ZBrushCentral

Programmatically store and rename a camera

Hey guys, been a while…
I need to script a few actions centered around the draw:cameras subpalette.

In particular:

  1. Store camera and rename it using a variable

  2. Load an image onto the camera from the texture palette

I tried this and a few other ideas but the input text popup will block the script

        [Note, "Importing plate image...", , 1]

        [FileNameSetNext, #outputImagePath]

        [IPress, Texture:Import]

       

        // --- Store and Rename Camera using ZFileUtils.RenameSetNext ---

        [Note, "Storing camera view with image name...", , 1]

        [VarSet, imageName, [FileNameExtract, #outputImagePath, 2]]  // Get filename from path

        [VarSet, cameraName, [StrMerge, "test_", #imageName]]  // Create the desired camera name

       

        // Store the camera first

        [IPress, Draw:Cameras:Store Cam]

       

        // Use the exact pattern from the working example

        [VarSet, buttonPath, "Draw:Cameras:Rename"]

        [If, (([IExists, #buttonPath]) && ([IsEnabled, #buttonPath])),

            [FileExecute, [Var, dllPath], RenameSetNext, #cameraName]

            [IPress, #buttonPath]

        ]

Found the routine in zfileutilsinc.txt

///////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////// Bypass renaming user input box //
/////////////////////////////////////////////////////////////////////////////
// Set the name to use instead of asking to the user
// @str: the text/string that will be substituted to the user input
[RoutineDef, ZFU_RenameSetNext,
	[FileExecute, [Var, dllPath], RenameSetNext, str]
, str]

// Rename "something" by giving the path to the button that ask for the rename box
// @buttonPath: the path of the button that asks the user to rename "something"
// @str: the text/string that will be substituted to the user input
[RoutineDef, ZFU_RenameFromButtonPath,
	[If, (([IExists, buttonPath]) && ([IsEnabled, buttonPath])),
		[FileExecute, [Var, dllPath], RenameSetNext, str]
		[IPress, buttonPath]
	]
, buttonPath, str]