Giter Site home page Giter Site logo

Comments (12)

Kiamo2 avatar Kiamo2 commented on August 26, 2024

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.

erniel avatar erniel commented on August 26, 2024

@al0fdf try exporting the tmx file instead of just saving it

from yati.

Kiamo2 avatar Kiamo2 commented on August 26, 2024

@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.

al0fdf avatar al0fdf commented on August 26, 2024

@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:
image

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):
image
Right object(implied properties):
image

When running in-game, note that only the left object is correctly instanced, the right remains a static body.
Screenshot:
image

The remote tree view:
image

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.

Kiamo2 avatar Kiamo2 commented on August 26, 2024

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.

Kiamo2 avatar Kiamo2 commented on August 26, 2024

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.

al0fdf avatar al0fdf commented on August 26, 2024

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.

Kiamo2 avatar Kiamo2 commented on August 26, 2024

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.

screenshot

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.

al0fdf avatar al0fdf commented on August 26, 2024

@Kiamo2 I have set the project file in the import defaults:

image

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.

Kiamo2 avatar Kiamo2 commented on August 26, 2024

_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.

al0fdf avatar al0fdf commented on August 26, 2024

@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.

Kiamo2 avatar Kiamo2 commented on August 26, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.