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

Change set_limit_target property type from NodePath to Node2D #343

Open
zen14774 opened this issue Jun 29, 2024 · 3 comments
Open

Change set_limit_target property type from NodePath to Node2D #343

zen14774 opened this issue Jun 29, 2024 · 3 comments
Labels
2D Issues concerning 2D scenes enhancement New feature or request phantom camera Related to PhantomCamera nodes

Comments

@zen14774
Copy link

Project Type

2D

Feature Description

In the previous version I was using set_limit_node to change the limits dynamically. However, the function in 0.7 set_limit_target takes a NodePath. That's a problem because the node I was using is not in the scene and doesn't have a path.

I can of course set the limits directly with set_limit... or add the node and then remove it after updating the limits, but I was wondering if the function couldn't just take a Node like it did in the previous version.

Anyway, just a suggestion for your consideration. Also, thank you again for such a useful add-on.

Use Cases

What I mentioned.

(Optional) Proposed Solution

No response

@ramokz
Copy link
Owner

ramokz commented Jun 30, 2024

It was a change that I did not want to do, but can't see how to get around it with a similar developer experience as pre-0.7.

Unlike the previous property system, the @export property approach doesn't currently allow for filtering the node types you can set from the inspector.
But you can with NodePaths by using @export_node_path. I could have changed it to a Node2D, and then apply a warning in the editor if the node wasn't either a TileMap or Area2D, but felt that the developer experience would suffer by showing all Node2D in a scene if you're setting it via the editor.

That said, if you feel that it's blocking you, then I could potentially change it to a Node2D instead of NodePath in 0.8 as a breaking change in preparation for any future Godot @export filtering support.

Though, I'm curious about how you went about setting the node to the limit previously and why the node you're referencing isn't in the scene given the issue you're running into?

@zen14774
Copy link
Author

About my use case: I have some scenes that have large tilemaps where I want to set limits to cover only a fixed size region of the whole map, but the exact position is dynamic so I was calculating it from code, then creating a collision shape and placing it where I want, then update the limits with area.camera.set_limit_node(collision).

Like I said, I can calculate the limits directly as I know the position and set them with set_limit_top, etc. The only thing about the previous version is that it was a cleaner way to handle it, but it's not blocking me at all as it's easy to work around.

Maybe if they add union types at some point the function could be extended to take either path or node. It could be a separate function, but I don't think it's worth adding just for my weird use case when it's so easy to work around it.

@ramokz
Copy link
Owner

ramokz commented Jul 2, 2024

Gotcha, yeah, I would prefer to keep it the way it is currently to minimise breaking changes.
I think if or when Godot supports the @export node type filtering, then I'll add it back in again.

Will keep the issue open until then as a reminder.

@ramokz ramokz added enhancement New feature or request phantom camera Related to PhantomCamera nodes 2D Issues concerning 2D scenes labels Jul 2, 2024
@ramokz ramokz changed the title set_limit_target changed behaviour in 0.7 Change set_limit_target property type from NodePath to Node2D Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2D Issues concerning 2D scenes enhancement New feature or request phantom camera Related to PhantomCamera nodes
Projects
None yet
Development

No branches or pull requests

2 participants