Copy Material from one object to another in viewport

I'm looking for a 3ds max script that will allow me to copy an object's material (with a hotkey - don't like new menus and tool bars) and paste it to another object all within the viewport. It would save me a lot of steps having to first open material editor then pick the material then assign to new material. I would love something that did this between instances like CopyPasteObjects.mcr (best script ever :). It would save me so much time.

Attached is an example of what I want to do...to select the object with the mat I need, copy, then switch to different max scene and paste onto new object.

Right now I'm copying and pasting objects which is adding in a lot of unnecessary steps.

Thanks in advance.

AttachmentSize
capture.jpg164.53 KB

Comments

Comment viewing options

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

To Barigazy: Copy of Material Instead of Instance.

Great job on this script! Just wondering if I can edit the code to paste the exact same material on the other objects instead of a copy of the material as this one does.

What's going on: When I paste the material to another object, it makes a copy of the material instead of pasting the same material. So then I would have to go in and edit each material individually instead of just the one original 1.

barigazy's picture

...

fn matchPropMaterial = if selection.count != 0 do
(
	if not InstanceMgr.autoMtlPropagation do InstanceMgr.autoMtlPropagation = on
	with redraw off with undo "copy mat" on
	(
		if (mat = selection[1].mat) != null do
		(
			for i = 2 to selection.count where canConvertTo selection[i] Editable_mesh do selection[i].mat = mat
		)
	)
)
matchPropMaterial()

barigazy

DotScott1's picture

Nice!

Thanks! Sorry, didn't quite understand how that one worked at first. Got it now though.

barigazy's picture

...

Just read the manual (MXS Help Document)

;)

barigazy

fajar's picture

look like life thread

look like life thread found....
just a another little gift....

fn matchPropMaterial =
(
 sel= selection as array
 mat2paste=  sel[1].material
 for i=2 to sel.count where (superclassof sel[i] == geometry or superClassOf sel[i] == shape) do 
 (
  with undo "copy mat" on
  (
    sel[i].material = mat2Paste
  )
 )
)

to use : select object that have material [obj A] and then select another object [obj B,C,D......] and then run the script

matchPropMaterial()
barigazy's picture

;)

fn matchPropMaterial = if selection.count != 0 do
(
	with redraw off with undo "" undo "copy mat" on
	(
		if (mat = selection[1].mat) != null do
		(
			for i = 2 to selection.count where canConvertTo selection[i] Editable_mesh do selection[i].mat = mat
		)
	)
)
matchPropMaterial()

barigazy

barigazy's picture

...

Neither do I :)
I'm lazy to search existing solution, it's easier to write new one ... sometimes :)

barigazy

miauu's picture
barigazy's picture

...

Similar but with my tool you can past over and over untill you copy next one :)

barigazy

miauu's picture

.

I never tested Mattransmiter. Just know that it exist. :)
Always is better to have multifunctional tool.

Comment viewing options

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