Access Range of parameter on CA?

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
  10 October 2012
Access Range of spinner on CA?

How can I access the range of a spinner's parameters in a custom attribute that I haven't scripted myself?
I thought this would be dead easy, but I can't get to the spinner's name in any usable generated code.

Last edited by floatingworld : 10 October 2012 at 11:50 AM.
 
  10 October 2012
I did this a few days ago with the value property.

You could use custAttributes.getDefSource <attrib_def> to see the code. Then access the range with CA.RolloutName.SpinnerName.range
__________________
Juan Martinez | Blog | Animator
 
  10 October 2012
Originally Posted by martinez: I did this a few days ago with the value property.

You could use custAttributes.getDefSource <attrib_def> to see the code. Then access the range with CA.RolloutName.SpinnerName.range

Yep. Something like this if you use EmptyModifier to store CA

Attr = custAttributes.getDef $.modifiers[1] 1
Attr.source
__________________
Looking in the right side. [bgaTools]
 
  10 October 2012
If you are accessing a definition that was written using the Attribute Editor it will store creation information about the definition in defData. That data will hold values like the range of a spinner since you can't access that via the parameter.
__________________
Paul Neale
http://paulneale.com
 
  10 October 2012
there is a puzzle. let's say you have only source of scripted CA. We don't know the name of the spinner. how to find it in the source?
 
  10 October 2012
Well in my case the spinner was labeled "IK-FK Blend" so I just searched for that in the source. But I guess you could do this on the rollout:


roll = myRollout

for i = 1 to roll.controls.count do
(
	--SEEMS TO CRASH ON GROUP CONTROLS
	try
	(
		format "%: %\n" (roll.controls[i].caption) (roll.controls[i].name)
	)
	catch()
)
__________________
Juan Martinez | Blog | Animator
 
  10 October 2012
I don't know if it helps but I had something similar to do a few weeks ago and I parsed the CA defSource string to find the items array of a dropdownlist.

I didn't find any other solution to that and wait to see more efficient ways to do it .

AFAIK, you can find some useful props of the CA with "getPBlockDefs", like default value, but not all options of the CA parameters.

I hope someone will make me wrong .
 
  10 October 2012
The problem I have with all these methods like parsing is that they require visual inspection.I need a completely coded soultion
 
  10 October 2012
I don't know if this works in every situation, but it seems to work in all the ones I encounter:


  Attr = custAttributes.getDef $.modifiers[1] 1
	arrayd =custAttributes.getPBlockDefs Attr
	caname =  Attr.name  ;
	rolloutname =   arrayd[1][4][2]  as string;
	for j = 5 to arrayd[1].count do (
	paramername = arrayd[1][j][2][4][1] as string;
 
	range = execute( "$.modifiers[1]."+caname+"."+rolloutname+"."+paramername+".range")
	print range[1];
	print range[2]
 


Basically it's Branco's method made explicit.I'd be interested if anyone finds that this fails sometimes. Does this solve yr puzzle denis?

Last edited by floatingworld : 10 October 2012 at 06:03 AM.
 
  10 October 2012
Seems better than source parsing, indeed.
And it does not require to know parameters name in advance, like you said before.
Thank you
 
  10 October 2012
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 11:05 AM.


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