ZBrushCentral

ZScript improvements, Possible?

Hi there,
I just started to play with ZScript(already have programming experience), and i found that some very useful funcions just not exist…
Subtool acces improvements

  • get subtool Name
  • rename subtool
  • or atleast set unique ID to duplicated subtools
  • ideally

Multi-Dimensional arrays
all i found on that was this forum post from 2004 year… and no, that not working for some reason.

  • possibility to assign array as part of another array.

Interface elements
- maybe some additional flag on functions like iSet/Ipress/iUnpress, so they wont trigger same action on element used.
For example, i made two sliders that should have same values if Option triggered. But if i simply write something like this in press action of slider:

[ISet,Zplugin:TileBuddy:Columns,[IGet,Zplugin:TileBuddy:Rows]] 

[ISet,Zplugin:TileBuddy:Rows,[IGet,Zplugin:TileBuddy:Columns]]

i’ll get infinite cycle and Zbrush will crash, so i have to make cycle prevention mechanism.

Or i need selection toggle element (for example 4 iSwitch, and just one should be active at same time), i cant just say: “if you was pressed, unpress all other”, why? i need atleast one to be pressed, so i mapped IPress action to unpress section of a toggle and now code looks like this:

	[ISwitch, "Zplugin:TileBuddy:BR", 0, "Bottom Right Corner", 		[IUnpress,Zplugin:TileBuddy:UL][IUnpress,Zplugin:TileBuddy:UR][IUnpress,Zplugin:TileBuddy:BL],
		[if, ([IGet, Zplugin:TileBuddy:UL]==0)&&([IGet, Zplugin:TileBuddy:UR]==0)&&([IGet, Zplugin:TileBuddy:BL]==0),[Ipress,Zplugin:TileBuddy:BR]],
		0,20]

From here i can propound to make new element with multiple switch elements, or new key to ISwitch to group them.

I’m not a pro at coding, and most things i did looks like hacks, but i dont see another way. And i see no way to do some things without improved access to subtools

Yes, certainly there is room for improvement. However, zscript is deliberately a simple scripting language so that non-coders can get to grips with it easily. Part of that is keeping the number of commands to a fairly small number. Inevitably that means that some commands that you may make heavy use of elsewhere will be missing, but most things can be done with a little creativity (or ‘hacks’ if that’s how you want to think of it).

For example, the name for the selected subtool can be got using:


[VarSet, subToolName,[IGetTitle,Tool:Item Info]]
[VarSet, subToolName,[StrExtract,subToolName,0,[StrLength,subToolName]-2]] // trims off end period '.'

The Item Info slider is the slider at the top of the Tool Palette (the Alpha, Brush, Material and Texture palettes have similar ‘Item Info’ sliders).

HTH,

The problem here is that if you want write something really cool and complex, you should be a coder, maybe partially, but coder, and no matter, if you are artist atm, you should learn how to code, and in contrast to other scripting languages, Zscript dont provide so much useful functionality.

I can understand that ZScript was made for artists and intended mostly to be used for small macros, so here are simple solution, not for developers, but for artists.
Do like Autodesk did with Maya, implement Python/Lua support with extended API.

For example, the name for the selected subtool can be got using:

[VarSet, subToolName,[IGetTitle,Tool:Item Info]]
[VarSet, subToolName,[StrExtract,subToolName,0,[StrLength,subToolName]-2]] // trims off end period ‘.’

The Item Info slider is the slider at the top of the Tool Palette (the Alpha, Brush, Material and Texture palettes have similar ‘Item Info’ sliders).

Thank you, this make possible some improvements for my plugin, but that will be huge hack coz i dont need just subtool name :slight_smile: i need to rename subtool(not save subtool>rename File>import subtool), ideally i want to access subtools by their ID(atm i should get to the top and move down till i get what i need).

When i come to code with Zscript i feel like i got cut 6 fingers out of 10, that’s it. Cant judge from common artist perspective, but when you going to code something, and looking at new scripting language, you expect that you will get something familiar to previous experience :slight_smile:

So in my opinion here are two ways:

  1. Let common artists work with Zscript, and implement support of some higher level language.
  2. Extend ZScript to something more powerful (i dont really think that wealth of choice will somehow affect artists, ZBrush itself is wealth of choice :). Maya users are artists too, and Mel let them do everything they want, nobody cries about complexity )
  3. Leave it as is and let me cry :smiley:

PS: from coder perspective this kind of creativity called hacks or workarounds 8)
PPS: just watched Nick Miller’s Eat3D “ZScripting with ZBrush” intro, and i dont think that “finding creative ways to workaround this limitations” is good, it makes development with ZScript more complex, than if it will have more functions

It’s possible to rename a subtool by importing an empty file with a “.dat” extension. Creating the file is easy enough using zscript but to delete it afterwards the ZFileUtils dll would have to be used. See the code snippet below:


//routine to create a file to import to change tool name
[RoutineDef,NameMesh,
	[If,[MemGetSize,MC_Namer],[MemDelete,MC_Namer]]
	[MemCreate,MC_Namer,1]
	[MemWriteString,MC_Namer," ",0,0]
	[MemSaveToFile,MC_Namer,newName]
	[MemDelete,MC_Namer]
,newName]//end routine

//routine to rename a subtool
[RoutineDef,RenameSubTool,
  [VarSet,newFile,[StrMerge,"PluginData\",newName,".dat"]]
  [RoutineCall,NameMesh,newFile]
  [FileNameSetNext,#newFile]
  [IPress,Tool:Import]
  [VarSet,subTName,#fle]
  //need to use ZFileUtils to delete the file
  [RoutineCall,DeleteFile,[FileNameResolvePath,newFile]]
]