Merged changes in the trunk up to revision 26856.
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Sat, 13 Feb 2010 01:13:16 +0000 (01:13 +0000)
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Sat, 13 Feb 2010 01:13:16 +0000 (01:13 +0000)
28 files changed:
1  2 
release/scripts/ui/properties_render.py
release/scripts/ui/space_userpref.py
source/blender/CMakeLists.txt
source/blender/blenkernel/CMakeLists.txt
source/blender/blenkernel/intern/scene.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/editors/CMakeLists.txt
source/blender/editors/render/render_intern.h
source/blender/editors/render/render_ops.c
source/blender/editors/render/render_shading.c
source/blender/editors/screen/screen_ops.c
source/blender/editors/space_outliner/outliner.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_orientations.c
source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
source/blender/makesdna/DNA_scene_types.h
source/blender/makesdna/intern/makesdna.c
source/blender/makesrna/RNA_access.h
source/blender/makesrna/intern/rna_main.c
source/blender/makesrna/intern/rna_scene.c
source/blender/python/CMakeLists.txt
source/blender/python/intern/bpy.c
source/blender/render/CMakeLists.txt
source/blender/render/intern/source/pipeline.c
source/creator/CMakeLists.txt
source/creator/creator.c

Simple merge
Simple merge
Simple merge
index a220340efcc8f3cb8a6aa29c1d23dcf72a084e78,0000000000000000000000000000000000000000..05c23678acdc1aee810320394324a7ea7343566e
mode 100644,000000..100644
--- /dev/null
@@@ -1,404 -1,0 +1,404 @@@
-       freestyle_render = RE_NewRender(freestyle_scene->id.name);
 +# include "BlenderStrokeRenderer.h"
 +# include "../stroke/Canvas.h"
 +# include "../application/AppConfig.h"
 +
 +# include "BlenderTextureManager.h"
 +
 +#ifdef __cplusplus
 +extern "C" {
 +#endif
 +
 +#include "MEM_guardedalloc.h"
 +
 +#include "DNA_camera_types.h"
 +#include "DNA_customdata_types.h"
 +#include "DNA_listBase.h"
 +#include "DNA_mesh_types.h"
 +#include "DNA_meshdata_types.h"
 +#include "DNA_screen_types.h"
 +
 +#include "BKE_customdata.h"
 +#include "BKE_global.h"
 +#include "BKE_library.h" /* free_libblock */
 +#include "BKE_material.h"
 +#include "BKE_main.h" /* struct Main */
 +#include "BKE_object.h"
 +#include "BKE_scene.h"
 +
 +#include "RE_pipeline.h"
 +
 +#include "renderpipeline.h"
 +
 +#ifdef __cplusplus
 +}
 +#endif
 +
 +
 +BlenderStrokeRenderer::BlenderStrokeRenderer(Render* re)
 +:StrokeRenderer(){
 +      
 +      // TEMPORARY - need a  texture manager
 +      _textureManager = new BlenderTextureManager;
 +      _textureManager->load();
 +
 +      // Scene.New("FreestyleStrokes")
 +      old_scene = re->scene;
 +
 +      objects.first = objects.last = NULL;
 +      
 +      ListBase lb;
 +      freestyle_scene = add_scene("freestyle_strokes");
 +      lb = freestyle_scene->r.layers;
 +      freestyle_scene->r= old_scene->r;
 +      freestyle_scene->r.layers= lb;
 +      set_scene_bg( freestyle_scene );
 +
 +      // image dimensions
 +      float ycor = ((float)re->r.yasp) / ((float)re->r.xasp);
 +      float width = freestyle_scene->r.xsch;
 +      float height = freestyle_scene->r.ysch * ycor;
 +
 +      // Camera
 +      Object* object_camera = add_object(freestyle_scene, OB_CAMERA);
 +      
 +      Camera* camera = (Camera *) object_camera->data;
 +      camera->type = CAM_ORTHO;
 +      camera->ortho_scale = max(width,height);
 +      
 +      object_camera->loc[0] = 0.5 * width;
 +      object_camera->loc[1] = 0.5 * height;
 +      object_camera->loc[2] = 1.0;
 +      
 +      freestyle_scene->camera = object_camera;
 +
 +      store_object(object_camera);
 +      
 +      // Material
 +      material = add_material("stroke_material");
 +      material->mode |= MA_VERTEXCOLP;
 +      material->mode |= MA_SHLESS;
 +}
 +
 +BlenderStrokeRenderer::~BlenderStrokeRenderer(){
 +      
 +        if(0 != _textureManager)
 +        {
 +          delete _textureManager;
 +          _textureManager = 0;
 +        }
 +
 +      // release scene
 +      free_libblock( &G.main->scene, freestyle_scene );
 +
 +      // release objects and data blocks
 +      LinkData *link = (LinkData *)objects.first;
 +      while(link) {
 +              Object *ob = (Object *)link->data;
 +              void *data = ob->data;
 +              char name[24];
 +              strcpy(name, ob->id.name);
 +              //cout << "removing " << name[0] << name[1] << ":" << (name+2) << endl;
 +              switch (ob->type) {
 +              case OB_MESH:
 +                      free_libblock( &G.main->object, ob );
 +                      free_libblock( &G.main->mesh, data );
 +                      break;
 +              case OB_CAMERA:
 +                      free_libblock( &G.main->object, ob );
 +                      free_libblock( &G.main->camera, data );
 +                      break;
 +              default:
 +                      cerr << "Warning: unexpected object in the scene: " << name[0] << name[1] << ":" << (name+2) << endl;
 +              }
 +              link = link->next;
 +      }
 +      BLI_freelistN( &objects );
 +
 +      // release material
 +      free_libblock( &G.main->mat, material );
 +      
 +      set_scene_bg( old_scene );
 +}
 +
 +void BlenderStrokeRenderer::store_object(Object *ob) const {
 +
 +      LinkData *link = (LinkData *)MEM_callocN(sizeof(LinkData), "temporary object" );
 +      link->data = ob;
 +      BLI_addhead(const_cast<ListBase *>(&objects), link);
 +}
 +
 +void BlenderStrokeRenderer::RenderStrokeRep(StrokeRep *iStrokeRep) const{
 +  RenderStrokeRepBasic(iStrokeRep);
 +}
 +
 +void BlenderStrokeRenderer::RenderStrokeRepBasic(StrokeRep *iStrokeRep) const{
 +      
 +      ////////////////////
 +      //  Build up scene
 +      ////////////////////
 +      
 +        vector<Strip*>& strips = iStrokeRep->getStrips();
 +        Strip::vertex_container::iterator v[3];
 +        StrokeVertexRep *svRep[3];
 +        Vec3r color[3];
 +        unsigned int vertex_index;
 +        float ycor = ((float)freestyle_scene->r.yasp) / ((float)freestyle_scene->r.xasp);
 +        float width = freestyle_scene->r.xsch;
 +        float height = freestyle_scene->r.ysch * ycor;
 +        Vec2r p;
 +      
 +        for(vector<Strip*>::iterator s=strips.begin(), send=strips.end();
 +        s!=send;
 +        ++s){         
 +              
 +          Strip::vertex_container& strip_vertices = (*s)->vertices();
 +              int strip_vertex_count = (*s)->sizeStrip();
 +              int m, n, visible_faces, visible_segments;
 +              bool visible;
 +
 +              // iterate over all vertices and count visible faces and strip segments
 +              // (note: a strip segment is a series of visible faces, while two strip
 +              // segments are separated by one or more invisible faces)
 +              v[0] = strip_vertices.begin();
 +          v[1] = v[0]; ++(v[1]);
 +          v[2] = v[1]; ++(v[2]);
 +              visible_faces = visible_segments = 0;
 +              visible = false;
 +          for (n = 2; n < strip_vertex_count; n++)
 +              {
 +                      svRep[0] = *(v[0]);
 +                      svRep[1] = *(v[1]);
 +                      svRep[2] = *(v[2]);
 +                      m = 0;
 +                      for (int j = 0; j < 3; j++) {
 +                              p = svRep[j]->point2d();
 +                              if (p[0] < 0.0 || p[0] > width || p[1] < 0.0 || p[1] > height)
 +                                      m++;
 +                      }
 +                      if (m == 3) {
 +                              visible = false;
 +                      } else {
 +                              visible_faces++;
 +                              if (!visible)
 +                                      visible_segments++;
 +                              visible = true;
 +                      }
 +                      ++v[0]; ++v[1]; ++v[2];
 +              }
 +              if (visible_faces == 0)
 +                      continue;
 +
 +              // me = Mesh.New()
 +              Object* object_mesh = add_object(freestyle_scene, OB_MESH);
 +              Mesh* mesh = (Mesh *) object_mesh->data;
 +              MEM_freeN(mesh->bb);
 +              mesh->bb= NULL;
 +              mesh->id.us = 0;
 +
 +              store_object(object_mesh);
 +              
 +#if 1
 +              // me.materials = [mat]
 +              mesh->mat = ( Material ** ) MEM_mallocN( 1 * sizeof( Material * ), "MaterialList" );
 +              mesh->mat[0] = material;
 +              mesh->totcol = 1;
 +              test_object_materials( (ID*) mesh );
 +#else
 +              assign_material(object_mesh, material, object_mesh->totcol+1);
 +              object_mesh->actcol= object_mesh->totcol;
 +#endif
 +              
 +              // vertices allocation
 +              mesh->totvert = visible_faces + visible_segments * 2;
 +              mesh->mvert = (MVert*) CustomData_add_layer( &mesh->vdata, CD_MVERT, CD_CALLOC, NULL, mesh->totvert);
 +                      
 +              // faces allocation
 +              mesh->totface = visible_faces;
 +              mesh->mface = (MFace*) CustomData_add_layer( &mesh->fdata, CD_MFACE, CD_CALLOC, NULL, mesh->totface);
 +              
 +              // colors allocation  - me.vertexColors = True
 +              MCol* alphas = (MCol *) CustomData_add_layer_named( &mesh->fdata, CD_MCOL, CD_CALLOC, NULL, mesh->totface, "A" );
 +              MCol* colors = (MCol *) CustomData_add_layer_named( &mesh->fdata, CD_MCOL, CD_CALLOC, NULL, mesh->totface, "RGB" );
 +              mesh->mcol = alphas;
 +
 +              ////////////////////
 +              //  Data copy
 +              ////////////////////
 +              
 +              MVert* vertices = mesh->mvert;
 +              MFace* faces = mesh->mface;
 +              
 +          v[0] = strip_vertices.begin();
 +          v[1] = v[0]; ++(v[1]);
 +          v[2] = v[1]; ++(v[2]);
 +
 +              vertex_index = 0;
 +              visible = false;
 +              
 +          for (n = 2; n < strip_vertex_count; n++)
 +              {
 +                      svRep[0] = *(v[0]);
 +                      svRep[1] = *(v[1]);
 +                      svRep[2] = *(v[2]);
 +                      m = 0;
 +                      for (int j = 0; j < 3; j++) {
 +                              p = svRep[j]->point2d();
 +                              if (p[0] < 0.0 || p[0] > width || p[1] < 0.0 || p[1] > height)
 +                                      m++;
 +                      }
 +                      if (m == 3) {
 +                              visible = false;
 +                      } else {
 +                              if (!visible) {
 +                                      vertex_index += 2;
 +
 +                                      // first vertex
 +                                      vertices->co[0] = svRep[0]->point2d()[0];
 +                                      vertices->co[1] = svRep[0]->point2d()[1];
 +                                      vertices->co[2] = 0.0;
 +                                      ++vertices;
 +                                      
 +                                      // second vertex
 +                                      vertices->co[0] = svRep[1]->point2d()[0];
 +                                      vertices->co[1] = svRep[1]->point2d()[1];
 +                                      vertices->co[2] = 0.0;
 +                                      ++vertices;
 +                              }
 +                              visible = true;
 +
 +                              // vertex
 +                              vertices->co[0] = svRep[2]->point2d()[0];
 +                              vertices->co[1] = svRep[2]->point2d()[1];
 +                              vertices->co[2] = 0.0;
 +                              
 +                              // faces
 +                              faces->v1 = vertex_index - 2;
 +                              faces->v2 = vertex_index - 1;
 +                              faces->v3 = vertex_index;
 +                              faces->v4 = 0;
 +                              
 +                              // colors
 +                              // red and blue are swapped - cf DNA_meshdata_types.h : MCol    
 +                              color[0] = svRep[0]->color();
 +                              color[1] = svRep[1]->color();
 +                              color[2] = svRep[2]->color();
 +
 +                              colors->a = 0;
 +                              colors->r = (short)(255.0f*(color[0])[2]);
 +                              colors->g = (short)(255.0f*(color[0])[1]);
 +                              colors->b = (short)(255.0f*(color[0])[0]);
 +                              alphas->a = 0;
 +                              alphas->r = 0;
 +                              alphas->g = 0;
 +                              alphas->b = (short)(255.0f*svRep[0]->alpha());
 +                              ++colors; ++alphas;
 +                              
 +                              colors->a = 0;
 +                              colors->r = (short)(255.0f*(color[1])[2]);
 +                              colors->g = (short)(255.0f*(color[1])[1]);
 +                              colors->b = (short)(255.0f*(color[1])[0]);
 +                              alphas->a = 0;
 +                              alphas->r = 0;
 +                              alphas->g = 0;
 +                              alphas->b = (short)(255.0f*svRep[1]->alpha());
 +                              ++colors; ++alphas;
 +                              
 +                              colors->a = 0;
 +                              colors->r = (short)(255.0f*(color[2])[2]);
 +                              colors->g = (short)(255.0f*(color[2])[1]);
 +                              colors->b = (short)(255.0f*(color[2])[0]);
 +                              alphas->a = 0;
 +                              alphas->r = 0;
 +                              alphas->g = 0;
 +                              alphas->b = (short)(255.0f*svRep[2]->alpha());
 +                              ++colors; ++alphas;
 +
 +                              ++faces; ++vertices; ++colors; ++alphas;
 +                              ++vertex_index;
 +                      }
 +                      ++v[0]; ++v[1]; ++v[2];
 +
 +              } // loop over strip vertices 
 +      
 +      } // loop over strips   
 +
 +}
 +
 +Render* BlenderStrokeRenderer::RenderScene( Render *re ) {
 +    Render* freestyle_render;
 +    RenderLayer *rl;
 +    float *rectf, *alpha;
 +      int x, y, rectx, recty;
 +      
 +      freestyle_scene->r.mode &= ~( R_EDGE_FRS | R_SHADOW | R_SSS | R_PANORAMA | R_ENVMAP | R_MBLUR );
 +      freestyle_scene->r.scemode &= ~( R_SINGLE_LAYER );
 +      freestyle_scene->r.planes = R_PLANES32;
 +      freestyle_scene->r.imtype = R_PNG;
 +      
 +    // Pass 1 - render only the alpha component
-       freestyle_render = RE_NewRender(freestyle_scene->id.name);
++      freestyle_render = RE_NewRender(freestyle_scene->id.name, RE_SLOT_DEFAULT);
 +      RE_BlenderFrame( freestyle_render, freestyle_scene, NULL, 1);
 +
 +    // save the alpha component of the render into a buffer
 +      rl = render_get_active_layer( freestyle_render, freestyle_render->result );
 +    if (!rl || rl->rectf == NULL) {
 +        cout << "Cannot find Freestyle result image" << endl;
 +      RE_FreeRender(freestyle_render);
 +        return NULL;
 +    }
 +      rectf = rl->rectf;
 +      rectx = re->rectx;
 +      recty = re->recty;
 +    alpha = new float[rectx * recty];
 +    for (y = 0; y < recty; y++)
 +        for (x = 0; x < rectx; x++)
 +            alpha[rectx * y + x] = rectf[4 * (rectx * y + x)];
 +
 +      RE_FreeRender(freestyle_render);
 +
 +    // replace the mesh vertex colors
 +    LinkData *link = (LinkData *)objects.first;
 +    while (link) {
 +              Object *ob = (Object *)link->data;
 +        if (ob->type == OB_MESH) {
 +              Mesh *mesh = (Mesh *)ob->data;
 +            int index = CustomData_get_named_layer_index(&mesh->fdata, CD_MCOL, "A");
 +            if (index < 0) {
 +                cout << "Cannot find mesh MCol layer (A)" << endl;
 +                goto error;
 +            }
 +            CustomData_free_layer(&mesh->fdata, CD_MCOL, mesh->totface, index);
 +              mesh->mcol = (MCol *)CustomData_get_layer_named(&mesh->fdata, CD_MCOL, "RGB");
 +            if (!mesh->mcol) {
 +                cout << "Cannot find mesh MCol layer (RGB)" << endl;
 +                goto error;
 +            }
 +              }
 +        link = link->next;
 +      }
 +
 +    // Pass 2 - render the RGB components
++      freestyle_render = RE_NewRender(freestyle_scene->id.name, RE_SLOT_DEFAULT);
 +    RE_BlenderFrame( freestyle_render, freestyle_scene, NULL, 1);
 +
 +    // merge the saved alpha component into the 2nd render
 +      rl = render_get_active_layer( freestyle_render, freestyle_render->result );
 +    if (!rl || rl->rectf == NULL) {
 +        cout << "Cannot find Freestyle result image" << endl;
 +      RE_FreeRender(freestyle_render);
 +        goto error;
 +    }
 +      rectf = rl->rectf;
 +    for (y = 0; y < recty; y++)
 +        for (x = 0; x < rectx; x++)
 +            rectf[4 * (rectx * y + x) + 3] = alpha[rectx * y + x];
 +
 +    delete [] alpha;
 +
 +    return freestyle_render;
 +
 +error:
 +    delete [] alpha;
 +
 +    return NULL;
 +}
Simple merge
index 4b5a404b26895259ec9fd118c61f969e0a3c5b8f,31183cf08b69f420f18fa14c34acb82cb5d695d8..002494504b6a6f606bda1ad6be8a3cca2529e280
@@@ -283,17 -293,17 +283,17 @@@ void RNA_def_main(BlenderRNA *brna
        RNA_def_property_string_maxlength(prop, 240);
        RNA_def_property_string_funcs(prop, "rna_Main_filename_get", "rna_Main_filename_length", "rna_Main_filename_set");
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-       RNA_def_property_ui_text(prop, "Filename", "Path to the .blend file.");
+       RNA_def_property_ui_text(prop, "Filename", "Path to the .blend file");
  
 -      for(i=0; lists[i].name; i++)
 +      for(i=0; lists[i][0]; i++)
        {
 -              prop= RNA_def_property(srna, lists[i].identifier, PROP_COLLECTION, PROP_NONE);
 -              RNA_def_property_struct_type(prop, lists[i].type);
 -              RNA_def_property_collection_funcs(prop, lists[i].iter_begin, "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0);
 -              RNA_def_property_ui_text(prop, lists[i].name, lists[i].description);
 +              prop= RNA_def_property(srna, lists[i][0], PROP_COLLECTION, PROP_NONE);
 +              RNA_def_property_struct_type(prop, lists[i][1]);
 +              RNA_def_property_collection_funcs(prop, lists[i][2], "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0);
 +              RNA_def_property_ui_text(prop, lists[i][3], lists[i][4]);
  
                /* collection functions */
 -              func= lists[i].func;
 +              func= (CollectionDefFunc *)lists[i][5];
                if(func)
                        func(brna, prop);
        }
index 94d18c48703019b4e2681402714ea2d1b5185142,361daaf8505e8467f12cc730058d6c4f89d21139..b6836623bf695089aba45446c6630d6bd7bcbde7
@@@ -1594,22 -1552,11 +1614,22 @@@ static void rna_def_scene_game_data(Ble
  static void rna_def_scene_render_layer(BlenderRNA *brna)
  {
        StructRNA *srna;
 +      PropertyRNA *prop;
  
        srna= RNA_def_struct(brna, "SceneRenderLayer", NULL);
-       RNA_def_struct_ui_text(srna, "Scene Render Layer", "Render layer.");
+       RNA_def_struct_ui_text(srna, "Scene Render Layer", "Render layer");
  
        rna_def_render_layer_common(srna, 1);
 +
 +      /* Freestyle */
 +
 +      rna_def_freestyle_settings(brna);
 +
 +      prop= RNA_def_property(srna, "freestyle_settings", PROP_POINTER, PROP_NONE);
 +      RNA_def_property_flag(prop, PROP_NEVER_NULL);
 +      RNA_def_property_pointer_sdna(prop, NULL, "freestyleConfig");
 +      RNA_def_property_struct_type(prop, "FreestyleSettings");
 +      RNA_def_property_ui_text(prop, "Freestyle Settings", "");
  }
  
  static void rna_def_scene_render_data(BlenderRNA *brna)
Simple merge
index 0000000000000000000000000000000000000000,49fac74bce832b07311899c3e332596b1cf6e774..de46aa71af96ede8ceaee1b96ce3d5b9e8e1feb0
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,133 +1,136 @@@
+ /**
+  * $Id:
+  *
+  * ***** BEGIN GPL LICENSE BLOCK *****
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  *
+  * This program is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  * GNU General Public License for more details.
+  *
+  * You should have received a copy of the GNU General Public License
+  * along with this program; if not, write to the Free Software Foundation,
+  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+  *
+  * Contributor(s): Campbell Barton
+  *
+  * ***** END GPL LICENSE BLOCK *****
+  */
+  
+ /* This file defines the '_bpy' module which is used by python's 'bpy' package.
+  * a script writer should never directly access this module */
+  
+ #include <Python.h>
+  
+ #include "bpy_rna.h"
+ #include "bpy_app.h"
+ #include "bpy_props.h"
+ #include "bpy_operator.h"
+  
+ #include "BLI_path_util.h"
+  
+  /* external util modules */
+ #include "../generic/Mathutils.h"
+ #include "../generic/Geometry.h"
+ #include "../generic/BGL.h"
+ #include "../generic/IDProp.h"
++
++#include "BPy_Freestyle.h"
+  
+ /* todo, make nice syntax for sphinx */
+ static char bpy_home_paths_doc[] = "home_paths(subfolder), return 3 paths to blender home directories (system, local, user), strings will be empty when not found.";
+ PyObject *bpy_home_paths(PyObject *self, PyObject *args)
+ {
+     PyObject *ret= PyTuple_New(3);
+     char *path;
+     char *subfolder= "";
+     
+       if (!PyArg_ParseTuple(args, "|s:blender_homes", &subfolder))
+               return NULL;
+     path= BLI_gethome_folder(subfolder, BLI_GETHOME_SYSTEM);
+     PyTuple_SET_ITEM(ret, 0, PyUnicode_FromString(path?path:""));
+     path= BLI_gethome_folder(subfolder, BLI_GETHOME_LOCAL);
+     PyTuple_SET_ITEM(ret, 1, PyUnicode_FromString(path?path:""));
+     path= BLI_gethome_folder(subfolder, BLI_GETHOME_USER);
+     PyTuple_SET_ITEM(ret, 2, PyUnicode_FromString(path?path:""));
+     
+     return ret;
+ }
+ static PyMethodDef meth_bpy_home_paths[] = {{ "home_paths", (PyCFunction)bpy_home_paths, METH_VARARGS, bpy_home_paths_doc}};
+ static void bpy_import_test(char *modname)
+ {
+       PyObject *mod= PyImport_ImportModuleLevel(modname, NULL, NULL, NULL, 0);
+       if(mod) {
+               Py_DECREF(mod);
+       }
+       else {
+               PyErr_Print();
+               PyErr_Clear();
+       }       
+ }
+ /*****************************************************************************
+ * Description: Creates the bpy module and adds it to sys.modules for importing
+ *****************************************************************************/
+ void BPy_init_modules( void )
+ {
+     extern BPy_StructRNA *bpy_context_module;
+       PyObject *mod;
+       /* Needs to be first since this dir is needed for future modules */
+       char *modpath= BLI_gethome_folder("scripts/modules", BLI_GETHOME_ALL);
+       if(modpath) {
+               PyObject *sys_path= PySys_GetObject("path"); /* borrow */
+               PyObject *py_modpath= PyUnicode_FromString(modpath);
+               PyList_Insert(sys_path, 0, py_modpath); /* add first */
+               Py_DECREF(py_modpath);
+       }
+       
+       /* stand alone utility modules not related to blender directly */
+       Geometry_Init();
+       Mathutils_Init();
+       BGL_Init();
+       IDProp_Init_Types();
++      Freestyle_Init();
+       mod = PyModule_New("_bpy");
+       /* add the module so we can import it */
+       PyDict_SetItemString(PySys_GetObject("modules"), "_bpy", mod);
+       Py_DECREF(mod);
+       /* run first, initializes rna types */
+       BPY_rna_init();
+       PyModule_AddObject( mod, "types", BPY_rna_types() ); /* needs to be first so bpy_types can run */
+       bpy_import_test("bpy_types");
+       PyModule_AddObject( mod, "data", BPY_rna_module() ); /* imports bpy_types by running this */
+       bpy_import_test("bpy_types");
+       PyModule_AddObject( mod, "props", BPY_rna_props() );
+       PyModule_AddObject( mod, "ops", BPY_operator_module() ); /* ops is now a python module that does the conversion from SOME_OT_foo -> some.foo */
+       PyModule_AddObject( mod, "app", BPY_app_struct() );
+       /* bpy context */
+     bpy_context_module= ( BPy_StructRNA * ) PyObject_NEW( BPy_StructRNA, &pyrna_struct_Type );
+     RNA_pointer_create(NULL, &RNA_Context, NULL, &bpy_context_module->ptr);
+     bpy_context_module->freeptr= 0;
+     PyModule_AddObject(mod, "context", (PyObject *)bpy_context_module);
+     
+       /* utility func's that have nowhere else to go */
+       PyModule_AddObject(mod, meth_bpy_home_paths->ml_name, (PyObject *)PyCFunction_New(meth_bpy_home_paths, NULL));
+       /* add our own modules dir, this is a python package */
+       bpy_import_test("bpy");
+ }
Simple merge
Simple merge
Simple merge