Chaos Corona Forum

Chaos Corona for 3ds Max => [Max] Corona Goodies - User Contributions => Topic started by: Frood on 2022-10-25, 13:13:31

Title: Macroscript to quickly add/remove Scatter Edge Trimming map
Post by: Frood on 2022-10-25, 13:13:31
Since there is ChaosScatter with Edge Trimming support now, here is a macroscript to quickly add and remove the ChaosScatterEdgeTrimming map to and from materials. Select a material (or multiple materials) in SME and execute it. If any scene object is selected, the material(s) of all selected objects will get processed instead. Supported materials are Multimaterial, Standardmaterial, CoronaPhysicalMtl and CoronaLegacyMtl.

Assign this script to two different hotkeys, where one hotkey uses the "SHIFT" key as part of the key combination. If "SHIFT" is pressed while invoking the script, "Remove" mode is active.

Example:
Assign this script to "Alt+Ctrl+E" and to "ALT+Ctrl+SHIFT+E". If you then press "Alt+Ctrl+E", "Add" mode is active. If you press "ALT+Ctrl+SHIFT+E", ChaosScatterEdgeTrimming maps will be removed instead.


We will probably not need those EdgeMaps anymore using Corona v10, but until then...


Good Luck


Edit:
Changed description to match version 0.3, attached version 0.3:
Required hotkey modifier key changed from "ALT" to "SHIFT" to trigger remove mode. Restored node selection in SME after removing EdgeTrimming maps. Removed console spam.
Edit:
Attached version 0.4:
Fixed undefined active SME view after starting Max without having SME opened once
Title: Re: Macroscript to quickly add/remove Scatter Edge Trimming map
Post by: romullus on 2022-10-25, 14:21:49
Thank you very much!
Title: Re: Macroscript to quickly add/remove Scatter Edge Trimming map
Post by: PROH on 2022-10-25, 15:16:01
Thank you :)

I'm running the script without hotkeys, and it adds Edge Trimming map(s) without problems. But I can't get it to remove them again.

Is this possible without hotkeys?

Corona 9
Max 2020
Title: Re: Macroscript to quickly add/remove Scatter Edge Trimming map
Post by: Frood on 2022-10-25, 17:23:07
I'm running the script without hotkeys

You mean as a toolbar icon? Then the only modifying key which would work is Shift (one reason why I prefer to hotkey it). Alt and Ctrl do not allow to run an icon. So you could change the line

Code: [Select]
if keyboard.altPressed then mode="Remove" else mode="Add"
in "on execute()" to

Code: [Select]
if keyboard.shiftPressed then mode="Remove" else mode="Add"
Then, a standard click on the icon would add the maps, and Shift+click on the icon would remove them. Hope it helps,


Good Luck




Title: Re: Macroscript to quickly add/remove Scatter Edge Trimming map
Post by: PROH on 2022-10-25, 18:11:09
Thank you.
I use hotkeys instead. It works very well, and simplifies the use of edgetrim enormous.

Great script :)
Title: Re: Macroscript to quickly add/remove Scatter Edge Trimming map
Post by: Frood on 2022-10-26, 10:10:29
Ok, nevertheless I changed the remove modifier key to shift, first post updated. This way add and remove is possible with both (icon/hotkey).


Good Luck


Title: Re: Macroscript to quickly add/remove Scatter Edge Trimming map
Post by: mike288 on 2022-10-26, 13:54:07
Very cool! Thank you. And yeah, we will focus not to have such burden for v10 anymore. :-)
Title: Re: Macroscript to quickly add/remove Scatter Edge Trimming map
Post by: PROH on 2022-10-26, 15:16:16
Hmm.. still can't get the toolbar icon to "remove" (shift + click), so I'm just using hotkeys.

Edit: With v 0.4 everything works as expected. Thank You :)
Title: Re: Macroscript to quickly add/remove Scatter Edge Trimming map
Post by: aaouviz on 2023-02-15, 12:14:32
Very cool! Thank you. And yeah, we will focus not to have such burden for v10 anymore. :-)

Any progress with this? :)
Title: Re: Macroscript to quickly add/remove Scatter Edge Trimming map
Post by: romullus on 2023-02-15, 16:28:44
+1

It's bad enough that edge trimming was officially released with this clunky workflow, it would be even worse if we have to wait for proper implementation for several years.
Title: Re: Macroscript to quickly add/remove Scatter Edge Trimming map
Post by: aaouviz on 2023-02-15, 19:06:21
To be fair, the script/plug-in that Frood shared above which automatically adds the trimming is VERY useful, fast and good.

So... there's that at least