2017-07-24 02:27:22 +02:00
|
|
|
import shutil
|
|
|
|
import bpy
|
|
|
|
import os
|
|
|
|
import json
|
|
|
|
from bpy.types import Menu, Panel, UIList
|
|
|
|
from bpy.props import *
|
|
|
|
from arm.utils import to_hex
|
|
|
|
|
2017-08-21 12:17:55 +02:00
|
|
|
class ArmTraitPropListItem(bpy.types.PropertyGroup):
|
2017-07-24 02:27:22 +02:00
|
|
|
# Group of properties representing an item in the list
|
2018-12-18 23:48:38 +01:00
|
|
|
name: StringProperty(
|
2017-07-24 02:27:22 +02:00
|
|
|
name="Name",
|
|
|
|
description="A name for this item",
|
|
|
|
default="Untitled")
|
|
|
|
|
2018-12-18 23:48:38 +01:00
|
|
|
value: StringProperty(
|
2017-07-24 02:27:22 +02:00
|
|
|
name="Value",
|
|
|
|
description="A name for this item",
|
|
|
|
default="")
|
|
|
|
|
2019-03-29 14:55:42 +01:00
|
|
|
class ARM_UL_PropList(bpy.types.UIList):
|
2017-07-24 02:27:22 +02:00
|
|
|
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
|
|
|
# We could write some code to decide which icon to use here...
|
|
|
|
custom_icon = 'OBJECT_DATAMODE'
|
|
|
|
|
|
|
|
# Make sure your code supports all 3 layout types
|
|
|
|
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
|
|
|
layout.prop(item, "value", text=item.name, emboss=False, icon=custom_icon)
|
|
|
|
|
|
|
|
elif self.layout_type in {'GRID'}:
|
|
|
|
layout.alignment = 'CENTER'
|
2018-11-18 21:52:50 +01:00
|
|
|
layout.label(text="", icon=custom_icon)
|
2017-07-24 02:27:22 +02:00
|
|
|
|
|
|
|
def register():
|
2017-08-21 12:17:55 +02:00
|
|
|
bpy.utils.register_class(ArmTraitPropListItem)
|
2019-03-29 14:55:42 +01:00
|
|
|
bpy.utils.register_class(ARM_UL_PropList)
|
2017-07-24 02:27:22 +02:00
|
|
|
|
|
|
|
def unregister():
|
2017-08-21 12:17:55 +02:00
|
|
|
bpy.utils.unregister_class(ArmTraitPropListItem)
|
2019-03-29 14:55:42 +01:00
|
|
|
bpy.utils.unregister_class(ARM_UL_PropList)
|