Creating a Mesh from Scratch with Python
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...
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!
I'm delighted that you think that way about my work! 😊
Thank you!
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
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.
You are welcome! ❤️
Thank you for the feedback about the music!
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!
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. 💪
i really love your content man, its priceless!!
Thank you so much for share it with the comunnity ^-^
I appreciate that! ❤️
I am glad you like it
May this video reach more people
Thank you! ❤️
Ur the best tutorial vd incould say frfr
Thanks
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?
Happy to help
At this point it does not have that content
I want to know how to do procedural modeling, such as creating a custom shape and then adjusting the width and height, or shape.
such good stuff!
Thank you!
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
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
by "bumpy" and "nunoy" you mean NumPy, right?
NumPy would make things faster
Did you get those face indices by actativating the overlay for that. Was wondering how your got those numbers
You need to enable the Developer Extras in the preferences
Here is what I did
czcams.com/video/9WnNRD8viX8/video.html
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
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
Which video is the follow-up for this one?
It is this one czcams.com/video/aSkgwf0SX_k/video.html
Thank you for pointing this out!
I forgot to link it 🫠
how to read a binary file that contains an object and create it to blender ?
Hello,
What is the format of your binary file?
@@CGPython .TMB file and .THM file..
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
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
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.
have you attempted to play with chat-GPT for writing scripts for blender kinda fun!
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.
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
thanks alot for your beneficial content
It's my pleasure
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)
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/