Merge pull request #14245 from huffman/feat/default-grabbable-setting

Add a 'grabbable' option to the new-model dialog
This commit is contained in:
John Conklin II 2018-10-22 11:42:40 -07:00 committed by GitHub
commit b3698388ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 13 deletions

View file

@ -116,9 +116,14 @@ Rectangle {
Column {
id: column2
width: 200
height: 400
height: 600
spacing: 10
CheckBox {
id: grabbable
text: qsTr("Grabbable")
}
CheckBox {
id: dynamic
text: qsTr("Dynamic")
@ -217,9 +222,10 @@ Rectangle {
newModelDialog.sendToScript({
method: "newModelDialogAdd",
params: {
textInput: modelURL.text,
checkBox: dynamic.checked,
comboBox: collisionType.currentIndex
url: modelURL.text,
dynamic: dynamic.checked,
collisionShapeIndex: collisionType.currentIndex,
grabbable: grabbable.checked
}
});
}

View file

@ -348,12 +348,12 @@ var toolBar = (function () {
if (!properties.grab) {
properties.grab = {};
}
if (Menu.isOptionChecked(MENU_CREATE_ENTITIES_GRABBABLE) &&
!(properties.type === "Zone" || properties.type === "Light" || properties.type === "ParticleEffect")) {
properties.grab.grabbable = true;
} else {
properties.grab.grabbable = false;
if (Menu.isOptionChecked(MENU_CREATE_ENTITIES_GRABBABLE) &&
!(properties.type === "Zone" || properties.type === "Light" || properties.type === "ParticleEffect")) {
properties.grab.grabbable = true;
} else {
properties.grab.grabbable = false;
}
}
SelectionManager.saveProperties();
@ -442,9 +442,9 @@ var toolBar = (function () {
function handleNewModelDialogResult(result) {
if (result) {
var url = result.textInput;
var url = result.url;
var shapeType;
switch (result.comboBox) {
switch (result.collisionShapeIndex) {
case SHAPE_TYPE_SIMPLE_HULL:
shapeType = "simple-hull";
break;
@ -464,7 +464,7 @@ var toolBar = (function () {
shapeType = "none";
}
var dynamic = result.checkBox !== null ? result.checkBox : DYNAMIC_DEFAULT;
var dynamic = result.dynamic !== null ? result.dynamic : DYNAMIC_DEFAULT;
if (shapeType === "static-mesh" && dynamic) {
// The prompt should prevent this case
print("Error: model cannot be both static mesh and dynamic. This should never happen.");
@ -473,6 +473,9 @@ var toolBar = (function () {
type: "Model",
modelURL: url,
shapeType: shapeType,
grab: {
grabbable: result.grabbable
},
dynamic: dynamic,
gravity: dynamic ? { x: 0, y: -10, z: 0 } : { x: 0, y: 0, z: 0 }
});