All Projects → ranjian0 → Blender-PyCharm

ranjian0 / Blender-PyCharm

Licence: other
Example setup for blender addon development in pycharm

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Blender-PyCharm

Blenderpy
Blender as a python module with easy-install
Stars: ✭ 162 (+237.5%)
Mutual labels:  blender
Blenderseed
appleseed plugin for Blender
Stars: ✭ 214 (+345.83%)
Mutual labels:  blender
Sheepit Client
Client for the free and distributed render farm "SheepIt Render Farm"
Stars: ✭ 244 (+408.33%)
Mutual labels:  blender
Visual Gps Slam
This is a repo for my master thesis research about the Fusion of Visual SLAM and GPS. It contains the research paper, code and other interesting data.
Stars: ✭ 175 (+264.58%)
Mutual labels:  blender
Hdcycles
Cycles Hydra Delegate
Stars: ✭ 197 (+310.42%)
Mutual labels:  blender
Gaffer
A light-manager add-on for Blender
Stars: ✭ 218 (+354.17%)
Mutual labels:  blender
Compas
Core packages of the COMPAS framework.
Stars: ✭ 146 (+204.17%)
Mutual labels:  blender
voxel-builder
Voxel-based 3D modeling application
Stars: ✭ 31 (-35.42%)
Mutual labels:  blender
Arsenal
Blender game engine written in Rust.
Stars: ✭ 214 (+345.83%)
Mutual labels:  blender
Bforartists
Bforartists is a fork of the popular 3D software Blender, with the goal to improve the UI.
Stars: ✭ 240 (+400%)
Mutual labels:  blender
3d models
3D Models of our products
Stars: ✭ 177 (+268.75%)
Mutual labels:  blender
Blender niftools addon
The Blender Niftools Addon is a Blender add-on to enable import and export of NetImmese File Formats including .nif, .kf, .egm.
Stars: ✭ 191 (+297.92%)
Mutual labels:  blender
Keyboard Layout Editor For Blender
Allows you to import keyboard layouts into blender and render them in 3d
Stars: ✭ 224 (+366.67%)
Mutual labels:  blender
Blender Launcher
Standalone client for managing official builds of Blender 3D
Stars: ✭ 174 (+262.5%)
Mutual labels:  blender
Blender Cli Rendering
Python scripts for rendering images using Blender 2.83 from command-line interface
Stars: ✭ 241 (+402.08%)
Mutual labels:  blender
Animation nodes
Node based visual scripting system designed for motion graphics in Blender.
Stars: ✭ 1,973 (+4010.42%)
Mutual labels:  blender
Stop Motion Obj
A Blender add-on for importing a sequence of OBJ meshes as frames
Stars: ✭ 217 (+352.08%)
Mutual labels:  blender
NodeSharer
Node Sharer is an add-on for Blender that lets you easily share procedural materials as text strings.
Stars: ✭ 48 (+0%)
Mutual labels:  blender
Blender Tools
🐵 Embark Addon for Blender
Stars: ✭ 250 (+420.83%)
Mutual labels:  blender
The lightmapper
Fast and easy baked GI Lightmaps for Blender and Cycles
Stars: ✭ 233 (+385.42%)
Mutual labels:  blender

PROBLEM DESCRIPTION

  • Developing blender addons can be a serious pain, especially when the code base is large.

  • Blenders internal text-editor is quite lacking and although there are some powerful addons out there to improve the experience, sometimes you just want to work in an IDE that you love.

  • There is no obvious way to link up your IDE to blender that allows a fast workflow

PROPOSAL

  • This document showcases a blender-pycharm workflow that I have personally stumbled upon that may or may not ease your troubles.

Solution

  1. Obviously you should have both blender and Pycharm installed on your machine

  2. Find a suitable folder where you can put all your addon development work. This folder will have a special format that will allows us to link it to blender.

  3. Once you've made the folder, add three sub-folders into it - addons, modules and startup.

    • Here's how mine looks Alt text
  4. Next we will link this folder to blender. i.e Blender will always know how to find this folder

    • Open blender

    • Goto File -> User Preferences

    • Under the file tab

    • Find the scripts path and point it to the folder we just made

    • Here's mine Alt text

  5. Now we are going to setup PyCharm. Hold on to your socks

  6. First of we want to create some pre-definitions for pycharm , so that it won't bother us with loads of errors when developing addons for blender

  7. Create another folder somewhere you like and download the pypredef_gen.py file that is in this repo into that folder.

    • You can click on the file

    • Click Raw

    • Save it into the folder you just made

    • Have something like this Alt text

  8. Now we are going to run this script, but we will do it with blender.

  9. Find the path to your Blender executable.

    Something like : - 'C:\program files\blender\blender.exe', or - '/usr/bin/blender'

  10. Run this command: path/to/blender/executable -b -P "path/to/pypredef_gen.py"

    replace 'path/to/blender/executable' with path from step 9 replace 'path/to/pypredef_gen.py' with path to that file

  11. Step 10 will create some folders like this:

Alt text

  1. Now that we have pre-definitions, we can go over the steps you will have to take to develop blender addons with pycharm

  2. Create a new pycharm project - this will be your addon.

    • Now this is important. You will want to create this project in the first folder that we created, under addons. This is where you will develop all your addons.

      i.e: if your first-folder was called 'blender-addons', your project should be under : "blender-addons/addons/"

  3. To set the pre-definitions for the project:

    • Go to File -> Settings

    • Under Project: -> Project Structure

    • Select Add Content Root

    • Navigate to pypredef folder

    • Like This:
      Alt text

    • Now pycharm will autocomplete blender python API

NOTE: You will have to do this for all your blender-addon projects

  1. Now we will finalize the setup and smoothen the workflow.

    -- First up is -> How to run the addon.

    a) If you set up the first folder properly, anytime you create a new addon project as in step 13, The addon will automatically be imported to blender.

    • thats the magic of the first folder.

    b) If you open blender, go to the user preferences under addons, you can enable it. It will remain enabled for the entire development.

    c) To keep refreshing the addon while you develop, you will need to keep restarting blender. Luckily we can create a run configuration in pycharm for exactly this.

    d) In your pycharm project root folder, create a new script called start_blender.py

    e) Add the following 2 lines:

    import os 
    os.system("path/to/blender/executable")
    

    f) Right-click on the file in the project tree and navigate to "Create 'start_blender.py'"

    g) Now anytime you run the project , it will open blender which will reload your addon.

    h) For some more goodies, you may want to start blender with some given settings every time e.g a layout.

    Create a start.blend file with all your settings and save it in the root of your project
    Now modify your start_blender.py:
        
        import os
        os.system("path/to/blender/executable  start.blend")
        
    Now everytime you run blender, it will open the .blend file with your settings.
    
  2. Finally make your cool addon.

    • Here's a sample Alt text

CONCLUSION

This is certainly alot of work to do, which is why its not for everyone.

If you are working with a huge multiple file/ multiple package addon, you should be able to appreciate the value of this workflow like I have.

Some Caveats:

- If your blender has slow startup time - "Your screwed"
- All blender output is delayed by pycharm until the program exits
- No debugging - obviously.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].