merged changes to revisio 23915
authorMaxime Curioni <maxime.curioni@gmail.com>
Sun, 18 Oct 2009 05:19:46 +0000 (05:19 +0000)
committerMaxime Curioni <maxime.curioni@gmail.com>
Sun, 18 Oct 2009 05:19:46 +0000 (05:19 +0000)
Updated buttons_render.py to have Freestyle buttons
Added "empty" BlenderTextureManager as preliminary step to remove last remnants of OpenGL and to allow Freestyle to run on my machine.

1  2 
release/scripts/ui/buttons_render.py
release/scripts/ui/buttons_scene.py
source/blender/blenloader/intern/readfile.c
source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
source/blender/makesdna/DNA_scene_types.h
source/blender/makesrna/intern/rna_scene.c
source/blender/render/intern/source/pipeline.c

index 0000000000000000000000000000000000000000,0826c766ce3659d921c74ccf352e34f3978dedc8..cd7a901a86649b86c08d184223474b3e0cd18234
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,454 +1,488 @@@
 -              col.itemR(rl, "sky")
+ import bpy
+ class RenderButtonsPanel(bpy.types.Panel):
+       __space_type__ = 'PROPERTIES'
+       __region_type__ = 'WINDOW'
+       __context__ = "render"
+       # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
+       
+       def poll(self, context):
+               rd = context.scene.render_data
+               return (context.scene and rd.use_game_engine==False) and (rd.engine in self.COMPAT_ENGINES)
+ class RENDER_PT_render(RenderButtonsPanel):
+       __label__ = "Render"
+       COMPAT_ENGINES = set(['BLENDER_RENDER'])
+       
+       def draw(self, context):
+               layout = self.layout
+               
+               rd = context.scene.render_data
+               row = layout.row()
+               row.itemO("screen.render", text="Image", icon='ICON_RENDER_STILL')
+               row.item_booleanO("screen.render", "animation", True, text="Animation", icon='ICON_RENDER_ANIMATION')
+               layout.itemR(rd, "display_mode", text="Display")
+ class RENDER_PT_layers(RenderButtonsPanel):
+       __label__ = "Layers"
+       __default_closed__ = True
+       COMPAT_ENGINES = set(['BLENDER_RENDER'])
+       
+       def draw(self, context):
+               layout = self.layout
+               
+               scene = context.scene
+               rd = scene.render_data
+               row = layout.row()
+               row.template_list(rd, "layers", rd, "active_layer_index", rows=2)
+               col = row.column(align=True)
+               col.itemO("scene.render_layer_add", icon='ICON_ZOOMIN', text="")
+               col.itemO("scene.render_layer_remove", icon='ICON_ZOOMOUT', text="")
+               rl = rd.layers[rd.active_layer_index]
+               
+               if rl:
+                       layout.itemR(rl, "name")
+               split = layout.split()
+               
+               col = split.column()
+               col.itemR(scene, "visible_layers", text="Scene")
+               col = split.column()
+               col.itemR(rl, "visible_layers", text="Layer")
+               layout.itemR(rl, "light_override", text="Light")
+               layout.itemR(rl, "material_override", text="Material")
+               
+               layout.itemS()
+               layout.itemL(text="Include:")
+               
+               split = layout.split()
+               col = split.column()
+               col.itemR(rl, "zmask")
+               row = col.row()
+               row.itemR(rl, "zmask_negate", text="Negate")
+               row.active = rl.zmask
+               col.itemR(rl, "all_z")
+               col = split.column()
+               col.itemR(rl, "solid")
+               col.itemR(rl, "halo")
+               col.itemR(rl, "ztransp")
++              col.itemR(rl, "sky")
+               col = split.column()
+               col.itemR(rl, "edge")
+               col.itemR(rl, "strand")
++              col.itemR(rl, "freestyle")
+               if rl.zmask:
+                       split = layout.split()
+                       split.itemL(text="Zmask Layers:")
+                       split.column().itemR(rl, "zmask_layers", text="")
+               
+               layout.itemS()
+               
+               split = layout.split()
+               
+               col = split.column()
+               col.itemL(text="Passes:")
+               col.itemR(rl, "pass_combined")
+               col.itemR(rl, "pass_z")
+               col.itemR(rl, "pass_vector")
+               col.itemR(rl, "pass_normal")
+               col.itemR(rl, "pass_uv")
+               col.itemR(rl, "pass_mist")
+               col.itemR(rl, "pass_object_index")
+               col = split.column()
+               col.itemL()
+               col.itemR(rl, "pass_color")
+               col.itemR(rl, "pass_diffuse")
+               row = col.row()
+               row.itemR(rl, "pass_specular")
+               row.itemR(rl, "pass_specular_exclude", text="", icon='ICON_X')
+               row = col.row()
+               row.itemR(rl, "pass_shadow")
+               row.itemR(rl, "pass_shadow_exclude", text="", icon='ICON_X')
+               row = col.row()
+               row.itemR(rl, "pass_ao")
+               row.itemR(rl, "pass_ao_exclude", text="", icon='ICON_X')
+               row = col.row()
+               row.itemR(rl, "pass_reflection")
+               row.itemR(rl, "pass_reflection_exclude", text="", icon='ICON_X')
+               row = col.row()
+               row.itemR(rl, "pass_refraction")
+               row.itemR(rl, "pass_refraction_exclude", text="", icon='ICON_X')
++              if rl.freestyle:
++                      layout.itemS()
++
++                      split = layout.split()
++
++                      col = split.column()
++                      col.itemL(text="Freestyle:")
++                      freestyle = rl.freestyle_settings
++                      col.itemR(freestyle, "sphere_radius", text="Sphere Radius")
++                      col.itemR(freestyle, "ridges_and_valleys", text="Ridges and Valleys")
++                      col.itemR(freestyle, "suggestive_contours", text="Suggestive Contours")
++                      col.itemR(freestyle, "dkr_epsilon", text="Dkr Epsilon")
++
++                      col.itemO("scene.freestyle_module_add", text="Add Style Module")
++
++                      for i, module in enumerate(freestyle.modules):
++                              box = layout.box()
++                              box.set_context_pointer("freestyle_module", module)
++                              row = box.row(align=True)
++                              row.itemR(module, "is_displayed", text="")
++                              row.itemR(module, "module_path", text="")
++                              row.itemO("scene.freestyle_module_remove", icon='ICON_X', text="")
++                              props = row.itemO("scene.freestyle_module_move_up", icon='VICON_MOVE_UP', text="", properties=True)
++                              props.active = (i > 0)
++                              props = row.itemO("scene.freestyle_module_move_down", icon='VICON_MOVE_DOWN', text="", properties=True)
++                              props.active = (i < len(freestyle.modules) - 1)
++
+ class RENDER_PT_shading(RenderButtonsPanel):
+       __label__ = "Shading"
+       COMPAT_ENGINES = set(['BLENDER_RENDER'])
+       def draw(self, context):
+               layout = self.layout
+               
+               rd = context.scene.render_data
+               
+               split = layout.split()
+               
+               col = split.column()
+               col.itemR(rd, "render_textures", text="Textures")
+               col.itemR(rd, "render_shadows", text="Shadows")
+               col.itemR(rd, "render_sss", text="Subsurface Scattering")
+               col.itemR(rd, "render_envmaps", text="Environment Map")
+               
+               col = split.column()
+               col.itemR(rd, "render_raytracing", text="Ray Tracing")
+               col.itemR(rd, "color_management")
+               col.itemR(rd, "alpha_mode", text="Alpha")
+ class RENDER_PT_performance(RenderButtonsPanel):
+       __label__ = "Performance"
+       __default_closed__ = True
+       COMPAT_ENGINES = set(['BLENDER_RENDER'])
+       def draw(self, context):
+               layout = self.layout
+               
+               rd = context.scene.render_data
+               split = layout.split()
+               
+               col = split.column(align=True)
+               col.itemL(text="Threads:")
+               col.row().itemR(rd, "threads_mode", expand=True)
+               sub = col.column()
+               sub.enabled = rd.threads_mode == 'THREADS_FIXED'
+               sub.itemR(rd, "threads")
+               col.itemL(text="Tiles:")
+               col.itemR(rd, "parts_x", text="X")
+               col.itemR(rd, "parts_y", text="Y")
+               col = split.column()
+               col.itemL(text="Memory:")
+               sub = col.column()
+               sub.itemR(rd, "save_buffers")
+               sub.enabled = not rd.full_sample
+               sub = col.column()
+               sub.active = rd.use_compositing
+               sub.itemR(rd, "free_image_textures")
+               sub = col.column()
+               sub.active = rd.render_raytracing
+               sub.itemL(text="Acceleration structure:")
+               sub.itemR(rd, "raytrace_structure", text="")
+               if rd.raytrace_structure == "OCTREE":
+                       sub.itemR(rd, "octree_resolution", text="Resolution")
+               else:
+                       sub.itemR(rd, "use_instances", text="Instances")
+               sub.itemR(rd, "use_local_coords", text="Local Coordinates")
+ class RENDER_PT_post_processing(RenderButtonsPanel):
+       __label__ = "Post Processing"
+       __default_closed__ = True
+       COMPAT_ENGINES = set(['BLENDER_RENDER'])
+       def draw(self, context):
+               layout = self.layout
+               
+               rd = context.scene.render_data
+               split = layout.split()
+               col = split.column()
+               col.itemR(rd, "use_compositing")
+               col.itemR(rd, "use_sequencer")
+               
+               col = split.column()
+               col.itemR(rd, "dither_intensity", text="Dither", slider=True)
+               
+               layout.itemS()
+                               
+               split = layout.split()
+               
+               col = split.column()
+               col.itemR(rd, "fields", text="Fields")
+               sub = col.column()
+               sub.active = rd.fields
+               sub.row().itemR(rd, "field_order", expand=True)
+               sub.itemR(rd, "fields_still", text="Still")
+               
+               col = split.column()
+               col.itemR(rd, "edge")
+               sub = col.column()
+               sub.active = rd.edge
+               sub.itemR(rd, "edge_threshold", text="Threshold", slider=True)
+               sub.itemR(rd, "edge_color", text="")
+               
++              layout.itemS()
++
++              split = layout.split()
++              col = split.column()
++              col.itemR(rd, "freestyle", text="Freestyle")
++              
+ class RENDER_PT_output(RenderButtonsPanel):
+       __label__ = "Output"
+       COMPAT_ENGINES = set(['BLENDER_RENDER'])
+       def draw(self, context):
+               layout = self.layout
+               
+               rd = context.scene.render_data
+               
+               layout.itemR(rd, "output_path", text="")
+               split = layout.split()
+               col = split.column()
+               col.itemR(rd, "file_format", text="")
+               col.row().itemR(rd, "color_mode", text="Color", expand=True)
+               col = split.column()
+               col.itemR(rd, "file_extensions")
+               col.itemR(rd, "use_overwrite")
+               col.itemR(rd, "use_placeholder")
+               if rd.file_format in ('AVIJPEG', 'JPEG'):
+                       split = layout.split()
+                       split.itemR(rd, "quality", slider=True)
+                       
+               elif rd.file_format == 'OPENEXR':
+                       split = layout.split()
+                       
+                       col = split.column()
+                       col.itemL(text="Codec:")
+                       col.itemR(rd, "exr_codec", text="")
+                       subsplit = split.split()
+                       col = subsplit.column()
+                       col.itemR(rd, "exr_half")
+                       col.itemR(rd, "exr_zbuf")
+                       col = subsplit.column()
+                       col.itemR(rd, "exr_preview")
+               
+               elif rd.file_format == 'JPEG2000':
+                       split = layout.split()
+                       col = split.column()
+                       col.itemL(text="Depth:")
+                       col.row().itemR(rd, "jpeg2k_depth", expand=True)
+                       col = split.column()
+                       col.itemR(rd, "jpeg2k_preset", text="")
+                       col.itemR(rd, "jpeg2k_ycc")
+                       
+               elif rd.file_format in ('CINEON', 'DPX'):
+                       split = layout.split()
+                       col = split.column()
+                       col.itemR(rd, "cineon_log", text="Convert to Log")
+                       col = split.column(align=True)
+                       col.active = rd.cineon_log
+                       col.itemR(rd, "cineon_black", text="Black")
+                       col.itemR(rd, "cineon_white", text="White")
+                       col.itemR(rd, "cineon_gamma", text="Gamma")
+                       
+               elif rd.file_format == 'TIFF':
+                       split = layout.split()
+                       split.itemR(rd, "tiff_bit")
+ class RENDER_PT_encoding(RenderButtonsPanel):
+       __label__ = "Encoding"
+       __default_closed__ = True
+       COMPAT_ENGINES = set(['BLENDER_RENDER'])
+       
+       def poll(self, context):
+               rd = context.scene.render_data
+               return rd.file_format in ('FFMPEG', 'XVID', 'H264', 'THEORA')
+       def draw(self, context):
+               layout = self.layout
+               
+               rd = context.scene.render_data
+               split = layout.split()
+               
+               split.itemR(rd, "ffmpeg_format")
+               if rd.ffmpeg_format in ('AVI', 'QUICKTIME', 'MKV', 'OGG'):
+                       split.itemR(rd, "ffmpeg_codec")
+               else:
+                       split.itemL()
+               split = layout.split()
+       
+               col = split.column()
+               col.itemR(rd, "ffmpeg_video_bitrate")
+               col.itemL(text="Rate:")
+               col.itemR(rd, "ffmpeg_minrate", text="Minimum")
+               col.itemR(rd, "ffmpeg_maxrate", text="Maximum")
+               col.itemR(rd, "ffmpeg_buffersize", text="Buffer")
+               
+               col = split.column()
+               col.itemR(rd, "ffmpeg_gopsize")
+               col.itemR(rd, "ffmpeg_autosplit")
+               col.itemL(text="Mux:")
+               col.itemR(rd, "ffmpeg_muxrate", text="Rate")
+               col.itemR(rd, "ffmpeg_packetsize", text="Packet Size")
+               
+               row = layout.row()
+               row.itemL(text="Audio:")
+               row = layout.row()
+               row.itemR(rd, "ffmpeg_audio_codec")
+               
+               split = layout.split()
+               col = split.column()
+               col.itemR(rd, "ffmpeg_audio_bitrate")
+               col.itemR(rd, "ffmpeg_audio_mixrate")
+               col = split.column()
+               col.itemR(rd, "ffmpeg_multiplex_audio")
+               col.itemR(rd, "ffmpeg_audio_volume")
+ class RENDER_PT_antialiasing(RenderButtonsPanel):
+       __label__ = "Anti-Aliasing"
+       COMPAT_ENGINES = set(['BLENDER_RENDER'])
+       def draw_header(self, context):
+               rd = context.scene.render_data
+               self.layout.itemR(rd, "antialiasing", text="")
+       def draw(self, context):
+               layout = self.layout
+               
+               rd = context.scene.render_data
+               layout.active = rd.antialiasing
+               split = layout.split()
+               
+               col = split.column()
+               col.row().itemR(rd, "antialiasing_samples", expand=True)
+               col.itemR(rd, "full_sample")
+               col = split.column()
+               col.itemR(rd, "pixel_filter", text="")
+               col.itemR(rd, "filter_size", text="Size", slider=True)
+       
+ class RENDER_PT_dimensions(RenderButtonsPanel):
+       __label__ = "Dimensions"
+       COMPAT_ENGINES = set(['BLENDER_RENDER'])
+       def draw(self, context):
+               layout = self.layout
+               
+               scene = context.scene
+               rd = scene.render_data
+               
+               split = layout.split()
+               
+               col = split.column()
+               sub = col.column(align=True)
+               sub.itemL(text="Resolution:")
+               sub.itemR(rd, "resolution_x", text="X")
+               sub.itemR(rd, "resolution_y", text="Y")
+               sub.itemR(rd, "resolution_percentage", text="")
+               
+               sub.itemL(text="Aspect Ratio:")
+               sub.itemR(rd, "pixel_aspect_x", text="X")
+               sub.itemR(rd, "pixel_aspect_y", text="Y")
+               row = col.row()
+               row.itemR(rd, "use_border", text="Border")
+               rowsub = row.row()
+               rowsub.active = rd.use_border
+               rowsub.itemR(rd, "crop_to_border", text="Crop")
+               
+               col = split.column(align=True)
+               col.itemL(text="Frame Range:")
+               col.itemR(scene, "start_frame", text="Start")
+               col.itemR(scene, "end_frame", text="End")
+               col.itemR(scene, "frame_step", text="Step")
+               
+               col.itemL(text="Frame Rate:")
+               col.itemR(rd, "fps")
+               col.itemR(rd, "fps_base",text="/")
+ class RENDER_PT_stamp(RenderButtonsPanel):
+       __label__ = "Stamp"
+       __default_closed__ = True
+       COMPAT_ENGINES = set(['BLENDER_RENDER'])
+       def draw_header(self, context):
+               rd = context.scene.render_data
+               self.layout.itemR(rd, "render_stamp", text="")
+       def draw(self, context):
+               layout = self.layout
+               
+               rd = context.scene.render_data
+               layout.active = rd.render_stamp
+               split = layout.split()
+               
+               col = split.column()
+               col.itemR(rd, "stamp_time", text="Time")
+               col.itemR(rd, "stamp_date", text="Date")
+               col.itemR(rd, "stamp_render_time", text="RenderTime")
+               col.itemR(rd, "stamp_frame", text="Frame")
+               col.itemR(rd, "stamp_scene", text="Scene")
+               col.itemR(rd, "stamp_camera", text="Camera")
+               col.itemR(rd, "stamp_filename", text="Filename")
+               col.itemR(rd, "stamp_marker", text="Marker")
+               col.itemR(rd, "stamp_sequence_strip", text="Seq. Strip")
+               col = split.column()
+               col.active = rd.render_stamp
+               col.itemR(rd, "stamp_foreground", slider=True)
+               col.itemR(rd, "stamp_background", slider=True)
+               col.itemR(rd, "stamp_font_size", text="Font Size")
+               row = layout.split(percentage=0.2)
+               row.itemR(rd, "stamp_note", text="Note")
+               sub = row.row()
+               sub.active = rd.stamp_note
+               sub.itemR(rd, "stamp_note_text", text="")
+ bpy.types.register(RENDER_PT_render)
+ bpy.types.register(RENDER_PT_layers)
+ bpy.types.register(RENDER_PT_dimensions)
+ bpy.types.register(RENDER_PT_antialiasing)
+ bpy.types.register(RENDER_PT_shading)
+ bpy.types.register(RENDER_PT_output)
+ bpy.types.register(RENDER_PT_encoding)
+ bpy.types.register(RENDER_PT_performance)
+ bpy.types.register(RENDER_PT_post_processing)
+ bpy.types.register(RENDER_PT_stamp)
index 1025d11284e64739e086a2eef4fef5e6b3819b29,54f47791d593e20a2adf74db19f19b7e87c813fe..ed6421d0646ca56627d51c22e244147cd311fd15
@@@ -1,4 -1,4 +1,3 @@@
--
  import bpy
  
  class SceneButtonsPanel(bpy.types.Panel):
@@@ -614,3 -135,3 +134,4 @@@ bpy.types.register(SCENE_PT_unit
  bpy.types.register(SCENE_PT_keying_sets)
  bpy.types.register(SCENE_PT_keying_set_paths)
  bpy.types.register(SCENE_PT_physics)
++
index 3759a1206a82a647fdce7a20e1480041ea6c058b,0000000000000000000000000000000000000000..e16568b5cf6b941c0c04a1ecf3d0107bc2911273
mode 100644,000000..100644
--- /dev/null
@@@ -1,273 -1,0 +1,273 @@@
- # include "../rendering/GLStrokeRenderer.h"
 +# include "BlenderStrokeRenderer.h"
 +# include "../stroke/Canvas.h"
 +# include "../application/AppConfig.h"
 +
-       _textureManager = new GLTextureManager;
++# 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"
 +
 +#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 width = freestyle_scene->r.xsch;
 +      float height = freestyle_scene->r.ysch;
 +
 +      // 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 face_index;
 +      
 +        for(vector<Strip*>::iterator s=strips.begin(), send=strips.end();
 +        s!=send;
 +        ++s){         
 +              
 +              // 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
 +              
 +              int strip_vertex_count = (*s)->sizeStrip();
 +      
 +              // vertices allocation
 +              mesh->totvert = strip_vertex_count;
 +              mesh->mvert = (MVert*) CustomData_add_layer( &mesh->vdata, CD_MVERT, CD_CALLOC, NULL, mesh->totvert);
 +                      
 +              // faces allocation
 +              mesh->totface = strip_vertex_count - 2;
 +              mesh->mface = (MFace*) CustomData_add_layer( &mesh->fdata, CD_MFACE, CD_CALLOC, NULL, mesh->totface);
 +              
 +              // colors allocation  - me.vertexColors = True
 +              mesh->mcol = (MCol *) CustomData_add_layer( &mesh->fdata, CD_MCOL, CD_CALLOC, NULL, mesh->totface );
 +
 +              ////////////////////
 +              //  Data copy
 +              ////////////////////
 +              
 +              MVert* vertices = mesh->mvert;
 +              MFace* faces = mesh->mface;
 +              MCol* colors = mesh->mcol;
 +              
 +          Strip::vertex_container& strip_vertices = (*s)->vertices();
 +          v[0] = strip_vertices.begin();
 +          v[1] = v[0]; ++(v[1]);
 +          v[2] = v[1]; ++(v[2]);
 +
 +              // first vertex
 +              svRep[0] = *(v[0]);
 +              vertices->co[0] = svRep[0]->point2d()[0];
 +              vertices->co[1] = svRep[0]->point2d()[1];
 +              vertices->co[2] = 0.0;
 +              ++vertices;
 +              
 +              // second vertex
 +              svRep[1] = *(v[1]);
 +              vertices->co[0] = svRep[1]->point2d()[0];
 +              vertices->co[1] = svRep[1]->point2d()[1];
 +              vertices->co[2] = 0.0;
 +              ++vertices;
 +              
 +              // iterating over subsequent vertices: each vertex adds a new face
 +              face_index = 0;
 +              
 +          while( v[2] != strip_vertices.end() ) 
 +              {
 +                      // INPUT
 +                      svRep[0] = *(v[0]);
 +                      svRep[1] = *(v[1]);
 +                      svRep[2] = *(v[2]);
 +                      
 +                      color[0] = svRep[0]->color();
 +                      color[1] = svRep[1]->color();
 +                      color[2] = svRep[2]->color();
 +                      
 +                      // vertex
 +                      vertices->co[0] = svRep[2]->point2d()[0];
 +                      vertices->co[1] = svRep[2]->point2d()[1];
 +                      vertices->co[2] = 0.0;
 +                      
 +                      // faces
 +                      faces->v1 = face_index;
 +                      faces->v2 = face_index + 1;
 +                      faces->v3 = face_index + 2;
 +                      faces->v4 = 0;
 +                      
 +                      // colors
 +                      // red and blue are swapped - cf DNA_meshdata_types.h : MCol    
 +                      colors->r = (short)(255.0f*(color[0])[2]);
 +                      colors->g = (short)(255.0f*(color[0])[1]);
 +                      colors->b = (short)(255.0f*(color[0])[0]);
 +                      colors->a = (short)(255.0f*svRep[0]->alpha());
 +                      ++colors;
 +                      
 +                      colors->r = (short)(255.0f*(color[1])[2]);
 +                      colors->g = (short)(255.0f*(color[1])[1]);
 +                      colors->b = (short)(255.0f*(color[1])[0]);
 +                      colors->a = (short)(255.0f*svRep[1]->alpha());
 +                      ++colors;
 +                      
 +                      colors->r = (short)(255.0f*(color[2])[2]);
 +                      colors->g = (short)(255.0f*(color[2])[1]);
 +                      colors->b = (short)(255.0f*(color[2])[0]);
 +                      colors->a = (short)(255.0f*svRep[2]->alpha());
 +                      ++colors;
 +                      
 +                      // ITERATION
 +                      ++v[0]; ++v[1]; ++v[2];
 +                      ++faces; ++vertices; ++colors;
 +                      ++face_index;
 +              
 +              } // loop over strip vertices 
 +      
 +      } // loop over strips   
 +
 +}
 +
 +Render* BlenderStrokeRenderer::RenderScene( Render *re ) {
 +      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;
 +      
 +      Render* freestyle_render = RE_NewRender(freestyle_scene->id.name);
 +      
 +      RE_BlenderFrame( freestyle_render, freestyle_scene, 1);
 +      return freestyle_render;
 +}