Merged changes in the trunk up to revision 31190.
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Mon, 9 Aug 2010 11:32:55 +0000 (11:32 +0000)
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Mon, 9 Aug 2010 11:32:55 +0000 (11:32 +0000)
35 files changed:
1  2 
release/scripts/ui/properties_render.py
release/scripts/ui/space_userpref.py
source/blender/CMakeLists.txt
source/blender/SConscript
source/blender/blenkernel/BKE_main.h
source/blender/blenkernel/CMakeLists.txt
source/blender/blenkernel/SConscript
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/scene.c
source/blender/blenloader/intern/readblenentry.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/render/render_shading.c
source/blender/editors/space_outliner/outliner.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_orientations.c
source/blender/makesdna/DNA_ID.h
source/blender/makesdna/DNA_scene_types.h
source/blender/makesdna/intern/makesdna.c
source/blender/makesrna/RNA_access.h
source/blender/makesrna/SConscript
source/blender/makesrna/intern/CMakeLists.txt
source/blender/makesrna/intern/makesrna.c
source/blender/makesrna/intern/rna_internal.h
source/blender/makesrna/intern/rna_main.c
source/blender/makesrna/intern/rna_scene.c
source/blender/python/SConscript
source/blender/python/doc/sphinx_doc_gen.py
source/blender/python/intern/bpy.c
source/blender/render/CMakeLists.txt
source/blender/render/intern/source/pipeline.c
source/creator/CMakeLists.txt
source/creator/SConscript
source/creator/creator.c

index e446767fa01a07ff612e4f3481f3333470f3397b,cd11179dc2577976be87241a1a6245e801be10a6..6856e73dc2f59286623de93d043164dadc2b4ff3
@@@ -19,8 -19,6 +19,6 @@@
  # <pep8 compliant>
  import bpy
  
- narrowui = bpy.context.user_preferences.view.properties_width_check
  
  class RENDER_MT_presets(bpy.types.Menu):
      bl_label = "Render Presets"
@@@ -36,18 -34,19 +34,19 @@@ class RENDER_MT_ffmpeg_presets(bpy.type
      draw = bpy.types.Menu.draw_preset
  
  
- class RenderButtonsPanel(bpy.types.Panel):
+ class RenderButtonsPanel():
      bl_space_type = 'PROPERTIES'
      bl_region_type = 'WINDOW'
      bl_context = "render"
      # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
  
-     def poll(self, context):
+     @classmethod
+     def poll(cls, context):
          rd = context.scene.render
-         return (context.scene and rd.use_game_engine is False) and (rd.engine in self.COMPAT_ENGINES)
+         return (context.scene and rd.use_game_engine is False) and (rd.engine in cls.COMPAT_ENGINES)
  
  
- class RENDER_PT_render(RenderButtonsPanel):
+ class RENDER_PT_render(RenderButtonsPanel, bpy.types.Panel):
      bl_label = "Render"
      COMPAT_ENGINES = {'BLENDER_RENDER'}
  
          layout = self.layout
  
          rd = context.scene.render
-         wide_ui = context.region.width > narrowui
  
          split = layout.split()
  
          col = split.column()
          col.operator("render.render", text="Image", icon='RENDER_STILL')
  
-         if wide_ui:
-             col = split.column()
+         col = split.column()
          col.operator("render.render", text="Animation", icon='RENDER_ANIMATION').animation = True
  
          layout.prop(rd, "display_mode", text="Display")
  
  
- class RENDER_PT_layers(RenderButtonsPanel):
+ class RENDER_PT_layers(RenderButtonsPanel, bpy.types.Panel):
      bl_label = "Layers"
      bl_default_closed = True
      COMPAT_ENGINES = {'BLENDER_RENDER'}
@@@ -79,7 -76,6 +76,6 @@@
  
          scene = context.scene
          rd = scene.render
-         wide_ui = context.region.width > narrowui
  
          row = layout.row()
          row.template_list(rd, "layers", rd, "active_layer_index", rows=2)
          col.label(text="")
          col.prop(rl, "light_override", text="Light")
          col.prop(rl, "material_override", text="Material")
-         if wide_ui:
-             col = split.column()
+         col = split.column()
          col.prop(rl, "visible_layers", text="Layer")
          col.label(text="Mask Layers:")
          col.prop(rl, "zmask_layers", text="")
          col.prop(rl, "solid")
          col.prop(rl, "halo")
          col.prop(rl, "ztransp")
 -
 -        col = split.column()
          col.prop(rl, "sky")
 +              
 +        col = split.column()
          col.prop(rl, "edge")
          col.prop(rl, "strand")
 +        col.prop(rl, "freestyle")
  
          layout.separator()
  
          col.prop(rl, "pass_object_index")
          col.prop(rl, "pass_color")
  
-         if wide_ui:
-             col = split.column()
+         col = split.column()
          col.label()
          col.prop(rl, "pass_diffuse")
          row = col.row()
          row.prop(rl, "pass_refraction_exclude", text="")
  
  
- class RENDER_PT_freestyle(RenderButtonsPanel):
++class RENDER_PT_freestyle(RenderButtonsPanel, bpy.types.Panel):
 +    bl_label = "Freestyle"
 +    COMPAT_ENGINES = {'BLENDER_RENDER'}
 +
-     def poll(self, context):
++    @classmethod
++    def poll(cls, context):
 +        rd = context.scene.render
 +        rl = rd.layers[rd.active_layer_index]
 +        return rl and rl.freestyle
 +
 +    def draw(self, context):
 +        layout = self.layout
 +
 +        rd = context.scene.render
 +        rl = rd.layers[rd.active_layer_index]
 +        freestyle = rl.freestyle_settings
 +
 +        split = layout.split()
 +
 +        col = split.column()
 +        col.prop(freestyle, "mode", text="Control Mode")
 +
 +        if freestyle.mode == "EDITOR":
 +            col.label(text="Edge Detection Options:")
 +            col.prop(freestyle, "crease_angle")
 +            col.prop(freestyle, "sphere_radius")
 +            col.prop(freestyle, "dkr_epsilon")
 +
 +            lineset = freestyle.active_lineset
 +
 +            col.label(text="Line Sets:")
 +            row = col.row()
 +            rows = 2
 +            if lineset:
 +                rows = 5
 +            # FIXME: scrollbar does not work correctly
 +            row.template_list(freestyle, "linesets", freestyle, "active_lineset_index", rows=rows)
 +
 +            sub = row.column()
 +            subsub = sub.column(align=True)
 +            subsub.operator("scene.freestyle_lineset_add", icon='ZOOMIN', text="")
 +            subsub.operator("scene.freestyle_lineset_remove", icon='ZOOMOUT', text="")
 +            if lineset:
 +                sub.separator()
 +                subsub = sub.column(align=True)
 +                subsub.operator("scene.freestyle_lineset_move", icon='TRIA_UP', text="").direction = 'UP'
 +                subsub.operator("scene.freestyle_lineset_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
 +
 +            if lineset:
 +                col.prop(lineset, "name")
 +                col.prop(lineset, "select_by_visibility")
 +                col.prop(lineset, "select_by_edge_types")
 +
 +                if lineset.select_by_visibility:
 +                    col.label(text="Visibility:")
 +                    sub = col.row(align=True)
 +                    sub.prop(lineset, "visibility", expand=True)
 +                    if lineset.visibility == "RANGE":
 +                        sub = col.row(align=True)
 +                        sub.prop(lineset, "qi_start")
 +                        sub.prop(lineset, "qi_end")
 +
 +                if lineset.select_by_edge_types:
 +                    col.label(text="Edge Types:")
 +                    row = col.row()
 +                    row.prop(lineset, "edge_type_negation", expand=True)
 +                    row = col.row()
 +                    row.prop(lineset, "edge_type_combination", expand=True)
 +
 +                    row = col.row()
 +                    sub = row.column()
 +                    sub.prop(lineset, "select_silhouette")
 +                    sub.prop(lineset, "select_border")
 +                    sub.prop(lineset, "select_crease")
 +                    sub.prop(lineset, "select_ridge")
 +                    sub.prop(lineset, "select_valley")
 +                    sub.prop(lineset, "select_suggestive_contour")
 +                    sub.prop(lineset, "select_material_boundary")
 +                    sub = row.column()
 +                    sub.prop(lineset, "select_contour")
 +                    sub.prop(lineset, "select_external_contour")
 +
 +        else: # freestyle.mode == "SCRIPT"
 +
 +            col.prop(freestyle, "crease_angle")
 +            col.prop(freestyle, "sphere_radius")
 +            col.prop(freestyle, "ridges_and_valleys")
 +            col.prop(freestyle, "suggestive_contours")
 +            sub = col.row()
 +            sub.prop(freestyle, "dkr_epsilon")
 +            sub.active = freestyle.suggestive_contours
 +            col.prop(freestyle, "material_boundaries")
 +            col.operator("scene.freestyle_module_add")
 +
 +            for i, module in enumerate(freestyle.modules):
 +                    box = layout.box()
 +                    box.set_context_pointer("freestyle_module", module)
 +                    row = box.row(align=True)
 +                    row.prop(module, "is_displayed", text="")
 +                    row.prop(module, "module_path", text="")
 +                    row.operator("scene.freestyle_module_remove", icon='X', text="")
 +                    row.operator("scene.freestyle_module_move", icon='TRIA_UP', text="").direction = 'UP'
 +                    row.operator("scene.freestyle_module_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
 +
 +
- class RENDER_PT_freestyle_linestyle(RenderButtonsPanel):
++class RENDER_PT_freestyle_linestyle(RenderButtonsPanel, bpy.types.Panel):
 +    bl_label = "Freestyle: Line Style"
 +    COMPAT_ENGINES = {'BLENDER_RENDER'}
 +
-     def poll(self, context):
++    @classmethod
++    def poll(cls, context):
 +        rd = context.scene.render
 +        rl = rd.layers[rd.active_layer_index]
 +        if rl and rl.freestyle:
 +            freestyle = rl.freestyle_settings
 +            return freestyle.mode == "EDITOR" and freestyle.active_lineset
 +        return False
 +
 +    def draw_modifier_box_header(self, box, modifier):
 +        row = box.row()
 +        row.set_context_pointer("modifier", modifier)
 +        if modifier.expanded:
 +            icon = "TRIA_DOWN"
 +        else:
 +            icon = "TRIA_RIGHT"
 +        row.operator("scene.freestyle_modifier_toggle_fold", icon=icon, text="", emboss=False)
 +        row.label(text=modifier.rna_type.name)
 +        row.prop(modifier, "name", text="")
 +        row.prop(modifier, "enabled", text="")
 +        sub = row.row(align=True)
 +        sub.operator("scene.freestyle_modifier_move", icon='TRIA_UP', text="").direction = 'UP'
 +        sub.operator("scene.freestyle_modifier_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
 +        row.operator("scene.freestyle_modifier_remove", icon='X', text="")
 +
 +    def draw_color_modifier(self, context, modifier):
 +        layout = self.layout
 +
 +        col = layout.column(align=True)
 +        self.draw_modifier_box_header(col.box(), modifier)
 +        if modifier.expanded:
 +            box = col.box()
 +            row = box.row()
 +            row.prop(modifier, "blend", text="")
 +            row.prop(modifier, "influence")
 +            if modifier.type == "DISTANCE_FROM_OBJECT":
 +                box.prop(modifier, "target")
 +            box.template_color_ramp(modifier, "color_ramp", expand=True)
 +            if modifier.type not in ["ALONG_STROKE"]:
 +                row = box.row(align=True)
 +                row.prop(modifier, "range_min")
 +                row.prop(modifier, "range_max")
 +
 +    def draw_alpha_modifier(self, context, modifier):
 +        layout = self.layout
 +
 +        col = layout.column(align=True)
 +        self.draw_modifier_box_header(col.box(), modifier)
 +        if modifier.expanded:
 +            box = col.box()
 +            row = box.row()
 +            row.prop(modifier, "blend", text="")
 +            row.prop(modifier, "influence")
 +            if modifier.type == "DISTANCE_FROM_OBJECT":
 +                box.prop(modifier, "target")
 +            row = box.row()
 +            row.prop(modifier, "mapping", text="")
 +            sub = row.column()
 +            sub.prop(modifier, "invert")
 +            if modifier.mapping == "CURVE":
 +                sub.enabled = False
 +                box.template_curve_mapping(modifier, "curve")
 +            if modifier.type not in ["ALONG_STROKE"]:
 +                row = box.row(align=True)
 +                row.prop(modifier, "range_min")
 +                row.prop(modifier, "range_max")
 +
 +    def draw_thickness_modifier(self, context, modifier):
 +        layout = self.layout
 +
 +        col = layout.column(align=True)
 +        self.draw_modifier_box_header(col.box(), modifier)
 +        if modifier.expanded:
 +            box = col.box()
 +            row = box.row()
 +            row.prop(modifier, "blend", text="")
 +            row.prop(modifier, "influence")
 +            if modifier.type == "DISTANCE_FROM_OBJECT":
 +                box.prop(modifier, "target")
 +            row = box.row()
 +            row.prop(modifier, "mapping", text="")
 +            sub = row.column()
 +            sub.prop(modifier, "invert")
 +            if modifier.mapping == "CURVE":
 +                sub.enabled = False
 +                box.template_curve_mapping(modifier, "curve")
 +            if modifier.type not in ["ALONG_STROKE"]:
 +                row = box.row(align=True)
 +                row.prop(modifier, "range_min")
 +                row.prop(modifier, "range_max")
 +            row = box.row(align=True)
 +            row.prop(modifier, "value_min")
 +            row.prop(modifier, "value_max")
 +
 +    def draw(self, context):
 +        layout = self.layout
 +
 +        rd = context.scene.render
 +        rl = rd.layers[rd.active_layer_index]
 +        lineset = rl.freestyle_settings.active_lineset
 +        linestyle = lineset.linestyle
 +
 +        split = layout.split()
 +        col = split.column()
 +        col.template_ID(lineset, "linestyle", new="scene.freestyle_linestyle_new")
 +
 +        col.separator()
 +        sub = col.row(align=True)
 +        sub.prop(linestyle, "panel", expand=True)
 +
 +        if linestyle.panel == "COLOR":
 +            col.label(text="Base Color:")
 +            col.prop(linestyle, "color", text="")
 +            col.label(text="Modifiers:")
 +            layout.operator_menu_enum("scene.freestyle_color_modifier_add", "type", text="Add Modifier")
 +            for modifier in linestyle.color_modifiers:
 +                self.draw_color_modifier(context, modifier)
 +        elif linestyle.panel == "ALPHA":
 +            col.label(text="Base Transparency:")
 +            col.prop(linestyle, "alpha")
 +            col.label(text="Modifiers:")
 +            layout.operator_menu_enum("scene.freestyle_alpha_modifier_add", "type", text="Add Modifier")
 +            for modifier in linestyle.alpha_modifiers:
 +                self.draw_alpha_modifier(context, modifier)
 +        elif linestyle.panel == "THICKNESS":
 +            col.label(text="Base Thickness:")
 +            col.prop(linestyle, "thickness")
 +            col.label(text="Modifiers:")
 +            layout.operator_menu_enum("scene.freestyle_thickness_modifier_add", "type", text="Add Modifier")
 +            for modifier in linestyle.thickness_modifiers:
 +                self.draw_thickness_modifier(context, modifier)
 +        elif linestyle.panel == "STROKES":
 +            pass
 +        elif linestyle.panel == "DISTORT":
 +            pass
 +        elif linestyle.panel == "MISC":
 +            pass
 +
 +
- class RENDER_PT_shading(RenderButtonsPanel):
+ class RENDER_PT_shading(RenderButtonsPanel, bpy.types.Panel):
      bl_label = "Shading"
      COMPAT_ENGINES = {'BLENDER_RENDER'}
  
          layout = self.layout
  
          rd = context.scene.render
-         wide_ui = context.region.width > narrowui
  
          split = layout.split()
  
          col.prop(rd, "use_sss", text="Subsurface Scattering")
          col.prop(rd, "use_envmaps", text="Environment Map")
  
-         if wide_ui:
-             col = split.column()
+         col = split.column()
          col.prop(rd, "use_raytracing", text="Ray Tracing")
          col.prop(rd, "color_management")
          col.prop(rd, "alpha_mode", text="Alpha")
  
  
- class RENDER_PT_performance(RenderButtonsPanel):
+ class RENDER_PT_performance(RenderButtonsPanel, bpy.types.Panel):
      bl_label = "Performance"
      bl_default_closed = True
      COMPAT_ENGINES = {'BLENDER_RENDER'}
          layout = self.layout
  
          rd = context.scene.render
-         wide_ui = context.region.width > narrowui
  
          split = layout.split()
  
          sub.prop(rd, "parts_x", text="X")
          sub.prop(rd, "parts_y", text="Y")
  
-         if wide_ui:
-             col = split.column()
+         col = split.column()
          col.label(text="Memory:")
          sub = col.column()
          sub.enabled = not (rd.use_border or rd.full_sample)
          sub.prop(rd, "use_local_coords", text="Local Coordinates")
  
  
- class RENDER_PT_post_processing(RenderButtonsPanel):
+ class RENDER_PT_post_processing(RenderButtonsPanel, bpy.types.Panel):
      bl_label = "Post Processing"
      bl_default_closed = True
      COMPAT_ENGINES = {'BLENDER_RENDER'}
          layout = self.layout
  
          rd = context.scene.render
-         wide_ui = context.region.width > narrowui
  
          split = layout.split()
  
          col.prop(rd, "use_compositing")
          col.prop(rd, "use_sequencer")
  
-         if wide_ui:
-             col = split.column()
+         col = split.column()
          col.prop(rd, "dither_intensity", text="Dither", slider=True)
  
          layout.separator()
          sub.prop(rd, "fields_still", text="Still")
  
  
-         if wide_ui:
-             col = split.column()
-         else:
-             col.separator()
+         col = split.column()
          col.prop(rd, "edge")
          sub = col.column()
          sub.active = rd.edge
          sub.prop(rd, "edge_threshold", text="Threshold", slider=True)
          sub.prop(rd, "edge_color", text="")
  
 +        layout.separator()
 +
 +        split = layout.split()
 +        col = split.column()
 +        col.prop(rd, "freestyle", text="Freestyle")
 +
  
- class RENDER_PT_output(RenderButtonsPanel):
+ class RENDER_PT_output(RenderButtonsPanel, bpy.types.Panel):
      bl_label = "Output"
      COMPAT_ENGINES = {'BLENDER_RENDER'}
  
  
          rd = context.scene.render
          file_format = rd.file_format
-         wide_ui = context.region.width > narrowui
  
          layout.prop(rd, "output_path", text="")
  
          col.prop(rd, "file_format", text="")
          col.row().prop(rd, "color_mode", text="Color", expand=True)
  
-         if wide_ui:
-             col = split.column()
+         col = split.column()
          col.prop(rd, "use_file_extension")
          col.prop(rd, "use_overwrite")
          col.prop(rd, "use_placeholder")
              col = split.column()
              col.label(text="Codec:")
              col.prop(rd, "exr_codec", text="")
-             if wide_ui:
-                 col = split.column()
+             col = split.column()
  
          elif file_format == 'OPEN_EXR':
              split = layout.split()
              col.label(text="Codec:")
              col.prop(rd, "exr_codec", text="")
  
-             if wide_ui:
-                 subsplit = split.split()
-                 col = subsplit.column()
+             subsplit = split.split()
+             col = subsplit.column()
              col.prop(rd, "exr_half")
              col.prop(rd, "exr_zbuf")
  
-             if wide_ui:
-                 col = subsplit.column()
+             col = subsplit.column()
              col.prop(rd, "exr_preview")
  
          elif file_format == 'JPEG2000':
              col.label(text="Depth:")
              col.row().prop(rd, "jpeg2k_depth", expand=True)
  
-             if wide_ui:
-                 col = split.column()
+             col = split.column()
              col.prop(rd, "jpeg2k_preset", text="")
              col.prop(rd, "jpeg2k_ycc")
  
              col = split.column()
              col.prop(rd, "cineon_log", text="Convert to Log")
  
-             if wide_ui:
-                 col = split.column(align=True)
+             col = split.column(align=True)
              col.active = rd.cineon_log
              col.prop(rd, "cineon_black", text="Black")
              col.prop(rd, "cineon_white", text="White")
                  col = split.column()
                  if rd.quicktime_audiocodec_type == 'LPCM':
                      col.prop(rd, "quicktime_audio_bitdepth", text="")
-                 if wide_ui:
-                     col = split.column()
+                 col = split.column()
                  col.prop(rd, "quicktime_audio_samplerate", text="")
  
                  split = layout.split()
                  col = split.column()
                  if rd.quicktime_audiocodec_type == 'AAC':
                      col.prop(rd, "quicktime_audio_bitrate")
-                 if wide_ui:
-                     subsplit = split.split()
-                     col = subsplit.column()
+                 subsplit = split.split()
+                 col = subsplit.column()
                  if rd.quicktime_audiocodec_type == 'AAC':
                      col.prop(rd, "quicktime_audio_codec_isvbr")
-                 if wide_ui:
-                     col = subsplit.column()
+                     
+                 col = subsplit.column()
                  col.prop(rd, "quicktime_audio_resampling_hq")
  
  
- class RENDER_PT_encoding(RenderButtonsPanel):
+ class RENDER_PT_encoding(RenderButtonsPanel, bpy.types.Panel):
      bl_label = "Encoding"
      bl_default_closed = True
      COMPAT_ENGINES = {'BLENDER_RENDER'}
  
-     def poll(self, context):
+     @classmethod
+     def poll(cls, context):
          rd = context.scene.render
          return rd.file_format in ('FFMPEG', 'XVID', 'H264', 'THEORA')
  
          layout = self.layout
  
          rd = context.scene.render
-         wide_ui = context.region.width > narrowui
  
          layout.menu("RENDER_MT_ffmpeg_presets", text="Presets")
  
          col = split.column()
          col.prop(rd, "ffmpeg_format")
          if rd.ffmpeg_format in ('AVI', 'QUICKTIME', 'MKV', 'OGG'):
-             if wide_ui:
-                 col = split.column()
+             col = split.column()
              col.prop(rd, "ffmpeg_codec")
          else:
-             if wide_ui:
-                 split.label()
+             split.label()
  
          split = layout.split()
  
          col = split.column()
          col.prop(rd, "ffmpeg_video_bitrate")
-         if wide_ui:
-             col = split.column()
+         col = split.column()
          col.prop(rd, "ffmpeg_gopsize")
  
          split = layout.split()
          col.prop(rd, "ffmpeg_maxrate", text="Maximum")
          col.prop(rd, "ffmpeg_buffersize", text="Buffer")
  
-         if wide_ui:
-             col = split.column()
+         col = split.column()
  
          col.prop(rd, "ffmpeg_autosplit")
          col.label(text="Mux:")
          col.prop(rd, "ffmpeg_audio_bitrate")
          col.prop(rd, "ffmpeg_audio_mixrate")
  
-         if wide_ui:
-             col = split.column()
+         col = split.column()
          col.prop(rd, "ffmpeg_audio_volume", slider=True)
  
  
- class RENDER_PT_antialiasing(RenderButtonsPanel):
+ class RENDER_PT_antialiasing(RenderButtonsPanel, bpy.types.Panel):
      bl_label = "Anti-Aliasing"
      COMPAT_ENGINES = {'BLENDER_RENDER'}
  
          layout = self.layout
  
          rd = context.scene.render
-         wide_ui = context.region.width > narrowui
          layout.active = rd.render_antialiasing
  
          split = layout.split()
          sub.enabled = not rd.use_border
          sub.prop(rd, "full_sample")
  
-         if wide_ui:
-             col = split.column()
+         col = split.column()
          col.prop(rd, "pixel_filter", text="")
          col.prop(rd, "filter_size", text="Size")
  
  
- class RENDER_PT_motion_blur(RenderButtonsPanel):
+ class RENDER_PT_motion_blur(RenderButtonsPanel, bpy.types.Panel):
      bl_label = "Full Sample Motion Blur"
      bl_default_closed = True
      COMPAT_ENGINES = {'BLENDER_RENDER'}
          row.prop(rd, "motion_blur_samples")
          row.prop(rd, "motion_blur_shutter")
  
- class RENDER_PT_dimensions(RenderButtonsPanel):
+ class RENDER_PT_dimensions(RenderButtonsPanel, bpy.types.Panel):
      bl_label = "Dimensions"
      COMPAT_ENGINES = {'BLENDER_RENDER'}
  
  
          scene = context.scene
          rd = scene.render
-         wide_ui = context.region.width > narrowui
  
          row = layout.row(align=True)
          row.menu("RENDER_MT_presets", text=bpy.types.RENDER_MT_presets.bl_label)
          sub.active = rd.use_border
          sub.prop(rd, "crop_to_border", text="Crop")
  
-         if wide_ui:
-             col = split.column()
+         col = split.column()
          sub = col.column(align=True)
          sub.label(text="Frame Range:")
          sub.prop(scene, "frame_start", text="Start")
          sub.prop(rd, "fps_base", text="/")
  
  
- class RENDER_PT_stamp(RenderButtonsPanel):
+ class RENDER_PT_stamp(RenderButtonsPanel, bpy.types.Panel):
      bl_label = "Stamp"
      bl_default_closed = True
      COMPAT_ENGINES = {'BLENDER_RENDER'}
          layout = self.layout
  
          rd = context.scene.render
-         wide_ui = context.region.width > narrowui
  
          layout.active = rd.render_stamp
  
          col.prop(rd, "stamp_marker", text="Marker")
          col.prop(rd, "stamp_sequencer_strip", text="Seq. Strip")
  
-         if wide_ui:
-             col = split.column()
+         col = split.column()
          col.active = rd.render_stamp
          col.prop(rd, "stamp_foreground", slider=True)
          col.prop(rd, "stamp_background", slider=True)
          sub.prop(rd, "stamp_note_text", text="")
  
  
- class RENDER_PT_bake(RenderButtonsPanel):
+ class RENDER_PT_bake(RenderButtonsPanel, bpy.types.Panel):
      bl_label = "Bake"
      bl_default_closed = True
      COMPAT_ENGINES = {'BLENDER_RENDER'}
          layout = self.layout
  
          rd = context.scene.render
-         wide_ui = context.region.width > narrowui
  
          layout.operator("object.bake_image", icon='RENDER_STILL')
 -
 +        
-         if wide_ui:
-             layout.prop(rd, "bake_type")
-         else:
-             layout.prop(rd, "bake_type", text="")
+         layout.prop(rd, "bake_type")
 -
 +        
          if rd.bake_type == 'NORMALS':
-             if wide_ui:
-                 layout.prop(rd, "bake_normal_space")
-             else:
-                 layout.prop(rd, "bake_normal_space", text="")
+             layout.prop(rd, "bake_normal_space")
          elif rd.bake_type in ('DISPLACEMENT', 'AO'):
              layout.prop(rd, "bake_normalized")
 -
 +        
          # col.prop(rd, "bake_aa_mode")
          # col.prop(rd, "bake_enable_aa")
 -
 +        
          layout.separator()
 -
 +        
          split = layout.split()
  
          col = split.column()
          col.prop(rd, "bake_clear")
          col.prop(rd, "bake_margin")
          col.prop(rd, "bake_quad_split", text="Split")
 -
 +        
-         if wide_ui:
-             col = split.column()
+         col = split.column()
          col.prop(rd, "bake_active")
          sub = col.column()
          sub.active = rd.bake_active
          sub.prop(rd, "bake_distance")
          sub.prop(rd, "bake_bias")
  
 -
 +        
- classes = [
-     RENDER_MT_presets,
-     RENDER_MT_ffmpeg_presets,
-     RENDER_PT_render,
-     RENDER_PT_layers,
-     RENDER_PT_freestyle,
-     RENDER_PT_freestyle_linestyle,
-     RENDER_PT_dimensions,
-     RENDER_PT_antialiasing,
-     RENDER_PT_motion_blur,
-     RENDER_PT_shading,
-     RENDER_PT_output,
-     RENDER_PT_encoding,
-     RENDER_PT_performance,
-     RENDER_PT_post_processing,
-     RENDER_PT_stamp,
-     RENDER_PT_bake]
  def register():
-     register = bpy.types.register
-     for cls in classes:
-         register(cls)
+     pass
  
  
  def unregister():
-     unregister = bpy.types.unregister
-     for cls in classes:
-         unregister(cls)
+     pass
  
  if __name__ == "__main__":
      register()
index c083a62a98ed934a6c9baf8f1687c94bd7b015eb,049d22a44edc5a3b9f0ddc59afebc9fe54bce999..1bd83e11b71769f02f75c6954431cc23ae6346a7
@@@ -142,7 -142,8 +142,8 @@@ class USERPREF_PT_interface(bpy.types.P
      bl_region_type = 'WINDOW'
      bl_show_header = False
  
-     def poll(self, context):
+     @classmethod
+     def poll(cls, context):
          userpref = context.user_preferences
          return (userpref.active_section == 'INTERFACE')
  
          sub.prop(view, "mini_axis_brightness", text="Brightness")
  
          col.separator()
-         col.separator()
-         col.separator()
-         col.label(text="Properties Window:")
-         col.prop(view, "properties_width_check")
          row.separator()
          row.separator()
  
          col.prop(view, "auto_perspective")
          col.prop(view, "smooth_view")
          col.prop(view, "rotation_angle")
 -
 +        
 +        col.separator()
 +        col.separator()
 +        
 +        col.label(text="2D Viewports:")
 +        col.prop(view, "view2d_grid_minimum_spacing", text="Minimum Grid Spacing")
 +        col.prop(view, "timecode_style")
 +        
          col.separator()
          col.separator()
  
@@@ -249,7 -237,8 +244,8 @@@ class USERPREF_PT_edit(bpy.types.Panel)
      bl_region_type = 'WINDOW'
      bl_show_header = False
  
-     def poll(self, context):
+     @classmethod
+     def poll(cls, context):
          userpref = context.user_preferences
          return (userpref.active_section == 'EDITING')
  
@@@ -363,7 -352,8 +359,8 @@@ class USERPREF_PT_system(bpy.types.Pane
      bl_region_type = 'WINDOW'
      bl_show_header = False
  
-     def poll(self, context):
+     @classmethod
+     def poll(cls, context):
          userpref = context.user_preferences
          return (userpref.active_section == 'SYSTEM')
  
@@@ -527,7 -517,8 +524,8 @@@ class USERPREF_PT_theme(bpy.types.Panel
              for i, attr in enumerate(props_ls):
                  colsub_pair[i % 2].row().prop(themedata, attr)
  
-     def poll(self, context):
+     @classmethod
+     def poll(cls, context):
          userpref = context.user_preferences
          return (userpref.active_section == 'THEMES')
  
@@@ -659,7 -650,8 +657,8 @@@ class USERPREF_PT_file(bpy.types.Panel)
      bl_region_type = 'WINDOW'
      bl_show_header = False
  
-     def poll(self, context):
+     @classmethod
+     def poll(cls, context):
          userpref = context.user_preferences
          return (userpref.active_section == 'FILES')
  
@@@ -730,7 -722,8 +729,8 @@@ class USERPREF_PT_input(InputKeyMapPane
      bl_space_type = 'USER_PREFERENCES'
      bl_label = "Input"
  
-     def poll(self, context):
+     @classmethod
+     def poll(cls, context):
          userpref = context.user_preferences
          return (userpref.active_section == 'INPUT')
  
@@@ -821,33 -814,112 +821,112 @@@ class USERPREF_PT_addons(bpy.types.Pane
      bl_label = "Addons"
      bl_region_type = 'WINDOW'
      bl_show_header = False
+     
+     _addons_fake_modules = {}
  
-     def poll(self, context):
+     @classmethod
+     def poll(cls, context):
          userpref = context.user_preferences
          return (userpref.active_section == 'ADDONS')
  
+     @staticmethod
+     def module_get(mod_name):
+         return USERPREF_PT_addons._addons_fake_modules[mod_name]
      @staticmethod
      def _addon_list():
+         import os
          import sys
          import time
  
          modules = []
          loaded_modules = set()
          paths = bpy.utils.script_paths("addons")
+         # if folder addons_contrib/ exists, scripts in there will be loaded
+         paths += bpy.utils.script_paths("addons_contrib")
  
          if bpy.app.debug:
              t_main = time.time()
  
-         # sys.path.insert(0, None)
-         for path in paths:
-             # sys.path[0] = path
-             modules.extend(bpy.utils.modules_from_path(path, loaded_modules))
+         # fake module importing
+         def fake_module(mod_name, mod_path, speedy=True):
+             if bpy.app.debug:
+                 print("fake_module", mod_name, mod_path)
+             import ast
+             ModuleType = type(ast)
+             if speedy:
+                 lines = []
+                 line_iter = iter(open(mod_path, "r"))
+                 l = ""
+                 while not l.startswith("bl_addon_info"):
+                     l = line_iter.readline()
+                     if len(l) == 0:
+                         break
+                 while l.rstrip():
+                     lines.append(l)
+                     l = line_iter.readline()
+                 del line_iter
+                 data = "".join(lines)
+             else:
+                 data = open(mod_path, "r").read()
+             ast_data = ast.parse(data, filename=mod_path)
+             body_info = None
+             for body in ast_data.body:
+                 if body.__class__ == ast.Assign:
+                     if len(body.targets) == 1:
+                         if getattr(body.targets[0], "id", "") == "bl_addon_info":
+                             body_info = body
+                             break
+             if body_info:
+                 mod = ModuleType(mod_name)
+                 mod.bl_addon_info = ast.literal_eval(body.value)
+                 mod.__file__ = mod_path
+                 mod.__time__ = os.path.getmtime(mod_path)
+                 return mod
+             else:
+                 return None
+         modules_stale = set(USERPREF_PT_addons._addons_fake_modules.keys())
  
-         if bpy.app.debug:
-             print("Addon Script Load Time %.4f" % (time.time() - t_main))
+         for path in paths:
+             for f in sorted(os.listdir(path)):
+                 if f.endswith(".py"):
+                     mod_name = f[0:-3]
+                     mod_path = os.path.join(path, f)
+                 elif ("." not in f) and (os.path.isfile(os.path.join(path, f, "__init__.py"))):
+                     mod_name = f
+                     mod_path = os.path.join(path, f, "__init__.py")
+                 else:
+                     mod_name = ""
+                     mod_path = ""
+                 if mod_name:
+                     if mod_name in modules_stale:
+                         modules_stale.remove(mod_name)
+                     mod = USERPREF_PT_addons._addons_fake_modules.get(mod_name)
+                     if mod:
+                         if mod.__time__ != os.path.getmtime(mod_path):
+                             print("Reloading", mod_name)
+                             del USERPREF_PT_addons._addons_fake_modules[mod_name]
+                             mod = None
+                     if mod is None:
+                         mod = fake_module(mod_name, mod_path)
+                         if mod:
+                             USERPREF_PT_addons._addons_fake_modules[mod_name] = mod
+                     
+         
+         # just incase we get stale modules, not likely
+         for mod_stale in modules_stale:
+             del USERPREF_PT_addons._addons_fake_modules[mod_stale]
+         del modules_stale
  
-         # del sys.path[0]
-         return modules
+         mod_list = list(USERPREF_PT_addons._addons_fake_modules.values())
+         mod_list.sort(key=lambda mod: (mod.bl_addon_info['category'], mod.bl_addon_info['name']))
+         return mod_list
  
      def draw(self, context):
          layout = self.layout
@@@ -1001,8 -1073,13 +1080,13 @@@ class WM_OT_addon_enable(bpy.types.Oper
      def execute(self, context):
          module_name = self.properties.module
  
+         # note, this still gets added to _bpy_types.TypeMap
+         import bpy_types as _bpy_types
+         _bpy_types._register_immediate = False
          try:
              mod = __import__(module_name)
+             _bpy_types._register_module(module_name)
              mod.register()
          except:
              import traceback
  
          if info.get("blender", (0, 0, 0)) > bpy.app.version:
              self.report("WARNING','This script was written for a newer version of Blender and might not function (correctly).\nThe script is enabled though.")
+         
+         _bpy_types._register_immediate = True
+         
          return {'FINISHED'}
  
  
@@@ -1029,13 -1108,15 +1115,15 @@@ class WM_OT_addon_disable(bpy.types.Ope
      module = StringProperty(name="Module", description="Module name of the addon to disable")
  
      def execute(self, context):
-         import traceback
+         import bpy_types as _bpy_types
          module_name = self.properties.module
  
          try:
              mod = __import__(module_name)
+             _bpy_types._unregister_module(module_name, free=False) # dont free because we may want to enable again.
              mod.unregister()
          except:
+             import traceback
              traceback.print_exc()
  
          addons = context.user_preferences.addons
@@@ -1123,7 -1204,8 +1211,8 @@@ class WM_OT_addon_expand(bpy.types.Oper
  
          # unlikely to fail, module should have already been imported
          try:
-             mod = __import__(module_name)
+             # mod = __import__(module_name)
+             mod = USERPREF_PT_addons.module_get(module_name)
          except:
              import traceback
              traceback.print_exc()
          return {'FINISHED'}
  
  
- classes = [
-     USERPREF_HT_header,
-     USERPREF_PT_tabs,
-     USERPREF_PT_interface,
-     USERPREF_PT_theme,
-     USERPREF_PT_edit,
-     USERPREF_PT_system,
-     USERPREF_PT_file,
-     USERPREF_PT_input,
-     USERPREF_PT_addons,
-     USERPREF_MT_interaction_presets,
-     USERPREF_MT_splash,
-     WM_OT_addon_enable,
-     WM_OT_addon_disable,
-     WM_OT_addon_install,
-     WM_OT_addon_expand]
  def register():
-     register = bpy.types.register
-     for cls in classes:
-         register(cls)
+     pass
  
  def unregister():
-     unregister = bpy.types.unregister
-     for cls in classes:
-         unregister(cls)
+     pass
  
  if __name__ == "__main__":
      register()
index 5e1ea753ace161cb2ef21ad23de5da4eb2e61ea2,96d1ce3e8b21bfd5fac8893f0071d88e84203d12..b6a20384b755fc833cee9674c5652e8861b3895a
@@@ -34,7 -34,6 +34,6 @@@ ADD_SUBDIRECTORY(blenlib
  ADD_SUBDIRECTORY(blenloader)
  ADD_SUBDIRECTORY(blenpluginapi)
  ADD_SUBDIRECTORY(imbuf)
- ADD_SUBDIRECTORY(imbuf/intern/cineon)
  ADD_SUBDIRECTORY(gpu)
  ADD_SUBDIRECTORY(makesdna)
  ADD_SUBDIRECTORY(makesrna)
@@@ -42,15 -41,18 +41,19 @@@ ADD_SUBDIRECTORY(readblenfile
  ADD_SUBDIRECTORY(render)
  ADD_SUBDIRECTORY(blenfont)
  ADD_SUBDIRECTORY(ikplugin)
 +ADD_SUBDIRECTORY(freestyle)
  
- IF(WITH_OPENEXR)
+ IF(WITH_IMAGE_OPENEXR)
        ADD_SUBDIRECTORY(imbuf/intern/openexr)
- ENDIF(WITH_OPENEXR)
+ ENDIF(WITH_IMAGE_OPENEXR)
  
- IF(WITH_DDS)
+ IF(WITH_IMAGE_DDS)
        ADD_SUBDIRECTORY(imbuf/intern/dds)
- ENDIF(WITH_DDS)
+ ENDIF(WITH_IMAGE_DDS)
+ IF(WITH_IMAGE_CINEON)
+       ADD_SUBDIRECTORY(imbuf/intern/cineon)
+ ENDIF(WITH_IMAGE_CINEON)
  
  IF(WITH_QUICKTIME)
        ADD_SUBDIRECTORY(quicktime)
index 834e83ec0e1310cbcd11fd76f115f6e6501b0660,549725a57a07ae95c59097d5650f63a49c890d11..1489f9a37385e8045b0d559bf5152de59b42c073
@@@ -9,9 -9,7 +9,8 @@@ SConscript(['avi/SConscript'
              'blenpluginapi/SConscript',
              'gpu/SConscript',
              'editors/SConscript',
 +                      'freestyle/SConscript',
              'imbuf/SConscript',
-             'imbuf/intern/cineon/SConscript',
              'makesdna/SConscript',
              'makesrna/SConscript',
              'readblenfile/SConscript',
@@@ -30,6 -28,9 +29,9 @@@ if env['WITH_BF_PYTHON']
  if env['WITH_BF_DDS']:
      SConscript (['imbuf/intern/dds/SConscript'])
  
+ if env['WITH_BF_CINEON']:
+     SConscript (['imbuf/intern/cineon/SConscript'])
  if env['WITH_BF_OPENEXR']:
      SConscript (['imbuf/intern/openexr/SConscript'])
  
index d576556f13c2f5dda6b042519b0d80aaff956f89,60c2d51571f8dbcce82b228e60dc1a523b42439a..74d4d114eba7310a0cf7e260a61860da89640fe4
@@@ -58,7 -58,6 +58,6 @@@ typedef struct Main 
        ListBase mat;
        ListBase tex;
        ListBase image;
-       ListBase wave;
        ListBase latt;
        ListBase lamp;
        ListBase camera;
@@@ -78,7 -77,6 +77,7 @@@
        ListBase particle;
        ListBase wm;
        ListBase gpencil;
 +      ListBase linestyle;
  } Main;
  
  
index 195dfe2ea70d5f95f224990c41e00e843d0a9de3,fbd75a79fd7eea49e604647d4b2524471c9731c0..af75ef1dbf6160aa16ccd8215dfbbb46b5d2dfc0
@@@ -30,7 -30,7 +30,7 @@@ SET(IN
        . ../../../intern/guardedalloc ../../../intern/memutil ../editors/include ../blenlib ../makesdna ../modifiers
        ../render/extern/include ../../../intern/decimation/extern
        ../imbuf ../avi ../../../intern/elbeem/extern ../../../intern/opennl/extern
 -      ../../../intern/iksolver/extern ../blenloader ../ikplugin
 +      ../../../intern/iksolver/extern ../blenloader ../ikplugin ../freestyle
        ../nodes ../../../extern/glew/include ../gpu ../makesrna ../../../intern/smoke/extern
        ../../../intern/bsp/extern ../blenfont
        ../../../intern/audaspace/intern
@@@ -46,21 -46,29 +46,29 @@@ IF(WITH_BULLET
        ADD_DEFINITIONS(-DUSE_BULLET)
  ENDIF(WITH_BULLET)
  
- IF(WITH_OPENEXR)
+ IF(WITH_IMAGE_OPENEXR)
        ADD_DEFINITIONS(-DWITH_OPENEXR)
- ENDIF(WITH_OPENEXR)
+ ENDIF(WITH_IMAGE_OPENEXR)
  
- IF(WITH_TIFF)
+ IF(WITH_IMAGE_TIFF)
        ADD_DEFINITIONS(-DWITH_TIFF)
- ENDIF(WITH_TIFF)
+ ENDIF(WITH_IMAGE_TIFF)
  
- IF(WITH_OPENJPEG)
+ IF(WITH_IMAGE_OPENJPEG)
        ADD_DEFINITIONS(-DWITH_OPENJPEG)
- ENDIF(WITH_OPENJPEG)
+ ENDIF(WITH_IMAGE_OPENJPEG)
  
- IF(WITH_DDS)
+ IF(WITH_IMAGE_DDS)
        ADD_DEFINITIONS(-DWITH_DDS)
- ENDIF(WITH_DDS)
+ ENDIF(WITH_IMAGE_DDS)
+ IF(WITH_IMAGE_CINEON)
+       ADD_DEFINITIONS(-DWITH_CINEON)
+ ENDIF(WITH_IMAGE_CINEON)
+ IF(WITH_IMAGE_HDR)
+       ADD_DEFINITIONS(-DWITH_HDR)
+ ENDIF(WITH_IMAGE_HDR)
  
  IF(WITH_QUICKTIME)
        SET(INC ${INC} ../quicktime ${QUICKTIME_INC})
@@@ -87,9 -95,9 +95,9 @@@ IF(WITH_OPENMP
                ADD_DEFINITIONS(-DPARALLEL=1)
  ENDIF(WITH_OPENMP)
  
- IF(NOT WITH_ELBEEM)
+ IF(NOT WITH_FLUID)
        ADD_DEFINITIONS(-DDISABLE_ELBEEM)
- ENDIF(NOT WITH_ELBEEM)
+ ENDIF(NOT WITH_FLUID)
  
  IF(WITH_LZO)
        SET(INC ${INC} ../../../extern/lzo/minilzo)
index 00c6415018bb97ea8514c6fcb6f9d4ff690b0180,9f5027f801df181d8a627b02fc2a7f62d90c1a14..77cb9d99486a0b6a4ca18badd6c1511aabbe0862
@@@ -7,7 -7,7 +7,7 @@@ incs = '. #/intern/guardedalloc #/inter
  incs += ' ../blenlib ../blenfont ../makesdna ../windowmanager'
  incs += ' ../render/extern/include #/intern/decimation/extern ../makesrna'
  incs += ' ../imbuf ../ikplugin ../avi #/intern/elbeem/extern ../nodes ../modifiers'
 -incs += ' #/intern/iksolver/extern ../blenloader'
 +incs += ' #/intern/iksolver/extern ../blenloader ../freestyle'
  incs += ' #/extern/bullet2/src'
  incs += ' #/intern/opennl/extern #/intern/bsp/extern'
  incs += ' ../gpu #/extern/glew/include'
@@@ -47,6 -47,12 +47,12 @@@ if env['WITH_BF_OPENJPEG']
  if env['WITH_BF_DDS']:
        defs.append('WITH_DDS')
  
+ if env['WITH_BF_CINEON']:
+       defs.append('WITH_CINEON')
+ if env['WITH_BF_HDR']:
+       defs.append('WITH_HDR')
  if env['WITH_BF_FFMPEG']:
        defs.append('WITH_FFMPEG')
        incs += ' ' + env['BF_FFMPEG_INC']
index 967cd5f452089f22d3db19fb9949c7cd8269b78b,e935573cf67a54a94caecf290d335511852e37e7..a545adcaf8e297ca3f99f70c8f1b6a44987f496b
  #include "MEM_guardedalloc.h"
  
  /* all types are needed here, in order to do memory operations */
- #include "DNA_scene_types.h"
- #include "DNA_mesh_types.h"
- #include "DNA_lattice_types.h"
- #include "DNA_meta_types.h"
- #include "DNA_material_types.h"
- #include "DNA_wave_types.h"
- #include "DNA_lamp_types.h"
+ #include "DNA_anim_types.h"
+ #include "DNA_armature_types.h"
+ #include "DNA_brush_types.h"
  #include "DNA_camera_types.h"
+ #include "DNA_group_types.h"
  #include "DNA_ipo_types.h"
  #include "DNA_key_types.h"
- #include "DNA_world_types.h"
+ #include "DNA_lamp_types.h"
+ #include "DNA_lattice_types.h"
+ #include "DNA_material_types.h"
+ #include "DNA_mesh_types.h"
+ #include "DNA_meta_types.h"
+ #include "DNA_nla_types.h"
+ #include "DNA_node_types.h"
+ #include "DNA_scene_types.h"
  #include "DNA_screen_types.h"
- #include "DNA_vfont_types.h"
- #include "DNA_text_types.h"
  #include "DNA_sound_types.h"
- #include "DNA_group_types.h"
- #include "DNA_armature_types.h"
- #include "DNA_node_types.h"
- #include "DNA_nla_types.h"
+ #include "DNA_text_types.h"
+ #include "DNA_vfont_types.h"
  #include "DNA_windowmanager_types.h"
- #include "DNA_anim_types.h"
+ #include "DNA_world_types.h"
+ #include "DNA_gpencil_types.h"
  
  #include "BLI_blenlib.h"
  #include "BLI_dynstr.h"
  #include "BKE_particle.h"
  #include "BKE_gpencil.h"
  #include "BKE_fcurve.h"
 +#include "BKE_linestyle.h"
  
  #define MAX_IDPUP             60      /* was 24 */
  
@@@ -175,8 -176,6 +177,6 @@@ int id_make_local(ID *id, int test
                        return 1;
                case ID_IM:
                        return 0; /* not implemented */
-               case ID_WV:
-                       return 0; /* deprecated */
                case ID_LT:
                        if(!test) {
                                make_local_lattice((Lattice*)id);
                        return 0; /* can't be linked */
                case ID_GD:
                        return 0; /* not implemented */
 +              case ID_LS:
 +                      return 0; /* not implemented */
        }
  
        return 0;
@@@ -267,8 -264,6 +267,6 @@@ int id_copy(ID *id, ID **newid, int tes
                case ID_IM:
                        if(!test) *newid= (ID*)copy_image((Image*)id);
                        return 1;
-               case ID_WV:
-                       return 0; /* deprecated */
                case ID_LT:
                        if(!test) *newid= (ID*)copy_lattice((Lattice*)id);
                        return 1;
                        return 0; /* can't be copied from here */
                case ID_GD:
                        return 0; /* not implemented */
 +              case ID_LS:
 +                      return 0; /* not implemented */
        }
        
        return 0;
@@@ -379,8 -372,6 +377,6 @@@ ListBase *which_libbase(Main *mainlib, 
                        return &(mainlib->tex);
                case ID_IM:
                        return &(mainlib->image);
-               case ID_WV:
-                       return &(mainlib->wave);
                case ID_LT:
                        return &(mainlib->latt);
                case ID_LA:
                        return &(mainlib->wm);
                case ID_GD:
                        return &(mainlib->gpencil);
 +              case ID_LS:
 +                      return &(mainlib->linestyle);
        }
        return 0;
  }
@@@ -482,7 -471,6 +478,6 @@@ int set_listbasepointers(Main *main, Li
        lb[a++]= &(main->curve);
        lb[a++]= &(main->mball);
  
-       lb[a++]= &(main->wave);
        lb[a++]= &(main->latt);
        lb[a++]= &(main->lamp);
        lb[a++]= &(main->camera);
        lb[a++]= &(main->library);
        lb[a++]= &(main->wm);
        lb[a++]= &(main->gpencil);
 +      lb[a++]= &(main->linestyle);
        
        lb[a]= NULL;
  
@@@ -550,9 -537,6 +545,6 @@@ static ID *alloc_libblock_notest(short 
                case ID_IM:
                        id= MEM_callocN(sizeof(Image), "image");
                        break;
-               case ID_WV:
-                       id= MEM_callocN(sizeof(Wave), "wave");
-                       break;
                case ID_LT:
                        id= MEM_callocN(sizeof(Lattice), "latt");
                        break;
                case ID_GD:
                        id = MEM_callocN(sizeof(bGPdata), "Grease Pencil");
                        break;
 +              case ID_LS:
 +                      id = MEM_callocN(sizeof(FreestyleLineStyle), "Freestyle Line Style");
 +                      break;
        }
        return id;
  }
@@@ -757,9 -738,6 +749,6 @@@ void free_libblock(ListBase *lb, void *
                case ID_IM:
                        free_image((Image *)id);
                        break;
-               case ID_WV:
-                       /* free_wave(id); */
-                       break;
                case ID_LT:
                        free_lattice((Lattice *)id);
                        break;
                case ID_GD:
                        free_gpencil_data((bGPdata *)id);
                        break;
 +              case ID_LS:
 +                      FRS_free_linestyle((FreestyleLineStyle *)id);
 +                      break;
        }
  
        if (id->properties) {
index 22f19835f5ac8302b18889b292e81fd97e32ef2e,95705ea8c05bb255da5d7d6b233ca828613eb46a..37ea93401f99ef042d865bd153aa9a6f454747db
@@@ -42,6 -42,7 +42,7 @@@
  
  #include "DNA_anim_types.h"
  #include "DNA_group_types.h"
+ #include "DNA_object_types.h"
  #include "DNA_scene_types.h"
  #include "DNA_screen_types.h"
  #include "DNA_sequence_types.h"
@@@ -74,8 -75,6 +75,8 @@@
  #include "BLI_math.h"
  #include "BLI_blenlib.h"
  
 +#include "FRS_freestyle_config.h"
 +
  //XXX #include "nla.h"
  
  #ifdef WIN32
@@@ -173,9 -172,12 +174,12 @@@ Scene *copy_scene(Main *bmain, Scene *s
                BLI_duplicatelist(&(scen->transform_spaces), &(sce->transform_spaces));
                BLI_duplicatelist(&(scen->r.layers), &(sce->r.layers));
                BKE_keyingsets_copy(&(scen->keyingsets), &(sce->keyingsets));
-               
-               scen->nodetree= ntreeCopyTree(sce->nodetree, 0);
-               
+               if(sce->nodetree) {
+                       scen->nodetree= ntreeCopyTree(sce->nodetree, 0);
+                       ntreeSwitchID(scen->nodetree, &sce->id, &scen->id);
+               }
                obase= sce->base.first;
                base= scen->base.first;
                while(base) {
  void free_scene(Scene *sce)
  {
        Base *base;
 -
 +      SceneRenderLayer *srl;
 +      
        base= sce->base.first;
        while(base) {
                base->object->id.us--;
                sce->r.ffcodecdata.properties = NULL;
        }
        
 +      for(srl= sce->r.layers.first; srl; srl= srl->next) {
 +              FRS_free_freestyle_config(srl);
 +      }
 +      
        BLI_freelistN(&sce->markers);
        BLI_freelistN(&sce->transform_spaces);
        BLI_freelistN(&sce->r.layers);
@@@ -1009,7 -1006,6 +1013,7 @@@ void scene_add_render_layer(Scene *sce
        srl->lay= (1<<20) -1;
        srl->layflag= 0x7FFF;   /* solid ztra halo edge strand */
        srl->passflag= SCE_PASS_COMBINED|SCE_PASS_Z;
 +      FRS_add_freestyle_config( srl );
  }
  
  /* render simplification */
index 30eb09c0b6166bf3c4bc7af5a94a9a64e301c1b1,6101012203ada6c62fe92cb1777ea51fad0b1072..3e32d98079ef443dc533cb3ad9cc5d7288c37842
@@@ -91,7 -91,6 +91,7 @@@ static IDType idtypes[]= 
        { ID_KE,                "Key",          "keys",                 0}, 
        { ID_LA,                "Lamp",         "lamps",                IDTYPE_FLAGS_ISLINKABLE}, 
        { ID_LI,                "Library",      "libraries",    0}, 
 +      { ID_LS,                "FreestyleLineStyle", "linestyles", 0}, 
        { ID_LT,                "Lattice",      "lattices",             IDTYPE_FLAGS_ISLINKABLE}, 
        { ID_MA,                "Material", "materials",        IDTYPE_FLAGS_ISLINKABLE}, 
        { ID_MB,                "Metaball", "metaballs",        IDTYPE_FLAGS_ISLINKABLE}, 
        { ID_VF,                "VFont",        "fonts",                IDTYPE_FLAGS_ISLINKABLE}, 
        { ID_WO,                "World",        "worlds",               IDTYPE_FLAGS_ISLINKABLE}, 
        { ID_WM,                "WindowManager", "window_managers",     0}, 
-       { ID_WV,                "Wave",         "waves",                0},  /* deprecated */
  };
  static int nidtypes= sizeof(idtypes)/sizeof(idtypes[0]);
  
index 019cb2fa3d6006b9ac17e8d78cf7bc08915b749d,e36b73189e6dfd052de02d6d36630dbe7abee146..b48f9dea70d4e7f84ac6f6d276734c5b44422438
  #endif
  
  #include "DNA_anim_types.h"
- #include "DNA_action_types.h"
  #include "DNA_armature_types.h"
- #include "DNA_ID.h"
  #include "DNA_actuator_types.h"
- #include "DNA_boid_types.h"
  #include "DNA_brush_types.h"
  #include "DNA_camera_types.h"
  #include "DNA_cloth_types.h"
- #include "DNA_color_types.h"
  #include "DNA_controller_types.h"
  #include "DNA_constraint_types.h"
- #include "DNA_curve_types.h"
- #include "DNA_customdata_types.h"
  #include "DNA_effect_types.h"
  #include "DNA_fileglobal_types.h"
  #include "DNA_genfile.h"
  #include "DNA_group_types.h"
  #include "DNA_gpencil_types.h"
  #include "DNA_ipo_types.h"
- #include "DNA_image_types.h"
  #include "DNA_key_types.h"
  #include "DNA_lattice_types.h"
  #include "DNA_lamp_types.h"
 +#include "DNA_linestyle_types.h"
  #include "DNA_meta_types.h"
  #include "DNA_material_types.h"
  #include "DNA_mesh_types.h"
  #include "DNA_meshdata_types.h"
- #include "DNA_modifier_types.h"
  #include "DNA_nla_types.h"
  #include "DNA_node_types.h"
- #include "DNA_object_types.h"
- #include "DNA_object_force.h"
  #include "DNA_object_fluidsim.h" // NT
- #include "DNA_outliner_types.h"
- #include "DNA_object_force.h"
  #include "DNA_packedFile_types.h"
- #include "DNA_particle_types.h"
  #include "DNA_property_types.h"
  #include "DNA_text_types.h"
  #include "DNA_view3d_types.h"
  #include "DNA_smoke_types.h"
  #include "DNA_sound_types.h"
  #include "DNA_space_types.h"
- #include "DNA_texture_types.h"
- #include "DNA_userdef_types.h"
  #include "DNA_vfont_types.h"
  #include "DNA_world_types.h"
- #include "DNA_windowmanager_types.h"
  
  #include "MEM_guardedalloc.h"
  #include "BLI_blenlib.h"
  #include "BKE_sequencer.h"
  #include "BKE_texture.h" // for open_plugin_tex
  #include "BKE_utildefines.h" // SWITCH_INT DATA ENDB DNA1 O_BINARY GLOB USER TEST REND
- #include "BKE_ipo.h"
  #include "BKE_sound.h"
  
  //XXX #include "BIF_butspace.h" // badlevel, for do_versions, patching event codes
@@@ -4124,10 -4106,8 +4107,8 @@@ static void composite_patch(bNodeTree *
  
  static void link_paint(FileData *fd, Scene *sce, Paint *p)
  {
-       if(p && p->brushes) {
-               int i;
-               for(i = 0; i < p->brush_count; ++i)
-                       p->brushes[i]= newlibadr_us(fd, sce->id.lib, p->brushes[i]);
+       if(p && p->brush) {
+               p->brush= newlibadr_us(fd, sce->id.lib, p->brush);
        }
  }
  
@@@ -4137,7 -4117,6 +4118,7 @@@ static void lib_link_scene(FileData *fd
        Base *base, *next;
        Sequence *seq;
        SceneRenderLayer *srl;
 +      FreestyleLineSet *fls;
        TimeMarker *marker;
        
        sce= main->scene.first;
                        for(srl= sce->r.layers.first; srl; srl= srl->next) {
                                srl->mat_override= newlibadr_us(fd, sce->id.lib, srl->mat_override);
                                srl->light_override= newlibadr_us(fd, sce->id.lib, srl->light_override);
 +                              for(fls=srl->freestyleConfig.linesets.first; fls; fls= fls->next) {
 +                                      fls->linestyle= newlibadr_us(fd, sce->id.lib, fls->linestyle);
 +                              }
                        }
                        /*Game Settings: Dome Warp Text*/
                        sce->gm.dome.warptext= newlibadr(fd, sce->id.lib, sce->gm.dome.warptext);
@@@ -4247,13 -4223,8 +4228,8 @@@ static void link_recurs_seq(FileData *f
  static void direct_link_paint(FileData *fd, Paint **paint)
  {
        Paint *p;
+ /* TODO. is this needed */
        p= (*paint)= newdataadr(fd, (*paint));
-       if(p) {
-               p->paint_cursor= NULL;
-               p->brushes= newdataadr(fd, p->brushes);
-               test_pointer_array(fd, (void**)&p->brushes);
-       }
  }
  
  static void direct_link_scene(FileData *fd, Scene *sce)
        Editing *ed;
        Sequence *seq;
        MetaStack *ms;
 +      SceneRenderLayer *srl;
  
        sce->theDag = NULL;
        sce->dagisvalid = 0;
                direct_link_paint(fd, (Paint**)&sce->toolsettings->vpaint);
                direct_link_paint(fd, (Paint**)&sce->toolsettings->wpaint);
  
-               sce->toolsettings->imapaint.paint.brushes= newdataadr(fd, sce->toolsettings->imapaint.paint.brushes);
-               test_pointer_array(fd, (void**)&sce->toolsettings->imapaint.paint.brushes);
                sce->toolsettings->imapaint.paintcursor= NULL;
                sce->toolsettings->particle.paintcursor= NULL;
        }
                        seq->strip= newdataadr(fd, seq->strip);
                        if(seq->strip && seq->strip->done==0) {
                                seq->strip->done= 1;
-                               seq->strip->tstripdata = 0;
-                               seq->strip->tstripdata_startstill = 0;
-                               seq->strip->tstripdata_endstill = 0;
-                               seq->strip->ibuf_startstill = 0;
-                               seq->strip->ibuf_endstill = 0;
  
                                if(seq->type == SEQ_IMAGE ||
                                   seq->type == SEQ_MOVIE ||
        link_list(fd, &(sce->transform_spaces));
        link_list(fd, &(sce->r.layers));
  
 +      for(srl= sce->r.layers.first; srl; srl= srl->next) {
 +              link_list(fd, &(srl->freestyleConfig.modules));
 +      }
 +      for(srl= sce->r.layers.first; srl; srl= srl->next) {
 +              link_list(fd, &(srl->freestyleConfig.linesets));
 +      }
 +      
        sce->nodetree= newdataadr(fd, sce->nodetree);
        if(sce->nodetree)
                direct_link_nodetree(fd, sce->nodetree);
@@@ -5379,130 -5334,6 +5347,130 @@@ static void lib_link_group(FileData *fd
        }
  }
  
 +/* ************ READ LINE STYLE ***************** */
 +
 +static void lib_link_linestyle(FileData *fd, Main *main)
 +{
 +      FreestyleLineStyle *linestyle;
 +      LineStyleModifier *m;
 +
 +      linestyle = main->linestyle.first;
 +      while (linestyle) {
 +              for (m = linestyle->color_modifiers.first; m; m = m->next) {
 +                      if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT) {
 +                              LineStyleColorModifier_DistanceFromObject *cm = (LineStyleColorModifier_DistanceFromObject *)m;
 +                              cm->target = newlibadr(fd, linestyle->id.lib, cm->target);
 +                      }
 +              }
 +              for (m = linestyle->alpha_modifiers.first; m; m = m->next){
 +                      if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT) {
 +                              LineStyleAlphaModifier_DistanceFromObject *am = (LineStyleAlphaModifier_DistanceFromObject *)m;
 +                              am->target = newlibadr(fd, linestyle->id.lib, am->target);
 +                      }
 +              }
 +              for (m = linestyle->thickness_modifiers.first; m; m = m->next){
 +                      if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT) {
 +                              LineStyleThicknessModifier_DistanceFromObject *tm = (LineStyleThicknessModifier_DistanceFromObject *)m;
 +                              tm->target = newlibadr(fd, linestyle->id.lib, tm->target);
 +                      }
 +              }
 +              linestyle = linestyle->id.next;
 +      }
 +}
 +
 +static void direct_link_linestyle_color_modifier(FileData *fd, LineStyleModifier *modifier)
 +{
 +      switch (modifier->type) {
 +      case LS_MODIFIER_ALONG_STROKE:
 +              {
 +                      LineStyleColorModifier_AlongStroke *m = (LineStyleColorModifier_AlongStroke *)modifier;
 +                      m->color_ramp = newdataadr(fd, m->color_ramp);
 +              }
 +              break;
 +      case LS_MODIFIER_DISTANCE_FROM_CAMERA:
 +              {
 +                      LineStyleColorModifier_DistanceFromCamera *m = (LineStyleColorModifier_DistanceFromCamera *)modifier;
 +                      m->color_ramp = newdataadr(fd, m->color_ramp);
 +              }
 +              break;
 +      case LS_MODIFIER_DISTANCE_FROM_OBJECT:
 +              {
 +                      LineStyleColorModifier_DistanceFromObject *m = (LineStyleColorModifier_DistanceFromObject *)modifier;
 +                      m->color_ramp = newdataadr(fd, m->color_ramp);
 +              }
 +              break;
 +      }
 +}
 +
 +static void direct_link_linestyle_alpha_modifier(FileData *fd, LineStyleModifier *modifier)
 +{
 +      switch (modifier->type) {
 +      case LS_MODIFIER_ALONG_STROKE:
 +              {
 +                      LineStyleAlphaModifier_AlongStroke *m = (LineStyleAlphaModifier_AlongStroke *)modifier;
 +                      m->curve = newdataadr(fd, m->curve);
 +                      direct_link_curvemapping(fd, m->curve);
 +              }
 +              break;
 +      case LS_MODIFIER_DISTANCE_FROM_CAMERA:
 +              {
 +                      LineStyleAlphaModifier_DistanceFromCamera *m = (LineStyleAlphaModifier_DistanceFromCamera *)modifier;
 +                      m->curve = newdataadr(fd, m->curve);
 +                      direct_link_curvemapping(fd, m->curve);
 +              }
 +              break;
 +      case LS_MODIFIER_DISTANCE_FROM_OBJECT:
 +              {
 +                      LineStyleAlphaModifier_DistanceFromObject *m = (LineStyleAlphaModifier_DistanceFromObject *)modifier;
 +                      m->curve = newdataadr(fd, m->curve);
 +                      direct_link_curvemapping(fd, m->curve);
 +              }
 +              break;
 +      }
 +}
 +
 +static void direct_link_linestyle_thickness_modifier(FileData *fd, LineStyleModifier *modifier)
 +{
 +      switch (modifier->type) {
 +      case LS_MODIFIER_ALONG_STROKE:
 +              {
 +                      LineStyleThicknessModifier_AlongStroke *m = (LineStyleThicknessModifier_AlongStroke *)modifier;
 +                      m->curve = newdataadr(fd, m->curve);
 +                      direct_link_curvemapping(fd, m->curve);
 +              }
 +              break;
 +      case LS_MODIFIER_DISTANCE_FROM_CAMERA:
 +              {
 +                      LineStyleThicknessModifier_DistanceFromCamera *m = (LineStyleThicknessModifier_DistanceFromCamera *)modifier;
 +                      m->curve = newdataadr(fd, m->curve);
 +                      direct_link_curvemapping(fd, m->curve);
 +              }
 +              break;
 +      case LS_MODIFIER_DISTANCE_FROM_OBJECT:
 +              {
 +                      LineStyleThicknessModifier_DistanceFromObject *m = (LineStyleThicknessModifier_DistanceFromObject *)modifier;
 +                      m->curve = newdataadr(fd, m->curve);
 +                      direct_link_curvemapping(fd, m->curve);
 +              }
 +              break;
 +      }
 +}
 +
 +static void direct_link_linestyle(FileData *fd, FreestyleLineStyle *linestyle)
 +{
 +      LineStyleModifier *modifier;
 +
 +      link_list(fd, &linestyle->color_modifiers);
 +      for(modifier=linestyle->color_modifiers.first; modifier; modifier= modifier->next)
 +              direct_link_linestyle_color_modifier(fd, modifier);
 +      link_list(fd, &linestyle->alpha_modifiers);
 +      for(modifier=linestyle->alpha_modifiers.first; modifier; modifier= modifier->next)
 +              direct_link_linestyle_alpha_modifier(fd, modifier);
 +      link_list(fd, &linestyle->thickness_modifiers);
 +      for(modifier=linestyle->thickness_modifiers.first; modifier; modifier= modifier->next)
 +              direct_link_linestyle_thickness_modifier(fd, modifier);
 +}
 +
  /* ************** GENERAL & MAIN ******************** */
  
  
@@@ -5536,7 -5367,6 +5504,7 @@@ static char *dataname(short id_code
                case ID_BR: return "Data from BR";
                case ID_PA: return "Data from PA";
                case ID_GD: return "Data from GD";
 +              case ID_LS: return "Data from LS";
        }
        return "Data from Lib Block";
        
@@@ -5703,9 -5533,6 +5671,9 @@@ static BHead *read_libblock(FileData *f
                case ID_GD:
                        direct_link_gpencil(fd, (bGPdata *)id);
                        break;
 +              case ID_LS:
 +                      direct_link_linestyle(fd, (FreestyleLineStyle *)id);
 +                      break;
        }
        
        /*link direct data of ID properties*/
@@@ -9430,7 -9257,6 +9398,6 @@@ static void do_versions(FileData *fd, L
                idproperties_fix_group_lengths(main->mat);
                idproperties_fix_group_lengths(main->tex);
                idproperties_fix_group_lengths(main->image);
-               idproperties_fix_group_lengths(main->wave);
                idproperties_fix_group_lengths(main->latt);
                idproperties_fix_group_lengths(main->lamp);
                idproperties_fix_group_lengths(main->camera);
  
        /* put compatibility code here until next subversion bump */
        {
+               Brush *br;
+               for(br= main->brush.first; br; br= br->id.next) {
+                       if(br->ob_mode==0)
+                               br->ob_mode= (OB_MODE_SCULPT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT|OB_MODE_VERTEX_PAINT);
+               }
+               
        }
  
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! */
@@@ -11304,7 -11136,6 +11277,7 @@@ static void lib_link_all(FileData *fd, 
        lib_link_nodetree(fd, main);    /* has to be done after scene/materials, this will verify group nodes */
        lib_link_brush(fd, main);
        lib_link_particlesettings(fd, main);
 +      lib_link_linestyle(fd, main);
  
        lib_link_mesh(fd, main);                /* as last: tpage images with users at zero */
  
@@@ -12224,23 -12055,6 +12197,23 @@@ static void expand_sound(FileData *fd, 
        expand_doit(fd, mainvar, snd->ipo); // XXX depreceated - old animation system
  }
  
 +static void expand_linestyle(FileData *fd, Main *mainvar, FreestyleLineStyle *linestyle)
 +{
 +      LineStyleModifier *m;
 +
 +      for (m = linestyle->color_modifiers.first; m; m = m->next) {
 +              if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT)
 +                      expand_doit(fd, mainvar, ((LineStyleColorModifier_DistanceFromObject *)m)->target);
 +      }
 +      for (m = linestyle->alpha_modifiers.first; m; m = m->next){
 +              if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT)
 +                      expand_doit(fd, mainvar, ((LineStyleAlphaModifier_DistanceFromObject *)m)->target);
 +      }
 +      for (m = linestyle->thickness_modifiers.first; m; m = m->next){
 +              if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT)
 +                      expand_doit(fd, mainvar, ((LineStyleThicknessModifier_DistanceFromObject *)m)->target);
 +      }
 +}
  
  static void expand_main(FileData *fd, Main *mainvar)
  {
                                                break;
                                        case ID_PA:
                                                expand_particlesettings(fd, mainvar, (ParticleSettings *)id);
 +                                              break;
 +                                      case ID_LS:
 +                                              expand_linestyle(fd, mainvar, (FreestyleLineStyle *)id);
 +                                              break;
                                        }
  
                                        doit= 1;
index 06254161a3cec8f39f31ccd08c94f16bbab4acbc,f9f66ed8504cddec82d98b0d0d117a1379bb2430..b875c47d854a1fc6e127e0162b21c5fd26ecb06b
@@@ -88,39 -88,26 +88,27 @@@ Any case: direct data is ALWAYS after t
  
  #include "DNA_anim_types.h"
  #include "DNA_armature_types.h"
- #include "DNA_action_types.h"
  #include "DNA_actuator_types.h"
- #include "DNA_boid_types.h"
  #include "DNA_brush_types.h"
  #include "DNA_camera_types.h"
  #include "DNA_cloth_types.h"
- #include "DNA_color_types.h"
  #include "DNA_constraint_types.h"
  #include "DNA_controller_types.h"
- #include "DNA_curve_types.h"
- #include "DNA_customdata_types.h"
- #include "DNA_effect_types.h"
  #include "DNA_genfile.h"
  #include "DNA_group_types.h"
  #include "DNA_gpencil_types.h"
- #include "DNA_image_types.h"
- #include "DNA_ipo_types.h"    // XXX depreceated - animsys
  #include "DNA_fileglobal_types.h"
  #include "DNA_key_types.h"
  #include "DNA_lattice_types.h"
- #include "DNA_listBase.h" /* for Listbase, the type of samples, ...*/
  #include "DNA_lamp_types.h"
 +#include "DNA_linestyle_types.h"
  #include "DNA_meta_types.h"
  #include "DNA_mesh_types.h"
  #include "DNA_meshdata_types.h"
  #include "DNA_material_types.h"
- #include "DNA_modifier_types.h"
- #include "DNA_nla_types.h"
  #include "DNA_node_types.h"
  #include "DNA_object_types.h"
  #include "DNA_object_force.h"
- #include "DNA_outliner_types.h"
  #include "DNA_packedFile_types.h"
  #include "DNA_particle_types.h"
  #include "DNA_property_types.h"
  #include "DNA_space_types.h"
  #include "DNA_screen_types.h"
  #include "DNA_sound_types.h"
- #include "DNA_texture_types.h"
  #include "DNA_text_types.h"
  #include "DNA_view3d_types.h"
  #include "DNA_vfont_types.h"
- #include "DNA_userdef_types.h"
  #include "DNA_world_types.h"
  #include "DNA_windowmanager_types.h"
  
  
  #include "BKE_action.h"
  #include "BKE_blender.h"
- #include "BKE_cloth.h"
  #include "BKE_curve.h"
- #include "BKE_customdata.h"
  #include "BKE_constraint.h"
  #include "BKE_global.h" // for G
  #include "BKE_library.h" // for  set_listbasepointers
  #include "BKE_main.h"
  #include "BKE_node.h"
- #include "BKE_packedFile.h" // for packAll
- #include "BKE_pointcache.h"
  #include "BKE_report.h"
- #include "BKE_screen.h" // for waitcursor
  #include "BKE_sequencer.h"
- #include "BKE_sound.h" /* ... and for samples */
  #include "BKE_utildefines.h" // for defines
  #include "BKE_modifier.h"
- #include "BKE_idprop.h"
  #include "BKE_fcurve.h"
  
  #include "BLO_writefile.h"
@@@ -1771,11 -1749,6 +1750,6 @@@ static void write_lamps(WriteData *wd, 
        }
  }
  
- static void write_paint(WriteData *wd, Paint *p)
- {
-       if(p && p->brushes)
-               writedata(wd, DATA, p->brush_count * sizeof(Brush*), p->brushes);
- }
  
  static void write_scenes(WriteData *wd, ListBase *scebase)
  {
        TimeMarker *marker;
        TransformOrientation *ts;
        SceneRenderLayer *srl;
 +      FreestyleModuleConfig *fmc;
 +      FreestyleLineSet *fls;
        ToolSettings *tos;
        
        sce= scebase->first;
                writestruct(wd, DATA, "ToolSettings", 1, tos);
                if(tos->vpaint) {
                        writestruct(wd, DATA, "VPaint", 1, tos->vpaint);
-                       write_paint(wd, &tos->vpaint->paint);
                }
                if(tos->wpaint) {
                        writestruct(wd, DATA, "VPaint", 1, tos->wpaint);
-                       write_paint(wd, &tos->wpaint->paint);
                }
                if(tos->sculpt) {
                        writestruct(wd, DATA, "Sculpt", 1, tos->sculpt);
-                       write_paint(wd, &tos->sculpt->paint);
                }
  
-               write_paint(wd, &tos->imapaint.paint);
+               // write_paint(wd, &tos->imapaint.paint);
  
                ed= sce->ed;
                if(ed) {
                for(ts = sce->transform_spaces.first; ts; ts = ts->next)
                        writestruct(wd, DATA, "TransformOrientation", 1, ts);
                
 -              for(srl= sce->r.layers.first; srl; srl= srl->next)
 +              for(srl= sce->r.layers.first; srl; srl= srl->next) {
                        writestruct(wd, DATA, "SceneRenderLayer", 1, srl);
 +                      
 +                      for(fmc= srl->freestyleConfig.modules.first; fmc; fmc = fmc->next) {
 +                              writestruct(wd, DATA, "FreestyleModuleConfig", 1, fmc);
 +                      }
 +                      
 +                      for(fls= srl->freestyleConfig.linesets.first; fls; fls = fls->next) {
 +                              writestruct(wd, DATA, "FreestyleLineSet", 1, fls);
 +                              writestruct(wd, DATA, "FreestyleLineStyle", 1, fls->linestyle);
 +                      }
 +
 +              }
                
                if(sce->nodetree) {
                        writestruct(wd, DATA, "bNodeTree", 1, sce->nodetree);
@@@ -2376,128 -2333,6 +2347,128 @@@ static void write_scripts(WriteData *wd
        }
  }
  
 +static void write_linestyle_color_modifiers(WriteData *wd, ListBase *modifiers)
 +{
 +      LineStyleModifier *m;
 +      char *struct_name;
 +
 +      for (m = modifiers->first; m; m = m->next) {
 +              switch (m->type) {
 +              case LS_MODIFIER_ALONG_STROKE:
 +                      struct_name = "LineStyleColorModifier_AlongStroke";
 +                      break;
 +              case LS_MODIFIER_DISTANCE_FROM_CAMERA:
 +                      struct_name = "LineStyleColorModifier_DistanceFromCamera";
 +                      break;
 +              case LS_MODIFIER_DISTANCE_FROM_OBJECT:
 +                      struct_name = "LineStyleColorModifier_DistanceFromObject";
 +                      break;
 +              default:
 +                      struct_name = "LineStyleColorModifier"; // this should not happen
 +              }
 +              writestruct(wd, DATA, struct_name, 1, m);
 +      }
 +      for (m = modifiers->first; m; m = m->next) {
 +              switch (m->type) {
 +              case LS_MODIFIER_ALONG_STROKE:
 +                      writestruct(wd, DATA, "ColorBand", 1, ((LineStyleColorModifier_AlongStroke *)m)->color_ramp);
 +                      break;
 +              case LS_MODIFIER_DISTANCE_FROM_CAMERA:
 +                      writestruct(wd, DATA, "ColorBand", 1, ((LineStyleColorModifier_DistanceFromCamera *)m)->color_ramp);
 +                      break;
 +              case LS_MODIFIER_DISTANCE_FROM_OBJECT:
 +                      writestruct(wd, DATA, "ColorBand", 1, ((LineStyleColorModifier_DistanceFromObject *)m)->color_ramp);
 +                      break;
 +              }
 +      }
 +}
 +
 +static void write_linestyle_alpha_modifiers(WriteData *wd, ListBase *modifiers)
 +{
 +      LineStyleModifier *m;
 +      char *struct_name;
 +
 +      for (m = modifiers->first; m; m = m->next) {
 +              switch (m->type) {
 +              case LS_MODIFIER_ALONG_STROKE:
 +                      struct_name = "LineStyleAlphaModifier_AlongStroke";
 +                      break;
 +              case LS_MODIFIER_DISTANCE_FROM_CAMERA:
 +                      struct_name = "LineStyleAlphaModifier_DistanceFromCamera";
 +                      break;
 +              case LS_MODIFIER_DISTANCE_FROM_OBJECT:
 +                      struct_name = "LineStyleAlphaModifier_DistanceFromObject";
 +                      break;
 +              default:
 +                      struct_name = "LineStyleAlphaModifier"; // this should not happen
 +              }
 +              writestruct(wd, DATA, struct_name, 1, m);
 +      }
 +      for (m = modifiers->first; m; m = m->next) {
 +              switch (m->type) {
 +              case LS_MODIFIER_ALONG_STROKE:
 +                      write_curvemapping(wd, ((LineStyleAlphaModifier_AlongStroke *)m)->curve);
 +                      break;
 +              case LS_MODIFIER_DISTANCE_FROM_CAMERA:
 +                      write_curvemapping(wd, ((LineStyleAlphaModifier_DistanceFromCamera *)m)->curve);
 +                      break;
 +              case LS_MODIFIER_DISTANCE_FROM_OBJECT:
 +                      write_curvemapping(wd, ((LineStyleAlphaModifier_DistanceFromObject *)m)->curve);
 +                      break;
 +              }
 +      }
 +}
 +
 +static void write_linestyle_thickness_modifiers(WriteData *wd, ListBase *modifiers)
 +{
 +      LineStyleModifier *m;
 +      char *struct_name;
 +
 +      for (m = modifiers->first; m; m = m->next) {
 +              switch (m->type) {
 +              case LS_MODIFIER_ALONG_STROKE:
 +                      struct_name = "LineStyleThicknessModifier_AlongStroke";
 +                      break;
 +              case LS_MODIFIER_DISTANCE_FROM_CAMERA:
 +                      struct_name = "LineStyleThicknessModifier_DistanceFromCamera";
 +                      break;
 +              case LS_MODIFIER_DISTANCE_FROM_OBJECT:
 +                      struct_name = "LineStyleThicknessModifier_DistanceFromObject";
 +                      break;
 +              default:
 +                      struct_name = "LineStyleThicknessModifier"; // this should not happen
 +              }
 +              writestruct(wd, DATA, struct_name, 1, m);
 +      }
 +      for (m = modifiers->first; m; m = m->next) {
 +              switch (m->type) {
 +              case LS_MODIFIER_ALONG_STROKE:
 +                      write_curvemapping(wd, ((LineStyleThicknessModifier_AlongStroke *)m)->curve);
 +                      break;
 +              case LS_MODIFIER_DISTANCE_FROM_CAMERA:
 +                      write_curvemapping(wd, ((LineStyleThicknessModifier_DistanceFromCamera *)m)->curve);
 +                      break;
 +              case LS_MODIFIER_DISTANCE_FROM_OBJECT:
 +                      write_curvemapping(wd, ((LineStyleThicknessModifier_DistanceFromObject *)m)->curve);
 +                      break;
 +              }
 +      }
 +}
 +
 +static void write_linestyles(WriteData *wd, ListBase *idbase)
 +{
 +      FreestyleLineStyle *linestyle;
 +
 +      for(linestyle=idbase->first; linestyle; linestyle= linestyle->id.next) {
 +              if(linestyle->id.us>0 || wd->current) {
 +                      writestruct(wd, ID_LS, "FreestyleLineStyle", 1, linestyle);
 +                      write_linestyle_color_modifiers(wd, &linestyle->color_modifiers);
 +                      write_linestyle_alpha_modifiers(wd, &linestyle->alpha_modifiers);
 +                      write_linestyle_thickness_modifiers(wd, &linestyle->thickness_modifiers);
 +              }
 +      }
 +}
 +
  /* context is usually defined by WM, two cases where no WM is available:
   * - for forward compatibility, curscreen has to be saved
   * - for undofile, curscene needs to be saved */
@@@ -2587,7 -2422,6 +2558,7 @@@ static int write_file_handle(Main *main
        write_brushes  (wd, &mainvar->brush);
        write_scripts  (wd, &mainvar->script);
        write_gpencils (wd, &mainvar->gpencil);
 +      write_linestyles(wd, &mainvar->linestyle);
        write_libraries(wd,  mainvar->next);
  
        if (write_user_block) {
index 773e9ddc2d49d5dd9867fe87ffdbe88809c01238,bebec77ce1a4125b62f11577e574aabb2d48e164..169ef4e76751dabf7168707944c6d13cd3fe7acd
  
  #include "DNA_scene_types.h"
  #include "DNA_userdef_types.h"
- #include "DNA_windowmanager_types.h"
  
  #include "BLI_string.h"
  
  #include "BKE_colortools.h"
  #include "BKE_context.h"
- #include "BKE_icons.h"
  #include "BKE_global.h"
  #include "BKE_library.h"
  #include "BKE_main.h"
  #include "BKE_texture.h"
- #include "BKE_utildefines.h"
  #include "BKE_report.h"
  
  #include "ED_screen.h"
@@@ -121,8 -118,6 +118,8 @@@ void uiTemplateDopeSheetFilter(uiLayou
                uiItemR(row, ptr, "display_armature", 0, "", 0);
        if (mainptr && mainptr->particle.first)
                uiItemR(row, ptr, "display_particle", 0, "", 0);
 +      if (mainptr && mainptr->linestyle.first)
 +              uiItemR(row, ptr, "display_linestyle", 0, "", 0);
        
        /* group-based filtering (only when groups are available */
        if (mainptr && mainptr->group.first) {
@@@ -144,8 -139,6 +141,6 @@@ typedef struct TemplateID 
  
        ListBase *idlb;
        int prv_rows, prv_cols;
-       char filterop[64];
  } TemplateID;
  
  /* Search browse menu, assign  */
@@@ -175,47 -168,17 +170,17 @@@ static void id_search_cb(const bContex
        /* ID listbase */
        for(id= lb->first; id; id= id->next) {
                if(!((flag & PROP_ID_SELF_CHECK) && id == id_from)) {
-                       int filter_yes;
-                       filter_yes= 0;
  
                        /* use filter */
-                       if (template->filterop[0] != 0) {
+                       if(RNA_property_type(template->prop)==PROP_POINTER) {
                                PointerRNA ptr;
-                               ReportList reports;
-                               FunctionRNA *func;
-                               ParameterList parms;
                                RNA_id_pointer_create(id, &ptr);
-                               BKE_reports_init(&reports, RPT_PRINT);
-                               func= RNA_struct_find_function(&ptr, template->filterop);
-                               if (func) {
-                                       RNA_parameter_list_create(&parms, &ptr, func);
-                                       RNA_parameter_set_lookup(&parms, "context", &C);
-                                       if (RNA_function_call((bContext *)C, &reports, &ptr, func, &parms) == 0) {
-                                               int* ret;
-                                               RNA_parameter_get_lookup(&parms, "ret", (void **)&ret);
-                                               if (!(*ret)) {
-                                                       RNA_parameter_list_free(&parms);
-                                                       continue;
-                                               }
-                                               else {
-                                                       filter_yes= 1;
-                                               }
-                                       }
-                                       RNA_parameter_list_free(&parms);
-                               }
+                               if(RNA_property_pointer_poll(&template->ptr, template->prop, &ptr)==0)
+                                       continue;
                        }
  
                        /* hide dot-datablocks, but only if filter does not force it visible */
-                       if(!filter_yes && U.uiflag & USER_HIDE_DOT)
+                       if(U.uiflag & USER_HIDE_DOT)
                                if ((id->name[2]=='.') && (str[0] != '.'))
                                        continue;
  
@@@ -386,7 -349,7 +351,7 @@@ static void template_id_cb(bContext *C
        }
  }
  
- static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, StructRNA *type, int flag, char *newop, char *openop, char *unlinkop, char *filterop)
+ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, StructRNA *type, int flag, char *newop, char *openop, char *unlinkop)
  {
        uiBut *but;
        uiBlock *block;
        uiBlockEndAlign(block);
  }
  
- static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop, char* filterop, int flag, int prv_rows, int prv_cols)
+ static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop, int flag, int prv_rows, int prv_cols)
  {
        TemplateID *template;
        PropertyRNA *prop;
        template->prv_rows = prv_rows;
        template->prv_cols = prv_cols;
  
-       if (filterop) 
-               BLI_strncpy(template->filterop, filterop, sizeof(template->filterop));
-       else
-               template->filterop[0] = 0;
        if(newop)
                flag |= UI_ID_ADD_NEW;
        if(openop)
         */
        if(template->idlb) {
                uiLayoutRow(layout, 1);
-               template_ID(C, layout, template, type, flag, newop, openop, unlinkop, filterop);
+               template_ID(C, layout, template, type, flag, newop, openop, unlinkop);
        }
  
        MEM_freeN(template);
  }
  
- void uiTemplateID(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop, char *filterop)
+ void uiTemplateID(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop)
  {
-       ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, filterop, UI_ID_BROWSE|UI_ID_RENAME|UI_ID_DELETE, 0, 0);
+       ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, UI_ID_BROWSE|UI_ID_RENAME|UI_ID_DELETE, 0, 0);
  }
  
- void uiTemplateIDBrowse(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop, char *filterop)
+ void uiTemplateIDBrowse(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop)
  {
-       ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, filterop, UI_ID_BROWSE|UI_ID_RENAME, 0, 0);
+       ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, UI_ID_BROWSE|UI_ID_RENAME, 0, 0);
  }
  
- void uiTemplateIDPreview(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop, char *filterop, int rows, int cols)
+ void uiTemplateIDPreview(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop, int rows, int cols)
  {
-       ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, filterop, UI_ID_BROWSE|UI_ID_RENAME|UI_ID_DELETE|UI_ID_PREVIEWS, rows, cols);
+       ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, UI_ID_BROWSE|UI_ID_RENAME|UI_ID_DELETE|UI_ID_PREVIEWS, rows, cols);
  }
  
  /************************ ID Chooser Template ***************************/
@@@ -670,12 -628,8 +630,8 @@@ void uiTemplatePathBuilder(uiLayout *la
  #include "DNA_object_force.h"
  
  #include "BKE_depsgraph.h"
- #include "BKE_DerivedMesh.h"
- #include "BKE_global.h"
  #include "BKE_modifier.h"
- #include "BKE_object.h"
  #include "BKE_particle.h"
- #include "BKE_report.h"
  
  #include "ED_util.h"
  
@@@ -1189,7 -1143,6 +1145,6 @@@ uiLayout *uiTemplateConstraint(uiLayou
  
  #include "DNA_lamp_types.h"
  #include "DNA_material_types.h"
- #include "DNA_texture_types.h"
  #include "DNA_world_types.h"
  
  #define B_MATPRV 1
@@@ -1289,7 -1242,6 +1244,6 @@@ void uiTemplatePreview(uiLayout *layout
  
  /********************** ColorRamp Template **************************/
  
- #include "BKE_texture.h"
  
  typedef struct RNAUpdateCb {
        PointerRNA ptr;
@@@ -1585,7 -1537,6 +1539,6 @@@ void uiTemplateVectorscope(uiLayout *la
  
  /********************* CurveMapping Template ************************/
  
- #include "BKE_colortools.h"
  
  static void curvemap_buttons_zoom_in(bContext *C, void *cumap_v, void *unused)
  {
@@@ -2177,7 -2128,7 +2130,7 @@@ static void list_item_row(bContext *C, 
                uiBlockSetEmboss(block, UI_EMBOSS);
                uiDefButR(block, OPTION, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, ptr, "use_textures", i, 0, 0, 0, 0,  NULL);
        }
 -      else if(RNA_struct_is_a(itemptr->type, &RNA_SceneRenderLayer)) {
 +      else if(RNA_struct_is_a(itemptr->type, &RNA_SceneRenderLayer) || itemptr->type == &RNA_FreestyleLineSet) {
                uiItemL(sub, name, icon);
                uiBlockSetEmboss(block, UI_EMBOSS);
                uiDefButR(block, OPTION, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "enabled", 0, 0, 0, 0, 0,  NULL);
index ba4052601394c3e41ae8466e7cbbbb00da038c2e,24796441fe400384f676022b54192127acdd5e0d..93e891dcc57fc25e9f88c5acf289d2a83c58f259
  #include "BKE_icons.h"
  #include "BKE_image.h"
  #include "BKE_library.h"
 +#include "BKE_linestyle.h"
  #include "BKE_main.h"
  #include "BKE_material.h"
  #include "BKE_node.h"
  #include "BKE_report.h"
  #include "BKE_scene.h"
  #include "BKE_texture.h"
- #include "BKE_utildefines.h"
  #include "BKE_world.h"
  
  #include "IMB_imbuf.h"
  
  #include "GPU_material.h"
  
 +#include "FRS_freestyle.h"
 +
  #include "RNA_access.h"
 +#include "RNA_enum_types.h"
  
  #include "WM_api.h"
  #include "WM_types.h"
@@@ -727,495 -722,6 +726,495 @@@ void SCENE_OT_render_layer_remove(wmOpe
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
  }
  
 +static int freestyle_module_add_exec(bContext *C, wmOperator *op)
 +{
 +      Scene *scene= CTX_data_scene(C);
 +      SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay);
 +
 +      FRS_add_module(&srl->freestyleConfig);
 +
 +      WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
 +      
 +      return OPERATOR_FINISHED;
 +}
 +
 +void SCENE_OT_freestyle_module_add(wmOperatorType *ot)
 +{
 +      /* identifiers */
 +      ot->name= "Add Freestyle Module";
 +      ot->idname= "SCENE_OT_freestyle_module_add";
 +      ot->description="Add a style module into the list of modules.";
 +      
 +      /* api callbacks */
 +      ot->exec= freestyle_module_add_exec;
 +
 +      /* flags */
 +      ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 +}
 +
 +static int freestyle_module_remove_exec(bContext *C, wmOperator *op)
 +{
 +      Scene *scene= CTX_data_scene(C);
 +      SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay);
 +      PointerRNA ptr= CTX_data_pointer_get_type(C, "freestyle_module", &RNA_FreestyleModuleSettings);
 +      FreestyleModuleConfig *module= ptr.data;
 +
 +      FRS_delete_module(&srl->freestyleConfig, module);
 +
 +      WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
 +      
 +      return OPERATOR_FINISHED;
 +}
 +
 +void SCENE_OT_freestyle_module_remove(wmOperatorType *ot)
 +{
 +      /* identifiers */
 +      ot->name= "Remove Freestyle Module";
 +      ot->idname= "SCENE_OT_freestyle_module_remove";
 +      ot->description="Remove the style module from the stack.";
 +      
 +      /* api callbacks */
 +      ot->exec= freestyle_module_remove_exec;
 +
 +      /* flags */
 +      ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 +}
 +
 +static int freestyle_module_move_exec(bContext *C, wmOperator *op)
 +{
 +      Scene *scene= CTX_data_scene(C);
 +      SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay);
 +      PointerRNA ptr= CTX_data_pointer_get_type(C, "freestyle_module", &RNA_FreestyleModuleSettings);
 +      FreestyleModuleConfig *module= ptr.data;
 +      int dir= RNA_enum_get(op->ptr, "direction");
 +
 +      if (dir == 1) {
 +              FRS_move_module_up(&srl->freestyleConfig, module);
 +      } else {
 +              FRS_move_module_down(&srl->freestyleConfig, module);
 +      }
 +      WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
 +      
 +      return OPERATOR_FINISHED;
 +}
 +
 +void SCENE_OT_freestyle_module_move(wmOperatorType *ot)
 +{
 +      static EnumPropertyItem direction_items[] = {
 +              {1, "UP", 0, "Up", ""},
 +              {-1, "DOWN", 0, "Down", ""},
 +              {0, NULL, 0, NULL, NULL}
 +      };
 +
 +      /* identifiers */
 +      ot->name= "Move Freestyle Module";
 +      ot->idname= "SCENE_OT_freestyle_module_move";
 +      ot->description="Change the position of the style module within in the list of style modules.";
 +      
 +      /* api callbacks */
 +      ot->exec= freestyle_module_move_exec;
 +
 +      /* flags */
 +      ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 +
 +      /* props */
 +      RNA_def_enum(ot->srna, "direction", direction_items, 0, "Direction", "Direction to move, UP or DOWN");
 +}
 +
 +static int freestyle_lineset_add_exec(bContext *C, wmOperator *op)
 +{
 +      Scene *scene= CTX_data_scene(C);
 +      SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay);
 +
 +      FRS_add_lineset(&srl->freestyleConfig);
 +
 +      WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
 +      
 +      return OPERATOR_FINISHED;
 +}
 +
 +void SCENE_OT_freestyle_lineset_add(wmOperatorType *ot)
 +{
 +      /* identifiers */
 +      ot->name= "Add Line Set";
 +      ot->idname= "SCENE_OT_freestyle_lineset_add";
 +      ot->description="Add a line set into the list of line sets.";
 +      
 +      /* api callbacks */
 +      ot->exec= freestyle_lineset_add_exec;
 +
 +      /* flags */
 +      ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 +}
 +
 +static int freestyle_active_lineset_poll(bContext *C)
 +{
 +      Scene *scene= CTX_data_scene(C);
 +      SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay);
 +
 +      return FRS_get_active_lineset(&srl->freestyleConfig) != NULL;
 +}
 +
 +static int freestyle_lineset_remove_exec(bContext *C, wmOperator *op)
 +{
 +      Scene *scene= CTX_data_scene(C);
 +      SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay);
 +
 +      FRS_delete_active_lineset(&srl->freestyleConfig);
 +
 +      WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
 +      
 +      return OPERATOR_FINISHED;
 +}
 +
 +void SCENE_OT_freestyle_lineset_remove(wmOperatorType *ot)
 +{
 +      /* identifiers */
 +      ot->name= "Remove Line Set";
 +      ot->idname= "SCENE_OT_freestyle_lineset_remove";
 +      ot->description="Remove the active line set from the list of line sets.";
 +      
 +      /* api callbacks */
 +      ot->exec= freestyle_lineset_remove_exec;
 +      ot->poll= freestyle_active_lineset_poll;
 +
 +      /* flags */
 +      ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 +}
 +
 +static int freestyle_lineset_move_exec(bContext *C, wmOperator *op)
 +{
 +      Scene *scene= CTX_data_scene(C);
 +      SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay);
 +      int dir= RNA_enum_get(op->ptr, "direction");
 +
 +      if (dir == 1) {
 +              FRS_move_active_lineset_up(&srl->freestyleConfig);
 +      } else {
 +              FRS_move_active_lineset_down(&srl->freestyleConfig);
 +      }
 +      WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
 +      
 +      return OPERATOR_FINISHED;
 +}
 +
 +void SCENE_OT_freestyle_lineset_move(wmOperatorType *ot)
 +{
 +      static EnumPropertyItem direction_items[] = {
 +              {1, "UP", 0, "Up", ""},
 +              {-1, "DOWN", 0, "Down", ""},
 +              {0, NULL, 0, NULL, NULL}
 +      };
 +
 +      /* identifiers */
 +      ot->name= "Move Line Set";
 +      ot->idname= "SCENE_OT_freestyle_lineset_move";
 +      ot->description="Change the position of the active line set within the list of line sets.";
 +      
 +      /* api callbacks */
 +      ot->exec= freestyle_lineset_move_exec;
 +      ot->poll= freestyle_active_lineset_poll;
 +
 +      /* flags */
 +      ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 +
 +      /* props */
 +      RNA_def_enum(ot->srna, "direction", direction_items, 0, "Direction", "Direction to move, UP or DOWN");
 +}
 +
 +static int freestyle_linestyle_new_exec(bContext *C, wmOperator *op)
 +{
 +      Scene *scene= CTX_data_scene(C);
 +      SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay);
 +      FreestyleLineSet *lineset = FRS_get_active_lineset(&srl->freestyleConfig);
 +
 +      if (!lineset) {
 +              BKE_report(op->reports, RPT_ERROR, "No active lineset to add a new line style to.");
 +              return OPERATOR_CANCELLED;
 +      }
 +      lineset->linestyle->id.us--;
 +      lineset->linestyle = FRS_new_linestyle("LineStyle", NULL);
 +
 +      WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
 +      
 +      return OPERATOR_FINISHED;
 +}
 +
 +void SCENE_OT_freestyle_linestyle_new(wmOperatorType *ot)
 +{
 +      /* identifiers */
 +      ot->name= "New Line Style";
 +      ot->idname= "SCENE_OT_freestyle_linestyle_new";
 +      ot->description="Create a new line style, reusable by multiple line sets.";
 +      
 +      /* api callbacks */
 +      ot->exec= freestyle_linestyle_new_exec;
 +      ot->poll= freestyle_active_lineset_poll;
 +
 +      /* flags */
 +      ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 +}
 +
 +static int freestyle_color_modifier_add_exec(bContext *C, wmOperator *op)
 +{
 +      Scene *scene= CTX_data_scene(C);
 +      SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay);
 +      FreestyleLineSet *lineset = FRS_get_active_lineset(&srl->freestyleConfig);
 +      int type= RNA_enum_get(op->ptr, "type");
 +
 +      if (!lineset) {
 +              BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style to add the modifier to.");
 +              return OPERATOR_CANCELLED;
 +      }
 +      if (FRS_add_linestyle_color_modifier(lineset->linestyle, type) < 0) {
 +              BKE_report(op->reports, RPT_ERROR, "Unknown line color modifier type.");
 +              return OPERATOR_CANCELLED;
 +      }
 +      WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
 +      
 +      return OPERATOR_FINISHED;
 +}
 +
 +void SCENE_OT_freestyle_color_modifier_add(wmOperatorType *ot)
 +{
 +      /* identifiers */
 +      ot->name= "Add Line Color Modifier";
 +      ot->idname= "SCENE_OT_freestyle_color_modifier_add";
 +      ot->description = "Add a line color modifier to the line style associated with the active lineset.";
 +      
 +      /* api callbacks */
 +      ot->invoke= WM_menu_invoke;
 +      ot->exec= freestyle_color_modifier_add_exec;
 +      ot->poll= freestyle_active_lineset_poll;
 +      
 +      /* flags */
 +      ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 +      
 +      /* properties */
 +      ot->prop= RNA_def_enum(ot->srna, "type", linestyle_color_modifier_type_items, 0, "Type", "");
 +}
 +
 +static int freestyle_alpha_modifier_add_exec(bContext *C, wmOperator *op)
 +{
 +      Scene *scene= CTX_data_scene(C);
 +      SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay);
 +      FreestyleLineSet *lineset = FRS_get_active_lineset(&srl->freestyleConfig);
 +      int type= RNA_enum_get(op->ptr, "type");
 +
 +      if (!lineset) {
 +              BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style to add the modifier to.");
 +              return OPERATOR_CANCELLED;
 +      }
 +      if (FRS_add_linestyle_alpha_modifier(lineset->linestyle, type) < 0) {
 +              BKE_report(op->reports, RPT_ERROR, "Unknown alpha transparency modifier type.");
 +              return OPERATOR_CANCELLED;
 +      }
 +      WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
 +      
 +      return OPERATOR_FINISHED;
 +}
 +
 +void SCENE_OT_freestyle_alpha_modifier_add(wmOperatorType *ot)
 +{
 +      /* identifiers */
 +      ot->name= "Add Alpha Transparency Modifier";
 +      ot->idname= "SCENE_OT_freestyle_alpha_modifier_add";
 +      ot->description = "Add an alpha transparency modifier to the line style associated with the active lineset.";
 +      
 +      /* api callbacks */
 +      ot->invoke= WM_menu_invoke;
 +      ot->exec= freestyle_alpha_modifier_add_exec;
 +      ot->poll= freestyle_active_lineset_poll;
 +      
 +      /* flags */
 +      ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 +      
 +      /* properties */
 +      ot->prop= RNA_def_enum(ot->srna, "type", linestyle_alpha_modifier_type_items, 0, "Type", "");
 +}
 +
 +static int freestyle_thickness_modifier_add_exec(bContext *C, wmOperator *op)
 +{
 +      Scene *scene= CTX_data_scene(C);
 +      SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay);
 +      FreestyleLineSet *lineset = FRS_get_active_lineset(&srl->freestyleConfig);
 +      int type= RNA_enum_get(op->ptr, "type");
 +
 +      if (!lineset) {
 +              BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style to add the modifier to.");
 +              return OPERATOR_CANCELLED;
 +      }
 +      if (FRS_add_linestyle_thickness_modifier(lineset->linestyle, type) < 0) {
 +              BKE_report(op->reports, RPT_ERROR, "Unknown line thickness modifier type.");
 +              return OPERATOR_CANCELLED;
 +      }
 +      WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
 +      
 +      return OPERATOR_FINISHED;
 +}
 +
 +void SCENE_OT_freestyle_thickness_modifier_add(wmOperatorType *ot)
 +{
 +      /* identifiers */
 +      ot->name= "Add Line Thickness Modifier";
 +      ot->idname= "SCENE_OT_freestyle_thickness_modifier_add";
 +      ot->description = "Add a line thickness modifier to the line style associated with the active lineset.";
 +      
 +      /* api callbacks */
 +      ot->invoke= WM_menu_invoke;
 +      ot->exec= freestyle_thickness_modifier_add_exec;
 +      ot->poll= freestyle_active_lineset_poll;
 +      
 +      /* flags */
 +      ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 +      
 +      /* properties */
 +      ot->prop= RNA_def_enum(ot->srna, "type", linestyle_thickness_modifier_type_items, 0, "Type", "");
 +}
 +
 +static int freestyle_modifier_toggle_fold_exec(bContext *C, wmOperator *op)
 +{
 +      Scene *scene= CTX_data_scene(C);
 +      PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_LineStyleModifier);
 +      LineStyleModifier *modifier= ptr.data;
 +
 +      if (modifier->flags & LS_MODIFIER_EXPANDED)
 +              modifier->flags &= ~LS_MODIFIER_EXPANDED;
 +      else
 +              modifier->flags |= LS_MODIFIER_EXPANDED;
 +
 +      WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
 +      
 +      return OPERATOR_FINISHED;
 +}
 +
 +void SCENE_OT_freestyle_modifier_toggle_fold(wmOperatorType *ot)
 +{
 +      /* identifiers */
 +      ot->name= "Toggle Modifier Fold";
 +      ot->idname= "SCENE_OT_freestyle_modifier_toggle_fold";
 +      ot->description="Fold/expand the modifier tab.";
 +      
 +      /* api callbacks */
 +      ot->exec= freestyle_modifier_toggle_fold_exec;
 +
 +      /* flags */
 +      ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 +}
 +
 +static int freestyle_get_modifier_type(PointerRNA *ptr)
 +{
 +      if (RNA_struct_is_a(ptr->type, &RNA_LineStyleColorModifier))
 +              return LS_MODIFIER_TYPE_COLOR;
 +      else if (RNA_struct_is_a(ptr->type, &RNA_LineStyleAlphaModifier))
 +              return LS_MODIFIER_TYPE_ALPHA;
 +      else if (RNA_struct_is_a(ptr->type, &RNA_LineStyleThicknessModifier))
 +              return LS_MODIFIER_TYPE_THICKNESS;
 +      return -1;
 +}
 +
 +static int freestyle_modifier_remove_exec(bContext *C, wmOperator *op)
 +{
 +      Scene *scene= CTX_data_scene(C);
 +      SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay);
 +      FreestyleLineSet *lineset = FRS_get_active_lineset(&srl->freestyleConfig);
 +      PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_LineStyleModifier);
 +      LineStyleModifier *modifier= ptr.data;
 +
 +      if (!lineset) {
 +              BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style the modifier belongs to.");
 +              return OPERATOR_CANCELLED;
 +      }
 +      switch (freestyle_get_modifier_type(&ptr)) {
 +      case LS_MODIFIER_TYPE_COLOR:
 +              FRS_remove_linestyle_color_modifier(lineset->linestyle, modifier);
 +              break;
 +      case LS_MODIFIER_TYPE_ALPHA:
 +              FRS_remove_linestyle_alpha_modifier(lineset->linestyle, modifier);
 +              break;
 +      case LS_MODIFIER_TYPE_THICKNESS:
 +              FRS_remove_linestyle_thickness_modifier(lineset->linestyle, modifier);
 +              break;
 +      default:
 +              BKE_report(op->reports, RPT_ERROR, "The object the data pointer refers to is not a valid modifier.");
 +              return OPERATOR_CANCELLED;
 +      }
 +      WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
 +      
 +      return OPERATOR_FINISHED;
 +}
 +
 +void SCENE_OT_freestyle_modifier_remove(wmOperatorType *ot)
 +{
 +      /* identifiers */
 +      ot->name= "Remove Modifier";
 +      ot->idname= "SCENE_OT_freestyle_modifier_remove";
 +      ot->description="Remove the modifier from the list of modifiers.";
 +      
 +      /* api callbacks */
 +      ot->exec= freestyle_modifier_remove_exec;
 +      ot->poll= freestyle_active_lineset_poll;
 +
 +      /* flags */
 +      ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 +}
 +
 +static int freestyle_modifier_move_exec(bContext *C, wmOperator *op)
 +{
 +      Scene *scene= CTX_data_scene(C);
 +      SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay);
 +      FreestyleLineSet *lineset = FRS_get_active_lineset(&srl->freestyleConfig);
 +      PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_LineStyleModifier);
 +      LineStyleModifier *modifier= ptr.data;
 +      int dir= RNA_enum_get(op->ptr, "direction");
 +
 +      if (!lineset) {
 +              BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style the modifier belongs to.");
 +              return OPERATOR_CANCELLED;
 +      }
 +      switch (freestyle_get_modifier_type(&ptr)) {
 +      case LS_MODIFIER_TYPE_COLOR:
 +              FRS_move_linestyle_color_modifier(lineset->linestyle, modifier, dir);
 +              break;
 +      case LS_MODIFIER_TYPE_ALPHA:
 +              FRS_move_linestyle_alpha_modifier(lineset->linestyle, modifier, dir);
 +              break;
 +      case LS_MODIFIER_TYPE_THICKNESS:
 +              FRS_move_linestyle_thickness_modifier(lineset->linestyle, modifier, dir);
 +              break;
 +      default:
 +              BKE_report(op->reports, RPT_ERROR, "The object the data pointer refers to is not a valid modifier.");
 +              return OPERATOR_CANCELLED;
 +      }
 +      WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
 +      
 +      return OPERATOR_FINISHED;
 +}
 +
 +void SCENE_OT_freestyle_modifier_move(wmOperatorType *ot)
 +{
 +      static EnumPropertyItem direction_items[] = {
 +              {1, "UP", 0, "Up", ""},
 +              {-1, "DOWN", 0, "Down", ""},
 +              {0, NULL, 0, NULL, NULL}
 +      };
 +
 +      /* identifiers */
 +      ot->name= "Move Modifier";
 +      ot->idname= "SCENE_OT_freestyle_modifier_move";
 +      ot->description="Move the modifier within the list of modifiers.";
 +      
 +      /* api callbacks */
 +      ot->exec= freestyle_modifier_move_exec;
 +      ot->poll= freestyle_active_lineset_poll;
 +
 +      /* flags */
 +      ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 +
 +      /* props */
 +      RNA_def_enum(ot->srna, "direction", direction_items, 0, "Direction", "Direction to move, UP or DOWN");
 +}
 +
  static int texture_slot_move(bContext *C, wmOperator *op)
  {
        ID *id= CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).id.data;
index 5bdcc5d37fbc79ce24fa239f11f1e7f96c363475,fc08f3390c9781bb2620ed75ab8634e78bb98371..d942976f4df4e1cfa88fe740df825af0b761a7c9
@@@ -48,6 -48,7 +48,7 @@@
  #include "DNA_scene_types.h"
  #include "DNA_world_types.h"
  #include "DNA_sequence_types.h"
+ #include "DNA_object_types.h"
  
  #include "BLI_blenlib.h"
  
@@@ -61,7 -62,6 +62,6 @@@
  #include "IMB_imbuf_types.h"
  
  #include "BKE_animsys.h"
- #include "BKE_constraint.h"
  #include "BKE_context.h"
  #include "BKE_deform.h"
  #include "BKE_depsgraph.h"
  #include "BKE_group.h"
  #include "BKE_library.h"
  #include "BKE_main.h"
- #include "BKE_material.h"
  #include "BKE_modifier.h"
- #include "BKE_object.h"
  #include "BKE_report.h"
- #include "BKE_screen.h"
  #include "BKE_scene.h"
  #include "BKE_sequencer.h"
- #include "BKE_utildefines.h"
  
  #include "ED_armature.h"
  #include "ED_object.h"
@@@ -987,8 -983,6 +983,6 @@@ static TreeElement *outliner_add_elemen
                        else {
                                if((seq->strip) && (seq->strip->stripdata))
                                        te->name= seq->strip->stripdata->name;
-                               else if((seq->strip) && (seq->strip->tstripdata) && (seq->strip->tstripdata->ibuf))
-                                       te->name= seq->strip->tstripdata->ibuf->name;
                                else
                                        te->name= "SQ None";
                        }
@@@ -4471,6 -4465,11 +4465,6 @@@ static void outliner_draw_iconrow(bCont
        int active;
  
        for(te= lb->first; te; te= te->next) {
 -              
 -              /* exit drawing early */
 -              if((*offsx) - OL_X > xmax)
 -                      break;
 -
                tselem= TREESTORE(te);
                
                /* object hierarchy always, further constrained on level */
index beeacfdc8d00740d90793a7e5b06e06053c40bfd,a450222dd9553c9c6849122ecd44f7fa51b0ff00..460e19ad0bf0e7e64371a5e96fafc2428f6e82dc
@@@ -63,7 -63,6 +63,6 @@@
  //#include "BIF_editsima.h"
  //#include "BIF_editparticle.h"
  
- #include "BKE_action.h"
  #include "BKE_nla.h"
  //#include "BKE_bad_level_calls.h"/* popmenu and error        */
  #include "BKE_bmesh.h"
@@@ -72,8 -71,6 +71,6 @@@
  #include "BKE_global.h"
  #include "BKE_particle.h"
  #include "BKE_pointcache.h"
- #include "BKE_utildefines.h"
- #include "BKE_context.h"
  #include "BKE_unit.h"
  
  //#include "BSE_view.h"
@@@ -556,6 -553,9 +553,6 @@@ int transformEvent(TransInfo *t, wmEven
  
        if (event->type == MOUSEMOVE)
        {
 -              if (t->modifiers & MOD_CONSTRAINT_SELECT)
 -                      t->con.mode |= CON_SELECT;
 -
                t->mval[0] = event->x - t->ar->winrct.xmin;
                t->mval[1] = event->y - t->ar->winrct.ymin;
  
@@@ -1457,6 -1457,7 +1454,7 @@@ void saveTransform(bContext *C, TransIn
        }
  }
  
+ /* note: caller needs to free 't' on a 0 return */
  int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int mode)
  {
        int options = 0;
@@@ -1695,9 -1696,6 +1693,9 @@@ void transformApply(const bContext *C, 
  {
        if ((t->redraw & TREDRAW_HARD) || (t->draw_handle_apply == NULL && (t->redraw & TREDRAW_SOFT)))
        {
 +              if (t->modifiers & MOD_CONSTRAINT_SELECT)
 +                      t->con.mode |= CON_SELECT;
 +
                selectConstraint(t);
                if (t->transform) {
                        t->transform(t, t->mval);  // calls recalcData()
index f9a7dadb691d475f25f22d8f9a5c91b25a588a8c,210ab0d45a82b3bb500761a6fdfed098348c8979..508dde31010cbcccef6762b5110dc34d1350c40a
@@@ -34,7 -34,6 +34,6 @@@
  #include "DNA_screen_types.h"
  #include "DNA_view3d_types.h"
  
- #include "BKE_global.h"
  #include "BKE_utildefines.h"
  #include "BKE_armature.h"
  #include "BKE_context.h"
@@@ -511,6 -510,7 +510,6 @@@ void initTransformOrientation(bContext 
  
        switch(t->current_orientation) {
        case V3D_MANIP_GLOBAL:
 -              unit_m3(t->spacemtx);
                strcpy(t->spacename, "global");
                break;
  
index 5ce7f2b933e15bc59d0167fc0505f6822216df60,49c2df428106d9d28663054166d817ccc159cbf2..bff50638989dc5826aad6175322b0eb827549626
@@@ -164,7 -164,6 +164,6 @@@ typedef struct PreviewImage 
  #define ID_MA         MAKE_ID2('M', 'A') /* Material */
  #define ID_TE         MAKE_ID2('T', 'E') /* Texture */
  #define ID_IM         MAKE_ID2('I', 'M') /* Image */
- #define ID_WV         MAKE_ID2('W', 'V') /* Wave (unused) */
  #define ID_LT         MAKE_ID2('L', 'T') /* Lattice */
  #define ID_LA         MAKE_ID2('L', 'A') /* Lamp */
  #define ID_CA         MAKE_ID2('C', 'A') /* Camera */
  #define ID_PA         MAKE_ID2('P', 'A') /* ParticleSettings */
  #define ID_GD         MAKE_ID2('G', 'D') /* GreasePencil */
  #define ID_WM         MAKE_ID2('W', 'M') /* WindowManager */
 +#define ID_LS         MAKE_ID2('L', 'S') /* FreestyleLineStyle */
  
        /* NOTE! Fake IDs, needed for g.sipo->blocktype or outliner */
  #define ID_SEQ                MAKE_ID2('S', 'Q')
index d58bc3aa9bcc662d0c6719ac0d055264495a9d73,bc9ae0abd99d91787ad8e8e0137d5936b209ab30..73a0e366547c832ce5dde5af19ccd49ef6b7b6f2
  extern "C" {
  #endif
  
- #include "DNA_brush_types.h"
  #include "DNA_vec_types.h"
  #include "DNA_listBase.h"
  #include "DNA_ID.h"
 +#include "DNA_freestyle_types.h"
  
  struct Object;
+ struct Brush;
  struct World;
  struct Scene;
  struct Image;
@@@ -162,9 -161,6 +162,9 @@@ typedef struct SceneRenderLayer 
        
        int passflag;                   /* pass_xor has to be after passflag */
        int pass_xor;
 +      
 +      struct FreestyleConfig freestyleConfig;
 +      
  } SceneRenderLayer;
  
  /* srl->layflag */
  #define SCE_LAY_EDGE  8
  #define SCE_LAY_SKY           16
  #define SCE_LAY_STRAND        32
 -      /* flags between 32 and 0x8000 are set to 1 already, for future options */
 +#define SCE_LAY_FRS           64
 +      /* flags between 64 and 0x8000 are set to 1 already, for future options */
  
  #define SCE_LAY_ALL_Z         0x8000
  #define SCE_LAY_XOR                   0x10000
@@@ -350,7 -345,7 +350,7 @@@ typedef struct RenderData 
        short bake_normal_space, bake_quad_split;
        float bake_maxdist, bake_biasdist, bake_pad;
  
-       /* paths to backbufffer, output, ftype */
+       /* paths to backbufffer, output */
        char backbuf[160], pic[160];
  
        /* stamps flags. */
@@@ -512,9 -507,7 +512,7 @@@ typedef struct TimeMarker 
  } TimeMarker;
  
  typedef struct Paint {
-       /* Array of brushes selected for use in this paint mode */
-       Brush **brushes;
-       int active_brush_index, brush_count;
+       struct Brush *brush;
        
        /* WM Paint cursor */
        void *paint_cursor;
@@@ -876,7 -869,6 +874,7 @@@ typedef struct Scene 
  #define R_NO_OVERWRITE        0x400000 /* skip existing files */
  #define R_TOUCH                       0x800000 /* touch files before rendering */
  #define R_SIMPLIFY            0x1000000
 +#define R_EDGE_FRS            0x2000000 /* R_EDGE for Freestyle */
  
  /* seq_flag */
  #define R_SEQ_GL_PREV 1
  /* imtype */
  #define R_TARGA               0
  #define R_IRIS                1
- #define R_HAMX                2
#define R_FTYPE               3 /* ftype is nomore */
+ /* #define R_HAMX             2 */ /* hamx is nomore */
/* #define R_FTYPE            3 */ /* ftype is nomore */
  #define R_JPEG90      4
  #define R_MOVIE               5
  #define R_IRIZ                7
index 40d183538c2d56b876f68b9fb97bde1152bfbf45,4133afffeedf55baf3464f3d082955d458cbd328..31cd0b3c32633b1b329d902ce68617dbd4dd4fb4
@@@ -78,7 -78,6 +78,6 @@@ char *includefiles[] = 
        "DNA_image_types.h",
        "DNA_texture_types.h",
        "DNA_lamp_types.h",
-       "DNA_wave_types.h",
        "DNA_material_types.h",
        "DNA_vfont_types.h",
        // if you add files here, please add them at the end
        "DNA_anim_types.h",
        "DNA_boid_types.h",
        "DNA_smoke_types.h",
 +      "DNA_freestyle_types.h",
 +      "DNA_linestyle_types.h",
  
        // empty string to indicate end of includefiles
        ""
@@@ -1130,7 -1127,6 +1129,6 @@@ int main(int argc, char ** argv
  #include "DNA_image_types.h"
  #include "DNA_texture_types.h"
  #include "DNA_lamp_types.h"
- #include "DNA_wave_types.h"
  #include "DNA_material_types.h"
  #include "DNA_vfont_types.h"
  #include "DNA_meta_types.h"
  #include "DNA_anim_types.h"
  #include "DNA_boid_types.h"
  #include "DNA_smoke_types.h"
 +#include "DNA_freestyle_types.h"
 +#include "DNA_linestyle_types.h"
  /* end of list */
index a4fc839a49c78d1f9930e575d2fdc520bcab848f,cbd2d7ec5b3f4f9d2b356da064071657f9d9db30..c1ae5c3a6c1d5f7e77dfba4e3300d128c636c820
@@@ -219,10 -219,6 +219,10 @@@ extern StructRNA RNA_FModifierNoise
  extern StructRNA RNA_FModifierPython;
  extern StructRNA RNA_FModifierStepped;
  extern StructRNA RNA_FollowPathConstraint;
 +extern StructRNA RNA_FreestyleLineStyle;
 +extern StructRNA RNA_FreestyleLineSet;
 +extern StructRNA RNA_FreestyleModuleSettings;
 +extern StructRNA RNA_FreestyleSettings;
  extern StructRNA RNA_Function;
  extern StructRNA RNA_GameBooleanProperty;
  extern StructRNA RNA_GameFloatProperty;
@@@ -277,19 -273,6 +277,19 @@@ extern StructRNA RNA_LimitDistanceConst
  extern StructRNA RNA_LimitLocationConstraint;
  extern StructRNA RNA_LimitRotationConstraint;
  extern StructRNA RNA_LimitScaleConstraint;
 +extern StructRNA RNA_LineStyleAlphaModifier;
 +extern StructRNA RNA_LineStyleAlphaModifier_AlongStroke;
 +extern StructRNA RNA_LineStyleAlphaModifier_DistanceFromCamera;
 +extern StructRNA RNA_LineStyleAlphaModifier_DistanceFromObject;
 +extern StructRNA RNA_LineStyleColorModifier;
 +extern StructRNA RNA_LineStyleColorModifier_AlongStroke;
 +extern StructRNA RNA_LineStyleColorModifier_DistanceFromCamera;
 +extern StructRNA RNA_LineStyleColorModifier_DistanceFromObject;
 +extern StructRNA RNA_LineStyleModifier;
 +extern StructRNA RNA_LineStyleThicknessModifier;
 +extern StructRNA RNA_LineStyleThicknessModifier_AlongStroke;
 +extern StructRNA RNA_LineStyleThicknessModifier_DistanceFromCamera;
 +extern StructRNA RNA_LineStyleThicknessModifier_DistanceFromObject;
  extern StructRNA RNA_LockedTrackConstraint;
  extern StructRNA RNA_Macro;
  extern StructRNA RNA_MagicTexture;
@@@ -687,6 -670,7 +687,7 @@@ int RNA_property_enum_name(struct bCont
  int RNA_property_enum_bitflag_identifiers(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier);
  
  StructRNA *RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop);
+ int RNA_property_pointer_poll(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *value);
  
  int RNA_property_editable(PointerRNA *ptr, PropertyRNA *prop);
  int RNA_property_editable_index(PointerRNA *ptr, PropertyRNA *prop, int index);
index edac0a07f07ecc07e2040b5323ff6e35621eae34,7ac76c4d107e6611bc330a123b920fb9a25945b1..706d5c61ba14cb9cc4bbe6af4928366d98bbef1f
@@@ -9,7 -9,6 +9,7 @@@ objs += 
  incs = '#/intern/guardedalloc #/intern/memutil #/intern/audaspace/intern ../blenkernel ../blenlib ../makesdna intern .'
  incs += ' ../windowmanager ../editors/include ../gpu ../imbuf ../ikplugin'
  incs += ' ../render/extern/include'
 +incs += ' ../freestyle'
  
  defs = []
  
@@@ -25,6 -24,12 +25,12 @@@ if env['WITH_BF_OPENJPEG']
  if env['WITH_BF_DDS']:
        defs.append('WITH_DDS')
  
+ if env['WITH_BF_CINEON']:
+       defs.append('WITH_CINEON')
+ if env['WITH_BF_HDR']:
+       defs.append('WITH_HDR')
  if env['WITH_BF_FFMPEG']:
        defs.append('WITH_FFMPEG')
        incs += ' ' + env['BF_FFMPEG_INC']
@@@ -46,6 -51,9 +52,9 @@@ if env['WITH_BF_GAMEENGINE']
  if env['BF_UNIT_TEST']:
        defs.append('UNIT_TEST')
  
+ if not env['WITH_BF_PYTHON']:
+       defs.append('DISABLE_PYTHON')
  if env['OURPLATFORM'] == 'linux2':
        cflags='-pthread'
        incs += ' ../../../extern/binreloc/include'
index 8345f3f632da1994d569c271ab38a50fad510c4e,9dbb2fd00aa491d06df30e9609ec71901476edd8..d631662567829c94eabb33369b9dc3e5c40a985a
@@@ -54,7 -54,6 +54,7 @@@ INCLUDE_DIRECTORIES
        ../../imbuf
        ../../render/extern/include
        ../../../../extern/glew/include
 +      ../../freestyle
        . )
  
  FILE(GLOB INC_FILES ../*.h ../../makesdna/*.h)
@@@ -71,21 -70,29 +71,29 @@@ IF(WITH_GAMEENGINE
        ADD_DEFINITIONS(-DGAMEBLENDER)
  ENDIF(WITH_GAMEENGINE)
  
- IF(WITH_OPENEXR)
+ IF(WITH_IMAGE_OPENEXR)
        ADD_DEFINITIONS(-DWITH_OPENEXR)
- ENDIF(WITH_OPENEXR)
+ ENDIF(WITH_IMAGE_OPENEXR)
  
- IF(WITH_TIFF)
+ IF(WITH_IMAGE_TIFF)
        ADD_DEFINITIONS(-DWITH_TIFF)
- ENDIF(WITH_TIFF)
+ ENDIF(WITH_IMAGE_TIFF)
  
- IF(WITH_OPENJPEG)
+ IF(WITH_IMAGE_OPENJPEG)
        ADD_DEFINITIONS(-DWITH_OPENJPEG)
- ENDIF(WITH_OPENJPEG)
+ ENDIF(WITH_IMAGE_OPENJPEG)
  
- IF(WITH_DDS)
+ IF(WITH_IMAGE_DDS)
        ADD_DEFINITIONS(-DWITH_DDS)
- ENDIF(WITH_DDS)
+ ENDIF(WITH_IMAGE_DDS)
+ IF(WITH_IMAGE_CINEON)
+       ADD_DEFINITIONS(-DWITH_CINEON)
+ ENDIF(WITH_IMAGE_CINEON)
+ IF(WITH_IMAGE_HDR)
+       ADD_DEFINITIONS(-DWITH_HDR)
+ ENDIF(WITH_IMAGE_HDR)
  
  IF(WITH_QUICKTIME)
        SET(INC ${INC} ../../quicktime)
@@@ -102,9 -109,9 +110,9 @@@ IF(WITH_LCMS
        ADD_DEFINITIONS(-DWITH_LCMS)
  ENDIF(WITH_LCMS)
  
- IF(NOT WITH_ELBEEM)
+ IF(NOT WITH_FLUID)
        ADD_DEFINITIONS(-DDISABLE_ELBEEM)
- ENDIF(NOT WITH_ELBEEM)
+ ENDIF(NOT WITH_FLUID)
  
  IF(WITH_FFTW3)
        ADD_DEFINITIONS(-DFFTW3=1)
index b9764ea021fbc703f84e0499067ec82cf850fe27,af0faf5a1656beb0b41408fa8767cc61cf5ac50b..ad8104f92e092555efbb01703fb8fe02fcc0bbc8
@@@ -2088,7 -2088,7 +2088,7 @@@ static void rna_generate_property(FILE 
                        }
                        case PROP_POINTER: {
                                PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
-                               fprintf(f, "\t%s, %s, %s, ", rna_function_string(pprop->get), rna_function_string(pprop->set), rna_function_string(pprop->typef));
+                               fprintf(f, "\t%s, %s, %s, %s,", rna_function_string(pprop->get), rna_function_string(pprop->set), rna_function_string(pprop->typef), rna_function_string(pprop->poll));
                                if(pprop->type) fprintf(f, "&RNA_%s\n", (char*)pprop->type);
                                else fprintf(f, "NULL\n");
                                break;
@@@ -2264,7 -2264,6 +2264,7 @@@ RNAProcessItem PROCESS_ITEMS[]= 
        {"rna_key.c", NULL, RNA_def_key},
        {"rna_lamp.c", NULL, RNA_def_lamp},
        {"rna_lattice.c", NULL, RNA_def_lattice},
 +      {"rna_linestyle.c", NULL, RNA_def_linestyle},
        {"rna_main.c", "rna_main_api.c", RNA_def_main},
        {"rna_material.c", "rna_material_api.c", RNA_def_material},
        {"rna_mesh.c", "rna_mesh_api.c", RNA_def_mesh},
index f92918fbbb3b0b4f203572757a3c8ea026d4f5b9,1a7036c7a362b62c06ed59854767c273f0c82b85..917025a7a891c12bcc2bf7ecb1bfde376a0da5af
@@@ -142,7 -142,6 +142,7 @@@ void RNA_def_image(struct BlenderRNA *b
  void RNA_def_key(struct BlenderRNA *brna);
  void RNA_def_lamp(struct BlenderRNA *brna);
  void RNA_def_lattice(struct BlenderRNA *brna);
 +void RNA_def_linestyle(struct BlenderRNA *brna);
  void RNA_def_main(struct BlenderRNA *brna);
  void RNA_def_material(struct BlenderRNA *brna);
  void RNA_def_mesh(struct BlenderRNA *brna);
@@@ -207,11 -206,18 +207,18 @@@ PointerRNA rna_object_shapekey_index_ge
  int rna_object_shapekey_index_set(struct ID *id, PointerRNA value, int current);
  
  /* named internal so as not to conflict with obj.update() rna func */
- void rna_Object_internal_update(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr);
  void rna_Object_internal_update_data(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr);
  void rna_Mesh_update_draw(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr);
  void rna_TextureSlot_update(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr);
  
+ /* basic poll functions for object types */
+ int rna_Armature_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
+ int rna_Camera_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
+ int rna_Curve_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
+ int rna_Lattice_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
+ int rna_Mesh_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
  char *rna_TextureSlot_path(struct PointerRNA *ptr);
  
  /* API functions */
@@@ -268,7 -274,6 +275,7 @@@ void RNA_def_main_armatures(BlenderRNA 
  void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop);
  void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop);
  void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop);
 +void RNA_def_main_linestyles(BlenderRNA *brna, PropertyRNA *cprop);
  
  /* ID Properties */
  
index c2f3953e627cd7b007a3268289bde1e1b604e396,a6260791012764acb479022b0c58963c3277b8de..0fc569acf832681af5291f932eadaa5b0dd206c7
@@@ -239,12 -239,6 +239,12 @@@ static void rna_Main_wm_begin(Collectio
        rna_iterator_listbase_begin(iter, &bmain->wm, NULL);
  }
  
 +static void rna_Main_linestyle_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 +{
 +      Main *bmain= (Main*)ptr->data;
 +      rna_iterator_listbase_begin(iter, &bmain->linestyle, NULL);
 +}
 +
  #ifdef UNIT_TEST
  
  static PointerRNA rna_Test_test_get(PointerRNA *ptr)
@@@ -306,7 -300,6 +306,7 @@@ void RNA_def_main(BlenderRNA *brna
                {"actions", "Action", "rna_Main_action_begin", "Actions", "Action datablocks.", RNA_def_main_actions},
                {"particles", "ParticleSettings", "rna_Main_particle_begin", "Particles", "Particle datablocks.", RNA_def_main_particles},
                {"gpencil", "GreasePencil", "rna_Main_gpencil_begin", "Grease Pencil", "Grease Pencil datablocks.", RNA_def_main_gpencil},
 +              {"linestyles", "FreestyleLineStyle", "rna_Main_linestyle_begin", "Line Styles", "Line Style datablocks.", RNA_def_main_linestyles},
                {NULL, NULL, NULL, NULL, NULL, NULL}};
  
        int i;
  
        prop= RNA_def_property(srna, "test", PROP_POINTER, PROP_NONE);
        RNA_def_property_struct_type(prop, "Test");
-       RNA_def_property_pointer_funcs(prop, "rna_Test_test_get", NULL, NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_Test_test_get", NULL, NULL, NULL);
  
        RNA_define_verify_sdna(1);
  
index eea426ceb0c26c5dbce2fef8427bd0c7394429a1,ca388951e68de9c8e31263134f4704be2792c623..aaedc75eb23c4e3ee2e1f88ea91eb8c45574cd9f
@@@ -34,7 -34,6 +34,7 @@@
  #include "DNA_particle_types.h"
  #include "DNA_scene_types.h"
  #include "DNA_userdef_types.h"
 +#include "DNA_linestyle_types.h"
  
  /* Include for Bake Options */
  #include "RE_pipeline.h"
@@@ -106,13 -105,17 +106,17 @@@ EnumPropertyItem image_type_items[] = 
        {R_TARGA, "TARGA", ICON_FILE_IMAGE, "Targa", ""},
        {R_RAWTGA, "TARGA_RAW", ICON_FILE_IMAGE, "Targa Raw", ""},
        {0, "", 0, " ", NULL},
+ #ifdef WITH_CINEON
        {R_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", ""},
        {R_DPX, "DPX",ICON_FILE_IMAGE, "DPX", ""},
+ #endif
  #ifdef WITH_OPENEXR
        {R_MULTILAYER, "MULTILAYER", ICON_FILE_IMAGE, "MultiLayer", ""},
        {R_OPENEXR, "OPEN_EXR", ICON_FILE_IMAGE, "OpenEXR", ""},
  #endif
+ #ifdef WITH_HDR
        {R_RADHDR, "HDR", ICON_FILE_IMAGE, "Radiance HDR", ""},
+ #endif
  #ifdef WITH_TIFF
        {R_TIFF, "TIFF", ICON_FILE_IMAGE, "TIFF", ""},
  #endif
  
  #include "RE_pipeline.h"
  
 +#include "FRS_freestyle.h"
 +
  static PointerRNA rna_Scene_objects_get(CollectionPropertyIterator *iter)
  {
        ListBaseIterator *internal= iter->internal;
@@@ -916,49 -917,6 +920,49 @@@ static void rna_TimeLine_remove(Scene *
        MEM_freeN(marker);
  }
  
 +static PointerRNA rna_FreestyleLineSet_linestyle_get(PointerRNA *ptr)
 +{
 +      FreestyleLineSet *lineset= (FreestyleLineSet *)ptr->data;
 +
 +      return rna_pointer_inherit_refine(ptr, &RNA_FreestyleLineStyle, lineset->linestyle);
 +}
 +
 +static void rna_FreestyleLineSet_linestyle_set(PointerRNA *ptr, PointerRNA value)
 +{
 +      FreestyleLineSet *lineset= (FreestyleLineSet*)ptr->data;
 +
 +      lineset->linestyle->id.us--;
 +      lineset->linestyle = (FreestyleLineStyle *)value.data;
 +      lineset->linestyle->id.us++;
 +}
 +
 +static PointerRNA rna_FreestyleSettings_active_lineset_get(PointerRNA *ptr)
 +{
 +      FreestyleConfig *config= (FreestyleConfig *)ptr->data;
 +      FreestyleLineSet *lineset= FRS_get_active_lineset(config);
 +      return rna_pointer_inherit_refine(ptr, &RNA_FreestyleLineSet, lineset);
 +}
 +
 +static void rna_FreestyleSettings_active_lineset_index_range(PointerRNA *ptr, int *min, int *max)
 +{
 +      FreestyleConfig *config= (FreestyleConfig *)ptr->data;
 +      *min= 0;
 +      *max= BLI_countlist(&config->linesets)-1;
 +      *max= MAX2(0, *max);
 +}
 +
 +static int rna_FreestyleSettings_active_lineset_index_get(PointerRNA *ptr)
 +{
 +      FreestyleConfig *config= (FreestyleConfig *)ptr->data;
 +      return FRS_get_active_lineset_index(config);
 +}
 +
 +static void rna_FreestyleSettings_active_lineset_index_set(PointerRNA *ptr, int value)
 +{
 +      FreestyleConfig *config= (FreestyleConfig *)ptr->data;
 +      FRS_set_active_lineset_index(config, value);
 +}
 +
  #else
  
  static void rna_def_transform_orientation(BlenderRNA *brna)
@@@ -1195,7 -1153,7 +1199,7 @@@ static void rna_def_tool_settings(Blend
        RNA_def_property_pointer_sdna(prop, NULL, "skgen_template");
        RNA_def_property_flag(prop, PROP_EDITABLE);
        RNA_def_property_struct_type(prop, "Object");
-       RNA_def_property_pointer_funcs(prop, NULL, "rna_Scene_skgen_etch_template_set", NULL);
+       RNA_def_property_pointer_funcs(prop, NULL, "rna_Scene_skgen_etch_template_set", NULL, NULL);
        RNA_def_property_ui_text(prop, "Template", "Template armature that will be retargeted to the stroke");
  
        prop= RNA_def_property(srna, "etch_subdivision_number", PROP_INT, PROP_NONE);
@@@ -1390,12 -1348,6 +1394,12 @@@ void rna_def_render_layer_common(Struct
        if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
  
 +      prop= RNA_def_property(srna, "freestyle", PROP_BOOLEAN, PROP_NONE);
 +      RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_FRS);
 +      RNA_def_property_ui_text(prop, "Freestyle", "Render stylized strokes in this Layer.");
 +      if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 +      else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 +
        /* passes */
        prop= RNA_def_property(srna, "pass_combined", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_COMBINED);
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
  }
  
-       RNA_def_property_pointer_funcs(prop, "rna_FreestyleLineSet_linestyle_get", "rna_FreestyleLineSet_linestyle_set", NULL);
 +static void rna_def_freestyle_settings(BlenderRNA *brna)
 +{
 +      StructRNA *srna;
 +      PropertyRNA *prop;
 +
 +      static EnumPropertyItem negation_items[] = {
 +              {0, "INCLUSIVE", 0, "Inclusive", "Select feature edges satisfying the given edge type conditions."},
 +              {FREESTYLE_LINESET_FE_NOT, "EXCLUSIVE", 0, "Exclusive", "Select feature edges not satisfying the given edge type conditions."},
 +              {0, NULL, 0, NULL, NULL}};
 +
 +      static EnumPropertyItem combination_items[] = {
 +              {0, "OR", 0, "Logical OR", "Combine feature edge type conditions by logical OR (logical disjunction)."},
 +              {FREESTYLE_LINESET_FE_AND, "AND", 0, "Logical AND", "Combine feature edge type conditions by logical AND (logical conjunction)."},
 +              {0, NULL, 0, NULL, NULL}};
 +
 +      static EnumPropertyItem freestyle_ui_mode_items[] = {
 +              {FREESTYLE_CONTROL_SCRIPT_MODE, "SCRIPT", 0, "Python Scripting Mode", "Advanced mode for using style modules in Python"},
 +              {FREESTYLE_CONTROL_EDITOR_MODE, "EDITOR", 0, "Parameter Editor Mode", "Basic mode for interactive style parameter editing"},
 +              {0, NULL, 0, NULL, NULL}};
 +
 +      static EnumPropertyItem visibility_items[] ={
 +              {FREESTYLE_QI_VISIBLE, "VISIBLE", 0, "Visible", "Select visible feature edges."},
 +              {FREESTYLE_QI_HIDDEN, "HIDDEN", 0, "Hidden", "Select hidden feature edges."},
 +              {FREESTYLE_QI_RANGE, "RANGE", 0, "QI Range", "Select feature edges within a range of quantitative invisibility (QI) values."},
 +              {0, NULL, 0, NULL, NULL}};
 +
 +      /* FreestyleLineSet */
 +
 +      srna= RNA_def_struct(brna, "FreestyleLineSet", NULL);
 +      RNA_def_struct_ui_text(srna, "Freestyle Line Set", "Line set for associating lines and style parameters.");
 +
 +      /* access to line style settings is redirected through functions */
 +      /* to allow proper id-buttons functionality */
 +      prop= RNA_def_property(srna, "linestyle", PROP_POINTER, PROP_NONE);
 +      RNA_def_property_struct_type(prop, "FreestyleLineStyle");
 +      RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_NULL);
-       RNA_def_property_pointer_funcs(prop, "rna_FreestyleSettings_active_lineset_get", NULL, NULL);
++      RNA_def_property_pointer_funcs(prop, "rna_FreestyleLineSet_linestyle_get", "rna_FreestyleLineSet_linestyle_set", NULL, NULL);
 +      RNA_def_property_ui_text(prop, "Line Style", "Line style settings");
 +      RNA_def_property_update(prop, NC_SCENE, NULL);
 +
 +      prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 +      RNA_def_property_string_sdna(prop, NULL, "name");
 +      RNA_def_property_ui_text(prop, "Line Set Name", "Line set name");
 +      RNA_def_property_update(prop, NC_SCENE, NULL);
 +      RNA_def_struct_name_property(srna, prop);
 +
 +      prop= RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
 +      RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_LINESET_ENABLED);
 +      RNA_def_property_ui_text(prop, "Enabled", "Enable or disable the line set.");
 +      RNA_def_property_update(prop, NC_SCENE, NULL);
 +
 +      prop= RNA_def_property(srna, "select_by_visibility", PROP_BOOLEAN, PROP_NONE);
 +      RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_VISIBILITY);
 +      RNA_def_property_ui_text(prop, "Selection by Visibility", "Select feature edges based on visibility.");
 +      RNA_def_property_update(prop, NC_SCENE, NULL);
 +
 +      prop= RNA_def_property(srna, "select_by_edge_types", PROP_BOOLEAN, PROP_NONE);
 +      RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_EDGE_TYPES);
 +      RNA_def_property_ui_text(prop, "Selection by Edge Types", "Select feature edges based on edge types.");
 +      RNA_def_property_update(prop, NC_SCENE, NULL);
 +
 +      prop= RNA_def_property(srna, "edge_type_negation", PROP_ENUM, PROP_NONE);
 +      RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
 +      RNA_def_property_enum_items(prop, negation_items);
 +      RNA_def_property_ui_text(prop, "Edge Type Negation", "Set the negation operation for conditions on feature edge types.");
 +      RNA_def_property_update(prop, NC_SCENE, NULL);
 +
 +      prop= RNA_def_property(srna, "edge_type_combination", PROP_ENUM, PROP_NONE);
 +      RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
 +      RNA_def_property_enum_items(prop, combination_items);
 +      RNA_def_property_ui_text(prop, "Edge Type Combination", "Set the combination operation for conditions on feature edge types.");
 +      RNA_def_property_update(prop, NC_SCENE, NULL);
 +
 +      prop= RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
 +      RNA_def_property_collection_sdna(prop, NULL, "objects", NULL);
 +      RNA_def_property_struct_type(prop, "Object");
 +      RNA_def_property_ui_text(prop, "Target Objects", "A list of objects on which stylized lines are drawn.");
 +
 +      prop= RNA_def_property(srna, "select_silhouette", PROP_BOOLEAN, PROP_NONE);
 +      RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_SILHOUETTE);
 +      RNA_def_property_ui_text(prop, "Silhouette", "Select silhouette edges.");
 +      RNA_def_property_update(prop, NC_SCENE, NULL);
 +
 +      prop= RNA_def_property(srna, "select_border", PROP_BOOLEAN, PROP_NONE);
 +      RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_BORDER);
 +      RNA_def_property_ui_text(prop, "Border", "Select border edges.");
 +      RNA_def_property_update(prop, NC_SCENE, NULL);
 +
 +      prop= RNA_def_property(srna, "select_crease", PROP_BOOLEAN, PROP_NONE);
 +      RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_CREASE);
 +      RNA_def_property_ui_text(prop, "Crease", "Select crease edges.");
 +      RNA_def_property_update(prop, NC_SCENE, NULL);
 +
 +      prop= RNA_def_property(srna, "select_ridge", PROP_BOOLEAN, PROP_NONE);
 +      RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_RIDGE);
 +      RNA_def_property_ui_text(prop, "Ridge", "Select ridges.");
 +      RNA_def_property_update(prop, NC_SCENE, NULL);
 +
 +      prop= RNA_def_property(srna, "select_valley", PROP_BOOLEAN, PROP_NONE);
 +      RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_VALLEY);
 +      RNA_def_property_ui_text(prop, "Valley", "Select valleys.");
 +      RNA_def_property_update(prop, NC_SCENE, NULL);
 +
 +      prop= RNA_def_property(srna, "select_suggestive_contour", PROP_BOOLEAN, PROP_NONE);
 +      RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_SUGGESTIVE_CONTOUR);
 +      RNA_def_property_ui_text(prop, "Suggestive Contour", "Select suggestive contours.");
 +      RNA_def_property_update(prop, NC_SCENE, NULL);
 +
 +      prop= RNA_def_property(srna, "select_material_boundary", PROP_BOOLEAN, PROP_NONE);
 +      RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_MATERIAL_BOUNDARY);
 +      RNA_def_property_ui_text(prop, "Material Boundary", "Select edges at material boundaries.");
 +      RNA_def_property_update(prop, NC_SCENE, NULL);
 +
 +      prop= RNA_def_property(srna, "select_contour", PROP_BOOLEAN, PROP_NONE);
 +      RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_CONTOUR);
 +      RNA_def_property_ui_text(prop, "Contour", "Select contours.");
 +      RNA_def_property_update(prop, NC_SCENE, NULL);
 +
 +      prop= RNA_def_property(srna, "select_external_contour", PROP_BOOLEAN, PROP_NONE);
 +      RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_EXTERNAL_CONTOUR);
 +      RNA_def_property_ui_text(prop, "External Contour", "Select external contours.");
 +      RNA_def_property_update(prop, NC_SCENE, NULL);
 +
 +      prop= RNA_def_property(srna, "visibility", PROP_ENUM, PROP_NONE);
 +      RNA_def_property_enum_sdna(prop, NULL, "qi");
 +      RNA_def_property_enum_items(prop, visibility_items);
 +      RNA_def_property_ui_text(prop, "Visibility", "Determine how to use visibility for feature edge selection.");
 +      RNA_def_property_update(prop, NC_SCENE, NULL);
 +
 +      prop= RNA_def_property(srna, "qi_start", PROP_INT, PROP_UNSIGNED);
 +      RNA_def_property_int_sdna(prop, NULL, "qi_start");
 +      RNA_def_property_range(prop, 0, INT_MAX);
 +      RNA_def_property_ui_text(prop, "Start", "First QI value of the QI range");
 +      RNA_def_property_update(prop, NC_SCENE, NULL);
 +
 +      prop= RNA_def_property(srna, "qi_end", PROP_INT, PROP_UNSIGNED);
 +      RNA_def_property_int_sdna(prop, NULL, "qi_end");
 +      RNA_def_property_range(prop, 0, INT_MAX);
 +      RNA_def_property_ui_text(prop, "End", "Last QI value of the QI range");
 +      RNA_def_property_update(prop, NC_SCENE, NULL);
 +
 +      /* FreestyleModuleSettings */
 +
 +      srna= RNA_def_struct(brna, "FreestyleModuleSettings", NULL);
 +      RNA_def_struct_sdna(srna, "FreestyleModuleConfig");
 +      RNA_def_struct_ui_text(srna, "Freestyle Module", "Style module configuration for specifying a style module.");
 +
 +      prop= RNA_def_property(srna, "module_path", PROP_STRING, PROP_FILEPATH);
 +      RNA_def_property_string_sdna(prop, NULL, "module_path");
 +      RNA_def_property_ui_text(prop, "Module Path", "Path to a style module file.");
 +      RNA_def_property_update(prop, NC_SCENE, NULL);
 +
 +      prop= RNA_def_property(srna, "is_displayed", PROP_BOOLEAN, PROP_NONE);
 +      RNA_def_property_boolean_sdna(prop, NULL, "is_displayed", 1);
 +      RNA_def_property_ui_text(prop, "Is Displayed", "Enable this style module during the rendering.");
 +      RNA_def_property_update(prop, NC_SCENE, NULL);
 +
 +      /* FreestyleSettings */
 +
 +      srna= RNA_def_struct(brna, "FreestyleSettings", NULL);
 +      RNA_def_struct_sdna(srna, "FreestyleConfig");
 +      RNA_def_struct_nested(brna, srna, "SceneRenderLayer");
 +      RNA_def_struct_ui_text(srna, "Frestyle Settings", "Freestyle settings for a SceneRenderLayer datablock.");
 +
 +      prop= RNA_def_property(srna, "modules", PROP_COLLECTION, PROP_NONE);
 +      RNA_def_property_collection_sdna(prop, NULL, "modules", NULL);
 +      RNA_def_property_struct_type(prop, "FreestyleModuleSettings");
 +      RNA_def_property_ui_text(prop, "Style modules", "A list of style modules (to be applied from top to bottom).");
 +
 +      prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
 +      RNA_def_property_enum_sdna(prop, NULL, "mode");
 +      RNA_def_property_enum_items(prop, freestyle_ui_mode_items);
 +      RNA_def_property_ui_text(prop, "Control Mode", "Select the Freestyle control mode");
 +      RNA_def_property_update(prop, NC_SCENE, NULL);
 +
 +      prop= RNA_def_property(srna, "suggestive_contours", PROP_BOOLEAN, PROP_NONE);
 +      RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_SUGGESTIVE_CONTOURS_FLAG);
 +      RNA_def_property_ui_text(prop, "Suggestive Contours", "Enable suggestive contours.");
 +      RNA_def_property_update(prop, NC_SCENE, NULL);
 +
 +      prop= RNA_def_property(srna, "ridges_and_valleys", PROP_BOOLEAN, PROP_NONE);
 +      RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_RIDGES_AND_VALLEYS_FLAG);
 +      RNA_def_property_ui_text(prop, "Ridges and Valleys", "Enable ridges and valleys.");
 +      RNA_def_property_update(prop, NC_SCENE, NULL);
 +
 +      prop= RNA_def_property(srna, "material_boundaries", PROP_BOOLEAN, PROP_NONE);
 +      RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_MATERIAL_BOUNDARIES_FLAG);
 +      RNA_def_property_ui_text(prop, "Material Boundaries", "Enable material boundaries.");
 +      RNA_def_property_update(prop, NC_SCENE, NULL);
 +
 +      prop= RNA_def_property(srna, "sphere_radius", PROP_FLOAT, PROP_NONE);
 +      RNA_def_property_float_sdna(prop, NULL, "sphere_radius");
 +      RNA_def_property_range(prop, 0.0, 1000.0);
 +      RNA_def_property_ui_text(prop, "Sphere Radius", "Sphere radius for computing curvatures.");
 +      RNA_def_property_update(prop, NC_SCENE, NULL);
 +
 +      prop= RNA_def_property(srna, "dkr_epsilon", PROP_FLOAT, PROP_NONE);
 +      RNA_def_property_float_sdna(prop, NULL, "dkr_epsilon");
 +      RNA_def_property_range(prop, 0.0, 1000.0);
 +      RNA_def_property_ui_text(prop, "Kr Derivative Epsilon", "Kr derivative epsilon for computing suggestive contours.");
 +      RNA_def_property_update(prop, NC_SCENE, NULL);
 +
 +      prop= RNA_def_property(srna, "crease_angle", PROP_FLOAT, PROP_NONE);
 +      RNA_def_property_float_sdna(prop, NULL, "crease_angle");
 +      RNA_def_property_range(prop, 0.0, 180.0);
 +      RNA_def_property_ui_text(prop, "Crease Angle", "Angular threshold in degrees (between 0 and 180) for detecting crease edges.");
 +      RNA_def_property_update(prop, NC_SCENE, NULL);
 +
 +      prop= RNA_def_property(srna, "linesets", PROP_COLLECTION, PROP_NONE);
 +      RNA_def_property_collection_sdna(prop, NULL, "linesets", NULL);
 +      RNA_def_property_struct_type(prop, "FreestyleLineSet");
 +      RNA_def_property_ui_text(prop, "Line Sets", "Line sets for associating lines and style parameters");
 +
 +      prop= RNA_def_property(srna, "active_lineset", PROP_POINTER, PROP_NONE);
 +      RNA_def_property_struct_type(prop, "FreestyleLineSet");
++      RNA_def_property_pointer_funcs(prop, "rna_FreestyleSettings_active_lineset_get", NULL, NULL, NULL);
 +      RNA_def_property_ui_text(prop, "Active Line Set", "Active line set being displayed");
 +      RNA_def_property_update(prop, NC_SCENE, NULL);
 +
 +      prop= RNA_def_property(srna, "active_lineset_index", PROP_INT, PROP_UNSIGNED);
 +      RNA_def_property_int_funcs(prop, "rna_FreestyleSettings_active_lineset_index_get", "rna_FreestyleSettings_active_lineset_index_set", "rna_FreestyleSettings_active_lineset_index_range");
 +      RNA_def_property_ui_text(prop, "Active Line Set Index", "Index of active line set slot");
 +      RNA_def_property_update(prop, NC_SCENE, NULL);
 +}
 +
  static void rna_def_scene_game_data(BlenderRNA *brna)
  {
        StructRNA *srna;
  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_icon(srna, ICON_RENDERLAYERS);
  
        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)
        RNA_def_property_ui_text(prop, "Edge Color", "");
        RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
        
 +      prop= RNA_def_property(srna, "freestyle", PROP_BOOLEAN, PROP_NONE);
 +      RNA_def_property_boolean_sdna(prop, NULL, "mode", R_EDGE_FRS);
 +      RNA_def_property_ui_text(prop, "Edge", "Draw stylized strokes using Freestyle.");
 +      RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 +
        /* threads */
        prop= RNA_def_property(srna, "threads", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "threads");
@@@ -3131,7 -2842,7 +3135,7 @@@ static void rna_def_scene_objects(Blend
  
        prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
        RNA_def_property_struct_type(prop, "Object");
-       RNA_def_property_pointer_funcs(prop, "rna_Scene_active_object_get", "rna_Scene_active_object_set", NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_Scene_active_object_get", "rna_Scene_active_object_set", NULL, NULL);
        RNA_def_property_flag(prop, PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "Active Object", "Active object for this scene");
        /* Could call: ED_base_object_activate(C, scene->basact);
@@@ -3222,6 -2933,7 +3226,7 @@@ void RNA_def_scene(BlenderRNA *brna
        /* Global Settings */
        prop= RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
        RNA_def_property_flag(prop, PROP_EDITABLE);
+       RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Camera_object_poll");
        RNA_def_property_ui_text(prop, "Camera", "Active camera used for rendering the scene");
        RNA_def_property_update(prop, NC_SCENE|NA_EDITED, "rna_Scene_view3d_update");
  
        RNA_def_property_pointer_sdna(prop, NULL, "set");
        RNA_def_property_struct_type(prop, "Scene");
        RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
-       RNA_def_property_pointer_funcs(prop, NULL, "rna_Scene_set_set", NULL);
+       RNA_def_property_pointer_funcs(prop, NULL, "rna_Scene_set_set", NULL, NULL);
        RNA_def_property_ui_text(prop, "Background Scene", "Background set scene");
        RNA_def_property_update(prop, NC_SCENE|NA_EDITED, NULL);
  
        prop= RNA_def_property(srna, "active_keying_set", PROP_POINTER, PROP_NONE);
        RNA_def_property_struct_type(prop, "KeyingSet");
        RNA_def_property_flag(prop, PROP_EDITABLE);
-       RNA_def_property_pointer_funcs(prop, "rna_Scene_active_keying_set_get", "rna_Scene_active_keying_set_set", NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_Scene_active_keying_set_get", "rna_Scene_active_keying_set_set", NULL, NULL);
        RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
        RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
        
        RNA_def_property_flag(prop, PROP_EDITABLE);
        RNA_def_property_struct_type(prop, "GreasePencil");
        RNA_def_property_ui_text(prop, "Grease Pencil Data", "Grease Pencil datablock");
 -      
 +
        /* Transform Orientations */
        prop= RNA_def_property(srna, "orientations", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_collection_sdna(prop, NULL, "transform_spaces", NULL);
index b4ce9898b1be3d4def4088ba890964fc27a7a833,17189341136c8df929b6b688ef19a3d3a0d259ed..c9dc60dcc924bf095406dc4aa640efa617018706
@@@ -5,12 -5,14 +5,15 @@@ sources = env.Glob('intern/*.c'
  
  incs = '. ../editors/include ../makesdna ../makesrna ../blenlib ../blenkernel ../nodes'
  incs += ' ../imbuf ../blenloader ../render/extern/include ../windowmanager'
 +incs += ' ../freestyle/intern/python'
  incs += ' #intern/guardedalloc #intern/memutil #extern/glew/include'
  incs += ' ' + env['BF_PYTHON_INC']
  
  defs = []
  
+ if env['BF_BUILDINFO']:
+       defs.append('BUILD_DATE')
  if env['OURPLATFORM'] in ('win32-mingw', 'win32-vc','win64-vc') and env['BF_DEBUG']:
        defs.append('_DEBUG')
  
index 7e4043c75ca18cc6a7b02307ac1c237a1b3b7a99,875efd752462b1f8e05936c826d99facb5e2fa96..a74f95a63c49c89691bbed3396533f4d55553dec
@@@ -47,7 -47,6 +47,7 @@@ reload(rna_info
  # lame, python wont give some access
  MethodDescriptorType = type(dict.get)
  GetSetDescriptorType = type(int.real)
 +StaticMethodType = type(staticmethod(lambda: None))
  
  EXAMPLE_SET = set()
  EXAMPLE_SET_USED = set()
@@@ -276,12 -275,6 +276,12 @@@ def pymodule2sphinx(BASEPATH, module_na
              if type(descr) == GetSetDescriptorType:
                  py_descr2sphinx("   ", fw, descr, module_name, type_name, key)
  
 +        for key, descr in descr_items:
 +            if type(descr) == StaticMethodType:
 +                descr = getattr(value, key)
 +                write_indented_lines("   ", fw, descr.__doc__ or "Undocumented", False)
 +                fw("\n")
 +
          fw("\n\n")
  
      file.close()
@@@ -367,6 -360,7 +367,7 @@@ def rna2sphinx(BASEPATH)
      
      # py modules
      fw("   bpy.utils.rst\n\n")
+     fw("   bpy.path.rst\n\n")
      fw("   bpy.app.rst\n\n")
      
      # C modules
  
  
      fw("   mathutils.rst\n\n")
 +    fw("   Freestyle.rst\n\n")
      fw("   blf.rst\n\n")
      
      # game engine
      from bpy import utils as module
      pymodule2sphinx(BASEPATH, "bpy.utils", module, "Utilities (bpy.utils)")
  
+     from bpy import path as module
+     pymodule2sphinx(BASEPATH, "bpy.path", module, "Path Utilities (bpy.path)")
      # C modules
      from bpy import app as module
      pymodule2sphinx(BASEPATH, "bpy.app", module, "Application Data (bpy.app)")
      pymodule2sphinx(BASEPATH, "mathutils", module, "Math Types & Utilities (mathutils)")
      del module
  
 +    import Freestyle as module
 +    pymodule2sphinx(BASEPATH, "Freestyle", module, "Freestyle Operators & Rules (Freestyle)")
 +    del module
 +
      import blf as module
      pymodule2sphinx(BASEPATH, "blf", module, "Font Drawing (blf)")
      del module
index 6d2e45f352a9815c265da527259dd22d66af4fdd,7ca1b365c6f126d20055325beb25a316309b832d..8319213a789606a5dd8954a9f3f9e46c53ff3b39
@@@ -41,8 -41,6 +41,8 @@@
  #include "../generic/blf_api.h"
  #include "../generic/IDProp.h"
  
 +#include "BPy_Freestyle.h"
 +
  static char bpy_script_paths_doc[] =
  ".. function:: script_paths()\n"
  "\n"
@@@ -67,7 -65,7 +67,7 @@@ PyObject *bpy_script_paths(PyObject *se
  static char bpy_blend_paths_doc[] =
  ".. function:: blend_paths(absolute=False)\n"
  "\n"
- "   Returns a list of paths associated with this blend file.\n"
+ "   Returns a list of paths to external files referenced by the loaded .blend file.\n"
  "\n"
  "   :arg absolute: When true the paths returned are made absolute.\n"
  "   :type absolute: boolean\n"
@@@ -155,7 -153,6 +155,7 @@@ void BPy_init_modules( void 
        BGL_Init();
        BLF_Init();
        IDProp_Init_Types();
 +      Freestyle_Init();
  
  
        mod = PyModule_New("_bpy");
index c78e09dae10e9a93c46d47970e57ac61e7baaabe,2047ab29d2446296ec19f9b5f5858560a9f4c018..6f897c1cbdca880cda5c26965897ec3e6f86002b
@@@ -29,7 -29,7 +29,7 @@@ FILE(GLOB SRC intern/source/*.c intern/
  SET(INC 
        intern/include ../../../intern/guardedalloc ../blenlib ../makesdna
        extern/include ../blenkernel ../imbuf
 -      ../include ../../kernel/gen_messaging ../blenloader
 +      ../include ../../kernel/gen_messaging ../blenloader ../freestyle
        ../../../intern/smoke/extern
        ../makesrna
  )
@@@ -38,9 -38,9 +38,9 @@@ IF(WIN32
        SET(INC ${INC} ${PTHREADS_INC})
  ENDIF(WIN32)
  
- IF(WITH_OPENEXR)
+ IF(WITH_IMAGE_OPENEXR)
        ADD_DEFINITIONS(-DWITH_OPENEXR)
- ENDIF(WITH_OPENEXR)
+ ENDIF(WITH_IMAGE_OPENEXR)
  
  IF(WITH_QUICKTIME)
        SET(INC ${INC} ../quicktime ${QUICKTIME_INC})
@@@ -54,9 -54,4 +54,4 @@@ IF(APPLE
        ENDIF(CMAKE_OSX_ARCHITECTURES MATCHES "i386" OR CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
  ENDIF(APPLE)
  
- #TODO
- #if env['OURPLATFORM']=='linux2':
- #    cflags='-pthread'
  BLENDERLIB_NOLIST(blender_render "${SRC}" "${INC}")
- #env.BlenderLib ( libname = 'blender_render', sources = sources, includes = Split(incs), defines=defs, libtype='core', priority=45, compileflags=cflags )
index 3c690d87f4a322b55f5c486d176953a94f8edf07,6c6e200a74e0683289fbd97c36f6a349a97c43df..a537a2376ae0ba1fd0998e7957e4cb1146f422ee
@@@ -42,7 -42,6 +42,7 @@@
  #include "BKE_utildefines.h"
  #include "BKE_global.h"
  #include "BKE_image.h"
 +#include "BKE_library.h"
  #include "BKE_main.h"
  #include "BKE_node.h"
  #include "BKE_object.h"
@@@ -68,9 -67,6 +68,9 @@@
  
  #include "RE_pipeline.h"
  
 +#include "FRS_freestyle.h"
 +#include "FRS_freestyle_config.h"
 +
  /* internal */
  #include "render_types.h"
  #include "renderpipeline.h"
@@@ -650,7 -646,6 +650,7 @@@ static RenderResult *new_render_result(
                rl->lay= (1<<20) -1;
                rl->layflag= 0x7FFF;    /* solid ztra halo strand */
                rl->passflag= SCE_PASS_COMBINED;
 +              FRS_add_freestyle_config( srl );
                
                re->r.actlay= 0;
        }
@@@ -1759,7 -1754,6 +1759,7 @@@ void RE_TileProcessor(Render *re
  /* ************  This part uses API, for rendering Blender scenes ********** */
  
  static int external_render_3d(Render *re, int do_all);
 +static void add_freestyle(Render *re);
  
  static void do_render_3d(Render *re)
  {
                if(!re->test_break(re->tbh))
                        add_halo_flare(re);
        
 +      /* Freestyle  */
 +      if( re->r.mode & R_EDGE_FRS && re->r.renderer==R_INTERN)
 +              if(!re->test_break(re->tbh))
 +                      add_freestyle(re);
 +              
        /* free all render verts etc */
        RE_Database_Free(re);
        
@@@ -2244,66 -2233,6 +2244,66 @@@ static void render_composit_stats(void 
  }
  
  
 +/* invokes Freestyle stroke rendering */
 +static void add_freestyle(Render *re)
 +{
 +      SceneRenderLayer *srl;
 +      LinkData *link;
 +
 +      FRS_init_stroke_rendering(re);
 +
 +      for(srl= (SceneRenderLayer *)re->scene->r.layers.first; srl; srl= srl->next) {
 +
 +              link = (LinkData *)MEM_callocN(sizeof(LinkData), "LinkData to Freestyle render");
 +              BLI_addtail(&re->freestyle_renders, link);
 +
 +              if( FRS_is_freestyle_enabled(srl) ) {
 +                      link->data = (void *)FRS_do_stroke_rendering(re, srl);
 +              }
 +      }
 +
 +      FRS_finish_stroke_rendering(re);
 +}
 +
 +/* merges the results of Freestyle stroke rendering into a given render result */
 +static void composite_freestyle_renders(Render *re, int sample)
 +{
 +      Render *freestyle_render;
 +      SceneRenderLayer *srl;
 +      LinkData *link;
 +
 +      link = (LinkData *)re->freestyle_renders.first;
 +      for(srl= (SceneRenderLayer *)re->scene->r.layers.first; srl; srl= srl->next) {
 +              if( FRS_is_freestyle_enabled(srl) ) {
 +                      freestyle_render = (Render *)link->data;
 +                      read_render_result(freestyle_render, sample);
 +                      FRS_composite_result(re, srl, freestyle_render);
 +                      RE_FreeRenderResult(freestyle_render->result);
 +                      freestyle_render->result = NULL;
 +              }
 +              link = link->next;
 +      }
 +}
 +
 +/* releases temporary scenes and renders for Freestyle stroke rendering */
 +static void free_all_freestyle_renders(void)
 +{
 +      Render *re1, *freestyle_render;
 +      LinkData *link;
 +
 +      for(re1= RenderGlobal.renderlist.first; re1; re1= re1->next) {
 +              for (link = (LinkData *)re1->freestyle_renders.first; link; link = link->next) {
 +                      if (link->data) {
 +                              freestyle_render = (Render *)link->data;
 +                              free_libblock(&G.main->scene, freestyle_render->scene);
 +                              RE_FreeRender(freestyle_render);
 +                      }
 +              }
 +              BLI_freelistN( &re1->freestyle_renders );
 +      }
 +}
 +
 +
  /* reads all buffers, calls optional composite, merges in first result->rectf */
  static void do_merge_fullsample(Render *re, bNodeTree *ntree)
  {
                        
                        tag_scenes_for_render(re);
                        for(re1= RenderGlobal.renderlist.first; re1; re1= re1->next) {
 -                              if(re1->scene->id.flag & LIB_DOIT)
 -                                      if(re1->r.scemode & R_FULL_SAMPLE)
 +                              if(re1->scene->id.flag & LIB_DOIT) {
 +                                      if(re1->r.scemode & R_FULL_SAMPLE) {
                                                read_render_result(re1, sample);
 +                                              composite_freestyle_renders(re1, sample);
 +                                      }
 +                              }
                        }
                }
  
@@@ -2486,8 -2412,6 +2486,8 @@@ static void do_render_composite_fields_
                        do_merge_fullsample(re, NULL);
        }
  
 +      free_all_freestyle_renders();
 +
        /* weak... the display callback wants an active renderlayer pointer... */
        re->result->renlay= render_get_active_layer(re, re->result);
        re->display_draw(re->ddh, re->result, NULL);
@@@ -2755,6 -2679,7 +2755,7 @@@ static void update_physics_cache(Rende
  {
        PTCacheBaker baker;
  
+       baker.main = re->main;
        baker.scene = scene;
        baker.pid = NULL;
        baker.bake = 0;
@@@ -2853,16 -2778,6 +2854,16 @@@ void RE_BlenderFrame(Render *re, Main *
        G.rendering= 0;
  }
  
 +void RE_RenderFreestyleStrokes(Render *re, Main *bmain, Scene *scene)
 +{
 +      re->result_ok= 0;
 +      scene->r.cfra= 1;
 +      if(render_initialize_from_main(re, bmain, scene, NULL, scene->lay, 0, 0)) {
 +              do_render_fields_blur_3d(re);
 +      }
 +      re->result_ok= 1;
 +}
 +
  static int do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh, ReportList *reports)
  {
        char name[FILE_MAX];
index 1eb26506653b653306f00ba473887dbea061bc44,4088369a05be9360b428fc2ad6f1e63bbde3b62a..de3fdc3e2efacc5c57fc6808588807c873f4137c
@@@ -39,7 -39,6 +39,7 @@@ INCLUDE_DIRECTORIES
        ../blender/render/extern/include
        ../blender/makesdna
        ../blender/gpu
 +      ../blender/freestyle
        ../blender/windowmanager
        ../kernel/gen_messaging
        ../kernel/gen_system
@@@ -53,13 -52,25 +53,25 @@@ IF(WITH_QUICKTIME
        ADD_DEFINITIONS(-DWITH_QUICKTIME)
  ENDIF(WITH_QUICKTIME)
  
- IF(WITH_OPENEXR)
+ IF(WITH_IMAGE_OPENEXR)
        ADD_DEFINITIONS(-DWITH_OPENEXR)
- ENDIF(WITH_OPENEXR)
+ ENDIF(WITH_IMAGE_OPENEXR)
  
- IF(WITH_TIFF)
+ IF(WITH_IMAGE_TIFF)
        ADD_DEFINITIONS(-DWITH_TIFF)
- ENDIF(WITH_TIFF)
+ ENDIF(WITH_IMAGE_TIFF)
+ IF(WITH_IMAGE_DDS)
+       ADD_DEFINITIONS(-DWITH_DDS)
+ ENDIF(WITH_IMAGE_DDS)
+ IF(WITH_IMAGE_CINEON)
+       ADD_DEFINITIONS(-DWITH_CINEON)
+ ENDIF(WITH_IMAGE_CINEON)
+ IF(WITH_IMAGE_HDR)
+       ADD_DEFINITIONS(-DWITH_HDR)
+ ENDIF(WITH_IMAGE_HDR)
  
  IF(WITH_PYTHON)
        INCLUDE_DIRECTORIES(../blender/python)
@@@ -124,16 -135,16 +136,16 @@@ IF(WITH_INSTALL
                
                ADD_CUSTOM_COMMAND(
                        TARGET blender POST_BUILD MAIN_DEPENDENCY blender
-                       COMMAND rm -Rf ${TARGETDIR}/.blender
-                       COMMAND mkdir ${TARGETDIR}/.blender/
-                       COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf ${TARGETDIR}/.blender/
+                       COMMAND rm -Rf ${TARGETDIR}/${BLENDER_VERSION}
+                       COMMAND mkdir ${TARGETDIR}/${BLENDER_VERSION}/
+                       COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf ${TARGETDIR}/${BLENDER_VERSION}/
                )
      
                IF(WITH_INTERNATIONAL)
                        ADD_CUSTOM_COMMAND(
                                TARGET blender POST_BUILD MAIN_DEPENDENCY blender
-                               COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages ${TARGETDIR}/.blender/
-                               COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale ${TARGETDIR}/.blender/
+                               COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages ${TARGETDIR}/${BLENDER_VERSION}/
+                               COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale ${TARGETDIR}/${BLENDER_VERSION}/
                        )
                ENDIF(WITH_INTERNATIONAL)
      
                        ADD_CUSTOM_COMMAND(
                                TARGET blender POST_BUILD MAIN_DEPENDENCY blender
                                COMMENT "copying blender scripts..."
-                               COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/scripts ${TARGETDIR}/.blender/
+                               COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/scripts ${TARGETDIR}/${BLENDER_VERSION}/
                                COMMAND find ${TARGETDIR} -name "*.py?" -prune -exec rm -rf {} "\;"
                        )
                        IF(WITH_PYTHON_INSTALL)
                                        TARGET blender POST_BUILD MAIN_DEPENDENCY blender
                                        COMMENT "copying a subset of the systems python..."
  
-                                       COMMAND mkdir ${TARGETDIR}/.blender/python # PYTHONPATH and PYTHONHOME is set here
-                                       COMMAND mkdir ${TARGETDIR}/.blender/python/lib/
-                                       COMMAND cp -R ${PYTHON_LIBPATH}/python${PYTHON_VERSION} ${TARGETDIR}/.blender/python/lib/
+                                       COMMAND mkdir ${TARGETDIR}/${BLENDER_VERSION}/python # PYTHONPATH and PYTHONHOME is set here
+                                       COMMAND mkdir ${TARGETDIR}/${BLENDER_VERSION}/python/lib/
+                                       COMMAND cp -R ${PYTHON_LIBPATH}/python${PYTHON_VERSION} ${TARGETDIR}/${BLENDER_VERSION}/python/lib/
  
-                                       COMMAND rm -rf ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/distutils
-                                       COMMAND rm -rf ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/lib2to3
-                                       COMMAND rm -rf ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/idlelib
-                                       COMMAND rm -rf ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/tkinter
-                                       COMMAND rm -rf ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/config
+                                       COMMAND rm -rf ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/distutils
+                                       COMMAND rm -rf ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/lib2to3
+                                       COMMAND rm -rf ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/idlelib
+                                       COMMAND rm -rf ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/tkinter
+                                       COMMAND rm -rf ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/config
  
-                                       COMMAND rm -rf ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/site-packages
-                                       COMMAND mkdir ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/site-packages    # python needs it.
+                                       COMMAND rm -rf ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/site-packages
+                                       COMMAND mkdir ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/site-packages    # python needs it.
  
-                                       COMMAND rm -f ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION}/lib-dynload/_tkinter.so
-                                       COMMAND find ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION} -name "test" -prune -exec rm -rf {} "\;"
-                                       COMMAND find ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION} -name "*.py?" -exec rm -rf {} "\;"
-                                       COMMAND find ${TARGETDIR}/.blender/python/lib/python${PYTHON_VERSION} -name "*.so"-exec strip -s {} "\;"
+                                       COMMAND rm -f ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/lib-dynload/_tkinter.so
+                                       COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION} -name "test" -prune -exec rm -rf {} "\;"
+                                       COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION} -name "*.py?" -exec rm -rf {} "\;"
+                                       COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION} -name "*.so"-exec strip -s {} "\;"
                                )
                        ENDIF(WITH_PYTHON_INSTALL)
                ENDIF(WITH_PYTHON)
                ENDIF(WITH_INTERNATIONAL)
        
                IF(WITH_PYTHON)
-                       IF(WITH_LIBS10.5)
-                               SET(PYTHON_ZIP "python_${CMAKE_OSX_ARCHITECTURES}.zip")
-                       ELSE(WITH_LIBS10.5)
-                               SET(PYTHON_ZIP "python.zip")
-                       ENDIF(WITH_LIBS10.5)
+                       SET(PYTHON_ZIP "python_${CMAKE_OSX_ARCHITECTURES}.zip")
                        ADD_CUSTOM_COMMAND(
                                TARGET blender POST_BUILD MAIN_DEPENDENCY blender
-                               COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/scripts ${TARGETDIR}/blender.app/Contents/MacOS/scripts/
+                               COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/scripts ${TARGETDIR}/blender.app/Contents/MacOS/
                                COMMAND rm -Rf ${TARGETDIR}/blender.app/Contents/MacOS/python/
                                COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/python/
                                COMMAND unzip -q ${LIBDIR}/release/${PYTHON_ZIP} -d ${TARGETDIR}/blender.app/Contents/MacOS/python/
@@@ -378,9 -385,9 +386,9 @@@ FILE(READ ${CMAKE_BINARY_DIR}/cmake_ble
  
  SET(BLENDER_LINK_LIBS bf_nodes ${BLENDER_LINK_LIBS} bf_windowmanager blender_render)
  
- IF(WITH_ELBEEM)
+ IF(WITH_FLUID)
        SET(BLENDER_LINK_LIBS ${BLENDER_LINK_LIBS} bf_elbeem)
- ENDIF(WITH_ELBEEM)
+ ENDIF(WITH_FLUID)
  
  IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
        SET(BLENDER_LINK_LIBS ${BLENDER_LINK_LIBS} extern_binreloc)
@@@ -429,7 -436,6 +437,7 @@@ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux"
          bf_editor_animation
          bf_editor_datafiles
  
 +              bf_freestyle
                blender_BSP 
                blender_render 
                blender_ONL 
index 7f359b2f5a87522b51b07d814ef1009408a1f988,01e62d33269d795fb65beb4d702c96c21159cc1c..4c603a3b4a9fbfbb4c668a66a4ed6e8e48298ad7
@@@ -8,7 -8,7 +8,7 @@@ incs = '#/intern/guardedalloc ../blende
  incs += ' ../blender/editors/include ../blender/blenloader ../blender/imbuf'
  incs += ' ../blender/renderconverter ../blender/render/extern/include ../blender/windowmanager'
  incs += ' ../blender/makesdna ../blender/makesrna ../kernel/gen_messaging'
 -incs += ' ../kernel/gen_system #/extern/glew/include ../blender/gpu'
 +incs += ' ../kernel/gen_system #/extern/glew/include ../blender/gpu ../blender/freestyle'
  incs += ' ' + env['BF_OPENGL_INC']
  
  defs = []
@@@ -35,9 -35,6 +35,6 @@@ if env['WITH_BF_PYTHON']
                defs.append('_DEBUG')
  else:
        defs.append('DISABLE_PYTHON')
- if env['WITH_BF_FHS']: # /usr -> /usr/share/blender/2.5
-       defs.append('BLENDERPATH=\\"' + os.path.join(env['BF_INSTALLDIR'], 'share', 'blender', env['BF_VERSION']) + '\\"')
        
  if env['BF_BUILDINFO']:
        defs.append('BUILD_DATE')
diff --combined source/creator/creator.c
index 8deb66d7f1f7ec9a08a1079f93cd179010d4ba30,05359b0611210bddabd0f723322aa1cdadfaf009..38480c1ffe0dbb758e9a6458aa20f9c5a84dcefb
@@@ -96,8 -96,6 +96,8 @@@
  #include "GPU_draw.h"
  #include "GPU_extensions.h"
  
 +#include "FRS_freestyle.h"
 +
  /* for passing information between creator and gameengine */
  #include "SYS_System.h"
  
@@@ -561,7 -559,9 +561,9 @@@ static int set_image_type(int argc, cha
                        else if (!strcmp(imtype,"AVICODEC")) scene->r.imtype = R_AVICODEC;
                        else if (!strcmp(imtype,"QUICKTIME")) scene->r.imtype = R_QUICKTIME;
                        else if (!strcmp(imtype,"BMP")) scene->r.imtype = R_BMP;
+ #ifdef WITH_HDR
                        else if (!strcmp(imtype,"HDR")) scene->r.imtype = R_RADHDR;
+ #endif
  #ifdef WITH_TIFF
                        else if (!strcmp(imtype,"TIFF")) scene->r.imtype = R_TIFF;
  #endif
  #endif
                        else if (!strcmp(imtype,"MPEG")) scene->r.imtype = R_FFMPEG;
                        else if (!strcmp(imtype,"FRAMESERVER")) scene->r.imtype = R_FRAMESERVER;
+ #ifdef WITH_CINEON
                        else if (!strcmp(imtype,"CINEON")) scene->r.imtype = R_CINEON;
                        else if (!strcmp(imtype,"DPX")) scene->r.imtype = R_DPX;
+ #endif
  #if WITH_OPENJPEG
                        else if (!strcmp(imtype,"JP2")) scene->r.imtype = R_JP2;
  #endif
@@@ -1130,10 -1132,6 +1134,10 @@@ int main(int argc, char **argv
        CTX_py_init_set(C, 1);
        WM_keymap_init(C);
  
 +      /* initialize Freestyle */
 +      FRS_initialize();
 +      FRS_set_context(C);
 +
        /* OK we are ready for it */
        BLI_argsParse(ba, 4, load_file, C);