DataCollection#
Datablocks of one kind (plupy.data.objects, .scenes, .materials, .libraries, .matter, or plupy.data.of_type(kind)): look up by ID or exact name, iterate, new(name) and delete(block).
class DataCollection(Collection)Inherits Collection: its members are documented there.
Usage and examples
Derived types: EffectChainCollection · FontCollection · MeshCollection · ModulationChainCollection · PhysicsMaterialCollection · ShaderCollection · ShapeCollection · SoundCollection · SoundSequenceCollection · SpriteCollection
new#
new(name: str, **options) -> DataBlockCreates and returns data. Supported kinds include object, scene, mesh, material, effect, library, style2D, stylesheet2D and compiled project data declarations (data:Namespace.ClassName). A Style 2D's values are its props (style2D.fill, style2D.radius, …); a Stylesheet 2D's text is props["stylesheet2D.source"]. Create custom data with plupy.data.of_type("data:ImpactSettings").new("Heavy impact"), then edit its C# property names through block.props. Mesh creation requires primitive= or generator=; there is no default. Mesh primitives: plane, cube, sphere, cone, cylinder, cube-fine, sphere-fine, plane-fine. Generators build a mesh from numbers (see generated meshes): box, cylinder, tube, elbow, wedge, stairs, grating, panel, ibeam; further keyword arguments set that generator's parameters, for example meshes.new("Drum", generator="cylinder", radius=0.3, height=0.9). Unspecified parameters keep their defaults. Unknown options raise TypeError; unsupported kinds, unknown parameters or invalid values raise PlupyError. Creation does not add scene or Library membership.
Generator parameters (meters unless noted; values outside a range are clamped; every generator also takes uvScale, the texture size in meters per repeat, default 1):
| Generator | Parameters (default) | Shape |
|---|---|---|
box | sizeX 1, sizeY 1, sizeZ 1, bevel 0 | Width, height, depth; bevel 0 is sharp |
cylinder | radius 0.5, topRadius 0.5, height 1, segments 24, capBottom 1, capTop 1 | Along Y; topRadius 0 is a cone; caps 0/1 |
tube | radius 0.5, thickness 0.05, height 1, segments 24 | Open pipe along Y |
elbow | radius 0.1, bendRadius 0.3, angle 90 (degrees), segments 16, rings 8, capped 0 | Starts along +Y and bends toward +X |
wedge | sizeX 1, sizeY 1, sizeZ 1 | Full height at −Z, sloping down to +Z |
stairs | width 2, rise 0.18, run 0.28, steps 8 | Climbs toward −Z |
grating | sizeX 2, sizeZ 1, spacing 0.05, barWidth 0.006, thickness 0.03, crossSpacing 0.2 | Bars along X |
panel | sizeX 2, sizeY 3, thickness 0.1, frame 0.1, inset 0.02 | Faces +Z; frame 0 is flat |
ibeam | length 4, height 0.3, flangeWidth 0.15, flangeThickness 0.02, webThickness 0.012 | Extruded along X |
Counts (segments, rings, steps) and switches (capBottom, capTop, capped) are rounded to whole numbers. Every generated mesh is centered on its bounding box. Generate each size you need rather than scaling one unit piece: a placement's scale also stretches the bevel and texture.
delete#
delete(block)Deletes an unreferenced datablock in this collection. Returns None. A different datablock kind raises TypeError; remaining users cause PlupyError. Dependencies are not deleted recursively.
Related types#
Collection · DataBlock · Library · Mesh · PlupyError · edit
Source#
- _live.py:198