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

Method get_node_states_stack

scene/property_utils.cpp:239–286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

237}
238
239Vector<SceneState::PackState> PropertyUtils::get_node_states_stack(const Node *p_node, const Node *p_owner, bool *r_instantiated_by_owner) {
240 if (r_instantiated_by_owner) {
241 *r_instantiated_by_owner = true;
242 }
243
244 LocalVector<_FastPackState> states_stack;
245 {
246 const Node *owner = p_owner;
247#ifdef TOOLS_ENABLED
248 if (!p_owner && Engine::get_singleton()->is_editor_hint()) {
249 owner = EditorNode::get_singleton()->get_edited_scene();
250 }
251#endif
252
253 const Node *n = p_node;
254 while (n) {
255 if (n == owner) {
256 const Ref<SceneState> &state = n->get_scene_inherited_state();
257 if (_collect_inheritance_chain(state, n->get_path_to(p_node), states_stack)) {
258 if (r_instantiated_by_owner) {
259 *r_instantiated_by_owner = false;
260 }
261 }
262 break;
263 } else if (!n->get_scene_file_path().is_empty()) {
264 const Ref<SceneState> &state = n->get_scene_instance_state();
265 _collect_inheritance_chain(state, n->get_path_to(p_node), states_stack);
266 }
267 n = n->get_owner();
268 }
269 }
270
271 // Convert to the proper type for returning, inverting the vector on the go
272 // (it was more convenient to fill the vector in reverse order)
273 Vector<SceneState::PackState> states_stack_ret;
274 {
275 states_stack_ret.resize(states_stack.size());
276 _FastPackState *ps = states_stack.ptr();
277 if (states_stack.size() > 0) {
278 for (int i = states_stack.size() - 1; i >= 0; --i) {
279 states_stack_ret.write[i].state.reference_ptr(ps->state);
280 states_stack_ret.write[i].node = ps->node;
281 ++ps;
282 }
283 }
284 }
285 return states_stack_ret;
286}
287
288void PropertyUtils::assign_custom_type_script(Object *p_object, const Ref<Script> &p_script) {
289 ERR_FAIL_NULL(p_object);

Callers

nothing calls this directly

Calls 13

get_path_toMethod · 0.80
get_scene_file_pathMethod · 0.80
reference_ptrMethod · 0.80
sizeMethod · 0.65
is_editor_hintMethod · 0.45
get_edited_sceneMethod · 0.45
is_emptyMethod · 0.45
get_ownerMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected