Creating a Mesh from Scratch with Python

Sdílet
Vložit
  • čas přidán 9. 07. 2024
  • Learn to create 3D meshes using Blender's bmesh Python module in this tutorial! Master getting references to vertices, edges, and faces and learn about Python's list comprehension feature. This will be a fast-paced, step-by-step guide for taking your Blender Python skills to the next level. #Blender3D #Bmesh #python
    Links to the code:
    Creating a pyramid from scratch using the Bmesh Blender Python module
    gist.github.com/CGArtPython/5...
    Creating an icosphere using the Bmesh Blender Python module
    gist.github.com/CGArtPython/4...
    Get selected verts via list comprehension
    gist.github.com/CGArtPython/6...

Komentáře • 42

  • @exhilex
    @exhilex Před 10 měsíci +6

    Python with blender is extremely powerful and let me tell you that you are doing a wonderful job taking all the complex documentation stuff and bringing to the audience such beginner friendly tutorials!

    • @CGPython
      @CGPython  Před 10 měsíci +1

      I'm delighted that you think that way about my work! 😊
      Thank you!

  • @RomboutVersluijs
    @RomboutVersluijs Před 6 dny

    Nice! Inwas looking at an API from a 3d foliage provider. They have modules for their own models and I got it working exporting obj files. Now using this to make blender models directly in blender will be way faster. No need for export and than import

  • @commonpike
    @commonpike Před 8 měsíci +3

    Perfect tutorial. Speed is good, simple enough. Thank you.
    Personally, I could do without the music :-) While toying along, I'm pausing all the time, so I'm not enjoying the music anyway.

    • @CGPython
      @CGPython  Před 7 měsíci

      You are welcome! ❤️
      Thank you for the feedback about the music!

  • @mind_of_a_darkhorse
    @mind_of_a_darkhorse Před 10 měsíci +1

    Great tutorial! I just started to use List Comprehension and it sure simplifies things, but is a little hard to get use to after doing it the old way! LOL! Keep up the great work!

    • @CGPython
      @CGPython  Před 10 měsíci +1

      Thanks! 😊
      You can do it! I also had a hard time when I was just starting to use List Comprehension.
      You just need to keep practicing, and it will become second nature to you. 💪

  • @williamanim4267
    @williamanim4267 Před 10 měsíci +1

    i really love your content man, its priceless!!
    Thank you so much for share it with the comunnity ^-^

    • @CGPython
      @CGPython  Před 10 měsíci

      I appreciate that! ❤️
      I am glad you like it

  • @exhilex
    @exhilex Před 10 měsíci

    May this video reach more people

  • @mepro3432
    @mepro3432 Před 9 měsíci +1

    Ur the best tutorial vd incould say frfr

  • @user-wg4oo3uv7k
    @user-wg4oo3uv7k Před 3 měsíci

    Thanks for the new information! Please tell me if the channel has content on programming tools such as bpy.ops.mesh.loopcut_slide or loop tools?

    • @CGPython
      @CGPython  Před 3 měsíci

      Happy to help
      At this point it does not have that content

  • @driftwood-f4p
    @driftwood-f4p Před 10 měsíci

    I want to know how to do procedural modeling, such as creating a custom shape and then adjusting the width and height, or shape.

  • @mingothemongo4466
    @mingothemongo4466 Před 10 měsíci

    such good stuff!

  • @davedumas0
    @davedumas0 Před 9 měsíci

    it has a hard time with geo nodes but if i feed it your "helper code" first and it does much better it only had a hard time with the names of the geo nodes so i just put a dict with a list of a bunch in the code before i post to GPT and it does much better

  • @RomboutVersluijs
    @RomboutVersluijs Před 5 dny

    I was wondering if there would be a speedup if we use bumpy. This is just a small model. I'm thinking of using it to generate foliage. I've got the data in different kind of arrays. It's basically on big list, so I need to first make an array of 3. Wonder if nunoy will be faster

    • @CGPython
      @CGPython  Před dnem

      by "bumpy" and "nunoy" you mean NumPy, right?
      NumPy would make things faster

  • @RomboutVersluijs
    @RomboutVersluijs Před 6 dny

    Did you get those face indices by actativating the overlay for that. Was wondering how your got those numbers

    • @CGPython
      @CGPython  Před dnem

      You need to enable the Developer Extras in the preferences
      Here is what I did
      czcams.com/video/9WnNRD8viX8/video.html

  • @TarasFTR
    @TarasFTR Před 10 měsíci

    I am writing add ons with geometry node. How knows, how to read object/mesh from node input and how to set object/mesh in node output? I can't find anything

    • @CGPython
      @CGPython  Před 10 měsíci

      Hello
      I'm not 100% sure what you are asking.
      Are you asking how you can use the Object Info node and select a mesh?
      Do you have some sample code or maybe a CZcams video link that shows what you are asking about or trying to do?
      If you want to send me a link, you can find me on Twitter and send me the link there @cgpython
      IIRC CZcams doesn't allow links in comments

  • @RomboutVersluijs
    @RomboutVersluijs Před 5 dny

    Which video is the follow-up for this one?

    • @CGPython
      @CGPython  Před dnem

      It is this one czcams.com/video/aSkgwf0SX_k/video.html
      Thank you for pointing this out!
      I forgot to link it 🫠

  • @dev.ashesh
    @dev.ashesh Před 9 měsíci

    how to read a binary file that contains an object and create it to blender ?

    • @CGPython
      @CGPython  Před 9 měsíci

      Hello,
      What is the format of your binary file?

    • @dev.ashesh
      @dev.ashesh Před 9 měsíci

      @@CGPython .TMB file and .THM file..

    • @CGPython
      @CGPython  Před 9 měsíci

      sorry, I have not worked with this file formats.
      Looks like this might work with tmb files
      github.com/0ceal0t/BlenderAssist#tmb-and-pap-files

  • @RomboutVersluijs
    @RomboutVersluijs Před 6 dny

    I'm confused why you run a sub for loop for those fave_vert_indices. It's basically a list of 4 items. So why do you run another for loop on each. Each item in that vert_ind8ces, only consist of 1 item, a single number. Or are you getting the coordinates of each face vertices. Not sure how the code reads that from only using index. I guess these are not random names, they are actually bmesh names for the attributes

    • @CGPython
      @CGPython  Před dnem

      At this point I am going to guess you watched the rest of the video where we add more items to the fave_vert_indices.
      We need to define each face using the index of the verts.

  • @davedumas0
    @davedumas0 Před 9 měsíci

    have you attempted to play with chat-GPT for writing scripts for blender kinda fun!

    • @CGPython
      @CGPython  Před 9 měsíci

      Hey,
      Yes, I have, it is very cool!
      But I had mixed luck in getting it to do more complex things.
      A person without any Python knowledge might have a bit of trouble getting some scripts to work.
      When 95% of the script is correct, getting that 5% might be very challenging if you don't know what to ask to fix the issue.

    • @davedumas0
      @davedumas0 Před 9 měsíci

      yeah im having the same issue but i got a script set up with a bunch of helper functions and i post that to give the api context of what im going it still gets stuff wrong mostly because the blender im using came out after 2021 so commands are a little different
      @@CGPython

  • @wissammmax
    @wissammmax Před 10 měsíci

    thanks alot for your beneficial content

  • @curlyflipper2020
    @curlyflipper2020 Před 10 měsíci +1

    Hey thanks for the tut u made. I was wonder if you could do me a flavor ? I tried doing some research on how to get the best score 'python bge ' , however it's too complicated to make out with how to make use of any of it . Below this is the code i that im using . I have some ideas on how to add a best score in this fashion , Scene 1 save current score , Scene 2 load current score , and Scene 3 load best score . However I was wondering if you could make some sense how to do this ?
    import bge
    from bge import logic
    path = logic.expandPath('//')
    def save():
    cont = bge.logic.getCurrentController()
    own = cont.owner
    info = own ['Text']
    file = open(path+'The_Score.txt', 'w')
    file.write(str(info))
    def load():
    cont = bge.logic.getCurrentController()
    own = cont.owner
    info = own ['Text']
    file = open(path+'The_Score.txt', 'r')
    line = file.readline()
    print(line)
    own ['Text'] = int(line)

    • @CGPython
      @CGPython  Před 10 měsíci +1

      Hello!
      I'm not too familiar with BGE, so I can't really help you here, sorry.
      It does look like valid Python code, but it is not closing the file after opening it for reading or writing.
      www.w3schools.com/python/ref_file_close.asp
      Consider using the with statement that will automatically close the file
      www.freecodecamp.org/news/with-open-in-python-with-statement-syntax-example/