Hide-unhide objects sequence

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 09 September 2010   #1
Hide-unhide objects sequence

Hi i'm new on scripting and i'm trying to create a script on phyton to show just one object on each frame:

Thats what i have so far:


for i in range(10): #Number of frames
Application.SetKey("cube-%d.visibility.rendvis" %(i+1), (i+2), 0, "")
Application.SetKey("cube-%d.visibility.rendvis" %(i+1), (i+1), 1,"")
Application.SetKey("cube-%d.visibility.rendvis" %(i+1), (i), 0, "")
Application.SetKey("cube-%d.visibility.viewvis" %(i+1), (i+2), 0, "")
Application.SetKey("cube-%d.visibility.viewvis" %(i+1), (i+1), 1,"")
Application.SetKey("cube-%d.visibility.viewvis" %(i+1), (i), 0, "")

print "Finished"

Could anyone give me some advice?
 
Old 09 September 2010   #2
A couple more details wouldn't go amiss
Do you have N objects and you wish only one to be showing for each frame across as many frames as you have objects? Or something else?

Assuming the above, and that the order of selection is what you want for the showing/not showing, try something like this:

startFrame = 10

for objIndex, eachObject in enumerate(Application.Selection):
	parViewVis = eachObject.Properties("visibility").Parameters("viewvis")
	Application.SaveKey(parViewVis, startFrame + objIndex -1 , False)
	Application.SaveKey(parViewVis, startFrame + objIndex, True)
	Application.SaveKey(parViewVis, startFrame + objIndex +1 , False)

Not 100% ideal as there's better object oriented options to create animation, but at least this should read easily enough for a neophyte.
__________________
Come, Join the Cult http://www.cultofrig.com - Rigging from First Principles
 
Old 09 September 2010   #3
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 05:26 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.