Notifications
Clear all

[Closed] Is it possible To Create and Edit Output Map Curve?

from MXS help:
[left]
<texturemap.output>.Mono_Color_Map subAnim

[/left]
[left]The Mono_Color_Map SubAnim contains the monochrome color mapping curve. You cannot create this curve in MAXScript, or access this curve unless you first turn on the Enable Color Map checkbox in the user interface.

But if you really want to do it you can!


 ...
 

Can you animate Output Map Curve points? to be continued

the code was removed for revision…
[/left]

11 Replies

Thanks for looking into this denisT. I will keep watching this to see what else you find out.

-Eric

we can animate points now:


  ...
  

[b]and it’s pure MXS!

[/b]the code was removed for revision…

 lo1

Can’t wait…

here is a cleaned up version… using mxs only it creates animated output color map curve.


try(destroydialog easyCCurve) catch()
rollout easyCCurve "Easy CCurve" width:208 height:215
(
	fn mouseWindowMove hwnd x y sx sy =
	(
		fn makeParam LoWord HiWord =
		(
			bit.or (bit.shift HiWord 16) (bit.and LoWord 0xFFFF)
		)
		WM_LBUTTONDOWN 	= 0x0201
		WM_LBUTTONUP 	= 0x0202
		WM_MOUSEMOVE	= 0x0200
		MK_LBUTTON	  = 0x0001
		
		p0 = makeParam x y
		p1 = makeParam (x+sx) (y+sy)
		
		uiaccessor.sendmessage hwnd WM_LBUTTONDOWN 0 p0 
		uiaccessor.sendmessage hwnd WM_MOUSEMOVE MK_LBUTTON p1 
		uiaccessor.sendmessage hwnd WM_LBUTTONUP 0 p1 
	)

	curveControl cc numcurves:1 width:200 height:200 pos:[4,4] \
		zoomvalues:[200,100] scrollvalues:[4,2] uiFlags:#() rcmFlags:#()
)
createdialog easyCCurve pos:[-1000,300] style:#() 

with redraw off
(
	d_hwnd = (windows.getChildHWND 0 easyCCurve.title)[1]
	c_hwnd = for w in (windows.getChildrenHWND d_hwnd) where w[4] == "DefCurveWindow" do exit with w[1]
	
	cc = easyCCurve.cc.curves[1]
	cc.color = orange
	cc.numpoints = 3
	pp = easyCCurve.cc.curves[1].points

	pp.selected = on
	pp[2].value = [1,0]
	pp[1].outtangent = [1,0]
	
	slidertime = 100
	undo off 
	(
		animate on easyCCurve.mouseWindowMove c_hwnd 0 100 0 10
		for k=1 to cc.numpoints do 
		(
--			format "%: % %
" k cc[k] cc[k].controller
			deletekeys cc[k].controller #allkeys
		)
	)
	slidertime = 0
	
	pp.value = [0,0]
	pp.selected = off

	-- Edit Curve Points 
	pp[1].outtangent = [0,0]
	pp[3].value = [1,0]

	pp[2].value = [0.25,0.25]
	pp[2].outtangent = [0.2,0]
	pp[2].intangent = [-0.2,0]
	
	-- Animate Curve Point 2
	animate on at time 100 pp[2].value = [0.75,0.75]
	
	-- Make Output Map
	outputmap = output name:"ccOutput"
	medit.PutMtlToMtlEditor outputmap 1
	medit.SetActiveMtlSlot 1 on

	-- Init Mono_Color_Map 
	mateditor.open()
	c = windows.getchildhwnd (windows.getchildhwnd 0 ("Material Editor - " + outputmap.name))[1] "Enable Color Map"

	BM_SETCHECKED = 0x00F1
	UIAccessor.SendMessage c[1] BM_SETCHECKED 1 0
	UIAccessor.PressButton c[1]

	-- Replace Curve
	replaceinstances outputmap.output.Mono_Color_Map.curve_1 easyCCurve.cc.curves[1][1].parent
	medit.SetActiveMtlSlot 1 on
)
destroydialog easyCCurve
free easyCCurve

enjoy!

 lo1

is this version specific?

Not working for me on max2009

exception on the replaceInstances line due to easyCCurve.cc.curves[1][1].parent being undefined (only .parent is undefined, easyCCurve.cc.curves[1][1] is defined)

2 Replies
(@denist)
Joined: 11 months ago

Posts: 0

i didn’t test it for 2009. it works for 2010+

(@denist)
Joined: 11 months ago

Posts: 0

replace in my sample couple lines:


	-- Replace Curve
	ref_target = (refs.dependents easyCCurve.cc.curves[1])[1][1] -- easyCCurve.cc.curves[1][1].parent
	replaceinstances outputmap.output.Mono_Color_Map.curve_1 ref_target


it has to work for max 2009

Wow man! That is awesome!!!

Out of curiosity, is there any way to access the value of the curve once you move it from easyCurve over to the Output Map using curveControl methods?

getValue meditMaterials[3].output[#mono_color_map].curve_1 0 .5 returns
– No “getValue” function for ReferenceTarget:Curve

Anyway, thanks for the code! That’s a big help

curvecontrol methods doesn’t work for output map. but you can bring the output curve back into a curvecotrol and get full access.

 lo1

sure enough, that works! thanks.

I have only one small suggestion which is to use a negative value in the Y of the created easyCCurve rollout. I have two monitors, and max window is located on the right one, so I get the rollout popping up for a second on the left monitor (at coordinate [-1000,300] relative to max window).

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

move the curve’s rollout anywhere. it’s not a problem… i’m looking for some way of the virtual drawing dialog without its popping-up. technically it’s possible to create a dialog, activate, but not draw.