Don't remap resources belonging to instance

(cherry picked from commit 8e8398209e)
This commit is contained in:
kobewi 2021-06-07 12:52:05 +02:00 committed by Rémi Verschelde
parent a33e0c2d41
commit 6ce63017d5
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -2948,6 +2948,7 @@ void SceneTreeDock::_clear_clipboard() {
void SceneTreeDock::_create_remap_for_node(Node *p_node, Map<RES, RES> &r_remap) { void SceneTreeDock::_create_remap_for_node(Node *p_node, Map<RES, RES> &r_remap) {
List<PropertyInfo> props; List<PropertyInfo> props;
p_node->get_property_list(&props); p_node->get_property_list(&props);
bool is_instanced = EditorPropertyRevert::may_node_be_in_instance(p_node);
for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) { for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
if (!(E->get().usage & PROPERTY_USAGE_STORAGE)) { if (!(E->get().usage & PROPERTY_USAGE_STORAGE)) {
@ -2958,6 +2959,15 @@ void SceneTreeDock::_create_remap_for_node(Node *p_node, Map<RES, RES> &r_remap)
if (v.is_ref()) { if (v.is_ref()) {
RES res = v; RES res = v;
if (res.is_valid()) { if (res.is_valid()) {
if (is_instanced) {
Variant orig;
if (EditorPropertyRevert::get_instanced_node_original_property(p_node, E->get().name, orig)) {
if (!EditorPropertyRevert::is_node_property_different(p_node, v, orig)) {
continue;
}
}
}
if ((res->get_path() == "" || res->get_path().find("::") > -1) && !r_remap.has(res)) { if ((res->get_path() == "" || res->get_path().find("::") > -1) && !r_remap.has(res)) {
_create_remap_for_resource(res, r_remap); _create_remap_for_resource(res, r_remap);
} }