Plush

plupy API reference#

User manual · API home · All types · Operations · Python guides

Python API for editing Plush project data. Run scripts in the editor's Code tab or with Plush --run-python <project> <script.py>. Both use bundled Python. Exported games do not use Python.

Run your first script · Examples · Workspace and imports

Entry points#

Entry pointTypePurpose
plupy.dataDataFind, create and edit project datablocks without a selection or visible scene
plupy.contextContextSupply temporary targets or use an editor area's captured selection
plupy.ops.objectObjectOpsMove scene uses through an editing operation
plupy.edit(label)editCommit a group of edits as one Undo step
plupy.scriptsScriptsCreate a C# script file and attach it to an object
plupy.Project, plupy.inspect_sceneProject, inspect_sceneRead immutable snapshots from an external Python process
plupy.PlupyError, plupy.AmbiguousErrorPlupyError, AmbiguousErrorLookup, validation and session errors

Types by area#

One page per type, generated from the wrapper's docstrings (tools/python/plupy_docs.py), with a heading per member, its signature and how it behaves. Live handles come from the API; do not construct them or import private _live classes. Operations maps every editor operation name (uses.add, the names the editor's assistant uses) to the member that documents it.

AreaTypesGuide
DataData, DataCollection, DataBlock, Properties, Mesh, the import collectionsProject data
Scenes and usesScene, Uses, Use, Transform, SceneCollection, ObjectObjects, scenes and uses · Transforms
Components and inputsComponents, Component, ComponentProperties, Pins, Inputs, EvaluatedUseComponents, pins and inputs · Evaluated values
AudioSound, SoundSequence, EffectChain, ModulationChain and their collectionsProject data
LibraryLibrary, LibraryFolderLibrary and model files
Context and operationsContext, ObjectOps, the selection handlesContext and selection · Object operations
Sessionedit, PlupyError, HandleEdit groups · Errors and handle lifetime
SnapshotsProject, inspect_sceneExternal snapshots

Create and place an object#

import plupy

with plupy.edit("Create crate"):
    scene = plupy.data.scenes.new("Crate scene")
    crate = plupy.data.objects.new("Crate")
    mesh = plupy.data.meshes.new("Crate mesh", primitive="cube")
    crate.components.add("mesh", mesh=mesh)
    placed = scene.objects.add(crate)
    placed.transform.position = (2, 0, 0)

Open Crate scene to inspect the result. One Undo removes this group. No context or selection setup is required. Each run creates new data.

Common rules#

This reference documents callable APIs only. Missing features and proposals are tracked in Linear, outside the reference.