Merged changes in the trunk up to revision 37388.
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Sat, 11 Jun 2011 00:22:10 +0000 (00:22 +0000)
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Sat, 11 Jun 2011 00:22:10 +0000 (00:22 +0000)
Conflicts resolved:
release/scripts/startup/bl_ui/properties_render.py
source/creator/SConscript
source/blender/blenlib/intern/bpath.c
source/blender/editors/space_outliner/outliner.c

43 files changed:
1  2 
build_files/scons/tools/Blender.py
doc/python_api/sphinx_doc_gen.py
release/scripts/startup/bl_ui/properties_render.py
source/blender/blenkernel/CMakeLists.txt
source/blender/blenkernel/SConscript
source/blender/blenkernel/intern/anim_sys.c
source/blender/blenkernel/intern/material.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/scene.c
source/blender/blenlib/CMakeLists.txt
source/blender/blenlib/intern/bpath.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/editors/animation/anim_channels_edit.c
source/blender/editors/animation/keyframes_draw.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/render/CMakeLists.txt
source/blender/editors/render/render_intern.h
source/blender/editors/render/render_shading.c
source/blender/editors/space_nla/nla_channels.c
source/blender/editors/transform/transform.c
source/blender/freestyle/CMakeLists.txt
source/blender/freestyle/intern/application/AppConfig.cpp
source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
source/blender/makesdna/DNA_scene_types.h
source/blender/makesdna/intern/makesdna.c
source/blender/makesrna/RNA_access.h
source/blender/makesrna/RNA_enum_types.h
source/blender/makesrna/intern/CMakeLists.txt
source/blender/makesrna/intern/makesrna.c
source/blender/makesrna/intern/rna_ID.c
source/blender/makesrna/intern/rna_color.c
source/blender/makesrna/intern/rna_internal.h
source/blender/makesrna/intern/rna_main.c
source/blender/makesrna/intern/rna_main_api.c
source/blender/makesrna/intern/rna_scene.c
source/blender/python/intern/CMakeLists.txt
source/blender/python/intern/bpy.c
source/blender/render/CMakeLists.txt
source/blender/render/intern/source/pipeline.c
source/blender/render/intern/source/shadeinput.c
source/creator/CMakeLists.txt
source/creator/creator.c

index 4bfa1851acb1853998ffb659496eed0f7632527b,50f43a03b8be91257d80f8fe2e9ea01b8897f98a..b6a9de5091a55d15de7eae4ba8e45900caeec406
@@@ -287,6 -290,50 +290,50 @@@ def propose_priorities()
              print "\t\t",new_priority, v
              new_priority += 5
  
 -    incs = ['#/intern/guardedalloc', '#/source/blender/blenlib', '#/source/blender/blenkernel', '#/source/blender/editors/include', '#/source/blender/blenloader', '#/source/blender/imbuf', '#/source/blender/renderconverter', '#/source/blender/render/extern/include', '#/source/blender/windowmanager', '#/source/blender/makesdna', '#/source/blender/makesrna', '#/source/gameengine/BlenderRoutines', '#/extern/glew/include', '#/source/blender/gpu', env['BF_OPENGL_INC']]
+ # emits the necessary file objects for creator.c, to be used in creating
+ # the final blender executable
+ def creator(env):
+     sources = ['creator.c']# + Blender.buildinfo(env, "dynamic") + Blender.resources
++    incs = ['#/intern/guardedalloc', '#/source/blender/blenlib', '#/source/blender/blenkernel', '#/source/blender/editors/include', '#/source/blender/blenloader', '#/source/blender/imbuf', '#/source/blender/renderconverter', '#/source/blender/render/extern/include', '#/source/blender/windowmanager', '#/source/blender/makesdna', '#/source/blender/makesrna', '#/source/gameengine/BlenderRoutines', '#/extern/glew/include', '#/source/blender/gpu', '#/source/blender/freestyle', env['BF_OPENGL_INC']]
+     defs = []
+     if env['WITH_BF_QUICKTIME']:
+         incs.append(env['BF_QUICKTIME_INC'])
+         defs.append('WITH_QUICKTIME')
+     if env['WITH_BF_BINRELOC']:
+         incs.append('#/extern/binreloc/include')
+         defs.append('WITH_BINRELOC')
+     if env['WITH_BF_OPENEXR']:
+         defs.append('WITH_OPENEXR')
+     if env['WITH_BF_TIFF']:
+         defs.append('WITH_TIFF')
+     if not env['WITH_BF_SDL']:
+         defs.append('DISABLE_SDL')
+     if env['WITH_BF_PYTHON']:
+         incs.append('#/source/blender/python')
+         defs.append('WITH_PYTHON')
+         if env['BF_DEBUG']:
+             defs.append('_DEBUG')
+         
+     if env['BF_BUILDINFO']:
+         defs.append('BUILD_DATE')
+         defs.append('NAN_BUILDINFO')
+         
+     if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+         incs.append(env['BF_PTHREADS_INC'])
+     env.Append(CPPDEFINES=defs)
+     env.Append(CPPPATH=incs)
+     obj = [env.Object(root_build_dir+'source/creator/creator/creator', ['#source/creator/creator.c'])]
+     return obj
  ## TODO: see if this can be made in an emitter
  def buildinfo(lenv, build_type):
      """
Simple merge
index ff3a6e65773fc4928b307b6d79220dea329c268c,54ca18ef82846ef32313340c19cc055a83240ea8..17abc4de342b9199d890e567edb4dd61c8129c91
@@@ -173,294 -172,130 +173,416 @@@ class RENDER_PT_layers(RenderButtonsPan
          row.prop(rl, "exclude_refraction", text="")
  
  
 +class RENDER_PT_freestyle(RenderButtonsPanel, bpy.types.Panel):
 +    bl_label = "Freestyle"
 +    COMPAT_ENGINES = {'BLENDER_RENDER'}
 +
 +    @classmethod
 +    def poll(cls, context):
 +        rd = context.scene.render
 +        rl = rd.layers.active
 +        return rl and rl.use_freestyle
 +
 +    def draw(self, context):
 +        layout = self.layout
 +
 +        rd = context.scene.render
 +        rl = rd.layers.active
 +        freestyle = rl.freestyle_settings
 +
 +        split = layout.split()
 +
 +        col = split.column()
 +        col.prop(freestyle, "raycasting_algorithm", text="Raycasting Algorithm")
 +        col.prop(freestyle, "mode", text="Control Mode")
 +
 +        if freestyle.mode == "EDITOR":
 +            col.label(text="Edge Detection Options:")
 +            col.prop(freestyle, "use_smoothness")
 +            col.prop(freestyle, "crease_angle")
 +            col.prop(freestyle, "sphere_radius")
 +            col.prop(freestyle, "kr_derivative_epsilon")
 +
 +            lineset = freestyle.linesets.active
 +
 +            col.label(text="Line Sets:")
 +            row = col.row()
 +            rows = 2
 +            if lineset:
 +                rows = 5
 +            row.template_list(freestyle, "linesets", freestyle.linesets, "active_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")
 +                if lineset.select_by_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")
 +                    col.separator() # XXX
 +
 +                col.prop(lineset, "select_by_edge_types")
 +                if lineset.select_by_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")
 +                    col.separator() # XXX
 +
 +                col.prop(lineset, "select_by_group")
 +                if lineset.select_by_group:
 +                    col.prop(lineset, "group")
 +                    row = col.row()
 +                    row.prop(lineset, "group_negation", expand=True)
 +                    col.separator() # XXX
 +
 +                col.prop(lineset, "select_by_image_border")
 +
 +        else: # freestyle.mode == "SCRIPT"
 +
 +            col.prop(freestyle, "use_smoothness")
 +            col.prop(freestyle, "crease_angle")
 +            col.prop(freestyle, "sphere_radius")
 +            col.prop(freestyle, "use_ridges_and_valleys")
 +            col.prop(freestyle, "use_suggestive_contours")
 +            sub = col.row()
 +            sub.prop(freestyle, "kr_derivative_epsilon")
 +            sub.active = freestyle.use_suggestive_contours
 +            col.prop(freestyle, "use_material_boundaries")
 +            col.operator("scene.freestyle_module_add")
 +
 +            for i, module in enumerate(freestyle.modules):
 +                box = layout.box()
 +                box.context_pointer_set("freestyle_module", module)
 +                row = box.row(align=True)
 +                row.prop(module, "use", 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, bpy.types.Panel):
 +    bl_label = "Freestyle: Line Style"
 +    COMPAT_ENGINES = {'BLENDER_RENDER'}
 +
 +    @classmethod
 +    def poll(cls, context):
 +        rd = context.scene.render
 +        rl = rd.layers.active
 +        if rl and rl.use_freestyle:
 +            freestyle = rl.freestyle_settings
 +            return freestyle.mode == "EDITOR" and freestyle.linesets.active
 +        return False
 +
 +    def draw_modifier_box_header(self, box, modifier):
 +        row = box.row()
 +        row.context_pointer_set("modifier", modifier)
 +        if modifier.expanded:
 +            icon = "TRIA_DOWN"
 +        else:
 +            icon = "TRIA_RIGHT"
 +        row.prop(modifier, "expanded", text="", icon=icon, emboss=False)
 +        row.label(text=modifier.rna_type.name)
 +        row.prop(modifier, "name", text="")
 +        row.prop(modifier, "use", 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.active
 +        lineset = rl.freestyle_settings.linesets.active
 +        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":
 +            col.label(text="Chaining:")
 +            col.prop(linestyle, "same_object")
 +            col.separator()
 +            col.label(text="Caps:")
 +            sub = col.row(align=True)
 +            sub.prop(linestyle, "caps", expand=True)
 +            col.separator()
 +            col.prop(linestyle, "use_dashed_line")
 +            sub = col.row()
 +            sub.enabled = linestyle.use_dashed_line
 +            subsub = sub.column()
 +            subsub.label(text="Dash")
 +            subsub.prop(linestyle, "dash1", text="")
 +            subsub = sub.column()
 +            subsub.label(text="Gap")
 +            subsub.prop(linestyle, "gap1", text="")
 +            subsub = sub.column()
 +            subsub.label(text="Dash")
 +            subsub.prop(linestyle, "dash2", text="")
 +            subsub = sub.column()
 +            subsub.label(text="Gap")
 +            subsub.prop(linestyle, "gap2", text="")
 +            subsub = sub.column()
 +            subsub.label(text="Dash")
 +            subsub.prop(linestyle, "dash3", text="")
 +            subsub = sub.column()
 +            subsub.label(text="Gap")
 +            subsub.prop(linestyle, "gap3", text="")
 +        elif linestyle.panel == "DISTORT":
 +            pass
 +        elif linestyle.panel == "MISC":
 +            pass
 +
 +
+ class RENDER_PT_dimensions(RenderButtonsPanel, bpy.types.Panel):
+     bl_label = "Dimensions"
+     COMPAT_ENGINES = {'BLENDER_RENDER'}
+     def draw(self, context):
+         layout = self.layout
+         scene = context.scene
+         rd = scene.render
+         row = layout.row(align=True)
+         row.menu("RENDER_MT_presets", text=bpy.types.RENDER_MT_presets.bl_label)
+         row.operator("render.preset_add", text="", icon="ZOOMIN")
+         row.operator("render.preset_add", text="", icon="ZOOMOUT").remove_active = True
+         split = layout.split()
+         col = split.column()
+         sub = col.column(align=True)
+         sub.label(text="Resolution:")
+         sub.prop(rd, "resolution_x", text="X")
+         sub.prop(rd, "resolution_y", text="Y")
+         sub.prop(rd, "resolution_percentage", text="")
+         sub.label(text="Aspect Ratio:")
+         sub.prop(rd, "pixel_aspect_x", text="X")
+         sub.prop(rd, "pixel_aspect_y", text="Y")
+         row = col.row()
+         row.prop(rd, "use_border", text="Border")
+         sub = row.row()
+         sub.active = rd.use_border
+         sub.prop(rd, "use_crop_to_border", text="Crop")
+         col = split.column()
+         sub = col.column(align=True)
+         sub.label(text="Frame Range:")
+         sub.prop(scene, "frame_start", text="Start")
+         sub.prop(scene, "frame_end", text="End")
+         sub.prop(scene, "frame_step", text="Step")
+         sub.label(text="Frame Rate:")
+         if rd.fps_base == 1:
+             fps_rate = round(rd.fps / rd.fps_base)
+         else:
+             fps_rate = round(rd.fps / rd.fps_base, 2)
+         # TODO: Change the following to iterate over existing presets
+         custom_framerate = (fps_rate not in {23.98, 24, 25, 29.97, 30, 50, 59.94, 60})
+         if custom_framerate == True:
+             fps_label_text = "Custom (" + str(fps_rate) + " fps)"
+         else:
+             fps_label_text = str(fps_rate) + " fps"
+         sub.menu("RENDER_MT_framerate_presets", text=fps_label_text)
+         if custom_framerate or (bpy.types.RENDER_MT_framerate_presets.bl_label == "Custom"):
+             sub.prop(rd, "fps")
+             sub.prop(rd, "fps_base", text="/")
+         subrow = sub.row(align=True)
+         subrow.label(text="Time Remapping:")
+         subrow = sub.row(align=True)
+         subrow.prop(rd, "frame_map_old", text="Old")
+         subrow.prop(rd, "frame_map_new", text="New")
+ class RENDER_PT_antialiasing(RenderButtonsPanel, bpy.types.Panel):
+     bl_label = "Anti-Aliasing"
+     COMPAT_ENGINES = {'BLENDER_RENDER'}
+     def draw_header(self, context):
+         rd = context.scene.render
+         self.layout.prop(rd, "use_antialiasing", text="")
+     def draw(self, context):
+         layout = self.layout
+         rd = context.scene.render
+         layout.active = rd.use_antialiasing
+         split = layout.split()
+         col = split.column()
+         col.row().prop(rd, "antialiasing_samples", expand=True)
+         sub = col.row()
+         sub.enabled = not rd.use_border
+         sub.prop(rd, "use_full_sample")
+         col = split.column()
+         col.prop(rd, "pixel_filter_type", text="")
+         col.prop(rd, "filter_size", text="Size")
+ class RENDER_PT_motion_blur(RenderButtonsPanel, bpy.types.Panel):
+     bl_label = "Sampled Motion Blur"
+     bl_options = {'DEFAULT_CLOSED'}
+     COMPAT_ENGINES = {'BLENDER_RENDER'}
+     @classmethod
+     def poll(cls, context):
+         rd = context.scene.render
+         return not rd.use_full_sample and (rd.engine in cls.COMPAT_ENGINES)
+     def draw_header(self, context):
+         rd = context.scene.render
+         self.layout.prop(rd, "use_motion_blur", text="")
+     def draw(self, context):
+         layout = self.layout
+         rd = context.scene.render
+         layout.active = rd.use_motion_blur
+         row = layout.row()
+         row.prop(rd, "motion_blur_samples")
+         row.prop(rd, "motion_blur_shutter")
  class RENDER_PT_shading(RenderButtonsPanel, bpy.types.Panel):
      bl_label = "Shading"
+     bl_options = {'DEFAULT_CLOSED'}
      COMPAT_ENGINES = {'BLENDER_RENDER'}
  
      def draw(self, context):
@@@ -562,12 -396,51 +683,56 @@@ class RENDER_PT_post_processing(RenderB
          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, "use_freestyle", text="Freestyle")
  
+ class RENDER_PT_stamp(RenderButtonsPanel, bpy.types.Panel):
+     bl_label = "Stamp"
+     bl_options = {'DEFAULT_CLOSED'}
+     COMPAT_ENGINES = {'BLENDER_RENDER'}
+     def draw_header(self, context):
+         rd = context.scene.render
+         self.layout.prop(rd, "use_stamp", text="")
+     def draw(self, context):
+         layout = self.layout
+         rd = context.scene.render
+         layout.active = rd.use_stamp
+         split = layout.split()
+         col = split.column()
+         col.prop(rd, "use_stamp_time", text="Time")
+         col.prop(rd, "use_stamp_date", text="Date")
+         col.prop(rd, "use_stamp_render_time", text="RenderTime")
+         col.prop(rd, "use_stamp_frame", text="Frame")
+         col.prop(rd, "use_stamp_scene", text="Scene")
+         col.prop(rd, "use_stamp_camera", text="Camera")
+         col.prop(rd, "use_stamp_lens", text="Lens")
+         col.prop(rd, "use_stamp_filename", text="Filename")
+         col.prop(rd, "use_stamp_marker", text="Marker")
+         col.prop(rd, "use_stamp_sequencer_strip", text="Seq. Strip")
+         col = split.column()
+         col.active = rd.use_stamp
+         col.prop(rd, "stamp_foreground", slider=True)
+         col.prop(rd, "stamp_background", slider=True)
+         col.separator()
+         col.prop(rd, "stamp_font_size", text="Font Size")
+         row = layout.split(percentage=0.2)
+         row.prop(rd, "use_stamp_note", text="Note")
+         sub = row.row()
+         sub.active = rd.use_stamp_note
+         sub.prop(rd, "stamp_note_text", text="")
  
  class RENDER_PT_output(RenderButtonsPanel, bpy.types.Panel):
      bl_label = "Output"
@@@ -906,29 -613,42 +905,42 @@@ class RENDER_PT_bake(RenderButtonsPanel
  
          layout.prop(rd, "bake_type")
  
 -            if rd.bake_type == 'NORMALS':
 -                layout.prop(rd, "bake_normal_space")
 -            elif rd.bake_type in {'DISPLACEMENT', 'AO'}:
 -                layout.prop(rd, "use_bake_normalize")
+         multires_bake = False
+         if rd.bake_type in ['NORMALS', 'DISPLACEMENT']:
+             layout.prop(rd, 'use_bake_multires')
+             multires_bake = rd.use_bake_multires
+         if not multires_bake:
 +        if rd.bake_type == 'NORMALS':
 +            layout.prop(rd, "bake_normal_space")
 +        elif rd.bake_type in {'DISPLACEMENT', 'AO'}:
 +            layout.prop(rd, "use_bake_normalize")
  
 -            # col.prop(rd, "bake_aa_mode")
 -            # col.prop(rd, "use_bake_antialiasing")
 +        # col.prop(rd, "bake_aa_mode")
 +        # col.prop(rd, "use_bake_antialiasing")
  
 -            layout.separator()
 +        layout.separator()
  
 -            split = layout.split()
 +        split = layout.split()
  
 -            col = split.column()
 -            col.prop(rd, "use_bake_clear")
 -            col.prop(rd, "bake_margin")
 -            col.prop(rd, "bake_quad_split", text="Split")
 +        col = split.column()
 +        col.prop(rd, "use_bake_clear")
 +        col.prop(rd, "bake_margin")
 +        col.prop(rd, "bake_quad_split", text="Split")
  
 -            col = split.column()
 -            col.prop(rd, "use_bake_selected_to_active")
 -            sub = col.column()
 -            sub.active = rd.use_bake_selected_to_active
 -            sub.prop(rd, "bake_distance")
 -            sub.prop(rd, "bake_bias")
 +        col = split.column()
 +        col.prop(rd, "use_bake_selected_to_active")
 +        sub = col.column()
 +        sub.active = rd.use_bake_selected_to_active
 +        sub.prop(rd, "bake_distance")
 +        sub.prop(rd, "bake_bias")
+         else:
+             if rd.bake_type == 'DISPLACEMENT':
+                 layout.prop(rd, "use_bake_lores_mesh")
+             layout.prop(rd, "use_bake_clear")
+             layout.prop(rd, "bake_margin")
  
  if __name__ == "__main__":  # only for live edit.
      bpy.utils.register_module(__name__)
Simple merge
index 7ade7a06ab55a22d4d8e3c345ef04f265489a54f,0c25da325ad55f0878fc1dd0a6bf824a96ea26ec..c6bd214a2f7217cec84dab02a1102d5cdfd94160
@@@ -32,9 -32,11 +32,12 @@@ set(IN
        ../gpu
        ../../../intern/ghost
        ../../../intern/guardedalloc
+ )
+ set(INC_SYS
        ${ZLIB_INCLUDE_DIRS}
        ${FREETYPE_INCLUDE_DIRS}
 +      ${ZLIB_INC}
  )
  
  set(SRC
index 34e6b7f1356aa06458dd829dd7a3031028a0e089,654ade8955f800325babc610b1a7c3c4f5c54649..98d53ca16dbaf11f52651b1b841eb5ccf52e2fc1
  #include "BKE_utildefines.h"
  #include "BKE_report.h"
  
- //XXX #include "BIF_screen.h" /* only for wait cursor */
- //
- /* for sequence */
- //XXX #include "BSE_sequence.h"
- //XXX define below from BSE_sequence.h - otherwise potentially odd behaviour
- typedef struct BPathIteratorSeqData {
+ typedef struct BPathIteratorSeqData
+ {
        int totseq;
        int seq;
 -      struct Sequence **seqar;        /* Sequence */
 -      struct Scene *scene;            /* Current scene */
 +      struct Sequence **seqar; /* Sequence */
 +      struct Scene *scene;                    /* Current scene */
  } BPathIteratorSeqData;
  
- typedef struct BPathIterator {
 +typedef struct BPathIteratorFrsModuleData {
 +      struct Scene *scene;                    /* Current scene */
 +      struct SceneRenderLayer *layer; /* Scene render layer */
 +      struct FreestyleModuleConfig *module;
 +} BPathIteratorFrsModuleData;
 +
+ typedef struct BPathIterator
+ {
        char*   _path; /* never access directly, use BLI_bpathIterator_getPath */
        const char*     _lib;
        const char*     _name;
@@@ -179,31 -158,37 +176,37 @@@ void BLI_bpathIterator_free(struct BPat
        MEM_freeN(bpi);
  }
  
- void BLI_bpathIterator_getPath( struct BPathIterator *bpi, char *path) {
+ void BLI_bpathIterator_getPath(struct BPathIterator *bpi, char *path)
+ {
        if (bpi->getpath_callback) {
 -              bpi->getpath_callback(bpi, path);
 +              bpi->getpath_callback( bpi, path );
-       } else {
+       }
+       else {
                strcpy(path, bpi->_path); /* warning, we assume 'path' are long enough */
        }
  }
  
- void BLI_bpathIterator_setPath( struct BPathIterator *bpi, const char *path) {
+ void BLI_bpathIterator_setPath(struct BPathIterator *bpi, const char *path)
+ {
        if (bpi->setpath_callback) {
 -              bpi->setpath_callback(bpi, path);
 +              bpi->setpath_callback( bpi, path );
-       } else {
+       }
+       else {
                strcpy(bpi->_path, path); /* warning, we assume 'path' are long enough */
        }
  }
  
- void BLI_bpathIterator_getPathExpanded( struct BPathIterator *bpi, char *path_expanded) {
+ void BLI_bpathIterator_getPathExpanded(struct BPathIterator *bpi, char *path_expanded)
+ {
        const char *libpath;
 -
 +      
        BLI_bpathIterator_getPath(bpi, path_expanded);
        libpath= BLI_bpathIterator_getLib(bpi);
 -
 +      
        if (libpath) { /* check the files location relative to its library path */
                BLI_path_abs(path_expanded, libpath);
-       } else { /* local data, use the blend files path */
+       }
+       else { /* local data, use the blend files path */
                BLI_path_abs(path_expanded, bpi->base_path);
        }
        BLI_cleanup_file(NULL, path_expanded);
@@@ -341,10 -331,11 +349,11 @@@ static struct Sequence *seq_stepdata__i
                                seq_array(ed, &bpi->seqdata.seqar, &bpi->seqdata.totseq, 0);
                                bpi->seqdata.seq= 0;
                        }
 -
 +                      
                        if (bpi->seqdata.seq >= bpi->seqdata.totseq) {
                                seq= NULL;
-                       } else {
+                       }
+                       else {
                                seq= bpi->seqdata.seqar[bpi->seqdata.seq];
                                while (!SEQ_HAS_PATH(seq) && seq->plugin==NULL) {
                                        bpi->seqdata.seq++;
@@@ -403,10 -367,11 +414,11 @@@ static struct FreestyleModuleConfig *fr
        return NULL;
  }
  
- static void seq_getpath(struct BPathIterator *bpi, char *path) {
+ static void seq_getpath(struct BPathIterator *bpi, char *path)
+ {
        Sequence *seq= (Sequence *)bpi->data;
  
 -
 +      
        path[0]= '\0'; /* incase we cant get the path */
        if (seq==NULL) return;
        if (SEQ_HAS_PATH(seq)) {
        }
  }
  
- static void seq_setpath(struct BPathIterator *bpi, const char *path) {
+ static void seq_setpath(struct BPathIterator *bpi, const char *path)
+ {
        Sequence *seq= (Sequence *)bpi->data;
 -      if (seq==NULL) return;
 -
 +      if (seq==NULL) return; 
 +      
        if (SEQ_HAS_PATH(seq)) {
                if (ELEM3(seq->type, SEQ_IMAGE, SEQ_MOVIE, SEQ_SOUND)) {
                        BLI_split_dirfile(path, seq->strip->dir, seq->strip->stripdata->name);
@@@ -454,9 -421,10 +468,10 @@@ static void text_getpath(struct BPathIt
        }
  }
  
- static void text_setpath(struct BPathIterator *bpi, const char *path) {
+ static void text_setpath(struct BPathIterator *bpi, const char *path)
+ {
        Text *text= (Text *)bpi->data;
 -      if (text==NULL) return;
 +      if (text==NULL) return; 
  
        if(text->name) {
                MEM_freeN(text->name);
        text->name= BLI_strdup(path);
  }
  
- static struct Mesh *cdata_stepdata__internal(struct Mesh *me, int step_next) {
+ static struct Mesh *cdata_stepdata__internal(struct Mesh *me, int step_next)
+ {
        if (me==NULL)
                return NULL;
 -
 +      
        if (step_next)
                me= me->id.next;
 -
 +      
        while (me) {
                if (me->fdata.external) {
                        break;
        return me;
  }
  
- static void bpi_type_step__internal( struct BPathIterator *bpi) {
+ static void bpi_type_step__internal(struct BPathIterator *bpi)
+ {
        bpi->type++; /* advance to the next type */
        bpi->data= NULL;
 -
 +      
        switch (bpi->type) {
        case BPATH_SEQ:
                bpi->getpath_callback= seq_getpath;
        }
  }
  
- void BLI_bpathIterator_step( struct BPathIterator *bpi) {
+ void BLI_bpathIterator_step(struct BPathIterator *bpi)
+ {
        while (bpi->type != BPATH_DONE) {
 -
 +              
                if  ((bpi->type) == BPATH_IMAGE) {
                        /*if (bpi->data)        bpi->data= ((ID *)bpi->data)->next;*/
                        if (bpi->data)  bpi->data= ima_stepdata__internal((Image *)bpi->data, 1, bpi->flag); /* must skip images that have no path */
  
                                /* we are done, advancing to the next item, this type worked fine */
                                break;
-                       } else {
+                       }
+                       else {
                                bpi_type_step__internal(bpi);
                        }
-                       
-                       
-               } else if  ((bpi->type) == BPATH_FONT) {
+               }
+               else if  ((bpi->type) == BPATH_FONT) {
 -
 +                      
                        if (bpi->data)  bpi->data= vf_stepdata__internal((VFont *)bpi->data, 1, bpi->flag);
                        else                    bpi->data= vf_stepdata__internal(bpi->bmain->vfont.first, 0, bpi->flag);
 -
 +                      
                        if (bpi->data) {
                                /* get the path info from this datatype */
                                VFont *vf= (VFont *)bpi->data;
                                bpi_type_step__internal(bpi);
                        }
  
-               } else if  ((bpi->type) == BPATH_LIB) {
+               }
+               else if  ((bpi->type) == BPATH_LIB) {
                        if (bpi->data)  bpi->data= ((ID *)bpi->data)->next;
                        else                    bpi->data= bpi->bmain->library.first;
 -
 +                      
                        if (bpi->data) {
                                /* get the path info from this datatype */
                                Library *lib= (Library *)bpi->data;
                                bpi->_path= lib->name;
                                bpi->_name= NULL;
                                bpi->len= sizeof(lib->name);
 -
 +                              
                                /* we are done, advancing to the next item, this type worked fine */
                                break;
-                       } else {
+                       }
+                       else {
                                bpi_type_step__internal(bpi);
                        }
-               } else if  ((bpi->type) == BPATH_SEQ) {
+               }
+               else if  ((bpi->type) == BPATH_SEQ) {
                        if (bpi->data)  bpi->data= seq_stepdata__internal( bpi, 1 );
                        else                    bpi->data= seq_stepdata__internal( bpi, 0 );
                        if (bpi->data) {
                                bpi->_name= me->id.name+2;
                                bpi->len= sizeof(me->fdata.external->filename);
                                break;
-                       } else {
+                       }
+                       else {
                                bpi_type_step__internal(bpi);
                        }
 +              } else if  ((bpi->type) == BPATH_FRS_MODULE) {
 +                      if (bpi->data)  bpi->data= frs_module_stepdata__internal( bpi, 1 );
 +                      else                    bpi->data= frs_module_stepdata__internal( bpi, 0 );
 +
 +                      if (bpi->data) {
 +                              FreestyleModuleConfig *module= (FreestyleModuleConfig *)bpi->data;
 +                              bpi->_lib= NULL;
 +                              bpi->_path= module->module_path;
 +                              bpi->_name= NULL;
 +                              bpi->len= sizeof(module->module_path);
 +                              break;
 +                      } else {
 +                              bpi_type_step__internal(bpi);
 +                      }
                }
        }
  }
@@@ -777,10 -740,11 +804,11 @@@ void makeFilesRelative(Main *bmain, con
                if(strncmp(filepath, "//", 2)) {
                        if (libpath) { /* cant make relative if we are library - TODO, LOG THIS */
                                linked++;
-                       } else { /* local data, use the blend files path */
+                       }
+                       else { /* local data, use the blend files path */
                                BLI_strncpy(filepath_relative, filepath, sizeof(filepath_relative));
                                /* Important BLI_cleanup_dir runs before the path is made relative
 -                               * because it wont work for paths that start with "//../" */
 +                               * because it wont work for paths that start with "//../" */ 
                                BLI_cleanup_file(bpi->base_path, filepath_relative); /* fix any /foo/../foo/ */
                                BLI_path_rel(filepath_relative, bpi->base_path);
                                /* be safe and check the length */
@@@ -956,12 -926,13 +990,13 @@@ void findMissingFiles(Main *bmain, cons
                                        printf("Could not open dir \"%s\"\n", dirname);
                                        return;
                                }
 -
 +                              
                                if (filesize > 0) {
 -
 -                                      if (BLI_bpathIterator_getPathMaxLen(bpi) < strlen(filename_new)) {
 +                                      
 +                                      if (BLI_bpathIterator_getPathMaxLen(bpi) < strlen(filename_new)) { 
                                                printf("cannot set path \"%s\" too long!", filename_new);
-                                       } else {
+                                       }
+                                       else {
                                                /* copy the found path into the old one */
                                                if (G.relbase_valid)
                                                        BLI_path_rel(filename_new, bpi->base_path);
index 032737c400e0df3db76020d903173951bf463798,c3bb6f457a26c0acebab9febe6c340c5044cf6af..29a62fbb6219d580e1b19c52c20c28a67f85ec4c
@@@ -32,8 -32,10 +32,11 @@@ set(IN
        ../../render/extern/include
        ../../windowmanager
        ../../../../intern/guardedalloc
+ )
+ set(INC_SYS
        ${GLEW_INCLUDE_PATH}
 +      ../../freestyle
  )
  
  set(SRC
index 96c78f4b632f9393776bddddf64ee2f8f249bd94,181fb0f0aac2b4a508d43c89b3317318209b2ac5..eba7f67f2fa3fe8d4ffed63e6ce7c6c722972633
@@@ -564,8 -566,10 +566,7 @@@ int transformEvent(TransInfo *t, wmEven
  
        if (event->type == MOUSEMOVE)
        {
-               t->mval[0] = event->x - t->ar->winrct.xmin;
-               t->mval[1] = event->y - t->ar->winrct.ymin;
 -              if (t->modifiers & MOD_CONSTRAINT_SELECT)
 -                      t->con.mode |= CON_SELECT;
 -
+               VECCOPY2D(t->mval, event->mval);
  
                // t->redraw |= TREDRAW_SOFT; /* Use this for soft redraw. Might cause flicker in object mode */
                t->redraw |= TREDRAW_HARD;
index a4a94883b01366a463b0dc90c1068ecdd5b020b7,0000000000000000000000000000000000000000..0bbccd0fca46252b2a8fee0a4c6be1f4d2521d91
mode 100644,000000..100644
--- /dev/null
@@@ -1,42 -1,0 +1,45 @@@
-       set(INC ${INC} ${PTHREADS_INC})
 +# $Id: CMakeLists.txt 14444 2008-04-16 22:40:48Z hos $
 +# ***** BEGIN GPL LICENSE BLOCK *****
 +#
 +# This program is free software; you can redistribute it and/or
 +# modify it under the terms of the GNU General Public License
 +# as published by the Free Software Foundation; either version 2
 +# of the License, or (at your option) any later version.
 +#
 +# This program is distributed in the hope that it will be useful,
 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 +# GNU General Public License for more details.
 +#
 +# You should have received a copy of the GNU General Public License
 +# along with this program; if not, write to the Free Software Foundation,
 +# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 +#
 +# The Original Code is Copyright (C) 2006, Blender Foundation
 +# All rights reserved.
 +#
 +# The Original Code is: all of this file.
 +#
 +# Contributor(s): Jacques Beaurain.
 +#
 +# ***** END GPL LICENSE BLOCK *****
 +
 +file(GLOB_RECURSE SRC *.cpp *.h)
 +
 +set(INC 
 +  ../blenkernel ../blenloader ../blenlib ../imbuf ../makesdna ../makesrna
 +  ../python ../python/intern
 +  ../render/extern/include ../render/intern/include ../include ../src
 +  ../../../extern/glew/include ../../../intern/guardedalloc ../freestyle
++)
++
++set(INC_SYS
 +  ${PYTHON_INCLUDE_DIRS}
 +  ${PNG_INC}
 +)
 +
 +if(WIN32)
- blender_add_lib(bf_freestyle "${SRC}" "${INC}")
++  set(INC_SYS ${INC_SYS} ${PTHREADS_INC})
 +endif(WIN32)
 +
++blender_add_lib(bf_freestyle "${SRC}" "${INC}" "${INC_SYS}")
index 7157d7a89aa786e7e1d4b41270b3a2af395e1b8e,0000000000000000000000000000000000000000..fe6a8fb5e53b473bade62636b12240b4a3aa7edb
mode 100755,000000..100755
--- /dev/null
@@@ -1,92 -1,0 +1,92 @@@
-       setRootDir( BLI_get_folder(BLENDER_SCRIPTS, NULL) );
 +//
 +//  Copyright (C) : Please refer to the COPYRIGHT file distributed 
 +//   with this source distribution. 
 +//
 +//  This program is free software; you can redistribute it and/or
 +//  modify it under the terms of the GNU General Public License
 +//  as published by the Free Software Foundation; either version 2
 +//  of the License, or (at your option) any later version.
 +//
 +//  This program is distributed in the hope that it will be useful,
 +//  but WITHOUT ANY WARRANTY; without even the implied warranty of
 +//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 +//  GNU General Public License for more details.
 +//
 +//  You should have received a copy of the GNU General Public License
 +//  along with this program; if not, write to the Free Software
 +//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 +//
 +///////////////////////////////////////////////////////////////////////////////
 +
 +#include "AppConfig.h"
 +#include <iostream>
 +
 +#include "../system/StringUtils.h"
 +using namespace std;
 +
 +extern "C" {
 +      #include "BLI_path_util.h"
 +}
 +
 +namespace Config {
 +Path* Path::_pInstance = 0;
 +Path::Path() {
 +      // get the root directory
 +      //soc
++      setRootDir( BLI_get_folder(BLENDER_SYSTEM_SCRIPTS, NULL) );
 +
 +      _pInstance = this;
 +}
 +void Path::setRootDir(const string& iRootDir) {
 +      _ProjectDir = iRootDir + string(DIR_SEP.c_str()) + "freestyle";
 +      _ModelsPath = "";
 +      _PatternsPath = _ProjectDir + string(DIR_SEP.c_str()) + "data"
 +                      + string(DIR_SEP.c_str()) + "textures" + string(DIR_SEP.c_str())
 +                      + "variation_patterns" + string(DIR_SEP.c_str());
 +      _BrushesPath = _ProjectDir + string(DIR_SEP.c_str()) + "data"
 +                      + string(DIR_SEP.c_str()) + "textures" + string(DIR_SEP.c_str())
 +                      + "brushes" + string(DIR_SEP.c_str());
 +      _PythonPath = _ProjectDir + string(DIR_SEP.c_str())
 ++ "style_modules" + string(DIR_SEP.c_str()) ;
 +      if (getenv("PYTHONPATH")) {
 +              _PythonPath += string(PATH_SEP.c_str()) + string(getenv("PYTHONPATH"));
 +      }
 +#ifdef WIN32
 +      _BrowserCmd = "C:\\Program Files\\Internet Explorer\\iexplore.exe %s";
 +#else
 +      _BrowserCmd = "mozilla %s";
 +#endif
 +      _HelpIndexPath = _ProjectDir + string(DIR_SEP.c_str()) + "doc"
 +                      + string(DIR_SEP.c_str()) + "html" + string(DIR_SEP.c_str())
 +                      + "index.html";
 +      _EnvMapDir = _ProjectDir + string(DIR_SEP.c_str()) + "data"
 +                      + string(DIR_SEP.c_str()) + "env_map" + string(DIR_SEP.c_str());
 +      _MapsDir = _ProjectDir + string(DIR_SEP.c_str()) + "data"
 +                      + string(DIR_SEP.c_str()) + "maps" + string(DIR_SEP.c_str());
 +}
 +void Path::setHomeDir(const string& iHomeDir) {
 +      _HomeDir = iHomeDir;
 +}
 +Path::~Path() {
 +      _pInstance = 0;
 +}
 +Path* Path::getInstance() {
 +      return _pInstance;
 +}
 +string Path::getEnvVar(const string& iEnvVarName) {
 +      string value;
 +      if (!getenv(StringUtils::toAscii(iEnvVarName).c_str() ) ) {
 +              cerr << "Warning: You may want to set the $"
 +                              << StringUtils::toAscii(iEnvVarName)
 +                              << " environment variable to use Freestyle." << endl
 +                              << "         Otherwise, the current directory will be used instead."
 +                              << endl;
 +              value = ".";
 +      } else {
 +              value = getenv(StringUtils::toAscii(iEnvVarName).c_str() );
 +      }
 +      return value;
 +}
 +
 +} // End of namepace Config
 +
index 7d52b92f7c6642e7dabd83a0a561b3342cd9d6f8,0000000000000000000000000000000000000000..c2d190d9ff1dd4aa4fd9493e7257b7b1dda7479d
mode 100644,000000..100644
--- /dev/null
@@@ -1,367 -1,0 +1,366 @@@
-       strcpy(freestyle_scene->r.backbuf, old_scene->r.backbuf);
 +# include "BlenderStrokeRenderer.h"
 +# include "../stroke/Canvas.h"
 +# include "../application/AppConfig.h"
 +
 +# include "BlenderTextureManager.h"
 +
 +#ifdef __cplusplus
 +extern "C" {
 +#endif
 +
 +#include "MEM_guardedalloc.h"
 +
 +#include "DNA_camera_types.h"
 +#include "DNA_customdata_types.h"
 +#include "DNA_listBase.h"
 +#include "DNA_mesh_types.h"
 +#include "DNA_meshdata_types.h"
 +#include "DNA_object_types.h"
 +#include "DNA_screen_types.h"
 +
 +#include "BKE_customdata.h"
 +#include "BKE_global.h"
 +#include "BKE_library.h" /* free_libblock */
 +#include "BKE_material.h"
 +#include "BKE_main.h" /* struct Main */
 +#include "BKE_object.h"
 +#include "BKE_scene.h"
 +
 +#include "RE_pipeline.h"
 +
 +#ifdef __cplusplus
 +}
 +#endif
 +
 +
 +BlenderStrokeRenderer::BlenderStrokeRenderer(Render* re, int render_count)
 +:StrokeRenderer(){
 +      
 +      // TEMPORARY - need a  texture manager
 +      _textureManager = new BlenderTextureManager;
 +      _textureManager->load();
 +
 +      // Scene.New("FreestyleStrokes")
 +      old_scene = re->scene;
 +
 +      char name[22];
 +      snprintf(name, sizeof(name), "FRS%d_%s", render_count, re->scene->id.name+2);
 +      freestyle_scene = add_scene(name);
 +      freestyle_scene->r.cfra = old_scene->r.cfra;
 +      freestyle_scene->r.mode= old_scene->r.mode;
 +      freestyle_scene->r.xsch= old_scene->r.xsch;
 +      freestyle_scene->r.ysch= old_scene->r.ysch;
 +      freestyle_scene->r.xasp= old_scene->r.xasp;
 +      freestyle_scene->r.yasp= old_scene->r.yasp;
 +      freestyle_scene->r.xparts= old_scene->r.xparts;
 +      freestyle_scene->r.yparts= old_scene->r.yparts;
 +      freestyle_scene->r.size= old_scene->r.size;
 +      freestyle_scene->r.maximsize= old_scene->r.maximsize;
 +      freestyle_scene->r.ocres = old_scene->r.ocres;
 +      freestyle_scene->r.color_mgt_flag = old_scene->r.color_mgt_flag;
 +      freestyle_scene->r.scemode= old_scene->r.scemode;
 +      freestyle_scene->r.flag= old_scene->r.flag;
 +      freestyle_scene->r.threads= old_scene->r.threads;
 +      freestyle_scene->r.border.xmin= old_scene->r.border.xmin;
 +      freestyle_scene->r.border.ymin= old_scene->r.border.ymin;
 +      freestyle_scene->r.border.xmax= old_scene->r.border.xmax;
 +      freestyle_scene->r.border.ymax= old_scene->r.border.ymax;
 +      strcpy(freestyle_scene->r.pic, old_scene->r.pic);
 +      freestyle_scene->r.safety.xmin= old_scene->r.safety.xmin;
 +      freestyle_scene->r.safety.ymin= old_scene->r.safety.ymin;
 +      freestyle_scene->r.safety.xmax= old_scene->r.safety.xmax;
 +      freestyle_scene->r.safety.ymax= old_scene->r.safety.ymax;
 +      freestyle_scene->r.osa= old_scene->r.osa;
 +      freestyle_scene->r.filtertype= old_scene->r.filtertype;
 +      freestyle_scene->r.gauss= old_scene->r.gauss;
 +      freestyle_scene->r.dither_intensity= old_scene->r.dither_intensity;
 +      BLI_strncpy(freestyle_scene->r.engine, old_scene->r.engine, sizeof(freestyle_scene->r.engine));
 +      set_scene_bg( G.main, freestyle_scene );
 +
 +      // image dimensions
 +      float ycor = ((float)re->r.yasp) / ((float)re->r.xasp);
 +      float width = freestyle_scene->r.xsch;
 +      float height = freestyle_scene->r.ysch * ycor;
 +
 +      // Camera
 +      Object* object_camera = add_object(freestyle_scene, OB_CAMERA);
 +      
 +      Camera* camera = (Camera *) object_camera->data;
 +      camera->type = CAM_ORTHO;
 +      camera->ortho_scale = max(width,height);
 +    camera->clipsta = 0.1f;
 +    camera->clipend = 100.0f;
 +
 +    _z_delta = 0.00001f;
 +    _z = camera->clipsta + _z_delta;
 +
 +    // test
 +    //_z = 999.90f; _z_delta = 0.01f;
 +      
 +      object_camera->loc[0] = 0.5 * width;
 +      object_camera->loc[1] = 0.5 * height;
 +      object_camera->loc[2] = 1.0;
 +      
 +      freestyle_scene->camera = object_camera;
 +      
 +      // Material
 +      material = add_material("stroke_material");
 +      material->mode |= MA_VERTEXCOLP;
 +      material->mode |= MA_TRANSP;
 +      material->mode |= MA_SHLESS;
 +      material->vcol_alpha = 1;
 +}
 +
 +BlenderStrokeRenderer::~BlenderStrokeRenderer(){
 +      
 +      if(0 != _textureManager)
 +      {
 +              delete _textureManager;
 +              _textureManager = 0;
 +      }
 +
 +      // The freestyle_scene object is not released here.  Instead,
 +      // the scene is released in free_all_freestyle_renders() in
 +      // source/blender/render/intern/source/pipeline.c, after the
 +      // compositor has finished.
 +
 +      // release objects and data blocks
 +      Base *b = (Base *)freestyle_scene->base.first;
 +      while(b) {
 +              Object *ob = b->object;
 +              void *data = ob->data;
 +              char name[24];
 +              strcpy(name, ob->id.name);
 +              //cout << "removing " << name[0] << name[1] << ":" << (name+2) << endl;
 +              switch (ob->type) {
 +              case OB_MESH:
 +                      free_libblock( &G.main->object, ob );
 +                      free_libblock( &G.main->mesh, data );
 +                      break;
 +              case OB_CAMERA:
 +                      free_libblock( &G.main->object, ob );
 +                      free_libblock( &G.main->camera, data );
 +                      freestyle_scene->camera = NULL;
 +                      break;
 +              default:
 +                      cerr << "Warning: unexpected object in the scene: " << name[0] << name[1] << ":" << (name+2) << endl;
 +              }
 +              b = b->next;
 +      }
 +      BLI_freelistN( &freestyle_scene->base );
 +
 +      // release material
 +      free_libblock( &G.main->mat, material );
 +      
 +      set_scene_bg( G.main, old_scene );
 +}
 +
 +float BlenderStrokeRenderer::get_stroke_vertex_z(void) const {
 +    float z = _z;
 +    BlenderStrokeRenderer *self = const_cast<BlenderStrokeRenderer *>(this);
 +    if (!(_z < _z_delta * 100000.0f))
 +        self->_z_delta *= 10.0f;
 +    self->_z += _z_delta;
 +    return -z;
 +}
 +
 +void BlenderStrokeRenderer::RenderStrokeRep(StrokeRep *iStrokeRep) const{
 +  RenderStrokeRepBasic(iStrokeRep);
 +}
 +
 +void BlenderStrokeRenderer::RenderStrokeRepBasic(StrokeRep *iStrokeRep) const{
 +      
 +      ////////////////////
 +      //  Build up scene
 +      ////////////////////
 +      
 +        vector<Strip*>& strips = iStrokeRep->getStrips();
 +        Strip::vertex_container::iterator v[3];
 +        StrokeVertexRep *svRep[3];
 +        Vec3r color[3];
 +        unsigned int vertex_index;
 +        float ycor = ((float)freestyle_scene->r.yasp) / ((float)freestyle_scene->r.xasp);
 +        float width = freestyle_scene->r.xsch;
 +        float height = freestyle_scene->r.ysch * ycor;
 +        Vec2r p;
 +      
 +        for(vector<Strip*>::iterator s=strips.begin(), send=strips.end();
 +        s!=send;
 +        ++s){         
 +              
 +          Strip::vertex_container& strip_vertices = (*s)->vertices();
 +              int strip_vertex_count = (*s)->sizeStrip();
 +              int m, n, visible_faces, visible_segments;
 +              bool visible;
 +
 +              // iterate over all vertices and count visible faces and strip segments
 +              // (note: a strip segment is a series of visible faces, while two strip
 +              // segments are separated by one or more invisible faces)
 +              v[0] = strip_vertices.begin();
 +          v[1] = v[0]; ++(v[1]);
 +          v[2] = v[1]; ++(v[2]);
 +              visible_faces = visible_segments = 0;
 +              visible = false;
 +          for (n = 2; n < strip_vertex_count; n++)
 +              {
 +                      svRep[0] = *(v[0]);
 +                      svRep[1] = *(v[1]);
 +                      svRep[2] = *(v[2]);
 +                      m = 0;
 +                      for (int j = 0; j < 3; j++) {
 +                              p = svRep[j]->point2d();
 +                              if (p[0] < 0.0 || p[0] > width || p[1] < 0.0 || p[1] > height)
 +                                      m++;
 +                      }
 +                      if (m == 3) {
 +                              visible = false;
 +                      } else {
 +                              visible_faces++;
 +                              if (!visible)
 +                                      visible_segments++;
 +                              visible = true;
 +                      }
 +                      ++v[0]; ++v[1]; ++v[2];
 +              }
 +              if (visible_faces == 0)
 +                      continue;
 +
 +              // me = Mesh.New()
 +              Object* object_mesh = add_object(freestyle_scene, OB_MESH);
 +              Mesh* mesh = (Mesh *) object_mesh->data;
 +              MEM_freeN(mesh->bb);
 +              mesh->bb= NULL;
 +              mesh->id.us = 0;
 +              
 +#if 1
 +              // me.materials = [mat]
 +              mesh->mat = ( Material ** ) MEM_mallocN( 1 * sizeof( Material * ), "MaterialList" );
 +              mesh->mat[0] = material;
 +              mesh->totcol = 1;
 +              test_object_materials( (ID*) mesh );
 +#else
 +              assign_material(object_mesh, material, object_mesh->totcol+1);
 +              object_mesh->actcol= object_mesh->totcol;
 +#endif
 +              
 +              // vertices allocation
 +              mesh->totvert = visible_faces + visible_segments * 2;
 +              mesh->mvert = (MVert*) CustomData_add_layer( &mesh->vdata, CD_MVERT, CD_CALLOC, NULL, mesh->totvert);
 +                      
 +              // faces allocation
 +              mesh->totface = visible_faces;
 +              mesh->mface = (MFace*) CustomData_add_layer( &mesh->fdata, CD_MFACE, CD_CALLOC, NULL, mesh->totface);
 +              
 +              // colors allocation  - me.vertexColors = True
 +              mesh->mcol = (MCol *) CustomData_add_layer( &mesh->fdata, CD_MCOL, CD_CALLOC, NULL, mesh->totface );
 +
 +              ////////////////////
 +              //  Data copy
 +              ////////////////////
 +              
 +              MVert* vertices = mesh->mvert;
 +              MFace* faces = mesh->mface;
 +              MCol* colors = mesh->mcol;
 +              
 +          v[0] = strip_vertices.begin();
 +          v[1] = v[0]; ++(v[1]);
 +          v[2] = v[1]; ++(v[2]);
 +
 +              vertex_index = 0;
 +              visible = false;
 +              
 +          for (n = 2; n < strip_vertex_count; n++)
 +              {
 +                      svRep[0] = *(v[0]);
 +                      svRep[1] = *(v[1]);
 +                      svRep[2] = *(v[2]);
 +                      m = 0;
 +                      for (int j = 0; j < 3; j++) {
 +                              p = svRep[j]->point2d();
 +                              if (p[0] < 0.0 || p[0] > width || p[1] < 0.0 || p[1] > height)
 +                                      m++;
 +                      }
 +                      if (m == 3) {
 +                              visible = false;
 +                      } else {
 +                              if (!visible) {
 +                                      vertex_index += 2;
 +
 +                                      // first vertex
 +                                      vertices->co[0] = svRep[0]->point2d()[0];
 +                                      vertices->co[1] = svRep[0]->point2d()[1];
 +                                      vertices->co[2] = get_stroke_vertex_z();
 +                                      ++vertices;
 +                                      
 +                                      // second vertex
 +                                      vertices->co[0] = svRep[1]->point2d()[0];
 +                                      vertices->co[1] = svRep[1]->point2d()[1];
 +                                      vertices->co[2] = get_stroke_vertex_z();
 +                                      ++vertices;
 +                              }
 +                              visible = true;
 +
 +                              // vertex
 +                              vertices->co[0] = svRep[2]->point2d()[0];
 +                              vertices->co[1] = svRep[2]->point2d()[1];
 +                              vertices->co[2] = get_stroke_vertex_z();
 +                              
 +                              // faces
 +                              faces->v1 = vertex_index - 2;
 +                              faces->v2 = vertex_index - 1;
 +                              faces->v3 = vertex_index;
 +                              faces->v4 = 0;
 +                              
 +                              // colors
 +                              // red and blue are swapped - cf DNA_meshdata_types.h : MCol    
 +                              color[0] = svRep[0]->color();
 +                              color[1] = svRep[1]->color();
 +                              color[2] = svRep[2]->color();
 +
 +                              colors->r = (short)(255.0f*(color[0])[2]);
 +                              colors->g = (short)(255.0f*(color[0])[1]);
 +                              colors->b = (short)(255.0f*(color[0])[0]);
 +                              colors->a = (short)(255.0f*svRep[0]->alpha());
 +                              ++colors;
 +                              
 +                              colors->r = (short)(255.0f*(color[1])[2]);
 +                              colors->g = (short)(255.0f*(color[1])[1]);
 +                              colors->b = (short)(255.0f*(color[1])[0]);
 +                              colors->a = (short)(255.0f*svRep[1]->alpha());
 +                              ++colors;
 +                              
 +                              colors->r = (short)(255.0f*(color[2])[2]);
 +                              colors->g = (short)(255.0f*(color[2])[1]);
 +                              colors->b = (short)(255.0f*(color[2])[0]);
 +                              colors->a = (short)(255.0f*svRep[2]->alpha());
 +                              ++colors;
 +
 +                              ++faces; ++vertices; ++colors;
 +                              ++vertex_index;
 +                      }
 +                      ++v[0]; ++v[1]; ++v[2];
 +
 +              } // loop over strip vertices 
 +      
 +      } // loop over strips   
 +
 +}
 +
 +Render* BlenderStrokeRenderer::RenderScene( Render *re ) {
 +    Camera *camera = (Camera *)freestyle_scene->camera->data;
 +    if (camera->clipend < _z)
 +        camera->clipend = _z + _z_delta * 100.0f;
 +    //cout << "clipsta " << camera->clipsta << ", clipend " << camera->clipend << endl;
 +
 +      freestyle_scene->r.mode &= ~( R_EDGE_FRS | R_SHADOW | R_SSS | R_PANORAMA | R_ENVMAP | R_MBLUR );
 +      freestyle_scene->r.scemode &= ~( R_SINGLE_LAYER );
 +      freestyle_scene->r.planes = R_PLANES32;
 +      freestyle_scene->r.imtype = R_PNG;
 +      if (freestyle_scene->r.mode & R_BORDER)
 +              freestyle_scene->r.mode |= R_CROP;
 +      
 +      Render *freestyle_render = RE_NewRender(freestyle_scene->id.name);
 +
 +      RE_RenderFreestyleStrokes(freestyle_render, G.main, freestyle_scene);
 +      return freestyle_render;
 +}
Simple merge
index 0126c62cceacc7dd12c9326009935ad842b3f83c,fc415dc80827a19167650bdc33e09f66c7a963fb..867c49ebe45d28a6d57076c10336e4abca2e91d9
@@@ -110,15 -110,12 +110,16 @@@ extern EnumPropertyItem node_filter_ite
  
  extern EnumPropertyItem ramp_blend_items[];
  
 +extern EnumPropertyItem linestyle_color_modifier_type_items[];
 +extern EnumPropertyItem linestyle_alpha_modifier_type_items[];
 +extern EnumPropertyItem linestyle_thickness_modifier_type_items[];
 +
  struct bContext;
  struct PointerRNA;
- EnumPropertyItem *rna_TransformOrientation_itemf(struct bContext *C, struct PointerRNA *ptr, int *free);
- EnumPropertyItem *rna_Sensor_type_itemf(struct bContext *C, struct PointerRNA *ptr, int *free);
- EnumPropertyItem *rna_Actuator_type_itemf(struct bContext *C, struct PointerRNA *ptr, int *free);
+ struct PropertyRNA;
+ EnumPropertyItem *rna_TransformOrientation_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
+ EnumPropertyItem *rna_Sensor_type_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
+ EnumPropertyItem *rna_Actuator_type_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
  
  /* Generic functions, return an enum from library data, index is the position
   * in the linked list can add more for different types as needed */
index 30e3d5a1052447b0d6fb6642d3c289eb1deca4bc,454a706a16b3f5fd4c443926ba0db158215030df..0233f85ae9199c2ec2ccfb1ebf57d1b3314ef598
@@@ -32,9 -32,11 +32,12 @@@ set(IN
        ../../blenloader
        ../../windowmanager
        ../../editors/include
 +      ../../freestyle/intern/python
        ../../../../intern/guardedalloc
        ../../../../intern/audaspace/intern
+ )
+ set(INC_SYS
        ${PYTHON_INCLUDE_DIRS}
  )
  
index e43d3a8e98c5a48610f730f1d2bec3bcbe320610,cb11b53c83c5873758cc9f7a136c6a32a41c8d2a..ce548af378020ae42288ecfd5e0bccf2be1ec97b
  
  #include "AUD_PyInit.h"
  
 +#include "BPy_Freestyle.h"
 +
  PyObject *bpy_package_py= NULL;
  
- static char bpy_script_paths_doc[] =
+ PyDoc_STRVAR(bpy_script_paths_doc,
  ".. function:: script_paths()\n"
  "\n"
  "   Return 2 paths to blender scripts directories.\n"
index a05121471e5d863e8b30da355f804c2c9d7f7571,aea377a35bb277145d533d5199672f3a2b27c23c..02ccac98ee172a1e8a848f44caef7da9a3572b92
@@@ -39,9 -39,12 +39,13 @@@ set(IN
        ../../../intern/smoke/extern
        ../../../intern/mikktspace
        ../../../intern/guardedalloc
 +      ../freestyle
  )
  
+ set(INC_SYS
+ )
  set(SRC
        intern/raytrace/rayobject.cpp
        intern/raytrace/rayobject_empty.cpp
Simple merge
Simple merge