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

    GetGenerator() equivalent in a Python Effector

    Scheduled Pinned Locked Moved PYTHON Development
    14 Posts 0 Posters 1.4k 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 18/01/2012 at 04:40, xxxxxxxx wrote:

      Just to bump this

      From what I can see there no connection between a PY Effector and the Cloner(s) that is/are using it?

      Can we get an answer on this one please either way - as the OP was early December.

      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 19/01/2012 at 03:58, xxxxxxxx wrote:

        OK Apart from going through the cloners - checking their effector list to see if it is using the Python effector
        is there any other way of getting the Cloner object the effector is attached to?

        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 23/01/2012 at 08:31, xxxxxxxx wrote:

          Originally posted by xxxxxxxx

          OK Apart from going through the cloners - checking their effector list to see if it is using the Python effector
          is there any other way of getting the Cloner object the effector is attached to?

          GetGenerator() is missing in the Python API and will be implemented in the future.

          Meanwhile, the best workaround is to add a Link user data to the Python Effector and connect the Cloner.
          Then in the Python effector code you could call:

          cloner = op[c4d.ID_USERDATA, 1]
          print cloner
          
          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 23/01/2012 at 08:43, xxxxxxxx wrote:

            Thanks for the feedback Yannick

            but I think this will be a problem if you use the effector in more than one cloner
            ie an unspecified number of cloers

            😉

            I'm thinking 
            search OM for cloners
            check effector list
            am I in there?

            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 24/01/2012 at 00:53, xxxxxxxx wrote:

              Originally posted by xxxxxxxx

              But I think this will be a problem if you use the effector in more than one cloner
              ie an unspecified number of cloners

              You can create as many Link user data as cloners.

              Originally posted by xxxxxxxx

              I'm thinking 
              search OM for cloners
              check effector list
              am I in there?

              Yes, meanwhile this solution may be the best for complex situations.

              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 24/01/2012 at 01:52, xxxxxxxx wrote:

                Sebastian just told me that in the Python effector scope there's a variable called "gen"... So we can access the cloner object with this variable.

                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 24/01/2012 at 07:25, xxxxxxxx wrote:

                  A quick example would save a lot of guesswork pls 
                  🙂

                  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 24/01/2012 at 07:42, xxxxxxxx wrote:

                    Basically, 'gen' is the name of a variable (referencing the cloner or generator object) added to the execution of main() function in a Python effector, just as the same as 'doc' (document where the effector resides) and 'op' (effector) variables:

                    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
                        
                        # Print variables added to the scope of main()
                        print op
                        print gen
                        print doc
                        
                        index = md.GetCurrentIndex()
                        mode = md.GetBlendID()
                        if mode==c4d.ID_MG_BASEEFFECTOR_POSITION:
                            return c4d.Vector(0.5)
                        else: return 1.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 24/01/2012 at 07:55, xxxxxxxx wrote:

                      Ah - I see

                      got it

                      place in a Python Effector and run

                      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 24/01/2012 at 09:01, xxxxxxxx wrote:

                        bingo, that works.

                        try again, deepshade.
                        ( I think you're still working on a python version of d_PolySize.)
                        I just tried :

                        cloneobj = gen[c4d.MG_OBJECT_LINK]
                        print cloneobj

                        and it does return the Object the Cloner's cloning onto correctly,
                        although it gets funky when there's multiple cloners referencingthe same Effector

                        thanks, yannick

                        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 24/01/2012 at 12:13, xxxxxxxx wrote:

                          multiple cloner issue here too

                          douwe - re: d_PolySize - still getting stuck on the coffee poly manipulation
                          can you annotate to make conversion (a little) easier

                          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 04/02/2012 at 05:51, xxxxxxxx wrote:

                            Originally posted by xxxxxxxx

                            Basically, 'gen' is the name of a variable (referencing the cloner or generator object) added to the execution of main() function in a Python effector, just as the same as 'doc' (document where the effector resides) and 'op' (effector) variables:

                            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
                                
                                # Print variables added to the scope of main()
                                print op
                                print gen
                                print doc
                                
                                index = md.GetCurrentIndex()
                                mode = md.GetBlendID()
                                if mode==c4d.ID_MG_BASEEFFECTOR_POSITION:
                                    return c4d.Vector(0.5)
                                else: return 1.0
                            

                            Why
                            When the python effector is set to Full Control
                            does GEN returns the Cloner

                            and
                            when the python effector is set to Parameter Control
                            does GEN returns the Cloner Object Link
                            ???

                            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 10/02/2012 at 12:12, xxxxxxxx wrote:

                              or to put it another way
                              is the variable GEN in parameter mode 
                              returned incorrectly ie a bug

                              If there is a difference - can someone explain why pls - as there is no documentation of the modes working differently other than (from what I can see) the parameter version appears to be hooked to refresh once for every clone count

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