PDA

View Full Version : Is it Possible to control a scripted Custom Attribute Parameter Via wiring ?


CGMATLAM
01-06-2009, 04:24 PM
Quick Question about Scripted Custom Attributes and wiring. I have been able to use a scripted custom attribute with a spinner UI to control a parameter, say the radius of a circle but I havent't been able to get it to work the other way around , and use the radius of the circle to control the scripted custom attribute. It seems to only work when the CA parameter is the master in the wiring.

I set up a simple test script where I have a boxes x position being = to a float Custom attribute parameter with a spinner UI .
The on Parameter set val do ( ) work fine via direct manipulation of the spinner interface for the parameter. The x position of the box is controlled by the spinner.

Actually when the Custom attribute parameter is wired with the sphere being the master, the spinner of the Parameter of the Scripted Custom attribute will change as the radius parameter of the sphere changes, but the commands that are contained in the
on Parameter set val do ( ) , will not execute , when the radius value of the sphere is changed. So the x position of the box does not change.

I have tried setting up the wire using the normal right click method and also using the scripted method and in both cases I can only get it to work in one direction with the Scripted custom attribute parameter controlling the sphere radius

Does the parameter wiring only work one way with scripted Custom Attributes.

Here is the code for the setup of the custom attribute and the wiring. You may recognize this from a previous post by Paule Neale on Scripted wiring. I have used it to make sure that I am getting the wiring code right since his script works perfectly. I have only added the set val section for controlling the X position of the box.


b=box()

s=sphere()

eM=emptyModifier()

addModifier b eM



def=attributes testAttrib

(



parameters testP rollout:testR

(

animationTrack type:#float UI:mySpinner

on animationTrack set val do

(

b.pos.x = val * 10

)

)



rollout testR "test"

(

spinner mySpinner "My Spinner"

)



)



custAttributes.add eM def



paramWire.connect eM.testAttrib[#animationTrack] s.baseObject[#radius] "animationTrack"



max modify mode

select b






If you run the above everything will work fine The boxes x position will be controlled by its animation track spinner , and the sphere radius will be controlled by the box animation track parameter spinner.

But if you then change the wiring so that the Custom attribute is being controlled by the
Sphere radius the Spinner of the Boxes Animation track parameter will update , but the box will not move in the position x.


Thank you.

marktsang
01-06-2009, 06:52 PM
you need to do a 2way wire -

see the tutorial on my old old site

www.marktsang.sitesled.com

CGMATLAM
01-06-2009, 09:36 PM
Just Saw Your Reply marktsang, Thank you.

So I tried the two way wire with the setup created in the Script below. But it did not work as desired. The Radius of the sphere was still controlled by the Scripted custom attribute spinner, but when I altered the radius parameter of the sphere the x position of the box did not change.

I could still manaully change the value of the Boxes custom attribute spinner to move the box but the effect I am looking for is to be able to use the radius spinner parameter to control the custom attribute spinner and in turn the position x of the box.

I will keep looking for a solution. Thank you for your reply.

Matthew

CGTalk Moderation
01-06-2009, 09:36 PM
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.