Notifications
Clear all

[Closed] Save and Load UVs

It is posible to save and load *.uvw file without opening save and load dialog?
I mean somethig similar to import-exportFile function with #noPrompt option.

6 Replies

You can use DialogMonitorOPS here is an example:
http://area.autodesk.com/forum/autodesk-3ds-max/maxscript/transfering-uvw-data-via-maxscript/

Depending on your needs “channelInfo.CopyChannel” might work for you.

1 Reply
(@gazybara)
Joined: 11 months ago

Posts: 0

Yep. I saw that thread on area. Anubis is show nice trick using swap function.

I’d rather go for channelInfo.CopyChannel than save/load uvw.

Swap function for transfering UVs is very good solution that i implemented in this script
http://www.scriptspot.com/3ds-max/scripts/quadrifyall

here’s a little snippet from my “scripts I wrote and then said, hmm done that, I’ll never use that again” drive

It will copy various channels, including UVW.

/*
************************************************************************
*********************************************************************
************************************************************************
Channel Hopper
by LoneRobot
pete@lonerobot.com
*/

if ChannelHopperRo != undefined and classof ChannelHopperRo == RolloutClass and ChannelHopperRo.open then destroydialog ChannelHopperRo

rollout ChannelHopperRo "" width:157 height:380
(
	local UICkb 
	
	fn CreateLogo =
	(
	imgstr = "iVBORw0KGgoAAAANSUhEUgAAACUAAAAnCAYAAACIVoEIAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACHDwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKOWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAEjHnZZ3VFTXFofPvXd6oc0wAlKG3rvAANJ7k15FYZgZYCgDDjM0sSGiAhFFRJoiSFDEgNFQJFZEsRAUVLAHJAgoMRhFVCxvRtaLrqy89/Ly++Osb+2z97n77L3PWhcAkqcvl5cGSwGQyhPwgzyc6RGRUXTsAIABHmCAKQBMVka6X7B7CBDJy82FniFyAl8EAfB6WLwCcNPQM4BOB/+fpFnpfIHomAARm7M5GSwRF4g4JUuQLrbPipgalyxmGCVmvihBEcuJOWGRDT77LLKjmNmpPLaIxTmns1PZYu4V8bZMIUfEiK+ICzO5nCwR3xKxRoowlSviN+LYVA4zAwAUSWwX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g=="
	bytearr = (dotnetclass "system.convert").FromBase64String imgstr
	memstream = dotnetobject "System.IO.MemoryStream" bytearr
	DecodedImg = (dotnetclass "System.drawing.image").fromstream memstream
	memstream.close()
	DecodedImg
	)
	
	fn StyleDotNetHeader label text =
	(
	label.text = text
	label.backcolor =  label.backcolor.fromARGB 52 83 103
	label.forecolor = label.forecolor.ghostwhite
	label.font = dotNetObject "System.Drawing.Font" "Verdana" 8 (dotNetClass "System.Drawing.FontStyle").bold
	label.image = if lrlogo == undefined then (CreateLogo()) else lrLogo	
	label.imagealign =label.imagealign.Middleright
	label.textalign = label.textalign.Middleleft
	label.padding = dotnetobject "padding" 10 0 0 0
	
		
	)
	
	
	fn copyPasteChannel source channelType channelID = 
	(
	/*

	*/
		if isvalidnode source then
		(
			if selection.count > 0 then
			(				
			ObjsArr = for i in selection collect i 
				
			if keyboard.shiftpressed then
				(
				for o in ObjsArr do ChannelInfo.ClearChannel o channelID
				)
				else
				(			
					if channelType == 2 then 
					(				
						ChannelInfo.CopySubChannel source channelType channelID 0
						for o in ObjsArr do ChannelInfo.PasteSubChannel o channelType channelID 0				
					)
					else 
					(
						ChannelInfo.CopyChannel source channelType channelID 
						for o in ObjsArr do ChannelInfo.PasteChannel o channelType channelID 								
					)
				)			
			)
			else messagebox "Please select a destination object to paste the channel onto." title:"Channel Hopper" beep:false
		)		
	)
	
	dotNetControl lblvc "Label" pos:[0,-1] width:157 height:40
	checkbutton btnID01 "1" pos:[70,259] width:20 height:18 highlightColor:(color 88 199 255) enabled:false
	checkbutton btnID02 "2" pos:[90,259] width:20 height:18 highlightColor:(color 88 199 255) enabled:false 
	checkbutton btnID03 "3" pos:[110,259] width:20 height:18 highlightColor:(color 88 199 255) enabled:false
	checkbutton btnID04 "4" pos:[130,259] width:20 height:18 highlightColor:(color 88 199 255) enabled:false
	checkbutton btnID05 "5" pos:[70,278] width:20 height:18 highlightColor:(color 88 199 255) enabled:false 
	checkbutton btnID06 "6" pos:[90,278] width:20 height:18 highlightColor:(color 88 199 255) enabled:false 
	checkbutton btnID07 "7" pos:[110,278] width:20 height:18 highlightColor:(color 88 199 255) enabled:false
	checkbutton btnID08 "8" pos:[130,278] width:20 height:18 highlightColor:(color 88 199 255) enabled:false
	button btnApply "Paste Channels To Selection" pos:[2,322] width:153 height:40 enabled:false
	label lblClear "Hold <Shift> to Clear Channels" pos:[3,364] width:150 height:30	
	checkbutton btnID09 "9" pos:[70,297] width:20 height:18 highlightColor:(color 88 199 255) enabled:false 
	checkbutton btnID10 "10" pos:[90,297] width:20 height:18 highlightColor:(color 88 199 255) enabled:false
	checkbutton btnID11 "11" pos:[110,297] width:20 height:18 highlightColor:(color 88 199 255) enabled:false
	checkbutton btnID12 "12" pos:[130,297] width:20 height:18 highlightColor:(color 88 199 255) enabled:false
	pickbutton btnPickSource "Source Object" pos:[3,42] width:151 height:28 autodisplay:true
	checkbutton ckbGeo "Geometry" pos:[6,89] width:145 height:21 highlightColor:(color 36 36 136)
	checkbutton ckbVsel "Vertex Selection" pos:[6,114] width:145 height:21 highlightColor:(color 65 177 65)
	checkbutton ckbVAlpha "Vertex Alpha" pos:[6,140] width:145 height:21 highlightColor:(color 135 22 22)
	checkbutton ckbVIllum "Vertex Illumination" pos:[6,165] width:145 height:21 highlightColor:(color 114 37 136)
	checkbutton ckbVC "Vertex Color" pos:[6,191] width:145 height:21 highlightColor:(color 185 155 37)
	checkbutton ckbUVW "UVW Mapping Channels" pos:[6,216] width:145 height:21 highlightColor:(color 225 88 199)
	spinner spnFrom "" pos:[12,276] width:50 height:16 range:[1,100,1] type:#integer
	spinner spnTo "" pos:[12,294] width:50 height:16 enabled:true range:[1,100,1] type:#integer
	radiobuttons rdoUVtype "" pos:[6,239] width:159 height:16 labels:#("Range   ", "Specific") columns:2 enabled:false
	GroupBox grpFT "" pos:[8,252] width:59 height:63  enabled:false
	label lblFT "From/To" pos:[16,259] width:43 height:12  enabled:false
	groupBox grpmargin "" pos:[8,252] width:59 height:21 enabled:false
	groupBox grpSCC "Set Channels To Copy" pos:[2,72] width:153 height:247
	
		
 	local RangeUI = #(grpFT,spnFrom,spnTo,lblFT)
 	local SpecUI = #(btnID01,btnID02,btnID03,btnID04,btnID05,btnID06,btnID07,btnID08,btnID09,btnID10,btnID11,btnID12)

	on ckbUVW changed state do
	(
		if rdoUVtype.state == 1 then
				for r in rangeUI do r.enabled = state
					else 
						for s in specUI do s.enabled = state
		rdoUVtype.enabled = state			
	)
	
	on btnPickSource picked obj do
	(
		if isvalidobj obj then
			btnApply.enabled = true				
	)
	
	on rdoUVtype changed val do
	(
		if ckbUVW.checked then
		(
			if val == 1 then
			(
				for s in specUI do s.enabled = false
				for r in rangeUI do r.enabled = true
			)
			else
			(
				for s in specUI do s.enabled = true
				for r in rangeUI do r.enabled = false
			)
		)
	)

	on ChannelHopperRo open do
	(
		StyleDotNetHeader Lblvc "Channel Hopper"
		for s in specUI do s.enabled = false
		for r in rangeUI do r.enabled = false	
		if selection.count == 1 then (btnPickSource.object = selection[1];btnPickSource.picked selection[1];btnPickSource.text = selection[1].name)
	)
	on btnApply pressed do
	(
		if ckbGeo.checked then
		(
			if isvalidnode btnPickSource.object then copyPasteChannel btnPickSource.object 1 1
		)
		
		if ckbVsel.checked then
		(
			if isvalidnode btnPickSource.object then copyPasteChannel btnPickSource.object 2 0
		)
		if ckbVAlpha.checked then
		(
			if isvalidnode btnPickSource.object then copyPasteChannel btnPickSource.object 3 -2
		)
		if ckbVIllum.checked then
		(
			if isvalidnode btnPickSource.object then copyPasteChannel btnPickSource.object 3 -1
		)
		if ckbVC.checked then
		(
			if isvalidnode btnPickSource.object then copyPasteChannel btnPickSource.object 3 0
		)
		if ckbUVW.checked then
		(
			local UVWRange = #()
			if rdoUVtype.state == 1 then
				UVWRange = for i = spnFrom.value to spnTo.value collect i			
					else UVWRange = for u = 1 to SpecUI.count where SpecUI[u].checked collect u				
			
			if isvalidnode btnPickSource.object then for uvChan in UVWRange do copyPasteChannel btnPickSource.object 3 uvChan
		)	
	)
)
createdialog ChannelHopperRo style:#(#style_toolwindow,#style_sysmenu) 

Thanks Pete.