Overriding Undo

Hi! I am new to open brush, I am trying to find action maps of xr controls but i am unable to find that. Can you please tell me where can i find that?
10 Replies
andybak
andybakโ€ข2y ago
@mikesky did most of the work on the new input system but it appears to be in Scripts\Input\UnityXRInput.inputactions and UnityXRInputAction.cs I think the latter is generated from the former? (or the other way round. No idea why Unity needs it done this way!)
UsamaTKD
UsamaTKDOPโ€ข2y ago
Thank you!! found it!!!!
mikesky
mikeskyโ€ข2y ago
Glad you found it! Yep we've got some mask for specific controllers, part of how we deal with the valve index grips. we apply these masks in https://github.com/icosa-gallery/open-brush/blob/main/Assets/Scripts/Input/UnityXRControllerInfo.cs#L66
GitHub
open-brush/Assets/Scripts/Input/UnityXRControllerInfo.cs at main ยท ...
Open Brush is the open source, community led evolution of Tilt Brush! Forked from https://github.com/googlevr/tilt-brush - icosa-gallery/open-brush
UsamaTKD
UsamaTKDOPโ€ข2y ago
That is amazing! You guys are awesome!! can you please tell me where can i find the undo action? I have found a static method named "Undo" in a partial class named "ApiMethods". is this the one that is responsible for undo action on controller? I want to disable undo action so i can perform my own functionality on it!!
andybak
andybakโ€ข2y ago
Ah OK. We don't use maps in that way currently (although that would be better - we are working with the code we inherited from Tilt Brush which was written before the new Unity Input System existed) Open Brush has it's own layer of mapping between physical buttons etc and internal actions In this specific case you probably want to look at SketchControlsScript and GlobalCommands.Undo
case GlobalCommands.Undo:
SketchMemoryScript.m_Instance.StepBack();
break;
case GlobalCommands.Undo:
SketchMemoryScript.m_Instance.StepBack();
break;
Many actions (but not all) are implemented as global commands and are handled in that big case/switch block (earlier on you can see this:
else if (InputManager.m_Instance.GetCommandDown(InputManager.SketchCommands.Undo) &&
CanUndo())
{
IssueGlobalCommand(GlobalCommands.Undo);
}
else if (InputManager.m_Instance.GetCommandDown(InputManager.SketchCommands.Undo) &&
CanUndo())
{
IssueGlobalCommand(GlobalCommands.Undo);
}
that's where it interfaces with input actions - but you probably want to change the first location
andybak
andybakโ€ข2y ago
(incidentally this is a great example of the XY Problem: https://en.wikipedia.org/wiki/XY_problem - your question was originally "where are the input action maps" but what you were really asking was "how do I override undo?" ๐Ÿ™‚ )
XY problem
The XY problem is a communication problem encountered in help desk, technical support, software engineering, or customer service situations where the question is about an end user's attempted solution (Y) rather than the root problem itself (X).The XY problem obscures the real issues and may even introduce secondary problems that lead to miscomm...
UsamaTKD
UsamaTKDOPโ€ข2y ago
Sorry for the confusion!! i will be careful next time!! Thanks for helping me
andybak
andybakโ€ข2y ago
No problem! Most people do similar ๐Ÿ™‚ The trick is to give some background when you're asking a question so we know what your ultimate goal is (easy for me to say - I am guilty of this as much as anyone!) I'm just fascinated by how often the XY concept applies.
UsamaTKD
UsamaTKDOPโ€ข2y ago
I did not know about this xy problem. Glad to know that!! Thanks! Question!! what is the purpose of maps then?
mikesky
mikeskyโ€ข2y ago
in our case it's enforcing a specific input for controllers that don't function as 'standard', a few cases: - index controller's 'grip' is extremely sensitive, therefore we need to use 'grip force'. 'grip' would override 'grip force' unless we used the map - pico 3 controller doesn't have touch sensitive thumbsticks, which the current input system uses to ensure proper thumbstick movement. (I want to change this, but haven't gotten around to it). so instead, Pico 3 has an emulated 'joystick touch' that triggers based on the thumbstick being tilted slightly. again this is an override property and needs it's own mapping I admit it's not ideal, but it was the easiest way to fit it in with the old-style Tilt Brush system. My aim was to upgrade to OpenXR, not rewrite the entire input stack ๐Ÿ˜„
Want results from more Discord servers?
Add your server