hoffstadt / hoffstadt/DearPyGui
Nested Draw Layers raise an error
- Dominant language
- C++
- Stars
- 15.6k
- Forks
- 783
- PR merge metrics
- No merged PRs in 30d
Description
## Version of Dear PyGui
Version: 1.11.1
Operating System: Arch Linux
## My Issue/Question
I found out that using draw layers to quickly hide/show or delete lists of items gives a huge performance boost compared to doing it manually on each item.
As such I started making use of them a lot.
However I got an error when trying to create a draw layer inside a draw layer. I do not think there should be such a restriction.
## To Reproduce
This code raises the following error:
```python
import dearpygui.dearpygui as dpg
dpg.create_context()
dpg.create_viewport()
dpg.setup_dearpygui()
with dpg.window(tag="Primary Window"):
with dpg.plot():
with dpg.draw_layer():
with dpg.draw_layer():
print('Hello')
```
```
Exception:
Error: [1003]
Command: add_draw_layer
Item: 24
Label:
Item Type: mvAppItemType::mvDrawLayer
Message: Incompatible parent. Acceptable parents include: mvAppItemType::mvTemplateRegistry
mvAppItemType::mvStage
mvAppItemType::mvDrawlist
mvAppItemType::mvWindowAppItem
mvAppItemType::mvPlot
mvAppItemType::mvViewportDrawlist
```
## Expected behavior
Being able to use draw layers inside draw layers.
Simply adding draw layers as possible child/parent of draw layers inside the code works in my usecase, but there might be a bit more work in order to handle correctly the optional properties of draw layers.
Contributor guide
Research direction
Start by running the provided nested dpg.draw_layer() reproducer and trace the add_draw_layer command's parent validation. Check how draw-layer optional properties are handled when a draw layer is the parent. Done means nested draw layers can be created without the incompatible-parent error and their optional properties behave correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- computer-graphics, desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100