diff --git a/korman/properties/__init__.py b/korman/properties/__init__.py index 85ef927..7d67d15 100644 --- a/korman/properties/__init__.py +++ b/korman/properties/__init__.py @@ -20,6 +20,7 @@ from .prop_world import * def register(): + bpy.types.Object.plasma_net = PointerProperty(type=PlasmaNet) bpy.types.Object.plasma_object = PointerProperty(type=PlasmaObject) bpy.types.World.plasma_age = PointerProperty(type=PlasmaAge) bpy.types.World.plasma_fni = PointerProperty(type=PlasmaFni) diff --git a/korman/properties/prop_object.py b/korman/properties/prop_object.py index 4abaa92..f21a468 100644 --- a/korman/properties/prop_object.py +++ b/korman/properties/prop_object.py @@ -18,6 +18,17 @@ from bpy.props import * from PyHSPlasma import * +def SdlEnumProperty(name): + return bpy.props.EnumProperty(name=name, + description="{} state synchronization".format(name), + items=[ + ("save", "Save to Server", "Save state on the server"), + ("volatile", "Volatile on Server", "Throw away state when the age shuts down"), + ("exclude", "Don't Send to Server", "Don't synchronize with the server"), + ], + default="save") + + class PlasmaObject(bpy.types.PropertyGroup): def _enabled(self, context): # This makes me sad @@ -60,3 +71,17 @@ class PlasmaObject(bpy.types.PropertyGroup): is_inited = BoolProperty(description="INTERNAL: Init proc complete", default=False, options={"HIDDEN"}) + + +class PlasmaNet(bpy.types.PropertyGroup): + manual_sdl = BoolProperty(name="Override SDL", + description="ADVANCED: Manually track high level states on this object", + default=False) + + # Some of the standard plSynchedObject states + agmaster = SdlEnumProperty("AGMaster") + layer = SdlEnumProperty("Layer") + physical = SdlEnumProperty("Physical") + responder = SdlEnumProperty("Responder") + sound = SdlEnumProperty("Sound") + xregion = SdlEnumProperty("XRegion") diff --git a/korman/ui/ui_object.py b/korman/ui/ui_object.py index 35fd1c2..489b112 100644 --- a/korman/ui/ui_object.py +++ b/korman/ui/ui_object.py @@ -38,4 +38,25 @@ class PlasmaObjectPanel(ObjectButtonsPanel, bpy.types.Panel): pl_age = context.scene.world.plasma_age layout.active = pl_obj.enabled + # Which page does this object go in? + # If left blank, the exporter puts it in page 0 -- "Default" layout.prop_search(pl_obj, "page", pl_age, "pages", icon="BOOKMARKS") + + +class PlasmaNetPanel(ObjectButtonsPanel, bpy.types.Panel): + bl_label = "Plasma Synchronization" + + def draw_header(self, context): + self.layout.prop(context.object.plasma_net, "manual_sdl", text="") + + def draw(self, context): + layout = self.layout + pl_net = context.object.plasma_net + layout.active = pl_net.manual_sdl + + layout.prop(pl_net, "agmaster", text="Animation") + layout.prop(pl_net, "layer", text="Material") + layout.prop(pl_net, "physical") + layout.prop(pl_net, "responder") + layout.prop(pl_net, "sound") + layout.prop(pl_net, "xregion")