Skip to content
This repository was archived by the owner on Jul 21, 2026. It is now read-only.
This repository was archived by the owner on Jul 21, 2026. It is now read-only.

@export defaults for Rect2/Transform2D are always zeroed in the Inspector #67

Description

@dev-parkins

Summary

The default-value parser for exported properties handles Vector2/Color struct-literal defaults correctly, but for Rect2 and Transform2D it unconditionally returns a hardcoded zeroed value regardless of what the script actually authored. Any script declaring e.g. @export let mut r: Rect2 = Rect2 { position: Vector2 { x: 10.0, y: 10.0 }, size: Vector2 { x: 64.0, y: 64.0 } }; will show (0,0)/(0,0) in the Godot Inspector instead of the authored default.

Location

crates/runtime/src/lib.rs, in the default-value-string parser (~line 682):

// TODO: Rect2, Transform2D (complex struct literals)
// For now, return type defaults
"Rect2" => Value::Rect2 {
    position: Box::new(Value::Vector2 { x: 0.0, y: 0.0 }),
    size: Box::new(Value::Vector2 { x: 0.0, y: 0.0 }),
},
"Transform2D" => Value::Transform2D {
    position: Box::new(Value::Vector2 { x: 0.0, y: 0.0 }),
    rotation: 0.0,
    scale: Box::new(Value::Vector2 { x: 1.0, y: 1.0 }),
},

Compare to the Vector2/Color cases immediately above, which correctly parse the nested field values out of the default-value string.

Expected

Rect2/Transform2D default parsing should follow the same nested-field-parsing pattern already implemented for Vector2/Color in the same function, rather than discarding the authored default.

Why it matters

User-visible bug: any exported Rect2/Transform2D property with a non-zero default silently shows the wrong value in the Inspector. Not currently caught by the ferris-test integration corpus because no test asserts on Inspector default values — worth adding one alongside the fix. Found during a broader technical-debt review of the v0.0.5 release.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2-MediumMedium priority tasks for regular workflowbugSomething isn't workinggodot-bindRelated to Godot GDExtension bindingsruntimeRelated to runtime crate (execution environment)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions