コード例 #1
0
    def populateUI(self, widget, properties=None, cut_support=False):
        """returns a tuple of added uiProperties"""
        if properties is None:
            properties = self._preset.properties()

        layout = PySide.QtGui.QFormLayout()

        collateTracksToolTip = """Enable this to include other shots which overlap the sequence time of each shot within the script. Cannot be enabled when Read Node overrides are set."""
        key = "collateTracks"
        value = False
        label = "Collate Shot Timings:"
        self._collateTimeProperty = UIPropertyFactory.create(type(value), key=key, value=value, dictionary=properties, label=label, tooltip=collateTracksToolTip)
        layout.addRow(label, self._collateTimeProperty)

        collateShotNameToolTip = """Enable this to include other shots which have the same name in the Nuke script. Cannot be enabled when Read Node overrides are set."""
        key = "collateShotNames"
        value = False
        label = "Collate Shot Name:"
        self._collateNameProperty = UIPropertyFactory.create(type(value), key=key, value=value, dictionary=properties, label=label, tooltip=collateShotNameToolTip)
        layout.addRow(label, self._collateNameProperty)

        if cut_support:
            cut_lbl = PySide.QtGui.QLabel(
                "NOTE: Cuts in Shotgun are only created when collate is off."
            )
            color_role = PySide.QtGui.QPalette.WindowText
            palette = widget.palette()
            darker_color = palette.color(color_role).darker(150)
            palette.setColor(color_role, darker_color)
            cut_lbl.setPalette(palette)
            layout.addRow(cut_lbl)

        widget.setLayout(layout)
        return (self._collateTimeProperty, self._collateNameProperty)
コード例 #2
0
    def populateUI(self, widget, properties=None):
        """returns a tuple of added uiProperties"""
        if properties is None:
            properties = self._preset.properties()

        layout = PySide.QtGui.QFormLayout()

        collateTracksToolTip = """Enable this to include other shots which overlap the sequence time of each shot within the script. Cannot be enabled when Read Node overrides are set."""
        key = "collateTracks"
        value = False
        label = "Collate Shot Timings:"
        self._collateTimeProperty = UIPropertyFactory.create(
            type(value),
            key=key,
            value=value,
            dictionary=properties,
            label=label,
            tooltip=collateTracksToolTip)
        layout.addRow(label, self._collateTimeProperty)

        collateShotNameToolTip = """Enable this to include other shots which have the same name in the Nuke script. Cannot be enabled when Read Node overrides are set."""
        key = "collateShotNames"
        value = False
        label = "Collate Shot Name:"
        self._collateNameProperty = UIPropertyFactory.create(
            type(value),
            key=key,
            value=value,
            dictionary=properties,
            label=label,
            tooltip=collateShotNameToolTip)
        layout.addRow(label, self._collateNameProperty)

        widget.setLayout(layout)
        return (self._collateTimeProperty, self._collateNameProperty)
コード例 #3
0
    def add_task_type_options(self, parent_layout, export_items):
        '''Create task type options widget for *export_items* with parent *parent_layout*.'''
        # provide access to tags.
        task_tags = set()
        for exportItem in export_items:
            item = exportItem.item()
            if not hasattr(item, 'tags'):
                continue

            for tag in item.tags():
                meta = tag.metadata()
                if meta.hasKey('type') and meta.value('type') == 'ftrack':
                    task_name = meta.value('ftrack.name')
                    task_tags.add(task_name)

        task_tags = sorted(list(task_tags)) or [
            self._preset.properties()['ftrack']['task_type']
        ]
        key, value, label = 'task_type', list(task_tags), 'Publish to task'
        tooltip = 'Select a task to publish to.'

        self.task_type_options_widget = UIPropertyFactory.create(
            type(value),
            key=key,
            value=value,
            dictionary=self._preset.properties()['ftrack'],
            label=label + ':',
            tooltip=tooltip)
        parent_layout.addRow(label + ':', self.task_type_options_widget)
        self.task_type_options_widget.update(True)
コード例 #4
0
    def populateUI(self, widget, properties=None, cut_support=False):
        """returns a tuple of added uiProperties"""
        if properties is None:
            properties = self._preset.properties()

        layout = QtGui.QFormLayout()

        collateTracksToolTip = """Enable this to include other shots which overlap the sequence time of each shot within the script. Cannot be enabled when Read Node overrides are set."""
        key = "collateTracks"
        value = False
        label = "Collate Shot Timings:"
        self._collateTimeProperty = UIPropertyFactory.create(
            type(value),
            key=key,
            value=value,
            dictionary=properties,
            label=label,
            tooltip=collateTracksToolTip,
        )
        layout.addRow(label, self._collateTimeProperty)

        collateShotNameToolTip = """Enable this to include other shots which have the same name in the Nuke script. Cannot be enabled when Read Node overrides are set."""
        key = "collateShotNames"
        value = False
        label = "Collate Shot Name:"
        self._collateNameProperty = UIPropertyFactory.create(
            type(value),
            key=key,
            value=value,
            dictionary=properties,
            label=label,
            tooltip=collateShotNameToolTip,
        )
        layout.addRow(label, self._collateNameProperty)

        if cut_support:
            cut_lbl = QtGui.QLabel(
                "NOTE: Cuts in SG are only created when collate is off.")
            color_role = QtGui.QPalette.WindowText
            palette = widget.palette()
            darker_color = palette.color(color_role).darker(150)
            palette.setColor(color_role, darker_color)
            cut_lbl.setPalette(palette)
            layout.addRow(cut_lbl)

        widget.setLayout(layout)
        return (self._collateTimeProperty, self._collateNameProperty)
コード例 #5
0
    def add_reviewable_options(self, parent_layout):
        '''Create reviewable options widget with parent *parent_layout*.'''
        key, value, label = 'opt_publish_reviewable', True, 'Publish reviewable'
        tooltip = 'Upload reviewable'

        self.reviewable_options_widget = UIPropertyFactory.create(
            type(value),
            key=key,
            value=value,
            dictionary=self._preset.properties()['ftrack'],
            label=label + ':',
            tooltip=tooltip)
        parent_layout.addRow(label + ':', self.reviewable_options_widget)
コード例 #6
0
    def addFtrackTaskUI(self, parent_layout, exportTemplate):
        current_task_name = self._preset.name()
        key, value, label = 'component_name', current_task_name, 'Component name'
        tooltip = 'Component Name'

        task_name_options_widget = UIPropertyFactory.create(
            type(value),
            key=key,
            value=value,
            dictionary=self._preset.properties()['ftrack'],
            label=label + ':',
            tooltip=tooltip)
        parent_layout.addRow(label + ':', task_name_options_widget)
コード例 #7
0
 def add_asset_name_options(self, parent_layout):
     '''Create asset name options widget with parent *parent_layout*.'''
     asset_name = self._preset.properties()['ftrack']['asset_name']
     key, value, label = 'asset_name', asset_name, 'Asset name'
     tooltip = 'Select an asset name to publish to.'
     self.asset_name_options_widget = UIPropertyFactory.create(
         type(value),
         key=key,
         value=value,
         dictionary=self._preset.properties()['ftrack'],
         label=label + ':',
         tooltip=tooltip)
     parent_layout.addRow(label + ':', self.asset_name_options_widget)
     self.asset_name_options_widget.update(True)
コード例 #8
0
    def add_thumbnail_options(self, parent_layout):
        '''Create thumbnail options widget with parent *parent_layout*.'''
        # Thumbanil generation.
        key, value, label = 'opt_publish_thumbnail', True, 'Publish thumbnail'
        tooltip = 'Generate and upload thumbnail'

        self.thumbnail_options_widget = UIPropertyFactory.create(
            type(value),
            key=key,
            value=value,
            dictionary=self._preset.properties()['ftrack'],
            label=label + ':',
            tooltip=tooltip)
        parent_layout.addRow(label + ':', self.thumbnail_options_widget)
コード例 #9
0
    def populateUI(self, widget, properties=None):
        """returns a tuple of added uiProperties"""
        if properties is None:
            properties = self._preset.properties()

        layout = PySide.QtGui.QFormLayout()

        collateTracksToolTip = """Enable this to include other shots which overlap the sequence time of each shot within the script. Cannot be enabled when Read Node overrides are set."""
        key = "collateTracks"
        value = False
        label = "Collate Shot Timings:"
        self._collateTimeProperty = UIPropertyFactory.create(type(value), key=key, value=value, dictionary=properties, label=label, tooltip=collateTracksToolTip)
        layout.addRow(label, self._collateTimeProperty)

        collateShotNameToolTip = """Enable this to include other shots which have the same name in the Nuke script. Cannot be enabled when Read Node overrides are set."""
        key = "collateShotNames"
        value = False
        label = "Collate Shot Name:"
        self._collateNameProperty = UIPropertyFactory.create(type(value), key=key, value=value, dictionary=properties, label=label, tooltip=collateShotNameToolTip)
        layout.addRow(label, self._collateNameProperty)

        widget.setLayout(layout)
        return (self._collateTimeProperty, self._collateNameProperty)
コード例 #10
0
    def add_asset_type_options(self, parent_layout):
        '''Create asset type options widget with parent *parent_layout*.'''
        asset_types = self.session.query('AssetType').all()

        asset_type_names = [asset_type['name'] for asset_type in asset_types]
        key, value, label = 'asset_type_name', asset_type_names, 'Asset type'
        tooltip = 'Asset type to be created.'

        self.asset_type_options_widget = UIPropertyFactory.create(
            type(value),
            key=key,
            value=value,
            dictionary=self._preset.properties()['ftrack'],
            label=label + ':',
            tooltip=tooltip)
        parent_layout.addRow(label + ':', self.asset_type_options_widget)
        self.asset_type_options_widget.update(True)
コード例 #11
0
    def add_project_options(self, parent_layout):
        '''Create project options widget with parent *parent_layout*.'''

        project_id = os.getenv('FTRACK_CONTEXTID')
        project = self.session.get('Project', project_id)

        self.logger.info('Project: {}'.format(project))
        key, value, label = 'project_name', str(
            project['full_name']), 'Create under project'
        tooltip = 'Updating/Creating Project.'

        self.project_options_widget = UIPropertyFactory.create(type(value),
                                                               key=key,
                                                               value=value,
                                                               dictionary={},
                                                               label=label +
                                                               ':',
                                                               tooltip=tooltip)
        parent_layout.addRow(label + ':', self.project_options_widget)
        self.project_options_widget.setDisabled(True)
コード例 #12
0
    def addTaskSelector(self, parent_layout, exportTemplate):
        '''Provide widget praented to *layout* to select
        from available instanciated tasks from *exportTemplate*.
        '''
        available_tasks_names = [
            preset.name() for path, preset in exportTemplate.flatten()
            if (isinstance(preset, TranscodePreset))
        ]

        key, value, label = 'reference_task', available_tasks_names, 'Source component'
        tooltip = 'Select component output as input for nuke script read node.'

        available_tasks_options = UIPropertyFactory.create(
            type(value),
            key=key,
            value=value,
            dictionary=self._preset.properties()['ftrack'],
            label=label + ':',
            tooltip=tooltip)
        parent_layout.addRow(label + ':', available_tasks_options)
        available_tasks_options.update(True)
コード例 #13
0
  def populateUI(self, widget, exportTemplate):
    if exportTemplate:
        self._exportTemplate = exportTemplate
        properties = self._preset.properties()
      
        layout = PySide.QtGui.QFormLayout()
        layout.setContentsMargins(9, 0, 9, 0)
        widget.setLayout(layout)
        layout.addRow(PySide.QtGui.QLabel("Note : Created Render Modules can only currently be set to TIFF."))
        
        #Add auto-save checkbox
        key, value, label = "autoSaveProject", True, "Auto-Save Project"
        uiProperty = UIPropertyFactory.create(type(value), key=key, value=value, dictionary=self._preset._properties, label=label+":", tooltip=label)
        
        layout.addRow(label+":", uiProperty)
        uiProperty.setToolTip("Auto-saves the newly generated project as a .aep file inside the export directory.")
        self._uiProperties.append(uiProperty)
        
        #Add create folders checkbox
        key, value, label = "createFolders", True, "Create Folders"
        uiProperty = UIPropertyFactory.create(type(value), key=key, value=value, dictionary=self._preset._properties, label=label+":", tooltip=label)
        layout.addRow(label+":", uiProperty)
        uiProperty.setToolTip("Automatically organises all media into relevant folders inside your AE project.")
        self._uiProperties.append(uiProperty)
        
        #Add timecode layer checkbox
        key, value, label = "addTimecodeLayer", True, "Add Timecode Layer"
        uiProperty = UIPropertyFactory.create(type(value), key=key, value=value, dictionary=self._preset._properties, label=label+":", tooltip=label)
        layout.addRow(label+":", uiProperty)
        uiProperty.setToolTip("Adds a 'Timecode' effect to the original plate. This will be created as a 'Guide' layer (i.e. it will not be rendered).")
        self._uiProperties.append(uiProperty)
        
        #Add log>lin layer checkbox
        key, value, label = "addLogLin", True, "Add Log>Lin Layer"
        uiProperty = UIPropertyFactory.create(type(value), key=key, value=value, dictionary=self._preset._properties, label=label+":", tooltip=label)
        layout.addRow(label+":", uiProperty)
        uiProperty.setToolTip("Adds a 'Cineon Converter' effect to the original plate. Useful when viewing .dpx files at gamma 2.2.")
        self._uiProperties.append(uiProperty)
        
        #Add write options
        self._writeList = PySide.QtGui.QListView()
        self._writeList.setMinimumHeight(20)
        self._writeList.resize(160,20)
        self._writeList.setToolTip("Render modules will be created for every ticked entry in this list.<br><br>NOTE : Currently only .tiff files are setup for immediate render.")
        
        self._readModel = PySide.QtGui.QStandardItemModel()
        self._writeModel = PySide.QtGui.QStandardItemModel()
        
        # Default to the empty item unless the preset has a value set.
        for path, preset in exportTemplate.flatten():
            
            #If it's not a nukeWriteNode, continue
            if preset._parentType.__module__ != 'hiero.exporters.FnExternalRender':
                continue
        
            #Make item
            item = PySide.QtGui.QStandardItem(path)
            item.setFlags(PySide.QtCore.Qt.ItemIsUserCheckable | PySide.QtCore.Qt.ItemIsEnabled)
            item.setData(PySide.QtCore.Qt.Unchecked, PySide.QtCore.Qt.CheckStateRole)
            
            #If it needs to be checked, make it checked.
            if path in properties["writePaths"]:
                item.setData(PySide.QtCore.Qt.Checked, PySide.QtCore.Qt.CheckStateRole)
            
            #Append item
            self._writeModel.appendRow(item)

        self._writeList.setModel(self._writeModel)
        self._writeModel.dataChanged.connect(self.writePresetChanged)
        layout.addRow("Render Item Paths :", self._writeList)
コード例 #14
0
    def __init__(self, session, error_data, missing_assets_types,
                 duplicated_components):
        '''Return a validator widget for the given *error_data* and *missing_assets_types*.'''
        super(FtrackSettingsValidator, self).__init__()

        self.setWindowTitle('Validation error')
        self._session = session

        self.logger = logging.getLogger(__name__ + '.' +
                                        self.__class__.__name__)

        ftrack_icon = QtGui.QIcon(':/ftrack/image/default/ftrackLogoLight')
        self.setWindowIcon(ftrack_icon)

        layout = QtWidgets.QVBoxLayout()
        self.setLayout(layout)

        box = QtWidgets.QGroupBox(
            'An error occured in the current schema configuration.')

        self.layout().addWidget(box)

        box_layout = QtWidgets.QVBoxLayout()
        box.setLayout(box_layout)

        form_layout = TaskUIFormLayout()
        box_layout.addLayout(form_layout)
        if duplicated_components:

            form_layout.addDivider(
                '{} Duplicated components name have been found'.format(
                    len(duplicated_components)))

            for component_name, task in duplicated_components:

                ui_property = UIPropertyFactory.create(
                    type(component_name),
                    key='component_name',
                    value=component_name,
                    dictionary=task._preset.properties()['ftrack'],
                    label='Component ' + ':',
                    tooltip='Duplicated component name')
                ui_property.update(True)
                form_layout.addRow('Duplicated component' + ':', ui_property)

                if component_name != task.component_name():
                    component_index = duplicated_components.index(
                        (task.component_name(), task))
                    duplicated_components.pop(component_index)

        for processor, values in error_data.items():
            form_layout.addDivider('Wrong {0} presets'.format(
                processor.__class__.__name__))

            for attribute, valid_values in values.items():
                valid_values.insert(0, '- select a value -')
                key, value, label = attribute, valid_values, ' '.join(
                    attribute.split('_'))
                tooltip = 'Set {0} value'.format(attribute)

                ui_property = UIPropertyFactory.create(
                    type(value),
                    key=key,
                    value=value,
                    dictionary=processor._preset.properties()['ftrack'],
                    label=label + ':',
                    tooltip=tooltip)
                form_layout.addRow(label + ':', ui_property)
                ui_property.update(True)

        if missing_assets_types:
            form_layout.addDivider('Missing asset types')

            for missing_asset in missing_assets_types:
                create_asset_button = QtWidgets.QPushButton(
                    missing_asset.capitalize())
                create_asset_button.clicked.connect(self.create_missing_asset)
                form_layout.addRow('Create asset: ', create_asset_button)

        buttons = QtWidgets.QDialogButtonBox()
        buttons.setOrientation(QtCore.Qt.Horizontal)
        buttons.addButton('Cancel', QtWidgets.QDialogButtonBox.RejectRole)
        buttons.addButton('Accept', QtWidgets.QDialogButtonBox.AcceptRole)
        buttons.accepted.connect(self.accept)
        buttons.rejected.connect(self.reject)
        self.layout().addWidget(buttons)
コード例 #15
0
    def execute(self, layout, ui_object, **kwargs):
        """
        Called when building the various UI interfaces for the Hiero Exporter.
        Allows for additional properties to be added to the presets through the GUI interface.
        """
        # Customize the UI belonging to the Shotgun Shot Processor in `sg_shot_processor.py`
        if ui_object.__class__.__name__ == self._ProcessorUIName:

            processor_ui = ui_object
            properties = processor_ui._preset.properties()

            #  CBSD Customization
            # ===========================
            # For our custom ability to throttle the "Shot Updater". Non-hook changes in `sg_shot_processor.py`
            # and `shot_updater.py` related to these presets.
            shot_updater_layout = self._build_shot_updater_widget(
                processor_ui, properties)
            layout.addLayout(shot_updater_layout)
            # ===========================

            # proof of concept for further custom GUI properties
            custom_widget = QtGui.QWidget()
            layout.addWidget(custom_widget)
            custom_layout = QtGui.QHBoxLayout(custom_widget)

            additional_options_widget_01 = QtGui.QWidget()
            additional_options_layout_01 = QtGui.QFormLayout(
                additional_options_widget_01)
            additional_options_layout_01.addRow(
                QtGui.QLabel(":::: Additional Processor Options ::::"))

            custom_property = """Set a new custom property!"""
            key = "customProperty01"
            value = True
            label = "Custom Property:"
            processor_ui._custom_property_01 = UIPropertyFactory.create(
                type(value),
                key=key,
                value=value,
                dictionary=properties,
                label=label,
                tooltip=custom_property)

            additional_options_layout_01.addRow(
                label, processor_ui._custom_property_01)

            custom_layout.addWidget(additional_options_widget_01)

        # Customize the UI for the "Shotgun Transcode Images" export type in the `version_creator.py` module.
        elif ui_object.__class__.__name__ == self._TranscodeUIName:
            transcoder_ui = ui_object

            properties = transcoder_ui._preset.properties()

            custom_widget = QtGui.QWidget()
            layout.addWidget(custom_widget)
            custom_layout = QtGui.QHBoxLayout(custom_widget)

            additional_options_widget_01 = QtGui.QWidget()
            additional_options_layout_01 = QtGui.QFormLayout(
                additional_options_widget_01)
            additional_options_layout_01.addRow(
                QtGui.QLabel(":::: Additional Transcoder Options ::::"))

            custom_property = """Set a new custom property!"""
            key = "customProperty01"
            value = True
            label = "Custom Property:"
            transcoder_ui._custom_property_01 = UIPropertyFactory.create(
                type(value),
                key=key,
                value=value,
                dictionary=properties,
                label=label,
                tooltip=custom_property)

            additional_options_layout_01.addRow(
                label, transcoder_ui._custom_property_01)

            custom_layout.addWidget(additional_options_widget_01)

        # Customize the UI for the "Shotgun Audio Export" in the `sg_audio_export.py` module.
        elif ui_object.__class__.__name__ == self._AudioExportUIName:
            audio_exporter_ui = ui_object

            properties = audio_exporter_ui._preset.properties()

            custom_widget = QtGui.QWidget()
            layout.addWidget(custom_widget)
            custom_layout = QtGui.QHBoxLayout(custom_widget)

            additional_options_widget_01 = QtGui.QWidget()
            additional_options_layout_01 = QtGui.QFormLayout(
                additional_options_widget_01)
            additional_options_layout_01.addRow(
                QtGui.QLabel(":::: Additional Audio Export Options ::::"))

            custom_property = """Set a new custom property!"""
            key = "customProperty01"
            value = True
            label = "Custom Property:"
            audio_exporter_ui._custom_property_01 = UIPropertyFactory.create(
                type(value),
                key=key,
                value=value,
                dictionary=properties,
                label=label,
                tooltip=custom_property)

            additional_options_layout_01.addRow(
                label, audio_exporter_ui._custom_property_01)

            custom_layout.addWidget(additional_options_widget_01)

        # Customize the UI for the "Shotgun Nuke Shot Export" in the `sg_nuke_shot_export.py` module.
        elif ui_object.__class__.__name__ == self._NukeShotExportUIName:

            nuke_exporter_ui = ui_object

            properties = nuke_exporter_ui._preset.properties()

            custom_widget = QtGui.QWidget()
            layout.addWidget(custom_widget)
            custom_layout = QtGui.QHBoxLayout(custom_widget)

            additional_options_widget_01 = QtGui.QWidget()
            additional_options_layout_01 = QtGui.QFormLayout(
                additional_options_widget_01)
            additional_options_layout_01.addRow(
                QtGui.QLabel(":::: Additional Nuke Shot Export Options ::::"))

            custom_property = """Set a new custom property!"""
            key = "customProperty01"
            value = True
            label = "Custom Property:"
            nuke_exporter_ui._custom_property_01 = UIPropertyFactory.create(
                type(value),
                key=key,
                value=value,
                dictionary=properties,
                label=label,
                tooltip=custom_property)

            additional_options_layout_01.addRow(
                label, nuke_exporter_ui._custom_property_01)

            custom_layout.addWidget(additional_options_widget_01)
コード例 #16
0
    def populateUI(self, widget, exportTemplate):
        if exportTemplate:
            self._exportTemplate = exportTemplate
            properties = self._preset.properties()

            layout = PySide.QtGui.QFormLayout()
            layout.setContentsMargins(9, 0, 9, 0)
            widget.setLayout(layout)
            layout.addRow(
                PySide.QtGui.QLabel(
                    "Note : Created Render Modules can only currently be set to TIFF."
                ))

            #Add auto-save checkbox
            key, value, label = "autoSaveProject", True, "Auto-Save Project"
            uiProperty = UIPropertyFactory.create(
                type(value),
                key=key,
                value=value,
                dictionary=self._preset._properties,
                label=label + ":",
                tooltip=label)

            layout.addRow(label + ":", uiProperty)
            uiProperty.setToolTip(
                "Auto-saves the newly generated project as a .aep file inside the export directory."
            )
            self._uiProperties.append(uiProperty)

            #Add create folders checkbox
            key, value, label = "createFolders", True, "Create Folders"
            uiProperty = UIPropertyFactory.create(
                type(value),
                key=key,
                value=value,
                dictionary=self._preset._properties,
                label=label + ":",
                tooltip=label)
            layout.addRow(label + ":", uiProperty)
            uiProperty.setToolTip(
                "Automatically organises all media into relevant folders inside your AE project."
            )
            self._uiProperties.append(uiProperty)

            #Add timecode layer checkbox
            key, value, label = "addTimecodeLayer", True, "Add Timecode Layer"
            uiProperty = UIPropertyFactory.create(
                type(value),
                key=key,
                value=value,
                dictionary=self._preset._properties,
                label=label + ":",
                tooltip=label)
            layout.addRow(label + ":", uiProperty)
            uiProperty.setToolTip(
                "Adds a 'Timecode' effect to the original plate. This will be created as a 'Guide' layer (i.e. it will not be rendered)."
            )
            self._uiProperties.append(uiProperty)

            #Add log>lin layer checkbox
            key, value, label = "addLogLin", True, "Add Log>Lin Layer"
            uiProperty = UIPropertyFactory.create(
                type(value),
                key=key,
                value=value,
                dictionary=self._preset._properties,
                label=label + ":",
                tooltip=label)
            layout.addRow(label + ":", uiProperty)
            uiProperty.setToolTip(
                "Adds a 'Cineon Converter' effect to the original plate. Useful when viewing .dpx files at gamma 2.2."
            )
            self._uiProperties.append(uiProperty)

            #Add write options
            self._writeList = PySide.QtGui.QListView()
            self._writeList.setMinimumHeight(20)
            self._writeList.resize(160, 20)
            self._writeList.setToolTip(
                "Render modules will be created for every ticked entry in this list.<br><br>NOTE : Currently only .tiff files are setup for immediate render."
            )

            self._readModel = PySide.QtGui.QStandardItemModel()
            self._writeModel = PySide.QtGui.QStandardItemModel()

            # Default to the empty item unless the preset has a value set.
            for path, preset in exportTemplate.flatten():

                #If it's not a nukeWriteNode, continue
                if preset._parentType.__module__ != 'hiero.exporters.FnExternalRender':
                    continue

                #Make item
                item = PySide.QtGui.QStandardItem(path)
                item.setFlags(PySide.QtCore.Qt.ItemIsUserCheckable
                              | PySide.QtCore.Qt.ItemIsEnabled)
                item.setData(PySide.QtCore.Qt.Unchecked,
                             PySide.QtCore.Qt.CheckStateRole)

                #If it needs to be checked, make it checked.
                if path in properties["writePaths"]:
                    item.setData(PySide.QtCore.Qt.Checked,
                                 PySide.QtCore.Qt.CheckStateRole)

                #Append item
                self._writeModel.appendRow(item)

            self._writeList.setModel(self._writeModel)
            self._writeModel.dataChanged.connect(self.writePresetChanged)
            layout.addRow("Render Item Paths :", self._writeList)
コード例 #17
0
ファイル: base.py プロジェクト: tk421storm/tk-hiero-export
    def _get_custom_widget(
        self, parent, create_method, get_method, set_method, properties=None
    ):
        """
        Uses the customize_export_ui hook to get a custom widget, get custom
        property definitions, and then set the widget's settings.

        :param parent: The parent widget.
        :param str create_method: The name of the create widget hook method to
            call to get the custom widget.
        :param str get_method: The name of the property getter hook method to
            call to get the custom property definitions.
        :param str set_method: The name of the widget property setter hook method
            to call to setup the widget using the custom properties.
        :param dict properties: The processor's properties dictionary to
            associate with any custom UIProperty objects created.

        :returns: A widget, or None if no custom widget was provided by the
            hook.
        """
        properties = properties or self._preset.properties()
        hook_name = "hook_customize_export_ui"
        hook_widget = self.app.execute_hook_method(
            hook_name,
            create_method,
            parent_widget=parent,
            base_class=HieroCustomizeExportUI,
        )

        if hook_widget is not None:
            hook_ui_properties = self._get_custom_properties(get_method)

            # This base class isn't intended to be run through an __init__ since
            # it's utility container class used as part of a mixin. Little backwards
            # here, but if we don't have a cache location for these properties
            # we can just create it here before moving on.
            if not hasattr(self, "_custom_properties"):
                self._custom_properties = dict()

            # We're only adding these property objects to a property in order
            # to protect them from garbage collections. We'll key it off of the
            # hook get method name since you'll end up with different property
            # objects per exporter type.
            #
            # Caching using an OrderedDict because we want to maintain the property
            # order as defined in the hook's get properties method. This means that
            # the programmer can define the properties in the order that they want
            # them to appear in a Qt layout and just iterate over what we give them
            # in the set properties hook method. NOTE: OrderedDict is Python 2.7+,
            # but that's safe here because we only support Hiero/NS versions that
            # come bundled with 2.7.
            cache = self._custom_properties.setdefault(
                get_method, collections.OrderedDict(),
            )

            for prop_data in hook_ui_properties:
                cache[prop_data["label"]] = UIPropertyFactory.create(
                    type(prop_data["value"]),
                    key=prop_data["name"],
                    value=prop_data["value"],
                    dictionary=properties,
                    tooltip=prop_data["tooltip"],
                )

            self.app.execute_hook_method(
                hook_name,
                set_method,
                widget=hook_widget,
                properties=self._custom_properties[get_method],
                base_class=HieroCustomizeExportUI,
            )

        return hook_widget
コード例 #18
0
    def _get_custom_widget(self, parent, create_method, get_method, set_method, properties=None):
        """
        Uses the customize_export_ui hook to get a custom widget, get custom
        property definitions, and then set the widget's settings.

        :param parent: The parent widget.
        :param str create_method: The name of the create widget hook method to
            call to get the custom widget.
        :param str get_method: The name of the property getter hook method to
            call to get the custom property definitions.
        :param str set_method: The name of the widget property setter hook method
            to call to setup the widget using the custom properties.
        :param dict properties: The processor's properties dictionary to
            associate with any custom UIProperty objects created.

        :returns: A widget, or None if no custom widget was provided by the
            hook.
        """
        properties = properties or self._preset.properties()
        hook_name = "hook_customize_export_ui"
        hook_widget = self.app.execute_hook_method(
            hook_name,
            create_method,
            parent_widget=parent,
            base_class=HieroCustomizeExportUI,
        )

        if hook_widget is not None:
            hook_ui_properties = self._get_custom_properties(get_method)

            # This base class isn't intended to be run through an __init__ since
            # it's utility container class used as part of a mixin. Little backwards
            # here, but if we don't have a cache location for these properties
            # we can just create it here before moving on.
            if not hasattr(self, "_custom_properties"):
                self._custom_properties = dict()

            # We're only adding these property objects to a property in order
            # to protect them from garbage collections. We'll key it off of the
            # hook get method name since you'll end up with different property
            # objects per exporter type.
            #
            # Caching using an OrderedDict because we want to maintain the property
            # order as defined in the hook's get properties method. This means that
            # the programmer can define the properties in the order that they want
            # them to appear in a Qt layout and just iterate over what we give them
            # in the set properties hook method. NOTE: OrderedDict is Python 2.7+,
            # but that's safe here because we only support Hiero/NS versions that
            # come bundled with 2.7.
            cache = self._custom_properties.setdefault(
                get_method,
                collections.OrderedDict(),
            )

            for prop_data in hook_ui_properties:
                cache[prop_data["label"]] = UIPropertyFactory.create(
                    type(prop_data["value"]),
                    key=prop_data["name"],
                    value=prop_data["value"],
                    dictionary=properties,
                    tooltip=prop_data["tooltip"],
                )

            self.app.execute_hook_method(
                hook_name,
                set_method,
                widget=hook_widget,
                properties=self._custom_properties[get_method],
                base_class=HieroCustomizeExportUI,
            )

        return hook_widget
コード例 #19
0
    def populateUI(self, widget, exportTemplate):
        if exportTemplate:

            self._exportTemplate = exportTemplate

            properties = self._preset.properties()

            layout = QtWidgets.QFormLayout()

            self._readList = QtWidgets.QListView()
            self._writeList = QtWidgets.QListView()

            self._readList.setMinimumHeight(50)
            self._writeList.setMinimumHeight(50)
            self._readList.resize(200, 50)
            self._writeList.resize(200, 50)

            self._readModel = QtWidgets.QStandardItemModel()
            self._writeModel = QtWidgets.QStandardItemModel()

            # Default to the empty item unless the preset has a value set.
            for model, presetValue in ((self._readModel,
                                        properties["readPaths"]),
                                       (self._writeModel,
                                        properties["writePaths"])):
                for path, preset in exportTemplate.flatten():

                    if model is self._writeModel:
                        if not hasattr(preset._parentType, 'nukeWriteNode'):
                            continue

                    item = QtWidgets.QStandardItem(path)
                    item.setFlags(QtCore.Qt.ItemIsUserCheckable
                                  | QtCore.Qt.ItemIsEnabled)

                    item.setData(QtCore.Qt.Unchecked, QtCore.Qt.CheckStateRole)
                    if path in presetValue:
                        item.setData(QtCore.Qt.Checked,
                                     QtCore.Qt.CheckStateRole)

                    model.appendRow(item)

            self._readList.setModel(self._readModel)
            self._writeList.setModel(self._writeModel)

            readNodeListToolTip = """Select multiple entries within the shot template to be used as inputs for the read nodes (i.e. symlink, transcode.. etc).\n No selection will mean that read nodes are created in the nuke script pointing directly at the source media.\n"""
            writeNodeListToolTip = """Add one or more "Nuke Write Node" tasks to your export structure to define the path and codec settings for the nuke script.\nIf no write paths are selected, no write node will be added to the nuke script."""

            self._readList.setToolTip(readNodeListToolTip)
            self._writeList.setToolTip(writeNodeListToolTip)
            self._readModel.dataChanged.connect(self.readPresetChanged)

            publishScriptTip = """When enabled, if there is a known shot in the asset that matches the shot in Hiero, the Nuke script will be published there."""
            key, value, label = "publishScript", True, FnAssetAPI.l(
                "{publish} Script")
            uiProperty = UIPropertyFactory.create(
                type(value),
                key=key,
                value=value,
                dictionary=self._preset._properties,
                label=label,
                tooltip=publishScriptTip)
            self._uiProperties.append(uiProperty)
            layout.addRow(uiProperty._label + ":", uiProperty)

            ## @todo Think of a better name
            useAssetsTip = """If enabled, any Clips that point to managed Assets will reference the Asset, rather than their files."""
            key, value, label = "useAssets", True, "Use Assets"
            uiProperty = UIPropertyFactory.create(
                type(value),
                key=key,
                value=value,
                dictionary=self._preset._properties,
                label=label,
                tooltip=useAssetsTip)
            self._uiProperties.append(uiProperty)
            layout.addRow(uiProperty._label + ":", uiProperty)

            layout.addRow("Read Nodes:", self._readList)
            self._writeModel.dataChanged.connect(self.writePresetChanged)
            layout.addRow("Write Nodes:", self._writeList)

            retimeToolTip = """Sets the retime method used if retimes are enabled.\n-Motion - Motion Estimation.\n-Blend - Frame Blending.\n-Frame - Nearest Frame"""
            key, value = "method", ("None", "Motion", "Frame", "Blend")
            uiProperty = UIPropertyFactory.create(
                type(value),
                key=key,
                value=value,
                dictionary=self._preset._properties,
                label="Retime Method",
                tooltip=retimeToolTip)
            self._uiProperties.append(uiProperty)
            layout.addRow(uiProperty._label + ":", uiProperty)

            collateTracksToolTip = """Enable this to include other shots which overlap the sequence time of each shot within the script. Cannot be enabled when Read Node overrides are set."""

            key, value, label = "collateTracks", False, "Collate Shot Timings"
            uiProperty = UIPropertyFactory.create(
                type(value),
                key=key,
                value=value,
                dictionary=self._preset.properties(),
                label=label + ":",
                tooltip=collateTracksToolTip)
            layout.addRow(label + ":", uiProperty)
            self._uiProperties.append(uiProperty)
            self._collateTimeProperty = uiProperty

            collateShotNameToolTip = """Enable this to include other shots which have the same name in the Nuke script. Cannot be enabled when Read Node overrides are set."""
            key, value, label = "collateShotNames", False, "Collate Shot Name"
            uiProperty = UIPropertyFactory.create(
                type(value),
                key=key,
                value=value,
                dictionary=self._preset.properties(),
                label=label + ":",
                tooltip=collateShotNameToolTip)
            layout.addRow(label + ":", uiProperty)
            self._collateNameProperty = uiProperty
            self._uiProperties.append(uiProperty)
            self.readPresetChanged(None, None)

            additionalNodesToolTip = """When enabled, allows custom Nuke nodes to be added into Nuke Scripts.\n Click Edit to add nodes on a per Shot, Track or Sequence basis.\n Additional Nodes can also optionally be filtered by Tag."""

            additionalNodesLayout = QtWidgets.QHBoxLayout()
            additionalNodesCheckbox = QtWidgets.QCheckBox()
            additionalNodesCheckbox.setToolTip(additionalNodesToolTip)
            additionalNodesCheckbox.stateChanged.connect(
                self._additionalNodesEnableClicked)
            if self._preset.properties()["additionalNodesEnabled"]:
                additionalNodesCheckbox.setCheckState(QtCore.Qt.Checked)
            additionalNodesButton = QtWidgets.QPushButton("Edit")
            additionalNodesButton.setToolTip(additionalNodesToolTip)
            additionalNodesButton.clicked.connect(
                self._additionalNodesEditClicked)
            additionalNodesLayout.addWidget(additionalNodesCheckbox)
            additionalNodesLayout.addWidget(additionalNodesButton)
            layout.addRow("Additional Nodes:", additionalNodesLayout)

            widget.setLayout(layout)
コード例 #20
0
    def _build_shot_updater_widget(self, processor_ui, properties):
        """This was written following the pattern in the CollatingExportUI object."""
        shot_updater_layout = QtGui.QFormLayout()

        sgCreateCut = """Create a Cut and CutItems in Shotgun..."""
        key = "sgCreateCut"
        value = True
        label = "Create Cut:"
        processor_ui._sgCreateCut = UIPropertyFactory.create(
            type(value),
            key=key,
            value=value,
            dictionary=properties,
            label=label,
            tooltip=sgCreateCut)
        shot_updater_layout.addRow(label, processor_ui._sgCreateCut)

        shot_updater_layout.addRow(QtGui.QLabel("--- Frame Ranges ---"))

        sgHeadIn = """Update 'sg_head_in' on the Shot entity."""
        key = "updateSgHeadIn"
        value = True
        label = "Head In:"
        processor_ui._sgHeadInProperty = UIPropertyFactory.create(
            type(value),
            key=key,
            value=value,
            dictionary=properties,
            label=label,
            tooltip=sgHeadIn)
        shot_updater_layout.addRow(label, processor_ui._sgHeadInProperty)

        sgCutIn = """Update 'sg_cut_in' on the Shot entity."""
        key = "updateSgCutIn"
        value = True
        label = "Cut In:"
        processor_ui._sgCutInProperty = UIPropertyFactory.create(
            type(value),
            key=key,
            value=value,
            dictionary=properties,
            label=label,
            tooltip=sgCutIn)
        shot_updater_layout.addRow(label, processor_ui._sgCutInProperty)

        sgCutOut = """Update 'sg_cut_out' on the Shot entity."""
        key = "updateSgCutOut"
        value = True
        label = "Cut Out:"
        processor_ui._sgCutOutProperty = UIPropertyFactory.create(
            type(value),
            key=key,
            value=value,
            dictionary=properties,
            label=label,
            tooltip=sgCutOut)
        shot_updater_layout.addRow(label, processor_ui._sgCutOutProperty)

        sgTailOut = """Update 'sg_tail_out' on the Shot entity."""
        key = "updateSgTailOut"
        value = True
        label = "Tail Out:"
        processor_ui._sgTailOutProperty = UIPropertyFactory.create(
            type(value),
            key=key,
            value=value,
            dictionary=properties,
            label=label,
            tooltip=sgTailOut)
        shot_updater_layout.addRow(label, processor_ui._sgTailOutProperty)

        sgCutDuration = """Update 'sg_cut_duration' on the Shot entity."""
        key = "updateSgCutDuration"
        value = True
        label = "Cut Duration:"
        processor_ui._sgCutDurationProperty = UIPropertyFactory.create(
            type(value),
            key=key,
            value=value,
            dictionary=properties,
            label=label,
            tooltip=sgCutDuration)
        shot_updater_layout.addRow(label, processor_ui._sgCutDurationProperty)

        sgWorkingDuration = """Update 'sg_working_duration' on the Shot entity."""
        key = "updateSgWorkingDuration"
        value = True
        label = "Working Duration:"
        processor_ui._sgWorkingDurationProperty = UIPropertyFactory.create(
            type(value),
            key=key,
            value=value,
            dictionary=properties,
            label=label,
            tooltip=sgWorkingDuration)
        shot_updater_layout.addRow(label,
                                   processor_ui._sgWorkingDurationProperty)

        shot_updater_layout.addRow(QtGui.QLabel("--- File System ---"))

        tkCreateFilesystemStructure = """Run the Toolkit 'Create Folders' command for the Shot entity."""
        key = "tkCreateFilesystemStructure"
        value = True
        label = "Create Folders:"
        processor_ui._tkCreateFilesystemStructureProperty = UIPropertyFactory.create(
            type(value),
            key=key,
            value=value,
            dictionary=properties,
            label=label,
            tooltip=tkCreateFilesystemStructure)
        shot_updater_layout.addRow(
            label, processor_ui._tkCreateFilesystemStructureProperty)

        return shot_updater_layout