[Bf-blender-cvs] [3a6e4d76f9d] profiler-editor: support vertical panning

Jacques Lucke noreply at git.blender.org
Thu Apr 29 11:30:50 CEST 2021


Commit: 3a6e4d76f9d937187e5d9aca24978b378bbe75b1
Author: Jacques Lucke
Date:   Wed Apr 28 17:09:37 2021 +0200
Branches: profiler-editor
https://developer.blender.org/rB3a6e4d76f9d937187e5d9aca24978b378bbe75b1

support vertical panning

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

M	source/blender/editors/space_profiler/profiler_draw.cc
M	source/blender/editors/space_profiler/space_profiler.cc

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

diff --git a/source/blender/editors/space_profiler/profiler_draw.cc b/source/blender/editors/space_profiler/profiler_draw.cc
index 1ae3de48690..c555869588e 100644
--- a/source/blender/editors/space_profiler/profiler_draw.cc
+++ b/source/blender/editors/space_profiler/profiler_draw.cc
@@ -86,14 +86,15 @@ class ProfilerDrawer {
                                              profiler_layout_->begin_time());
     /* Giving a bit more space on the right side is convenient. */
     const float extended_duration_ms = std::max(duration_ms * 1.1f, 5000.0f);
-    UI_view2d_totRect_set(&region_->v2d, extended_duration_ms, 1);
+    /* TODO: Remove magic numbers. */
+    UI_view2d_totRect_set(&region_->v2d, extended_duration_ms, 2000);
 
     UI_view2d_scrollers_draw(&region_->v2d, nullptr);
   }
 
   void compute_vertical_extends_of_all_nodes()
   {
-    int top_y = region_->winy;
+    int top_y = region_->winy - region_->v2d.cur.ymax;
     for (Span<ProfileNode *> nodes : profiler_layout_->root_nodes()) {
       top_y = this->compute_vertical_extends_of_nodes(nodes, top_y);
       top_y -= parallel_padding_;
diff --git a/source/blender/editors/space_profiler/space_profiler.cc b/source/blender/editors/space_profiler/space_profiler.cc
index bcb2a63c019..58d4c292b1b 100644
--- a/source/blender/editors/space_profiler/space_profiler.cc
+++ b/source/blender/editors/space_profiler/space_profiler.cc
@@ -64,12 +64,13 @@ static SpaceLink *profiler_create(const ScrArea *UNUSED(area), const Scene *UNUS
     v2d->scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM;
     v2d->keepzoom = V2D_LOCKZOOM_Y;
     v2d->keeptot = V2D_KEEPTOT_BOUNDS;
+    v2d->keepofs = V2D_KEEPOFS_Y;
     v2d->align = V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_POS_Y;
     v2d->min[0] = 0.0001f;
-    v2d->min[1] = 100.0f;
+    v2d->min[1] = 1.0f;
     v2d->max[0] = 100000.0f;
-    v2d->max[1] = 100.0f;
-    BLI_rctf_init(&v2d->tot, 0, 5000, -1, 0);
+    v2d->max[1] = 5000.0f;
+    BLI_rctf_init(&v2d->tot, 0, 5000, -1000, 0);
     v2d->cur = v2d->tot;
   }



More information about the Bf-blender-cvs mailing list