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.
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.
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?
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) th-cam.com/video/TJXtio1YDCw/w-d-xo.html
@@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!
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?
@@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.
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!
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
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
You can actually update the split normals via the mesh data (without bmesh) Here is an example gist.github.com/CGArtPython/96abf841bd732ee54a6c89643df45cab
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.
Was wondering why we use this on bmesh leverl and why not simply run the bevel operator in the active object. What is the difference. Not sure I saw that in the video
Great question! Yeah, you are correct that we can also use a bevel op. With bmesh you can chain multiple types of edits and you have more control over the mesh editing process. Also, the Blender devs outline some issues when if you use operators docs.blender.org/api/current/info_gotcha.html#using-operators
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
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
@@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
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.
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() ```
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!
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.
@@CGPython The best way to tackle a large problem is to break it down into small parts! So, I totally agree!
Got pointed to your channel through your sponsorship on @CurtisHolt Blender 4.0 video. Look forwarded to following your content as well! 👏👏👏
Welcome aboard! ❤️🚀
You're back !! great !!
Yes! Thank you!
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.
Thank you!
Yes, I want to cover that as well.
Stay tuned 📺
Found you from film booth. I’m glad I did 💪
I'm glad you did! Welcome aboard!
A great introduction, Thanks so mesh, I mean much 👍👍
Glad you liked it! 🥳
Thank you so much for your videos! I am working my way slowly through all of them. You are an excellent teacher!
You're very welcome!
I'm really happy you like them! 🥳
Great Intro Video!
I'm glad you like it
Great video!
Thank you! Glad you enjoyed it.
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?
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)
th-cam.com/video/TJXtio1YDCw/w-d-xo.html
@@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!
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?
@@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.
Excellent. Thanks!
Amazing!
Thank you! Cheers!
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!
Thanks for the idea!
Do you have an example script you are using this in?
So I can understand your use case better
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
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
You can actually update the split normals via the mesh data (without bmesh)
Here is an example
gist.github.com/CGArtPython/96abf841bd732ee54a6c89643df45cab
You'er my hero!@@CGPython
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.
Thanks for the tip! 💖
How about when the scripting option is not up there?
sorry, I don't understand what you are asking about
Was wondering why we use this on bmesh leverl and why not simply run the bevel operator in the active object. What is the difference. Not sure I saw that in the video
Great question!
Yeah, you are correct that we can also use a bevel op.
With bmesh you can chain multiple types of edits and you have more control over the mesh editing process.
Also, the Blender devs outline some issues when if you use operators
docs.blender.org/api/current/info_gotcha.html#using-operators
This did help - but how do I bevel only one edge e.g. with index = 11?
I had an example of beveling a single edge
gist.github.com/CGArtPython/bc10b8a9b6e4934458bb664d8f45f1e1
This is so useful, thankk you thank you CG Python
You're very welcome!
Thank you for the tutorial you provided for beginner. If possible could you please upload videos with some better voice output.
Thank you for your feedback
Can you share exactly what you don't like about the audio quality?
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
Got it!
What do you mean by “scene optimization”?
@@CGPython creating instance of object collection for faster rendering
the music is too loud@@CGPython
Hi! If I already have a GLTF file or a model made can I export python code that will create the exact same model?
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
@@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
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.
As of blender 4.0, you do not need to add bmesh update
Hi. Great video. Can you make tutorial how to insert pose asset browser to keyframe? Thank in advance. Subscribed.
Thank you for the idea! 💪
I'll think about it 🤔
Please make the complete series on a beginner to advanced level blender bone and rigging series by scripting
Thank you so much From India 🇮🇳
Thank you for the idea! ❤️
great tutorial... please how do you select a particular vertices and merge them, i have been having a hard time figuring this out
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()
```