Blender Python Scripting Tutorial : 5 Scripting Tips for Beginners [learn python for beginners]

preview_player
Показать описание
In this Blender Python Scripting Tutorial, I wanted to share with you 5 things I think will help when writing your scripts / add-ons. Some of these tips you may already know, some of them you might not.

Looking to learn Python for beginners? You are in the right place. Be sure to check out the Scripting Playlist!.

Timestamps:
0:00 - Intro
0:25 - Blender Docs
1:24 - Python console
4:30 - Built-in Templates
5:40 - Properties Toolbar (ctrl + T)
9:45 - Edit Source

There are many Additional tools that can be used in order to improve the Text editor and if you guys are interested, I will be doing a video on more advanced tools for the text editor.

I hope you find this Blender Python Scripting Tutorial helpful and as always, thanks for watching!..

Рекомендации по теме
Комментарии
Автор

thank you very much, even though I'm Russian, but with subtitles I understand you perfectly and study, continue in the same vein, you deserve a large audience

stemir
Автор

Hey, man these where really useful to say these are pretty helpful tutorials and you should defiantly continue with more advanced in-depth ones. 10/10

epicXfiles
Автор

Wow thank you! Pointing me to the quickstart guide is really helpful for me! Thanks for taking time to make these videos!

tymothylim
Автор

All great tips for beginners - especially the console! A little out-dated now, but Blender's developments can run quite fast.

I feel the best tip you gave was to use the console. Back in the day, this helped me understand more of what's available to me without jumping into documentation very much. I was able to explore the API, object data structures and play around with manipulating things before I even finalised my approach in the add-on. FYI: you can use the "tab" key on your keyboard to have a list of options displayed for you. If that doesn't show anything, ensure there is a period and then try to "tab". 😉

The second-best tip, for me, was directing people to the documentation. Believe me: you will dip into it a lot, depending on what you're doing! 😋

An extra tip from me would be to experiment. Blender has some quirks, and you'll need to eventually understand these quirks (to a degree) in order to make certain things work. For example: I'm working on an add-on which uses Geometry Nodes and shows text in the 3D scene. If I update the text via the add-on UI, by directly exposing and manipulating the string value in the add-on UI as a property, the updated text will NOT be displayed in the 3D scene automatically. However, I found that if I reassign the currently selected object's X location back to itself (obj.location.x = obj.location.x) it will "nudge" and force an update and the updated text will be displayed. It's a little weird, but this is where experimentation comes into play, perhaps as well as general experience. So, on that front, I would also add and urge people to ask questions in forums if the console, API documentation and internet searches yield unclear results.

For more familiar/deeper-diving developers I would suggest that if your add-on is several hundred lines of code - especially if over a thousand - consider breaking up the add-on across several files so that the code is a little easier to manage (breaking up the code by area of concern). I would also suggest creating a custom add-on template which includes a base Panel class with helper methods for defining UI operators, labels, properties, etc. I found this cleaned up my UI code quite significantly because I was no longer needing to write two or more lines of code in order to show and place a UI element. Instead, due to my helper methods, I can typically define and place a UI element with one line of code and keep the main UI code clean, simple and more readable.

I love developing Blender add-ons. It can sometimes be a pain in the neck, depending on what you're trying to do, but the fact we can add and extend Blender's functionality via Python is awesome! 🙃

sludgiebear
Автор

Sir, you are amazing in blender python addon programming.I learnt a lot.
I develop many scripts for after effects.not in blender and iam curious about blender addon developing.but languages are different. In after effects i use JavaScript but in blender python is used.
Your tutorials help a lot to me.
In youtube, there is so many tutorials for blender scripting.but your tutorials are good.because you teach from the basics to advance
Thanks sir

FineStudios
Автор

Why don't you use VIM / vscode / notepad++ / sublime text. Most programmers eventually find themselves using VIM though tbh.
I still use the Blender scripting layout for testing stuff. You can install the stuff you need via pip. Thanks for the videos Darkfall!

darcytaylor
Автор

for edit source enable developer extras in edit->preferences->interface or it want show

dchristop
Автор

Weird that you didn't mention the "Data API" outliner mode. I personally felt like I found a holy grail, no more Ctrl-Tab'ing randomly, all the data is interactable and has a lot of useful tooltips.

WeaselOnaStick
Автор

Cool Video, but how did you do these chapters in the Youtube timeline? Youtube breaks the chapters of your video down in the timeline so you can see which chapter starts when.

BlenderDefender
Автор

Thanks for these valuable tips.
However I don't have the "Edit Source" option in 2.82 or 2.83, do you use an addon ?
I've tried the Edit Operator Source addon but it's not working anymore and it's not working with a right clic on the property

ratus
Автор

Thank u so much for yr videos really usefull) But i have some questions and dont how to write u, in this case i stay it here ( my problem: i have a plane with 4 vertices and i want to select one of them and move, i try to write some code but nothing work)

grigorarakelyan
Автор

Hi Darkfall,
fist of all, thank's for your videos. They are awesome. I just started with creating my own addons and your playlist is pretty much the only one useful to me. I have an idea for another topic, which would help me a lot. I explain it on an example. I try to make a Favorite tab and would like to place the "Show edge length" button. When I click on it, it shows: = True
. So I tried to implement this, like you showed in the first video: But unfortunately it doesn't work. So I was wondering, is it overlay, or data.overlay.? Or is it even an operator (row.operator)? Or a types (row.types) ? I am very confused what belongs into which category.
Or another example: When I click on the button Recalculate Normals inside, I see this: When I try to implement this in my addon like this:, I still see only "Flip normals". And I don't know how to implement this. Also the "Edit Source" is not available, maybe it's because I am using 2.9 version. So I would like to know, how to exactly find the correct way to get the references. Or, how to use the documentation, to be able to properly implement things. Would be grate to have a video on that.
Thanks, Huxi

huxi
Автор

can someone help me with this. (i need to create these 3 panels):

Panel 1
1. The UI Panel will contain 3 Textboxes to accept 3 values representing X, Y, Z coordinates (of the center of the intended sphere) and a slider that is used to set a value representing the radius of the intended sphere.
2. The UI Panel will contain a button called 'Display' that will then render the Sphere in the Blender interface


Panel 2
1. Add a file input field to the UI Panel created in Panel 1, the uploaded file will be used as a texture file
2. Clicking on a new 'Apply Texture' button should apply the texture file on to the sphere



Panel 3
1. Add a checkbox to the UI Panel
2. Checking the checkbox to True, the user can select vertices along the surface of the sphere
3. Clicking on a new 'Change' button should delete the selected vertices or display them in a different color

anonymoussloth
Автор

Hello - struggling right now with some screen tracking, coming from the tut u made on that. Are your services available for hire? If so would be incredible!

Plaayaa
Автор

Which plug-in should auto complete use?

Ian-bhrn
Автор

can you make some tutorials on Custom Nodes please, I cannot find the document anywhere. thank you

drtringuyenzmc
Автор

For blender 3.0 autocomplete is done using (just lost 20 min of my life looking this up), please put this up as a text warning in the video using youtube video editor. Thanks

dchristop
Автор

Hello, at 5:56 I see that your properties tab (ctrl T) is different of mine (far better than mine), yours at left (not a big problem R or L) with a lot of choices (like Live Edit) that I don't have, mine look like a simplified and incomplete one... what's wrong with me ^^? I use 2.82 but same in 2.83, my properties tab have just : margin - font size - tab width - indentation and above I have find & replace with find next - replace -case-wrap-all ...

Miamosirop
Автор

maybe it's version specific (2.9) the 'edit source' doesn't show for me (as presented in the video, right click, bottom most option)...
does anyone know anything about this?
btw I have found the 'edit operator source' add-on, tried disabling/ reenabling; restarting blender, it changed nothing...
thanks in advance...

petervarga
Автор

How do you scroll to that scripting workspace?

RichardvanBemmelen
visit shbcf.ru