Announcement

Collapse
No announcement yet.

I'd like to change IDs quickly

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

  • I'd like to change IDs quickly

    I have a big scene with 4900 cars, all instences

    I have a base of 14 differents cars...

    I need to change all the IDs from ID 1 to 44 to ID 71 to 115...

    Is there an easy way to do that... A script or something ?


    Please Help this is an emergency...

    Best regards...
    My Flickr

  • #2
    Object IDs?

    copy and paste this code in a new script, save with a name you like as .ms file.
    Execute.
    Have the objects you want to change IDs of selected FIRST.
    Once the script runs you'll be able to choose what id number has to be changed to what other ID number, amongst the selected objects ONLY.
    No selection will throw up an error, as well as selecting items without objectID...
    Have your selection sets ready...
    You said you were in a hurry


    Code:
    inID=1
    outID=1
    rollout IDRoll "Object ID changer" width:216 height:72
    (
    	spinner spn1 "Change ID:" pos:[16,8] width:96 height:16 range:[0,100000,1] type:#integer
    	spinner spn2 "To ID:" pos:[136,8] width:72 height:16 range:[0,100000,1] type:#integer
    	button btn1 "Frabulate it!" pos:[8,32] width:200 height:32
    	on spn1 changed val do
    		inID=val
    	on spn2 changed val do
    		outID=val
    	on btn1 pressed  do
    (
    		s=selection as array
    		for i in s where i.gbufferchannel == inID do i.gbufferchannel =outID
    	)
    )
    createdialog IDRoll
    Lele

    Comment


    • #3
      Thanks a lot ... But...


      it doesn't work on a simple cube ...

      I made a cube
      I turn it into editable poly.
      I select the cube
      I run the script
      I change ID6 to 50

      It doesnt work...

      I have Max 8...
      My Flickr

      Comment


      • #4
        OBJECT ids.
        you need material IDs on faces?

        Lele

        Comment


        • #5
          I have my 14 cars with for exemple :

          Car01 : ID1 ID2 ID15 ID44 ID14
          Car02 : ID3 ID4 ID15 ID44 ID14


          My multi/sub for cars is 1 to 44


          I need to change it to 71 to 115

          And of course I need to change the Ids on cars ...


          Does that answer your question ?
          My Flickr

          Comment


          • #6
            it sure does. working on it.
            Editable Polys are fine, yes?
            Editable meshes have different methods to do that.

            Lele

            Comment


            • #7
              Sorry it's Material IDs....


              Sorry i'm a newbie into max... only 4 month, after 8 year Maya...

              My Flickr

              Comment


              • #8
                I work only with edit poly...
                My Flickr

                Comment


                • #9
                  Thanks a lot for looking at my request...


                  Italians are Max World champion...

                  French guys not...
                  My Flickr

                  Comment


                  • #10
                    sorry mate got busy

                    Try this meanwhile, if you haven't yet.
                    Select the poly object, go in faces mode, scroll all the way down to the rollout named "Polygon Properties".
                    The first group of spinners deals with face material ID: input 71 in the lower spinner (the one by the select ID button), and press the button "select ID" to select all polys with materialID 71.
                    Then, in the upper spinner, type 115 and press enter, to set the materialID of the selected polys to 115.
                    Or, in the material editor, set a number you wish in the ID box of the multi-sub material. this is the exact opposite as changing IDs on the faces, as you change the ID of the sub-material. it may be quicker, or not, depending on how the scene is set up.
                    Script may be a bit further away, as stuff's piling in, sorry

                    Lele

                    Comment


                    • #11
                      OK...

                      Thanks for your time...
                      My Flickr

                      Comment


                      • #12
                        Originally posted by studioDIM
                        sorry mate got busy

                        Try this meanwhile, if you haven't yet.
                        Select the poly object, go in faces mode, scroll all the way down to the rollout named "Polygon Properties".
                        The first group of spinners deals with face material ID: input 71 in the lower spinner (the one by the select ID button), and press the button "select ID" to select all polys with materialID 71.
                        Then, in the upper spinner, type 115 and press enter, to set the materialID of the selected polys to 115.
                        Or, in the material editor, set a number you wish in the ID box of the multi-sub material. this is the exact opposite as changing IDs on the faces, as you change the ID of the sub-material. it may be quicker, or not, depending on how the scene is set up.
                        Script may be a bit further away, as stuff's piling in, sorry

                        Lele

                        In fact I try to have only one Multi/Sub in my scene... and I need to reasign all shader in a unique Mlti/Sub...

                        Thats why I need to simply change the Material IDs into object...
                        My Flickr

                        Comment


                        • #13
                          On Cgtalk :

                          http://forums.cgsociety.org/showthre...85#post3946385


                          Someone help me find this :

                          Code:
                          (
                          	-- the settings
                           
                          	matIDoffset = 2
                           
                          	-- the script
                          	theSel = selection as array
                          	for theObj in theSel do(
                          		if classof theObj == Editable_Mesh then (
                          			theNumFaces = getNumFaces theObj
                          			print theNumFaces
                          			for theFace = 1 to theNumFaces do (
                          				theCurrentMatID = getFaceMatID theObj theFace
                          				setFaceMatID theObj theFace (theCurrentMatID + matIDoffset)
                          				format "%: % %\n" theObj.name theFace (theCurrentMatID + matIDoffset)
                           
                          			)
                          			update theObj
                          		)else(
                          			print "Object is not Editable_Mesh"
                          		)
                          	)
                          )
                          Thanks again every body....



                          And if someone havv an idea of changing this script for Editable Poly...
                          My Flickr

                          Comment


                          • #14
                            You could probably fix it, just look up meshops and polyops in the maxscript help, replace the meshops with the matching polyops and it should work.
                            Eric Boer
                            Dev

                            Comment


                            • #15
                              Code:
                              (
                              	-- the settings
                              	
                              	matIDoffset = 2
                              	
                              	-- the script
                              	theSel = selection as array
                              	for theObj in theSel do(
                              		theObjType = classof theObj
                              		case theObjType of (
                              			 Editable_Mesh:(
                              				theNumFaces = getNumFaces theObj
                              				for theFace = 1 to theNumFaces do (
                              					theCurrentMatID = getFaceMatID theObj theFace
                              					setFaceMatID theObj theFace (theCurrentMatID + matIDoffset)
                              					-- format "%: % %\n" theObj.name theFace (theCurrentMatID + matIDoffset)
                              		
                              				)
                              				update theObj
                              				)
                              			Editable_Poly: (
                              				print "Object is POLY"
                              				theNumFaces = getNumFaces theObj
                              				for theFace = 1 to theNumFaces do (
                              					theCurrentMatID = polyOp.getFaceMatID theObj theFace
                              					polyOp.setFaceMatID theObj theFace (theCurrentMatID + matIDoffset)
                              					format "%: % %\n" theObj.name theFace (theCurrentMatID + matIDoffset)
                              				)
                              			)
                              			default:(
                              				print "Object cannot be processed"
                              			)
                              		)
                              	)
                              
                              )


                              Those too script are not renaming but offseting the Material IDs... It's enought for what I need....
                              My Flickr

                              Comment

                              Working...
                              X