Hi !
I am try to set my scatter rig , the basic rule is :
- node selected : set the node to the
Scatter Object
, try find selection tag and set to the "Scater Aera" - tag selected : set the node which tag on to the
Scatter Object
, tag to the "Scater Aera"
All they worked , but in the context " only tag selected " , the the scatter object doesn't active in object manager , I cann't find how this heppend .
the scatter shoud be :
the " tag " context , it returns like this , the scatter is set right and active is object manager , but it doesn't active in attribute manager .
How can I fix this ?
( It's a bare-bone rig that i can show this problem and easy to read , If a non delete setting is needed please let me kow)
@ Windows 11 21H2 Cinema 4D 2023.0.0
from typing import Optional
import c4d
doc: c4d.documents.BaseDocument # The active document
op: Optional[c4d.BaseObject] # The active object, None if unselected
def redshift_scatter() -> c4d.BaseObject :
# Modifier ID
ModifierID = 1018545
ModifierName = 'Scatter : '
selection = False
doc.StartUndo()
selectedtag = doc.GetActiveTag()
node = doc.GetActiveObject()
# pass if nothing selected
if not node and (not selectedtag or not selectedtag.CheckType(5673)) :
return
# node selected
if node :
doc.AddUndo(c4d.UNDOTYPE_BITS,node)
node.DelBit(c4d.BIT_ACTIVE)
tags = [tag for tag in node.GetTags() if tag.CheckType(5673)]
if len(tags)==[]:
pass
if len(tags) == 1 :
scatter_selection = tags[0].GetName()
selection = True
else:
if selectedtag in tags :
scatter_selection = selectedtag.GetName()
selection = True
doc.AddUndo(c4d.UNDOTYPE_BITS,selectedtag)
selectedtag.DelBit(c4d.BIT_ACTIVE)
# selection tag
elif (selectedtag and selectedtag.CheckType(5673)) and not node:
scatter_selection = selectedtag.GetName()
selection = True
node = selectedtag.GetObject()
# deselect tag
doc.AddUndo(c4d.UNDOTYPE_BITS,selectedtag)
selectedtag.DelBit(c4d.BIT_ACTIVE)
# world matrix.
pos = node.GetMg()
# Modifier
Modifier = c4d.BaseObject(ModifierID)
Modifier[c4d.ID_MG_MOTIONGENERATOR_MODE] = 0
Modifier[c4d.MG_OBJECT_LINK] = node
#Modifier[c4d.MG_POLYSURFACE_SEED] = seed
Modifier[c4d.MG_POLY_MODE_] = 3 # surface
if selection :
Modifier[c4d.MG_POLY_SELECTION] = scatter_selection
Modifier.SetName(ModifierName + node.GetName())
Modifier.SetMg(pos) # Set the world (global) matrix.
Modifier.InsertAfter(node)
doc.AddUndo(c4d.UNDOTYPE_NEWOBJ,Modifier)
Modifier.SetBit(c4d.BIT_ACTIVE)
doc.EndUndo()
c4d.EventAdd()
return Modifier
if __name__ == '__main__':
redshift_scatter()
thanks :blush: