Hey all!
I hope this is the correct section to post this question.
I built myself a little script that allows me to boole multiple objects in one go:
import c4d
from c4d import gui
def main():
doc = c4d.documents.GetActiveDocument()
doc.StartUndo() #Don't know if this works like this at all
selected = doc.GetActiveObjects(1)
while len(selected) > 1:
newBool = c4d.BaseObject(c4d.Oboole)
doc.AddUndo(c4d.UNDOTYPE_NEW, newBool)
doc.InsertObject(newBool)
newBool[c4d.BOOLEOBJECT_SINGLE_OBJECT] = True
newBool[c4d.BOOLEOBJECT_TYPE] = 0
tmpA = selected.pop(0)
tmpA.InsertUnder(newBool)
doc.AddUndo(c4d.UNDOTYPE_CHANGE, tmpA) # ???
tmpB = selected.pop(0)
tmpB.InsertUnder(newBool)
doc.AddUndo(c4d.UNDOTYPE_CHANGE, tmpB) # ???
doc.SetActiveObject(newBool)
c4d.CallCommand(12236)
doc.AddUndo(c4d.UNDOTYPE_CHANGE, newBool) # ???
newerBool = doc.GetObjects()[0]
selected.insert(0, newerBool.GetDown())
c4d.EventAdd(c4d.EVENT_FORCEREDRAW)
doc.EndUndo();
if __name__=='__main__':
main()
Doing this, I thought it would be time to learn about "AddUndo". But it does not work like I thought it would.
Would someone be able to point me in the right direction?
WARNING: The script like it is now CHRASHES my c4d... If you'd like to use the script delete all "UNDO"-lines. Then it should work.
Tyvm!
kws
EDIT: Yes, I know Booleans are the Crocs of modeling. But for my current task they really speed up my workflow...