Fix issue with moving locators

Fix issue with centering meshes
Fix transform gizmo not updating when dragging elements in outliner
Fix close button on Quick Setup not working
Fix lag when using mirror painting settings menu multiple times
This commit is contained in:
JannisX11 2022-09-23 17:47:37 +02:00
parent f90f90c482
commit a159a177db
6 changed files with 28 additions and 14 deletions

View File

@ -44,7 +44,8 @@ class Menu {
}
this.id = typeof id == 'string' ? id : '';
this.children = [];
this.node = $('<ul class="contextMenu"></ul>')[0]
this.node = document.createElement('ul');
this.node.classList.add('contextMenu');
this.structure = structure;
this.options = options || {};
this.onOpen = this.options.onOpen;
@ -143,7 +144,7 @@ class Menu {
} else if (Keybinds.extra.confirm.keybind.isTriggered(e)) {
obj.find('li.focused').click()
if (scope && !this.options.keep_open) {
scope.hide()
//scope.hide()
}
used = true;
} else if (Keybinds.extra.cancel.keybind.isTriggered(e)) {
@ -436,7 +437,7 @@ class Menu {
handleMenuOverflow(ctxmenu);
}
$(scope.node).on('click', (ev) => {
scope.node.onclick = (ev) => {
if (
ev.target.className.includes('parent') ||
(ev.target.parentNode && ev.target.parentNode.className.includes('parent')) ||
@ -450,7 +451,7 @@ class Menu {
this.hide()
}
}
})
}
if (scope.type === 'bar_menu') {
MenuBar.open = scope

View File

@ -569,7 +569,7 @@ ModelLoader.loaders = {};
methods: {
tl,
close() {
obj.remove();
this.$el.remove();
},
reload() {
Blockbench.reload();

View File

@ -769,7 +769,11 @@ function moveElementsInSpace(difference, axis) {
}
} else if (space instanceof Group) {
if (el.movable && el instanceof Mesh == false) el.from[axis] += difference;
if (el.movable && el instanceof Cube) {
el.from[axis] += difference;
} else if (el.movable && el.position) {
el.position[axis] += difference;
}
if (el.resizable && el.to) el.to[axis] += difference;
if (el.rotatable && !el.position) el.origin[axis] += difference;
} else {
@ -800,8 +804,15 @@ function moveElementsInSpace(difference, axis) {
}
}
if (el.movable && (el instanceof Mesh == false || !move_origin)) el.from.V3_add(m.x, m.y, m.z);
if (el.resizable && el.to) el.to.V3_add(m.x, m.y, m.z);
if (el instanceof Cube) {
el.from.V3_add(m.x, m.y, m.z);
el.to.V3_add(m.x, m.y, m.z);
} else if (el instanceof Mesh && move_origin) {
el.position.V3_add(m.x, m.y, m.z);
} else if (el.position) {
el.position.V3_add(m.x, m.y, m.z);
}
if (move_origin) {
if (el.rotatable && !el.position && el instanceof TextureMesh == false) el.origin.V3_add(m.x, m.y, m.z);
}

View File

@ -304,7 +304,7 @@ class Mesh extends OutlinerElement {
this.extend(data)
}
}
get from() {
get position() {
return this.origin;
}
get vertice_list() {

View File

@ -12,9 +12,10 @@ class NullObject extends OutlinerElement {
}
}
get origin() {
return this.from;
return this.position;
}
extend(object) {
if (object.from) this.position.V3_set(object.from);
for (var key in NullObject.properties) {
NullObject.properties[key].merge(this, object)
}
@ -60,8 +61,8 @@ class NullObject extends OutlinerElement {
return super.unselect(...args);
}
flip(axis, center) {
var offset = this.from[axis] - center
this.from[axis] = center - offset;
var offset = this.position[axis] - center
this.position[axis] = center - offset;
// Name
if (axis == 0 && this.name.includes('right')) {
this.name = this.name.replace(/right/g, 'left').replace(/2$/, '');
@ -89,7 +90,7 @@ class NullObject extends OutlinerElement {
offset.z += this.parent.origin[2];
}
} else {
offset = Reusable.vec3.fromArray(this.from);
offset = Reusable.vec3.fromArray(this.position);
}
offset.applyQuaternion(q);
pos.add(offset);
@ -133,7 +134,7 @@ class NullObject extends OutlinerElement {
])
new Property(NullObject, 'string', 'name', {default: 'null_object'})
new Property(NullObject, 'vector', 'from')
new Property(NullObject, 'vector', 'position')
new Property(NullObject, 'string', 'ik_target', {condition: () => Format.animation_mode});
new Property(NullObject, 'boolean', 'lock_ik_target_rotation')
new Property(NullObject, 'boolean', 'locked');

View File

@ -861,6 +861,7 @@ function moveOutlinerSelectionTo(item, target, event, order) {
updateSelection()
Undo.finishEdit('Duplicate selection', {elements: selected, outliner: true, selection: true})
} else {
Transformer.updateSelection()
Undo.finishEdit('Move elements in outliner')
}
}