Skip to content

Native Windows video motion capture with ExMR, FlowHMR and GVHMR, contact correction, humanoid retargeting, and FBX/VMD export.

Python

Mirror application processing logs to command window

toyxyz2c96e28bc53f
diff --git a/SOURCE_MANIFEST.json b/SOURCE_MANIFEST.json
index 9838089..aa6c34f 100644
--- a/SOURCE_MANIFEST.json
+++ b/SOURCE_MANIFEST.json
@@ -81,8 +81,8 @@
},
{
"path": "docs/USER_GUIDE.md",
- "bytes": 26967,
- "sha256": "d93475384797b973cdf5c623cf9f8c3e0812150716d88f846b48f318c5f22110"
+ "bytes": 27041,
+ "sha256": "1cbf35f221be0670a4278c475419dfc98fc5bcead0230699809284d5ef6b1fae"
},
{
"path": "docs/VALIDATION.md",
@@ -921,14 +921,19 @@
},
{
"path": "mocap/character_ui.py",
- "bytes": 20005,
- "sha256": "dd0fde3adaa0bbe79c8819c15427f50db219539e86e539bab286c41311c12d80"
+ "bytes": 20079,
+ "sha256": "031e926548715c3784ed790dbbb3d7931ef528cbd4830ad04d6143129211f9fd"
},
{
"path": "mocap/compute_policy.py",
"bytes": 6513,
"sha256": "3125b5a360d71c229a958a553548af0f03c82b58698f1b758a14f2048a2f7e92"
},
+ {
+ "path": "mocap/console_log.py",
+ "bytes": 1694,
+ "sha256": "a521856caf424a8e65c3d648d44680c744714d6e714c2f6bf232edff53d0b87a"
+ },
{
"path": "mocap/contact_arm_plan.py",
"bytes": 16111,
@@ -1071,8 +1076,8 @@
},
{
"path": "mocap/gui.py",
- "bytes": 93735,
- "sha256": "e8431933753346c919d84c347c71e234b0fa0bbc64510ab825b951376321688a"
+ "bytes": 93839,
+ "sha256": "69cba589e41ff1e3964fa9644c710fdf58570174b9aa0f556748341d05b01513"
},
{
"path": "mocap/gvhmr_attention.py",
@@ -1496,8 +1501,8 @@
},
{
"path": "mocap/workspace_ui.py",
- "bytes": 33691,
- "sha256": "8c5f0597c07f1d5ebbe4c92eed0cc4caf386a9c336a95433d9e45e3259e65dfc"
+ "bytes": 33729,
+ "sha256": "7b492f007639a1ad13d16ef92bae1a4655fb22d7520eb48612b2cb025cc69b2b"
},
{
"path": "native_compat/LICENSE",
diff --git a/docs/USER_GUIDE.md b/docs/USER_GUIDE.md
index 4d738f1..0eb467c 100644
--- a/docs/USER_GUIDE.md
+++ b/docs/USER_GUIDE.md
@@ -101,7 +101,8 @@ have not yet been verified; compatibility reports are welcome.
The AI runtimes remain separate. Downloads and free disk space are needed;
the install can take time.
3. Run `RGBMoCap.cmd`. Keep its console open while the GUI runs; launch errors
- and exit codes are displayed there. Use **Help > Check System** if needed.
+ and exit codes are displayed there. Processing messages and the app **Console**
+ output also appear there. Use **Help > Check System** if needed.
4. In **Model Manager**, download or import the selected AI model files. Some
models require registration and agreement to their provider's terms and must
be downloaded manually.
diff --git a/mocap/character_ui.py b/mocap/character_ui.py
index df00fe7..e2ddcd6 100644
--- a/mocap/character_ui.py
+++ b/mocap/character_ui.py
@@ -257,7 +257,9 @@ class CharacterWorkspace:
text=bytes(self.character_process.readAllStandardOutput()).decode('utf8',errors='replace')
self.character_buffer=(self.character_buffer+text)[-16000:]
for line in text.splitlines():
- if line.startswith('CHARACTER:'):self.character_line=line.partition(':')[2].strip()
+ if line.startswith('CHARACTER:'):
+ self.character_line=line.partition(':')[2].strip()
+ self.log.status_terminal(line.strip())
self.character_progress()
def character_progress(self):
diff --git a/mocap/console_log.py b/mocap/console_log.py
new file mode 100644
index 0000000..7c09b95
--- /dev/null
+++ b/mocap/console_log.py
@@ -0,0 +1,47 @@
+"""Mirror the in-app console to a command window without blocking the UI."""
+import os
+import queue
+import sys
+import threading
+
+from PySide6.QtWidgets import QTextEdit
+
+
+class ConsoleLog(QTextEdit):
+ def __init__(self, parent=None):
+ super().__init__(parent)
+ self._messages = None
+ self._last_status = None
+ stream = sys.stdout if os.environ.get("RGB_MOCAP_MANAGED") == "1" else None
+ if stream is not None:
+ self._messages = queue.Queue(maxsize=256)
+ threading.Thread(target=self._write_messages, args=(stream,), daemon=True,
+ name="console-output").start()
+ self.write_terminal("RGB MoCap started. Processing messages also appear in the app Console.")
+
+ def _write_messages(self, stream):
+ while True:
+ message = self._messages.get()
+ try:
+ stream.write(message + "\n")
+ stream.flush()
+ except (OSError, ValueError, UnicodeError):
+ # Closing a terminal must not interrupt processing or the GUI.
+ return
+
+ def write_terminal(self, message):
+ if self._messages is not None and message and str(message).strip():
+ try:
+ self._messages.put_nowait(str(message)[:16384])
+ except queue.Full:
+ # A blocked output stream must not stall the GUI or grow memory.
+ pass
+
+ def status_terminal(self, message):
+ if message != self._last_status:
+ self._last_status = message
+ self.write_terminal(message)
+
+ def append(self, text):
+ super().append(text)
+ self.write_terminal(text)
diff --git a/mocap/gui.py b/mocap/gui.py
index 28961eb..9ea4141 100644
--- a/mocap/gui.py
+++ b/mocap/gui.py
@@ -1301,6 +1301,7 @@ class MainWindow(CharacterWorkspace,ModelWorkspace,ProjectSaving,PeopleWorkspace
self.status.setText(event['message'])
elif kind == "progress":
message=event.get('message','Processing...')
+ self.log.status_terminal(message)
self.status.setText((self._task_actor+' · ' if getattr(self,'_task_actor','') else '')+message)
self.task_state.update(event,time.monotonic())
self.update_task_progress()
@@ -1313,6 +1314,7 @@ class MainWindow(CharacterWorkspace,ModelWorkspace,ProjectSaving,PeopleWorkspace
self.failed = True
self.task_timer.stop();self.task_info.setText('Failed')
self.status.setText("Processing failed. " + event.get("message", "See the console for details."))
+ self.log.write_terminal(self.status.text())
elif kind == "complete":
self.task_state.cached|=bool(event.get('cached',False))
self.log.append(f"{STAGES.get(event['stage'])}: {event.get('elapsed', 0):.2f} s · {event.get('output')}")
diff --git a/mocap/workspace_ui.py b/mocap/workspace_ui.py
index 4064826..0458c02 100644
--- a/mocap/workspace_ui.py
+++ b/mocap/workspace_ui.py
@@ -1,5 +1,6 @@
"""Editor workspace layout; processing and playback live in MainWindow."""
from .tooltips import tooltip_text, plain_tooltip
+from .console_log import ConsoleLog
from PySide6.QtCore import Qt, QSize
from PySide6.QtGui import QIcon
from PySide6.QtWidgets import (QWidget, QFrame, QLabel, QPushButton, QComboBox, QCheckBox,
@@ -510,7 +511,7 @@ def build_workspace(w):
w.task_info.setObjectName('taskInfo')
w.task_info.setToolTip(tooltip_text('Step left estimates time for the current step; Total left estimates the remaining queue. Estimates appear once enough timing data is available and may change.'))
footer.addWidget(w.task_info)
- w.log = QTextEdit()
+ w.log = ConsoleLog()
w.log.setReadOnly(True)
w.log.setUndoRedoEnabled(False)
w.log.document().setMaximumBlockCount(500)