Keep changes for clones



  • 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__
     __
     _ _
    

    __




  • 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 ___  
     _ ___
    



  • 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




  • 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.



  • 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



  • 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?


Log in to reply