Chaos Corona Forum

Chaos Corona for 3ds Max => [Max] Corona Goodies - User Contributions => Topic started by: Phasma on 2017-06-21, 12:54:33

Title: Corona Listener
Post by: Phasma on 2017-06-21, 12:54:33
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
Title: Re: Corona Listener
Post by: romullus on 2017-06-21, 14:24:46
I have zero experience in maxscript, but still this might come handy. Thanks!
Title: Re: Corona Listener
Post by: maru on 2017-06-21, 16:10:05
Actually that's really awesome!
Title: Re: Corona Listener
Post by: Jahman on 2017-06-21, 22:34:19
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

)

)
Title: Re: Corona Listener
Post by: Christa Noel on 2017-06-22, 04:18:15
hi, Phasma. your script reminds me to this ScriptSpot: scripting the render setup (http://www.scriptspot.com/forums/3ds-max/general-scripting/scripting-the-render-set-up), you have the same method with pixamoon.

hi, Jahman. thanks for sharing the idea, never thought that changeHandler could handle renderers.current
Title: Re: Corona Listener
Post by: Phasma on 2017-06-22, 11:25:56
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!