mirror of
https://github.com/overte-org/overte.git
synced 2025-07-31 08:01:28 +02:00
good progress- can create particle entity from menu
This commit is contained in:
parent
0511ff70ac
commit
804f82f2f1
5 changed files with 130 additions and 25 deletions
|
@ -27,6 +27,7 @@ Script.include([
|
||||||
"libraries/entityCameraTool.js",
|
"libraries/entityCameraTool.js",
|
||||||
"libraries/gridTool.js",
|
"libraries/gridTool.js",
|
||||||
"libraries/entityList.js",
|
"libraries/entityList.js",
|
||||||
|
"particle_explorer/particleExplorerTool.js",
|
||||||
"libraries/lightOverlayManager.js",
|
"libraries/lightOverlayManager.js",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -640,8 +641,13 @@ var toolBar = (function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newParticleButton === toolBar.clicked(clickedOverlay)) {
|
if (newParticleButton === toolBar.clicked(clickedOverlay)) {
|
||||||
print("EBL: NEW PARTICLES");
|
createNewEntity({
|
||||||
Script.load('particle_explorer/particleExplorer.js');
|
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;
|
return false;
|
||||||
|
@ -1579,8 +1585,16 @@ PropertiesTool = function(opts) {
|
||||||
} else {
|
} else {
|
||||||
if (data.properties.dynamic === false) {
|
if (data.properties.dynamic === false) {
|
||||||
// this object is leaving dynamic, so we zero its velocities
|
// this object is leaving dynamic, so we zero its velocities
|
||||||
data.properties["velocity"] = {x: 0, y: 0, z: 0};
|
data.properties["velocity"] = {
|
||||||
data.properties["angularVelocity"] = {x: 0, y: 0, z: 0};
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
z: 0
|
||||||
|
};
|
||||||
|
data.properties["angularVelocity"] = {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
z: 0
|
||||||
|
};
|
||||||
}
|
}
|
||||||
if (data.properties.rotation !== undefined) {
|
if (data.properties.rotation !== undefined) {
|
||||||
var rotation = data.properties.rotation;
|
var rotation = data.properties.rotation;
|
||||||
|
@ -1863,3 +1877,4 @@ propertyMenu.onSelectMenuItem = function(name) {
|
||||||
var showMenuItem = propertyMenu.addMenuItem("Show in Marketplace");
|
var showMenuItem = propertyMenu.addMenuItem("Show in Marketplace");
|
||||||
|
|
||||||
propertiesTool = PropertiesTool();
|
propertiesTool = PropertiesTool();
|
||||||
|
var particleExplorerTool = ParticleExplorerTool();
|
|
@ -71,13 +71,31 @@ EntityListTool = function(opts) {
|
||||||
webView.eventBridge.emitScriptEvent(JSON.stringify(data));
|
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) {
|
webView.eventBridge.webEventReceived.connect(function(data) {
|
||||||
data = JSON.parse(data);
|
data = JSON.parse(data);
|
||||||
if (data.type == "selectionUpdate") {
|
if (data.type == "selectionUpdate") {
|
||||||
|
print("EBL CLICKED ON SOME SHIT " + JSON.stringify(data))
|
||||||
var ids = data.entityIds;
|
var ids = data.entityIds;
|
||||||
var entityIDs = [];
|
var entityIDs = [];
|
||||||
for (var i = 0; i < ids.length; i++) {
|
for (var i = 0; i < ids.length; i++) {
|
||||||
entityIDs.push(ids[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);
|
selectionManager.setSelections(entityIDs);
|
||||||
if (data.focus) {
|
if (data.focus) {
|
||||||
|
|
|
@ -82,7 +82,6 @@ window.onload = function() {
|
||||||
|
|
||||||
listenForSettingsUpdates();
|
listenForSettingsUpdates();
|
||||||
window.onresize = setGUIWidthToWindowWidth;
|
window.onresize = setGUIWidthToWindowWidth;
|
||||||
console.log('JBP HAS EVENT BRIDGE');
|
|
||||||
})
|
})
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -128,9 +127,6 @@ function loadGUI() {
|
||||||
individualKeys.push(key);
|
individualKeys.push(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//alphabetize our keys
|
//alphabetize our keys
|
||||||
|
@ -345,14 +341,6 @@ function writeVec3ToInterface(obj) {
|
||||||
function listenForSettingsUpdates() {
|
function listenForSettingsUpdates() {
|
||||||
EventBridge.scriptEventReceived.connect(function(data) {
|
EventBridge.scriptEventReceived.connect(function(data) {
|
||||||
data = JSON.parse(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') {
|
if (data.messageType === 'initial_settings') {
|
||||||
_.each(data.initialSettings, function(value, key) {
|
_.each(data.initialSettings, function(value, key) {
|
||||||
settings[key] = {};
|
settings[key] = {};
|
||||||
|
@ -361,6 +349,10 @@ function listenForSettingsUpdates() {
|
||||||
|
|
||||||
loadGUI();
|
loadGUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (date.type === "enableParticleTab") {
|
||||||
|
console.log("EBL JUST GOT AN ENABLE MESSAGE!");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
60
examples/particle_explorer/particleExplorer.html
Normal file
60
examples/particle_explorer/particleExplorer.html
Normal 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>
|
20
examples/particle_explorer/particleExplorerTool.js
Normal file
20
examples/particle_explorer/particleExplorerTool.js
Normal 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
Loading…
Reference in a new issue