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
MDRaisedButton - Elevation #1327
Comments
@arncode90 When you run your code. What it's your opengl version? |
Sry, late reply. [INFO ] [GL ] Using the "OpenGL" graphics system |
(Hypothesis) I think elevation shader is not compatible with opengl>3.0 because it used gl_FragColor which it's deprecated. So maybe, the elevation is not correctly updated in your example because of that. |
ok ty for yor time checking this issue.. i will go for 1.0.2 then xD yes, my shadow seems like flat grey-ish i dont know much about system etc, i tested 2 same code, just only with 2 different button. The one with MDRaisedButton crashed |
Here my logcat from phone (i deleted some unnecessary line): [INFO ] [Kivy ] v2.1.0 App crashed and the logcat ended here. |
Sry, but can i ask something? The code @ kivymd/uix/button/button.py (Line 1017) KivyMD/kivymd/uix/button/button.py Line 1017 in 558d56e
Clock.schedule_once(self.create_anim_raised) it refer to the method below: def create_anim_raised(self, *args) -> None:
self._elevation_raised = self.elevation + 1.2
self._anim_raised = Animation(elevation=self.elevation + 1, d=0.15) It has something to do / related to the system? Because if I edit the "create_anim_raised" method in Line 1020 (like code below), the elevation bug not showing when running on my Windows (not yet check when running on the phone). def create_anim_raised(self, *args) -> None:
if self.elevation != 0:
self._elevation_raised = self.elevation + 1.2
self._anim_raised = Animation(elevation=self.elevation + 1, d=0.15) |
I think this function is Ok when shadow is correctly rendering. I'm not an expert in Shader, but I hope someone will find a way to make shader compatible for all opengl version. |
Ok mp-007 |
Finally find the problem. It's the smoothstep function that doesn't work properly in opengl>3.0 If I change the elevation.frag by that, it's seem to work:
@HeaTTheatR can you check if this fix work on your side. Note: you can happy_smoothstep for an other name ;) |
|
@mp-007 Don't pay attention, this is my typo. I'll check it on my computer. Will you be able to do PR later if it works on my computer as well? |
@HeaTTheatR Yes I can make a PR if it works on your computer. |
@mp-007 Please remind me exactly what problem is being solved by your new shader changes? |
I don't know why but smoothstep return value is not correct on by computer (opengl 4.6). When I rewrite the function from the documentation (https://registry.khronos.org/OpenGL-Refpages/gl4/html/smoothstep.xhtml), it's working now. |
@mp-007 OK, let's make a PR, but please leave the old code commented out. And call the |
@HeaTTheatR Like I said in my last comment, I don't need to create a new function. Just by specified the input type, it's working. At the end, my only changes are:
I will make a PR with this changes. |
@mp-007 OK. |
@mp-007 OK, thanks for this PR! |
by commented this part in elevation.py, seem to fix this issue.
Can we considered all widgets to have relative position? |
@mp-007 We need to do this thoroughly. Both static widgets with elevation behavior and widgets with elevation behavior that are inside |
possible fix for issue kivymd#1327
I was talking about this |
Hey guys I think I am having a similar issue here, but only happens when scrolling. Here's a video of it: Here is my code (it is a little hacked together since it's my first time working with kivy/kivyMD, sorry for the formatting here I can't change it): ` Builder.load_string('''
: ''') class NewTable(RecycleView):
class Cols(BoxLayout):
def refresh_view_attrs(self, newTable, index, data): def on_touch_down(self, touch): class TestApp(MDApp): if name == 'main': |
Found out a small work around is switching out MDRaisedButton for MDFillRoundFlatButton, so not a big deal for me :) |
Description of the Bug
MDRaisedButton still showing an elevation (when the button is clicked), even I set the elevation to 0.
Code and Logs
Video
2022-08-29.23-41-05.mov
Versions
The text was updated successfully, but these errors were encountered: