Skip to content

Commit

Permalink
Fixed duplicate command in editor
Browse files Browse the repository at this point in the history
  • Loading branch information
EspeuteClement committed Jan 22, 2024
1 parent d6eb1c8 commit ae1699a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hide/comp/SceneEditor.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3157,7 +3157,7 @@ class SceneEditor {
var lastElem = elements[elements.length-1];
var lastIndex = lastElem.parent.children.indexOf(lastElem) + 1;
for(elt in elements) {
var clone = elt.clone(elt.parent, null);
@:privateAccess var clone = elt.copyDefault(elt.parent, elt.parent.shared);
var index = lastIndex+1;
elt.parent.children.remove(clone);
elt.parent.children.insert(index, clone);
Expand Down
5 changes: 4 additions & 1 deletion hrt/prefab/Prefab.hx
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,9 @@ class Prefab {
return newInstance;
};

/*
Create a copy of this prefab with a new context shared
*/
public final function clone(?root: Prefab = null, contextShared:ContextShared, withChildren : Bool = true) : Prefab {
var sh = contextShared;

Expand All @@ -662,7 +665,7 @@ class Prefab {
}

/**
Create a copy of this prefab and it's childrens, whitout initializing their fields
Create a copy of this prefab and it's childrens
**/
final function copyDefault(?parent:Prefab = null, sh: ContextShared, withChildren : Bool = true) : Prefab {
var thisClass = Type.getClass(this);
Expand Down

0 comments on commit ae1699a

Please sign in to comment.