ZBrushCentral

arrays, button, and load/save file help

is there a way to create arrays in zscript, or are you limited to just variables?

also, i am creating a zscript where you can save a file by clicking a button. im using the [filenameask] command, but in the cmd it says that the proper way to write it would be this for loading a file
(replace the bold large a with small arrows)

[FileNameAsk,"DXF (*.dxf)a *.dxfa OBJ (*.obj)a *.objaa,,"Please select a file to load"]

so am i supposed to write the > sign where the arrows are, or do i need to find the hex code for that arrow symbol and type it using alt+numpad?

and my final question, i am working on a plugin where i can save a .zce file (no im not gonna tell you what it stands for) and i was wondering if i can define somewhere what data it saves ( i know how to retrieve the data) and i was also wondering if i had to write a section that tells zbrush how to interpret (sp?) the data in the save file.

wow, this is like, the fifth time im editing this post to add a question.

i was wondering if you could create one of those buttons that turns on and off, like the edit button or the x,y,z mirror buttons.

  1. Creating arrays is easy, you simply define a list variable, in this example for a string:

[VarDef,listofthings(30),""]
[VarSet,listofthings(0),"apple"]
[VarSet,listofthings(1),"pear"]
and so on.

It is possible to have a list of different types of data. Define it but don’t assign a value. This is handy if you want to save out different list variables as a single file (using VarListCopy and VarSave):

[VarDef,MySettings(30),]

2)Use a vertical line:

[FileNameAsk,"DXF (*.dxf)| *.dxfa OBJ (*.obj)| *.obj||,,"Please select a file to load"]

3)I’m not aware that you can define file formats for handling by ZBrush so you can only load your own formats through your plugin/zscript.

4)Use [ISwitch].

i was thinking that i could have the save file be a bunch of variables that the plugin interprets when the file is opened. and i guess i would have to write a dll file that tells it how to save the file though. my plugin is mostly done though ( well the first part of it).

also i just realized this, in the zanimator plugin you can save your animations as zan files, i think. so there must be a way to define how to save your own file type.

There are a number of ways that you can specify a file name and you can invent any extension you wish for some of them. For example you might simply write a memory block to file like this:

[MemSaveToFile,My_Mem_Block,"Data\MyProject.zpg"]

You can use [FileNameAsk] followed by an appropriate action (such as [MemCreateFromFile]) to save or load any files from within your plugin, and then simply apply whatever functions are appropriate to the data.

Note that [VarSave] will automatically use the .zvr extension.

i am looking at all these mem commands and they are a bit confusing, but the big thing is that the command rerence says they need to be placed inside a container command, but it doesnt tell you what kind of container.

A container is a Zscript command that can include (or contain) other Zscript commands.

The containers are: IButton ISlider ISwitch SectionBegin IFreeze * IKeyPress If * Loop * RoutineDef Sleep *

The coontainers I marked with an * (and the commands within them) are executed as soon as Zbrush encounters them, furthermore they can be placed as top level commands. This is especially useful for something you need to happen as soon as your Zscript is loaded.

For example, your memory commands could be placed inside a container at the top level of your Zscript, which simply means outside any other containers. Take a look:

[If, [MemGetSize, MyMemoryBlock],
   //Do nothing, memoryblock already exists
   ,
   //Memory block does not exist. Create it.
   [MemCreate, MyMemoryBlock, 128]
   ]
   
   [Ibutton, ExampleButton, ,
   //Commands placed here are first executed when ExampleButton is pressed
   [MVarSet, MyMemoryBlock, 12, 65432]
   ]
There is also a special instance container called ZSphereEdit which is needed to contain the various ZSphere* commands.

o thats freakin perfect i had no idea there were zsphere commands! can you use these to set sizes and change zsphere color, and limit how big they can get ect?, (im making a plugin where i want to create something similar to the rigging ability in zbrush 2.5 where you can draw the mesh but its made out of tiny orange zspheres, but it has nothing to do with riging)

You can get/set various properties for individual Zspheres and add or delete Zspheres. Check out the ZScript Command Reference for the full list of Zsphere properties.