diff --git a/Scripts/convert_collection.py b/Scripts/convert_collection.py index 789394897679489251ad207f887d5674c52ce749..4fc5d42337048ab5bff0d63e863bdee2f4a67118 100644 --- a/Scripts/convert_collection.py +++ b/Scripts/convert_collection.py @@ -138,12 +138,16 @@ class Convert_Collection(CustomCommand): """Finds the Master in the scene This will be replaced by importing missing assets in the next sprint""" try: - self.get_item(source + "_GRP") + self.get_item(source + "_00_GRP") except LookupError: - print ("The asset is missing from the scene") - # Import Master? + try: + self.get_item(source + "_GRP") + except LookupError: + print ("The asset is missing from the scene") + else: + return self.get_item(source + "_GRP") else: - return self.get_item(source + "_GRP") + return self.get_item(source + "_00_GRP") def clear_positions(self): """Removes the assets currently found inside the positions""" diff --git a/Scripts/geometry_exporter.py b/Scripts/geometry_exporter.py index 9b251b07c303e6d0aafa08ddf0ddf4bd86b382e0..3548341284d9ace113c16f19091573548160883f 100644 --- a/Scripts/geometry_exporter.py +++ b/Scripts/geometry_exporter.py @@ -15,6 +15,8 @@ class GeometryExporter(CustomCommand): self.dyna_Add("item_name", lx.symbol.sTYPE_STRING) self.dyna_Add("mode", lx.symbol.sTYPE_STRING) self.dyna_Add("export_fbx", lx.symbol.sTYPE_BOOLEAN) + self.dyna_Add("smooth", lx.symbol.sTYPE_BOOLEAN) + self.dyna_Add("subdivisions", lx.symbol.sTYPE_INTEGER) self.dyna_Add("fbx_path", lx.symbol.sTYPE_STRING) self.dyna_Add("fbx_smooth_path", lx.symbol.sTYPE_STRING) @@ -25,6 +27,8 @@ class GeometryExporter(CustomCommand): self.item_name = None self.mode = None self.export_fbx = None + self.smooth_fbx = None + self.subdivisions = None self.fbx_path = None self.fbx_smooth_path = None @@ -75,10 +79,14 @@ class GeometryExporter(CustomCommand): self.mode = self.attr_GetString(5) if not self.export_fbx and self.dyna_IsSet(6): self.export_fbx = self.dyna_Bool(6) + if not self.smooth_fbx and self.dyna_IsSet(7): + self.smooth_fbx = self.dyna_Bool(7) + if not self.subdivisions: + self.subdivisions = int(self.attr_GetInt(8)) if not self.fbx_path: - self.fbx_path = self.attr_GetString(7) + self.fbx_path = self.attr_GetString(9) if not self.fbx_smooth_path: - self.fbx_smooth_path = self.attr_GetString(8) + self.fbx_smooth_path = self.attr_GetString(10) self.scene = modo.Scene() self.asset_group = self.get_item(self.object_name) @@ -118,7 +126,8 @@ class GeometryExporter(CustomCommand): if self.export_fbx: self.fbx_settings = self.set_fbx_settings() self.fbx_export() - self.fbx_smooth_export() + if self.smooth_fbx: + self.fbx_smooth_export() self.revert_fbx_settings() # Restore changes @@ -173,13 +182,13 @@ class GeometryExporter(CustomCommand): smoothed.append(new) for x in smoothed: self.scene.select(x) - lx.eval("poly.subdivide ccsds") - lx.eval("poly.subdivide ccsds") + for amount in range(self.subdivisions): + lx.eval("poly.subdivide ccsds") self.scene.select(self.asset_group) for x in smoothed: self.scene.select(x, True) command = ( - "!!export.selected 15 false false true filepath:{%s}" % self.fbx_smooth_path + "!!export.selected 15 false false true filepath:{%s}" % self.fbx_smooth_path ) lx.eval(command) lx.eval("scene.set %s" % scene_id) @@ -216,8 +225,8 @@ class GeometryExporter(CustomCommand): if "deformers" in x.itemGraphNames: for ops in x.itemGraph("deformers").reverse(): if ( - ops.superType == "meshoperation" - or ops.superType == "tooloperation" + ops.superType == "meshoperation" + or ops.superType == "tooloperation" ): if x not in mesh_ops: mesh_ops.append(x) @@ -250,21 +259,21 @@ class GeometryExporter(CustomCommand): for each in self.mesh_ops: for operation in each.itemGraph("deformers").reverse(): if ( - operation.superType == "meshoperation" - or operation.superType == "tooloperation" + operation.superType == "meshoperation" + or operation.superType == "tooloperation" ): if ( - operation - not in self.mesh_ops_folder.itemGraph("deformTree").reverse() + operation + not in self.mesh_ops_folder.itemGraph("deformTree").reverse() ): operations.append(operation) if "selops" in operation.itemGraphNames: for selop in operation.itemGraph("selops").reverse(): if ( - selop - not in self.mesh_ops_folder.itemGraph( - "deformTree" - ).reverse() + selop + not in self.mesh_ops_folder.itemGraph( + "deformTree" + ).reverse() ): selop.itemGraph( "deformTree" @@ -301,7 +310,7 @@ class GeometryExporter(CustomCommand): asset_assembly.addItems(each) asset_assembly.addItems(self.mesh_ops_folder) for op in self.mesh_ops_folder.itemGraph( - "deformTree" + "deformTree" ).reverse(): asset_assembly.addItems(op) elif self.mode == "freeze": @@ -471,13 +480,15 @@ class GeometryExporter(CustomCommand): if __name__ == "__main__": task = GeometryExporter() - task.file_path = "//studio/users/Lisa/ExportTests/ThroneA_MODELLING_Pipeline_v001.lxp" - task.asset_name = "ThroneA" - task.object_name = "ThroneA_GRP" - task.assembly_name = "ThroneA_00_MODELLING_Pipeline_v001" - task.item_name = "ThroneA_ITEM" + task.file_path = "//studio/users/Lisa/ExportTests/PhoneA_MODELLING_Pipeline_v001.lxp" + task.asset_name = "PhoneA" + task.object_name = "PhoneA_GRP" + task.assembly_name = "PhoneA_00_MODELLING_Pipeline_v001" + task.item_name = "PhoneA_ITEM" task.mode = "freeze" # Try with "mesh ops" too - task.export_fbx = False - task.fbx_path = "//studio/jobs/INK493_DoorDash2/LIBRARIES/ASSETS/PROPS/CloudA/MODELS/MODELLING/DevTest/v003/GEOMETRY_LXP/CloudA_MODELLING_DevTest_v003.fbx" - task.fbx_smooth_path = "//studio/jobs/INK493_DoorDash2/LIBRARIES/ASSETS/PROPS/CloudA/MODELS/MODELLING/DevTest/v003/GEOMETRY_LXP/CloudA_MODELLING_DevTest_v003_smooth.fbx" + task.export_fbx = True + task.smooth_fbx = True + task.subdivisions = 1 # 1/2/3 Default 2 + task.fbx_path = "//studio/users/Lisa/ExportTests/PhoneA_MODELLING_Pipeline_v001.fbx" + task.fbx_smooth_path = "//studio/users/Lisa/ExportTests/PhoneA_MODELLING_Pipeline_smooth_v001.fbx" task.basic_Execute(None, None)