Compare commits
	
		
			24 Commits
		
	
	
		
			v1.2.0
			...
			3e066bbe64
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 3e066bbe64 | |||
|   | 0cc8beb830 | ||
|   | 336870ecb5 | ||
|   | daacdf1a5d | ||
|   | 48c05380c6 | ||
|   | 9f4a205f3d | ||
|   | 216ea5d7a4 | ||
|   | d2c7dbd79f | ||
|   | 6247a289e6 | ||
|   | 2b60f0d2a6 | ||
|   | 8d5c701b86 | ||
|   | c072c9e56d | ||
|   | 2421ba70c2 | ||
|   | ae42cda6ab | ||
|   | 0ac921d855 | ||
|   | 806a7cc060 | ||
| d1d83d39af | |||
| 1ec4332576 | |||
| 125ad2792c | |||
|   | f451be4d18 | ||
|   | 613cb20678 | ||
|   | 432c9ff380 | ||
|   | ba762d9548 | ||
|   | b120b74cd4 | 
| @@ -1,8 +1,8 @@ | |||||||
| bl_info = { | bl_info = { | ||||||
|     'name': 'SWBF .msh Import-Export', |     'name': 'SWBF .msh Import-Export', | ||||||
|     'author': 'Will Snyder, SleepKiller', |     'author': 'Will Snyder, PrismaticFlower', | ||||||
|     "version": (1, 0, 0), |     "version": (1, 3, 3), | ||||||
|     'blender': (2, 80, 0), |     'blender': (4, 3, 2), | ||||||
|     'location': 'File > Import-Export', |     'location': 'File > Import-Export', | ||||||
|     'description': 'Export as SWBF .msh file', |     'description': 'Export as SWBF .msh file', | ||||||
|     'warning': '', |     'warning': '', | ||||||
| @@ -118,6 +118,11 @@ class ExportMSH(Operator, ExportHelper): | |||||||
|  |  | ||||||
|     def execute(self, context): |     def execute(self, context): | ||||||
|  |  | ||||||
|  |         if 'SELECTED' in self.export_target and len(bpy.context.selected_objects) == 0: | ||||||
|  |             raise Exception("{} was chosen, but you have not selected any objects. " | ||||||
|  |                             " Don't forget to unhide all the objects you wish to select!".format(self.export_target)) | ||||||
|  |  | ||||||
|  |  | ||||||
|         scene, armature_obj = create_scene( |         scene, armature_obj = create_scene( | ||||||
|                                 generate_triangle_strips=self.generate_triangle_strips, |                                 generate_triangle_strips=self.generate_triangle_strips, | ||||||
|                                 apply_modifiers=self.apply_modifiers, |                                 apply_modifiers=self.apply_modifiers, | ||||||
| @@ -157,14 +162,14 @@ def menu_func_export(self, context): | |||||||
|  |  | ||||||
|  |  | ||||||
| class ImportMSH(Operator, ImportHelper): | class ImportMSH(Operator, ImportHelper): | ||||||
|     """ Import an SWBF .msh file. """ |     """ Import SWBF .msh file(s). """ | ||||||
|  |  | ||||||
|     bl_idname = "swbf_msh.import" |     bl_idname = "swbf_msh.import" | ||||||
|     bl_label = "Import SWBF .msh File(s)" |     bl_label = "Import SWBF .msh File(s)" | ||||||
|     filename_ext = ".msh" |     filename_ext = ".msh" | ||||||
|  |  | ||||||
|     files: CollectionProperty( |     files: CollectionProperty( | ||||||
|             name="File Path", |             name="File Path(s)", | ||||||
|             type=bpy.types.OperatorFileListElement, |             type=bpy.types.OperatorFileListElement, | ||||||
|             ) |             ) | ||||||
|  |  | ||||||
| @@ -176,7 +181,7 @@ class ImportMSH(Operator, ImportHelper): | |||||||
|  |  | ||||||
|     animation_only: BoolProperty( |     animation_only: BoolProperty( | ||||||
|         name="Import Animation(s)", |         name="Import Animation(s)", | ||||||
|         description="Import on or more animations from the selected files and append each as a new Action to currently selected Armature.", |         description="Import one or more animations from the selected files and append each as a new Action to currently selected Armature.", | ||||||
|         default=False |         default=False | ||||||
|     ) |     ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -138,6 +138,9 @@ class Reader: | |||||||
|     def how_much_left(self, pos): |     def how_much_left(self, pos): | ||||||
|         return self.end_pos - pos |         return self.end_pos - pos | ||||||
|  |  | ||||||
|  |     def bytes_remaining(self): | ||||||
|  |         return self.end_pos - self.file.tell() | ||||||
|  |  | ||||||
|     def skip_until(self, header): |     def skip_until(self, header): | ||||||
|         while (self.could_have_child() and header not in self.peak_next_header()): |         while (self.could_have_child() and header not in self.peak_next_header()): | ||||||
|             self.skip_bytes(1) |             self.skip_bytes(1) | ||||||
|   | |||||||
| @@ -67,7 +67,7 @@ def extract_anim(armature: bpy.types.Armature, root_name: str) -> Animation: | |||||||
|  |  | ||||||
|     for frame in range(num_frames): |     for frame in range(num_frames): | ||||||
|          |          | ||||||
|         frame_time = framerange.x + frame * increment |         frame_time = int(framerange.x + frame * increment) | ||||||
|         bpy.context.scene.frame_set(frame_time) |         bpy.context.scene.frame_set(frame_time) | ||||||
|  |  | ||||||
|         for keyable_bone in keyable_bones: |         for keyable_bone in keyable_bones: | ||||||
|   | |||||||
| @@ -32,7 +32,6 @@ def extract_and_apply_anim(filename : str, scene : Scene): | |||||||
|  |  | ||||||
|     if scene.animation is None: |     if scene.animation is None: | ||||||
|         raise Exception("No animation found in msh file!") |         raise Exception("No animation found in msh file!") | ||||||
|      |  | ||||||
|     else: |     else: | ||||||
|         head, tail = os.path.split(filename) |         head, tail = os.path.split(filename) | ||||||
|         anim_name = tail.split(".")[0] |         anim_name = tail.split(".")[0] | ||||||
| @@ -40,6 +39,10 @@ def extract_and_apply_anim(filename : str, scene : Scene): | |||||||
|         if anim_name in bpy.data.actions: |         if anim_name in bpy.data.actions: | ||||||
|             bpy.data.actions.remove(bpy.data.actions[anim_name], do_unlink=True) |             bpy.data.actions.remove(bpy.data.actions[anim_name], do_unlink=True) | ||||||
|  |  | ||||||
|  |             for nt in arma.animation_data.nla_tracks: | ||||||
|  |                 if anim_name == nt.strips[0].name: | ||||||
|  |                     arma.animation_data.nla_tracks.remove(nt) | ||||||
|  |  | ||||||
|         action = bpy.data.actions.new(anim_name) |         action = bpy.data.actions.new(anim_name) | ||||||
|         action.use_fake_user = True |         action.use_fake_user = True | ||||||
|  |  | ||||||
| @@ -103,4 +106,5 @@ def extract_and_apply_anim(filename : str, scene : Scene): | |||||||
|                     fcurve_loc_z.keyframe_points.insert(i,t.z) |                     fcurve_loc_z.keyframe_points.insert(i,t.z) | ||||||
|  |  | ||||||
|         arma.animation_data.action = action |         arma.animation_data.action = action | ||||||
|  |         track = arma.animation_data.nla_tracks.new() | ||||||
|  |         track.strips.new(action.name, int(action.frame_range[0]), action) | ||||||
| @@ -180,8 +180,10 @@ to provide an exact emulation""" | |||||||
|  |  | ||||||
|             texture_input_nodes.append(texImage) |             texture_input_nodes.append(texImage) | ||||||
|  |  | ||||||
|  |             specular_key = "Specular" if bpy.app.version < (4, 0, 0) else "Specular IOR Level" | ||||||
|  |  | ||||||
|             bsdf.inputs["Roughness"].default_value = 1.0 |             bsdf.inputs["Roughness"].default_value = 1.0 | ||||||
|             bsdf.inputs["Specular"].default_value = 0.0 |             bsdf.inputs[specular_key].default_value = 0.0 | ||||||
|  |  | ||||||
|             material.use_backface_culling = not bool(mat_props.doublesided) |             material.use_backface_culling = not bool(mat_props.doublesided) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -40,6 +40,7 @@ def model_to_mesh_object(model: Model, scene : Scene, materials_map : Dict[str, | |||||||
|     vertex_positions = [] |     vertex_positions = [] | ||||||
|     vertex_uvs = [] |     vertex_uvs = [] | ||||||
|     vertex_normals = [] |     vertex_normals = [] | ||||||
|  |     vertex_colors = [] | ||||||
|  |  | ||||||
|     # Keeps track of which vertices each group of weights affects |     # Keeps track of which vertices each group of weights affects | ||||||
|     # i.e. maps offset of vertices -> weights that affect them |     # i.e. maps offset of vertices -> weights that affect them | ||||||
| @@ -58,6 +59,7 @@ def model_to_mesh_object(model: Model, scene : Scene, materials_map : Dict[str, | |||||||
|  |  | ||||||
|  |  | ||||||
|     if model.geometry: |     if model.geometry: | ||||||
|  |         geometry_has_colors = any(segment.colors for segment in model.geometry) | ||||||
|  |  | ||||||
|         for segment in model.geometry: |         for segment in model.geometry: | ||||||
|  |  | ||||||
| @@ -76,6 +78,11 @@ def model_to_mesh_object(model: Model, scene : Scene, materials_map : Dict[str, | |||||||
|             if segment.normals: |             if segment.normals: | ||||||
|                 vertex_normals += [tuple(convert_vector_space(n)) for n in segment.normals] |                 vertex_normals += [tuple(convert_vector_space(n)) for n in segment.normals] | ||||||
|  |  | ||||||
|  |             if segment.colors: | ||||||
|  |                 vertex_colors.extend(segment.colors) | ||||||
|  |             elif geometry_has_colors: | ||||||
|  |                 [vertex_colors.extend([0.0, 0.0, 0.0, 1.0]) for _ in range(len(segment.positions))] | ||||||
|  |              | ||||||
|             if segment.weights: |             if segment.weights: | ||||||
|                 vertex_weights_offsets[polygon_index_offset] = segment.weights |                 vertex_weights_offsets[polygon_index_offset] = segment.weights | ||||||
|  |  | ||||||
| @@ -111,7 +118,6 @@ def model_to_mesh_object(model: Model, scene : Scene, materials_map : Dict[str, | |||||||
|         blender_mesh.vertices.add(len(vertex_positions)) |         blender_mesh.vertices.add(len(vertex_positions)) | ||||||
|         blender_mesh.vertices.foreach_set("co", [component for vertex_position in vertex_positions for component in vertex_position]) |         blender_mesh.vertices.foreach_set("co", [component for vertex_position in vertex_positions for component in vertex_position]) | ||||||
|  |  | ||||||
|  |  | ||||||
|         # LOOPS  |         # LOOPS  | ||||||
|  |  | ||||||
|         flat_indices = [index for polygon in polygons for index in polygon] |         flat_indices = [index for polygon in polygons for index in polygon] | ||||||
| @@ -122,13 +128,16 @@ def model_to_mesh_object(model: Model, scene : Scene, materials_map : Dict[str, | |||||||
|         blender_mesh.loops.foreach_set("vertex_index", flat_indices) |         blender_mesh.loops.foreach_set("vertex_index", flat_indices) | ||||||
|  |  | ||||||
|         # Normals |         # Normals | ||||||
|         blender_mesh.create_normals_split() |  | ||||||
|         blender_mesh.loops.foreach_set("normal", [component for i in flat_indices for component in vertex_normals[i]]) |         blender_mesh.loops.foreach_set("normal", [component for i in flat_indices for component in vertex_normals[i]]) | ||||||
|  |  | ||||||
|         # UVs |         # UVs | ||||||
|         blender_mesh.uv_layers.new(do_init=False) |         blender_mesh.uv_layers.new(do_init=False) | ||||||
|         blender_mesh.uv_layers[0].data.foreach_set("uv", [component for i in flat_indices for component in vertex_uvs[i]]) |         blender_mesh.uv_layers[0].data.foreach_set("uv", [component for i in flat_indices for component in vertex_uvs[i]]) | ||||||
|  |  | ||||||
|  |         # Colors | ||||||
|  |         if geometry_has_colors: | ||||||
|  |             blender_mesh.color_attributes.new("COLOR0", "FLOAT_COLOR", "POINT") | ||||||
|  |             blender_mesh.color_attributes[0].data.foreach_set("color", vertex_colors) | ||||||
|  |  | ||||||
|  |  | ||||||
|         # POLYGONS/FACES |         # POLYGONS/FACES | ||||||
| @@ -165,7 +174,6 @@ def model_to_mesh_object(model: Model, scene : Scene, materials_map : Dict[str, | |||||||
|         reset_normals = [0.0] * (len(blender_mesh.loops) * 3) |         reset_normals = [0.0] * (len(blender_mesh.loops) * 3) | ||||||
|         blender_mesh.loops.foreach_get("normal", reset_normals) |         blender_mesh.loops.foreach_get("normal", reset_normals) | ||||||
|         blender_mesh.normals_split_custom_set(tuple(zip(*(iter(reset_normals),) * 3))) |         blender_mesh.normals_split_custom_set(tuple(zip(*(iter(reset_normals),) * 3))) | ||||||
|         blender_mesh.use_auto_smooth = True |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     blender_mesh_object = bpy.data.objects.new(model.name, blender_mesh) |     blender_mesh_object = bpy.data.objects.new(model.name, blender_mesh) | ||||||
| @@ -188,4 +196,3 @@ def model_to_mesh_object(model: Model, scene : Scene, materials_map : Dict[str, | |||||||
|  |  | ||||||
|  |  | ||||||
|     return blender_mesh_object |     return blender_mesh_object | ||||||
|  |  | ||||||
|   | |||||||
| @@ -73,7 +73,7 @@ class Model: | |||||||
|     name: str = "Model" |     name: str = "Model" | ||||||
|     parent: str = "" |     parent: str = "" | ||||||
|     model_type: ModelType = ModelType.NULL |     model_type: ModelType = ModelType.NULL | ||||||
|     hidden: bool = True |     hidden: bool = False | ||||||
|  |  | ||||||
|     transform: ModelTransform = field(default_factory=ModelTransform) |     transform: ModelTransform = field(default_factory=ModelTransform) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -40,6 +40,10 @@ def gather_models(apply_modifiers: bool, export_target: str, skeleton_only: bool | |||||||
|     # Here we just keep track of all names, regardless of origin |     # Here we just keep track of all names, regardless of origin | ||||||
|     exported_object_names: Set[str] = set()  |     exported_object_names: Set[str] = set()  | ||||||
|  |  | ||||||
|  |     # Me must keep track of hidden objects separately because | ||||||
|  |     # evaluated_get clears hidden status | ||||||
|  |     blender_objects_to_hide: Set[str] = set() | ||||||
|  |  | ||||||
|     # Armature must be processed before everything else! |     # Armature must be processed before everything else! | ||||||
|  |  | ||||||
|     # In this loop we also build a set of names of all objects |     # In this loop we also build a set of names of all objects | ||||||
| @@ -47,6 +51,10 @@ def gather_models(apply_modifiers: bool, export_target: str, skeleton_only: bool | |||||||
|     # groups that do not reference exported objects in the main  |     # groups that do not reference exported objects in the main  | ||||||
|     # model building loop below this one. |     # model building loop below this one. | ||||||
|     for uneval_obj in select_objects(export_target): |     for uneval_obj in select_objects(export_target): | ||||||
|  |  | ||||||
|  |         if get_is_model_hidden(uneval_obj): | ||||||
|  |             blender_objects_to_hide.add(uneval_obj.name) | ||||||
|  |  | ||||||
|         if uneval_obj.type == "ARMATURE" and not armature_found: |         if uneval_obj.type == "ARMATURE" and not armature_found: | ||||||
|             # Keep track of the armature, we don't want to process > 1! |             # Keep track of the armature, we don't want to process > 1! | ||||||
|             armature_found = uneval_obj.evaluated_get(depsgraph) if apply_modifiers else uneval_obj |             armature_found = uneval_obj.evaluated_get(depsgraph) if apply_modifiers else uneval_obj | ||||||
| @@ -80,7 +88,6 @@ def gather_models(apply_modifiers: bool, export_target: str, skeleton_only: bool | |||||||
|             model = Model() |             model = Model() | ||||||
|             model.name = obj.name |             model.name = obj.name | ||||||
|             model.model_type = ModelType.NULL if skeleton_only else get_model_type(obj, armature_found) |             model.model_type = ModelType.NULL if skeleton_only else get_model_type(obj, armature_found) | ||||||
|             model.hidden = get_is_model_hidden(obj) |  | ||||||
|  |  | ||||||
|             transform = obj.matrix_local |             transform = obj.matrix_local | ||||||
|  |  | ||||||
| @@ -133,6 +140,8 @@ def gather_models(apply_modifiers: bool, export_target: str, skeleton_only: bool | |||||||
|         if get_is_collision_primitive(obj): |         if get_is_collision_primitive(obj): | ||||||
|             model.collisionprimitive = get_collision_primitive(obj) |             model.collisionprimitive = get_collision_primitive(obj) | ||||||
|  |  | ||||||
|  |         model.hidden = model.name in blender_objects_to_hide | ||||||
|  |  | ||||||
|         models_list.append(model) |         models_list.append(model) | ||||||
|  |  | ||||||
|     # We removed all composite bones after looking through the objects, |     # We removed all composite bones after looking through the objects, | ||||||
| @@ -170,7 +179,7 @@ def create_mesh_geometry(mesh: bpy.types.Mesh, valid_vgroup_indices: Set[int]) - | |||||||
|     vertex_remap: List[Dict[Tuple[int, int], int]] = [dict() for i in range(material_count)] |     vertex_remap: List[Dict[Tuple[int, int], int]] = [dict() for i in range(material_count)] | ||||||
|     polygons: List[Set[int]] = [set() for i in range(material_count)] |     polygons: List[Set[int]] = [set() for i in range(material_count)] | ||||||
|  |  | ||||||
|     if mesh.vertex_colors.active is not None: |     if mesh.color_attributes.active_color is not None: | ||||||
|         for segment in segments: |         for segment in segments: | ||||||
|             segment.colors = [] |             segment.colors = [] | ||||||
|  |  | ||||||
| @@ -206,7 +215,10 @@ def create_mesh_geometry(mesh: bpy.types.Mesh, valid_vgroup_indices: Set[int]) - | |||||||
|                 yield mesh.uv_layers.active.data[loop_index].uv.y |                 yield mesh.uv_layers.active.data[loop_index].uv.y | ||||||
|  |  | ||||||
|             if segment.colors is not None: |             if segment.colors is not None: | ||||||
|                 for v in mesh.vertex_colors.active.data[loop_index].color: |                 active_color = mesh.color_attributes.active_color | ||||||
|  |                 data_index = loop_index if active_color.domain == "CORNER" else vertex_index | ||||||
|  |  | ||||||
|  |                 for v in mesh.color_attributes.active_color.data[data_index].color: | ||||||
|                     yield v |                     yield v | ||||||
|  |  | ||||||
|             if segment.weights is not None: |             if segment.weights is not None: | ||||||
| @@ -236,7 +248,10 @@ def create_mesh_geometry(mesh: bpy.types.Mesh, valid_vgroup_indices: Set[int]) - | |||||||
|             segment.texcoords.append(mesh.uv_layers.active.data[loop_index].uv.copy()) |             segment.texcoords.append(mesh.uv_layers.active.data[loop_index].uv.copy()) | ||||||
|  |  | ||||||
|         if segment.colors is not None: |         if segment.colors is not None: | ||||||
|             segment.colors.append(list(mesh.vertex_colors.active.data[loop_index].color)) |             active_color = mesh.color_attributes.active_color | ||||||
|  |             data_index = loop_index if active_color.domain == "CORNER" else vertex_index | ||||||
|  |  | ||||||
|  |             segment.colors.append(list(active_color.data[data_index].color)) | ||||||
|  |  | ||||||
|         if segment.weights is not None: |         if segment.weights is not None: | ||||||
|             groups = mesh.vertices[vertex_index].groups |             groups = mesh.vertices[vertex_index].groups | ||||||
| @@ -290,6 +305,9 @@ def get_model_type(obj: bpy.types.Object, armature_found: bpy.types.Object) -> M | |||||||
| def get_is_model_hidden(obj: bpy.types.Object) -> bool: | def get_is_model_hidden(obj: bpy.types.Object) -> bool: | ||||||
|     """ Gets if a Blender object should be marked as hidden in the .msh file. """ |     """ Gets if a Blender object should be marked as hidden in the .msh file. """ | ||||||
|  |  | ||||||
|  |     if obj.hide_get(): | ||||||
|  |         return True | ||||||
|  |  | ||||||
|     name = obj.name.lower() |     name = obj.name.lower() | ||||||
|  |  | ||||||
|     if name.startswith("c_"): |     if name.startswith("c_"): | ||||||
| @@ -482,6 +500,7 @@ def expand_armature(armature: bpy.types.Object) -> Dict[str, Model]: | |||||||
|  |  | ||||||
|         model.model_type = ModelType.BONE if bone.name in proper_BONES else ModelType.NULL |         model.model_type = ModelType.BONE if bone.name in proper_BONES else ModelType.NULL | ||||||
|         model.name = bone.name |         model.name = bone.name | ||||||
|  |         model.hidden = True | ||||||
|         model.transform.rotation = convert_rotation_space(local_rotation) |         model.transform.rotation = convert_rotation_space(local_rotation) | ||||||
|         model.transform.translation = convert_vector_space(local_translation) |         model.transform.translation = convert_vector_space(local_translation) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -165,19 +165,23 @@ def _read_matd(matd: Reader) -> Material: | |||||||
|  |  | ||||||
|         elif next_header == "TX0D": |         elif next_header == "TX0D": | ||||||
|             with matd.read_child() as tx0d: |             with matd.read_child() as tx0d: | ||||||
|                 mat.texture0 = tx0d.read_string() |                 if tx0d.bytes_remaining() > 0: | ||||||
|  |                     mat.texture0 = tx0d.read_string() | ||||||
|  |  | ||||||
|         elif next_header == "TX1D": |         elif next_header == "TX1D": | ||||||
|             with matd.read_child() as tx1d: |             with matd.read_child() as tx1d: | ||||||
|                 mat.texture1 = tx1d.read_string() |                 if tx1d.bytes_remaining() > 0: | ||||||
|  |                     mat.texture1 = tx1d.read_string() | ||||||
|  |  | ||||||
|         elif next_header == "TX2D": |         elif next_header == "TX2D": | ||||||
|             with matd.read_child() as tx2d: |             with matd.read_child() as tx2d: | ||||||
|                 mat.texture2 = tx2d.read_string() |                 if tx2d.bytes_remaining() > 0: | ||||||
|  |                     mat.texture2 = tx2d.read_string() | ||||||
|  |  | ||||||
|         elif next_header == "TX3D": |         elif next_header == "TX3D": | ||||||
|             with matd.read_child() as tx3d: |             with matd.read_child() as tx3d: | ||||||
|                 mat.texture3 = tx3d.read_string() |                 if tx3d.bytes_remaining() > 0: | ||||||
|  |                     mat.texture3 = tx3d.read_string() | ||||||
|  |  | ||||||
|         else: |         else: | ||||||
|             matd.skip_bytes(1) |             matd.skip_bytes(1) | ||||||
| @@ -203,7 +207,9 @@ def _read_modl(modl: Reader, materials_list: List[Material]) -> Model: | |||||||
|  |  | ||||||
|                 global model_counter |                 global model_counter | ||||||
|                 global mndx_remap |                 global mndx_remap | ||||||
|                 mndx_remap[index] = model_counter |  | ||||||
|  |                 if index not in mndx_remap: | ||||||
|  |                     mndx_remap[index] = model_counter | ||||||
|  |  | ||||||
|                 model_counter += 1 |                 model_counter += 1 | ||||||
|  |  | ||||||
|   | |||||||
| @@ -195,6 +195,5 @@ def extract_scene(filepath: str, scene: Scene): | |||||||
|     for model in scene.models: |     for model in scene.models: | ||||||
|         if model.name in model_map: |         if model.name in model_map: | ||||||
|             obj = model_map[model.name] |             obj = model_map[model.name] | ||||||
|             if get_is_model_hidden(obj) and len(obj.children) == 0: |             obj.hide_set(model.hidden or get_is_model_hidden(obj)) | ||||||
|                 obj.hide_set(True) |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -39,12 +39,9 @@ def pack_color(color) -> int: | |||||||
|     return packed |     return packed | ||||||
|  |  | ||||||
| def unpack_color(color: int) -> List[float]: | def unpack_color(color: int) -> List[float]: | ||||||
|  |     r = (color >> 16 & 0xFF) / 255.0 | ||||||
|     mask = int(0x000000ff) |     g = (color >> 8  & 0xFF) / 255.0 | ||||||
|  |     b = (color >> 0  & 0xFF) / 255.0 | ||||||
|     r = (color & (mask << 16)) / 255.0 |     a = (color >> 24 & 0xFF) / 255.0 | ||||||
|     g = (color & (mask << 8)) / 255.0 |  | ||||||
|     b = (color & mask) / 255.0 |  | ||||||
|     a = (color & (mask << 24)) / 255.0 |  | ||||||
|  |  | ||||||
|     return [r,g,b,a] |     return [r,g,b,a] | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user