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

Method _set_impl

editor/debugger/editor_debugger_inspector.cpp:52–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50}
51
52bool EditorDebuggerRemoteObjects::_set_impl(const StringName &p_name, const Variant &p_value, const String &p_field) {
53 String name = p_name;
54 if (!prop_values.has(name) || String(name).begins_with("Constants/")) {
55 return false;
56 }
57
58 // Change it back to the real name when fetching.
59 if (name == "Script") {
60 name = "script";
61 } else if (name.begins_with("Metadata/")) {
62 name = name.replace_first("Metadata/", "metadata/");
63 }
64
65 Dictionary &values = prop_values[p_name];
66 Dictionary old_values = values.duplicate();
67 for (const uint64_t key : values.keys()) {
68 values.set(key, p_value);
69 }
70
71 EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton();
72 const int size = remote_object_ids.size();
73 ur->create_action(size == 1 ? vformat(TTR("Set %s"), name) : vformat(TTR("Set %s on %d objects"), name, size), UndoRedo::MERGE_ENDS);
74
75 ur->add_do_method(this, SNAME("emit_signal"), SNAME("values_edited"), name, values, p_field);
76 ur->add_undo_method(this, SNAME("emit_signal"), SNAME("values_edited"), name, old_values, p_field);
77 ur->commit_action();
78
79 return true;
80}
81
82bool EditorDebuggerRemoteObjects::_get(const StringName &p_name, Variant &r_ret) const {
83 String name = p_name;

Callers

nothing calls this directly

Calls 14

vformatFunction · 0.85
TTRFunction · 0.85
begins_withMethod · 0.80
replace_firstMethod · 0.80
keysMethod · 0.80
sizeMethod · 0.65
StringClass · 0.50
hasMethod · 0.45
duplicateMethod · 0.45
setMethod · 0.45
create_actionMethod · 0.45
add_do_methodMethod · 0.45

Tested by

no test coverage detected