From dc547a05d98b240c73d2329ce2943a33674623f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marein=20K=C3=B6nings?= Date: Tue, 14 Feb 2017 19:55:34 +0100 Subject: [PATCH] Add rudimentary DropDownList logic node, with a string as input --- korman/nodes/node_python.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/korman/nodes/node_python.py b/korman/nodes/node_python.py index 0e6307d..89e52bf 100644 --- a/korman/nodes/node_python.py +++ b/korman/nodes/node_python.py @@ -34,6 +34,7 @@ _attrib2param = { "ptAttribFloat": plPythonParameter.kFloat, "ptAttribBoolean": plPythonParameter.kBoolean, "ptAttribString": plPythonParameter.kString, + "ptAttribDropDownList": plPythonParameter.kString, "ptAttribSceneobject": plPythonParameter.kSceneObject, "ptAttribSceneobjectList": plPythonParameter.kSceneObjectList, "ptAttribActivator": plPythonParameter.kActivator, @@ -99,6 +100,7 @@ class PlasmaAttribute(bpy.types.PropertyGroup): _simple_attrs = { "ptAttribString": "value_string", + "ptAttribDropDownList": "value_string", "ptAttribInt": "value_int", "ptAttribFloat": "value_float", "ptAttribBoolean": "value_bool", @@ -474,6 +476,24 @@ class PlasmaAttribObjectNode(idprops.IDPropObjectMixin, PlasmaAttribNodeBase, bp return {"target_object": "object_name"} +class PlasmaAttribDropDownListNode(PlasmaAttribNodeBase, bpy.types.Node): + bl_category = "PYTHON" + bl_idname = "PlasmaAttribDropDownListNode" + bl_label = "Drop Down List Attribute" + + pl_attrib = "ptAttribDropDownList" + value = StringProperty() + + def draw_buttons(self, context, layout): + layout.prop(self, "value", text=self.attribute_name) + + def update(self): + super().update() + attrib = self.to_socket + if attrib is not None and not self.value: + self.value = attrib.simple_value + + class PlasmaAttribStringNode(PlasmaAttribNodeBase, bpy.types.Node): bl_category = "PYTHON" bl_idname = "PlasmaAttribStringNode" @@ -590,6 +610,7 @@ _attrib_colors = { "ptAttribResponder": (0.031, 0.110, 0.290, 1.0), "ptAttribResponderList": (0.031, 0.110, 0.290, 1.0), "ptAttribString": (0.675, 0.659, 0.494, 1.0), + "ptAttribDropDownList": (0.475, 0.459, 0.494, 1.0), PlasmaAttribNumericNode.pl_attrib: (0.443, 0.439, 0.392, 1.0), PlasmaAttribObjectNode.pl_attrib: (0.565, 0.267, 0.0, 1.0),