Skip to content

Commit

Permalink
Add rudimentary DropDownList logic node, with a string as input
Browse files Browse the repository at this point in the history
  • Loading branch information
Marein Könings committed Feb 19, 2017
1 parent 9d32541 commit 9b1a6d7
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions korman/nodes/node_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"ptAttribFloat": plPythonParameter.kFloat,
"ptAttribBoolean": plPythonParameter.kBoolean,
"ptAttribString": plPythonParameter.kString,
"ptAttribDropDownList": plPythonParameter.kString,
"ptAttribSceneobject": plPythonParameter.kSceneObject,
"ptAttribSceneobjectList": plPythonParameter.kSceneObjectList,
"ptAttribActivator": plPythonParameter.kActivator,
Expand Down Expand Up @@ -98,6 +99,7 @@ class PlasmaAttribute(bpy.types.PropertyGroup):

_simple_attrs = {
"ptAttribString": "value_string",
"ptAttribDropDownList": "value_string",
"ptAttribInt": "value_int",
"ptAttribFloat": "value_float",
"ptAttribBoolean": "value_bool",
Expand Down Expand Up @@ -468,6 +470,24 @@ def get_key(self, exporter, so):
return exporter.mgr.find_create_key(plWaveSet7, so=ref_so, bl=bo)


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"
Expand Down Expand Up @@ -550,6 +570,7 @@ def get_key(self, exporter, so):
"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),
Expand Down

0 comments on commit 9b1a6d7

Please sign in to comment.