Python Effector Plugin [SOLVED]
-
On 22/07/2015 at 03:26, xxxxxxxx wrote:
Hi everyone,
I'm developing a custom effector, but I'd like to distribute it as a plugin instead of a python effector with code inside.
I was trying to register an object plugin that could be fed into the effector list on the cloner to get access to the cloner's moData, but there seems to be no option to inherit from the effector class, only the basic object one. Which cannot be inserted into the cloner's effector list.
Is there any way to create a base effector plugin and add functionality on top?
Another way i tried was to create a command plugin which issues the command 1025800 (python effector), but i'd rather create a baseObject, set its properties and then add it into the scene.
With the command route i must search the object, create user data on the fly and inject python code inside it.Also, is there a way to hide the code UI and/or protect it?
Thanks
Max
-
On 23/07/2015 at 05:25, xxxxxxxx wrote:
Hi Max,
welcome to the Plugin Café forums !
Smile
[URL-REMOVED]Unfortunately it is currently not possible to implement effectors in Python. The needed classEffectorData is only available in the C++ API.
So you can either use C++ to implement your effector or stick to the Python Effector.
Sorry.
[URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.
-
On 23/07/2015 at 07:01, xxxxxxxx wrote:
Hey Andreas,
Thanks for the clear answer!
Do you also know how to create a python effector with the baseObject syntax instead of command?
I'm finding a lot of trouble to create an interface from code. Can Userdate be populated with a .res file by reading and associating it to the userdata section?
Thanks
-
On 23/07/2015 at 07:51, xxxxxxxx wrote:
Hi Max,
Do you also know how to create a python effector with the baseObject syntax instead of command?
I'm afraid, I don't understand the question. Can you try to explain it differently?
-
On 24/07/2015 at 02:05, xxxxxxxx wrote:
If I want to insert a python effector in the scene this is what i am forced to do:
- register a command plugin
- c4d.CallCommand(1025800)
- find the newly crated effector (usually at the top of the hierarchy so no problems there)
- create the according user datas
- inject python code inside
Which is not really handy.
What I would like to do is to create an object as a referenced var, then set its properties using a single baseContainer prepared beforehand, inject python and then instance my object into the scene, something in the line of:> myObj = c4d.BaseObject( *MYPTHONEFFECTORID" )
>
> myObj.SetUserDataContainer(myContainer)
>
> doc.InsertObject(myObj)
This method obvieously doesn't work as the effectors are not enumerated in the standard object types.Also, i'd really love to import from a .res file my user data configuration insead of just creating them in a method, which is not documented enough. Trying to set User Data and style the interface to my liking means i have to deal with a lot of descIds which i don't understand how to properly set up
-
On 24/07/2015 at 08:08, xxxxxxxx wrote:
Hello,
to find out the type ID of any given element of Cinema 4D you can simple create such an object manually, select it, access the selected object in your code and call GetType(). Or you can open the "Customize Commands" dialog that lists all objects, tags, commands etc. There you can find the "Python" effector and its ID.
With that ID you can easily create and configure the effector:
pythonEffector = c4d.BaseObject(1025800); if pythonEffector is not None: pythonEffector[c4d.OEPYTHON_STRING] = "# my python code" doc.InsertObject(pythonEffector, None, None) c4d.EventAdd()
beset wishes,
Sebastian -
On 27/07/2015 at 06:28, xxxxxxxx wrote:
Thanks that worked as intended!
After searching a bit it seems there's no way to hide object data (namely the code window) from the object properties. Am I right?
Also, I'm sincerely getting blocked out at how poor is the documentation regarding the creation of user data interfaces. Stuff like renaming the user data tab and how to configure a BaseContainer and add it to the interface in one single call rather than setting one user data after the next using addUserData.
Can you please give specific direction on best practices and readings to better understand?
Thanks
-
On 28/07/2015 at 09:54, xxxxxxxx wrote:
Hi Max,
can you please open new threads for questions on different topics. It will make searching the forums a bit easier in the future. Thanks!
-
On 29/07/2015 at 01:50, xxxxxxxx wrote:
Ok thanks!