def main(file_name, local): logger = logging.getLogger("LgtLay start") new_file.new_file() context = pipeFile.PathDetails.parse_path(file_name) save_as.save_as(file_name) # create Light group import_lights(context) logger.info("Import light done.") # AR set rebuild_scene() logger.info("Rebuild scene done.") # switch to midmdl assemb = Assembly.Assembly() assemb.set_active("MidMdl") # get the AnimLay cache abc_files = get_cache_files(context) if abc_files: for abc_file in abc_files: if abc_file.endswith("env.abc"): continue namespace = os.path.splitext(os.path.basename(abc_file))[0] create_reference.create_reference(abc_file, namespace) logger.info("Reference cache done.") # fix frame range fix_frame_range.fix_frame_range(context) logger.info("Fix frame range done.") # set resolution resolution = Project(context.project).resolution set_image_size.set_image_size(*resolution) save_as.save_as(file_name) logger.info("%s publish successful!" % file_name) if not local: quit_maya.quit_maya()
def reference_in_env(context): set_ad_path = pipeFile.get_task_file(context.project, context.sequence, "c000", "Set", "Set", "maya_shot_definition", "") if not os.path.isfile(set_ad_path): print "%s is not an exist file" % set_ad_path return assemb = Assembly.Assembly() node_name = "%s_%s_set" % (context.sequence, "c000") node = assemb.reference_ad(node_name, set_ad_path) create_group.create_group("Env") mc.parent(node, "Env") return node
def main(): if not mc.objExists("Env"): logger.info("Env group not exist.") return if check_no_shd_in_reps(): return assemb = Assembly.Assembly() assemb.set_active("Shd") context = pipeFile.PathDetails.parse_path() cache_dir = context.cache_dir cache_dir = cache_dir.replace("Anim", "Lgt") abc_path = "%s/env.abc" % cache_dir # export Env group as abc to cache dir export_env_cache(abc_path)
def create_shot_ad(context): ad_path = context.definition_path if os.path.isfile(ad_path): return ad_node_name = "%s_%s_AD" % (context.sequence, context.shot) if not os.path.isfile(context.publish_path): logger.error("%s is not an exist file" % context.publish_path) return new_file.new_file() rename_scene.rename_scene(ad_path) assemb = Assembly.Assembly() name = context.step node = assemb.create_assembly_node(ad_node_name, "assemblyDefinition") assemb.create_representation(node, "Scene", name, name, context.publish_path) save_file.save_file()
def rebuild_scene(): # get logger logger = logging.getLogger(__name__) # get conf data anim_edit_data = get_anim_edit_data() name = anim_edit_data.get("owner") def_path = anim_edit_data.get("definition") # create AR node assemb = Assembly.Assembly() ar_node = assemb.reference_ad(name, def_path) logger.info("Create %s done." % ar_node) # edit edit(anim_edit_data) logger.info("anim edit done.") # set parent create_group.create_group("Env") mc.parent(ar_node, "Env") logger.info("Set parent done.")
def main(file_name, local): logger = logging.getLogger("MainLgt start") new_file.new_file() create_group.create_group("Lights") # AR set AD file context = pipeFile.PathDetails.parse_path(file_name) project = context.project sequence = context.sequence set_ad_file = pipeFile.get_task_file(project, sequence, "c000", "Set", "Set", "maya_shot_definition", "") assemb = Assembly.Assembly() node = assemb.reference_ad("%s_c000_set" % sequence, set_ad_file) create_group.create_group("Env") mc.parent(node, "Env") # set Shd active assemb.set_active("Shd") save_as.save_as(file_name) logger.info("%s publish successful!" % file_name) if not local: quit_maya.quit_maya()
def export_cache(context): step = context.step if step == "AnimLay": switch_step = "MidMdl" else: switch_step = "HighMdl" # switch to rig assemb = Assembly.Assembly() assemb.set_active(switch_step) logger.info("Set assembly active done") # export camera cache export_camera_cache(context) logger.info("Export camera cache done.") # export env cache export_env_cache(context) logger.info("Export env cache done.") # export other cache export_other_cache(context, "Prop") logger.info("Export Prop cache done.") export_other_cache(context, "Char") logger.info("Export Char cache done.")
def main(): if not mc.objExists("Env"): logger.info("Env group not exist.") return if check_no_shd_in_reps(): return assemb = Assembly.Assembly() assemb.set_active("Shd") context = pipeFile.PathDetails.parse_path() cache_dir = context.cache_dir abc_path = "%s/env.abc" % cache_dir # export Env group as abc to cache dir export_env_cache(abc_path) # delete Env group mc.delete("Env") logger.info("Delete Env group done.") # import abc import_env_cache(abc_path) # save as next edition file next_edition_file = context.next_edition_file save_as.save_as(next_edition_file) logger.info("Save as next edition file done.")
def __init__(self, parent=None): super(SwitchAssembly, self).__init__(parent) self.assembly = Assembly.Assembly() self.reps = self.assembly.get_all_reps() self.resize(300, 80) self.setWindowTitle("Switch Assembly") main_layout = QVBoxLayout(self) main_layout.setContentsMargins(0, 0, 0, 0) sel_layout = QHBoxLayout() self.sel_btn_group = QButtonGroup() all_check = QCheckBox("All") all_check.setChecked(True) sel_check = QCheckBox("Selected") for check in [all_check, sel_check]: self.sel_btn_group.addButton(check) sel_layout.addWidget(check) self.assembly_btn = QPushButton("Assembly") self.menu = QMenu() self.action_group = QActionGroup(self) main_layout.addLayout(sel_layout) main_layout.addWidget(self.assembly_btn) self.set_signals()