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

Versioning not working since changes to toml versioning were made [BUG] #463

Closed
TimStrauven opened this issue Apr 21, 2024 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@TimStrauven
Copy link
Contributor

Contact Details

No response

Description

I noticed this when trying to save a blender file with the current versioning system, the following error pops up:
ValueError: bpy_struct: item.attr = val: sequences of dimension 0 should contain 3 items, not 10

The reason this happens is I think that a tuple is expected, however that tuple is converted to string and is then being sent to blender.

The old code before the changes was:

def get_addon_version():
    from .import bl_info
    return bl_info["version"]

def write_addon_version(context):
    version = get_addon_version()

    logger.debug("Writting addon version: " + str(version))

    # NOTE: Version is written to every scene because there's no global
    # place we can put this value
    for scene in bpy.data.scenes:
        scene.sketcher.version = version

the changes splitted the get_addon_version function into another file and made get_addon_version return a string:

def get_bl_info():

    from .. import bl_info
    return bl_info


def get_addon_version() -> str:
    """Return addon version from manifest file"""

    if version < (4, 20):
        return str(get_bl_info()["version"])

    manifest = pathlib.Path(__file__).parent.parent / "blender_manifest.toml"
    try:
        import toml
        return toml.load(manifest)["blender"]
    except Exception:
        return ""

The bigger issue is that it seems like any file that has been saved from new since this change with blender version < 4.20 will have no version info at all....
So version updating does not seem to happen anymore because it passes here without a set version prop:

    for scene in bpy.data.scenes:
        props = scene.sketcher

        if not props.is_property_set("version"):
            continue

Addon Version

0.27.3

Blender Version

4.1

What platform are you running on?

Linux

@TimStrauven TimStrauven added the bug Something isn't working label Apr 21, 2024
@hlorus
Copy link
Owner

hlorus commented Apr 21, 2024

Good catch! Are you planning to submit a PR? Otherwise I'll have a look.

@TimStrauven
Copy link
Contributor Author

I don't know the history behind al the versioning changes, so it might be better if you have a look at it.

@hlorus
Copy link
Owner

hlorus commented Apr 21, 2024

Resolved with:
f297800

@hlorus hlorus closed this as completed Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants