array path to controller

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 02 February 2013   #1
array path to controller

Say for example I have an array that contains the numbers which represent a subAnim controller path.
I'm trying to build a function that would return the controller and node's complete path.
How could I build a variable which would allow me to directly get to that controller.

example:

m = returnSubAnim $Teapot #(3,1,1)
print m
--printed "$Teapot[1][1]"


Working code, but I'm not a fan of execute

fn returnSubAnim obj arr =
(
	local str = "$"+obj.name
	for i in 1 to arr.count do append str ("[" + arr[i] as string + "]")
	execute str
)
tea = teapot()
subIndexes = #(3,1,1)

clearlistener()
m = (returnSubAnim tea subIndexes)

m.value = 10
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com

Last edited by JokerMartini : 02 February 2013 at 10:07 PM.
 
Old 02 February 2013   #2
Originally Posted by JokerMartini: Say for example I have an array that contains the numbers which represent a subAnim controller path.
I'm trying to build a function that would return the controller and node's complete path.
How could I build a variable which would allow me to directly get to that controller.

example:

 m = returnSubAnim $Teapot #(3,1,1)
 print m
 --printed "$Teapot[1][1]"
 


Working code, but I'm not a fan of execute

 fn returnSubAnim obj arr =
 (
 	local str = "$"+obj.name
 	for i in 1 to arr.count do append str ("[" + arr[i] as string + "]")
 	execute str
 )
 tea = teapot()
 subIndexes = #(3,1,1)
 
 clearlistener()
 m = (returnSubAnim tea subIndexes)
 
 m.value = 10
 
 

You can use also

fn returnSubAnim obj arr val: =
(
	local str = "$"+obj.name
	for i in 1 to arr.count do append str ("[" + arr[i] as string + "]")
	m = execute str
	if val != unsupplied do m.value = val
)
tea = teapot()
subIndexes = #(3,1,1)
returnSubAnim tea subIndexes val:100
__________________
Looking in the right side. [bgaTools]
 
Old 02 February 2013   #3
Quote: Working code, but I'm not a fan of execute


Yes I never feel comfortable using it. I've never understood why the scope has to be global. Why can't it just be in the scope of the code where it's executed?

Cg.
__________________
Not bad. For a hughman.
 
Old 02 February 2013   #4
seems like no matter what the execute will have to be used. I'm going to keep searching around.
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 02 February 2013   #5
Originally Posted by JokerMartini: seems like no matter what the execute will have to be used. I'm going to keep searching around.

what do you know about exprForMAXObject?
 
Old 03 March 2013   #6
I know that it is awesome ! and life saver at times
__________________
Felipe Nogueira aka: PePeTD
Technical Artist/Character TD
http://felipenogueira3d.com
 
Old 03 March 2013   #7
I've never heard of that. It seems rather awesome!
Thank you for sharing that!
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 03 March 2013   #8
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 09:02 PM.


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