Commit graph

200 commits

Author SHA1 Message Date
Leander Hasty
74734f35e9 [Case 6491] more uniform grabber tools; more distrust of rotateOverlayTarget.
Rotation tools' onMove methods now use rayPlaneIntersection rather than using the giant invisible rotateOverlayTarget.  It can likely be entirely removed in the next commit.

tool.onBegin's signature is now (event, pickRay, pickResult, ...) -- this allows us to avoid recomputing the ray or intersection when unnecessary.

translateXZTool is now a part of the grabberTools array; addGrabberTool and addStretchTool have been modified to return the tool reference (and not disassemble and reassemble the tools, so they can keep their own local functions and state).  This does make the array potentially less type-uniform, which may (?) undo some javascript optimizations, but allows us to eventually remove some state -- and they're only 1x/frame methods.

We now compute rotationNormal in rotation tool onBegin, rather than having many different normals lying around.

Merged the final branches in mousePressEvent.

Also fixed issue with mode TRANSLATE_XZ test within updateRotationHandles.

Reviewed-by: LaShonda Hopper <lashonda@1stplayable.com>
2017-09-28 15:04:27 -04:00
Leander Hasty
fa74fbc986 [Case 6491] fixes rotation skip near 0 and 180.
Previously, when rotating, it would be easy to achieve 1 degree granularity, except near the 0 degree and 180 degree "poles", where it would often e.g. jump from 10 to -10, or 174 to -175, or similar.

yawZero/pitchZero/rollZero were all based on the yawHandle/pitchHandle/rollHandle ray intersection, and were not necessarily coplanar with rotateOverlayTarget. As a result, centerToZero didn't lie on the expected plane, while centerToIntersect did.  This had the effect of distorting the rotation range.

We also have a possible issue in here with editOverlay(rotationOverlayTarget,{rotation:...}) not taking effect immediately.  Better to take the existing ray and cast against a known plane, as e.g. translateXZTool and such do.  No risk of stale rotation in that case.

This also cleans up rotationHelper args a bit to avoid some string switches and keep flow a little more readable.

TODO: propagate ray-plane test to helperRotationHandleOnMove rather than relying on ray hit location; normalize onBegin/onMove/etc across all tools to take queryRay and results args to avoid recreating the ray.

Reviewed-by: LaShonda Hopper <lashonda@1stplayable.com>
2017-09-28 15:04:27 -04:00
LaShonda Hopper
fe171af31b [Case 6491] entitySelectionTool mousePressEvent refactor/cleanup (details below).
Fixes situations where attempting to click on a rotate, grab,
or scale handle that was in front of others might unexpectedly
activate the obscured handle.

As of this commit the flow of mousePressEvent such that the
first item whether it be a tool or selection is what reacts
and absorbs the click/touch.  This is counter to the prior
behavior where whichever item or tool last passed the check
would determine what was hit and handled the touch _even_
when it wasn't the first thing to be touched.

* Got rid of some unused/stale vars
* Added some convenience functions
    * setRotationHandlesVisible function
    * setStretchHandlesVisible function
    * setGrabberMoveUpVisible function
* Removed checkIntersectWith helper functions as they're
  no longer used.
* Normalized onBegin signatures for all GrabberTools to
  support the new flow within mousePressEvent.
    * These are tools registered via addGrabberTool/makeStretchTool.
    * The onBegin signature changes from onBegin( event ) to
      onBegin( event, intersectResult ).
        * This allows for a simpler tool triggering where tools which
          utilized the additional information provided will have it,
          those which may need it the future shall have it with little
          issue, and those that don't care may ignore it.

NOTE(s):
* Tested normal movement within opening creation menu:  Passed
* With Creation Menu Open:
    * Tested clicking around the world in empty space: Passed
    * Tested single selection: Passed
    * Tested single selection rotation (pitch, yaw, roll): Passed
    * Tested single selection translation (xz, y): Passed
    * Tested multiple selection: Passed
    * Tested multiple selection rotation (pitch, yaw, roll): Passed
    * Tested multiple selection translation (xz, y): Passed

Reviewed-by: Leander Hasty <leander@1stplayable.com>

Changes Committed:
	modified:   scripts/system/libraries/entitySelectionTool.js
2017-09-28 15:04:27 -04:00
LaShonda Hopper
96afbeca23 [Case 6491] Dedupe rotation handle tool code (details below).
Pulled the common code shared between the rotation handle
tools out into helper funcs:
* helperRotationHandleOnBegin
* helperRotationHandleOnMove
* helperRotationHandleOnEnd

These functions either take in or derive the necessary info
needed to handle a specific rotation axis.

NOTE(s):
* Tested yaw, pitch, & roll handles using a box. The behavior
  remained consistent with that prior to this commit.

Reviewed-by: Leander Hasty <leander@1stplayable.com>

Changes Committed:
	modified:   scripts/system/libraries/entitySelectionTool.js
2017-09-28 15:04:26 -04:00
LaShonda Hopper
926789437c [Case 6491] Propagates rotation reposition fix from YawHandle (details below).
This wraps the selections rotation update handling into common helper
function utilized by all rotation handle tools (yaw,pitch,roll).

This function is the generalized fix previously exclusive to yawHandle.
This functions is now called within onMove for yaw, pitch, & rollHandle
tools.

NOTE(s):
* Tested yaw, pitch, & roll rotation didn't see any aberrant behavior.
** Tested overlapping shapes and selecting the overlapping portions followed
   by a rotation handle.  Only one took hold as a selection.
** Tested multiple selection and objects rotated & repositioned about the
   encapsulating bounding box's center point as expected.
* Tested translation with multiple items selected and it behaved as
  expected.

Reviewed-by: Leander Hasty <leander@1stplayable.com>

Changes Committed:
	modified:   scripts/system/libraries/entitySelectionTool.js
2017-09-28 15:04:26 -04:00
LaShonda Hopper
18cc632df5 [Case 6491] Minor: Switching off wantDebug flags that were left on.
Changes Committed:
	modified:   scripts/system/libraries/entitySelectionTool.js
2017-09-28 15:04:26 -04:00
LaShonda Hopper
196b665e22 [Case 6491] Cleanup of mousePressEvent/tool(s) onBegin (details below).
* Removes unregister tools switch which was never reached.
* Rolls all code rotation handle related code within mousePressEvent
  to the respective rotation handler onBegin functions.
    * onBegin call site updated accordingly to provide intersection
      data that code depends upon.
* Moves all translateXZTool code explicitly within mousePressEvent
  to the tool's onBegin function.
    * onBegin signature updated accordingly to provide intersect
      results that the tool relies upon.
    * Found and fixed a bug with translateXZTool
      where its startingElevation and startingDistance properties
      were _only_ set when local _debug_ var was set.
          * This appears to have been responsible for being able
            to move the object farther than was visible.  Re-tested
            with fix and wasn't able to get that behavior any longer.
* Wrap intersect tests within more reader friendly functions.

NOTE(s):
* Tested GrabberMoveUp and Rotation Handles.  They work as they
  did previously as expected.
* Tested selection behavior and it currently maintains as expected.
* Tested translationXZTool and it maintains its prior behavior with
  the improvement noted above.

Reviewed-by: Leander Hasty <leander@1stplayable.com>

Changes Committed:
    modified:   scripts/system/libraries/entitySelectionTool.js
2017-09-28 15:04:20 -04:00
LaShonda Hopper
ae8ae6f6cc [Case 6491] Grabbers stay invisible while rotating (details below).
This fixes the issue where grabbers would re-appear when rotating
the selected object rather than staying hidden.

updateHandles will now take the mode into account when deciding
if the non-light grabber handles should be visible.  This can be
subverted by the user selecting a light source as in line with
the previous behavior.

Adds some debug prints in event handlers guarded by local
wantDebug checks.

Has some minor cleanup changes:
* Remove unused var within updateRotationHandles
* Readability improvement for light check within updateHandles
* Pulled up rotate mode check within updateHandles
* Added grabberCloner visibility flag within updateHandles

Changes Committed:
    modified:   scripts/system/libraries/entitySelectionTool.js
2017-09-28 14:58:30 -04:00
LaShonda Hopper
15ff4ebecb [Case 6491] Adds some debugging prints.
Changes Committed:
	modified:   scripts/system/libraries/entitySelectionTool.js
2017-09-28 14:58:30 -04:00
druiz17
58a00a89d7 remove debug print 2017-09-27 12:58:11 -07:00
druiz17
38096b48d9 fixing entitySelectionTool 2017-09-27 10:52:56 -07:00
LaShonda Hopper
cc2ff565ac [Case 6491] Ran lint on entitySelectionTool.js (details below).
Prior Issue Count: 35
Current Issue Count: 3

Resolved:
* 17 used out of scope issues.
* 11 already defined issues.
* 2 missing semicolon issues.
* 1 implicit comparison against null issue.
* 1 readability warning.

Remaining Issues as of this commit:
* scripts/system/libraries/entitySelectionTool.js: line 17, col 1, Read only.
** HIFI_PUBLIC_BUCKET assignment
* scripts/system/libraries/entitySelectionTool.js: line 19, col 1, Read only.
** SPACE_WORLD assignment
* scripts/system/libraries/entitySelectionTool.js: line 30, col 1, Read only.
** SelectionManager assignment

One notable item was a chunk of code from makeStretchTool's onMove
function which wasn't in scope of the vars being utilized.

Changes Committed:
	modified:   scripts/system/libraries/entitySelectionTool.js
2017-08-16 15:21:30 -04:00
LaShonda Hopper
48e327815d [Case 6491] Resolves arg order to centerToZero and centerToIntersection vectors.
Changes Committed:
	modified:   scripts/system/libraries/entitySelectionTool.js
2017-08-09 11:38:44 -04:00
Mike Moody
036a16c0b3 readded line that caused colflict. 2017-07-24 16:51:23 -07:00
Leander Hasty
26cc8134eb WL21463 - entitySelectionTool: use multiarg findRayIntersection instead of editOverlay.
We're seeing the ignoreRayIntersection flag not take effect before findRayIntersection calls.  This may be due to editOverlay and editOverlays becoming non-blocking in 1f7d2b2 .

This altered the flow in mousePressEvent significantly; the first block, intended to handle scale/clone only, started handling rotation (should have been second block) and sometimes selection (should have been third block).

Similarly, in the various rotate grabbers' onMove methods, the pickRay will no longer intersect anything other than rotateOverlayTarget; this avoids some awful behavior when scrubbing over the size and clone grabbers.

This also reverts unnecessary parts of the prior commits to keep the diff for this WL cleaner, and adds a few TODO comments to revisit about redundant statements and incorrect names.

In addition, we've noticed but not fixed herein:

* There is a minor edgecase near 0 and 180, where it's difficult to get within a degree or two of the poles occasionally.
* The scale/clone grabbers don't stay disappeared for rotation in some cases.  This doesn't impact usability anymore, but it'd be nice to determine why they come back when they hide briefly.
* The addGrabbers for yaw/pitch/roll could be deduplicated, and yaw has some multiselect "reposition" enable/disable logic that pitch and roll lack.

Reviewed-by: LaShonda Hopper <lashonda@1stplayable.com>
2017-07-21 10:56:24 -04:00
Philip Rosedale
6e82343b29 Merge pull request #10406 from amvmoody/21289
21289 - Edit: Add the ability to duplicate an object with hand controller
2017-05-13 20:43:52 -07:00
Mike Moody
89d93ee56d Updated HMD grab Clone to work with all entity types. 2017-05-11 04:16:22 -07:00
Mike Moody
dae652d3db v1 HMD duplication overlay. 2017-05-08 11:25:24 -07:00
Mike Moody
03490c81da v1 with bug, looking into. 2017-05-06 15:36:18 -07:00
Delanir
27029eb8db Fix Code Standard
Fix indent lines 2799-2800
Fix one line that had more than 128 columns wide
2017-04-27 18:24:49 +01:00
Delanir
956d1e9d95 Fix Code Standard 2017-04-19 16:30:49 +01:00
Delanir
fcde85e51b Fix Style
- Replace tabs by 4 spaces;
- Add indents and spaces;
- Formated multi/line statement
- Removed out-of-scope comments.
2017-04-10 22:16:56 +01:00
Delanir
25a89a631b hifi: #21216 - Resize entities with hand controllers while editing
hifi: #21216 - Resize entities with hand controllers while editing
Modified StretchTool to allow for movement in 3D
- uses data from motion controller (position and rotation) to
stretch/resize the entities/primitives in 3D.
- the range of the resize depends on distance to the object.
2017-04-10 20:25:30 +01:00
Seth Alves
902e3d41d6 merge from upstream 2017-03-24 08:20:35 -07:00
Triplelexx
a964edee91 change all references of Quat.getFront to Quat.getForward in scripts directory 2017-03-21 22:25:30 +00:00
Ryan Huffman
df644edde4 Fix hand controller not able to select light/particle icons 2017-03-20 09:45:50 -07:00
Seth Alves
3b581a8dfe merge from upstream 2017-03-02 16:35:44 -08:00
Seth Alves
10cb7aab06 Merge pull request #9684 from Menithal/parent-hotkey
WL#20856 Added Parenting Hotkeys to Edit.js Among Visual tweaks
2017-03-02 16:30:43 -08:00
Seth Alves
70060eb464 in 2d mode, clicks on tablet don't get used for other things
Conflicts:
	scripts/system/libraries/entitySelectionTool.js
2017-02-24 11:37:04 -08:00
Seth Alves
e43c4c17f5 in 2d mode, clicks on tablet don't get used for other things 2017-02-23 21:27:25 -08:00
Menithal
f5d266a562 Updated 2017-02-17 23:28:28 +02:00
Seth Alves
39e1edafd2 merge from upstream 2017-02-17 13:16:12 -08:00
Seth Alves
5ddcbae934 save tablet web-overlay ID in HMD interface. don't trigger edit affordances if the click was intented for the tablet 2017-02-17 11:51:23 -08:00
Seth Alves
b6b6ad780d allow isSpotlight to be 0 or 1 2017-02-16 17:15:52 -08:00
Menithal
d96f95a7e9 Updated edit.js and selection tool
Last selected entity will now be yellow instead of orange
2017-02-16 10:05:59 +02:00
Seth Alves
076b0ed3ab get particle explorer working, again 2017-02-15 15:00:25 -08:00
Seth Alves
792c7ff51f PointerEvent will now relay keyboard modifiers 2017-02-15 10:41:56 -08:00
Seth Alves
3a23ec86d5 handles etc work better 2017-02-14 13:57:48 -08:00
Seth Alves
44aa3e044b make it so near grabbing while edit is active doesn't select a new entity 2017-02-10 16:56:53 -08:00
Dante Ruiz
7a4a769015 fix more editing bugs 2017-01-31 16:53:57 +00:00
Seth Alves
c317ba8054 merge from upstream 2017-01-25 15:57:53 -08:00
Ryan Huffman
ad70431c26 Fix edit.js server script status getting reset when changing properties 2017-01-20 15:34:38 -08:00
Seth Alves
37b179b00b remove commented-out code 2016-12-09 09:55:02 -08:00
Seth Alves
369f61e172 bring over some previous tablet-ui work 2016-12-08 16:54:39 -08:00
Anthony J. Thibault
53864abaf2 edit.js: Fix for picking and manipulating objects via hand controllers.
The ray picking was not using the proper grab sphere offset, so it became detached from the visual ray, making picking difficult.
2016-10-20 13:37:31 -07:00
howard-stearns
03a8af76e3 don't do hand-controller edit object-selection when pointed at a HUD
element
2016-09-14 12:02:33 -07:00
SamGondelman
b23d3cd35a fixed messed up transparency on edit selection of shapes 2016-08-05 18:35:16 -07:00
howard-stearns
b8e6572ebf basic hand-controller editing 2016-07-05 17:00:54 -07:00
howard-stearns
acb56d0603 Larger edit handles, and more tolerance in click (vs drag). 2016-05-16 12:35:05 -07:00
James B. Pollack
06171f6063 move default to system 2016-04-26 14:47:02 -07:00
Renamed from scripts/default/libraries/entitySelectionTool.js (Browse further)