S pivot C pivot rotation issue

I wanted to make a post to see if its possible in zbrush to remember/store rotation of a substool. What I want to script is something that stores the rotation of the subtool when in C Pivot and S Pivot.

How it would work in practice: An upper arm guard mesh on a char (char stance is a natural pose). It sits in the correct location on the char arm and is a symmetrical part (C Pivot). But when I press S pivot the mesh goes to the center location AND ROTATES to face the camera correctly allowing one to have a cleanly aligned mesh to work with. When C Pivot is pressed it snaps back to the original position and rotation on the arm regardless if remeshing or dyna meshing has taken place in S Pivot.

Currently it only supports the subtool’s position.



There are two sorts of rotation in ZBrush and both can be changed through zscript:

  1. Rotation in the document (viewport). This is the equivalent of changing the camera view. You can use the MTransformGet and MTransformSet commands (and also the TransformGet/TransformSet but there is a limit of 1024 on scale values). This affects the whole model and all its subtools.

  2. Rotation relative to world space. You can use the Tool>Deformation>Rotate slider, using IModSet to change the axes. This affects the current subtool only and so changes its rotation relative to the other subtools. Using this method you’d need to store the values used so that they could be reversed later.