Skip to content

Reduce usage of Dictionary classes around the codebase. #72

@nemerle

Description

@nemerle

Many classes return Dictionaries instead of more specific structs:

Dictionary PhysicsDirectSpaceState3D::_intersect_ray
...
    Dictionary d;
    d["position"] = inters.position;
    d["normal"] = inters.normal;
    d["collider_id"] = Variant::from(inters.collider_id);
    d["collider"] = Variant(inters.collider);
    d["shape"] = inters.shape;
    d["rid"] = inters.rid;

    return d;
}

this could be very well be replaced by something like:

struct IntersectResult {
Vector3 position;
Vector3 normal;
ObjectID collider_id;
Object *collider;
int shape;
RID rid;
};
IntersectResult PhysicsDirectSpaceState3D::_intersect_ray(...)

and MethodBinder::bind_method would need to handle decoding/encoding such structs.

The two main issues are caused by bound methods:

  • Some invocations are queued for later execution ( thus their arguments need to be serialized, and return value deserialized ).
  • The script language inter-op does not handle passing generic 'structs'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions