@@ -62,6 +62,9 @@ func _ready() -> void:
62
62
await get_tree ().process_frame
63
63
sun .shadow_enabled = mm_globals .get_config ("ui_3d_preview_sun_shadow" )
64
64
65
+ if mm_globals .config .has_section_key ("path" , "mesh" ):
66
+ do_load_custom_mesh (mm_globals .config .get_value ("path" , "mesh" ))
67
+
65
68
func update_menu ():
66
69
mm_globals .menu_manager .create_menus (MENU , self , mm_globals .menu_manager .MenuBarGodot .new (ui ))
67
70
@@ -100,19 +103,19 @@ func _on_Model_item_selected(id) -> void:
100
103
for f in MMMeshLoader .get_file_dialog_filters ():
101
104
dialog .add_filter (f )
102
105
if mm_globals .config .has_section_key ("path" , "mesh" ):
103
- dialog .current_dir = mm_globals .config .get_value ("path" , "mesh" )
106
+ dialog .current_dir = mm_globals .config .get_value ("path" , "mesh" ). get_base_dir ()
104
107
var files = await dialog .select_files ()
105
108
if files .size () == 1 :
106
109
do_load_custom_mesh (files [0 ])
107
110
else :
108
111
select_object (id )
109
112
110
113
func do_load_custom_mesh (file_path ) -> void :
111
- mm_globals .config .set_value ("path" , "mesh" , file_path .get_base_dir ())
112
114
var id = objects .get_child_count ()- 1
113
115
var mesh : Mesh = null
114
116
mesh = MMMeshLoader .load_mesh (file_path )
115
117
if mesh != null :
118
+ mm_globals .config .set_value ("path" , "mesh" , file_path )
116
119
var object : MeshInstance3D = objects .get_child (id )
117
120
object .mesh = mesh
118
121
mm_globals .main_window .set_current_mesh (mesh )
0 commit comments