Comments (12)
Can't reproduce this, it works in my tests.
Could you please zip and append a mini example?
PS had an idea:
Is your (relative) res_path maybe from viewpoint of the project file different to the res_path from viewpoint of the .tmx?
That could be a problem.
from yati.
@al0fdf try exporting the tmx file instead of just saving it
from yati.
@al0fdf : I've tested now different relative paths and that worked too.
So currently without an example of yours I've no clue.
Yet I've only Windows available and not sure what's happening on Linux...
from yati.
@Kiamo2 Here's my reproduction project.
There is a test_object
class created in the custom types editor, with the instance
and res_path
properties set:
In the tiled/map.tmx
level, there are two test_objects
. The properties of the right object, I edited to make sure they are part of the tmx
file. The left object's properties I left as is; they're implied:
Left object(edited properties):
Right object(implied properties):
When running in-game, note that only the left object is correctly instanced, the right remains a static body.
Screenshot:
Here is the zip for the reproduction case:
yati_instacing_repro_project.zip
With the following folder structure:
└── yati_repro_project
├── addons
│ └── YATI
│ ├── CustomTypes.gd
│ ├── DictionaryBuilder.gd
│ ├── DictionaryFromXml.gd
│ ├── Importer.gd
│ ├── plugin.cfg
│ ├── PostProcessing.gd
│ ├── TiledImport.gd
│ ├── TilemapCreator.gd
│ ├── TilesetCreator.gd
│ └── XmlParserCtrl.gd
├── icon.svg
├── icon.svg.import
├── main.gd
├── main.tscn
├── project.godot
├── test_object.tscn
└── tiled
├── map.tmx
├── map.tmx.import
├── propertytypes.json
├── repro.tiled-project
└── tileset.tsx
from yati.
Now it's going to be mysterious.
After setting the project file in the import options for map.tmx (was missing there), everything worked well on my side.
Maybe it's indeed Linux behaving different...?
If so it's going to be a bit difficult for me,
-> I'll try to examine the path building and look for potential weaknesses here.
from yati.
Can't find anything and as the res_path entries in 'map_working.tmx' and 'repro.tiled-project' are identical it's no big surprise that it's working.
But - as you've written "When running in-game...", are you talking about the runtime version?
from yati.
Can't find anything and as the res_path entries in 'map_working.tmx' and 'repro.tiled-project' are identical it's no big surprise that it's working. But - as you've written "When running in-game...", are you talking about the runtime version?
I'm talking about running the godot project from the editor.
from yati.
Aah, you've changed the example zip.
OK, I've tested with the changed example and it also works as soon as I specified the project file in the Project File option and reimported.
Could it be that you simply missed to specify the project file???
Please note, that for Custom Types to be supported the project file is neccessary!
(TBD: Point that out more precise in the docu)
The reason is that Tiled stores its Custom Types in the project file, NOT in the .tmx.
The .tmx only contains the class name.
Unless you overwrite a custom property (not grayed out in Tiled), then it's contained in the .tmx thus the left icon works without project file.
from yati.
@Kiamo2 I have set the project file in the import defaults:
However when creating a new inherited scene based on map.tmx
in the editor, I get:
Import file 'res://tiled/map.tmx'
-- Unknown class 'test_object'. -> Assuming Default
Import finished with 1 warning.
When finding that line(around line 652
in TilemapCreator.gd
), and debug-printing the _ct
variable, I find that it is null
, which could explain why the test_object
class is unknown at that time.
if _ct != null:
_ct.merge_custom_properties(obj, "object")
+ print(_ct)
...
if godot_type == _godot_type.UNKNOWN:
if not _add_class_as_metadata and class_string != "" and not godot_node_type_prop_found:
print_rich("[color=" + WARNING_COLOR +"] -- Unknown class '" + class_string + "'. -> Assuming Default[/color]")
_warning_count += 1
...
Godot's console output of the above code:
Import file 'res://tiled/map.tmx'
<null>
-- Unknown class 'test_object'. -> Assuming Default
<null>
Import finished with 1 warning.
from yati.
_ct being null is indicating that no project file has been loaded.
You may have set it in the importer defaults, but after I loaded your example, the actual Tiled Project File option for map.tmx was empty.
I had explicitly to set it.
Please check if it is set by looking at the import options when the file 'map.tmx' is selected in the file system window on the left.
Like above in the screenshot.
(Godot pecularity: If the Import option tab is blank, select another file and then select 'map.tmx' again)
Maybe the importer defaults have no effect on the currently actually used import options.
from yati.
@Kiamo2 That seems to be the issue. The importer tab does not use the project's default import options. After re-importing the .tmx
with the project file set in map.tmx
's import options, both scenes were correctly instanced!
from yati.
I took a closer look and found out:
- The importer defaults only come into play if no (previous) import has been done for a .tmx, i.e. - no .tmx.import file exists parallel to the .tmx yet.
- After an import, the import options used are saved in the .tmx.import file and then have priority over any changed importer defaults.
I think, this explains the behavior and I consider the issue as resolved.
from yati.
Related Issues (20)
- Godot 4.2 - `TileMap.CellQuadrantSize` got renamed HOT 2
- AstarGrid2D (get_cell_tile_data) does not detect "custom data layer" in Tilset HOT 1
- How do I access raw tile id data? HOT 4
- Error `Can't find file 'uid://byk7emqeyttmh::::res://assets/mytilemap.png'.` HOT 3
- Reimporting multiple maps at once with same tileset results in hundreds to thousands of errors HOT 2
- Please add Object IDs to the imported nodes HOT 6
- Add a way to set the TileSet Texture NormalMap Texture and Specular Texture HOT 5
- Maps in projects exported on macOS are lacking collision data HOT 7
- Can't add multiple Tiles Collision Shapes with different physics_layer HOT 3
- Tile Collision Polygons not updating in Godot. HOT 3
- Make runtime loading compatible with threads ? HOT 2
- Need some help for the c# version HOT 1
- Support TileMapLayer nodes from Godot 4.3 HOT 7
- Error when enabling HOT 5
- GDScript Installation fails with Class "CustomTypes" hides a global script class HOT 6
- Option to import TSX files as an external TileSet resource HOT 6
- Custom Properties defined on object tile definitions do not propogate. HOT 4
- add_id_as_metadata does not work on instance items HOT 3
- Runtime package breaks when project is exported HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yati.