EpicGamesExt / BlenderTools

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

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

Open gerroon opened 7 months ago

gerroon commented 7 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 7 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 7 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 7 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 7 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 7 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 7 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 7 months ago

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

MalikuMane commented 7 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 6 months ago

Thanks for this!

3dcinetv commented 5 months ago

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

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

JoshQuake commented 5 months 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

jdknox commented 4 months ago

Is there a reason why the LOD regex was case-insensitive to begin with? If so, wouldn't it be better to change the regex string to use (?i:<pat>) instead of just deleting the important part?

The issue is now with the placement of the inline flag, not that the flag exists.

(I honestly don't know what the correct answer is, but I can offer that brute deleting flags usually isn't the best long-term approach. No passive aggression, just speaking from my past mistakes...)

JoshQuake commented 4 months ago

Is there a reason why the LOD regex was case-insensitive to begin with? If so, wouldn't it be better to change the regex string to use (?i:<pat>) instead of just deleting the important part?

The issue is now with the placement of the inline flag, not that the flag exists.

(I honestly don't know what the correct answer is, but I can offer that brute deleting flags usually isn't the best long-term approach. No passive aggression, just speaking from my past mistakes...)

Yep, that was a temp solution. It has been properly resolved at the maintained repo https://github.com/poly-hammer/BlenderTools/

omrkrk 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

@JoshQuake I cant find this tab. how can I reach this tab

larieflor 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

@JoshQuake I cant find this tab. how can I reach this tab

Go to Pipeline tab > Export > Settings Dialog > Click Import tab and under LOD Settings

jack-yao91 commented 3 months ago

Hey we are maintaing a new fork now. I would follow that for updates, since the Epic one is still only compatible with 3.6 (also isn't being maintained). Ours should be up to date and working with 4.1. https://github.com/poly-hammer/BlenderTools

This release should work https://github.com/poly-hammer/BlenderTools/releases/tag/20240617232853

larieflor commented 3 months ago

@larieflor ty but that wasn't the solution to my problem. can you help me about it.

Python: Traceback (most recent call last): File "C:\Users\yasar\AppData\Roaming\Blender Foundation\Blender\4.2\scripts\addons\send2ue\operators.py", line 71, in modal raise error File "C:\Users\yasar\AppData\Roaming\Blender Foundation\Blender\4.2\scripts\addons\send2ue\operators.py", line 61, in modal function(*args, **kwargs) File "C:\Users\yasar\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\yasar\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\yasar\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\yasar\AppData\Roaming\Blender Foundation\Blender\4.2\scripts\addons\send2ue\core\utilities.py", line 832, in is_collision_of ) or re.fullmatch( ^^^^^^^^^^^^^ File "C:\Program Files (x86)\Steam\steamapps\common\Blender\4.2\python\Lib\re\__init__.py", line 171, in fullmatch return _compile(pattern, flags).fullmatch(string) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files (x86)\Steam\steamapps\common\Blender\4.2\python\Lib\re\__init__.py", line 294, in _compile p = _compiler.compile(pattern, flags) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files (x86)\Steam\steamapps\common\Blender\4.2\python\Lib\re\_compiler.py", line 745, in compile p = _parser.parse(p, flags) ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files (x86)\Steam\steamapps\common\Blender\4.2\python\Lib\re\_parser.py", line 989, in parse p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files (x86)\Steam\steamapps\common\Blender\4.2\python\Lib\re\_parser.py", line 464, in _parse_sub itemsappend(_parse(source, state, verbose, nested + 1, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files (x86)\Steam\steamapps\common\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 24

try going to Blender preferences, under Add ons and down to Preferences, change the RPC Response timeout to 99999

jack-yao91 commented 3 months ago

The error is a Regex error. It is related to changes in re module in python 3.11. We fixed it in the 2.4.5 version of the addon in our fork.

larieflor commented 3 months ago

The error is a Regex error. It is related to changes in re module in python 3.11. We fixed it in the 2.4.5 version of the addon in our fork.

I see, thank you so much! 2.4.5 worked smoothly on my end now.