PRT Loader MAXScript Exposure¶
Available in Krakatoa v1.0.0 and higher
PRT Loader Implementation¶
- The Krakatoa 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;
- Integer 1 = visible in view only, won’t render;
- Integer 2 = visible in render only, won’t display;
- Integer 3 = visible in viewport and render.
- IMPORTANT! The length of the array MUST match the length of the fileList array, otherwise you might produce a crash!
- In other words, whenever you add or remove an item in the .fileList array, you should also add or remove the corresponding item in the .fileListFlags array.
Render¶
.renderLoadMode : integer
- Get/set the Render > Particle Loading mode index corresponding to the options in the drop-down list.
- Possible values are:
- Load Every Nth Particle
- Load First N Particles (default)
- 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.
.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
Viewport¶
.viewLoadMode : integer
- Get/set the Viewport > Particle Loading mode index corresponding to the options in the drop-down list.
- Possible values are: * Load Using Render Mode (default) * Load Every Nth Particle * Load First N Particles
- When set to 1, the value of the renderLoadMode property will be used to define the viewport loading mode.
.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
.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).
.ignoreMaterial : boolean
- When set to true, the material assigned to the PRT Loader will be ignored when displaying particles in the viewport, for example in order to preview KCM data as color.
- When set to false(default), the Material assigned to the PRT Loader will be shown in the viewport.
.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:
- No Display
- Display Disk Count
- Display Render Count
- 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 are
- Availability Graph (default) - shows whether a frame exists on disk or not
- Count Graph - shows the actual particle counts
Timing¶
.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.
.keepVelocityChannel : boolean
- Get/set whether to reset the Velocity channel to [0,0,0] when .loadSingleFrame is set to true.
- When false (default), loading a single frame will discard the Velocity informations because static particles should not motion blur.
- When true, the Velocity channel will be respected and the particles will produce motion blur as well as provide velocity data to Krakatoa Channels Modifiers on the stack.
- One possible usage of this mode is moving particles loaded from a single frame along their velocity vectors using a KCM based on the current time.
.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.
.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 either be clamped to the range limits to avoid errors or no particles will be output, depending on the .beforeRangeBehavior and .afterRangeBehavior properties.
- 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.
.beforeRangeBehavior : integer .afterRangeBehavior : integer
- Get/set the behavior of the PRT Loader when Use Custom Range is enabled and a frame is requested outside of the range.
- When the value is 1 (Hold), the first or last particle file will be used in place of all frames outside of the range.
- When the value is 2 (Blank), no particles will be generated outside of the range.
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.
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.
OBSOLETE PROPERTIES¶
- The following properties were available in Krakatoa v1.1.3 and earlier and were retired in v1.5.0:
.particleColorSource : integer
- Get/set the index of the drop-down list defining the source of particle color.
- Possible values are:
- Saved Particle Color (default)
- Loader’s Wireframe Color
- Loader’s Material Self-Illum.
- This setting might indirectly control the viewport color in case the viewportParticleColorSource property is set to 1.
.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.
.viewportParticleColorSource : integer
- Get/set the index of the drop-down list defining the source of particle color in the viewport.
- Possible values are:
- Colors Using Render Mode (default)
- Saved Particle Color
- Loader’s Wireframe Color
- Loader’s Material Color
- When set to 1, the value of the particleColorSource property will define the actual color source mode.