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?
Chad On 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 -~----------~----~----~----~------~----~------~--~---
