1. #1
    Senior Member User Gallery
    Join Date
    Feb 2007
    Location
    Wellington, NZ
    Posts
    157

    Default 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 ..
    Jens Kafitz
    Sr. Texture Artist, Weta Digital


  2. #2
    Moderator User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    8,609

    Default

    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.

  3. #3
    Senior Member User Gallery
    Join Date
    Feb 2007
    Location
    Wellington, NZ
    Posts
    157

    Default

    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
    Jens Kafitz
    Sr. Texture Artist, Weta Digital


  4. #4
    Moderator User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    8,609

    Default

    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:

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

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

    2. 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):
    [CODE]
    [ISet,Texture:Item Info,35]//selects texture number 35 from the list[/CODE]

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

    HTH,

  5. #5
    Senior Member User Gallery
    Join Date
    Feb 2007
    Location
    Wellington, NZ
    Posts
    157

    Default

    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 ?
    Jens Kafitz
    Sr. Texture Artist, Weta Digital


  6. #6
    Moderator User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    8,609

    Default

    You can do it like this:
    [CODE]
    [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,"\nTexture Height = ",#txtrHeight]][/CODE]

  7. #7
    Senior Member User Gallery
    Join Date
    Feb 2007
    Location
    Wellington, NZ
    Posts
    157

    Default

    All sorted ! Many thanks !
    Jens Kafitz
    Sr. Texture Artist, Weta Digital


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •