Announcement

Collapse
No announcement yet.

Move UV Map channel 1 to 10 of maps on entire scene

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

  • Move UV Map channel 1 to 10 of maps on entire scene

    Hi guys.

    I'd like to be able to move all the maps channels from a scene from 1 to 10 in the materials.
    Currently I'm using Zorb and it's working pretty well, but I was just wondering if anybody had another approach for this.
    Maybe a script that would read through all the maps and move them?

    Thanks
    Stan
    3LP Team

  • #2
    If you want to change every bitmap in the scene then you can use:
    Code:
    for b in getClassInstances bitmapTexture do b.coords.mapChannel = 10
    It is completely indiscriminate however and will change the channel of bitmaps used in modifiers etc.

    If you only want to change maps used in scene materials use:
    Code:
    for b in getClassInstances bitmapTexture target:sceneMaterials do b.coords.mapChannel = 10
    Dan Brew

    Comment


    • #3
      Nice one.

      This is only working for the bitmap maps though.
      I was think of something that could work on any map type in max : noise, tile, bercon, checker, etc.
      Is there a way to access this .coords.mapChannel for all the maps type or do we have to manually specify each map type?

      Thanks!
      Stan
      3LP Team

      Comment


      • #4
        Originally posted by 3LP View Post
        Is there a way to access this .coords.mapChannel for all the maps type or do we have to manually specify each map type?
        Yes, but unfortunately they all use slightly different ways of setting the map channel so the code is a bit longer.
        Code:
        (
        	local mc = 10
        	for b in getClassInstances StandardUVGen target:sceneMaterials do
        	(
        		b.mapping = 0 --delete if not required
        		b.mappingType = 0 --delete if not required
        		b.mapChannel = mc
        	)
        	for b in getClassInstances StandardXYZGen target:sceneMaterials do
        	(
        		b.coordType = 2 --delete if not required
        		b.mapChannel = mc
        	)
        	for b in getClassInstances berconTile target:sceneMaterials do
        	(
        		b.xyz_map = 0 --delete if not required
        		b.xyz_chan = mc
        	)
        )
        I've also included lines to set the coords to use the specific map channel. If you don't need these just delete them.
        Dan Brew

        Comment


        • #5
          Dude, you rock!
          Doesn't work for the bercon noise, but I guess I can try to find out what it should be

          At the same time, I'm using this code to apply a Unwrap to each selected object to move the UV map from 1 to 10.
          Would you see any other way to write this that would be better?
          Works well but we never know you'd have a idea

          Code:
          theObjs = selection as array
          clearSelection()
          max modify mode
          
          
          for obj in theObjs do
          (
              select obj
              modPanel.setCurrentObject obj.baseObject
              modPanel.addModToSelection (Unwrap_UVW ()) ui:off
              obj.modifiers[#unwrap_uvw].unwrap.setMapChannel 10
              obj.modifiers[#unwrap_uvw].unwrap.move ()
              --hide obj
          )
          Stan
          Last edited by 3LP; 29-06-2015, 10:31 AM.
          3LP Team

          Comment


          • #6
            I use this, had it custom made by a friend - https://www.dropbox.com/s/ztay9nxrfo...k_v003.ms?dl=0

            It has an option for shuffling UV's from one channel to another. Along with several other features.

            If you select all your objects, choose source UV, 1, and target UV 10. It should do the trick.

            Click image for larger version

Name:	Capture_Script.JPG
Views:	1
Size:	30.1 KB
ID:	856440
            Brendan Coyle | www.brendancoyle.com

            Comment


            • #7
              Hey,
              Thanks for this but it seems not to be working for me
              I did source uv and target uv and "shuffle UV", not sure what I do wrong.

              Here is my test scene :
              https://dl.dropboxusercontent.com/u/...%20to%2010.max
              Does it work for all of those maps for you?

              Cheers
              Stan
              3LP Team

              Comment


              • #8
                looks like it's working for me.. you need to drop a uvw unwrap down if you want to view (punch in ch10 and click 'abandon' to see that ch10 has the same UVs as ch1). Basically it's moving the UV's from 1 to 10, so ch1 will stay the same and ch10 is getting updated to match. I think you applied it twice to these teapots
                Brendan Coyle | www.brendancoyle.com

                Comment


                • #9
                  aaahhhh right!
                  I though you spoke about moving uv map in the materials, sorry mate.

                  Yes then I guess it's doing it the same way as my script about, but great to have a UI

                  Cheers!
                  Stan
                  3LP Team

                  Comment

                  Working...
                  X