colinvella/tIDE

tIDE cannot open tilesheets that are 3 or more directories above the directory a map file resides in.

Opened this issue · 9 comments

Hello,
to outline the problem: in image #1, you can see that I have a tide file in D:\C\B\A named test2.tide.

image

This file has reference to a tilesheet file "E.png" located in the root of D:\

image

The file maps properly when creating the tide map initially, however after saving the file, closing it, and attempting to reopen it, the following error occurs:

image

I notice that the error declares that it is attempting to open a png file residing in "D:\C\B" - which will naturally cause an error, because the tilemap file does not exist in this directory. However, when examining the tide file's data, it doesn't make sense why it would be searching that directory for its tilemap file?

<Map Id="test2">
  <Description><![CDATA[]]></Description>
  <TileSheets>
    <TileSheet Id="untitled tile sheet">
      <Description><![CDATA[]]></Description>
      <ImageSource><![CDATA[..\..\..\E.png]]></ImageSource>
      <Alignment SheetSize="25 x 18" TileSize="32 x 32" Margin="0 x 0" Spacing="0 x 0" />
      <Properties />
    </TileSheet>
  </TileSheets>
  <Layers />
  <Properties />
</Map>

So far as is evident to me, the data path to the image appears to be correct ("CDATA[..\..\..\E.png]"). So as to why it is being interpreted differently does not make any sense to me?

Thank you for your reply - I realize that this project hasn't had any updates made to it in quite some time. I've actually been using it for many years, and it has otherwise worked without any issue until now. If this issue is not worth the time to look into it, I do not blame you - I just wanted to inquire with you just in case it interested you.

It does not appear to me that the issue has to do with the map texture file being located in the root of a drive - I have tested this in other scenarios with both the .tide file and the tilemap texture file being nested deeper into a file structure. This error only appears when the tilemap is 3 directories up from the .tide file.

To demonstrate, I have done as you said, and created folder X in the root of D:, and moved the tilemap file into it:

image

Note how tIDE continues to search in the wrong location, but also mistakenly puts the new directory "X" in the path after "B". This seems like some sort of a parsing error? The tide file's contents pasted below:

<?xml version="1.0" encoding="utf-8"?>
<Map Id="test2">
  <Description><![CDATA[]]></Description>
  <TileSheets>
    <TileSheet Id="untitled tile sheet">
      <Description><![CDATA[]]></Description>
      <ImageSource><![CDATA[..\..\..\X\E.png]]></ImageSource>
      <Alignment SheetSize="25 x 18" TileSize="32 x 32" Margin="0 x 0" Spacing="0 x 0" />
      <Properties />
    </TileSheet>
  </TileSheets>
  <Layers />
  <Properties />
</Map>

Ahh okay, I understand you better now. I've rearranged the files to match your question:

image

image

E.png resides in D:\X
test2.tide resides in D:\X\C\B\A\

Here is the tide file's data:

<?xml version="1.0" encoding="utf-8"?>
<Map Id="test2">
  <Description><![CDATA[]]></Description>
  <TileSheets>
    <TileSheet Id="untitled tile sheet">
      <Description><![CDATA[]]></Description>
      <ImageSource><![CDATA[..\..\..\E.png]]></ImageSource>
      <Alignment SheetSize="25 x 18" TileSize="32 x 32" Margin="0 x 0" Spacing="0 x 0" />
      <Properties />
    </TileSheet>
  </TileSheets>
  <Layers />
  <Properties />
</Map>

And here is the error tIDE outputs when trying to open test2.tide

image

To add some more information, I have another file, "test.tide" that resides in D:\X\C\B, and looks for E.png 2 directories up at the same location as the previous .tide file.

<?xml version="1.0" encoding="utf-8"?>
<Map Id="Test">
  <Description><![CDATA[]]></Description>
  <TileSheets>
    <TileSheet Id="generic tile sheet">
      <Description><![CDATA[]]></Description>
      <ImageSource><![CDATA[..\..\E.png]]></ImageSource>
      <Alignment SheetSize="25 x 18" TileSize="32 x 32" Margin="0 x 0" Spacing="0 x 0" />
      <Properties />
    </TileSheet>
  </TileSheets>
  <Layers />
  <Properties />
</Map>

This file opens, no issue.

Next, I will create another directory one folder further down the structure and follow the same pattern now.

image

<?xml version="1.0" encoding="utf-8"?>
<Map Id="Test3">
  <Description><![CDATA[]]></Description>
  <TileSheets>
    <TileSheet Id="generic tile sheet">
      <Description><![CDATA[]]></Description>
      <ImageSource><![CDATA[..\..\..\..\E.png]]></ImageSource>
      <Alignment SheetSize="25 x 18" TileSize="32 x 32" Margin="0 x 0" Spacing="0 x 0" />
      <Properties />
    </TileSheet>
  </TileSheets>
  <Layers />
  <Properties />
</Map>

Here is the error it returns when trying to open it:

image

From this, I think it is safe to assume that so long as the map is further down the file path beyond 2 directories from a tilesheet that it tries to read, it will fail. However, you raise a good question, I had not yet tested the opposite. I shall test this.

I created a test file in a new directory, D:\Red called 'test.tide'. This new directory has subdirectories as shown below:

image

I added several tilesheets to this tide file to test if it appeared to error when loading tilesheets that were deeper embedded in the file structure:

<?xml version="1.0" encoding="utf-8"?>
<Map Id="Test">
  <Description><![CDATA[]]></Description>
  <TileSheets>
    <TileSheet Id="generic tile sheet">
      <Description><![CDATA[]]></Description>
      <ImageSource><![CDATA[Blue\Green\E.png]]></ImageSource>
      <Alignment SheetSize="25 x 18" TileSize="32 x 32" Margin="0 x 0" Spacing="0 x 0" />
      <Properties />
    </TileSheet>
	    <TileSheet Id="generic tile sheet2">
      <Description><![CDATA[]]></Description>
      <ImageSource><![CDATA[Blue\Green\Yellow\F.png]]></ImageSource>
      <Alignment SheetSize="25 x 18" TileSize="32 x 32" Margin="0 x 0" Spacing="0 x 0" />
      <Properties />
    </TileSheet>
	    <TileSheet Id="generic tile sheet3">
      <Description><![CDATA[]]></Description>
      <ImageSource><![CDATA[Blue\Green\Yellow\Orange\G.png]]></ImageSource>
      <Alignment SheetSize="25 x 18" TileSize="32 x 32" Margin="0 x 0" Spacing="0 x 0" />
      <Properties />
    </TileSheet>
  </TileSheets>
  <Layers />
  <Properties />
</Map>

This file loads properly, and loads each of its tilesheets. This organization of tilesheets-in-relation-to-tidemap appears to have no issues.

No apology necessary! Thank you so much for taking the time to look at this with me.

Well, it doesn't halt my work entirely, however it does hinder my ability to organize my map files in such a way where I can nest "sub-areas" maps inside of folders belonging to their "parent areas" folders. I'll just have to settle on a simpler organization scheme.

No problem!

In the event that you do take a look into this, I have one more tidbit of information that may be useful to you: This problem does not persist when a map is loaded and run within an XNA game, it appears to be an issue with the tIDE editor specifically.