Skip to content

Commit bd22b58

Browse files
committed
Fix being able to copy-paste unsupported elements into armature bone
1 parent 885156d commit bd22b58

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

js/copy_paste.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,11 @@ export const Clipbench = {
362362
let elements = [];
363363
let new_elements_by_old_id = {};
364364
for (let save of Clipbench.elements) {
365-
if (!OutlinerElement.isTypePermitted(save.type)) return;
366-
let copy = OutlinerElement.fromSave(save).addTo(target).markAsSelected();
365+
if (!OutlinerElement.isTypePermitted(save.type)) continue;
366+
let copy = new OutlinerElement.types[save.type](save);
367+
if (!canAddOutlinerNodesTo([copy], target)) continue;
368+
copy.init();
369+
copy.addTo(target).markAsSelected();
367370
copy.createUniqueName();
368371
Property.resetUniqueValues(copy.constructor, copy);
369372
if (typeof save.isOpen == 'boolean') copy.isOpen = save.isOpen;

js/outliner/outliner.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,6 @@ export function canAddOutlinerNodesTo(selection, target) {
10441044
return true;
10451045
}
10461046
if (!target.getTypeBehavior('parent')) return false;
1047-
if (target.selected) return false;
10481047
let child_types = target.getTypeBehavior('child_types');
10491048
if (child_types) {
10501049
if (selection.find(el => child_types.includes(el.type) == false)) return false;
@@ -1057,6 +1056,7 @@ export function canAddOutlinerNodesTo(selection, target) {
10571056
return true;
10581057
}
10591058
export function canAddOutlinerSelectionTo(target) {
1059+
if (target.selected) return false;
10601060
let nodes_to_move = Outliner.selected.concat(Group.selected).filter(element => element.parent == 'root' || element.parent.selected != true);
10611061
return canAddOutlinerNodesTo(nodes_to_move, target);
10621062
}

0 commit comments

Comments
 (0)