in that case, in your draw method you want to get an MPlug to your
attribute and do something with the value, like setColor for your
customLocator.

check out swissArmyManip.py in mayainstall/devkit/plug-ins/scripted

-cheers
Damon Shelton


On Fri, Oct 19, 2012 at 2:32 PM, mkarlsson <[email protected]
> wrote:

> Thank you for replying.
>
> I did try what you described - for
> example: mkJointLocator.attributeAffects(mkJointLocator.aColor,
> mkJointLocator.aFakedOutput)
>
> ...where mkJointLocator.aFakedOutput is just an attribute to get the
> compute() method to be invoked.
>
> What I find weird is that Maya did not invoke the compute() method unless
> I connected the aFakedOutput attribute to aFakedInput attribute. It's as
> if aFakedOutput has to plausibly affect something for Maya to invoke
> compute()
>
> Am I missing something here?
>
> Ultimately I'm not looking to change any output attribute - I'm just
> looking for attribute changes that has an effect on how the [custom
> Locator] node in question should be rendered (color, alpha, etc)
>
> I have it working - but it seems like the code "smells bad" if you know
> what I mean :)
>
>
> On Friday, October 19, 2012 9:30:48 AM UTC-7, damonshelton wrote:
>
>> Hey Martin,
>> When you create a plugin, as your adding the attributes you can set which
>> attribute change affects which output attribute, etc.. Setting your keyable
>> attribute to attributeAffects(output attr) then when it changes it can
>> trigger the compute function.
>> Once the compute function is triggered you can run your information from
>> there and call other functions, etc...
>>
>> inside the compute function you can specify
>> if plug == keyableattributeyouwant:
>>     dostuff()
>>
>>
>> On Tue, Oct 16, 2012 at 5:02 PM, mkarlsson <martin.rola...@gmail.**com>wrote:
>>
>>> Would someone please point me to an example where a custom node [Python
>>> plugin] has a keyable attribute and that has code that executes anytime
>>> that attribute is changed?
>>>
>>> I'm used to getter and setter functions where you can be very explicit
>>> about what code to execute depending on what change occurs - and I've not
>>> been able to find an example of this yet.
>>>
>>> Thank you!
>>>
>>> --
>>> view archives: 
>>> http://groups.google.com/**group/python_inside_maya<http://groups.google.com/group/python_inside_maya>
>>> change your subscription settings: http://groups.google.com/**
>>> group/python_inside_maya/**subscribe<http://groups.google.com/group/python_inside_maya/subscribe>
>>>
>>
>>  --
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings:
> http://groups.google.com/group/python_inside_maya/subscribe
>

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to