Exemplo n.º 1
0
    def _setup_ui(self):

        self.setWindowTitle("Reference Edit Import")
        self.setLayout(QtGui.QVBoxLayout())

        self._selector = RefEditSelector(parent=self)

        # Select as far as we can.
        path = (cmds.file(q=True, sceneName=True)
                or cmds.workspace(q=True, fullName=True) or None)
        if path is not None:
            self._selector.setPath(path, allow_partial=True)

        self.layout().addLayout(self._selector)

        self._type_box = QtGui.QGroupBox("Edit Types")
        self._type_box.setLayout(QtGui.QVBoxLayout())
        self.layout().addWidget(self._type_box)

        self._option_box = QtGui.QGroupBox("Options")
        self._option_box.setLayout(QtGui.QVBoxLayout())
        self.layout().addWidget(self._option_box)

        self._only_selected_checkbox = QtGui.QCheckBox(
            "Only Apply to Selected Nodes", checked=True)
        self._only_selected_checkbox.stateChanged.connect(
            self._node_filters_changed)
        self._option_box.layout().addWidget(self._only_selected_checkbox)

        self._on_selection_parents_checkbox = QtGui.QCheckBox(
            "...or Parents of Selected Nodes", checked=True)
        self._on_selection_parents_checkbox.stateChanged.connect(
            self._node_filters_changed)
        self._option_box.layout().addWidget(
            self._on_selection_parents_checkbox)

        self._on_selection_children_checkbox = QtGui.QCheckBox(
            "...or Children of Selected Nodes", checked=True)
        self._on_selection_children_checkbox.stateChanged.connect(
            self._node_filters_changed)
        self._option_box.layout().addWidget(
            self._on_selection_children_checkbox)

        self._node_box = QtGui.QGroupBox("Nodes")
        self._node_box.setLayout(QtGui.QVBoxLayout())
        self.layout().addWidget(self._node_box)

        button = QtGui.QPushButton("Apply Edits")
        button.clicked.connect(self._on_reference)
        self.layout().addWidget(button)

        self._selector.path_changed = self._path_changed
        self._path_changed(self._selector.path())
Exemplo n.º 2
0
 def _setup_ui(self):
     self._enabled_checkbox = QtGui.QCheckBox()
     self._enabled_checkbox.setChecked(True)
     self._enabled_checkbox.stateChanged.connect(self._on_enabled_change)
     self._cache_name_field = QtGui.QLineEdit(self._cache_name)
     self._cache_name_field.textChanged.connect(self._on_name_change)
     self._on_enabled_change()
Exemplo n.º 3
0
    def _setupGui(self):

        self._enabledCheckbox = QtGui.QCheckBox(checked=True)
        self._enabledCheckbox.stateChanged.connect(self._onEnabledChanged)

        self._nameField = QtGui.QLineEdit(self._export_name)
        self._nameField.textChanged.connect(self._onNameChanged)

        self._onEnabledChanged()
Exemplo n.º 4
0
    def _setup_ui(self):
        self.setWindowTitle('Geocache Import')
        self.setWindowFlags(Qt.Tool)
        self.setMinimumWidth(900)
        self.setMinimumHeight(550)

        main_layout = QtGui.QVBoxLayout()
        self.setLayout(main_layout)

        self._scroll_widget = area = QtGui.QScrollArea()
        main_layout.addWidget(area)
        area.setFrameShape(QtGui.QFrame.NoFrame)
        area.setWidgetResizable(True)

        area_widget = QtGui.QWidget()
        area.setWidget(area_widget)
        self._scroll_layout = QtGui.QVBoxLayout()
        area_widget.setLayout(self._scroll_layout)
        self._scroll_layout.addStretch()

        button_layout = QtGui.QHBoxLayout()
        main_layout.addLayout(button_layout)

        button = QtGui.QPushButton("Add Geocache...")
        button.setMinimumSize(button.sizeHint().expandedTo(QtCore.QSize(
            100, 0)))
        button_layout.addWidget(button)
        button.clicked.connect(self._on_add_geocache)

        self._sync_timeline_checkbox = QtGui.QCheckBox("Sync Timeline")
        self._sync_timeline_checkbox.setChecked(True)
        button_layout.addWidget(self._sync_timeline_checkbox)

        button_layout.addStretch()

        button = QtGui.QPushButton("Apply")
        button.setMinimumSize(button.sizeHint().expandedTo(QtCore.QSize(
            100, 0)))
        button_layout.addWidget(button)
        button.clicked.connect(self._on_apply_clicked)

        button = QtGui.QPushButton("Save")
        button.setMinimumSize(button.sizeHint().expandedTo(QtCore.QSize(
            100, 0)))
        button_layout.addWidget(button)
        button.clicked.connect(self._on_save_clicked)
Exemplo n.º 5
0
 def _setup_ui(self):
     
     self.setWindowTitle("Reference Edit Export")
     self.setLayout(QtGui.QVBoxLayout())
     self.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
     
     group = QtGui.QGroupBox('References')
     self.layout().addWidget(group)
     group.setLayout(QtGui.QVBoxLayout())
     
     self._refs = []
     for ref_path in cmds.file(q=True, reference=True):
         ref_name = cmds.file(ref_path, q=True, namespace=True)
         checkbox = QtGui.QCheckBox(ref_name)
         checkbox.setChecked(True)
         group.layout().addWidget(checkbox)
         self._refs.append((ref_name, ref_path, checkbox))
     
     self._exporter = RefEditExporter()
     self._exporter_widget = sgpublish.exporter.ui.tabwidget.Widget()
     self.layout().addWidget(self._exporter_widget)
     
     # Work area.
     tab = sgpublish.exporter.ui.workarea.Widget(self._exporter, {
         'directory': 'data/refedits',
         'sub_directory': '',
         'extension': '.mel',
         'warning': self._warning,
         'error': self._warning,
     })
     self._exporter_widget.addTab(tab, "Export to Work Area")
     
     # SGPublishes.
     tab = sgpublish.exporter.ui.publish.maya.Widget(self._exporter)
     tab.beforeScreenshot.connect(lambda *args: self.hide())
     tab.afterScreenshot.connect(lambda *args: self.show())
     self._exporter_widget.addTab(tab, "Publish to Shotgun")
     
     button_row = QtGui.QHBoxLayout()
     button_row.addStretch()
     self.layout().addLayout(button_row)
     
     self._button = button = QtGui.QPushButton("Export")
     button.clicked.connect(self._on_export)
     button_row.addWidget(button)
Exemplo n.º 6
0
    def _setup_ui(self):

        self.setWindowTitle("Camera Export")
        self.setLayout(QtGui.QVBoxLayout())
        self.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)

        camera_row = QtGui.QHBoxLayout()
        camera_row.setSpacing(2)
        self.layout().addLayout(camera_row)

        self._cameras = QtGui.QComboBox()
        camera_row.addWidget(self._cameras)
        self._cameras.activated.connect(self._on_cameras_changed)

        button = QtGui.QPushButton("Reload")
        button.clicked.connect(self._on_reload)
        button.setFixedHeight(self._cameras.sizeHint().height())
        button.setFixedWidth(button.sizeHint().width())
        camera_row.addWidget(button)

        box = QtGui.QGroupBox("Manifest Summary")
        self.layout().addWidget(box)
        box.setLayout(QtGui.QVBoxLayout())
        self._summary = QtGui.QLabel("Select a camera.")
        box.layout().addWidget(self._summary)
        box.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)

        box = QtGui.QGroupBox("Options")
        self.layout().addWidget(box)
        box.setLayout(QtGui.QVBoxLayout())
        self._worldSpaceBox = QtGui.QCheckBox(
            "Bake to World Space (for debugging)")
        box.layout().addWidget(self._worldSpaceBox)

        self._exporter = CameraExporter()
        self._exporter_widget = sgpublish.exporter.ui.tabwidget.Widget()
        self.layout().addWidget(self._exporter_widget)

        # SGPublishes.
        tab = sgpublish.exporter.ui.publish.maya.Widget(self._exporter)
        tab.beforeScreenshot.connect(lambda *args: self.hide())
        tab.afterScreenshot.connect(lambda *args: self.show())
        self._exporter_widget.addTab(tab, "Publish to Shotgun")

        # Work area.
        tab = sgpublish.exporter.ui.workarea.Widget(
            self._exporter, {
                'directory': 'scenes/camera',
                'sub_directory': '',
                'extension': '.ma',
                'warning': self._warning,
                'error': self._warning,
            })
        self._exporter_widget.addTab(tab, "Export to Work Area")

        button_row = QtGui.QHBoxLayout()
        button_row.addStretch()
        self.layout().addLayout(button_row)

        self._button = button = QtGui.QPushButton("Export")
        button.clicked.connect(self._on_export)
        button_row.addWidget(button)

        self._populate_cameras()
Exemplo n.º 7
0
    def _init_ui(self):
        self.setWindowTitle('Geocache Export')
        self.setMinimumWidth(600)
        self.setLayout(QtGui.QVBoxLayout())

        pattern_layout = QtGui.QHBoxLayout()
        self.layout().addLayout(pattern_layout)
        pattern_layout.addWidget(QtGui.QLabel("Set Pattern:"))
        self._pattern_field = field = QtGui.QLineEdit('__cache__*')
        field.returnPressed.connect(self._reload)
        pattern_layout.addWidget(field)
        self._reload_button = button = QtGui.QPushButton('Reload')
        button.clicked.connect(self._reload)
        pattern_layout.addWidget(button)

        tree = self._sets_tree = QtGui.QTreeWidget()
        tree.setFrameShadow(QtGui.QFrame.Plain)
        tree.setColumnCount(3)
        tree.setHeaderLabels(['Geometry', '', 'Export Name'])
        self.layout().addWidget(tree)
        tree.viewport().setBackgroundRole(QtGui.QPalette.Window)

        self._reload()

        options_box = QtGui.QGroupBox('Options')
        self.layout().addWidget(options_box)
        options_box.setLayout(QtGui.QVBoxLayout())

        version = int(cmds.about(version=True).split()[0])
        layout = QtGui.QHBoxLayout()
        options_box.layout().addLayout(layout)
        label = QtGui.QLabel("Store Points In:")
        label.setEnabled(version >= 2013)
        layout.addWidget(label)
        group = QtGui.QButtonGroup()
        self._local_radio = QtGui.QRadioButton('Local Space')
        self._local_radio.setEnabled(version >= 2013)
        group.addButton(self._local_radio)
        layout.addWidget(self._local_radio)
        self._world_radio = QtGui.QRadioButton('World Space')
        self._world_radio.setEnabled(version >= 2013)
        group.addButton(self._world_radio)
        layout.addWidget(self._world_radio)
        layout.addStretch()
        if version < 2013:
            label = QtGui.QLabel('(only in 2013+)')
            label.setEnabled(False)
            layout.addWidget(label)
            self._local_radio.setChecked(True)
        else:
            self._world_radio.setChecked(True)

        self._abc_check = QtGui.QCheckBox("Also export as Alembic")
        options_box.layout().addWidget(self._abc_check)
        if hasattr(cmds, 'AbcExport'):
            self._abc_check.setChecked(True)
        else:
            self._abc_check.setDisabled(True)

        self._exporter = Exporter()
        self._exporter_widget = sgpublish.exporter.ui.tabwidget.Widget()
        self.layout().addWidget(self._exporter_widget)

        # SGPublishes.
        tab = sgpublish.exporter.ui.publish.maya.Widget(self._exporter)
        tab.beforeScreenshot.connect(lambda *args: self.hide())
        tab.afterScreenshot.connect(lambda *args: self.show())
        self._exporter_widget.addTab(tab, "Publish to Shotgun")

        # Work area.
        tab = sgpublish.exporter.ui.workarea.Widget(
            self._exporter, {
                'directory': 'data/geo_cache',
                'sub_directory': '',
                'extension': '',
                'workspace': cmds.workspace(q=True, fullName=True) or None,
                'filename': cmds.file(q=True, sceneName=True) or None,
                'warning': self._warning,
                'error': self._warning,
            })
        self._exporter_widget.addTab(tab, "Export to Work Area")

        button_layout = QtGui.QHBoxLayout()
        self.layout().addLayout(button_layout)

        button_layout.addStretch()

        button = self._local_button = QtGui.QPushButton("Process Locally")
        button.clicked.connect(self._on_process_button)
        button_layout.addWidget(button)

        button = self._qube_button = QtGui.QPushButton("Process on Farm")
        button.clicked.connect(self._on_queue_button)
        button_layout.addWidget(button)
Exemplo n.º 8
0
    def _path_changed(self, path):

        self._path = path

        for child in self._type_box.children():
            if isinstance(child, QtGui.QWidget):
                child.hide()
                child.destroy()
        for child in self._node_box.children():
            if isinstance(child, QtGui.QWidget):
                child.hide()
                child.destroy()

        if path is None:
            self._type_box.layout().addWidget(QtGui.QLabel("Nothing"))
            self._option_box.layout().addWidget(QtGui.QLabel("Nothing"))
            return

        self._parse_file(path)

        self._command_boxes = []
        for command in sorted(set(e.command for e in self._edits)):
            checkbox = QtGui.QCheckBox(command)
            checkbox.setChecked(command == 'setAttr')
            self._command_boxes.append(checkbox)
            self._type_box.layout().addWidget(checkbox)

        self._node_boxes = []
        all_nodes = set()
        for e in self._edits:
            all_nodes.update(e.nodes)

        node_filter = None
        if self._only_selected_checkbox.isChecked():
            node_filter = set(cmds.ls(selection=True, long=True) or ())

        if self._on_selection_parents_checkbox.isChecked():
            node_filter = node_filter or set()
            visited = set()
            to_visit = set(cmds.ls(selection=True, long=True) or ())
            while to_visit:
                node = to_visit.pop()
                node_filter.add(node)
                if node in visited:
                    continue
                visited.add(node)
                to_visit.update(
                    cmds.listRelatives(node, allParents=True, fullPath=True)
                    or ())

        if self._on_selection_children_checkbox.isChecked():
            node_filter = node_filter or set()
            for node in cmds.ls(selection=True, long=True) or ():
                node_filter.update(
                    cmds.listRelatives(
                        node, allDescendents=True, fullPath=True) or ())

        if node_filter is not None:
            all_nodes.intersection_update(node_filter)

        for node in sorted(all_nodes):
            checkbox = QtGui.QCheckBox(node, checked=True)
            self._node_boxes.append(checkbox)
            self._node_box.layout().addWidget(checkbox)