Dev:2.4/Source/Python/API/ModdingBlender

提供: wiki
移動先: 案内検索

Premise

The apricot project can benefit from improved blender integration with CrystalSpace. Blender 2.5 development has started and this is a good time to plan the big picture, the ideal environment for integrating other applications and tools into Blender.

From this plan, a subset can be implemented in Blender 2.46+ and eventually fully implemented in Blender 2.5.

I can dedicate quite a lot of time to this as a part of the apricot project and would appreciate feedback and advice so this can be used for general integration --Ideasman42 13:22, 7 March 2008 (CET)

Example Use Cases

  • Blender as a level editor
  • Blender for game content creation
  • Render engine integration
  • Blender as an architectural tool

Limitations with Existing System

  • Current methods of integrating tools in blender is acceptable simple cases. However its too fragmented to be used for modifying blender for specialized workflows that require changes to Blender in many places.

(scriptlinks, scripts window, event & space handlers)

Requirements

Modding Blender With Python

Requirements for integrating Blender with other applications

The aim of this development is to be able to be able to Mod Blender for special use.

at the moment you can modify blender by adding scriptlinks to individual objects or enabling event or draw handelers to the 3d view. but this is clumsy and requires too much user intervention to set it up.

With a Blender Mod, a user should be able to download a python script and allow it to "Mod" blender for special use.

  • Game engine integration
  • Blender as a level editor

Scope

  • Register Panels
  • Register Window Types (just use script window type, but display is their own type in the window selector)
  • Register Scriptlinks that dont need to be applied to each object/scene/world etc.
  • Register DRAW and EVENT Handlers

Implementation

Each 'Mod' would a s single python file in the scripts directory. This mod can have a normal script header

 #!BPY
 """
 Name: 'Crystal Space'
 Blender: 247
 Group: 'Integration'
 """

Each script can be enabled and disabled (like event/draw handlers). The Mod script would be imported by blender as a module (so it stays loaded in memory) and blender can call functions within the module for specific tasks.