Merge pull request #2099 from MoritzBrueckner/2.9-LodOperators

Fix lod operator polling and add some bl_options
This commit is contained in:
Lubos Lenco 2021-02-01 09:55:22 +01:00 committed by GitHub
commit cbb8ee4bae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -56,6 +56,7 @@ class ArmLodListNewItem(bpy.types.Operator):
# Add a new item to the list
bl_idname = "arm_lodlist.new_item"
bl_label = "Add a new item"
bl_options = {'UNDO'}
def execute(self, context):
mdata = bpy.context.object.data
@ -68,10 +69,13 @@ class ArmLodListDeleteItem(bpy.types.Operator):
# Delete the selected item from the list
bl_idname = "arm_lodlist.delete_item"
bl_label = "Deletes an item"
bl_options = {'INTERNAL', 'UNDO'}
@classmethod
def poll(self, context):
def poll(cls, context):
""" Enable if there's something in the list """
if bpy.context.object is None:
return False
mdata = bpy.context.object.data
return len(mdata.arm_lodlist) > 0
@ -97,6 +101,7 @@ class ArmLodListMoveItem(bpy.types.Operator):
# Move an item in the list
bl_idname = "arm_lodlist.move_item"
bl_label = "Move an item in the list"
bl_options = {'INTERNAL', 'UNDO'}
direction: EnumProperty(
items=(
('UP', 'Up', ""),