godot-proposals icon indicating copy to clipboard operation
godot-proposals copied to clipboard

Make "Show Behind Parent" CanvasItem property inherit from its parent node

Open CsloudX opened this issue 1 year ago • 2 comments
trafficstars

Describe the project you are working on

NoGame-APP

Describe the problem or limitation you are having in your project

image

Look, i want the ArmL was child of Body, so I add it to the Body i want ArmL behind Body, so I set ArmL's Show behind parent to true. it OK.

and now, I want ForeArmL was a child of ArmL and behind Body too. there was 2 way:

  1. set the ForeArmL's zindex to -1 --> It will cause other sprite that zindex==0 draw middle of the Player.
  2. use the remote transform node --> Yes, it work, but IMO inherit show behind parent was a better way.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Use remote transform node, it has 2 point I don't like:

  1. it broken my sprites's tree relationship. not better make sense.
  2. if i have much sprite, it need add much remote transform nodes.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

let propety show behind parent was inherit. it mean: if I set ArmL's show behind parent, because ForeArmL was a child of ArmL, so ArmL and ForeArmL will behind Body. treat ArmL and it children as a whole.

For me, most situation was need this feature.

If this enhancement will not be used often, can it be worked around with a few lines of script?

No, I need remote transform node to do this.

Is there a reason why this should be core and not an add-on in the asset library?

It should be core.

CsloudX avatar Jul 26 '24 12:07 CsloudX

This would be opt-in I assume? A new option? Otherwise this would break compatibility

AThousandShips avatar Jul 26 '24 13:07 AThousandShips

image

Look, i want the ArmL was child of Body, so I add it to the Body i want ArmL behind Body, so I set ArmL's Show behind parent to true. it OK.

and now, I want ForeArmL was a child of ArmL and behind Body too.

Seems like there's some misconception in here, as CanvasItem.show_behind_parent already does affect the rendering order of the given CanvasItem and its whole subtree (its children, childrens' children, etc.; respecting other settings like z_index etc.).

So assuming that Body, ArmL and ForeArmL in the example above have default settings like z_index, y_sort_enabled , top_level, then setting ArmL.show_behind_parent = true will already make ForeArmL be drawn behind the Body.

Setup Order
ytwLvLYrsp
all default settings
1. Hip
2. Body
3. ArmL
4. ForeArmL
as above
+ ArmL.show_behind_parent = true
1. Hip
2. ArmL
3. ForeArmL
4. Body

I guess what you actually want is for it to be drawn also behind the Hip? :thinking:

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

let propety show behind parent was inherit. it mean: if I set ArmL's show behind parent, because ForeArmL was a child of ArmL, so ArmL and ForeArmL will behind Body. treat ArmL and it children as a whole.

So AFAICT it already works like that, thus not sure what change is actually being proposed in here. :upside_down_face:

kleonc avatar Jul 28 '24 15:07 kleonc

@kleonc Oh, Sorry, My fault. yes, it was work fine that I want.

I guess what you actually want is for it to be drawn also behind the Hip? 🤔

Yes, I want this, i'm not notice the hip. i look it wrong with body, sorray again. thanks again.

CsloudX avatar Jul 29 '24 06:07 CsloudX