help with script to hide objects based on rotation

hi there

I don't have much knowledge in scripting, but in my current project i needed
a script that set the object visibility key to 0 when it's rotation more than 86 - I have more than 1043 object by the way :) - anyway ....

I did my 1st ever script - which i think is a crap :) - and one of my friends helped me a little and I reached this stage :

for i in selection do
(slidertime=slidertime+1
r = i.rotation as eulerAngles
if r.x >= 71 then
(
animButtonState = true
slidertime=slidertime-1
i.visibility = true
slidertime=slidertime+1
i.visibility = false
animButtonState = false
)
)

but it didn't work will for me, and I couldn't figure what's wrong .

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Graph's picture

this should do

(
	local r = animationRange
	local sel = selection as array
 
	for t = r.start.frame to r.end.frame do for o in sel do with animate true at time t o.visibility = (o.transform.rotationpart as eulerangles).x >= 86
)

btw please use the [code][/code] brackets

Raphael Steves

ismail3d's picture

WOW all in one line :) thank

WOW

all in one line :)

thank you soooooooooooooooooooooooooooooo much .

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.