[Bf-blender-cvs] [7f57b9f2c18] lanpr-under-gp: LineArt: Restore collection and object panels for usage flag settings.

YimingWu noreply at git.blender.org
Sat Jul 25 18:21:10 CEST 2020


Commit: 7f57b9f2c18ebc7a4d3f0a35eecf90ead55bff77
Author: YimingWu
Date:   Sun Jul 26 00:13:13 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rB7f57b9f2c18ebc7a4d3f0a35eecf90ead55bff77

LineArt: Restore collection and object panels for usage flag settings.

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

M	release/scripts/startup/bl_ui/properties_lineart.py
M	source/blender/editors/space_buttons/buttons_context.c
M	source/blender/editors/space_buttons/space_buttons.c
M	source/blender/makesdna/DNA_space_types.h
M	source/blender/makesrna/intern/rna_space.c

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

diff --git a/release/scripts/startup/bl_ui/properties_lineart.py b/release/scripts/startup/bl_ui/properties_lineart.py
index 94f58d80ab2..569abc5fa16 100644
--- a/release/scripts/startup/bl_ui/properties_lineart.py
+++ b/release/scripts/startup/bl_ui/properties_lineart.py
@@ -23,59 +23,11 @@ from bpy.types import Panel
 class LineartButtonsPanel:
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
-    bl_context = "lineart"
-
-
-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')
-
-
-class OBJECT_PT_lineart_settings(LineartButtonsPanel, Panel):
-    bl_label = "LRT settings"
-
-    def draw(self, context):
-        collection = context.collection
-        lineart = collection.lineart
-        ob = context.object
-        obl = ob.lineart
-
-        layout = self.layout
-        layout.use_property_split = True
-        layout.use_property_decorate = False
-
-        layout.prop(obl, 'use_multiple_levels', text="Multiple Levels")
-        if obl.use_multiple_levels:
-            col = layout.column(align=True)
-            col.prop(obl, 'level_start')
-            col.prop(obl, 'level_end', text="End")
-        else:
-            layout.prop(obl, 'level_start', text="Level")
-
-        layout.prop(obl, 'use_same_style')
-        if obl.use_same_style:
-            layout.prop_search(obl, 'target_layer',
-                               obl.target.data, "layers", icon='GREASEPENCIL')
-            layout.prop_search(
-                obl, 'target_material', obl.target.data, "materials", icon='SHADING_TEXTURE')
-
-        expand = not obl.use_same_style
-        lineart_make_line_type_entry(
-            layout, obl.contour, "Contour", expand, obl.target.data)
-        lineart_make_line_type_entry(
-            layout, obl.crease, "Crease", expand, obl.target.data)
-        lineart_make_line_type_entry(
-            layout, obl.material, "Material", expand, obl.target.data)
-        lineart_make_line_type_entry(
-            layout, obl.edge_mark, "Edge Mark", expand, obl.target.data)
+    bl_context = "object"
 
 
 class OBJECT_PT_lineart(LineartButtonsPanel, Panel):
-    bl_label = "Usage"
+    bl_label = "Line Art Settings"
 
     def draw(self, context):
         layout = self.layout
@@ -86,7 +38,6 @@ class OBJECT_PT_lineart(LineartButtonsPanel, Panel):
 
 classes = (
     OBJECT_PT_lineart,
-    OBJECT_PT_lineart_settings,
 )
 
 if __name__ == "__main__":  # only for live edit.
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index 7ce1ab4ab16..6edd517ce06 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -619,18 +619,6 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma
       found = buttons_context_path_collection(path, window);
 #else
       BLI_assert(!"'WITH_LINEART' disabled - should not possible to access 'BCONTEXT_COLLECTION'");
-#endif
-      break;
-    case BCONTEXT_LRT: /* This is for Line Art object flags */
-#ifdef WITH_LINEART
-      if (scene && (scene->lineart.flags & LRT_AUTO_UPDATE)) {
-        found = buttons_context_path_object(path);
-      }
-      else {
-        found = 0;
-      }
-#else
-      BLI_assert(!"'WITH_LINEART' disabled - should not possible to access 'BCONTEXT_LRT'");
 #endif
       break;
     case BCONTEXT_TOOL:
@@ -874,6 +862,10 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
     set_pointer_type(path, result, &RNA_World);
     return 1;
   }
+  if (CTX_data_equals(member, "collection")) {
+    set_pointer_type(path, result, &RNA_Collection);
+    return 1;
+  }
   if (CTX_data_equals(member, "object")) {
     set_pointer_type(path, result, &RNA_Object);
     return 1;
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index ae9ee60ce82..a93079c41cb 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -168,6 +168,10 @@ int ED_buttons_tabs_list(SpaceProperties *sbuts, int *context_tabs_array)
     context_tabs_array[length] = BCONTEXT_VIEW_LAYER;
     length++;
   }
+  if (sbuts->pathflag & (1 << BCONTEXT_VIEW_LAYER)) {
+    context_tabs_array[length] = BCONTEXT_COLLECTION;
+    length++;
+  }
   if (sbuts->pathflag & (1 << BCONTEXT_SCENE)) {
     context_tabs_array[length] = BCONTEXT_SCENE;
     length++;
@@ -262,13 +266,6 @@ static void buttons_main_region_layout_properties(const bContext *C,
       contexts[0] = "collection";
 #else
       BLI_assert(!"'WITH_LINEART' disabled - should not possible to access 'BCONTEXT_COLLECTION'");
-#endif
-      break;
-    case BCONTEXT_LRT:
-#ifdef WITH_LINEART
-      contexts[0] = "lineart";
-#else
-      BLI_assert(!"'WITH_LINEART' disabled - should not possible to access 'BCONTEXT_COLLECTION'");
 #endif
       break;
     case BCONTEXT_OBJECT:
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 6ef38c7be4c..a5b8b948f3d 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -212,7 +212,6 @@ typedef enum eSpaceButtons_Context {
   BCONTEXT_SHADERFX = 15,
   BCONTEXT_OUTPUT = 16,
   BCONTEXT_COLLECTION = 17,
-  BCONTEXT_LRT = 18,
 
   /* Keep last. */
   BCONTEXT_TOT,
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 24730e71fb9..e560b72cc0c 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -444,7 +444,6 @@ static const EnumPropertyItem buttons_context_items[] = {
      "Bone Constraints",
      "Bone Constraint Properties"},
     {BCONTEXT_MATERIAL, "MATERIAL", ICON_MATERIAL, "Material", "Material Properties"},
-    {BCONTEXT_LRT, "LRT", ICON_SHADING_RENDERED, "LRT", "LRT Properties"},
     {BCONTEXT_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture Properties"},
     {BCONTEXT_PARTICLE, "PARTICLES", ICON_PARTICLES, "Particles", "Particle Properties"},
     {BCONTEXT_PHYSICS, "PHYSICS", ICON_PHYSICS, "Physics", "Physics Properties"},



More information about the Bf-blender-cvs mailing list