Я пытаюсь задокументировать инструмент, написанный для Maya, в Pyside2, и получаю сообщение об ошибке, когда Sphinx пытается импортировать скрипт как модуль для автоматической генерации HTML. Инструмент работает нормально сам по себе, но что-то в том, как он написан, вызывает ошибку на стороне Сфинкса. Я поставлю образец моего кода и ошибку ниже:
import maya.cmds as cmds
import maya.mel as mel
import os
import maya.OpenMayaUI as mui
from functools import partial
from PySide2 import QtWidgets,QtCore,QtGui
import shiboken2
import re
class LAYERS_WINDOW_TOOL(object):
def __init__(self):
self.light_types = ["volumeLight","areaLight","spotLight","pointLight","directionalLight","ambientLight","VRayLightRectShape"]
self.materials_VRayMtl = cmds.ls(type = "VRayMtl")
self.materials_phong = cmds.ls(type = "phong")
self.materials_blinn = cmds.ls(type = "blinn")
self.materials_lambert = cmds.ls(type = "lambert")
self.materials_surface_shader = cmds.ls(type = "surfaceShader")
self.materials_displacement = cmds.ls(type = "displacementShader")
self.displacement_nodes = cmds.ls(type = "VRayDisplacement")
self.placement_nodes = cmds.ls(type = "place2dTexture")
self.file_nodes = cmds.ls(type = "file")
self.gammaCorrect_nodes = cmds.ls(type = "gammaCorrect")
self.ramp_nodes = cmds.ls(type = "ramp")
self.layeredTexture = cmds.ls(type = "layeredTexture")
self.VRayBlendMtls = cmds.ls(type = "VRayBlendMtl")
self.VRayPlaceEnvTex_nodes = cmds.ls(type = "VRayPlaceEnvTex")
self.multiplyDivide = cmds.ls(type = "multiplyDivide")
self.remapHsv = cmds.ls(type = "remapHsv")
self.remapColor = cmds.ls(type = "remapColor")
self.materials = self.materials_VRayMtl + self.materials_phong + self.materials_blinn + self.materials_lambert + self.materials_surface_shader + self.placement_nodes + self.file_nodes + self.materials_displacement + self.displacement_nodes + self.layeredTexture + self.VRayBlendMtls + self.VRayPlaceEnvTex_nodes + self.ramp_nodes + self.gammaCorrect_nodes + self.multiplyDivide + self.remapHsv + self.remapColor
self.object_check_g = cmds.ls(g = True)
self.object_check_transform = cmds.ls(type = "transform")
self.object_check_cameras = cmds.ls(type = "camera")
self.object_check = self.object_check_g + self.object_check_transform + self.materials + self.object_check_cameras
self.lites = cmds.ls(lt = True)
self.vray_lights = []
for object in self.object_check:
node_type = cmds.nodeType(object)
for lite in self.light_types:
if node_type == lite:
self.vray_lights.append(object)
self.object_check.append("vraySettings")
Ошибка, которую я получаю в окне терминала:
Traceback (most recent call last):
File "c:\python27\lib\site-packages\sphinx\ext\autodoc\importer.py", line 154, in import_module
__import__(modname)
File "U:/cwinters/python_git_hub_pub\rebuild_layers.py", line 1425, in <module>
main()
File "U:/cwinters/python_git_hub_pub\rebuild_layers.py", line 1422, in main
layers_tool_inst = LAYERS_WINDOW_TOOL()
File "U:/cwinters/python_git_hub_pub\rebuild_layers.py", line 30, in __init__
self.materials = self.materials_VRayMtl + self.materials_phong + self.materials_blinn + self.materials_lambert + self.materials_surface_shader + self.placement_nodes + self.file_nodes + self.materials_displacement + self.displacement_nodes + self.layeredTexture + self.VRayBlendMtls + self.VRayPlaceEnvTex_nodes + self.ramp_nodes + self.gammaCorrect_nodes + self.multiplyDivide + self.remapHsv + self.remapColor
TypeError: unsupported operand type(s) for +: '_MockObject' and '_MockObject'
Это строка кода, которая, кажется, нарушает ее, но инструмент работает нормально при запуске в Maya, как и предполагалось.
self.materials = self.materials_VRayMtl + self.materials_phong + self.materials_blinn + self.materials_lambert + self.materials_surface_shader + self.placement_nodes + self.file_nodes + self.materials_displacement + self.exse.Ro.To.RisT. + self.VRayPlaceEnvTex_nodes + self.ramp_nodes + self.gammaCorrect_nodes + self.multiplyDivide + self.remapHsv + self.remapColor