raimad.Compo
class
Compo(
builtins.object,
):
Compos: the building blocks of RAIMAD.
TODO explain
def __init__(self, *args: Any, **kwargs: Any) -> None:
Instantiate new Compo.
Parameters
*args, **kwargs
All arguments and keyword arguments are forwarded to `self._make()`
def _make(self, *args: Any, **kwargs: Any) -> None:
TODO doc conventions for virtual methods.
TODO
@classmethod def partial(cls, **kwargs: Any) -> 'rai.typing.Partial':
Return a Partial of this component class.
Parameters
kwargs: Any
Options to store in the Partial
Returns
rai.typing.Partial
The new Partial
def steamroll(self) -> 'rai.typing.Geoms':
Steamroll the entire compo hierarchy into one Geoms dict.
Returns
rai.typing.Geoms
Returns all geometries (i.e. all raw geometries as well as subcompos) of this component
TODO example
def final(self) -> Self:
Return self.
This method exists for uniformity with Proxy.final
Returns
Self
`self` is returned
def depth(self) -> int:
Return the number zero.
This method exists for uniformity with Proxy.depth
Returns
int
The number 0 is returned.
def descend(self) -> Iterator[Self]:
Yield self.
This method exists for uniformity with Proxy.descend.
Yields
Self
Yields `self`.
def descend_p(self) -> 'Iterator[rai.typing.Proxy]':
Yield nothing.
This method exists for uniformity with Proxy.descend_p
Yields
None
Nothing is yielded.
def proxy(self) -> 'rai.typing.Proxy':
Return a new proxy pointing to this compo.
Returns
rai.typing.Proxy
The new proxy
def walk_hier(self) -> Iterator[ForwardRef('rai.typing.CompoLike')]:
Traverse the subcomponent hierarchy of this compo.
This method will recursively walk through the entire subcompo hierarchy of this compo.
Yields
rai.typing.Proxy
TODO explain better
def transform_point(self, point: 'rai.typing.PointLike') -> 'rai.typing.PointLike':
Do nothing to `point` and return as-is.
This method exists for uniformity with Proxy.transform_point.
Parameters
pointrai.typing.PointLike
A point
Returns
rai.typing.Point
The same point
@classmethod def __init_subclass__(cls) -> None:
Bookkeeping for creating new Compo classes.
def auto_subcompos(self, locs: dict[typing.Any, typing.Any] | None = None) -> None:
Dirty hack for use in `_make` to quickly add all proxies as subcompos.
Simply call `self.auto_subcompos(locals())` at the end of your `_make()` function, and all of the proxies in the scope of `_make()` will be added as subcompos. Better yet, don't use this function and add subcompos manually.
Parameters
locs
This should be set to the output of `locals()`. The function will use this to see what proxies were defined in the caller and add them as subcompos. If `None` is passed, this function will instead use arcane `inspect` magic to traverse the stack and find the proxies defined in the caller.
def __str__(self) -> str:
Get string representation of compo.
Returns
str
TODO sample string
def __repr__(self) -> str:
Get string representation of compo.
Returns
str
TODO sample string
Property scale
Deliberately unimplemented -- see Proxy.scale.
Raises
TransformCompoError
always raised.
Property move
Deliberately unimplemented -- see Proxy.move.
Raises
TransformCompoError
always raised.
Property movex
Deliberately unimplemented -- see Proxy.movex.
Raises
TransformCompoError
always raised.
Property movey
Deliberately unimplemented -- see Proxy.movey.
Raises
TransformCompoError
always raised.
Property rotate
Deliberately unimplemented -- see Proxy.rotate.
Raises
TransformCompoError
always raised.
Property flip
Deliberately unimplemented -- see Proxy.flip.
Raises
TransformCompoError
always raised.
Property hflip
Deliberately unimplemented -- see Proxy.hflip.
Raises
TransformCompoError
always raised.
Property vflip
Deliberately unimplemented -- see Proxy.vflip.
Raises
TransformCompoError
always raised.
Property bbox
Get a BBox pointing to this proxy.
Returns
rai.BBox
A BBox which encompasses all geometry of this compo