Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - JokerMartini

Pages: [1]
1
[Max] Feature Requests / Re: Tonemapping & Maxscript
« on: 2023-01-10, 19:17:27 »
Hey everyone,
I'm one of the developers of Vexus and I can point out where we are having issues supporting corona as well as some possible solutions.

The Goal:
As you may know Vexus is a node based scene assembly tool. Within Vexus we want to give users the ability to create/manipulate the Tone Mapping settings inside of the Corona VFB. However there are some pitfalls that are preventing that from being possible via maxscript.

The Issues:
- There is no way to remove all Tone Mapping operators from the ui. Using the following code
Code: [Select]
setProperty renderers.current "colorMap.pipeline" null simply just resets the operators to the Default which contains a list of operators that the user may not want.
- There is no way to save and load Tone Mapping presets via maxscript.
- Simply creating Tone Mapping operators with maxscript results in buggy because it's only successful if the use assigns an ID to the operator however there is no provided safe way of knowing what id can be assigned to the operator.

Solution Ideas:
- Provide a method to easily clear all ToneMapping operators so the list appears actually empty from a visual standpoint
- Provide a method for adding and operator where the user is not required to supply and ID to the operator. Option provide a method where I can get and ID which I can then safely use as and ID for the Tone Mapping operator. Currently for a user to add and operator they have to do the following...
Code: [Select]
fn addLutOperatorPlugin =
(
    op = LutOperatorPlugin()
op.colorMappingOperator_enabled = true
op.colorMappingOperator_path = "L:\_Max_stuff\_Corona_LUTs_Tonemapping Only\DS_4_Values.CUBE"
op.colorMappingOperator_opacity = random 0.0 1.0

    id = random 1 500
setProperty op "colorMappingOperator.id" id
    lastOperator = getProperty renderers.current "colorMap.pipeline"
    setProperty op "colorMappingOperator.nextOperator" lastOperator
    setProperty renderers.current "colorMap.pipeline" op
)
addLutOperatorPlugin()
I would suggest making the method more user friendly removing the requirement for the user to come up with some random id value and simplify the appending of the operator like this (pseudo code)
Code: [Select]
op = LutOperatorPlugin()
op.colorMappingOperator_enabled = true
op.colorMappingOperator_path = "L:\_Max_stuff\_Corona_LUTs_Tonemapping Only\DS_4_Values.CUBE"
op.colorMappingOperator_opacity = random 0.0 1.0
append renderers.current.colorMap.pipeline.operators op

It would be nice if the operators were managed almost more like how render elements are. An array of Objects that can be iterated through, append, remove...ect. Right now the manipulating of operators is more complicated than needed making it difficult to implement. We can't safely and reliably append new operators and/or save/load existing operator presets.

2
Yeah i checked out the docs. those were a good starting point. However i've diving a bit deeper into the code and trying to build a pipeline. It seems like there are quite a few things unclear or broke, i could use your help with.

1. When adding a new operator via, it seems that the checkbox does not work. Run the following code and try to click the checkbox on all the operators.

Code: [Select]
clearlistener()
fn clearOperators =
(
renderers.current.colorMap_pipeline = undefined
)

fn getOperators =
(
local ops = #()
local op = renderers.current.colorMap_pipeline
while op != undefined do (
append ops op
--Print ("Operator found: " + classof op as string)
--show op
op = op.colorMappingOperator_nextOperator
)
ops
)

fn appendNewOperator op =
(
local ops = getOperators()
if ops.count == 0 then
(
setProperty renderers.current "colorMap.pipeline" op
) else
(
local lastOp = ops[ops.count]
setProperty lastOp "colorMappingOperator.nextOperator" op
)
)
clearOperators()
appendNewOperator (AcesOtOperatorPlugin())
appendNewOperator (ContrastOperatorPlugin())
appendNewOperator (LutOperatorPlugin())
appendNewOperator (ReinhardOperatorPlugin())
appendNewOperator (ToneCurveOperatorPlugin())

2. When adding an operator through code, it always appends it to the bottom even when adding it to the last operator by called 'setProperty lastOp ....' as shown in the docs. However when you click the + button in the UI it adds the operator at the bottom of the list. It seems unclear on how to do that same process via code succesfully.

I want to be able to build a new operator without necessarily always clearing ones that already exist.

3
Here is my code. I'm trying to append new operators but i'm quite confused on how this is suppose to work. It seems to append them in the wrong order compared to when a user clicks the Plus (+) button within in the VFB. Help is much appreciated.

Code: [Select]
clearlistener()
fn clearOperators =
(
print "todo..."
)

fn getOperators =
(
local ops = #()
local op = renderers.current.colorMap_pipeline
while op != undefined do (
append ops op
--Print ("Operator found: " + classof op as string)
--show op
op = op.colorMappingOperator_nextOperator
)
ops
)

fn appendNewOperator op =
(
local ops = getOperators()
if ops.count == 0 then
(
setProperty renderers.current "colorMap.pipeline" op
) else
(
local lastOp = ops[ops.count]
setProperty lastOp "colorMappingOperator.nextOperator" op
)
)

-- clearOperators()
-- op = getOperators()

appendNewOperator (LutOperatorPlugin())
appendNewOperator (AcesOtOperatorPlugin())
appendNewOperator (ReinhardOperatorPlugin())
appendNewOperator (ToneCurveOperatorPlugin())
appendNewOperator (ContrastOperatorPlugin())


4
What method can be used to clear the all operators?

5
Regarding the posts above, I'm one of the developers of Vexus and i had a question about adding new Operators.

Let's say for example, I wanted to append an operator from an arbitrary maxscript. how would one do so? Your sample script here works great but you redefine all the operators. I want to add a new one, leaving the existing ones as they are.

Is there a wrapper method or ease of use method that returns me the last operator so i can then call

```
op2 = ContrastOperatorPlugin()
setProperty lastOp "colorMappingOperator.nextOperator" op2
```

Pages: [1]