Announcement

Collapse
No announcement yet.

How to change file path on matlib in one go ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to change file path on matlib in one go ?

    Hi,


    After a crashed HD, I've reinstalled max and put again my old matlib.
    Since I reorganized ma new HD, I have some problem to redirect all my bitmaps...


    Now, when I open my matlib, I have my differents materials with missing maps.
    All my users path are good now (according to my fresh 3dsmax install)
    So now, how can I change all the path assignment inside my matlib in one go ?
    Is there a way to do it automaticly then save again my matlib ?

    Thanks in advance !
    (Sorry for my bad english)

  • #2
    Colin wrote a killer script for this very thing!

    http://www.colinsenner.com/scripts/relink-bitmaps

    Open up file with missing maps, run script and then point it to new maps location. Save.
    Troy Buckley | Technical Art Director
    Midwest Studios

    Comment


    • #3
      +1 for relink-bitmaps Ive used that one for a couple years and love it!
      Cheers,
      -dave
      ■ ASUS ROG STRIX X399-E - 1950X ■ ASUS ROG STRIX X399-E - 2990WX ■ ASUS PRIME X399 - 2990WX ■ GIGABYTE AORUS X399 - 2990WX ■ ASUS Maximus Extreme XI with i9-9900k ■

      Comment


      • #4
        Hi,
        thanks for your suggestions, I use this very good script (thx Colin !)
        But my problem isn't to relink a scene but a matlib file.


        Maybe I'm wrong but I don't think I could do that with Relink-Bitmaps...


        What I'm looking for is to redirect in one go my old XXX.mat to the new maps location, then save it
        (Sorry for my bad english)

        Comment


        • #5
          AH! My bad. All of my material libraries are actual Max files so that I can XRef the materials into the various scenes and as the materials get updated/improved, they link back into all of the various scenes for that project.

          The only thing I could think of would be to assign each material to an object within Max and then re-link the materials at that point and then save out a new matlib file. :/

          I don't have max in front of me at the moment and can't really think of anything else off the top of my head. Sorry.
          Troy Buckley | Technical Art Director
          Midwest Studios

          Comment


          • #6
            It's surprising there isn't a sort of 'mat lib editor' of sorts somewhere out there...
            James Burrell www.objektiv-j.com
            Visit my Patreon patreon.com/JamesBurrell

            Comment


            • #7
              Originally posted by Donald2B View Post
              AH! My bad. All of my material libraries are actual Max files so that I can XRef the materials into the various scenes and as the materials get updated/improved, they link back into all of the various scenes for that project.

              The only thing I could think of would be to assign each material to an object within Max and then re-link the materials at that point and then save out a new matlib file. :/

              I don't have max in front of me at the moment and can't really think of anything else off the top of my head. Sorry.
              Thanks !
              Yes, I did that (assign each material to an object within Max), it can be done for a reasonable matlib with some materials but I also have matlib with a lot of materials, this will be painful :/

              Originally posted by Pixelcon View Post
              It's surprising there isn't a sort of 'mat lib editor' of sorts somewhere out there...
              Yes, it's also what I thought ! In fact, I was sure to find a "smart" way to do that in a snap but the more I search, the less I find
              (Sorry for my bad english)

              Comment


              • #8
                I had a similar problem when we changed servers here so I wrote a quick tool to change all our material libraries. It doesn't have a ui so it isn't very user friendy but it does the job.
                Code:
                (
                	clearListener()
                	
                	TSKmatLibs = getFiles ((getDir #matlib)+"\\*.mat")
                	for matLib in TSKmatLibs do
                	(
                		loadMaterialLibrary matLib
                		for mat in currentMaterialLibrary do
                		(
                			maps = getClassInstances bitmapTex target:mat
                			if substring map.filename 3 7 as name == "oldPath" as name do
                			(
                				map.filename = replace map.filename 3 7 "myNewPath"
                				print map.filename
                			)
                		)
                		fileSaveMatLib quiet:true
                	)
                )
                It basically loads all the matlibs in your material library folder and replaces part of the file path for every bitmap. So YOU MUST MAKE A BACKUP OF ALL MATLIBS FIRST!!

                If you are unsure how to edit the code to make it work for you send me an example of your old filepath and how you want it to look afterwards.
                Dan Brew

                Comment


                • #9
                  Hi Dan,
                  Sorry for the late reply, busy atm.
                  Thank you (again!), will try your code ASAP...
                  I will let you know

                  (Sorry for my bad english)

                  Comment

                  Working...
                  X