WindowCursor#
- class omni.kit.window.cursor.WindowCursor#
Bases:
IExtA class responsible for managing custom cursor shapes within the main application window.
This extension class interacts with the application’s window and the imgui renderer to register, unregister, override, and retrieve cursor shapes. It maintains a mapping of custom cursor names to their respective image paths. On startup, it initializes this mapping and registers any additional cursor shapes provided. On shutdown, it unregisters these cursor shapes and cleans up resources.
If the application or imgui renderer is not ready, the methods will fail gracefully.
Methods
Clears any overridden cursor shape, reverting to default.
Gets the current standard cursor shape override.
Gets the current extended cursor shape override.
Cleans up resources on shutdown.
on_startup(ext_id)Initializes cursor shapes on startup.
override_cursor_shape(shape)Overrides the current cursor shape with a standard shape.
override_cursor_shape_extend(shape_name)Overrides the current cursor shape with an extended shape.
register_cursor_shape_extend(shape_name, path)Registers an extended cursor shape with its file path.
unregister_cursor_shape_extend(shape_name)Unregisters an extended cursor shape.
- __init__(self: omni.ext._extensions.IExt) None#
- clear_overridden_cursor_shape() bool#
Clears any overridden cursor shape, reverting to default.
- Returns:
True if the operation succeeded
- Return type:
bool
- get_cursor_shape_override() CursorStandardShape | None#
Gets the current standard cursor shape override.
- Returns:
The overridden cursor shape or None if not overridden.
- Return type:
Optional[windowing.CursorStandardShape]
- get_cursor_shape_override_extend() str | None#
Gets the current extended cursor shape override.
- Returns:
The name of the overridden cursor shape or None if not overridden.
- Return type:
Optional[str]
- on_shutdown()#
Cleans up resources on shutdown.
- on_startup(ext_id)#
Initializes cursor shapes on startup.
- Parameters:
ext_id (str) – Extension ID.
- override_cursor_shape(
- shape: CursorStandardShape,
Overrides the current cursor shape with a standard shape.
- Parameters:
shape (windowing.CursorStandardShape) – The standard cursor shape.
- Returns:
True if the operation succeeded
- Return type:
bool
- override_cursor_shape_extend(shape_name: str) bool#
Overrides the current cursor shape with an extended shape.
- Parameters:
shape_name (str) – The name of the extended cursor shape.
- Returns:
True if the operation succeeded
- Return type:
bool
- register_cursor_shape_extend(
- shape_name: str,
- path: str,
Registers an extended cursor shape with its file path. If the shape is already registered, unregister the previous one before registering again.
- Parameters:
shape_name (str) – The name of the cursor shape to register.
path (str) – The file path to the cursor image.
- Returns:
True if the operation succeeded.
- Return type:
bool
- unregister_cursor_shape_extend(shape_name: str) bool#
Unregisters an extended cursor shape. If the shape is being set as the current cursor, restore to default, otherwise if not registered, nothing is done.
- Parameters:
shape_name (str) – The name of the cursor shape to unregister.
- Returns:
True if the operation succeeded
- Return type:
bool