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

Try bpy.context.view_layer.update() #56

Open
mrwonko opened this issue Apr 4, 2024 · 2 comments · May be fixed by #69
Open

Try bpy.context.view_layer.update() #56

mrwonko opened this issue Apr 4, 2024 · 2 comments · May be fixed by #69

Comments

@mrwonko
Copy link
Owner

mrwonko commented Apr 4, 2024

Maybe that way repeatedly switching out of pose mode during gla import can be avoided?

@mrwonko
Copy link
Owner Author

mrwonko commented Apr 4, 2024

for frameNum, frame in enumerate(self.frames):
            # show progress bar / remaining time
            if time.time() >= nextProgressDisplayTime:
                ....
                nextProgressDisplayTime = time.time() + PROGRESS_UPDATE_INTERVAL

            # absolute offset matrices by bone index
            offsets: Dict[int, mathutils.Matrix] = {}
            for index in hierarchyOrder:
                ....
                pose_bone = bones[index]
                # pose_bone.matrix = transformation * scaleMatrix
                pose_bone.matrix = transformation
                bpy.context.view_layer.update()
                # in the _humanoid face, the scale gets changed. that messes the re-export up. FIXME: understand why. Is there a problem?
                pose_bone.scale = [1, 1, 1]
                pose_bone.keyframe_insert('location', frame = frameNum)
                pose_bone.keyframe_insert('rotation_quaternion', frame = frameNum)

        scene.frame_current = 1

https://discord.com/channels/200934142278369281/1103343134160728144/1225545235652935821

@SomaZ
Copy link
Contributor

SomaZ commented Sep 9, 2024

Used bpy.ops.pose.visual_transform_apply() instead of bpy.context.view_layer.update() and put key frame inserts into another loop which is also a bit faster in #69

@SomaZ SomaZ linked a pull request Sep 9, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants