Skip to content

26.3.beta.1 - Traits - Cannot use exported groups/categories in multiple traits being used by the same class #1395

Description

@BLOKBUSTR

Tested versions

Tested in 26.3.beta.1, both standard and Mono versions.
Versions below 26.3 are inapplicable.

System information

Redot v26.3.beta.1.mono - macOS Sonoma (14.2.1) - Multi-window, 2 monitors - Metal (Forward+) - integrated Apple M1 (Apple7) - Apple M1 (8 threads) - 16.00 GiB memory

Issue description

I was attempting to create exported properties for multiple traits. When creating a class implementing multiple traits, the traits' exported properties are ordered below the class's:

Image
I highlighted the single exported property of my class; the rest of the properties are from two different traits, "EntityHealth" and "EntityStamina" respectively.

My issue began when I wanted to use @export_group() in my class to categorize exported node references under a group. However, this also groups the traits' exported properties, causing them to be disorganized for my purpose.


What I expected:

I attempted to solve this by adding more @export_group() lines within the traits themselves. Here is a mockup of what I intended the final result to be:

Image

What actually happened:

Once I used @export_group() in multiple traits that were being used by the same class, the parser generated this error from the class:

Parse Error: Can not use "EntityStamina" trait since it shadows members from previous traits.

I also tested this with @export_category() and @export_subgroup() in both traits, and they produce the same error. It even throws the error when I define @export_group() in one trait, and @export_category() in another, as an example.

I have tested all other export types available, except @export_tool_button(), but none of them contributed to the error.

I was a little uncertain at first whether I should've made a bug report for this, since I don't fully know the intended behavior behind this, but my reasoning for writing this report anyway is because this is something that happened contrary to my expectations.

Steps to reproduce

Copy the following script. Comment/uncomment the T_B trait implementation and the different @export_group() and @export_category() lines to observe different combinations producing the same error:

extends Node
uses T_A#, T_B
# Uncomment the implementation of the T_B trait above to produce this error:
# Parse Error: Can not use "T_B" trait since it shadows members from previous traits.

trait T_A:
    @export_group("Trait A")
    @export var test_a: int

trait T_B:
    # Groups and categories also cannot coexist with each other between traits.
    @export_category("Trait B")
    #@export_group("Trait B")
    @export var test_b: int

Minimal reproduction project (MRP)

Supplied with above script.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions