Extending Blender Pie Menus with Custom Operators using Python
HTML-код
- Опубликовано: 21 окт 2024
- In this video, we will continue to work on a custom Blender Pie Menu. I'll show you how to update the layout of the Pie Menu and add a custom operator. I'll also share how you can debug simple scripts using VSCode.
Initial Code:
github.com/CGA...
Final code:
github.com/CGA...
Exploring the Pie Menu Template in Blender with Python
• Exploring the Pie Menu...
Using Python classes in Blender:
• Using Python classes i...
5 Steps to setup VSCode for Blender Python (on Windows)
• 5 Steps to setup VSCod...
5 Steps to setup VSCode for Blender Python (on macOS)
• 5 Steps to setup VSCod...
5 Steps to setup VSCode for Blender Python (on Linux)
• 5 Steps to setup VSCod...
#blender #python #tutorial #addon #debugging #vscode
A truly useful Blender Python Tutorial! Thanks a bunch! Keep up the great work!
Thanks, will do!
Victor, this channel is amazing. Thank you so much!
My pleasure! 😀
This is great. But, is it possible to label the columns to designate what each does, like modifiers, mesh editing, that sort of thing.
You can create a sub menu
```
class WM_MT_submenu(bpy.types.Menu):
bl_label = "Submenu"
def draw(self, context):
layout = self.layout
layout.operator("mesh.primitive_cube_add")
class WM_MT_pie_menu(bpy.types.Menu):
bl_label = "Pie Menu Example"
def draw(self, context):
layout = self.layout
pie = layout.menu_pie()
# Add the submenu
pie.menu("WM_MT_submenu", text="Mesh Menu")
```
This was very helpful, thank you. Do you happen to have some resource to help set up autocompletion/intellisense for bpy in pycharm? I found a "faker" on github and it mostly works, but it doesn't include for example the values of the icon enum (edit: I mean in code, not the icon viewer). It makes development very annoying.
I also find it annoying that I have to restart blender every time I want to test a change I made.
Sorry for the beginner questions
That is a great question!
You can use the fake-bpy-module
github.com/nutti/fake-bpy-module/blob/master/docs/setup_pycharm.md
I made a video about setting up VSCode that will allow you to reload/rerun code without restarting blender
ruclips.net/video/YUytEtaVrrc/видео.html&lc=UgzNG9VDDmXtswEFysR4AaABAg
There is also this resource for setting up pycharm
b3d.interplanety.org/en/using-external-ide-pycharm-for-writing-blender-scripts/
@@CGPython Yeah the fake one is what I used. Which worked for some, but not all things. I'll check out the others, thank you :)
Viktor, thanks for all your tutorials. It helps a lot in developing own tools. Could you please explain collection groups and property groups. That stuff really makes me struggle. I just can't get logic behind it without some help.
Thanks!
Great suggestion! ❤️
I'll add that to my to do list!
I have a question. Is there any way to create custom "Editor Type" or how else it is called? I mean like there is 3D viewport, there is Text editor, "Properties". I did small research and only founded how to make custom NodeTree and nothing else so I wonder is this possible at all. Maybe I asked too hard question to answer or maybe you will talk about this in future video. But I just don't know so it's normal thing to ask d;
Are you asking about creating a New Custom Editor Area using the Python API?
The Blender developers have not provided that ability to us via the Python API. The existing Editor Areas are defined in the C++ code.
You can create your own Custom Editor Area using C++, but this would mean you would have to create a fork of Blender and maintain it on your own.
For example
www.bforartists.de/
or
www.linuxadictos.com/en/spa-studios-libero-el-codigo-fuente-de-su-fork-de-blender-con-mejoras-de-grease-pencil.html
@@CGPython Thank you, that's exactly what I was trying to achieve. I already figured that out that this will require me to change blender's source code. Which Is impossible to me because of my lack of knowledge of how blender is structured, or how it works under the hood. But still I'm more than happy that you actually answered ;)
Hello friend! Please could you explain how to add in pie menu editor some things like vertices data, edges data, opacity and etc which have slider button (driver). Because if you try to add this operator PME said "cant add this wigdet"
I have only seen the standard Pie Menu used as a selection mechanism.
I think you would need to use or write a custom Pie Menu widget to support your use case.
Checkout @JayAnAm Slider Widget
ruclips.net/video/iWsQDnphu80/видео.html