1
[Max] Resolved Bugs / Re: C8 - VFB tonemapping parameters have been hidden from Maxscripting?
« on: 2022-06-30, 11:38:29 »Quote
And regarding ease of editing the code - if I want to add in an operator half way, is there an easy way to do this without repeatedly changing the Op, ID, and Property numbers for the whole script?
Hi, I created some sample code that should be easier to modify - all the new operators are in separate functions so the operator variable does not have to be numbered, when adding a new operator, a new function can be created by taking the old one and just rewriting the operator-specific settings (e.g. rich shadows, opacity, ...). Also the ID is generated by a function so it does not have to be numbered manually. It could be improved further by deduplicating the common parts, but this is just for an illustration. The code does not add all the operators from the original code and they are added in reverse order (the ones added later are at the bottom, which is I think more clean). The function calls can be easily reshuffled to get a different order, or new calls can be added.
Hope this helps.
Code: [Select]
global id = 0
fn generateId =
(
id = id + 1
return id
)
fn addLutOperatorPlugin =
(
op = LutOperatorPlugin()
id = generateId()
setProperty op "colorMappingOperator.id" id
setProperty op "colorMappingOperator.enabled" false
setProperty op "colorMappingOperator.path" "L:\_Max_stuff\_Corona_LUTs_Tonemapping Only\DS_4_Values.CUBE"
setProperty op "colorMappingOperator.opacity" 1
lastOperator = getProperty renderers.current "colorMap.pipeline"
setProperty op "colorMappingOperator.nextOperator" lastOperator
setProperty renderers.current "colorMap.pipeline" op
)
fn addFilmicOperatorPlugin =
(
op = FilmicOperatorPlugin()
id = generateId()
setProperty op "colorMappingOperator.id" id
setProperty op "colorMappingOperator.enabled" true
setProperty op "colorMappingOperator.highlightCompression" 1
setProperty op "colorMappingOperator.Richshadows" 1
lastOperator = getProperty renderers.current "colorMap.pipeline"
setProperty op "colorMappingOperator.nextOperator" lastOperator
setProperty renderers.current "colorMap.pipeline" op
)
fn addReinhardOperatorPlugin =
(
op = ReinhardOperatorPlugin()
id = generateId()
setProperty op "colorMappingOperator.id" id
setProperty op "colorMappingOperator.enabled" true
setProperty op "colorMappingOperator.highlightCompression" 0.6
lastOperator = getProperty renderers.current "colorMap.pipeline"
setProperty op "colorMappingOperator.nextOperator" lastOperator
setProperty renderers.current "colorMap.pipeline" op
)
setProperty renderers.current "colorMap.pipeline" null
addLutOperatorPlugin()
addFilmicOperatorPlugin()
addReinhardOperatorPlugin()
Bohus