[XPresso] How to add numeric data from an In-/Exclusion Userdata?
-
Hi,
I have a
Null Object
with anIn-/Exclusion Userdata
attached. InIn-/Exclusion Userdata
someMograph Effector
have been added. I want to useSample Node
to get allStrength
ofMograph Effector
, then add outputStrength
together. How can I do?Here is the snapshot of the scene.
The problem I meet is that I can't use
Python
to sample the output of aMograph Effector
(Sample Node With Python), and I haven't found a way to cumulate output of anObject List Node
.Thanks!
-
Hi @eZioPan, first of all, I would like to remind you, we do not have the purpose to help you with Xpresso and we normally do not have the purpose to help you on algorithm question.
With that's said, consider this as a Christmas present .
You need to store everything yourself, so a map of effector and result. Then you can do the calculation.import c4d #Welcome to the world of Python listEffector = list() class Effector(object): def __init__(self, eff, mat): self.eff = eff self.mat = mat def main(): global finalMat, listEffector effectorInList = None for e in listEffector: if e.eff == eff: effectorInList = e break if not effectorInList: newEff = Effector(eff, mat) listEffector.append(newEff) else: effectorInList.mat = mat finalMat = c4d.Matrix() for e in listEffector: finalMat *= e.mat
Find this script in the Gvnode of this file. 0_1545392377324_effectorSampling.c4d
Note that all effector offer the possibility to be used as a Deformer by switching the Deformation Mode to Object.
Cheers,
Maxime. -
Hi, @m_adam
Thank you for your kindness and the inspiring answer! It's a GREAT Christmas present for me!
So sorry asking
XPresso
related questions in this forum.
The problem I faced is a little bit complex than this: I need sampleEffector
s' totalOutput Strength
s in the position from aPolygon Object
'sPoint
s, and store the result into aVertex Color Map
attached for further use.
This problem bothers me for months, and I didn't find any clue until your post. I have never think about usingPython Node
withglobal variable
inXPresso Network
can keep the data as I need and do the magic!From the bottom of my heart, I want to say THANK YOU.
The answer you give not only solve this problem, but also inspire me re-thinking ofObjectList Node
andPython Node
, and how these nodes executed in anXPresso Network
.Just let me THANK YOU AGAIN!
Best wishes for you to have a wonderful holiday!