[Bf-blender-cvs] [7da7d97affc] temp-lanpr-review: Cleanup: LANPR compilder flags, missing registers, and some other fixes.

YimingWu noreply at git.blender.org
Fri Nov 22 12:18:44 CET 2019


Commit: 7da7d97affc215e0e1725a4c59032b7c7d0199cb
Author: YimingWu
Date:   Fri Nov 22 19:17:54 2019 +0800
Branches: temp-lanpr-review
https://developer.blender.org/rB7da7d97affc215e0e1725a4c59032b7c7d0199cb

Cleanup: LANPR compilder flags, missing registers, and some other fixes.

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

M	release/scripts/startup/bl_ui/properties_collection.py
M	release/scripts/startup/bl_ui/properties_lanpr.py
M	release/scripts/startup/bl_ui/properties_render.py
M	source/blender/blenkernel/intern/scene.c
M	source/blender/draw/CMakeLists.txt
M	source/blender/draw/DRW_engine.h
M	source/blender/draw/engines/lanpr/lanpr_engine.c
M	source/blender/editors/CMakeLists.txt
M	source/blender/editors/include/ED_lanpr.h
M	source/blender/editors/lanpr/lanpr_cpu.c
M	source/blender/editors/render/render_update.c
M	source/blender/editors/space_api/spacetypes.c
M	source/blender/editors/space_buttons/CMakeLists.txt
M	source/blender/editors/space_buttons/buttons_context.c
M	source/blender/editors/space_buttons/space_buttons.c
M	source/blender/editors/space_view3d/CMakeLists.txt
M	source/blender/editors/space_view3d/space_view3d.c
M	source/blender/editors/util/CMakeLists.txt
M	source/blender/makesrna/intern/rna_scene.c
M	source/blender/python/intern/bpy_app_build_options.c

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

diff --git a/release/scripts/startup/bl_ui/properties_collection.py b/release/scripts/startup/bl_ui/properties_collection.py
index fe721cd189a..8b99af8a33e 100644
--- a/release/scripts/startup/bl_ui/properties_collection.py
+++ b/release/scripts/startup/bl_ui/properties_collection.py
@@ -18,15 +18,12 @@
 
 # <pep8 compliant>
 from bpy.types import Panel
-from bpy import data
-from mathutils import Vector
-
 
 class CollectionButtonsPanel:
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
     bl_context = "collection"
-    # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
+    COMPAT_ENGINES = { 'BLENDER_LANPR' }
 
     @classmethod
     def poll(cls, context):
@@ -41,6 +38,7 @@ def lanpr_make_line_type_entry(col, line_type, text_disp, expand, search_from):
 
 class COLLECTION_PT_collection_flags(CollectionButtonsPanel, Panel):
     bl_label = "Collection Flags"
+    COMPAT_ENGINES = { 'BLENDER_LANPR' }
 
     def draw(self, context):
         layout=self.layout
@@ -65,6 +63,7 @@ class COLLECTION_PT_collection_flags(CollectionButtonsPanel, Panel):
 
 class COLLECTION_PT_lanpr_collection(CollectionButtonsPanel, Panel):
     bl_label = "Collection LANPR"
+    COMPAT_ENGINES = { 'BLENDER_LANPR' }
 
     @classmethod
     def poll(cls, context):
diff --git a/release/scripts/startup/bl_ui/properties_lanpr.py b/release/scripts/startup/bl_ui/properties_lanpr.py
index 564a44cc1f9..6bb42ec75ba 100644
--- a/release/scripts/startup/bl_ui/properties_lanpr.py
+++ b/release/scripts/startup/bl_ui/properties_lanpr.py
@@ -18,19 +18,12 @@
 
 # <pep8 compliant>
 from bpy.types import Panel
-from bpy import data
-from mathutils import Vector
-
 
 class LanprButtonsPanel:
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
     bl_context = "lanpr"
-    # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
-
-    @classmethod
-    def poll(cls, context):
-        return True
+    COMPAT_ENGINES = { 'BLENDER_LANPR' }
 
 def lanpr_make_line_type_entry(col, line_type, text_disp, expand, search_from):
     col.prop(line_type, "use", text=text_disp)
@@ -40,6 +33,7 @@ def lanpr_make_line_type_entry(col, line_type, text_disp, expand, search_from):
 
 class OBJECT_PT_lanpr_settings(LanprButtonsPanel, Panel):
     bl_label = "LANPR settings"
+    COMPAT_ENGINES = { 'BLENDER_LANPR' }
 
     @classmethod
     def poll(cls, context):
@@ -80,6 +74,7 @@ class OBJECT_PT_lanpr_settings(LanprButtonsPanel, Panel):
 
 class OBJECT_PT_lanpr(LanprButtonsPanel, Panel):
     bl_label = "Usage"
+    COMPAT_ENGINES = { 'BLENDER_LANPR' }
 
     @classmethod
     def poll(cls, context):
diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py
index 27c7c908d29..f5d89d55d37 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -673,10 +673,6 @@ class RENDER_PT_lanpr(RenderButtonsPanel, Panel):
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_LANPR', 'BLENDER_OPENGL', 'BLENDER_EEVEE'}
     bl_label = "LANPR"
     bl_options = {'DEFAULT_CLOSED'}
-    
-    @classmethod
-    def poll(cls, context):
-        return True
 
     def draw_header(self, context):
         if context.scene.render.engine != 'BLENDER_LANPR':
@@ -990,10 +986,6 @@ class RENDER_PT_lanpr_options(RenderButtonsPanel, Panel):
     bl_options = {'DEFAULT_CLOSED'}
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_LANPR', 'BLENDER_OPENGL', 'BLENDER_EEVEE'}
 
-    @classmethod
-    def poll(cls, context):
-        return True
-
     def draw(self, context):
         scene = context.scene
         lanpr = scene.lanpr
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index ffe3b7f56c8..b569c0ed8e2 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -532,7 +532,7 @@ void BKE_lanpr_free_everything(Scene *s)
   LANPR_LineLayerComponent *llc;
 
 #ifdef WITH_LANPR
-  DRW_scene_freecache(s);
+  DRW_scene_lanpr_freecache(s);
 #endif
 
   while ((ll = BLI_pophead(&lanpr->line_layers)) != NULL) {
diff --git a/source/blender/draw/CMakeLists.txt b/source/blender/draw/CMakeLists.txt
index c89dd10e217..3567b512863 100644
--- a/source/blender/draw/CMakeLists.txt
+++ b/source/blender/draw/CMakeLists.txt
@@ -176,6 +176,7 @@ if(WITH_LANPR)
 	  engines/lanpr
   )
   list(APPEND SRC
+    engines/lanpr/lanpr_all.h
     engines/lanpr/lanpr_dpix.c
     engines/lanpr/lanpr_engine.c
     engines/lanpr/lanpr_cpu.c
@@ -409,8 +410,4 @@ if(WITH_FREESTYLE)
   add_definitions(-DWITH_FREESTYLE)
 endif()
 
-if(WITH_LANPR)
-  add_definitions(-DWITH_LANPR)
-endif()
-
 blender_add_lib(bf_draw "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/draw/DRW_engine.h b/source/blender/draw/DRW_engine.h
index 6cb3732346c..652a97fb0d3 100644
--- a/source/blender/draw/DRW_engine.h
+++ b/source/blender/draw/DRW_engine.h
@@ -139,7 +139,11 @@ void DRW_draw_select_id(struct Depsgraph *depsgraph,
 bool DRW_render_check_grease_pencil(struct Depsgraph *depsgraph);
 void DRW_render_gpencil(struct RenderEngine *engine, struct Depsgraph *depsgraph);
 void DRW_gpencil_freecache(struct Object *ob);
-void DRW_scene_freecache(struct Scene *sce);
+
+/* LANPR calls */
+#ifdef WITH_LANPR
+void DRW_scene_lanpr_freecache(struct Scene *sce);
+#endif
 
 /* This is here because GPUViewport needs it */
 struct DRWInstanceDataList *DRW_instance_data_list_create(void);
diff --git a/source/blender/draw/engines/lanpr/lanpr_engine.c b/source/blender/draw/engines/lanpr/lanpr_engine.c
index 460612c817b..6dbe0bdf880 100644
--- a/source/blender/draw/engines/lanpr/lanpr_engine.c
+++ b/source/blender/draw/engines/lanpr/lanpr_engine.c
@@ -131,7 +131,7 @@ static void lanpr_engine_init(void *ved)
   lanpr_share.init_complete = 1;
 }
 
-void DRW_scene_freecache(Scene *sce)
+void DRW_scene_lanpr_freecache(Scene *sce)
 {
   LANPR_LineLayer *ll;
 
diff --git a/source/blender/editors/CMakeLists.txt b/source/blender/editors/CMakeLists.txt
index 7fdc7b94501..191a017ecce 100644
--- a/source/blender/editors/CMakeLists.txt
+++ b/source/blender/editors/CMakeLists.txt
@@ -66,5 +66,6 @@ endif()
 add_subdirectory(datafiles)
 
 if(WITH_LANPR)
+  add_definitions(-DWITH_LANPR)
   add_subdirectory(lanpr)
 endif()
diff --git a/source/blender/editors/include/ED_lanpr.h b/source/blender/editors/include/ED_lanpr.h
index d7da029a4f7..eadafa49dd2 100644
--- a/source/blender/editors/include/ED_lanpr.h
+++ b/source/blender/editors/include/ED_lanpr.h
@@ -24,6 +24,10 @@
 #ifndef __ED_LANPR_H__
 #define __ED_LANPR_H__
 
+#ifndef WITH_LANPR
+#    error LANPR code included in non-LANPR-enabled build
+#endif
+
 #include "BLI_listbase.h"
 #include "BLI_linklist.h"
 #include "BLI_math.h"
@@ -598,4 +602,7 @@ void OBJECT_OT_lanpr_update_gp_source(struct wmOperatorType *ot);
 
 void ED_operatortypes_lanpr(void);
 
+/* for rna */
+static bool rna_lanpr_shader_error_get(PointerRNA *UNUSED(ptr));
+
 #endif /* __ED_LANPR_H__ */
diff --git a/source/blender/editors/lanpr/lanpr_cpu.c b/source/blender/editors/lanpr/lanpr_cpu.c
index 3c0ae7066b4..d4e9d6f7a6a 100644
--- a/source/blender/editors/lanpr/lanpr_cpu.c
+++ b/source/blender/editors/lanpr/lanpr_cpu.c
@@ -2105,7 +2105,7 @@ static int lanpr_triangle_line_imagespace_intersection_v2(SpinLock *UNUSED(spl),
   }
 
   /* To accomodate k=0 and k=inf (vertical) lines. */
-  if (abs(rl->l->fbcoord[0] - rl->r->fbcoord[0]) > abs(rl->l->fbcoord[1] - rl->r->fbcoord[1])) {
+  if (ABS(rl->l->fbcoord[0] - rl->r->fbcoord[0]) > ABS(rl->l->fbcoord[1] - rl->r->fbcoord[1])) {
     cut = tmat_get_linear_ratio(rl->l->fbcoord[0], rl->r->fbcoord[0], trans[0]);
   }
   else {
diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c
index 1c6e6926c21..1d0eb88e61f 100644
--- a/source/blender/editors/render/render_update.c
+++ b/source/blender/editors/render/render_update.c
@@ -59,7 +59,9 @@
 #include "ED_render.h"
 #include "ED_view3d.h"
 
+#ifdef WITH_LANPR
 #include "ED_lanpr.h"
+#endif
 
 #include "DEG_depsgraph.h"
 
diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c
index 52814c32d51..528e7dae6aa 100644
--- a/source/blender/editors/space_api/spacetypes.c
+++ b/source/blender/editors/space_api/spacetypes.c
@@ -64,7 +64,9 @@
 #include "ED_gizmo_library.h"
 #include "ED_transform.h"
 
+#ifdef WITH_LANPR
 #include "ED_lanpr.h"
+#endif
 
 #include "io_ops.h"
 
diff --git a/source/blender/editors/space_buttons/CMakeLists.txt b/source/blender/editors/space_buttons/CMakeLists.txt
index 25ff6bbd098..c8a3577de6b 100644
--- a/source/blender/editors/space_buttons/CMakeLists.txt
+++ b/source/blender/editors/space_buttons/CMakeLists.txt
@@ -54,4 +54,8 @@ if(WITH_FREESTYLE)
   add_definitions(-DWITH_FREESTYLE)
 endif()
 
+if(WITH_LANPR)
+  add_definitions(-DWITH_LANPR)
+endif()
+
 blender_add_lib(bf_editor_space_buttons "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index d46ff6bfba1..fa1122e5f75 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -598,10 +598,15 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma
     case BCONTEXT_WORLD:
       found = buttons_context_path_world(path);
       break;
-    case BCONTEXT_COLLECTION:
+    case BCONTEXT_COLLECTION: /* This is for LANPR collection flags */
+#ifdef WITH_LANPR
       found = buttons_context_path_collection(path, window);
+#else
+      BLI_assert(!"'WITH_LANPR' disabled - should not possible to access 'BCONTEXT_COLLECTION'");
+#endif
       break;
-    case BCONTEXT_LANPR:
+    case BCONTEXT_LANPR: /* This is for LANPR object flags */
+#ifdef WITH_LANPR
       if (scene &&
           ((scene->lanpr.flags & LANPR_ENABLED) || !strcmp(scene->r.engine, "BLENDER_LANPR"))) {
         found = buttons_context_path_object(path);
@@ -609,6 +614,9 @@ static int buttons_context_path(const bContext *C, ButsContextPa

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list