MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / _property_changed

Method _property_changed

editor/debugger/script_editor_debugger.cpp:1448–1492  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1446}
1447
1448void ScriptEditorDebugger::_property_changed(Object *p_base, const StringName &p_property, const Variant &p_value) {
1449 if (!p_base || !live_debug || !EditorNode::get_singleton()->get_edited_scene()) {
1450 return;
1451 }
1452
1453 Node *node = Object::cast_to<Node>(p_base);
1454
1455 if (node) {
1456 NodePath path = EditorNode::get_singleton()->get_edited_scene()->get_path_to(node);
1457 int pathid = _get_node_path_cache(path);
1458
1459 if (p_value.is_ref_counted()) {
1460 Ref<Resource> res = p_value;
1461 if (res.is_valid() && !res->get_path().is_empty()) {
1462 Array msg = { pathid, p_property, res->get_path() };
1463 _put_msg("scene:live_node_prop_res", msg);
1464 }
1465 } else {
1466 Array msg = { pathid, p_property, p_value };
1467 _put_msg("scene:live_node_prop", msg);
1468 }
1469
1470 return;
1471 }
1472
1473 Resource *res = Object::cast_to<Resource>(p_base);
1474
1475 if (res && !res->get_path().is_empty()) {
1476 String respath = res->get_path();
1477 int pathid = _get_res_path_cache(respath);
1478
1479 if (p_value.is_ref_counted()) {
1480 Ref<Resource> res2 = p_value;
1481 if (res2.is_valid() && !res2->get_path().is_empty()) {
1482 Array msg = { pathid, p_property, res2->get_path() };
1483 _put_msg("scene:live_res_prop_res", msg);
1484 }
1485 } else {
1486 Array msg = { pathid, p_property, p_value };
1487 _put_msg("scene:live_res_prop", msg);
1488 }
1489
1490 return;
1491 }
1492}
1493
1494bool ScriptEditorDebugger::is_move_to_foreground() const {
1495 return move_to_foreground;

Callers 1

_properties_changedMethod · 0.45

Calls 6

get_path_toMethod · 0.80
get_edited_sceneMethod · 0.45
is_ref_countedMethod · 0.45
is_validMethod · 0.45
is_emptyMethod · 0.45
get_pathMethod · 0.45

Tested by

no test coverage detected