def _setup_namer(self): ext = os.path.splitext(self._publish['sg_path'])[1] # Increment the version number if copying to the same task. if self._node.state['Task'] is self._publish['sg_link']: version = self._publish['sg_version'] + 1 else: version = 1 workspace = os.path.join(self._task_path, 'maya') scenes = os.path.join(workspace, 'scenes') self._namer._namer = SceneName( workspace=workspace, directory='scenes', detail=self._publish['code'], version=version, revision=1, step_name=self._node.state['Task']['step']['short_name'], ) self._namer._namer.version = version basename = self._namer._namer.get_basename() revision = utils.get_next_revision( scenes, basename, ext, version, ) self._namer._namer.revision = revision self._namer._namer.extension = ext self._namer.namer_updated() self._namer.update_preview()
def _on_node_changed(self, node): self._node = node self._enable = 'PublishEvent' in node.state # Button only works when there is a publish. self._copy_button.setEnabled(self._enable) self._open_button.setEnabled(self._enable) if self._enable: self._task_path = self._model.sgfs.path_for_entity(node.state['Task']) publish = node.state.get('PublishEvent') self._namer._namer.detail = publish['code'] self._namer._namer.extension = ext = os.path.splitext(publish['sg_path'])[1] basename = self._namer._namer.get_basename() self._namer._namer.revision = utils.get_next_revision( os.path.join(self._workspace, 'scenes'), os.path.splitext(basename)[0], ext, 1, ) self._namer.namer_updated() self._namer.update_preview()
def _on_node_changed(self, node): self._node = node self._enable = 'PublishEvent' in node.state # Button only works when there is a publish. self._copy_button.setEnabled(self._enable) self._open_button.setEnabled(self._enable) if self._enable: self._task_path = self._model.sgfs.path_for_entity( node.state['Task']) publish = node.state.get('PublishEvent') # TODO: Strip this with the scene_name(r)'s tools, when they exist. detail = publish['code'] step_name = publish.fetch('link.Task.step.Step.short_name') if detail.lower().startswith(step_name.lower()): detail = detail[len(step_name):].lstrip('_') self._namer._namer.detail = detail self._namer._namer.extension = ext = os.path.splitext( publish['sg_path'])[1] basename = self._namer._namer.get_basename() self._namer._namer.revision = utils.get_next_revision( os.path.join(self._workspace, 'scenes'), os.path.splitext(basename)[0], ext, 1, ) self._namer.namer_updated() self._namer.update_preview()