[Bf-blender-cvs] [e9df7caf193] temp-lanpr-review: LANPR line rendering (summer of code)

YimingWu noreply at git.blender.org
Wed Nov 20 10:23:16 CET 2019


Commit: e9df7caf1936a2a45e8e8fba4372688a11f3ce6d
Author: YimingWu
Date:   Fri Nov 15 11:46:33 2019 +0800
Branches: temp-lanpr-review
https://developer.blender.org/rBe9df7caf1936a2a45e8e8fba4372688a11f3ce6d

LANPR line rendering (summer of code)

LANPR Patch

This is the patch for soc-2019-npr branch. Now modified as containing only LANPR changes

This patch **doesn't include** the following:

- GPencil modifiers.
- Smooth contour modifier.
- SVG.
- Affected UI scripts.
- Freestyle changes.

Those above will be submitted in other diffs.

Differential Revision: https://developer.blender.org/D5442

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

M	CMakeLists.txt
M	build_files/cmake/config/blender_full.cmake
M	build_files/cmake/config/blender_lite.cmake
M	build_files/cmake/config/blender_release.cmake
M	release/scripts/startup/bl_ui/__init__.py
A	release/scripts/startup/bl_ui/properties_collection.py
M	release/scripts/startup/bl_ui/properties_data_camera.py
A	release/scripts/startup/bl_ui/properties_lanpr.py
M	release/scripts/startup/bl_ui/properties_render.py
M	release/scripts/startup/bl_ui/properties_world.py
M	release/scripts/startup/bl_ui/space_view3d.py
M	source/blender/blenkernel/BKE_gpencil.h
M	source/blender/blenkernel/BKE_scene.h
M	source/blender/blenkernel/CMakeLists.txt
M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/blenkernel/intern/library_query.c
M	source/blender/blenkernel/intern/scene.c
M	source/blender/blenloader/intern/readfile.c
M	source/blender/blenloader/intern/versioning_280.c
M	source/blender/blenloader/intern/writefile.c
M	source/blender/draw/CMakeLists.txt
M	source/blender/draw/DRW_engine.h
A	source/blender/draw/engines/lanpr/lanpr_all.h
A	source/blender/draw/engines/lanpr/lanpr_chain_draw.c
A	source/blender/draw/engines/lanpr/lanpr_cpu.c
A	source/blender/draw/engines/lanpr/lanpr_dpix.c
A	source/blender/draw/engines/lanpr/lanpr_engine.c
A	source/blender/draw/engines/lanpr/shaders/lanpr_dpix_preview_frag.glsl
A	source/blender/draw/engines/lanpr/shaders/lanpr_dpix_preview_geom.glsl
A	source/blender/draw/engines/lanpr/shaders/lanpr_dpix_project_clip_frag.glsl
A	source/blender/draw/engines/lanpr/shaders/lanpr_dpix_project_passthrough_vert.glsl
A	source/blender/draw/engines/lanpr/shaders/lanpr_snake_edge_frag.glsl
A	source/blender/draw/engines/lanpr/shaders/lanpr_snake_image_peel_frag.glsl
A	source/blender/draw/engines/lanpr/shaders/lanpr_snake_line_connection_frag.glsl
A	source/blender/draw/engines/lanpr/shaders/lanpr_snake_line_connection_geom.glsl
A	source/blender/draw/engines/lanpr/shaders/lanpr_snake_line_connection_vert.glsl
A	source/blender/draw/engines/lanpr/shaders/lanpr_snake_multichannel_frag.glsl
A	source/blender/draw/engines/lanpr/shaders/lanpr_software_chain_geom.glsl
A	source/blender/draw/engines/lanpr/shaders/lanpr_software_line_chain_geom.glsl
A	source/blender/draw/engines/lanpr/shaders/lanpr_software_passthrough_vert.glsl
M	source/blender/draw/intern/DRW_render.h
M	source/blender/draw/intern/draw_manager.c
M	source/blender/draw/intern/draw_manager_texture.c
M	source/blender/editors/CMakeLists.txt
A	source/blender/editors/include/ED_lanpr.h
A	source/blender/editors/lanpr/CMakeLists.txt
A	source/blender/editors/lanpr/lanpr_chain.c
A	source/blender/editors/lanpr/lanpr_cpu.c
A	source/blender/editors/lanpr/lanpr_intern.h
A	source/blender/editors/lanpr/lanpr_ops.c
A	source/blender/editors/lanpr/lanpr_util.c
M	source/blender/editors/mesh/CMakeLists.txt
M	source/blender/editors/mesh/editmesh_tools.c
M	source/blender/editors/mesh/mesh_intern.h
M	source/blender/editors/mesh/mesh_ops.c
M	source/blender/editors/render/render_update.c
M	source/blender/editors/space_api/CMakeLists.txt
M	source/blender/editors/space_api/spacetypes.c
M	source/blender/editors/space_buttons/buttons_context.c
M	source/blender/editors/space_buttons/space_buttons.c
M	source/blender/editors/space_view3d/space_view3d.c
M	source/blender/makesdna/DNA_collection_types.h
M	source/blender/makesdna/DNA_gpencil_types.h
A	source/blender/makesdna/DNA_lanpr_types.h
M	source/blender/makesdna/DNA_object_types.h
M	source/blender/makesdna/DNA_scene_types.h
M	source/blender/makesdna/DNA_space_types.h
M	source/blender/makesdna/intern/makesdna.c
M	source/blender/makesrna/RNA_access.h
M	source/blender/makesrna/intern/CMakeLists.txt
M	source/blender/makesrna/intern/makesrna.c
M	source/blender/makesrna/intern/rna_collection.c
M	source/blender/makesrna/intern/rna_internal.h
A	source/blender/makesrna/intern/rna_lanpr.c
M	source/blender/makesrna/intern/rna_object.c
M	source/blender/makesrna/intern/rna_scene.c
M	source/blender/makesrna/intern/rna_space.c
M	source/blender/python/intern/bpy_app_build_options.c

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 738914fee44..86c3e9cf0f9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -374,6 +374,9 @@ mark_as_advanced(WITH_SYSTEM_GLOG)
 # Freestyle
 option(WITH_FREESTYLE     "Enable Freestyle (advanced edges rendering)" ON)
 
+# LANPR
+option(WITH_LANPR     "Enable LANPR (more advanced edges rendering)" ON)
+
 # Misc
 if(WIN32)
   option(WITH_INPUT_IME "Enable Input Method Editor (IME) for complex Asian character input" ON)
@@ -1797,6 +1800,7 @@ if(FIRST_RUN)
   info_cfg_option(WITH_INPUT_NDOF)
   info_cfg_option(WITH_CYCLES)
   info_cfg_option(WITH_FREESTYLE)
+  info_cfg_option(WITH_LANPR)
   info_cfg_option(WITH_OPENCOLORIO)
   info_cfg_option(WITH_OPENIMAGEDENOISE)
   info_cfg_option(WITH_OPENVDB)
diff --git a/build_files/cmake/config/blender_full.cmake b/build_files/cmake/config/blender_full.cmake
index 4c47c4c4dba..a9d50158b75 100644
--- a/build_files/cmake/config/blender_full.cmake
+++ b/build_files/cmake/config/blender_full.cmake
@@ -18,6 +18,7 @@ set(WITH_LIBMV               ON  CACHE BOOL "" FORCE)
 set(WITH_LIBMV_SCHUR_SPECIALIZATIONS ON CACHE BOOL "" FORCE)
 set(WITH_COMPOSITOR          ON  CACHE BOOL "" FORCE)
 set(WITH_FREESTYLE           ON  CACHE BOOL "" FORCE)
+set(WITH_LANPR               ON  CACHE BOOL "" FORCE)
 set(WITH_GHOST_XDND          ON  CACHE BOOL "" FORCE)
 set(WITH_IK_SOLVER           ON  CACHE BOOL "" FORCE)
 set(WITH_IK_ITASC            ON  CACHE BOOL "" FORCE)
diff --git a/build_files/cmake/config/blender_lite.cmake b/build_files/cmake/config/blender_lite.cmake
index 6d0f160c764..3aa54f97592 100644
--- a/build_files/cmake/config/blender_lite.cmake
+++ b/build_files/cmake/config/blender_lite.cmake
@@ -24,6 +24,7 @@ set(WITH_LIBMV               OFF CACHE BOOL "" FORCE)
 set(WITH_LLVM                OFF CACHE BOOL "" FORCE)
 set(WITH_COMPOSITOR          OFF CACHE BOOL "" FORCE)
 set(WITH_FREESTYLE           OFF CACHE BOOL "" FORCE)
+set(WITH_LANPR               OFF CACHE BOOL "" FORCE)
 set(WITH_GHOST_XDND          OFF CACHE BOOL "" FORCE)
 set(WITH_IK_SOLVER           OFF CACHE BOOL "" FORCE)
 set(WITH_IK_ITASC            OFF CACHE BOOL "" FORCE)
diff --git a/build_files/cmake/config/blender_release.cmake b/build_files/cmake/config/blender_release.cmake
index cf849519c83..2ef629a2ecc 100644
--- a/build_files/cmake/config/blender_release.cmake
+++ b/build_files/cmake/config/blender_release.cmake
@@ -19,6 +19,7 @@ set(WITH_LIBMV               ON  CACHE BOOL "" FORCE)
 set(WITH_LIBMV_SCHUR_SPECIALIZATIONS ON CACHE BOOL "" FORCE)
 set(WITH_COMPOSITOR          ON  CACHE BOOL "" FORCE)
 set(WITH_FREESTYLE           ON  CACHE BOOL "" FORCE)
+set(WITH_LANPR               ON  CACHE BOOL "" FORCE)
 set(WITH_GHOST_XDND          ON  CACHE BOOL "" FORCE)
 set(WITH_IK_SOLVER           ON  CACHE BOOL "" FORCE)
 set(WITH_IK_ITASC            ON  CACHE BOOL "" FORCE)
diff --git a/release/scripts/startup/bl_ui/__init__.py b/release/scripts/startup/bl_ui/__init__.py
index 5daacbb2e44..ac5d1a7ac30 100644
--- a/release/scripts/startup/bl_ui/__init__.py
+++ b/release/scripts/startup/bl_ui/__init__.py
@@ -65,6 +65,7 @@ _modules = [
     "properties_scene",
     "properties_texture",
     "properties_world",
+    "properties_collection",
 
     # Generic Space Modules
     #
@@ -101,6 +102,9 @@ import bpy
 if bpy.app.build_options.freestyle:
     _modules.append("properties_freestyle")
 
+if bpy.app.build_options.lanpr:
+    _modules.append("properties_lanpr")
+
 __import__(name=__name__, fromlist=_modules)
 _namespace = globals()
 _modules_loaded = [_namespace[name] for name in _modules]
diff --git a/release/scripts/startup/bl_ui/properties_collection.py b/release/scripts/startup/bl_ui/properties_collection.py
new file mode 100644
index 00000000000..fe721cd189a
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_collection.py
@@ -0,0 +1,118 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <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
+
+    @classmethod
+    def poll(cls, context):
+        return (context.engine in cls.COMPAT_ENGINES)
+
+
+def lanpr_make_line_type_entry(col, line_type, text_disp, expand, search_from):
+    col.prop(line_type, "use", text=text_disp)
+    if line_type.use and expand:
+        col.prop_search(line_type, "layer", search_from, "layers", icon='GREASEPENCIL')
+        col.prop_search(line_type, "material",  search_from, "materials", icon='SHADING_TEXTURE')
+
+class COLLECTION_PT_collection_flags(CollectionButtonsPanel, Panel):
+    bl_label = "Collection Flags"
+
+    def draw(self, context):
+        layout=self.layout
+        collection=context.collection
+        vl = context.view_layer
+        vlc = vl.active_layer_collection
+        if vlc.name == 'Master Collection':
+            row = layout.row()
+            row.label(text="This is the master collection")
+            return
+        
+        row = layout.row()
+        col = row.column(align=True)
+        col.prop(vlc,"hide_viewport")
+        col.prop(vlc,"holdout")
+        col.prop(vlc,"indirect_only")
+        row = layout.row()
+        col = row.column(align=True)
+        col.prop(collection,"hide_select")
+        col.prop(collection,"hide_viewport")
+        col.prop(collection,"hide_render")
+
+class COLLECTION_PT_lanpr_collection(CollectionButtonsPanel, Panel):
+    bl_label = "Collection LANPR"
+
+    @classmethod
+    def poll(cls, context):
+        return context.scene.render.engine == 'BLENDER_LANPR' or context.scene.lanpr.enabled
+
+    def draw(self,context):
+        layout = self.layout
+        layout.use_property_split = True
+        layout.use_property_decorate = False
+        collection = context.collection
+        lanpr = collection.lanpr
+        row = layout.row()
+        row.prop(lanpr,"usage")
+        if lanpr.usage!='INCLUDE':
+            layout.prop(lanpr,"force")
+        else:
+            layout.prop(lanpr,"target")
+            
+            if lanpr.target:
+
+                layout.prop(lanpr,'use_multiple_levels', text="Multiple Levels")
+                
+                if lanpr.use_multiple_levels:
+                    col = layout.column(align=True)
+                    col.prop(lanpr,'level_start',text="Level Begin")
+                    col.prop(lanpr,'level_end',text="End")
+                else:
+                    layout.prop(lanpr,'level_start',text="Level")
+                
+                layout.prop(lanpr, "use_same_style")
+
+                if lanpr.use_same_style:
+                    layout.prop_search(lanpr, 'target_layer', lanpr.target.data, "layers", icon='GREASEPENCIL')
+                    layout.prop_search(lanpr, 'target_material', lanpr.target.data, "materials", icon='SHADING_TEXTURE')
+
+                expand = not lanpr.use_same_style
+                lanpr_make_line_type_entry(layout, lanpr.contour, "Contour", expand, lanpr.target.data)
+                lanpr_make_line_type_entry(layout, lanpr.crease, "Crease", expand, lanpr.target.data)
+                lanpr_make_line_type_entry(layout, lanpr.material, "Material", expand, lanpr.target.data)
+                lanpr_make_line_type_entry(layout, lanpr.edge_mark, "Edge Mark", expand, lanpr.target.data)
+                lanpr_make_line_type_entry(layout, lanpr.intersection, "Intersection", expand, lanpr.target.data)
+
+classes = (
+    COLLECTION_PT_collection_flags,
+    COLLECTION_PT_lanpr_collection,
+)
+
+if __name__ == "__main__":  # only for live edit.
+    from bpy.utils import register_class
+    for cls in classes:
+        register_class(cls)
diff --git a/release/scripts/startup/bl_ui/properties_data_camera.py b/release/scripts/startup/bl_ui/properties_data_camera.py
index eef70056be8..5d654d33a2d 100644
--- a/release/scripts/startup/bl_ui/properties_data_camera.py
+++ b/release/scripts/startup/bl_ui/properties_data_camera.py
@@ -39,7 +39,7 @@ class CAMERA_PT_presets(PresetPanel, Panel):
     preset_subdir = "camera"
     preset_operator = "script.execute_preset"
     preset_add_operator = "camera.preset_add"
-    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_LANPR', 'BLENDER_WORKBENCH'}
 
 
 class SAFE_AREAS_PT_presets(PresetPanel, Panel):
@@ -47,13 +47,13 @@ class SAFE_AREAS_PT_presets(PresetPanel, Panel):
     preset_subdir = "safe_areas"
     preset_operator = "script.execute_preset"
     preset_add_operator = "safe_areas.preset_add"
-    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_LANPR', 'BLENDER_WORKBENCH'}
 
 
 class DATA_PT_context_camera(CameraButtonsPanel, Panel):
     bl_label = ""
     bl_options = {'HIDE_HEADER'}
-    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_LANPR', 'BLENDER_WORKBENCH'}
 
     def draw(self, context):
         layout = self.layout
@@ -70,7 +70,7 @@ class DATA_PT_context_camera(CameraButtonsPanel, Panel):
 
 class DATA_PT_lens(CameraButtonsPanel, Panel):
     bl_label = "Lens"
-    COMPAT_ENGINES = {'BLENDER_RENDER',

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list