After looking through the dotnet SDK, there are a few interesting classes available and I would strongly urge anyone to have a look. (If you want to integrate them in an external class library, you will have to reference them in your VS project)
For example, there is a csharputilities.synchronizingbackgroundworker thread class that is supposed to keep better track of the worker thread than the backgroundworker class. I had a few intermittent errors using BackgroundWorker in 3dsmax which i am hoping was down to this. My initial tests with my dynamic thumbnail cache seem to be working fine in max.
there is also a method of using dotnet to create a timechange callback which i found interesting, potentially for developing tools that interface with max.
The main (visual!) difference of using the maxform class over windows.form is that the UI will automatically be set to the background ui of 3dsMax. In a windows.form you will have to use colorman and convert it to a dotnet colour value in order to match it.
so thanks for the nudge, Yannick!
p.s. is there any additions in the max 2009 dotnet SDK over the 2008 one?
There’s no difference between them. I hope they will add new classes and methods in future releases.
Thanks a lot for pointing the others interesting classes and methods, Pete!
no worries yannick, it was your site that got me started on this in the first place, so thanks.
I just had a quick look and I noticed that CsharpUtilities has added stringutilities and setclass. hmmm not sure about setclass, I assumed was a sort of equivalent of the cast operator???
In fact Set is a container class (like Collection, List, Dictionnary etc…). We can’t use it in MAXScript because we don’t have generics mechanism.
I think these 2 new classes in Max 2009 were added with the update of the SceneExplorer.
As far as I know, SceneExplorer is the only built-in plugin using .NET in 3ds Max. So the .NET SDK is updated with the needs of the SceneExplorer.
I see. I think pretty much most of the dotnet SDK are classes for the scene explorer!
Hi guys, here’s an update with some minor changes, created a new treenode class with some new properties like dirName, files and thumbs. I think it’s pretty straightforward so I’ll just post an updated example here.
(
dotnet.LoadAssembly @"$scripts\KClasses.dll"
-- Create Form
local hForm = dotNetObject "MaxCustomControls.MaxForm"
hForm.Size = dotNetObject "System.Drawing.Size" 1024 768
hForm.FormBorderStyle = (dotnetclass "System.Windows.Forms.FormBorderStyle").FixedToolWindow
hForm.Text = "KClasses Example"
hForm.ShowInTaskbar = False
local tvFolders = dotnetobject "KClasses.dnFolders"
tvFolders.Dock = (dotnetclass "System.Windows.Forms.DockStyle").Left
tvFolders.Size = dotNetObject "System.Drawing.Size" 200 350
tvFolders.ProcessTree(@"c:\KClasses_Test")
local flThumbs = dotnetobject "KClasses.dnThumbs"
flThumbs.Dock = (dotnetclass "System.Windows.Forms.DockStyle").Fill
flThumbs.AutoScroll=True
hform.controls.add(flThumbs)
hform.Controls.Add(tvFolders)
fn tvFolders_MouseDown sender eb =
(
hittest= tvFolders.Hittest(eb.location)
if hittest.location==(dotnetclass "System.Windows.Forms.TreeViewHitTestLocations").Label then
(
start=timestamp()
flThumbs.Controls.Clear()
tvFolders.ProcessFiles(eb.node)
tvFolders.ProcessThumbs(eb.node)
flThumbs.CreateThumbs eb.node.thumbs eb.node.files
end=timestamp()
format "Processing took % seconds
" ((end - start) / 1000.0)
)
)
dotnet.addEventHandler tvFolders "NodeMouseClick" tvFolders_MouseDown
hForm.ShowModeless()
)
Hi guys, it’s been a while since I’ve touched this project… but I had a request to add a feature minding the filetypes available in the dnFolders class, so I’ve changed and now you have to options:
tvFolders.ProcessFiles eb.node undefined – this will work as it used to, using the default extensions, jpg, tga ,tif, hdr, max
tvFolders.ProcessFiles eb.node #(“.jpg”,”.tga”) – this way you define the extensions you need inside an array and you’re done.
Here’s the example script updated:
(
dotnet.LoadAssembly @"$scripts\KClasses.dll"
-- Create Form
local hForm = dotNetObject "MaxCustomControls.MaxForm"
hForm.Size = dotNetObject "System.Drawing.Size" 1024 768
hForm.FormBorderStyle = (dotnetclass "System.Windows.Forms.FormBorderStyle").FixedToolWindow
hForm.Text = "KClasses Example"
hForm.ShowInTaskbar = False
local tvFolders = dotnetobject "KClasses.dnFolders"
tvFolders.Dock = (dotnetclass "System.Windows.Forms.DockStyle").Left
tvFolders.Size = dotNetObject "System.Drawing.Size" 200 350
tvFolders.ProcessTree(@"c:\KClasses_Test")
local flThumbs = dotnetobject "KClasses.dnThumbs"
flThumbs.Dock = (dotnetclass "System.Windows.Forms.DockStyle").Fill
flThumbs.AutoScroll=True
hform.controls.add(flThumbs)
hform.Controls.Add(tvFolders)
fn tvFolders_MouseDown sender eb =
(
hittest= tvFolders.Hittest(eb.location)
if hittest.location==(dotnetclass "System.Windows.Forms.TreeViewHitTestLocations").Label then
(
start=timestamp()
flThumbs.Controls.Clear()
t--tvFolders.ProcessFiles eb.node undefined
tvFolders.ProcessFiles eb.node #("*.jpg","*.tga")
tvFolders.ProcessThumbs eb.node
flThumbs.CreateThumbs eb.node
end=timestamp()
format "Processing took % seconds
" ((end - start) / 1000.0)
)
)
dotnet.addEventHandler tvFolders "NodeMouseClick" tvFolders_MouseDown
hForm.ShowModeless()
)
I’m just updating this post with the latest compile of the KClasses, it’s been a long time since I’ve touched this and I think it’s about time
Here’s the examples of the new classes:
(
dotnet.loadassembly @"C:\KClasses.dll"
dnGet=dotnetObject "KClasses.DnGetDiskFreeSpaceEx"
dnGet.dnGetDiskFreeSpace @"\\yourserver\shared\"
print (((dnGet.freeBytes / 1024) / 1024) / 1024)
)
(
dotnet.loadAssembly @"C:\KClasses.dll"
local NPrinter= dotnetobject "KClasses.dnNetworkPrintFile"
NPrinter.printit @"c: est.txt" @"\\printer\sharename"
)
(
dotnet.loadAssembly @"C:\KClasses.dll"
local KPlayer = dotnetobject "KClasses.dnMIDI"
rollout plMIDI "You can DO IT!"
(
button btnStop "Stop playing!"
on btnStop pressed do
(
KPlayer.StopMIDI()
destroyDialog plMIDI
)
)
createdialog plMIDI
KPlayer.PlayMIDI "C:\smiths_thereisalight.mid"
)
Hi Kameleon!
Great classes, thanks!
@LoneRobot:
I asked for generic class generation some days ago and it seems to be possible!
http://forums.cgsociety.org/showthread.php?f=98&t=854696
Hello all,
I’m pretty novice with this stuff but I’m having a lot of fun combining many of your examples. I’m creating a asset browser/creator that uses LoneRobot’s HitchHiker assembly inside a tabControl that I learned from Pen’s tutorial.
At the moment, I have the hitchhiker end working and I understand how to get what I want out of it. What I would love to do is use dnFolders in my rollout to send the eb.node.dirName to HitchHiker.populate.
I’m completely unfamiliar with MaxForms and for the time being would like to continue with my good ol rollouts and buttons with a little dotnet over the top.
Is it possible to use this assembly in a rollout? as a rollout clause? or some other way
Is it possible (and advised) to use MaxForms in a rollout? it seems that they take the place of old rollouts entirely.
any tips will be appreciated. I’ll share my mess when I get it cleaned up a bit and have a presentable UI.