particle panel in tool window

This commit is contained in:
ericrius1 2016-01-28 14:34:19 -08:00
parent 2acc88261f
commit 0511ff70ac
3 changed files with 75 additions and 78 deletions

View file

@ -16,14 +16,16 @@
<head> <head>
<script type="text/javascript" src="dat.gui.min.js"></script> <script type="text/javascript" src="dat.gui.min.js"></script>
<script type="text/javascript" src="underscore-min.js"></script> <script type="text/javascript" src="underscore-min.js"></script>
<script type="text/javascript" src="main.js?123"></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>
</script> </script>
<style> <style>
body{ body{
background-color:black; background-color:black;
overflow-x: hidden; overflow-x: hidden;
} }
#my-gui-container{ #my-gui-container{
@ -31,12 +33,12 @@ body{
} }
.importer{ .importer{
margin-bottom:4px; margin-bottom:4px;
} }
::-webkit-input-placeholder { ::-webkit-input-placeholder {
text-align: center; text-align: center;
font-family: Helvetica font-family: Helvetica
} }
#importer-input{ #importer-input{

View file

@ -34,49 +34,34 @@ var updateInterval;
var currentInputField; var currentInputField;
var storedController; var storedController;
var keysToIgnore = [ //CHANGE TO WHITELIST
'importSettings', var keysToAllow = [
'exportSettings',
'script',
'visible',
'locked',
'userData',
'position',
'dimensions',
'rotation',
'id',
'description',
'type',
'created',
'age',
'ageAsText',
'boundingBox',
'naturalDimensions',
'naturalPosition',
'velocity',
'gravity',
'acceleration',
'damping',
'restitution',
'friction',
'density',
'lifetime',
'scriptTimestamp',
'registrationPoint',
'angularVelocity',
'angularDamping',
'collisionless',
'dynamic',
'href',
'actionData',
'marketplaceID',
'collisionSoundURL',
'shapeType',
'isEmitting', 'isEmitting',
'sittingPoints', 'maxParticles',
'originalTextures', 'lifespan',
'parentJointIndex', 'emitRate',
'parentID' 'emitSpeed',
'speedSpread',
'emitOrientation',
'emitDimensios',
'emitRadiusStart',
'polarStart',
'polarFinish',
'azimuthFinish',
'emitAcceleration',
'accelerationSpread',
'particleRadius',
'radiusSpread',
'radiusStart',
'radiusFinish',
'color',
'colorSpread',
'colorStart',
'colorFinish',
'alpha',
'alphaSpread',
'alphaFinish',
'emitterShouldTrail'
]; ];
var individualKeys = []; var individualKeys = [];
@ -85,8 +70,8 @@ var quatKeys = [];
var colorKeys = []; var colorKeys = [];
window.onload = function() { window.onload = function() {
if (typeof EventBridge !== 'undefined') {
openEventBridge(function() {
var stringifiedData = JSON.stringify({ var stringifiedData = JSON.stringify({
messageType: 'page_loaded' messageType: 'page_loaded'
}); });
@ -97,9 +82,9 @@ window.onload = function() {
listenForSettingsUpdates(); listenForSettingsUpdates();
window.onresize = setGUIWidthToWindowWidth; window.onresize = setGUIWidthToWindowWidth;
} else { console.log('JBP HAS EVENT BRIDGE');
console.log('No event bridge, probably not in interface.'); })
}
}; };
function loadGUI() { function loadGUI() {
@ -120,31 +105,31 @@ function loadGUI() {
var keys = _.keys(settings); var keys = _.keys(settings);
_.each(keys, function(key) { _.each(keys, function(key) {
var shouldIgnore = _.contains(keysToIgnore, key); var shouldAllow = _.contains(keysToAllow, key);
if (shouldIgnore) { if (shouldAllow) {
return; var subKeys = _.keys(settings[key]);
var hasX = _.contains(subKeys, 'x');
var hasY = _.contains(subKeys, 'y');
var hasZ = _.contains(subKeys, 'z');
var hasW = _.contains(subKeys, 'w');
var hasRed = _.contains(subKeys, 'red');
var hasGreen = _.contains(subKeys, 'green');
var hasBlue = _.contains(subKeys, 'blue');
if ((hasX && hasY && hasZ) && hasW === false) {
vec3Keys.push(key);
} else if (hasX && hasY && hasZ && hasW) {
quatKeys.push(key);
} else if (hasRed || hasGreen || hasBlue) {
colorKeys.push(key);
} else {
individualKeys.push(key);
}
} }
var subKeys = _.keys(settings[key]);
var hasX = _.contains(subKeys, 'x');
var hasY = _.contains(subKeys, 'y');
var hasZ = _.contains(subKeys, 'z');
var hasW = _.contains(subKeys, 'w');
var hasRed = _.contains(subKeys, 'red');
var hasGreen = _.contains(subKeys, 'green');
var hasBlue = _.contains(subKeys, 'blue');
if ((hasX && hasY && hasZ) && hasW === false) {
vec3Keys.push(key);
} else if (hasX && hasY && hasZ && hasW) {
quatKeys.push(key);
} else if (hasRed || hasGreen || hasBlue) {
colorKeys.push(key);
} else {
individualKeys.push(key);
}
}); });
@ -182,7 +167,7 @@ function addIndividualKeys() {
controller = gui.add(settings, key); controller = gui.add(settings, key);
} }
//2-way - need to fix not being able to input exact values if constantly listening //2-way - need to fix not being able to input exact values if constantly listening
//controller.listen(); //controller.listen();
@ -469,6 +454,7 @@ function removeListenerFromGUI(key) {
} }
//the section below is to try to work at achieving two way bindings; //the section below is to try to work at achieving two way bindings;
function addListenersBackToGUI() { function addListenersBackToGUI() {
gui.__listening.push(storedController); gui.__listening.push(storedController);
storedController = null; storedController = null;
@ -500,5 +486,4 @@ function registerDOMElementsForListenerBlocking() {
}); });
}); });
}); });
} }

View file

@ -141,8 +141,19 @@ SettingsWindow = function() {
this.webWindow = null; this.webWindow = null;
this.init = function() { this.init = function() {
var url = Script.resolvePath('index.html');
_this.shnur = "bdur";
Script.update.connect(waitForObjectAuthorization); Script.update.connect(waitForObjectAuthorization);
_this.webWindow = new WebWindow('Particle Explorer', Script.resolvePath('index.html'), 400, 600, false); _this.webWindow = new OverlayWebWindow({
title: 'Particle Explorer',
source: url,
toolWindow: true
});
// _this.webWindow.setVisible(false);
Script.setTimeout(function() {
print("EBL IN TIMEOUT! " + _this.shnur);
_this.webWindow.setVisible(true);
}, 2000)
_this.webWindow.eventBridge.webEventReceived.connect(_this.onWebEventReceived); _this.webWindow.eventBridge.webEventReceived.connect(_this.onWebEventReceived);
}; };
@ -161,7 +172,6 @@ SettingsWindow = function() {
editEntity(_data.updatedSettings); editEntity(_data.updatedSettings);
return; return;
} }
}; };
}; };