On 19/03/2017 at 20:11, xxxxxxxx wrote:
In Xpresso,there is a node called "smple node",is ti possible to create it with python tag?for example,how to use the falloff of a plain effector to control a lot of cubes' filter(as the screenshot below). I have achieved it via Xpresso setup,but I want to do it via python tag,How to do achieve this?somebody has an example code? any help would be very appreciated!
I want to achieve this goal via python tag ,is it possible? I tried this code below,but not work,maybe it is the cause that I don't know how to use the FalloffDataData.
from c4d.modules.mograph import FalloffDataData
def main() :
null = op.GetObject()
cubes = null.GetChildren()
FalloffDataData = doc.SearchObject('plain')
for cube in cubes() :
mg = cube.GetMg()
FalloffDataData.mat = mg
if FalloffDataData.strength >= 0:
cube[c4d.PRIM_CUBE_DOFILLET] = 1
cube[c4d.PRIM_CUBE_DOFILLET] = 0
On 20/03/2017 at 05:59, xxxxxxxx wrote:
can you perhaps describe the scenario in more detail? The cubes you want to filter are just cubes or are they created by a cloner (maybe even MoGraph Cloner)? Perhaps the Python Effector is much more, what you are looking for?
On 20/03/2017 at 22:40, xxxxxxxx wrote:
I am sorry!I have re-edited my post . my question is that how I can achieve the effect in the screenshot via python tag or python effector .Thank you!
On 22/03/2017 at 10:09, xxxxxxxx wrote:
I'm afraid I have no good news on this topic.
There's currently no way to achieve this in Python.
The point is, the effector only gets "executed", if it's part of a MoGraph generator (cloner,...). So the Python Effector code (or also the Plain Effector) won't get run at all in the scenario shown in your screenshot. The Sample node in Xpresso uses special internal messages to force execution of the Effector and to sample the falloff in order to get the desired result. These messages (and there data types) are not available in Python. Sorry.
On 22/03/2017 at 22:41, xxxxxxxx wrote:
Thank you all the same! I'll keep it mind. I have another question that how to use the "FalloffDataData" function,for example, FalloffDataData.mat function, or this class function is only used in plugingdata? I am confused about this class,would you help me understanding this function?thank you !
On 24/03/2017 at 09:35, xxxxxxxx wrote:
The C++ docs contain a bit more info on FalloffDataData. It's needed, when writing custom FalloffData plugins.
On 27/03/2017 at 09:45, xxxxxxxx wrote:
Ooopsy, sorry, I need to correct myself a bit or at least add some information.
While it's not possible to sample the falloff of an effector in Python in the above described scenario, in C++ there's at least the C4D_Falloff class. This can be used to add falloffs to for example a deformer or generator. With this you can set up your own falloff and sample it to your liking.
Of course neither in Python (yet) nor exactly what was asked for. But on the other hand, it's at least an option to sample a falloff.
On 28/06/2017 at 13:28, xxxxxxxx wrote:
Just wanted to put in a request to be able to Sample an arbitrary falloff. Specifically, I'm looking to sample the falloff data of an effector linked via userdata.
On 29/06/2017 at 09:57, xxxxxxxx wrote:
though I can't make any promises, chances aren't that bad, that this will be possible in one of the future releases.