Data#
plupy.data: the project's datablocks by kind (objects, scenes, meshes, materials, sounds, …), each a collection to look up, create, import and delete in. Works in the editor and headlessly, without a selection.
| Property | Item type | Creation |
|---|---|---|
data.objects | Object | Empty object |
data.scenes | Scene | Empty scene |
data.meshes | Mesh | Primitive or generated mesh, or import_file(path) for a .glb model |
data.sprites | DataBlock | import_file(path) only: an image for materials and 2D |
data.materials | DataBlock | Material |
data.shaders | Shader | new(name, surface_model="lit") or new_slang(name, source=..., parameters=...) |
data.libraries | Library | Library |
data.matter | DataBlock | Matter substance (density, toughness…; set with props) for the matter component |
data.shapes | DataBlock | Physics shape: new(fit=…) or new(kind=…) |
data.physics_materials | DataBlock | Physics material (friction, restitution) |
data.fonts | DataBlock | import_file(path) only |
data.sounds | Sound | import_file(path), import_soundfont(path), or new(name) for an empty Sound to fill with keyzones |
data.modulation_chains | ModulationChain | new(name); add, set, remove envelopes |
data.effect_chains | EffectChain | new(name); add, set, move, remove audio effects |
data.sound_sequences | SoundSequence | new(name, text=None); edited as text; import_midi(path, …) |
class DataUsage and examples
Members: objects · scenes · meshes · sprites · materials · shaders · libraries · matter · shapes · physics_materials · fonts · sounds · sound_sequences · modulation_chains · effect_chains · of_type · unused · purge_unused
objects#
objects = DataCollection('object')A class attribute shared by every instance.
scenes#
scenes = DataCollection('scene')A class attribute shared by every instance.
meshes#
meshes = MeshCollection()A class attribute shared by every instance.
sprites#
sprites = SpriteCollection()A class attribute shared by every instance.
materials#
materials = DataCollection('material')A class attribute shared by every instance.
shaders#
shaders = ShaderCollection()A class attribute shared by every instance.
libraries#
libraries = DataCollection('library')A class attribute shared by every instance.
matter#
matter = DataCollection('matter')A class attribute shared by every instance.
shapes#
shapes = ShapeCollection('physicsShape')A class attribute shared by every instance.
physics_materials#
physics_materials = PhysicsMaterialCollection('physicsMaterial')A class attribute shared by every instance.
fonts#
fonts = FontCollection()A class attribute shared by every instance.
sounds#
sounds = SoundCollection()A class attribute shared by every instance.
sound_sequences#
sound_sequences = SoundSequenceCollection()A class attribute shared by every instance.
modulation_chains#
modulation_chains = ModulationChainCollection()A class attribute shared by every instance.
effect_chains#
effect_chains = EffectChainCollection()A class attribute shared by every instance.
of_type#
of_type(kind: str) -> DataCollectionReturns a collection filtered by an exact datablock kind string. An unknown kind returns an empty collection. Compiled C# data declarations use data:Namespace.ClassName and support .new(name). Other kinds support creation only where documented on their collection.
unused#
unused() -> tuple[DataBlock, ...]Datablocks nothing refers to (scenes and libraries are never listed).
Returns datablocks nothing refers to: no scene, object, Library entry, component or other datablock uses them. Scenes and libraries are roots and are never listed; the project's default physics material and its collision layers are kept. Writes nothing.
purge_unused#
purge_unused() -> strDelete every unused datablock (and what that frees) in one undo step; returns a summary.
Deletes every unused datablock, then whatever that frees in turn (a controller's states, then their clips), in one Undo step, and returns a summary such as "Purged 3 unused datablocks: 2 mesh, 1 material. Undo restores them.". Data files go with them; source assets (models, images, fonts) stay. It covers the whole project: a builder script that shares a project with other authored content should delete the datablocks it owns instead.
Related types#
DataBlock · DataCollection · EffectChain · EffectChainCollection · FontCollection · Library · Mesh · MeshCollection · ModulationChain · ModulationChainCollection · Object · PhysicsMaterialCollection · Property · Scene · Shader · ShaderCollection · ShapeCollection · Sound · SoundCollection · SoundSequence · SoundSequenceCollection · SpriteCollection
Source#
- _live.py:1948