@@ -292,6 +292,12 @@ Error SceneDebugger::_msg_live_node_prop_res(const Array &p_args) {
292292 return OK;
293293}
294294
295+ Error SceneDebugger::_msg_live_node_prop_res_array (const Array &p_args) {
296+ ERR_FAIL_COND_V (p_args.size () < 7 , ERR_INVALID_DATA);
297+ LiveEditor::get_singleton ()->_node_set_res_array_func (p_args[0 ], p_args[1 ], p_args[2 ], p_args[3 ], p_args[4 ], p_args[5 ], p_args[6 ]);
298+ return OK;
299+ }
300+
295301Error SceneDebugger::_msg_live_node_prop (const Array &p_args) {
296302 ERR_FAIL_COND_V (p_args.size () < 3 , ERR_INVALID_DATA);
297303 LiveEditor::get_singleton ()->_node_set_func (p_args[0 ], p_args[1 ], p_args[2 ]);
@@ -304,6 +310,12 @@ Error SceneDebugger::_msg_live_res_prop_res(const Array &p_args) {
304310 return OK;
305311}
306312
313+ Error SceneDebugger::_msg_live_res_prop_res_array (const Array &p_args) {
314+ ERR_FAIL_COND_V (p_args.size () < 7 , ERR_INVALID_DATA);
315+ LiveEditor::get_singleton ()->_res_set_res_array_func (p_args[0 ], p_args[1 ], p_args[2 ], p_args[3 ], p_args[4 ], p_args[5 ], p_args[6 ]);
316+ return OK;
317+ }
318+
307319Error SceneDebugger::_msg_live_res_prop (const Array &p_args) {
308320 ERR_FAIL_COND_V (p_args.size () < 3 , ERR_INVALID_DATA);
309321 LiveEditor::get_singleton ()->_res_set_func (p_args[0 ], p_args[1 ], p_args[2 ]);
@@ -549,8 +561,10 @@ void SceneDebugger::_init_message_handlers() {
549561 message_handlers[" live_node_path" ] = _msg_live_node_path;
550562 message_handlers[" live_res_path" ] = _msg_live_res_path;
551563 message_handlers[" live_node_prop_res" ] = _msg_live_node_prop_res;
564+ message_handlers[" live_node_prop_res_array" ] = _msg_live_node_prop_res_array;
552565 message_handlers[" live_node_prop" ] = _msg_live_node_prop;
553566 message_handlers[" live_res_prop_res" ] = _msg_live_res_prop_res;
567+ message_handlers[" live_res_prop_res_array" ] = _msg_live_res_prop_res_array;
554568 message_handlers[" live_res_prop" ] = _msg_live_res_prop;
555569 message_handlers[" live_node_call" ] = _msg_live_node_call;
556570 message_handlers[" live_res_call" ] = _msg_live_res_call;
@@ -1098,6 +1112,32 @@ void LiveEditor::_node_set_res_func(int p_id, const StringName &p_prop, const St
10981112 _node_set_func (p_id, p_prop, r);
10991113}
11001114
1115+ void LiveEditor::_node_set_res_array_func (int p_id, const StringName &p_prop, const Variant &p_value, const uint32_t &p_typed_builtin, const StringName &p_typed_class_name, const String &p_typed_script_path, const Array &p_res_indexes_array) {
1116+ Array array = p_value;
1117+
1118+ Array res_array;
1119+ Variant script;
1120+ if (!p_typed_script_path.is_empty ()) {
1121+ script = ResourceLoader::load (p_typed_script_path);
1122+ }
1123+
1124+ res_array.set_typed (p_typed_builtin, p_typed_class_name, script);
1125+ res_array.resize (array.size ());
1126+
1127+ for (int i = 0 ; i < array.size (); i++) {
1128+ if (array[i].get_type () != Variant::NIL && p_res_indexes_array.has (i)) {
1129+ Ref<Resource> res = ResourceLoader::load (array[i]);
1130+ if (res.is_valid ()) {
1131+ res_array[i] = res;
1132+ }
1133+ } else {
1134+ res_array[i] = array[i];
1135+ }
1136+ }
1137+
1138+ _node_set_func (p_id, p_prop, res_array);
1139+ }
1140+
11011141void LiveEditor::_node_call_func (int p_id, const StringName &p_method, const Variant **p_args, int p_argcount) {
11021142 SceneTree *scene_tree = SceneTree::get_singleton ();
11031143 if (!scene_tree) {
@@ -1189,6 +1229,32 @@ void LiveEditor::_res_set_res_func(int p_id, const StringName &p_prop, const Str
11891229 _res_set_func (p_id, p_prop, r);
11901230}
11911231
1232+ void LiveEditor::_res_set_res_array_func (int p_id, const StringName &p_prop, const Variant &p_value, const uint32_t &p_typed_builtin, const StringName &p_typed_class_name, const String &p_typed_script_path, const Array &p_res_indexes_array) {
1233+ Array array = p_value;
1234+
1235+ Array res_array;
1236+ Variant script;
1237+ if (!p_typed_script_path.is_empty ()) {
1238+ script = ResourceLoader::load (p_typed_script_path);
1239+ }
1240+
1241+ res_array.set_typed (p_typed_builtin, p_typed_class_name, script);
1242+ res_array.resize (array.size ());
1243+
1244+ for (int i = 0 ; i < array.size (); i++) {
1245+ if (array[i].get_type () != Variant::NIL && p_res_indexes_array.has (i)) {
1246+ Ref<Resource> res = ResourceLoader::load (array[i]);
1247+ if (res.is_valid ()) {
1248+ res_array[i] = res;
1249+ }
1250+ } else {
1251+ res_array[i] = array[i];
1252+ }
1253+ }
1254+
1255+ _res_set_func (p_id, p_prop, res_array);
1256+ }
1257+
11921258void LiveEditor::_res_call_func (int p_id, const StringName &p_method, const Variant **p_args, int p_argcount) {
11931259 if (!live_edit_resource_cache.has (p_id)) {
11941260 return ;
0 commit comments