[Bf-blender-cvs] [bd9a8de00c0] lanpr-under-gp: LineArt: LISTBASE_FOREACH modifications.

YimingWu noreply at git.blender.org
Wed Nov 4 09:26:01 CET 2020


Commit: bd9a8de00c0f913345e5ba5f4b8fdfc97a80c6e8
Author: YimingWu
Date:   Wed Nov 4 15:02:50 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rBbd9a8de00c0f913345e5ba5f4b8fdfc97a80c6e8

LineArt: LISTBASE_FOREACH modifications.

===================================================================

M	source/blender/blenkernel/intern/scene.c
M	source/blender/blenloader/intern/versioning_290.c
M	source/blender/editors/include/ED_lineart.h
M	source/blender/editors/lineart/lineart_chain.c

===================================================================

diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index fa862a0ed04..425f8eb2dc4 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -236,22 +236,6 @@ static void scene_copy_markers(Scene *scene_dst, const Scene *scene_src, const i
   }
 }
 
-static void BKE_lineart_free_everything(Scene *s)
-{
-#if 0
-  SceneLineart *lineart = &s->lineart;
-#endif
-  /* Nothing to free. Reserved for future. */
-}
-
-static void BKE_lineart_copy_data(const Scene *from, Scene *to)
-{
-#if 0
-  const SceneLineart *lineart = &from->lineart;
-#endif
-  /*  Line layer removed. Currently nothing to do. Reserved for future. */
-}
-
 static void scene_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int flag)
 {
   Scene *scene_dst = (Scene *)id_dst;
diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c
index 93eee5224ca..992238ec49c 100644
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@ -1139,16 +1139,14 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
    */
   {
 
-    for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
-      if (!DNA_struct_find(fd->filesdna, "SceneLineart")) {
-        for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
-          scene->lineart.crease_threshold = 140.0f;
-          scene->lineart.line_types |= LRT_EDGE_FLAG_ALL_TYPE;
-          scene->lineart.flags |= (LRT_ALLOW_DUPLI_OBJECTS | LRT_REMOVE_DOUBLES);
-          scene->lineart.angle_splitting_threshold = DEG2RAD(60.0f);
-          scene->lineart.chaining_geometry_threshold = 0.01f;
-          scene->lineart.chaining_image_threshold = 0.01f;
-        }
+    if (!DNA_struct_find(fd->filesdna, "SceneLineart")) {
+      LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
+        scene->lineart.crease_threshold = 140.0f;
+        scene->lineart.line_types |= LRT_EDGE_FLAG_ALL_TYPE;
+        scene->lineart.flags |= (LRT_ALLOW_DUPLI_OBJECTS | LRT_REMOVE_DOUBLES);
+        scene->lineart.angle_splitting_threshold = DEG2RAD(60.0f);
+        scene->lineart.chaining_geometry_threshold = 0.01f;
+        scene->lineart.chaining_image_threshold = 0.01f;
       }
     }
   }
diff --git a/source/blender/editors/include/ED_lineart.h b/source/blender/editors/include/ED_lineart.h
index 59030f568d5..96120b74a96 100644
--- a/source/blender/editors/include/ED_lineart.h
+++ b/source/blender/editors/include/ED_lineart.h
@@ -275,18 +275,18 @@ typedef struct LineartRenderBuffer {
   int draw_material_preview;
   double material_transparency;
 
-  char use_contour;
-  char use_crease;
-  char use_material;
-  char use_edge_marks;
-  char use_intersections;
-  char fuzzy_intersections;
-  char fuzzy_everything;
-  char allow_boundaries;
-  char remove_doubles;
+  bool use_contour;
+  bool use_crease;
+  bool use_material;
+  bool use_edge_marks;
+  bool use_intersections;
+  bool fuzzy_intersections;
+  bool fuzzy_everything;
+  bool allow_boundaries;
+  bool remove_doubles;
 
   /** Keep an copy of these data so the scene can be freed when lineart is runnning. */
-  char cam_is_persp;
+  bool cam_is_persp;
   float cam_obmat[4][4];
   double camera_pos[3];
   double near_clip, far_clip;
diff --git a/source/blender/editors/lineart/lineart_chain.c b/source/blender/editors/lineart/lineart_chain.c
index da4b978ccce..897674a8ffd 100644
--- a/source/blender/editors/lineart/lineart_chain.c
+++ b/source/blender/editors/lineart/lineart_chain.c
@@ -721,12 +721,11 @@ static LineartChainRegisterEntry *lineart_chain_get_closest_cre(LineartRenderBuf
                                                                 LineartBoundingArea *caller_ba)
 {
 
-  LineartChainRegisterEntry *cre, *next_cre, *closest_cre = NULL;
+  LineartChainRegisterEntry *closest_cre = NULL;
 
   /* Keep using for loop because cre could be removed from the iteration before getting to the
    * next one. */
-  for (cre = ba->linked_chains.first; cre; cre = next_cre) {
-    next_cre = cre->next;
+  LISTBASE_FOREACH_MUTABLE (LineartChainRegisterEntry *, cre, &ba->linked_chains) {
     if (cre->rlc->object_ref != rlc->object_ref) {
       if (!rb->fuzzy_everything) {
         if (rb->fuzzy_intersections) {



More information about the Bf-blender-cvs mailing list