Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Python Effector Plugin [SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    9 Posts 0 Posters 764 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          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

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            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?

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              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:

              1. register a command plugin
              2. c4d.CallCommand(1025800)
              3. find the newly crated effector (usually at the top of the hierarchy so no problems there)
              4. create the according user datas
              5. 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 🙂

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                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

                1 Reply Last reply Reply Quote 0
                • H Offline
                  Helper
                  last edited by

                  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

                  1 Reply Last reply Reply Quote 0
                  • H Offline
                    Helper
                    last edited by

                    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!

                    1 Reply Last reply Reply Quote 0
                    • H Offline
                      Helper
                      last edited by

                      On 29/07/2015 at 01:50, xxxxxxxx wrote:

                      Ok thanks!

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post