[sectionBegin," Using Layers ",0,"ZScript Primer (Press to expand this section)",
	[varDef,zbPrimerTempOpenLY][varDef,zbInitDocSavedLY,0][varDef,zbInitSavedDocLY,""]
	[iPress,7442]
	[if,(zbPrimerTempOpenLY),
		[iKeyPress,'N',[iPress,document:newdocument]]
	, // else
		[if,[messageYesNo,"OK to clear all customized tools, lights and materials?","DOCUMENT MUST BE CLEARED BEFORE PROCEEDING..."],
			[if,[isEnabled,document:save],
				[if,[messageYesno,"Would you like to save this document before proceeding?","Document has not been saved."],
					[iPress,document:saveas]
					[varSet,zbInitSavedDocLY,[fileNameGetLastUsed]]
					[varSet,zbInitDocSavedLY,1]
				] // end if (user saves)
			] // end if (save enabled)
			[Note,"One moment please...",,2]
			[iKeyPress,13,[iReset]]
			[varSet,zbPrimerTempOpenLY,1]
		, // else (user won't reset)
			[iUnPress,0][exit]
		] // end if (wanna reset?)
	] // end if PrimerTemp
	[Note,"This primer describes ZBrush Layers: convenient groupings of paint and objects that can be manipulated in different ways.",layer:,-1]
	[Note,"\n\n\C909090(Click to continue)\Cc0c0c0",,0]
] // end sectionBegin
[pd][paintBackSliver,2,40,40,40][pd]
In traditional paint programs, layers are like sheets of clear film with flat images on each. Changing the order of the layers gives the illusion of bringing some images closer to you, the viewer.

ZBrush layers are different; they are 3-dimensional. Each layer incorporates its elements' positions in space, including how near or far they are from you, the viewer.

[iButton,"Press this button","Click to begin",
	[iPress,tool:sphere3D]
	[iColorSet,255,50,50]
	[iSet,material:itemInfo,1]
	[iSet,texture:itemInfo,0]
	[canvasClick,200,240,200,242]
	[transformSet,200,240,0,160,160,160,0,0,0]
	
	[iPress,layer:inventory:create]
	[iPress,tool:cube3D]
	[iColorSet,50,50,255]
	[iSet,material:itemInfo,1]
	[iSet,texture:itemInfo,0]
	[canvasClick,440,240,440,242]
	[transformSet,440,240,0,120,120,120,45,0,45]
] // end iButton
to draw two objects on two separate layers (note that the first layer is always enabled). In this example the red sphere is drawn on the first layer; a second layer is [buttonFind,layer:inventory:create,created] and the blue cube is drawn on it. Notice how the two objects collide with each other; they are sitting side by side in the drawing space, rather than simply sitting one in front of the other.

Note the highlight around the second layer [buttonFind,3843,"show me"]. This indicates it's the active layer, which means any objects drawn will be put on this layer. You can change the active layer two ways: [FontSetSizeMedium]([PenMove,4])[PenMove,-15,6][FontSetSizeSmall]1[PenMove,5,-6][FontSetSizeMedium] by clicking on an inactive layer's icon, and [FontSetSizeMedium]([PenMove,4])[PenMove,-15,6][FontSetSizeSmall]2[PenMove,5,-6][FontSetSizeMedium] by holding the 'Tilde' key ('~', usually located in the upper-left corner of the keyboard) and clicking on anything drawn on the canvas; the layer that contains that object is selected.

You can turn each layer on and off by clicking on its icon once to make it the active layer, then again to turn it on or off [iButton,"show me","Turn the layer on and off",
	[iUnpress,3843]
	[iPress,3842]
	[delay,1]
	[iPress,3843]
	[iPress,3843]
]. // end iButton
Turning a layer off has the effect of removing all its elements from the drawing space, until that layer is turned on again.

You can move a layer, and everything it contains, in any direction. You can bring it closer or further away [iButton,"show me","Move layer in the Z direction",
	[iShow,layer:modifiers:displacez,1]
	[iSet,layer:modifiers:displacez,-60]
	[delay,1.]
	[iSet,layer:modifiers:displacez,120]
	[delay,1.]
	[iSet,layer:modifiers:displacez,-60]
], // end iButton
move it left and right [iButton,"show me","Move layer horizontally",
	[iShow,layer:modifiers:displaceh,1]
	[iSet,layer:modifiers:displaceh,-30]
	[delay,1.]
	[iSet,layer:modifiers:displaceh,60]
	[delay,1.]
	[iSet,layer:modifiers:displaceh,-30]
], // end iButton
and up and down [iButton,"show me","Move layer vertically",
	[iShow,layer:modifiers:displacev,1]
	[iSet,layer:modifiers:displacev,-30]
	[delay,1.]
	[iSet,layer:modifiers:displacev,60]
	[delay,1.]
	[iSet,layer:modifiers:displacev,-30]
]. // end iButton
You can also move a layer horizontally or vertically by holding the 'Tilde' key and clicking and dragging within the document window. 

You can duplicate a layer, which creates an exact copy of the layer and everything it contains, and continue working with it [iButton,"show me","Duplicate the layer",
	[iPress,layer:inventory:dup]
	[iSet,layer:modifiers:displacev,-30]
	[delay,.76]
	[iSet,layer:modifiers:displacev,60]
	[delay,.75]
	[iSet,layer:modifiers:displacev,-30]
]. // end iButton

The [buttonPress,layer:modifiers:w,"W button"], which stands for "Wrap", is a powerful feature. When moving a layer horizontally or vertically, everything that scrolls off one edge re-appears on the opposite edge, if this is pressed [buttonSet,layer:modifiers:displaceh,110,"show me"]. One way you can use this feature is to help you create tiles in a seamless texture.

If the W button is un-pressed, wrapping does not occur and whatever scrolls off the edge is simply cut off at the edge of the canvas [iButton,"show me","Turn off wrapping",
	[iUnpress,layer:modifiers:w]
	[iSet,layer:modifiers:displacev,-120]
	[delay,1]
	[iSet,layer:modifiers:displacev,120]
	[iPress,layer:modifiers:w]
]. // end iButton
[pd]
You can merge layers, which simply combines all elements from two layers onto one [buttonPress,layer:inventory:mrg,"show me"]. Pressing the [buttonFind,layer:inventory:mrg,"Merge button"] causes the current layer to merge with the layer to the left of it. You can reposition layers by selecting them and swapping them with the layer to the [buttonFind,layer:inventory:<<,left] or to the [buttonFind,layer:inventory:>>,right].

You can fill a layer with the current material and texture (or single color if [buttonFind,texture:txtr00,"Texture Off"] is selected) [iButton,"show me","Fill this layer with a color",
	[iSet,texture:itemInfo,24]
	[iSet,material:itemInfo,11]
	[iPress,layer:modifiers:fill]
]. // end iButton

In this example, the [buttonFind,28601,"World Map texture"] and [buttonFind,28501,"Spherical Intensity material"] are selected, then the [buttonFind,layer:modifiers:fill,Fill] button is pressed. Note that filling removes everything from the layer beforehand.

You can also flip an entire layer horizontally [buttonPress,layer:modifiers:fliph,"show me"] or vertically [buttonPress,layer:modifiers:flipv,"show me"].

Finally, you can clear entire layers [buttonPress,layer:modifiers:clear,"show me"]. You can also delete layers, removing them entirely from the palette. Note that there must always be at least one layer defined, so you can only delete the [buttonFind,3842,first] layer if there is at least one more layer enabled.

[iButton," Return to your original (saved) document ","Return to your original file",
	[fileNameSetNext,zbInitSavedDocLY]
	[if,[isEnabled,document:save],
		[iKeyPress,'N',[iPress,document:open]]
	, // else nothing to save
		[iPress,document:open]
	] // end if
	[varSet,zbInitSavedDocLY,""]
	[varSet,zbInitDocSavedLY,0]
	[varSet,zbPrimerTempOpenLY,0]
] // end iButton
[pd][pd][paintBackSliver,2,40,40,40][pd][sectionEnd] // end of Using Layers

