[Closed] New Maxscripter/Help please
Hi all,
I’ve finally taken the plunge into maxscripting, has been quite fun going through the tutorials. I thought I’d try something practical, and I’m a little stuck.
Basically I’m trying to create a button to select all bones and then hide them and another button to unhide them, after scrounging around I managed this.
setselectfilter 8
Max select all
hide selection
However, I lose the ability to then select anything else!!!
I know I can easily use the filters but I was just trying something practical in maxscript.
Any help appreciated!
Thanks
After you’ve selected the bones you could then just rest the filter back to what it was
Thanks, was just wondering if that was the best way to do it.
I guess if it works though it should be good!
Check out this code
rollout rl_boneTool "Hide/Unhide Bones" width:90 height:60
(
button btn_hide "Hide Bones" width:80 height:24 pos:[4,4]
button btn_unhide "Unhide Bones" width:80 height:24 pos:[4,30]
on btn_hide pressed do for o in geometry where (classOf o == BoneObj or classOf o == Biped_Object) do hide o -- hide bones and biped obj
on btn_unhide pressed do for o in geometry where (classOf o == BoneObj or classOf o == Biped_Object) do unhide o -- unhide bones and biped obj
)
createDialog rl_boneTool
This two loops go thru all geometry and hide or unhide bones and biped objects
for o in geometry where (classOf o == BoneObj or classOf o == Biped_Object) do hide o -- hide bones and biped obj
for o in geometry where (classOf o == BoneObj or classOf o == Biped_Object) do unhide o -- unhide bones and biped obj
we’ve discussed on this forum many times why it’s better to collect a set of objects and hide/select/freeze/etc. the set of objects than do it by item…
Hi Denis,
Thank you for advice :). If I right understood you then script wrote this way will work better
rollout rl_boneTool "Hide/Unhide Bones" width:90 height:60
(
button btn_hide "Hide Bones" width:80 height:24 pos:[4,4]
button btn_unhide "Unhide Bones" width:80 height:24 pos:[4,30]
local sceneBones;
on btn_hide pressed do
(
sceneBones = for o in geometry where (classOf o == BoneObj or classOf o == Biped_Object) collect o
hide sceneBones
)
on btn_unhide pressed do if sceneBones != undefined then unhide sceneBones
)
createDialog rl_boneTool
Wow, thanks Lucpet! Thats really helpful, a great practical way to see another way to accomplish this example!
Much appreciated, I have learnt alot just from researching the things you use in your code!
Thank you!
don’t thank me I barely know what I’m doing lol
anything DenisT’s posts is what you should study.
Lol, I meant thanks to Arahnoid, not that I didn’t appreciate your input too I mean it did work.
Cool will do i will check out Dens scripts.
Thanks all!
lol I thought so
Here do yourself a favour, save your pennies, and get these
http://www.cg-academy.net/es_catalog/product_info.php?products_id=46
yes. the code is better.
the max sends less messages (notifications) when does do any operation with group of objects than it does the same with every object from the list. so the multi-object operation is faster.