ZBrushCentral

Loading variables from a text file

Hi again and thanks for the tips on getting started with ZBrush scripting. I now have a basic script up and running for loading .obj files and .bmp files with hardcoded names etc.
Here’s the script so far (obviously it won’t work if you don’t have the same hardcoded assets):

// Begin ZScript
[PenMove, 0, -10]
[Title,“Remedy ZBrush Tools”][pd]
[Caption,“v0.01c by SamiV”][pd]
[PenMove, 0, -50]
[IButton,“Import from 3dsmax”,“Imports an OBJ and its textures”,
[IShowActions,0]

// Import mesh, plants it somewhere and puts on Edit mode
[FileNameSetNext,“D:\Cleaner.obj”]
[IPress,Tool:Import]
[CanvasStroke,(ZObjStrokeV02n21=H1B3V156H1B3V157H1B3V158H1B3V159H1B3V15AH1B3V15BH1B3V15CH1B3V15EH1B3V15FH1B3V160H1B3V161H1B3V162H1B3V163H1B3V164H1B3V166H1B3V167H1B3V168H1B3V169H1B3V16AH1B3V16BH1B3V16B)]
[IPress,Transform:Edit]

// Import textures and flip the Y
[FileNameSetNext,“D:\Temp\Textures\Cleaner_Body_C.bmp”]
[IPress,Texture:Import]
[IPress,Texture:Flpv]
// Other misc setup
[IUnPress,Draw:Rgb] // Disable Rgb by default
,160,16
]
// End ZScript

Now, the next thing I want to do is to load all the hardcoded strings such as “D:\Cleaner.obj” and “D:\Temp\Textures\Cleaner_Body_C.bmp” etc from a config file, which I can output when exporting the geometry originally from 3ds.

The ZScriptCommandsList talks a little bit about the MemReadString and MemCreate etc, but I don’t really have a grasp on how to use them yet. I somehow feel a bit uneasy dealing with memory manually since I’ve grown used to scripting languages doing it automatically.

My other alternative is to dynamically create the “Import.txt” every time I export something out of 3dsmax, but then the ZBrush user will always have to manually hit “Reload” for the tool when jumping between 3ds and ZBrush.

Anyway, I was wondering if anyone has any samples on how to exactly load data from a text file and use that as a variable in a recursion loop loading files etc?

Thanks, SamiV.

Hi Sami,
i don’t know a method to open a text file from script…
Maybe with [MemCreateFromFile] statements…
Another method is to write a .zvr, but i suspect you can’t decode the zvr format :cry: and then you can create zvr only with ZBrush.

cameyo