Merged changes in the trunk up to revision 51448.
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Sat, 20 Oct 2012 16:48:48 +0000 (16:48 +0000)
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Sat, 20 Oct 2012 16:48:48 +0000 (16:48 +0000)
Conflicts resolved:
source/blender/blenkernel/CMakeLists.txt
source/blender/blenloader/intern/readfile.c
source/blender/editors/mesh/editmesh_tools.c
source/blender/makesrna/intern/rna_main_api.c

42 files changed:
1  2 
doc/python_api/sphinx_doc_gen.py
release/scripts/startup/bl_ui/properties_render.py
release/scripts/startup/bl_ui/space_view3d.py
source/blender/CMakeLists.txt
source/blender/blenkernel/CMakeLists.txt
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/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/bmesh/operators/bmo_utils.c
source/blender/editors/animation/anim_filter.c
source/blender/editors/include/ED_anim_api.h
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_file/filelist.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/transform/transform.c
source/blender/makesdna/DNA_action_types.h
source/blender/makesdna/DNA_material_types.h
source/blender/makesdna/DNA_userdef_types.h
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_main_api.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/CMakeLists.txt
source/blender/render/intern/include/render_types.h
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/pipeline.c
source/blender/render/intern/source/shadeoutput.c
source/blender/windowmanager/CMakeLists.txt
source/blender/windowmanager/WM_types.h
source/blender/windowmanager/intern/wm_files.c
source/blenderplayer/bad_level_call_stubs/stubs.c

Simple merge
Simple merge
index 9a24a3ca4e09f1c0606d3de97a64a436c91afe57,d4e7f09b5f1bd87b341e10b973a0250722b09d6f..f690c9dcda4a32ae55ee22756704d1f0631c3707
@@@ -195,9 -193,8 +194,9 @@@ set(SR
        BKE_lamp.h
        BKE_lattice.h
        BKE_library.h
-       BKE_mask.h
 +      BKE_linestyle.h
        BKE_main.h
+       BKE_mask.h
        BKE_material.h
        BKE_mball.h
        BKE_mesh.h
Simple merge
index b6c793bcdba8f619d968e5dee924baf1b15bcee5,ea0a711788ebe0af0ee4b156166a554715dc49ed..97ca210c3d0a2ed5b0a495722a9b8e7fac9b88f5
@@@ -3625,16 -3629,17 +3630,17 @@@ static void lib_link_customdata_mtpoly(
                
                if (layer->type == CD_MTEXPOLY) {
                        MTexPoly *tf= layer->data;
-                       int i;
+                       int j;
                        
-                       for (i = 0; i < totface; i++, tf++) {
+                       for (j = 0; j < totface; j++, tf++) {
                                tf->tpage = newlibadr(fd, me->id.lib, tf->tpage);
-                               if (tf->tpage && tf->tpage->id.us==0)
+                               if (tf->tpage && tf->tpage->id.us == 0) {
                                        tf->tpage->id.us = 1;
 -                              }
                        }
                }
        }
  }
++}
  
  static void lib_link_mesh(FileData *fd, Main *main)
  {
@@@ -8205,36 -8040,111 +8229,141 @@@ static void do_versions(FileData *fd, L
                                do_version_ntree_tex_coord_from_dupli_264(NULL, NULL, ntree);
        }
  
+       if (main->versionfile < 264 || (main->versionfile == 264 && main->subversionfile < 2)) {
+               MovieClip *clip;
+               for (clip = main->movieclip.first; clip; clip = clip->id.next) {
+                       MovieTracking *tracking = &clip->tracking;
+                       MovieTrackingObject *tracking_object;
+                       for (tracking_object = tracking->objects.first;
+                            tracking_object;
+                            tracking_object = tracking_object->next)
+                       {
+                               if (tracking_object->keyframe1 == 0 && tracking_object->keyframe2 == 0) {
+                                       tracking_object->keyframe1 = tracking->settings.keyframe1;
+                                       tracking_object->keyframe2 = tracking->settings.keyframe2;
+                               }
+                       }
+               }
+       }
+       if (main->versionfile < 264 || (main->versionfile == 264 && main->subversionfile < 3)) {
+               /* smoke branch */
+               {
+                       Object *ob;
+                       for (ob = main->object.first; ob; ob = ob->id.next) {
+                               ModifierData *md;
+                               for (md = ob->modifiers.first; md; md = md->next) {
+                                       if (md->type == eModifierType_Smoke) {
+                                               SmokeModifierData *smd = (SmokeModifierData *)md;
+                                               if ((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain) {
+                                                       /* keep branch saves if possible */
+                                                       if (!smd->domain->flame_max_temp) {
+                                                               smd->domain->burning_rate = 0.75f;
+                                                               smd->domain->flame_smoke = 1.0f;
+                                                               smd->domain->flame_vorticity = 0.5f;
+                                                               smd->domain->flame_ignition = 1.25f;
+                                                               smd->domain->flame_max_temp = 1.75f;
+                                                               smd->domain->adapt_threshold = 0.02f;
+                                                               smd->domain->adapt_margin = 4;
+                                                               smd->domain->flame_smoke_color[0] = 0.7f;
+                                                               smd->domain->flame_smoke_color[1] = 0.7f;
+                                                               smd->domain->flame_smoke_color[2] = 0.7f;
+                                                       }
+                                               }
+                                               else if ((smd->type & MOD_SMOKE_TYPE_FLOW) && smd->flow) {
+                                                       if (!smd->flow->texture_size) {
+                                                               smd->flow->fuel_amount = 1.0;
+                                                               smd->flow->surface_distance = 1.5;
+                                                               smd->flow->color[0] = 0.7f;
+                                                               smd->flow->color[1] = 0.7f;
+                                                               smd->flow->color[2] = 0.7f;
+                                                               smd->flow->texture_size = 1.0f;
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+               }
+               /* render border for viewport */
+               {
+                       bScreen *sc;
+                       for (sc = main->screen.first; sc; sc = sc->id.next) {
+                               ScrArea *sa;
+                               for (sa = sc->areabase.first; sa; sa = sa->next) {
+                                       SpaceLink *sl;
+                                       for (sl = sa->spacedata.first; sl; sl = sl->next) {
+                                               if (sl->spacetype == SPACE_VIEW3D) {
+                                                       View3D *v3d = (View3D *)sl;
+                                                       if (v3d->render_border.xmin == 0.0f && v3d->render_border.ymin == 0.0f &&
+                                                           v3d->render_border.xmax == 0.0f && v3d->render_border.ymax == 0.0f)
+                                                       {
+                                                               v3d->render_border.xmax = 1.0f;
+                                                               v3d->render_border.ymax = 1.0f;
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+               }
+       }
+       if (main->versionfile < 264 || (main->versionfile == 264 && main->subversionfile < 4)) {
+               /* Fix for old node flags: Apparently the SOCK_DYNAMIC flag has been in use for other
+                * purposes before and then removed and later reused for SOCK_DYNAMIC. This socket should
+                * only be used by certain node types which don't use template lists, cleaning this up here.
+                */
+               bNodeTreeType *ntreetype;
+               bNodeTree *ntree;
+               
+               ntreetype = ntreeGetType(NTREE_COMPOSIT);
+               if (ntreetype && ntreetype->foreach_nodetree)
+                       ntreetype->foreach_nodetree(main, NULL, do_version_node_cleanup_dynamic_sockets_264);
+               ntreetype = ntreeGetType(NTREE_SHADER);
+               if (ntreetype && ntreetype->foreach_nodetree)
+                       ntreetype->foreach_nodetree(main, NULL, do_version_node_cleanup_dynamic_sockets_264);
+               ntreetype = ntreeGetType(NTREE_TEXTURE);
+               if (ntreetype && ntreetype->foreach_nodetree)
+                       ntreetype->foreach_nodetree(main, NULL, do_version_node_cleanup_dynamic_sockets_264);
+               
+               for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next)
+                       do_version_node_cleanup_dynamic_sockets_264(NULL, NULL, ntree);
+       }
 +      /* default values in Freestyle settings */
 +      {
 +              Scene *sce;
 +              SceneRenderLayer *srl;
 +              FreestyleLineStyle *linestyle;
 +
 +              for(sce = main->scene.first; sce; sce = sce->id.next) {
 +                      if (sce->r.line_thickness_mode == 0) {
 +                              sce->r.line_thickness_mode= R_LINE_THICKNESS_ABSOLUTE;
 +                              sce->r.unit_line_thickness= 1.f;
 +                      }
 +                      for(srl= sce->r.layers.first; srl; srl= srl->next) {
 +                              if (srl->freestyleConfig.mode == 0)
 +                                      srl->freestyleConfig.mode= FREESTYLE_CONTROL_EDITOR_MODE;
 +                              if (srl->freestyleConfig.raycasting_algorithm == 0)
 +                                      srl->freestyleConfig.raycasting_algorithm= FREESTYLE_ALGO_CULLED_ADAPTIVE_CUMULATIVE;
 +                      }
 +              }
 +              for(linestyle = main->linestyle.first; linestyle; linestyle = linestyle->id.next) {
 +                      if (linestyle->thickness_position == 0) {
 +                              linestyle->thickness_position= LS_THICKNESS_CENTER;
 +                              linestyle->thickness_ratio= 0.5f;
 +                      }
 +                      if (linestyle->chaining == 0)
 +                              linestyle->chaining= LS_CHAINING_PLAIN;
 +                      if (linestyle->rounds == 0)
 +                              linestyle->rounds= 3;
 +              }
 +      }
 +
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! */
        /* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */
  
index fbddd26c9597dcc3fd4c793017f49e6e5f08669a,8d7ae3aad6a8de7a25ae70f400f0b26c6ce7e717..fba42a33f885373ce2c5ac68e046beac89397287
@@@ -233,29 -232,28 +233,29 @@@ typedef enum eAnimFilter_Flags 
  
  /* Dopesheet only */
  /* 'Scene' channels */
- #define SEL_SCEC(sce) ((sce->flag & SCE_DS_SELECTED))
- #define EXPANDED_SCEC(sce) ((sce->flag & SCE_DS_COLLAPSED) == 0)
+ #define SEL_SCEC(sce) (CHECK_TYPE_INLINE(sce, Scene), ((sce->flag & SCE_DS_SELECTED)))
+ #define EXPANDED_SCEC(sce) (CHECK_TYPE_INLINE(sce, Scene), ((sce->flag & SCE_DS_COLLAPSED) == 0))
  /* 'Sub-Scene' channels (flags stored in Data block) */
- #define FILTER_WOR_SCED(wo) ((wo->flag & WO_DS_EXPAND))
+ #define FILTER_WOR_SCED(wo) (CHECK_TYPE_INLINE(wo, World), (wo->flag & WO_DS_EXPAND))
 +#define FILTER_LS_SCED(linestyle) ((linestyle->flag & LS_DS_EXPAND))
  /* 'Object' channels */
- #define SEL_OBJC(base) ((base->flag & SELECT))
- #define EXPANDED_OBJC(ob) ((ob->nlaflag & OB_ADS_COLLAPSED) == 0)
+ #define SEL_OBJC(base)          (CHECK_TYPE_INLINE(base, Base), ((base->flag & SELECT)))
+ #define EXPANDED_OBJC(ob)       (CHECK_TYPE_INLINE(ob, Object), ((ob->nlaflag & OB_ADS_COLLAPSED) == 0))
  /* 'Sub-object' channels (flags stored in Data block) */
- #define FILTER_SKE_OBJD(key) ((key->flag & KEY_DS_EXPAND))
- #define FILTER_MAT_OBJD(ma) ((ma->flag & MA_DS_EXPAND))
- #define FILTER_LAM_OBJD(la) ((la->flag & LA_DS_EXPAND))
- #define FILTER_CAM_OBJD(ca) ((ca->flag & CAM_DS_EXPAND))
- #define FILTER_CUR_OBJD(cu) ((cu->flag & CU_DS_EXPAND))
- #define FILTER_PART_OBJD(part) ((part->flag & PART_DS_EXPAND))
- #define FILTER_MBALL_OBJD(mb) ((mb->flag2 & MB_DS_EXPAND))
- #define FILTER_ARM_OBJD(arm) ((arm->flag & ARM_DS_EXPAND))
- #define FILTER_MESH_OBJD(me) ((me->flag & ME_DS_EXPAND))
- #define FILTER_LATTICE_OBJD(lt) ((lt->flag & LT_DS_EXPAND))
- #define FILTER_SPK_OBJD(spk) ((spk->flag & SPK_DS_EXPAND))
+ #define FILTER_SKE_OBJD(key)    (CHECK_TYPE_INLINE(key, Key), ((key->flag & KEY_DS_EXPAND)))
+ #define FILTER_MAT_OBJD(ma)     (CHECK_TYPE_INLINE(ma, Material), ((ma->flag & MA_DS_EXPAND)))
+ #define FILTER_LAM_OBJD(la)     (CHECK_TYPE_INLINE(la, Lamp), ((la->flag & LA_DS_EXPAND)))
+ #define FILTER_CAM_OBJD(ca)     (CHECK_TYPE_INLINE(ca, Camera), ((ca->flag & CAM_DS_EXPAND)))
+ #define FILTER_CUR_OBJD(cu)     (CHECK_TYPE_INLINE(cu, Curve), ((cu->flag & CU_DS_EXPAND)))
+ #define FILTER_PART_OBJD(part)  (CHECK_TYPE_INLINE(part, ParticleSettings), ((part->flag & PART_DS_EXPAND)))
+ #define FILTER_MBALL_OBJD(mb)   (CHECK_TYPE_INLINE(mb, MetaBall), ((mb->flag2 & MB_DS_EXPAND)))
+ #define FILTER_ARM_OBJD(arm)    (CHECK_TYPE_INLINE(arm, bArmature), ((arm->flag & ARM_DS_EXPAND)))
+ #define FILTER_MESH_OBJD(me)    (CHECK_TYPE_INLINE(me, Mesh), ((me->flag & ME_DS_EXPAND)))
+ #define FILTER_LATTICE_OBJD(lt) (CHECK_TYPE_INLINE(lt, Lattice), ((lt->flag & LT_DS_EXPAND)))
+ #define FILTER_SPK_OBJD(spk)    (CHECK_TYPE_INLINE(spk, Speaker), ((spk->flag & SPK_DS_EXPAND)))
  /* Variable use expanders */
- #define FILTER_NTREE_DATA(ntree) ((ntree->flag & NTREE_DS_EXPAND))
- #define FILTER_TEX_DATA(tex) ((tex->flag & TEX_DS_EXPAND))
+ #define FILTER_NTREE_DATA(ntree) (CHECK_TYPE_INLINE(ntree, bNodeTree), ((ntree->flag & NTREE_DS_EXPAND)))
+ #define FILTER_TEX_DATA(tex)     (CHECK_TYPE_INLINE(tex, Tex), ((tex->flag & TEX_DS_EXPAND)))
  
  /* 'Sub-object/Action' channels (flags stored in Action) */
  #define SEL_ACTC(actc) ((actc->flag & ACT_SELECTED))
index d73e7d81b9f88ae6327f3d5759b2493b5f9a223d,2dbcd20a276a28581206c419c3b9282863c82f87..ee615093c86925f09367dd90fc37f860e15fa430
@@@ -1215,11 -1265,14 +1265,14 @@@ static int edbm_vert_connect(bContext *
        if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
                return OPERATOR_CANCELLED;
        }
+       else {
+               EDBM_selectmode_flush(em);  /* so newly created edges get the selection state from the vertex */
 +      
 +      EDBM_update_generic(C, em, TRUE);
  
 -              EDBM_update_generic(C, em, TRUE);
 -
 -              return len ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
 -      }
 +      return len ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
 +}
+ }
  
  void MESH_OT_vert_connect(wmOperatorType *ot)
  {
@@@ -5393,106 -5480,53 +5480,157 @@@ void MESH_OT_convex_hull(wmOperatorTyp
        join_triangle_props(ot);
  }
  
+ static int mesh_symmetrize_exec(bContext *C, wmOperator *op)
+ {
+       Object *obedit = CTX_data_edit_object(C);
+       BMEditMesh *em = BMEdit_FromObject(obedit);
+       BMOperator bmop;
+       EDBM_op_init(em, &bmop, op, "symmetrize input=%hvef direction=%i",
+                    BM_ELEM_SELECT, RNA_enum_get(op->ptr, "direction"));
+       BMO_op_exec(em->bm, &bmop);
+       if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+               return OPERATOR_CANCELLED;
+       }
+       else {
+               EDBM_update_generic(C, em, TRUE);
+               EDBM_selectmode_flush(em);
+               return OPERATOR_FINISHED;
+       }
+ }
+ void MESH_OT_symmetrize(struct wmOperatorType *ot)
+ {
+       static EnumPropertyItem axis_direction_items[] = {
+               {BMO_SYMMETRIZE_NEGATIVE_X, "NEGATIVE_X", 0, "-X to +X", ""},
+               {BMO_SYMMETRIZE_POSITIVE_X, "POSITIVE_X", 0, "+X to -X", ""},
+               {BMO_SYMMETRIZE_NEGATIVE_Y, "NEGATIVE_Y", 0, "-Y to +Y", ""},
+               {BMO_SYMMETRIZE_POSITIVE_Y, "POSITIVE_Y", 0, "+Y to -Y", ""},
+               {BMO_SYMMETRIZE_NEGATIVE_Z, "NEGATIVE_Z", 0, "-Z to +Z", ""},
+               {BMO_SYMMETRIZE_POSITIVE_Z, "POSITIVE_Z", 0, "+Z to -Z", ""},
+               {0, NULL, 0, NULL, NULL},
+       };
+       /* identifiers */
+       ot->name = "Symmetrize";
+       ot->description = "Enforce symmetry (both form and topological) across an axis";
+       ot->idname = "MESH_OT_symmetrize";
+       /* api callbacks */
+       ot->exec = mesh_symmetrize_exec;
+       ot->poll = ED_operator_editmesh;
+       /* flags */
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+       ot->prop = RNA_def_enum(ot->srna, "direction", axis_direction_items,
+                               BMO_SYMMETRIZE_NEGATIVE_X,
+                               "Direction", "Which sides to copy from and to");
+ }
++
 +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_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
 +                      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_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
 +                      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_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
 +                      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_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
 +                      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", "");
 +}
 +
index df04cc33e71ecea8e86c09298dd625ad0a47069a,82e7fe60301bf15d645d7dfc6dd21a3e19a9ae25..ec54ae09fd2d79012ec4a1f219e4b97aef1e782f
@@@ -2729,8 -2332,8 +2347,8 @@@ static int draw_dm_faces_sel__compareDr
  }
  
  /* also draws the active face */
- static void draw_dm_faces_sel(BMEditMesh *em, DerivedMesh *dm, unsigned char *baseCol, 
+ 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;
index 3485f6b252895ffd51e503c26caf8e1760fff251,329f1273588d441f98513cc018fd66d94078ca08..b77af6988ecfa715060572b1919d06072041d865
@@@ -71,7 -71,7 +71,8 @@@
  #include "BKE_speaker.h"
  #include "BKE_movieclip.h"
  #include "BKE_mask.h"
+ #include "BKE_gpencil.h"
 +#include "BKE_linestyle.h"
  
  #include "DNA_armature_types.h"
  #include "DNA_camera_types.h"
@@@ -562,23 -565,19 +566,36 @@@ static void rna_Main_masks_remove(Main 
        /* XXX python now has invalid pointer? */
  }
  
+ static void rna_Main_grease_pencil_remove(Main *bmain, ReportList *reports, bGPdata *gpd)
+ {
+       if (ID_REAL_USERS(gpd) <= 0) {
+               BKE_gpencil_free(gpd);
+               BKE_libblock_free(&bmain->gpencil, gpd);
+       }
+       else
+               BKE_reportf(reports, RPT_ERROR, "Grease Pencil '%s' must have zero users to be removed, found %d",
+                           gpd->id.name + 2, ID_REAL_USERS(gpd));
+       /* XXX python now has invalid pointer? */
+ }
 +FreestyleLineStyle *rna_Main_linestyles_new(Main *bmain, const char* name)
 +{
 +      FreestyleLineStyle *linestyle = FRS_new_linestyle(name, bmain);
 +      id_us_min(&linestyle->id);
 +      return linestyle;
 +}
 +
 +void rna_Main_linestyles_remove(Main *bmain, ReportList *reports, FreestyleLineStyle *linestyle)
 +{
 +      if(ID_REAL_USERS(linestyle) <= 0)
 +              BKE_libblock_free(&bmain->linestyle, linestyle);
 +      else
 +              BKE_reportf(reports, RPT_ERROR, "Line style \"%s\" must have zero users to be removed, found %d.", linestyle->id.name+2, ID_REAL_USERS(linestyle));
 +
 +      /* XXX python now has invalid pointer? */
 +}
 +
  /* tag functions, all the same */
  static void rna_Main_cameras_tag(Main *bmain, int value) { tag_main_lb(&bmain->camera, value); }
  static void rna_Main_scenes_tag(Main *bmain, int value) { tag_main_lb(&bmain->scene, value); }
index 15aa5164c86ac00c86a3294045c5f3aeb921496d,61c49027d9a4c51ad6ae55413d0521c33e679d4c..bd660b943215977e7fd4acd7490aee0bf7a1a26b
@@@ -33,10 -34,8 +34,9 @@@ set(IN
        ../../makesdna
        ../../makesrna
        ../../windowmanager
-       ../../gpu
+       ../../../../intern/cycles/blender
 +      ../../freestyle/intern/python
        ../../../../intern/guardedalloc
-       ../../../../intern/cycles/blender
  )
  
  set(INC_SYS