diff --git a/wle_pp/wle_pp_bundler/js/pp/cauldron/fsm/fsm.js b/wle_pp/wle_pp_bundler/js/pp/cauldron/fsm/fsm.js index d8b9f84..7ce1537 100644 --- a/wle_pp/wle_pp_bundler/js/pp/cauldron/fsm/fsm.js +++ b/wle_pp/wle_pp_bundler/js/pp/cauldron/fsm/fsm.js @@ -31,12 +31,12 @@ PP.PendingPerform = class PendingPerform { } }; -PP.PerformType = { +PP.PerformMode = { IMMEDIATE: 0, DELAYED: 1 }; -PP.PerformDelayedType = { +PP.PerformDelayedMode = { QUEUE: 0, KEEP_FIRST: 1, KEEP_LAST: 2 @@ -51,7 +51,7 @@ PP.SkipStateFunction = { PP.FSM = class FSM { - constructor(performType = PP.PerformType.IMMEDIATE, performDelayedType = PP.PerformDelayedType.QUEUE) { + constructor(performMode = PP.PerformMode.IMMEDIATE, performDelayedMode = PP.PerformDelayedMode.QUEUE) { this._myCurrentStateData = null; this._myStateMap = new Map(); @@ -61,15 +61,15 @@ PP.FSM = class FSM { this._myDebugShowDelayedInfo = false; this._myDebugLogName = "FSM"; - this._myPerformType = performType; - this._myPerformDelayedType = performDelayedType; + this._myPerformMode = performMode; + this._myPerformDelayedMode = performDelayedMode; this._myPendingPerforms = []; this._myCurrentlyPerformedTransition = null; this._myInitCallbacks = new Map(); // Signature: callback(fsm, initStateData, initTransitionObject, ...args) this._myInitIDCallbacks = new Map(); // Signature: callback(fsm, initStateData, initTransitionObject, ...args) - this._myTransitionCallbacks = new Map(); // Signature: callback(fsm, fromStateData, toStateData, transitionData, performType, ...args) - this._myTransitionIDCallbacks = []; // Signature: callback(fsm, fromStateData, toStateData, transitionData, performType, ...args) + this._myTransitionCallbacks = new Map(); // Signature: callback(fsm, fromStateData, toStateData, transitionData, performMode, ...args) + this._myTransitionIDCallbacks = []; // Signature: callback(fsm, fromStateData, toStateData, transitionData, performMode, ...args) } addState(stateID, state = null) { @@ -171,7 +171,7 @@ PP.FSM = class FSM { update(dt, ...args) { if (this._myPendingPerforms.length > 0) { for (let i = 0; i < this._myPendingPerforms.length; i++) { - this._perform(this._myPendingPerforms[i].myID, PP.PerformType.DELAYED, ...this._myPendingPerforms[i].myArgs); + this._perform(this._myPendingPerforms[i].myID, PP.PerformMode.DELAYED, ...this._myPendingPerforms[i].myArgs); } this._myPendingPerforms = []; } @@ -182,7 +182,7 @@ PP.FSM = class FSM { } perform(transitionID, ...args) { - if (this._myPerformType == PP.PerformType.DELAYED) { + if (this._myPerformMode == PP.PerformMode.DELAYED) { this.performDelayed(transitionID, ...args); } else { this.performImmediate(transitionID, ...args); @@ -192,18 +192,18 @@ PP.FSM = class FSM { performDelayed(transitionID, ...args) { let performDelayed = false; - switch (this._myPerformDelayedType) { - case PP.PerformDelayedType.QUEUE: + switch (this._myPerformDelayedMode) { + case PP.PerformDelayedMode.QUEUE: this._myPendingPerforms.push(new PP.PendingPerform(transitionID, ...args)); performDelayed = true; break; - case PP.PerformDelayedType.KEEP_FIRST: + case PP.PerformDelayedMode.KEEP_FIRST: if (!this.hasPendingPerforms()) { this._myPendingPerforms.push(new PP.PendingPerform(transitionID, ...args)); performDelayed = true; } break; - case PP.PerformDelayedType.KEEP_LAST: + case PP.PerformDelayedMode.KEEP_LAST: this.resetPendingPerforms(); this._myPendingPerforms.push(new PP.PendingPerform(transitionID, ...args)); performDelayed = true; @@ -214,7 +214,7 @@ PP.FSM = class FSM { } performImmediate(transitionID, ...args) { - return this._perform(transitionID, PP.PerformType.IMMEDIATE, ...args); + return this._perform(transitionID, PP.PerformMode.IMMEDIATE, ...args); } canPerform(transitionID) { @@ -367,20 +367,20 @@ PP.FSM = class FSM { return hasTransition; } - setPerformType(performType) { - this._myPerformType = performType; + setPerformMode(performMode) { + this._myPerformMode = performMode; } - getPerformType() { - return this._myPerformType; + getPerformMode() { + return this._myPerformMode; } - setPerformDelayedType(performDelayedType) { - this._myPerformDelayedType = performDelayedType; + setPerformDelayedMode(performDelayedMode) { + this._myPerformDelayedMode = performDelayedMode; } - getPerformDelayedType() { - return this._myPerformDelayedType; + getPerformDelayedMode() { + return this._myPerformDelayedMode; } hasPendingPerforms() { @@ -402,8 +402,8 @@ PP.FSM = class FSM { cloneFSM._myDebugShowDelayedInfo = this._myDebugShowDelayedInfo; cloneFSM._myDebugLogName = this._myDebugLogName.slice(0); - cloneFSM._myPerformType = this._myPerformType; - cloneFSM._myPerformDelayedType = this._myPerformDelayedType; + cloneFSM._myPerformMode = this._myPerformMode; + cloneFSM._myPerformDelayedMode = this._myPerformDelayedMode; cloneFSM._myPendingPerforms = this._myPendingPerforms.slice(0); for (let entry of this._myStateMap.entries()) { @@ -554,12 +554,12 @@ PP.FSM = class FSM { } } - _perform(transitionID, performType, ...args) { + _perform(transitionID, performMode, ...args) { if (this.isPerformingTransition()) { let currentlyPerformedTransition = this.getCurrentlyPerformedTransition(); let consoleArguments = [this._myDebugLogName, "- Trying to perform:", transitionID]; if (this._myDebugShowDelayedInfo) { - consoleArguments.push(performType == PP.PerformType.DELAYED ? "- Delayed" : "- Immediate"); + consoleArguments.push(performMode == PP.PerformMode.DELAYED ? "- Delayed" : "- Immediate"); } consoleArguments.push("- But another transition is currently being performed -", currentlyPerformedTransition.myID); console.warn(...consoleArguments); @@ -580,7 +580,7 @@ PP.FSM = class FSM { if (this._myDebugLogActive) { let consoleArguments = [this._myDebugLogName, "- From:", fromState.myID, "- To:", toState.myID, "- With:", transitionID]; if (this._myDebugShowDelayedInfo) { - consoleArguments.push(performType == PP.PerformType.DELAYED ? "- Delayed" : "- Immediate"); + consoleArguments.push(performMode == PP.PerformMode.DELAYED ? "- Delayed" : "- Immediate"); } console.log(...consoleArguments); } @@ -602,7 +602,7 @@ PP.FSM = class FSM { this._myCurrentStateData = transitionToPerform.myToState; if (this._myTransitionCallbacks.size > 0) { - this._myTransitionCallbacks.forEach(function (callback) { callback(this, fromState, toState, transitionToPerform, performType, ...args); }.bind(this)); + this._myTransitionCallbacks.forEach(function (callback) { callback(this, fromState, toState, transitionToPerform, performMode, ...args); }.bind(this)); } if (this._myTransitionIDCallbacks.length > 0) { @@ -616,7 +616,7 @@ PP.FSM = class FSM { } for (let callbackMap of this.transitionIDMaps) { - callbackMap.forEach(function (callback) { callback(this, fromState, toState, transitionToPerform, performType, ...args); }.bind(this)); + callbackMap.forEach(function (callback) { callback(this, fromState, toState, transitionToPerform, performMode, ...args); }.bind(this)); } } @@ -626,14 +626,14 @@ PP.FSM = class FSM { } else if (this._myDebugLogActive) { let consoleArguments = [this._myDebugLogName, "- No Transition:", transitionID, "- From:", this._myCurrentStateData.myID]; if (this._myDebugShowDelayedInfo) { - consoleArguments.push(performType == PP.PerformType.DELAYED ? "- Delayed" : "- Immediate"); + consoleArguments.push(performMode == PP.PerformMode.DELAYED ? "- Delayed" : "- Immediate"); } console.warn(...consoleArguments); } } else if (this._myDebugLogActive) { let consoleArguments = [this._myDebugLogName, "- FSM not initialized yet"]; if (this._myDebugShowDelayedInfo) { - consoleArguments.push(performType == PP.PerformType.DELAYED ? "- Delayed" : "- Immediate"); + consoleArguments.push(performMode == PP.PerformMode.DELAYED ? "- Delayed" : "- Immediate"); } console.warn(...consoleArguments); } diff --git a/wle_pp/wle_pp_bundler/js/pp/gameplay/grab_throw/grabber_hand.js b/wle_pp/wle_pp_bundler/js/pp/gameplay/grab_throw/grabber_hand.js index 77b2eb1..083ba77 100644 --- a/wle_pp/wle_pp_bundler/js/pp/gameplay/grab_throw/grabber_hand.js +++ b/wle_pp/wle_pp_bundler/js/pp/gameplay/grab_throw/grabber_hand.js @@ -81,17 +81,17 @@ WL.registerComponent('pp-grabber-hand', { } if (this._myGrabButton == 0) { - this._myGamepad.registerButtonEventListener(PP.GamepadButtonType.SELECT, PP.GamepadButtonEvent.PRESS_START, this, this._grab.bind(this, PP.GamepadButtonType.SELECT)); - this._myGamepad.registerButtonEventListener(PP.GamepadButtonType.SELECT, PP.GamepadButtonEvent.PRESS_END, this, this._throw.bind(this, PP.GamepadButtonType.SELECT)); + this._myGamepad.registerButtonEventListener(PP.GamepadButtonID.SELECT, PP.GamepadButtonEvent.PRESS_START, this, this._grab.bind(this, PP.GamepadButtonID.SELECT)); + this._myGamepad.registerButtonEventListener(PP.GamepadButtonID.SELECT, PP.GamepadButtonEvent.PRESS_END, this, this._throw.bind(this, PP.GamepadButtonID.SELECT)); } else if (this._myGrabButton == 1) { - this._myGamepad.registerButtonEventListener(PP.GamepadButtonType.SQUEEZE, PP.GamepadButtonEvent.PRESS_START, this, this._grab.bind(this, PP.GamepadButtonType.SQUEEZE)); - this._myGamepad.registerButtonEventListener(PP.GamepadButtonType.SQUEEZE, PP.GamepadButtonEvent.PRESS_END, this, this._throw.bind(this, PP.GamepadButtonType.SQUEEZE)); + this._myGamepad.registerButtonEventListener(PP.GamepadButtonID.SQUEEZE, PP.GamepadButtonEvent.PRESS_START, this, this._grab.bind(this, PP.GamepadButtonID.SQUEEZE)); + this._myGamepad.registerButtonEventListener(PP.GamepadButtonID.SQUEEZE, PP.GamepadButtonEvent.PRESS_END, this, this._throw.bind(this, PP.GamepadButtonID.SQUEEZE)); } else { - this._myGamepad.registerButtonEventListener(PP.GamepadButtonType.SQUEEZE, PP.GamepadButtonEvent.PRESS_START, this, this._grab.bind(this, PP.GamepadButtonType.SQUEEZE)); - this._myGamepad.registerButtonEventListener(PP.GamepadButtonType.SQUEEZE, PP.GamepadButtonEvent.PRESS_END, this, this._throw.bind(this, PP.GamepadButtonType.SQUEEZE)); + this._myGamepad.registerButtonEventListener(PP.GamepadButtonID.SQUEEZE, PP.GamepadButtonEvent.PRESS_START, this, this._grab.bind(this, PP.GamepadButtonID.SQUEEZE)); + this._myGamepad.registerButtonEventListener(PP.GamepadButtonID.SQUEEZE, PP.GamepadButtonEvent.PRESS_END, this, this._throw.bind(this, PP.GamepadButtonID.SQUEEZE)); - this._myGamepad.registerButtonEventListener(PP.GamepadButtonType.SELECT, PP.GamepadButtonEvent.PRESS_START, this, this._grab.bind(this, PP.GamepadButtonType.SELECT)); - this._myGamepad.registerButtonEventListener(PP.GamepadButtonType.SELECT, PP.GamepadButtonEvent.PRESS_END, this, this._throw.bind(this, PP.GamepadButtonType.SELECT)); + this._myGamepad.registerButtonEventListener(PP.GamepadButtonID.SELECT, PP.GamepadButtonEvent.PRESS_START, this, this._grab.bind(this, PP.GamepadButtonID.SELECT)); + this._myGamepad.registerButtonEventListener(PP.GamepadButtonID.SELECT, PP.GamepadButtonEvent.PRESS_END, this, this._throw.bind(this, PP.GamepadButtonID.SELECT)); } }, onDeactivate() { @@ -100,17 +100,17 @@ WL.registerComponent('pp-grabber-hand', { } if (this._myGrabButton == 0) { - this._myGamepad.unregisterButtonEventListener(PP.GamepadButtonType.SELECT, PP.GamepadButtonEvent.PRESS_START, this); - this._myGamepad.unregisterButtonEventListener(PP.GamepadButtonType.SELECT, PP.GamepadButtonEvent.PRESS_END, this); + this._myGamepad.unregisterButtonEventListener(PP.GamepadButtonID.SELECT, PP.GamepadButtonEvent.PRESS_START, this); + this._myGamepad.unregisterButtonEventListener(PP.GamepadButtonID.SELECT, PP.GamepadButtonEvent.PRESS_END, this); } else if (this._myGrabButton == 1) { - this._myGamepad.unregisterButtonEventListener(PP.GamepadButtonType.SQUEEZE, PP.GamepadButtonEvent.PRESS_START, this); - this._myGamepad.unregisterButtonEventListener(PP.GamepadButtonType.SQUEEZE, PP.GamepadButtonEvent.PRESS_END, this); + this._myGamepad.unregisterButtonEventListener(PP.GamepadButtonID.SQUEEZE, PP.GamepadButtonEvent.PRESS_START, this); + this._myGamepad.unregisterButtonEventListener(PP.GamepadButtonID.SQUEEZE, PP.GamepadButtonEvent.PRESS_END, this); } else { - this._myGamepad.unregisterButtonEventListener(PP.GamepadButtonType.SQUEEZE, PP.GamepadButtonEvent.PRESS_START, this); - this._myGamepad.unregisterButtonEventListener(PP.GamepadButtonType.SQUEEZE, PP.GamepadButtonEvent.PRESS_END, this); + this._myGamepad.unregisterButtonEventListener(PP.GamepadButtonID.SQUEEZE, PP.GamepadButtonEvent.PRESS_START, this); + this._myGamepad.unregisterButtonEventListener(PP.GamepadButtonID.SQUEEZE, PP.GamepadButtonEvent.PRESS_END, this); - this._myGamepad.unregisterButtonEventListener(PP.GamepadButtonType.SELECT, PP.GamepadButtonEvent.PRESS_START, this); - this._myGamepad.unregisterButtonEventListener(PP.GamepadButtonType.SELECT, PP.GamepadButtonEvent.PRESS_END, this); + this._myGamepad.unregisterButtonEventListener(PP.GamepadButtonID.SELECT, PP.GamepadButtonEvent.PRESS_START, this); + this._myGamepad.unregisterButtonEventListener(PP.GamepadButtonID.SELECT, PP.GamepadButtonEvent.PRESS_END, this); } }, _grab: function (grabButton) { diff --git a/wle_pp/wle_pp_bundler/js/pp/input/cauldron/input_types.js b/wle_pp/wle_pp_bundler/js/pp/input/cauldron/input_types.js index f6ae99e..3c2dd45 100644 --- a/wle_pp/wle_pp_bundler/js/pp/input/cauldron/input_types.js +++ b/wle_pp/wle_pp_bundler/js/pp/input/cauldron/input_types.js @@ -14,7 +14,7 @@ PP.InputSourceType = { TRACKED_HAND: 1 }; -PP.TrackedHandJointType = { +PP.TrackedHandJointID = { WRIST: "wrist", THUMB_METACARPAL: "thumb-metacarpal", @@ -47,7 +47,7 @@ PP.TrackedHandJointType = { PINKY_FINGER_TIP: "pinky-finger-tip", }; -PP.TrackedHandJointTypeIndex = { +PP.TrackedHandJointIDIndex = { WRIST: 0, THUMB_METACARPAL: 1, diff --git a/wle_pp/wle_pp_bundler/js/pp/input/cauldron/input_utils.js b/wle_pp/wle_pp_bundler/js/pp/input/cauldron/input_utils.js index 2acc46f..f712fa8 100644 --- a/wle_pp/wle_pp_bundler/js/pp/input/cauldron/input_utils.js +++ b/wle_pp/wle_pp_bundler/js/pp/input/cauldron/input_utils.js @@ -62,21 +62,21 @@ PP.InputUtils = { return oppositeHandedness; }, - getJointTypeByIndex: function (index) { - let jointType = null; + getJointIDByIndex: function (index) { + let jointID = null; - let jointTypeKey = null; - for (let jointTypeIndexKey in PP.TrackedHandJointTypeIndex) { - if (PP.TrackedHandJointTypeIndex[jointTypeIndexKey] == index) { - jointTypeKey = jointTypeIndexKey; + let jointIDKey = null; + for (let jointIDIndexKey in PP.TrackedHandJointIDIndex) { + if (PP.TrackedHandJointIDIndex[jointIDIndexKey] == index) { + jointIDKey = jointIDIndexKey; break; } } - if (jointTypeKey != null) { - jointType = PP.TrackedHandJointType[jointTypeKey]; + if (jointIDKey != null) { + jointID = PP.TrackedHandJointID[jointIDKey]; } - return jointType; + return jointID; }, }; \ No newline at end of file diff --git a/wle_pp/wle_pp_bundler/js/pp/input/cauldron/keyboard.js b/wle_pp/wle_pp_bundler/js/pp/input/cauldron/keyboard.js index 1589953..bdef04c 100644 --- a/wle_pp/wle_pp_bundler/js/pp/input/cauldron/keyboard.js +++ b/wle_pp/wle_pp_bundler/js/pp/input/cauldron/keyboard.js @@ -1,4 +1,4 @@ -PP.KeyType = { +PP.KeyID = { _0: "0", _1: "1", _2: "2", @@ -86,43 +86,43 @@ PP.Keyboard = class Keyboard { constructor() { this._myKeyInfos = new Map(); - for (let keyType in PP.KeyType) { - this.addKey(PP.KeyType[keyType]); + for (let key in PP.KeyID) { + this.addKey(PP.KeyID[key]); } } - isKeyPressed(keyType) { + isKeyPressed(KeyID) { let isPressed = false; - if (this._myKeyInfos.has(keyType)) { - isPressed = this._myKeyInfos.get(keyType).myIsPressed; + if (this._myKeyInfos.has(KeyID)) { + isPressed = this._myKeyInfos.get(KeyID).myIsPressed; } return isPressed; } - isKeyPressStart(keyType) { + isKeyPressStart(KeyID) { let isPressStart = false; - if (this._myKeyInfos.has(keyType)) { - isPressStart = this._myKeyInfos.get(keyType).myIsPressStart; + if (this._myKeyInfos.has(KeyID)) { + isPressStart = this._myKeyInfos.get(KeyID).myIsPressStart; } return isPressStart; } - isKeyPressEnd(keyType) { + isKeyPressEnd(KeyID) { let isPressEnd = false; - if (this._myKeyInfos.has(keyType)) { - isPressEnd = this._myKeyInfos.get(keyType).myIsPressEnd; + if (this._myKeyInfos.has(KeyID)) { + isPressEnd = this._myKeyInfos.get(KeyID).myIsPressEnd; } return isPressEnd; } - addKey(keyType) { - this._myKeyInfos.set(keyType, + addKey(KeyID) { + this._myKeyInfos.set(KeyID, { myIsPressed: false, myIsPressStart: false, myIsPressStartToProcess: false, myIsPressEnd: false, myIsPressEndToProcess: false, }); } @@ -163,9 +163,9 @@ PP.Keyboard = class Keyboard { } } - _keyPressedChanged(keyType, isPressed) { - if (this._myKeyInfos.has(keyType)) { - let keyInfo = this._myKeyInfos.get(keyType); + _keyPressedChanged(KeyID, isPressed) { + if (this._myKeyInfos.has(KeyID)) { + let keyInfo = this._myKeyInfos.get(KeyID); if (isPressed) { keyInfo.myIsPressed = true; diff --git a/wle_pp/wle_pp_bundler/js/pp/input/cauldron/mouse.js b/wle_pp/wle_pp_bundler/js/pp/input/cauldron/mouse.js index dfd63c9..f99472c 100644 --- a/wle_pp/wle_pp_bundler/js/pp/input/cauldron/mouse.js +++ b/wle_pp/wle_pp_bundler/js/pp/input/cauldron/mouse.js @@ -1,4 +1,4 @@ -PP.MouseButtonType = { +PP.MouseButtonID = { LEFT: 0, MIDDLE: 1, RIGHT: 2, @@ -9,8 +9,8 @@ PP.Mouse = class Mouse { // #TODO refactor Mouse/Keyboard/Gamepad and create a sort of parent ButtonHandler that have the base ButtonInfo and all of them inherit this._myButtonInfos = new Map(); - for (let typeKey in PP.MouseButtonType) { - this._myButtonInfos.set(PP.MouseButtonType[typeKey], + for (let key in PP.MouseButtonID) { + this._myButtonInfos.set(PP.MouseButtonID[key], { myIsPressed: false, myIsPressStart: false, myIsPressStartToProcess: false, myIsPressEnd: false, myIsPressEndToProcess: false, }); } @@ -83,31 +83,31 @@ PP.Mouse = class Mouse { return this._myIsValid; } - isButtonPressed(buttonInfoType) { + isButtonPressed(buttonID) { let isPressed = false; - if (this._myButtonInfos.has(buttonInfoType)) { - isPressed = this._myButtonInfos.get(buttonInfoType).myIsPressed; + if (this._myButtonInfos.has(buttonID)) { + isPressed = this._myButtonInfos.get(buttonID).myIsPressed; } return isPressed; } - isButtonPressStart(buttonInfoType) { + isButtonPressStart(buttonID) { let isPressStart = false; - if (this._myButtonInfos.has(buttonInfoType)) { - isPressStart = this._myButtonInfos.get(buttonInfoType).myIsPressStart; + if (this._myButtonInfos.has(buttonID)) { + isPressStart = this._myButtonInfos.get(buttonID).myIsPressStart; } return isPressStart; } - isButtonPressEnd(buttonInfoType = null) { + isButtonPressEnd(buttonID = null) { let isPressEnd = false; - if (this._myButtonInfos.has(buttonInfoType)) { - isPressEnd = this._myButtonInfos.get(buttonInfoType).myIsPressEnd; + if (this._myButtonInfos.has(buttonID)) { + isPressEnd = this._myButtonInfos.get(buttonID).myIsPressEnd; } return isPressEnd; diff --git a/wle_pp/wle_pp_bundler/js/pp/input/cauldron/tracked_hand_draw_all_joints.js b/wle_pp/wle_pp_bundler/js/pp/input/cauldron/tracked_hand_draw_all_joints.js index 8af756e..1a7618b 100644 --- a/wle_pp/wle_pp_bundler/js/pp/input/cauldron/tracked_hand_draw_all_joints.js +++ b/wle_pp/wle_pp_bundler/js/pp/input/cauldron/tracked_hand_draw_all_joints.js @@ -17,21 +17,21 @@ WL.registerComponent('pp-tracked-hand-draw-all-joints', { this._myJointMeshObjectList = []; - for (let jointTypeKey in PP.TrackedHandJointType) { - let jointType = PP.TrackedHandJointType[jointTypeKey]; + for (let jointIDKey in PP.TrackedHandJointID) { + let jointID = PP.TrackedHandJointID[jointIDKey]; if (!this._myHideMetacarpals || - (jointType != PP.TrackedHandJointType.THUMB_METACARPAL && - jointType != PP.TrackedHandJointType.INDEX_FINGER_METACARPAL && jointType != PP.TrackedHandJointType.MIDDLE_FINGER_METACARPAL && - jointType != PP.TrackedHandJointType.RING_FINGER_METACARPAL && jointType != PP.TrackedHandJointType.PINKY_FINGER_METACARPAL) + (jointID != PP.TrackedHandJointID.THUMB_METACARPAL && + jointID != PP.TrackedHandJointID.INDEX_FINGER_METACARPAL && jointID != PP.TrackedHandJointID.MIDDLE_FINGER_METACARPAL && + jointID != PP.TrackedHandJointID.RING_FINGER_METACARPAL && jointID != PP.TrackedHandJointID.PINKY_FINGER_METACARPAL) ) { let jointObject = this._myTrackedHandMeshObject.pp_addObject(); - this._myJointMeshObjectList[jointType] = jointObject; + this._myJointMeshObjectList[jointID] = jointObject; jointObject.pp_addComponent("pp-tracked-hand-draw-joint", { "_myHandedness": this._myHandedness, "_myFixForward": this._myFixForward, - "_myJointType": PP.TrackedHandJointTypeIndex[jointTypeKey], + "_myJointID": PP.TrackedHandJointIDIndex[jointIDKey], "_myJointMesh": this._myJointMesh, "_myJointMaterial": this._myJointMaterial, }); diff --git a/wle_pp/wle_pp_bundler/js/pp/input/cauldron/tracked_hand_draw_joint.js b/wle_pp/wle_pp_bundler/js/pp/input/cauldron/tracked_hand_draw_joint.js index 38ec5a9..273859c 100644 --- a/wle_pp/wle_pp_bundler/js/pp/input/cauldron/tracked_hand_draw_joint.js +++ b/wle_pp/wle_pp_bundler/js/pp/input/cauldron/tracked_hand_draw_joint.js @@ -1,7 +1,7 @@ WL.registerComponent('pp-tracked-hand-draw-joint', { _myHandedness: { type: WL.Type.Enum, values: ['left', 'right'], default: 'left' }, _myFixForward: { type: WL.Type.Bool, default: true }, - _myJointType: { + _myJointID: { type: WL.Type.Enum, values: [ 'Wrist', @@ -18,9 +18,9 @@ WL.registerComponent('pp-tracked-hand-draw-joint', { }, { init: function () { this._myHandednessInternal = PP.InputUtils.getHandednessByIndex(this._myHandedness); - this._myJointTypeInternal = PP.InputUtils.getJointTypeByIndex(this._myJointType); + this._myJointIDInternal = PP.InputUtils.getJointIDByIndex(this._myJointID); - this._myTrackedHandJointPose = new PP.TrackedHandJointPose(this._myHandednessInternal, this._myJointTypeInternal); + this._myTrackedHandJointPose = new PP.TrackedHandJointPose(this._myHandednessInternal, this._myJointIDInternal); this._myTrackedHandJointPose.setFixForward(this._myFixForward); }, start: function () { diff --git a/wle_pp/wle_pp_bundler/js/pp/input/cauldron/tracked_hand_draw_skin.js b/wle_pp/wle_pp_bundler/js/pp/input/cauldron/tracked_hand_draw_skin.js index 3dfc87a..48ab767 100644 --- a/wle_pp/wle_pp_bundler/js/pp/input/cauldron/tracked_hand_draw_skin.js +++ b/wle_pp/wle_pp_bundler/js/pp/input/cauldron/tracked_hand_draw_skin.js @@ -20,8 +20,8 @@ WL.registerComponent('pp-tracked-hand-draw-skin', { for (let i = 0; i < this._myJoints.length; i++) { let jointObject = this._myJoints[i]; - let jointType = jointObject.name; // joint name must match the PP.TrackedHandJointType enum value - let jointPose = this._myTrackedHandPose.getJointPose(jointType); + let jointID = jointObject.name; // joint name must match the PP.TrackedHandJointID enum value + let jointPose = this._myTrackedHandPose.getJointPose(jointID); jointObject.pp_setTransformLocalQuat(jointPose.getTransformQuat()); } diff --git a/wle_pp/wle_pp_bundler/js/pp/input/gamepad/base_gamepad.js b/wle_pp/wle_pp_bundler/js/pp/input/gamepad/base_gamepad.js index acb24ca..d9e80ff 100644 --- a/wle_pp/wle_pp_bundler/js/pp/input/gamepad/base_gamepad.js +++ b/wle_pp/wle_pp_bundler/js/pp/input/gamepad/base_gamepad.js @@ -4,17 +4,17 @@ PP.BaseGamepad = class BaseGamepad { this._myHandedness = handedness; this._myButtonInfos = []; - for (let key in PP.GamepadButtonType) { - this._myButtonInfos[PP.GamepadButtonType[key]] = new PP.GamepadButtonInfo(PP.GamepadButtonType[key], this._myHandedness); + for (let key in PP.GamepadButtonID) { + this._myButtonInfos[PP.GamepadButtonID[key]] = new PP.GamepadButtonInfo(PP.GamepadButtonID[key], this._myHandedness); } this._myAxesInfo = new PP.GamepadAxesInfo(this._myHandedness); this._myButtonCallbacks = []; // Signature: callback(ButtonInfo, Gamepad) - for (let typeKey in PP.GamepadButtonType) { - this._myButtonCallbacks[PP.GamepadButtonType[typeKey]] = []; + for (let key in PP.GamepadButtonID) { + this._myButtonCallbacks[PP.GamepadButtonID[key]] = []; for (let eventKey in PP.GamepadButtonEvent) { - this._myButtonCallbacks[PP.GamepadButtonType[typeKey]][PP.GamepadButtonEvent[eventKey]] = new Map(); + this._myButtonCallbacks[PP.GamepadButtonID[key]][PP.GamepadButtonEvent[eventKey]] = new Map(); } } @@ -34,16 +34,16 @@ PP.BaseGamepad = class BaseGamepad { return this._myHandedness; } - getButtonInfo(buttonType) { - return this._myButtonInfos[buttonType]; + getButtonInfo(buttonID) { + return this._myButtonInfos[buttonID]; } - registerButtonEventListener(buttonType, buttonEvent, id, callback) { - this._myButtonCallbacks[buttonType][buttonEvent].set(id, callback); + registerButtonEventListener(buttonID, buttonEvent, id, callback) { + this._myButtonCallbacks[buttonID][buttonEvent].set(id, callback); } - unregisterButtonEventListener(buttonType, buttonEvent, id) { - this._myButtonCallbacks[buttonType][buttonEvent].delete(id); + unregisterButtonEventListener(buttonID, buttonEvent, id) { + this._myButtonCallbacks[buttonID][buttonEvent].delete(id); } getAxesInfo() { @@ -114,7 +114,7 @@ PP.BaseGamepad = class BaseGamepad { } - _getButtonData(buttonType) { + _getButtonData(buttonID) { let buttonData = { myIsPressed: false, myIsTouched: false, myValue: 0 }; return buttonData; } @@ -160,18 +160,18 @@ PP.BaseGamepad = class BaseGamepad { } _updateButtonInfos() { - this._updateSingleButtonInfo(PP.GamepadButtonType.SELECT); - this._updateSingleButtonInfo(PP.GamepadButtonType.SQUEEZE); - this._updateSingleButtonInfo(PP.GamepadButtonType.TOUCHPAD); - this._updateSingleButtonInfo(PP.GamepadButtonType.THUMBSTICK); - this._updateSingleButtonInfo(PP.GamepadButtonType.BOTTOM_BUTTON); - this._updateSingleButtonInfo(PP.GamepadButtonType.TOP_BUTTON); - this._updateSingleButtonInfo(PP.GamepadButtonType.THUMB_REST); + this._updateSingleButtonInfo(PP.GamepadButtonID.SELECT); + this._updateSingleButtonInfo(PP.GamepadButtonID.SQUEEZE); + this._updateSingleButtonInfo(PP.GamepadButtonID.TOUCHPAD); + this._updateSingleButtonInfo(PP.GamepadButtonID.THUMBSTICK); + this._updateSingleButtonInfo(PP.GamepadButtonID.BOTTOM_BUTTON); + this._updateSingleButtonInfo(PP.GamepadButtonID.TOP_BUTTON); + this._updateSingleButtonInfo(PP.GamepadButtonID.THUMB_REST); } - _updateSingleButtonInfo(buttonType) { - let button = this._myButtonInfos[buttonType]; - let buttonData = this._getButtonData(buttonType); + _updateSingleButtonInfo(buttonID) { + let button = this._myButtonInfos[buttonID]; + let buttonData = this._getButtonData(buttonID); button.myIsPressed = buttonData.myIsPressed; button.myIsTouched = buttonData.myIsTouched; @@ -257,9 +257,9 @@ PP.BaseGamepad = class BaseGamepad { } }.bind(this)); - for (let typeKey in PP.GamepadButtonType) { - let buttonInfo = this._myButtonInfos[PP.GamepadButtonType[typeKey]]; - let buttonCallbacks = this._myButtonCallbacks[PP.GamepadButtonType[typeKey]]; + for (let key in PP.GamepadButtonID) { + let buttonInfo = this._myButtonInfos[PP.GamepadButtonID[key]]; + let buttonCallbacks = this._myButtonCallbacks[PP.GamepadButtonID[key]]; //PRESSED if (buttonInfo.myIsPressed && !buttonInfo.myPrevIsPressed) { diff --git a/wle_pp/wle_pp_bundler/js/pp/input/gamepad/cauldron/gamepad_mesh_animator.js b/wle_pp/wle_pp_bundler/js/pp/input/gamepad/cauldron/gamepad_mesh_animator.js index ca4436e..a5ee384 100644 --- a/wle_pp/wle_pp_bundler/js/pp/input/gamepad/cauldron/gamepad_mesh_animator.js +++ b/wle_pp/wle_pp_bundler/js/pp/input/gamepad/cauldron/gamepad_mesh_animator.js @@ -54,28 +54,28 @@ WL.registerComponent('pp-gamepad-mesh-animator', { // PRESSED if (this._myThumbstick != null) { - gamepad.registerButtonEventListener(PP.GamepadButtonType.THUMBSTICK, PP.GamepadButtonEvent.PRESS_START, this, this._thumbstickPressedStart.bind(this)); - gamepad.registerButtonEventListener(PP.GamepadButtonType.THUMBSTICK, PP.GamepadButtonEvent.PRESS_END, this, this._thumbstickPressedEnd.bind(this)); + gamepad.registerButtonEventListener(PP.GamepadButtonID.THUMBSTICK, PP.GamepadButtonEvent.PRESS_START, this, this._thumbstickPressedStart.bind(this)); + gamepad.registerButtonEventListener(PP.GamepadButtonID.THUMBSTICK, PP.GamepadButtonEvent.PRESS_END, this, this._thumbstickPressedEnd.bind(this)); } if (this._myTopButton != null) { - gamepad.registerButtonEventListener(PP.GamepadButtonType.TOP_BUTTON, PP.GamepadButtonEvent.PRESS_START, this, this._topButtonPressedStart.bind(this)); - gamepad.registerButtonEventListener(PP.GamepadButtonType.TOP_BUTTON, PP.GamepadButtonEvent.PRESS_END, this, this._topButtonPressedEnd.bind(this)); + gamepad.registerButtonEventListener(PP.GamepadButtonID.TOP_BUTTON, PP.GamepadButtonEvent.PRESS_START, this, this._topButtonPressedStart.bind(this)); + gamepad.registerButtonEventListener(PP.GamepadButtonID.TOP_BUTTON, PP.GamepadButtonEvent.PRESS_END, this, this._topButtonPressedEnd.bind(this)); } if (this._myBottomButton != null) { - gamepad.registerButtonEventListener(PP.GamepadButtonType.BOTTOM_BUTTON, PP.GamepadButtonEvent.PRESS_START, this, this._bottomButtonPressedStart.bind(this)); - gamepad.registerButtonEventListener(PP.GamepadButtonType.BOTTOM_BUTTON, PP.GamepadButtonEvent.PRESS_END, this, this._bottomButtonPressedEnd.bind(this)); + gamepad.registerButtonEventListener(PP.GamepadButtonID.BOTTOM_BUTTON, PP.GamepadButtonEvent.PRESS_START, this, this._bottomButtonPressedStart.bind(this)); + gamepad.registerButtonEventListener(PP.GamepadButtonID.BOTTOM_BUTTON, PP.GamepadButtonEvent.PRESS_END, this, this._bottomButtonPressedEnd.bind(this)); } // VALUE CHANGED if (this._mySelect != null) { - gamepad.registerButtonEventListener(PP.GamepadButtonType.SELECT, PP.GamepadButtonEvent.VALUE_CHANGED, this, this._selectValueChanged.bind(this)); + gamepad.registerButtonEventListener(PP.GamepadButtonID.SELECT, PP.GamepadButtonEvent.VALUE_CHANGED, this, this._selectValueChanged.bind(this)); } if (this._mySqueeze != null) { - gamepad.registerButtonEventListener(PP.GamepadButtonType.SQUEEZE, PP.GamepadButtonEvent.VALUE_CHANGED, this, this._squeezeValueChanged.bind(this)); + gamepad.registerButtonEventListener(PP.GamepadButtonID.SQUEEZE, PP.GamepadButtonEvent.VALUE_CHANGED, this, this._squeezeValueChanged.bind(this)); } // AXES CHANGED diff --git a/wle_pp/wle_pp_bundler/js/pp/input/gamepad/cauldron/gamepad_utils.js b/wle_pp/wle_pp_bundler/js/pp/input/gamepad/cauldron/gamepad_utils.js index bea7c99..46866b7 100644 --- a/wle_pp/wle_pp_bundler/js/pp/input/gamepad/cauldron/gamepad_utils.js +++ b/wle_pp/wle_pp_bundler/js/pp/input/gamepad/cauldron/gamepad_utils.js @@ -14,31 +14,31 @@ PP.GamepadUtils = { return PP.GamepadUtils._mySimultaneousTouchMaxDelay; }, - // gamepadButtonTypesList is a sequence of a gamepads and a list of buttonTypes like this ([gamepad1, squeeze, top, select], [gamepad2, bottom, squeeze, select], ...) + // gamepadButtonIDsList is a sequence of a gamepads and a list of buttonIDs like this ([gamepad1, squeeze, top, select], [gamepad2, bottom, squeeze, select], ...) // if the first parameter is a number it's used as multiplePressCount - // if the buttonTypes list is empty for a given gamepad, it means that every button will be included - isAnyButtonPressStart: function (...gamepadButtonTypesList) { + // if the buttonIDs list is empty for a given gamepad, it means that every button will be included + isAnyButtonPressStart: function (...gamepadButtonIDsList) { let multiplePressCount = null; - let realGamepadButtonTypesList = gamepadButtonTypesList; - if (!isNaN(gamepadButtonTypesList[0])) { - multiplePressCount = gamepadButtonTypesList[0]; - realGamepadButtonTypesList = gamepadButtonTypesList.slice(1); + let realGamepadButtonIDsList = gamepadButtonIDsList; + if (!isNaN(gamepadButtonIDsList[0])) { + multiplePressCount = gamepadButtonIDsList[0]; + realGamepadButtonIDsList = gamepadButtonIDsList.slice(1); } - for (let gamepadButtonTypes of realGamepadButtonTypesList) { - if (gamepadButtonTypes.length == 1) { - for (let key in PP.GamepadButtonType) { - gamepadButtonTypes.push(PP.GamepadButtonType[key]); + for (let gamepadButtonIDs of realGamepadButtonIDsList) { + if (gamepadButtonIDs.length == 1) { + for (let key in PP.GamepadButtonID) { + gamepadButtonIDs.push(PP.GamepadButtonID[key]); } } } let isOnePressStart = false; - for (let gamepadButtonTypes of realGamepadButtonTypesList) { - let gamepad = gamepadButtonTypes[0]; - for (let i = 1; i < gamepadButtonTypes.length; i++) { - let buttonType = gamepadButtonTypes[i]; - let button = gamepad.getButtonInfo(buttonType); + for (let gamepadButtonIDs of realGamepadButtonIDsList) { + let gamepad = gamepadButtonIDs[0]; + for (let i = 1; i < gamepadButtonIDs.length; i++) { + let buttonID = gamepadButtonIDs[i]; + let button = gamepad.getButtonInfo(buttonID); if (button.isPressStart(multiplePressCount)) { isOnePressStart = true; @@ -53,32 +53,32 @@ PP.GamepadUtils = { return isOnePressStart; }, - // gamepadButtonTypesList is a sequence of a gamepads and a list of buttonTypes like this ([gamepad1, squeeze, top, select], [gamepad2, bottom, squeeze, select], ...) + // gamepadButtonIDsList is a sequence of a gamepads and a list of buttonIDs like this ([gamepad1, squeeze, top, select], [gamepad2, bottom, squeeze, select], ...) // if the first parameter is a number it's used as multiplePressCount - // if the buttonTypes list is empty for a given gamepad, it means that every button will be included - areButtonsPressStart: function (...gamepadButtonTypesList) { + // if the buttonIDs list is empty for a given gamepad, it means that every button will be included + areButtonsPressStart: function (...gamepadButtonIDsList) { let multiplePressCount = null; - let realGamepadButtonTypesList = gamepadButtonTypesList; - if (!isNaN(gamepadButtonTypesList[0])) { - multiplePressCount = gamepadButtonTypesList[0]; - realGamepadButtonTypesList = gamepadButtonTypesList.slice(1); + let realGamepadButtonIDsList = gamepadButtonIDsList; + if (!isNaN(gamepadButtonIDsList[0])) { + multiplePressCount = gamepadButtonIDsList[0]; + realGamepadButtonIDsList = gamepadButtonIDsList.slice(1); } - for (let gamepadButtonTypes of realGamepadButtonTypesList) { - if (gamepadButtonTypes.length == 1) { - for (let key in PP.GamepadButtonType) { - gamepadButtonTypes.push(PP.GamepadButtonType[key]); + for (let gamepadButtonIDs of realGamepadButtonIDsList) { + if (gamepadButtonIDs.length == 1) { + for (let key in PP.GamepadButtonID) { + gamepadButtonIDs.push(PP.GamepadButtonID[key]); } } } let areButtonPressedRecently = true; let isOnePressStart = false; - for (let gamepadButtonTypes of realGamepadButtonTypesList) { - let gamepad = gamepadButtonTypes[0]; - for (let i = 1; i < gamepadButtonTypes.length; i++) { - let buttonType = gamepadButtonTypes[i]; - let button = gamepad.getButtonInfo(buttonType); + for (let gamepadButtonIDs of realGamepadButtonIDsList) { + let gamepad = gamepadButtonIDs[0]; + for (let i = 1; i < gamepadButtonIDs.length; i++) { + let buttonID = gamepadButtonIDs[i]; + let button = gamepad.getButtonInfo(buttonID); if (!(button.myIsPressed && (multiplePressCount == null || button.myMultiplePressStartCount == multiplePressCount) && button.myTimePressed < PP.GamepadUtils._mySimultaneousPressMaxDelay)) { areButtonPressedRecently = false; @@ -97,28 +97,28 @@ PP.GamepadUtils = { return areButtonPressedRecently && isOnePressStart; }, - isAnyButtonPressEnd: function (...gamepadButtonTypesList) { + isAnyButtonPressEnd: function (...gamepadButtonIDsList) { let multiplePressCount = null; - let realGamepadButtonTypesList = gamepadButtonTypesList; - if (!isNaN(gamepadButtonTypesList[0])) { - multiplePressCount = gamepadButtonTypesList[0]; - realGamepadButtonTypesList = gamepadButtonTypesList.slice(1); + let realGamepadButtonIDsList = gamepadButtonIDsList; + if (!isNaN(gamepadButtonIDsList[0])) { + multiplePressCount = gamepadButtonIDsList[0]; + realGamepadButtonIDsList = gamepadButtonIDsList.slice(1); } - for (let gamepadButtonTypes of realGamepadButtonTypesList) { - if (gamepadButtonTypes.length == 1) { - for (let key in PP.GamepadButtonType) { - gamepadButtonTypes.push(PP.GamepadButtonType[key]); + for (let gamepadButtonIDs of realGamepadButtonIDsList) { + if (gamepadButtonIDs.length == 1) { + for (let key in PP.GamepadButtonID) { + gamepadButtonIDs.push(PP.GamepadButtonID[key]); } } } let isOnePressEnd = false; - for (let gamepadButtonTypes of realGamepadButtonTypesList) { - let gamepad = gamepadButtonTypes[0]; - for (let i = 1; i < gamepadButtonTypes.length; i++) { - let buttonType = gamepadButtonTypes[i]; - let button = gamepad.getButtonInfo(buttonType); + for (let gamepadButtonIDs of realGamepadButtonIDsList) { + let gamepad = gamepadButtonIDs[0]; + for (let i = 1; i < gamepadButtonIDs.length; i++) { + let buttonID = gamepadButtonIDs[i]; + let button = gamepad.getButtonInfo(buttonID); if (button.isPressEnd(multiplePressCount)) { isOnePressEnd = true; @@ -133,29 +133,29 @@ PP.GamepadUtils = { return isOnePressEnd; }, - areButtonsPressEnd: function (...gamepadButtonTypesList) { + areButtonsPressEnd: function (...gamepadButtonIDsList) { let multiplePressCount = null; - let realGamepadButtonTypesList = gamepadButtonTypesList; - if (!isNaN(gamepadButtonTypesList[0])) { - multiplePressCount = gamepadButtonTypesList[0]; - realGamepadButtonTypesList = gamepadButtonTypesList.slice(1); + let realGamepadButtonIDsList = gamepadButtonIDsList; + if (!isNaN(gamepadButtonIDsList[0])) { + multiplePressCount = gamepadButtonIDsList[0]; + realGamepadButtonIDsList = gamepadButtonIDsList.slice(1); } - for (let gamepadButtonTypes of realGamepadButtonTypesList) { - if (gamepadButtonTypes.length == 1) { - for (let key in PP.GamepadButtonType) { - gamepadButtonTypes.push(PP.GamepadButtonType[key]); + for (let gamepadButtonIDs of realGamepadButtonIDsList) { + if (gamepadButtonIDs.length == 1) { + for (let key in PP.GamepadButtonID) { + gamepadButtonIDs.push(PP.GamepadButtonID[key]); } } } let areButtonNotPressedRecently = true; let isOnePressEnd = false; - for (let gamepadButtonTypes of realGamepadButtonTypesList) { - let gamepad = gamepadButtonTypes[0]; - for (let i = 1; i < gamepadButtonTypes.length; i++) { - let buttonType = gamepadButtonTypes[i]; - let button = gamepad.getButtonInfo(buttonType); + for (let gamepadButtonIDs of realGamepadButtonIDsList) { + let gamepad = gamepadButtonIDs[0]; + for (let i = 1; i < gamepadButtonIDs.length; i++) { + let buttonID = gamepadButtonIDs[i]; + let button = gamepad.getButtonInfo(buttonID); if (!(!button.myIsPressed && (multiplePressCount == null || button.myMultiplePressEndCount == multiplePressCount) && button.myTimeNotPressed < PP.GamepadUtils._mySimultaneousPressMaxDelay)) { areButtonNotPressedRecently = false; @@ -174,28 +174,28 @@ PP.GamepadUtils = { return areButtonNotPressedRecently && isOnePressEnd; }, - isAnyButtonTouchStart: function (...gamepadButtonTypesList) { + isAnyButtonTouchStart: function (...gamepadButtonIDsList) { let multiplePressCount = null; - let realGamepadButtonTypesList = gamepadButtonTypesList; - if (!isNaN(gamepadButtonTypesList[0])) { - multiplePressCount = gamepadButtonTypesList[0]; - realGamepadButtonTypesList = gamepadButtonTypesList.slice(1); + let realGamepadButtonIDsList = gamepadButtonIDsList; + if (!isNaN(gamepadButtonIDsList[0])) { + multiplePressCount = gamepadButtonIDsList[0]; + realGamepadButtonIDsList = gamepadButtonIDsList.slice(1); } - for (let gamepadButtonTypes of realGamepadButtonTypesList) { - if (gamepadButtonTypes.length == 1) { - for (let key in PP.GamepadButtonType) { - gamepadButtonTypes.push(PP.GamepadButtonType[key]); + for (let gamepadButtonIDs of realGamepadButtonIDsList) { + if (gamepadButtonIDs.length == 1) { + for (let key in PP.GamepadButtonID) { + gamepadButtonIDs.push(PP.GamepadButtonID[key]); } } } let isOneTouchStart = false; - for (let gamepadButtonTypes of realGamepadButtonTypesList) { - let gamepad = gamepadButtonTypes[0]; - for (let i = 1; i < gamepadButtonTypes.length; i++) { - let buttonType = gamepadButtonTypes[i]; - let button = gamepad.getButtonInfo(buttonType); + for (let gamepadButtonIDs of realGamepadButtonIDsList) { + let gamepad = gamepadButtonIDs[0]; + for (let i = 1; i < gamepadButtonIDs.length; i++) { + let buttonID = gamepadButtonIDs[i]; + let button = gamepad.getButtonInfo(buttonID); if (button.isTouchStart(multiplePressCount)) { isOneTouchStart = true; @@ -210,29 +210,29 @@ PP.GamepadUtils = { return isOneTouchStart; }, - areButtonsTouchStart: function (...gamepadButtonTypesList) { + areButtonsTouchStart: function (...gamepadButtonIDsList) { let multipleTouchCount = null; - let realGamepadButtonTypesList = gamepadButtonTypesList; - if (!isNaN(gamepadButtonTypesList[0])) { - multipleTouchCount = gamepadButtonTypesList[0]; - realGamepadButtonTypesList = gamepadButtonTypesList.slice(1); + let realGamepadButtonIDsList = gamepadButtonIDsList; + if (!isNaN(gamepadButtonIDsList[0])) { + multipleTouchCount = gamepadButtonIDsList[0]; + realGamepadButtonIDsList = gamepadButtonIDsList.slice(1); } - for (let gamepadButtonTypes of realGamepadButtonTypesList) { - if (gamepadButtonTypes.length == 1) { - for (let key in PP.GamepadButtonType) { - gamepadButtonTypes.push(PP.GamepadButtonType[key]); + for (let gamepadButtonIDs of realGamepadButtonIDsList) { + if (gamepadButtonIDs.length == 1) { + for (let key in PP.GamepadButtonID) { + gamepadButtonIDs.push(PP.GamepadButtonID[key]); } } } let areButtonTouchedRecently = true; let isOneTouchStart = false; - for (let gamepadButtonTypes of realGamepadButtonTypesList) { - let gamepad = gamepadButtonTypes[0]; - for (let i = 1; i < gamepadButtonTypes.length; i++) { - let buttonType = gamepadButtonTypes[i]; - let button = gamepad.getButtonInfo(buttonType); + for (let gamepadButtonIDs of realGamepadButtonIDsList) { + let gamepad = gamepadButtonIDs[0]; + for (let i = 1; i < gamepadButtonIDs.length; i++) { + let buttonID = gamepadButtonIDs[i]; + let button = gamepad.getButtonInfo(buttonID); if (!(button.myIsTouched && (multipleTouchCount == null || button.myMultipleTouchStartCount == multipleTouchCount) && button.myTimeTouched < PP.GamepadUtils._mySimultaneousTouchMaxDelay)) { areButtonTouchedRecently = false; @@ -251,28 +251,28 @@ PP.GamepadUtils = { return areButtonTouchedRecently && isOneTouchStart; }, - isAnyButtonTouchEnd: function (...gamepadButtonTypesList) { + isAnyButtonTouchEnd: function (...gamepadButtonIDsList) { let multiplePressCount = null; - let realGamepadButtonTypesList = gamepadButtonTypesList; - if (!isNaN(gamepadButtonTypesList[0])) { - multiplePressCount = gamepadButtonTypesList[0]; - realGamepadButtonTypesList = gamepadButtonTypesList.slice(1); + let realGamepadButtonIDsList = gamepadButtonIDsList; + if (!isNaN(gamepadButtonIDsList[0])) { + multiplePressCount = gamepadButtonIDsList[0]; + realGamepadButtonIDsList = gamepadButtonIDsList.slice(1); } - for (let gamepadButtonTypes of realGamepadButtonTypesList) { - if (gamepadButtonTypes.length == 1) { - for (let key in PP.GamepadButtonType) { - gamepadButtonTypes.push(PP.GamepadButtonType[key]); + for (let gamepadButtonIDs of realGamepadButtonIDsList) { + if (gamepadButtonIDs.length == 1) { + for (let key in PP.GamepadButtonID) { + gamepadButtonIDs.push(PP.GamepadButtonID[key]); } } } let isOneTouchEnd = false; - for (let gamepadButtonTypes of realGamepadButtonTypesList) { - let gamepad = gamepadButtonTypes[0]; - for (let i = 1; i < gamepadButtonTypes.length; i++) { - let buttonType = gamepadButtonTypes[i]; - let button = gamepad.getButtonInfo(buttonType); + for (let gamepadButtonIDs of realGamepadButtonIDsList) { + let gamepad = gamepadButtonIDs[0]; + for (let i = 1; i < gamepadButtonIDs.length; i++) { + let buttonID = gamepadButtonIDs[i]; + let button = gamepad.getButtonInfo(buttonID); if (button.isTouchEnd(multiplePressCount)) { isOneTouchEnd = true; @@ -287,29 +287,29 @@ PP.GamepadUtils = { return isOneTouchEnd; }, - areButtonsTouchEnd: function (...gamepadButtonTypesList) { + areButtonsTouchEnd: function (...gamepadButtonIDsList) { let multipleTouchCount = null; - let realGamepadButtonTypesList = gamepadButtonTypesList; - if (!isNaN(gamepadButtonTypesList[0])) { - multipleTouchCount = gamepadButtonTypesList[0]; - realGamepadButtonTypesList = gamepadButtonTypesList.slice(1); + let realGamepadButtonIDsList = gamepadButtonIDsList; + if (!isNaN(gamepadButtonIDsList[0])) { + multipleTouchCount = gamepadButtonIDsList[0]; + realGamepadButtonIDsList = gamepadButtonIDsList.slice(1); } - for (let gamepadButtonTypes of realGamepadButtonTypesList) { - if (gamepadButtonTypes.length == 1) { - for (let key in PP.GamepadButtonType) { - gamepadButtonTypes.push(PP.GamepadButtonType[key]); + for (let gamepadButtonIDs of realGamepadButtonIDsList) { + if (gamepadButtonIDs.length == 1) { + for (let key in PP.GamepadButtonID) { + gamepadButtonIDs.push(PP.GamepadButtonID[key]); } } } let areButtonNotTouchedRecently = true; let isOneTouchEnd = false; - for (let gamepadButtonTypes of realGamepadButtonTypesList) { - let gamepad = gamepadButtonTypes[0]; - for (let i = 1; i < gamepadButtonTypes.length; i++) { - let buttonType = gamepadButtonTypes[i]; - let button = gamepad.getButtonInfo(buttonType); + for (let gamepadButtonIDs of realGamepadButtonIDsList) { + let gamepad = gamepadButtonIDs[0]; + for (let i = 1; i < gamepadButtonIDs.length; i++) { + let buttonID = gamepadButtonIDs[i]; + let button = gamepad.getButtonInfo(buttonID); if (!(!button.myIsTouched && (multipleTouchCount == null || button.myMultipleTouchEndCount == multipleTouchCount) && button.myTimeNotTouched < PP.GamepadUtils._mySimultaneousTouchMaxDelay)) { areButtonNotTouchedRecently = false; diff --git a/wle_pp/wle_pp_bundler/js/pp/input/gamepad/gamepad_buttons.js b/wle_pp/wle_pp_bundler/js/pp/input/gamepad/gamepad_buttons.js index b6b7460..7642158 100644 --- a/wle_pp/wle_pp_bundler/js/pp/input/gamepad/gamepad_buttons.js +++ b/wle_pp/wle_pp_bundler/js/pp/input/gamepad/gamepad_buttons.js @@ -1,4 +1,4 @@ -PP.GamepadButtonType = { +PP.GamepadButtonID = { SELECT: 0, // Trigger SQUEEZE: 1, // Grip TOUCHPAD: 2, // This is to support older gamepads, you can just use TOP_BUTTON to use this button for both older and newer gamepads @@ -29,8 +29,8 @@ PP.GamepadAxesEvent = { }; PP.GamepadButtonInfo = class GamepadButtonInfo { - constructor(type, handedness) { - this.myType = type; + constructor(id, handedness) { + this.myID = id; this.myHandedness = handedness; this.myIsPressed = false; @@ -65,8 +65,8 @@ PP.GamepadButtonInfo = class GamepadButtonInfo { this.myPrevMultipleTouchEndCount = 0; } - getType() { - return this.myType; + getID() { + return this.myID; } getHandedness() { @@ -102,7 +102,7 @@ PP.GamepadButtonInfo = class GamepadButtonInfo { } clone() { - let value = new PP.GamepadButtonInfo(this.myType, this.myHandedness); + let value = new PP.GamepadButtonInfo(this.myID, this.myHandedness); value.myIsPressed = this.myIsPressed; value.myPrevIsPressed = this.myPrevIsPressed; value.myIsTouched = this.myIsTouched; diff --git a/wle_pp/wle_pp_bundler/js/pp/input/gamepad/gamepad_cores/gamepad_core.js b/wle_pp/wle_pp_bundler/js/pp/input/gamepad/gamepad_cores/gamepad_core.js index a4a2e80..7b9c555 100644 --- a/wle_pp/wle_pp_bundler/js/pp/input/gamepad/gamepad_cores/gamepad_core.js +++ b/wle_pp/wle_pp_bundler/js/pp/input/gamepad/gamepad_cores/gamepad_core.js @@ -28,7 +28,7 @@ PP.GamepadCore = class GamepadCore { } - getButtonData(buttonType) { + getButtonData(buttonID) { let buttonData = { pressed: false, touched: false, value: 0 }; return buttonData; } diff --git a/wle_pp/wle_pp_bundler/js/pp/input/gamepad/gamepad_cores/keyboard_gamepad_core.js b/wle_pp/wle_pp_bundler/js/pp/input/gamepad/gamepad_cores/keyboard_gamepad_core.js index 7514e40..605454b 100644 --- a/wle_pp/wle_pp_bundler/js/pp/input/gamepad/gamepad_cores/keyboard_gamepad_core.js +++ b/wle_pp/wle_pp_bundler/js/pp/input/gamepad/gamepad_cores/keyboard_gamepad_core.js @@ -39,56 +39,56 @@ PP.KeyboardGamepadCore = class KeyboardGamepadCore extends PP.GamepadCore { } } - getButtonData(buttonType) { + getButtonData(buttonID) { let buttonData = { myIsPressed: false, myIsTouched: false, myValue: 0 }; if (this.isGamepadCoreActive()) { if (this.getHandedness() == PP.Handedness.LEFT) { - switch (buttonType) { - case PP.GamepadButtonType.SELECT: - buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.E) || PP.myKeyboard.isKeyPressed(PP.KeyType.e); + switch (buttonID) { + case PP.GamepadButtonID.SELECT: + buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyID.E) || PP.myKeyboard.isKeyPressed(PP.KeyID.e); break; - case PP.GamepadButtonType.SQUEEZE: - buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.Q) || PP.myKeyboard.isKeyPressed(PP.KeyType.q); + case PP.GamepadButtonID.SQUEEZE: + buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyID.Q) || PP.myKeyboard.isKeyPressed(PP.KeyID.q); break; - case PP.GamepadButtonType.TOUCHPAD: - buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.X) || PP.myKeyboard.isKeyPressed(PP.KeyType.x); + case PP.GamepadButtonID.TOUCHPAD: + buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyID.X) || PP.myKeyboard.isKeyPressed(PP.KeyID.x); break; - case PP.GamepadButtonType.THUMBSTICK: - buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.R) || PP.myKeyboard.isKeyPressed(PP.KeyType.r); + case PP.GamepadButtonID.THUMBSTICK: + buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyID.R) || PP.myKeyboard.isKeyPressed(PP.KeyID.r); break; - case PP.GamepadButtonType.BOTTOM_BUTTON: - buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.C) || PP.myKeyboard.isKeyPressed(PP.KeyType.c); + case PP.GamepadButtonID.BOTTOM_BUTTON: + buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyID.C) || PP.myKeyboard.isKeyPressed(PP.KeyID.c); break; - case PP.GamepadButtonType.TOP_BUTTON: - buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.F) || PP.myKeyboard.isKeyPressed(PP.KeyType.f); + case PP.GamepadButtonID.TOP_BUTTON: + buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyID.F) || PP.myKeyboard.isKeyPressed(PP.KeyID.f); break; - case PP.GamepadButtonType.THUMB_REST: - buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.V) || PP.myKeyboard.isKeyPressed(PP.KeyType.v); + case PP.GamepadButtonID.THUMB_REST: + buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyID.V) || PP.myKeyboard.isKeyPressed(PP.KeyID.v); break; } } else { - switch (buttonType) { - case PP.GamepadButtonType.SELECT: - buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.U) || PP.myKeyboard.isKeyPressed(PP.KeyType.u); + switch (buttonID) { + case PP.GamepadButtonID.SELECT: + buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyID.U) || PP.myKeyboard.isKeyPressed(PP.KeyID.u); break; - case PP.GamepadButtonType.SQUEEZE: - buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.O) || PP.myKeyboard.isKeyPressed(PP.KeyType.o); + case PP.GamepadButtonID.SQUEEZE: + buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyID.O) || PP.myKeyboard.isKeyPressed(PP.KeyID.o); break; - case PP.GamepadButtonType.TOUCHPAD: - buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.M) || PP.myKeyboard.isKeyPressed(PP.KeyType.m); + case PP.GamepadButtonID.TOUCHPAD: + buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyID.M) || PP.myKeyboard.isKeyPressed(PP.KeyID.m); break; - case PP.GamepadButtonType.THUMBSTICK: - buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.Y) || PP.myKeyboard.isKeyPressed(PP.KeyType.y); + case PP.GamepadButtonID.THUMBSTICK: + buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyID.Y) || PP.myKeyboard.isKeyPressed(PP.KeyID.y); break; - case PP.GamepadButtonType.BOTTOM_BUTTON: - buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.N) || PP.myKeyboard.isKeyPressed(PP.KeyType.n); + case PP.GamepadButtonID.BOTTOM_BUTTON: + buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyID.N) || PP.myKeyboard.isKeyPressed(PP.KeyID.n); break; - case PP.GamepadButtonType.TOP_BUTTON: - buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.H) || PP.myKeyboard.isKeyPressed(PP.KeyType.h); + case PP.GamepadButtonID.TOP_BUTTON: + buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyID.H) || PP.myKeyboard.isKeyPressed(PP.KeyID.h); break; - case PP.GamepadButtonType.THUMB_REST: - buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.B) || PP.myKeyboard.isKeyPressed(PP.KeyType.b); + case PP.GamepadButtonID.THUMB_REST: + buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyID.B) || PP.myKeyboard.isKeyPressed(PP.KeyID.b); break; } } @@ -107,15 +107,15 @@ PP.KeyboardGamepadCore = class KeyboardGamepadCore extends PP.GamepadCore { if (this.isGamepadCoreActive()) { if (this.getHandedness() == PP.Handedness.LEFT) { - if (PP.myKeyboard.isKeyPressed(PP.KeyType.W) || PP.myKeyboard.isKeyPressed(PP.KeyType.w)) axes[1] += 1.0; - if (PP.myKeyboard.isKeyPressed(PP.KeyType.S) || PP.myKeyboard.isKeyPressed(PP.KeyType.s)) axes[1] += -1.0; - if (PP.myKeyboard.isKeyPressed(PP.KeyType.D) || PP.myKeyboard.isKeyPressed(PP.KeyType.d)) axes[0] += 1.0; - if (PP.myKeyboard.isKeyPressed(PP.KeyType.A) || PP.myKeyboard.isKeyPressed(PP.KeyType.a)) axes[0] += -1.0; + if (PP.myKeyboard.isKeyPressed(PP.KeyID.W) || PP.myKeyboard.isKeyPressed(PP.KeyID.w)) axes[1] += 1.0; + if (PP.myKeyboard.isKeyPressed(PP.KeyID.S) || PP.myKeyboard.isKeyPressed(PP.KeyID.s)) axes[1] += -1.0; + if (PP.myKeyboard.isKeyPressed(PP.KeyID.D) || PP.myKeyboard.isKeyPressed(PP.KeyID.d)) axes[0] += 1.0; + if (PP.myKeyboard.isKeyPressed(PP.KeyID.A) || PP.myKeyboard.isKeyPressed(PP.KeyID.a)) axes[0] += -1.0; } else { - if (PP.myKeyboard.isKeyPressed(PP.KeyType.I) || PP.myKeyboard.isKeyPressed(PP.KeyType.i) || PP.myKeyboard.isKeyPressed(PP.KeyType.UP)) axes[1] += 1.0; - if (PP.myKeyboard.isKeyPressed(PP.KeyType.K) || PP.myKeyboard.isKeyPressed(PP.KeyType.k) || PP.myKeyboard.isKeyPressed(PP.KeyType.DOWN)) axes[1] += -1.0; - if (PP.myKeyboard.isKeyPressed(PP.KeyType.L) || PP.myKeyboard.isKeyPressed(PP.KeyType.l) || PP.myKeyboard.isKeyPressed(PP.KeyType.RIGHT)) axes[0] += 1.0; - if (PP.myKeyboard.isKeyPressed(PP.KeyType.J) || PP.myKeyboard.isKeyPressed(PP.KeyType.j) || PP.myKeyboard.isKeyPressed(PP.KeyType.LEFT)) axes[0] += -1.0; + if (PP.myKeyboard.isKeyPressed(PP.KeyID.I) || PP.myKeyboard.isKeyPressed(PP.KeyID.i) || PP.myKeyboard.isKeyPressed(PP.KeyID.UP)) axes[1] += 1.0; + if (PP.myKeyboard.isKeyPressed(PP.KeyID.K) || PP.myKeyboard.isKeyPressed(PP.KeyID.k) || PP.myKeyboard.isKeyPressed(PP.KeyID.DOWN)) axes[1] += -1.0; + if (PP.myKeyboard.isKeyPressed(PP.KeyID.L) || PP.myKeyboard.isKeyPressed(PP.KeyID.l) || PP.myKeyboard.isKeyPressed(PP.KeyID.RIGHT)) axes[0] += 1.0; + if (PP.myKeyboard.isKeyPressed(PP.KeyID.J) || PP.myKeyboard.isKeyPressed(PP.KeyID.j) || PP.myKeyboard.isKeyPressed(PP.KeyID.LEFT)) axes[0] += -1.0; } } diff --git a/wle_pp/wle_pp_bundler/js/pp/input/gamepad/gamepad_cores/xr_gamepad_core.js b/wle_pp/wle_pp_bundler/js/pp/input/gamepad/gamepad_cores/xr_gamepad_core.js index b90d546..a8d5e51 100644 --- a/wle_pp/wle_pp_bundler/js/pp/input/gamepad/gamepad_cores/xr_gamepad_core.js +++ b/wle_pp/wle_pp_bundler/js/pp/input/gamepad/gamepad_cores/xr_gamepad_core.js @@ -42,22 +42,22 @@ PP.XRGamepadCore = class XRGamepadCore extends PP.GamepadCore { this._updateHandPose(dt); } - getButtonData(buttonType) { + getButtonData(buttonID) { let buttonData = { myIsPressed: false, myIsTouched: false, myValue: 0 }; if (this.isGamepadCoreActive()) { - if (buttonType < this._myGamepad.buttons.length) { - let gamepadButton = this._myGamepad.buttons[buttonType]; + if (buttonID < this._myGamepad.buttons.length) { + let gamepadButton = this._myGamepad.buttons[buttonID]; - if (buttonType != PP.GamepadButtonType.SELECT && buttonType != PP.GamepadButtonType.SQUEEZE) { + if (buttonID != PP.GamepadButtonID.SELECT && buttonID != PP.GamepadButtonID.SQUEEZE) { buttonData.myIsPressed = gamepadButton.pressed; } else { - buttonData.myIsPressed = this._getSpecialButtonPressed(buttonType); + buttonData.myIsPressed = this._getSpecialButtonPressed(buttonID); } buttonData.myIsTouched = gamepadButton.touched; buttonData.myValue = gamepadButton.value; - } else if (buttonType == PP.GamepadButtonType.TOP_BUTTON && this._myGamepad.buttons.length >= 3) { + } else if (buttonID == PP.GamepadButtonID.TOP_BUTTON && this._myGamepad.buttons.length >= 3) { //This way if you are using a basic touch gamepad, top button will work anyway let touchButton = this._myGamepad.buttons[2]; buttonData.myIsPressed = touchButton.pressed; @@ -130,13 +130,13 @@ PP.XRGamepadCore = class XRGamepadCore extends PP.GamepadCore { } //This is to be more compatible - _getSpecialButtonPressed(buttonType) { + _getSpecialButtonPressed(buttonID) { let isPressed = false; if (this.isGamepadCoreActive()) { - if (buttonType == PP.GamepadButtonType.SELECT) { + if (buttonID == PP.GamepadButtonID.SELECT) { isPressed = this._mySelectPressed; - } else if (buttonType == PP.GamepadButtonType.SQUEEZE) { + } else if (buttonID == PP.GamepadButtonID.SQUEEZE) { isPressed = this._mySqueezePressed; } } diff --git a/wle_pp/wle_pp_bundler/js/pp/input/gamepad/universal_gamepad.js b/wle_pp/wle_pp_bundler/js/pp/input/gamepad/universal_gamepad.js index f1f3e8e..3b3c273 100644 --- a/wle_pp/wle_pp_bundler/js/pp/input/gamepad/universal_gamepad.js +++ b/wle_pp/wle_pp_bundler/js/pp/input/gamepad/universal_gamepad.js @@ -86,12 +86,12 @@ PP.UniversalGamepad = class UniversalGamepad extends PP.BaseGamepad { } } - _getButtonData(buttonType) { + _getButtonData(buttonID) { let buttonData = { myIsPressed: false, myIsTouched: false, myValue: 0 }; for (let core of this._myGamepadCores.values()) { if (core.isGamepadCoreActive()) { - let coreButtonData = core.getButtonData(buttonType); + let coreButtonData = core.getButtonData(buttonID); buttonData.myIsPressed = buttonData.myIsPressed || coreButtonData.myIsPressed; buttonData.myIsTouched = buttonData.myIsTouched || coreButtonData.myIsTouched; if (Math.abs(coreButtonData.myValue) > Math.abs(buttonData.myValue)) { diff --git a/wle_pp/wle_pp_bundler/js/pp/input/pose/components/set_tracked_hand_joint_local_transform.js b/wle_pp/wle_pp_bundler/js/pp/input/pose/components/set_tracked_hand_joint_local_transform.js index b181970..5376ccc 100644 --- a/wle_pp/wle_pp_bundler/js/pp/input/pose/components/set_tracked_hand_joint_local_transform.js +++ b/wle_pp/wle_pp_bundler/js/pp/input/pose/components/set_tracked_hand_joint_local_transform.js @@ -2,7 +2,7 @@ WL.registerComponent('pp-set-tracked-hand-joint-local-transform', { _myHandedness: { type: WL.Type.Enum, values: ['left', 'right'], default: 'left' }, _myFixForward: { type: WL.Type.Bool, default: true }, _mySetLocalScaleAsJointRadius: { type: WL.Type.Bool, default: false }, - _myJointType: { + _myJointID: { type: WL.Type.Enum, values: [ 'Wrist', @@ -17,9 +17,9 @@ WL.registerComponent('pp-set-tracked-hand-joint-local-transform', { }, { init: function () { this._myHandednessInternal = PP.InputUtils.getHandednessByIndex(this._myHandedness); - this._myJointTypeInternal = PP.InputUtils.getJointTypeByIndex(this._myJointType); + this._myJointIDInternal = PP.InputUtils.getJointIDByIndex(this._myJointID); - this._myTrackedHandJointPose = new PP.TrackedHandJointPose(this._myHandednessInternal, this._myJointTypeInternal); + this._myTrackedHandJointPose = new PP.TrackedHandJointPose(this._myHandednessInternal, this._myJointIDInternal); this._myTrackedHandJointPose.setFixForward(this._myFixForward); }, start: function () { diff --git a/wle_pp/wle_pp_bundler/js/pp/input/pose/tracked_hand_joint_pose.js b/wle_pp/wle_pp_bundler/js/pp/input/pose/tracked_hand_joint_pose.js index fdfbfcb..5803a46 100644 --- a/wle_pp/wle_pp_bundler/js/pp/input/pose/tracked_hand_joint_pose.js +++ b/wle_pp/wle_pp_bundler/js/pp/input/pose/tracked_hand_joint_pose.js @@ -1,22 +1,22 @@ PP.TrackedHandJointPose = class TrackedHandJointPose extends PP.BasePose { - constructor(handedness, trackedHandJointType, basePoseParams = new PP.BasePoseParams()) { + constructor(handedness, trackedHandJointID, basePoseParams = new PP.BasePoseParams()) { super(basePoseParams); this._myInputSource = null; this._myHandedness = handedness; - this._myTrackedHandJointType = trackedHandJointType; + this._myTrackedHandJointID = trackedHandJointID; this._myJointRadius = 0; } - getTrackedHandJointType() { - return this._myTrackedHandJointType; + getTrackedHandJointID() { + return this._myTrackedHandJointID; } - setTrackedHandJointType(trackedHandJointType) { - this._myTrackedHandJointType = trackedHandJointType; + setTrackedHandJointID(trackedHandJointID) { + this._myTrackedHandJointID = trackedHandJointID; } getJointRadius() { @@ -28,7 +28,7 @@ PP.TrackedHandJointPose = class TrackedHandJointPose extends PP.BasePose { } _getPose(xrFrame) { - return xrFrame.getJointPose(this._myInputSource.hand.get(this._myTrackedHandJointType), this._myReferenceSpace); + return xrFrame.getJointPose(this._myInputSource.hand.get(this._myTrackedHandJointID), this._myReferenceSpace); } _updateHook(dt, xrPose) { diff --git a/wle_pp/wle_pp_bundler/js/pp/input/pose/tracked_hand_pose.js b/wle_pp/wle_pp_bundler/js/pp/input/pose/tracked_hand_pose.js index a7f12d0..9e5b696 100644 --- a/wle_pp/wle_pp_bundler/js/pp/input/pose/tracked_hand_pose.js +++ b/wle_pp/wle_pp_bundler/js/pp/input/pose/tracked_hand_pose.js @@ -1,12 +1,12 @@ PP.TrackedHandPoseParams = class TrackedHandPoseParams extends PP.BasePoseParams { - constructor(addAllJointTypes = true) { + constructor(addAllJointIDs = true) { super(); - this.myTrackedHandJointTypeList = []; + this.myTrackedHandJointIDList = []; - if (addAllJointTypes) { - for (let typeKey in PP.TrackedHandJointType) { - this.myTrackedHandJointTypeList.push([PP.TrackedHandJointType[typeKey]]); + if (addAllJointIDs) { + for (let key in PP.TrackedHandJointID) { + this.myTrackedHandJointIDList.push([PP.TrackedHandJointID[key]]); } } } @@ -26,9 +26,9 @@ PP.TrackedHandPose = class TrackedHandPose { this._myTrackedHandJointPoseParams.myReferenceObject = this._myReferenceObject; this._myTrackedHandJointPoseList = []; - for (let jointType of trackedHandPoseParams.myTrackedHandJointTypeList) { - let trackedHandJointPose = new PP.TrackedHandJointPose(this._myHandedness, jointType, this._myTrackedHandJointPoseParams); - this._myTrackedHandJointPoseList[jointType] = trackedHandJointPose; + for (let jointID of trackedHandPoseParams.myTrackedHandJointIDList) { + let trackedHandJointPose = new PP.TrackedHandJointPose(this._myHandedness, jointID, this._myTrackedHandJointPoseParams); + this._myTrackedHandJointPoseList[jointID] = trackedHandJointPose; } } @@ -46,23 +46,23 @@ PP.TrackedHandPose = class TrackedHandPose { } } - getJointPose(jointType) { - return this._myTrackedHandJointPoseList[jointType]; + getJointPose(jointID) { + return this._myTrackedHandJointPoseList[jointID]; } - getJointPoseByIndex(jointPoseTypeIndex) { - return this._myTrackedHandJointPoseList[PP.InputUtils.getJointTypeByIndex(jointPoseTypeIndex)]; + getJointPoseByIndex(jointIDIndex) { + return this._myTrackedHandJointPoseList[PP.InputUtils.getJointIDByIndex(jointIDIndex)]; } - addTrackedHandJointType(jointType) { - if (!this._myTrackedHandJointPoseList.pp_has(element => element.getTrackedHandJointType() == jointType)) { - let trackedHandJointPose = new PP.TrackedHandJointPose(this._myHandedness, jointType, this._myTrackedHandJointPoseParams); + addTrackedHandJointID(jointID) { + if (!this._myTrackedHandJointPoseList.pp_has(element => element.getTrackedHandJointID() == jointID)) { + let trackedHandJointPose = new PP.TrackedHandJointPose(this._myHandedness, jointID, this._myTrackedHandJointPoseParams); this._myTrackedHandJointPoseList.push(trackedHandJointPose); } } - removeTrackedHandJointType(jointType) { - this._myTrackedHandJointPoseList.pp_remove(element => element.getTrackedHandJointType() == jointType); + removeTrackedHandJointID(jointID) { + this._myTrackedHandJointPoseList.pp_remove(element => element.getTrackedHandJointID() == jointID); } setReferenceObject(referenceObject) { diff --git a/wle_pp/wle_pp_bundler/js/pp/tool/console_vr/console_vr_widget.js b/wle_pp/wle_pp_bundler/js/pp/tool/console_vr/console_vr_widget.js index a7d5d1e..707cdb0 100644 --- a/wle_pp/wle_pp_bundler/js/pp/tool/console_vr/console_vr_widget.js +++ b/wle_pp/wle_pp_bundler/js/pp/tool/console_vr/console_vr_widget.js @@ -662,8 +662,8 @@ PP.ConsoleVRWidget = class ConsoleVRWidget { _updateGamepadsExtraActions(dt) { if (this._myLeftGamepad && this._myRightGamepad) { - if ((this._myLeftGamepad.getButtonInfo(PP.GamepadButtonType.THUMBSTICK).isPressStart() && this._myRightGamepad.getButtonInfo(PP.GamepadButtonType.THUMBSTICK).myIsPressed) || - (this._myRightGamepad.getButtonInfo(PP.GamepadButtonType.THUMBSTICK).isPressStart() && this._myLeftGamepad.getButtonInfo(PP.GamepadButtonType.THUMBSTICK).myIsPressed)) { + if ((this._myLeftGamepad.getButtonInfo(PP.GamepadButtonID.THUMBSTICK).isPressStart() && this._myRightGamepad.getButtonInfo(PP.GamepadButtonID.THUMBSTICK).myIsPressed) || + (this._myRightGamepad.getButtonInfo(PP.GamepadButtonID.THUMBSTICK).isPressStart() && this._myLeftGamepad.getButtonInfo(PP.GamepadButtonID.THUMBSTICK).myIsPressed)) { this._toggleVisibility(); } diff --git a/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_object_tuners/easy_light_color.js b/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_object_tuners/easy_light_color.js index 54ddd88..2c0ac9d 100644 --- a/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_object_tuners/easy_light_color.js +++ b/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_object_tuners/easy_light_color.js @@ -76,8 +76,8 @@ PP.EasyLightColor = class EasyLightColor extends PP.EasyObjectTuner { light.color[3] = light.color[3]; } - if ((PP.myRightGamepad.getButtonInfo(PP.GamepadButtonType.TOP_BUTTON).isPressStart() && PP.myLeftGamepad.getButtonInfo(PP.GamepadButtonType.TOP_BUTTON).myIsPressed) || - (PP.myLeftGamepad.getButtonInfo(PP.GamepadButtonType.TOP_BUTTON).isPressStart() && PP.myRightGamepad.getButtonInfo(PP.GamepadButtonType.TOP_BUTTON).myIsPressed)) { + if ((PP.myRightGamepad.getButtonInfo(PP.GamepadButtonID.TOP_BUTTON).isPressStart() && PP.myLeftGamepad.getButtonInfo(PP.GamepadButtonID.TOP_BUTTON).myIsPressed) || + (PP.myLeftGamepad.getButtonInfo(PP.GamepadButtonID.TOP_BUTTON).isPressStart() && PP.myRightGamepad.getButtonInfo(PP.GamepadButtonID.TOP_BUTTON).myIsPressed)) { let hsvColor = PP.ColorUtils.color1To255(PP.ColorUtils.rgbToHsv(color)); let rgbColor = PP.ColorUtils.color1To255(color); diff --git a/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_object_tuners/easy_mesh_color.js b/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_object_tuners/easy_mesh_color.js index a115079..4648ad4 100644 --- a/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_object_tuners/easy_mesh_color.js +++ b/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_object_tuners/easy_mesh_color.js @@ -92,8 +92,8 @@ PP.EasyMeshColor = class EasyMeshColor extends PP.EasyObjectTuner { } if (this._myColorType != 6) { - if ((PP.myRightGamepad.getButtonInfo(PP.GamepadButtonType.TOP_BUTTON).isPressStart() && PP.myLeftGamepad.getButtonInfo(PP.GamepadButtonType.TOP_BUTTON).myIsPressed) || - (PP.myLeftGamepad.getButtonInfo(PP.GamepadButtonType.TOP_BUTTON).isPressStart() && PP.myRightGamepad.getButtonInfo(PP.GamepadButtonType.TOP_BUTTON).myIsPressed)) { + if ((PP.myRightGamepad.getButtonInfo(PP.GamepadButtonID.TOP_BUTTON).isPressStart() && PP.myLeftGamepad.getButtonInfo(PP.GamepadButtonID.TOP_BUTTON).myIsPressed) || + (PP.myLeftGamepad.getButtonInfo(PP.GamepadButtonID.TOP_BUTTON).isPressStart() && PP.myRightGamepad.getButtonInfo(PP.GamepadButtonID.TOP_BUTTON).myIsPressed)) { let hsvColor = PP.ColorUtils.color1To255(PP.ColorUtils.rgbToHsv(color)); let rgbColor = PP.ColorUtils.color1To255(color); diff --git a/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_object_tuners/easy_text_color.js b/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_object_tuners/easy_text_color.js index 35702ca..0a9e286 100644 --- a/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_object_tuners/easy_text_color.js +++ b/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_object_tuners/easy_text_color.js @@ -78,8 +78,8 @@ PP.EasyTextColor = class EasyTextColor extends PP.EasyObjectTuner { textMaterial[this._myColorVariableNames[this._myColorType]] = color; } - if ((PP.myRightGamepad.getButtonInfo(PP.GamepadButtonType.TOP_BUTTON).isPressStart() && PP.myLeftGamepad.getButtonInfo(PP.GamepadButtonType.TOP_BUTTON).myIsPressed) || - (PP.myLeftGamepad.getButtonInfo(PP.GamepadButtonType.TOP_BUTTON).isPressStart() && PP.myRightGamepad.getButtonInfo(PP.GamepadButtonType.TOP_BUTTON).myIsPressed)) { + if ((PP.myRightGamepad.getButtonInfo(PP.GamepadButtonID.TOP_BUTTON).isPressStart() && PP.myLeftGamepad.getButtonInfo(PP.GamepadButtonID.TOP_BUTTON).myIsPressed) || + (PP.myLeftGamepad.getButtonInfo(PP.GamepadButtonID.TOP_BUTTON).isPressStart() && PP.myRightGamepad.getButtonInfo(PP.GamepadButtonID.TOP_BUTTON).myIsPressed)) { let hsvColor = PP.ColorUtils.color1To255(PP.ColorUtils.rgbToHsv(color)); let rgbColor = PP.ColorUtils.color1To255(color); diff --git a/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_tune_widgets/easy_tune_widget.js b/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_tune_widgets/easy_tune_widget.js index 9e5da38..49cbb61 100644 --- a/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_tune_widgets/easy_tune_widget.js +++ b/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_tune_widgets/easy_tune_widget.js @@ -185,8 +185,8 @@ PP.EasyTuneWidget = class EasyTuneWidget { _updateGamepadWidgetVisibility() { if (this._myGamepad) { - if ((this._myGamepad.getButtonInfo(PP.GamepadButtonType.BOTTOM_BUTTON).isPressStart() && this._myGamepad.getButtonInfo(PP.GamepadButtonType.TOP_BUTTON).myIsPressed) || - (this._myGamepad.getButtonInfo(PP.GamepadButtonType.TOP_BUTTON).isPressStart() && this._myGamepad.getButtonInfo(PP.GamepadButtonType.BOTTOM_BUTTON).myIsPressed)) { + if ((this._myGamepad.getButtonInfo(PP.GamepadButtonID.BOTTOM_BUTTON).isPressStart() && this._myGamepad.getButtonInfo(PP.GamepadButtonID.TOP_BUTTON).myIsPressed) || + (this._myGamepad.getButtonInfo(PP.GamepadButtonID.TOP_BUTTON).isPressStart() && this._myGamepad.getButtonInfo(PP.GamepadButtonID.BOTTOM_BUTTON).myIsPressed)) { this._toggleVisibility(); } } @@ -217,7 +217,7 @@ PP.EasyTuneWidget = class EasyTuneWidget { } _updateGamepadScrollVariable(dt) { - if (this._myGamepad && (!this._mySetup.myScrollVariableButtonType || this._myGamepad.getButtonInfo(this._mySetup.myScrollVariableButtonType).myIsPressed)) { + if (this._myGamepad && (!this._mySetup.myScrollVariableButtonID || this._myGamepad.getButtonInfo(this._mySetup.myScrollVariableButtonID).myIsPressed)) { let x = this._myGamepad.getAxesInfo().myAxes[0]; let y = this._myGamepad.getAxesInfo().myAxes[1]; if (Math.abs(x) > this._mySetup.myScrollVariableMinXThreshold && Math.abs(y) < this._mySetup.myScrollVariableMaxYThreshold) { diff --git a/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_tune_widgets/easy_tune_widget_setup.js b/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_tune_widgets/easy_tune_widget_setup.js index 9f724ee..e0f7dcf 100644 --- a/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_tune_widgets/easy_tune_widget_setup.js +++ b/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_tune_widgets/easy_tune_widget_setup.js @@ -10,7 +10,7 @@ PP.EasyTuneWidgetSetup = class EasyTuneWidgetSetup { this.myScrollVariableDelay = 0.5; this.myScrollVariableMinXThreshold = 0.6; this.myScrollVariableMaxYThreshold = 0.25; - this.myScrollVariableButtonType = null; + this.myScrollVariableButtonID = null; this.myRefreshVariablesDelay = null; }