Commit: 3b5d9ce441128e6f0d4a29ae74e390f755526e24
Author: Antonio Vazquez
Date:   Thu Jun 7 19:15:12 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB3b5d9ce441128e6f0d4a29ae74e390f755526e24

Move Info panel to Bottom Bar Statistics

Now the info appears in the same place that other object types.

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

M       release/scripts/startup/bl_ui/properties_data_gpencil.py
M       source/blender/blenkernel/BKE_gpencil.h
M       source/blender/blenkernel/intern/gpencil.c
M       source/blender/editors/space_info/info_stats.c
M       source/blender/makesrna/intern/rna_gpencil.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_gpencil.py 
b/release/scripts/startup/bl_ui/properties_data_gpencil.py
index f073cc64f97..407e0426a6a 100644
--- a/release/scripts/startup/bl_ui/properties_data_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py
@@ -202,32 +202,6 @@ class DATA_PT_gpencil_vertexpanel(DataButtonsPanel, Panel):
             layout.prop(context.tool_settings, "vertex_group_weight", 
text="Weight")
 
 
-class DATA_PT_gpencil_infopanel(DataButtonsPanel, Panel):
-    bl_space_type = 'PROPERTIES'
-    bl_region_type = 'WINDOW'
-    bl_context = "data"
-    bl_label = "Information"
-    bl_options = {'DEFAULT_CLOSED'}
-
-    def draw(self, context):
-        layout = self.layout
-        gpd = context.gpencil_data
-
-        split = layout.split(percentage=0.5)
-
-        col = split.column(align=True)
-        col.label("Layers:", icon="LAYER_ACTIVE")
-        col.label("Frames:", icon="LAYER_ACTIVE")
-        col.label("Strokes:", icon="LAYER_ACTIVE")
-        col.label("Points:", icon="LAYER_ACTIVE")
-
-        col = split.column(align=True)
-        col.label(str(gpd.info_total_layers))
-        col.label(str(gpd.info_total_frames))
-        col.label(str(gpd.info_total_strokes))
-        col.label(str(gpd.info_total_points))
-
-
 class DATA_PT_gpencil_display(DataButtonsPanel, Panel):
     bl_label = "Viewport Display"
     bl_options = {'DEFAULT_CLOSED'}
@@ -253,7 +227,6 @@ class DATA_PT_gpencil_display(DataButtonsPanel, Panel):
         sub.active = not gpd.show_constant_thickness
         sub.prop(gpd, "pixfactor", text="Thickness Scale")
 
-
         if gpl:
             layout.prop(gpd, "show_stroke_direction", text="Show Stroke 
Directions")
 
@@ -268,7 +241,6 @@ classes = (
     DATA_PT_gpencil_parentpanel,
     DATA_PT_gpencil_vertexpanel,
     DATA_PT_gpencil_display,
-    DATA_PT_gpencil_infopanel,
 
     GPENCIL_UL_vgroups,
 )
diff --git a/source/blender/blenkernel/BKE_gpencil.h 
b/source/blender/blenkernel/BKE_gpencil.h
index 2569a5ecaa4..3311b117135 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -94,6 +94,12 @@ void BKE_gpencil_frame_delete_laststroke(struct bGPDlayer 
*gpl, struct bGPDframe
 void BKE_gpencil_material_index_remove(struct bGPdata *gpd, int index);
 void BKE_gpencil_material_remap(struct bGPdata *gpd, const unsigned int 
*remap, unsigned int remap_len);
 
+/* statistics functions */
+int BKE_gpencil_stats_total_layers(struct bGPdata *gpd);
+int BKE_gpencil_stats_total_frames(struct bGPdata *gpd);
+int BKE_gpencil_stats_total_strokes(struct bGPdata *gpd);
+int BKE_gpencil_stats_total_points(struct bGPdata *gpd);
+
 /* Utilities for creating and populating GP strokes */
 /* - Number of values defining each point in the built-in data 
  *   buffers for primitives (e.g. 2D Monkey) 
diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index a390e64531b..f196ad27613 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1606,3 +1606,46 @@ void BKE_gpencil_material_remap(struct bGPdata *gpd, 
const unsigned int *remap,
 #undef MAT_NR_REMAP
 
 }
+
+/* statistics functions */
+int BKE_gpencil_stats_total_layers(bGPdata *gpd)
+{
+       return BLI_listbase_count(&gpd->layers);
+}
+
+int BKE_gpencil_stats_total_frames(bGPdata *gpd)
+{
+       int tot = 0;
+       for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
+               tot += BLI_listbase_count(&gpl->frames);
+       }
+
+       return tot;
+}
+
+int BKE_gpencil_stats_total_strokes(bGPdata *gpd)
+{
+       int tot = 0;
+       for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
+               for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
+                       tot += BLI_listbase_count(&gpf->strokes);
+               }
+       }
+
+       return tot;
+}
+
+int BKE_gpencil_stats_total_points(bGPdata *gpd)
+{
+       int tot = 0;
+       for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
+               for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
+                       for (bGPDstroke *gps = gpf->strokes.first; gps; gps = 
gps->next) {
+                               tot += gps->totpoints;
+                       }
+               }
+       }
+
+       return tot;
+}
+
diff --git a/source/blender/editors/space_info/info_stats.c 
b/source/blender/editors/space_info/info_stats.c
index 481c9031a73..d9f290a69e6 100644
--- a/source/blender/editors/space_info/info_stats.c
+++ b/source/blender/editors/space_info/info_stats.c
@@ -32,6 +32,7 @@
 
 #include "DNA_armature_types.h"
 #include "DNA_curve_types.h"
+#include "DNA_gpencil_types.h"
 #include "DNA_group_types.h"
 #include "DNA_lattice_types.h"
 #include "DNA_meta_types.h"
@@ -49,6 +50,7 @@
 #include "BKE_curve.h"
 #include "BKE_displist.h"
 #include "BKE_DerivedMesh.h"
+#include "BKE_gpencil.h"
 #include "BKE_key.h"
 #include "BKE_layer.h"
 #include "BKE_paint.h"
@@ -72,6 +74,7 @@ typedef struct SceneStats {
        int totobj,  totobjsel;
        int totlamp, totlampsel;
        int tottri;
+       int totgplayer, totgpframe, totgpstroke, totgppoint;
 
        char infostr[MAX_INFO_LEN];
 } SceneStats;
@@ -85,6 +88,8 @@ typedef struct SceneStatsFmt {
        char totobj[MAX_INFO_NUM_LEN], totobjsel[MAX_INFO_NUM_LEN];
        char totlamp[MAX_INFO_NUM_LEN], totlampsel[MAX_INFO_NUM_LEN];
        char tottri[MAX_INFO_NUM_LEN];
+       char totgplayer[MAX_INFO_NUM_LEN], totgpframe[MAX_INFO_NUM_LEN];
+       char totgpstroke[MAX_INFO_NUM_LEN], totgppoint[MAX_INFO_NUM_LEN];
 } SceneStatsFmt;
 
 static void stats_object(Object *ob, int sel, int totob, SceneStats *stats)
@@ -144,6 +149,15 @@ static void stats_object(Object *ob, int sel, int totob, 
SceneStats *stats)
                        }
                        break;
                }
+               case OB_GPENCIL:
+               {
+                       bGPdata *gpd = (bGPdata *)ob->data;
+                       stats->totgplayer = BKE_gpencil_stats_total_layers(gpd);
+                       stats->totgpframe = BKE_gpencil_stats_total_frames(gpd);
+                       stats->totgpstroke = 
BKE_gpencil_stats_total_strokes(gpd);
+                       stats->totgppoint = BKE_gpencil_stats_total_points(gpd);
+                       break;
+               }
        }
 }
 
@@ -442,6 +456,11 @@ static void stats_string(ViewLayer *view_layer)
 
        SCENE_STATS_FMT_INT(tottri);
 
+       SCENE_STATS_FMT_INT(totgplayer);
+       SCENE_STATS_FMT_INT(totgpframe);
+       SCENE_STATS_FMT_INT(totgpstroke);
+       SCENE_STATS_FMT_INT(totgppoint);
+
 #undef SCENE_STATS_FMT_INT
 
 
@@ -499,6 +518,14 @@ static void stats_string(ViewLayer *view_layer)
                ofs += BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs, 
IFACE_("Bones:%s/%s %s%s"),
                                    stats_fmt.totbonesel, stats_fmt.totbone, 
memstr, gpumemstr);
        }
+       else if ((ob) && (ob->type == OB_GPENCIL)) {
+               ofs += BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs,
+                       IFACE_("Layers:%s | Frames:%s | Strokes:%s | 
Points:%s"),
+                       stats_fmt.totgplayer, stats_fmt.totgpframe, 
stats_fmt.totgpstroke, stats_fmt.totgppoint);
+
+               ofs += BLI_strncpy_rlen(s + ofs, memstr, MAX_INFO_LEN - ofs);
+               ofs += BLI_strncpy_rlen(s + ofs, gpumemstr, MAX_INFO_LEN - ofs);
+       }
        else if (stats_is_object_dynamic_topology_sculpt(ob, object_mode)) {
                ofs += BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs, 
IFACE_("Verts:%s | Tris:%s%s"), stats_fmt.totvert,
                                    stats_fmt.tottri, gpumemstr);
diff --git a/source/blender/makesrna/intern/rna_gpencil.c 
b/source/blender/makesrna/intern/rna_gpencil.c
index 41dba57cc0e..e91889378a7 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -596,53 +596,6 @@ static void rna_GPencil_clear(bGPdata *gpd)
        WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 }
 
-/* info functions */
-static int rna_GPencil_info_total_layers(PointerRNA *ptr)
-{
-       bGPdata *gpd = (bGPdata *)ptr->id.data;
-
-       return BLI_listbase_count(&gpd->layers);
-}
-
-static int rna_GPencil_info_total_frames(PointerRNA *ptr)
-{
-       bGPdata *gpd = (bGPdata *)ptr->id.data;
-       int tot = 0;
-       for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
-               tot += BLI_listbase_count(&gpl->frames);
-       }
-
-       return tot;
-}
-
-static int rna_GPencil_info_total_strokes(PointerRNA *ptr)
-{
-       bGPdata *gpd = (bGPdata *)ptr->id.data;
-       int tot = 0;
-       for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
-               for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
-                       tot += BLI_listbase_count(&gpf->strokes);
-               }
-       }
-
-       return tot;
-}
-
-static int rna_GPencil_info_total_points(PointerRNA *ptr)
-{
-       bGPdata *gpd = (bGPdata *)ptr->id.data;
-       int tot = 0;
-       for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
-               for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
-                       for (bGPDstroke *gps = gpf->strokes.first; gps; gps = 
gps->next) {
-                               tot += gps->totpoints;
-                       }
-               }
-       }
-
-       return tot;
-}
-
 static void rna_GpencilVertex_groups_begin(CollectionPropertyIterator *iter, 
PointerRNA *ptr)
 {
        bGPDstroke *gps = ptr->data;
@@ -1312,27 +1265,6 @@ static void rna_def_gpencil_data(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Lines Only", "Show only edit lines for 
additional frames");
        RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, 
"rna_GPencil_update");
 
-       /* info properties */
-       prop = RNA_def_property(srna, "info_total_layers", PROP_INT, 
PROP_UNSIGNED);
-       RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-       RNA_def_property_int_funcs(prop, "rna_GPencil_info_total_layers", NULL, 
NULL);
-       RNA_def_property_ui_text(prop, "Total Layers", "Number of Layers");
-
-       prop = RNA_def_property(srna, "info_total_frames", PROP_INT, 
PROP_UNSIGNED);
-       RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-       RNA_def_property_int_funcs(prop, "rna_GPencil_info_total_frames", NULL, 
NULL);
-       RNA_def_property_ui_text(prop, "Total Frames", "Number of Frames");
-
-       prop = RNA_def_property(srna, "info_total_strokes", PROP_INT, 
PROP_UNSIGNED);
-       RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-       RNA_def_property_int_funcs(prop, "rna_GPencil_info_total_strokes", 
NULL, NULL);
-       RNA_def_property_ui_text(prop, "Total Strokes", "Number of Strokes");
-
-       prop = RNA_def_property(srna, "info_total_points", PROP_INT, 
PROP_UNSIGNED);
-       RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-       RNA_def_property_int_funcs(prop, "rna_GPencil_info_total_points", NULL, 
NULL);
-       RNA_def_property_ui_text(prop, "Total Points", "Number of Points");
-
        /* onion skinning */
        prop = RNA_def_property(srna, "ghost_before_range", PROP_INT

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to