1. #1
    Senior Member User Gallery
    Join Date
    Aug 2004
    Location
    London UK
    Age
    36
    Posts
    106

    Default script to import from file names / directory

    Hi I was wondering if there's way to expand upon subtool master, or en extra script, that would be able to import multiple models back into each subtool ? I have a set of mel scripts in Maya that read in exported subtools for tweaking, and then I save them back out again to the same file name. Just want to refresh my subtools to read that back in.

    I know GoZ can do this already, but we use Windows Zbrush and Linux Maya (on a different machine, or another user), so I'm using a set of MEL tools on the Maya end of things.

    Anyway I can emulate how goZ works with a custom script to loop through files and import them for each matching subtool ?

    thanks

    Ben

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

    Default

    In principle this isn't too difficult. In pseudo code you would:

    1. Get the path to the folder where your files are.
    2. Get the name of the first subtool and concatenate it with the path & extension to form the file name.
    3. See if there's a file of this name in the folder.
    4. If there is a file, go to the relevant (presumably lowest) subdivision level of the subtool and import the file.
    5. Repeat for all subtools.

    For (1) you can either hard code the path or use a text file which is read by the zscript.

    For (2) you would do something like:
    [CODE][VarSet,subToolName,[IGetTitle,Tool:Item Info]]
    [VarSet,subToolName,[StrExtract,subToolName,0,[StrLength,subToolName]-2]]
    [VarSet,fullFilePath,[StrMerge,pathToFolder,subToolName,fileExt]][/CODE]


    For looping through the subtools you can adapt this macro: http://www.zbrushcentral.com/showthr...l=1#post798045


    Let me know if you've any other questions,

Posting Permissions

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