Giter Site home page Giter Site logo

keymesh-addon's People

Contributors

elkmug avatar pablodp606 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

keymesh-addon's Issues

Question: Getting material names for each key frame (writing an exporter)

Hi there, also ccing in @AldrinMathew, this is not an issue so much as a question. I've been writing an exporter for keymesh for use in Unity, and I've stumbled into a problem where I'm trying to get the list of materials names used each keyframe. The problem seems to be that this list isn't updated with all the materials when I iterate across it in the exporter. I'm not entirely sure how to solve this or even why it's happenening. The output is also currently dependent on what frame is selected in the scrubber.

Below is some of my exporter code:

class KeyframeMeshObjExport(bpy.types.Operator, ExportHelper):
    bl_idname = "object.keyframe_mesh_obj"       
    bl_label = "Export Obj Sequence"
    bl_options = {'REGISTER'}   
    filename_ext = ".obj"

    @classmethod
    def poll(cls, context): 
        # It's a Keymesh scene
        for o in bpy.context.selected_objects: 
            if "km_datablock" and "km_id" in o:
                return True
        return False
        
    def execute(self, context):
        frame_end = -99999
        frame_start = 99999
        current_frame = bpy.context.scene.frame_current
        obs = list(bpy.context.selected_objects)

        objects = []
        
        framerate = 11 
        # Get length of the current action
        for o in obs:
            framerate = o.users_scene[0].render.fps
            this_end = o.users_scene[0].frame_end
            this_start = o.users_scene[0].frame_start
            if(this_end > frame_end): 
                frame_end = this_end
            if(this_start < frame_start): 
                frame_start = this_start

    
        file_path = Path(self.filepath)
        folder_path = file_path.parent        
        materials = {}
        
        
        bpy.ops.object.select_all(action='DESELECT')
            
        for o in obs:
            keyframes=[]
            o.select_set(True)
            object_material_slots={}        
            for i in range(frame_start, frame_end + 1): 
                bpy.context.scene.frame_current = i
                km_frame_handler(0)
                updateKeymesh(bpy.context.scene)
                dirty = False

                fcurves = o.animation_data.action.fcurves
                for fcurve in fcurves:
                    if fcurve.data_path != '["km_datablock"]':
                        continue                
                    
                    for keyframe in fcurve.keyframe_points:
                        if i == int(keyframe.co.x):                            
                            dirty = True
                            break
                                            
                if dirty:        
                    frame_materials=[]                    
                    # The line in question that doesn't seem to be updating:
                    for mat in o.material_slots:
                        materials[mat.name] = True        
                        object_material_slots[mat.name] = True
                        frame_materials.append(mat.name)
                    keyframes.append({"frame":i, "materials": list(frame_materials) })
                    filename = str(Path(str(folder_path.absolute()) +"/" + re.sub(r'\.obj$',"_",file_path.name) + o.name + "_" + str(i) + ".obj").absolute())
                    bpy.ops.export_scene.obj(filepath=filename, use_materials=True, use_selection=True, use_blen_objects=True, group_by_object=True)
                    
            
                 
            o.select_set(False)

            objects.append({
                "name": o.name,
                "keyframes": list(keyframes),
                "materials": list(object_material_slots.keys())
            })        
                            
        json_data_filename = str(Path(str(folder_path.absolute()) +"/" + file_path.name + ".objseq").absolute())

    
        with open(json_data_filename, 'w') as outfile:
            json.dump({ 
                "materials": list(materials.keys()), 
                "frame_start": frame_start,
                "frame_end": frame_end,
                "frame_rate": framerate,
                "objects": list(objects)
            }, outfile)

        bpy.context.scene.frame_current = current_frame
        km_frame_handler(0)
        
        return {'FINISHED'}

This is the output of this script in an example project I'm working on. There should be five materials in frame 63, but only three show up. The actual exported obj has space for 5 materials:

{
    "materials": [
        "EggMaterial",
        "GooMaterial",
        "PlantMaterial"
    ],
    "frame_start": 1,
    "frame_end": 80,
    "frame_rate": 24,
    "objects": [
        {
            "name": "Sphere",
            "keyframes": [
                {
                    "frame": 1,
                    "materials": [
                        "EggMaterial"
                    ]
                },
                {
                    "frame": 3,
                    "materials": [
                        "EggMaterial"
                    ]
                },
                {
                    "frame": 5,
                    "materials": [
                        "EggMaterial"
                    ]
                },
                {
                    "frame": 7,
                    "materials": [
                        "EggMaterial"
                    ]
                },
                {
                    "frame": 9,
                    "materials": [
                        "EggMaterial"
                    ]
                },
                {
                    "frame": 11,
                    "materials": [
                        "EggMaterial",
                        "GooMaterial"
                    ]
                },
                {
                    "frame": 13,
                    "materials": [
                        "EggMaterial",
                        "GooMaterial"
                    ]
                },
                {
                    "frame": 15,
                    "materials": [
                        "EggMaterial",
                        "GooMaterial"
                    ]
                },
                {
                    "frame": 17,
                    "materials": [
                        "EggMaterial",
                        "GooMaterial"
                    ]
                },
                {
                    "frame": 19,
                    "materials": [
                        "EggMaterial",
                        "GooMaterial"
                    ]
                },
                {
                    "frame": 21,
                    "materials": [
                        "EggMaterial",
                        "GooMaterial"
                    ]
                },
                {
                    "frame": 23,
                    "materials": [
                        "EggMaterial",
                        "GooMaterial"
                    ]
                },
                {
                    "frame": 25,
                    "materials": [
                        "EggMaterial",
                        "GooMaterial"
                    ]
                },
                {
                    "frame": 27,
                    "materials": [
                        "EggMaterial",
                        "GooMaterial"
                    ]
                },
                {
                    "frame": 29,
                    "materials": [
                        "EggMaterial",
                        "GooMaterial"
                    ]
                },
                {
                    "frame": 31,
                    "materials": [
                        "EggMaterial",
                        "GooMaterial"
                    ]
                },
                {
                    "frame": 51,
                    "materials": [
                        "EggMaterial",
                        "GooMaterial"
                    ]
                },
                {
                    "frame": 53,
                    "materials": [
                        "EggMaterial",
                        "GooMaterial"
                    ]
                },
                {
                    "frame": 55,
                    "materials": [
                        "EggMaterial",
                        "GooMaterial",
                        "PlantMaterial"
                    ]
                },
                {
                    "frame": 57,
                    "materials": [
                        "EggMaterial",
                        "GooMaterial",
                        "PlantMaterial"
                    ]
                },
                {
                    "frame": 59,
                    "materials": [
                        "EggMaterial",
                        "GooMaterial",
                        "PlantMaterial"
                    ]
                },
                {
                    "frame": 61,
                    "materials": [
                        "EggMaterial",
                        "GooMaterial",
                        "PlantMaterial"
                    ]
                },
                {
                    "frame": 63,
                    "materials": [
                        "EggMaterial",
                        "GooMaterial",
                        "PlantMaterial"
                    ]
                }
            ],
            "materials": [
                "EggMaterial",
                "GooMaterial",
                "PlantMaterial"
            ]
        }
    ]
}

Feature Request: Export to Mesh Sequence or Alembic File

Hi there
I'm extremely excited for this add on as I've been independently working on a game that utilizes sequences of meshes for character animation. Keymesh adds some really nice workflow improvements however I cannot use it yet as the animations don't yet allow export to a format usable by my game engine (Unity).

Mixing with shapekey produces shapekey jumps on play/render

For me the natural way to use keymesh is mixing it with shapekeys to achieve smooth transitions and reduce work with simple inbetweens.
But I`ve encountered issue, when I was making my first keymesh project

Here is videolog and explanation
In short: at 1st frame of shapekey, where animation key is 0, it jumps to 1 instead, and on the previous frame keymesh frame do not appear (previous state instead).

You can launch animation from this file or render it to frames.
keymesh-shapekey mix.zip

Here is my render result (2nd and 3rd are wrong, compare with viewport manual frame switching):
FramesRendered.zip

Support exporting to alembic

Currently, exporting a keymeshed mesh results in a static alembic mesh. This is important to be able to export the animation out of Blender.

Sculpt mode settings reset

I found this while testing. This is a serious bug that prevents the Addon from functioning properly.

Problem

The sculpt settings reset every time the Keyframe Mesh operator is used.

What does it affect?

  • Symmetry
    • Mirror Symmetry: It does not affect any other option available under the Symmetry panel.
  • Remesh
    • Voxel Size
    • Adaptivity
    • No other option in Remesh panel is affected.

Example

  • If the user have activated mirror symmetry in any of the axes, when Keyframe Mesh option is pressed, the symmetry resets to none.

This is a superset of #2.

Addon Will not install from Zip file

I spent about 3 hours on this.
The addon will not install for me on osx with the zip file.
Finally I just loaded keymesh-addon-main.py in my addons folder, and installed in blender
navigating straight to that .py file.
Something about the structure of the .zip file is not allowing it to show up in 'addons' in blender user prefs.

Not working in my blender 2.9 or 2.92 as well

I dont know the reason why it is not working. as i click on Keymesh button it just add key but don't make key slider forward. also, still if i manually forwarded the slider and insert another key it just again add the key but as i play animation nothing happens.

Edit mode not working on MacOS

A friend of mine was using this on Mac, and encountered problems with using it. He made a recording showing his use, and the different results coming from different modes.

https://www.dropbox.com/s/5is0vw47a1i00eg/keymesh_bug.mov?dl=0

I don't know personally if this is a Keymesh issue or something with Blender itself. It is a possibility a fix can't be found from this side. If a fix can't be found within Keymesh, I'll ask on the Blender page.

Thank you guys for your time and for this plugin.

All actions appear to follow the last mesh key frame?

I thought this might help with simple animations of, say, mouths. So, I added Suzanne to see what could be achieved.

If keying a timeline, it appears fine. But to lip sync a whole sequence, that would be messy. So I thought maybe individual mesh key frames, for each mouth shape, captured as individual actions. I am hoping then to set up to animate through action selections.

Therefore, I am trying to save actions comprising individual mesh sculpts (assigned to AI, E, etc, FV, L, BMP, yadda),

I am essentially creating a new action for each sculpted mesh, with a single key frame. Furthermore, I have the frame set to "1" for each key frame capture.

I find, all actions end up with the same mesh layout?

That is, for example, I'll sculpt a "rest"mesh for the resting mouth, then save that as an action called "rest", I then sculpt an "AI" mesh, save that as an action "AI". If I then reassign "rest" the "AI" sculpt remains. If I then sculpt an "E" mesh, "rest" and "AI" mesh actions present as "E" mesh.

I assume this has something to do with the internals of the key frame and the way it's captured? It isn't intuitive?

Am I barking up the wrong tree trying to use the add-in this way?

.

Curves: "Anim All" Addon & "Keymesh" crash when used together

Using the "Keymesh Addon" with "Anim All Addon" causes a crash.

The idea was to use curves with grease pencil line art modifier to create a 2D character.
A very specific example would be creating different mouth shapes and being able to switch them out using key mesh.

"Anim All Addon" comes into play when tweening from one mouth shapes to the next.

Lets say mouth shape A (4 points) is on frame 10, and uses the "Anim All Addon" to tween to Frame 20, mouth shape B. Easy enough.
Now if we want frame 20 to use 3 times the amount of points ideally we would be able to cheat it using the "Keymesh Addon" using the animation principle cut on the action.

At the moment both addons are storing the information in 2 very different ways.

Combining these addons means tweening curves and meshes and the ability to "switch and tween" on breakdown keys for seamless tweening. This would make curves more robust and reliable than Grease Pencils and offer more functionality taking advantage of Grease Pencil, EEVEE, and Geometry Nodes with minimal code to maintain.

Happy to get online and talk to you more about this showing animation examples and how the UI might be able to be improved for animators if Blender if is capable of doing it.

💜✨Feature proposal✨💜 - Keyframe Keymap option

Hi there, this add-on is lovely 💜, is there a chance you could implement a shortcut for Keyframe Mesh ? If this is the case can it be mapped by the user? This would be super appreciated for speeding up workflow! 🤓✨

not working correctly in blender 3.1

when i keyframe mesh i'm getting inconsistent behavior. sometimes the keyframe appears, but it doesn't actually save the mesh vertex positions. I also tried making a keyframe mesh every 10 frames and which positions were saved for each keyframe kept flipping around and weren't what i set it as...

seems like a really cool add-on. If you end up fixing this it would be much appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.