27/04/2019
This effector helps, when you are scaling clones and default MoGraph operations gives a weird results.
import c4d from c4d.modules import mograph as mo def main(): method = op[c4d.ID_USERDATA,2] # User Data: Method negative = op[c4d.ID_USERDATA,3] # User Data: Negative Values md = mo.GeGetMoData(op) # Get MoData if md is None: return False # If there is no MoData, stop processing cnt = md.GetCount() # Get clone count marr = md.GetArray(c4d.MODATA_MATRIX) # Get MoData matrix farr = md.GetArray(c4d.MODATA_FLAGS) # Get MoData flags for i in range(0, cnt): # Iterate through clones sx = marr[i].v1.GetNormalized()[0] # Get scale x sy = marr[i].v2.GetNormalized()[1] # Get scale y sz = marr[i].v3.GetNormalized()[2] # Get scale z if negative == 1: # If 'Negative Values' checkbox is ticked if sx < 0: # If x is smaller than zero sx = 0 # Set x to zero if sy < 0: # If y is smaller than zero sy = 0 # Set y to zero if sz < 0: # If z is smaller than zero sz = 0 # Set z to zero if sx == 0: # If x-scale is zero marr[i].v1 = c4d.Vector(0.0000001,0,0) # Set x-scale to extreme small if sy == 0: # If y-scale is zero marr[i].v2 = c4d.Vector(0,0.0000001,0) # Set y-scale to extreme small if sz == 0: # If z-scale is zero marr[i].v3 = c4d.Vector(0,0,0.0000001) # Set z-scale to extreme small if method == 1: # If method is set to 'Hide' if sx == 0 or sy == 0 or sz == 0: # If some of the axis are zero farr[i] &= ~(c4d.MOGENFLAG_CLONE_ON) # Hide the clone md.SetArray(c4d.MODATA_FLAGS, farr, True) # Set MoData flags md.SetArray(c4d.MODATA_MATRIX, marr, True) # Set MoData matrix return True # Everything is fine
ar_effector_zero_scale_fix.c4d 1.0.0 (2023.1.2)