I have the following problem in making a copy of a bend deformer that has a box field as a child and the same box field inserted in its field list as you can see in the picture.
Using the pyhon tag to make a copy of the bend deformer I get a different result from one obtained by running the command in Tools/Arrange Objects/Duplicate or even with a simple Drag and Drop.
I would like to have the same latter results using the python code.
Precisely happens that the copy made with the python code results in having in the Field list the Box Field of the previous Bend and not the duplicated one.
How can I solve the problem?
This is the code used for make and insert a copy:
last = op.GetObject().GetDownLast()
new_object = last.GetClone(c4d.COPYFLAGS_NO_ANIMATION)
The start point
The Control Drag result
The Python code result
Hi Gianni, first of all, welcome in the plugincafe community.
Creates a new object in the scene from a Python Tag is not allowed. As you may know or not, tags are evaluated in parallel (meaning not on the main thread), while the main thread process the object tree. So modify any component from a thread (the Python Scripting tag) to the current document that is being processed should be avoided and may be disabled in future since it can cause hight instability, freeze or crash.
For more information please read Threading Information.
On a side note, in order to transfer/copy link, when creates new object/copying object you should use c4d.AliasTrans.
Note the code snippet indentation in the documentation is wrong, it will be fixed in the next version of the documentation.
If you have any questions, please let me know,
Hi Maxime, thank you for the reply.
I forgot to write that the code is executed after pressing a button. Last year in the old forum we talked about the fact that it was safe to create a new object while managing the pressure of a button.
I really hope this feature will not be removed in the future.
This is the old thread:
At this point to obtain the result I want, do I still need to use c4d.AliasTrans?
If yes, I'm going to try it somehow.
Just tried now…
It seems to work perfectly!
I don't want to boring you, but, please, don't disable this super feature in python. Instead you could update the documentation specifying well how to use it.