ZBrushCentral

Camera_Rotationxyz and Object_Rotationxyz

I know how to get the values of Rotx, Roty and Rotz of the 3dWorld where I’m looking at. As I understood I can do that with TransformGet. But, as the title of this thread already implies am I in need of a ZScript function to ascertain the Rotation xyz values of the active tool itself, when a specific erea of the tool is facing the camera.;
I have found some workaround: With the mouse I turn the active tool so that the area of interest of the tool is facing the ‘Camera’/me, the onlooker.
TransformGet will give me the Rotxyz-values in relation to the Frontview. And these values I can use for:

[TransformGet,xPos, yPos, zPos, xSc, ySc, zSc, xRot, yRot, zRot]
[TransformSet, (Document:Width*.5), (Document:Height*.5), 0, 100, 100, 100, 0, 0, 0]
[IModSet,Tool :smiley: eformation:Rotate,1] //Tool :smiley: eformationDimOpX
[ISet,Tool :smiley: eformation:Rotate,xRot]
[IModSet,Tool :smiley: eformation:Rotate,2] //Tool :smiley: eformationDimOpY
[ISet,Tool :smiley: eformation:Rotate,yRot]
[IModSet,Tool :smiley: eformation:Rotate,4] //Tool :smiley: eformationDimOpZ
[ISet,Tool :smiley: eformation:Rotate,zRot]

This workaround is a little bit clumsy, because in most cases I need more than ones to reposition manually the area of interest really facing me, then again let the zscript recalculate and then I approach gradually the desired situation in which the area of interest is facing me WHILE I am in frontview.

That is the position in which I can do certain things with the mesh for which I make this zscript.

So, my question is, I hope, clear now: If I could directly measure the Rotxyz-values of the active tool itself, when the area of iterest is facing me, I could probably solve this riddle more directly by simply Rotating the tool back towards its Rot000-value?

Greetings, EddyL

The way the model is first drawn on the canvas [with a vertical downward stroke] will give you its 0,0,0 rotation values. The Tool:Preview window will also show this more accurately. You can adjust the 0,0,0 rotation of your model by rotating it in the Tool:Preview and then pressing Store. Once you know the default starting position you can use TransformGet and TransformSet to adjust your model as you wish.

EDIT: If you set the model rotation using the Deformation slider you are setting the model’s default setting in the same way as by adjusting the Preview.

Hi Marcus,

As usual you have helped me to go further in my quest for ultimate zbcontrol :rolleyes:
Although I did not ge from you a simple formula/ZScriptfunction to use, I know now a straightforward way to accomplish my goal.

Because of this coming success the moment for posting my plugin-work comes close, but … I don’t know how and in which format I should post the plugin itself. Please give me some info how to do tis, then I can soon post my first plugin.

Greetings, EddyL

Hi Marcus,
I forget to ask you a probably simple question: after I have rotated the model’s own orientation in the Tool:Preview I apply this new ‘look’ with Tool:Preview:Store. Only now this change will be the case for my mesh in the workarea.
Then I can do my thing with it, etc. That’s what I understand.

If, after all the work done to the model I want to give it it’s old orientation back I can not do this precisely in the Tool:Preview.
Sure, I can do that with trial and error with Tool:Deformation:Rotation (Rotx,Roty,Rotz), maybe there is a more direct ad accurae approach?

Greetings again, EddyL

Eddy,

When you want to post your plugin, you need to zip together the plugin .zsc file and any other files/folders the plugin uses and post in a new thread in the ZScript Utilities Forum . Make sure you give clear instructions as to what the plugin does.

On restoring your model’s original orientation: if you are adjusting the model in the Tool:Preview I don’t think there is an easy way of restoring the previous setting, once Store has been pressed. The only way I can think of is to just use the Deformation:Rotation slider to make your adjustments and keep a record of the changes, reversing them when you want to restore things.

Hi Marcus,

You replied some days ago in this thread:

On restoring your model’s original orientation: if you are adjusting the model in the Tool:Preview I don’t think there is an easy way of restoring the previous setting, once Store has been pressed. The only way I can think of is to just use the Deformation:Rotation slider to make your adjustments and keep a record of the changes, reversing them when you want to restore things.

My new question: How do I keep a record of the changes while being in ZScript. Is there a way to input this into, say, a variableRotX, variableRotY, variableRotZ? I tried: [VarSet, variableX,[StrAsk,“type variableX hier”]]
but on this ZB crashes. If that where be possible, I could first move with the Deformation,Rotate (X) slider and put this value when asked for bij the script.

Greetings, EddyL

Eddy,

Apologies for the delay in replying.

It seems that StrAsk will crash ZBrush if it does not have all its arguments. Just make sure that you have two commas after StrAsk and all should be well (you could include some text for initial input and title). To make sure that StrAsk returns a number, declare the variable (in this case, variableX) as a number type and any text that is input will return 0, numbers their value:


[VarDef,variableX,0]


[VarSet,variableX,[StrAsk,"type here","Please enter a rotation value"]]

An alternative way of getting input for the sliders would be to have a slider as part of the plugin and get the user to set that - this would then set the Deformation slider and record the value.

HTH,