Cleanup
This commit is contained in:
parent
c69774402c
commit
4f25af45ba
|
@ -1,30 +1,26 @@
|
||||||
import shutil
|
|
||||||
import bpy
|
import bpy
|
||||||
import os
|
|
||||||
import json
|
|
||||||
from bpy.types import Menu, Panel, UIList
|
|
||||||
from bpy.props import *
|
from bpy.props import *
|
||||||
|
|
||||||
class ArmTilesheetActionListItem(bpy.types.PropertyGroup):
|
class ArmTilesheetActionListItem(bpy.types.PropertyGroup):
|
||||||
name: StringProperty(
|
name: StringProperty(
|
||||||
name="Name",
|
name="Name",
|
||||||
description="A name for this item",
|
description="A name for this item",
|
||||||
default="Untitled")
|
default="Untitled")
|
||||||
|
|
||||||
start_prop: IntProperty(
|
start_prop: IntProperty(
|
||||||
name="Start",
|
name="Start",
|
||||||
description="A name for this item",
|
description="A name for this item",
|
||||||
default=0)
|
default=0)
|
||||||
|
|
||||||
end_prop: IntProperty(
|
end_prop: IntProperty(
|
||||||
name="End",
|
name="End",
|
||||||
description="A name for this item",
|
description="A name for this item",
|
||||||
default=0)
|
default=0)
|
||||||
|
|
||||||
loop_prop: BoolProperty(
|
loop_prop: BoolProperty(
|
||||||
name="Loop",
|
name="Loop",
|
||||||
description="A name for this item",
|
description="A name for this item",
|
||||||
default=True)
|
default=True)
|
||||||
|
|
||||||
class ARM_UL_TilesheetActionList(bpy.types.UIList):
|
class ARM_UL_TilesheetActionList(bpy.types.UIList):
|
||||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
||||||
|
@ -52,13 +48,13 @@ class ArmTilesheetActionListNewItem(bpy.types.Operator):
|
||||||
return{'FINISHED'}
|
return{'FINISHED'}
|
||||||
|
|
||||||
class ArmTilesheetActionListDeleteItem(bpy.types.Operator):
|
class ArmTilesheetActionListDeleteItem(bpy.types.Operator):
|
||||||
# Delete the selected item from the list
|
"""Delete the selected item from the list"""
|
||||||
bl_idname = "arm_tilesheetactionlist.delete_item"
|
bl_idname = "arm_tilesheetactionlist.delete_item"
|
||||||
bl_label = "Deletes an item"
|
bl_label = "Deletes an item"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(self, context):
|
def poll(self, context):
|
||||||
""" Enable if there's something in the list """
|
"""Enable if there's something in the list"""
|
||||||
wrd = bpy.data.worlds['Arm']
|
wrd = bpy.data.worlds['Arm']
|
||||||
if len(wrd.arm_tilesheetlist) == 0:
|
if len(wrd.arm_tilesheetlist) == 0:
|
||||||
return False
|
return False
|
||||||
|
@ -80,19 +76,20 @@ class ArmTilesheetActionListDeleteItem(bpy.types.Operator):
|
||||||
return{'FINISHED'}
|
return{'FINISHED'}
|
||||||
|
|
||||||
class ArmTilesheetActionListMoveItem(bpy.types.Operator):
|
class ArmTilesheetActionListMoveItem(bpy.types.Operator):
|
||||||
# Move an item in the list
|
"""Move an item in the list"""
|
||||||
bl_idname = "arm_tilesheetactionlist.move_item"
|
bl_idname = "arm_tilesheetactionlist.move_item"
|
||||||
bl_label = "Move an item in the list"
|
bl_label = "Move an item in the list"
|
||||||
bl_options = {'INTERNAL'}
|
bl_options = {'INTERNAL'}
|
||||||
|
|
||||||
direction: EnumProperty(
|
direction: EnumProperty(
|
||||||
items=(
|
items=(
|
||||||
('UP', 'Up', ""),
|
('UP', 'Up', ""),
|
||||||
('DOWN', 'Down', ""),))
|
('DOWN', 'Down', "")
|
||||||
|
))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(self, context):
|
def poll(self, context):
|
||||||
""" Enable if there's something in the list. """
|
"""Enable if there's something in the list"""
|
||||||
wrd = bpy.data.worlds['Arm']
|
wrd = bpy.data.worlds['Arm']
|
||||||
if len(wrd.arm_tilesheetlist) == 0:
|
if len(wrd.arm_tilesheetlist) == 0:
|
||||||
return False
|
return False
|
||||||
|
@ -135,27 +132,27 @@ class ArmTilesheetActionListMoveItem(bpy.types.Operator):
|
||||||
|
|
||||||
class ArmTilesheetListItem(bpy.types.PropertyGroup):
|
class ArmTilesheetListItem(bpy.types.PropertyGroup):
|
||||||
name: StringProperty(
|
name: StringProperty(
|
||||||
name="Name",
|
name="Name",
|
||||||
description="A name for this item",
|
description="A name for this item",
|
||||||
default="Untitled")
|
default="Untitled")
|
||||||
|
|
||||||
tilesx_prop: IntProperty(
|
tilesx_prop: IntProperty(
|
||||||
name="Tiles X",
|
name="Tiles X",
|
||||||
description="A name for this item",
|
description="A name for this item",
|
||||||
default=0)
|
default=0)
|
||||||
|
|
||||||
tilesy_prop: IntProperty(
|
tilesy_prop: IntProperty(
|
||||||
name="Tiles Y",
|
name="Tiles Y",
|
||||||
description="A name for this item",
|
description="A name for this item",
|
||||||
default=0)
|
default=0)
|
||||||
|
|
||||||
framerate_prop: FloatProperty(
|
framerate_prop: FloatProperty(
|
||||||
name="Frame Rate",
|
name="Frame Rate",
|
||||||
description="A name for this item",
|
description="A name for this item",
|
||||||
default=4.0)
|
default=4.0)
|
||||||
|
|
||||||
arm_tilesheetactionlist: CollectionProperty(type=ArmTilesheetActionListItem)
|
arm_tilesheetactionlist: CollectionProperty(type=ArmTilesheetActionListItem)
|
||||||
arm_tilesheetactionlist_index: IntProperty(name="Index for my_list", default=0)
|
arm_tilesheetactionlist_index: IntProperty(name="Index for arm_tilesheetactionlist", default=0)
|
||||||
|
|
||||||
class ARM_UL_TilesheetList(bpy.types.UIList):
|
class ARM_UL_TilesheetList(bpy.types.UIList):
|
||||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
||||||
|
@ -168,10 +165,10 @@ class ARM_UL_TilesheetList(bpy.types.UIList):
|
||||||
|
|
||||||
elif self.layout_type in {'GRID'}:
|
elif self.layout_type in {'GRID'}:
|
||||||
layout.alignment = 'CENTER'
|
layout.alignment = 'CENTER'
|
||||||
layout.label(text="", icon = custom_icon)
|
layout.label(text="", icon=custom_icon)
|
||||||
|
|
||||||
class ArmTilesheetListNewItem(bpy.types.Operator):
|
class ArmTilesheetListNewItem(bpy.types.Operator):
|
||||||
# Add a new item to the list
|
"""Add a new item to the list"""
|
||||||
bl_idname = "arm_tilesheetlist.new_item"
|
bl_idname = "arm_tilesheetlist.new_item"
|
||||||
bl_label = "Add a new item"
|
bl_label = "Add a new item"
|
||||||
|
|
||||||
|
@ -182,7 +179,7 @@ class ArmTilesheetListNewItem(bpy.types.Operator):
|
||||||
return{'FINISHED'}
|
return{'FINISHED'}
|
||||||
|
|
||||||
class ArmTilesheetListDeleteItem(bpy.types.Operator):
|
class ArmTilesheetListDeleteItem(bpy.types.Operator):
|
||||||
# Delete the selected item from the list
|
"""Delete the selected item from the list"""
|
||||||
bl_idname = "arm_tilesheetlist.delete_item"
|
bl_idname = "arm_tilesheetlist.delete_item"
|
||||||
bl_label = "Deletes an item"
|
bl_label = "Deletes an item"
|
||||||
|
|
||||||
|
@ -206,15 +203,16 @@ class ArmTilesheetListDeleteItem(bpy.types.Operator):
|
||||||
return{'FINISHED'}
|
return{'FINISHED'}
|
||||||
|
|
||||||
class ArmTilesheetListMoveItem(bpy.types.Operator):
|
class ArmTilesheetListMoveItem(bpy.types.Operator):
|
||||||
# Move an item in the list
|
"""Move an item in the list"""
|
||||||
bl_idname = "arm_tilesheetlist.move_item"
|
bl_idname = "arm_tilesheetlist.move_item"
|
||||||
bl_label = "Move an item in the list"
|
bl_label = "Move an item in the list"
|
||||||
bl_options = {'INTERNAL'}
|
bl_options = {'INTERNAL'}
|
||||||
|
|
||||||
direction: EnumProperty(
|
direction: EnumProperty(
|
||||||
items=(
|
items=(
|
||||||
('UP', 'Up', ""),
|
('UP', 'Up', ""),
|
||||||
('DOWN', 'Down', ""),))
|
('DOWN', 'Down', "")
|
||||||
|
))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(self, context):
|
def poll(self, context):
|
||||||
|
@ -255,7 +253,6 @@ class ArmTilesheetListMoveItem(bpy.types.Operator):
|
||||||
return{'FINISHED'}
|
return{'FINISHED'}
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
|
|
||||||
bpy.utils.register_class(ArmTilesheetActionListItem)
|
bpy.utils.register_class(ArmTilesheetActionListItem)
|
||||||
bpy.utils.register_class(ARM_UL_TilesheetActionList)
|
bpy.utils.register_class(ARM_UL_TilesheetActionList)
|
||||||
bpy.utils.register_class(ArmTilesheetActionListNewItem)
|
bpy.utils.register_class(ArmTilesheetActionListNewItem)
|
||||||
|
@ -269,7 +266,7 @@ def register():
|
||||||
bpy.utils.register_class(ArmTilesheetListMoveItem)
|
bpy.utils.register_class(ArmTilesheetListMoveItem)
|
||||||
|
|
||||||
bpy.types.World.arm_tilesheetlist = CollectionProperty(type=ArmTilesheetListItem)
|
bpy.types.World.arm_tilesheetlist = CollectionProperty(type=ArmTilesheetListItem)
|
||||||
bpy.types.World.arm_tilesheetlist_index = IntProperty(name="Index for my_list", default=0)
|
bpy.types.World.arm_tilesheetlist_index = IntProperty(name="Index for arm_tilesheetlist", default=0)
|
||||||
|
|
||||||
def unregister():
|
def unregister():
|
||||||
bpy.utils.unregister_class(ArmTilesheetListItem)
|
bpy.utils.unregister_class(ArmTilesheetListItem)
|
||||||
|
|
Loading…
Reference in a new issue