From c378d862b17f3387bcc08e15b22d37e1e14233e6 Mon Sep 17 00:00:00 2001 From: Patrick Dulebohn Date: Tue, 18 Oct 2022 15:34:49 -0400 Subject: [PATCH] Add Yeesha/Relto Page Modifier * Properties and UI for a simple modifier for xYeeshaPages.py --- korman/properties/modifiers/logic.py | 57 ++++++++++++++++++++++++++++ korman/ui/modifiers/logic.py | 6 +++ 2 files changed, 63 insertions(+) diff --git a/korman/properties/modifiers/logic.py b/korman/properties/modifiers/logic.py index 2fcec98..22248cc 100644 --- a/korman/properties/modifiers/logic.py +++ b/korman/properties/modifiers/logic.py @@ -117,3 +117,60 @@ class PlasmaMaintainersMarker(PlasmaModifierProperties): @property def requires_actor(self): return True + + +yeeshapage_pfms = { + "filename": "xYeeshaPages.py", + "attribs": ( + { 'id': 1, 'type': "ptAttribActivator", 'name': "actClickableBook" }, + { 'id': 2, 'type': "ptAttribInt", 'name': "PageNumbers" }, + ) +} + + +class PlasmaYeeshaPage(PlasmaModifierProperties, PlasmaModifierLogicWiz): + pl_id="yeeshapage" + + bl_category = "Logic" + bl_label = "Yeesha Page" + bl_description = "Set up clickable mesh for a Yeesha/Relto page." + bl_icon = "NEW" + + page_object = PointerProperty(name="Clickable", + description="Object to click for page GUI.", + type=bpy.types.Object, + poll=idprops.poll_mesh_objects) + + page_region = PointerProperty(name="Click Region", + description="Activation region.", + type=bpy.types.Object, + poll=idprops.poll_mesh_objects) + + page_number = IntProperty(name="Page Number", + description="Page number in xYeeshaPages.py script and YeeshaPageGUI.prp", + min=1, default=1, + options=set()) + + def logicwiz(self, bo, tree): + nodes = tree.nodes + + yeeshapage_pfm = yeeshapage_pfms + yeeshapagenode = self._create_python_file_node(tree, yeeshapage_pfm["filename"], yeeshapage_pfm["attribs"]) + self._create_clothing_nodes(bo, tree.nodes, yeeshapagenode) + + def _create_clothing_nodes(self, page_object, nodes, yeeshapagenode): + # Clickable + yeeshapageclick = nodes.new("PlasmaClickableNode") + yeeshapageclick.value = self.page_object + yeeshapageclick.allow_simple = False + yeeshapageclick.link_output(yeeshapagenode, "satisfies", "actClickableBook") + + # Region + yeeshapageregion = nodes.new("PlasmaClickableRegionNode") + yeeshapageregion.region_object = self.page_region + yeeshapageregion.link_output(yeeshapageclick, "satisfies", "region") + + # Page Number + yeeshapagenum = nodes.new("PlasmaAttribIntNode") + yeeshapagenum.value_int = self.page_number + yeeshapagenum.link_output(yeeshapagenode, "pfm", "PageNumbers") diff --git a/korman/ui/modifiers/logic.py b/korman/ui/modifiers/logic.py index d657b5f..fade4c8 100644 --- a/korman/ui/modifiers/logic.py +++ b/korman/ui/modifiers/logic.py @@ -42,3 +42,9 @@ def spawnpoint(modifier, layout, context): def maintainersmarker(modifier, layout, context): layout.label(text="Positive Y is North, positive Z is up.") layout.prop(modifier, "calibration") + +def yeeshapage(modifier, layout, context): + layout.prop(modifier, "page_object") + layout.prop(modifier, "page_region") + layout.prop(modifier, "page_number") +