User Tools

Site Tools


Set Universal View Tool Coordinate Space

Summary

Below is an example demonstrating how you can set the coordinate space of the universal view tools, via script.

API Areas of Interest

Example

View_Tool_Set_Coordinate_Space.dsa
// DAZ Studio version 4.10.0.72 filetype DAZ Script
 
// Define an anonymous function;
// serves as our main loop,
// limits the scope of variables
(function(){
 
	// Get the viewport manager
	var oViewportMgr = MainWindow.getViewportMgr();
	// If we do not have a viewport manager
	if( !oViewportMgr ){
		// We are done...
		return "";
	}
 
	// Find the tool;
	// DzUniversalTool, DzUniversalRotateTool, DzUniversalTranslateTool, DzUniversalScaleTool
	var oTool = oViewportMgr.findTool( "DzUniversalTool" );
	// If the tool was not found
	if( !oTool ){
		// We are done...
		return;
	}
 
	// If the active tool is not the tool we want
	if( !pointersAreEqual( oTool, oViewportMgr.getActiveTool() ) ){
		// Change the active tool to the one we want
		oViewportMgr.setActiveTool( oTool );
	}
 
	// If the apppliation version is older than 4.11.0.52
	if( App.version64 < 0x0004000b00000034 ){
		// Set the coordinate space of the tool
		// World = 0
		// Local = 1
		// Object = 2
		// Camera = 3
		// Gimbal = 4
		oTool.setSpace( 0 );
	// If the apppliation version is 4.11.0.52 or newer
	} else {
		// Set the coordinate space of the tool
		oTool.setCoordinateSpace( DzUniversalTool.WorldSpace );//DzUniversalTool.LocalSpace
	}
 
// Finalize the function and invoke
})();