fix various bugs after refactor

This commit is contained in:
yyc12345 2022-04-04 12:45:41 +08:00
parent c40f956771
commit cb9609ac2c
4 changed files with 12 additions and 10 deletions

View File

@ -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(';')

View File

@ -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'}

View File

@ -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:

View File

@ -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)