I wrote two Python Effectors that changes clone offset. Clone offset picks which child of the cloner gets cloned or the blending between those children. Keep in mind that offsetting clones does not change clone’s id number.
Clone offset
With the first Python Effector you can give clone id and child id to the input field and therefore you can change which child of the Cloner is chosen to that clone.
Syntax is [clone id, child id]. Clone and child indexes starts from 0 (zero). So, if you want that third clone is second child of the Cloner you would put [2,1]. You can modify as many clones as you please.
import c4d from c4d.modules import mograph as mo def main(): try: # Try to execute following md = mo.GeGetMoData(op) # Get MoGraph data if md is None: return False # If there is no data, quit data = op[c4d.ID_USERDATA,1] # Get user data input c = data.replace('\n','') # Remove line breaks c = c.replace('\r','') # Remove carriage returns c = c.replace('[','') # Remove '[' characters c = c.split(']') # Split string to list using ']' character as a delimiter c.remove('') # Remove empty items from list clen = len(c) # Get length of the list gen = md.GetGenerator() # Get generator cnt = md.GetCount() # Get number of clones cln = md.GetArray(c4d.MODATA_CLONE) # Get clone array nchd = float(len(gen.GetChildren())) # Get number of generator's children fall = md.GetFalloffs() # Get falloffs for i in range(0, cnt): # Loop if i < clen: # If 'i' is not greater than length of the 'clen' list clone_id = int(c[i].split(',')[0]) # Get clone id child_id = int(c[i].split(',')[1]) # Get child id cln[clone_id] = (1/nchd) * child_id # Offset clone except: # If something goes wrong pass # Do nothing md.SetArray(c4d.MODATA_CLONE, cln, True) # Set clone array data return True
ar_effector_clone_offset.c4d v1.0.0 (2023.1.3)
Clone offset with weight threshold
With the second Python Effector you can change clones depending on weight transformation. You can choose number of the child and adjust the threshold. I don’t know how useful this tool is but it was fun to make.
import c4d from c4d.modules import mograph as mo def main(): md = mo.GeGetMoData(op) # Get MoGraph data if md is None: return False # If there is no data, quit thd = op[c4d.ID_USERDATA,2] # Threshold cid = op[c4d.ID_USERDATA,3] # Chosen child id gen = md.GetGenerator() # Get generator cnt = md.GetCount() # Get number of clones cln = md.GetArray(c4d.MODATA_CLONE) # Get clone array warr = md.GetArray(c4d.MODATA_WEIGHT) # Get weight array nchd = float(len(gen.GetChildren())) # Get number of generator's children fall = md.GetFalloffs() # Get falloffs for i in reversed(range(0, cnt)): # Loop through clone count if warr[i] >= thd: # If clone weight is equal or greater than threshold cln[i] = (1/nchd)*(cid) # Offset clone md.SetArray(c4d.MODATA_CLONE, cln, True) # Set clone array data return True
ar_effector_clone_offset_weight_threshold.c4d v1.0.0 (2023.1.3)