|
@@ -1,11 +1,10 @@
|
|
|
from dataclasses import dataclass
|
|
|
from typing import Callable, Dict, List, Optional, Union
|
|
|
|
|
|
-from .. import globals
|
|
|
from ..dependencies import register_component
|
|
|
from ..element import Element
|
|
|
from ..events import SceneClickEventArguments, SceneClickHit, handle_event
|
|
|
-from ..functions.lifecycle import on_connect
|
|
|
+from ..globals import socketio_id
|
|
|
from .scene_object3d import Object3D
|
|
|
from .scene_objects import Scene as SceneObject
|
|
|
|
|
@@ -72,14 +71,18 @@ class Scene(Element):
|
|
|
self.stack: List[Union[Object3D, SceneObject]] = [SceneObject()]
|
|
|
self.camera: SceneCamera = SceneCamera()
|
|
|
self.on_click = on_click
|
|
|
+ self.on('connect', self.handle_connect)
|
|
|
self.on('click3d', self.handle_click)
|
|
|
- on_connect(self.handle_connect)
|
|
|
|
|
|
- def handle_connect(self) -> None:
|
|
|
- with globals.current_socket():
|
|
|
+ def handle_connect(self, x) -> None:
|
|
|
+ if not 'args' in x:
|
|
|
+ raise Exception('no args')
|
|
|
+ with socketio_id(x['args']):
|
|
|
+ self.run_method('init')
|
|
|
self.move_camera(duration=0)
|
|
|
for object in self.objects.values():
|
|
|
object.send()
|
|
|
+ return 'bam2'
|
|
|
|
|
|
def handle_click(self, msg: Dict) -> None:
|
|
|
arguments = SceneClickEventArguments(
|