User Tools

Site Tools

Toggle Universal View Tool Snapping


Below is an example demonstrating how you can toggle snapping of the universal view tools, via script.

API Areas of Interest


// DAZ Studio version filetype DAZ Script
// Define an anonymous function;
// serves as our main loop,
// limits the scope of variables
	// Get the viewport manager
	var oViewportMgr = MainWindow.getViewportMgr();
	// If we do not have a viewport manager
	if( !oViewportMgr ){
		// We are done...
	// Get the active view tool
	var oTool = oViewportMgr.getActiveTool();
	// If the tool does not inherit the class we want;
	// e.g., DzUniversalTool, DzUniversalRotateTool,
	// DzUniversalTranslateTool, DzUniversalScaleTool
	if( !oTool.inherits( "DzUniversalTool" ) ){
		// We are done...
	// Toggle the snapping tool setting
	oTool.setSnapTranslation( !oTool.getSnapTranslation() );
	//oTool.setSnapRotation( !oTool.getSnapRotation() );
	//oTool.setSnapScale( !oTool.getSnapScale() );
// Finalize the function and invoke