5 Steps to setup VSCode for Blender Python (on macOS)

Sdílet
Vložit
  • čas přidán 9. 07. 2024
  • Learn how to set up and install VSCode on macOS for efficient Blender Python development with this step-by-step tutorial. This easy-to-follow guide covers everything from downloading and installing VSCode to configuring it for seamless integration with Blender.
    5 Steps to setup VSCode for Blender Python (on Windows)
    • 5 Steps to setup VSCod...
    5 Steps to setup VSCode for Blender Python (on Linux)
    • 5 Steps to setup VSCod...
    Visual Studio Code Download
    code.visualstudio.com/Download
    Python Download
    www.python.org/downloads/
    Fake Blender Python API module
    github.com/nutti/fake-bpy-module
    Blender Python scripting: Creating custom operators from scratch
    • Blender Python scripti...
    00:00 - Intro
    01:22 - Step 1 install Python
    04:20 - Step 2 install VSCode
    05:00 - Step 3 Configure VScode for Python
    07:22 - Step 4 Configure VScode for Blender Python
    09:12 - Step 5 Configure Blender/VSCode integration
    #blender #python #scripting #tutorial #vscode

Komentáře • 18

  • @peterstrohmeier4666
    @peterstrohmeier4666 Před 4 měsíci

    Thank You so much. Now I am able to debug my Python-S/W for Blender.
    BTW: To run the S/W I had to make a change at the end and not to go over "main()".😀

  • @ginescap
    @ginescap Před rokem

    Thanks, I hope you finish the Linux one. :)

  • @CGPython
    @CGPython  Před rokem

    Hey friends,
    I just realized that I made a mistake in the edit
    The VSCode Command Palette is launched with
    Command + Shift + P

  • @Winston-K
    @Winston-K Před rokem

    I'm so happy to have found your videos. I enjoy making Blender art in short videos using Python. Having your videos available to explain how to use `bpy` has helped me clean up my code! Especially cleaning up the scene for multiple script runs.
    Look forward to more videos :)

    • @CGPython
      @CGPython  Před rokem

      Hey Jason,
      I'm pleased to hear that! 😃

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

    reopened blender after creating the __init__.py file but did not see the custom panel -- tried "Blender: Run Script" as well but no dice. Help?
    (I was able to get the other scripts (the ones that create and move cubes) working just fine. Thanks!

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

      Make sure to have that __init__.py file in a separate folder and then open that folder in VSCode.
      Also, make sure that you have the bl_info dictionary in the code (the part of the code that registers the add-on).
      If you have everything in place, the add-on will auto-load when you start Blender from VSCdoe, no need to run "Blender: Run Script

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

    A notification keeps popping up that says "No workspace folder found". Can you help?

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

      yes, I have a video on how to fix that
      czcams.com/users/shortsK9Ft10KuLCA

  • @kuzey3d767
    @kuzey3d767 Před rokem

    Is there a different procedure for Mac m1 devices? I installed the fake-bpy-module but when I try to run a script I'm getting No module named 'bpy'....is this because M1's use zsh instead of bash? cheers

    • @CGPython
      @CGPython  Před rokem +1

      Hey,
      No it isn't because the M1, I'm running a Mac M2 here.
      The issue is that you can only launch the script in Blender if you run it from the VSCode Command Palette. The "Run & Debug" currently works only for scripts that you run outside of Blender.
      To run the script you need to do the following:
      1. Open the VSCode Command Palette with Command + Shift + P
      2. Start Blender using the "Blender: Start" command
      3. Open the Command Palette (again) with Command + Shift + P
      4. Select "Blender: Run Script"
      See 10:20 in the video

    • @kuzey3d767
      @kuzey3d767 Před rokem +1

      @@CGPython Cheers I think VSC was using the wrong Python Interpreter, in any case, it's working now. Thank you!

    • @radekradmor
      @radekradmor Před 8 měsíci

      had the same - wrong version of Python - thanks@@kuzey3d767

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

    Thanks a million for all your efforts Victor!
    In getting the initial script to run from vsc... After starting blender from vsc and it installed debugpy ok, then trying to run the script from vsc I'm getting:
    Got POST: {'type': 'script', 'path': '/Users/marknielsen/Desktop/VSCode_Blender_Testing/my_bpy_script.py'}
    Traceback (most recent call last):
    File "/Users/marknielsen/.vscode/extensions/jacqueslucke.blender-development-0.0.18/pythonFiles/include/blender_vscode/utils.py", line 22, in always
    try: func()
    File "/Users/marknielsen/.vscode/extensions/jacqueslucke.blender-development-0.0.18/pythonFiles/include/blender_vscode/operators/script_runner.py", line 24, in run_script_action
    bpy.ops.dev.run_script(context, filepath=path)
    File "/Applications/Blender.app/Contents/Resources/4.0/scripts/modules/bpy/ops.py", line 106, in __call__
    C_exec, C_undo = _BPyOpsSubModOp._parse_args(args)
    File "/Applications/Blender.app/Contents/Resources/4.0/scripts/modules/bpy/ops.py", line 60, in _parse_args
    raise ValueError("1-2 args execution context is supported")
    ValueError: 1-2 args execution context is supported
    Any thoughts on troubleshooting?

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

      I uninstalled Jacques Blender Development extension and installed your experimental fork. It worked on the initial script run test so now I'll attempt to complete the rest of your video steps. I'm running VSCode 1.84.2, Blender 4.0.1, Python 3.12.0 installed blender using it's own

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

      yeah,
      There was a Blender Python update when Blender was released.
      I submitted a fix to the original Jacques Blender Development extension. It should be fixed there as well.
      I'm glad it is working for you now!