Skip to content

feat(tools): 更新MapTracker工具以支持实时定位功能#702

Merged
he0119 merged 7 commits intoMaaEnd:mainfrom
isHarryh:main
Feb 23, 2026
Merged

feat(tools): 更新MapTracker工具以支持实时定位功能#702
he0119 merged 7 commits intoMaaEnd:mainfrom
isHarryh:main

Conversation

@isHarryh
Copy link
Member

@isHarryh isHarryh commented Feb 22, 2026

概要

此 PR 主要针对 MapTracker 工具进行了优化,并附带对 MapTracker 的参数进行了调整。

添加的功能包括一个实时定位功能以便更高效地编辑路径点、可选的控制是否打印信息的节点系列参数。

此外重构了工具脚本的代码以提升使用体验。

Summary by Sourcery

更新 MapTracker 工具和服务,以支持实时游戏内位置捕获、可配置的 UI 消息,以及改进的编辑器用户体验和渲染性能。

新功能:

  • 在 MapTracker 编辑器中通过读取推理日志的位置服务增加实时位置获取功能,将当前游戏内位置追加为路径点。
  • 在 MapTracker 编辑器中引入 GUI 状态栏和模态覆盖层,用于展示操作反馈和服务连接状态。
  • MapTrackerMoveMapTrackerInfer 添加可选的 UI 消息打印控制(no_print/print 标志),从而可以切换导航和推理输出。

问题修复:

  • 确保 MapTrackerMove 的紧急停止和 UI 流程遵守 no_print 标志,并将未命中的推理结果视为失败。

增强:

  • 通过缓存缩放后的图像、基于整数颜色的绘图工具以及改进的十字准星和侧边栏视觉效果,优化 MapTracker 编辑器渲染。
  • 调整 MapTrackerMove 和推理的默认参数,以实现更可靠的到达检测和位置推理,并在动作之间复用共享的默认值。
  • 重构绘图工具以使用带自动 BGR 转换的十六进制 Color 类型,并支持半透明遮罩,然后在 MapTracker 工具和合并器 UI 中统一应用。

文档:

  • 扩展 MapTracker 开发者文档,涵盖 GUI 编辑器工具、实时位置工作流、更新后的参数默认值,以及新的 print/no_print 选项。
Original summary in English

Summary by Sourcery

Update MapTracker tools and services to support realtime in-game location capture, configurable UI messaging, and improved editor UX and rendering performance.

New Features:

  • Add realtime location fetching in the MapTracker editor via a location service that reads inference logs and appends the current in-game position as a path point.
  • Introduce GUI status bar and modal overlays in the MapTracker editor to show operation feedback and service connection states.
  • Add optional UI message printing controls (no_print/print flags) to MapTrackerMove and MapTrackerInfer so navigation and inference output can be toggled.

Bug Fixes:

  • Ensure MapTrackerMove emergency stop and UI flows honor the no_print flag and treat non-hit inference results as failures.

Enhancements:

  • Refine MapTracker editor rendering with cached scaled images, color-int-based drawing utilities, and improved crosshair and sidebar visuals.
  • Adjust default MapTrackerMove and inference parameters for more reliable arrival detection and location inference, and reuse shared defaults between actions.
  • Refactor drawing utilities to use a hex Color type with automatic BGR conversion and support for semi-transparent masking, then apply these across MapTracker tools and the merger UI.

Documentation:

  • Expand MapTracker developer documentation to cover the GUI editor tool, realtime location workflow, updated parameter defaults, and new print/no_print options.

Copilot AI review requested due to automatic review settings February 22, 2026 17:44
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - 我发现了两个问题,并给出了一些总体性的反馈:

  • LocationService._read_last_lines 中,使用 buffer.rsplit 反向读取并将尾部部分追加到 lines 的逻辑比较复杂,而且在保持正确行序方面容易出错;建议考虑改成更常见、更直接的 tail 实现方式(例如,从文件末尾按固定大小读取块后一次性切分,或者使用 deque),以便让行为更容易理解和维护。
  • wait_for_new_locationget_latest_location 这两个方法,一旦遇到第一个地图名称不同的日志条目,就立刻返回 "mismatch" 状态,即便后面的条目可能会匹配预期地图。如果同一时间可能并发处理多个地图,继续扫描直到找到匹配条目,或直到超时/行数上限为止,会更健壮。
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `LocationService._read_last_lines`, the reverse-reading logic with `buffer.rsplit` and appending the tail part to `lines` is quite complex and error-prone for preserving correct line order; consider simplifying this to a more conventional tail implementation (e.g., reading fixed-size chunks from the end and splitting once, or using `deque`) to make the behavior easier to reason about and maintain.
- Both `wait_for_new_location` and `get_latest_location` return a `"mismatch"` status as soon as they encounter the first log entry with a different map name, even if later entries might match the expected map; if multiple maps can be processed concurrently, it would be more robust to continue scanning until a matching entry is found or the timeout/lines limit is reached.

## Individual Comments

### Comment 1
<location> `tools/map_tracker/map_tracker_editor.py:324-333` </location>
<code_context>
-        self.mouse_x: int = -1
-        self.mouse_y: int = -1
+        # Status feedback shown in map area status bar
+        self._status: PathEditPage.StatusRecord = self.StatusRecord(
+            0, 0xFFFFFF, "Welcome to MapTracker Editor!"
+        )
</code_context>

<issue_to_address>
**suggestion (bug_risk):** StatusRecord is always truthy, so the guard in `_render_status_bar` never disables rendering.

Since `_status` is always a `StatusRecord`, `if not self._status:` in `_render_status_bar` will never be false. Either allow `_status` to be `None` (and update the type) to represent “no status”, or remove the guard to match the actual invariants and simplify the logic.

Suggested implementation:

```python
from typing import Any, List, Tuple, Optional

```

```python
        # Status feedback shown in map area status bar
        # None means "no status", which disables rendering in `_render_status_bar`.
        self._status: Optional[PathEditPage.StatusRecord] = None

```

To fully implement the "nullable status" approach, verify and, if necessary, adjust these points in the rest of `PathEditPage`:

1. In `_render_status_bar`, keep the guard `if not self._status:` (or equivalent) so that it correctly skips rendering when `_status` is `None`, and ensure that any access to `self._status.color` / `self._status.text` etc. happens only after that guard.
2. In any method that directly assigns to `self._status`, keep assigning a concrete `StatusRecord` instance; in any method that wants to clear the status, assign `None`.
3. If there are type hints or docstrings elsewhere that still state `_status` is always a `StatusRecord`, update them to reflect `Optional[StatusRecord]`.
</issue_to_address>

### Comment 2
<location> `tools/map_tracker/utils.py:48-53` </location>
<code_context>
     def get_text_size(self, text: str, font_scale: float, *, thickness: int):
         return cv2.getTextSize(text, self._font_face, font_scale, thickness)[0]

+    @staticmethod
+    def _to_bgr(color: Color) -> tuple[int, int, int]:
+        r = (color >> 16) & 0xFF
+        g = (color >> 8) & 0xFF
+        b = color & 0xFF
+        return (b, g, r)
+
     def text(
</code_context>

<issue_to_address>
**suggestion (bug_risk):** Color conversion assumes 0xRRGGBB; adding a fast path for already-BGR colors or validation may avoid misuse.

Since nothing stops callers from passing an OpenCV-style BGR tuple to these methods, that input would now be misinterpreted and silently produce wrong colors. To mitigate, consider either accepting `(b, g, r)` tuples unchanged in `_to_bgr`, or asserting `isinstance(color, int)` (at least in debug builds) to catch misuse early.

Suggested implementation:

```python
Color = int  # 0xRRGGBB packed integer color
BGRColor = tuple[int, int, int]

```

```python
    @staticmethod
    def _to_bgr(color: Color | BGRColor) -> tuple[int, int, int]:
        """
        Normalize a color value to an OpenCV BGR tuple.

        Accepts either:
        - packed 0xRRGGBB integer (preferred), or
        - an already-BGR tuple (b, g, r), which is returned unchanged.
        """
        # Fast path for callers that already provide OpenCV-style BGR tuples.
        if isinstance(color, tuple):
            if len(color) != 3:
                raise ValueError(f"Expected a 3-tuple for BGR color, got {len(color)} elements: {color}")
            b, g, r = color
            return int(b), int(g), int(r)

        # Defensive check to catch misuse early (e.g., passing RGB tuples).
        if not isinstance(color, int):
            raise TypeError(
                f"Color must be either a packed 0xRRGGBB int or a BGR 3-tuple, got {type(color).__name__}: {color!r}"
            )

        r = (color >> 16) & 0xFF
        g = (color >> 8) & 0xFF
        b = color & 0xFF
        return (b, g, r)

```
</issue_to_address>

Sourcery 对开源项目是免费的——如果你觉得我们的评审有帮助,欢迎分享 ✨
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据反馈改进后续的评审。
Original comment in English

Hey - I've found 2 issues, and left some high level feedback:

  • In LocationService._read_last_lines, the reverse-reading logic with buffer.rsplit and appending the tail part to lines is quite complex and error-prone for preserving correct line order; consider simplifying this to a more conventional tail implementation (e.g., reading fixed-size chunks from the end and splitting once, or using deque) to make the behavior easier to reason about and maintain.
  • Both wait_for_new_location and get_latest_location return a "mismatch" status as soon as they encounter the first log entry with a different map name, even if later entries might match the expected map; if multiple maps can be processed concurrently, it would be more robust to continue scanning until a matching entry is found or the timeout/lines limit is reached.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `LocationService._read_last_lines`, the reverse-reading logic with `buffer.rsplit` and appending the tail part to `lines` is quite complex and error-prone for preserving correct line order; consider simplifying this to a more conventional tail implementation (e.g., reading fixed-size chunks from the end and splitting once, or using `deque`) to make the behavior easier to reason about and maintain.
- Both `wait_for_new_location` and `get_latest_location` return a `"mismatch"` status as soon as they encounter the first log entry with a different map name, even if later entries might match the expected map; if multiple maps can be processed concurrently, it would be more robust to continue scanning until a matching entry is found or the timeout/lines limit is reached.

## Individual Comments

### Comment 1
<location> `tools/map_tracker/map_tracker_editor.py:324-333` </location>
<code_context>
-        self.mouse_x: int = -1
-        self.mouse_y: int = -1
+        # Status feedback shown in map area status bar
+        self._status: PathEditPage.StatusRecord = self.StatusRecord(
+            0, 0xFFFFFF, "Welcome to MapTracker Editor!"
+        )
</code_context>

<issue_to_address>
**suggestion (bug_risk):** StatusRecord is always truthy, so the guard in `_render_status_bar` never disables rendering.

Since `_status` is always a `StatusRecord`, `if not self._status:` in `_render_status_bar` will never be false. Either allow `_status` to be `None` (and update the type) to represent “no status”, or remove the guard to match the actual invariants and simplify the logic.

Suggested implementation:

```python
from typing import Any, List, Tuple, Optional

```

```python
        # Status feedback shown in map area status bar
        # None means "no status", which disables rendering in `_render_status_bar`.
        self._status: Optional[PathEditPage.StatusRecord] = None

```

To fully implement the "nullable status" approach, verify and, if necessary, adjust these points in the rest of `PathEditPage`:

1. In `_render_status_bar`, keep the guard `if not self._status:` (or equivalent) so that it correctly skips rendering when `_status` is `None`, and ensure that any access to `self._status.color` / `self._status.text` etc. happens only after that guard.
2. In any method that directly assigns to `self._status`, keep assigning a concrete `StatusRecord` instance; in any method that wants to clear the status, assign `None`.
3. If there are type hints or docstrings elsewhere that still state `_status` is always a `StatusRecord`, update them to reflect `Optional[StatusRecord]`.
</issue_to_address>

### Comment 2
<location> `tools/map_tracker/utils.py:48-53` </location>
<code_context>
     def get_text_size(self, text: str, font_scale: float, *, thickness: int):
         return cv2.getTextSize(text, self._font_face, font_scale, thickness)[0]

+    @staticmethod
+    def _to_bgr(color: Color) -> tuple[int, int, int]:
+        r = (color >> 16) & 0xFF
+        g = (color >> 8) & 0xFF
+        b = color & 0xFF
+        return (b, g, r)
+
     def text(
</code_context>

<issue_to_address>
**suggestion (bug_risk):** Color conversion assumes 0xRRGGBB; adding a fast path for already-BGR colors or validation may avoid misuse.

Since nothing stops callers from passing an OpenCV-style BGR tuple to these methods, that input would now be misinterpreted and silently produce wrong colors. To mitigate, consider either accepting `(b, g, r)` tuples unchanged in `_to_bgr`, or asserting `isinstance(color, int)` (at least in debug builds) to catch misuse early.

Suggested implementation:

```python
Color = int  # 0xRRGGBB packed integer color
BGRColor = tuple[int, int, int]

```

```python
    @staticmethod
    def _to_bgr(color: Color | BGRColor) -> tuple[int, int, int]:
        """
        Normalize a color value to an OpenCV BGR tuple.

        Accepts either:
        - packed 0xRRGGBB integer (preferred), or
        - an already-BGR tuple (b, g, r), which is returned unchanged.
        """
        # Fast path for callers that already provide OpenCV-style BGR tuples.
        if isinstance(color, tuple):
            if len(color) != 3:
                raise ValueError(f"Expected a 3-tuple for BGR color, got {len(color)} elements: {color}")
            b, g, r = color
            return int(b), int(g), int(r)

        # Defensive check to catch misuse early (e.g., passing RGB tuples).
        if not isinstance(color, int):
            raise TypeError(
                f"Color must be either a packed 0xRRGGBB int or a BGR 3-tuple, got {type(color).__name__}: {color!r}"
            )

        r = (color >> 16) & 0xFF
        g = (color >> 8) & 0xFF
        b = color & 0xFF
        return (b, g, r)

```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the MapTracker tool with a real-time location feature and refactors the codebase for improved usability and maintainability.

Changes:

  • Adds real-time location service to MapTracker editor for fetching current game coordinates via log file monitoring
  • Refactors color representation from BGR tuples to 0xRRGGBB hex integers in Python tools for cleaner code
  • Adds optional print control parameters (no_print for MapTrackerMove, print for MapTrackerInfer) to manage UI message verbosity
  • Updates default parameter values (arrival_threshold from 4.5 to 3.5, threshold from 0.5 to 0.4) and improves rendering performance through image caching

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tools/map_tracker/utils.py Refactors Color type from BGR tuple to 0xRRGGBB int, adds _to_bgr conversion helper, implements new mask method for semi-transparent overlays
tools/map_tracker/map_tracker_merger.py Updates color values to use new hex integer format
tools/map_tracker/map_tracker_editor.py Adds LocationService class for real-time location fetching, implements modal UI with status bar, optimizes rendering with scaled image caching, adds "Get Realtime Location" button
docs/developers/map-tracker.md Documents new tool features including real-time location service, updates parameter descriptions, adds tool usage instructions
assets/resource/pipeline/MapTracker.json Adds MapTrackerTestLoop and MapTrackerTest nodes for location service testing
agent/go-service/map-tracker/move.go Adds NoPrint parameter to suppress UI messages, changes KeyDownSync delay from 0ms to 100ms during navigation
agent/go-service/map-tracker/infer.go Adds Print parameter to enable UI messages, implements inference result display with HTML templates
agent/go-service/map-tracker/const.go Updates default parameters (arrival_threshold, threshold values), adds DEFAULT_INFERENCE_PARAM_FOR_MOVE
agent/go-service/map-tracker/messages/inference_finished.html New HTML template for successful inference UI display
agent/go-service/map-tracker/messages/inference_failed.html New HTML template for failed inference UI display
Comments suppressed due to low confidence (6)

agent/go-service/map-tracker/infer.go:40

  • The comment grammar is incorrect. It should read "Precision is a value that controls the inference precision/speed tradeoff." (add "that" and ensure proper article usage).
	// Precision is a value controls the inference precision/speed tradeoff.
	Precision float64 `json:"precision,omitempty"`

agent/go-service/map-tracker/move.go:189

  • Adding a delay of 100ms to KeyDownSync when rotation is being adjusted changes the behavior in all branches of rotation adjustment logic. This delay was previously 0ms. While this may be intentional to avoid issues with rapid key presses, the delay could impact responsiveness during navigation. Consider whether this delay is necessary in all cases or if it should only be applied in specific scenarios.
					aw.KeyDownSync(KEY_W, 100)
				} else {
					// Just rotate for small misalignment
					aw.RotateCamera(int(float64(deltaRot)*param.RotationSpeed), 100, 100)
					aw.KeyDownSync(KEY_W, 100)
				}
			} else {
				aw.KeyDownSync(KEY_W, 100)

tools/map_tracker/map_tracker_editor.py:704

  • The cache invalidation for scaled images clears both _scaled_img and _scaled_scale on zoom change. However, _scaled_img is set to None but _scaled_scale should also be set to None for consistency, or alternatively just check _scaled_img alone. Currently line 704 sets _scaled_scale to None which is correct, but for code clarity, consider only checking if _scaled_img is None on line 423 since both are invalidated together.
            self._scaled_img = None
            self._scaled_scale = None

tools/map_tracker/map_tracker_editor.py:1015

  • The cv2.waitKey(1) call followed by time.sleep(0.05) creates an effective polling interval of ~50ms. Consider removing the cv2.waitKey(1) call as it's typically used for window event processing in OpenCV GUI applications, but in this context the tool already has its own window and event loop. The sleep alone should be sufficient for the polling interval, and removing the waitKey could avoid potential conflicts with the main window's event processing.
                    cv2.waitKey(1)
                    time.sleep(0.05)

agent/go-service/map-tracker/infer.go:44

  • The comment for the Print field should follow Go documentation conventions by starting with the field name. It should read "Print indicates whether to print status to GUI." to match the style of other fields in this struct.
	// Whether to print status to GUI.
	Print bool `json:"print,omitempty"`

agent/go-service/map-tracker/move.go:44

  • The comment for the NoPrint field should follow Go documentation conventions by starting with the field name. It should read "NoPrint indicates whether to suppress status printing for GUI." to match the style of other fields in this struct.
	// Whether to suppress status printing for GUI.
	NoPrint bool `json:"no_print,omitempty"`

@he0119 he0119 merged commit 1da46de into MaaEnd:main Feb 23, 2026
1 check passed
HYY1116 pushed a commit to HYY1116/MaaEnd that referenced this pull request Feb 25, 2026
## 概要

此 PR 主要针对 MapTracker 工具进行了优化,并附带对 MapTracker 的参数进行了调整。

添加的功能包括一个实时定位功能以便更高效地编辑路径点、可选的控制是否打印信息的节点系列参数。

此外重构了工具脚本的代码以提升使用体验。

## Summary by Sourcery

更新 MapTracker 工具和服务,以支持实时游戏内位置捕获、可配置的 UI 消息,以及改进的编辑器用户体验和渲染性能。

新功能:
- 在 MapTracker 编辑器中通过读取推理日志的位置服务增加实时位置获取功能,将当前游戏内位置追加为路径点。
- 在 MapTracker 编辑器中引入 GUI 状态栏和模态覆盖层,用于展示操作反馈和服务连接状态。
- 为 `MapTrackerMove` 和 `MapTrackerInfer` 添加可选的 UI
消息打印控制(`no_print`/`print` 标志),从而可以切换导航和推理输出。

问题修复:
- 确保 `MapTrackerMove` 的紧急停止和 UI 流程遵守 `no_print` 标志,并将未命中的推理结果视为失败。

增强:
- 通过缓存缩放后的图像、基于整数颜色的绘图工具以及改进的十字准星和侧边栏视觉效果,优化 MapTracker 编辑器渲染。
- 调整 `MapTrackerMove` 和推理的默认参数,以实现更可靠的到达检测和位置推理,并在动作之间复用共享的默认值。
- 重构绘图工具以使用带自动 BGR 转换的十六进制 `Color` 类型,并支持半透明遮罩,然后在 MapTracker 工具和合并器 UI
中统一应用。

文档:
- 扩展 MapTracker 开发者文档,涵盖 GUI 编辑器工具、实时位置工作流、更新后的参数默认值,以及新的
`print`/`no_print` 选项。

<details>
<summary>Original summary in English</summary>

## Summary by Sourcery

Update MapTracker tools and services to support realtime in-game
location capture, configurable UI messaging, and improved editor UX and
rendering performance.

New Features:
- Add realtime location fetching in the MapTracker editor via a location
service that reads inference logs and appends the current in-game
position as a path point.
- Introduce GUI status bar and modal overlays in the MapTracker editor
to show operation feedback and service connection states.
- Add optional UI message printing controls (no_print/print flags) to
MapTrackerMove and MapTrackerInfer so navigation and inference output
can be toggled.

Bug Fixes:
- Ensure MapTrackerMove emergency stop and UI flows honor the no_print
flag and treat non-hit inference results as failures.

Enhancements:
- Refine MapTracker editor rendering with cached scaled images,
color-int-based drawing utilities, and improved crosshair and sidebar
visuals.
- Adjust default MapTrackerMove and inference parameters for more
reliable arrival detection and location inference, and reuse shared
defaults between actions.
- Refactor drawing utilities to use a hex Color type with automatic BGR
conversion and support for semi-transparent masking, then apply these
across MapTracker tools and the merger UI.

Documentation:
- Expand MapTracker developer documentation to cover the GUI editor
tool, realtime location workflow, updated parameter defaults, and new
print/no_print options.

</details>

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
MistEO pushed a commit that referenced this pull request Mar 9, 2026
## 概要

此 PR 主要针对 MapTracker 工具进行了优化,并附带对 MapTracker 的参数进行了调整。

添加的功能包括一个实时定位功能以便更高效地编辑路径点、可选的控制是否打印信息的节点系列参数。

此外重构了工具脚本的代码以提升使用体验。

## Summary by Sourcery

更新 MapTracker 工具和服务,以支持实时游戏内位置捕获、可配置的 UI 消息,以及改进的编辑器用户体验和渲染性能。

新功能:
- 在 MapTracker 编辑器中通过读取推理日志的位置服务增加实时位置获取功能,将当前游戏内位置追加为路径点。
- 在 MapTracker 编辑器中引入 GUI 状态栏和模态覆盖层,用于展示操作反馈和服务连接状态。
- 为 `MapTrackerMove` 和 `MapTrackerInfer` 添加可选的 UI
消息打印控制(`no_print`/`print` 标志),从而可以切换导航和推理输出。

问题修复:
- 确保 `MapTrackerMove` 的紧急停止和 UI 流程遵守 `no_print` 标志,并将未命中的推理结果视为失败。

增强:
- 通过缓存缩放后的图像、基于整数颜色的绘图工具以及改进的十字准星和侧边栏视觉效果,优化 MapTracker 编辑器渲染。
- 调整 `MapTrackerMove` 和推理的默认参数,以实现更可靠的到达检测和位置推理,并在动作之间复用共享的默认值。
- 重构绘图工具以使用带自动 BGR 转换的十六进制 `Color` 类型,并支持半透明遮罩,然后在 MapTracker 工具和合并器 UI
中统一应用。

文档:
- 扩展 MapTracker 开发者文档,涵盖 GUI 编辑器工具、实时位置工作流、更新后的参数默认值,以及新的
`print`/`no_print` 选项。

<details>
<summary>Original summary in English</summary>

## Summary by Sourcery

Update MapTracker tools and services to support realtime in-game
location capture, configurable UI messaging, and improved editor UX and
rendering performance.

New Features:
- Add realtime location fetching in the MapTracker editor via a location
service that reads inference logs and appends the current in-game
position as a path point.
- Introduce GUI status bar and modal overlays in the MapTracker editor
to show operation feedback and service connection states.
- Add optional UI message printing controls (no_print/print flags) to
MapTrackerMove and MapTrackerInfer so navigation and inference output
can be toggled.

Bug Fixes:
- Ensure MapTrackerMove emergency stop and UI flows honor the no_print
flag and treat non-hit inference results as failures.

Enhancements:
- Refine MapTracker editor rendering with cached scaled images,
color-int-based drawing utilities, and improved crosshair and sidebar
visuals.
- Adjust default MapTrackerMove and inference parameters for more
reliable arrival detection and location inference, and reuse shared
defaults between actions.
- Refactor drawing utilities to use a hex Color type with automatic BGR
conversion and support for semi-transparent masking, then apply these
across MapTracker tools and the merger UI.

Documentation:
- Expand MapTracker developer documentation to cover the GUI editor
tool, realtime location workflow, updated parameter defaults, and new
print/no_print options.

</details>

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
MistEO pushed a commit that referenced this pull request Mar 9, 2026
## 概要

此 PR 主要针对 MapTracker 工具进行了优化,并附带对 MapTracker 的参数进行了调整。

添加的功能包括一个实时定位功能以便更高效地编辑路径点、可选的控制是否打印信息的节点系列参数。

此外重构了工具脚本的代码以提升使用体验。

## Summary by Sourcery

更新 MapTracker 工具和服务,以支持实时游戏内位置捕获、可配置的 UI 消息,以及改进的编辑器用户体验和渲染性能。

新功能:
- 在 MapTracker 编辑器中通过读取推理日志的位置服务增加实时位置获取功能,将当前游戏内位置追加为路径点。
- 在 MapTracker 编辑器中引入 GUI 状态栏和模态覆盖层,用于展示操作反馈和服务连接状态。
- 为 `MapTrackerMove` 和 `MapTrackerInfer` 添加可选的 UI
消息打印控制(`no_print`/`print` 标志),从而可以切换导航和推理输出。

问题修复:
- 确保 `MapTrackerMove` 的紧急停止和 UI 流程遵守 `no_print` 标志,并将未命中的推理结果视为失败。

增强:
- 通过缓存缩放后的图像、基于整数颜色的绘图工具以及改进的十字准星和侧边栏视觉效果,优化 MapTracker 编辑器渲染。
- 调整 `MapTrackerMove` 和推理的默认参数,以实现更可靠的到达检测和位置推理,并在动作之间复用共享的默认值。
- 重构绘图工具以使用带自动 BGR 转换的十六进制 `Color` 类型,并支持半透明遮罩,然后在 MapTracker 工具和合并器 UI
中统一应用。

文档:
- 扩展 MapTracker 开发者文档,涵盖 GUI 编辑器工具、实时位置工作流、更新后的参数默认值,以及新的
`print`/`no_print` 选项。

<details>
<summary>Original summary in English</summary>

## Summary by Sourcery

Update MapTracker tools and services to support realtime in-game
location capture, configurable UI messaging, and improved editor UX and
rendering performance.

New Features:
- Add realtime location fetching in the MapTracker editor via a location
service that reads inference logs and appends the current in-game
position as a path point.
- Introduce GUI status bar and modal overlays in the MapTracker editor
to show operation feedback and service connection states.
- Add optional UI message printing controls (no_print/print flags) to
MapTrackerMove and MapTrackerInfer so navigation and inference output
can be toggled.

Bug Fixes:
- Ensure MapTrackerMove emergency stop and UI flows honor the no_print
flag and treat non-hit inference results as failures.

Enhancements:
- Refine MapTracker editor rendering with cached scaled images,
color-int-based drawing utilities, and improved crosshair and sidebar
visuals.
- Adjust default MapTrackerMove and inference parameters for more
reliable arrival detection and location inference, and reuse shared
defaults between actions.
- Refactor drawing utilities to use a hex Color type with automatic BGR
conversion and support for semi-transparent masking, then apply these
across MapTracker tools and the merger UI.

Documentation:
- Expand MapTracker developer documentation to cover the GUI editor
tool, realtime location workflow, updated parameter defaults, and new
print/no_print options.

</details>

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants