Author Topic: Macroscript to quickly add/remove Scatter Edge Trimming map  (Read 7306 times)

2022-10-25, 13:13:31

Frood

  • Active Users
  • **
  • Posts: 1967
    • View Profile
    • Rakete GmbH
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
« Last Edit: 2022-10-27, 16:22:59 by Frood »
Never underestimate the power of a well placed level one spell.

2022-10-25, 14:21:49
Reply #1

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 9025
  • Let's move this topic, shall we?
    • View Profile
    • My Models
Thank you very much!
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2022-10-25, 15:16:01
Reply #2

PROH

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

2022-10-25, 17:23:07
Reply #3

Frood

  • Active Users
  • **
  • Posts: 1967
    • View Profile
    • Rakete GmbH
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




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

2022-10-25, 18:11:09
Reply #4

PROH

  • Active Users
  • **
  • Posts: 1219
    • View Profile
Thank you.
I use hotkeys instead. It works very well, and simplifies the use of edgetrim enormous.

Great script :)

2022-10-26, 10:10:29
Reply #5

Frood

  • Active Users
  • **
  • Posts: 1967
    • View Profile
    • Rakete GmbH
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


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

2022-10-26, 13:54:07
Reply #6

mike288

  • Former Corona Team Member
  • Active Users
  • **
  • Posts: 353
  • Michal 'Mike' Wirth
    • View Profile
Very cool! Thank you. And yeah, we will focus not to have such burden for v10 anymore. :-)
Chaos Scatter developer | In case of crash, please send minidump | Private uploader: https://corona-renderer.com/upload

2022-10-26, 15:16:16
Reply #7

PROH

  • Active Users
  • **
  • Posts: 1219
    • View Profile
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 :)
« Last Edit: 2022-10-27, 16:54:39 by PROH »

2023-02-15, 12:14:32
Reply #8

aaouviz

  • Active Users
  • **
  • Posts: 945
    • View Profile
    • Another Angle 3D
Very cool! Thank you. And yeah, we will focus not to have such burden for v10 anymore. :-)

Any progress with this? :)
Nicolas Pratt
Another Angle 3D
https://www.instagram.com/anotherangle3d/

2023-02-15, 16:28:44
Reply #9

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 9025
  • Let's move this topic, shall we?
    • View Profile
    • My Models
+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.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2023-02-15, 19:06:21
Reply #10

aaouviz

  • Active Users
  • **
  • Posts: 945
    • View Profile
    • Another Angle 3D
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
Nicolas Pratt
Another Angle 3D
https://www.instagram.com/anotherangle3d/