Author Topic: [Solved] Help: Open tone mapping settings editor from script  (Read 370 times)

2023-06-12, 17:55:47

Charlie Nicols

  • Active Users
  • **
  • Posts: 88
    • View Profile
Does anybody know if it is possible to open a camera's tone mapping settings editor from maxscript or a macro?

This button:


Thanks!
« Last Edit: 2023-06-13, 11:10:36 by Charlie Nicols »

2023-06-12, 22:04:22
Reply #1

Frood

  • Active Users
  • **
  • Posts: 1922
    • View Profile
    • Rakete GmbH
Hi,

Does anybody know if it is possible to open a camera's tone mapping settings editor from maxscript or a macro?


Not conveniently, but you can get a reference to the UI and let windows press the button. Example macro:

Code: [Select]
macroScript OpenCCamToneMapping
category:"# Scripts"
toolTip:"Opens tone mapping edit window of current Corona camera."
icon: #("Systems",2)

(

on isEnabled do (
return ((classof (viewport.getCamera())==CoronaCam))
)

on execute do (
max modify mode
select (viewport.getCamera())
TMButton=windows.getChildHWND (windows.getChildHWND #max ((viewport.getCamera()).name))[7] "Edit..."         
windows.sendMessage TMButton[1] 0x201 0 0 -- LMB down
windows.sendMessage TMButton[1] 0x202 0 0 -- LMB up
)
)


Coding like this it is crap, but it works.


Good Luck



Never underestimate the power of a well placed level one spell.

2023-06-13, 11:09:34
Reply #2

Charlie Nicols

  • Active Users
  • **
  • Posts: 88
    • View Profile
Thank you so much, that has worked great!

Had to change it a little to get it to work with my python script. If anyone's curious:
Code: [Select]
from pymxs import runtime as rt
parent = rt.windows.getChildHWND(rt.name("max"), (rt.viewport.getCamera().name))
tm_btn = rt.windows.getChildHWND(parent[7], "Edit...")

Thanks again, I really appreciate it!