Chaos Corona Forum
Chaos Scatter => [Scatter] I need help! => Topic started by: Kelevra on 2020-11-17, 14:13:09
-
Hey,
I am currently learning max script and have and idea for a little script involving CScattter.
But I need the actions happening when pushing the "+" under "Distribute-on Objects" and "Instanced" objects". MaxListner do not record it and google was no help.
Does anybody know the actions (the little sting of text) that can be used in maxscript or where I can find it?
Thanks.
-
Maybe this will help?
https://wiki.corona-renderer.com/maxscript#corona_scatter_api
If it's not enough, let me know, and I should be able to get more help.
-
These are properties of the CScatter object itself (not the interface), 'distributionObjects' and 'scatteredObjects' are the names. Both are node arrays. If you have for example a Corona scatter object named 'Corona Scatter001', then you get the scattered objects with
$'Corona Scatter001'.scatteredObjects
You would use the 'join' command to add other nodes to it.
Good Luck
Edit:
Class name and properties have changed, see https://forum.corona-renderer.com/index.php?topic=40283.msg213883#msg213883
-
These are properties of the CScatter object itself (not the interface), 'distributionObjects' and 'scatteredObjects' are the names. Both are node arrays. If you have for example a Corona scatter object named 'Corona Scatter001', then you get the scattered objects with
$'Corona Scatter001'.scatteredObjects
You would use the 'join' command to add other nodes to it.
Good Luck
Thank you so much. This solves it!
-
These are properties of the CScatter object itself (not the interface), 'distributionObjects' and 'scatteredObjects' are the names. Both are node arrays. If you have for example a Corona scatter object named 'Corona Scatter001', then you get the scattered objects with
$'Corona Scatter001'.scatteredObjects
You would use the 'join' command to add other nodes to it.
Good Luck
Hi. May I ask where to find this kind of info? I struggled very hard for a few days until I found this post.
That is indeed the way to assign scattered objects and distribution objects. The thing is, I haven't been able to find anything on the matter anywhere on the internet but in this single post.
I also haven't been able to see it using getINterfaces, showInterfaces or showInterface.
Thanks in advance!
-
Hi,
see Maxscript Class and Object Inspector Functions (https://help.autodesk.com/view/3DSMAX/2017/ENU/?guid=__files_GUID_879ECFAD_7928_44B3_BCD7_276D53C89B52_htm). In most cases, if you want to change anything by script, select an object and type "show $". It's not hard to figure out what the properties mean or do. If you cannot find what you are searching for, check for interfaces. If you issue "showinterfaces $" while having a CScatter object selected, you will see the interfaces and the methods listed in the Wiki (https://wiki.corona-renderer.com/maxscript) already mentioned by Maru. For properties of objects which are not selectable (e.g. Render Elements, objects which are properties etc.), you need to use "show" on an object reference, for example "show renderers.current" to see a list of all CoronaRenderer properties (if Corona is the currently active renderer).
Hope it helps,
Good Luck
-
Hi,
see Maxscript Class and Object Inspector Functions (https://help.autodesk.com/view/3DSMAX/2017/ENU/?guid=__files_GUID_879ECFAD_7928_44B3_BCD7_276D53C89B52_htm). In most cases, if you want to change anything by script, select an object and type "show $". It's not hard to figure out what the properties mean or do. If you cannot find what you are searching for, check for interfaces. If you issue "showinterfaces $" while having a CScatter object selected, you will see the interfaces and the methods listed in the Wiki (https://wiki.corona-renderer.com/maxscript) already mentioned by Maru. For properties of objects which are not selectable (e.g. Render Elements, objects which are properties etc.), you need to use "show" on an object reference, for example "show renderers.current" to see a list of all CoronaRenderer properties (if Corona is the currently active renderer).
Hope it helps,
Good Luck
That's a huge piece of advice. Thanks a lot!
Now I'm facing a weird issue where, even when the objects appear to be assigned (they appear in the array and in the interface of the scatter), they don't show in the viewport or they show but they don't react to changes in the min/max transform settings. This doesn't happen if I manually assign the exact same objects.
Here is the code I'm using, in case anyone wants to test it to see the issue
Basically the append $.distributionobjects <appendedObject> form doesn't seem to be working
ScatteredObj= sphere radius: 1 position:[0,0,0] --ScatteredObj
b = plane length: 100 width:100 pos: [150,150,0] --distrib object
--SCATTER CREATION
Cscatter isselected: on iconsize: 50 pos: ScatteredObj.pos
--APPENDING
append $.distributionobjects b
append $.scatteredobjects ScatteredObj
max zoomext sel -- zooms scatter
Thanks!
-
You would also have to add the distributionobjectsdensity and scatteredObjectsFrequency properties. These arrays are initially empty as well. So your code would look like this:
ScatteredObj= sphere radius: 1 position:[0,0,0] --ScatteredObj
b = plane length: 100 width:100 pos: [150,150,0] --distrib object
--SCATTER CREATION
Cscatter isselected: on iconsize: 50 pos: ScatteredObj.pos
--APPENDING
append $.distributionobjects b
append $.distributionobjectsdensity 1.0
append $.scatteredobjects ScatteredObj
append $.scatteredObjectsFrequency 1.0
max zoomext sel -- zooms scatter
Good Luck
-
Hi Frood. Thank you very much for taking the time to answer again.
I arrived to the same solution and I was coming here to share it!
I basically used this code to compare every property setting in my scatter and in a correctly working one
for i in 1 to (getPropNames$).count do (
print (((getPropNames($))[i]) as string + ": " + (execute ("$." + (getPropNames$)[i])) as string)
)
Once again, thank you for your help!