[Closed] TreeView SceneManager
Hi all!
I’m new to MaxScritp and I’m trying to write a simple scenegraph editor using a the ActiveX treeview.
I starded from the basic tutorial in the max script reference guide and then I added more functionalities. Now I would like to make it possible to edit basic scene elements from the scenegraph.
The main features I’m trying to implement now are:
- drag and drop (to move node inside/outside groups and so forth)
- make the tree view autoupdate itself when it’s opened and I create new object (as reference take the “Render to Texture” bakable objects list, which is a .net control though)
The point is that I don’t have a clue on where to start from, particularly about the second feature.
Can you help me??
Thanks in advance!
Regards,
Adriano
As for the first part, I’ve not had much experience with activex drag’n’drop, so I’ll have to skip over it for now.
As for the second part. Getting the tree populated on opening shouldn’t be that hard – I assume you probably already have code to do it.
You simply need to create a “on [rollout] open do” event and put your startup code in there. It might also be a good idea to have a “on [rollout] close do” event as well, just to tidy up.
As for monitoring the scene, take a look at the “callbacks” system. You can register listeners for nodeCreated, nodeClonded, nodeHide/UnHide, NodePre/PostDelete and lots of other cool stuff.
Shane
Hi! Thanks a lot to both of you for your answers!
Unfortunately I solved the “autoupdate problem” today. I found out about the callbacks reading again the max script docs, but thanks anyway. Now I’m looking for the drag and drop feature, but I shouldn’t be too far from figure it out. Any help still appreciated though
Eric really thaaaaaanks so much for this advice! I really ignored that fact until now! Really thanks again!!!
Regards,
Adriano
If you are ever planning on running this script on a 64bit system, then drop ActiveX for .Net now. ActiveX is not support under Windows 64bit, where as .Net is supported by 32 and 64bit OSes.
-Eric
For drag&drop, see the Named Selection Sets editor in Max which was implemented in MAXScript. In Max 9 and 2008, it uses DotNet. In Max 8, it used ActiveX. So you should be able to get an idea how it is written by dissecting its source.
As mentioned already, learning the DotNet way of doing this would be a better idea. There is a conversion example in the MAXScript Reference that takes the ActiveX tutorial and converts it into DotNet. It is actually simpler to write DotNet controls, and they tend to be a lot more powerful.
Thanks for the drag&drop advice! I looked for something like what you suggested but I couldn’t find it (I’m not really familiar with Max).
About the “porting to .Net” tutorial, I’ve already found it, but after your consideration I’ll take it more seriously
Regards,
Adriano