C4d scripting Help


#1

Hello i wanted to toggle off and on the ‘Select only Visible elements’ and i know that there is an already build in shortcut for that on cinema, but it only toggles the tools you have active, i want it to toggle the lasso tool while still being on the live selection tool (a toggle for both of them) so i came up with this script, this one does toggle only the active tool but couldn’t make the jump to lasso tool and activate/deactivate there and then come back to live tool :slight_smile:

def main():

tool = doc.GetActiveToolData()

c4d.CallCommand(200000083)  # LiveSelectionTool
tool[c4d.MDATA_SELECTLIVE_VISIBLE] = not tool[c4d.MDATA_SELECTLIVE_VISIBLE] #toggle off/on visible selection

c4d.CallCommand(200000084) # LassoTool
tool[c4d.MDATA_SELECTION_VISIBLE] = not tool[c4d.MDATA_SELECTION_VISIBLE] #toggle off/on visible selection
c4d.CallCommand(200000083) # LiveSelectionTool again
c4d.EventAdd() 

any suggestions?