Invalid Syntax Error in Maya 2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone!
I am trying to use a script to automate the turn-on of the Visibility on Redshift for all selected objects. But every time I run it it says "Syntax Error".
import maya.cmds as cmds
def set_visibility_overrides():
# Get the selected geometries
selected_geometries = cmds.ls(selection=True, dag=True, shapes=True)
for geometry in selected_geometries:
# Check if the geometry has the attribute "rsEnableVisibilityOverrides"
if cmds.attributeQuery("rsEnableVisibilityOverrides", node=geometry, exists=True):
# Set the value of "rsEnableVisibilityOverrides" to 1
cmds.setAttr(geometry + ".rsEnableVisibilityOverrides", 1)
print("Set rsEnableVisibilityOverrides to 1 for:", geometry)
else:
print("Attribute 'rsEnableVisibilityOverrides' not found for", geometry)
# Call the function
set_visibility_overrides()
Can anyone spot the error? Or is it just a thing of my Maya preferences?
Thank you in advance!