Couldn't get path, invalid selection!
Describe the bug
Sometimes getting data path fails.
It should normally add the attribute with no problem because Blender itself can get the path and the debug UI is using the exact same operator bpy.ops.ui.copy_data_path_button(full_path=True).
To Reproduce Steps to reproduce the behavior:
- Mostly likely any generated UI by add-on in which you can find buttons linked to the UI ones
- Click on Add new Attribute
- Select panel
- Select Group
- Experience Error message Couldn't get path, invalid selection!
Expected behavior Creation of new attribute and adding it to the UI.
Desktop (please complete the following information):
- OS: Linux Manjaro
- Blender: 2.93
The issue is incorrect context.
RuntimeError: Operator bpy.ops.ui.copy_data_path_button.poll() failed, context is incorrect
So the solution is to pass the correct context to the bpy.ops.ui.copy_data_path_button operator which I have no idea how to do for know. There might be a solution in which we could use the button pointer but it's just a wild guess...