[plugin] rex_tmx_importer_v2

Post your completed addons to share with the community

Post » Fri Jun 23, 2017 1:19 am

Update

Now "Expression:ObjectX", "Expression:ObjectY" will shift with "Expression:POX", "Expression:POY".


@justifun

1) added in latest version. But I don't have time to test it carefully.
2) I have no idea about importing tsx files to C2. I guess that it is impossible.
B
108
S
26
G
272
Posts: 4,473
Reputation: 152,281

Post » Fri Jun 23, 2017 1:56 am

@rexrainbow - Thanks! I'll check it out and report back any bugs!

For those of you who might have been trying to figure out multiple maps vs one tileset the workflow i found that works ok is.

Make a tileset and leave it open in tiled. Then create a new Map for each level you want to design. Drag your pieces from the one tile set into your map and design it.

Save a copy of your map seperately then you main one as a backup.

Click the button in the tileset window that says "Embed Tileset into map"

Save your map file into your C2 Project folder

By embedding your tileset into the map file the data will be accessible from the TMX importer. However you need to make sure you make a backup of the TMX map because you want to keep your master map files NOT have the tileset embedded into it, so that you can use the same tileset for all maps.

Not sure how to un-embed a tileset from a map :(
B
87
S
44
G
16
Posts: 1,005
Reputation: 17,938

Post » Sun Jun 25, 2017 10:17 pm

Update: ok after more testing this issue is still present. If you are using objects with custom properties as opposed to tiles, the imported wont pick them up.

@rexrainbow - Hello again!

I still have to verify the new object offset feature you added, but in the mean time i came across another issue with the TMX importer.

When using the Tiled map editor object layer, and you add objects via the "Insert Tile" button (the one that has a little image icon). Any custom properties on these objects will show up in the property window, however they wont be read by the importer

Here's an example.
If I save the file after adding a few tiles, None of the custom properties show up in the tmx data in the <objectgroup> <properties> section where i believe your plugin is looking for them.

However! If you add another random custom property to the object in the map then save it again there is now a new entry in the <objectgroup> at the bottom (its no longer blank), AND the TMX importer now actually reads all the previous custom properties that it was skipping over before.

It appears that If your importer doesn't find a <properties> section within <objectgroup> they it wont load any of the custom properties that are being added to the file via embedding a external tileset even though the data for that is just in a different location in the .tmx file.

Example: File saved with only custom object properties being defined in the tileset
Code: Select all
 <objectgroup name="Object Layer 1">
  <object id="1" gid="1" x="0" y="1400" width="2064" height="401">
  </object>
 </objectgroup>

[/code]

Example: File saved with an extra custom property added before saving
Code: Select all
 <objectgroup name="Object Layer 1">
  <object id="1" gid="1" x="0" y="1400" width="2064" height="401">
   <properties>
    <property name="TestProperty" value="TestData"/>
   </properties>
  </object>
 </objectgroup>


in both examples, up higher in the TMX file the object custom properties are defined but the importer is skipping this data if the <objectgroup> is missing the <properties> section
Code: Select all
  <tile id="0">
   <properties>
    <property name="Damage" type="int" value="1"/>
    <property name="Name" value="LavaPool"/>
    <property name="Solid" type="int" value="1"/>
    <property name="Value" type="int" value="0"/>
   </properties>
   <image width="2064" height="401" source="../Art/Lava_ground.png"/>


it appears as if its a case of how the map editor is saving the file, but perhaps there's a way to make it work with your importer?

I can be found on discord in your channel if you have further questions: @justifun

thanks!
B
87
S
44
G
16
Posts: 1,005
Reputation: 17,938

Post » Mon Jun 26, 2017 5:44 am

@rexrainbow - it seems like this is part of this issue (as is "as intended" by the map editor developer)

https://github.com/bjorn/tiled/issues/1609

It doesnt save that information if the object properties havent changed (on the main map).

So is there a way with your importer to grab the information from the first portion of the TMX file for each tile ID / property instead of looking for it down in the <objectgroup> section at the bottom?

thanks
B
87
S
44
G
16
Posts: 1,005
Reputation: 17,938

Post » Tue Jun 27, 2017 10:11 am

@justifun

Added to TODO.
B
108
S
26
G
272
Posts: 4,473
Reputation: 152,281

Post » Thu Jun 29, 2017 8:27 pm

@justifun

Could you please provide a simple test tmx file for your case?
B
108
S
26
G
272
Posts: 4,473
Reputation: 152,281

Post » Thu Jun 29, 2017 8:49 pm

@rexrainbow - Here's a sample file for you : https://dl.dropboxusercontent.com/u/403 ... forRex.zip

This map is made up of objects instead of regular tiles, and the objects in the tileset have custom properties on them.

the goals is to be able to read those custom property names and values (and ideally the layer name that the objects are on too.

Thanks rex, and let me know if there's anything else you need from me to help.
B
87
S
44
G
16
Posts: 1,005
Reputation: 17,938

Previous

Return to Completed Addons

Who is online

Users browsing this forum: gonzdevour, grodrigues and 2 guests