Mesh Editing in Blender with Python: I Wish I'd Learned THIS Sooner
Vložit
- čas přidán 5. 07. 2024
- Join me in this tutorial as I dive deep into using context managers in Blender for mesh editing with Python's bmesh module. I'll walk you through a hands-on example of transforming code to use a context manager and demonstrate how to effectively debug it in VSCode. By the end, you'll not only gain a solid understanding but also have challenges to test and reinforce your skills. Perfect for those eager to enhance their Blender-Python prowess!
Blender Python script that bevels the edges of an active object that is in OBJECT mode
gist.github.com/CGArtPython/3...
Blender Python script that bevels the edges of an active object that is in EDIT mode:
gist.github.com/CGArtPython/c...
Blender Python script that bevels the edges of an active object that is in EDIT mode:
gist.github.com/CGArtPython/c...
Script explanation in this video "Blender Scripting Guide: Mastering Mesh Editing with Python"
• Blender Scripting Guid...
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 #bmesh #VSCode
Here is a link to the video with the advanced version of the context manager:
czcams.com/video/XcdCzB3tILs/video.html
I have a short video explaining decorators here:
czcams.com/users/shortsXzDFbWnWxzU
cool! please delve into more advanced topics and version of this one! well done! Learning tons here! Both python and blender!
Thank you!
I'll share the more advanced version of this code soon.
Here is a link to the video with the advanced version of the context manager:
czcams.com/video/XcdCzB3tILs/video.html
I hope you like!
@@CGPython sure do
The best CZcams channel to learn Python scripting in Blender ❤
Thanks Brett ❤️
The best demonstration of a custom context manager I have seen.
Thank you! ❤️
Soooo good! Thank you!
Excellent explanation! Now, people have a new way to do things! I knew about context managers, but did not really understand how to use them! This is a big help!
Thank you!
That is great to hear! 🥳
Thank you. Your an excellent teacher. You've given me a few tips that has already made me more peofficient in just a few weeks of practice.
Really thank you sir 🙏
Edit: I'd be interested to see the more advanced work around.
However I do enjoy a good challenge !
Wonderful! ❤️
I'll share the advanced version soon.
Here is a link to the video with the advanced version of the context manager:
czcams.com/video/XcdCzB3tILs/video.html
@@CGPython Wow! thank you so much. Really appreciate this 🙏 🙏
I just discovered your channel :O
I have a short video explaining decorators here:
czcams.com/users/shortsXzDFbWnWxzU
Id happily see the more advanced version. Is it used the overrides thingamy? This was an interesting video. Where on StackOver/etc did you come across it? Although it does feel a bit magical/not intuitive that it yields and then jumps and runs the line of code then back into the function.
I'll share the advanced version of this code soon. ⌛
I actually have two more versions, one with a nested context manager and one using a class context manager.
> Where on StackOver/etc did you come across it?
I didn't really find it anywhere. I have been using Python for a long time. Eventually, you start seeing where to use context managers, just like in that scene in The Matrix movie. 😅
@@CGPython nice. I guess the extra import is the only downside. But yeah the whole stuff of repeated boiler plate code in blender and being in the right bpy.context, which is a minefield in itself, can lead to (for me personally) a lot of searching around repeatedly for certain lines again and again.
@@jonathanhutchinson5649 this is video with the advanced version of the context manager:
czcams.com/video/XcdCzB3tILs/video.html
Can you do video about practice vfx effect using Python into Blender's API with geometric nodes?
I have done a couple of videos on working with geo nodes from Python
czcams.com/video/Is8Qu7onvzM/video.html
czcams.com/video/hlZ_cFSlaMs/video.html
I need to loop back to some Python geo nodes at some point.
How would you create a script to split edges at their midpoint, with the selection order kept in mind? I want to create an new edge between the selected edges at the midpoints.
After that operation, you will have a split face, right?
This should work for you
with get_bmesh(mesh_obj) as bm:
selected_edges = [edge for edge in bm.edges if edge.select]
bmesh.ops.subdivide_edges(bm, edges=selected_edges, cuts=1)
@@CGPython Thank you ! As a modeler I would love to see more tut on bmesh. Like how would you write a script to spin a edge clockwise. Assume you have 2 quads and you select the the middle edge, now you want to spin that edge clock wise.
Great idea!
I open texture using this code, and cant assign it to displayce modifier:
import bpy
bpy.ops.image.open('INVOKE_DEFAULT')
In your example using voronoi texture (not image from pc)
I can assign voronoi and other generated textures, but i cant assign image from pc
Thank you
try this
gist.github.com/CGArtPython/0f74f1c71051150514df309052a3a190
And can you do a beginner tutorial on using Python for Animation in Blender's Bpy?
Have you seen this playlist?
czcams.com/video/nmJqIaSZlRs/video.html
I have a couple of videos on animation at the start of the playlist
@@CGPython definitely missed that Playlist. Thanks
How to assign image texture to displayse modifier using pythom??? HELP! HELP! HELP!
In this file
github.com/CGArtPython/blender_plus_python/blob/main/holder/script_done.py
look for the `def add_displace_modifier(name, texture_type, empty_obj=None):` function
I go over an example use case in this video
czcams.com/video/Z7tVeI1D7CY/video.html
thank you@@CGPython
too fast !
background music disturbing
if you only teach the correct way to script, you dont have to show or mention what can go wrong or any alternative way to do the same thing, if a beginer learns the correct way to doit from the egining, then he would not make any mistakes. simplifie your tuts, they will e more useful.
Thank you for the input!
The "correct way" to script is a subjective thing.
For example, writing scripts in pythonic way requires a lot of preparation. I can't think of a good way to teach that from the start.