Tree Gen #83360

Closed
opened 2020-12-03 13:59:26 +01:00 by Константин Басинский · 14 comments

System Information
Operating system: Windows-10-10.0.19041-SP0 64 Bits
Graphics card: Radeon RX 580 Series ATI Technologies Inc. 4.5.13587 Core Profile Context 20.4.2 26.20.15029.27017

Blender Version
Broken: version: 2.91.0, branch: master, commit date: 2020-11-25 08:34, hash: blender/blender@0f45cab862
Worked: (newest version of Blender that worked as expected)

Addon Information
Name: Sapling Tree Gen (0, 3, 4)
Author: Andrew Hale (TrumanBlending), Aaron Buchler, CansecoGPC

Short description of error

Python: Traceback (most recent call last):

File "D:\Games\Steam\steamapps\common\Blender\2.91\scripts\addons\add_curve_sapling_init_.py", line 1110, in invoke
return self.execute(context)
File "D:\Games\Steam\steamapps\common\Blender\2.91\scripts\addons\add_curve_sapling_init_.py", line 1102, in execute
utils.addTree(self)
File "D:\Games\Steam\steamapps\common\Blender\2.91\scripts\addons\add_curve_sapling\utils.py", line 1537, in addTree
leafDupliObj = props.leafDupliObj
File "D:\Games\Steam\steamapps\common\Blender\2.91\scripts\modules\bpy_types.py", line 720, in getattribute
return getattr(properties, attr)

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x90 in position 0: invalid start byte

location: <unknown location>:-1

Exact steps for others to reproduce the error
Ctrl+A - Curve - Tree Gen - Error

**System Information** Operating system: Windows-10-10.0.19041-SP0 64 Bits Graphics card: Radeon RX 580 Series ATI Technologies Inc. 4.5.13587 Core Profile Context 20.4.2 26.20.15029.27017 **Blender Version** Broken: version: 2.91.0, branch: master, commit date: 2020-11-25 08:34, hash: `blender/blender@0f45cab862` Worked: (newest version of Blender that worked as expected) **Addon Information** Name: Sapling Tree Gen (0, 3, 4) Author: Andrew Hale (TrumanBlending), Aaron Buchler, CansecoGPC **Short description of error** ```lines Python: Traceback (most recent call last): ``` File "D:\Games\Steam\steamapps\common\Blender\2.91\scripts\addons\add_curve_sapling\__init__.py", line 1110, in invoke return self.execute(context) File "D:\Games\Steam\steamapps\common\Blender\2.91\scripts\addons\add_curve_sapling\__init__.py", line 1102, in execute utils.addTree(self) File "D:\Games\Steam\steamapps\common\Blender\2.91\scripts\addons\add_curve_sapling\utils.py", line 1537, in addTree leafDupliObj = props.leafDupliObj File "D:\Games\Steam\steamapps\common\Blender\2.91\scripts\modules\bpy_types.py", line 720, in __getattribute__ return getattr(properties, attr) ``` UnicodeDecodeError: 'utf-8' codec can't decode byte 0x90 in position 0: invalid start byte location: <unknown location>:-1 ``` **Exact steps for others to reproduce the error** Ctrl+A - Curve - Tree Gen - Error

Added subscriber: @Ceelees

Added subscriber: @Ceelees

#90384 was marked as duplicate of this issue

#90384 was marked as duplicate of this issue

Added subscriber: @rjg

Added subscriber: @rjg

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'

This appears to be an encoding issue. Does this happen in every project or just a particular file? If it's the latter, could you please create a minimal example that allows us to reproduce this and ideally share how you created this file?

The problem may be the same as blender/blender#74510.

This appears to be an encoding issue. Does this happen in every project or just a particular file? If it's the latter, could you please create a minimal example that allows us to reproduce this and ideally share how you created this file? The problem may be the same as blender/blender#74510.

While I cannot reproduce the exact issue with my current locale/language settings, I can reproduce something that is likely related.

  • Name an object ж
  • Add > Curve > Sapling Tree Gen
  • Switch settings to Leaves
  • Query the Leaf Objects and select the one named ж

The name is not properly displayed for the enum and every time it is selected there character changes (it's either blank, p_, ðZ, Đ]).

While I cannot reproduce the exact issue with my current locale/language settings, I can reproduce something that is likely related. - Name an object `ж` - *Add > Curve > Sapling Tree Gen* - Switch settings to *Leaves* - Query the *Leaf Objects* and select the one named `ж` The name is not properly displayed for the enum and every time it is selected there character changes (it's either blank, `p_`, `ðZ`, `Đ]`).

Looking further into this, it seems to be caused by the dynamic construction of the enum. The leafDupliObj EnumProperty is defined as:

    leafDupliObj: EnumProperty(
        name='Leaf Object',
        description='Object to use for leaf instancing if Leaf Shape is DupliFaces or DupliVerts',
        items=objectList,
        update=update_leaves
        )

The enum items are dynamically populated based on the return value of objectList implemented in AddTree (__init__.py).

    def objectList(self, context):
        objects = []
        bObjects = bpy.data.objects

        for obj in bObjects:
            if (obj.type in ['MESH', 'CURVE', 'SURFACE']) and (obj.name not in ['tree', 'leaves']):
                objects.append((obj.name, obj.name, ""))

        return (objects if objects else
                [('NONE', "No objects", "No appropriate objects in the Scene")])

According to the Python API docs using a callback for items is known to cause issues when not keeping a reference to the returned strings:

There is a known bug with using a callback, Python must keep a reference to the strings returned by the callback or Blender will misbehave or even crash.

Looking further into this, it seems to be caused by the dynamic construction of the enum. The `leafDupliObj` `EnumProperty` is defined as: ``` leafDupliObj: EnumProperty( name='Leaf Object', description='Object to use for leaf instancing if Leaf Shape is DupliFaces or DupliVerts', items=objectList, update=update_leaves ) ``` The enum items are dynamically populated based on the return value of `objectList` implemented in `AddTree` (`__init__.py`). ``` def objectList(self, context): objects = [] bObjects = bpy.data.objects for obj in bObjects: if (obj.type in ['MESH', 'CURVE', 'SURFACE']) and (obj.name not in ['tree', 'leaves']): objects.append((obj.name, obj.name, "")) return (objects if objects else [('NONE', "No objects", "No appropriate objects in the Scene")]) ``` According to the [Python API docs ](https://docs.blender.org/api/master/bpy.props.html#bpy.props.EnumProperty) using a callback for `items` is known to cause issues when not keeping a reference to the returned strings: > There is a known bug with using a callback, Python must keep a reference to the strings returned by the callback or Blender will misbehave or even crash.

Changed status from 'Needs User Info' to: 'Confirmed'

Changed status from 'Needs User Info' to: 'Confirmed'

I'm marking this ticket as confirmed. Either the add-on has to be updated to work with the current limitations of the API or this has to be addressed in the Python API to fix the underlying issue.

I'm marking this ticket as confirmed. Either the add-on has to be updated to work with the current limitations of the API or this has to be addressed in the Python API to fix the underlying issue.

Dear Robert

I found issue of my problem

If I use cyrillic letter like "Ж" on my ICOsphere, this problem appear
BUT if I use cyrillic letters on any plane - all correct

Please, check my file.
https://drive.google.com/file/d/1yCjH3MmheHVn8IXVZt1LBEUQguZmwV9p/view?usp=sharing

Dear Robert I found issue of my problem If I use cyrillic letter like "Ж" on my ICOsphere, this problem appear BUT if I use cyrillic letters on any plane - all correct Please, check my file. https://drive.google.com/file/d/1yCjH3MmheHVn8IXVZt1LBEUQguZmwV9p/view?usp=sharing

Added subscriber: @randum

Added subscriber: @randum

This issue was referenced by cef282cc9a

This issue was referenced by cef282cc9acdc1eb4e77d92fa7631f47a47a867c

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Campbell Barton self-assigned this 2021-01-07 03:55:41 +01:00

Added subscribers: @nurlana, @PratikPB2123

Added subscribers: @nurlana, @PratikPB2123
Sign in to join this conversation.
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#83360
No description provided.