ZBrushCentral

Remove subpalette and reload script when debugging?

I’m working on a Zscript and I’m looking to speed up my debugging and testing process. My Zscript creates a new subpalette. I would like to find a way to clear the subpalette and reload the script without having to restart ZBrush, because it’s a pain having to close and open ZBrush each time I make a change to the script.

I find my process going like this…

  1. Make edits to the Zscript .txt file in a text editor. Add new functionality.

  2. Open ZBrush and go Zscript > Load. The script creates a subpalette.

  3. Test the new functionality on the subpalette. If there are errors…

  4. Restart ZBrush and repeat from 1.

Any thoughts?

Thank you!

David

I just tried adding a button to the subpalette that attempts to delete the subpalette, but it doesn’t seem to do anything. Not sure if this is possible…

[ IButton, “Zplugin:My Script:Delete Subpalette”, , [ IClose, “Zplugin:My Script” ] , , 1 ]

nope it doesn’t works since 2021, the issue has been reported, just keep the fingers crossed to so it vanished away by the dev team. I had personally informed Paul, and the support of the cruel bug which do not reload the UI, and brick you script when you get a message box for an code error in your RoutineDef.

So personally for conception and research i am still using ZBrush 2020.
I have attached macro that show up how to hot reload a plugin.

Hope it Helps!
Nicolas

/*
 @ Version : 1.0
 @ Category : Learning
 @ Tags : ["hotreload", "plugin", "script", "ICLose", "IExists", "FileNameSetNExt", "IPress"]
 @ Status : released
 @ Purpose : "Hot Reload a script or a plugin with Ui interface without to restart ZBrush."
 */

[RoutineDef, reload_zscript,

	// first check if the subpalette exists	
	[If, [IExists, "Zplugin:Plugin Name"],
		// then remove it from the UI.
		[IClose, "Zplugin:Plugin Name"]
	]

	// set the path to the script or plugins
	[FileNameSetNext, "ZBRUSH_ZSTARTUP\ZPlugs64\plugin_name.txt"]

	// then load the zscript with that path.
	[IPress, "ZScript:load"]
]

[IButton,"???","Hot Reload a script or a plugin with Ui interface without to restart ZBrush.",
	[IShowActions,0]
	[IConfig,2020]
	[RoutineCall, reload_zscript]
]

Thanks Nicolas! @facelessmindz

This is great. Yeah, I wasn’t able to get it to work in 2021, so I’m going to try to download 2020. I’m having a hard time trying to find where to download old versions though…

David

you must to contact the support so they can send you a link for a specific build, and I am using the 2020.1.3 version.
Nicolas