Problem giving input connection to the per-particle attributes via custom nodes

Problem giving input connection to the per-particle attributes via custom nodes

Anonymous
Not applicable
658 Views
5 Replies
Message 1 of 6

Problem giving input connection to the per-particle attributes via custom nodes

Anonymous
Not applicable
I have written custom node, which generates positions for particles as vector array. Now I want to connect this output to the per particle position attribute but its not happening. Is that any other way to give a input for per particle attributes ? please help me out , thanks
0 Likes
659 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
Take a look at MPxParticleAttributeMapperNode
0 Likes
Message 3 of 6

andrea_pinto82
Advocate
Advocate

I am trying to make an arraymapper with pyhton.

 

class arrayMapperCustom(OpenMayaMPx.MPxParticleAttributeMapperNode):
	# class variables
	outPositionPP = OpenMaya.MObject()
	def __init__(self):
		OpenMayaMPx.MPxParticleAttributeMapperNode.__init__(self)
​

 

 
when I create the node there are not errors.
but when I try to connect the attributes I have this warning. Why?
 
connectAttr -f arrayMapperCustom1.outPosition nParticleShape1.userVector1PP;
// Warning: line 1: Connection from arrayMapperCustom1.outPosition ---> nParticleShape1.userVector1PP was not allowed. You can only connect to a per-particle attribute from another per-particle attribute on the same shape or from an arrayMapper or particleAgeMapper node. This may cause subsequent connections to fail during duplication with the "-ic" flag. //
// Error: line 1: Connection not made: 'arrayMapperCustom1.outPosition' -> 'nParticleShape1.userVector1PP'. Destination node will not allow the connection. //
// Error: line 1: The attribute 'arrayMapperCustom1.outPosition' cannot be connected to 'nParticleShape1.userVector1PP'. //
0 Likes
Message 4 of 6

andrea_pinto82
Advocate
Advocate

sorry, I had wrote wrong the registernode.

Now it is works

 

mplugin.registerNode( kPluginNodeTypeName, arrayMapperCustomId, nodeCreator, nodeInitializer, OpenMayaMPx.MPxNode.kParticleAttributeMapperNode )

 

Message 5 of 6

andrea_pinto82
Advocate
Advocate

Hi, I have a problem with the class attribute "computeNode"

arrayMapperCustom.attributeAffects( arrayMapperCustom.computeNode, arrayMapperCustom.outPositionPP)

 

this is the error when I load the plugin

# Traceback (most recent call last):
# File "/Applications/Autodesk/maya2020/Maya.app/Contents/MacOS/plug-ins/arrayMapperCustom.py", line 156, in nodeInitializer
# arrayMapperCustom.attributeAffects( arrayMapperCustom.computeNode, arrayMapperCustom.outPositionPP)
# TypeError: in method 'MPxNode_attributeAffects', argument 1 of type 'MObject const &' // 
// Warning: file: /Applications/Autodesk/maya2020/Maya.app/Contents/scripts/others/pluginWin.mel line 317: Failed to call script creator function //

 

Where am i doing wrong? Any ideas?

thanks 

 

0 Likes
Message 6 of 6

andrea_pinto82
Advocate
Advocate

I found it, sorry for my newbie ignorant questions. 🙂

computeNode = OpenMayaMPx.cvar.MPxParticleAttributeMapperNode_computeNode

 

0 Likes