Cleanup: simplify attribute access
Avoid getattr(..) when values are know to exist.
This commit is contained in:
@@ -694,7 +694,7 @@ class ANIM_OT_slot_new_for_id(Operator):
|
||||
return True
|
||||
|
||||
def execute(self, context):
|
||||
animated_id = getattr(context, "animated_id", None)
|
||||
animated_id = context.animated_id
|
||||
|
||||
action = animated_id.animation_data.action
|
||||
slot = action.slots.new(for_id=animated_id)
|
||||
@@ -726,7 +726,7 @@ class ANIM_OT_slot_unassign_from_id(Operator):
|
||||
return True
|
||||
|
||||
def execute(self, context):
|
||||
animated_id = getattr(context, "animated_id", None)
|
||||
animated_id = context.animated_id
|
||||
animated_id.animation_data.action_slot = None
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
@@ -342,7 +342,7 @@ class DOPESHEET_HT_editor_buttons:
|
||||
case 'ACTION':
|
||||
return context.object
|
||||
case 'SHAPEKEY':
|
||||
return context.object.data and getattr(context.object.data, 'shape_keys', None)
|
||||
return getattr(context.object.data, "shape_keys", None)
|
||||
case _:
|
||||
print("Dope Sheet mode '{:s}' not expected to have an Action selector".format(st.mode))
|
||||
return context.object
|
||||
|
||||
Reference in New Issue
Block a user