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

Fix pink GradientTexture2D #94744

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

matheusmdx
Copy link
Contributor

@matheusmdx matheusmdx commented Jul 25, 2024

Fix #93759, needs #94864 first.

This pr apply the suggested changes here: #93759 (comment)

@AThousandShips AThousandShips added bug cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release topic:core topic:2d labels Jul 25, 2024
@AThousandShips AThousandShips added this to the 4.4 milestone Jul 25, 2024
@akien-mga akien-mga requested a review from KoBeWi July 25, 2024 17:27
@akien-mga
Copy link
Member

There's the same const_cast for GradientTexture1D.

@KoBeWi added it in #81137, so it would be important to understand why.

@KoBeWi
Copy link
Member

KoBeWi commented Jul 25, 2024

I think that update_now() is supposed to prepare the texture in case you want to get the image while an update is still queued.

EDIT:
Yep, this brings back #66627

@rune-scape
Copy link
Contributor

rune-scape commented Jul 25, 2024

see my suggested fix: #93759 (comment)

@matheusmdx
Copy link
Contributor Author

see my suggested fix: #93759 (comment)

I tried to apply this changes but i'm getting an error when i compile, most probably i'm doing something wrong:


gradient_texture.h:
Captura 2024-07-26 13-05-52-302452
Captura 2024-07-26 13-06-20-210124


gradient_texture.cpp:
Captura 2024-07-26 13-06-36-204074

Captura 2024-07-26 13-07-07-472456

Sorry if is some silly error, i'm don't have much knowledge of c++

@rune-scape
Copy link
Contributor

ive made the same changes and didn't get any compiler error
the error output would be helpful,
keep in mind theres GradientTexture1D and GradientTexture2D and they both have a const_cast

@matheusmdx
Copy link
Contributor Author

@rune-scape I pushed my changes for this pr can you check the tests results?

@rune-scape
Copy link
Contributor

whoa, i swear i thought i compiled it, but ya im getting the same cryptic errors
i think theres a missing create_custom_callable_function_pointer function for const methods that return void .. in callable_method_pointer.h

@rune-scape
Copy link
Contributor

made a PR (#94864) that fixes that problem and tested that these changes compile with that change

@@ -172,14 +172,13 @@ RID GradientTexture1D::get_rid() const {
}

Ref<Image> GradientTexture1D::get_image() const {
const_cast<GradientTexture1D *>(this)->update_now();
Copy link
Contributor

Choose a reason for hiding this comment

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

this and the other call to update_now() should still be here, just as a regular method call without the const_cast

@matheusmdx matheusmdx force-pushed the fix-pink-gradient2d branch 2 times, most recently from 510d6f3 to cd2c37e Compare July 28, 2024 12:53
@matheusmdx
Copy link
Contributor Author

Changes done, i also updated the pr description to inform about #94864

@akien-mga
Copy link
Member

Can be rebased as #94864 was just merged.

@matheusmdx
Copy link
Contributor Author

Done

@akien-mga akien-mga removed the cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release label Sep 26, 2024
@akien-mga
Copy link
Member

Note for release management: To cherry-pick this to 4.3, #94864 would need to be cherry-picked first.

@akien-mga akien-mga merged commit f8f2ab6 into godotengine:master Sep 26, 2024
19 checks passed
@akien-mga
Copy link
Member

Thanks!

@matheusmdx matheusmdx deleted the fix-pink-gradient2d branch September 26, 2024 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release topic:core topic:2d
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Creating a new Gradient2D resource shows up as pink
5 participants