我正在制作一个索具工具/遵循Maya中的教程,由于某种原因我收到了意外的缩进错误。我经历了多次用空格或标签替换所有空白区域都无济于事。
import os
try:
riggingToolRoot = os.environ["RIGGING_TOOL_ROOT"]
except:
print "RIGGING_TOOL_ROOT environment variable not correctly configured"
else:
import sys
print riggingToolRoot
path = riggingToolRoot + "/Modules"
if not path in sys.path:
sys.path.append(path)
import System.blueprint_UI as blueprint_UI
reload(blueprint_UI)
UI = blueprint_UI.Blueprint_UI()
显然“将System.blueprint_UI导入为blueprint_UI”是违规行为 line,它只在blueprint_UI.py的最新更改后标记。如果有任何用处的话,我也包含了代码。
import maya.cmds as cmds
import System.utils as utils
reload(utils)
class Blueprint_UI:
def __init__(self):
# Store UI elements in a dictionary.
self.UIElements = {}
if cmds.window("blueprint_UI_window", exists=True):
cmds.deleteUI("blueprint_UI_window")
windowWidth = 400
windowHeight = 598
self.UIElements["window"] = cmds.window("blueprint_UI_window", width=windowWidth, height=windowHeight, title="Blueprint Module UI", sizeable=False)
self.UIElements["topLevelColumn"] = cmds.columnLayout(adjustableColumn=True, columnAlign="center")
# Setup tabs
tabHeight = 500
self.UIElements["tabs"] = cmds.tabLayout(height=tabHeight, innerMarginWidth=5, innerMarginHeight=5)
tabWidth = cmds.tabLayout(self.UIElements["tabs"], q=True, width=True)
self.scrollWidth = tabWidth - 40
self.initialiseModuleTab(tabHeight,tabWidth)
cmds.tabLayout(self.UIElements["tabs"], edit=True, tabLabelIndex=([1, "Modules"]))
# Display window
cmds.showWindow( self.UIElements["window"] )
def initialiseModuleTab(self, tabHeight, tabWidth):
scrollHeight = tabHeight # temp value
self.UIElements["moduleColumn"] = cmds.columnLayout(adj=True, rs=3)
self.UIElements["moduleFrameLayout"] = cmds.frameLayout(height=scrollHeight, collapsable=False, borderVisible=False, labelVisible=False)
self.UIElements["moduleList_Scroll"] = cmds.scrollLayout(hst=0)
self.UIElements["moduleList_Column"] = cmds.columnLayout(columnWidth = self.scrollWidth, adj=True, rs=2)
# First separator
cmds.separator()
for module in utils.findAllModules("Modules/Blueprint"):
print module