kpiorno / kivy3dgui Goto Github PK
View Code? Open in Web Editor NEWPure Kivy library to display and interact with Kivy widgets in a 3D mesh.
License: MIT License
Pure Kivy library to display and interact with Kivy widgets in a 3D mesh.
License: MIT License
I get the following error when loading large obj files. I have attached the concerned obj file and the code file as well.
3d_render.zip
kivy.graphics.vertex_instructions._ensure_ushort_view OverflowError: value too large to convert to unsigned short
On a desktop with a mouse everything works ok.
But on a touchscreen, HP All-in-One system the checkers.py crashed. I suspect the problem lies in the fact that on a touchscreen a "touch_move" event is generated iso a "touch_up/down".
Both systems are Ubuntu 22.04 with a python v3.8 virtual environment with kivy 2.1 installed and the kivy3dgui placed inside the tree.
To reproduce, start checkers.py and touch any stone.
This is the complete traceback:
[.[1;32mINFO.[0m ] [Logger ] Record log in /home/user/.kivy/logs/kivy_22-09-22_5.txt
[.[1;32mINFO.[0m ] [Kivy ] v2.1.0
[.[1;32mINFO.[0m ] [Kivy ] Installed at "/opt/App/.venv3.8/lib/python3.8/site-packages/kivy/__init__.py"
[.[1;32mINFO.[0m ] [Python ] v3.8.13 (default, Apr 19 2022, 02:32:06)
[GCC 11.2.0]
[.[1;32mINFO.[0m ] [Python ] Interpreter at "/opt/App/.venv3.8/bin/python3"
[.[1;32mINFO.[0m ] [Logger ] Purge log fired. Processing...
[.[1;32mINFO.[0m ] [Logger ] Purge finished!
[.[1;32mINFO.[0m ] [Factory ] 189 symbols loaded
[.[1;32mINFO.[0m ] [ImageLoaderFFPy] Using ffpyplayer 4.3.1
[.[1;32mINFO.[0m ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_ffpyplayer
[.[1;32mINFO.[0m ] [Text ] Provider: sdl2
[.[1;32mINFO.[0m ] [Window ] Provider: sdl2
[.[1;32mINFO.[0m ] [GL ] Using the "OpenGL" graphics system
[.[1;32mINFO.[0m ] [GL ] Backend used <sdl2>
[.[1;32mINFO.[0m ] [GL ] OpenGL version <b'4.6 (Compatibility Profile) Mesa 22.0.1'>
[.[1;32mINFO.[0m ] [GL ] OpenGL vendor <b'Intel'>
[.[1;32mINFO.[0m ] [GL ] OpenGL renderer <b'Mesa Intel(R) UHD Graphics 610 (CFL GT1)'>
[.[1;32mINFO.[0m ] [GL ] OpenGL parsed version: 4, 6
[.[1;32mINFO.[0m ] [GL ] Shading version <b'4.60'>
[.[1;32mINFO.[0m ] [GL ] Texture max size <16384>
[.[1;32mINFO.[0m ] [GL ] Texture max units <32>
[.[1;32mINFO.[0m ] [Window ] auto add sdl2 input provider
[.[1;32mINFO.[0m ] [Window ] virtual keyboard not allowed, single mode, not docked
[.[1;32mINFO.[0m ] [GL ] NPOT texture support is available
[.[1;32mINFO.[0m ] [Shader ] Read </opt/App/BtpKivy_Xf_16.6/kivy3dgui/gles2.0/toonshader/toon_shadows.glsl>
[.[1;32mINFO.[0m ] [Shader ] Read </opt/App/BtpKivy_Xf_16.6/kivy3dgui/gles2.0/shaders/shadowpass.glsl>
[.[1;32mINFO.[0m ] [Shader ] Read </opt/App/BtpKivy_Xf_16.6/kivy3dgui/gles2.0/shaders/selection.glsl>
[.[1;32mINFO.[0m ] [Shader ] Read </opt/App/BtpKivy_Xf_16.6/kivy3dgui/gles2.0/shaders/dop.glsl>
[.[1;32mINFO.[0m ] [ProbeSysfs ] device match: /dev/input/event8
[.[1;32mINFO.[0m ] [MTD ] Read event from </dev/input/event8>
[.[1;32mINFO.[0m ] [Base ] Start application main loop
[.[1;32mINFO.[0m ] [MTD ] </dev/input/event8> range position X is 0 - 4095
[.[1;32mINFO.[0m ] [MTD ] </dev/input/event8> range position Y is 0 - 4095
[.[1;32mINFO.[0m ] [MTD ] </dev/input/event8> range touch major is 0 - 0
[.[1;32mINFO.[0m ] [MTD ] </dev/input/event8> range touch minor is 0 - 0
[.[1;32mINFO.[0m ] [MTD ] </dev/input/event8> range pressure is 0 - 255
[.[1;32mINFO.[0m ] [MTD ] </dev/input/event8> axes invertion: X is 0, Y is 0
[.[1;32mINFO.[0m ] [MTD ] </dev/input/event8> rotation set to 0
[.[1;32mINFO.[0m ] [Base ] Leaving application in progress...
Traceback (most recent call last):
File "checker.py", line 136, in <module>
CheckerApp().run()
File "/opt/App/.venv3.8/lib/python3.8/site-packages/kivy/app.py", line 955, in run
runTouchApp()
File "/opt/App/.venv3.8/lib/python3.8/site-packages/kivy/base.py", line 574, in runTouchApp
EventLoop.mainloop()
File "/opt/App/.venv3.8/lib/python3.8/site-packages/kivy/base.py", line 339, in mainloop
self.idle()
File "/opt/App/.venv3.8/lib/python3.8/site-packages/kivy/base.py", line 383, in idle
self.dispatch_input()
File "/opt/App/.venv3.8/lib/python3.8/site-packages/kivy/base.py", line 334, in dispatch_input
post_dispatch_input(*pop(0))
File "/opt/App/.venv3.8/lib/python3.8/site-packages/kivy/base.py", line 263, in post_dispatch_input
listener.dispatch('on_motion', etype, me)
File "kivy/_event.pyx", line 731, in kivy._event.EventDispatcher.dispatch
File "/opt/App/.venv3.8/lib/python3.8/site-packages/kivy/core/window/__init__.py", line 1662, in on_motion
self.dispatch('on_touch_move', me)
File "kivy/_event.pyx", line 731, in kivy._event.EventDispatcher.dispatch
File "/opt/App/.venv3.8/lib/python3.8/site-packages/kivy/core/window/__init__.py", line 1689, in on_touch_move
if w.dispatch('on_touch_move', touch):
File "kivy/_event.pyx", line 731, in kivy._event.EventDispatcher.dispatch
File "/opt/App/.venv3.8/lib/python3.8/site-packages/kivy/uix/widget.py", line 600, in on_touch_move
if child.dispatch('on_touch_move', touch):
File "kivy/_event.pyx", line 731, in kivy._event.EventDispatcher.dispatch
File "/opt/App/BtpKivy_Xf_16.6/kivy3dgui/canvas3d.py", line 770, in on_touch_move
if 'right' in t_touch.button:
TypeError: argument of type 'NoneType' is not iterable
To reproduce: Start the checkers example and generate a "touch_move" event a stone on a touchscreen.
It will crash.
See also my pull request for a syntax fix. (This only fixes a crash on a non touchscreen)
Note: all other demos run properly
[INFO ] [CutBuffer ] cut buffer support enabled
Traceback (most recent call last):
File "editor3d.py", line 445, in
Minimal3dApp().run()
File "/usr/lib/python2.7/dist-packages/kivy/app.py", line 829, in run
root = self.build()
File "editor3d.py", line 238, in build
self.space_editor = SpaceEditor(layout3d, self, self.editor_manager)
File "/tmp/kivy3dgui/editor/space_editor.py", line 37, in init
node = Builder.load_string(dedent(axis.format(e, colors[i])))
File "/usr/lib/python2.7/dist-packages/kivy/lang/builder.py", line 405, in load_string
rule_children=rule_children)
File "/usr/lib/python2.7/dist-packages/kivy/lang/builder.py", line 707, in _apply_rule
e), cause=tb)
kivy.lang.builder.BuilderException: Parser: File "", line 9:
...
7: always_on_top: True
8: receive_shadows: False
9: meshes: ("./editor/meshes/x-rot-axis.obj",)
10: Button:
11: id: c_button
...
AttributeError: 'NoneType' object has no attribute 'add_node'
File "/usr/lib/python2.7/dist-packages/kivy/lang/builder.py", line 700, in _apply_rule
setattr(widget_set, key, value)
File "kivy/weakproxy.pyx", line 35, in kivy.weakproxy.WeakProxy.setattr
File "kivy/properties.pyx", line 497, in kivy.properties.Property.set
File "kivy/properties.pyx", line 839, in kivy.properties.ListProperty.set
File "kivy/properties.pyx", line 544, in kivy.properties.Property.set
File "kivy/properties.pyx", line 599, in kivy.properties.Property.dispatch
File "kivy/_event.pyx", line 1214, in kivy._event.EventObservers.dispatch
File "kivy/_event.pyx", line 1120, in kivy._event.EventObservers._dispatch
File "/tmp/kivy3dgui/kivy3dgui/node.py", line 303, in on_meshes
self.parent.add_node(self)
Hi dear sir,
I would like to know how to set a node parameters to adapt position and size. For example, I would like a node to be a button which can rotate on pressed. Imagine in your checker example. You have two buttons in the left top corner. I would like these buttons were two nodes and they stayed in that position as window resizes and changed size accordingly.
Best regards
Any idea why this happens for some objects?
Kivy vesion: 2.0.0rc4
Objects here
from kivy.app import App
from kivy.lang import Builder
class ExampleApp(App):
def build(self):
root = Builder.load_string('''
#: import Layout3D kivy3dgui.layout3d
Layout3D:
id: par
size_hint: (1.0, 1.0)
Node:
id: Node1
name: 'Node 0'
rotate: (270, 90, 0, 0)
# scale: (0.2, 0.2, 0.2)
translate: (0, -10, -50)
meshes: ("./untitled.obj", )
FloatLayout:
canvas:
Color:
rgb: 1, 1, 1, 1
Rectangle:
size: self.size
pos: self.pos
''')
self.root = root
return root
if __name__ == '__main__':
ExampleApp().run()
In order to work 'out of the box', would it not be best to have a default mesh that displays as close to standard FloatLayout as much as possible.
The aim to to have it just work, with as few 'surprises' as possible e.g. having to create a mesh. Many users will now know what a mesh is, so a default, simple mesh makes sense?
Traceback (most recent call last):
File "C:\Users\Harry\Desktop\mykivy\kivy3dgui-master\example.py", line 197, in
ExampleApp().run()
File "C:\Users\Harry\AppData\Local\Programs\Python\Python36-32\lib\site-packages\kivy\app.py", line 802, in run
root = self.build()
File "C:\Users\Harry\Desktop\mykivy\kivy3dgui-master\example.py", line 191, in build
''')
File "C:\Users\Harry\AppData\Local\Programs\Python\Python36-32\lib\site-packages\kivy\lang\builder.py", line 381, in load_string
widget = Factory.get(parser.root.name)()
File "C:\Users\Harry\Desktop\mykivy\kivy3dgui-master\kivy3dgui\layout3d.py", line 159, in init
self.create_canvas()
File "C:\Users\Harry\Desktop\mykivy\kivy3dgui-master\kivy3dgui\layout3d.py", line 218, in create_canvas
canvas_size=self.canvas_size, id="CANVAS3D")
File "C:\Users\Harry\Desktop\mykivy\kivy3dgui-master\kivy3dgui\canvas3d.py", line 226, in init
super(Canvas3D, self).init(**kwargs)
File "C:\Users\Harry\AppData\Local\Programs\Python\Python36-32\lib\site-packages\kivy\uix\floatlayout.py", line 65, in init
super(FloatLayout, self).init(**kwargs)
File "C:\Users\Harry\AppData\Local\Programs\Python\Python36-32\lib\site-packages\kivy\uix\layout.py", line 76, in init
super(Layout, self).init(**kwargs)
File "C:\Users\Harry\AppData\Local\Programs\Python\Python36-32\lib\site-packages\kivy\uix\widget.py", line 337, in init
super(Widget, self).init(**kwargs)
File "kivy_event.pyx", line 254, in kivy._event.EventDispatcher.init (kivy_event.c:5332)
TypeError: object.init() takes no parameters
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.