feat(rcf): initial ecs work

This commit is contained in:
Swann Martinez
2019-03-15 18:24:20 +01:00
parent 67122c6fcd
commit 5a831668c8
2 changed files with 75 additions and 1 deletions

View File

@ -18,14 +18,16 @@ import sys
from . import net_operators from . import net_operators
from . import net_ui from . import net_ui
from . import net_ecs
def register(): def register():
bsyncio.register() bsyncio.register()
net_operators.register() net_operators.register()
net_ui.register() net_ui.register()
net_ecs.register()
def unregister(): def unregister():
bsyncio.unregister() bsyncio.unregister()
net_ui.unregister() net_ui.unregister()
net_operators.unregister() net_operators.unregister()
net_ecs.unregister()

72
net_ecs.py Normal file
View File

@ -0,0 +1,72 @@
import bpy
from .libs.esper import esper
class Object:
def __init__(self, name=None):
self.name = name
class Vector:
def __init__(self, x=0.0 ,y=0.0,z=0.0):
self.x = x
self.y = y
self.z = z
class Pointer:
def __init__(self, path=None):
self.path = path
class ObjectProcessor(esper.Processor):
def __init__(self):
super().__init__()
def process(self):
for ent in self.world.get_component(Object):
print('asdasd')
class ecs_launch(bpy.types.Operator):
bl_idname = "ecs.launch"
bl_label = "ecs_launch"
bl_description = "Description that shows in blender tooltips"
bl_options = {'REGISTER'}
@classmethod
def poll(cls, context):
return True
def invoke(self, context, event):
context.window_manager.modal_handler_add(self)
return {"RUNNING_MODAL"}
def modal(self, context, event):
if event.type == "LEFTMOUSE":
return {"FINISHED"}
if event.type in {"RIGHTMOUSE", "ESC"}:
return {"CANCELLED"}
return {"RUNNING_MODAL"}
class ecs_init(bpy.types.Operator):
bl_idname = "ecs.init"
bl_label = "ecs_init"
bl_description = "Description that shows in blender tooltips"
bl_options = {"REGISTER"}
@classmethod
def poll(cls, context):
return True
def execute(self, context):
return {"FINISHED"}
classes = (
ecs_init,
ecs_launch,
)
register, unregister = bpy.utils.register_classes_factory(classes)