Apply "Rename new cube" setting to all elements

This commit is contained in:
JannisX11 2020-12-30 22:30:43 +01:00
parent 74e52d5a16
commit 9b078273dc
3 changed files with 35 additions and 34 deletions

View File

@ -857,7 +857,6 @@ BARS.defineActions(function() {
Blockbench.dispatchEvent( 'add_cube', {object: base_cube} )
Vue.nextTick(function() {
updateSelection()
if (settings.create_rename.value) {
base_cube.rename()
}

View File

@ -500,38 +500,6 @@ function getAllGroups() {
iterate(Outliner.root)
return ta;
}
function addGroup() {
Undo.initEdit({outliner: true});
var add_group = Group.selected
if (!add_group && selected.length) {
add_group = Cube.selected.last()
}
var base_group = new Group({
origin: add_group ? add_group.origin : undefined
})
base_group.addTo(add_group)
base_group.isOpen = true
if (Format.bone_rig) {
base_group.createUniqueName()
}
if (add_group instanceof NonGroup && selected.length > 1) {
selected.forEach(function(s, i) {
s.addTo(base_group)
})
}
base_group.init().select()
Undo.finishEdit('add_group');
loadOutlinerDraggable()
Vue.nextTick(function() {
updateSelection()
if (settings.create_rename.value) {
base_group.rename()
}
base_group.showInOutliner()
Blockbench.dispatchEvent( 'add_group', {object: base_group} )
})
}
window.__defineGetter__('selected_group', () => {
console.warn('selected_group is deprecated. Please use Group.selected instead.')
return Group.selected
@ -545,7 +513,36 @@ BARS.defineActions(function() {
condition: () => Modes.edit,
keybind: new Keybind({key: 71, ctrl: true}),
click: function () {
addGroup();
Undo.initEdit({outliner: true});
var add_group = Group.selected
if (!add_group && selected.length) {
add_group = Cube.selected.last()
}
var base_group = new Group({
origin: add_group ? add_group.origin : undefined
})
base_group.addTo(add_group)
base_group.isOpen = true
if (Format.bone_rig) {
base_group.createUniqueName()
}
if (add_group instanceof NonGroup && selected.length > 1) {
selected.forEach(function(s, i) {
s.addTo(base_group)
})
}
base_group.init().select()
Undo.finishEdit('add_group');
loadOutlinerDraggable()
Vue.nextTick(function() {
updateSelection()
if (settings.create_rename.value) {
base_group.rename()
}
base_group.showInOutliner()
Blockbench.dispatchEvent( 'add_group', {object: base_group} )
})
}
})
new Action({

View File

@ -107,6 +107,11 @@ BARS.defineActions(function() {
locator.select().createUniqueName();
objs.push(locator);
Undo.finishEdit('add locator');
Vue.nextTick(function() {
if (settings.create_rename.value) {
locator.rename();
}
})
}
})
})