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

Dynamically load assets from point data with pre-defined meshes #215

Closed
kb173 opened this issue Apr 7, 2020 · 9 comments
Closed

Dynamically load assets from point data with pre-defined meshes #215

kb173 opened this issue Apr 7, 2020 · 9 comments
Assignees
Labels
needs testing Possibly fixed, but requires verification by others

Comments

@kb173
Copy link
Member

kb173 commented Apr 7, 2020

Once boku-ilen/geodot-plugin#21 is done, we can easily retrieve point data from e.g. a shapefile. We want to be able to load assets (meshes) based on such point data. Which specific mesh is used often depends on an attribute of the point.

@kb173 kb173 added the enhancement New feature or request label Apr 7, 2020
@kb173 kb173 added this to the Version 0.5 - Winter Waterfall milestone Apr 7, 2020
@kb173 kb173 self-assigned this Apr 7, 2020
@kb173
Copy link
Member Author

kb173 commented Apr 14, 2020

In da9e3cc, a node was added which can load different assets based on the value of an attribute in GeoPoints from a Shapefile.

This was implemented for power poles:

image

The same can be done for other shapefiles pretty easily - you just need to set an attribute and map its possible values to PackedScenes.

It would theoretically be nice to expose this even further, to something like a config json. However, we have to implement the Asset in the editor anyways (to allow additional functionality and because of the challenge of importing meshes at runtime), so I'm not sure if that's feasible...

@kb173
Copy link
Member Author

kb173 commented Jul 17, 2020

This is on hold since it will be largely solved by the layer rewrite. Keeping the issue open to ensure that this functionality will be fully included.

@MathiasBaumgartinger
Copy link
Contributor

Related to #236 and #230

@kb173
Copy link
Member Author

kb173 commented Dec 21, 2020

The implementation of this as an ObjectLayer needs to be finished.

@kb173
Copy link
Member Author

kb173 commented Feb 16, 2021

The ObjectLayer functionality for rendering objects is now finished. Leaving this open until the UI is adapted as well.

@MathiasBaumgartinger
Copy link
Contributor

MathiasBaumgartinger commented Feb 17, 2021

Since i don't really find any example/documentation on how to use it, I am going to request a bit of help here @kb173.

I will clasically obtain metadata via get_selected_metadata() then will create a FeatureLayer representing the points, right?

EDIT: Just found a snippet of this - sorry.

@kb173
Copy link
Member Author

kb173 commented Feb 17, 2021

For future reference I'll just post the example here as well:

    # Test Point Data
    var windmill_layer = FeatureLayer.new()
    var windmill_dataset = Geodot.get_dataset("/home/karl/Downloads/ooe_point_test.shp")
    windmill_layer.geo_feature_layer = windmill_dataset.get_feature_layer("ooe_point_test")
    windmill_layer.render_type = Layer.RenderType.OBJECT
    windmill_layer.render_info = Layer.ObjectRenderInfo.new()
    windmill_layer.render_info.object = preload("res://Objects/WindTurbine/GenericWindTurbine.tscn")
    windmill_layer.render_info.ground_height_layer = height_layer.clone()
    windmill_layer.name = "Windmills"

@MathiasBaumgartinger MathiasBaumgartinger added needs testing Possibly fixed, but requires verification by others and removed enhancement New feature or request labels May 25, 2021
@MathiasBaumgartinger
Copy link
Contributor

Functionality for this is here - marking it as needs-testing.

@kb173
Copy link
Member Author

kb173 commented Jul 14, 2021

This has been tested for a while now, and it was even extended to work with dynamically loaded OBJ meshes in 681d5f4. Both methods seem stable and the result looks as expected.

@kb173 kb173 closed this as completed Jul 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs testing Possibly fixed, but requires verification by others
Projects
None yet
Development

No branches or pull requests

2 participants