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

map_ninepatch_axis() fix #34704

Closed
wants to merge 1 commit into from
Closed

map_ninepatch_axis() fix #34704

wants to merge 1 commit into from

Conversation

lucypero
Copy link
Contributor

Not all control paths return in the function map_ninepatch_axis(). Removing an if fixes it.

@akien-mga
Copy link
Member

akien-mga commented Dec 30, 2019

What does this actually fix? Are you just trying to solve a compiler/static checker warning?

Those two uniforms are set via NinePatchRect's axis_stretch_{horizontal,vertical} properties, which indeed only take values 0 (stretch), 1 (tile) and 2 (tile fit):

ADD_GROUP("Axis Stretch", "axis_stretch_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "axis_stretch_horizontal", PROPERTY_HINT_ENUM, "Stretch,Tile,Tile Fit"), "set_h_axis_stretch_mode", "get_h_axis_stretch_mode");
ADD_PROPERTY(PropertyInfo(Variant::INT, "axis_stretch_vertical", PROPERTY_HINT_ENUM, "Stretch,Tile,Tile Fit"), "set_v_axis_stretch_mode", "get_v_axis_stretch_mode");

Please also try to write more explicit commit messages, "fix" and the name of a static method deep in the backend doesn't give us much information on what this commit actually does. A commit log should describe the bug that it fixes, so that we can easily understand it without having to read the code. See https://github.com/godotengine/godot/blob/master/CONTRIBUTING.md#format-your-commit-logs-with-readability-in-mind

@reduz
Copy link
Member

reduz commented Dec 30, 2019

Oh sorry, I asked him to submit this fix. Technically this is not a bug because it will never go via a different path, but lets say that in some mysterious platforms that some people may be porting code too, the compiler will complain because not all return paths are satisfied.

@reduz reduz self-requested a review December 30, 2019 22:13
@akien-mga
Copy link
Member

Well I think it's better to add an else with an error message if we really want to satisfy compilers, and keep the == 2 as is.

akien-mga added a commit that referenced this pull request Jan 1, 2020
@akien-mga
Copy link
Member

Superseded by e4907e5 (GLES3, master) and 6546735 (Vulkan, vulkan). Thanks for the contribution nevertheless!

@akien-mga akien-mga closed this Jan 1, 2020
@akien-mga akien-mga added this to the 4.0 milestone Jan 1, 2020
TritiatedWater added a commit to TritiatedWater/godot that referenced this pull request Jan 1, 2020
`ERROR: _display_error_with_code: CanvasShaderGLES3: Fragment Program Compilation Failed:
0:166(2): error: `return' with wrong type int, in function `map_ninepatch_axis' returning float`  caused by godotengine#34704
akien-mga added a commit that referenced this pull request Jan 1, 2020
akien-mga added a commit to akien-mga/godot that referenced this pull request Feb 11, 2020
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