ZBrushCentral

few basic questions

ok i think i will do somthing like that :

Technically i can to load several plugin using a macro, it load only the first plugin. ( get bored of the limitations really…)
Well it loads the first plugin (plugin_A), then when the first plugin is loaded it start the loading of the “plugin B” and same apply to load plugin C at the end of plugin B…
it was impossible to do that using the macro that execute a routine that differ the loading of the Zsc files.

LEt’s pretend i provide a copy of each Zbrush default user layout

so we got this in the final package:

what should be in the final package :


  • Zplugs/plugindatadirector/ (common plugin resource)
  • Zplugs/plugin_a.zsc
  • Zplugs/plugin_b.zsc
  • Zplugs/plugin_c.zsc
  • Zstartup/macro/gametools/loadplugin.zsc to move in your macro folder
  • Zstartup/userInterfaceLayout/
  • GT_minimal.cfg
  • GT_default.cfg
  • GT_compact_ui.cfg
  • etc…

from scripting i can load any of the interface layout, even none customize one.
if i create interfaceLayout it 's because i can’t to script the creation of the new menu
if the user want to use the plugin with his custom layout he only have to create the new menu, and puch a button from macro :GameTools:LoadPlugin.

i found a tweak but it doesn’t works properly… ( get tired of this really , i want to get back to the content of the plugin not the structure of it ;/)

Well, ive created a macro that generate the “Gametools:About” subpalette : ( check below )

//ZBRUSH MACRO - Recorded in ZBrush version 4.73
[IButton,???,“Press to run this macro. Macros can be aborted by pressing the ëescí key.”,
[IShowActions,0]
[IConfig,4.73]
//[If, [IExists, “GameTools”],
[ISubpalette, “GameTools:About”]

//,//else //[Note, "Gametools doesn't exists",,2] //]

]

This “About” subpalette is a key for the plugin to load in my custom menu , without it it cannot load the plugin.


i even try to emulate the keyboard when i go enable customize and then Create menu
i can’t to defined the text to enter here “GameTools” with the use of [Ikeypress] it doesn’t works :frowning:

Zbrush drives me crazy :confused:

i started to port the code of my full plugin, to the plugin_A
and now i got some [Iswitch that are not at the top level.
because is use this method :[If, [IExists, “GameTools”],

[ISubPalette, “GameTools:PSD Document Bridge”]

[ISwitch, “GameTools:PSD Document Bridge:Mat”,

So i tried that more as a curiosity but…
[If, [IExists, “GameTools”],

[ISubPalette, “GameTools:PSD Document Bridge”]

<zscriptinsert, “gametools_define.zsc” >


…It worked, but now plugin_A refuse to compile because there is a lot of comment in my plugin, how it could be different…

Zbrush hates me :frowning:

1- the issue described here.
2- create a supalette without to ask the user to create by himself in the custom menu.
3- create the custom menu using zscript, the one that is the less important.

if i can be sure i create a custom menu from the plugin_a loading
and that i can to add that subpalette in that Custom Menu, I don’t need this any more :

[if, [IExist,“customMenu”],

//UI stuff with button and switch
[Iswitch,

I hope for something i missed, really.

ahahah i answer to myself for point 1.

[If, [IExists, “GameTools:About”] = 0,
[Exit]
]

i didn’t think Exit, would simply stop the execution of the full script like ui etc… but it does !
so it prevent the plugin to crash at loading if the custom menu doesn’t exist.

but I still have to be reloaded from the macro. or with the help of “Zscript/DefaultZscript.txt” .

so now i can continue to port my code ;)))

I’m sorry, I’ve not had much time to look at this but if you are trying to load plugins from another plugin (or macro or zscript) then you will run into problems. ZBrush doesn’t allow more than one plugin/macro/zscript to be active at a time, so the moment your code has [IPress,ZScript:Load] (or presses a button on another plugin) your code will stop running. Control has passed to the other plugin and will not pass back to your plugin.

You can use <zscriptinsert> to add another zscript to your code but that is no different to including the code in the first place. It can be useful for organizational purposes and code reuse but it isn’t a way of getting around the limitations of zscript.

As far as creating custom layouts through zscript is concerned it is a long time since I tried and failed - I simply decided that it was too problematic. Especially moving buttons etc. around. For the naming side of things I recently added a “PasteText” function to the ZFileUtils dynamic library which you might find does the trick (the examples are for naming a Layer or SubTool but it should work whenever ZBrush asks for text input. Note that it comes with no guarantees!):
http://docs.pixologic.com/user-guide/customizing-zbrush/zscripting/zfileutils/#pasteText

HTH,

Hey Marcus, good to see you :slight_smile:
i am finishing the port and i will tell you this.
i think it depends how the plugins “a, b and c” are structured
at the moment the only thing that doesn’t work correctly are some switch button, but because it must to read the button status, that are into the part i still have to port.
i need to finish this so i could tell you how it works.

example : from plugin A

using [Iget, “plugin C:SwitchButton”] will works.

but if you need to use [Iset, “plugin C:SwitchButton”, 1]

the code must to be included into the plugin C

Following this rules and i might have something that work properlly.

grea and thx for pasteText, I don’t think i have the need of this, if the process to add my plugin into a custom ui is two steps

  1. enable customize > create new menu,
  2. the user enter “GameTools” and done.
  3. macro > macros > gametools>loadplugin

last question ? any success to create a subpalette using scripting when the custom menu already exists ?
it works partially, the subpallette is added on top of the menu but prevent me from clicking on the gametools menu.

this is the code i am using :
[If, [IExists, “GameTools”],
[ISubpalette, “GameTools:About”]

,//else [Note, "Gametools doesn't exists",,2] ]

It works Marcus ! it works, i can render set my render passes and render from plugin C, then when done i got into the psd bridge (plugin 1) and it read well the render options to figure out the format file,etc… so it ****ing works :slight_smile:

only one stuff that doesn’t work now, the switch into the plugin 1 doesn’t works
i think i must to enable all switchs button from the plugin_C.

I will confirm you this !

ok i run into too much issues now :slight_smile:

impossible to fix the issue with the switch buttons

some routine code that are define in plugin A and run from plugin A and that need to check nothing from any other plugin B or C, refuse to complete the routine process. it stop at the middle for now reason.
[note, “note1”] works
[ipress, tool:plane3d] works
[note, 'note2"] doesn’t works

not just that one, it happen from code in the plugin B, but plugin C work perfectly…

Last option to me, is to cleanly split the plugin and keep no connection between them all

problem is the licensing… and the come back in Zplugin menu :frowning:
for licensing we do it from a specific plugin, it write the data after the license verification
and if ok , all the plugin check for the stuff that activate the plugins. can’t to say too much, but when you know zscripting there is no many way for doing that^^

Ok let’s do this keep smilling and i will port that for a third time with this different approach.

and even duplicate some code tool from one plugin to another when i need the psd bridge

some new idea for the structure of the plugins

Module 0 : PSD Document Bridge

  • logo
  • psdsend - psdreceive
  • 4 switchs
  • quicksketch module
  • Texturing module
  • Illustrator module
  • baking master ( substance batchtools)
  • License Activation
    -About

-content Here - (depends of the Selection)

if Texturing module ( with pbr tools)

  • ALL bpr + filter

if illustrator module ( no pbr)

  • ALL bpr + filter

if Substance baker

  • no bpr filter only available map that batchtool can create.

Module 1 : Quicksketch Tools

  • texture to qsm
  • bpr 2 qsm
  • classic quicksketch

Module 2 :Texturing Module

  • document size
  • texturing tools
  • workflow tools
  • workflow preset
  • render passes
  • render options

Module 3 Illustration

  • document size (preset ?)
  • workflow preset ( could be different than what is available on Texturing module )
  • render passes
  • render options
  • include Quicksketch tool ?

Module 4 : substance batchtool Module

  • document size
  • render passes
  • workflow preset
  • render options

What do you think ?

aarg; i 've got something revolutionary, to show up and just a little stone is stopping me from finializing it.
will se it soon if i found a method to edit path that Zbrush Return no backslash , or double backslash
but single backslashe make maya mel script unefficient to convert the single backslash :confused:
i got a good knowledge of mel script and really nothing has worked
fromNativePAth, toNativePath, SubstituteAllString, while > substitute and never success with this :confused:
I try what is suggestted here too ; and the slash function doesn’t works too .

so i must to cleanup the path directly from Zbrush
but Zscript is missing so many function to handle Strings :confused:

Marcus do you have any idea how i could change
from this
"D:\IMAGING\PIXOLOGIC\ZBRUSH 4R7/ZStartup
to
"D:\IMAGING\PIXOLOGIC\ZBRUSH 4R7\ZStartup
or
D:/IMAGING/PIXOLOGIC/ZBRUSH 4R7/ZStartup
or
D://IMAGING//PIXOLOGIC//ZBRUSH 4R7//ZStartup

i get the path using filenameresolve on a folder/file from my plugin.
Any idea ?

Hello i think that all this require to be more precise
a video help to see what i trying to achieve
https://www.youtube.com/watch?v=Enkc0tL_gxg

at the moment the only manner that worked is to create a txt file into the plugin data directory
with the path of Zbrush with regular

look like this
http://i.imgur.com/0QRULuU.png

so from the zscript if the path is always the same it will works

i just [strmerge] the value read from the mem file with the path i defined to be the default path.
it lets me create a path that looks like that :

D://Imaging//Pixologic//ZBrush 4R7//ZStartup//ZPlugs64//ZGameToolsData//Renders//Baker//Meshes//

and that is added into the output melscript

so you copy the text from the txt file that popup after you build the list.
and paste it into maya Script editor. it work well.

But now can i do if i get a path like that

C:\Pixologic\Zbrush 4R7\

the user will have to open the path.txt and edit the path and to add double the foward slashes.

this way it can build the path, if the Zbrush installation path is different then mine.

But now i want to add a way to define the working directory, and i want to be out of Zbrush.

so i need a way to define a path to a directory, i have no sucess with fileNameAsk, it want a file with an extension.

then after, when i can resolve the defined path, i also need to tokenize le path and trim all the single \ and/or single /
and then rebuild the finale path, but i have no idea how coudl do that

i think about using a Loop, strFind, strlength, strExtract

still don’t know how to build it.

I’ve not looked at your video yet but in the meantime - ZBrush will automatically expand any file path that uses the special form:

“ZBRUSH_ZSTARTUP/ZPlugs64/MyPluginData/ZFileUtils.lib”

where ZBRUSH_ZSTARTUP will be expanded to give the full path on the user’s system.

Also, you can use [FileNameResolvePath,“MyPlugin.zsc”] to give the full path of your plugin, wherever it’s installed. You could then use [FileNameExtract] to get just the path, and so on.

HTH,

yes thank you but i know all this
it give this :

there is both type of slashes in what FileNameExtract|FileNameResolvePath | ZBRUSH_FOLDERNAME ( zstartup, alpha, ztools etc…)
produce as result :
D:\IMAGING\PIXOLOGI\CZBRUSH 4R7/ZStartup\ZPlugs64\ZGameToolsData\Models\

single \ are nothing i can exploit with maya melscript which is another shame
or i need them to be doubled, like that : \ or i need them to be all single forward backslash : /

my idea is :

a var that store the path after a filenameresolvepath
a var that get the length of the full path
a loop that check the for “” using StrFind
if i can know what if the position of the character, i can store it, and recheck the path, for the second “”

when done i can apply a StrExtract, on the var, and trim the \ and then Strmerge with // instead.

this is just the little thing that I am missing to make it works.

Urgh, sorry, I misunderstood what you were asking.

You can change any backslashes to forward slashes like this:

[IButton,TestPath,
[VarSet,newPath,""]
[VarSet,[COLOR=#b86d70]subStr,“D:\IMAGING\PIXOLOGIC\ZBRUSH 4R7/ZStartup\ZPlugs64\ZGameToolsData\Models”]
[VarSet,lp,[StrLength,subStr]]
[Loop,lp,
[VarSet,offset,[StrFind,[StrFromAsc,92],subStr]]
[If,offset > -1,

[VarSet,appendStr,[StrExtract,subStr,0,offset]]

[VarSet,newPath,[StrMerge,newPath,appendStr,"/"]]

[VarSet,subStr,[StrExtract,subStr,offset+1,256]]

,

[LoopExit]

]//end if
]//end loop

[Note,newPath]

]//end button

woaw million thx, marcus, and don’t be sorry :slight_smile:
The most fun is that i had written some code on paper over the tv yestesday , my code is very similar
just , I cut the path, at 1, 2, 3 4, etc, into the loop of 255 chars that is the maximum chars i can store a variable
but it check the with strfind if there is any \ , if yes, it apply a trim, and put the vars on th eside so i can rebuil the full path at the end :slight_smile:

but you method with the offset > -1 look to be simpler :wink:

Great! :slight_smile:

sorry marcus i read my message agains and it was too ealry the morning :slight_smile:
so now you can maybe understand what i did ^^
hey and check the video, you will love it iam sure of that ^^

arg, i need some help again :confused:

i store a path into a var on the disk, well it’s a path to a directory not a file.

i am creating a workspace Directory for Zbrush, it means that i am checking if a directory exists under the workspace dir that is the currently set as working workspace.
it a similar to maya workspace, so it checks first if

workspace\meshes
workspace\meshes\Low
workspace\meshes\High
workspace\meshes\Cage
workspace extures
etc…

if those folder exists or not, and create them before to bake the textures, or before to batch the Obj Export.

so i got everything that works, but [fileExists,myPath] just doesn’t works on Dir path
it always return 0
FileNameResolvePath also as no effect, its just useful to grab the full path of Zbrush, from a file that stand into a sub directory like plugindata.

I tried with openFolder of the ZLib utils but it seems it doesn’t works too :

[VarSet, testDir, "K:\ZGameTools_workspace\weapons\railGun\Meshes"] [VarSet, testDir, [FileExecute,[Var,dllPath],"OpenFolder",testDir]]

it returns 0 even if the directory has been created manually.

I’m missing something, may you have some kind of magic spell for that one

hmm, somtime iam stupid :slight_smile:

i forget to add this
[RoutineCall ,checkSystem] so each call to the dll did not worked :x
i can check if a folder exist this way :
[RoutineCall, CheckSystem]
[VarSet, testDir, “K:\ZGameTools_workspace\weapons\railGun\Meshes”]

//get the number of files/folders
[VarSet,fileCount,[FileExecute,[Var,dllPath],“GetFileNumber”, testDir]]
[If,fileCount < 0
,//commands
[Note,“Error getting number of files in folder”]
]

[Note, fileCount,,2]

so it return the number of files, or it return Zero if the folder Exists, and then if the folder does exists, it will return -1
perfect :slight_smile:

Long time i haven’t posted here, just to tell that i made some nice progress

Workspace manager that handle the save of the zpr, brushes, alpha, materials, and all what can be outputed using the rendering/baking

Substance batchtools is on the way…

ZBrush64_2016-06-23_21-10-45.pngZGametools-texturer-ui-update.png

i worked on something to store views like in Zapplink, I need that for the Renderer module
and i need that also to simply the process to when i need (with the TEXTURER module) to frame on the Tile Area(subtool) or the render area(subtool),
The problem is that it must to switch the proper subtools and then get back on the one that wad selected before the user pressed the button, and for the renderer it was for sure important to have such of vital function, to make it complete.

It’s not perfect , but today I found a post that emerges again on top of the forum and i see there is something very similar to what i did :stuck_out_tongue:
here : http://www.zbrushcentral.com/showthread.php?198085-scripting-question&p=1172742&viewfull=1#post1172742

:frustrated:
i didn’t see the [MTransformGet] exists to build a list… cause using [TransformGet] doesn’t support to make a var list…
so i had to rehandle the values differently, and that not very clean yet.
Can i pick up some of your concept using the [MTransformGet] and your loop ?
also i notice some error when i try to restore the saved view, i guess the correct grimbal error part, would fix my problem too.
hmm the fun is that i notice the post just after :confused:
I had successfully created the buttons paths to be stored into a vars list, that was another challenge ^^

I also made plenty of icons to make a more fancy UI :slight_smile:

Hope you like, it takes more time then expected at the moment it no more 1 plugin but 4 plugins :slight_smile:

Nicolas

This is looking really interesting Nicolas!

Do you plan on releasing these plugins to the community at some point?