panel entity, readme

This commit is contained in:
James B. Pollack 2015-12-19 19:11:17 -08:00
parent 05467bd5e1
commit 9f0d254739
2 changed files with 28 additions and 17 deletions

View file

@ -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

View file

@ -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);