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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Effector Q

    Scheduled Pinned Locked Moved PYTHON Development
    11 Posts 0 Posters 1.2k 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

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 25/11/2011 at 08:00, xxxxxxxx wrote:

      Forgive the noob stuff
      just need to get some things clear in my head

      I want to start of with 1 clone being controlled by any of the parameter settings

      I can see how you select and individual clone 
      and write code to control it
      but how do you enable any/all of the parameters to affect that clone?

      I also could't find anything by searching the sdk for 
      mode = md.GetBlendID()

      advice appreciated

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 26/11/2011 at 10:08, xxxxxxxx wrote:

        or do I have to duplicate all the parameter controls in my code

        or can I write something like
        If value in parameters
        get the index of the chosen clone
        apply parameter to it
        and return without doing anything to the other clones
        ?

        or have I just got the plan all wrong?

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 26/11/2011 at 14:30, xxxxxxxx wrote:

          I haven't had a chance to play around with the python mograph stuff yet. But it looks like you can manipulate a specific clone if you use it's array index number.

          Look at the pyEffector example in the R13 sdk. And add this to the end of the code:

             pos = marr[3]#Get a specific clone  
          pos.off = c4d.Vector(110,200,0)  #Move that one specific clone somewhere in memory only  
          md.SetArray(c4d.MODATA_MATRIX, marr, True)#Update the changes made to the array from memory  
          

          I assume you can do other things this way. But I haven't tried it yet.

          -ScottA

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

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 27/11/2011 at 01:58, xxxxxxxx wrote:

            Hi Scott

            Thanks for your time, I'm already that far and can change position, rotation, scale etc
            but you have to manually create the User data area inputs for everything.

            The effector has a 'parameter only' mode, so,
            what I wanted to do was find a way (IF it were possible) to use the parameter control version of the effector to gather the data, rather than re writing every input option manually

            Does that make sense?

            I also couldn't find any information about

            mode  = mdGetBlendID()

            the current default code in the python effector (parameter control vers)  seems to return half the value in the parameter list
            so its not a very clear example of whats going on or how you are supposed to use it.

            Essentially I want to use the parameter controls but limit them to 1 clone - selected from user data, index value.

            Paul

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

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 27/11/2011 at 09:01, xxxxxxxx wrote:

              Well... This is my interpretation of it.

              mdGetBlendID() is a method that looks up the ID#s in the file:
               resource\modules\objects\res\description\obaseeffector.h

              In the effector's code it uses those ID numbers as a switch validator.
              In other words: if (the id is found) then do something.

              The ID numbers in that obaseeffector.h file also match the same parameters that are supported internally by the Coffee&Python effectors "parameter controls" option.
              Since this is how we create plugins(using the descriptions). My guess is that's why only those options are supported by the "parameter controls" option in the effector.
              So to use the other parameters that are not listed in the obaseeffector.h file. You'll have to set them up by hand with UserData and specific array index ID's.

              -ScottA

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

                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                On 27/11/2011 at 13:33, xxxxxxxx wrote:

                I got as far as this

                def main() :
                    md = mo.GeGetMoData(op)
                    if md==None: return 1.0
                    user_index = op[c4d.ID_USERDATA, 1]
                    index = md.GetCurrentIndex()
                    mode = md.GetBlendID()
                    if mode == c4d.ID_MG_BASEEFFECTOR_POSITION and index == user_index  :
                        return c4d.Vector(1)
                    else: return 0

                which allows the effector to affect only the indexed value

                if mode == c4d.ID_MG_BASEEFFECTOR_SCALE and index == user_index  :
                        return c4d.Vector(1)

                does the same for scale

                if mode == c4d.ID_MG_BASEEFFECTOR_ROTATION and index == user_index  :
                        return c4d.Vector(1)

                does the same for rotation

                Q: how do I combine them all?

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

                  THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                  On 27/11/2011 at 15:03, xxxxxxxx wrote:

                  Put the result into a Matrix?

                  Cheers
                  Lennart

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

                    THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                    On 27/11/2011 at 23:47, xxxxxxxx wrote:

                    Any help with the syntax pls?

                    I'm still struggling a bit to understand whats going on - have commented

                    _<__<_t_<__<_t_<__<_t_>_
                    def main() :
                        md = mo.GeGetMoData(op)
                        if md==None: return 1.0
                        user_index = op[c4d.ID_USERDATA, 1]
                        index = md.GetCurrentIndex()
                        mode = md.GetBlendID() # sets up the effector to use the parameters
                        if mode == c4d.ID_MG_BASEEFFECTOR_POSITION and index == user_index  :
                            return c4d.Vector(1) #return all the values in the position section
                        else: return 0 # if condition not met, don't return any data from the position section_/div>


                    Now to me it would make sense to return a vector of 1,1,1 to turn return 100% of each of the parameters, but that doesnt work

                    and combine all the  checks with AND
                     if mode == c4d.ID_MG_BASEEFFECTOR_POSITION and index == user_index 
                    and
                    mode == c4d.ID_MG_BASEEFFECTOR_SCALE and index == user_index 
                    and
                    mode == c4d.ID_MG_BASEEFFECTOR_ROTATION and index == user_index

                    but no

                    I just need someone to put me on the straight an narrow

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

                      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                      On 28/11/2011 at 05:24, xxxxxxxx wrote:

                      this works
                      but can't  see why??

                      if it returns a vector of 1
                      and that's acting as a some kind if scaling of the parameter output)
                      how does it now which parameter (PSR) the vector refers ?

                      import c4d
                      from c4d.modules import mograph as mo
                      #Welcome to the world of Python

                      def main() :
                          md = mo.GeGetMoData(op)
                          if md==None: return 1.0
                          user_index = op[c4d.ID_USERDATA, 1]
                          index = md.GetCurrentIndex()
                          
                          mode = md.GetBlendID()
                          if mode == c4d.ID_MG_BASEEFFECTOR_POSITION and index == user_index :
                               return c4d.Vector(1)
                          
                          if mode == c4d.ID_MG_BASEEFFECTOR_SCALE and index == user_index :
                               return c4d.Vector(1)
                          
                          if mode == c4d.ID_MG_BASEEFFECTOR_ROTATION and index == user_index :
                       
                              return c4d.Vector(1)
                          else: return 0

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

                        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                        On 28/11/2011 at 12:49, xxxxxxxx wrote:

                        Hi, maybe you are looking for the "Full Control" mode where you set all data of the clones and don't have to return one vector for each ID.

                        Cheers, Sebastian

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

                          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                          On 28/11/2011 at 22:32, xxxxxxxx wrote:

                          Hi Sebastian

                          No, I'm just trying to understand what's happening in the parameter mode.

                          Starting with

                          index = md.GetCurrentIndex()

                          as there is no definition for 
                          GetCurrentIndex

                          that appears to be something that is run once
                          so its not obvious how its does the equivalent of iterating through the index (in full mode)

                          the same applies to
                              if mode == c4d.ID_MG_BASEEFFECTOR_POSITION and index == user_index :
                                   return c4d.Vector(1)

                          the index value must be iterated somehow?

                          Unless the code (the parameter mode python)  is being run for every clone
                          but theres no information to that effect

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