Is there any way to make Zbrush to export all the textures v-flipped?
It can be annoying, forgetting to flip on export, and flip back when working in Zbrush
in preferences…import export settings
You can only choose to flip the model in the preferences, IIRC.
So you mean its the same for normal-flipping as for flipping regular color-textures?
Hello again.
When importing an image (for texture) then I needed to flip it vertically manually. Changing the preference>import-exprot settings didnt help.
I tried NormalMapFlipY and NormalMapFlipVert.
Is there something I am doing wrong or isnt it even possible?
There is no setting to flip textures vertically automatically. You could, however, create your own import and export buttons that would do the job for you. It would be done through ZScripting, by editing the DefaultZScript or by writing a plugin.
My ZPlugMaker could help you do this.
What you do:
1.Record a zscript of only the actions you wish to use. In this case, make sure you have a texture selected then press Record. DON’T use the ZScript Reset option when starting the recording. Then press the Texture>FlipV button followed by the Texture>Export. Save the file (any name will do) and End Recording. Save the recording with a short, meaningful name such as ‘FlipTxtr.txt’
2. Download and install my ZPlugMaker plugin. Restart ZB and press the ZPlugMaker button which will be in the ZPlugin>MarcusTools subpalette. You will be asked to choose a file. Select the recording file you just made (‘FlipTxtr.txt’). The plugin will then ask if you wish to assign a hotkey. Do so if you wish. That’s it: there will be a new button in the ZPlugin>My PLugins subpalette named FlipTxtr (or whatever) which will flip the selected texture before bringing up the export dialog.
EDIT: For importing, simply record a brief script first pressing the Texture>Import button (select any texture) then flip vertically, end recording.
HTH,
Thank you Aurick, thank you Marcus.
Since I havent any experience over scripting, I think Marcus’ script will help me alot.
A question though.
Is it possible to assign an icon to the created “plugins”? Please see the images attached.
Attachments
Yes you can but you’ll have to edit the plugin text file. This will be in your ZStartup\ZPlugs folder and named something like MyPlugin_FlipTxtr.txt (where the ‘FlipTxtr’ bit is the name you chose).
Open the file in a text editor. The last couple of lines will look something like this:
[IPress,Texture:Export]
,,76,1400,,19]
[EDIT: depending on your text editor this may be all on one line.]
The important line is the last. In my example the ‘76’ is the button width, the ‘1400’ is the hotkey I assigned and the ‘19’ is the button height.
Edit the last line so that it is like this:
,,38,1400,"export_flipped.jpg",38]
Obviously “export_flipped.jpg” is the image file name and relative path. This example assumes that the image file is also in the ZPlugs folder. If it was in a subfolder of the ZPlugs called “images” then the code would be “images\export_flipped.jpg” (including the quote marks). I’ve changed the height and width values to 38 because that’s the standard for square interface buttons. Note that your hotkey number will mostly like not be ‘1400’ and if you didn’t assign a hotkey this space will be blank. Don’t delete any commas.
When you’ve done editing save the file then restart ZBrush. Your button image should now show and you can drag to the interface.
HTH,
Dear Marcus, thanx for helping me out here.
I made my first attemt now today, and I managed to make en export.
Testing the script by clicking run gave me a nice result.
However, there are some things I wonder about;
- The export created two files, one TXT a´nd one ZSC file. Are both needed?
- Can I rename one or both of them afterwards?
- Can I add more commands in the TXT-file?
- And finally; can I tweak the script so it runs as fast as the light? I dont really need to see how it clicks step after step until it get finished.
Now, I am going to check your plugin maker
Haider,
The instructions I gave you above for adding in a button image refer to the file output from my ZPlugMaker plugin NOT the zscript recording file.
You can rename or edit the text file of your recording if you want, just make sure that if you add in commands they are all in the ‘command’ section. The .zsc file is the ZBrush compiled version and it’s not necessary to keep this. If you use ZPlugMaker to make a plugin you only need select the .txt version.
The reason that your script runs slowly is probably because you have the Show Actions button pressed in the ZScript palette. It’s not really necessary to have this on the whole time so simply turn it off and then save your interface configuration (Shift+Ctrl+I). You can easily switch it back on if you are replaying a zscript and want to see what’s happening.
If you get stuck, let me know.
Hey Marc, this is so cool. Everything works easy and smooth - creating the plugin and the icons.
I wonder though, when the PluginMaker creats a plugin, it created those TXT files. But where are those registered? I mean, if i copy-paste such a TXT file (with another name) it wont find it anyway right? So where is the plugin being registered, so that it got loaded at startup?
Haider,
I’m glad you’ve got it working.
The important files for ZPlugins are the .zsc files. As I mentioned above, these are compiled versions of zscript text files. So to create a plugin you need to load a text file using the Zscript>Load button. This creates the .zsc file which, if it is placed in your ZStartup\ZPlugs folder, will load each time you start ZBrush. The ZPlugMaker plugin works by creating the text file called ‘MyPlugin_name.txt’ in the ZStartup/ZPlugs folder, then loads it automatically and so creating the compiled .zsc version (and in the right place to load every time). If you then edit this text file ZBrush will update the plugin on launch because if there is a text file of the same name as the plugin .zsc in the ZPlugs folder ZBrush loads the text file and recompiles the plugin - but only if both .txt and .zsc files are present.
I hope that’s clear?
Its totally clear
the reason why I ask is, that I need to change workstation from time to time. So I dont want to reinstall Zbrush and loose all my plugins. So I use to save my plugins-folder to reuse. I was afraid that I couldnt use it this time, but it seems I can.
Great job!
You made me look into the scripting for the first time, and I noticed that it wasnt so hard like I thought. Thanx for that as well
Great! I look forward to a Haider_zbrush_plugin!
Cheers,
Hey Marc,
thank you for you earlier help - it actually became not only one, but two small plugins for importing and exporting flipped images. Very good.
However, I wonder about the Show Actions button. Is it possible to have it turned off all the time? It seems not to work for me to store the configuration.
Haider,
You should be able to have Show Actions switched off the whole time. Switch it off, then save the configuration with Shift+Ctrl+I. That works for me.
If for some reason this doesn’t work for you, you can make sure that your plugins turn it off temporarily by adding
[IShowActions,0]
to the start of the command section of the plugin button. (My ZPlugMaker plugin should add this automatically.)
The start of the button code would then look something like this:
[IButton,"ZPlugin:MyPlugins:ZNotePad",
"Load ZNotePad zscript",
[IShowActions,0]
//other commands follow here
Thanx again Marcus, you keep on helping
I thought too, that saving the configuration should help, but somehow it doesnt, and I have no idea why it is like that.
By the way, what information can be stored in the “StartupDocument.ZBR”-file?
Basically any information that is normally stored in a document: canvas size, lighting set up, custom materials (as long as they have been painted somewhere on the canvas).
For stuff not stored and loaded with the start up document, such as custom alphas and whatnot, you can edit the defaultzscript.txt file (located in the ZScripts folder). Make sure all commands come before the final [PD]. Your code could be something like this:
[If,1,
[FileNameSetNext,"C:\Program Files\Pixologic\ZBrush2\ZAlphas\Snakeskin.psd"]
[IPress,Alpha:Import]
]
[PD]
You should be able to switch off Show Actions like this. Just add the code
[If,1,
[IUnPress,ZScript:Show Actions]
]
before the [PD] in your defaultzscript.txt file.
EDIT: I forgot that you need the [If command bit because [IPress can’t be a ‘top level’ command!