Author Topic: Corona Listener  (Read 5264 times)

2017-06-21, 12:54:33

Phasma

  • Active Users
  • **
  • Posts: 112
    • View Profile
As a TD I write a lot of tools for big office. unfortunately, I can not give away most of the Corona based tools as we rely on them comercially. However I think I wrote a little tool that I can share and that would make lives of other TD's and script people a little bit more easy. It just Listens to whatever all the Corona Properties are doing, so you can simply use the code in your own tools by simply playing around with the properties.

enjoy

2017-06-21, 14:24:46
Reply #1

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 8843
  • Let's move this topic, shall we?
    • View Profile
    • My Models
I have zero experience in maxscript, but still this might come handy. Thanks!
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2017-06-21, 16:10:05
Reply #2

maru

  • Corona Team
  • Active Users
  • ****
  • Posts: 12758
  • Marcin
    • View Profile
Actually that's really awesome!
Marcin Miodek | chaos-corona.com
3D Support Team Lead - Corona | contact us

2017-06-21, 22:34:19
Reply #3

Jahman

  • Active Users
  • **
  • Posts: 45
  • Panteleev Sergey
    • View Profile
    • some of my scripts for 3ds max
It just Listens to whatever all the Corona Properties are doing, so you can simply use the code in your own tools by simply playing around with the properties.
There's actually a much better way of doing it.

Code: [Select]
deleteAllChangeHandlers id:#renderSettingsChangeListener
when parameters renderers.current change id:#renderSettingsChangeListener do (

handleRenderSettingsChange()

)


Didn't test it much, but I hope everyone who's interested get the idea behind.
Code: [Select]
(
fn getRenderSettings props = (

for p in props collect getProperty renderers.current p

)

renderPropNames = getPropNames renderers.current
lastRenderSettings = getRenderSettings renderPropNames

deleteAllChangeHandlers id:#rendSettings
global renderSettingsChangeHandler = when parameters renderers.current changes id:#rendSettings val do (

props = getRenderSettings renderPropNames
for i=1 to props.count where props[i] != lastRenderSettings[i] do (

if isKindOf props[i] array do (

if (props[i] as string) == (lastRenderSettings[i] as string) do continue -- and never compare arrays like I do

)

format "%: %\n" renderPropNames[i] props[i]

)
lastRenderSettings = props

)

)
« Last Edit: 2017-06-21, 23:15:09 by Jahman »

2017-06-22, 04:18:15
Reply #4

Christa Noel

  • Active Users
  • **
  • Posts: 911
  • God bless us everyone
    • View Profile
    • dionch.studio
hi, Phasma. your script reminds me to this ScriptSpot: scripting the render setup, you have the same method with pixamoon.

hi, Jahman. thanks for sharing the idea, never thought that changeHandler could handle renderers.current

2017-06-22, 11:25:56
Reply #5

Phasma

  • Active Users
  • **
  • Posts: 112
    • View Profile
Thanks for the changeHandler idea, Jahman. I would have never thought about this one!

@Christa Noel: havent had a look in there but I am pretty sure that there was something out there already... in the days of the interwebs at least someone had to come up with a similar idea before :-P... in my case I used a similar script for the Deadlines SMTDSettings...

Thanks romullus and maru!