panda3d-imgui 1.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,219 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ # Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ # poetry.lock
109
+ # poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ # pdm.lock
116
+ # pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ # pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # Redis
135
+ *.rdb
136
+ *.aof
137
+ *.pid
138
+
139
+ # RabbitMQ
140
+ mnesia/
141
+ rabbitmq/
142
+ rabbitmq-data/
143
+
144
+ # ActiveMQ
145
+ activemq-data/
146
+
147
+ # SageMath parsed files
148
+ *.sage.py
149
+
150
+ # Environments
151
+ .env
152
+ .envrc
153
+ .venv
154
+ env/
155
+ venv/
156
+ ENV/
157
+ env.bak/
158
+ venv.bak/
159
+
160
+ # Spyder project settings
161
+ .spyderproject
162
+ .spyproject
163
+
164
+ # Rope project settings
165
+ .ropeproject
166
+
167
+ # mkdocs documentation
168
+ /site
169
+
170
+ # mypy
171
+ .mypy_cache/
172
+ .dmypy.json
173
+ dmypy.json
174
+
175
+ # Pyre type checker
176
+ .pyre/
177
+
178
+ # pytype static type analyzer
179
+ .pytype/
180
+
181
+ # Cython debug symbols
182
+ cython_debug/
183
+
184
+ # PyCharm
185
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
186
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
187
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
188
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
189
+ # .idea/
190
+
191
+ # Abstra
192
+ # Abstra is an AI-powered process automation framework.
193
+ # Ignore directories containing user credentials, local state, and settings.
194
+ # Learn more at https://abstra.io/docs
195
+ .abstra/
196
+
197
+ # Visual Studio Code
198
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
199
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
200
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
201
+ # you could uncomment the following to ignore the entire vscode folder
202
+ # .vscode/
203
+
204
+ # Ruff stuff:
205
+ .ruff_cache/
206
+
207
+ # PyPI configuration file
208
+ .pypirc
209
+
210
+ # Marimo
211
+ marimo/_static/
212
+ marimo/_lsp/
213
+ __marimo__/
214
+
215
+ # Streamlit
216
+ .streamlit/secrets.toml
217
+
218
+ # Custom
219
+ *.ini
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Little Cat
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,92 @@
1
+ Metadata-Version: 2.4
2
+ Name: panda3d-imgui
3
+ Version: 1.0.1
4
+ Summary: A Dear ImGui backend for Python-based Panda3D projects with built-in utilities.
5
+ Project-URL: Homepage, https://github.com/LittleToonCat/panda3d-imgui
6
+ Project-URL: Issues, https://github.com/LittleToonCat/panda3d-imgui/issues
7
+ Author-email: Little Cat <toontownlittlecat@gmail.com>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Keywords: Dear ImGui,Panda3D,imgui-bundle
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Requires-Python: >=3.10
14
+ Requires-Dist: imgui-bundle==1.92.4
15
+ Requires-Dist: panda3d
16
+ Requires-Dist: pyperclip
17
+ Description-Content-Type: text/markdown
18
+
19
+ # panda3d-imgui
20
+ A [Dear ImGui](https://github.com/ocornut/imgui) backend for Python-based Panda3D projects with built-in utilities (based on DIRECT Tools).
21
+
22
+ <img width="1920" height="1080" alt="Screenshot 2025-11-05 at 10 58 18 PM" src="https://github.com/user-attachments/assets/0de21a26-b37a-40a3-9ae9-b07b2a853742" />
23
+
24
+ This module will allow you to use and create Dear ImGui user interfaces within a Panda3D window, preferbly used to create content creation/debugging tools.
25
+ (It uses [Dear ImGui Bundle](https://pthom.github.io/imgui_bundle/) which contains not only the Python bindings for Dear ImGui, but with other goodies as well.
26
+
27
+ ## How to use
28
+ You can install the module through pip:
29
+ ```
30
+ pip install panda3d-imgui
31
+ ```
32
+
33
+ And you can import this module as `p3dimgui`
34
+ ```python
35
+ import p3dimgui
36
+ ```
37
+
38
+ It has a helper method called `init` which you can easlily add in your ShowBase class. This will create a `ImGuiBackend` object into `base.imgui`
39
+ and initialize it, along side the built-in ultilities.
40
+
41
+ ```python
42
+ from direct.showbase.ShowBase import ShowBase
43
+
44
+ from imgui_bundle import imgui
45
+
46
+ import p3dimgui
47
+
48
+ class MyApp(ShowBase):
49
+ def __init__(self):
50
+ ShowBase.__init__(self)
51
+
52
+ # Install Dear ImGui
53
+ p3dimgui.init()
54
+ ```
55
+
56
+ Once initalized, it will send an event called `imgui-new-frame` every frame. You can accept this event whenever you want to draw with ImGui:
57
+ ```python
58
+ def draw(self):
59
+ # Show the demo window.
60
+ imgui.show_demo_window()
61
+
62
+ self.accept('imgui-new-frame', self.draw)
63
+
64
+ ```
65
+
66
+ Combine all this and you would have something like this, which will start up a new Panda3D window and shows the Dear ImGui demo window.
67
+ ```python
68
+ from direct.showbase.ShowBase import ShowBase
69
+
70
+ from imgui_bundle import imgui
71
+
72
+ import p3dimgui
73
+
74
+ class MyApp(ShowBase):
75
+ def __init__(self):
76
+ ShowBase.__init__(self)
77
+
78
+ # Install Dear ImGui
79
+ p3dimgui.init()
80
+
81
+ self.accept('imgui-new-frame', self.draw)
82
+
83
+ def draw(self):
84
+ # Show the demo window.
85
+ imgui.show_demo_window()
86
+
87
+ app = MyApp()
88
+ app.run()
89
+ ```
90
+ <img width="800" height="628" alt="image" src="https://github.com/user-attachments/assets/ab233406-c187-4061-bbe3-49420294f524" />
91
+
92
+ For a more better demo which showcases all the built-in utilities aviliable (like the screenshot at the top), see the [demo.py](https://github.com/LittleToonCat/panda3d-imgui/blob/main/demo.py) file.
@@ -0,0 +1,74 @@
1
+ # panda3d-imgui
2
+ A [Dear ImGui](https://github.com/ocornut/imgui) backend for Python-based Panda3D projects with built-in utilities (based on DIRECT Tools).
3
+
4
+ <img width="1920" height="1080" alt="Screenshot 2025-11-05 at 10 58 18 PM" src="https://github.com/user-attachments/assets/0de21a26-b37a-40a3-9ae9-b07b2a853742" />
5
+
6
+ This module will allow you to use and create Dear ImGui user interfaces within a Panda3D window, preferbly used to create content creation/debugging tools.
7
+ (It uses [Dear ImGui Bundle](https://pthom.github.io/imgui_bundle/) which contains not only the Python bindings for Dear ImGui, but with other goodies as well.
8
+
9
+ ## How to use
10
+ You can install the module through pip:
11
+ ```
12
+ pip install panda3d-imgui
13
+ ```
14
+
15
+ And you can import this module as `p3dimgui`
16
+ ```python
17
+ import p3dimgui
18
+ ```
19
+
20
+ It has a helper method called `init` which you can easlily add in your ShowBase class. This will create a `ImGuiBackend` object into `base.imgui`
21
+ and initialize it, along side the built-in ultilities.
22
+
23
+ ```python
24
+ from direct.showbase.ShowBase import ShowBase
25
+
26
+ from imgui_bundle import imgui
27
+
28
+ import p3dimgui
29
+
30
+ class MyApp(ShowBase):
31
+ def __init__(self):
32
+ ShowBase.__init__(self)
33
+
34
+ # Install Dear ImGui
35
+ p3dimgui.init()
36
+ ```
37
+
38
+ Once initalized, it will send an event called `imgui-new-frame` every frame. You can accept this event whenever you want to draw with ImGui:
39
+ ```python
40
+ def draw(self):
41
+ # Show the demo window.
42
+ imgui.show_demo_window()
43
+
44
+ self.accept('imgui-new-frame', self.draw)
45
+
46
+ ```
47
+
48
+ Combine all this and you would have something like this, which will start up a new Panda3D window and shows the Dear ImGui demo window.
49
+ ```python
50
+ from direct.showbase.ShowBase import ShowBase
51
+
52
+ from imgui_bundle import imgui
53
+
54
+ import p3dimgui
55
+
56
+ class MyApp(ShowBase):
57
+ def __init__(self):
58
+ ShowBase.__init__(self)
59
+
60
+ # Install Dear ImGui
61
+ p3dimgui.init()
62
+
63
+ self.accept('imgui-new-frame', self.draw)
64
+
65
+ def draw(self):
66
+ # Show the demo window.
67
+ imgui.show_demo_window()
68
+
69
+ app = MyApp()
70
+ app.run()
71
+ ```
72
+ <img width="800" height="628" alt="image" src="https://github.com/user-attachments/assets/ab233406-c187-4061-bbe3-49420294f524" />
73
+
74
+ For a more better demo which showcases all the built-in utilities aviliable (like the screenshot at the top), see the [demo.py](https://github.com/LittleToonCat/panda3d-imgui/blob/main/demo.py) file.
@@ -0,0 +1,140 @@
1
+ from panda3d.core import loadPrcFileData, WindowProperties, Point3
2
+ from math import pi, sin, cos
3
+
4
+ from direct.showbase.ShowBase import ShowBase
5
+ from direct.task import Task
6
+ from direct.actor.Actor import Actor
7
+ from direct.interval.IntervalGlobal import Sequence
8
+
9
+ import p3dimgui
10
+
11
+ from imgui_bundle import imgui, imgui_ctx
12
+
13
+ import sys
14
+
15
+ class DemoBase(ShowBase):
16
+ def __init__(self):
17
+ # Start at a 720p resolution
18
+ loadPrcFileData('', 'win-size 1280 720')
19
+
20
+ ShowBase.__init__(self)
21
+
22
+ # Enable debug output
23
+ loadPrcFileData('', 'notify-level-imgui debug')
24
+
25
+ # Disable the camera trackball controls.
26
+ self.disableMouse()
27
+
28
+ # Install Dear ImGui
29
+ p3dimgui.init()
30
+
31
+ # Load the environment model.
32
+ self.scene = self.loader.loadModel("models/environment")
33
+
34
+ # Reparent the model to render.
35
+ self.scene.reparentTo(self.render)
36
+
37
+ # Apply scale and position transforms on the model.
38
+ self.scene.setScale(0.25, 0.25, 0.25)
39
+ self.scene.setPos(-8, 42, 0)
40
+
41
+ # Load and transform the panda actor.
42
+ self.pandaActor = Actor("models/panda-model",
43
+ {"walk": "models/panda-walk4"})
44
+
45
+ self.pandaActor.setScale(0.005, 0.005, 0.005)
46
+ self.pandaActor.reparentTo(self.render)
47
+
48
+ # Loop its animation.
49
+ self.pandaActor.loop("walk")
50
+
51
+ # Create the four lerp intervals needed for the panda to
52
+ # walk back and forth.
53
+ posInterval1 = self.pandaActor.posInterval(13,
54
+ Point3(0, -10, 0),
55
+ startPos=Point3(0, 10, 0))
56
+
57
+ posInterval2 = self.pandaActor.posInterval(13,
58
+ Point3(0, 10, 0),
59
+ startPos=Point3(0, -10, 0))
60
+
61
+ hprInterval1 = self.pandaActor.hprInterval(3,
62
+ Point3(180, 0, 0),
63
+ startHpr=Point3(0, 0, 0))
64
+
65
+ hprInterval2 = self.pandaActor.hprInterval(3,
66
+ Point3(0, 0, 0),
67
+ startHpr=Point3(180, 0, 0))
68
+
69
+ # Create and play the sequence that coordinates the intervals.
70
+ self.pandaPace = Sequence(posInterval1, hprInterval1,
71
+ posInterval2, hprInterval2,
72
+ name="pandaPace")
73
+ self.pandaPace.loop()
74
+
75
+ # This assumes that the TimeSliderManager has replaced the .popupControls() method.
76
+ self.pandaPace.popupControls()
77
+
78
+ # This assumes that the ExplorerManager has replaced the .explore() method.
79
+ self.render.explore()
80
+
81
+ self.camera.setPosHpr((11.80, -24.85, 17.20), (30.00, -29.55, 0.00))
82
+
83
+ # This assumes that the PlaceManager has replaced the .place() method.
84
+ self.camera.place()
85
+
86
+ self.showDemoWindow = True
87
+
88
+ self.accept('imgui-new-frame', self.__newFrame)
89
+ self.accept('`', self.__toggleImgui)
90
+
91
+ def __toggleImgui(self):
92
+ if not self.imgui.isKeyboardCaptured():
93
+ self.imgui.toggle()
94
+
95
+ def __newFrame(self):
96
+ # Dear ImGui commands can be placed here.
97
+ with imgui_ctx.begin_main_menu_bar() as mainMenu:
98
+ if mainMenu:
99
+
100
+ with imgui_ctx.begin_menu("Demo") as demoMenu:
101
+ if demoMenu:
102
+
103
+ clickedExplorer, _ = imgui.menu_item("Show Scene Graph Explorer", "", self.render in self.explorerManager.nodesToExplorers, True)
104
+ if clickedExplorer:
105
+ if self.render not in self.explorerManager.nodesToExplorers:
106
+ self.render.explore()
107
+ else:
108
+ self.explorerManager.nodesToExplorers[self.render].active = False
109
+
110
+ clickedPlacer, _ = imgui.menu_item("Show Camera Node Placer", "", self.camera in self.placeManager.nodesToPlacers, True)
111
+ if clickedPlacer:
112
+ if self.camera not in self.placeManager.nodesToPlacers:
113
+ self.camera.place()
114
+ else:
115
+ self.placeManager.nodesToPlacers[self.camera].active = False
116
+
117
+ clickedSlider, _ = imgui.menu_item("Show Interval Time Slider", "", self.pandaPace in self.timeSliderManager.intervalToTimeSliders, True)
118
+ if clickedSlider:
119
+ if self.pandaPace not in self.timeSliderManager.intervalToTimeSliders:
120
+ self.pandaPace.popupControls()
121
+ else:
122
+ self.timeSliderManager.intervalToTimeSliders[self.pandaPace].active = False
123
+
124
+ clickedDemo, _ = imgui.menu_item("Show Dear ImGui Demo Window", "", self.showDemoWindow, True)
125
+ if clickedDemo:
126
+ self.showDemoWindow = not self.showDemoWindow
127
+
128
+ clickedQuit, _ = imgui.menu_item("Quit", "Cmd+Q" if sys.platform == 'darwin' else "Alt+F4", False, True)
129
+ if clickedQuit:
130
+ self.userExit()
131
+
132
+ # Display FPS after the menu on the menu bar, cause why not.
133
+ imgui.set_cursor_pos_x(imgui.get_window_size().x - 140)
134
+ imgui.text("%.2f FPS (%.2f ms)" % (imgui.get_io().framerate, 1000.0 / imgui.get_io().framerate))
135
+
136
+ if self.showDemoWindow:
137
+ imgui.show_demo_window()
138
+
139
+ demo = DemoBase()
140
+ demo.run()
@@ -0,0 +1,33 @@
1
+ from .backend import ImGuiBackend
2
+
3
+ from .utilities.PlaceManager import PlaceManager
4
+ from .utilities.PlacePanel import PlacePanel
5
+ from .utilities.ExplorerManager import ExplorerManager
6
+ from .utilities.SceneGraphExplorer import SceneGraphExplorer
7
+ from .utilities.TimeSliderManager import TimeSliderManager
8
+ from .utilities.IntervalTimeSlider import IntervalTimeSlider
9
+
10
+ __all__ = ['init',
11
+ 'ImGuiBackend',
12
+ "PlacePanel",
13
+ 'PlaceManager',
14
+ 'ExplorerManager',
15
+ 'SceneGraphExplorer',
16
+ 'TimeSliderManager',
17
+ 'IntervalTimeSlider',
18
+ ]
19
+
20
+ def init(window = None, parent = None,
21
+ style = 'dark', wantPlaceManager = True,
22
+ wantExplorerManager = True, wantTimeSliderManager = True):
23
+ try:
24
+ base.imgui
25
+ except AttributeError:
26
+ base.imgui = ImGuiBackend(window, parent, style)
27
+
28
+ if wantPlaceManager:
29
+ base.placeManager = PlaceManager()
30
+ if wantExplorerManager:
31
+ base.explorerManager = ExplorerManager()
32
+ if wantTimeSliderManager:
33
+ base.timeSliderManager = TimeSliderManager()