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

Export categories from parent classes are not reloading, and cause "duplicate categories". #71616

Closed
Frontrider opened this issue Jan 18, 2023 · 11 comments · Fixed by #89631
Closed

Comments

@Frontrider
Copy link

Godot version

4.0 beta 13

System information

Manjaro Linux

Issue description

Export categories from the parent script are not shown unless you reload the project, and can cause the same category name to be duplicated.

The first one is a bug, that needs to be fixed. Categories shouldn't just vanish like that.

The second one is a thing I can't place, personally I'd expect those to be merged instead of getting 2 menus with the same name.

Steps to reproduce

If you extend this script:

extends CharacterBody2D
class_name Speed

@export_category("speed")
@export var speed:int = 1.0:
	set(new_value):
		speed = new_value
	get:
		if(parent_segment != null):
			return parent_segment.speed
		return speed

With this:

extends Speed

@export_category("speed")
@export var turn_speed = 10

Then at first you won't see the category from the parent class, then after a project reload you'll see 2 categories with the name "speed".

Minimal reproduction project

N/A

@KoBeWi
Copy link
Member

KoBeWi commented Jan 18, 2023

It might be related to other script reloading issues. Strange that reloading scene does not help; it usually works.

The second one is a thing I can't place, personally I'd expect those to be merged instead of getting 2 menus with the same name.

The properties are grouped by class first and then by category. That's how inspector is designed; it does not support merging categories between classes.

@KoBeWi KoBeWi added this to the 4.0 milestone Jan 18, 2023
@KoBeWi KoBeWi moved this from To Assess to Todo in 4.x Priority Issues Jan 18, 2023
@Frontrider
Copy link
Author

Frontrider commented Jan 18, 2023

The properties are grouped by class first and then by category. That's how inspector is designed; it does not support merging categories between classes.

Taking that as the answer, but it is something that at least looks like a bug. Someone else will inevitably report it as a bug if left like this.

@YuriSizov
Copy link
Contributor

Categories are not supposed to be used like this at all. They are exposed for your convenience, but categories are designed to represent the class hierarchy. Groups should be used for grouping, and groups only exist within categories. We simply do not recommend using categories frivolously. Also, the list of properties is linear, what you see if what you get, exactly in that order, and respecting the class hierarchy. And that's what we'll say to a potential bug report.

@vnen
Copy link
Member

vnen commented Feb 22, 2023

@YuriSizov is there anything we can do about this? Potentially we could check for a probable misuse of the feature, but all in all it seems to be working as intended.

@Frontrider
Copy link
Author

Can you show an error if the group was duplicated? I think that should be more than enough to "enforce the correct usage", and not have anyone mention it again. :)

@YuriSizov
Copy link
Contributor

YuriSizov commented Feb 22, 2023

We could add a warning if you try to add a category or a (sub)group with the same signature, but otherwise indeed this is working as intended and grouping properties can be duplicated without any repercussions. You just shouldn't expect them to merge.

I guess a warning would be like "child category is shadowing parent category, pay attention"? May want to wait a bit and see if there is a lot of confusion, or if it's just this one report.

@YuriSizov YuriSizov modified the milestones: 4.0, 4.x Feb 22, 2023
@Frontrider
Copy link
Author

I guess a warning would be like "child category is shadowing parent category, pay attention"? May want to wait a bit and see if there is a lot of confusion, or of it's just this one report.

That would be perfect. After the explanation the only issue I see here is that it looks like a bug.

@dalexeev
Copy link
Member

This needs to be re-tested, maybe something has changed after #78254 and #81221.

@KoBeWi
Copy link
Member

KoBeWi commented Oct 17, 2023

Then at first you won't see the category from the parent class, then after a project reload you'll see 2 categories with the name "speed".

The double category shows immediately now
image

@dalexeev
Copy link
Member

Export categories from the parent script are not shown unless you reload the project, and can cause the same category name to be duplicated.

The first one is a bug, that needs to be fixed. Categories shouldn't just vanish like that.

It might be related to other script reloading issues. Strange that reloading scene does not help; it usually works.

The double category shows immediately now

I think the first part regarding script reloading has been fixed, probably by #83123.

The second one is a thing I can't place, personally I'd expect those to be merged instead of getting 2 menus with the same name.

The properties are grouped by class first and then by category. That's how inspector is designed; it does not support merging categories between classes.

I think after a number of PRs this now works properly and categories/groups/subgroups don't conflict with each other and regular properties:

is there anything we can do about this? Potentially we could check for a probable misuse of the feature, but all in all it seems to be working as intended.

Can you show an error if the group was duplicated?

We could add a warning if you try to add a category or a (sub)group with the same signature, but otherwise indeed this is working as intended and grouping properties can be duplicated without any repercussions.

I guess a warning would be like "child category is shadowing parent category, pay attention"?

I think this is no longer necessary since you can now have categories/groups/subgroups duplicated at different inheritance levels.

So, if there is no objection, I suggest closing this issue after merging #89631.

@Frontrider
Copy link
Author

IF nobody has anything else to add, close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants