refactor: use msgpack instead of umsgpack
refactor: remove unused files
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
| Dependencies | Version | Needed |
|
| Dependencies | Version | Needed |
|
||||||
|--------------|:-------:|-------:|
|
|--------------|:-------:|-------:|
|
||||||
| ZeroMQ | latest | yes |
|
| ZeroMQ | latest | yes |
|
||||||
| umsgpack | latest | yes |
|
| msgpack | latest | yes |
|
||||||
| PyYAML | latest | yes |
|
| PyYAML | latest | yes |
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
@ -22,7 +22,7 @@ from . import environment, utils
|
|||||||
|
|
||||||
DEPENDENCIES = {
|
DEPENDENCIES = {
|
||||||
("zmq","zmq"),
|
("zmq","zmq"),
|
||||||
("umsgpack","umsgpack"),
|
("msgpack","msgpack"),
|
||||||
("yaml","pyyaml"),
|
("yaml","pyyaml"),
|
||||||
("jsondiff","jsondiff")
|
("jsondiff","jsondiff")
|
||||||
}
|
}
|
||||||
|
@ -5,9 +5,6 @@ from .. import utils
|
|||||||
from .. import presence
|
from .. import presence
|
||||||
from .bl_datablock import BlDatablock
|
from .bl_datablock import BlDatablock
|
||||||
from ..libs.replication.replication.constants import UP
|
from ..libs.replication.replication.constants import UP
|
||||||
from ..libs.debug import draw_point
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class BlUser(BlDatablock):
|
class BlUser(BlDatablock):
|
||||||
# def __init__(self, *args, **kwargs):
|
# def __init__(self, *args, **kwargs):
|
||||||
|
@ -3,7 +3,6 @@ import logging
|
|||||||
|
|
||||||
from . import operators, utils, presence
|
from . import operators, utils, presence
|
||||||
from .bl_types.bl_user import BlUser
|
from .bl_types.bl_user import BlUser
|
||||||
from .libs import debug
|
|
||||||
from .libs.replication.replication.constants import FETCHED
|
from .libs.replication.replication.constants import FETCHED
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
126
libs/debug.py
126
libs/debug.py
@ -1,126 +0,0 @@
|
|||||||
import bpy
|
|
||||||
import bgl
|
|
||||||
import gpu
|
|
||||||
from gpu_extras.batch import batch_for_shader
|
|
||||||
import numpy
|
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_COORDS = [(0.0, 0.0, 0.0)]
|
|
||||||
DEFAULT_INDICES = [(0)]
|
|
||||||
|
|
||||||
|
|
||||||
def refresh_viewport():
|
|
||||||
bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)
|
|
||||||
|
|
||||||
|
|
||||||
class Drawable():
|
|
||||||
"""Drawable base class in charge to hanfle the drawing pipline.
|
|
||||||
|
|
||||||
:param coords: list of vertices
|
|
||||||
:type coords: list of tuples. ex: [(x,y,z),...]
|
|
||||||
:param indices: list of vertices index to structure geometry
|
|
||||||
:type indices: list of tuples.
|
|
||||||
:param location: suited location in world space.
|
|
||||||
:type location: tuple, (x,y,z)
|
|
||||||
:param mode: primitive drawing mode.
|
|
||||||
:type mode: string in ['POINTS','LINES','TRIS'], default: "POINTS".
|
|
||||||
:param color: primitive color
|
|
||||||
:type color: tuple, (r,g,b,a)
|
|
||||||
:param duration: lifetime of the primitive in seconds
|
|
||||||
:type duration: float
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(self, coords=DEFAULT_COORDS, indices=DEFAULT_INDICES, location=(0.0, 0.0, 0.0), mode='POINTS', color=(1, 0, 0, 1), duration=0):
|
|
||||||
self._duration = duration
|
|
||||||
self._color = color
|
|
||||||
self._coord = [tuple(numpy.add(c,location)) for c in coords]
|
|
||||||
self.shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
|
|
||||||
self.batch = batch_for_shader(
|
|
||||||
self.shader, mode, {"pos": self._coord}, indices=indices)
|
|
||||||
|
|
||||||
# Bind the drawing function
|
|
||||||
self._handler = bpy.types.SpaceView3D.draw_handler_add(
|
|
||||||
self.draw, (), 'WINDOW', 'POST_VIEW')
|
|
||||||
# Bind the callback
|
|
||||||
if duration:
|
|
||||||
self._timer = bpy.app.timers.register(
|
|
||||||
self.clear, first_interval=duration)
|
|
||||||
|
|
||||||
def draw(self):
|
|
||||||
self.shader.bind()
|
|
||||||
self.shader.uniform_float("color", self._color)
|
|
||||||
self.batch.draw(self.shader)
|
|
||||||
|
|
||||||
def clear(self):
|
|
||||||
"""Remove the drawable object from the viewport
|
|
||||||
"""
|
|
||||||
bpy.types.SpaceView3D.draw_handler_remove(self._handler, 'WINDOW')
|
|
||||||
|
|
||||||
|
|
||||||
def draw_point(location=(0, 0, 0), color=(1, 0, 0, 1), duration=1):
|
|
||||||
"""Draw a point
|
|
||||||
|
|
||||||
:param location: suited location in world space.
|
|
||||||
:type location: tuple, (x,y,z)
|
|
||||||
:param color: primitive color
|
|
||||||
:type color: tuple, (r,g,b,a)
|
|
||||||
:param duration: lifetime of the primitive in seconds
|
|
||||||
:type duration: float
|
|
||||||
"""
|
|
||||||
return Drawable(location=location, color=color, duration=duration)
|
|
||||||
|
|
||||||
|
|
||||||
def draw_line(a=(0, 0, 0), b=(0, 1, 0), color=(1, 0, 0, 1), duration=1):
|
|
||||||
""" Draw a line from a given point A to the point B.
|
|
||||||
|
|
||||||
:param a: point A location in world space.
|
|
||||||
:type a: tuple, (x,y,z)
|
|
||||||
:param b: point B location in world space.
|
|
||||||
:type b: tuple, (x,y,z)
|
|
||||||
:param color: primitive color
|
|
||||||
:type color: tuple, (r,g,b,a)
|
|
||||||
:param duration: lifetime of the primitive in seconds
|
|
||||||
:type duration: float
|
|
||||||
"""
|
|
||||||
return Drawable(coords=[a, b], indices=[(0, 1)], mode='LINES', color=color, duration=duration)
|
|
||||||
|
|
||||||
|
|
||||||
def draw_cube(radius=1, location=(0, 0, 0), color=(1, 0, 0, 1), duration=1):
|
|
||||||
""" Draw a cube.
|
|
||||||
|
|
||||||
:param radius: size of the cube.
|
|
||||||
:type radius: float
|
|
||||||
:param location: suited location in world space.
|
|
||||||
:type location: tuple, (x,y,z)
|
|
||||||
:param color: primitive color
|
|
||||||
:type color: tuple, (r,g,b,a)
|
|
||||||
:param duration: lifetime of the primitive in seconds
|
|
||||||
:type duration: float
|
|
||||||
"""
|
|
||||||
coords = (
|
|
||||||
(-radius, -radius, -radius), (+radius, -radius, -radius),
|
|
||||||
(-radius, +radius, -radius), (+radius, +radius, -radius),
|
|
||||||
(-radius, -radius, +radius), (+radius, -radius, +radius),
|
|
||||||
(-radius, +radius, +radius), (+radius, +radius, +radius))
|
|
||||||
|
|
||||||
indices = (
|
|
||||||
(0, 1), (0, 2), (1, 3), (2, 3),
|
|
||||||
(4, 5), (4, 6), (5, 7), (6, 7),
|
|
||||||
(0, 4), (1, 5), (2, 6), (3, 7))
|
|
||||||
|
|
||||||
return Drawable(coords=coords, mode='LINES', indices=indices, location=location, color=color, duration=duration)
|
|
||||||
|
|
||||||
def draw_custom(coords=DEFAULT_COORDS, indices=DEFAULT_INDICES, mode='LINES',location=(0, 0, 0), color=(1, 0, 0, 1), duration=1):
|
|
||||||
""" Draw a user defined polygon shape.
|
|
||||||
|
|
||||||
:param coords: list of vertices
|
|
||||||
:type coords: list of tuples. ex: [(x,y,z),...]
|
|
||||||
:param indices: list of vertices index to structure geometry
|
|
||||||
:type indices: list of tuples.
|
|
||||||
:param location: suited location in
|
|
||||||
:param color: primitive color
|
|
||||||
:type color: tuple, (r,g,b,a)
|
|
||||||
:param duration: lifetime of the primitive in seconds
|
|
||||||
:type duration: float
|
|
||||||
"""
|
|
||||||
return Drawable(coords=coords, indices=indices, mode=mode, location=location, color=color, duration=duration)
|
|
Submodule libs/replication updated: 543e9b7d1d...3274935356
1134
libs/umsgpack.py
1134
libs/umsgpack.py
File diff suppressed because it is too large
Load Diff
@ -15,7 +15,7 @@ from bpy_extras.io_utils import ExportHelper
|
|||||||
from bpy.app.handlers import persistent
|
from bpy.app.handlers import persistent
|
||||||
|
|
||||||
from . import environment, presence, ui, utils, delayable
|
from . import environment, presence, ui, utils, delayable
|
||||||
from .libs import umsgpack
|
import msgpack
|
||||||
from .libs.replication.replication.data import ReplicatedDataFactory
|
from .libs.replication.replication.data import ReplicatedDataFactory
|
||||||
from .libs.replication.replication.interface import Session
|
from .libs.replication.replication.interface import Session
|
||||||
from .libs.replication.replication.exception import NonAuthorizedOperationError
|
from .libs.replication.replication.exception import NonAuthorizedOperationError
|
||||||
|
@ -12,9 +12,6 @@ from bpy_extras import view3d_utils
|
|||||||
from gpu_extras.batch import batch_for_shader
|
from gpu_extras.batch import batch_for_shader
|
||||||
|
|
||||||
from . import utils
|
from . import utils
|
||||||
from .libs import debug
|
|
||||||
# from .bl_types.bl_user import BlUser
|
|
||||||
# from .delayable import Draw
|
|
||||||
|
|
||||||
global renderer
|
global renderer
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user