ZBrushCentral

Clearing the texture/alpha list via script

Hi,
I am trying to clear the Alpha and Texture list completely by script. My problem is that
A) Init Zbrush doesn’t get rid of loaded textures/alphas
B) The “Remove” Button in the Textures Tab only seems to remove things from the Quick Pick List, but not from the complete List.

I need to maintain unique names so I can run other scripts so I need to somehow ensure that the list is clean. I can’t have two textures named “Color” with different resolutions in the list …

Unfortunately there is no way to clear out the Texture of Alpha palettes other than by restarting ZBrush. However, there may be a way around your difficulty. If you explain a little more about what you are doing, I will see what suggestions I can make.

Hey Marcus,
thanks for the quick response.
I am doing a pretty straight forward macro that reads out specific files from disc output by a photoshop action.
The filenames are always “polarized.psd” and “unpolarized.psd” and are applied to a subdivided plane so I can sculpt and paint on the plane, then read out the original texture resolution and output the result as a photosho file with a hardcoded name onto disc.
This phototshop file gets then merged in the correct place into the original photoshop file via action (therefore the matching resolution is important)
It’s like Zapplink but instead of using Zbrush as the final target where everything ends up in, Photoshop is the target (unfortunately Zbrush does not deal with the 16k resolutions - neither pixel count nor matching polygon count - I require so I need to split sections out - sections that I would like to be able to freely specify via marquee selection in photoshop - so the resolution of the input texture changes every time)

Everything works like a charm on the first roundtrip to Photoshop. But when I do a second round (so a different section of the psd doc was split out with a different resolution) Zbrush gets tripped up because I have two of each - polarized.psd and unpolarized.psd - in the list and it randomly picks the wrong file and I end up with the wrong resolution. For some reason even the “Remove” in the texture palette does not get rid of the items - neither does init Zbrush.

Bit of a pain really. I was trying to figure out how to get the item number of the textures I import, store that on disc and recall the correct texture by accessing this number but I can’t figure out how.

Thanks in advance.
Jens

It’s never been possible to clear out these palettes - I agree it can be a pain. However, you can get around the problem like this:

  1. If you are applying a texture to a mesh (such as a plane) you can avoid the Texure palette altogether by importing directly:

[IPress,Tool:Texture Map:TextureMap]
[FileNameSetNext,#texturepath]
[IPress,File:Texture:Import]
[IClick,6207]//get rid of popup

(where #texturepath is a variable with the full path to the image file you want to use)

  1. If you are exporting from the Texture palette (for example, after cloning a texture), then you can use the numerical ID of the texture (as in the slider at the top of the palette):

[ISet,Texture:Item Info,35]//selects texture number 35 from the list

It would also be possible to check the texture dimensions if you needed to.

HTH,

Ah sweet, circumventing the texture palette all together is a good idea, I’ll test that tomorrow. But if the texture doesn’t appear in the list, how do I get its resolution ? I have been using IGet to grab the Width and height from the current texture but that only grabs it off the sliders from the textures palette, doesn’t it ? Which in the case of directly loading it onto the subtool doesn’t help ?

You can do it like this:


[VarSet,txtrInfo,""]
[VarSet,txtrWidth,0]
[VarSet,txtrHeight,0]

[VarSet,txtrInfo,[IGetInfo,Tool:Texture Map:TextureMap]]//this is the info that appears when the cursor is over the thumbnail

[VarSet,index,[StrFind,"Width=",txtrInfo]]//StrFind will return -1 if string not found

[If,index>-1,[VarSet,txtrWidth,[StrExtract,txtrInfo,index+6,index+10]]]
[VarSet,index,[StrFind,"Height=",txtrInfo]]
[If,index>-1,[VarSet,txtrHeight,[StrExtract,txtrInfo,index+7,index+11]]]
[Note,[StrMerge,"Texture Width = ",#txtrWidth,"
Texture Height = ",#txtrHeight]]

All sorted ! Many thanks !