iBrushC / animextras

An open source Blender addon that adds extra animation functionality.
MIT License
167 stars 24 forks source link

Not working on armatures? #21

Closed Luka- closed 3 years ago

Luka- commented 3 years ago

I have an armature(rig), that has multiple meshes which have drivers to choose the one which is "active" (so basically multiple balls types which you can choose from). When selecting an armature object, set_onion is grayed out.

From this code:

    @classmethod
    def poll(cls, context):
        obj = context.active_object
        if context.selected_objects != []:
            if (hasattr(obj.parent,"animation_data") and (obj.type == 'MESH')):
                if (hasattr(obj.parent.animation_data,"action")):
                    return True
            if hasattr(obj.animation_data,"action"):
                if hasattr(obj.animation_data.action,"fcurves"):
                    return ((obj.type == 'MESH') and hasattr(obj.animation_data,"action") or (obj.type=='EMPTY'))
            if hasattr(obj.instance_collection, "all_objects"):
                return True

It seems to me that this addon is not supposed to work on armatures at all - I'm supposed to select the underlying mesh (and then obj.parent will have animation data)?

So, am I correct in that this doesn't work for armatures, or am I missing something?

schroef commented 3 years ago

If im correct it looks at mesh object and checks if its a child of a armature. AnimExtras looks at ther parent armature and uses the key frames to generate mesh in GPU and draw in the 3dview

Could you share a simplified version of the model?

Luka- commented 3 years ago

Sorry for the very late reply...

Model is the ball in this file (this is from the course I'm taking): ball.zip

schroef commented 3 years ago

@Luka-

thanks for the model. I tried it and i can get it to work. The way it work is you need to be able to select to mesh. So in this case i made sure those balls in the other Collection are selectable. Once you can select it, you can refresh the drawing.

One downside to this setup is that "In Front" drawing does work since the mesh is not parented to the actually armature

Screen Shot 2021-09-27 at 15 02 52

Luka- commented 3 years ago

Thanks for your help!

I'm closing this issue for now then.