Skip to content

Commit

Permalink
adding browser server #11
Browse files Browse the repository at this point in the history
  • Loading branch information
Zamme committed Jun 12, 2024
1 parent 4d48176 commit 1ef431b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions B2G3/blender2godot/test_project/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import sys
from http.server import HTTPServer, SimpleHTTPRequestHandler, test # type: ignore
from pathlib import Path
from threading import Thread

import bpy
from blender2godot.addon_config import addon_config # type: ignore
Expand All @@ -49,8 +50,6 @@ def end_headers(self):
self.send_header("Cross-Origin-Embedder-Policy", "require-corp")
self.send_header("Access-Control-Allow-Origin", "*")
super().end_headers()


### END BROWSER SERVER ###


Expand Down Expand Up @@ -93,8 +92,15 @@ def execute(self, context):
def modal(self, context, event):
if not self._testing:
self._testing = True
test(CORSRequestHandler, DualStackServer, port=self._port)
return {'PASS_THROUGH'}
self._handler = CORSRequestHandler
self._dual_stack_server = DualStackServer
t = Thread(target=test, args=(self._handler, self._dual_stack_server, self._port,))
t.start()
test(self._handler, self._dual_stack_server, port=self._port)
return {'PASS_THROUGH'}
else:
print(self._handler)
return {'FINISHED'}

def invoke(self, context, event):
print("Starting browser game", context.scene.project_folder)
Expand Down

0 comments on commit 1ef431b

Please sign in to comment.