Unhide from Left to right

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 11 November 2010   #1
Unhide from Left to right

I have a script that will unhide objects randomly but What I would really like is to unhide based on an objects X, any ideas?

Here is my current script


for o in selection do
(
myNum = random 0 270 --frames
my2ndNum = random myNum myNum+5 --length of unhide
myX = o.pos.x
o.visibility = bezier_float() -- Track View: Add Visibility Track
addNewKey o.visibility.controller myNum #select
addNewKey o.visibility.controller my2ndNum #select
o.visibility.controller.keys[1].value = 0
o.visibility.controller.keys[2].value = 1
)


Thanks in advance!
__________________
www.davetyner.com
 
Old 11 November 2010   #2
Collect the objects to reveal into an array.
Collect the positions' X component (or whatever axis you want) in another array.
Collect the indices of the objects into yet another array.
Perform indexed sort using qsort (see help).
Set keys in the order defined by the index array.
Done.

Alternatively, use the distance from a given point in space to your objects for the sorting. This will produce a radial reveal if they are not in a row but spread around randomly.
__________________
Bobo
 
Old 11 November 2010   #3
Like Bobo said,

Distance can be used quite simply, distance from world origin:

fn sortDist v1 v2 = if distance v1.pos [0,0,0] > distance v2.pos [0,0,0] then 1 else -1
sel = selection as array
qsort sel sortDist


-Johan
__________________
Online: LinkedIn
 
Old 11 November 2010   #4
Perfect! Thanks Bobo and JHN!
__________________
www.davetyner.com
 
Old 11 November 2010   #5
Hey guys, now as part of this script I am trying to get the z value of the xform modifier. I can get the [x,y,z] values with

for o in sel do (
			addModifier o (XForm ())
			select o
			m = -((getModContextBBoxMin o o.xform) - (getModContextBBoxMax o o.xform))
			b = m * o.xform.gizmo.scale
			print b
			)


I was wondering if there was an easy way to get just the z?

Thanks!
__________________
www.davetyner.com
 
Old 11 November 2010   #6
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.
 
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 01:22 PM.


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