Author Topic: MAXSCRIPT: Use the function of a button inside corona render dialog.  (Read 2488 times)

2015-03-12, 20:53:31

3dwannab

  • Active Users
  • **
  • Posts: 362
    • View Profile
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.

2015-03-12, 21:26:40
Reply #1

racoonart

  • Active Users
  • **
  • Posts: 1446
    • View Profile
    • racoon-artworks
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
Any sufficiently advanced bug is indistinguishable from a feature.

2015-03-12, 22:48:57
Reply #2

3dwannab

  • Active Users
  • **
  • Posts: 362
    • View Profile
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.

2015-03-12, 23:07:23
Reply #3

racoonart

  • Active Users
  • **
  • Posts: 1446
    • View Profile
    • racoon-artworks
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
)
)
Any sufficiently advanced bug is indistinguishable from a feature.

2015-03-12, 23:56:11
Reply #4

3dwannab

  • Active Users
  • **
  • Posts: 362
    • View Profile
it's all you need ;)
That's easy for you to say. :)

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