diff --git a/js/api.js b/js/api.js index 4f99a751..7b424e1a 100644 --- a/js/api.js +++ b/js/api.js @@ -101,7 +101,7 @@ const Blockbench = { return node }, showQuickMessage(message, time = 1000) { - document.getElementById('quick_message_box').remove() + document.getElementById('quick_message_box')?.remove(); let quick_message_box = Interface.createElement('div', {id: 'quick_message_box'}, tl(message)); document.body.append(quick_message_box); diff --git a/js/io/formats/collada.js b/js/io/formats/collada.js index a11ade8e..fda47000 100644 --- a/js/io/formats/collada.js +++ b/js/io/formats/collada.js @@ -540,11 +540,13 @@ var codec = new Codec('collada', { ] } if (node.rotatable) { - tag.content.push( + let rotation_angles = [ {type: 'rotate', attributes: {sid: 'rotationZ'}, content: `0 0 1 ${node.rotation[2]}`}, {type: 'rotate', attributes: {sid: 'rotationY'}, content: `0 1 0 ${node.rotation[1]}`}, - {type: 'rotate', attributes: {sid: 'rotationX'}, content: `1 0 0 ${node.rotation[0]}`}, - ) + {type: 'rotate', attributes: {sid: 'rotationX'}, content: `1 0 0 ${node.rotation[0]}`} + ]; + if (node.mesh.rotation.order == 'XYZ') rotation_angles.reverse(); + tag.content.push(...rotation_angles); } if (node instanceof Cube || node instanceof Mesh) { let textures = []; diff --git a/js/io/formats/fbx.js b/js/io/formats/fbx.js index 170eb84f..b5c7c588 100644 --- a/js/io/formats/fbx.js +++ b/js/io/formats/fbx.js @@ -129,6 +129,7 @@ var codec = new Codec('fbx', { } function addNodeBase(node, fbx_type) { let unique_name = getUniqueName('object', node.uuid, node.name); + let rotation_order = node.mesh.rotation.order == 'XYZ' ? 5 : 0; Objects[node.uuid] = { _key: 'Model', _values: [getID(node.uuid), `Model::${unique_name}`, fbx_type], @@ -140,7 +141,8 @@ var codec = new Codec('fbx', { P4: {_key: 'P', _values: ["Lcl Translation", "Lcl Translation", "", "A", ...getElementPos(node)]}, P5: node.rotation ? {_key: 'P', _values: ["RotationPivot", "Vector3D", "Vector", "", 0, 0, 0]} : undefined, P6: node.rotation ? {_key: 'P', _values: ["Lcl Rotation", "Lcl Rotation", "", "A", ...node.rotation]} : undefined, - P7: node.faces ? {_key: 'P', _values: ["DefaultAttributeIndex", "int", "Integer", "",0]} : undefined, + P7: node.rotation ? {_key: 'P', _values: ["RotationOrder", "enum", "", "", rotation_order]} : undefined, + P8: node.faces ? {_key: 'P', _values: ["DefaultAttributeIndex", "int", "Integer", "",0]} : undefined, }, Shading: '_Y', Culling: "CullingOff", diff --git a/js/web.js b/js/web.js index ec7dd0e6..970c3a80 100644 --- a/js/web.js +++ b/js/web.js @@ -79,14 +79,15 @@ async function loadInfoFromURL() { if (Blockbench.queries.plugins) { let plugin_ids = Blockbench.queries.plugins.split(/,/); - let plugins = plugin_ids.map(id => Plugins.all.find(plugin => plugin.id == id)).filter(p => p instanceof Plugin && p.installed == false); + let plugins = plugin_ids.map(id => Plugins.all.find(plugin => plugin.id == id)) + .filter(p => p instanceof Plugin && p.installed == false && p.isInstallable()); if (plugins.length) { await new Promise(resolve => { let form = { info: {type: 'info', text: 'dialog.load_plugins_from_query.text'} } plugins.forEach(plugin => { - form[plugin.id] = {type: 'checkbox', label: plugin.name, description: plugin.description, value: true} + form[plugin.id.replace(/\./g, '_')] = {type: 'checkbox', label: plugin.name, description: plugin.description, value: true} }) new Dialog({ id: 'load_plugins_from_query', @@ -96,7 +97,7 @@ async function loadInfoFromURL() { onConfirm: async function(result) { let promises = []; plugins.forEach(plugin => { - if (result[plugin.id]) { + if (result[plugin.id.replace(/\./g, '_')]) { promises.push(plugin.download()); } })