-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
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
Parallax2D: Repeat size is getting value 2.08165e-12 instead 0 #91631
Comments
@markdibarry what is your OS? |
Win 10. Perhaps it's a Mac issue? |
In the MRP the
@stephannv I'd say one question is how you've ended up with such value in there? 🤔 Note that because of the limited precision of the inspector input fields, it's already shown as But by draging it out and back to
@markdibarry Back to the Parallax2D repeating behavior, does this work as expected? |
I didn't change the X value, it was created with that value by default. I noticed that value on another scene on my project but I didn't give attention to it. I will try to replicate it |
@kleonc I uploaded a video to issue description showing how I got that value. |
@kleonc Yeah that's the expected behavior since it'd never be overlapping with itself with normal use and wouldn't be centered. The repeat should be the same size as the image or larger in most scenarios unless you didn't prepare the image for use with parallax... then you'd need to base it off a region for the sprite. It also needs to be the same size or larger than the screen or the parallax effect is broken, same as Though it is interesting that this is a |
@stephannv This I can't replicate though (v4.3.dev6.official [89850d5], Windows). For me, it's being saved as So indeed could be Mac-specific issue. But could be something else. No clue what exactly, briefly looked at the code ( Also in the video are you using mouse or trackpad? Again not sure if that's relevant but the more info the better. 🙂
Since it's not Parallax2D specific, it means you could potentially check whether the same happens for you in the previous versions. If we'd know since what exact version this started happening it would greatly narrow down where to look for the cause. Also worth noting:
Would need to be investigated / stepped through by someone who can reproduce the issue. |
I'm not sure, I did some tests today, and I noticed that "0.0...00208" is there before I change any value, just hovering the Vector2 on a newly created object and I already got that strange value, but it isn't saved on scene yet, this will be saved only if I change any property (x or y) Screen.Recording.2024-05-08.at.2.32.10.PM.mov
I'm using magic trackpad.
I tried to replicate the issue and found the version where this problem started: 4.0-beta8 (PRs merged | Commits).
Yes, I could reproduce the problem using Vector2, Vector3, Vector4, Transform2D and Transform3D. Here a video: problem.mp4
Yeah, I could reproduce the problem using
I will try to find some pattern, if I find, I will report here. |
Then I'd say it's rather unlikely to be input related.
That's great find, we're down to 150 commits. I've skimmed through the PRs and these catched my eye as potentially suspicious: #65101, #67660. Here's a simple EditorPlugin to output some brief debug info about EditorSpinSliders: Plugin
@tool
extends EditorPlugin
var inspector: EditorInspector
func _enter_tree() -> void:
inspector = get_editor_interface().get_inspector()
inspector.property_selected.connect(on_property_selected)
func _exit_tree() -> void:
inspector.property_selected.disconnect(on_property_selected)
func on_property_selected(property: String) -> void:
var property_editor: EditorProperty = find_property_editor(inspector, property)
if not property_editor.get_class() in [
"EditorPropertyVector2",
]:
return
print("-".repeat(80))
print("property_selected(%s)" % [property])
var property_value: Vector2 = property_editor.get_edited_object().get(property)
print(" %s.x = 0x%s ≈ %50.40f" % [property, f64_to_hex_string(property_value.x), property_value.x])
print(" %s.y = 0x%s ≈ %50.40f" % [property, f64_to_hex_string(property_value.y), property_value.y])
print()
property_editor.print_tree_pretty()
var slider_props_to_list: Array = []
slider_props_to_list.append_array(ClassDB.class_get_property_list("Range", true))
slider_props_to_list.append_array(ClassDB.class_get_property_list("EditorSpinSlider", true))
var spin_sliders := property_editor.find_children("", "EditorSpinSlider", true, false)
for spin_slider: EditorSpinSlider in spin_sliders:
print()
print(spin_slider)
for prop in slider_props_to_list:
var value: Variant = spin_slider.get(prop.name)
if value is float:
print(" %-15s = 0x%s ≈ %50.40f" % [prop.name, f64_to_hex_string(value), value])
else:
print(" %-15s = %s" % [prop.name, value])
print("-".repeat(80))
func find_property_editor(node: Node, property: String) -> EditorProperty:
var to_check: Array[Node] = [node]
while not to_check.is_empty():
var current: Node = to_check.pop_back()
if current is EditorProperty and current.get_edited_property() == property:
return current
to_check.append_array(current.get_children())
return null
func f64_to_hex_string(value: float) -> String:
var bytes := PackedFloat64Array([value]).to_byte_array()
bytes.reverse()
return bytes.hex_encode() Could you show what output you're getting from it e.g. after you select Example output
|
@kleonc I got: On 4.3.dev6
On 4.0-beta7
|
@stephannv Thanks! I don't think Lines 36 to 44 in 45cac42
|
@kleonc updated. I couldn't run on beta7 because |
Oh, indeed But I'd say it already seems like your issue arised because of the changes in #65101.
This tells us that the value within the object is just fine (until after a wrong value from the inspector is saved into the object). So the issue is likely about the EditorSpinSlider.
Here we can see that only the The If we'd use such exact Line 102 in c4279fe
Then the exact result would be But of course the calculations are done with doubles and hence it's done with much less precision. Not sure why exactly would you get such result instead of (Unless you're getting A kinda separate thing: should EditorSpinSlider's default |
@kleonc I updated the logs in my previous comment including 4.0-beta7.
|
Tested versions
v4.3.dev6.official.89850d553
System information
Mac OS 14.2.1 - Vulkan 1.2.275 - Forward Mobile - Using Device #0: Apple - Apple M1 Max
Issue description
When using images with transparency inside a Parallax2D with repeat config enabled, it seems to add the same image 2 times at same position. It can be noticed when using image with some transparency because it gets "darker".
On editor
Running:
@kleonc noticed that problem is due to the repeat size X value. It was stored as
Vector2(2.08165e-12, 500)
insteadVector2(0, 500)
:parallax2d.mp4
Steps to reproduce
Minimal reproduction project (MRP)
mrp.zip
The text was updated successfully, but these errors were encountered: