Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export material animation #2347

Open
y-khodja opened this issue Sep 9, 2024 · 2 comments
Open

Export material animation #2347

y-khodja opened this issue Sep 9, 2024 · 2 comments
Labels
question Further information is requested

Comments

@y-khodja
Copy link

y-khodja commented Sep 9, 2024

Is your feature request related to a problem? Please describe.
Hello,

I am actually trying to export animated propreties from materials with NLA into an extension. I could manage to make it work with some hooks in Blender 3.3LTS. I am trying to make it work with Blender 3.6LTS but the thing is that the code has changed a lot and i am a little bit stuck in:

  • io_scene_gltf2\blender\exp\animation\gltf2_blender_gather_tracks.py line 113
    the problem here is that the type i have added in tracks is 'MATERIAL'. You code manage 'OBJECT' or shape_keys. the NLA here is in the material_slots of the blender_object. Both line 111 and 117 will crash in my case.

Describe the solution you'd like
Is there a way to manage the shape keys with and "elif" and let the else become anything else ? Or do you have any other idea to get this exported ?

Additional context
The addon i'm working helps third parties to export glTF for Microsoft Flight Simulator game by adding extensions in the right places.

Thank you !

@julienduroure julienduroure added the question Further information is requested label Sep 11, 2024
@julienduroure
Copy link
Collaborator

If you want to use KHR_animation_pointer to export these material properties, you should use Blender 4.2.x and enable the option (using Scene or NLA Track animation mode)

image

@y-khodja
Copy link
Author

Actually i am trying to manage to get it work without your sampling (by sampling the material animations in 'gather_actions_hook' and 'gather_tracks_hook'. Because we already have an extension to manage those kind of animations in our engine. To give an example of what it looks like:

{
            "channels" : [
                {
                    "sampler" : 3,
                    "target" : {
                        "node" : 0,
                        "path" : "scale"
                    }
                }
            ],
            "extensions" : {
                "ASOBO_property_animation" : {
                    "channels" : [
                        {
                            "sampler" : 0,
                            "target" : "materials/0/pbrMetallicRoughness/baseColorFactor"
                        },
                        {
                            "sampler" : 1,
                            "target" : "materials/0/pbrMetallicRoughness/roughnessFactor"
                        },
                        {
                            "sampler" : 2,
                            "target" : "materials/0/pbrMetallicRoughness/metallicFactor"
                        }
                    ]
                }
            },
            "name" : "MaterialAnimation",
            "samplers" : [
                {
                    "input" : 4,
                    "interpolation" : "LINEAR",
                    "output" : 5
                },
                {
                    "input" : 4,
                    "interpolation" : "LINEAR",
                    "output" : 6
                },
                {
                    "input" : 4,
                    "interpolation" : "LINEAR",
                    "output" : 7
                },
                {
                    "input" : 8,
                    "interpolation" : "STEP",
                    "output" : 9
                }
            ]
        }

We want to support all LTS versions of Blender, so i'll have to make it work for 3.6 and 4.2 😊

Thank you for your response 😄 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants