Karana.KUtils.MultibodyTUI.graphics#

Attributes#

Classes#

FocusBase

Base class for emphasizing items in a list

NodePool

Basic helper for reusable ProxySceneNodes

PartHighlighter

FocusBase that applies a fixed material to focused SceneParts

LoopLineCookie

Cookie data for LoopConnector

LoopConnector

FocusBase that draws a line across a LoopConstraintHinge

FramePairLineCookie

Cookie data for FramePairConnector

FramePairConnector

FocusBase that draws lines connecting Frame pairs

FrameAxesDisplay

FocusBase that shows a Frame's axes

MaskSelectTUI

Base class for terminal user interfaces

PerspectiveModeTUI

Base class for terminal user interfaces

Module Contents#

Karana.KUtils.MultibodyTUI.graphics.Item#
Karana.KUtils.MultibodyTUI.graphics.Cookie#
class Karana.KUtils.MultibodyTUI.graphics.FocusBase[source]#

Bases: Generic[Item, Cookie], abc.ABC

Base class for emphasizing items in a list

The intent is for concrete subclasses to implement side effects in _focus_one that indicate to the user that the item is in focus (and do the inverse in _unfocus_one). For example, if Item is a Frame then _focus_one might turn on axes visualization for that Frame. The Cookie can be used if some arbitrary state from _focus_one is needed later in the corresponding _unfocus_one.

list_focused() collections.abc.Iterable[Item][source]#

All currently focused items

is_focused(item: Item) bool[source]#

Whether a given item is focused

set(items: collections.abc.Iterable[Item])[source]#

Set the list of focused items

This will intelligently consider only the changes in the focus list and do the minimal amount of focusing/unfocusing. This is to avoid triggering unnecesssary side effects that may be performance intensive.

Parameters:

items (Iterable[Item]) – The new list of focused items

add(items: collections.abc.Iterable[Item])[source]#

Additionally focus a list of items

This doesn’t affect currently focused items and will ignore items from the given list that are already focused.

Parameters:

items (Iterable[Item]) – The additional new items to focus

remove(items: collections.abc.Iterable[Item])[source]#

Unfocus a list of items

This will ignore items that aren’t already focused

Parameters:

items (Iterable[Item]) – The items to unfocus

clear()[source]#

Unfocus all focused items

__del__()[source]#
class Karana.KUtils.MultibodyTUI.graphics.NodePool(name: str, scene: Karana.Scene.ProxyScene)[source]#

Basic helper for reusable ProxySceneNodes

For use cases where nodes need to be constantly added and removed, this pool can be used in lieu of actually creating and destroying the nodes. Instead, when a node is no longer needed it can be returned to the pool for later reuse. If the pool runs out of unused nodes it will automatically create new ones as needed.

borrow() Karana.Scene.ProxySceneNode[source]#

Get a node from the pool

Returns:

A free node from the pool

Return type:

ProxySceneNode

release(node: Karana.Scene.ProxySceneNode)[source]#

Return a node to the pool for reuse

Parameters:

node (ProxySceneNode) – The node to return to the pool

class Karana.KUtils.MultibodyTUI.graphics.PartHighlighter(highlight: Karana.Scene.Scene_types.MaterialType | Karana.Scene.Color)[source]#

Bases: FocusBase[Karana.Scene.ScenePart, Karana.Scene.Scene_types.MaterialType]

FocusBase that applies a fixed material to focused SceneParts

class Karana.KUtils.MultibodyTUI.graphics.LoopLineCookie[source]#

Cookie data for LoopConnector

src_node: Karana.Scene.ProxySceneNode#
tgt_node: Karana.Scene.ProxySceneNode#
line_id: int#
class Karana.KUtils.MultibodyTUI.graphics.LoopConnector(scene: Karana.Scene.ProxyScene, source_color: Karana.Scene.Color, target_color: Karana.Scene.Color)[source]#

Bases: FocusBase[Karana.Dynamics.LoopConstraintHinge, LoopLineCookie]

FocusBase that draws a line across a LoopConstraintHinge

class Karana.KUtils.MultibodyTUI.graphics.FramePairLineCookie[source]#

Cookie data for FramePairConnector

src_node: Karana.Scene.ProxySceneNode#
tgt_node: Karana.Scene.ProxySceneNode#
line_id: int#
class Karana.KUtils.MultibodyTUI.graphics.FramePairConnector(scene: Karana.Scene.ProxyScene, source_color: Karana.Scene.Color, target_color: Karana.Scene.Color)[source]#

Bases: FocusBase[tuple[Karana.Frame.Frame, Karana.Frame.Frame], FramePairLineCookie]

FocusBase that draws lines connecting Frame pairs

class Karana.KUtils.MultibodyTUI.graphics.FrameAxesDisplay(scene: Karana.Scene.ProxyScene, axes_size: float = 10)[source]#

Bases: FocusBase[Karana.Frame.Frame, Karana.Scene.ProxySceneNode]

FocusBase that shows a Frame’s axes

class Karana.KUtils.MultibodyTUI.graphics.MaskSelectTUI(camera: Karana.Scene.GraphicalSceneCamera)[source]#

Bases: Karana.KUtils.MultibodyTUI.dialog.FlagsTUI

Base class for terminal user interfaces

property mask#
Karana.KUtils.MultibodyTUI.graphics.PerspectiveModeOptions#
class Karana.KUtils.MultibodyTUI.graphics.PerspectiveModeTUI[source]#

Bases: Karana.KUtils.MultibodyTUI.dialog.ChoiceTUI

Base class for terminal user interfaces

property mode: PerspectiveModeOptions | None#