feat: factory setup
This commit is contained in:
parent
11b6866045
commit
e376650df2
@ -1 +1 @@
|
|||||||
Subproject commit 130845f74dc59d2bb0e5fee8c66e199ac377cff0
|
Subproject commit e3de7fbfb9758fd576eba3a87d4a8c418066f16c
|
32
operators.py
32
operators.py
@ -17,6 +17,7 @@ from pathlib import Path
|
|||||||
from . import environment, presence, ui, utils
|
from . import environment, presence, ui, utils
|
||||||
from .libs import umsgpack
|
from .libs import umsgpack
|
||||||
from .libs.replication.client import Client
|
from .libs.replication.client import Client
|
||||||
|
from .libs.replication.data import ReplicatedDataFactory
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -116,9 +117,8 @@ def unregister_ticks():
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
# OPERATORS
|
# OPERATORS
|
||||||
|
|
||||||
|
|
||||||
class SessionStartOperator(bpy.types.Operator):
|
class SessionStartOperator(bpy.types.Operator):
|
||||||
bl_idname = "session.start"
|
bl_idname = "session.start"
|
||||||
bl_label = "start"
|
bl_label = "start"
|
||||||
@ -142,20 +142,28 @@ class SessionStartOperator(bpy.types.Operator):
|
|||||||
if settings.start_empty:
|
if settings.start_empty:
|
||||||
clean_scene()
|
clean_scene()
|
||||||
|
|
||||||
# Session setup
|
# Setup data factory
|
||||||
if settings.username == "DefaultUser":
|
bpy_factory = ReplicatedDataFactory()
|
||||||
settings.username = "{}_{}".format(
|
|
||||||
settings.username, utils.random_string_digits())
|
|
||||||
|
|
||||||
|
# Setup client
|
||||||
client = Client()
|
client = Client(factory=bpy_factory)
|
||||||
client.connect(settings.username,
|
|
||||||
settings.ip,
|
if self.host:
|
||||||
settings.port)
|
client.host(
|
||||||
|
id=settings.username,
|
||||||
|
address=settings.ip,
|
||||||
|
port=settings.port
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
client.connect(
|
||||||
|
id=settings.username,
|
||||||
|
address=settings.ip,
|
||||||
|
port=settings.port
|
||||||
|
)
|
||||||
|
|
||||||
# settings.is_running = True
|
# settings.is_running = True
|
||||||
# bpy.ops.session.refresh()
|
# bpy.ops.session.refresh()
|
||||||
register_ticks()
|
#register_ticks()
|
||||||
|
|
||||||
# Launch drawing module
|
# Launch drawing module
|
||||||
if settings.enable_presence:
|
if settings.enable_presence:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user