Ejemplo n.º 1
0
    def addControl(self, control, uiType, defaultValue=None):

        if not UIType.isTypeOf(uiType, UIType.TypesAll):
            message('Cannot add unknown control type ({0}) for {1}. Skipped'.format(uiType, str(control)))
            return

        if UIType.isTypeOf(uiType, UIType.TypesPYQT | UIType.TypesPYSIDE):
            controller = ctrl_qt.getController(uiType, control, defaultValue)
            if controller:
                self.controllers.append(controller)
            else:
                message('Failed to add controller (type={0}) for {1}'.format(uiType, str(control)))
            return

        if UIType.isTypeOf(uiType, UIType.TypesM):
            if ctrl_maya:
                self.controllers.append(ctrl_maya.getController(uiType, control, defaultValue))
            else:
                message('Failed to add controller (type={0}) for {1}'.format(uiType, str(control)))
            return

        if UIType.isTypeOf(uiType, UIType.TypesPM):
            if ctrl_pymel:
                self.controllers.append(ctrl_pymel.getController(uiType, control, defaultValue))
            else:
                message('Failed to add controller (type={0}) for {1}'.format(uiType, str(control)))
            return

        assert False, 'Failed to add a controller.'
Ejemplo n.º 2
0
    def addControl(self, control, uiType, defaultValue=None):

        if not UIType.isTypeOf(uiType, UIType.TypesAll):
            message('Cannot add unknown control type ({0}) for {1}. Skipped'.
                    format(uiType, str(control)))
            return

        if UIType.isTypeOf(uiType, UIType.TypesPYQT | UIType.TypesPYSIDE):
            controller = ctrl_qt.getController(uiType, control, defaultValue)
            if controller:
                self.controllers.append(controller)
            else:
                message('Failed to add controller (type={0}) for {1}'.format(
                    uiType, str(control)))
            return

        if UIType.isTypeOf(uiType, UIType.TypesM):
            if ctrl_maya:
                self.controllers.append(
                    ctrl_maya.getController(uiType, control, defaultValue))
            else:
                message('Failed to add controller (type={0}) for {1}'.format(
                    uiType, str(control)))
            return

        if UIType.isTypeOf(uiType, UIType.TypesPM):
            if ctrl_pymel:
                self.controllers.append(
                    ctrl_pymel.getController(uiType, control, defaultValue))
            else:
                message('Failed to add controller (type={0}) for {1}'.format(
                    uiType, str(control)))
            return

        assert False, 'Failed to add a controller.'
Ejemplo n.º 3
0
def getController(uiType, control, defaultValue):

    if uiType in constructors:

        if UIType.isTypeOf(uiType, UIType.TypesPYQT):
            if _PyQt4:
                return constructors[uiType](_PyQt4, control, defaultValue)
            else:
                message('Cannot create controller: PyQt is not available.')
                return

        if UIType.isTypeOf(uiType, UIType.TypesPYSIDE):
            if _PySide:
                return constructors[uiType](_PySide, control, defaultValue)
            else:
                message('Cannot create controller: PySide is not available.')
                return
Ejemplo n.º 4
0
def getController(uiType, control, defaultValue):

    if uiType in constructors:

        if UIType.isTypeOf(uiType, UIType.TypesPYQT):
            if _PyQt4:
                return constructors[uiType](_PyQt4, control, defaultValue)
            else:
                message('Cannot create controller: PyQt is not available.')
                return

        if UIType.isTypeOf(uiType, UIType.TypesPYSIDE):
            if _PySide:
                return constructors[uiType](_PySide, control, defaultValue)
            else:
                message('Cannot create controller: PySide is not available.')
                return