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

    Keep changes for clones

    Scheduled Pinned Locked Moved PYTHON Development
    6 Posts 0 Posters 653 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 15/11/2012 at 00:04, xxxxxxxx wrote:

      Just tinkering - I know this isnt correct - but any feedback appreciated

      Trying to get a random sort mograph clones
      by shuffling the clone array

      I can randomise or reverse on a particular frame
      but not keep the randomisation

      if (frame >= 70) :  random.shuffle(marr)
      constantly shuffles - not wanted

      if (frame == 70) :  random.shuffle(marr)
      shuffles on that one frame then resets to original order on 71 - not wanted

      any ideas

      import c4d
      from c4d.modules import  mograph as mo
      import  math, random
      #Welcome to the world of Python
        
      def main() :
          md = mo.GeGetMoData(op)
          if md==None: return False
          
          cnt = md.GetCount()
          marr = md.GetArray(c4d.MODATA_MATRIX)
          fall = md.GetFalloffs()
        
          #marr.reverse() #just reverse
          #marr.append(marr.pop(0))    #another reverse
        
          
          frame = doc.GetTime().GetFrame(doc.GetFps()) 
        
          if (frame >= 70) :  random.shuffle(marr) 
          for i in reversed(xrange(0, cnt)) :
              marr _.off = marr _.off__
       _ _        #if (i == 4) :  marr.reverse() # experimen__
       _ _    md.SetArray(c4d.MODATA_MATRIX, marr, True)__
       _ _    return True__
       __
       _ _
      

      __


      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 15/11/2012 at 12:51, xxxxxxxx wrote:

        try this ---->

          
         _import c4d  
        from c4d.modules import  mograph as mo  
        import  math, random  
        #Welcome to the world of Python  
        def my_shuffle(array) :  
              random.shuffle(array)  
              return array  
        def main() :  
          md = mo.GeGetMoData(op)  
          if md==None: return False  
          cnt = md.GetCount()  
          marr = md.GetArray(c4d.MODATA_MATRIX)  
          fall = md.GetFalloffs()  
          global marr1  
          try:  
              marr = marr1  
          except NameError:  
              pass  
          
          frame = doc.GetTime().GetFrame(doc.GetFps())   
          if (frame == 20) :  
              marr1 = my_shuffle(marr)  
          for i in reversed(xrange(0, cnt)) :  
              marr[i].off = marr[i].off  
          md.SetArray(c4d.MODATA_MATRIX, marr, True)  
          return True ___  
         _ ___
        

        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 15/11/2012 at 13:07, xxxxxxxx wrote:

          Brilliant - thanks douwe

          changed third to last line

          marr (square bracket)i (square bracket).off _  = marr ._ (square bracket) _ i_ (square bracket).off


          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 15/11/2012 at 16:17, xxxxxxxx wrote:

            Ye, bad things happen when one forgets to use the correct BBcode. fixed.

            Glad to help you out,
            although it feels like cheating every time i resort to the NameError trick.

            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 16/11/2012 at 03:52, xxxxxxxx wrote:

              Yup same post as you spotted douwe

              I started with the thought about shuffling the array - but then I got stuck on the code

              Will post the whole thing back there included scene file (as we can't do that here)

              The only issue I've found (I guess its to do with the global setting) if you change clone numbers or setup then you have to recompile

              http://www.c4dcafe.com/ipb/topic/72221-change-the-order-of-clones-in-a-grid/page\__gopid\__521195#entry521195

              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/11/2012 at 04:58, xxxxxxxx wrote:

                Anyone have any suggestions of how to get over having to reset the effector,

                every time the clone count and or type gets changed?

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