Author Topic: Corona Scatter "Distribute-on objects" and "Instanced objects" max script  (Read 950 times)

2020-11-17, 14:13:09

Kelevra

  • Users
  • *
  • Posts: 2
    • View Profile
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.

2020-11-17, 16:58:27
Reply #1

maru

  • Corona Team
  • Active Users
  • ****
  • Posts: 10881
  • Marcin
    • View Profile

2020-11-17, 17:42:20
Reply #2

Frood

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

Code: [Select]
$'Corona Scatter001'.scatteredObjects
You would use the 'join' command to add other nodes to it.


Good Luck



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

2020-11-25, 15:47:23
Reply #3

Kelevra

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

Code: [Select]
$'Corona Scatter001'.scatteredObjects
You would use the 'join' command to add other nodes to it.


Good Luck

Thank you so much. This solves it!

2021-09-14, 03:05:36
Reply #4

Mstp

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

Code: [Select]
$'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!

2021-09-14, 09:39:24
Reply #5

Frood

  • Active Users
  • **
  • Posts: 1662
    • View Profile
    • Rakete GmbH
Hi,

see Maxscript Class and Object Inspector Functions. 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 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



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

2021-09-14, 23:14:48
Reply #6

Mstp

  • Users
  • *
  • Posts: 2
    • View Profile
Hi,

see Maxscript Class and Object Inspector Functions. 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 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

Code: [Select]
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!

Yesterday at 21:42:57
Reply #7

Frood

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

Code: [Select]
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



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