File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -294,6 +294,15 @@ func (instance *instanceImplementation) PropertyCanRevert(name gd.StringName) bo
294294 }); ok {
295295 return bool (impl .PropertyCanRevert (name .String ()))
296296 }
297+ // When only PropertyGetRevert is implemented, a non-nil revert value implies the
298+ // property can be reverted (Godot calls _property_can_revert before _property_get_revert).
299+ if impl , ok := val .(interface {
300+ PropertyGetRevert (string ) any
301+ }); ok {
302+ if impl .PropertyGetRevert (name .String ()) != nil {
303+ return true
304+ }
305+ }
297306 sname := name .String ()
298307 rtype := reflect .TypeOf (val ).Elem ()
299308 field , ok := rtype .FieldByName (sname )
@@ -318,10 +327,11 @@ func (instance *instanceImplementation) PropertyGetRevert(name gd.StringName) (g
318327 return gd.Variant {}, false
319328 }
320329 if impl , ok := val .(interface {
321- PropertyGetRevert (string ) ( any , bool )
330+ PropertyGetRevert (string ) any
322331 }); ok {
323- val , ok := impl .PropertyGetRevert (name .String ())
324- return gd .NewVariant (val ), ok
332+ if v := impl .PropertyGetRevert (name .String ()); v != nil {
333+ return gd .NewVariant (v ), true
334+ }
325335 }
326336 sname := name .String ()
327337 rtype := reflect .TypeOf (val ).Elem ()
You can’t perform that action at this time.
0 commit comments