PDA

View Full Version : Array Attributes???


kakle
02-28-2008, 07:48 AM
ok im very very new to API but i'm making a node that excepts an array of plugs (in my case it will be vertices from an object(but only the selected ones)). I was wondering if anyone could give me a example of an array attributes as an input, in python, just a simple one would be perfect so i can try to reverse engineer it, or an explanation if you would not mind. Thank you for any help.

strarup
03-05-2008, 07:43 AM
Hi Kakle,


eh... could you e.g. specify it a bit more... e.g. what do you wanna use it for... what kind of operation do you want...

kind regards

Strarup

kakle
03-05-2008, 10:44 PM
im sorry i was a touch vague, since then, through heaps of trouble shooting and pain i was able to semi understand how they work. i was trying to iterate over selected components... i found that sets/groupparts is wat i need to have as inputs(groupid and outputGeometry). do you know how i can get the data to world space though? i think i need to use transformation matrix, but how does it work with a mfnMesh?

below is how i got it workin, But im not confident its the best workflow.

numAttr = OpenMaya.MFnGenericAttribute()
aimNode.INPUTgeo= numAttr.create("inputShape", "inG")
numAttr.addDataAccept(OpenMaya.MFnData.kPluginGeometry)
numAttr.setArray(True)
numAttr.setReadable(True)
numAttr.setUsesArrayDataBuilder(True)
numAttr.setStorable(1)

dataHandleGEOarray = dataBlock.inputArrayValue(aimNode.INPUTgeo)
for i in range(0,int(dataHandleGEOarray.elementCount()),1):
dataHandleGEOarray.jumpToElement(i)
temp=OpenMaya.MDataHandle()
temp=dataHandleGEOarray.inputValue()
try:
geomIter=OpenMaya.MItGeometry( temp, GRPIDV[i], 1)
count=0
while geomIter.isDone() == False:
point = geomIter.position()
inputComponentPOSarray.append((point.x,point.y,point.z))
count+=1
geomIter.next()
except:
print sys.exc_info()
print temp.type()

strarup
03-12-2008, 09:37 PM
unfortunately I don't know that much about python yet...
so I'm not that much of a help in this case...

hopefully some with more python understanding can help you with your problem... :)

kind regards

Strarup

CGTalk Moderation
03-12-2008, 09:37 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.