From cb9609ac2ce081cf515a7ecd956e433ce311f9ad Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Mon, 4 Apr 2022 12:45:41 +0800 Subject: [PATCH] fix various bugs after refactor --- ballance_blender_plugin/OBJS_add_floors.py | 4 ++-- ballance_blender_plugin/OBJS_add_rails.py | 2 +- ballance_blender_plugin/UTILS_functions.py | 4 ++-- ballance_blender_plugin/__init__.py | 12 +++++++----- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/ballance_blender_plugin/OBJS_add_floors.py b/ballance_blender_plugin/OBJS_add_floors.py index d2acbfd..297c586 100644 --- a/ballance_blender_plugin/OBJS_add_floors.py +++ b/ballance_blender_plugin/OBJS_add_floors.py @@ -201,7 +201,7 @@ def _create_or_get_material(material_name, prefs_externalTexture): # initialize material parameter # load texture first - texture_filename = UTILS_constants.floor_textureReflactMap[material_name] + texture_filename = UTILS_constants.floor_textureReflactionMap[material_name] deconflict_texture_name = "BMERevenge_" + texture_filename (texture, skip_init) = UTILS_functions.create_instance_with_option( UTILS_constants.BmfileInfoType.TEXTURE, @@ -222,7 +222,7 @@ def _create_or_get_material(material_name, prefs_externalTexture): break # return mtl - return m + return mtl def _solve_vec_data(str_data, d1, d2, d3, unit, unit_height): sp = str_data.split(';') diff --git a/ballance_blender_plugin/OBJS_add_rails.py b/ballance_blender_plugin/OBJS_add_rails.py index aa65684..3798609 100644 --- a/ballance_blender_plugin/OBJS_add_rails.py +++ b/ballance_blender_plugin/OBJS_add_rails.py @@ -60,7 +60,7 @@ class BALLANCE_OT_add_rails(bpy.types.Operator): bpy.ops.object.join() # apply 3d cursor - UTILS_functions.add_into_scene_and_move_to_cursor(obj) + UTILS_functions.move_to_cursor(firstObj) return {'FINISHED'} diff --git a/ballance_blender_plugin/UTILS_functions.py b/ballance_blender_plugin/UTILS_functions.py index d0b43d1..4ec0fb9 100644 --- a/ballance_blender_plugin/UTILS_functions.py +++ b/ballance_blender_plugin/UTILS_functions.py @@ -18,7 +18,7 @@ def show_message_box(message, title, icon): bpy.context.window_manager.popup_menu(draw, title = title, icon = icon) def add_into_scene_and_move_to_cursor(obj): - Move2Cursor(obj) + move_to_cursor(obj) view_layer = bpy.context.view_layer collection = view_layer.active_layer_collection.collection @@ -174,7 +174,7 @@ def create_instance_with_option(instance_type, instance_name, instance_opt, elif instance_type == UTILS_constants.BmfileInfoType.MATERIAL: temp_instance = bpy.data.materials[instance_name] elif instance_type == UTILS_constants.BmfileInfoType.TEXTURE: - temp_instance = bpy.data.textures[instance_name] + temp_instance = bpy.data.images[instance_name] temp_is_existed = True except: diff --git a/ballance_blender_plugin/__init__.py b/ballance_blender_plugin/__init__.py index 103e2c9..a0df65a 100644 --- a/ballance_blender_plugin/__init__.py +++ b/ballance_blender_plugin/__init__.py @@ -115,7 +115,9 @@ classes = ( OBJS_add_components.BALLANCE_OT_add_components, OBJS_add_rails.BALLANCE_OT_add_rails, OBJS_add_floors.BALLANCE_OT_add_floors, - BALLANCE_MT_AddFloorMenu + BALLANCE_MT_AddFloorMenu, + + NAMES_rename_via_group.BALLANCE_OT_rename_via_group ) def menu_func_bm_import(self, context): @@ -157,17 +159,17 @@ def register(): bpy.types.TOPBAR_MT_file_import.append(menu_func_bm_import) bpy.types.TOPBAR_MT_file_export.append(menu_func_bm_export) - bpy.types.VIEW3D_HT_header.append(menu_func_ballance_3d) + bpy.types.VIEW3D_MT_editor_menus.prepend(menu_func_ballance_3d) bpy.types.VIEW3D_MT_add.append(menu_func_ballance_add) - bpy.types.COLLECTION_MT_context_menu.append(menu_func_ballance_rename) + bpy.types.OUTLINER_MT_collection.append(menu_func_ballance_rename) def unregister(): bpy.types.TOPBAR_MT_file_import.remove(menu_func_bm_import) bpy.types.TOPBAR_MT_file_export.remove(menu_func_bm_export) - bpy.types.VIEW3D_HT_header.remove(menu_func_ballance_3d) + bpy.types.VIEW3D_MT_editor_menus.remove(menu_func_ballance_3d) bpy.types.VIEW3D_MT_add.remove(menu_func_ballance_add) - bpy.types.COLLECTION_MT_context_menu.remove(menu_func_ballance_rename) + bpy.types.OUTLINER_MT_collection.remove(menu_func_ballance_rename) for cls in classes: bpy.utils.unregister_class(cls)