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

Texture names with spaces should be quoted #3951

Closed
mathias17 opened this issue Feb 14, 2022 · 4 comments · Fixed by #3983
Closed

Texture names with spaces should be quoted #3951

mathias17 opened this issue Feb 14, 2022 · 4 comments · Fixed by #3983
Labels
Prio:3 Low priority: Minor problems and nice to have features Type:Bug Errors and problems
Milestone

Comments

@mathias17
Copy link

I have a large MAP file created with TrenchBroom that TrenchBroom can no longer open. Instead, I get an error message.

Fortunately an autosave backup prevented significant progress loss but it's the second time in 24 hours this has happened, while working on the same file. It seems likely that continuing to work in the same file will just lead it to it happening again so my plan is to manually split up the map into multiple map files. Inconvenient, but apparently necessary.

The second time it happened, I expected it because I could no longer paste a copy of a brush. So, it seems like some program functions become impaired when this problem happens. Once I could no longer paste, I tried re-opening the file and sure enough, I got the error message.

If someone intends to investigate the issue and wants a copy of the file for testing, let me know. I don't want to share it publicly.


System Information

TrenchBroom V2021.1 on Windows 10

Expected Behavior

File opens as per usual.

Steps to Reproduce

Attempt to open said file.
This error will appear:
error image

I believe "Walls15" is part of a texture filename. Could this just be a simple to solve syntax error type of thing?

Crash Info

No crash occurs. Only an error message (see above screenshot) when trying to open a problem file.

Before closing the problem file, I checked the console tab - here are the last lines:

Couldn't parse as Valve entities: At line 1, column 1: Expected '{', but got '(' (raw data: '(') (unknown position)
Couldn't parse as Valve brushes: At line 1, column 1: Expected '{', but got '(' (raw data: '(') (unknown position)
Couldn't parse as Standard entities: At line 1, column 1: Expected '{', but got '(' (raw data: '(') (unknown position)
Couldn't parse as Standard brushes: At line 1, column 1: Expected '{', but got '(' (raw data: '(') (unknown position)
Couldn't parse as Valve entities: At line 1, column 1: Expected '{', but got '(' (raw data: '(') (unknown position)
Couldn't parse as Valve brushes: At line 1, column 1: Expected '{', but got '(' (raw data: '(') (unknown position)
Couldn't parse as Standard entities: At line 1, column 1: Expected '{', but got '(' (raw data: '(') (unknown position)
Couldn't parse as Standard brushes: At line 1, column 1: Expected '{', but got '(' (raw data: '(') (unknown position)
Couldn't parse as Valve entities: At line 1, column 1: Expected '{', but got '(' (raw data: '(') (unknown position)
Couldn't parse as Valve brushes: At line 1, column 1: Expected '{', but got '(' (raw data: '(') (unknown position)
Couldn't parse as Standard entities: At line 1, column 1: Expected '{', but got '(' (raw data: '(') (unknown position)
Couldn't parse as Standard brushes: At line 1, column 1: Expected '{', but got '(' (raw data: '(') (unknown position)
Couldn't parse as Valve entities: At line 20, column 160: Expected '[', but got string (raw data: 'Walls15') (unknown position)
Couldn't parse as Valve brushes: At line 3, column 1: Expected '(', but got string (raw data: 'mapversion') (unknown position)
Couldn't parse as Standard entities: At line 8, column 163: Expected integer or decimal, but got '[' (raw data: '[') (unknown position)
Couldn't parse as Standard brushes: At line 3, column 1: Expected '(', but got string (raw data: 'mapversion') (unknown position)
Could not parse clipboard contents: At line 2, column 1: Expected '(', but got '{' (raw data: '{')
Couldn't parse as Valve entities: At line 20, column 160: Expected '[', but got string (raw data: 'Walls15') (unknown position)
Couldn't parse as Valve brushes: At line 3, column 1: Expected '(', but got string (raw data: 'mapversion') (unknown position)
Couldn't parse as Standard entities: At line 8, column 163: Expected integer or decimal, but got '[' (raw data: '[') (unknown position)
Couldn't parse as Standard brushes: At line 3, column 1: Expected '(', but got string (raw data: 'mapversion') (unknown position)
Could not parse clipboard contents: At line 2, column 1: Expected '(', but got '{' (raw data: '{')
Couldn't parse as Valve entities: At line 20, column 160: Expected '[', but got string (raw data: 'Walls15') (unknown position)
Couldn't parse as Valve brushes: At line 3, column 1: Expected '(', but got string (raw data: 'mapversion') (unknown position)
Couldn't parse as Standard entities: At line 8, column 163: Expected integer or decimal, but got '[' (raw data: '[') (unknown position)
Couldn't parse as Standard brushes: At line 3, column 1: Expected '(', but got string (raw data: 'mapversion') (unknown position)
Could not parse clipboard contents: At line 2, column 1: Expected '(', but got '{' (raw data: '{')
Couldn't parse as Valve entities: At line 11, column 160: Expected '[', but got string (raw data: 'Walls15') (unknown position)
Couldn't parse as Valve brushes: At line 3, column 1: Expected '(', but got string (raw data: 'mapversion') (unknown position)
Couldn't parse as Standard entities: At line 8, column 161: Expected integer or decimal, but got '[' (raw data: '[') (unknown position)
Couldn't parse as Standard brushes: At line 3, column 1: Expected '(', but got string (raw data: 'mapversion') (unknown position)
Could not parse clipboard contents: At line 2, column 1: Expected '(', but got '{' (raw data: '{')
Couldn't parse as Valve entities: At line 11, column 160: Expected '[', but got string (raw data: 'Walls15') (unknown position)
Couldn't parse as Valve brushes: At line 3, column 1: Expected '(', but got string (raw data: 'mapversion') (unknown position)
Couldn't parse as Standard entities: At line 8, column 161: Expected integer or decimal, but got '[' (raw data: '[') (unknown position)
Couldn't parse as Standard brushes: At line 3, column 1: Expected '(', but got string (raw data: 'mapversion') (unknown position)
Could not parse clipboard contents: At line 2, column 1: Expected '(', but got '{' (raw data: '{')
Couldn't parse as Valve entities: At line 11, column 160: Expected '[', but got string (raw data: 'Walls15') (unknown position)
Couldn't parse as Valve brushes: At line 3, column 1: Expected '(', but got string (raw data: 'mapversion') (unknown position)
Couldn't parse as Standard entities: At line 8, column 161: Expected integer or decimal, but got '[' (raw data: '[') (unknown position)
Couldn't parse as Standard brushes: At line 3, column 1: Expected '(', but got string (raw data: 'mapversion') (unknown position)
Could not parse clipboard contents: At line 2, column 1: Expected '(', but got '{' (raw data: '{')
Couldn't parse as Valve entities: At line 11, column 160: Expected '[', but got string (raw data: 'Walls15') (unknown position)
Couldn't parse as Valve brushes: At line 3, column 1: Expected '(', but got string (raw data: 'mapversion') (unknown position)
Couldn't parse as Standard entities: At line 8, column 161: Expected integer or decimal, but got '[' (raw data: '[') (unknown position)
Couldn't parse as Standard brushes: At line 3, column 1: Expected '(', but got string (raw data: 'mapversion') (unknown position)
Could not parse clipboard contents: At line 2, column 1: Expected '(', but got '{' (raw data: '{')
Couldn't parse as Valve entities: At line 11, column 160: Expected '[', but got string (raw data: 'Walls15') (unknown position)
Couldn't parse as Valve brushes: At line 3, column 1: Expected '(', but got string (raw data: 'mapversion') (unknown position)
Couldn't parse as Standard entities: At line 8, column 161: Expected integer or decimal, but got '[' (raw data: '[') (unknown position)
Couldn't parse as Standard brushes: At line 3, column 1: Expected '(', but got string (raw data: 'mapversion') (unknown position)
Could not parse clipboard contents: At line 2, column 1: Expected '(', but got '{' (raw data: '{')
Couldn't parse as Valve entities: At line 11, column 160: Expected '[', but got string (raw data: 'Walls15') (unknown position)
Couldn't parse as Valve brushes: At line 3, column 1: Expected '(', but got string (raw data: 'mapversion') (unknown position)
Couldn't parse as Standard entities: At line 8, column 161: Expected integer or decimal, but got '[' (raw data: '[') (unknown position)
Couldn't parse as Standard brushes: At line 3, column 1: Expected '(', but got string (raw data: 'mapversion') (unknown position)
Could not parse clipboard contents: At line 2, column 1: Expected '(', but got '{' (raw data: '{')
Couldn't parse as Valve entities: At line 11, column 160: Expected '[', but got string (raw data: 'Walls15') (unknown position)
Couldn't parse as Valve brushes: At line 3, column 1: Expected '(', but got string (raw data: 'mapversion') (unknown position)
Couldn't parse as Standard entities: At line 8, column 161: Expected integer or decimal, but got '[' (raw data: '[') (unknown position)
Couldn't parse as Standard brushes: At line 3, column 1: Expected '(', but got string (raw data: 'mapversion') (unknown position)
Could not parse clipboard contents: At line 2, column 1: Expected '(', but got '{' (raw data: '{')

And while I still have the problem file open, and I try to copy/paste brushes from it into a new fresh map file (because once I close it, I cannot open it again), nothing happens. No brushes get pasted. But this appears in the console:

Couldn't parse as Valve entities: At line 424, column 160: Expected '[', but got string (raw data: 'Walls15') (unknown position)
Couldn't parse as Valve brushes: At line 3, column 1: Expected '(', but got string (raw data: 'mapversion') (unknown position)
Couldn't parse as Standard entities: At line 8, column 174: Expected integer or decimal, but got '[' (raw data: '[') (unknown position)
Couldn't parse as Standard brushes: At line 3, column 1: Expected '(', but got string (raw data: 'mapversion') (unknown position)
Could not parse clipboard contents: At line 2, column 1: Expected '(', but got '{' (raw data: '{')
@kduske
Copy link
Collaborator

kduske commented Feb 14, 2022

Please attach the map file that provokes the error.

@mathias17
Copy link
Author

Hi, kduske. I could email you the file, but after more testing I was able to create a minified test case file that throws the same error.

I eventually figured out that if I replaced all of the "Walls15" textures in the problem map file then the issues goes away.

Download ZIP: https://drive.google.com/file/d/1JboJatPK76fcP5i6EPJTjNB1hcP6sByW/view?usp=sharing
(map file and three text textures included:

Maintenance Walls15.png - causes issue.
Maintenance Walls16.png - causes issue.
FloorsCeilings4.png - does not cause issue.

The image texture in question is actually named "Maintenance Walls15.png", not "Walls15". I looked at the image file and it appears to be just like all my other textures. I can open it in Photoshop; the files appears to be in good condition.
I found that another texture I was using, "Maintenance Walls16.png", caused the same problem.

Try to open the map file from the zip and see what happens. I can't open it.
But if I use notepad to replace the problem textures with a different one then I can open it.

I have NO idea why TrenchBroom does not like these image files.

@kduske
Copy link
Collaborator

kduske commented Feb 14, 2022

The texture name contains a space. TB cannot handle texture names that contain spaces because it doesn't know where the texture name ends, so they must be enclosed in quotation marks. TB adds quotation marks to texture names when necessary while saving, so either there is a bug with that logic, or this file was somehow changed outside of TB.

@mathias17
Copy link
Author

Oh geeze . . . yep that seems to be the problem - spaces in texture filenames.
No, I hadn't modified the file I gave you outside of TB.

Coincidentally, I just hadn't used a texture with a space in its filename yet, up until this point. My texture library for this project has a mixtures of files with and without spaces.

(I'll definitely be removing all spaces from textures I'm given to use in the future. Thanks for your speedy help!)

@kduske kduske changed the title Cannot open MAP file anymore. Critical error. Texture names with spaces should be quoted Feb 14, 2022
@kduske kduske added Prio:3 Low priority: Minor problems and nice to have features Type:Bug Errors and problems labels Feb 14, 2022
@kduske kduske added this to the 2022.2 milestone May 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Prio:3 Low priority: Minor problems and nice to have features Type:Bug Errors and problems
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants