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…

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 :wink:

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

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…

OBJECT ids.
you need material IDs on faces?

Lele

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 ?

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

Lele

Sorry it’s Material IDs…

Sorry i’m a newbie into max… only 4 month, after 8 year Maya…

:slight_smile:

I work only with edit poly…

Thanks a lot for looking at my request…

Italians are Max World champion… :slight_smile:

French guys not…

sorry mate got busy :frowning:

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 :frowning:

Lele

OK…

Thanks for your time…

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…

On Cgtalk :

http://forums.cgsociety.org/showthread.php?p=3946385#post3946385

Someone help me find this :


(
	-- 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…

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.

(
	-- 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…