Can you set a hotkey to switch between Local and World coordinates? (solved, ty)

SnowSultanSnowSultan Posts: 3,837
edited 1:52AM in The Commons

I've been using another program recently that lets you simply press the Translate or Rotate hotkey button again to switch between Local and World coordinates, and it makes a gigantic difference in ease of use. Can we set a hotkey in Studio to switch between these modes? I looked in the Customize menu, but could not find anything. The only way appears to be to click on the button in the Tools panel. Thanks in advance for any information.

Post edited by SnowSultan at

Comments

  • Richard HaseltineRichard Haseltine Posts: 111,411
    edited September 10

    Save this as a script, make it into a custom action, and then in Window>Workspace>Customise right-click on it on the left, under Custom, and assign a keyboard shortcut. It toggles between local and world only, any other coordinate systems are not changed.

    It works in DS 4 (as long as it is new enough to have the options, tested in 4.24) and DS 6

    // DAZ Studio version 4.24.0.4 filetype DAZ Script
    // Toggle Coordinate System
    // (c) Richard Haseltine, 2026
    
    // Switches the coordinate system used by a transform tool between Local and World
    // Does nothing is other systems active, or other tools active
    
    function toggleCoords () {
    	// Get the Viewport Manager
    	var oVPMgr = MainWindow.getViewportMgr();
    	if ( ! oVPMgr ) {
    		return;
    	}
    	
    	// From the Viewport Manager get the active tool
    	var oActTool = oVPMgr.getActiveTool();
    	if ( ! oActTool ) {
    		return;
    	}
    	
    	// Check that it is a node posing tool
    	if ( ! oActTool.inherits( "DzTransformTool" ) ) {
    		return;
    	}
    	
    	// Get the coordinate system in use
    	var oCS = oActTool.getCoordinateSpace();
    	
    	// We are interested only in World or Local
    	if ( oCS != DzUniversalTool.WorldSpace && oCS != DzUniversalTool.LocalSpace ) {
    		return;
    	}
    	
    	print ( "Got here" );
    	
    	// toogle the coordinate system
    	if ( oCS == DzUniversalTool.WorldSpace ) {
    		oActTool.setCoordinateSpace ( DzUniversalTool.LocalSpace )
    	}
    	else {
    		oActTool.setCoordinateSpace ( DzUniversalTool.WorldSpace )
    	}
    }
    
    toggleCoords();
    
    Post edited by Richard Haseltine on
  • SnowSultanSnowSultan Posts: 3,837

    Thank you very much, but how do I save this as a script?

  • Copy it and paste it into Window>Panes(Tabs)>ScriptIDE and use its own file menu, or just paste it into a text editor (Notepad will do if you don't have anything better) and when you save it choose the all formats option and add .dsa at the end (you don't want it to add its own .txt extension).

  • SnowSultanSnowSultan Posts: 3,837

    Thank you, it works great! I didn't realize it was for the Universal Tool at first, but it seems to be fine. Much appreciated.   :)

Sign In or Register to comment.