Browse Source

Change Tint Selection

* Change tint color selectors to color pickers
* Add equations to convert RGB values
pull/349/head
Patrick Dulebohn 2 years ago
parent
commit
bf2af9aeaf
  1. 49
      korman/properties/modifiers/logic.py
  2. 8
      korman/ui/modifiers/logic.py

49
korman/properties/modifiers/logic.py

@ -177,33 +177,20 @@ class PlasmaTakeClothing(PlasmaModifierProperties, PlasmaModifierLogicWiz):
clothing_chance = StringProperty(name="Chance SDL (optional)", clothing_chance = StringProperty(name="Chance SDL (optional)",
description="SDL variable for chance appearance of clothing.", description="SDL variable for chance appearance of clothing.",
options=set()) options=set())
clothing_tint1red = IntProperty(name="Tint 1 Red", clothing_tint1 = FloatVectorProperty(name="Tint 1",
description="Red setting for first tint.", description="Sets the default color of the first tint in clothing.",
min=0, max=255, default=255, subtype="COLOR",
options=set()) min=0.0, max=1.0,
clothing_tint1green = IntProperty(name="Tint 1 Green", default=(1.0, 1.0, 1.0))
description="Green setting for first tint.", clothing_tint2 = FloatVectorProperty(name="Tint 2",
min=0, max=255, default=255, description="Sets the default color of the second tint in clothing.",
options=set()) subtype="COLOR",
clothing_tint1blue = IntProperty(name="Tint 1 Blue", min=0.0, max=1.0,
description="Blue setting for first tint.", default=(1.0, 1.0, 1.0))
min=0, max=255, default=255,
options=set())
clothing_tint2on = BoolProperty(name="Second Tint?", clothing_tint2on = BoolProperty(name="Second Tint?",
description="Does the clothing item have a second tint color?", description="Does the clothing item have a second tint color?",
default=False, default=False,
options=set()) options=set())
clothing_tint2red = IntProperty(name="Tint 2 Red",
description="Red setting for second tint.",
min=0, max=255, default=255,
options=set())
clothing_tint2green = IntProperty(name="Tint 2 Green",
description="Green setting for second tint.",
min=0, max=255, default=255,
options=set())
clothing_tint2blue = IntProperty(name="Tint 2 Blue",
description="Blue setting for second tint.",
min=0, max=255, default=255,
options=set()) options=set())
clothing_stayvis = BoolProperty(name="Stay Visible After Click?", clothing_stayvis = BoolProperty(name="Stay Visible After Click?",
description="Should the clothing stay visible after first clicking?", description="Should the clothing stay visible after first clicking?",
@ -212,6 +199,8 @@ class PlasmaTakeClothing(PlasmaModifierProperties, PlasmaModifierLogicWiz):
def logicwiz(self, bo, tree): def logicwiz(self, bo, tree):
nodes = tree.nodes nodes = tree.nodes
colortint1 = self.clothing_tint1
colortint2 = self.clothing_tint2
# Create Python File node # Create Python File node
clothingpynode = self._create_python_file_node(tree, clothing_pfm["filename"], clothing_pfm["attribs"]) clothingpynode = self._create_python_file_node(tree, clothing_pfm["filename"], clothing_pfm["attribs"])
@ -257,27 +246,27 @@ class PlasmaTakeClothing(PlasmaModifierProperties, PlasmaModifierLogicWiz):
clothingmale.link_output(clothingpynode, "pfm", "stringMClothingName") clothingmale.link_output(clothingpynode, "pfm", "stringMClothingName")
clothingred1 = nodes.new("PlasmaAttribIntNode") clothingred1 = nodes.new("PlasmaAttribIntNode")
clothingred1.value_int = self.clothing_tint1red clothingred1.value_int = (255 * colortint1.r)
clothingred1.link_output(clothingpynode, "pfm", "intTint1Red") clothingred1.link_output(clothingpynode, "pfm", "intTint1Red")
clothinggreen1 = nodes.new("PlasmaAttribIntNode") clothinggreen1 = nodes.new("PlasmaAttribIntNode")
clothinggreen1.value_int = self.clothing_tint1green clothinggreen1.value_int = (255 * colortint1.g)
clothinggreen1.link_output(clothingpynode, "pfm", "intTint1Green") clothinggreen1.link_output(clothingpynode, "pfm", "intTint1Green")
clothingblue1 = nodes.new("PlasmaAttribIntNode") clothingblue1 = nodes.new("PlasmaAttribIntNode")
clothingblue1.value_int = self.clothing_tint1blue clothingblue1.value_int = (255 * colortint1.b)
clothingblue1.link_output(clothingpynode, "pfm", "intTint1Blue") clothingblue1.link_output(clothingpynode, "pfm", "intTint1Blue")
clothingred2 = nodes.new("PlasmaAttribIntNode") clothingred2 = nodes.new("PlasmaAttribIntNode")
clothingred2.value_int = self.clothing_tint2red clothingred2.value_int = (255 * colortint2.r)
clothingred2.link_output(clothingpynode, "pfm", "intTint2Red") clothingred2.link_output(clothingpynode, "pfm", "intTint2Red")
clothinggreen2 = nodes.new("PlasmaAttribIntNode") clothinggreen2 = nodes.new("PlasmaAttribIntNode")
clothinggreen2.value_int = self.clothing_tint2green clothinggreen2.value_int = (255 * colortint2.g)
clothinggreen2.link_output(clothingypnode, "pfm", "intTint2Green") clothinggreen2.link_output(clothingpynode, "pfm", "intTint2Green")
clothingblue2 = nodes.new("PlasmaAttribIntNode") clothingblue2 = nodes.new("PlasmaAttribIntNode")
clothingblue2.value_int = self.clothing_tint2blue clothingblue2.value_int = (255 * colortint2.b)
clothingblue2.link_output(clothingpynode, "pfm", "intTint2Blue") clothingblue2.link_output(clothingpynode, "pfm", "intTint2Blue")
# Misc # Misc

8
korman/ui/modifiers/logic.py

@ -68,15 +68,11 @@ def clothing(modifier, layout, context):
split = layout.split() split = layout.split()
col = split.column() col = split.column()
col.prop(modifier, "clothing_tint1red") col.prop(modifier, "clothing_tint1")
col.prop(modifier, "clothing_tint1green")
col.prop(modifier, "clothing_tint1blue")
col = split.column() col = split.column()
col.enabled = modifier.clothing_tint2on is True col.enabled = modifier.clothing_tint2on is True
col.prop(modifier, "clothing_tint2red") col.prop(modifier, "clothing_tint2")
col.prop(modifier, "clothing_tint2green")
col.prop(modifier, "clothing_tint2blue")
layout.separator() layout.separator()
layout.label(text="Visibility:") layout.label(text="Visibility:")

Loading…
Cancel
Save