mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-03 22:38:48 +08:00
Fix resolution rendering logic in statemachine for viewer beta (#2085)
* fix render statemachine logic for viewer beta
This commit is contained in:
1 parent
1066f8f433
commit
e4a5c38b28
2 files changed
+11
-3
No files matched your search
@@ -17,6 +17,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import threading
|
import threading
|
||||||
|
import time
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import TYPE_CHECKING, Any, Dict, Literal, Optional, Tuple, get_args
|
from typing import TYPE_CHECKING, Any, Dict, Literal, Optional, Tuple, get_args
|
||||||
|
|
||||||
@@ -97,12 +98,16 @@ class RenderStateMachine(threading.Thread):
|
|||||||
elif self.next_action == "rerender":
|
elif self.next_action == "rerender":
|
||||||
# never overwrite rerenders
|
# never overwrite rerenders
|
||||||
pass
|
pass
|
||||||
|
elif action.action == "static" and self.next_action.action == "move":
|
||||||
|
# don't overwrite a move action with a static: static is always self-fired
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
# monimal use case, just set the next action
|
# monimal use case, just set the next action
|
||||||
self.next_action = action
|
self.next_action = action
|
||||||
|
|
||||||
# handle interrupt logic
|
# handle interrupt logic
|
||||||
if self.state == "high" and self.next_action.action in ("move", "rerender"):
|
if self.state == "high" and self.next_action.action in ("move", "rerender"):
|
||||||
|
print("interrupting render", self.next_action.action)
|
||||||
self.interrupt_render_flag = True
|
self.interrupt_render_flag = True
|
||||||
self.render_trigger.set()
|
self.render_trigger.set()
|
||||||
|
|
||||||
@@ -176,7 +181,10 @@ class RenderStateMachine(threading.Thread):
|
|||||||
continue
|
continue
|
||||||
self._send_output_to_viewer(outputs)
|
self._send_output_to_viewer(outputs)
|
||||||
# if we rendered a static low res, we need to self-trigger a static high-res
|
# if we rendered a static low res, we need to self-trigger a static high-res
|
||||||
if self.state == "low_static":
|
if self.next_action is None:
|
||||||
|
# if there hasn't been an action, wait for 1/target_fps seconds in case we get another move command
|
||||||
|
time.sleep(1 / self.target_fps)
|
||||||
|
if self.state in ["low_static", "low_move"]:
|
||||||
self.action(RenderAction("static", action.camera_state))
|
self.action(RenderAction("static", action.camera_state))
|
||||||
|
|
||||||
def check_interrupt(self, frame, event, arg):
|
def check_interrupt(self, frame, event, arg):
|
||||||
|
|||||||
@@ -126,8 +126,8 @@ class Viewer:
|
|||||||
|
|
||||||
def _interrupt_render(self, _) -> None:
|
def _interrupt_render(self, _) -> None:
|
||||||
"""Interrupt current render."""
|
"""Interrupt current render."""
|
||||||
if self.camera_message is not None:
|
if self.camera_state is not None:
|
||||||
self.render_statemachine.action(RenderAction("rerender", self.camera_message))
|
self.render_statemachine.action(RenderAction("rerender", self.camera_state))
|
||||||
|
|
||||||
def _crop_params_update(self, _) -> None:
|
def _crop_params_update(self, _) -> None:
|
||||||
"""Update crop parameters"""
|
"""Update crop parameters"""
|
||||||
|
|||||||
Reference in new issue
Block a user