SnapToolButton#

class omni.kit.manipulator.tool.snap.SnapToolButton(*args, **kwargs)#

Bases: SimpleToolButton

A button for toggling snap functionality in transform manipulators.

This class provides a UI component that allows users to enable or disable snapping when using translate, rotate, or scale manipulators. It interfaces with a SettingModel to persist the snapping state across sessions.

Parameters:
  • \*args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments, among which ‘operation’ (Operation) is mandatory and specifies the manipulator operation type (translate, rotate, scale).

Methods

__init__(*args, **kwargs)

Initializes the snap tool button with the given operation.

can_build(manipulator, operation)

Determines whether the snap tool button can be built for the given manipulator and operation.

destroy()

Cleans up the resources used by the SnapToolButton instance.

__init__(*args, **kwargs)#

Initializes the snap tool button with the given operation.

Parameters:
  • \*args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments, among which ‘operation’ (Operation) is mandatory and specifies the manipulator operation type (translate, rotate, scale).

classmethod can_build(
manipulator: TransformManipulator,
operation: Operation,
) bool#

Determines whether the snap tool button can be built for the given manipulator and operation.

Parameters:
  • manipulator (TransformManipulator) – The manipulator to check for compatibility with the snap tool.

  • operation (Operation) – The operation type for which to check the possibility of building the snap tool.

Returns:

True if the snap tool button can be built for the given manipulator and operation, otherwise False.

Return type:

bool

destroy()#

Cleans up the resources used by the SnapToolButton instance. Destroys the associated model if it exists.