-
-
Notifications
You must be signed in to change notification settings - Fork 580
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
Added property info for Object's and Ref's and ported the implementation of the check
method
#950
Added property info for Object's and Ref's and ported the implementation of the check
method
#950
Conversation
Rebased to master. Now it should build without problems. |
Do I need to do something else to continue the review? |
This is spot on, but I am unsure how we can further reduce code duplication within some of those bindings files that are not generated. |
Macros can be used here. All 3 #define VARIANT_OBJECT_CAST(impl) \
template <class T> \
struct VariantCaster impl { \
static _FORCE_INLINE_ T cast(const Variant &p_variant) { \
using TStripped = std::remove_pointer_t<T>; \
if constexpr (std::is_base_of<Object, TStripped>::value) { \
return Object::cast_to<TStripped>(p_variant); \
} else { \
return p_variant; \
} \
} \
}
// Will produce a warning. Error when building for Windows with godot-cpp's CI.
VARIANT_OBJECT_CAST();
VARIANT_OBJECT_CAST(<T &>);
VARIANT_OBJECT_CAST(<const T &>); But there will still be a bunch of duplicated code nearby. I'll leave my changes here as is. |
check
method
After the rebase, I removed the examples here, but I think this is not a problem because one of them has already been merged in another PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the changes to use appropriate hint string (as in upstream godot).
The class_name
is then copied automatically from the hint_string
in make_property_info
.
Done. |
Do I need to do something else? |
I would also really like to see those kind of convenience fixes land in godot-cpp soon |
Thanks! |
Supersedes #810
Rebased and fixed. Also added
PropertyInfo
forRef<T>
#948 is required for a successful build