Closed TimKraemer closed 1 week ago
in case someone is interested to replace "interpolation":"LINEAR"
with "interpolation":"STEP"
for every scale animation, I'm using this python script to do so:
import json
import sys
def modify_gltf(input_path, output_path):
# Load the GLTF file
with open(input_path, 'r') as file:
gltf = json.load(file)
# Iterate over the animations
for animation in gltf.get('animations', []):
for channel in animation.get('channels', []):
target = channel.get('target', {})
# Check if the target path is "scale"
if target.get('path') == 'scale':
sampler_index = channel.get('sampler')
if sampler_index is not None:
sampler = animation.get('samplers', [])[sampler_index]
# Change the interpolation to "STEP"
if sampler:
sampler['interpolation'] = 'STEP'
# Save the modified GLTF file
with open(output_path, 'w') as file:
json.dump(gltf, file, indent=2)
print(f"GLTF file has been modified and saved as '{output_path}'")
if __name__ == "__main__":
if len(sys.argv) != 3:
print("Usage: python modify_gltf.py <input_path> <output_path>")
else:
input_path = sys.argv[1]
output_path = sys.argv[2]
modify_gltf(input_path, output_path)
Hello,
You are using "Scene" animation mode, that is a full bake mode, where we can't retrieve interpolation
In your case, I suggest changing to "Action" for example.
Seems I can't reproduce your issue with negative scale when changing to STEP
More than a month without any answer, closing this ticket. Feel free to comment and provide the .blend file if you want me to have a look
Describe the bug Whenever I try to export this example scene (a cube with a linear
translation
animation and a constantscale
animation from1,1,1
to0,0,0
at the end) the exporter is giving me twoLINEAR
interpolations:when I then manually change the second one to a
STEP
interpolation, it gives me a weird scale for one frame withx: -1.083
,y: -1.083
,z: -1.083
before it scales to zero.To Reproduce
Steps to reproduce the behavior:
Expected behavior Ideally linear interpolation should get exported as
"interpolation":"LINEAR",
while constant interpolation get's exported as"interpolation":"STEP"
independent from each other. Since it's easy to write a script to do this manually, the second problem, that one frame leads to a weird scale of-1.083
should be prevented completely..blend file/ .gltf (mandatory) Example blender file and output gltf with already modified STEP interpolation: simple_test.zip
Version
Additional context related: #2137