Beispiel #1
0
    def widget(self, container):
        widget = QtWidgets.QFrame()
        widget.setFrameStyle(QtWidgets.QFrame.StyledPanel)

        hbox = QtWidgets.QHBoxLayout(widget)
        hbox.setContentsMargins(0, 0, 0, 0)
        label = QtWidgets.QLabel(container['drivers'].verbose_name)
        hbox.addWidget(label)
        drivers_widget = container['drivers'].widget()
        drivers_widget.setMaximumHeight(65)
        hbox.addWidget(drivers_widget)

        vbox = QtWidgets.QVBoxLayout()
        hbox.addLayout(vbox)

        hbox1 = QtWidgets.QHBoxLayout()
        vbox.addLayout(hbox1)
        label = QtWidgets.QLabel(container['driven'].verbose_name)
        hbox1.addWidget(label)
        hbox1.addWidget(container['driven'].widget())
        hbox1.addWidget(container['maintain_offset'].widget())

        hbox2 = QtWidgets.QHBoxLayout()
        vbox.addLayout(hbox2)
        hbox2.setContentsMargins(0, 0, 0, 0)
        hbox2.addWidget(container['skip_tx'].widget())
        hbox2.addWidget(container['skip_ty'].widget())
        hbox2.addWidget(container['skip_tz'].widget())
        hbox2.addStretch()

        hbox3 = QtWidgets.QHBoxLayout()
        vbox.addLayout(hbox3)
        hbox3.setContentsMargins(0, 0, 0, 0)
        hbox3.addWidget(container['skip_rx'].widget())
        hbox3.addWidget(container['skip_ry'].widget())
        hbox3.addWidget(container['skip_rz'].widget())
        hbox3.addStretch()

        return widget
Beispiel #2
0
    def __init__(self, parent=None):
        super(WeightRemapDialog, self).__init__(parent)
        self.setWindowTitle('Remap Weights')
        self.setObjectName('remapWeightsUI')
        self.setModal(True)
        self.resize(600, 400)
        self.mapping = {}

        mainvbox = QtWidgets.QVBoxLayout(self)

        label = QtWidgets.QLabel('The following influences have no corresponding influence from the ' \
                             'imported file.  You can either remap the influences or skip them.')
        label.setWordWrap(True)
        mainvbox.addWidget(label)

        hbox = QtWidgets.QHBoxLayout()
        mainvbox.addLayout(hbox)

        # The existing influences that didn't have weight imported
        vbox = QtWidgets.QVBoxLayout()
        hbox.addLayout(vbox)
        vbox.addWidget(QtWidgets.QLabel('Unmapped influences'))
        self.existing_influences = QtWidgets.QListWidget()
        vbox.addWidget(self.existing_influences)

        vbox = QtWidgets.QVBoxLayout()
        hbox.addLayout(vbox)
        vbox.addWidget(QtWidgets.QLabel('Available imported influences'))
        widget = QtWidgets.QScrollArea()
        self.imported_influence_layout = QtWidgets.QVBoxLayout(widget)
        vbox.addWidget(widget)

        hbox = QtWidgets.QHBoxLayout()
        mainvbox.addLayout(hbox)
        hbox.addStretch()
        btn = QtWidgets.QPushButton('Ok')
        btn.released.connect(self.accept)
        hbox.addWidget(btn)
Beispiel #3
0
    def widget(self, container):
        widget = QtWidgets.QFrame()
        widget.setFrameStyle(QtWidgets.QFrame.NoFrame)
        layout = QtWidgets.QHBoxLayout(widget)
        layout.addWidget(container['operation'].widget())

        file_path_widget = container['file_path'].widget()
        file_path_widget.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
        layout.addWidget(file_path_widget)

        layout.addWidget(QtWidgets.QLabel(container['namespace'].verbose_name))
        namespace_widget = container['namespace'].widget()
        namespace_widget.setMaximumWidth(150)
        namespace_widget.setSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
        layout.addWidget(namespace_widget)

        return widget
Beispiel #4
0
    def widget(self, container):
        # The fields will be arranged in two row containers
        # [[driver, driven], [name, twist, swing, twistAxis]]
        widget = QtWidgets.QFrame()
        widget.setFrameStyle(QtWidgets.QFrame.StyledPanel)
        vbox = QtWidgets.QVBoxLayout(widget)

        for attrs in [
            ['driver', 'driven'],
            ['name', 'twist', 'swing', 'twist_axis'],
        ]:
            hbox = QtWidgets.QHBoxLayout(widget)
            vbox.addLayout(hbox)
            hbox.setContentsMargins(0, 0, 0, 0)
            for attr in attrs:
                hbox.addWidget(QtWidgets.QLabel(container[attr].verbose_name))
                hbox.addWidget(container[attr].widget())

        return widget
Beispiel #5
0
    def __init__(self, comp, queue, parent=None):
        super(ComponentWidget, self).__init__(parent)
        self.setMouseTracking(True)
        self.queue_layout = parent.queue_layout
        self.queue = queue
        self.comp = comp
        vbox = QtWidgets.QVBoxLayout(self)
        self.setFrameStyle(QtWidgets.QFrame.StyledPanel)
        self.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                           QtWidgets.QSizePolicy.Maximum)
        self.over_grab_hotspot = False
        self.color = ComponentWidget.normal_color

        # Header
        hbox = QtWidgets.QHBoxLayout()
        self.header_layout = hbox
        hbox.setContentsMargins(16, 4, 4, 4)
        vbox.addLayout(hbox)

        # Expand toggle
        expand_action = QtWidgets.QAction('Toggle', self)
        expand_action.setCheckable(True)
        icon = QtGui.QIcon(QtGui.QPixmap(':/arrowDown.png'))
        expand_action.setIcon(icon)
        expand_action.setToolTip('Toggle details')
        expand_action.setStatusTip('Toggle details')
        button = QtWidgets.QToolButton()
        button.setDefaultAction(expand_action)
        hbox.addWidget(button)

        # Enable checkbox
        enabled = QtWidgets.QCheckBox()
        enabled.setToolTip('Enable/Disable Component')
        hbox.addWidget(enabled)

        # Breakpoint
        self.break_point_action = QtWidgets.QAction('Breakpoint', self)
        self.break_point_action.setCheckable(True)
        self.break_point_action.setIcon(self.break_point_disabled_icon)
        self.break_point_action.setToolTip('Set break point at component.')
        self.break_point_action.setStatusTip('Set break point at component.')
        self.break_point_action.toggled.connect(self.set_break_point)
        button = QtWidgets.QToolButton()
        button.setDefaultAction(self.break_point_action)
        hbox.addWidget(button)

        # Execute button
        action = QtWidgets.QAction('Execute', self)
        icon = QtGui.QIcon(QtGui.QPixmap(':/timeplay.png'))
        action.setIcon(icon)
        action.setToolTip('Execute the component')
        action.setStatusTip('Execute the component')
        action.triggered.connect(
            partial(self.execute_component,
                    on_error=parent.on_component_execution_error))
        button = QtWidgets.QToolButton()
        button.setDefaultAction(action)
        hbox.addWidget(button)

        # Image label
        label = QtWidgets.QLabel()
        label.setPixmap(comp.image(size=24))
        label.setToolTip(comp.__class__.__doc__)
        hbox.addWidget(label)

        # Name label
        label = QtWidgets.QLabel(comp.name().split('.')[-1])
        label.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                            QtWidgets.QSizePolicy.Fixed)
        label.setToolTip(comp.__class__.__doc__)
        font = QtGui.QFont()
        font.setPointSize(14)
        label.setFont(font)
        hbox.addWidget(label)
        hbox.addStretch()

        if comp.help_url():
            action = QtWidgets.QAction('Help', self)
            icon = QtGui.QIcon(QtGui.QPixmap(':/help.png'))
            action.setIcon(icon)
            action.setToolTip('Open help documentation.')
            action.setStatusTip('Open help documentation.')
            action.triggered.connect(partial(webbrowser.open, comp.help_url()))
            button = QtWidgets.QToolButton()
            button.setDefaultAction(action)
            hbox.addWidget(button)

        action = QtWidgets.QAction('Delete', self)
        icon = QtGui.QIcon(QtGui.QPixmap(':/smallTrash.png'))
        action.setIcon(icon)
        message = 'Delete Component'
        action.setToolTip(message)
        action.setStatusTip(message)
        action.triggered.connect(partial(self.remove, prompt=True))
        button = QtWidgets.QToolButton()
        button.setDefaultAction(action)
        hbox.addWidget(button)

        content_vbox = QtWidgets.QVBoxLayout()
        content_vbox.setContentsMargins(16, 0, 0, 0)
        vbox.addLayout(content_vbox)

        content_widget = comp.widget()
        content_vbox.addWidget(content_widget)
        enabled.toggled.connect(content_widget.setEnabled)
        enabled.setChecked(comp.enabled)
        enabled.toggled.connect(comp.set_enabled)
        expand_action.toggled.connect(content_widget.setVisible)
        content_widget.setVisible(False)
Beispiel #6
0
    def __init__(self, parent=None):
        super(ControlWindow, self).__init__(parent)
        self.setWindowTitle('CMT Control Creator')
        self.resize(300, 500)
        vbox = QtWidgets.QVBoxLayout(self)

        size = 20
        label_width = 60
        icon_left = QtGui.QIcon(
            QtGui.QPixmap(':/nudgeLeft.png').scaled(size, size))
        icon_right = QtGui.QIcon(
            QtGui.QPixmap(':/nudgeRight.png').scaled(size, size))
        validator = QtGui.QDoubleValidator(-180.0, 180.0, 2)
        grid = QtWidgets.QGridLayout()
        vbox.addLayout(grid)

        # Rotate X
        label = QtWidgets.QLabel('Rotate X')
        label.setMaximumWidth(label_width)
        grid.addWidget(label, 0, 0, QtCore.Qt.AlignRight)
        b = QtWidgets.QPushButton(icon_left, '')
        b.released.connect(partial(self.rotate_x, direction=-1))
        grid.addWidget(b, 0, 1)
        self.offset_x = QtWidgets.QLineEdit('45.0')
        self.offset_x.setValidator(validator)
        grid.addWidget(self.offset_x, 0, 2)
        b = QtWidgets.QPushButton(icon_right, '')
        b.released.connect(partial(self.rotate_x, direction=1))
        grid.addWidget(b, 0, 3)

        # Rotate Y
        label = QtWidgets.QLabel('Rotate Y')
        label.setMaximumWidth(label_width)
        grid.addWidget(label, 1, 0, QtCore.Qt.AlignRight)
        b = QtWidgets.QPushButton(icon_left, '')
        b.released.connect(partial(self.rotate_y, direction=-1))
        grid.addWidget(b, 1, 1)
        self.offset_y = QtWidgets.QLineEdit('45.0')
        self.offset_y.setValidator(validator)
        grid.addWidget(self.offset_y, 1, 2)
        b = QtWidgets.QPushButton(icon_right, '')
        b.released.connect(partial(self.rotate_y, direction=1))
        grid.addWidget(b, 1, 3)

        # Rotate Z
        label = QtWidgets.QLabel('Rotate Z')
        label.setMaximumWidth(label_width)
        grid.addWidget(label, 2, 0, QtCore.Qt.AlignRight)
        b = QtWidgets.QPushButton(icon_left, '')
        b.released.connect(partial(self.rotate_z, direction=-1))
        grid.addWidget(b, 2, 1)
        self.offset_z = QtWidgets.QLineEdit('45.0')
        self.offset_z.setValidator(validator)
        grid.addWidget(self.offset_z, 2, 2)
        b = QtWidgets.QPushButton(icon_right, '')
        b.released.connect(partial(self.rotate_z, direction=1))
        grid.addWidget(b, 2, 3)
        grid.setColumnStretch(2, 2)

        hbox = QtWidgets.QHBoxLayout()
        vbox.addLayout(hbox)
        b = QtWidgets.QPushButton('Export Selected')
        b.released.connect(self.dump_controls)
        hbox.addWidget(b)

        b = QtWidgets.QPushButton('Set Color')
        b.released.connect(self.set_color)
        hbox.addWidget(b)

        hbox = QtWidgets.QHBoxLayout()
        vbox.addLayout(hbox)
        b = QtWidgets.QPushButton('Create Selected')
        b.released.connect(self.create_selected)
        hbox.addWidget(b)

        b = QtWidgets.QPushButton('Remove Selected')
        b.released.connect(self.remove_selected)
        hbox.addWidget(b)

        hbox = QtWidgets.QHBoxLayout()
        vbox.addLayout(hbox)
        self.stack_count = QtWidgets.QSpinBox()
        self.stack_count.setValue(2)
        hbox.addWidget(self.stack_count)

        b = QtWidgets.QPushButton('Create Transform Stack')
        b.released.connect(self.create_transform_stack)
        b.setToolTip('Creates a transform stack above each selected node.')
        hbox.addWidget(b)

        self.control_list = QtWidgets.QListWidget()
        self.control_list.setSelectionMode(
            QtWidgets.QAbstractItemView.ExtendedSelection)
        vbox.addWidget(self.control_list)

        self.populate_controls()