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

Store rest transform on NiTransformInterpolator #458

Closed
7 tasks done
HENDRIX-ZT2 opened this issue Sep 25, 2021 · 1 comment · Fixed by #467
Closed
7 tasks done

Store rest transform on NiTransformInterpolator #458

HENDRIX-ZT2 opened this issue Sep 25, 2021 · 1 comment · Fixed by #467
Assignees
Labels
Bug Issue with specific functionality not working as intended but overall plugin is working.

Comments

@HENDRIX-ZT2
Copy link
Contributor

HENDRIX-ZT2 commented Sep 25, 2021

@niftools/blender-niftools-addon-reviewer -

Before creating a new issue, ensure that

  • Read the user documentation.
  • Check that the issue hasn't already been reported.
  • Read through the list of Helpful resources links on the right-hand side.
  • Talk with the developers to ensure its a valid issue

The issue will get closed off immediately as invalid if

  • Looking for support where the forums, chat or documentation is more appropriate.
  • Goes off topic, loses focus or turns into a discussion.
  • Removing parts of the template the issue.

Fill out the template below to the best of your ability, including .blend files, nifs, logs; help us to help you.

Issue Overview

For games that use interpolators rather than keyframe controllers, the rest pose has to be set on the interpolator. As reported by @kormákur

Version Information

Blender Niftools Addon Version Info

[Provide version information for the Blender Niftools Addon the issue occurs with, available in Blender in the Add-On section]

Blender Version Info

[Provide information on which version of Blender the issue is seen]

Platform information

[Provide a brief overview of what OS your running on]

Context

Workaround:

def apply_skeleton_to_interpolators(controller_sequence):
    directory = os.path.dirname(NifOp.props.filepath)
    skeleton_path = directory + '\\' + 'skeleton.nif'
    skeleton_file = NifFormat.Data()
    try:
        with open(skeleton_path, "rb") as _file:
            skeleton_file.read(_file)
    except OSError:
        raise NifError(f"skeleton.nif is missing in path '{directory}'")
    
    for controlled_block in controller_sequence.controlled_blocks:
        try:
            ninode = next(s_block for s_block in skeleton_file.blocks if type(
                s_block) is NifFormat.NiNode and s_block.name == controlled_block.node_name)
        except:
            break
        if not ninode:
            NifLog.warn(f"Couldn't find skeleton NiNode {controlled_block.node_name}")
            continue
        interp = controlled_block.interpolator
        interp.scale = ninode.scale
        interp.translation.x = ninode.translation.x
        interp.translation.y = ninode.translation.y
        interp.translation.z = ninode.translation.z
        scale, quat = ninode.rotation.get_scale_quat()
        interp.rotation.x = quat.x
        interp.rotation.y = quat.y
        interp.rotation.z = quat.z
        interp.rotation.w = quat.w
    NifLog.info("Finished applying skeleton to interpolators")

Steps to Reproduce

[Ordered list of the steps required for recreating the issue, including settings]
#.

Expected Result

[Describe what you expected to have resulted from this process]

Actual Result

Interpolator transform is zeroed.

Possible Fix

[Optional, suggest fixes, improvement or reasons for the bug might have occurred]

Screenshot

[If relevant, include a screenshot]

Logs and Files

[Provide logs file generated during the error as well as the blend and nif files are related to the issue]

Info Bar Output

[Output from the Info View, available at top of Blender viewport, drag to expand]

Console Output

[Set the logging level to 'Debug' and attach the output of the console. Enable via Window -> Toggle Console]

Blend File

[Attach the blend file if the issue is reproducible]

Nif File

[Attach input or output files, samples of what the expected output should be and reproducing the issue]

Similar Known Issues

[Reference any known issues - https://github.com/niftools/blender_niftools_addon/issues]

Additional Information

[Anything else you feel is relevant]

@HENDRIX-ZT2 HENDRIX-ZT2 added the Bug Issue with specific functionality not working as intended but overall plugin is working. label Sep 25, 2021
HENDRIX-ZT2 added a commit to HENDRIX-ZT2/blender_niftools_addon that referenced this issue Sep 26, 2021
@HENDRIX-ZT2
Copy link
Contributor Author

Idk why this didn't autoclose with the merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issue with specific functionality not working as intended but overall plugin is working.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants