BlenderTools icon indicating copy to clipboard operation
BlenderTools copied to clipboard

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

Open gerroon opened this issue 1 year ago • 20 comments

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:

  • Addon: Send to Unreal
  • Steps to Reproduce the Problem: Add Suzanne, add a material to it, press push asset from the menu
  • Error Log: See below
  • OS: i.e.Windows
  • Addon Version: i.e. Send to Unreal 1.4.0
  • Blender Version: 4.2
  • Unreal Version: Unreal 5.3
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



gerroon avatar Mar 23 '24 18:03 gerroon

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? ;)

redemprez avatar Mar 27 '24 09:03 redemprez

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

JoshQuake avatar Mar 28 '24 20:03 JoshQuake

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

PGSCOM avatar Mar 28 '24 22:03 PGSCOM

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

JoshQuake avatar Mar 28 '24 23:03 JoshQuake

@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

redemprez avatar Mar 29 '24 09:03 redemprez

@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 avatar Mar 29 '24 09:03 JoshQuake

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

redemprez avatar Mar 29 '24 09:03 redemprez

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

MalikuMane avatar Apr 03 '24 03:04 MalikuMane

Thanks for this!

Puzzabug avatar May 16 '24 19:05 Puzzabug

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

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

3dcinetv avatar May 24 '24 06:05 3dcinetv

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

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

Remove (?i) from the string

JoshQuake avatar May 24 '24 23:05 JoshQuake

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...)

jdknox avatar Jul 04 '24 01:07 jdknox

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/

JoshQuake avatar Jul 04 '24 01:07 JoshQuake

@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

omrkrk avatar Jul 18 '24 15:07 omrkrk

@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

larieflor avatar Jul 18 '24 15:07 larieflor

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

jack-yao91 avatar Jul 18 '24 17:07 jack-yao91

@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

larieflor avatar Jul 18 '24 17:07 larieflor

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.

jack-yao91 avatar Jul 18 '24 17:07 jack-yao91

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.

larieflor avatar Jul 18 '24 18:07 larieflor