combine .mat file's in 1

may be a simple script for some of you expert's. Select several mat's and combine then using there file name's if possible... In addition the same tool would allow a drag and drop function into the material browser or mat editor.
Thanks in advance
Ste sherry

Comments

Comment viewing options

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

Even after 10 years you

Even after 10 years you posted this, i searched for this yesterday and found. Now im using it and wanted to create an account to say THANK YOU!!! :)

elirobinson's picture

Awesome!

Awesome! Very helpful script.

Rokas's picture

Thank You Marco Brunetta

helped me

fajar's picture

That very usefull ,thanks

That very usefull ,thanks marco u're such a kind of nice person!! remember me in CGtalk!! the who ask bout adding modifier thing!

btw where are you learning this all, is it you from programer background or kind of it!!? damn can I be like U someday!!

Marco Brunetta's picture

Lol, just practice, trial

Lol, just practice, trial and error like most. I don't have much of a programming background really, I studied architecture...

Keep at it, eventually you'll get to my level, and realize I don't know much =P

Marco Brunetta's picture

Sent it to you by mail, but

Sent it to you by mail, but I'll post it here in case somebody else finds it useful.

(
	rollout mergeLibs ".mat merger"
	(
		local matArray = #()
		local matsCollected = 0
 
		button btn_getFiles "Add Files" width:200 height:25
		label lbl_foundMats "Materials Collected: 0"
		button btn_setDest "Choose destination" width:200 height:25 --enabled:false
 
		ON btn_getFiles PRESSED DO
		(
			local theDialog = dotNetObject  "System.Windows.Forms.OpenFileDialog"
			theDialog.Multiselect = true --allow multiple files to be selected
			theDialog.title = "Add Files"
			theDialog.Filter = "Material Library (*.mat)|*.mat|All Files (*.*)|*.*" --specify the filter
			theDialog.FilterIndex = 1
			local result = theDialog.showDialog() --display the dialog, get result into variable
			result.ToString() --when closed, convert the result to string
			IF (result.Equals result.Cancel) != true DO --returns TRUE if Cancel was pressed, FALSE otherwise
			(
				FOR theFile in theDialog.fileNames DO 
				(
					local theLib = loadTempMaterialLibrary theFile
					IF theLib != undefined DO
					(
						FOR theMat in theLib DO
						(
							append matArray theMat
							matsCollected = matsCollected+1
							lbl_foundMats.text = ("Materials Collected: "+matsCollected as string)
						)
					)
				)
			)
			IF matArray.count != 0 DO btn_setDest.enabled = true
		)
		ON btn_setDest PRESSED DO
		(
			local matSavePath = (getSaveFileName caption:"Save Material Library" types:"Material Library (*.mat)|*.mat")
			IF matSavePath != undefined DO
			(
				local matLibrary = materialLibrary()
				FOR theMat in matArray DO append matLibrary theMat
				saveTempMaterialLibrary matLibrary matSavePath
			)
		)
	)
	createDialog mergeLibs width:220
)

Comment viewing options

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