Skip to content
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

Fixed drag and drop not respecting type on exported arrays. #50805

Conversation

EricEzaM
Copy link
Contributor

@EricEzaM EricEzaM commented Jul 24, 2021

See #50718

Before: drag and drop of invalid type was allowed, and also created empty value in array.

cWuoR4dhIw.mp4

After: drag and drop not allowed in the first place.

Rc3HX4Ljvd.mp4

@YeldhamDev YeldhamDev added this to the 4.0 milestone Jul 24, 2021
@AaronRecord
Copy link
Contributor

I'm not sure that's the right "See also"...

@EricEzaM
Copy link
Contributor Author

Lol, fixed. Sometimes github throws a fit when trying to autocomplete issues numbers and it puts the wrong one in when I paste the number.

@EricEzaM EricEzaM force-pushed the fix-exported-arrays-drag-and-drop-types branch from c9b6d9c to e519ef3 Compare October 1, 2021 08:17
@EricEzaM
Copy link
Contributor Author

EricEzaM commented Oct 1, 2021

Rebased & retested, still works as intended.

// When the subtype is of type Object, an additional subtype may be specified in the hint string
// (e.g. Resource, Texture2D, ShaderMaterial, etc). We want the allowed type to be that, not just "Object".
if (subtype == Variant::OBJECT && subtype_hint_string != "") {
allowed_type = subtype_hint_string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure that subtype_hint_string will always be a valid object type?

What about these for example:

scene/main/canvas_item.cpp
959:    ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "CanvasItemMaterial,ShaderMaterial"), "set_material", "get_material");

scene/resources/environment.cpp
1358:   ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "adjustment_color_correction", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D,Texture3D"), "set_adjustment_color_correction", "get_adjustment_color_correction");

Or possible use of the weird 17/17:RichTextEffect syntax (currently seen on Variant::ARRAY but who knows..).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah so this is for the array editor, those appear to just be normal properties. The "Subtype" is the first number before the / I believe, and at the moment that is only ever for Variant::OBJECT. (currently 21)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like discussed before this should really be changed, but for now this resolves it, lol.

@akien-mga akien-mga merged commit 93cb71c into godotengine:master Oct 1, 2021
@akien-mga
Copy link
Member

Thanks!

@EricEzaM EricEzaM deleted the fix-exported-arrays-drag-and-drop-types branch October 5, 2021 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants