Chaos Corona Forum

Chaos Corona for 3ds Max => [Max] General Discussion => Topic started by: harumscarum on 2022-05-10, 13:45:09

Title: Corona Decal - maxscript commands
Post by: harumscarum on 2022-05-10, 13:45:09
is there any way to add objects (by its name) to the Corona Decal (include list) with the maxscript?
Title: Re: Corona Decal - maxscript commands
Post by: Frood on 2022-05-10, 14:37:35
Hi, try:

Code: [Select]
-- create a decal object:
mydecal=CDecal name: "Testdecal"

-- print the include/exclude list:
mydecal.excludeList

-- create some node...
mybox=box name: "Testbox"

--- ... and add it to the node array:
appendifunique mydecal.excludelist mybox

-- create another...
my2ndBox=box name: "Anotherbox"

-- ... and add it to the array using its name:
appendifunique mydecal.excludelist $Anotherbox

--- see the updated excludeList:
mydecal.excludelist

-- list all properties of the decal object:
show mydecal



Good Luck



Title: Re: Corona Decal - maxscript commands
Post by: harumscarum on 2022-05-10, 14:53:06
wow, thank you very much!

I wonder if the following is also possible:
- Run script to select bitmap file
- Corona Decal created with the dimensions of the bitmap (1px=1m)

That would be very useful tool to create real-world-size Corona Decal objects in one click
Title: Re: Corona Decal - maxscript commands
Post by: Frood on 2022-05-10, 15:58:20
Hi,

sure:

Code: [Select]
bm=selectBitMap caption:"Select bitmap to create a decal object from."
mydecal=CDecal sizeX:bm.width sizeY:bm.height name: ((getFileNameFile(bm.filename) as string)+"_Decal")
decalmat=CoronaPhysicalMtl name: ((getFileNameFile(bm.filename) as string)+"_Decal_Material") baseTexmap: (Bitmaptexture name: (getFileNameFile(bm.filename) as string) filename: bm.filename)
mydecal.material=decalmat


I'd create a macroscript from it though and check for CDecal class and/or version of CoronaRenderer first (on isEnabled() ).


Good Luck



Title: Re: Corona Decal - maxscript commands
Post by: harumscarum on 2022-05-11, 21:49:08
thank you so much!
Title: Re: Corona Decal - maxscript commands
Post by: harumscarum on 2023-04-08, 00:01:40
Is there any way to clear include/exclude list by maxscript command for all Corona Decals objects in the scene?
Title: Re: Corona Decal - maxscript commands
Post by: Frood on 2023-04-08, 12:16:05
Hi, try

Code: [Select]
for o in getClassinstances Cdecal do o.excludeList=#()

Good Luck