def update_version_action(typed, parameter, puppet, category): column, publish_dirname = None, None inputs = get_inputs(parameter.getNode()) if typed == 'animation': column = 'i5' publish_dirname = os.path.join(inputs['show_path'], 'scene', inputs['sequence'], inputs['shot']) latest_version = versions.get_latest_version(publish_dirname, typed) elif typed == 'lookdev': column = 'i3' dependency_versions = versions.get_asset_dependency_versions( inputs['show_path'], category, puppet, 'lookdev', 'model') model_version = get_model_version(parameter, puppet) latest_version = 'None' if model_version in dependency_versions: lookdev_versions = dependency_versions[model_version] if lookdev_versions: latest_version = lookdev_versions[0] current_version, version_parameter = get_current_version( parameter, puppet, column) if current_version == latest_version: message = 'not found any new versions\ncurrent version is the latest version' QtGui.QMessageBox.information(None, 'information', message, QtGui.QMessageBox.Ok) return message = 'Are you sure, want to update?\n%s to %s' % (current_version, latest_version) replay = QtGui.QMessageBox.question(None, 'question', message, QtGui.QMessageBox.Yes, QtGui.QMessageBox.No) if replay == QtGui.QMessageBox.No: print 'abort the animation updates!...' return version_parameter.setValue(latest_version, 1.0)
def get_animation_inputs(show_path, sequence, shot, typed): ''' :description get the animation published scene description :param show_path <str> :param sequence <str> :param shot <str> :param typed <str> ''' animation_dirname = os.path.join(show_path, 'scene', sequence, shot) if not os.path.isdir(animation_dirname): message = 'not found any valid %s publish' % typed return None, message latest_version = versions.get_latest_version(animation_dirname, typed) if not latest_version: message = 'not found any %s publish versions' % typed return None, message # read scene description manifest_path = os.path.join(animation_dirname, typed, latest_version, 'manifest.json') if not os.path.isfile(manifest_path): message = 'not found any valid %s manifest (scene description)' % typed return None, message with (open(manifest_path, 'r')) as manifest: data = json.load(manifest) scene_data = data['data'] return scene_data, None
def create_node(): template_path = resources.get_template_path() latest_version = versions.get_latest_version(template_path, 'lighting') if not latest_version: message = 'not found any publish versions' QtGui.QMessageBox.warning( None, 'Warning', message, QtGui.QMessageBox.Ok) return xml_scene = os.path.join( template_path, 'lighting', latest_version, 'lighting.xml') if not os.path.isfile(xml_scene): message = 'not found xml in the latest publish \n<%s>\n<%s>' % ( latest_version, xml_scene) QtGui.QMessageBox.warning( None, 'Warning', message, QtGui.QMessageBox.Ok) return scene.new_katana_scene() root_node = NodegraphAPI.GetRootNode() knodes = scene.xml_file_to_nodes(xml_scene, parent=root_node) print '# info: lighting template nodes' for knode in knodes: print '\t', knode.getName() message = [ 'template type: '.rjust(15) + 'lighting', 'version: '.rjust(15) + latest_version, 'path: '.rjust(15) + xml_scene ] QtGui.QMessageBox.information( None, 'success', '\n'.join(message), QtGui.QMessageBox.Ok) print '\n'.join(message)
def set_current_versions(self): publish_path, pipe = self.get_publish_path() version_type = str(self.combobox_version.currentText()) temp_version = versions.get_latest_version(publish_path, pipe) current_versions = str(self.combobox_version.currentText()) version_index = versions.PATTERN[current_versions] latest_version = 'None' if temp_version: latest_version = temp_version next_version = versions.get_next_version(version_index, temp_version) self.lineedit_latestversion.setText(latest_version) self.lineedit_nextversion.setText(next_version)
def set_current_versions(self, *args): current_type = str(self.combobox_type.currentText()) current_version = str(self.combobox_versions.currentText()) temp_version = versions.get_latest_version(self.template_path, current_type) latest_version = None if temp_version: latest_version = temp_version index = versions.PATTERN[current_version] next_version = versions.get_next_version(index, latest_version) if not latest_version: latest_version = 'None' self.lineedit_latest.setText(latest_version) self.lineedit_next.setText(next_version)
def set_lookdev_versions(knode): parameter = knode.getParameter('studio_pipe.version') hints = ast.literal_eval(parameter.getHintString()) text = 'major' if hints['buttonText'] == 'major': text = 'minor' if hints['buttonText'] == 'minor': text = 'patch' hints['buttonText'] = text parameter.setHintString(str(hints)) publish_path, typed = get_publish_path(knode) temp_version = versions.get_latest_version(publish_path, typed) latest_version = None if temp_version: latest_version = temp_version index = versions.PATTERN[text] next_version = versions.get_next_version(index, latest_version) pipe_parameter = knode.getParameter('studio_pipe') if not latest_version: latest_version = 'None' pipe_parameter.getChild('latest_version').setValue(latest_version, 1.0) pipe_parameter.getChild('next_version').setValue(next_version, 1.0)