GPv3: Add statistics information #112573
|
@ -15,6 +15,7 @@
|
|||
#include "DNA_collection_types.h"
|
||||
#include "DNA_curve_types.h"
|
||||
#include "DNA_gpencil_legacy_types.h"
|
||||
#include "DNA_grease_pencil_types.h"
|
||||
#include "DNA_lattice_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meta_types.h"
|
||||
|
@ -30,6 +31,7 @@
|
|||
#include "BLI_string_utf8.h"
|
||||
#include "BLI_timecode.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_span.hh"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
|
@ -38,9 +40,11 @@
|
|||
#include "BKE_blender_version.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_curve.h"
|
||||
#include "BKE_curves.hh"
|
||||
#include "BKE_displist.h"
|
||||
#include "BKE_editmesh.h"
|
||||
#include "BKE_gpencil_legacy.h"
|
||||
#include "BKE_grease_pencil.hh"
|
||||
#include "BKE_key.h"
|
||||
#include "BKE_layer.h"
|
||||
#include "BKE_main.h"
|
||||
|
@ -190,10 +194,31 @@ static void stats_object(Object *ob,
|
|||
}
|
||||
break;
|
||||
}
|
||||
case OB_GREASE_PENCIL: {
|
||||
if (!is_selected) {
|
||||
break;
|
||||
}
|
||||
filedescriptor marked this conversation as resolved
|
||||
|
||||
filedescriptor marked this conversation as resolved
Outdated
Iliya Katushenock
commented
`const` for span too.
|
||||
const GreasePencil *grease_pencil = static_cast<GreasePencil *>(ob->data);
|
||||
|
||||
for (const GreasePencilDrawingBase *drawing_base : grease_pencil->drawings()) {
|
||||
const GreasePencilDrawing *drawing = reinterpret_cast<const GreasePencilDrawing *>(drawing_base);
|
||||
Falk David
commented
`range` -> `drawing_index`
|
||||
const blender::bke::CurvesGeometry &curves = drawing->wrap().strokes();
|
||||
Hans Goudey
commented
This copies the geometry, since the variable isn't a reference. This copies the geometry, since the variable isn't a reference.
Falk David
commented
We shouldn't ever access the We shouldn't ever access the `geometry` on the DNA directly. Use `->strokes()`.
Hans Goudey
commented
These should be const pointers. I also updated main to make These should be const pointers. I also updated main to make `->drawings();` return const pointers too.
|
||||
|
||||
filedescriptor marked this conversation as resolved
Outdated
Hans Goudey
commented
Use the Use the `.points_num()` and `.curves_num()` accessors.
|
||||
stats->totgppoint += curves.points_num();
|
||||
stats->totgpstroke += curves.curves_num();
|
||||
}
|
||||
|
||||
for (const blender::bke::greasepencil::Layer *layer : grease_pencil->layers()) {
|
||||
Falk David
commented
This is not right. Number of drawings != number of keyframes. This is not right. Number of drawings != number of keyframes.
This should iterate over the layers and count up their `frames().size()`.
Pratik Borhade
commented
I think new drawing is created for every frame so the count should be equal, no? I think new drawing is created for every frame so the count should be equal, no?
I might be wrong here. Updating the PR.
Falk David
commented
There will be the ability to link the data of one drawing for multiple keyframes (similar to how There will be the ability to link the data of one drawing for multiple keyframes (similar to how `ALT`+`D` works for object data linking).
|
||||
stats->totgpframe += layer->frames().size();
|
||||
}
|
||||
Falk David
commented
`auto` -> `const bke::greasepencil::Layer *`
|
||||
|
||||
stats->totgplayer += grease_pencil->layers().size();
|
||||
break;
|
||||
}
|
||||
case OB_CURVES:
|
||||
case OB_POINTCLOUD:
|
||||
case OB_VOLUME:
|
||||
case OB_GREASE_PENCIL: {
|
||||
case OB_VOLUME: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -835,7 +860,7 @@ void ED_info_draw_stats(
|
|||
else if (ob && (object_mode & OB_MODE_POSE)) {
|
||||
stats_row(col1, labels[BONES], col2, stats_fmt.totbonesel, stats_fmt.totbone, y, height);
|
||||
}
|
||||
else if ((ob) && (ob->type == OB_GPENCIL_LEGACY)) {
|
||||
else if ((ob) && ELEM(ob->type, OB_GPENCIL_LEGACY, OB_GREASE_PENCIL)) {
|
||||
stats_row(col1, labels[LAYERS], col2, stats_fmt.totgplayer, nullptr, y, height);
|
||||
stats_row(col1, labels[FRAMES], col2, stats_fmt.totgpframe, nullptr, y, height);
|
||||
stats_row(col1, labels[STROKES], col2, stats_fmt.totgpstroke, nullptr, y, height);
|
||||
|
|
Use
const
for the pointer variables here.