Plush

Components#

plupy · Type index

Module: plupy · obtained from obj.components

The components stored on an object or component group (obj.components): look up by ID or unambiguous name, iterate, find(key), choices() and add(key). Editing them changes every use of that object.

class Components(Collection)

Inherits Collection: its members are documented there.

Usage and examples

Members: choices · find · Indexing · add

choices#

choices()

Returns a tuple of available component descriptors, including keys, names and categories. Use returned keys unchanged. Script choices come from successfully compiled C# scripts.

find#

find(key: str) -> tuple[Component, ...]

All locally owned instances with this exact catalog key.

Returns every local component with the exact catalog key, such as "render2D" or "script:MyMover"; returns an empty tuple when none match. Use components[id] for one stable instance or components[name] for an unambiguous display name. Duplicate names raise AmbiguousError, including through get().

Indexing#

x[key]

The component with this ID, display name ("Rigid Body") or catalog key ("physicsBody", "script:Mover"): KeyError when none matches (the message lists the names and keys present), AmbiguousError when several share the key (use find(key) for all of them).

add#

add(key: str, *, mesh: DataBlock | None=None) -> Component

Adds a component and returns its handle. Examples: "render2D", "mesh", "script:TypeName". The mesh component needs a mesh datablock via mesh=. Variant component edits require explicitly choosing the base. Unsupported keys or invalid references raise PlupyError.

AmbiguousError · Collection · Component · DataBlock · PlupyError · Use

Source#