Blender Scripting Guide: Mastering Mesh Editing with Python

  Рет қаралды 7,993

CG Python

CG Python

10 ай бұрын

Start exploring the power of the BMesh Python module in Blender with this tutorial designed for 3D artists. Understand the essentials of manipulating and editing geometry seamlessly using a Python script. Whether you're a beginner or looking to enhance your Blender scripting skills, this BMesh introduction will provide valuable insights. Start building the foundation for creating advanced 3D modeling scripts and add-ons today. Perfect for those passionate about taking their 3D artwork to the next level. #Blender3D #BMesh #3DModeling #pythonscripting
Used "A Baker Kneading the Dough" Video by ROMAN ODINTSOV: www.pexels.com/video/a-baker-...

Пікірлер: 54
@mind_of_a_darkhorse
@mind_of_a_darkhorse 10 ай бұрын
A great tutorial! BMesh is a lot to grasp and you explained it succinctly and well! Glad to see you are back after a short break! You were missed!
@CGPython
@CGPython 10 ай бұрын
Glad it was helpful! Thank you! I definitely want to do some more with BMesh. Just scratching the surface with this. I don't want to overload everyone.
@mind_of_a_darkhorse
@mind_of_a_darkhorse 10 ай бұрын
@@CGPython The best way to tackle a large problem is to break it down into small parts! So, I totally agree!
@ShirazHazrat
@ShirazHazrat 6 ай бұрын
Excellent. Thanks!
@ludthx
@ludthx 10 ай бұрын
You're back !! great !!
@CGPython
@CGPython 10 ай бұрын
Yes! Thank you!
@teccc42
@teccc42 10 ай бұрын
Thank you so much for your videos! I am working my way slowly through all of them. You are an excellent teacher!
@CGPython
@CGPython 10 ай бұрын
You're very welcome! I'm really happy you like them! 🥳
@KevinMerinoCreations
@KevinMerinoCreations 7 ай бұрын
Got pointed to your channel through your sponsorship on @CurtisHolt Blender 4.0 video. Look forwarded to following your content as well! 👏👏👏
@CGPython
@CGPython 7 ай бұрын
Welcome aboard! ❤️🚀
@JosueMartinez-ww1vj
@JosueMartinez-ww1vj 8 ай бұрын
A great introduction, Thanks so mesh, I mean much 👍👍
@CGPython
@CGPython 8 ай бұрын
Glad you liked it! 🥳
@rafamichalski6150
@rafamichalski6150 10 ай бұрын
I have wondered for a long when you are going to start tutorials about Edit Mode, and now there is one. Wish to know more about all actions, like extrusion, inset... Great work, thank you.
@CGPython
@CGPython 10 ай бұрын
Thank you! Yes, I want to cover that as well. Stay tuned 📺
@stefanguiton
@stefanguiton 10 ай бұрын
Great video!
@CGPython
@CGPython 10 ай бұрын
Thank you! Glad you enjoyed it.
@dshot92
@dshot92 10 ай бұрын
Great Intro Video!
@CGPython
@CGPython 10 ай бұрын
I'm glad you like it
10 ай бұрын
Amazing!
@CGPython
@CGPython 10 ай бұрын
Thank you! Cheers!
@AlHowell
@AlHowell 9 ай бұрын
Found you from film booth. I’m glad I did 💪
@CGPython
@CGPython 9 ай бұрын
I'm glad you did! Welcome aboard!
@mixchief
@mixchief 9 ай бұрын
This is so useful, thankk you thank you CG Python
@CGPython
@CGPython 9 ай бұрын
You're very welcome!
@Crowdrender
@Crowdrender 9 ай бұрын
Nice video! A couple of questions, can you build a performant addon that allows modifying the visible mesh in real time? Would imagine that constantly creating bmesh objects would be slow. So is there a way to either do this efficiently, by updating a bmesh from the object's mesh? Or is it better to somehow visualise the bmesh and edit that, similar to how edit mode works?
@CGPython
@CGPython 9 ай бұрын
Do you have some examples of what you want to do? For example, the MESHmachine add-on uses bmesh to edit meshes in real time machin3.gumroad.com/l/MESHmachine At the end of the day, you would need to go through bmesh to apply edits to meshes in Blender. Even if you have an external library that is written in C++ or Rust that does the heavy lifting. Here is an example of how you can speed up geometry processing with Rust from the World Blender Meetup Day 2022 Part 3 (link with timestamp) kzfaq.info/get/bejne/irCIp8yglr-oc6s.html
@Crowdrender
@Crowdrender 9 ай бұрын
@@CGPython Thanks :) we worked on a scultping addon with @JamieDunbar, we're working on the next edition and wanted to look at how we could display what a merged set of objects would look like in real time without actually merging them yet. So, first idea after watching this video was bmesh but the thought of constantly creating multiple bmesh objects for different meshes doesn't sound like it would be fast!
@CGPython
@CGPython 9 ай бұрын
I would still try to see how bad it would look if you just used pure python bmesh before you start optimizing. If that doesn't work try looking into Cython? IIRC @JacquesLucke used that in the animation nodes add-on. Also not sure how this would look, but maybe draw the merged mesh with some debug lines?
@MACHIN3
@MACHIN3 7 ай бұрын
@@CGPython Thanks for the shoutout :) To add something to the topic, bmesh generally works to edit meshes in real time, but of course it depends on the operations you do and the complexity of the mesh you are handling. There definitely are situations where it does make sense to previs the to-be-created/changed geometry and only push to the new mesh at the end in a single step, instead of doing it with each modal execution for instance.
@alextsui8551
@alextsui8551 10 ай бұрын
Great tutorial! Looking forward to next one about loops. I dont't know how to change loop normal to face normal, in other words modify the split normal same to face normal. Hope you could teach that in the next one. Thanks a lot!
@CGPython
@CGPython 10 ай бұрын
Thanks for the idea! Do you have an example script you are using this in? So I can understand your use case better
@alextsui8551
@alextsui8551 10 ай бұрын
Thanks for your reply! After bevel each edge of a cube, enable the Auto Smooth and apply a Weighted Normal modifier, the split normal will be different to ones before, and it make sense. But for lowpoly or stylized model appearance, I would like to change the split normal back to before just same as the face normal. Thx again! @@CGPython
@alextsui8551
@alextsui8551 10 ай бұрын
I tried many ways but can not find a proper way to modify loop normal, it seems like using different data structure for split normal. Code below is most of my attempt. import bpy import bmesh obj = bpy.context.edit_object mesh = obj.data bm = bmesh.from_edit_mesh(mesh) for face in bm.faces: if face.select: normal = face.normal for loop in face.loops: split_normals[loop.index] = normal bm.free() bmesh.update_edit_mesh(obj.data) @@CGPython
@CGPython
@CGPython 9 ай бұрын
You can actually update the split normals via the mesh data (without bmesh) Here is an example gist.github.com/CGArtPython/96abf841bd732ee54a6c89643df45cab
@alextsui8551
@alextsui8551 9 ай бұрын
You'er my hero!@@CGPython
@danil9843
@danil9843 10 ай бұрын
Hi. Great video. Can you make tutorial how to insert pose asset browser to keyframe? Thank in advance. Subscribed.
@CGPython
@CGPython 10 ай бұрын
Thank you for the idea! 💪 I'll think about it 🤔
@briantriesart
@briantriesart 2 ай бұрын
Hi, I love your channel. thanks for sharing your knowledge! Just a comment: I humbly think the zoom-in and zoom-out in the post-video editing are not necessary. You can save some time by skipping this step and the video will be perfectly understandable saving your valuable time for more content :) haha Thank you.
@CGPython
@CGPython 2 ай бұрын
Thanks for the tip! 💖
@WhatsThisStickyStuff
@WhatsThisStickyStuff 3 ай бұрын
Hi! If I already have a GLTF file or a model made can I export python code that will create the exact same model?
@CGPython
@CGPython 3 ай бұрын
You don't need to write Python code to import a glTF file You can use the built in add-on docs.blender.org/manual/en/latest/addons/import_export/scene_gltf2.html
@WhatsThisStickyStuff
@WhatsThisStickyStuff 3 ай бұрын
@@CGPython Right but I want to turn a 3D model into a python script and then hypothetically send that script to someone else and have them make the 3D model using just the script
@CGPython
@CGPython 3 ай бұрын
It would be possible to do this, but I don't know why you would need to do this. If the other person has Blender, why not just send them the glTF file? Maybe this is just for fun? You need to look at the add-on that I mentioned to understand how that data is represented via Python and then create a Blender Python script that adds the verts and faces to create the mesh. Probably the most challenging part would be creating the encoded Materials, Textures, and Animations.
@joantonio6331
@joantonio6331 3 ай бұрын
As of blender 4.0, you do not need to add bmesh update
@AbhinavKumar-po9hk
@AbhinavKumar-po9hk 8 ай бұрын
Thank you for the tutorial you provided for beginner. If possible could you please upload videos with some better voice output.
@CGPython
@CGPython 8 ай бұрын
Thank you for your feedback Can you share exactly what you don't like about the audio quality?
@AbhinavKumar-po9hk
@AbhinavKumar-po9hk 8 ай бұрын
In some of your videos, your voice is not audible properly, after putting on headphone and on full volume, then only getting the some part of the audio. @@CGPython Again thanks a lot. your videos helped ma a lot in my project. can you make videos on optimize scene and configurator render
@CGPython
@CGPython 7 ай бұрын
Got it! What do you mean by “scene optimization”?
@AbhinavKumar-po9hk
@AbhinavKumar-po9hk 7 ай бұрын
@@CGPython creating instance of object collection for faster rendering
@guy_roh
@guy_roh 5 ай бұрын
the music is too loud@@CGPython
@okayBro0001
@okayBro0001 10 ай бұрын
Please make the complete series on a beginner to advanced level blender bone and rigging series by scripting Thank you so much From India 🇮🇳
@CGPython
@CGPython 9 ай бұрын
Thank you for the idea! ❤️
@2and3d_com
@2and3d_com 8 ай бұрын
great tutorial... please how do you select a particular vertices and merge them, i have been having a hard time figuring this out
@CGPython
@CGPython 8 ай бұрын
Here is an example of using bmesh.ops.collapse ``` # get a reference to the active object mesh_obj = bpy.context.active_object # create a new bmesh and initialize it from mesh data in Edit Mode bm = bmesh.from_edit_mesh(mesh_obj.data) selected_edges = [edge for edge in bm.edges if edge.select] selected_edge = selected_edges[0] bmesh.ops.collapse(bm, edges=[selected_edge]) bmesh.update_edit_mesh(mesh_obj.data) # clean up/free memory that was allocated for the bmesh bm.free() ```
Creating a Mesh from Scratch with Python
13:04
CG Python
Рет қаралды 6 М.
The most important Python script I ever wrote
19:58
John Watson Rooney
Рет қаралды 129 М.
A pack of chips with a surprise 🤣😍❤️ #demariki
00:14
Demariki
Рет қаралды 35 МЛН
🍟Best French Fries Homemade #cooking #shorts
00:42
BANKII
Рет қаралды 62 МЛН
Python Decorators Explained
0:32
CG Python
Рет қаралды 10 М.
If Blender Is Free Why Studios Don't Use it
10:43
InspirationTuts
Рет қаралды 296 М.
Getting Started with Scripting in Python
49:24
Blender
Рет қаралды 12 М.
5 Steps to setup VSCode for Blender Python (on Windows)
12:29
CG Python
Рет қаралды 20 М.
Should You give up Learning Blender Python?
6:25
CG Python
Рет қаралды 5 М.
Automate your job with Python
6:07
John Watson Rooney
Рет қаралды 358 М.