Chaos Corona Forum

Chaos Corona for 3ds Max => [Max] I need help! => Topic started by: 3dwannab on 2015-03-12, 20:53:31

Title: MAXSCRIPT: Use the function of a button inside corona render dialog.
Post by: 3dwannab on 2015-03-12, 20:53:31
Hi,

I want to call up the function of the '+' in the render dialog for use in a script so that is has the same function of that in the render dialog. See attached the button I refer to.

What's the best way to go about this? Thanks.

I've tried
Code: [Select]
renderers.current.mtlOverride_includeModeBut this is only a boolean and comes back as only true or false.
Title: Re: MAXSCRIPT: Use the function of a button inside corona render dialog.
Post by: racoonart on 2015-03-12, 21:26:40
here you go:

Code: [Select]
for i in selection do appendifunique renderers.current.overrideMtl_exclude irenderers.current.overrideMtl_exclude is simply an array and you can add and remove items from it
Title: Re: MAXSCRIPT: Use the function of a button inside corona render dialog.
Post by: 3dwannab on 2015-03-12, 22:48:57
Thanks very mucho, it's easy when you know how. Now, I'm trying to create the code to rightclick the button to remove it from the array. I've tried mulitple things but I think this is the closest I've gotten.

Code: [Select]
        on btn_matoverrideexclude rightclick do
        (
            for i in selection do deleteItem renderers.current.overrideMtl_exclude i
        )

But the error is:
Code: [Select]
-- Runtime error: array index must be positive number, got: $Box:Box003 @ [809.705383,50.000000,264.243652]
I've look up forums but no code seems to work.
Title: Re: MAXSCRIPT: Use the function of a button inside corona render dialog.
Post by: racoonart on 2015-03-12, 23:07:23
You have to find the right index of the object first. You can't simply delete the node, you have to delete the node by index (that's also what the error message tells you). I hope you already downloaded the .chm version of the maxscript documentation ;) If not, do it now - it's all you need ;)

Code: [Select]
for i in selection do(
arr = renderers.current.overrideMtl_exclude
id = findItem arr i
if id != 0 then (
deleteItem arr id
)
)
Title: Re: MAXSCRIPT: Use the function of a button inside corona render dialog.
Post by: 3dwannab on 2015-03-12, 23:56:11
it's all you need ;)
That's easy for you to say. :)

Thanks for your help DC and the tip about the .chm file.