|
@@ -1310,29 +1310,31 @@ int SceneState::_find_base_scene_node_remap_key(int p_idx) const {
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
|
|
-Variant SceneState::get_property_value(int p_node, const StringName &p_property, bool &found) const {
|
|
|
|
- found = false;
|
|
|
|
|
|
+Variant SceneState::get_property_value(int p_node, const StringName &p_property, bool &r_found, bool &r_node_deferred) const {
|
|
|
|
+ r_found = false;
|
|
|
|
+ r_node_deferred = false;
|
|
|
|
|
|
ERR_FAIL_COND_V(p_node < 0, Variant());
|
|
ERR_FAIL_COND_V(p_node < 0, Variant());
|
|
|
|
|
|
if (p_node < nodes.size()) {
|
|
if (p_node < nodes.size()) {
|
|
- //find in built-in nodes
|
|
|
|
|
|
+ // Find in built-in nodes.
|
|
int pc = nodes[p_node].properties.size();
|
|
int pc = nodes[p_node].properties.size();
|
|
const StringName *namep = names.ptr();
|
|
const StringName *namep = names.ptr();
|
|
|
|
|
|
const NodeData::Property *p = nodes[p_node].properties.ptr();
|
|
const NodeData::Property *p = nodes[p_node].properties.ptr();
|
|
for (int i = 0; i < pc; i++) {
|
|
for (int i = 0; i < pc; i++) {
|
|
if (p_property == namep[p[i].name & FLAG_PROP_NAME_MASK]) {
|
|
if (p_property == namep[p[i].name & FLAG_PROP_NAME_MASK]) {
|
|
- found = true;
|
|
|
|
|
|
+ r_found = true;
|
|
|
|
+ r_node_deferred = p[i].name & FLAG_PATH_PROPERTY_IS_NODE;
|
|
return variants[p[i].value];
|
|
return variants[p[i].value];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- //property not found, try on instance
|
|
|
|
-
|
|
|
|
- if (base_scene_node_remap.has(p_node)) {
|
|
|
|
- return get_base_scene_state()->get_property_value(base_scene_node_remap[p_node], p_property, found);
|
|
|
|
|
|
+ // Property not found, try on instance.
|
|
|
|
+ HashMap<int, int>::ConstIterator I = base_scene_node_remap.find(p_node);
|
|
|
|
+ if (I) {
|
|
|
|
+ return get_base_scene_state()->get_property_value(I->value, p_property, r_found, r_node_deferred);
|
|
}
|
|
}
|
|
|
|
|
|
return Variant();
|
|
return Variant();
|
|
@@ -1722,13 +1724,25 @@ StringName SceneState::get_node_property_name(int p_idx, int p_prop) const {
|
|
|
|
|
|
Vector<String> SceneState::get_node_deferred_nodepath_properties(int p_idx) const {
|
|
Vector<String> SceneState::get_node_deferred_nodepath_properties(int p_idx) const {
|
|
Vector<String> ret;
|
|
Vector<String> ret;
|
|
- ERR_FAIL_INDEX_V(p_idx, nodes.size(), ret);
|
|
|
|
- for (int i = 0; i < nodes[p_idx].properties.size(); i++) {
|
|
|
|
- uint32_t idx = nodes[p_idx].properties[i].name;
|
|
|
|
- if (idx & FLAG_PATH_PROPERTY_IS_NODE) {
|
|
|
|
- ret.push_back(names[idx & FLAG_PROP_NAME_MASK]);
|
|
|
|
|
|
+ ERR_FAIL_COND_V(p_idx < 0, ret);
|
|
|
|
+
|
|
|
|
+ if (p_idx < nodes.size()) {
|
|
|
|
+ // Find in built-in nodes.
|
|
|
|
+ for (int i = 0; i < nodes[p_idx].properties.size(); i++) {
|
|
|
|
+ uint32_t idx = nodes[p_idx].properties[i].name;
|
|
|
|
+ if (idx & FLAG_PATH_PROPERTY_IS_NODE) {
|
|
|
|
+ ret.push_back(names[idx & FLAG_PROP_NAME_MASK]);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ return ret;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // Property not found, try on instance.
|
|
|
|
+ HashMap<int, int>::ConstIterator I = base_scene_node_remap.find(p_idx);
|
|
|
|
+ if (I) {
|
|
|
|
+ return get_base_scene_state()->get_node_deferred_nodepath_properties(I->value);
|
|
|
|
+ }
|
|
|
|
+
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|