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

Full Rect MarginContainer does not work fine in the main scene plugin #87412

Closed
DexterFstone opened this issue Jan 20, 2024 · 15 comments
Closed

Comments

@DexterFstone
Copy link

Tested versions

reproducible in 4.2.1.stable

System information

Windows 7, 10, Godot 4.2.1 Stable

Issue description

I tried to make a main scene plugin I put a margin container and made it fully rect but in plugin did not work at all
My scene:
image
result:
image
after that, I added some code to my scene script and now it's better
Code:

@tool
extends Control

@onready var data_container = $DataContainer
@onready var h = data_container.size.y

func _ready():
	await get_tree().create_timer(5).timeout
	data_container.position.y = 0
	data_container.size.y = h

result:
image

but why? Is it a bug or do I miss something?

Steps to reproduce

  1. create a main scene plugin

  2. add the margin container as a child as the control node and make it a full Rect

  3. add a label or anything to show content

  4. Test result
    or

  5. test attached addon

Minimal reproduction project (MRP)

addons.zip

@KoBeWi
Copy link
Member

KoBeWi commented Jan 20, 2024

The MainScreen Control where you add your plugin is a VBoxContainer.
image
You need to set vertical size flags to Fill + Expand to make your node use full size.

I see get_editor_main_screen() already returns a VBoxContainer, but maybe it could use an additional clarification somewhere 🤔

@DexterFstone
Copy link
Author

The MainScreen Control where you add your plugin is a VBoxContainer. image You need to set vertical size flags to Fill + Expand to make your node use full size.

I see get_editor_main_screen() already returns a VBoxContainer, but maybe it could use an additional clarification somewhere 🤔

My Tree:
image

Everything is expanded and fill

@DexterFstone
Copy link
Author

I changed the type of marginContainer to Control node in problem is fix soo margin container has a problem and it is a bug

@KoBeWi
Copy link
Member

KoBeWi commented Jan 21, 2024

You did not fix your problem, but you hid it. The Control has wrong size.

@DexterFstone
Copy link
Author

The Control has wrong size.

which one?

@KoBeWi
Copy link
Member

KoBeWi commented Jan 21, 2024

The one you used instead of MarginContainer. You can see the content correctly, because non-Container nodes don't arrange their children.

@DexterFstone
Copy link
Author

The one you used instead of MarginContainer. You can see the content correctly, because non-Container nodes don't arrange their children.

I changed again to margin container
I want to know fix the problem
Can u edit my attached file and send it again?

@KoBeWi
Copy link
Member

KoBeWi commented Jan 21, 2024

Instead of anchors, use the container sizing menu and set it to vertical fill with expand flag:
image
You need to set it in your root node, it will make it take the full available space.

@DexterFstone
Copy link
Author

Instead of anchors, use the container sizing menu and set it to vertical fill with expand flag: image You need to set it in your root node, it will make it take the full available space.

nothing happened

@KoBeWi
Copy link
Member

KoBeWi commented Jan 21, 2024

addons.zip

@DexterFstone
Copy link
Author

addons.zip

Do u just check Expand? why is your file working but when I do that is not work?

@KoBeWi
Copy link
Member

KoBeWi commented Jan 21, 2024

Enable Expand and then click Fill.

@DexterFstone
Copy link
Author

Enable Expand and then click Fill.

image
image

@KoBeWi
Copy link
Member

KoBeWi commented Jan 21, 2024

Did you set it for the root node? (Control)
Also when you change it, be sure to reload the plugin.

I used the toolbar menu when setting it, but it should be the same using the inspector.

@DexterFstone
Copy link
Author

Did you set it for the root node? (Control) Also when you change it, be sure to reload the plugin.

I used the toolbar menu when setting it, but it should be the same using the inspector.

yes I do
one more thing I tested, I created a new scene and it worked fine so it is a bug but rare

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

No branches or pull requests

3 participants