[Bf-blender-cvs] [f19ed441b84] lanpr-under-gp: Cleanup: Remove target settings in CollectionLineart.

YimingWu noreply at git.blender.org
Sun Jun 28 16:37:45 CEST 2020


Commit: f19ed441b84e6f8a8e65cdccc4c11b94ba368482
Author: YimingWu
Date:   Sun Jun 28 22:37:39 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rBf19ed441b84e6f8a8e65cdccc4c11b94ba368482

Cleanup: Remove target settings in CollectionLineart.

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

M	release/scripts/startup/bl_ui/properties_collection.py
M	source/blender/blenkernel/intern/collection.c
M	source/blender/blenloader/intern/readfile.c
M	source/blender/blenloader/intern/writefile.c
M	source/blender/editors/lineart/lineart_cpu.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
M	source/blender/makesdna/DNA_collection_types.h
M	source/blender/makesrna/RNA_access.h
M	source/blender/makesrna/intern/rna_collection.c
M	source/blender/makesrna/intern/rna_gpencil_modifier.c

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

diff --git a/release/scripts/startup/bl_ui/properties_collection.py b/release/scripts/startup/bl_ui/properties_collection.py
index 88d12899910..e499bc79cc1 100644
--- a/release/scripts/startup/bl_ui/properties_collection.py
+++ b/release/scripts/startup/bl_ui/properties_collection.py
@@ -19,11 +19,12 @@
 # <pep8 compliant>
 from bpy.types import Panel
 
+
 class CollectionButtonsPanel:
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
     bl_context = "collection"
-    COMPAT_ENGINES = { 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'CYCLES' }
+    COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'CYCLES'}
 
     @classmethod
     def poll(cls, context):
@@ -33,86 +34,55 @@ class CollectionButtonsPanel:
 def lineart_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')
+        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"
-    COMPAT_ENGINES = { 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'CYCLES' }
+    COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'CYCLES'}
 
     def draw(self, context):
-        layout=self.layout
-        collection=context.collection
+        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")
+        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")
+        col.prop(collection, "hide_select")
+        col.prop(collection, "hide_viewport")
+        col.prop(collection, "hide_render")
+
 
 class COLLECTION_PT_lineart_collection(CollectionButtonsPanel, Panel):
     bl_label = "Collection Line Art"
-    COMPAT_ENGINES =  { 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'CYCLES' }
+    COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'CYCLES'}
 
     @classmethod
     def poll(cls, context):
         return context.scene.lineart.enabled
 
-    def draw_header(self, context):
-        layout = self.layout
-        collection = context.collection
-        layout.prop(collection, "configure_lineart", text="")
-
-    def draw(self,context):
+    def draw(self, context):
         layout = self.layout
         layout.use_property_split = True
         layout.use_property_decorate = False
         collection = context.collection
-        if not collection.configure_lineart:
-            return
-        
-        lineart = collection.lineart
+
         row = layout.row()
-        row.prop(lineart,"usage")
-        if lineart.usage!='INCLUDE':
-            layout.prop(lineart,"force")
-        else:
-            layout.prop(lineart,"target")
-            
-            if lineart.target:
-
-                layout.prop(lineart,'use_multiple_levels', text="Multiple Levels")
-                
-                if lineart.use_multiple_levels:
-                    col = layout.column(align=True)
-                    col.prop(lineart,'level_start',text="Level Begin")
-                    col.prop(lineart,'level_end',text="End")
-                else:
-                    layout.prop(lineart,'level_start',text="Level")
-                
-                layout.prop(lineart, "use_same_style")
-
-                if lineart.use_same_style:
-                    layout.prop_search(lineart, 'target_layer', lineart.target.data, "layers", icon='GREASEPENCIL')
-                    layout.prop_search(lineart, 'target_material', lineart.target.data, "materials", icon='SHADING_TEXTURE')
-
-                expand = not lineart.use_same_style
-                lineart_make_line_type_entry(layout, lineart.contour, "Contour", expand, lineart.target.data)
-                lineart_make_line_type_entry(layout, lineart.crease, "Crease", expand, lineart.target.data)
-                lineart_make_line_type_entry(layout, lineart.material, "Material", expand, lineart.target.data)
-                lineart_make_line_type_entry(layout, lineart.edge_mark, "Edge Mark", expand, lineart.target.data)
-                lineart_make_line_type_entry(layout, lineart.intersection, "Intersection", expand, lineart.target.data)
+        row.prop(collection, "lineart_usage")
+
 
 classes = (
     COLLECTION_PT_collection_flags,
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c
index 00604a31845..07eff64e51c 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -81,15 +81,6 @@ static bool collection_find_child_recursive(Collection *parent, Collection *coll
 /** \name Collection Data-Block
  * \{ */
 
-static void collection_lineart_copy(const Collection *src, Collection *dst)
-{
-  if (src->lineart) {
-    CollectionLineart *lineart = MEM_callocN(sizeof(CollectionLineart), "CollectionLineart");
-    dst->lineart = lineart;
-    memcpy(dst->lineart, src->lineart, sizeof(CollectionLineart));
-  }
-}
-
 /**
  * Only copy internal data of Collection ID from source
  * to already allocated/initialized destination.
@@ -129,7 +120,6 @@ static void collection_copy_data(Main *bmain, ID *id_dst, const ID *id_src, cons
   LISTBASE_FOREACH (CollectionObject *, cob, &collection_src->gobject) {
     collection_object_add(bmain, collection_dst, cob->ob, flag, false);
   }
-  collection_lineart_copy(collection_src, collection_dst);
 }
 
 static void collection_free_data(ID *id)
@@ -144,19 +134,12 @@ static void collection_free_data(ID *id)
   BLI_freelistN(&collection->parents);
 
   BKE_collection_object_cache_free(collection);
-
-  /* Remove Line Art configurations */
-  MEM_SAFE_FREE(collection->lineart);
 }
 
 static void collection_foreach_id(ID *id, LibraryForeachIDData *data)
 {
   Collection *collection = (Collection *)id;
 
-  if (collection->lineart) {
-    BKE_LIB_FOREACHID_PROCESS(data, collection->lineart->target, IDWALK_CB_NOP);
-  }
-
   LISTBASE_FOREACH (CollectionObject *, cob, &collection->gobject) {
     BKE_LIB_FOREACHID_PROCESS(data, cob->ob, IDWALK_CB_USER);
   }
@@ -276,9 +259,6 @@ void BKE_collection_add_from_object(Main *bmain,
 void BKE_collection_free(Collection *collection)
 {
   collection_free_data(&collection->id);
-
-  /* Remove Line Art configurations */
-  MEM_SAFE_FREE(collection->lineart);
 }
 
 /**
@@ -432,8 +412,6 @@ static Collection *collection_duplicate_recursive(Main *bmain,
     collection_child_remove(collection_new, child_collection_old);
   }
 
-  collection_lineart_copy(collection_old, collection_new);
-
   return collection_new;
 }
 
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 49ebc9f4f69..d895d7caa26 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -6170,8 +6170,6 @@ static void direct_link_collection(BlendDataReader *reader, Collection *collecti
     direct_link_view_layer(reader, collection->view_layer);
   }
 #endif
-
-  BLO_read_data_address(reader, &collection->lineart);
 }
 
 static void lib_link_collection_data(BlendLibReader *reader, Library *lib, Collection *collection)
@@ -6188,10 +6186,6 @@ static void lib_link_collection_data(BlendLibReader *reader, Library *lib, Colle
   for (CollectionChild *child = collection->children.first; child != NULL; child = child->next) {
     BLO_read_id_address(reader, lib, &child->collection);
   }
-
-  if (collection->lineart) {
-    collection->lineart->target = newlibadr(reader->fd, lib, collection->lineart->target);
-  }
 }
 
 static void lib_link_collection(BlendLibReader *reader, Collection *collection)
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index e50ca4109a4..1963f9ede3e 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -2392,10 +2392,6 @@ static void write_collection_nolib(BlendWriter *writer, Collection *collection)
   LISTBASE_FOREACH (CollectionChild *, child, &collection->children) {
     BLO_write_struct(writer, CollectionChild, child);
   }
-
-  if (collection->lineart != NULL) {
-    writestruct(writer->wd, DATA, CollectionLineart, 1, collection->lineart);
-  }
 }
 
 static void write_collection(BlendWriter *writer, Collection *collection, const void *id_address)
diff --git a/source/blender/editors/lineart/lineart_cpu.c b/source/blender/editors/lineart/lineart_cpu.c
index 76bb1dc8bac..91b23fd2dd1 100644
--- a/source/blender/editors/lineart/lineart_cpu.c
+++ b/source/blender/editors/lineart/lineart_cpu.c
@@ -1707,14 +1707,12 @@ int ED_lineart_object_collection_usage_check(Collection *c, Object *o)
   int object_is_used = (o->lineart.usage == OBJECT_FEATURE_LINE_INCLUDE ||
                         o->lineart.usage == OBJECT_FEATURE_LINE_INHERENT);
 
-  if (object_is_used && (c->flag & COLLECTION_CONFIGURED_FOR_LRT) &&
-      (c->lineart->flags & LRT_LINE_LAYER_COLLECTION_FORCE) &&
-      (c->lineart->usage != COLLECTION_FEATURE_LINE_INCLUDE)) {
+  if (object_is_used && (c->lineart_usage != COLLECTION_LRT_INCLUDE)) {
     if (BKE_collection_has_object_recursive(c, o)) {
-      if (c->lineart->usage == COLLECTION_FEATURE_LINE_EXCLUDE) {
+      if (c->lineart_usage == COLLECTION

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list