Blender Scripting Guide: Mastering Mesh Editing with Python

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 พ.ย. 2024

ความคิดเห็น • 60

  • @mind_of_a_darkhorse
    @mind_of_a_darkhorse ปีที่แล้ว +4

    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  ปีที่แล้ว +1

      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 ปีที่แล้ว

      @@CGPython The best way to tackle a large problem is to break it down into small parts! So, I totally agree!

  • @KevinMerinoCreations
    @KevinMerinoCreations ปีที่แล้ว +1

    Got pointed to your channel through your sponsorship on @CurtisHolt Blender 4.0 video. Look forwarded to following your content as well! 👏👏👏

    • @CGPython
      @CGPython  ปีที่แล้ว +1

      Welcome aboard! ❤️🚀

  • @ludthx
    @ludthx ปีที่แล้ว +1

    You're back !! great !!

    • @CGPython
      @CGPython  ปีที่แล้ว

      Yes! Thank you!

  • @rafamichalski6150
    @rafamichalski6150 ปีที่แล้ว +2

    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  ปีที่แล้ว +1

      Thank you!
      Yes, I want to cover that as well.
      Stay tuned 📺

  • @AlHowell
    @AlHowell ปีที่แล้ว +1

    Found you from film booth. I’m glad I did 💪

    • @CGPython
      @CGPython  ปีที่แล้ว +1

      I'm glad you did! Welcome aboard!

  • @JosueMartinez-ww1vj
    @JosueMartinez-ww1vj ปีที่แล้ว +1

    A great introduction, Thanks so mesh, I mean much 👍👍

    • @CGPython
      @CGPython  ปีที่แล้ว +1

      Glad you liked it! 🥳

  • @teccc42
    @teccc42 ปีที่แล้ว +1

    Thank you so much for your videos! I am working my way slowly through all of them. You are an excellent teacher!

    • @CGPython
      @CGPython  ปีที่แล้ว

      You're very welcome!
      I'm really happy you like them! 🥳

  • @dshot92
    @dshot92 ปีที่แล้ว

    Great Intro Video!

    • @CGPython
      @CGPython  ปีที่แล้ว

      I'm glad you like it

  • @stefanguiton
    @stefanguiton ปีที่แล้ว +1

    Great video!

    • @CGPython
      @CGPython  ปีที่แล้ว

      Thank you! Glad you enjoyed it.

  • @Crowdrender
    @Crowdrender ปีที่แล้ว +1

    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  ปีที่แล้ว +1

      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

    • @Crowdrender
      @Crowdrender ปีที่แล้ว

      @@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  ปีที่แล้ว +1

      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 ปีที่แล้ว +1

      @@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.

  • @ShirazHazrat
    @ShirazHazrat ปีที่แล้ว

    Excellent. Thanks!

  •  ปีที่แล้ว

    Amazing!

    • @CGPython
      @CGPython  ปีที่แล้ว

      Thank you! Cheers!

  • @alextsui8551
    @alextsui8551 ปีที่แล้ว +1

    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  ปีที่แล้ว

      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 ปีที่แล้ว

      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 ปีที่แล้ว

      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  ปีที่แล้ว

      You can actually update the split normals via the mesh data (without bmesh)
      Here is an example
      gist.github.com/CGArtPython/96abf841bd732ee54a6c89643df45cab

    • @alextsui8551
      @alextsui8551 ปีที่แล้ว

      You'er my hero!@@CGPython

  • @briantriesart
    @briantriesart 7 หลายเดือนก่อน

    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  7 หลายเดือนก่อน +1

      Thanks for the tip! 💖

  • @captaincharles9166
    @captaincharles9166 15 วันที่ผ่านมา

    How about when the scripting option is not up there?

    • @CGPython
      @CGPython  11 วันที่ผ่านมา

      sorry, I don't understand what you are asking about

  • @RomboutVersluijs
    @RomboutVersluijs 4 หลายเดือนก่อน

    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

    • @CGPython
      @CGPython  4 หลายเดือนก่อน

      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

  • @felkonx
    @felkonx หลายเดือนก่อน

    This did help - but how do I bevel only one edge e.g. with index = 11?

    • @CGPython
      @CGPython  หลายเดือนก่อน

      I had an example of beveling a single edge
      gist.github.com/CGArtPython/bc10b8a9b6e4934458bb664d8f45f1e1

  • @mixchief
    @mixchief ปีที่แล้ว

    This is so useful, thankk you thank you CG Python

    • @CGPython
      @CGPython  ปีที่แล้ว

      You're very welcome!

  • @AbhinavKumar-po9hk
    @AbhinavKumar-po9hk ปีที่แล้ว +1

    Thank you for the tutorial you provided for beginner. If possible could you please upload videos with some better voice output.

    • @CGPython
      @CGPython  ปีที่แล้ว

      Thank you for your feedback
      Can you share exactly what you don't like about the audio quality?

    • @AbhinavKumar-po9hk
      @AbhinavKumar-po9hk ปีที่แล้ว

      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  ปีที่แล้ว

      Got it!
      What do you mean by “scene optimization”?

    • @AbhinavKumar-po9hk
      @AbhinavKumar-po9hk ปีที่แล้ว +1

      @@CGPython creating instance of object collection for faster rendering

    • @guy_roh
      @guy_roh 10 หลายเดือนก่อน

      the music is too loud@@CGPython

  • @WhatsThisStickyStuff
    @WhatsThisStickyStuff 9 หลายเดือนก่อน

    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  9 หลายเดือนก่อน

      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 9 หลายเดือนก่อน

      @@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  9 หลายเดือนก่อน

      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 8 หลายเดือนก่อน +1

    As of blender 4.0, you do not need to add bmesh update

  • @danil9843
    @danil9843 ปีที่แล้ว

    Hi. Great video. Can you make tutorial how to insert pose asset browser to keyframe? Thank in advance. Subscribed.

    • @CGPython
      @CGPython  ปีที่แล้ว

      Thank you for the idea! 💪
      I'll think about it 🤔

  • @okayBro0001
    @okayBro0001 ปีที่แล้ว

    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  ปีที่แล้ว +1

      Thank you for the idea! ❤️

  • @2and3d_com
    @2and3d_com ปีที่แล้ว

    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  ปีที่แล้ว

      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()
      ```