PDA

View Full Version : Is it possible To Create and Edit Output Map Curve?


denisT
07-12-2011, 06:55 PM
from MXS help:

<texturemap.output>.Mono_Color_Map subAnim


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...

PiXeL_MoNKeY
07-12-2011, 08:35 PM
Thanks for looking into this denisT. I will keep watching this to see what else you find out.

-Eric

denisT
07-12-2011, 09:06 PM
we can animate points now: :) :) :)

...


and it's pure MXS!

the code was removed for revision...

lo
07-13-2011, 06:51 AM
Can't wait...

denisT
07-14-2011, 12:17 AM
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 "%: % %\n" 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!

lo
07-14-2011, 06:52 AM
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)

Pacermike
07-14-2011, 08:00 AM
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 :thumbsup:

denisT
07-14-2011, 01:54 PM
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)

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

denisT
07-14-2011, 02:00 PM
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 :thumbsup:

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

denisT
07-15-2011, 08:28 PM
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)

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

lo
07-15-2011, 11:41 PM
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).

denisT
07-16-2011, 12:29 AM
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).

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.

CGTalk Moderation
07-16-2011, 12:29 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.