Skip to content

#STB-Input-Panel-Object is not working #35

Description

@z4m1

Describe the bug
An error occurs when setting the property as described in the wiki.

#STB-Input-Panel-Object
MyObject = ""

To Reproduce
Add the above example as a script from the add-on.

Expected behavior
The object selection property should be displayed.

Screenshots
If applicable, add screenshots to help explain your problem.

Version Information:

  • Add-on Version [e.g. 2.1.4]
  • Blender Version: 4.5.10

Additional context
I looked into the source code and managed to solve the problem.
In function.py, BLENDER_TYPE_TO_PY_TYPE defines "Object": bpy.types.Object, but this is incorrect because the next line in add_prop() returns False:
is_type = isinstance(value, BLENDER_TYPE_TO_PY_TYPE.get(property_type, None))

It should correctly be:
"Object": (str, bpy.types.Object)

Along with this change, the latter part of add_prop() also needs to be modified.

Original code:

elif property_type == "Object":
    new_element.prop = value.name

Modified code:

elif property_type == "Object":
    if isinstance(value, str):
        new_element.prop = value
    else:
        new_element.prop = value.name

The add-on works correctly after applying these fixes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions