I got everything working and was wondering if this is possible
customNodeA.attr---connection---nodeB.attr
Retrieve the nodeB.attr value before the connection is made and store it in customNodeA within the customNodeA's compute function. Looking to do this within customNodeA so it can be turned off in "NodeState" and will use the default before the connection was even made.
Thanks
-brian
www.meljunky.com
-------- Original Message --------
Subject: [Maya-Python] Re: MFnCompoundAttribute and iterations of
compute
From: <[email protected]>
Date: Sat, November 07, 2009 11:11 pm
To: [email protected]
My output attribute is a weightList attribute much like the skinCluster's weightList attribute.The attribute affects is gradient a MFnCompoundAttribute:a...Node.attributeAffects( a...Node.midPoint, a...Node.gradient)
a...Node.attributeAffects( a...Node.slope, a...Node.gradient )For the output attribute:a...Node.attributeAffects( a...Node.midPoint, a...Node.weightList )
a...Node.attributeAffects( a...Node.slope, a...Node.weightList )a...Node.attributeAffects( a...Node.gradient_FloatValue, a...Node.weightList )If midPoint or slope is changed then I want the entire weightList updated. If only one, gradient_FloatValue is changed rather then the entire array then one weightList element should be updated. I could refresh the entire weightList, since speed will not be an issue.Just that the first plug to be marked dirty is gradient_FloatValue[2] and I would not know to mark the entire weightList dirty or just one. Unless I could tell how many of gradient elements is marked dirty on the first compute.I can see that dataBlock.inputArrayValue can handle all them elements when the plug is referencing ..g[2].gv. I am already using the dataBlock already to only retrieve a...Node.gradient but that is as far as I got with it. Marking them clean makes sense.-brianwww.meljunky.com-------- Original Message --------
Subject: [Maya-Python] Re: MFnCompoundAttribute and iterations of
compute
From: Chad Vernon <[email protected]>
Date: Sat, November 07, 2009 7:23 pm
To: [email protected]
If I'm understanding the question correctly, you could loop through all elements with inputArrayHandle, set each gv, and then set all the handles clean with MArrayDataHandle.setAllClean(), then compute is only called once. What is the output attribute and what is your attributeAffects attribute?
ChadOn Fri, Nov 6, 2009 at 6:33 PM, meljunky <[email protected]> wrote:
I created an array attribute of type MFnCompoundAttribute, called
'gradient' that has three child attributes:
value = OpenMaya.MFnNumericData.kFloat
position = OpenMaya.MFnNumericData.kFloat
interp =OpenMaya.MFnEnumAttribute
The MFnCompoundAttribute has the following set:
cAttr.setArray(1)
cAttr.setStorable(1)
cAttr.setUsesArrayDataBuilder(True)
I have two other attributes that affects the gradient attributes. The
compute function is called correctly whenever the two attributes
change.
The problem is in my test node, I created three elements [0,1,2], each
child attribute is called separately by the compute function.
Here are the different iterations from the compute (There are 9 loops
in the iteration):
...g[2].gv <---Child Attribute
...g[2].gp
...g[2].gi
...g[1].gv
...g[1].gp
...g[1].gi
...g[0].gv
...g[0].gp
...g[0].gi
I printed these values based off of: plug.partialName(True, True)
'gv' will derived its value from the two attributes and from 'gp'.
While 'gi' and 'gp' will remain constant the whole time. ( I am
creating gradientControl, so I need all three child attributes. 'gi'
and 'gp' will be set based off a command or a script)
Is it possible to have compute loop through 'gradient', only there
times by there element? That way I can use dataBlock.inputArrayValue
to find the two attributes, find the 'gp' value, and finally update
'gv' value.
Rather have:
..g[2]
..g[1]
..g[0]
Suppose I could ignore 'gp' and 'gi' with an 'if' statement, but I
would still need to determine the corresponding 'gp' value to update
the 'gv' value.
I would also need to know what element by index I am currently working
with.
There is no examples in the Maya python dev kit when it comes to
MFnCompoundAttribute.
Thanks,
-brian
www.meljunky.com
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---
