Notifications
Clear all

[Closed] animated hide&unhide work on viewport but not on render

If D1.ishidden Then
UnHide D1; Hide D2; Hide D3

with this position script code i animate the hide property and its work good on view port but when i render the scene it doesn’t work.

please help.

7 Replies

can you explain a little more ? isHidden is boolean and … Do you want to animate the visibility of some objects ?
why position script?

in the scene i setup i put a simple code in the the position script controller of an shape when the shape move along the y axis then a set of image plane start to hide and unhide to mimic like a human mouth…as u can see on my max file its animated and work good on viewport but on render the image plane does not hide and unhide…

I once had this problem and by baking the animation and … you can solve this problem but i can’t remember the exact solution

Here it is the remedy if you are in hurry just push slider one frame forward and render your scene and save it

sceneLastFramenumber = 80
frametobeginrender = 0   
for i = 1 to sceneLastFramenumber do
(
slidertime = frametobeginrender + i
yourfilename = "P_."
yourFile = ".jpg"
yourfilename= "C:\	est\\" + yourfilename + i as string + yourFile
RenderedImage = Render outputfile:yourfilename
close RenderedImage
)

I made a scene with the same problem i hope someone find it interesting and leave a reply
Here it is

obj1 = sphere radius:20 pos:[-50,0,0] wirecolor:red
obj2 = sphere radius:20 pos:[50,0,0]   wirecolor:blue
mover = point() 
fakeObj = circle radius:15
c = fakeObj.pos.controller.Z_Position.controller = float_script ()
c.addnode "D1" obj1
c.addnode "D2" obj2
c.addTarget "zpos"    mover.pos.controller.Z_Position.controller
sctxt  = "
if zpos<=50 then (UnHide D1; Hide D2)
if zpos>50 then (UnHide D2; Hide D1) 
0

"   
c.setexpression sctxt
c.update()
animate on 
(
at time 0    mover.pos.z=0
at time 40    mover.pos.z=150   
at time 80    mover.pos.z=0      
)

The problem is when you render a frame it shows the true scene of viewport at render and the animation changes but when you render the whole scene the animation will not render.

tnx for ur survival reply

The hidden property is not animatable. For render, you should use the visibility property.

It’s not easy to combine both in the same script as when you hide an object, it’s not taken into acount for render so its visibility doesn’t matter. Perhaps with prerender callbacks it can be done.
See this post where DenisT shows some solutions: http://forums.cgsociety.org/showthread.php?f=98&t=1400527&page=1&pp=15

Here’s a code that works for render but not for viewports in wireframe mode (it works in shaded mode):


delete objects

obj1 = sphere radius:20 pos:[-50,0,0] wirecolor:red
ctrl1 = obj1.visibility = float_script() 
obj1.visibility.controller = ctrl1

obj2 = sphere radius:20 pos:[50,0,0]   wirecolor:blue
ctrl2 = obj2.visibility = float_script() 
obj2.visibility.controller = ctrl2

mover = point()

ctrl1.addobject "zpos"    mover.pos.controller.Z_Position.controller
sctxt  = "if zpos.value<=50 then 1. else 0."
ctrl1.setexpression sctxt

ctrl2.addobject "zpos"    mover.pos.controller.Z_Position.controller
sctxt  = "if zpos.value<50 then 0. else 1."
ctrl2.setexpression sctxt

animate on
(
at time 0    mover.pos.z=0
at time 40    mover.pos.z=150
at time 80    mover.pos.z=0
)

Thanks so much for the reply.

Thanks for the link