wolfhece._sculpt_manager

Sculpt brush and profile brush companion object for WolfMapViewer.

All sculpt-brush and profile-brush interaction logic lives here. WolfMapViewer holds a single instance as self._sculpt and exposes one-line delegators for every method so that external callers remain unaffected.

Design notes

  • SculptManager owns all private transient state (cursor positions, pressure, show-overlay flags, rect-rotation helpers, brush-refresh coalescing flag). The public panel references (sculpt_panel, profile_panel) stay as regular attributes on WolfMapViewer because wolf_sculpt.py sets them directly (mapviewer.sculpt_panel = self).

  • Six event-hook methods let the viewer delegate its mouse / keyboard / action events with a single call.

  • wx parent for dialogs is always self._viewer.

Module Contents

class wolfhece._sculpt_manager.SculptManager(viewer: wolfhece.PyDraw.WolfMapViewer)[source]

Companion object that owns sculpt-brush and profile-brush logic.

_viewer[source]
cursor_xy: tuple | None = None[source]
pressure: float = 1.0[source]
show_size: bool = False[source]
show_zone: bool = False[source]
profile_cursor_xy: tuple | None = None[source]
profile_last_seg: tuple | None = None[source]
brush_refresh_pending: bool = False[source]
_rect_rot_center_xy: tuple | None = None[source]
_rect_rot_angle_offset: float = 0.0[source]
_rect_rot_calibrated: bool = False[source]
on_wheel(ctx: wolfhece._viewer_plugin_handlers.MouseContext) bool[source]

Handle mouse-wheel brush controls when action == ‘sculpt’.

Parameters:
  • ctxMouseContext built from the wheel event. The relevant fields are shift, ctrl, alt, wheel_rotation and wheel_delta.

  • return). (Returns True if the event was fully consumed (caller should)

on_left_down(ctx: wolfhece._viewer_plugin_handlers.MouseContext) bool[source]

Handle left-button press for sculpt / profile actions.

Parameters:
  • ctxMouseContext built from the left-down event. The relevant fields are x, y, left_down and shift.

  • return). (Returns True if the event was consumed (caller should)

on_motion(ctx: wolfhece._viewer_plugin_handlers.MouseContext) bool[source]

Handle mouse motion for sculpt / profile actions.

Parameters:
  • ctx – Pre-built MouseContext with world coordinates, pixel coordinates, modifier flags, button states and stylus pressure. The caller (On_Mouse_Motion) stores this object in viewer._mouse_context before calling this method, so tooltip helpers can read it directly.

  • return). (Returns True when the event is fully consumed (caller should)

  • pan (Returns False when sculpt middle-drag must fall through to the)

  • code

  • 'profile'. (or when the action is neither 'sculpt' nor)

on_end_action(prev_action: str) None[source]

Clean up sculpt / profile state and notify panels when action ends.

on_key_z(ctx: wolfhece._viewer_plugin_handlers.KeyboardSnapshot) bool[source]

Handle Ctrl+Z undo for sculpt / profile.

Returns True if the key was consumed (caller should skip the default zoom-on-array action).

on_key_r(ctx: wolfhece._viewer_plugin_handlers.KeyboardSnapshot) bool[source]

Guard: suppress reset-selection when sculpt RECTANGLE rotate mode is active.

Returns True if R was suppressed; the caller is responsible for calling e.Skip() so the key event continues to propagate.

hide_size() None[source]

Callback scheduled via viewer.schedule_once to hide the radius-size overlay.

hide_zone() None[source]

Callback scheduled via viewer.schedule_once to hide the search-zone overlay.

get_event_pressure(e) float[source]

Return stylus pressure in [0, 1].

Reads from WinTab (Wintab32.dll) when available, which works reliably on wx.GLCanvas. Falls back to wx then to 1.0.

profile_apply_at(x: float, y: float) None[source]

Apply the profile brush at world position (x, y).

request_brush_refresh() None[source]

Schedule a single Refresh() for the next event-loop idle.

Multiple calls from the same burst of mouse-motion events all land here; only the first actually posts a deferred call so that one repaint serves all pending GPU patches.

do_brush_refresh() None[source]

Callback — executed once per burst, repaints the canvas.

sculpt_apply_at(x: float, y: float, pressure: float = 1.0) None[source]

Apply the sculpt brush at world position (x, y).

pressure is a stylus pressure value in [0, 1].

draw_profile_cursor() None[source]

Draw the profile brush ghost overlay on the OpenGL canvas.

draw_sculpt_cursor() None[source]

Draw the sculpt brush footprint (circle / square / rectangle).