ZBrushCentral

Questions; Using markers to restore an object, how best to delete a 3D object

Below is a small script I wrote to investigate why my use of markers isn’t working. Basically, it draws a sphere, marks the sphere, empties the canvas, and then clicks on the marker to restore the sphere.

First, a few things I already know; the marker is set properly, at (200,200), and clicking at that location by hand after the script runs does restore the sphere. Apparently it is the final “CanvasClick” which isn’t working as expected.

Second; is there a better way to empty the canvas? The roundabout way I’m doing it is to choose the simple brush and paint a bit with it, to force the current 3d object to be painted to the canvas, so that a layer clear will then clear everything. But it would be more elegant if I could simply delete the 3d object itself.

[RoutineDef, Init,

// Make and mark sphere. [IPress, "Marker:Tool"] [IPress, "Tool:Sphere3D"] [IPress, "Stroke:DragDot"] [CanvasClick, 200, 200] [IPress, "Transform:Mark Object Position"] // Clear the canvas. Is there a better way to do this? [IPress, "Tool:SimpleBrush"] [CanvasClick, 100, 100] [IPress, "Layer:Clear Layer"] // Restore the marked object--but it doesn't work [CanvasClick, 200, 200]

]

[RoutineCall, Init]

Thanks,
Ken

have you tried [Ipress,EDIT:UNDO] or [Ipress,Document:UNDO]

see what works best for you

try [CanvasClick, 200, 200, 200, 200 ]

Sven

[CanvasClick, 200, 200]
[CanvasClick, 200, 200]

Thanks for all the help. Sven’s and digit’s suggestions were clever, but don’t work :-). Marcus, yours works under some cases, but under other cases gives an unwanted snapshot of the object on the canvas. See the thread I’ve just started, “Newbie Tips”, for a full solution.

Thanks everyone,
Ken

Kenny,

I’m not really sure what you’re doing in your sample up there, but here’s a simple two button script that uses the TRANSFORM:Marker tool. It’s what works for me… every time.

// Script to redraw a markered sphere

[IButton," draw sphere ", "place original sphere...",
	[IPress, PREFERENCES:Init ZBrush ]					// start new canvas
	[Note, "draw, mark, erase and redraw a sphere", , 4 ]

	[IPress, TOOL:Sphere3d]								// select sphere tool
	[CanvasClick, 200, 200, 300, 300 ]					// draw sphere with 100 unit radius
	[IPress, TRANSFORM:Edit ]								// go to edit mode
	[Note, "sphere drawn", , 2 ]							// message and 2 second pause

	[ISet, MARKER:On/Off, 1 ]								// set marker on
	[ISet, MARKER:Delete All, 1]							// clear any existing markers
	[ISet, MARKER:Tool, 1]									// set so Tool ID is saved with marker
	[IPress, TRANSFORM:Mark ]							// set marker
	[IUnPress, TRANSFORM:Edit ]							// leave edit mode
	[IPress,EDIT:Undo ]										// remove sphere tool 
	[Note, "Sphere markered, press redraw... ", , 3 ]	// message and 2 second pause
]

[PenMove, 5 ]
[IButton, " redraw ", "display previously marked sphere",
	[CanvasClick, 200,200,200,200]						// restore sphere tool based on marked data and location
	[IPress, Transform:Edit ]								// place sphere tool in edit mode
	[Note, "sphere redrawn", , 2 ]
]

Sven

Sven,
Having tested your script example I find it works perfectly satisfactorily with just
[CanvasClick, 200, 200].
I’m interested as in what circumstances you found it necessary to add the drag to 200, 200?

Hi Marcus,

Yup, you’re right. [CanvasClick, 200, 200] works perfectly well in this script. I’ll have to look through old scripts to find the reason I always use [CanvasClick, 200, 200, 200, 200], which also works perfectly well in this script.

It may be that it’s something I arrived at from a particular set of circumstances I can’t off hand remember right now. When I run across it I’ll send you an email. :wink:

At any rate, the one thing to avoid with MM, is stranding an extra clone of the markered object that becomes visible only after you translate, rotate or otherwise edit your newly restored object.

Sven

Hi Sven,

Thanks. :slight_smile: Good point about the extra clone, as Ken found out when testing my solution to his problem.