ZScript Tutorial Window Interfaces

From ZBrush Info

Jump to: navigation, search

Contents

Tutorial Window Interfaces

The Tutorial Window is at the bottom of the ZBrush interface. You open it by clicking or dragging the handle, or pressing the hotkey 'H'. The 'Play' button for zscript recordings displays here and it is the default location for zscript buttons and sliders.

Attractive and functional interfaces can be designed for the Tutorial Window. There are special commands for specifying the placement of interface elements, setting text display properties, and the opening and closing of separate UI elements. Images can be used for the background and as button icons. All this means that the Tutorial Window offers great flexibility for interface design.

Here is an example:
ZScript Window UI example

However, there is a drawback with Tutorial Window interfaces. Only one zscript (or plugin or macro) can be active at a time, so the moment another zscript/plugin/macro is called any zscript that uses the Tutorial Window for its interface will disappear. This can become very tiresome if your zscript is one that users will need throughout a ZBrush session as it means they will have to keep reloading it. But for single-run special operations that require a complex interface, the Tutorial Window offers the best options.

Designing Tutorial Window Interfaces

The positioning of elements in the Tutorial Window is done by an invisible Pen for which there is a group of commands. By first specifying the Pen position, each interface item can be placed accurately. Measurements are in pixels:

[PenMove,10,5]//moves the Pen 10 pixels to the right and 5 pixels down

See here for the many commands for ZScript Tutorial Window interfaces.

Tips & Tricks

When creating a Tutorial Window interface it is generally desirable to have the window open a set amount, so that the whole interface is visible. In ZBrush 3.1, the Tutorial Window is closed by default, so it makes sense to have the code open the window when the zscript is loaded. This method was first suggested by TVeyes in this thread at ZBC.


[VarDef,ZwindowHeight,100]/*Set to your desired window height*/
[VarDef,Init,1]/*Used for running the code below once*/
[If,Init,/*if Init is 1, returns true*/
[If,[IHeight,1006]< ZwindowHeight,
[If,[IHeight,1006]> (ZwindowHeight-4),
[IClick,1002,[IHPos,1002]+100,[IVPos,1002],[IHPos,1002]+100,([IVPos,1002]-10)]/*Move Zscript Divider down 10 pixels*/
]
[IClick,1002,[IHPos,1002]+100,[IVPos,1002],[IHPos,1002]+100,(([IVPos,1002]+[IHeight,1006])-ZwindowHeight)]/*Set Zscript Divider to ZwindowHeight*/
]
[If,[IHeight,1006] > ZwindowHeight,
[If,[IHeight,1006] < (ZwindowHeight+4),
[IClick,1002,[IHPos,1002]+100,[IVPos,1002],[IHPos,1002]+100,([IVPos,1002]-10)]/*Move Zscript Divider down 10 pixels*/
]
[IClick,1002,[IHPos,1002]+100,[IVPos,1002],[IHPos,1002]+100,(([IVPos,1002]+[IHeight,1006]) -ZwindowHeight)]/*Set Zscript Divider to ZwindowHeight*/
]
[VarSet,Init,0]/*stops the code repeating*/
]/*end If*/



Tutorial Window Sample Code

For some sample code for creating a Tutorial Window interface see ZScript Example: Tutorial Window interface.

Personal tools
Editing ZBrushInfo