Skip to content

Commit

Permalink
Minor UI fixes; disabled checkProxyKeyframes validation
Browse files Browse the repository at this point in the history
  • Loading branch information
inertials-revenge committed Oct 15, 2021
1 parent 5814353 commit 6eadd96
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 37 deletions.
62 changes: 32 additions & 30 deletions io_alamo_tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
bl_info = {
"name": "ALAMO Tools",
"author": "Gaukler, evilbobthebob, inertial",
"version": (0, 0, 3, 2),
"version": (0, 0, 3, 3),
"blender": (2, 93, 0),
"category": "Import-Export"
}
Expand Down Expand Up @@ -117,7 +117,7 @@ def execute(self, context):

#check if export objects satisfy requirements (has material, UVs, ...)
messages = validation.validate(mesh_list)

if messages is not None and len(messages) > 0:
for message in messages:
self.report(*message)
Expand Down Expand Up @@ -159,17 +159,19 @@ class CreateConstraintBone(bpy.types.Operator):
@classmethod
def poll(cls, context):
object = bpy.context.object
if type(object) != type(None):
if(object.type == 'MESH'):
if bpy.context.mode == 'OBJECT':
armature = utils.findArmature()
if armature != None:
hasChildConstraint = False
for constraint in object.constraints:
if constraint.type == 'CHILD_OF':
hasChildConstraint = True
if not hasChildConstraint:
return True
if (
type(object) != type(None)
and object.type == 'MESH'
and bpy.context.mode == 'OBJECT'
):
armature = utils.findArmature()
if armature is not None:
hasChildConstraint = False
for constraint in object.constraints:
if constraint.type == 'CHILD_OF':
hasChildConstraint = True
if not hasChildConstraint:
return True
return False

def execute(self, context):
Expand All @@ -195,7 +197,7 @@ def execute(self, context):

class SetHasCollisionTrue(bpy.types.Operator):
bl_idname = "alamo.collision_true"
bl_label = "Show"
bl_label = ""
bl_description = "Set HasCollision to True for all selected objects"

@classmethod
Expand All @@ -211,7 +213,7 @@ def execute(self, context):

class SetHasCollisionFalse(bpy.types.Operator):
bl_idname = "alamo.collision_false"
bl_label = "Hide"
bl_label = ""
bl_description = "Set HasCollision to False for all selected objects"

@classmethod
Expand All @@ -227,7 +229,7 @@ def execute(self, context):

class SetHiddenTrue(bpy.types.Operator):
bl_idname = "alamo.hidden_true"
bl_label = "Show"
bl_label = ""
bl_description = "Set Hidden to True for all selected objects"

@classmethod
Expand All @@ -243,7 +245,7 @@ def execute(self, context):

class SetHiddenFalse(bpy.types.Operator):
bl_idname = "alamo.hidden_false"
bl_label = "Hide"
bl_label = ""
bl_description = "Set Hidden to False for all selected objects"

@classmethod
Expand All @@ -259,7 +261,7 @@ def execute(self, context):

class SetBoneVisible(bpy.types.Operator):
bl_idname = "alamo.bone_visible"
bl_label = "Show"
bl_label = ""
bl_description = "Set Visible to True for all selected bones"

@classmethod
Expand All @@ -275,7 +277,7 @@ def execute(self, context):

class SetBoneInvisible(bpy.types.Operator):
bl_idname = "alamo.bone_invisible"
bl_label = "Hide"
bl_label = ""
bl_description = "Set Visible to False for all selected bones"

@classmethod
Expand All @@ -291,7 +293,7 @@ def execute(self, context):

class SetAltDecreaseStayHiddenTrue(bpy.types.Operator):
bl_idname = "alamo.alt_decrease_stay_hidden_true"
bl_label = "Show"
bl_label = ""
bl_description = "Set altDecreaseStayHidden to True for all selected bones"

@classmethod
Expand All @@ -307,7 +309,7 @@ def execute(self, context):

class SetAltDecreaseStayHiddenFalse(bpy.types.Operator):
bl_idname = "alamo.alt_decrease_stay_hidden_false"
bl_label = "Hide"
bl_label = ""
bl_description = "Set altDecreaseStayHidden to False for all selected bones"

@classmethod
Expand All @@ -323,7 +325,7 @@ def execute(self, context):

class EnableProxyFalse(bpy.types.Operator):
bl_idname = "alamo.disable_proxy"
bl_label = "Show"
bl_label = ""
bl_description = "Set EnableProxy to False for all selected bones"

@classmethod
Expand All @@ -339,7 +341,7 @@ def execute(self, context):

class EnableProxyTrue(bpy.types.Operator):
bl_idname = "alamo.enable_proxy"
bl_label = "Hide"
bl_label = ""
bl_description = "Set EnableProxy to True for all selected bones"

@classmethod
Expand All @@ -355,7 +357,7 @@ def execute(self, context):

class ProxyShow(bpy.types.Operator):
bl_idname = "alamo.show_proxy"
bl_label = "Show"
bl_label = ""
bl_description = "Set proxyIsHidden to False for all selected bones"

@classmethod
Expand All @@ -371,7 +373,7 @@ def execute(self, context):

class ProxyHide(bpy.types.Operator):
bl_idname = "alamo.hide_proxy"
bl_label = "Hide"
bl_label = ""
bl_description = "Set proxyIsHidden to True for all selected bones"

@classmethod
Expand Down Expand Up @@ -414,7 +416,7 @@ def keyframeProxySet(operation):

class keyframeProxyShow(bpy.types.Operator):
bl_idname = "alamo.show_keyframe_proxy"
bl_label = "Show"
bl_label = ""
bl_description = "Create a keyframe and set proxyIsHiddenAnimation to False for all selected bones"

@classmethod
Expand All @@ -428,7 +430,7 @@ def execute(self, context):

class keyframeProxyHide(bpy.types.Operator):
bl_idname = "alamo.hide_keyframe_proxy"
bl_label = "Hide"
bl_label = ""
bl_description = "Create a keyframe and set proxyIsHiddenAnimation to True for all selected bones"

@classmethod
Expand All @@ -442,7 +444,7 @@ def execute(self, context):

class keyframeProxyRemove(bpy.types.Operator):
bl_idname = "alamo.remove_keyframe_proxy"
bl_label = "Remove"
bl_label = ""
bl_description = "Remove active keyframes from all selected bones"

@classmethod
Expand All @@ -467,7 +469,7 @@ def skeletonEnumCallback(scene, context):

class skeletonEnumClass(PropertyGroup):
skeletonEnum : EnumProperty(
name='Active Skeleton',
name = 'Active Skeleton',
description = "skeleton that is exported",
items = skeletonEnumCallback
)
Expand Down Expand Up @@ -590,7 +592,7 @@ def draw(self, context):
layout.active = False
if bpy.context.mode == "EDIT_ARMATURE":
layout.active = all_same

if not all_same:
layout.label(icon="ERROR", text="Inconsistent EnableProxy states.")
layout.label(icon="BLANK1", text="Change selection or set EnableProxy.")
Expand Down
18 changes: 11 additions & 7 deletions io_alamo_tools/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,19 @@ def checkProxyKeyframes():
local_errors = []
actions = bpy.data.actions
current_frame = bpy.context.scene.frame_current
for action in actions:
for fcurve in action.fcurves:
if fcurve.data_path.find("proxyIsHiddenAnimation") > -1:
previous_keyframe = None
armature = utils.findArmature()
if armature is not None:
armature = findArmature()
if armature is not None:
for action in actions:
print(action.name)
for fcurve in action.fcurves:
print(fcurve.group.name)
if fcurve.data_path.find("proxyIsHiddenAnimation") > -1:
previous_keyframe = None
for keyframe in fcurve.keyframe_points:
bpy.context.scene.frame_set(int(keyframe.co[0]))
# TODO Keyframes don't store what action they're from. Maybe check each keyframe against the current action?
this_keyframe = armature.path_resolve(fcurve.data_path)
print(previous_keyframe, this_keyframe)
if this_keyframe == previous_keyframe:
local_errors += [({'WARNING'}, f'ALAMO - {fcurve.group.name} has duplicate keyframe on frame {bpy.context.scene.frame_current}')]
previous_keyframe = this_keyframe
Expand All @@ -192,7 +196,7 @@ def validate(mesh_list):
]
checklist_no_object = [
checkTranslationArmature,
checkProxyKeyframes,
# checkProxyKeyframes, # Disabled until it can be fixed
]

for check in checklist:
Expand Down

0 comments on commit 6eadd96

Please sign in to comment.