EpicGamesExt / BlenderTools

Blender addons that improve the game development workflow between Blender and Unreal.
https://epicgamesext.github.io/BlenderTools/
MIT License
2.69k stars 26 forks source link

Send to Unreal - re.error: global flags not at the start of the expression at position 22 #729

Open gerroon opened 3 months ago

gerroon commented 3 months ago

Hi

Send to Unreal is throwing this error under Blender 4.2, Windows 11, version 2.4.3

In the description paste in and edit the following:

Traceback (most recent call last):
  File "C:\Users\USER\AppData\Roaming\Blender Foundation\Blender\4.2\scripts\addons\send2ue\operators.py", line 71, in modal
    raise error
  File "C:\Users\USER\AppData\Roaming\Blender Foundation\Blender\4.2\scripts\addons\send2ue\operators.py", line 61, in modal
    function(*args, **kwargs)
  File "C:\Users\USER\AppData\Roaming\Blender Foundation\Blender\4.2\scripts\addons\send2ue\core\export.py", line 224, in export_mesh
    utilities.select_asset_collisions(asset_name, properties)
  File "C:\Users\USER\AppData\Roaming\Blender Foundation\Blender\4.2\scripts\addons\send2ue\core\utilities.py", line 950, in select_asset_collisions
    for mesh_object in get_asset_collisions(asset_name, properties):
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\USER\AppData\Roaming\Blender Foundation\Blender\4.2\scripts\addons\send2ue\core\utilities.py", line 636, in get_asset_collisions
    if is_collision_of(asset_name, mesh_object.name, properties):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\USER\AppData\Roaming\Blender Foundation\Blender\4.2\scripts\addons\send2ue\core\utilities.py", line 832, in is_collision_of
    ) or re.fullmatch(
         ^^^^^^^^^^^^^
  File "C:\blender\4.2\python\Lib\re\__init__.py", line 171, in fullmatch
    return _compile(pattern, flags).fullmatch(string)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\blender\4.2\python\Lib\re\__init__.py", line 294, in _compile
    p = _compiler.compile(pattern, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\blender\4.2\python\Lib\re\_compiler.py", line 745, in compile
    p = _parser.parse(p, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\blender\4.2\python\Lib\re\_parser.py", line 989, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\blender\4.2\python\Lib\re\_parser.py", line 464, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\blender\4.2\python\Lib\re\_parser.py", line 850, in _parse
    raise source.error('global flags not at the start '
re.error: global flags not at the start of the expression at position 22
Error: Python: Traceback (most recent call last):
  File "C:\Users\USER\AppData\Roaming\Blender Foundation\Blender\4.2\scripts\addons\send2ue\operators.py", line 71, in modal
    raise error
  File "C:\Users\USER\AppData\Roaming\Blender Foundation\Blender\4.2\scripts\addons\send2ue\operators.py", line 61, in modal
    function(*args, **kwargs)
  File "C:\Users\USER\AppData\Roaming\Blender Foundation\Blender\4.2\scripts\addons\send2ue\core\export.py", line 224, in export_mesh
    utilities.select_asset_collisions(asset_name, properties)
  File "C:\Users\USER\AppData\Roaming\Blender Foundation\Blender\4.2\scripts\addons\send2ue\core\utilities.py", line 950, in select_asset_collisions
    for mesh_object in get_asset_collisions(asset_name, properties):
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\USER\AppData\Roaming\Blender Foundation\Blender\4.2\scripts\addons\send2ue\core\utilities.py", line 636, in get_asset_collisions
    if is_collision_of(asset_name, mesh_object.name, properties):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\USER\AppData\Roaming\Blender Foundation\Blender\4.2\scripts\addons\send2ue\core\utilities.py", line 832, in is_collision_of
    ) or re.fullmatch(
         ^^^^^^^^^^^^^
  File "C:\blender\4.2\python\Lib\re\__init__.py", line 171, in fullmatch
    return _compile(pattern, flags).fullmatch(string)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\blender\4.2\python\Lib\re\__init__.py", line 294, in _compile
    p = _compiler.compile(pattern, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\blender\4.2\python\Lib\re\_compiler.py", line 745, in compile
    p = _parser.parse(p, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\blender\4.2\python\Lib\re\_parser.py", line 989, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\blender\4.2\python\Lib\re\_parser.py", line 464, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\blender\4.2\python\Lib\re\_parser.py", line 850, in _parse
    raise source.error('global flags not at the start '
re.error: global flags not at the start of the expression at position 22
redemprez commented 3 months ago

I confirm this bug - also present in Blender 4.1. It would be great if it would be fixed. Maybe @JoshQuake could come for rescue? ;)

JoshQuake commented 3 months ago

I confirm this bug - also present in Blender 4.1. It would be great if it would be fixed. Maybe @JoshQuake could come for rescue? ;)

lol I haven't updated to 4.1 yet but might as well take a look

PGSCOM commented 3 months ago

I confirm this bug - also present in Blender 4.1. It would be great if it would be fixed. Maybe @JoshQuake could come for rescue? ;)

lol I haven't updated to 4.1 yet but might as well take a look

It also happens in 4.1, I have not updated yet and I have stayed on 4.0

JoshQuake commented 3 months ago

Here's a temp fix that removes (?i) regex from default lod_regex value. Global flags are not allowed mid string in blender 4.1+'s regex parser.

send2ue-2.4.3_v4fixes_28-03.zip

Created pull request #732 with fix as well

redemprez commented 3 months ago

@JoshQuake thanks very much, you are the boss. Although I still get error in Blender 4.1. Can you look at it (big please!) :)

image

JoshQuake commented 3 months ago

@JoshQuake thanks very much, you are the boss. Although I still get error in Blender 4.1. Can you look at it (big please!) :)

image

can you check your LOD settings? If yours has (?i) then remove it from there. image

redemprez commented 3 months ago

@JoshQuake - thank you, that was it! After removal plugin works correctly!

MalikuMane commented 2 months ago

It seems to be an issue with builds that use python 3.11. I built blender 4.0.2 with 3.11 and it also occurred there.

@JoshQuake thanks very much, you are the boss. Although I still get error in Blender 4.1. Can you look at it (big please!) :) image

can you check your LOD settings? If yours has (?i) then remove it from there. image

Puzzabug commented 1 month ago

Thanks for this!

3dcinetv commented 1 month ago

@JoshQuake - thank you, that was it! After removal plugin works correctly!

what did you remove? did you "uncheck" LODs?

JoshQuake commented 1 month ago

@JoshQuake - thank you, that was it! After removal plugin works correctly!

what did you remove? did you "uncheck" LODs?

Remove (?i) from the string