[XPresso] How to add numeric data from an In-/Exclusion Userdata?
-
Hi,
I have a
Null Objectwith anIn-/Exclusion Userdataattached. InIn-/Exclusion UserdatasomeMograph Effectorhave been added. I want to useSample Nodeto get allStrengthofMograph Effector, then add outputStrengthtogether. How can I do?Here is the snapshot of the scene.

The problem I meet is that I can't use
Pythonto 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.matFind 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
XPressorelated questions in this forum.
The problem I faced is a little bit complex than this: I need sampleEffectors' totalOutput Strengths in the position from aPolygon Object'sPoints, and store the result into aVertex Color Mapattached 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 Nodewithglobal variableinXPresso Networkcan 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 NodeandPython Node, and how these nodes executed in anXPresso Network.Just let me THANK YOU AGAIN!
Best wishes for you to have a wonderful holiday!