THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 11/03/2012 at 01:19, xxxxxxxx wrote:
All other Layer icons can be toggled (with effect) except for Solo
why does it need the added Button click simulation
import c4d
from c4d import *
def main() :
doc = c4d.documents.GetActiveDocument()
root = doc.GetLayerObjectRoot()#Gets the layer manager
LayersList = root.GetChildren()
toggled = 0
for layers in LayersList:
#print layers.GetName()
if layers.GetBit(c4d.BIT_ACTIVE) :# if the layer is selected
layer_data = layers.GetLayerData(doc)
layer_data['solo'] = not layer_data['solo']
layers.SetLayerData(doc,layer_data)
toggled=1
c4d.EventAdd()
if toggled == 0:
gui.MessageDialog("Select a layer to use the script")
return False
CallButton(layers, 100004726) # why do we need this when other items in the layer list do not
if __name__=='__main__':
main()
ie. all the other icons can be toggled and function without a button click?
import c4d
from c4d import gui
def main() :
#c4d.CallCommand(13957); # Clear console
doc = c4d.documents.GetActiveDocument()
root = doc.GetLayerObjectRoot()#Gets the layer manager
LayersList = root.GetChildren()
toggled = 0
for layers in LayersList:
if layers.GetBit(c4d.BIT_ACTIVE) :# if the layer is selected
layer_data = layers.GetLayerData(doc)
layer_data['view'] = not layer_data['view']
layer_data['render'] = not layer_data['render']
layer_data['manager'] = not layer_data['manager']
layer_data['locked'] = not layer_data['locked']
layer_data['generators'] = not layer_data['generators']
layer_data['expressions'] = not layer_data['expressions']
layer_data['animation'] = not layer_data['animation']
layer_data['deformers'] = not layer_data['deformers']
layers.SetLayerData(doc,layer_data)
toggled=1
c4d.EventAdd()
if toggled == 0:
gui.MessageDialog("Select a layer to use the script")
return False
if __name__=='__main__':
main()