From 9f0d254739df2a9a158c01a138a85717dcad0812 Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Sat, 19 Dec 2015 19:11:17 -0800 Subject: [PATCH] panel entity, readme --- examples/light_modifier/README.md | 16 ++++++------- examples/light_modifier/lightModifier.js | 29 ++++++++++++++++-------- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/examples/light_modifier/README.md b/examples/light_modifier/README.md index 73c2199ec9..b12ff7550b 100644 --- a/examples/light_modifier/README.md +++ b/examples/light_modifier/README.md @@ -1,6 +1,8 @@ -This PR demonstrates one way in-world editing of objects might work. We start with a spotlight. When you distant grab the sliders, you can move them along their axis to change their values. You may also rotate / move the block to which the spotlight is attached. +This PR demonstrates one way in-world editing of objects might work. -Enter edit mode by running your distance beam through a light overlay. Exit using the red X. +Running this script will show light overlay icons in-world. Enter edit mode by running your distance beam through a light overlay. Exit using the red X. + +When you distant grab the sliders, you can move them along their axis to change their values. You may also rotate / move the block to which the spotlight is attached. To test: https://rawgit.com/imgntn/hifi/light_mod/examples/lights/lightLoader.js To reset, I recommend stopping all scripts then re-loading lightLoader.js @@ -8,14 +10,12 @@ To reset, I recommend stopping all scripts then re-loading lightLoader.js When you run the lightLoader.js script, several scripts will be loaded: - handControllerGrab.js (custom) - lightModifier.js (listens for message to create sliders for a given light) -- lightModifierTestScene.js (creates a light and parents it to a block, then sends a message ^^) +- lightModifierTestScene.js (creates a light) - slider.js (attached to each slider entity) -- lightParent.js (attached to the entity to which a light is parented, so you can move it around) +- lightParent.js (attached to a 3d model of a light, to which a light is parented, so you can move it around. or keep the current parent if a light already has a parent) - closeButton.js (for closing the ui) -- ../libraries/lightOverlayManager.js (custom) -- ../libraries/entitySelectionTool.js - - +- ../libraries/lightOverlayManager.js (shows 2d overlays for lights in the world) +- ../libraries/entitySelectionTool.js (visualizes volume of the lights) Current sliders are (top to bottom): red diff --git a/examples/light_modifier/lightModifier.js b/examples/light_modifier/lightModifier.js index 14053c7974..30f004c922 100644 --- a/examples/light_modifier/lightModifier.js +++ b/examples/light_modifier/lightModifier.js @@ -16,13 +16,14 @@ var SLIDERS_SHOULD_STAY_WITH_AVATAR = false; var VERTICAL_SLIDERS = false; var SHOW_OVERLAYS = true; var SHOW_LIGHT_VOLUME = true; +var USE_PARENTED_PANEL = false; //variables for managing overlays var selectionDisplay; var selectionManager; var lightOverlayManager; -//for when we make a block parent for the light +//for when we make a 3d model of a light a parent for the light var PARENT_SCRIPT_URL = Script.resolvePath('lightParent.js?' + Math.random(0 - 100)); if (SHOW_OVERLAYS === true) { @@ -362,9 +363,9 @@ var slidersRef = { var light = null; function makeSliders(light) { - + var panel; if (USE_PARENTED_PANEL === true) { - createPanelEntity(MyAvatar.position); + panel = createPanelEntity(MyAvatar.position); } if (light.type === 'spotlight') { @@ -409,10 +410,21 @@ function makeSliders(light) { subscribeToSliderMessages(); if (USE_PARENTED_PANEL === true) { - parentEntitiesToPanel(); + parentEntitiesToPanel(panel); + } + + if () { + parentPanelToAvatar(panel) } }; +function parentPanelToAvatar(panel) { + Entities.editEntity(panel, { + parentID: MyAvatar.sessionUUID, + //actually figure out which one to parent it to -- probably a spine or something. + parentJointIndex: 1, + }) +} function parentEntitiesToPanel(panel) { slidersRef.forEach(function(slider) { @@ -493,11 +505,10 @@ function createCloseButton(endOfAxis) { ignoreForCollisions: true, script: CLOSE_BUTTON_SCRIPT_URL, userData: JSON.stringify({ - grabbableKey: { - wantsTrigger: true - } - }) - //need to add wantsTrigger stuff so we can interact with it with our beamz + grabbableKey: { + wantsTrigger: true + } + }) } var button = Entities.addEntity(buttonProperties);