How to Make Meshes with Python in Blender!

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 มิ.ย. 2024
  • Talking about constructing meshes with Python in Blender.
    Watch my crash course: • Python Crash Course fo...
    Visit my website: curtisholt.online/
    Visit the Sketchfab store: sketchfab.com/store
    USEFUL LINKS:
    ==========
    Intro to Coding: • Introduction to Coding
    BMesh Documentation: docs.blender.org/api/current/...
    CHAPTERS:
    ==========
    00:00 - Intro
    00:36 - Main Data Types
    01:44 - Accessing Object Data
    02:27 - Getting Vertices
    02:56 - Getting Edges
    05:02 - Get Vertex From Edge
    05:46 - Vertex Counts For Faces
    06:26 - Getting Faces
    06:54 - Creating Vertices
    07:27 - Creating Edges
    09:58 - Skin Modifier Tip
    10:59 - Creating Faces
    11:26 - Building the Mesh (pydata)
    14:23 - BMesh
    14:40 - Final Thoughts
    15:19 - Sponsor (Sketchfab)
    15:51 - Outro
    Social / Discord and Store Links:
    curtisholt.online/links
    #blender #tutorial #python

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

  • @MMmmmVarley
    @MMmmmVarley 3 ปีที่แล้ว +15

    Dating myself here a bit, but... This oddly takes me back to the mid 80's when I got my first view at creating computer graphics, plotting out X,Y coordinates, setting radius, and, you have a circle! Thanks for this Curtis, looking forward to more.

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

      And DBW Render took that into three dimensions on the Amiga. Heady days, those... scan-lines creeping across the screen... cooling fans ruffling the curtains... pixels baking in an A1080 CRT... and the inevitable crash, sigh, and hope you God you saved the file before hitting render.

  • @trevorfranks69
    @trevorfranks69 3 ปีที่แล้ว +23

    No I'm not afraid of code, I'll watch 😂

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

    Best Programming tutorial for blender till now! Excellent Work Curtis!

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

    This is a wonderful beginner series!! 💯

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

    Thanks a lot for these Python videos. I know they are a bit old now, but they are very helpful. I'm trying to use Blender for math visualization for education purposes. There's a lot of stuff I want to automate, and I think once I get the hang of things, scripting is going to be very handy. I'm having a really hard time trying to figure out how to access and manipulate the data that I want through scripting. This and your "Crash Course" scripting video were very helpful and I'd definitely watch more of these if you ever start them up again.

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

    loving the content, please keep the programming series coming

  • @SHIVAM.M.S
    @SHIVAM.M.S 3 ปีที่แล้ว +4

    Thanks for the great tutorials Curtis :-)

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

    Please keep up these tuts, they're excellent

  • @HeadInstead
    @HeadInstead 3 ปีที่แล้ว +17

    Great, thank you very much!
    For me it only worked when I replaced
    col = bpy.data.collections.get("Objects")
    with
    col = bpy.data.collections.get("Collection")
    (I use Blender 2.90.0)

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

      Yes, that's just you specifying what collection you want to use. In my scene, I had a collection called 'Objects', so that's what I used :)

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

      @@CurtisHolt Ah, yes I see! So I just had to look at the name of the collection on the top right of the screen (in my case it was 'Collection' by default already), which makes a lot of sense. I was thinking about some default from the bpy library, but of course it is linked with the current state of the scene!
      Thanks a lot for your tutorials, I just got started with Blender and I am amazed by what I can do with it :)

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

      @@CurtisHolt That's why I couldn't get it to work!!! ;)

    • @5daydreams
      @5daydreams 8 หลายเดือนก่อน

      Ohhh, so this was a string based thing - no wonder mine wasn't working either - MVP comment

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

    Nice and clear explanations! You've made a very good work here, thank you it was really helpful. Now I can summon meshes from csv datafile as data curves and visualize them as surfaces that I can split with animated planes to really get some grip on what's happening in my process!!! Nothing of this would have been possible without first understanding how to create the mesh so a googol of thanks to you sir! :) :) :)

  • @christophervaca7116
    @christophervaca7116 3 ปีที่แล้ว +3

    I love these python tuts.

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

    Good one.
    Many Thanks for sharing your knowledge.

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

    This will probably change my life (for the better). Thank you sooooo much :D

  •  3 ปีที่แล้ว +1

    Thanks for sharing this!

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

    Great explanation! Ty man

  • @GiulioBuscaroli
    @GiulioBuscaroli 3 ปีที่แล้ว +3

    This is super useful man!
    I know that it may not be the fancy shining side of blender but you are helping us unlock the real potential of this wonderful tool.
    What sources do you suggest to dive deeper into scripting for blender and getting familiar with APIs?
    Keep pushing on this and thank you again

  • @AB3D-tutorials
    @AB3D-tutorials 3 ปีที่แล้ว +3

    Awesome! Thank you so much. I was wondering how to do this.

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

    More videos about Python in Blender, please!!!
    Great content!!!

  • @sikritidakua
    @sikritidakua 3 ปีที่แล้ว +3

    Code is what I do all day 😂
    Thank you so much for the great tutorial

  • @etdle7
    @etdle7 3 ปีที่แล้ว

    I was waiting for this!

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

    Great video! Please keep on making Python in Blender vids! Thank you.

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

    Thank you for sharing !

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

    Brilliant. Thanks!

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

    Great work👏👏👏

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

    greate explanation! thank You!

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

    high quality stuff!

  • @arnabmukherjee7926
    @arnabmukherjee7926 3 ปีที่แล้ว +3

    yay curtis is back!!!!!!

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

    Hey Curtis, thanks for the tutorial - really helpful!
    Have you considered keeping such videos at 30fps? IMHO 60fps doesn't add anything, and just makes playback more resource-intensive (i.e takes more bandwidth & makes my potato PC stutter). I do appreciate the big text, but text can always use more resolution to make it sharper, and right now I can only watch it in blurry 480p

  • @thewhiterabbit661
    @thewhiterabbit661 3 ปีที่แล้ว +3

    Love how you show the code AND explain it, now i can make more of my own code and not copy tutorials all the time.

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

      however i still cant get any of this code to work

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

    Great tutorial series, I'm just a bit confused about this one (Im using Blender 3.2)...at 2:12, is that something we do at the start, before we start appending to vertices and edges? Because around 7:37 I don't get a new edge. How does the edges array know anything about the verts array indices? Also nothing from my script prints to my console. Everything in the previous intro tutorial worked perfectly.

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

    Really really thank you for your kind teaching
    But I have a question I want to make parametric surface in specific boundary
    So I want to make vertices set 2 dimension , vert[i][j]
    How to make it??

  • @davidcaro
    @davidcaro 3 ปีที่แล้ว

    Nice one! Thank you again. One question, when adding modifiers to an object, can we select or get any new verts or data? I mean for example a bevel modifier on verts. Will create new faces. Can I access the data from that new faces?

    • @eduardoluizpadilha779
      @eduardoluizpadilha779 3 ปีที่แล้ว

      knowing how blender works normally, no. You will need to apply them before having access to this.

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

    It's a really nice tutorial, great style, pacing and explanations. But I'm missing some crucial information. How do I write points to an existing mesh for example?

  • @JuanGonzalezOrtodoncia
    @JuanGonzalezOrtodoncia 3 ปีที่แล้ว

    I know this is outside the scope. But I'm trying to create a script to select the closest vertices in a mesh to a second mesh selected vertices. I cannot use the closest point on mesh function in BLender 2.8 (maybe they change it). Maybe you know a way I could work around it?. I appreciate any help you may provide that points me in the right direction.

  • @Xraller
    @Xraller 3 ปีที่แล้ว

    So can I model an object and then print out that info to use for a new mesh?

  • @rajeevranjan8270
    @rajeevranjan8270 3 ปีที่แล้ว

    hi there
    I love your work . concise information to the point.i want to ask please tell me to develop how to develop core computer graphic library.python is all about to use library in backend.even in face builder add-on has core library in c .so please help me so that i can start coding .

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

    We need more of python for blender tuts.

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

    非常感谢😂

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

    I cant apply vertices coodinations to the list, if I don't write a Plus in front of the bracket.
    vert.append([1
    +(v.co.x),
    +(v.co.y),
    +(0.0)
    ])
    why ist that? I cant't use it like that, because the X coordinate of the second point allways ends up beeing 0. I think it tries to calculate the same negative value with it's positive counterpart.

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

    Thanks for this tutorial Curtis.
    But I got lost. In the first Part of the video, before 06:54, we were just exploring what vertices are in an object
    After 06:54 is the actual vertices creations ? The lists created are just lists: not linked to bpy or the active_object
    verts = []
    edges = []
    faces = []
    so.data.vertices.append gives an error: AttributeError: 'bpy_prop_collection' object has no attribute 'append'
    How we actually gives those lists with those coordinates to bpy ?
    Also I don't understand how edges.append([0,1]) it's not linked to verts
    Sorry if the solution is in your previous coding videos, but I did watch them and still can't figure it out

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

      This video is showing you how to access the mesh data from a pre-existing object, and create a new object from scratch, not how to add new mesh data to a pre-existing object.
      After 6:54, I begin showing you how to create a mesh from scratch which begins by creating lists of data which will eventually be passed to mesh.from_pydata (11:29), to actually create the mesh.

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

    What is Mesh.loops and why do we need they?

  • @MultiSaded
    @MultiSaded 3 ปีที่แล้ว

    If I have created a rectangle and I want to orient (bending) in their middle with an angle, Can I do this with Python in the blender?

    • @MultiSaded
      @MultiSaded 3 ปีที่แล้ว

      @@viveksachan11 Can you help me how can bending a rectangle with angle?

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

    for me, it went wrong with "AttributeError: 'BlendData' object has no attribute 'collections'"
    what blender version is this? (I'm trying here on blender 2.76b)

  • @FineStudios
    @FineStudios 3 ปีที่แล้ว

    Sir,how to create a backdrop in 3d view with python?
    Sir please help me

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

    Hi great tutorial 😋 but i have a question:do i really have to use python in blender. like i really don't see the importance of using it can you tell me what can i make only with python.

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

      The reason I'm learning scripting is so that I have more control over procedural animations. Right now I'm trying to make a spirograph type animation where I have some line segments linked to each other that rotate and move around in 3D space. I want the endpoints of the rotating segments to draw a curves as they move through space. I'm finding it very hard to automate this using Geometry Nodes and it seems like scripting is going to be the best solution.

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

    Python: File "\Text", line 1
    vertices*
    ^
    SyntaxError: invalid syntax
    location: :-1
    I am facing this error what should i do?

  • @Drew_Vernon
    @Drew_Vernon 3 ปีที่แล้ว

    Am I right in thinking that bmesh is faster than bpy.data.meshes ????

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

    Is there a way to set a different color for the edge of a cube? 🙄

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

    Very Interesting. But surely the order of the Vertices in declaring a Face is important is it not ?
    Typically in 3D modelling the order of Vertices, associated with a face defines the front/ back face directions. So if you want to see the face, avoid it becoming a back face, you would need to order the Vertices in a Clockwise form the perspective of a viewer looking at the front face.

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

    sir show full code,,im stuck from where to start

  • @NICK....
    @NICK.... 3 ปีที่แล้ว

    For people who can't be arsed to copy everything:
    import bpy
    verts = []
    edges = []
    faces = []
    verts.append([0.0,0.0,0.0])
    name = "New Object"
    mesh = bpy.data.meshes.new(name)
    obj = bpy.data.objects.new(name, mesh)
    col = bpy.data.collections.get("Objects")
    col.objects.link(obj)
    bpy.context.view_layer.objects.active = obj
    mesh.from_pydata(verts, edges, faces)

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

    ChatGPT + Python + Blender ❤

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

    nice video, not impressed with the blender's python API design so far, but maybe it will grow on me.

  • @DrRed2x
    @DrRed2x 3 ปีที่แล้ว

    0:00 what do you mean who is allergic to code

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

    Heads up for anyone who is confused. Print() only outputs to the system console which is stupidly only available in that windows trash.

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

    I am not afraid of this coding shit....I'll watch this.
    1:45 😄😄😅😅imma head out .............

  • @hax_gosha4784
    @hax_gosha4784 3 ปีที่แล้ว

    making this a engine features ingame where money

  • @Just3DThings
    @Just3DThings 3 ปีที่แล้ว +3

    First

  • @SmellyNutz
    @SmellyNutz 3 ปีที่แล้ว +7

    Rates of infection. [This is a meme, values aint accurate]
    Standing 1cm apart: 100%
    Standing 1m apart: 50%
    Standing 2m apart: 10%
    Like Programming?: 0%

  • @hereb4theend
    @hereb4theend 3 ปีที่แล้ว

    Son... Are you.. are you Coding??!
    Ah! No mom I swear. I was just watching porn.

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

    Binod

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

    this video must be 18+

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

    This is awesome, but impossible to focus due to stupid background sounds!

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

    Not sure if I typed something incorrectly but I'm using Blender 3.3 and at 11:30 it was not working for me to define col = bpy.data.collections.get("Objects"). It was giving me an error in the next line when trying to link.
    I fixed it by replacing the command above with col = bpy.context.collection instead.