Addon: Add LED UI panel

This commit is contained in:
Artem30801
2020-08-02 18:24:14 +03:00
parent 764080bc79
commit cf06dbd5ce
3 changed files with 38 additions and 7 deletions

View File

@@ -5,6 +5,7 @@ from bpy.props import PointerProperty, StringProperty, BoolProperty, EnumPropert
from . operators.export import ExportSwarmAnimation
from . operators.check import CheckSwarmAnimation
from . ui.drone_panel import DronePanel
from . ui.led_panel import LedPanel
from . ui.swarm_panel import SwarmPanel
bl_info = {
@@ -72,14 +73,12 @@ class CleverShowProperties(PropertyGroup):
('prop', "By object property", ""),
],
default="prop",
options=set(), # not animateable
)
drones_name: StringProperty(
name="Name identifier",
description="Name identifier for all drone objects",
default="clever",
options=set(), # not animateable
)
speed_limit: FloatProperty(
@@ -106,11 +105,17 @@ class CleverDroneProperties(PropertyGroup):
default=True,
)
class CleverLedProperties(PropertyGroup):
is_led: BoolProperty(
name="Is LED color",)
led_effect: EnumProperty(
name="Is LED color",
)
group: StringProperty(
name="LED group name",
default="ALL",
)
effect: EnumProperty(
name="LED effect",
items=[('fill', 'Fill', ""),
('blink', 'Blink', ""),
@@ -128,7 +133,8 @@ class CleverLedProperties(PropertyGroup):
classes = (CleverShowProperties, CleverDroneProperties, CleverLedProperties,
ExportSwarmAnimation, CheckSwarmAnimation,
DronePanel, SwarmPanel,
DronePanel, SwarmPanel, LedPanel,
)
def menu_func(self, context):

View File

@@ -1,7 +1,7 @@
from bpy.types import Panel
class DronePanel(Panel):
bl_label = "Drone"
bl_label = "Clever-Show Drone"
bl_idname = "OBJECT_PT_drone"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
@@ -12,5 +12,9 @@ class DronePanel(Panel):
def draw(self, context):
layout = self.layout
layout.use_property_split = True
# layout.use_property_decorate = True
layout.enabled = context.object.drone.is_drone
layout.prop(context.object.drone, "armed")

View File

@@ -0,0 +1,21 @@
from bpy.types import Panel
class LedPanel(Panel):
bl_label = "Clever-Show LED"
bl_idname = "MATERIAL_PT_led"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "material"
def draw_header(self, context):
self.layout.prop(context.material.led, "is_led", text="")
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = True
layout.enabled = context.material.led.is_led
layout.prop(context.material.led, "group")
layout.prop(context.material.led, "effect")