Browse Source

Merge 0a57ddabdc into 421f8032c8

pull/349/merge
Patrick Dulebohn 2 years ago committed by GitHub
parent
commit
1a9839d7fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 156
      korman/properties/modifiers/logic.py
  2. 36
      korman/ui/modifiers/logic.py

156
korman/properties/modifiers/logic.py

@ -117,3 +117,159 @@ class PlasmaMaintainersMarker(PlasmaModifierProperties):
@property
def requires_actor(self):
return True
clothing_pfm = {
"filename": "xTakableClothing.py",
"attribs": (
{ 'id': 1, 'type': "ptAttribString", 'name': "stringVarName" },
{ 'id': 2, 'type': "ptAttribBoolean", 'name': "boolShowOnTrue" },
{ 'id': 3, 'type': "ptAttribActivator", 'name': "actClickable" },
{ 'id': 4, 'type': "ptAttribString", 'name': "stringFClothingName" },
{ 'id': 5, 'type': "ptAttribString", 'name': "stringMClothingName" },
{ 'id': 6, 'type': "ptAttribBoolean", 'name': "boolHasHairColor" },
{ 'id': 7, 'type': "ptAttribString", 'name': "stringChanceSDLName" },
{ 'id': 8, 'type': "ptAttribInt", 'name': "intTint1Red" },
{ 'id': 9, 'type': "ptAttribInt", 'name': "intTint1Green" },
{ 'id': 10, 'type': "ptAttribInt", 'name': "intTint1Blue" },
{ 'id': 11, 'type': "ptAttribInt", 'name': "intTint2Red" },
{ 'id': 12, 'type': "ptAttribInt", 'name': "intTint2Green" },
{ 'id': 13, 'type': "ptAttribInt", 'name': "intTint2Blue" },
{ 'id': 14, 'type': "ptAttribBoolean", 'name': "boolStayVisible" },
{ 'id': 15, 'type': "ptAttribBoolean", 'name': "boolFirstUpdate" },
)
}
class PlasmaTakeClothing(PlasmaModifierProperties, PlasmaModifierLogicWiz):
pl_id = "clothing"
bl_category = "Logic"
bl_label = "Takable Clothing"
bl_description = "Set up clickable mesh for a collectable clothing item."
bl_icon = "POSE_HLT"
clickable_object = PointerProperty(name="Clickable",
description="Clickable mesh object for clothing item.",
type=bpy.types.Object,
poll=idprops.poll_mesh_objects)
clickable_region = PointerProperty(name="Region",
description="Region to activate clickable.",
type=bpy.types.Object,
poll=idprops.poll_mesh_objects)
clothing_sdl = StringProperty(name="SDL Variable",
description="SDL variable associated with the clothing item.",
options=set())
clothing_show = BoolProperty(name="Show on true?",
description="Have the clothing only appear when the SDL variable is true.",
default=False,
options=set())
clothing_hair = BoolProperty(name="Changes hair color?",
description="Should the hair change too?",
default=False,
options=set())
clothing_male = StringProperty(name="Male ID",
description="ID name for male version of clothing.",
options=set())
clothing_female = StringProperty(name="Female ID",
description="ID name for female version of clothing.",
options=set())
clothing_chance = StringProperty(name="Chance SDL (optional)",
description="SDL variable for chance appearance of clothing.",
options=set())
clothing_tint1 = FloatVectorProperty(name="Tint 1",
description="Sets the default color of the first tint in clothing.",
subtype="COLOR",
min=0.0, max=1.0,
default=(1.0, 1.0, 1.0))
clothing_tint2 = FloatVectorProperty(name="Tint 2",
description="Sets the default color of the second tint in clothing.",
subtype="COLOR",
min=0.0, max=1.0,
default=(1.0, 1.0, 1.0))
clothing_stayvis = BoolProperty(name="Stay Visible After Click?",
description="Should the clothing stay visible after first clicking?",
default=False,
options=set())
def logicwiz(self, bo, tree):
nodes = tree.nodes
colortint1 = self.clothing_tint1
colortint2 = self.clothing_tint2
# Create Python File node
clothingpynode = self._create_python_file_node(tree, clothing_pfm["filename"], clothing_pfm["attribs"])
# Clickable
clickable = nodes.new("PlasmaClickableNode")
clickable.clickable_object = self.clickable_object
for i in clickable.inputs:
i.allow_simple = False
clickable.link_output(clothingpynode, "satisfies", "actClickable")
# Region
clothingrgn = nodes.new("PlasmaClickableRegionNode")
clothingrgn.region_object = self.clickable_region
clothingrgn.link_output(clickable, "satisfies", "region")
# SDL Variable
clothingsdlvar = nodes.new("PlasmaAttribStringNode")
clothingsdlvar.value = self.clothing_sdl
clothingsdlvar.link_output(clothingpynode, "pfm", "stringVarName")
# Show On True?
clothingshow = nodes.new("PlasmaAttribBoolNode")
clothingshow.value = self.clothing_show
clothingshow.link_output(clothingpynode, "pfm", "boolShowOnTrue")
# Hair color?
clothinghair = nodes.new("PlasmaAttribBoolNode")
clothinghair.value = self.clothing_hair
clothinghair.link_output(clothingpynode, "pfm", "boolHasHairColor")
# Chance SDL
clothingchance = nodes.new("PlasmaAttribStringNode")
clothingchance.value = self.clothing_chance
clothingchance.link_output(clothingpynode, "pfm", "stringChanceSDLName")
# Colors, man!
clothingfemale = nodes.new("PlasmaAttribStringNode")
clothingfemale.value = self.clothing_female
clothingfemale.link_output(clothingpynode, "pfm", "stringFClothingName")
clothingmale = nodes.new("PlasmaAttribStringNode")
clothingmale.value = self.clothing_male
clothingmale.link_output(clothingpynode, "pfm", "stringMClothingName")
clothingred1 = nodes.new("PlasmaAttribIntNode")
clothingred1.value_int = (255 * colortint1.r)
clothingred1.link_output(clothingpynode, "pfm", "intTint1Red")
clothinggreen1 = nodes.new("PlasmaAttribIntNode")
clothinggreen1.value_int = (255 * colortint1.g)
clothinggreen1.link_output(clothingpynode, "pfm", "intTint1Green")
clothingblue1 = nodes.new("PlasmaAttribIntNode")
clothingblue1.value_int = (255 * colortint1.b)
clothingblue1.link_output(clothingpynode, "pfm", "intTint1Blue")
clothingred2 = nodes.new("PlasmaAttribIntNode")
clothingred2.value_int = (255 * colortint2.r)
clothingred2.link_output(clothingpynode, "pfm", "intTint2Red")
clothinggreen2 = nodes.new("PlasmaAttribIntNode")
clothinggreen2.value_int = (255 * colortint2.g)
clothinggreen2.link_output(clothingpynode, "pfm", "intTint2Green")
clothingblue2 = nodes.new("PlasmaAttribIntNode")
clothingblue2.value_int = (255 * colortint2.b)
clothingblue2.link_output(clothingpynode, "pfm", "intTint2Blue")
# Misc
clothingvis = nodes.new("PlasmaAttribBoolNode")
clothingvis.value = self.clothing_stayvis
clothingvis.link_output(clothingpynode, "pfm", "boolStayVisible")
clothingeval = nodes.new("PlasmaAttribBoolNode")
clothingeval.value = False
clothingeval.link_output(clothingpynode, "pfm", "boolFirstUpdate")

36
korman/ui/modifiers/logic.py

@ -42,3 +42,39 @@ 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 clothing(modifier, layout, context):
layout.prop(modifier, "clickable_object")
layout.prop(modifier, "clickable_region")
if modifier.clickable_object and modifier.clickable_region:
layout.separator()
layout.label(text="Clothing Item Details:")
split = layout.split()
col = split.column()
col.prop(modifier, "clothing_sdl")
col.prop(modifier, "clothing_chance")
col.prop(modifier, "clothing_female")
col.prop(modifier, "clothing_male")
layout.separator()
layout.label(text="Default Clothing Color(s):")
split = layout.split()
col = split.column()
col.prop(modifier, "clothing_tint1")
col = split.column()
col.prop(modifier, "clothing_tint2")
split = layout.split()
col = split.column()
col.prop(modifier, "clothing_hair")
layout.separator()
layout.label(text="Visibility:")
split = layout.split()
col = split.column()
col.prop(modifier, "clothing_show")
col = split.column()
col.prop(modifier, "clothing_stayvis")

Loading…
Cancel
Save