BluEgo
Hi, I am new here, so first of all thank you for all your great contribute to the maya API scene.

It's a while now I am trying to learn how to write maya plugins, and now I would like to write a basic feather system, just for fun and to improve my understanding of maya api.
For now I wrote my own scatter node, which generates patterns also in a poisson disc style.

So I am trying to start writing something similar to your awesome arrayToDynArray, to have some feedback with the current maya instancer (even if I would like to replace it eventually).

With MFnArrayAttrsData function set I read the list of arrays included in the attribute "myInstancer.inputPositions".
Now the problem is that I really didn't understood pretty well what kind of attribute I should declare as output attr in the initializer method.
So, my code looks like this now:

def nodeScatterToInstancerInitializer():

        typedAttr = OpenMaya.MFnTypedAttribute()

        # INPUT Attrs
        scatterToInstancer.inputPositionPP = typedAttr.create("inPositionPP", "inPos", OpenMaya.MFnVectorArrayData.kVectorArray)
        typedAttr.setHidden(False)
        typedAttr.setKeyable(True)
        typedAttr.setInternal(True)
        scatterToInstancer.addAttribute(scatterToInstancer.inputPositionPP)
       
       
        # OUTPUT Attrs
        scatterToInstancer.outputValue = typedAttr.create("outValue", "out", OpenMaya.MFnArrayAttrsData.kDynArrayAttrsData  )
        typedAttr.setKeyable(False)
        typedAttr.setStorable(False)
        typedAttr.setHidden(False)
        typedAttr.setReadable(True)
        scatterToInstancer.addAttribute(scatterToInstancer.outputValue)
       
        # ATTRIBUTE AFFECTS
        scatterToInstancer.attributeAffects(scatterToInstancer.inputPositionPP,scatterToInstancer.outputValue)


... but my outputValue doesn't succeed to initialize. So, what kind of output attribute I should declare if I am going to handle it with MFnArrayAttrsData?

Thank you for all the help you could give me.
BluEgo
...or, to put it in other words, how should I declare/create an attribute in the initializer which the MEL type is "newParticles" ?
Reply 0 0
BluEgo
... unbelievable, I spent one day reading docs to try to understand why this didn't worked as I expected, and then it was because of a stupid error: I wrote kDynArrayAttrsData instead of simply  kDynArrayAttrs :S

scatterToInstancer.outputValue = typedAttr.create("outValue", "out", OpenMaya.MFnArrayAttrsData.kDynArrayAttrsData  )
Reply 0 0
pshipkov
Glad you figured it out.
Sorry for the late response.

Reply 0 0
BluEgo
Thank you  pshipkov.
Sorry again for the stupid question :S
Reply 0 0
pshipkov
No worries.

Reply 0 0
Reply