UV unwrap multiple objects

Okay guys, here a challenge..(maybe)
When selecting 2 or more objects than applying the Unwrap UV modifier than select all the polygons, than use flatten mapping. than pack UVs it seems that all the polygons from all objects pack within the 0 to 1 space nicely side to side object to object.

However im looking for another way to pack the UVs, instead of the above result I would like to pack all object UVs at once as if they were being packed for themselves individually in 0 to 1 space. (They would be overlapping the other objects uv's of course. That way all objects are fit in the 0 to 1, like if they were uv unwrapped separately 1 by 1 )

The reason I need this is for setting up 1000s of already modeled game assets that require 1000s of objects UV unwraps needed for lightmap channels in the game engine.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
justoneartist's picture

UV unwrap multiple objects (modifier.unfoldMap)

What is the script that work with the unfoldMap?

miauu's picture

.

(
	max modify mode
	selObjsArr = selection as array
	for o in selObjsArr do
	(
		select o
		uvMod = (Unwrap_uvw())
		addModifier o uvMod ui:true
-- 		uvMod.unfoldMap 0	--	max2014 not works
-- 		uvMod.unfoldMap 1	--	max2014 not works
		uvMod.unfoldMapNoParams()
	)
)
miauu's picture

.

Is this is what you need?

(
	max modify mode
	selObjsArr = selection as array
	for o in selObjsArr do
	(
		select o
		uvMod = (Unwrap_uvw())
		addModifier o uvMod ui:true
		uvMod.flattenMap 45.0 #([1,0,0], [-1,0,0], [0,1,0], [0,-1,0], [0,0,1], [0,0,-1]) 0.02 true 0 true true
	)
)

Select the objects that you want to unwrap and run the script

vermiw's picture

Another Channel

Is it possible to make this work directly on channel 2 ? I really need this for the same reason: 1000 props....
Please rewrite the whole thing just to make sure it works.

Very nice Thank you.

barigazy's picture

...

Following up Kostadin solution U can try this fn

fn uvwFlattenMap objArr mapChannel:1 = if objArr.count != 0 do
(
	clearSelection()
	SetCommandPanelTaskMode #modify
	with redraw off
	(
		for node in objArr where validModifier node (modifier = Unwrap_uvw()) do
		(
			addModifier node modifier ui:on
			modifier.setMapChannel mapChannel
			select node ; modPanel.setCurrentObject modifier
			modifier.flattenMap 45.0 #([1,0,0], [-1,0,0], [0,1,0], [0,-1,0], [0,0,1], [0,0,-1]) 0.02 on 0 on on
		)
	)
)
uvwFlattenMap (selection as array) mapChannel:2

barigazy

tuxmask75's picture

Perfect !

Perfect !

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.