good progress- can create particle entity from menu

This commit is contained in:
ericrius1 2016-01-28 15:57:35 -08:00
parent 0511ff70ac
commit 804f82f2f1
5 changed files with 130 additions and 25 deletions

View file

@ -27,6 +27,7 @@ Script.include([
"libraries/entityCameraTool.js",
"libraries/gridTool.js",
"libraries/entityList.js",
"particle_explorer/particleExplorerTool.js",
"libraries/lightOverlayManager.js",
]);
@ -141,9 +142,9 @@ var importingSVOTextOverlay = Overlays.addOverlay("text", {
var MARKETPLACE_URL = "https://metaverse.highfidelity.com/marketplace";
var marketplaceWindow = new OverlayWebWindow({
title: 'Marketplace',
source: "about:blank",
width: 900,
title: 'Marketplace',
source: "about:blank",
width: 900,
height: 700,
visible: false
});
@ -194,7 +195,7 @@ var toolBar = (function() {
};
});
activeButton = toolBar.addTool({
imageURL: toolIconUrl + "edit-status.svg",
@ -450,8 +451,8 @@ var toolBar = (function() {
newModelButtonDown = true;
return true;
}
if (newCubeButton === toolBar.clicked(clickedOverlay)) {
createNewEntity({
type: "Box",
@ -640,8 +641,13 @@ var toolBar = (function() {
}
if (newParticleButton === toolBar.clicked(clickedOverlay)) {
print("EBL: NEW PARTICLES");
Script.load('particle_explorer/particleExplorer.js');
createNewEntity({
type: "ParticleEffect",
isEmitting: true,
particleRadius: 0.1,
emitRate: 100,
textures: "https://hifi-public.s3.amazonaws.com/alan/Particles/Particle-Sprite-Smoke-1.png",
});
}
return false;
@ -664,7 +670,7 @@ var toolBar = (function() {
}
newModelButtonDown = false;
return handled;
}
@ -1524,8 +1530,8 @@ PropertiesTool = function(opts) {
var url = Script.resolvePath('html/entityProperties.html');
var webView = new OverlayWebWindow({
title: 'Entity Properties',
source: url,
title: 'Entity Properties',
source: url,
toolWindow: true
});
@ -1579,8 +1585,16 @@ PropertiesTool = function(opts) {
} else {
if (data.properties.dynamic === false) {
// this object is leaving dynamic, so we zero its velocities
data.properties["velocity"] = {x: 0, y: 0, z: 0};
data.properties["angularVelocity"] = {x: 0, y: 0, z: 0};
data.properties["velocity"] = {
x: 0,
y: 0,
z: 0
};
data.properties["angularVelocity"] = {
x: 0,
y: 0,
z: 0
};
}
if (data.properties.rotation !== undefined) {
var rotation = data.properties.rotation;
@ -1863,3 +1877,4 @@ propertyMenu.onSelectMenuItem = function(name) {
var showMenuItem = propertyMenu.addMenuItem("Show in Marketplace");
propertiesTool = PropertiesTool();
var particleExplorerTool = ParticleExplorerTool();

View file

@ -71,13 +71,31 @@ EntityListTool = function(opts) {
webView.eventBridge.emitScriptEvent(JSON.stringify(data));
}
that.enableParticleTab = function(entityID) {
var data = {
type: "enableParticleTab",
entity: entityID
};
webView.eventBridge.emitScriptEvent(JSON.stringify(data));
}
webView.eventBridge.webEventReceived.connect(function(data) {
data = JSON.parse(data);
if (data.type == "selectionUpdate") {
print("EBL CLICKED ON SOME SHIT " + JSON.stringify(data))
var ids = data.entityIds;
var entityIDs = [];
for (var i = 0; i < ids.length; i++) {
entityIDs.push(ids[i]);
}
if (entityIDs.length === 1) {
//We selected just one entity, so see if that entity is a particle entity
var type = Entities.getEntityProperties(entityIDs[0], "type").type;
if (type === "ParticleEffect") {
that.enableParticleTab(entityIDs[0]);
}
}
selectionManager.setSelections(entityIDs);
if (data.focus) {

View file

@ -82,7 +82,6 @@ window.onload = function() {
listenForSettingsUpdates();
window.onresize = setGUIWidthToWindowWidth;
console.log('JBP HAS EVENT BRIDGE');
})
};
@ -128,9 +127,6 @@ function loadGUI() {
individualKeys.push(key);
}
}
});
//alphabetize our keys
@ -345,14 +341,6 @@ function writeVec3ToInterface(obj) {
function listenForSettingsUpdates() {
EventBridge.scriptEventReceived.connect(function(data) {
data = JSON.parse(data);
//2-way
// if (data.messageType === 'object_update') {
// _.each(data.objectSettings, function(value, key) {
// settings[key] = value;
// });
// }
if (data.messageType === 'initial_settings') {
_.each(data.initialSettings, function(value, key) {
settings[key] = {};
@ -361,6 +349,10 @@ function listenForSettingsUpdates() {
loadGUI();
}
if (date.type === "enableParticleTab") {
console.log("EBL JUST GOT AN ENABLE MESSAGE!");
}
});
}

View file

@ -0,0 +1,60 @@
<!--
// main.js
//
//
// Created by James B. Pollack @imgntn on 9/26/2015
// Copyright 2015 High Fidelity, Inc.
//
// Loads dat.gui, underscore, and the app
// Quickly edit the aesthetics of a particle system.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
-->
<html>
<head>
<script type="text/javascript" src="dat.gui.min.js"></script>
<script type="text/javascript" src="underscore-min.js"></script>
<script type="text/javascript" src="qrc:///qtwebchannel/qwebchannel.js"></script>
<script type="text/javascript" src="../html/eventBridgeLoader.js"></script>
<script type="text/javascript" src="main.js?1234"></script>
<script>
</script>
<style>
body{
background-color:black;
overflow-x: hidden;
}
#my-gui-container{
}
.importer{
margin-bottom:4px;
}
::-webkit-input-placeholder {
text-align: center;
font-family: Helvetica
}
#importer-input{
width:90%;
line-height: 2;
margin-left:5%;
}
</style>
</head>
<body>
<div class="importer">
<input type='text' id="importer-input" placeholder="Import: Paste JSON here." onkeypress="handleInputKeyPress(event)">
</div>
<div id="my-gui-container">
</div>
</body>
</html>

View file

@ -0,0 +1,20 @@
var PARTICLE_EXPLORER_HTML_URL = Script.resolvePath('particleExplorer.html');
ParticleExplorerTool = function() {
var that = {};
var url = PARTICLE_EXPLORER_HTML_URL;
var webView = new OverlayWebWindow({
title: 'Particle Explorer', source: url, toolWindow: true
});
var visible = false;
webView.setVisible(visible);
that.setVisible = function(newVisible) {
visible = newVisible;
webView.setVisible(visible);
}
};