From 103af23248685983d92151eb06d296ebe77c7d9e Mon Sep 17 00:00:00 2001 From: Stefania Pedrazzi Date: Mon, 18 Feb 2019 10:08:53 +0100 Subject: [PATCH 1/7] Get slot translation and rotation properties from asset definition --- app/model/part.js | 1 + app/view/handle.js | 66 ++++++++++++++++++++++------------------------ 2 files changed, 33 insertions(+), 34 deletions(-) diff --git a/app/model/part.js b/app/model/part.js index 483543c..a898b77 100644 --- a/app/model/part.js +++ b/app/model/part.js @@ -64,6 +64,7 @@ class Part extends Observable { // eslint-disable-line no-unused-vars if (this.slots[slotName] === part) return slotName; } + return null; } serialize() { diff --git a/app/view/handle.js b/app/view/handle.js index 2d1ed69..cf3b6a8 100644 --- a/app/view/handle.js +++ b/app/view/handle.js @@ -1,4 +1,4 @@ -/* global THREE */ +/* global THREE, Part, Robot */ class Handle { // eslint-disable-line no-unused-vars constructor(robotController, domElement, camera, scene, orbitControls) { @@ -107,47 +107,45 @@ class Handle { // eslint-disable-line no-unused-vars } _updateConstraints() { - // TODO: the following should be defined in assets.json (and so Webots :-/ ) if (!this.part) return; - var asset = this.part.asset; - if (asset.root) { + + var parentPart = this.part.parent; + console.assert(parentPart); + + if (parentPart instanceof Robot) { this.control.rotationSnap = null; this.control.translationSnap = null; this.control.showX = true; this.control.showY = true; this.control.showZ = true; - } else if (asset.slotType === 'tinkerbots') { - this.control.rotationSnap = Math.PI / 2.0; - this.control.translationSnap = null; - if (this.mode === 'rotate') { - this.control.showX = false; - this.control.showY = false; - this.control.showZ = true; - } else { - this.control.showX = false; - this.control.showY = false; - this.control.showZ = false; - } - } else if (asset.slotType.startsWith('lego')) { - this.control.rotationSnap = Math.PI / 2.0; - this.control.translationSnap = 0.02; - if (this.mode === 'rotate') { - this.control.showX = false; - this.control.showY = false; - this.control.showZ = true; - } else { - this.control.showX = true; - this.control.showY = true; - this.control.showZ = false; + return; + } + + if (parentPart instanceof Part) { + var slotName = parentPart.slotName(this.part); + if (slotName) { + var slotData = parentPart.asset.slots[slotName]; + this.control.rotationSnap = slotData.rotationSnap; + this.control.translationSnap = slotData.translationSnap; + if (this.mode === 'rotate') { + this.control.showX = false; + this.control.showY = false; + this.control.showZ = true; + } else { + this.control.showX = this.control.translationSnap !== null; + this.control.showY = this.control.showX; + this.control.showZ = false; + } + return; } - } else { - // normally unreachable. - this.control.rotationSnap = null; - this.control.translationSnap = null; - this.control.showX = false; - this.control.showY = false; - this.control.showZ = false; } + + // normally unreachable. + this.control.rotationSnap = null; + this.control.translationSnap = null; + this.control.showX = false; + this.control.showY = false; + this.control.showZ = false; } } From 72d898498e19495b984bdeb42231e305d57a15fd Mon Sep 17 00:00:00 2001 From: Stefania Pedrazzi Date: Mon, 18 Feb 2019 11:17:03 +0100 Subject: [PATCH 2/7] Disable control settings in case of select mode and support free translation and rotation for parts --- app/view/handle.js | 51 ++++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/app/view/handle.js b/app/view/handle.js index cf3b6a8..6d8ba23 100644 --- a/app/view/handle.js +++ b/app/view/handle.js @@ -113,35 +113,38 @@ class Handle { // eslint-disable-line no-unused-vars var parentPart = this.part.parent; console.assert(parentPart); - if (parentPart instanceof Robot) { - this.control.rotationSnap = null; - this.control.translationSnap = null; - this.control.showX = true; - this.control.showY = true; - this.control.showZ = true; - return; - } + if (this.mode !== 'select') { + if (parentPart instanceof Robot) { + this.control.rotationSnap = null; + this.control.translationSnap = null; + this.control.showX = true; + this.control.showY = true; + this.control.showZ = true; + return; + } - if (parentPart instanceof Part) { - var slotName = parentPart.slotName(this.part); - if (slotName) { - var slotData = parentPart.asset.slots[slotName]; - this.control.rotationSnap = slotData.rotationSnap; - this.control.translationSnap = slotData.translationSnap; - if (this.mode === 'rotate') { - this.control.showX = false; - this.control.showY = false; - this.control.showZ = true; - } else { - this.control.showX = this.control.translationSnap !== null; - this.control.showY = this.control.showX; - this.control.showZ = false; + if (parentPart instanceof Part) { + var slotName = parentPart.slotName(this.part); + if (slotName) { + var slotData = parentPart.asset.slots[slotName]; + this.control.rotationSnap = slotData.rotationSnap === -1 ? null : slotData.rotationSnap; + this.control.translationSnap = slotData.translationSnap === -1 ? null : slotData.translationSnap; + if (this.mode === 'rotate') { + this.control.showX = false; + this.control.showY = false; + this.control.showZ = true; + return; + } else if (this.mode === 'translate') { + this.control.showX = slotData.translationSnap !== null; + this.control.showY = this.control.showX; + this.control.showZ = slotData.enabledTranslationZSnap === true; + return; + } } - return; } } - // normally unreachable. + // select mode or invalid structure. this.control.rotationSnap = null; this.control.translationSnap = null; this.control.showX = false; From 9be7088bc6487ca8855e180f36497e9de317fef1 Mon Sep 17 00:00:00 2001 From: Stefania Pedrazzi Date: Mon, 18 Feb 2019 11:17:23 +0100 Subject: [PATCH 3/7] Define snap properties for parts --- assets/assets.json | 542 +++++++++++++++++++++++++++++++++------------ 1 file changed, 401 insertions(+), 141 deletions(-) diff --git a/assets/assets.json b/assets/assets.json index 23a1cc6..f2f43e5 100644 --- a/assets/assets.json +++ b/assets/assets.json @@ -6,126 +6,171 @@ "slots": { "upSlot": { "type": "tinkerbots", - "translation": "0 0 0.02" + "translation": "0 0 0.02", + "rotationSnap": 1.5708 }, "upASlot": { "type": "lego cross female", "translation": "-0.01 -0.01 0.015", - "rotation": "0 0 1 -1.5708" + "rotation": "0 0 1 -1.5708", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "upBSlot": { "type": "lego cross female", "translation": "-0.01 0.01 0.015", - "rotation": "0 0 1 3.1415" + "rotation": "0 0 1 3.1415", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "upCSlot": { "type": "lego cross female", "translation": "0.01 0.01 0.015", - "rotation": "0 0 1 1.5708" + "rotation": "0 0 1 1.5708", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "upDSlot": { "type": "lego cross female", - "translation": "0.01 -0.01 0.015" + "translation": "0.01 -0.01 0.015", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "downSlot": { "type": "tinkerbots", "translation": "0 0 -0.02", - "rotation": "0 1 0 -3.1415" + "rotation": "0 1 0 -3.1415", + "rotationSnap": 1.5708 }, "downASlot": { "type": "lego cross female", "translation": "-0.01 0.01 -0.015", - "rotation": "0.70710826 0.7071053 0 3.14153" + "rotation": "0.70710826 0.7071053 0 3.14153", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "downBSlot": { "type": "lego cross female", "translation": "-0.01 -0.01 -0.015", - "rotation": "0 1 0 -3.1415" + "rotation": "0 1 0 -3.1415", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "downCSlot": { "type": "lego cross female", "translation": "0.01 -0.01 -0.015", - "rotation": "-0.70710826 0.7071053 0 3.14153" + "rotation": "-0.70710826 0.7071053 0 3.14153", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "downDSlot": { "type": "lego cross female", "translation": "0.01 0.01 -0.015", - "rotation": "-1 0 0 3.14159" + "rotation": "-1 0 0 3.14159", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "leftSlot": { "type": "tinkerbots", "translation": "0.02 0 0", - "rotation": "0 1 0 1.57" + "rotation": "0 1 0 1.57", + "rotationSnap": 1.5708 }, "leftASlot": { "type": "lego cross female", "translation": "0.015 0.01 0.01", - "rotation": "0.7071053 3.2758115e-5 0.70710826 3.14153" + "rotation": "0.7071053 3.2758115e-5 0.70710826 3.14153", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "leftBSlot": { "type": "lego cross female", "translation": "0.015 0.01 -0.01", - "rotation": "0.5773496 0.5773496 0.5773516 2.0944" + "rotation": "0.5773496 0.5773496 0.5773516 2.0944", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "leftCSlot": { "type": "lego cross female", "translation": "0.015 -0.01 -0.01", - "rotation": "0 1 0 1.57" + "rotation": "0 1 0 1.57", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "leftDSlot": { "type": "lego cross female", "translation": "0.015 -0.01 0.01", - "rotation": "-0.5773496 0.5773496 -0.5773516 2.0944" + "rotation": "-0.5773496 0.5773496 -0.5773516 2.0944", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "rightSlot": { "type": "tinkerbots", "translation": "-0.02 0 0", - "rotation": "0 1 0 -1.57" + "rotation": "0 1 0 -1.57", + "rotationSnap": 1.5708 }, "rightASlot": { "type": "lego cross female", "translation": "-0.015 -0.01 0.01", - "rotation": "0 1 0 -1.57" + "rotation": "0 1 0 -1.57", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "rightBSlot": { "type": "lego cross female", "translation": "-0.015 -0.01 -0.01", - "rotation": "0.5773496 -0.5773496 -0.5773516 2.0944" + "rotation": "0.5773496 -0.5773496 -0.5773516 2.0944", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "rightCSlot": { "type": "lego cross female", "translation": "-0.015 0.01 -0.01", - "rotation": "0.7071053 0 -0.70710826 3.14153" + "rotation": "0.7071053 0 -0.70710826 3.14153", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "rightDSlot": { "type": "lego cross female", "translation": "-0.015 0.01 0.01", - "rotation": "-0.5773496 -0.5773496 0.5773516 2.0944" + "rotation": "-0.5773496 -0.5773496 0.5773516 2.0944", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "backSlot": { "type": "tinkerbots", "translation": "0 -0.02 0", - "rotation": "1 0 0 1.57" + "rotation": "1 0 0 1.57", + "rotationSnap": 1.5708 }, "backASlot": { "type": "lego cross female", "translation": "0.01 -0.015 0.01", - "rotation": "0.5773496 -0.5773496 0.5773516 2.0944" + "rotation": "0.5773496 -0.5773496 0.5773516 2.0944", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "backBSlot": { "type": "lego cross female", "translation": "0.01 -0.015 -0.01", - "rotation": "1 0 0 1.57" + "rotation": "1 0 0 1.57", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "backCSlot": { "type": "lego cross female", "translation": "-0.01 -0.015 -0.01", - "rotation": "0.5773496 0.5773496 -0.5773516 2.0944" + "rotation": "0.5773496 0.5773496 -0.5773516 2.0944", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "backDSlot": { "type": "lego cross female", "translation": "-0.01 -0.015 0.01", - "rotation": "0 0.70710677 -0.70710677 3.14153" + "rotation": "0 0.70710677 -0.70710677 3.14153", + "rotationSnap": 1.5708, + "translationSnap": 0.02 } } }, @@ -136,126 +181,171 @@ "slots": { "upSlot": { "type": "tinkerbots", - "translation": "0 0 0.04" + "translation": "0 0 0.04", + "rotationSnap": 1.5708 }, "upASlot": { "type": "lego cross female", "translation": "-0.01 -0.01 0.035", - "rotation": "0 0 1 -1.5708" + "rotation": "0 0 1 -1.5708", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "upBSlot": { "type": "lego cross female", "translation": "-0.01 0.01 0.035", - "rotation": "0 0 1 3.1415" + "rotation": "0 0 1 3.1415", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "upCSlot": { "type": "lego cross female", "translation": "0.01 0.01 0.035", - "rotation": "0 0 1 1.5708" + "rotation": "0 0 1 1.5708", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "upDSlot": { "type": "lego cross female", - "translation": "0.01 -0.01 0.035" + "translation": "0.01 -0.01 0.035", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "leftSlot": { "type": "tinkerbots", "translation": "0.02 0 0.02", - "rotation": "0 1 0 1.57" + "rotation": "0 1 0 1.57", + "rotationSnap": 1.5708 }, "leftASlot": { "type": "lego cross female", "translation": "0.015 0.01 0.03", - "rotation": "0.7071053 3.2758115e-5 0.70710826 3.14153" + "rotation": "0.7071053 3.2758115e-5 0.70710826 3.14153", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "leftBSlot": { "type": "lego cross female", "translation": "0.015 0.01 0.01", - "rotation": "0.5773496 0.5773496 0.5773516 2.0944" + "rotation": "0.5773496 0.5773496 0.5773516 2.0944", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "leftCSlot": { "type": "lego cross female", "translation": "0.015 -0.01 0.01", - "rotation": "0 1 0 1.57" + "rotation": "0 1 0 1.57", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "leftDSlot": { "type": "lego cross female", "translation": "0.015 -0.01 0.03", - "rotation": "-0.5773496 0.5773496 -0.5773516 2.0944" + "rotation": "-0.5773496 0.5773496 -0.5773516 2.0944", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "rightSlot": { "type": "tinkerbots", "translation": "-0.02 0 0.02", - "rotation": "0 1 0 -1.57" + "rotation": "0 1 0 -1.57", + "rotationSnap": 1.5708 }, "rightASlot": { "type": "lego cross female", "translation": "-0.015 -0.01 0.03", - "rotation": "0 1 0 -1.57" + "rotation": "0 1 0 -1.57", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "rightBSlot": { "type": "lego cross female", "translation": "-0.015 -0.01 0.01", - "rotation": "0.5773496 -0.5773496 -0.5773516 2.0944" + "rotation": "0.5773496 -0.5773496 -0.5773516 2.0944", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "rightCSlot": { "type": "lego cross female", "translation": "-0.015 0.01 0.01", - "rotation": "0.7071053 0 -0.70710826 3.14153" + "rotation": "0.7071053 0 -0.70710826 3.14153", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "rightDSlot": { "type": "lego cross female", "translation": "-0.015 0.01 0.03", - "rotation": "-0.5773496 -0.5773496 0.5773516 2.0944" + "rotation": "-0.5773496 -0.5773496 0.5773516 2.0944", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "backSlot": { "type": "tinkerbots", "translation": "0 -0.02 0.02", - "rotation": "1 0 0 1.57" + "rotation": "1 0 0 1.57", + "rotationSnap": 1.5708 }, "frontASlot": { "type": "lego cross female", "translation": "-0.01 0.015 0.03", - "rotation": "-0.5775032 -0.57704425 -0.5775032 2.09348" + "rotation": "-0.5775032 -0.57704425 -0.5775032 2.09348", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "frontBSlot": { "type": "lego cross female", "translation": "-0.01 0.015 0.01", - "rotation": "0 0.7068252 0.7073882 3.14153" + "rotation": "0 0.7068252 0.7073882 3.14153", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "frontCSlot": { "type": "lego cross female", "translation": "0.01 0.015 0.01", - "rotation": "-0.5775032 0.57704425 0.5775032 2.09348" + "rotation": "-0.5775032 0.57704425 0.5775032 2.09348", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "frontDSlot": { "type": "lego cross female", "translation": "0.01 0.015 0.03", - "rotation": "1 0 0 -1.57" + "rotation": "1 0 0 -1.57", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "frontSlot": { "type": "tinkerbots", "translation": "0 0.02 0.02", - "rotation": "1 0 0 -1.57" + "rotation": "1 0 0 -1.57", + "rotationSnap": 1.5708 }, "backASlot": { "type": "lego cross female", "translation": "0.01 -0.015 0.03", - "rotation": "0.5773496 -0.5773496 0.5773516 2.0944" + "rotation": "0.5773496 -0.5773496 0.5773516 2.0944", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "backBSlot": { "type": "lego cross female", "translation": "0.01 -0.015 0.01", - "rotation": "1 0 0 1.57" + "rotation": "1 0 0 1.57", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "backCSlot": { "type": "lego cross female", "translation": "-0.01 -0.015 0.01", - "rotation": "0.5773496 0.5773496 -0.5773516 2.0944" + "rotation": "0.5773496 0.5773496 -0.5773516 2.0944", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "backDSlot": { "type": "lego cross female", "translation": "-0.01 -0.015 0.03", - "rotation": "0 0.70710677 -0.70710677 3.14153" + "rotation": "0 0.70710677 -0.70710677 3.14153", + "rotationSnap": 1.5708, + "translationSnap": 0.02 } } }, @@ -267,100 +357,136 @@ "backASlot": { "rotation": "0.5773496 -0.5773496 0.5773516 2.0944", "translation": "0.01 -0.015 0.03", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "backBSlot": { "rotation": "1 0 0 1.57", "translation": "0.01 -0.015 0.01", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "backCSlot": { "rotation": "0.5773496 0.5773496 -0.5773516 2.0944", "translation": "-0.01 -0.015 0.01", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "backDSlot": { "rotation": "0 0.70710677 -0.70710677 3.14153", "translation": "-0.01 -0.015 0.03", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "backSlot": { "rotation": "1 0 0 1.57", "translation": "0 -0.02 0.02", - "type": "tinkerbots" + "type": "tinkerbots", + "rotationSnap": 1.5708 }, "leftASlot": { "rotation": "0.7071053 3.2758115e-05 0.70710826 3.14153", "translation": "0.015 0.01 0.03", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "leftBSlot": { "rotation": "0.5773496 0.5773496 0.5773516 2.0944", "translation": "0.015 0.01 0.01", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "leftCSlot": { "rotation": "0 1 0 1.57", "translation": "0.015 -0.01 0.01", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "leftDSlot": { "rotation": "-0.5773496 0.5773496 -0.5773516 2.0944", "translation": "0.015 -0.01 0.03", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "leftSlot": { "rotation": "0 1 0 1.57", "translation": "0.02 0 0.02", - "type": "tinkerbots" + "type": "tinkerbots", + "rotationSnap": 1.5708 }, "rightASlot": { "rotation": "0 1 0 -1.57", "translation": "-0.015 -0.01 0.03", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "rightBSlot": { "rotation": "0.5773496 -0.5773496 -0.5773516 2.0944", "translation": "-0.015 -0.01 0.01", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "rightCSlot": { "rotation": "0.7071053 0 -0.70710826 3.14153", "translation": "-0.015 0.01 0.01", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "rightDSlot": { "rotation": "-0.5773496 -0.5773496 0.5773516 2.0944", "translation": "-0.015 0.01 0.03", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "rightSlot": { "rotation": "0 1 0 -1.57", "translation": "-0.02 0 0.02", - "type": "tinkerbots" + "type": "tinkerbots", + "rotationSnap": 1.5708 }, "upASlot": { "rotation": "0 0 1 -1.5708", "translation": "-0.01 -0.01 0.035", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "upBSlot": { "rotation": "0 0 1 3.1415", "translation": "-0.01 0.01 0.035", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "upCSlot": { "rotation": "0 0 1 1.5708", "translation": "0.01 0.01 0.035", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "upDSlot": { "translation": "0.01 -0.01 0.035", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "upSlot": { "translation": "0 0 0.04", - "type": "tinkerbots" + "type": "tinkerbots", + "rotationSnap": 1.5708 } } }, @@ -372,25 +498,34 @@ "ASlot": { "rotation": "0 0 1 -1.5708", "translation": "-0.01 -0.01 0.035", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "BSlot": { "rotation": "0 0 1 3.1415", "translation": "-0.01 0.01 0.035", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "CSlot": { "rotation": "0 0 1 1.5708", "translation": "0.01 0.01 0.035", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "DSlot": { "translation": "0.01 -0.01 0.035", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "slot": { "translation": "0 0 0.04", - "type": "tinkerbots" + "type": "tinkerbots", + "rotationSnap": 1.5708 } } }, @@ -402,25 +537,34 @@ "ASlot": { "rotation": "0 0 1 -1.5708", "translation": "-0.01 -0.01 0.035", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "BSlot": { "rotation": "0 0 1 3.1415", "translation": "-0.01 0.01 0.035", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "CSlot": { "rotation": "0 0 1 1.5708", "translation": "0.01 0.01 0.035", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "DSlot": { "translation": "0.01 -0.01 0.035", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "slot": { "translation": "0 0 0.04", - "type": "tinkerbots" + "type": "tinkerbots", + "rotationSnap": 1.5708 } } }, @@ -432,85 +576,116 @@ "backSlot": { "rotation": "1 0 0 1.57", "translation": "0 -0.015 0.02", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "frontSlot": { "rotation": "1 0 0 -1.57", "translation": "0 0.015 0.02", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "leftASlot": { "rotation": "0.7071053 3.2758115e-05 0.70710826 3.14153", "translation": "0.015 0.01 0.03", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "leftBSlot": { "rotation": "0.5773496 0.5773496 0.5773516 2.0944", "translation": "0.015 0.01 0.01", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "leftCSlot": { "rotation": "0 1 0 1.57", "translation": "0.015 -0.01 0.01", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "leftDSlot": { "rotation": "-0.5773496 0.5773496 -0.5773516 2.0944", "translation": "0.015 -0.01 0.03", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "leftSlot": { "rotation": "0 1 0 1.57", "translation": "0.02 0 0.02", - "type": "tinkerbots" + "type": "tinkerbots", + "rotationSnap": 1.5708 }, "rightASlot": { "rotation": "0 1 0 -1.57", "translation": "-0.015 -0.01 0.03", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "rightBSlot": { "rotation": "0.5773496 -0.5773496 -0.5773516 2.0944", "translation": "-0.015 -0.01 0.01", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "rightCSlot": { "rotation": "0.7071053 0 -0.70710826 3.14153", "translation": "-0.015 0.01 0.01", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "rightDSlot": { "rotation": "-0.5773496 -0.5773496 0.5773516 2.0944", "translation": "-0.015 0.01 0.03", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "rightSlot": { "rotation": "0 1 0 -1.57", "translation": "-0.02 0 0.02", - "type": "tinkerbots" + "type": "tinkerbots", + "rotationSnap": 1.5708 }, "upASlot": { "rotation": "0 0 1 -1.5708", "translation": "-0.01 -0.01 0.035", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "upBSlot": { "rotation": "0 0 1 3.1415", "translation": "-0.01 0.01 0.035", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "upCSlot": { "rotation": "0 0 1 1.5708", "translation": "0.01 0.01 0.035", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "upDSlot": { "translation": "0.01 -0.01 0.035", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "upSlot": { "translation": "0 0 0.04", - "type": "tinkerbots" + "type": "tinkerbots", + "rotationSnap": 1.5708 } } }, @@ -522,17 +697,23 @@ "fingerASlot": { "rotation": "1 0 0 -0.0655", "translation": "0 0.0156 0.0354", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "fingerBSlot": { "rotation": "-0.025175689 -0.04360558 0.99873155 2.09549", "translation": "-0.01351 -0.0078 0.0354", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "fingerCSlot": { "rotation": "0.025175689 -0.04360558 0.99873155 4.1877", "translation": "0.01351 -0.0078 0.0354", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 } } }, @@ -544,100 +725,136 @@ "backASlot": { "rotation": "0.5773496 -0.5773496 0.5773516 2.0944", "translation": "0.01 -0.015 0.03", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "backBSlot": { "rotation": "1 0 0 1.57", "translation": "0.01 -0.015 0.01", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "backCSlot": { "rotation": "0.5773496 0.5773496 -0.5773516 2.0944", "translation": "-0.01 -0.015 0.01", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "backDSlot": { "rotation": "0 0.70710677 -0.70710677 3.14153", "translation": "-0.01 -0.015 0.03", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "backSlot": { "rotation": "1 0 0 1.57", "translation": "0 -0.02 0.02", - "type": "tinkerbots" + "type": "tinkerbots", + "rotationSnap": 1.5708 }, "leftASlot": { "rotation": "0.7071053 3.2758115e-05 0.70710826 3.14153", "translation": "0.015 0.01 0.03", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "leftBSlot": { "rotation": "0.5773496 0.5773496 0.5773516 2.0944", "translation": "0.015 0.01 0.01", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "leftCSlot": { "rotation": "0 1 0 1.57", "translation": "0.015 -0.01 0.01", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "leftDSlot": { "rotation": "-0.5773496 0.5773496 -0.5773516 2.0944", "translation": "0.015 -0.01 0.03", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "leftSlot": { "rotation": "0 1 0 1.57", "translation": "0.02 0 0.02", - "type": "tinkerbots" + "type": "tinkerbots", + "rotationSnap": 1.5708 }, "rightASlot": { "rotation": "0 1 0 -1.57", "translation": "-0.015 -0.01 0.03", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "rightBSlot": { "rotation": "0.5773496 -0.5773496 -0.5773516 2.0944", "translation": "-0.015 -0.01 0.01", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "rightCSlot": { "rotation": "0.7071053 0 -0.70710826 3.14153", "translation": "-0.015 0.01 0.01", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "rightDSlot": { "rotation": "-0.5773496 -0.5773496 0.5773516 2.0944", "translation": "-0.015 0.01 0.03", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "rightSlot": { "rotation": "0 1 0 -1.57", "translation": "-0.02 0 0.02", - "type": "tinkerbots" + "type": "tinkerbots", + "rotationSnap": 1.5708 }, "upASlot": { "rotation": "0 0 1 -1.5708", "translation": "-0.01 -0.01 0.035", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "upBSlot": { "rotation": "0 0 1 3.1415", "translation": "-0.01 0.01 0.035", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "upCSlot": { "rotation": "0 0 1 1.5708", "translation": "0.01 0.01 0.035", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "upDSlot": { "translation": "0.01 -0.01 0.035", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "upSlot": { "translation": "0 0 0.04", - "type": "tinkerbots" + "type": "tinkerbots", + "rotationSnap": 1.5708 } } }, @@ -648,7 +865,9 @@ "slots": { "endSlot": { "translation": "0 0 0.022", - "type": "lego cross male" + "type": "lego cross male", + "rotationSnap": 1.5708, + "translationSnap": 0.02 } } }, @@ -666,26 +885,36 @@ "backSlot": { "rotation": "0 1 0 -1.57", "translation": "-0.025 0 0.015", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "frontSlot": { "rotation": "0 1 0 1.57", "translation": "0.005 0 0.015", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "leftSlot": { "rotation": "1 0 0 -1.57", "translation": "-0.01 0.005 0.015", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.01 }, "rightSlot": { "rotation": "1 0 0 1.57", "translation": "-0.01 -0.005 0.015", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.01 }, "upSlot": { "translation": "-0.01 0 0.02", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.005 } } }, @@ -697,11 +926,16 @@ "axisSlot": { "rotation": "1 0 0 -1.57", "translation": "-0.01 -0.005 0.015", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": -1, + "translationSnap": 0.01, + "enabledTranslationZSnap": true }, "upSlot": { "translation": "-0.01 0 0.02", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.005 } } }, @@ -713,26 +947,36 @@ "backSlot": { "rotation": "0 1 0 -1.57", "translation": "-0.005 0 0.015", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "frontSlot": { "rotation": "0 1 0 1.57", "translation": "0.005 0 0.015", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "leftSlot": { "rotation": "1 0 0 -1.57", "translation": "0 0.005 0.015", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "rightSlot": { "rotation": "1 0 0 1.57", "translation": "0 -0.005 0.015", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "upSlot": { "translation": "0 0 0.02", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.005 } } }, @@ -744,26 +988,36 @@ "backSlot": { "rotation": "0 1 0 -1.57", "translation": "-0.005 0 0.015", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "frontSlot": { "rotation": "0 1 0 1.57", "translation": "0.005 0 0.015", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "leftSlot": { "rotation": "1 0 0 1.57", "translation": "0 -0.005 0.015", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "rightSlot": { "rotation": "1 0 0 -1.57", "translation": "0 0.01 0.015", - "type": "lego cross male" + "type": "lego cross male", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "upSlot": { "translation": "0 0 0.02", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.005 } } }, @@ -775,12 +1029,16 @@ "backSlot": { "rotation": "0 1 0 -1.05", "translation": "-0.0005 0 0.011", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 }, "frontSlot": { "rotation": "0 1 0 1.05", "translation": "0.0005 0 0.011", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 } }, "parameters": { @@ -798,7 +1056,9 @@ "slot": { "rotation": "0 1 0 1.57", "translation": "0.005 0 0.015", - "type": "lego cross female" + "type": "lego cross female", + "rotationSnap": 1.5708, + "translationSnap": 0.02 } }, "parameters": { From 6fdb6c0306e83f0e63109feb580fc5d010bc4420 Mon Sep 17 00:00:00 2001 From: Stefania Pedrazzi Date: Wed, 20 Feb 2019 08:51:08 +0100 Subject: [PATCH 4/7] Fix slots constraints and add possibility to specify which axis handle is visible from the asset.json --- app/view/handle.js | 32 ++- assets/assets.json | 563 +++++++++++++++++++++++++++++++++------------ 2 files changed, 448 insertions(+), 147 deletions(-) diff --git a/app/view/handle.js b/app/view/handle.js index 6d8ba23..47676a9 100644 --- a/app/view/handle.js +++ b/app/view/handle.js @@ -130,14 +130,34 @@ class Handle { // eslint-disable-line no-unused-vars this.control.rotationSnap = slotData.rotationSnap === -1 ? null : slotData.rotationSnap; this.control.translationSnap = slotData.translationSnap === -1 ? null : slotData.translationSnap; if (this.mode === 'rotate') { - this.control.showX = false; - this.control.showY = false; - this.control.showZ = true; + if (this.control.rotationSnap === 0) { + this.control.showX = false; + this.control.showY = false; + this.control.showZ = false; + } else if (slotData.rotationGizmoVisibility === undefined) { + this.control.showX = true; + this.control.showY = true; + this.control.showZ = true; + } else { + this.control.showX = slotData.rotationGizmoVisibility[0]; + this.control.showY = slotData.rotationGizmoVisibility[1]; + this.control.showZ = slotData.rotationGizmoVisibility[2]; + } return; } else if (this.mode === 'translate') { - this.control.showX = slotData.translationSnap !== null; - this.control.showY = this.control.showX; - this.control.showZ = slotData.enabledTranslationZSnap === true; + if (this.control.translationSnap === 0) { + this.control.showX = false; + this.control.showY = false; + this.control.showZ = false; + } else if (slotData.translationHandleVisibility === undefined) { + this.control.showX = true; + this.control.showY = true; + this.control.showZ = true; + } else { + this.control.showX = slotData.translationHandleVisibility[0]; + this.control.showY = slotData.translationHandleVisibility[1]; + this.control.showZ = slotData.translationHandleVisibility[2]; + } return; } } diff --git a/assets/assets.json b/assets/assets.json index f2f43e5..5e22a1b 100644 --- a/assets/assets.json +++ b/assets/assets.json @@ -7,170 +7,220 @@ "upSlot": { "type": "tinkerbots", "translation": "0 0 0.02", - "rotationSnap": 1.5708 + "rotationSnap": 1.5708, + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0 }, "upASlot": { "type": "lego cross female", "translation": "-0.01 -0.01 0.015", "rotation": "0 0 1 -1.5708", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "upBSlot": { "type": "lego cross female", "translation": "-0.01 0.01 0.015", "rotation": "0 0 1 3.1415", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "upCSlot": { "type": "lego cross female", "translation": "0.01 0.01 0.015", "rotation": "0 0 1 1.5708", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "upDSlot": { "type": "lego cross female", "translation": "0.01 -0.01 0.015", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "downSlot": { "type": "tinkerbots", "translation": "0 0 -0.02", "rotation": "0 1 0 -3.1415", - "rotationSnap": 1.5708 + "rotationSnap": 1.5708, + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0 }, "downASlot": { "type": "lego cross female", "translation": "-0.01 0.01 -0.015", "rotation": "0.70710826 0.7071053 0 3.14153", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "downBSlot": { "type": "lego cross female", "translation": "-0.01 -0.01 -0.015", "rotation": "0 1 0 -3.1415", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "downCSlot": { "type": "lego cross female", "translation": "0.01 -0.01 -0.015", "rotation": "-0.70710826 0.7071053 0 3.14153", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "downDSlot": { "type": "lego cross female", "translation": "0.01 0.01 -0.015", "rotation": "-1 0 0 3.14159", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "leftSlot": { "type": "tinkerbots", "translation": "0.02 0 0", "rotation": "0 1 0 1.57", - "rotationSnap": 1.5708 + "rotationSnap": 1.5708, + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0 }, "leftASlot": { "type": "lego cross female", "translation": "0.015 0.01 0.01", "rotation": "0.7071053 3.2758115e-5 0.70710826 3.14153", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "leftBSlot": { "type": "lego cross female", "translation": "0.015 0.01 -0.01", "rotation": "0.5773496 0.5773496 0.5773516 2.0944", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "leftCSlot": { "type": "lego cross female", "translation": "0.015 -0.01 -0.01", "rotation": "0 1 0 1.57", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "leftDSlot": { "type": "lego cross female", "translation": "0.015 -0.01 0.01", "rotation": "-0.5773496 0.5773496 -0.5773516 2.0944", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "rightSlot": { "type": "tinkerbots", "translation": "-0.02 0 0", "rotation": "0 1 0 -1.57", - "rotationSnap": 1.5708 + "rotationSnap": 1.5708, + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0 }, "rightASlot": { "type": "lego cross female", "translation": "-0.015 -0.01 0.01", "rotation": "0 1 0 -1.57", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "rightBSlot": { "type": "lego cross female", "translation": "-0.015 -0.01 -0.01", "rotation": "0.5773496 -0.5773496 -0.5773516 2.0944", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "rightCSlot": { "type": "lego cross female", "translation": "-0.015 0.01 -0.01", "rotation": "0.7071053 0 -0.70710826 3.14153", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "rightDSlot": { "type": "lego cross female", "translation": "-0.015 0.01 0.01", "rotation": "-0.5773496 -0.5773496 0.5773516 2.0944", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "backSlot": { "type": "tinkerbots", "translation": "0 -0.02 0", "rotation": "1 0 0 1.57", - "rotationSnap": 1.5708 + "rotationSnap": 1.5708, + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0 }, "backASlot": { "type": "lego cross female", "translation": "0.01 -0.015 0.01", "rotation": "0.5773496 -0.5773496 0.5773516 2.0944", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "backBSlot": { "type": "lego cross female", "translation": "0.01 -0.015 -0.01", "rotation": "1 0 0 1.57", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "backCSlot": { "type": "lego cross female", "translation": "-0.01 -0.015 -0.01", "rotation": "0.5773496 0.5773496 -0.5773516 2.0944", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "backDSlot": { "type": "lego cross female", "translation": "-0.01 -0.015 0.01", "rotation": "0 0.70710677 -0.70710677 3.14153", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] } } }, @@ -182,170 +232,220 @@ "upSlot": { "type": "tinkerbots", "translation": "0 0 0.04", - "rotationSnap": 1.5708 + "rotationSnap": 1.5708, + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0 }, "upASlot": { "type": "lego cross female", "translation": "-0.01 -0.01 0.035", "rotation": "0 0 1 -1.5708", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "upBSlot": { "type": "lego cross female", "translation": "-0.01 0.01 0.035", "rotation": "0 0 1 3.1415", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "upCSlot": { "type": "lego cross female", "translation": "0.01 0.01 0.035", "rotation": "0 0 1 1.5708", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "upDSlot": { "type": "lego cross female", "translation": "0.01 -0.01 0.035", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "leftSlot": { "type": "tinkerbots", "translation": "0.02 0 0.02", "rotation": "0 1 0 1.57", - "rotationSnap": 1.5708 + "rotationSnap": 1.5708, + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0 }, "leftASlot": { "type": "lego cross female", "translation": "0.015 0.01 0.03", "rotation": "0.7071053 3.2758115e-5 0.70710826 3.14153", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "leftBSlot": { "type": "lego cross female", "translation": "0.015 0.01 0.01", "rotation": "0.5773496 0.5773496 0.5773516 2.0944", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "leftCSlot": { "type": "lego cross female", "translation": "0.015 -0.01 0.01", "rotation": "0 1 0 1.57", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "leftDSlot": { "type": "lego cross female", "translation": "0.015 -0.01 0.03", "rotation": "-0.5773496 0.5773496 -0.5773516 2.0944", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "rightSlot": { "type": "tinkerbots", "translation": "-0.02 0 0.02", "rotation": "0 1 0 -1.57", - "rotationSnap": 1.5708 + "rotationSnap": 1.5708, + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0 }, "rightASlot": { "type": "lego cross female", "translation": "-0.015 -0.01 0.03", "rotation": "0 1 0 -1.57", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "rightBSlot": { "type": "lego cross female", "translation": "-0.015 -0.01 0.01", "rotation": "0.5773496 -0.5773496 -0.5773516 2.0944", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "rightCSlot": { "type": "lego cross female", "translation": "-0.015 0.01 0.01", "rotation": "0.7071053 0 -0.70710826 3.14153", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "rightDSlot": { "type": "lego cross female", "translation": "-0.015 0.01 0.03", "rotation": "-0.5773496 -0.5773496 0.5773516 2.0944", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "backSlot": { "type": "tinkerbots", "translation": "0 -0.02 0.02", "rotation": "1 0 0 1.57", - "rotationSnap": 1.5708 + "rotationSnap": 1.5708, + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0 }, "frontASlot": { "type": "lego cross female", "translation": "-0.01 0.015 0.03", "rotation": "-0.5775032 -0.57704425 -0.5775032 2.09348", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "frontBSlot": { "type": "lego cross female", "translation": "-0.01 0.015 0.01", "rotation": "0 0.7068252 0.7073882 3.14153", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "frontCSlot": { "type": "lego cross female", "translation": "0.01 0.015 0.01", "rotation": "-0.5775032 0.57704425 0.5775032 2.09348", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "frontDSlot": { "type": "lego cross female", "translation": "0.01 0.015 0.03", "rotation": "1 0 0 -1.57", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "frontSlot": { "type": "tinkerbots", "translation": "0 0.02 0.02", "rotation": "1 0 0 -1.57", - "rotationSnap": 1.5708 + "rotationSnap": 1.5708, + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0 }, "backASlot": { "type": "lego cross female", "translation": "0.01 -0.015 0.03", "rotation": "0.5773496 -0.5773496 0.5773516 2.0944", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "backBSlot": { "type": "lego cross female", "translation": "0.01 -0.015 0.01", "rotation": "1 0 0 1.57", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "backCSlot": { "type": "lego cross female", "translation": "-0.01 -0.015 0.01", "rotation": "0.5773496 0.5773496 -0.5773516 2.0944", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "backDSlot": { "type": "lego cross female", "translation": "-0.01 -0.015 0.03", "rotation": "0 0.70710677 -0.70710677 3.14153", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] } } }, @@ -359,134 +459,174 @@ "translation": "0.01 -0.015 0.03", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "backBSlot": { "rotation": "1 0 0 1.57", "translation": "0.01 -0.015 0.01", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "backCSlot": { "rotation": "0.5773496 0.5773496 -0.5773516 2.0944", "translation": "-0.01 -0.015 0.01", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "backDSlot": { "rotation": "0 0.70710677 -0.70710677 3.14153", "translation": "-0.01 -0.015 0.03", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "backSlot": { "rotation": "1 0 0 1.57", "translation": "0 -0.02 0.02", "type": "tinkerbots", - "rotationSnap": 1.5708 + "rotationSnap": 1.5708, + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0 }, "leftASlot": { "rotation": "0.7071053 3.2758115e-05 0.70710826 3.14153", "translation": "0.015 0.01 0.03", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "leftBSlot": { "rotation": "0.5773496 0.5773496 0.5773516 2.0944", "translation": "0.015 0.01 0.01", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "leftCSlot": { "rotation": "0 1 0 1.57", "translation": "0.015 -0.01 0.01", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "leftDSlot": { "rotation": "-0.5773496 0.5773496 -0.5773516 2.0944", "translation": "0.015 -0.01 0.03", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "leftSlot": { "rotation": "0 1 0 1.57", "translation": "0.02 0 0.02", "type": "tinkerbots", - "rotationSnap": 1.5708 + "rotationSnap": 1.5708, + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0 }, "rightASlot": { "rotation": "0 1 0 -1.57", "translation": "-0.015 -0.01 0.03", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "rightBSlot": { "rotation": "0.5773496 -0.5773496 -0.5773516 2.0944", "translation": "-0.015 -0.01 0.01", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "rightCSlot": { "rotation": "0.7071053 0 -0.70710826 3.14153", "translation": "-0.015 0.01 0.01", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "rightDSlot": { "rotation": "-0.5773496 -0.5773496 0.5773516 2.0944", "translation": "-0.015 0.01 0.03", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "rightSlot": { "rotation": "0 1 0 -1.57", "translation": "-0.02 0 0.02", "type": "tinkerbots", - "rotationSnap": 1.5708 + "rotationSnap": 1.5708, + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0 }, "upASlot": { "rotation": "0 0 1 -1.5708", "translation": "-0.01 -0.01 0.035", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "upBSlot": { "rotation": "0 0 1 3.1415", "translation": "-0.01 0.01 0.035", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "upCSlot": { "rotation": "0 0 1 1.5708", "translation": "0.01 0.01 0.035", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "upDSlot": { "translation": "0.01 -0.01 0.035", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "upSlot": { "translation": "0 0 0.04", "type": "tinkerbots", - "rotationSnap": 1.5708 + "rotationSnap": 1.5708, + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0 } } }, @@ -500,32 +640,42 @@ "translation": "-0.01 -0.01 0.035", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "BSlot": { "rotation": "0 0 1 3.1415", "translation": "-0.01 0.01 0.035", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "CSlot": { "rotation": "0 0 1 1.5708", "translation": "0.01 0.01 0.035", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "DSlot": { "translation": "0.01 -0.01 0.035", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "slot": { "translation": "0 0 0.04", "type": "tinkerbots", - "rotationSnap": 1.5708 + "rotationSnap": 1.5708, + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0 } } }, @@ -539,32 +689,42 @@ "translation": "-0.01 -0.01 0.035", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "BSlot": { "rotation": "0 0 1 3.1415", "translation": "-0.01 0.01 0.035", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "CSlot": { "rotation": "0 0 1 1.5708", "translation": "0.01 0.01 0.035", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "DSlot": { "translation": "0.01 -0.01 0.035", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "slot": { "translation": "0 0 0.04", "type": "tinkerbots", - "rotationSnap": 1.5708 + "rotationSnap": 1.5708, + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0 } } }, @@ -578,114 +738,148 @@ "translation": "0 -0.015 0.02", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "frontSlot": { "rotation": "1 0 0 -1.57", "translation": "0 0.015 0.02", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "leftASlot": { "rotation": "0.7071053 3.2758115e-05 0.70710826 3.14153", "translation": "0.015 0.01 0.03", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "leftBSlot": { "rotation": "0.5773496 0.5773496 0.5773516 2.0944", "translation": "0.015 0.01 0.01", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "leftCSlot": { "rotation": "0 1 0 1.57", "translation": "0.015 -0.01 0.01", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "leftDSlot": { "rotation": "-0.5773496 0.5773496 -0.5773516 2.0944", "translation": "0.015 -0.01 0.03", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "leftSlot": { "rotation": "0 1 0 1.57", "translation": "0.02 0 0.02", "type": "tinkerbots", - "rotationSnap": 1.5708 + "rotationSnap": 1.5708, + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0 }, "rightASlot": { "rotation": "0 1 0 -1.57", "translation": "-0.015 -0.01 0.03", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "rightBSlot": { "rotation": "0.5773496 -0.5773496 -0.5773516 2.0944", "translation": "-0.015 -0.01 0.01", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "rightCSlot": { "rotation": "0.7071053 0 -0.70710826 3.14153", "translation": "-0.015 0.01 0.01", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "rightDSlot": { "rotation": "-0.5773496 -0.5773496 0.5773516 2.0944", "translation": "-0.015 0.01 0.03", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "rightSlot": { "rotation": "0 1 0 -1.57", "translation": "-0.02 0 0.02", "type": "tinkerbots", - "rotationSnap": 1.5708 + "rotationSnap": 1.5708, + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0 }, "upASlot": { "rotation": "0 0 1 -1.5708", "translation": "-0.01 -0.01 0.035", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "upBSlot": { "rotation": "0 0 1 3.1415", "translation": "-0.01 0.01 0.035", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "upCSlot": { "rotation": "0 0 1 1.5708", "translation": "0.01 0.01 0.035", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "upDSlot": { "translation": "0.01 -0.01 0.035", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "upSlot": { "translation": "0 0 0.04", "type": "tinkerbots", - "rotationSnap": 1.5708 + "rotationSnap": 1.5708, + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0 } } }, @@ -699,21 +893,27 @@ "translation": "0 0.0156 0.0354", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "fingerBSlot": { "rotation": "-0.025175689 -0.04360558 0.99873155 2.09549", "translation": "-0.01351 -0.0078 0.0354", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "fingerCSlot": { "rotation": "0.025175689 -0.04360558 0.99873155 4.1877", "translation": "0.01351 -0.0078 0.0354", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] } } }, @@ -727,134 +927,174 @@ "translation": "0.01 -0.015 0.03", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "backBSlot": { "rotation": "1 0 0 1.57", "translation": "0.01 -0.015 0.01", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "backCSlot": { "rotation": "0.5773496 0.5773496 -0.5773516 2.0944", "translation": "-0.01 -0.015 0.01", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "backDSlot": { "rotation": "0 0.70710677 -0.70710677 3.14153", "translation": "-0.01 -0.015 0.03", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "backSlot": { "rotation": "1 0 0 1.57", "translation": "0 -0.02 0.02", "type": "tinkerbots", - "rotationSnap": 1.5708 + "rotationSnap": 1.5708, + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0 }, "leftASlot": { "rotation": "0.7071053 3.2758115e-05 0.70710826 3.14153", "translation": "0.015 0.01 0.03", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "leftBSlot": { "rotation": "0.5773496 0.5773496 0.5773516 2.0944", "translation": "0.015 0.01 0.01", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "leftCSlot": { "rotation": "0 1 0 1.57", "translation": "0.015 -0.01 0.01", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "leftDSlot": { "rotation": "-0.5773496 0.5773496 -0.5773516 2.0944", "translation": "0.015 -0.01 0.03", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "leftSlot": { "rotation": "0 1 0 1.57", "translation": "0.02 0 0.02", "type": "tinkerbots", - "rotationSnap": 1.5708 + "rotationSnap": 1.5708, + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0 }, "rightASlot": { "rotation": "0 1 0 -1.57", "translation": "-0.015 -0.01 0.03", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "rightBSlot": { "rotation": "0.5773496 -0.5773496 -0.5773516 2.0944", "translation": "-0.015 -0.01 0.01", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "rightCSlot": { "rotation": "0.7071053 0 -0.70710826 3.14153", "translation": "-0.015 0.01 0.01", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "rightDSlot": { "rotation": "-0.5773496 -0.5773496 0.5773516 2.0944", "translation": "-0.015 0.01 0.03", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "rightSlot": { "rotation": "0 1 0 -1.57", "translation": "-0.02 0 0.02", "type": "tinkerbots", - "rotationSnap": 1.5708 + "rotationSnap": 1.5708, + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0 }, "upASlot": { "rotation": "0 0 1 -1.5708", "translation": "-0.01 -0.01 0.035", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "upBSlot": { "rotation": "0 0 1 3.1415", "translation": "-0.01 0.01 0.035", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "upCSlot": { "rotation": "0 0 1 1.5708", "translation": "0.01 0.01 0.035", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "upDSlot": { "translation": "0.01 -0.01 0.035", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "upSlot": { "translation": "0 0 0.04", "type": "tinkerbots", - "rotationSnap": 1.5708 + "rotationSnap": 1.5708, + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0 } } }, @@ -867,7 +1107,9 @@ "translation": "0 0 0.022", "type": "lego cross male", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.005, + "translationHandleVisibility": [false, false, true] } } }, @@ -887,34 +1129,44 @@ "translation": "-0.025 0 0.015", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "frontSlot": { "rotation": "0 1 0 1.57", "translation": "0.005 0 0.015", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "leftSlot": { "rotation": "1 0 0 -1.57", "translation": "-0.01 0.005 0.015", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.01 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.01, + "translationHandleVisibility": [true, true, false] }, "rightSlot": { "rotation": "1 0 0 1.57", "translation": "-0.01 -0.005 0.015", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.01 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.01, + "translationHandleVisibility": [true, true, false] }, "upSlot": { "translation": "-0.01 0 0.02", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.005 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.005, + "translationHandleVisibility": [true, true, false] } } }, @@ -928,14 +1180,17 @@ "translation": "-0.01 -0.005 0.015", "type": "lego cross female", "rotationSnap": -1, + "rotationGizmoVisibility": [false, false, true], "translationSnap": 0.01, - "enabledTranslationZSnap": true + "translationHandleVisibility": [true, true, true] }, "upSlot": { "translation": "-0.01 0 0.02", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.005 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.005, + "translationHandleVisibility": [true, true, false] } } }, @@ -949,34 +1204,44 @@ "translation": "-0.005 0 0.015", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "frontSlot": { "rotation": "0 1 0 1.57", "translation": "0.005 0 0.015", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "leftSlot": { "rotation": "1 0 0 -1.57", "translation": "0 0.005 0.015", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "rightSlot": { "rotation": "1 0 0 1.57", "translation": "0 -0.005 0.015", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "upSlot": { "translation": "0 0 0.02", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.005 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.005, + "translationHandleVisibility": [true, true, false] } } }, @@ -990,34 +1255,44 @@ "translation": "-0.005 0 0.015", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "frontSlot": { "rotation": "0 1 0 1.57", "translation": "0.005 0 0.015", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "leftSlot": { "rotation": "1 0 0 1.57", "translation": "0 -0.005 0.015", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "rightSlot": { "rotation": "1 0 0 -1.57", "translation": "0 0.01 0.015", "type": "lego cross male", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "upSlot": { "translation": "0 0 0.02", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.005 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.005, + "translationHandleVisibility": [true, true, false] } } }, @@ -1031,14 +1306,18 @@ "translation": "-0.0005 0 0.011", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] }, "frontSlot": { "rotation": "0 1 0 1.05", "translation": "0.0005 0 0.011", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] } }, "parameters": { @@ -1058,7 +1337,9 @@ "translation": "0.005 0 0.015", "type": "lego cross female", "rotationSnap": 1.5708, - "translationSnap": 0.02 + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0.02, + "translationHandleVisibility": [true, true, false] } }, "parameters": { From 68146180103748e1eb5b7449f0d7677ec8df8b67 Mon Sep 17 00:00:00 2001 From: Stefania Pedrazzi Date: Wed, 20 Feb 2019 09:27:42 +0100 Subject: [PATCH 5/7] Add reference file describing the assets.json format --- assets/assets.md | 60 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 assets/assets.md diff --git a/assets/assets.md b/assets/assets.md new file mode 100644 index 0000000..32cb123 --- /dev/null +++ b/assets/assets.md @@ -0,0 +1,60 @@ +## Assets Definition + +The assets defining the robot parts have to be listed one after the other in the `assets.json` file. +This section describes the supported properties. + +Here is a simple example of valid `asset.json`: +``` +{ + "tinkerbots/base": { + "proto": "TinkerbotsBase", + "icon": "/robot-designer/assets/models/tinkerbots/base/icon.png", + "root": true, + "slots": { + "upSlot": { + "type": "tinkerbots", + "translation": "0 0 0.02", + "rotationSnap": 1.5708, + "rotationGizmoVisibility": [false, false, true], + "translationSnap": 0 + } + } + } +} +``` + +### Part Properties + +The part is identified by a name that should represent the path in which the part model stored in a X3D file named `model.x3d` is located. +These properties are mandatory and need to be specified for each part: + +- `proto`: string that specifies the name of model used for the export. This should for example match the Webots PROTO name. + +- `icon`: string that specifies the path to the model icon to be shown in the part browser. + +- `slots`: list of slots specifying where other parts can be connected. The slot properties are defined in the next section. + +Other optional properties: + +* `root`: boolean that specifies if the part is the main robot core. Default value is *false*. + +* `slotType`: string that specifies the slot type of the current part. + +### Slot Properties + +In order to have a user-friendly slot snap system, slots have different properties. +It is important that the slot identifier matched the Webots PROTO model slot name in order to have a fully working export mechanism. + +- `type`: string that specifies the slot type of the current part. Only parts having a matching `slotType` can be connected. + +- `translation`: 3D vector string that specifies the slot position: for example *"0 0 0.02"*. + +- `rotation`: 3D vector string that specifies the slot orientation using Euler axis-angle format: for example *"0 0 1 1.5708"*. + +- `translationSnap`: size of translation step used when moving the connected part using the translation handles: for example *0.01*. Default value is *-1* that corresponds to an infinitesimal step size. Setting `translationSnap` to *0* will disable moving the connected part. + +- `translationHandleVisibility`: boolean array that specifies which of the *x*, *y*, or *z* translation axis are enabled: for example *[false, false, true]* will only enable translation on the *z*-axis. Default value is *[true, true, true]*. + +- `rotationSnap`: size of rotation step used when moving the connected part using the rotation gizmo: for example *1.5708*. Default value is *-1* that corresponds to an infinitesimal step size. Setting `rotationSnap` to *0* will disable rotating the connected part. + +- `rotationGizmoVisibility`: boolean array that specifies which of the *x*, *y*, or *z* rotation axis are enabled: for example *[false, false, true]* will only enable rotation on the *z*-axis. Default value is *[true, true, true]*. From bb57438cd420e7050fc5919a7be6e2e482674f5d Mon Sep 17 00:00:00 2001 From: Stefania Pedrazzi Date: Wed, 20 Feb 2019 11:18:25 +0100 Subject: [PATCH 6/7] Reset the selection when any part is removed to fix invalid handle visualization --- app/commands/commands.js | 25 ++++++++++++++++++------- app/robot_designer.js | 5 ++--- app/view/handle.js | 1 + app/view/robot_viewer.js | 10 +++++++++- 4 files changed, 30 insertions(+), 11 deletions(-) diff --git a/app/commands/commands.js b/app/commands/commands.js index 32c4f4a..d7a83c5 100644 --- a/app/commands/commands.js +++ b/app/commands/commands.js @@ -35,12 +35,15 @@ class Commands extends Observable { // eslint-disable-line no-unused-vars } addPart(parent, slot, part) { + var that = this; this._pushAction( function(redo, data) { if (redo) parent.addPart(slot, part); - else + else { parent.removePart(part); + that.notify('AnyPartRemoved', null); + } }, [] ); @@ -73,25 +76,30 @@ class Commands extends Observable { // eslint-disable-line no-unused-vars } addRootPart(robot, part) { + var that = this; this._pushAction( function(redo, data) { if (redo) robot.addRootPart(part); - else + else { robot.removePart(); + that.notify('AnyPartRemoved', null); + } }, [] ); } removePart(part) { + var that = this; var parent = part.parent; var slotName = parent.slotName(part); this._pushAction( function(redo, data) { - if (redo) + if (redo) { parent.removePart(part); - else + that.notify('AnyPartRemoved', null); + } else parent.addPart(slotName, part); }, [] @@ -99,17 +107,20 @@ class Commands extends Observable { // eslint-disable-line no-unused-vars } removeRootPart(robot, part) { + var that = this; this._pushAction( function(redo, data) { - if (redo) + if (redo) { robot.removePart(); - else + that.notify('AnyPartRemoved', null); + } else robot.addRootPart(part); }, [] ); + this.notify('AnyPartRemoved', null); } - + changeColor(part, color) { var previousColor = part.color; this._pushAction( diff --git a/app/robot_designer.js b/app/robot_designer.js index 5203fe9..f439452 100644 --- a/app/robot_designer.js +++ b/app/robot_designer.js @@ -42,7 +42,7 @@ class RobotDesigner { this.robotMediator = new RobotMediator(this.robot); this.robotController = new RobotController(this.assetLibrary, this.commands, this.robot); - this.robotViewer = new RobotViewer(this.robotViewerElement, this.robotController); + this.robotViewer = new RobotViewer(this.robotViewerElement, this.robotController, this.commands); this.robotViewer.scene.add(this.robotMediator.rootObject); this.highlightOutlinePass = this.robotViewer.highlightOutlinePass; @@ -162,8 +162,7 @@ function deleteSelectedPart() { // eslint-disable-line no-unused-vars } while (parent); } - designer.robotViewer.selector.clearSelection(); - designer.robotViewer.handle.detach(); + designer.robotViewer.clearSelection(); } function mouseMove(ev) { // eslint-disable-line no-unused-vars diff --git a/app/view/handle.js b/app/view/handle.js index 47676a9..78cf768 100644 --- a/app/view/handle.js +++ b/app/view/handle.js @@ -78,6 +78,7 @@ class Handle { // eslint-disable-line no-unused-vars this.target.parent.remove(this.target); this.target = null; } + this.part = null; } showHandle() { diff --git a/app/view/robot_viewer.js b/app/view/robot_viewer.js index 418ba59..3c74b5d 100644 --- a/app/view/robot_viewer.js +++ b/app/view/robot_viewer.js @@ -9,7 +9,7 @@ // 6. mouse interactions class RobotViewer { // eslint-disable-line no-unused-vars - constructor(robotViewerElement, robotController) { + constructor(robotViewerElement, robotController, commands) { this.robotViewerElement = robotViewerElement; this.robotController = robotController; @@ -64,6 +64,9 @@ class RobotViewer { // eslint-disable-line no-unused-vars this.selector = new Selector(this.selectionOutlinePass); this.handle = new Handle(this.robotController, this.robotViewerElement, this.camera, this.scene, this.controls); + // reset selection and handles when any part is removed + commands.addObserver('AnyPartRemoved', () => this.clearSelection()); + this.gpuPicker = new THREE.GPUPicker({renderer: this.renderer, debug: false}); this.gpuPicker.setFilter(function(object) { return object instanceof THREE.Mesh && 'x3dType' in object.userData; @@ -171,4 +174,9 @@ class RobotViewer { // eslint-disable-line no-unused-vars } this.handle.showHandle(); } + + clearSelection() { + this.selector.clearSelection(); + this.handle.detach(); + } } From b1335e8c00670a59acf8cc33a2e8b32507d15365 Mon Sep 17 00:00:00 2001 From: Stefania Pedrazzi Date: Thu, 21 Feb 2019 09:09:13 +0100 Subject: [PATCH 7/7] Rename assets.md to README.md --- assets/{assets.md => README.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename assets/{assets.md => README.md} (100%) diff --git a/assets/assets.md b/assets/README.md similarity index 100% rename from assets/assets.md rename to assets/README.md