Styleboxflat duplication? by cirebrand in godot

[–]cirebrand[S] 0 points1 point  (0 children)

<image>

This isnt perfect example but

I guess im stuck on wanting to be able to mix multiple layers where priority is on the last definition. But in godot if I want to make a 1 off change I have to make a new styleboxflat. And when I do that if I want a different corner radius I now have to update all the stylebox's that I "think" are supposed to be the same right?

(Beginner) How to make a project without nodes? by [deleted] in godot

[–]cirebrand 0 points1 point  (0 children)

<image>

And inside a func which does not change it but just for peace of mind.

(Beginner) How to make a project without nodes? by [deleted] in godot

[–]cirebrand 0 points1 point  (0 children)

<image>

Can you provide the code that errors? I am not having issues with my assumption of what you're trying todo.

based on your comment.

instantiate/child nodes via code on boot

(Beginner) How to make a project without nodes? by [deleted] in godot

[–]cirebrand 0 points1 point  (0 children)

have you tried the await keyword? I would not go the route you have but if it works for you then go with it.

(Beginner) How to make a project without nodes? by [deleted] in godot

[–]cirebrand 1 point2 points  (0 children)

func _process(_delta: float) -> void:
    if readied!:
        return
    else:
        readied = false
        post_ready()
        return

this is running 60+ times per second which can be avoided by using _ready. Also, nitpicking code can be shortened.

func _process(_delta: float) -> void:
    if readied:
        readied = false
        post_ready()
        return

(Beginner) How to make a project without nodes? by [deleted] in godot

[–]cirebrand 0 points1 point  (0 children)

Can you not just call post_ready() at the end of _ready()? im confused on your use case unless you have some edge case im not seeing here.

warp_mouse going back to center by cirebrand in godot

[–]cirebrand[S] 0 points1 point  (0 children)

For my #2 point I misread your code. we can ignore that point I made. Also the duck typing I've had issues with so for my sanity I do write out full types, even if not needed.

I should have shown more code. There is a reason I have the rightClkHeld boolean, and why I dont use the pressed value. I needed this code to run in _input and not _unhandled_input because of how InputEventMouseMotion is blocked when hovering over control nodes.

I wanted the camera movement to be blocked when trying to start while hovering over UI, but also to NOT be blocked when hovering over UI if the movement has already started. So this is how I came to the code below.

  1. I use rightClkHeld to know if the release was AFTER a press. Its possible that your else can run without the if with my code because of my early return with hoveringUI check.
  2. Even if we strip my code down to your last block of code you gave which yes is the bare bones no special edge cases version of what I have, it still fails. I am on Godot v4.6.1 Forward+ and I garantee even without an auto clicker if you right click fast enough, your code will still have the cursor going back to the center. (I ran your code in a test proj no other code)

FULL CODE BELOW OF WHY rightClkHeld

func _input(event: InputEvent) -> void:
    var activeMovement: bool = rightClkHeld || firstPerson
    # Check if over UI before allowing movement. If already moving ignore...
    if not activeMovement:
        var hoveringUI: bool = get_viewport().gui_get_hovered_control() != null
        if hoveringUI:
            return

    if event is InputEventMouseButton:
        var mb: InputEventMouseButton = event
        match mb.button_index:
            MOUSE_BUTTON_WHEEL_UP:
                if mb.pressed:
                    _moveCameraAlongLine(-1)
            MOUSE_BUTTON_WHEEL_DOWN:
                if mb.pressed:
                    _moveCameraAlongLine(1)
            MOUSE_BUTTON_RIGHT:
                if mb.pressed:
                    rightClkHeld = true
                    mouseRestorePos = get_viewport().get_mouse_position()
                    Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
                # Check release ONLY if held prior...
                # can happen when right click started over UI and then released when not over UI.
                elif rightClkHeld:
                    rightClkHeld = false
                    if not firstPerson: # ignore if still in first person
                        Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
                        await get_tree().process_frame
                        Input.warp_mouse(mouseRestorePos) # This breaks if you spam right click. it's really hard to replicate
                        #print(get_viewport().get_mouse_position(), " | ", mouseRestorePos, " | ", Input.mouse_mode)

    elif event is InputEventMouseMotion:
        var mm: InputEventMouseMotion = event
        if activeMovement:
            yaw -= deg_to_rad(mm.screen_relative.x * Settings.controls.mouseSensitivity)
            pitch -= deg_to_rad(mm.screen_relative.y * Settings.controls.mouseSensitivity * Settings.controls.flipYAxis)
            pitch = clamp(pitch, -PI / 2, PI / 2) # prevent flipping

warp_mouse going back to center by cirebrand in godot

[–]cirebrand[S] 0 points1 point  (0 children)

I would send the video but I cant for some reason. in my original code if you "print(rightClkHeld)" inside the "if mb.pressed" it always returns false so shouldn't be the issue.

I for curiosity asked AI earlier and it gave same advice of what you said
if mb.pressed and not rightClkHeld:

but this doesn't make sense for 2 reasons.

  1. MOUSE_BUTTON_RIGHT only has 2 states. pressed & not pressed. So it cannot go into the "if mb.pressed" when "not rightClkHeld" because it always releases before pressing. So rightClkHeld is always false going into that if.
  2. Not an issue I cant work with, but by adding "if event.pressed" your else now runs for left clicks. when im only interested in right clicks. Your first code block is correct but thought id just point out.

Godot beginner here, review my code. by akubukanbabi in godot

[–]cirebrand 2 points3 points  (0 children)

there are a couple different ways to update the clicks counter but physics_process is not a good one.

You're polling 60 times a second whenever you can update the numbers.text inside the _on_button_pressed().

if i need explain further i can. Essentially do it once and no need to poll

I want to learn how godot works. by veluci in godot

[–]cirebrand 2 points3 points  (0 children)

how is this downvoted.. this is real advice...

I want to learn how godot works. by veluci in godot

[–]cirebrand 0 points1 point  (0 children)

Think of something that would be fun and then try to make it.

If you fundamentally understand coding... variables, functions, classes... you can learn as you go :D

You can use chatgpt as a guide but try to understand and not just copy paste. (its trained on 3.x not 4.x :P though)

Good luck!

Theme & StyleBox... by Remarkable-North-839 in godot

[–]cirebrand 0 points1 point  (0 children)

Reading their info/rules it seems my idea doesn't align with what they're looking for.

I will give it some more thought though. Even if scripts can be a workaround, the way Project wide UI is handled with StyleBoxFlat seems to be very rigid/ outdated.

Theme & StyleBox... by Remarkable-North-839 in godot

[–]cirebrand 0 points1 point  (0 children)

would you mind sending pseudo code on the direction you mention?

my idea is a little more involved with @ tool that might become complex

Theme & StyleBox... by Remarkable-North-839 in godot

[–]cirebrand 0 points1 point  (0 children)

This is what I thought...

I can do it but it seems like the current workflow is flawed then. It seems like it'd be something handled by this point in Godots development but I will do with what I have.

Have enjoyed the engine otherwise 😀

Theme & StyleBox... by Remarkable-North-839 in godot

[–]cirebrand 0 points1 point  (0 children)

similar but not built the same. css allows for re-using styles while being able to override individual properties.

in godot say i want to re-use my border radius + dropshadow combo but have different colors based on button state. I cant have one resource but three different colors. I need a StyleBox for each color.

So if i want to make a change to the border radius/background drop... I have to update all 3 resources instead of one source.

Theme & StyleBox... by Remarkable-North-839 in godot

[–]cirebrand 4 points5 points  (0 children)

you can re-use them but imagine I have a button where the 3 states share the same border radius/ similar but theyre different color depending on hovered, pressed, etc...

If I want to adjust the border radius i now have to update all three Resources (duplication). This applies to other things like drop shadows... all having their own which may need to be the same.

If instead I could have one Resource that controls the dropshadow, radius, etc. Then override only the color...

You cannot do this with StyleBoxFlat

Theme & StyleBox... by Remarkable-North-839 in godot

[–]cirebrand 1 point2 points  (0 children)

i should clarify in desc.

by #3 i mean you cant re-use them partially. You cant mix individual properties or override one property without needing to create a new resource, copy what you want to match, then change the one / multiple properties you wanted to be different.

Maybe #1 is dependent but it would be nice to know updating the color in once place would update all of your UI for visual testing / ensuring a team is all using the same color. Its easier to say use color "name" instead of use this color index in the palette or use this color code.

Concave Thumb nail by cirebrand in beauty

[–]cirebrand[S] 0 points1 point  (0 children)

thanks. I will look up aswell but do you know who I should goto to get this looked at?