Skip to content

int cast in add_dummy_markers to comply with blender python 3.1+#524

Merged
HENDRIX-ZT2 merged 2 commits into
niftools:developfrom
TackYs:develop
Jun 29, 2022
Merged

int cast in add_dummy_markers to comply with blender python 3.1+#524
HENDRIX-ZT2 merged 2 commits into
niftools:developfrom
TackYs:develop

Conversation

@TackYs
Copy link
Copy Markdown
Contributor

@TackYs TackYs commented Jun 13, 2022

@niftools/blender-niftools-addon-reviewer

Overview

blenders python had some changes from 3.1+ that affect scripting, from docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.1/Python_API
"Python 3.10 no longer implicitly converts floats to int's (issue linked). This means functions that previously accepted float typed values will raise a type error.
Floating point arguments must now be explicitly converted to integers"

This error is encountered in add_dummy_markers in nif_export/animation/init.py

float-to-int_niftools

A simple int cast resolves this - don't know if similar issues exists in other parts of the code. Should be harmless?

Detailed Description

[List of functional updates]

Fixes Known Issues

None afaik

Documentation

[Overview of updates to documentation]

Testing

[Overview of testing required to ensure functionality is correctly implemented]

Manual

[Set of steps to manually verify updates are working correctly]

Automated

[List of tests run, updated or added to avoid future regressions]

Additional Information

[Anything else you deem relevant]

@neomonkeus neomonkeus self-assigned this Jun 13, 2022
@neomonkeus neomonkeus added the Blender:3.0 Issues tied to Blender 3.0+ label Jun 13, 2022
@HENDRIX-ZT2
Copy link
Copy Markdown
Contributor

This is quirky as keyframes used to be able to land between physical frames, ie. needing floats rather than ints. The code that imports markers should be checked too.

@TackYs
Copy link
Copy Markdown
Contributor Author

TackYs commented Jun 22, 2022

Importing a nif with text keys in controllersequence wont give me any markers at all...

base_textkey_at_weird_time.zip

@TackYs
Copy link
Copy Markdown
Contributor Author

TackYs commented Jun 22, 2022

Nvm I'm stupid, they are there just fine - I just didnt show pose markers.

There already is a round statement in the code though, import_text_key_extra_data (nif_import/animation/__init__.py)has:

frame = round(key.time * self.fps)

Seems like the cleaner fix over just int casting...

Blenders bpy.types.Action's frame_range gives a [float,float] array - I think just casting these should be fine, afaik you cant set an actions start/end to sub-frame positions

@TackYs
Copy link
Copy Markdown
Contributor Author

TackYs commented Jun 23, 2022

added fix in get_controller_data -> see comment #506

@neomonkeus
Copy link
Copy Markdown
Member

Good to merge?

Copy link
Copy Markdown
Contributor

@HENDRIX-ZT2 HENDRIX-ZT2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to merge!

@HENDRIX-ZT2 HENDRIX-ZT2 merged commit c80b1a0 into niftools:develop Jun 29, 2022
@Candoran2 Candoran2 mentioned this pull request Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Blender:3.0 Issues tied to Blender 3.0+

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants