Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gerroon opened this issue Mar 23, 2024 · 19 comments
Labels
bug Something isn't working

Comments

@gerroon
Copy link

gerroon commented Mar 23, 2024

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 gerroon added the bug Something isn't working label Mar 23, 2024
@redemprez
Copy link

redemprez commented Mar 27, 2024

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
Copy link
Contributor

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
Copy link

PGSCOM commented Mar 28, 2024

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
Copy link
Contributor

JoshQuake commented Mar 28, 2024

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
Copy link

@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
Copy link
Contributor

@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
Copy link

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

@MalikuMane
Copy link

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
Copy link

Thanks for this!

@3dcinetv
Copy link

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

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

@JoshQuake
Copy link
Contributor

JoshQuake commented May 24, 2024

@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
Copy link

jdknox commented Jul 4, 2024

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
Copy link
Contributor

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
Copy link

omrkrk commented Jul 18, 2024

@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
Copy link

@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
Copy link

jack-yao91 commented Jul 18, 2024

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
Copy link

@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
Copy link

jack-yao91 commented Jul 18, 2024

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests