Merged changes in the trunk up to revision 45308.
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Sat, 31 Mar 2012 22:09:43 +0000 (22:09 +0000)
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Sat, 31 Mar 2012 22:09:43 +0000 (22:09 +0000)
Conflicts resolved:
source/blender/editors/interface/resources.c
source/blender/editors/mesh/editmesh_select.c
source/blender/editors/space_view3d/drawobject.c

41 files changed:
1  2 
build_files/scons/tools/Blender.py
doc/python_api/sphinx_doc_gen.py
release/scripts/startup/bl_ui/space_view3d.py
source/blender/blenkernel/CMakeLists.txt
source/blender/blenkernel/intern/anim_sys.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/material.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/subsurf_ccg.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/bmesh/operators/bmo_utils.c
source/blender/editors/animation/anim_channels_defines.c
source/blender/editors/animation/anim_channels_edit.c
source/blender/editors/animation/anim_filter.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/interface/resources.c
source/blender/editors/mesh/editmesh_select.c
source/blender/editors/mesh/editmesh_tools.c
source/blender/editors/mesh/mesh_intern.h
source/blender/editors/mesh/mesh_ops.c
source/blender/editors/render/render_shading.c
source/blender/editors/space_nla/nla_channels.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_orientations.c
source/blender/makesdna/intern/makesdna.c
source/blender/makesrna/intern/makesrna.c
source/blender/makesrna/intern/rna_action.c
source/blender/makesrna/intern/rna_color.c
source/blender/makesrna/intern/rna_mesh.c
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_userdef.c
source/blender/python/intern/bpy.c
source/blender/render/extern/include/RE_pipeline.h
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/pipeline.c
source/blender/windowmanager/intern/wm_files.c
source/blenderplayer/bad_level_call_stubs/stubs.c
source/creator/CMakeLists.txt
source/creator/creator.c

Simple merge
Simple merge
@@@ -102,377 -102,373 +102,377 @@@ const unsigned char *UI_ThemeGetColorPt
                }
                else {
                
-                       switch(spacetype) {
-                       case SPACE_BUTS:
-                               ts= &btheme->tbuts;
-                               break;
-                       case SPACE_VIEW3D:
-                               ts= &btheme->tv3d;
-                               break;
-                       case SPACE_IPO:
-                               ts= &btheme->tipo;
-                               break;
-                       case SPACE_FILE:
-                               ts= &btheme->tfile;
-                               break;
-                       case SPACE_NLA:
-                               ts= &btheme->tnla;
-                               break;
-                       case SPACE_ACTION:
-                               ts= &btheme->tact;
-                               break;
-                       case SPACE_SEQ:
-                               ts= &btheme->tseq;
-                               break;
-                       case SPACE_IMAGE:
-                               ts= &btheme->tima;
-                               break;
-                       case SPACE_TEXT:
-                               ts= &btheme->text;
-                               break;
-                       case SPACE_OUTLINER:
-                               ts= &btheme->toops;
-                               break;
-                       case SPACE_INFO:
-                               ts= &btheme->tinfo;
-                               break;
-                       case SPACE_USERPREF:
-                               ts= &btheme->tuserpref;
-                               break;
-                       case SPACE_CONSOLE:
-                               ts= &btheme->tconsole;
-                               break;
-                       case SPACE_TIME:
-                               ts= &btheme->ttime;
-                               break;
-                       case SPACE_NODE:
-                               ts= &btheme->tnode;
-                               break;
-                       case SPACE_LOGIC:
-                               ts= &btheme->tlogic;
-                               break;
-                       case SPACE_CLIP:
-                               ts= &btheme->tclip;
-                               break;
-                       default:
-                               ts= &btheme->tv3d;
-                               break;
+                       switch (spacetype) {
+                               case SPACE_BUTS:
+                                       ts = &btheme->tbuts;
+                                       break;
+                               case SPACE_VIEW3D:
+                                       ts = &btheme->tv3d;
+                                       break;
+                               case SPACE_IPO:
+                                       ts = &btheme->tipo;
+                                       break;
+                               case SPACE_FILE:
+                                       ts = &btheme->tfile;
+                                       break;
+                               case SPACE_NLA:
+                                       ts = &btheme->tnla;
+                                       break;
+                               case SPACE_ACTION:
+                                       ts = &btheme->tact;
+                                       break;
+                               case SPACE_SEQ:
+                                       ts = &btheme->tseq;
+                                       break;
+                               case SPACE_IMAGE:
+                                       ts = &btheme->tima;
+                                       break;
+                               case SPACE_TEXT:
+                                       ts = &btheme->text;
+                                       break;
+                               case SPACE_OUTLINER:
+                                       ts = &btheme->toops;
+                                       break;
+                               case SPACE_INFO:
+                                       ts = &btheme->tinfo;
+                                       break;
+                               case SPACE_USERPREF:
+                                       ts = &btheme->tuserpref;
+                                       break;
+                               case SPACE_CONSOLE:
+                                       ts = &btheme->tconsole;
+                                       break;
+                               case SPACE_TIME:
+                                       ts = &btheme->ttime;
+                                       break;
+                               case SPACE_NODE:
+                                       ts = &btheme->tnode;
+                                       break;
+                               case SPACE_LOGIC:
+                                       ts = &btheme->tlogic;
+                                       break;
+                               case SPACE_CLIP:
+                                       ts = &btheme->tclip;
+                                       break;
+                               default:
+                                       ts = &btheme->tv3d;
+                                       break;
                        }
-                       
-                       switch(colorid) {
-                       case TH_BACK:
-                               if (theme_regionid==RGN_TYPE_WINDOW)
-                                       cp= ts->back;
-                               else if (theme_regionid==RGN_TYPE_CHANNELS)
-                                       cp= ts->list;
-                               else if (theme_regionid==RGN_TYPE_HEADER)
-                                       cp= ts->header;
-                               else
-                                       cp= ts->button; 
-                               break;
-                       case TH_TEXT:
-                               if (theme_regionid==RGN_TYPE_WINDOW)
-                                       cp= ts->text; 
-                               else if (theme_regionid==RGN_TYPE_CHANNELS)
-                                       cp= ts->list_text;
-                               else if (theme_regionid==RGN_TYPE_HEADER)
-                                       cp= ts->header_text;
-                               else
-                                       cp= ts->button_text; 
-                               break;
-                       case TH_TEXT_HI:
-                               if (theme_regionid==RGN_TYPE_WINDOW)
-                                       cp= ts->text_hi;
-                               else if (theme_regionid==RGN_TYPE_CHANNELS)
-                                       cp= ts->list_text_hi;
-                               else if (theme_regionid==RGN_TYPE_HEADER)
-                                       cp= ts->header_text_hi;
-                               else
-                                       cp= ts->button_text_hi; 
-                               break;
-                       case TH_TITLE:
-                               if (theme_regionid==RGN_TYPE_WINDOW)
-                                       cp= ts->title;
-                               else if (theme_regionid==RGN_TYPE_CHANNELS)
-                                       cp= ts->list_title;
-                               else if (theme_regionid==RGN_TYPE_HEADER)
-                                       cp= ts->header_title;
-                               else
-                                       cp= ts->button_title; 
-                               break;
-                               
-                       case TH_HEADER:
-                               cp= ts->header; break;
-                       case TH_HEADERDESEL:
-                               /* we calculate a dynamic builtin header deselect color, also for pulldowns... */
-                               cp= ts->header; 
-                               headerdesel[0]= cp[0]>10?cp[0]-10:0;
-                               headerdesel[1]= cp[1]>10?cp[1]-10:0;
-                               headerdesel[2]= cp[2]>10?cp[2]-10:0;
-                               cp= headerdesel;
-                               break;
-                       case TH_HEADER_TEXT:
-                               cp= ts->header_text; break;
-                       case TH_HEADER_TEXT_HI:
-                               cp= ts->header_text_hi; break;
-                               
-                       case TH_PANEL:
-                               cp= ts->panel; break;
-                       case TH_PANEL_TEXT:
-                               cp= ts->panel_text; break;
-                       case TH_PANEL_TEXT_HI:
-                               cp= ts->panel_text_hi; break;
-                               
-                       case TH_BUTBACK:
-                               cp= ts->button; break;
-                       case TH_BUTBACK_TEXT:
-                               cp= ts->button_text; break;
-                       case TH_BUTBACK_TEXT_HI:
-                               cp= ts->button_text_hi; break;
-                               
-                       case TH_SHADE1:
-                               cp= ts->shade1; break;
-                       case TH_SHADE2:
-                               cp= ts->shade2; break;
-                       case TH_HILITE:
-                               cp= ts->hilite; break;
-                               
-                       case TH_GRID:
-                               cp= ts->grid; break;
-                       case TH_WIRE:
-                               cp= ts->wire; break;
-                       case TH_LAMP:
-                               cp= ts->lamp; break;
-                       case TH_SPEAKER:
-                               cp= ts->speaker; break;
-                       case TH_CAMERA:
-                               cp= ts->camera; break;
-                       case TH_EMPTY:
-                               cp= ts->empty; break;
-                       case TH_SELECT:
-                               cp= ts->select; break;
-                       case TH_ACTIVE:
-                               cp= ts->active; break;
-                       case TH_GROUP:
-                               cp= ts->group; break;
-                       case TH_GROUP_ACTIVE:
-                               cp= ts->group_active; break;
-                       case TH_TRANSFORM:
-                               cp= ts->transform; break;
-                       case TH_VERTEX:
-                               cp= ts->vertex; break;
-                       case TH_VERTEX_SELECT:
-                               cp= ts->vertex_select; break;
-                       case TH_VERTEX_SIZE:
-                               cp= &ts->vertex_size; break;
-                       case TH_OUTLINE_WIDTH:
-                               cp= &ts->outline_width; break;
-                       case TH_EDGE:
-                               cp= ts->edge; break;
-                       case TH_EDGE_SELECT:
-                               cp= ts->edge_select; break;
-                       case TH_EDGE_SEAM:
-                               cp= ts->edge_seam; break;
-                       case TH_EDGE_SHARP:
-                               cp= ts->edge_sharp; break;
-                       case TH_EDGE_CREASE:
-                               cp= ts->edge_crease; break;
-                       case TH_EDITMESH_ACTIVE:
-                               cp= ts->editmesh_active; break;
-                       case TH_EDGE_FACESEL:
-                               cp= ts->edge_facesel; break;
-                       case TH_FACE:
-                               cp= ts->face; break;
-                       case TH_FACE_SELECT:
-                               cp= ts->face_select; break;
-                       case TH_FACE_DOT:
-                               cp= ts->face_dot; break;
-                       case TH_FACEDOT_SIZE:
-                               cp= &ts->facedot_size; break;
-                       case TH_DRAWEXTRA_EDGELEN:
-                               cp= ts->extra_edge_len; break;
-                       case TH_DRAWEXTRA_FACEAREA:
-                               cp= ts->extra_face_area; break;
-                       case TH_DRAWEXTRA_FACEANG:
-                               cp= ts->extra_face_angle; break;
-                       case TH_NORMAL:
-                               cp= ts->normal; break;
-                       case TH_VNORMAL:
-                               cp= ts->vertex_normal; break;
-                       case TH_BONE_SOLID:
-                               cp= ts->bone_solid; break;
-                       case TH_BONE_POSE:
-                               cp= ts->bone_pose; break;
-                       case TH_STRIP:
-                               cp= ts->strip; break;
-                       case TH_STRIP_SELECT:
-                               cp= ts->strip_select; break;
-                       case TH_CFRAME:
-                               cp= ts->cframe; break;
-                       case TH_NURB_ULINE:
-                               cp= ts->nurb_uline; break;
-                       case TH_NURB_VLINE:
-                               cp= ts->nurb_vline; break;
-                       case TH_NURB_SEL_ULINE:
-                               cp= ts->nurb_sel_uline; break;
-                       case TH_NURB_SEL_VLINE:
-                               cp= ts->nurb_sel_vline; break;
-                       case TH_ACTIVE_SPLINE:
-                               cp= ts->act_spline; break;
-                       case TH_LASTSEL_POINT:
-                               cp= ts->lastsel_point; break;
-                       case TH_HANDLE_FREE:
-                               cp= ts->handle_free; break;
-                       case TH_HANDLE_AUTO:
-                               cp= ts->handle_auto; break;
-                       case TH_HANDLE_AUTOCLAMP:
-                               cp= ts->handle_auto_clamped; break;
-                       case TH_HANDLE_VECT:
-                               cp= ts->handle_vect; break;
-                       case TH_HANDLE_ALIGN:
-                               cp= ts->handle_align; break;
-                       case TH_HANDLE_SEL_FREE:
-                               cp= ts->handle_sel_free; break;
-                       case TH_HANDLE_SEL_AUTO:
-                               cp= ts->handle_sel_auto; break;
-                       case TH_HANDLE_SEL_AUTOCLAMP:
-                               cp= ts->handle_sel_auto_clamped; break;
-                       case TH_HANDLE_SEL_VECT:
-                               cp= ts->handle_sel_vect; break;
-                       case TH_HANDLE_SEL_ALIGN:
-                               cp= ts->handle_sel_align; break;
-                       case TH_FREESTYLE_EDGE_MARK:
-                               cp= ts->freestyle_edge_mark; break;
-                       case TH_FREESTYLE_FACE_MARK:
-                               cp= ts->freestyle_face_mark; break;
-               
-                       case TH_SYNTAX_B:
-                               cp= ts->syntaxb; break;
-                       case TH_SYNTAX_V:
-                               cp= ts->syntaxv; break;
-                       case TH_SYNTAX_C:
-                               cp= ts->syntaxc; break;
-                       case TH_SYNTAX_L:
-                               cp= ts->syntaxl; break;
-                       case TH_SYNTAX_N:
-                               cp= ts->syntaxn; break;
-                       case TH_NODE:
-                               cp= ts->syntaxl; break;
-                       case TH_NODE_IN_OUT:
-                               cp= ts->syntaxn; break;
-                       case TH_NODE_OPERATOR:
-                               cp= ts->syntaxb; break;
-                       case TH_NODE_CONVERTOR:
-                               cp= ts->syntaxv; break;
-                       case TH_NODE_GROUP:
-                               cp= ts->syntaxc; break;
-                       case TH_NODE_CURVING:
-                               cp= &ts->noodle_curving; break;
-                       case TH_SEQ_MOVIE:
-                               cp= ts->movie; break;
-                       case TH_SEQ_MOVIECLIP:
-                               cp= ts->movieclip; break;
-                       case TH_SEQ_IMAGE:
-                               cp= ts->image; break;
-                       case TH_SEQ_SCENE:
-                               cp= ts->scene; break;
-                       case TH_SEQ_AUDIO:
-                               cp= ts->audio; break;
-                       case TH_SEQ_EFFECT:
-                               cp= ts->effect; break;
-                       case TH_SEQ_PLUGIN:
-                               cp= ts->plugin; break;
-                       case TH_SEQ_TRANSITION:
-                               cp= ts->transition; break;
-                       case TH_SEQ_META:
-                               cp= ts->meta; break;
-                       case TH_SEQ_PREVIEW:
-                               cp= ts->preview_back; break;
-                               
-                       case TH_CONSOLE_OUTPUT:
-                               cp= ts->console_output; break;
-                       case TH_CONSOLE_INPUT:
-                               cp= ts-> console_input; break;
-                       case TH_CONSOLE_INFO:
-                               cp= ts->console_info; break;
-                       case TH_CONSOLE_ERROR:
-                               cp= ts->console_error; break;
-                       case TH_CONSOLE_CURSOR:
-                               cp= ts->console_cursor; break;
-                       case TH_HANDLE_VERTEX:
-                               cp= ts->handle_vertex;
-                               break;
-                       case TH_HANDLE_VERTEX_SELECT:
-                               cp= ts->handle_vertex_select;
-                               break;
-                       case TH_HANDLE_VERTEX_SIZE:
-                               cp= &ts->handle_vertex_size;
-                               break;
-                               
-                       case TH_DOPESHEET_CHANNELOB:
-                               cp= ts->ds_channel;
-                               break;
-                       case TH_DOPESHEET_CHANNELSUBOB:
-                               cp= ts->ds_subchannel;
-                               break;  
-                                       
-                       case TH_PREVIEW_BACK:
-                               cp= ts->preview_back;
-                               break;  
-                       case TH_STITCH_PREVIEW_FACE:
-                               cp = ts->preview_stitch_face;
-                               break;
-                       case TH_STITCH_PREVIEW_EDGE:
-                               cp = ts->preview_stitch_edge;
-                               break;
-                       case TH_STITCH_PREVIEW_VERT:
-                               cp = ts->preview_stitch_vert;
-                               break;
-                       case TH_STITCH_PREVIEW_STITCHABLE:
-                               cp = ts->preview_stitch_stitchable;
-                               break;
-                       case TH_STITCH_PREVIEW_UNSTITCHABLE:
-                               cp = ts->preview_stitch_unstitchable;
-                               break;
-                       case TH_STITCH_PREVIEW_ACTIVE:
-                               cp = ts->preview_stitch_active;
-                               break;
-                       case TH_MARKER_OUTLINE:
-                               cp= ts->marker_outline; break;
-                       case TH_MARKER:
-                               cp= ts->marker; break;
-                       case TH_ACT_MARKER:
-                               cp= ts->act_marker; break;
-                       case TH_SEL_MARKER:
-                               cp= ts->sel_marker; break;
-                       case TH_BUNDLE_SOLID:
-                               cp= ts->bundle_solid; break;
-                       case TH_DIS_MARKER:
-                               cp= ts->dis_marker; break;
-                       case TH_PATH_BEFORE:
-                               cp= ts->path_before; break;
-                       case TH_PATH_AFTER:
-                               cp= ts->path_after; break;
-                       case TH_CAMERA_PATH:
-                               cp= ts->camera_path; break;
-                       case TH_LOCK_MARKER:
-                               cp= ts->lock_marker; break;
-                       
-                       case TH_MATCH:
-                               cp= ts->match;
-                               break;
-                               
-                       case TH_SELECT_HIGHLIGHT:
-                               cp= ts->selected_highlight;
-                               break;
+                       switch (colorid) {
+                               case TH_BACK:
+                                       if (theme_regionid == RGN_TYPE_WINDOW)
+                                               cp = ts->back;
+                                       else if (theme_regionid == RGN_TYPE_CHANNELS)
+                                               cp = ts->list;
+                                       else if (theme_regionid == RGN_TYPE_HEADER)
+                                               cp = ts->header;
+                                       else
+                                               cp = ts->button;
+                                       break;
+                               case TH_TEXT:
+                                       if (theme_regionid == RGN_TYPE_WINDOW)
+                                               cp = ts->text;
+                                       else if (theme_regionid == RGN_TYPE_CHANNELS)
+                                               cp = ts->list_text;
+                                       else if (theme_regionid == RGN_TYPE_HEADER)
+                                               cp = ts->header_text;
+                                       else
+                                               cp = ts->button_text;
+                                       break;
+                               case TH_TEXT_HI:
+                                       if (theme_regionid == RGN_TYPE_WINDOW)
+                                               cp = ts->text_hi;
+                                       else if (theme_regionid == RGN_TYPE_CHANNELS)
+                                               cp = ts->list_text_hi;
+                                       else if (theme_regionid == RGN_TYPE_HEADER)
+                                               cp = ts->header_text_hi;
+                                       else
+                                               cp = ts->button_text_hi;
+                                       break;
+                               case TH_TITLE:
+                                       if (theme_regionid == RGN_TYPE_WINDOW)
+                                               cp = ts->title;
+                                       else if (theme_regionid == RGN_TYPE_CHANNELS)
+                                               cp = ts->list_title;
+                                       else if (theme_regionid == RGN_TYPE_HEADER)
+                                               cp = ts->header_title;
+                                       else
+                                               cp = ts->button_title;
+                                       break;
+                               case TH_HEADER:
+                                       cp = ts->header; break;
+                               case TH_HEADERDESEL:
+                                       /* we calculate a dynamic builtin header deselect color, also for pulldowns... */
+                                       cp = ts->header;
+                                       headerdesel[0] = cp[0] > 10 ? cp[0] - 10 : 0;
+                                       headerdesel[1] = cp[1] > 10 ? cp[1] - 10 : 0;
+                                       headerdesel[2] = cp[2] > 10 ? cp[2] - 10 : 0;
+                                       cp = headerdesel;
+                                       break;
+                               case TH_HEADER_TEXT:
+                                       cp = ts->header_text; break;
+                               case TH_HEADER_TEXT_HI:
+                                       cp = ts->header_text_hi; break;
+                               case TH_PANEL:
+                                       cp = ts->panel; break;
+                               case TH_PANEL_TEXT:
+                                       cp = ts->panel_text; break;
+                               case TH_PANEL_TEXT_HI:
+                                       cp = ts->panel_text_hi; break;
+                               case TH_BUTBACK:
+                                       cp = ts->button; break;
+                               case TH_BUTBACK_TEXT:
+                                       cp = ts->button_text; break;
+                               case TH_BUTBACK_TEXT_HI:
+                                       cp = ts->button_text_hi; break;
+                               case TH_SHADE1:
+                                       cp = ts->shade1; break;
+                               case TH_SHADE2:
+                                       cp = ts->shade2; break;
+                               case TH_HILITE:
+                                       cp = ts->hilite; break;
+                               case TH_GRID:
+                                       cp = ts->grid; break;
+                               case TH_WIRE:
+                                       cp = ts->wire; break;
+                               case TH_LAMP:
+                                       cp = ts->lamp; break;
+                               case TH_SPEAKER:
+                                       cp = ts->speaker; break;
+                               case TH_CAMERA:
+                                       cp = ts->camera; break;
+                               case TH_EMPTY:
+                                       cp = ts->empty; break;
+                               case TH_SELECT:
+                                       cp = ts->select; break;
+                               case TH_ACTIVE:
+                                       cp = ts->active; break;
+                               case TH_GROUP:
+                                       cp = ts->group; break;
+                               case TH_GROUP_ACTIVE:
+                                       cp = ts->group_active; break;
+                               case TH_TRANSFORM:
+                                       cp = ts->transform; break;
+                               case TH_VERTEX:
+                                       cp = ts->vertex; break;
+                               case TH_VERTEX_SELECT:
+                                       cp = ts->vertex_select; break;
+                               case TH_VERTEX_SIZE:
+                                       cp = &ts->vertex_size; break;
+                               case TH_OUTLINE_WIDTH:
+                                       cp = &ts->outline_width; break;
+                               case TH_EDGE:
+                                       cp = ts->edge; break;
+                               case TH_EDGE_SELECT:
+                                       cp = ts->edge_select; break;
+                               case TH_EDGE_SEAM:
+                                       cp = ts->edge_seam; break;
+                               case TH_EDGE_SHARP:
+                                       cp = ts->edge_sharp; break;
+                               case TH_EDGE_CREASE:
+                                       cp = ts->edge_crease; break;
+                               case TH_EDITMESH_ACTIVE:
+                                       cp = ts->editmesh_active; break;
+                               case TH_EDGE_FACESEL:
+                                       cp = ts->edge_facesel; break;
+                               case TH_FACE:
+                                       cp = ts->face; break;
+                               case TH_FACE_SELECT:
+                                       cp = ts->face_select; break;
+                               case TH_FACE_DOT:
+                                       cp = ts->face_dot; break;
+                               case TH_FACEDOT_SIZE:
+                                       cp = &ts->facedot_size; break;
+                               case TH_DRAWEXTRA_EDGELEN:
+                                       cp = ts->extra_edge_len; break;
+                               case TH_DRAWEXTRA_FACEAREA:
+                                       cp = ts->extra_face_area; break;
+                               case TH_DRAWEXTRA_FACEANG:
+                                       cp = ts->extra_face_angle; break;
+                               case TH_NORMAL:
+                                       cp = ts->normal; break;
+                               case TH_VNORMAL:
+                                       cp = ts->vertex_normal; break;
+                               case TH_BONE_SOLID:
+                                       cp = ts->bone_solid; break;
+                               case TH_BONE_POSE:
+                                       cp = ts->bone_pose; break;
+                               case TH_STRIP:
+                                       cp = ts->strip; break;
+                               case TH_STRIP_SELECT:
+                                       cp = ts->strip_select; break;
+                               case TH_CFRAME:
+                                       cp = ts->cframe; break;
+                               case TH_NURB_ULINE:
+                                       cp = ts->nurb_uline; break;
+                               case TH_NURB_VLINE:
+                                       cp = ts->nurb_vline; break;
+                               case TH_NURB_SEL_ULINE:
+                                       cp = ts->nurb_sel_uline; break;
+                               case TH_NURB_SEL_VLINE:
+                                       cp = ts->nurb_sel_vline; break;
+                               case TH_ACTIVE_SPLINE:
+                                       cp = ts->act_spline; break;
+                               case TH_LASTSEL_POINT:
+                                       cp = ts->lastsel_point; break;
+                               case TH_HANDLE_FREE:
+                                       cp = ts->handle_free; break;
+                               case TH_HANDLE_AUTO:
+                                       cp = ts->handle_auto; break;
+                               case TH_HANDLE_AUTOCLAMP:
+                                       cp = ts->handle_auto_clamped; break;
+                               case TH_HANDLE_VECT:
+                                       cp = ts->handle_vect; break;
+                               case TH_HANDLE_ALIGN:
+                                       cp = ts->handle_align; break;
+                               case TH_HANDLE_SEL_FREE:
+                                       cp = ts->handle_sel_free; break;
+                               case TH_HANDLE_SEL_AUTO:
+                                       cp = ts->handle_sel_auto; break;
+                               case TH_HANDLE_SEL_AUTOCLAMP:
+                                       cp = ts->handle_sel_auto_clamped; break;
+                               case TH_HANDLE_SEL_VECT:
+                                       cp = ts->handle_sel_vect; break;
+                               case TH_HANDLE_SEL_ALIGN:
+                                       cp = ts->handle_sel_align; break;
++                              case TH_FREESTYLE_EDGE_MARK:
++                                      cp = ts->freestyle_edge_mark; break;
++                              case TH_FREESTYLE_FACE_MARK:
++                                      cp = ts->freestyle_face_mark; break;
+                               case TH_SYNTAX_B:
+                                       cp = ts->syntaxb; break;
+                               case TH_SYNTAX_V:
+                                       cp = ts->syntaxv; break;
+                               case TH_SYNTAX_C:
+                                       cp = ts->syntaxc; break;
+                               case TH_SYNTAX_L:
+                                       cp = ts->syntaxl; break;
+                               case TH_SYNTAX_N:
+                                       cp = ts->syntaxn; break;
+                               case TH_NODE:
+                                       cp = ts->syntaxl; break;
+                               case TH_NODE_IN_OUT:
+                                       cp = ts->syntaxn; break;
+                               case TH_NODE_OPERATOR:
+                                       cp = ts->syntaxb; break;
+                               case TH_NODE_CONVERTOR:
+                                       cp = ts->syntaxv; break;
+                               case TH_NODE_GROUP:
+                                       cp = ts->syntaxc; break;
+                               case TH_NODE_CURVING:
+                                       cp = &ts->noodle_curving; break;
+                               case TH_SEQ_MOVIE:
+                                       cp = ts->movie; break;
+                               case TH_SEQ_MOVIECLIP:
+                                       cp = ts->movieclip; break;
+                               case TH_SEQ_IMAGE:
+                                       cp = ts->image; break;
+                               case TH_SEQ_SCENE:
+                                       cp = ts->scene; break;
+                               case TH_SEQ_AUDIO:
+                                       cp = ts->audio; break;
+                               case TH_SEQ_EFFECT:
+                                       cp = ts->effect; break;
+                               case TH_SEQ_PLUGIN:
+                                       cp = ts->plugin; break;
+                               case TH_SEQ_TRANSITION:
+                                       cp = ts->transition; break;
+                               case TH_SEQ_META:
+                                       cp = ts->meta; break;
+                               case TH_SEQ_PREVIEW:
+                                       cp = ts->preview_back; break;
+                               case TH_CONSOLE_OUTPUT:
+                                       cp = ts->console_output; break;
+                               case TH_CONSOLE_INPUT:
+                                       cp = ts->console_input; break;
+                               case TH_CONSOLE_INFO:
+                                       cp = ts->console_info; break;
+                               case TH_CONSOLE_ERROR:
+                                       cp = ts->console_error; break;
+                               case TH_CONSOLE_CURSOR:
+                                       cp = ts->console_cursor; break;
+                               case TH_HANDLE_VERTEX:
+                                       cp = ts->handle_vertex;
+                                       break;
+                               case TH_HANDLE_VERTEX_SELECT:
+                                       cp = ts->handle_vertex_select;
+                                       break;
+                               case TH_HANDLE_VERTEX_SIZE:
+                                       cp = &ts->handle_vertex_size;
+                                       break;
+                               case TH_DOPESHEET_CHANNELOB:
+                                       cp = ts->ds_channel;
+                                       break;
+                               case TH_DOPESHEET_CHANNELSUBOB:
+                                       cp = ts->ds_subchannel;
+                                       break;
+                               case TH_PREVIEW_BACK:
+                                       cp = ts->preview_back;
+                                       break;
+                               case TH_STITCH_PREVIEW_FACE:
+                                       cp = ts->preview_stitch_face;
+                                       break;
+                               case TH_STITCH_PREVIEW_EDGE:
+                                       cp = ts->preview_stitch_edge;
+                                       break;
+                               case TH_STITCH_PREVIEW_VERT:
+                                       cp = ts->preview_stitch_vert;
+                                       break;
+                               case TH_STITCH_PREVIEW_STITCHABLE:
+                                       cp = ts->preview_stitch_stitchable;
+                                       break;
+                               case TH_STITCH_PREVIEW_UNSTITCHABLE:
+                                       cp = ts->preview_stitch_unstitchable;
+                                       break;
+                               case TH_STITCH_PREVIEW_ACTIVE:
+                                       cp = ts->preview_stitch_active;
+                                       break;
+                               case TH_MARKER_OUTLINE:
+                                       cp = ts->marker_outline; break;
+                               case TH_MARKER:
+                                       cp = ts->marker; break;
+                               case TH_ACT_MARKER:
+                                       cp = ts->act_marker; break;
+                               case TH_SEL_MARKER:
+                                       cp = ts->sel_marker; break;
+                               case TH_BUNDLE_SOLID:
+                                       cp = ts->bundle_solid; break;
+                               case TH_DIS_MARKER:
+                                       cp = ts->dis_marker; break;
+                               case TH_PATH_BEFORE:
+                                       cp = ts->path_before; break;
+                               case TH_PATH_AFTER:
+                                       cp = ts->path_after; break;
+                               case TH_CAMERA_PATH:
+                                       cp = ts->camera_path; break;
+                               case TH_LOCK_MARKER:
+                                       cp = ts->lock_marker; break;
+                               case TH_MATCH:
+                                       cp = ts->match;
+                                       break;
+                               case TH_SELECT_HIGHLIGHT:
+                                       cp = ts->selected_highlight;
+                                       break;
                        }
                }
        }
@@@ -675,10 -671,8 +675,10 @@@ void ui_theme_init_default(void
        rgba_char_args_set(btheme->tv3d.button_text_hi, 255, 255, 255, 255);
        rgba_char_args_set(btheme->tv3d.button_title, 0, 0, 0, 255);
        rgba_char_args_set(btheme->tv3d.title, 0, 0, 0, 255);
 +      rgba_char_args_set(btheme->tv3d.freestyle_edge_mark, 0x7f, 0xff, 0x7f, 255);
 +      rgba_char_args_set(btheme->tv3d.freestyle_face_mark, 0x7f, 0xff, 0x7f, 51);
  
-       btheme->tv3d.facedot_size= 4;
+       btheme->tv3d.facedot_size = 4;
  
        rgba_char_args_set(btheme->tv3d.extra_edge_len, 32, 0, 0, 255);
        rgba_char_args_set(btheme->tv3d.extra_face_area, 0, 32, 0, 255);
@@@ -1773,19 -1767,15 +1773,28 @@@ void init_userdef_do_versions(void
                }
        }
  
+       if (bmain->versionfile < 262 || (bmain->versionfile == 262 && bmain->subversionfile < 4)) {
+               bTheme *btheme;
+               for (btheme = U.themes.first; btheme; btheme = btheme->next) {
+                       if (btheme->tseq.movieclip[0] == 0) {
+                               rgba_char_args_set(btheme->tseq.movieclip,  32, 32, 143, 255);
+                       }
+               }
+       }
 +      /* Freestyle color settings */
 +      {
 +              bTheme *btheme;
 +
 +              for(btheme= U.themes.first; btheme; btheme= btheme->next) {
 +                      /* check for alpha==0 is safe, then color was never set */
 +                      if(btheme->tv3d.freestyle_edge_mark[3]==0) {
 +                              rgba_char_args_set(btheme->tv3d.freestyle_edge_mark, 0x7f, 0xff, 0x7f, 255);
 +                              rgba_char_args_set(btheme->tv3d.freestyle_face_mark, 0x7f, 0xff, 0x7f, 51);
 +                      }
 +              }
 +      }
 +
        /* GL Texture Garbage Collection (variable abused above!) */
        if (U.textimeout == 0) {
                U.texcollectrate = 60;
@@@ -1171,48 -1165,43 +1167,48 @@@ static void edgetag_context_set(BMEditM
  {
        
        switch (scene->toolsettings->edge_mode) {
-       case EDGE_MODE_SELECT:
-               BM_elem_select_set(em->bm, e, val);
-               break;
-       case EDGE_MODE_TAG_SEAM:
-               BM_elem_flag_set(e, BM_ELEM_SEAM, val);
-               break;
-       case EDGE_MODE_TAG_SHARP:
-               BM_elem_flag_set(e, BM_ELEM_SMOOTH, !val);
-               break;
-       case EDGE_MODE_TAG_FREESTYLE:
-               BM_elem_flag_set(e, BM_ELEM_FREESTYLE, val);
-               break;
-       case EDGE_MODE_TAG_CREASE:
-        {
-               float *crease = CustomData_bmesh_get(&em->bm->edata, e->head.data, CD_CREASE);
-               *crease = (val) ? 1.0f : 0.0f;
-               break;
-        }
-       case EDGE_MODE_TAG_BEVEL:
-        {
-               float *bweight = CustomData_bmesh_get(&em->bm->edata, e->head.data, CD_BWEIGHT);
-               *bweight = (val) ? 1.0f : 0.0f;
-               break;
-        }
+               case EDGE_MODE_SELECT:
+                       BM_elem_select_set(em->bm, e, val);
+                       break;
+               case EDGE_MODE_TAG_SEAM:
+                       BM_elem_flag_set(e, BM_ELEM_SEAM, val);
+                       break;
+               case EDGE_MODE_TAG_SHARP:
+                       BM_elem_flag_set(e, BM_ELEM_SMOOTH, !val);
+                       break;
++              case EDGE_MODE_TAG_FREESTYLE:
++                      BM_elem_flag_set(e, BM_ELEM_FREESTYLE, val);
++                      break;
+               case EDGE_MODE_TAG_CREASE:
+               {
+                       float *crease = CustomData_bmesh_get(&em->bm->edata, e->head.data, CD_CREASE);
+                       *crease = (val) ? 1.0f : 0.0f;
+                       break;
+               }
+               case EDGE_MODE_TAG_BEVEL:
+               {
+                       float *bweight = CustomData_bmesh_get(&em->bm->edata, e->head.data, CD_BWEIGHT);
+                       *bweight = (val) ? 1.0f : 0.0f;
+                       break;
+               }
        }
  }
  
  static int edgetag_context_check(Scene *scene, BMEditMesh *em, BMEdge *e)
  {
        switch (scene->toolsettings->edge_mode) {
-       case EDGE_MODE_SELECT:
-               return BM_elem_flag_test(e, BM_ELEM_SELECT) ? 1 : 0;
-       case EDGE_MODE_TAG_SEAM:
-               return BM_elem_flag_test(e, BM_ELEM_SEAM);
-       case EDGE_MODE_TAG_SHARP:
-               return !BM_elem_flag_test(e, BM_ELEM_SMOOTH);
-       case EDGE_MODE_TAG_FREESTYLE:
-               return !BM_elem_flag_test(e, BM_ELEM_FREESTYLE);
-       case EDGE_MODE_TAG_CREASE:      
-               return BM_elem_float_data_get(&em->bm->edata, e, CD_CREASE) ? 1 : 0;
-       case EDGE_MODE_TAG_BEVEL:
-               return BM_elem_float_data_get(&em->bm->edata, e, CD_BWEIGHT) ? 1 : 0;
+               case EDGE_MODE_SELECT:
+                       return BM_elem_flag_test(e, BM_ELEM_SELECT) ? 1 : 0;
+               case EDGE_MODE_TAG_SEAM:
+                       return BM_elem_flag_test(e, BM_ELEM_SEAM);
+               case EDGE_MODE_TAG_SHARP:
+                       return !BM_elem_flag_test(e, BM_ELEM_SMOOTH);
++              case EDGE_MODE_TAG_FREESTYLE:
++                      return !BM_elem_flag_test(e, BM_ELEM_FREESTYLE);
+               case EDGE_MODE_TAG_CREASE:
+                       return BM_elem_float_data_get(&em->bm->edata, e, CD_CREASE) ? 1 : 0;
+               case EDGE_MODE_TAG_BEVEL:
+                       return BM_elem_float_data_get(&em->bm->edata, e, CD_BWEIGHT) ? 1 : 0;
        }
        return 0;
  }
@@@ -1420,13 -1409,9 +1416,12 @@@ static void mouse_mesh_shortest_path(bC
                        case EDGE_MODE_TAG_BEVEL:
                                me->drawflag |= ME_DRAWBWEIGHTS;
                                break;
 +                      case EDGE_MODE_TAG_FREESTYLE:
 +                              me->drawflag |= ME_DRAW_FREESTYLE_EDGE;
 +                              break;
                }
                
-               DAG_id_tag_update(ob->data, OB_RECALC_DATA);
-               WM_event_add_notifier(C, NC_GEOM|ND_SELECT, ob->data);
+               EDBM_update_generic(C, em, FALSE);
        }
  }
  
@@@ -4536,109 -4477,5 +4477,109 @@@ void MESH_OT_inset(wmOperatorType *ot
        /* use 1 rather then 10 for max else dragging the button moves too far */
        RNA_def_property_ui_range(prop, 0.0, 1.0, 0.01, 4);
  
-       RNA_def_boolean(ot->srna, "use_outset", FALSE, "Outset",  "outset rather then inset");
+       RNA_def_boolean(ot->srna, "use_outset", FALSE, "Outset", "Outset rather than inset");
  }
 +
 +static int edbm_mark_freestyle_edge(bContext *C, wmOperator *op)
 +{
 +      Object *obedit = CTX_data_edit_object(C);
 +      Mesh *me = ((Mesh *)obedit->data);
 +      BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh;
 +      BMEdge *eed;
 +      BMIter iter;
 +      int clear = RNA_boolean_get(op->ptr, "clear");
 +
 +      if (em == NULL) return OPERATOR_FINISHED;
 +
 +      /* auto-enable seams drawing */
 +      if (clear == 0) {
 +              me->drawflag |= ME_DRAW_FREESTYLE_EDGE;
 +      }
 +
 +      if (clear) {
 +              BM_ITER(eed, &iter, em->bm, BM_EDGES_OF_MESH, NULL) {
 +                      if (BM_elem_flag_test(eed, BM_ELEM_SELECT) && !BM_elem_flag_test(eed, BM_ELEM_HIDDEN))
 +                              BM_elem_flag_disable(eed, BM_ELEM_FREESTYLE);
 +              }
 +      }
 +      else {
 +              BM_ITER(eed, &iter, em->bm, BM_EDGES_OF_MESH, NULL) {
 +                      if (BM_elem_flag_test(eed, BM_ELEM_SELECT) && !BM_elem_flag_test(eed, BM_ELEM_HIDDEN))
 +                              BM_elem_flag_enable(eed, BM_ELEM_FREESTYLE);
 +              }
 +      }
 +
 +      DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
 +      WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 +
 +      return OPERATOR_FINISHED;
 +}
 +
 +void MESH_OT_mark_freestyle_edge(wmOperatorType *ot)
 +{
 +      /* identifiers */
 +      ot->name = "Mark Freestyle Edge";
 +      ot->description = "(un)mark selected edges as Freestyle feature edges";
 +      ot->idname = "MESH_OT_mark_freestyle_edge";
 +
 +      /* api callbacks */
 +      ot->exec = edbm_mark_freestyle_edge;
 +      ot->poll = ED_operator_editmesh;
 +
 +      /* flags */
 +      ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 +
 +      RNA_def_boolean(ot->srna, "clear", 0, "Clear", "");
 +}
 +
 +static int edbm_mark_freestyle_face_exec(bContext *C, wmOperator *op)
 +{
 +      Object *obedit = CTX_data_edit_object(C);
 +      Mesh *me = ((Mesh *)obedit->data);
 +      BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh;
 +      BMFace *efa;
 +      BMIter iter;
 +      int clear = RNA_boolean_get(op->ptr, "clear");
 +
 +      if (em == NULL) return OPERATOR_FINISHED;
 +
 +      /* auto-enable Freestyle face mark drawing */
 +      if(!clear) {
 +              me->drawflag |= ME_DRAW_FREESTYLE_FACE;
 +      }
 +
 +      if(clear) {
 +              BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
 +                      if (BM_elem_flag_test(efa, BM_ELEM_SELECT) && !BM_elem_flag_test(efa, BM_ELEM_HIDDEN))
 +                              BM_elem_flag_disable(efa, BM_ELEM_FREESTYLE);
 +              }
 +      } else {
 +              BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
 +                      if (BM_elem_flag_test(efa, BM_ELEM_SELECT) && !BM_elem_flag_test(efa, BM_ELEM_HIDDEN))
 +                              BM_elem_flag_enable(efa, BM_ELEM_FREESTYLE);
 +              }
 +      }
 +
 +      DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
 +      WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 +
 +      return OPERATOR_FINISHED;
 +}
 +
 +void MESH_OT_mark_freestyle_face(wmOperatorType *ot)
 +{
 +      /* identifiers */
 +      ot->name = "Mark Freestyle Face";
 +      ot->description = "(un)mark selected faces for exclusion from Freestyle feature edge detection";
 +      ot->idname = "MESH_OT_mark_freestyle_face";
 +
 +      /* api callbacks */
 +      ot->exec = edbm_mark_freestyle_face_exec;
 +      ot->poll = ED_operator_editmesh;
 +
 +      /* flags */
 +      ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 +
 +      RNA_def_boolean(ot->srna, "clear", 0, "Clear", "");
 +}
 +
@@@ -570,572 -567,12 +571,572 @@@ void SCENE_OT_render_layer_remove(wmOpe
        ot->exec = render_layer_remove_exec;
  
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
  }
  
 +static int freestyle_module_add_exec(bContext *C, wmOperator *UNUSED(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 *UNUSED(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 *UNUSED(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_copy_exec(bContext *C, wmOperator *op)
 +{
 +      Scene *scene= CTX_data_scene(C);
 +      SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay);
 +
 +      FRS_copy_active_lineset(&srl->freestyleConfig);
 +
 +      WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
 +      
 +      return OPERATOR_FINISHED;
 +}
 +
 +void SCENE_OT_freestyle_lineset_copy(wmOperatorType *ot)
 +{
 +      /* identifiers */
 +      ot->name= "Copy Line Set";
 +      ot->idname= "SCENE_OT_freestyle_lineset_copy";
 +      ot->description="Copy the active line set to a buffer";
 +      
 +      /* api callbacks */
 +      ot->exec= freestyle_lineset_copy_exec;
 +      ot->poll= freestyle_active_lineset_poll;
 +
 +      /* flags */
 +      ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 +}
 +
 +static int freestyle_lineset_paste_exec(bContext *C, wmOperator *op)
 +{
 +      Scene *scene= CTX_data_scene(C);
 +      SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay);
 +
 +      FRS_paste_active_lineset(&srl->freestyleConfig);
 +
 +      WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
 +      
 +      return OPERATOR_FINISHED;
 +}
 +
 +void SCENE_OT_freestyle_lineset_paste(wmOperatorType *ot)
 +{
 +      /* identifiers */
 +      ot->name= "Paste Line Set";
 +      ot->idname= "SCENE_OT_freestyle_lineset_paste";
 +      ot->description="Paste the buffer content to the active line set";
 +      
 +      /* api callbacks */
 +      ot->exec= freestyle_lineset_paste_exec;
 +      ot->poll= freestyle_active_lineset_poll;
 +
 +      /* flags */
 +      ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 +}
 +
 +static int freestyle_lineset_remove_exec(bContext *C, wmOperator *UNUSED(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_copy_linestyle(lineset->linestyle);
 +
 +      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_geometry_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_geometry_modifier(lineset->linestyle, type) < 0) {
 +              BKE_report(op->reports, RPT_ERROR, "Unknown stroke geometry modifier type.");
 +              return OPERATOR_CANCELLED;
 +      }
 +      WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
 +      
 +      return OPERATOR_FINISHED;
 +}
 +
 +void SCENE_OT_freestyle_geometry_modifier_add(wmOperatorType *ot)
 +{
 +      /* identifiers */
 +      ot->name= "Add Stroke Geometry Modifier";
 +      ot->idname= "SCENE_OT_freestyle_geometry_modifier_add";
 +      ot->description = "Add a stroke geometry modifier to the line style associated with the active lineset";
 +      
 +      /* api callbacks */
 +      ot->invoke= WM_menu_invoke;
 +      ot->exec= freestyle_geometry_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_geometry_modifier_type_items, 0, "Type", "");
 +}
 +
 +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;
 +      else if (RNA_struct_is_a(ptr->type, &RNA_LineStyleGeometryModifier))
 +              return LS_MODIFIER_TYPE_GEOMETRY;
 +      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;
 +      case LS_MODIFIER_TYPE_GEOMETRY:
 +              FRS_remove_linestyle_geometry_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;
 +      case LS_MODIFIER_TYPE_GEOMETRY:
 +              FRS_move_linestyle_geometry_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;
+       ID *id = CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).id.data;
  
        if (id) {
                MTex **mtex_ar, *mtexswap;
@@@ -2494,24 -2493,13 +2493,28 @@@ static void draw_dm_edges_sharp(BMEditM
        dm->drawMappedEdges(dm, draw_dm_edges_sharp__setDrawOptions, em);
  }
  
- static int draw_dm_edges_freestyle__setDrawOptions(void *userData, int index)
 +/* Draw only Freestyle feature edges */
-       BMEdge *eed = EDBM_get_edge_for_index(userData, index);
++static DMDrawOption draw_dm_edges_freestyle__setDrawOptions(void *userData, int index)
 +{
-       return !BM_elem_flag_test(eed, BM_ELEM_HIDDEN) && BM_elem_flag_test(eed, BM_ELEM_FREESTYLE);
++      BMEdge *eed = EDBM_edge_at_index(userData, index);
 +
++      if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN) && BM_elem_flag_test(eed, BM_ELEM_FREESTYLE))
++              return DM_DRAW_OPTION_NORMAL;
++      else
++              return DM_DRAW_OPTION_SKIP;
 +}
++
 +static void draw_dm_edges_freestyle(BMEditMesh *em, DerivedMesh *dm)
 +{
 +      dm->drawMappedEdges(dm, draw_dm_edges_freestyle__setDrawOptions, em);
 +}
  
  /* Draw faces with color set based on selection
-        * return 2 for the active face so it renders with stipple enabled */
+  * return 2 for the active face so it renders with stipple enabled */
  static DMDrawOption draw_dm_faces_sel__setDrawOptions(void *userData, int index)
  {
-       drawDMFacesSel_userData * data = userData;
-       BMFace *efa = EDBM_get_face_for_index(data->em, index);
+       drawDMFacesSel_userData *data = userData;
+       BMFace *efa = EDBM_face_at_index(data->em, index);
        unsigned char *col;
        
        if (!efa)
                        return DM_DRAW_OPTION_STIPPLE;
                }
                else {
-                       col = data->cols[BM_elem_flag_test(efa, BM_ELEM_SELECT)?1:BM_elem_flag_test(efa, BM_ELEM_FREESTYLE)?2:0];
-                       if (col[3]==0)
 -                      col = data->cols[BM_elem_flag_test(efa, BM_ELEM_SELECT) ? 1 : 0];
++                      col = data->cols[BM_elem_flag_test(efa, BM_ELEM_SELECT) ? 1 : BM_elem_flag_test(efa, BM_ELEM_FREESTYLE) ? 2 : 0];
+                       if (col[3] == 0)
                                return DM_DRAW_OPTION_SKIP;
                        glColor4ubv(col);
                        return DM_DRAW_OPTION_NORMAL;
@@@ -2554,10 -2542,10 +2557,10 @@@ static int draw_dm_faces_sel__compareDr
        if (efa == data->efa_act || next_efa == data->efa_act)
                return 0;
  
-       col = data->cols[BM_elem_flag_test(efa, BM_ELEM_SELECT)?1:BM_elem_flag_test(efa, BM_ELEM_FREESTYLE)?2:0];
-       next_col = data->cols[BM_elem_flag_test(next_efa, BM_ELEM_SELECT)?1:BM_elem_flag_test(next_efa, BM_ELEM_FREESTYLE)?2:0];
 -      col = data->cols[BM_elem_flag_test(efa, BM_ELEM_SELECT) ? 1 : 0];
 -      next_col = data->cols[BM_elem_flag_test(next_efa, BM_ELEM_SELECT) ? 1 : 0];
++      col = data->cols[BM_elem_flag_test(efa, BM_ELEM_SELECT) ? 1 : BM_elem_flag_test(efa, BM_ELEM_FREESTYLE) ? 2 : 0];
++      next_col = data->cols[BM_elem_flag_test(next_efa, BM_ELEM_SELECT) ? 1 : BM_elem_flag_test(next_efa, BM_ELEM_FREESTYLE) ? 2 : 0];
  
-       if (col[3]==0 || next_col[3]==0)
+       if (col[3] == 0 || next_col[3] == 0)
                return 0;
  
        return col == next_col;
  
  /* also draws the active face */
  static void draw_dm_faces_sel(BMEditMesh *em, DerivedMesh *dm, unsigned char *baseCol, 
 -                              unsigned char *selCol, unsigned char *actCol, BMFace *efa_act)
 +                              unsigned char *selCol, unsigned char *markCol, unsigned char *actCol, BMFace *efa_act)
  {
        drawDMFacesSel_userData data;
-       data.dm= dm;
+       data.dm = dm;
        data.cols[0] = baseCol;
        data.em = em;
        data.cols[1] = selCol;
@@@ -3087,44 -3074,40 +3090,44 @@@ static void draw_em_fancy(Scene *scene
                }
        }
        
-       if (me->drawflag & ME_DRAWFACES) {      /* transp faces */
+       if (me->drawflag & ME_DRAWFACES) {  /* transp faces */
 -              unsigned char col1[4], col2[4], col3[4];
 +              unsigned char col1[4], col2[4], col3[4], col4[4];
  
                UI_GetThemeColor4ubv(TH_FACE, col1);
                UI_GetThemeColor4ubv(TH_FACE_SELECT, col2);
 -              UI_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, col3);
 +              UI_GetThemeColor4ubv(TH_FREESTYLE_FACE_MARK, col3);
 +              UI_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, col4);
                
                glEnable(GL_BLEND);
-               glDepthMask(0);         // disable write in zbuffer, needed for nice transp
+               glDepthMask(0);     // disable write in zbuffer, needed for nice transp
                
                /* don't draw unselected faces, only selected, this is MUCH nicer when texturing */
                if (CHECK_OB_DRAWTEXTURE(v3d, dt))
                        col1[3] = 0;
                
 -              draw_dm_faces_sel(em, cageDM, col1, col2, col3, efa_act);
 +              if (!(me->drawflag & ME_DRAW_FREESTYLE_FACE))
 +                      col3[3] = 0;
 +
 +              draw_dm_faces_sel(em, cageDM, col1, col2, col3, col4, efa_act);
  
                glDisable(GL_BLEND);
-               glDepthMask(1);         // restore write in zbuffer
+               glDepthMask(1);     // restore write in zbuffer
        }
        else if (efa_act) {
                /* even if draw faces is off it would be nice to draw the stipple face
                 * Make all other faces zero alpha except for the active
                 * */
 -              unsigned char col1[4], col2[4], col3[4];
 -              col1[3] = col2[3] = 0; /* don't draw */
 -              UI_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, col3);
 +              unsigned char col1[4], col2[4], col3[4], col4[4];
 +              col1[3] = col2[3] = col3[3] = 0; /* don't draw */
 +              UI_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, col4);
                
                glEnable(GL_BLEND);
-               glDepthMask(0);         // disable write in zbuffer, needed for nice transp
+               glDepthMask(0);     // disable write in zbuffer, needed for nice transp
                
 -              draw_dm_faces_sel(em, cageDM, col1, col2, col3, efa_act);
 +              draw_dm_faces_sel(em, cageDM, col1, col2, col3, col4, efa_act);
  
                glDisable(GL_BLEND);
-               glDepthMask(1);         // restore write in zbuffer
+               glDepthMask(1);     // restore write in zbuffer
                
        }
  
Simple merge
Simple merge
@@@ -1233,12 -1263,12 +1265,12 @@@ int main(int argc, const char **argv
        BLI_argsParse(ba, 1, NULL, NULL);
  
  #if defined(WITH_PYTHON_MODULE) || defined(WITH_HEADLESS)
-       G.background= 1; /* python module mode ALWAYS runs in background mode (for now) */
+       G.background = 1; /* python module mode ALWAYS runs in background mode (for now) */
  #else
        /* for all platforms, even windos has it! */
-       if (G.background) signal(SIGINT, blender_esc);  /* ctrl c out bg render */
+       if (G.background) signal(SIGINT, blender_esc);  /* ctrl c out bg render */
  #endif
 -
 +      
        /* background render uses this font too */
        BKE_font_register_builtin(datatoc_Bfont, datatoc_Bfont_size);