ScriptSpot

Forum topic · Scripts Wanted

Hide / Show bones

By titane357 · 2013-06-20

Description

Hello
I would like to show/hide bones by a toggle.
I found different scripts, but in max2014, these script can show bones but can't hide bones even with a redraw fonction ???
Anybody can help ?

Comments (9)

citizenWOLF · 2021-02-23

this is working for me as toggle. Change category and names by your needs.


macroScript BonesToggle category:"Test" toolTip:"BonesToggle" (
if hideByCategory.bones == true then ( hideByCategory.bones = false)
else (hideByCategory.bones = true)
)

titane357 · 2013-06-20

Thanks Barigazy, I found :
hideByCategory.bones = (not hideByCategory.bones)
it works on bones but not on bipedobjects...
strangely, "hide category" "Bone Object" is switched "on" by the script, but biped objects not hidden...

barigazy · 2013-06-20


hideByCategory.bones = (not hideByCategory.bones) 

Code above not works in max2014 even if you force view redrawing.

titane357 · 2013-06-21

Thanks very much Barigazy, it works.
As I really want a shortcut : i'll keep ( one with "on" and another "off" )=
-------
fn collectClasses optArr:#(cb_bone,cb_bip,cb_cat,cb_hub) =
(
for c in 1 to optArr.count collect
(
case c of
(
(1): BoneGeometry
(2): Biped_Object
(3): CATBone
(4): HubObject
)
)
)
fn hide_unhide_Skeleton state: =
(
local skeletonClasses = collectClasses()
(for b in geometry where findItem skeletonClasses (classof b.baseobject) != 0 collect b).ishidden = state
)
hide_unhide_Skeleton state:on
-------------------------

I'd be better with a switch ;-)

barigazy · 2013-06-21

But how you can chack which option ei sceleton type you want to consider in process?

titane357 · 2013-06-21

for now, I just need to hide/show bones or biped objects...
So nevermind if I can't choose for the moment.
Very annoying that in max you can toogle visibility for shape, geometry, light,... but not bones with shortcut...
So, your script is enough for me at the moment. Thanks.

barigazy · 2013-06-20

Or if you want to no loop trough all scene objects then use simply

(for b in geometry where isKindof b.baseobject BoneGeometry collect b).ishidden = on
(for b in geometry where isKindof b.baseobject BoneGeometry collect b).ishidden = off

barigazy · 2013-06-20

Can you try this

--to hide bones
(for b in objects where isKindof b.baseobject BoneGeometry collect b).ishidden = on
--to unhide
(for b in objects where isKindof b.baseobject BoneGeometry collect b).ishidden = off