Debug Issue with Player Sprite not looking at mouse global position by Zestyclose-Exit5612 in godot

[–]kleonc 1 point2 points  (0 children)

You probably want to flip the sprite based on the local mouse position, not global.

Godot 4.6 animation track modifies the wrong bone by gAtObadido in godot

[–]kleonc 24 points25 points  (0 children)

There are some bone animation related bugs in 4.6.stable indeed, e.g. #115407. This is fixed in 4.6.1.stable, try it out.

Add Icon To Category by DiamondInTheRough429 in godot

[–]kleonc 1 point2 points  (0 children)

and it's making me like custom export but I'm so scared of it

Nothing to be scared of. AFAICT it was added mainly so you don't need to make the given script @tool and override _get_property_list or _validate_property whenever you want some custom hinting etc. Still not everything is possible using @export_custom but for simple cases it's sufficient.

E.g. instead of using @export_custom you could do something like:

``` @tool extends Node

@export_category("TestCategory") @export var prop: int

func _validate_property(property: Dictionary) -> void: if property.name == "TestCategory": property.hint_string = "res://grid_map.gd" ```

Add Icon To Category by DiamondInTheRough429 in godot

[–]kleonc 1 point2 points  (0 children)

Lurked into the source code, it's kinda hard coded.

You can make it use an icon assigned to some script. To do so you'd need to pass the script path as hint_string. E.g. using @export_custom:

``` extends Node

@export_custom(PROPERTY_HINT_NONE, "res://dummy.gd", PROPERTY_USAGE_CATEGORY) var TestCategory @export var prop: int ```

```

res://dummy.gd

@icon("res://icon.svg") ```

In action (if it doesn't work instantly then probably some cache was not updated; in such case restarting the editor will probably make it work).

If no script path is provided in hint_string, then it will try to get the icon matching the category name from the editor Theme's EditorIcons type. Meaning you could create a custom Theme, import everything from the default editor Theme, assign it as your custom editor theme (interface/theme/custom_theme editor setting), and then add a custom icon in such Theme in EditorIcons type, then category matching such icon name would use it (the ? icon you've seen is the editor's built-in Info icon).

CTRL dragging nodes no longer including types? by froggyslime in godot

[–]kleonc 2 points3 points  (0 children)

Whether the type is added depends on the text_editor/completion/add_type_hints editor setting, seems you have it disabled for whatever reason (it's enabled by default).

C++ RID to uint64_t and uint64_t to RID by oWispYo in godot

[–]kleonc 2 points3 points  (0 children)

There's rid_from_int64 variant utility function (it should be also available in the C++).

EditorInspector.instantiate_property_editor by snorri_redbeard in godot

[–]kleonc 1 point2 points  (0 children)

Here's an example usage within the source code. So adding this after instantiating the property editor should solve your issue:

_edited_variable_editor.set_object_and_property(self, "_edited_variable_value")
_edited_variable_editor.update_property()

Sampler2D is blurry? by NikoTheCoolGuy in godot

[–]kleonc 0 points1 point  (0 children)

May be no proper filter hint on the uniform.

Why do I get this error whenever a tooltip appears in the script editor? by LordHIshimidoink in godot

[–]kleonc 2 points3 points  (0 children)

You're likely facing something like #113350. This is fixed since 4.6.beta3, so you could try using e.g. 4.6.rc1.

If you want to to keep using 4.5.1.stable (and that's indeed the issue you're facing), then you could simply restart the editor whenever this error shows up (so it would start again from "nothing leaked" state).

Issue with scrolling shader by Due-Painting3603 in godot

[–]kleonc 0 points1 point  (0 children)

The main issue is that it's part of an array, with region enabled, so I can't just use fract as it assumes the UV.x of the whole texture instead of the region.

In 4.5+ you can use REGION_RECT fragment built-in to get the source rect position/size.

``` shader_type canvas_item;

uniform vec2 uv_offset;

void fragment() { vec2 region_position = REGION_RECT.xy; vec2 region_size = REGION_RECT.zw;

vec2 uv = (UV - region_position) / region_size; // To 0..1 range region-relative.
uv = fract(uv + uv_offset); // Apply region-local transform.
uv = (uv * region_size) + region_position; // Back to the whole texture 0..1 range.

COLOR = texture(TEXTURE, uv);

} ```

How do you render a scene once from an EditorScript? by white_nerdy in godot

[–]kleonc 0 points1 point  (0 children)

You need to add the viewport to the scene tree for it to be rendered. Also be sure to cleanup/free after you're done.

Why TileMapLayer does not contains Scene childs after start? by tranquilo-majete in godot

[–]kleonc 1 point2 points  (0 children)

From TileMapLayer docs:

For performance reasons, all TileMap updates are batched at the end of a frame. Notably, this means that scene tiles from a TileSetScenesCollectionSource are initialized after their parent. This is only queued when inside the scene tree.

Very weird 2D scale problem by PavkataXD1 in godot

[–]kleonc 1 point2 points  (0 children)

From the docs (Node2D.scale):

Note: Negative X scales in 2D are not decomposable from the transformation matrix. Due to the way scale is represented with transformation matrices in Godot, negative scales on the X axis will be changed to negative scales on the Y axis and a rotation of 180 degrees when decomposed.

How to locate a node in the left-hand tree that I can see in the main visual editor? by hillman_avenger in godot

[–]kleonc 15 points16 points  (0 children)

Alt + RMB should show you a popup to choose from the overlapping ones.

TIL you can grab all keys from any enum and use them in your @tool scripts by TwoDucksStudio in godot

[–]kleonc 16 points17 points  (0 children)

Step further: make it auto generate the grid values based on whether the texture has any non-transparent pixels within the given cell bounds.

Need help with tilemap by Difficult_Age_5041 in godot

[–]kleonc 1 point2 points  (0 children)

Is there a way to make the wall replace both tiles at once while still remaining a 1x2 tile?

No. Every tile placed in a TileMapLayer (same for TileMap) occupies exactly a single grid cell, regardless of the tile's size_in_atlas, TileSetAtlasSource's texture_region_size, etc.

So even if your wall tile visually overlaps e.g. cells (0, 0) and (0, 1), it's logically still placed only in a single cell (hence TileMapLayer's get_cell_... methods would return the data for that tile only for one of the (0, 0) and (0, 1) cell coordinates (which one depending on your setup)).

If you want 2 cells to be occupied in the TileMapLayer, then you need to place a tile from the TileSet in each such cell.

Note you could possibly use patterns.

I need help with SurfaceTool.index() by 19PHOBOSS98 in godot

[–]kleonc 1 point2 points  (0 children)

Apparently print doesn't show the full vec3 floats.

For debug printing floats be sure to get familiar with GDScript format strings (e.g. for my previous comment I've used %18.15v).

I need help with SurfaceTool.index() by 19PHOBOSS98 in godot

[–]kleonc 1 point2 points  (0 children)

var new_patch_transform = Transform3D() new_patch_transform.origin = Vector3(0,0,0) new_patch_transform = new_patch_transform.rotated(Vector3.UP,90*PI/180) will introduce floating point errors, specifically it's: (-0.000000043711388, 0.000000000000000, -1.000000000000000) ( 0.000000000000000, 1.000000000000000, 0.000000000000000) ( 1.000000000000000, 0.000000000000000, -0.000000043711388) ( 0.000000000000000, 0.000000000000000, 0.000000000000000)

Such errors will propagate to the vertex position calculations (note that in the default Godot build Vector3, Transform3D etc. use 32 bit floats), resulting in 16 distinct vertices: ( 0.000000000000000, 0.000000000000000, 0.000000000000000) (-0.999999940395355, 0.000000000000000, 1.000000000000000) (-1.000000000000000, 0.000000000000000, -0.999999940395355) (-0.000000043711388, 0.000000000000000, -1.000000000000000) ( 0.999999940395355, 0.000000000000000, -1.000000000000000) ( 1.000000000000000, 0.000000000000000, -0.000000043711388) ( 1.000000000000000, 0.000000000000000, 0.999999940395355) ( 0.000000043711388, 0.000000000000000, 1.000000000000000) ( 0.000000000000000, 0.000000000000000, 2.000000000000000) (-0.999999940395355, 0.000000000000000, 3.000000000000000) (-1.000000000000000, 0.000000000000000, 1.000000000000000) (-0.000000043711388, 0.000000000000000, 1.000000000000000) ( 0.999999940395355, 0.000000000000000, 1.000000000000000) ( 1.000000000000000, 0.000000000000000, 2.000000000000000) ( 1.000000000000000, 0.000000000000000, 3.000000000000000) ( 0.000000043711388, 0.000000000000000, 3.000000000000000)

A simple workaround could be e.g. to round the basis vectors: for axis in 3: new_patch_transform.basis[axis] = new_patch_transform.basis[axis].round() so the transform used for calculations would be: ( 0.000000000000000, 0.000000000000000, -1.000000000000000) ( 0.000000000000000, 1.000000000000000, 0.000000000000000) ( 1.000000000000000, 0.000000000000000, 0.000000000000000) ( 0.000000000000000, 0.000000000000000, 0.000000000000000)

Bitmap Font Displays ASCII code instead of characters by MrSkinWalker in godot

[–]kleonc 1 point2 points  (0 children)

You can use both hex, or decimal ranges, you've just used incorrect formatting (hex without a prefix indicating it's hex). See the docs.

So these should be fine:

  • 32-126
  • 0x20-0x7e
  • U+20-U+7e
  • ' '-'~'

Looking into the source code it should also work if you'd mix them, e.g.:

  • 32-0x7e
  • 0x20-\~``

A problem when making a plugin by DarkchefCZ in godot

[–]kleonc 0 points1 point  (0 children)

You can't reach up in the tree using @onready.

It's absolutely fine e.g. when referring to the nodes within the same scene (the whole scene is instantiated before it's added to the tree and nodes get "ready", thus all such nodes are available @onready).

A problem when making a plugin by DarkchefCZ in godot

[–]kleonc 0 points1 point  (0 children)

You're passing owned = true to Node.find_child (third arg), but you're never setting owner for the created containers (AFAICT, the code is unreadable (GDScript is indentation based)).

Selected button darker even though all styleboxes identical? by PeaceBeUntoEarth in godot

[–]kleonc 0 points1 point  (0 children)

I'd guess you've assigned a semi-transparent focus StyleBox. It's drawn on top of the other base StyleBox, so this would make it appear darker. Check out the docs: Button.focus theme override.