Apply Left/Right button Mappings to all applications?

Questions and answers about 3Dconnexion devices on Windows.

Moderator: Moderators

Post Reply
Framed_Previz90
Posts: 13
Joined: Sat May 23, 2020 8:31 pm

Apply Left/Right button Mappings to all applications?

Post by Framed_Previz90 »

Hello guys.

I have recently bought myself a spacemouse wireless. Extremely pleased with it so far.

I would like the keys mapped to the left/right buttons to be applied to every application (but the gnob settings to remain app specific).

I cant find the settings for this. the UI will only let me mapp for the last active window. Any idea how I can achieve this?

Thanks :)
Framed_Previz90
Posts: 13
Joined: Sat May 23, 2020 8:31 pm

Re: Apply Left/Right button Mappings to all applications?

Post by Framed_Previz90 »

Hey Jwick!

Firstly, I am on windows 10

For example, Page down and Page up. But the keys are not important, I would like to learn how to do this myself.
After reading your post about .xml files I took about one hour and tried to do it manually with notepad.xml as an example.

It seems there is more than one place I need to change. I got as far as getting the correct keys to show on 3DX button assignment window but pressing them would not work in notepad, not even after refreshing 3DX service.

Finally, I generated two notepad.xml with their own unique mappings through the 3DX service and replacing between the two of them in appdata directory works, without restarting 3DX service.



I am your usual suspect, so I use

Maya
Photoshop
Zbrush
sketchup
Etc
etc

Your post history tells me you are a 3DX engineer and a knowledgable memeber of this forum, I would like to ask you for some advice please;

In Maya. The Spacemouse knob can only be used to navigate the viewport even if another window belonging to Maya is active. I know, this is desirable as it lets one work paralel.

But I want to achieve these two objectives.
  • If the graph editor is active, the knob should only trigger keyboard keys and those keys should only affect Graph editor window.
    As soon as the view port is active, the knob should default back to navigation.
  • In any context. if Button 1 is held down, then the knob should should only trigger keyboard keys. kind of like a modifier (Ctr+A)


I looked around and found third party software called UCR, it does the two points above but it has a flaw. there is 2-3 second delay every time the knob changes from firing keys to doing viewport navigation.


My experiment with notepad.xml tells me this is possbile. I have some programing experience with Python and Autohotkey.
I can essentailly get files moved/copied to the 3DX appdata directory if certain conditions are met.
I dont need to restart 3DX service. I think it would be fast enough but it feels like the dirty way to do it.

Am I over looking something here? Is there something I can use in the .xml files to help me do this in a more elegant way
than overwriting .xml files every time?




I would like to keep my hand on the Spacemouse at all times just like my mouse. I really need this. So any help would be greatly appreciated.
jwick
Moderator
Moderator
Posts: 3331
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Apply Left/Right button Mappings to all applications?

Post by jwick »

You bring up several very good ideas.

There are ways of doing these things, completely undocumented, and rarely tested. And there's no GUI to help you.

There's nothing wrong with copying files around. The driver has to read the entire file anyway. So there's not much difference between changing one line or changing the entire file.
The only real difference is that any changes made in one file, will not be reflected in the other.

The only caveat is that if you want to use a new file, you probably have to get the other file out of the directory. The driver doesn't use the filenames. It uses the contents of the file. If it finds two files with the same "signature", it will use the first one it finds and ignore the other.

If you turn logging on (3Dx systray icon->Write Log File), the log file may tell you what is wrong with the files that aren't behaving the way you want. The log file is at %localappdata%\3dconnexion\3dxware\3DxService.log.

You may want to assign your buttons to run executables/scripts to do the copying for you. For this you need a ButtonAction of type="Exe". E.g.,

Code: Select all

    <ButtonAction Type="Exe">
      <ID>VBS_RunSample</ID>
      <Name>Run Sample VBS</Name>
      <Executable>cscript.EXE</Executable>
      <Arg>e:\mytemp\vbs\samples.vbs SaveDir dirname1 c:\tmp</Arg>
    </ButtonAction>
    
Generally, the driver always follows focus to an app-specific cfg. There are two exceptions:
  • Global.xml: you can assign Button/Axis Actions that are used in preference to app-specific actions (they override). E.g., I use these to always have +/- scaling available in every app
  • Desktop.xml: you can temporarily switch to this cfg by pressing a button. E.g., if you want to use it in the Maya graph editor window. Many people use this to switch to a 2D mouse mode (control the system cursor).
It's hard with only two buttons on a device to get too clever. The SpaceMouse Enterprise with the LCD that shows what is going on, is more useful to advanced usage.

You might want to try launching Radial Menus off the two buttons to give yourself more flexibility.
Framed_Previz90
Posts: 13
Joined: Sat May 23, 2020 8:31 pm

Re: Apply Left/Right button Mappings to all applications?

Post by Framed_Previz90 »

Thank you so much for your prompt reply. You have answered a few key questions that I had. If only every forum is like this.. :D
The driver has to read the entire file anyway. So there's not much difference between changing one line or changing the entire file.
This is great news. One last question though, how often does the driver read the .xml files? I am thinking every time an input occurs on the hardware it checks on the .xml files. If thats so then, then its very ideal.


The only caveat is that if you want to use a new file, you probably have to get the other file out of the directory.
I will propably just over write it and make acceptions for those times when I have saved changes to back up.


Desktop.xml: you can temporarily switch to this cfg by pressing a button. E.g., if you want to use it in the Maya graph editor window. Many people use this to switch to a 2D mouse mode (control the system cursor).
This sounds incredible, any idea how I can get hold of this file?

It's hard with only two buttons on a device to get too clever. The SpaceMouse Enterprise with the LCD that shows what is going on, is more useful to advanced usage.
This makes perfect sense, especially since my hand would always be resting on it but I am always on the move between offices and home. So the Spacemouse is most ideal.



Since posting my question I have also discovered, there is a wealth of information here, so I will take to reading them to fill in the blanks. Great news!
jwick
Moderator
Moderator
Posts: 3331
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Apply Left/Right button Mappings to all applications?

Post by jwick »

The forum is extremely useful for us to find out what issues customers are having, and things they want. I always look forward to getting feedback.

The operating system notifies the driver when you change a file. It is independent of the device.

The use of the Desktop.xml file is detailed here.

When you get deeper into this I can suggest better solutions. Without the GUI, you will have to get good at editing XML files. Some of this more complicated configuration branching is relatively easy to describe but difficult to design a GUI that people can understand.

I don't currently have a solution for completely globally overriding buttons and axes. It works "most of the time". Some applications require further workarounds.
Post Reply