| Previous Topic (MAXScript Access) | Up (Contents) | Next Topic (None) |
PRT Loader MaxScript Exposure
Particle Loader Implementation
The Krakatoa Particle Loader (PRT Loader) is a hybrid object using a scripted GUI on top of a C++ plug-in. As with the Krakatoa GUI, this was done for flexibility reasons - designing User Interfaces is much easier in MAXScript, while all the heavy duty work is performed in the much faster C++ code.
- The base class (KrakatoaPRTLoaderBase) was implemented as a C++ plug-in using the Max SDK. This plugin provides all the low-level operations like particle loading for display and rendering, particle deformations and culling and so on. This plugin does not expose many properties and is not creatable via the GUI.
- The Particle Loader GUI (KrakatoaPRTLoader) was implemented as a scripted geometry plug-in extending the above-mentioned C++ plug-in. It provides all parameter blocks controlling the Loader's features and implements the GUI level features like Presets, Particle Count graph and so on.
- The two plug-ins communicate with each other, with the base plug-in monitoring the parameter blocks of the scripted plug-in and reacting accordingly.
Scripted Particle Loader Properties
Class: KrakatoaPrtLoader; SuperClass: GeometryClass; ClassID: #(1186461122, 1294604214)
Files
.fileList : string array
Get/set the array of file names to be loaded. The length of the array is arbitrary
.fileListFlags : int array
Get/set the array of particle visibility flags where bit 1 is the viewport visibility, bit 2 is the render visibility. Integer 0 = invisible in view and render, 1 = visible in view only, 2 = visible in render only, 3 = visible in viewport and render. The length of the array MUST match the length of the fileList array!
Render
.renderLoadMode : integer
Get/set the Render > Particle Loading mode index corresponding to the options in the drop-down list.
Possible values are:Note that this mode can indirectly influence the Viewport Particle Loading mode if the latter is set to "Load Using Render Mode" by setting .viewLoadMode=1.
- Load Every Nth Particle
- Load First N Particles (default)
.enabledInRender : boolean
Get/set whether the particles will render or not. When set to false, the particles will not be loaded when rendering. This is independent from the enabledInView option so particles can be shown in the viewport but not show up in a rendering!
.percentRenderer : float
Get/set the percentage of particles to be rendered. This property is ANIMATABLE. Range is 0.0 to 100.0. It is also indirectly controlling the amount of particles displayed in the viewport, because the percentViewport property is calculated as percent of the percentRenderer property!
.useRenderLimit : boolean
Get/set whether to use the renderLimit property to cap the maximum number of particles to be loaded from this Particle Loader when rendering.
.renderLimit : integer
Get/set the number of particles to be loaded from this Particle Loader when the useRenderLimit property is set to true. Value is in thousands, so a value of 1000 means 1000x1000 = 1 million
.particleColorSource : integer
Get/set the index of the drop-down list defining the source of particle color.
Possible values are:This setting might indirectly control the viewport color in case the viewportParticleColorSource property is set to 1.
- Saved Particle Color (default)
- Loader's Wireframe Color
- Loader's Material Self-Illum.
.loadDensities : boolean
Get/set whether to load density information from the particle file. When set to false, the density will be assumed 1.0 and then scaled based on all other parameters affecting particle density like the global particle density, material opacity (if enabled) and visibility track.
.resetDensities : boolean
Get/set whether to reset the content of the Density channel to 1
.copyDensitiesToMapChannel : boolean
Get/set whether to copy the density information from the Density Channel to a Map Channel specified by the .densityMapChannel property. If set to true, the .resetDensities will be implicitly assumed true too.
.densityMapChannel : integer
Get/set the Map channel number to copy the densities to when .copyDensitiesToMapChannel is set to true. Valid values are 0 for Vertex Color channel and 1 to 99 for UV Mapping channels. Once copied, the data could be accessed by a Material via a Vertex Color map set to the same channel.
Viewport
.viewLoadMode : integer
Get/set the Viewport > Particle Loading mode index corresponding to the options in the drop-down list.
Possible values are:When set to 1, the value of the renderLoadMode property will be used to define the viewport loading mode.
- Load Using Render Mode (default)
- Load Every Nth Particle
- Load First N Particles
.enabledInView : boolean
Get/set whether the particles will display in the viewport or not. When set to false, the particles will not be loaded and drawn in the viewport. This is independent from the enabledInRender option so particles can be hidden in the viewport but still show up in a rendering!
.percentViewport : float
Get/set the percentage of particles to be displayed as a fraction of the animatable precentRender property. Range is 0.0 to 100.0. This property is not animatable, but if the percentRender is animated, it will indirectly animate the viewport amounts. Typical default is 1.0% to allow faster viewport redraws. If more than a million particles are being loaded, might require lower values in the 0.1 range.
.useViewportLimit : boolean
Get/set whether to use the viewportLimit property to cap the maximum number of particles to be loaded from this Particle Loader when displaying in the viewport.
.viewportLimit : integer
Get/set the number of particles to be loaded from this Particle Loader when the useViewportLimit property is set to true. Value is in thousands, so a value of 100 means 100x1000 = 100,000
.viewportParticleColorSource : integer
Get/set the index of the drop-down list defining the source of particle color in the viewport.
Possible values are:When set to 1, the value of the particleColorSource property will define the actual color source mode.
- Colors Using Render Mode (default)
- Saved Particle Color
- Loader's Wireframe Color
- Loader's Material Color
.viewportParticleDisplayMode : integer
Get/set the index of the drop-down list defining the shape of particles in the viewport.
Possible values are:
- Display As Small Dots --does not support z-buffering, incorrect sorting in viewports
- Display As Large Dots (default) -- performs correct z-buffering
- Display Velocities -- does not display stationary particles
- Display Normals --does not show particles without normals
.scaleNormals : float
Get/set the normal scale when .viewportParticleDisplayMode is set to 4 (Display Normals).
.showIcon : boolean
Get/set whether to display the Krakatoa Logo Icon. Default is true. Note that when adding object space modifiers, the actual .iconSize property will be used regardless of whether the icon display is enabled or not.
.iconSize : float
Get/set the Krakatoa Logo Icon size.
.showBoundingBox : boolean
Get/set whether to display the particles bounding box. Default is true
Particle Culling
.useCullingGizmo : boolean
Get/set whether to use the objects from the Culling Named Selection Set to cull particles (if the NSS is specified). Default is false.
.invertCullingGizmo : boolean
Get/set whether to cull particles that are outside (false, default) or particles that are inside the culling volumes (true).
.cullingNamedSelectionSet : string
Get/set the name of the Named Selection Set specifying the objects to use for particle culling. Default is "".
.useThresholdCulling : boolean
Get/set whether to use threshold culling.
.cullingThreshold : float
Get/set the culling threshold value.
.getCullingSurfaceNormals : boolean
Get/set whether to use the surface normals of the culling gizmo for particles closer than the Culling Threshold. When set to true, the normals will be acquired from the culling gizmo (if available) regardless of the other Culling state properties.
Particle Count
.showCountInViewport : integer
Get/set which particle count to display in the viewport.
Possible values are:0. No Display
1. Display Disk Count
2. Display Render Count
3. Display Viewport Count
.autoUpdateGraph : boolean
Get/set whether to update the Graph automatically. Default is false.
.graphMode : integer
Get/set the particle count graph mode. Possible values are1. Availability Graph (default) - shows whether a frame exists on disk or not
2. Count Graph - shows the actual particle counts
Timing
.limitToRange : boolean
Get/set whether to clamp the requested frame to be loaded (after calculating time offset, playback graph etc.) to the range specified by rangeStartFrame and rangeEndFrame. When set to true, if a frame outside of the range is requested, its frame number will be clamped to the range limits to avoid errors. If a frame within limits is missing though, it will still cause an error message.
.rangeStartFrame : integer
.rangeEndFrame : integer
Get/set the start and end of the custom frame range used when .limitToRange is set to true.
.loadSingleFrame : boolean
Get/set whether to load the specified file(s) as frame sequences or to just load the exact file name specified on each frame. Default is false. This applies to ALL files in the .fileList array.
.frameOffset : integer
Get/set the frame offset to be applied to the file sequence. Default is 0 (no offset).
.enablePlaybackGraph : boolean
Get/set whether to use the scene time (false, default) or use the animatable playbackGraphTime parameter's value to determine which frame to be loaded on which frame (true).
.playbackGraphTime : float -- ANIMATABLE
Get/set the time to be loaded when .enablePlaybackGraph is set to true. This property is ANIMATABLE and can thus be used to create special animation effects using particle file sequences. Positions and velocities will be extrapolated based on the closest full frame.
Options
.useTransform : boolean
Get/set whether the particles will be transformed by the Loader's transformation matrix (true, default) or loaded in absolute world coordinates, exactly as they were saved (false).
Deformations
.gizmoBoxX : float -- ANIMATABLE
.gizmoBoxY : float -- ANIMATABLE
.gizmoBoxZ : float -- ANIMATABLE
Get/set the size of the modifier context bounding box. Since the particle system's actual bounding box size can vary heavily from frame to frame depending on particle positions, display counts etc., the modifier context is exposed as a user-defined box that can be animated over time for advanced deformation effects.
Internal
.KrakatoaPrtLoaderBase
Contains the base object extended by the scripted plug-in.
C++ Particle Loader Plug-in Properties
Class: KrakatoaPrtLoaderBase; SuperClass: GeometryClass; ClassID: #(1875294739, 459190122)
.CullingRefs : node array
Internal. Not accessible to MAXScript
.NodeRefs : maxObject array
Internal. Not accessible to MAXScript
.OwnerRef : maxObject
Internal. Not accessible to MAXScript
.LastErrorMessage : value
Contains the last error message caused by a missing file during loading. Used by the scripted plug-in to display when pressing the Update Info button.