blender_cad_transforms icon indicating copy to clipboard operation
blender_cad_transforms copied to clipboard

CAD Transforms won't activate on Blender 4.0 alpha

Open meikasahara opened this issue 1 year ago • 6 comments

The latest Blender 4.0 alpha builds (from May 23 onwards) breka compatibility with the add-on, and as a result it can no longer be used or activated. Upon attempting to activate it, the following error appears in the console:

addon_utils.disable: slcad_transform not disabled
Traceback (most recent call last):
  File "/home/user/Blender/blender-4.0.0-alpha+main.8ed65fe6de9a-linux.x86_64-release/4.0/scripts/modules/addon_utils.py", line 333, in enable
    mod = __import__(module_name)
  File "/home/user/.config/blender/4.0/scripts/addons/slcad_transform/__init__.py", line 63, in <module>
    from .slcad_transform import register, unregister
  File "/home/user/.config/blender/4.0/scripts/addons/slcad_transform/slcad_transform.py", line 45, in <module>
    from .utils.gpu_draw import (
  File "/home/user/.config/blender/4.0/scripts/addons/slcad_transform/utils/gpu_draw.py", line 401, in <module>
    class GPU_2d_uniform(GPU_Draw):
  File "/home/user/.config/blender/4.0/scripts/addons/slcad_transform/utils/gpu_draw.py", line 402, in GPU_2d_uniform
    _shader = get_shader('2D_UNIFORM_COLOR')
  File "/home/user/.config/blender/4.0/scripts/addons/slcad_transform/utils/gpu_draw.py", line 85, in get_shader
    return gpu.shader.from_builtin(builtin_typ)
ValueError: expected a string in ('FLAT_COLOR', 'IMAGE', 'IMAGE_COLOR', 'SMOOTH_COLOR', 'UNIFORM_COLOR', 'POLYLINE_FLAT_COLOR', 'POLYLINE_SMOOTH_COLOR', 'POLYLINE_UNIFORM_COLOR'), got '2D_UNIFORM_COLOR'
```

`

meikasahara avatar May 27 '23 15:05 meikasahara

Thank you for reporting.

s-leger avatar May 27 '23 19:05 s-leger

It seems for Blender 4.0 all strings 3D_UNIFORM_COLOR should be replaced with UNIFORM_COLOR according to the example in the docs - https://docs.blender.org/api/4.0/gpu.html#d-lines-with-single-color

There are probably others incompatible changes in 4.0 as well.

meikasahara avatar May 29 '23 09:05 meikasahara

Changing line 402 of the file "gpu_draw.py" to _shader = get_shader('UNIFORM_COLOR') and line 225 of the same file to blf.size(font_id, self._font_size) makes the addon work on current versions of Blender 4.0.0 for the time being.

meikasahara avatar Jun 01 '23 12:06 meikasahara

Can't make it work. It still crashes a lot while using, even with those lines corrected.

SecondGM avatar Jul 12 '23 14:07 SecondGM

Hello , I'm also getting a similar problem on blender 4.0.1 , I get the following error message when trying to activate the addon Screenshot from 2023-11-21 22-13-19

Jsevenh avatar Nov 21 '23 19:11 Jsevenh

Same issue faced by me.

johari564w avatar Nov 27 '23 05:11 johari564w