Тёмный
CG Python
CG Python
CG Python
Подписаться
Python tutorials for CG artists.

You can expect quick to the point tips, tricks, and tutorials about how to use the Python programming language for CG art.

Alongside technical deep dives for artists who want to gain a better understanding of Python.

All opinions are my own.
Blender 4.2 Extensions VS Add-ons Explained
8:14
2 месяца назад
Create a Simple Rig UI with Blender Python
24:29
2 месяца назад
Why using print() can get you into trouble
16:03
4 месяца назад
Use THIS For Easy Blender Scripting
8:31
5 месяцев назад
Use THIS to Master A.I. Blender Python Scripts
8:04
6 месяцев назад
How to learn Blender Python with ChatGPT
12:48
7 месяцев назад
Should You give up Learning Blender Python?
6:25
8 месяцев назад
Blender Python: The most confusing part of BMesh
27:38
10 месяцев назад
Комментарии
@ft.harshsharma
@ft.harshsharma 4 часа назад
Where can I get more advanced tutorials covering panel ui ?
@rakshithkumarg1839
@rakshithkumarg1839 2 дня назад
Where will you get the code for registering the window manger???
@bennyirawan7054
@bennyirawan7054 2 дня назад
your voice sound so soothing, it almost feels therapeutic
@CGPython
@CGPython 2 дня назад
🙂
@LucidGeometry
@LucidGeometry 5 дней назад
Very nice. You could continue this great script by making it more idiomatic Python. For example, rather than reassigning from and to node variables (only in python is this ever considered acceptable code 😱) simply define a function that takes the from/to nodes and output/input names to connect as parameters. This is a two-birds refactoring: readability and reusability. You can use the same technique with the x-coordinate of the nodes. Hide the increment in a function, call it each time and just assign each new return value when you create the node. Then you can also encapsulate that within a new_node(…) function that takes a node name and calls the increment. I’m coming at this as a Python programmer learning Blender scripting. We’ll meet in the middle! Again, awesome tutorial.
@CGPython
@CGPython 2 дня назад
Thanks for the tips!
@ferriohtv
@ferriohtv 5 дней назад
Master how i can controle timeline Driver whit geometry nodes and python?? would be amazig for make a procedural crows animation
@haseebahmed3195
@haseebahmed3195 6 дней назад
I think you should create a simple extension that bundle python module using wheel .
@VVV.12345
@VVV.12345 7 дней назад
YES!! Thank you so much!!!
@HarvestrX
@HarvestrX 9 дней назад
Is there a way to stop a script from running when it doesn't work without shutting down Blender? Right now, I choose kill terminal in VS Code and it stops processing the script of course, but in doing so it shuts down Blender as well. Also, why are my scripts becoming read only where I can't edit them?
@CGPython
@CGPython 2 дня назад
I can't think of a great solution for this. > Also, why are my scripts becoming read only where I can't edit them? What version of the extension are you running? I think this was fixed in [0.0.22] - 2024-09-04 "Blender: Run Script" will no longer open read-only file when hitting debug point (#142)" github.com/JacquesLucke/blender_vscode/blob/master/CHANGELOG.md If you are running version [0.0.22] or higher Please ask to reopen github.com/JacquesLucke/blender_vscode/issues/140
@felkonx
@felkonx 14 дней назад
Thank you for sharing. Please no background Sounds/music. I am not an native english speaker and it makes it hard to follow, your sometimes really fast, speechpattern 😖
@CGPython
@CGPython 2 дня назад
I will keep that in mind! Thanks for the feedback!
@mrdixioner
@mrdixioner 14 дней назад
Why install Python when you can configure VSCode to use the Blender interpreter. So the first point can be safely crossed out.
@ced9302
@ced9302 16 дней назад
Hello, thank you for this great turotial. Is it possible to export the material so that it can be retrieved from another script?
@CGPython
@CGPython 2 дня назад
Yes, you can save it into a blend file. Here is an example: gist.github.com/CGArtPython/3951a2aba0b14ef1b4090e5c8ad516dd
@NotGarbageLoops
@NotGarbageLoops 16 дней назад
Watching this at 1.75x speed, the background music become drumb&bass XD
@CGPython
@CGPython 15 дней назад
😆
@Aaqil_3D
@Aaqil_3D 16 дней назад
​@CGPython Could you please help me understand how to create a drop-down menu within a compositor Node Group in Blender?
@CGPython
@CGPython 2 дня назад
I'll write down this idea, thanks!
@Aaqil_3D
@Aaqil_3D 2 дня назад
@@CGPython You're welcome ☺
@toapyandfriends
@toapyandfriends 17 дней назад
Now scripts created on ChatGPT can get errors. I’ve created a Blender add-on that automates the process of having GPT generate code, running it in the text editor, and pasting any errors back into GPT. It also automates finding code examples to give it. You can provide it with any add-on or file as an example. For people who write Blender Python scripts, this is a game-changing tool. Is there a way I could get you to do a video on it? Or maybe I could send you a copy to test-it’s really robust, with over twenty thousand lines of code.
@toapyandfriends
@toapyandfriends 17 дней назад
Now scripts created on ChatGPT can get errors. I’ve created a Blender add-on that automates the process of having GPT generate code, running it in the text editor, and pasting any errors back into GPT. It also automates finding code examples to give it. You can provide it with any add-on or file as an example. For people who write Blender Python scripts, this is a game-changing tool. Is there a way I could get you to do a video on it? Or maybe I could send you a copy to test-it’s really robust, with over twenty thousand lines of code.
@CGPython
@CGPython 2 дня назад
This sounds cool, but I don't do product reviews on this channel.
@mrdixioner
@mrdixioner 17 дней назад
Спасибо огромное!!!
@amankushwaha4362
@amankushwaha4362 17 дней назад
I love the way he just explain. First show problem then give the solution to train my brain at learning time.
@amankushwaha4362
@amankushwaha4362 17 дней назад
Thanks
@mrdixioner
@mrdixioner 17 дней назад
Спасибо огромное!!! Вы очень хорошо объясняете!
@CGPython
@CGPython 15 дней назад
Happy to help! ❤️‍🔥
@KevinCBurke
@KevinCBurke 19 дней назад
Thank you SO much for this video. It helped me a ton! 🙏
@CGPython
@CGPython 15 дней назад
Glad it helped!
@stindedesign
@stindedesign 19 дней назад
Thanks for the good and useful videos. I'm pretty new to Blender programming. I'm using homebrew to install a lot of useful s/w. The python3 - m pip install fake-bpy-module forces to use either brew or pipx. However, either of those works. Can you add the homebrew and pipx way in you video? I would help a lot.
@stindedesign
@stindedesign 19 дней назад
Hi. I got it sorted out. The easiest way is to create the virtual environment with VS code in the workspace and install the fake-bpy-module there.
@CGPython
@CGPython 15 дней назад
Thanks for sharing your findings! 💖
@mahmoudsalah7628
@mahmoudsalah7628 20 дней назад
Nah this is not getting enough recognition yet, You are my hero from now on :)
@ced9302
@ced9302 21 день назад
Hello Victor, I thought I saw that it was possible in some way to do the opposite. I mean install blender as a python module. Wouldn't that be more advantageous? If possible, would you consider making a video to explain how to do it? THANKS
@SpencerMagnusson
@SpencerMagnusson 18 дней назад
@@ced9302 depends on your use case. But yes, you can install Blender as a Python module; I use it for unit testing. But it's effectively running Blender headless, so not everything is enabled (say, simulating user input). If you want Blender's UI, then you'd be better off with Blender as an app.
@CGPython
@CGPython 15 дней назад
Yeah, I have a video on this in the works. You can find the bpy module here pypi.org/project/bpy/ It is great for doing bulk processing of assets. I would say you would iterate on your script with the blender UI and then once everything is working you would use this bpy module installed from pip. I think it would be hard to iterate on a script without the UI, unless you have years for experience with bpy.
@SpencerMagnusson
@SpencerMagnusson 21 день назад
Great video! Thanks for sharing that, neat tip. And just so users know, they don't have to install Python or pip themselves. It's already included with Blender. The path on Windows is "C:\Program Files\Blender Foundation\Blender 4.2\4.2\python\bin\python.exe". So you can just do "python.exe -m pip" instead of just "pip" while in that folder (or use the full file path).
@CGPython
@CGPython 21 день назад
Great point! Thanks!!
@HVLib
@HVLib 21 день назад
the problem am facin is how to separate system python of blender python. or how to change interpreter without getting conflicts. I start getting this issues just recently on win 11
@CGPython
@CGPython 2 дня назад
Are you not able to select the Python interpreter on the bottom right of VSCode?
@HorseyTime
@HorseyTime 22 дня назад
Bro i spent like FOREVER trying to find how to use pygame with blender. Eventually figured it out omg i woulda killed for this video in thag time
22 дня назад
This is very helpful. Thank you!
@carloscarneiro1857
@carloscarneiro1857 22 дня назад
Hi Victor, muito obrigado por compartilhar de uma forma tão direta e fácil para o leigo este aprendizado
@CGPython
@CGPython 2 дня назад
Glad you think so! ❤️‍🔥 Happy to help! 🙂
@arturertel
@arturertel 22 дня назад
that helped a lot!
@CGPython
@CGPython 2 дня назад
Nice!
@mind_of_a_darkhorse
@mind_of_a_darkhorse 23 дня назад
Wow, this is a big help! Thanks for bringing this to our attention!
@arthurprather6720
@arthurprather6720 25 дней назад
Useful information, easy to pick up. Thanks for sharing.
@CGPython
@CGPython 2 дня назад
Thank you
@MichaelBullo
@MichaelBullo 27 дней назад
Great video. Great channel. Thank you.
@CGPython
@CGPython 2 дня назад
Thanks for watching! 💖
@KJYMOON
@KJYMOON 27 дней назад
I Love your video. thanks !
@CGPython
@CGPython 2 дня назад
Thank you too!
@KeithSine
@KeithSine 27 дней назад
This is amazing. No idea if you're still maintaining this but would you have an example that could import a list of .stl files (like you do .blend files) and use them as the source objects for renders instead of linking .blend files?
@KeithSine
@KeithSine 27 дней назад
figured out how to convert my .stl to .blend first ... so that solves that problem. Now working on trying to make things rotate on multiple axis in the same render.
@CGPython
@CGPython 2 дня назад
Oh! That's cool! 🙂💪
@gregortidholm
@gregortidholm Месяц назад
This is really Awesome 👏
@CGPython
@CGPython Месяц назад
Woohoo ❤️‍🔥
@Mataharidong
@Mataharidong Месяц назад
TYSM!!! 😭, its help me so much
@CGPython
@CGPython Месяц назад
I'm so glad!
@Mataharidong
@Mataharidong Месяц назад
Hi bro im new to python but this one is the perfect i like so much :>
@CGPython
@CGPython Месяц назад
Hey, that’s awesome! Python is super fun. ❤️‍🔥 Keep going, and you'll be coding like a pro before you know it!
@Gunat737
@Gunat737 Месяц назад
My Add on did not show in the Add on installation panel in the Edt > Preferences Tab. May be I didn't save it as a zipped file.
@CGPython
@CGPython Месяц назад
What Blender version are you using? You might need to make it into an extension. I need to make an updated video of this If you are using 4.2 you can checkout the changes done to add-on here ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-QrDt1_Bn670.htmlsi=bE-eHfz3A2ZiA09V
@binatheis
@binatheis Месяц назад
I have a question: I am building an addon in which I will make use of some Python wheels, but one of these wheels needs OpenImageIO and numpy to work. I have done some research and found out that Blender has OpenImageIO and numpy installed as Python modules, if I decide to exclude OpenImageIO and numpy wheels from my addon, could the wheel that depends on them to work have problems to run? That is, would my addon detect and work fine with those modules that come by default in Blender?
@CGPython
@CGPython Месяц назад
Great question! You should be fine using the OpenImageIO and numpy that come with Blender. You would only need to worry about this if your add-on needed a particular version of OpenImageIO or numpy.
@Rare.99
@Rare.99 Месяц назад
Very cool
@A000803323
@A000803323 Месяц назад
Hi! total python noob here. How do I create a script that will add drivers to shape keys for me? I'm trying to control shape keys with empties, but due to the number it would be tedious to add the drivers manually every time (I'm using CC4 characters, which come with a bunch of shape keys, but no way to control them easily unless you buy Iclone). I can't seem to find an answer on google or reddit.
@CGPython
@CGPython Месяц назад
Try this example gist.github.com/CGArtPython/d446d51e08f4d6bd277134173d1311e2 This Blender Python script adds 5 empty objects to the current scene and then assigns drivers to each empty. The drivers are set to control the X location of each empty based on the X location of the next empty in the list, multiplied by 0.5.
@facundopedemonte
@facundopedemonte Месяц назад
Excellent! Extremely clear and to the point. Amazing content, thanks!
@CGPython
@CGPython Месяц назад
Thank you for your kind words! I really appreciate your support!
@studioromanrec
@studioromanrec Месяц назад
It only works in parallel with bl_info, even if bl_info is commented out.
@studioromanrec
@studioromanrec Месяц назад
Everything is working now; I figured out what the issue was.
@studioromanrec
@studioromanrec Месяц назад
I am eagerly awaiting your response. Could you please advise on how to handle this?
@tinkerboi
@tinkerboi Месяц назад
Could you by any chance make a video on how to extrude manually using bmesh? I am kind of curious how extrude works in low level
@CGPython
@CGPython Месяц назад
Thank you for the idea!
@studioromanrec
@studioromanrec Месяц назад
Here is a very simple add-on. The __init__.py file contains the following code: import bpy class OBJECT_OT_add_cube(bpy.types.Operator): bl_idname = "object.add_cube" bl_label = "Add Cube" bl_options = {'REGISTER', 'UNDO'} def execute(self, context): bpy.ops.mesh.primitive_cube_add() return {'FINISHED'} class VIEW3D_PT_simple_panel(bpy.types.Panel): bl_label = "Simple Cube Panel" bl_idname = "VIEW3D_PT_simple_panel" bl_space_type = 'VIEW_3D' bl_region_type = 'UI' bl_category = 'Simple Cube Addon' def draw(self, context): layout = self.layout layout.operator("object.add_cube") def register(): bpy.utils.register_class(OBJECT_OT_add_cube) bpy.utils.register_class(VIEW3D_PT_simple_panel) def unregister(): bpy.utils.unregister_class(OBJECT_OT_add_cube) bpy.utils.unregister_class(VIEW3D_PT_simple_panel) if __name__ == "__main__": register() And here is the manifest file: schema_version = "1.0.0" id = "simple_cube_addon" name = "Simple Cube Addon" version = "1.0.0" tagline = "Adds a panel that spawns a cube" maintainer = "Your Name <your.email@example.com>" type = "add-on" tags = ["Object"] blender_version_min = "4.2.0" license = ["SPDX:GPL-2.0-or-later"] Why doesn't it launch in VS Code, but works fine when zipped and installed in Blender?
@CGPython
@CGPython Месяц назад
I am able to run your code from VSCode looks like the issue is with `_name_ ` here is the explanation ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE--qq64ReRZhU.html
@kvdam8826
@kvdam8826 Месяц назад
Hi Victor, Thanks for this. 👍👍
@nuckle4270
@nuckle4270 Месяц назад
Can you give a little information on the mesh_size:props.FloatProperty() block. Is this a python definition convention or blender? Is it a key:value pair? I am maybe at an intermediate level of python and I've not seen definitions like this so far.
@CGPython
@CGPython Месяц назад
This is a great question! This actually uses type annotation syntax. Type annotations are evaluated for classes, so this is basically a function that registers some information with Blender and returns a type peps.python.org/pep-0526/#runtime-effects-of-type-annotations blender.stackexchange.com/a/246159
@nuckle4270
@nuckle4270 Месяц назад
@@CGPython Thanks a lot!