Karana.KUtils.MultibodyTUI.graphics
===================================

.. py:module:: Karana.KUtils.MultibodyTUI.graphics

.. autoapi-nested-parse::

   Classes and functions for MultibodyTUI to interact with the graphics.



Attributes
----------

.. autoapisummary::

   Karana.KUtils.MultibodyTUI.graphics.Item
   Karana.KUtils.MultibodyTUI.graphics.Cookie
   Karana.KUtils.MultibodyTUI.graphics.PerspectiveModeOptions


Classes
-------

.. autoapisummary::

   Karana.KUtils.MultibodyTUI.graphics.FocusBase
   Karana.KUtils.MultibodyTUI.graphics.NodePool
   Karana.KUtils.MultibodyTUI.graphics.PartHighlighter
   Karana.KUtils.MultibodyTUI.graphics.LoopLineCookie
   Karana.KUtils.MultibodyTUI.graphics.LoopConnector
   Karana.KUtils.MultibodyTUI.graphics.FramePairLineCookie
   Karana.KUtils.MultibodyTUI.graphics.FramePairConnector
   Karana.KUtils.MultibodyTUI.graphics.FrameAxesDisplay
   Karana.KUtils.MultibodyTUI.graphics.MaskSelectTUI
   Karana.KUtils.MultibodyTUI.graphics.PerspectiveModeTUI


Module Contents
---------------

.. py:data:: Item

.. py:data:: Cookie

.. py:class:: FocusBase

   Bases: :py:obj:`Generic`\ [\ :py:obj:`Item`\ , :py:obj:`Cookie`\ ], :py:obj:`abc.ABC`


   Base class for emphasizing items in a list.

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


   .. py:method:: listFocused() -> collections.abc.Iterable[Item]

      All currently focused items.



   .. py:method:: isFocused(item: Item) -> bool

      Whether a given item is focused.



   .. py:method:: set(items: collections.abc.Iterable[Item])

      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 unnecessary side effects that may be
      performance intensive.

      :param items: The new list of focused items
      :type items: Iterable[Item]



   .. py:method:: add(items: collections.abc.Iterable[Item])

      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.

      :param items: The additional new items to focus
      :type items: Iterable[Item]



   .. py:method:: remove(items: collections.abc.Iterable[Item])

      Unfocus a list of items.

      This will ignore items that aren't already focused

      :param items: The items to unfocus
      :type items: Iterable[Item]



   .. py:method:: clear()

      Unfocus all focused items.



   .. py:method:: __del__()

      Delete this FocusBase.



.. py:class:: NodePool(name: str, scene: Karana.Scene.ProxyScene)

   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.


   .. py:method:: borrow() -> Karana.Scene.ProxySceneNode

      Get a node from the pool.

      :returns: A free node from the pool
      :rtype: ProxySceneNode



   .. py:method:: release(node: Karana.Scene.ProxySceneNode)

      Return a node to the pool for reuse.

      :param node: The node to return to the pool
      :type node: ProxySceneNode



.. py:class:: PartHighlighter(highlight: Karana.Scene.Scene_types.MaterialType | Karana.Scene.Color)

   Bases: :py:obj:`FocusBase`\ [\ :py:obj:`Karana.Scene.ScenePart`\ , :py:obj:`Karana.Scene.Scene_types.MaterialType`\ ]


   A FocusBase that applies a fixed material to focused SceneParts.


.. py:class:: LoopLineCookie

   Cookie data for LoopConnector.


   .. py:attribute:: src_node
      :type:  Karana.Scene.ProxySceneNode


   .. py:attribute:: tgt_node
      :type:  Karana.Scene.ProxySceneNode


   .. py:attribute:: line_id
      :type:  int


.. py:class:: LoopConnector(scene: Karana.Scene.ProxyScene, source_color: Karana.Scene.Color, target_color: Karana.Scene.Color)

   Bases: :py:obj:`FocusBase`\ [\ :py:obj:`Karana.Dynamics.LoopConstraintCutJoint`\ , :py:obj:`LoopLineCookie`\ ]


   FocusBase that draws a line across a LoopConstraintCutJoint.


.. py:class:: FramePairLineCookie

   Cookie data for FramePairConnector.


   .. py:attribute:: src_node
      :type:  Karana.Scene.ProxySceneNode


   .. py:attribute:: tgt_node
      :type:  Karana.Scene.ProxySceneNode


   .. py:attribute:: line_id
      :type:  int


.. py:class:: FramePairConnector(scene: Karana.Scene.ProxyScene, source_color: Karana.Scene.Color, target_color: Karana.Scene.Color)

   Bases: :py:obj:`FocusBase`\ [\ :py:obj:`tuple`\ [\ :py:obj:`Karana.Frame.Frame`\ , :py:obj:`Karana.Frame.Frame`\ ]\ , :py:obj:`FramePairLineCookie`\ ]


   FocusBase that draws lines connecting Frame pairs.


.. py:class:: FrameAxesDisplay(scene: Karana.Scene.ProxyScene, axes_size: float = 10)

   Bases: :py:obj:`FocusBase`\ [\ :py:obj:`Karana.Frame.Frame`\ , :py:obj:`Karana.Scene.ProxySceneNode`\ ]


   FocusBase that shows a Frame's axes.


.. py:class:: MaskSelectTUI(camera: Karana.Scene.GraphicalSceneCamera)

   Bases: :py:obj:`Karana.KUtils.MultibodyTUI.dialog.FlagsTUI`


   Control the layer mask of a camera.


   .. py:property:: mask

      The layer mask.

      :rtype: The layer mask.


.. py:data:: PerspectiveModeOptions

.. py:class:: PerspectiveModeTUI

   Bases: :py:obj:`Karana.KUtils.MultibodyTUI.dialog.ChoiceTUI`


   Control the perspective of a camera.


   .. py:property:: mode
      :type: PerspectiveModeOptions | None


      Get the perspective mode used.

      :returns: The perspective mode options used if it exists.
      :rtype: PerspectiveModeOptions | None


