Feel free to rip the code out and purpose it however you need, or run the script once from anywhere and then you'll find it under Customize UI > Category: "VigTools"
@r_fletch_r: Needed to change it to node.max.z - node.min.z otherwise it must stand on the ground for it to get it´s real height.
I finally got some things working on my own, but there are some things i don´t understand and i can´t find a solution for it.
Is it possible to determine if something was selected or not?
And is it possible to change a value of a label if something is selected?(and if it´s possible to change that value in realtime in case the selected object changes?)
it´s not that i can´t change the text of a label(and the property is caption).
The problem is, that i have to click on a button to update the value, but i want it to change if i select an object, change it for example.
this "for obj in selection do" what happens if i run the script and nothing is selected?
My problem is, that i don´t want to have a error message saying something like "xyz only works if something is selected"
the selection is empty so nothing happens. selection allways exists so it wont throw and error.
So far as updating a label when the selection changes, You can add a timer to your rollout. in its tick event put the update code. it helps to check for a change before updating the UI. if you dont you get some flicker
Ok works good so far
But i used callbacks for it, unfortunately i couldn´t find a callback for changing the mesh, but atm the one for selecting is enough.
Now i need to look into selection/recursion and stuff and i can do some fancy stuff(hopefully, if not I have to look into the C++ Api which i want to avoid if possible )
Have you looked into Epheres C# SDK for max, its a bit of an easy path to go down than the C++ route, especially considering the plugins refresh with max without any need to restart the app.
Replies
"Pivot to World Zero"
http://dl.dropbox.com/u/2336353/SceneClean.ms
Feel free to rip the code out and purpose it however you need, or run the script once from anywhere and then you'll find it under Customize UI > Category: "VigTools"
ResetPivot $
for i in selection do
(
i.pivot = [i.pivot.x, i.pivot.y, i.min.z]
)
$.pos = [0,0,0]
)
I finally got some things working on my own, but there are some things i don´t understand and i can´t find a solution for it.
Is it possible to determine if something was selected or not?
And is it possible to change a value of a label if something is selected?(and if it´s possible to change that value in realtime in case the selected object changes?)
To work on selected objects you use the 'selection' collection
so
That code will loop through the whole selection, pulling out a node at a time and letting you work with it.
If you want to tell if a node is in the selection collection then I use findItem which returns the nodes index in the selection or 0 if its not in it.
I think the property you want for labels is .text
The problem is, that i have to click on a button to update the value, but i want it to change if i select an object, change it for example.
this "for obj in selection do" what happens if i run the script and nothing is selected?
My problem is, that i don´t want to have a error message saying something like "xyz only works if something is selected"
So far as updating a label when the selection changes, You can add a timer to your rollout. in its tick event put the update code. it helps to check for a change before updating the UI. if you dont you get some flicker
But i used callbacks for it, unfortunately i couldn´t find a callback for changing the mesh, but atm the one for selecting is enough.
Now i need to look into selection/recursion and stuff and i can do some fancy stuff(hopefully, if not I have to look into the C++ Api which i want to avoid if possible )
Have you looked into Epheres C# SDK for max, its a bit of an easy path to go down than the C++ route, especially considering the plugins refresh with max without any need to restart the app.