Notifications
Clear all

[Closed] Copy colormap of output to mix

Hi guys,
this is my first post in this forum.
is there any way to copy colormap curve of output to colormap curve of mixmap?
can anybody help?

8 Replies

The most simple way of doing it, so you don’t have to mess around with a lot of things (some not even possible), would be to copy the whole texture output from one map to the other.

Here is a function to do this. if The parameter ‘instance’ is true, then any modification to one curve will affect the other.

(
	fn CopyMapOutput map1 map2 instance:false =
	(
		if not instance then map2.output = copy map1.output
		else map2.output = map1.output
	)

	CopyMapOutput <SourceMap> <DestMap> instance:false
)

Here is a more complete function.

(
	/*
		<SourceMap>: Map to copy the OUTPUT parameters from
		<DestMap>  : Map to copy the OUTPUT parameters to
		instance   : Make all OUTPUT parameters instances
		keep	   : Keep all DestMap OUTPUT parameters (except Color Map)
	*/
	
	fn CopyMapOutput map1 map2 instance:false keep:false =
	(
		with undo off with animate off
		(
			if not instance then
			(
				output = copy map1.output
				if keep do
				(
					properties = getpropnames map1.output
					for j in properties where j != #mono_color_map do
					(
						setproperty output j (getproperty map2.output j)
						controller = getpropertycontroller map2.output j
						if controller != undefined do setpropertycontroller output j controller
					)
				)
			)else(
				output = map1.output
			)
			map2.output = output
		)
	)

	CopyMapOutput <SourceMap> <DestMap> instance:false keep:true
)

replaceinstances <destination output>.Mono_Color_Map <source output>.Mono_Color_Map
-- or
replaceinstances <destination output>.Mono_Color_Map (copy <source output>.Mono_Color_Map)


if you want to copy (replace) only Mono_Color_Map

Do you know how to enable the Color Map from MXS? Because if you haven’t enabled it at least once manually in the , then replaceinstances() will throw an exception.

(
     	source = meditmaterials[1] = mix()
     	dest   = meditmaterials[2] = output()
     
     	replaceinstances dest.output.Mono_Color_Map source.output.Mono_Color_Map
     )
 From the Help:

The following properties are not accessible by MAXScript in 3ds Max: Enable Color Map checkbox and the RGB/Mono radio-button.

the only way to enable color_maps and change rgb <-> mono via mxs is to use some trick with ui-sendmessages…

actually it’s not easy to set these flags via sdk as well. it’s one of max’s ‘black boxes’

2 Replies
(@polytools3d)
Joined: 11 months ago

Posts: 0

To overcome this limitation is why I wrote the above function instead of using replaceInstances ().

(@serejah)
Joined: 11 months ago

Posts: 0

I didn’t test it at all, but probably this one should work. Just in case someone will end up here from google like I did.

i showed my solution looking on the picture from the original question, where both color maps are already enabled.