[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51768] trunk/blender/source/blender/ editors: Usability: Logic editor

Dalai Felinto dfelinto at gmail.com
Tue Oct 30 17:41:00 CET 2012


Hi Ton,

Thanks a lot for this commit.
There are some remaining issues I wonder if you can take a look at:

(1) when horizontal scroll is on, the bottom buttons are "cropped":
http://www.pasteall.org/pic/39748
(2) when I do the pan gesture at once (instead of continuously) with
the OSX trackpad it pan and zoom altogether (I would expected it only
to zoom).
(3) the home is not viewing all, e.g. this is a screen after I press
HOME (you can't see the actuators) http://www.pasteall.org/pic/39749

Cheers,
Dalai

2012/10/30 Ton Roosendaal <ton at blender.org>:
> Revision: 51768
>           http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51768
> Author:   ton
> Date:     2012-10-30 15:33:03 +0000 (Tue, 30 Oct 2012)
> Log Message:
> -----------
> Usability: Logic editor
>
> - View now restricts to the actual region you work on. Makes zoom and pan nicer.
> - Added HOME for reset view to 1:1 zoom level.
>
> Also: fixed nasty bug in view2d code that checked validity of 2d views, only
> showed (afaik) in the logic eidtor though.
>
> Effect was that zoom in/out would weirdly jump when going across zoomlevel 1.
>
> Modified Paths:
> --------------
>     trunk/blender/source/blender/editors/interface/view2d.c
>     trunk/blender/source/blender/editors/space_logic/logic_window.c
>     trunk/blender/source/blender/editors/space_logic/space_logic.c
>
> Modified: trunk/blender/source/blender/editors/interface/view2d.c
> ===================================================================
> --- trunk/blender/source/blender/editors/interface/view2d.c     2012-10-30 14:22:49 UTC (rev 51767)
> +++ trunk/blender/source/blender/editors/interface/view2d.c     2012-10-30 15:33:03 UTC (rev 51768)
> @@ -599,7 +599,7 @@
>                         if ((cur->xmin < tot->xmin) && (cur->xmax > tot->xmax)) {
>                                 /* outside boundaries on both sides, so take middle-point of tot, and place in balanced way */
>                                 temp = BLI_rctf_cent_x(tot);
> -                               diff = curheight * 0.5f;
> +                               diff = curwidth * 0.5f;
>
>                                 cur->xmin = temp - diff;
>                                 cur->xmax = temp + diff;
>
> Modified: trunk/blender/source/blender/editors/space_logic/logic_window.c
> ===================================================================
> --- trunk/blender/source/blender/editors/space_logic/logic_window.c     2012-10-30 14:22:49 UTC (rev 51767)
> +++ trunk/blender/source/blender/editors/space_logic/logic_window.c     2012-10-30 15:33:03 UTC (rev 51768)
> @@ -56,6 +56,7 @@
>  #include "BKE_library.h"
>  #include "BKE_main.h"
>  #include "BKE_sca.h"
> +#include "BKE_screen.h"
>
>  #include "ED_util.h"
>
> @@ -66,6 +67,7 @@
>  #include "BLF_translation.h"
>
>  #include "UI_interface.h"
> +#include "UI_view2d.h"
>
>  #include "RNA_access.h"
>
> @@ -2208,15 +2210,13 @@
>         SpaceLogic *slogic= CTX_wm_space_logic(C);
>         Object *ob= CTX_data_active_object(C);
>         ID **idar;
> -
>         PointerRNA logic_ptr, settings_ptr, object_ptr;
> -
>         uiLayout *layout, *row, *box;
>         uiBlock *block;
>         uiBut *but;
>         char uiblockstr[32];
>         short a, count;
> -       int xco, yco, width;
> +       int xco, yco, width, height;
>
>         if (ob==NULL) return;
>
> @@ -2270,7 +2270,7 @@
>
>         /* ****************** Controllers ****************** */
>
> -       xco= 420; yco= 170; width= 300;
> +       xco= 420; yco= -10; width= 300;
>         layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, UI_GetStyle());
>         row = uiLayoutRow(layout, TRUE);
>
> @@ -2373,11 +2373,11 @@
>                 }
>         }
>         uiBlockLayoutResolve(block, NULL, &yco);        /* stores final height in yco */
> +       height = yco;
>
> -
>         /* ****************** Sensors ****************** */
>
> -       xco= 10; yco= 170; width= 340;
> +       xco= 10; yco= -10; width= 340;
>         layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, UI_GetStyle());
>         row = uiLayoutRow(layout, TRUE);
>
> @@ -2442,10 +2442,11 @@
>                 }
>         }
>         uiBlockLayoutResolve(block, NULL, &yco);        /* stores final height in yco */
> +       height = MIN2(height, yco);
>
>         /* ****************** Actuators ****************** */
>
> -       xco= 800; yco= 170; width= 340;
> +       xco= 800; yco= -10; width= 340;
>         layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, UI_GetStyle());
>         row = uiLayoutRow(layout, TRUE);
>
> @@ -2513,13 +2514,21 @@
>                 }
>         }
>         uiBlockLayoutResolve(block, NULL, &yco);        /* stores final height in yco */
> +       height = MIN2(height, yco);
> +
> +       UI_view2d_totRect_set(&ar->v2d, 1150, height);
>
> -
> +       /* set the view */
> +       UI_view2d_view_ortho(&ar->v2d);
> +
>         uiComposeLinks(block);
>
>         uiEndBlock(C, block);
>         uiDrawBlock(C, block);
>
> +       /* restore view matrix */
> +       UI_view2d_view_restore(C);
> +
>         if (idar) MEM_freeN(idar);
>  }
>
>
> Modified: trunk/blender/source/blender/editors/space_logic/space_logic.c
> ===================================================================
> --- trunk/blender/source/blender/editors/space_logic/space_logic.c      2012-10-30 14:22:49 UTC (rev 51767)
> +++ trunk/blender/source/blender/editors/space_logic/space_logic.c      2012-10-30 15:33:03 UTC (rev 51768)
> @@ -84,8 +84,9 @@
>
>  /* ******************** default callbacks for image space ***************** */
>
> -static SpaceLink *logic_new(const bContext *UNUSED(C))
> +static SpaceLink *logic_new(const bContext *C)
>  {
> +       ScrArea *sa= CTX_wm_area(C);
>         ARegion *ar;
>         SpaceLogic *slogic;
>
> @@ -120,14 +121,11 @@
>         ar->regiontype= RGN_TYPE_WINDOW;
>
>         ar->v2d.tot.xmin =  0.0f;
> -       ar->v2d.tot.ymin =  0.0f;
> -       ar->v2d.tot.xmax = 1280;
> -       ar->v2d.tot.ymax = 240.0f;
> +       ar->v2d.tot.ymax =  0.0f;
> +       ar->v2d.tot.xmax = 1150.0f;
> +       ar->v2d.tot.ymin = ( 1150.0f/(float)sa->winx ) * (float)-sa->winy;
>
> -       ar->v2d.cur.xmin =  0.0f;
> -       ar->v2d.cur.ymin =  0.0f;
> -       ar->v2d.cur.xmax = 1280.0f;
> -       ar->v2d.cur.ymax = 240.0f;
> +       ar->v2d.cur = ar->v2d.tot;
>
>         ar->v2d.min[0] = 1.0f;
>         ar->v2d.min[1] = 1.0f;
> @@ -136,13 +134,14 @@
>         ar->v2d.max[1] = 32000.0f;
>
>         ar->v2d.minzoom = 0.5f;
> -       ar->v2d.maxzoom = 1.21f;
> +       ar->v2d.maxzoom = 1.5f;
>
>         ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
> -       ar->v2d.keepzoom = V2D_LIMITZOOM | V2D_KEEPASPECT;
> -       ar->v2d.keeptot = 0;
> +       ar->v2d.keepzoom = V2D_KEEPZOOM | V2D_LIMITZOOM | V2D_KEEPASPECT;
> +       ar->v2d.keeptot = V2D_KEEPTOT_BOUNDS;
> +       ar->v2d.align = V2D_ALIGN_NO_POS_Y | V2D_ALIGN_NO_NEG_X;
> +       ar->v2d.keepofs = V2D_KEEPOFS_Y;
>
> -
>         return (SpaceLink *)slogic;
>  }
>
> @@ -183,6 +182,9 @@
>         WM_keymap_add_item(keymap, "LOGIC_OT_properties", NKEY, KM_PRESS, 0, 0);
>         WM_keymap_add_item(keymap, "LOGIC_OT_links_cut", LEFTMOUSE, KM_PRESS, KM_CTRL, 0);
>         WM_keymap_add_menu(keymap, "LOGIC_MT_logicbricks_add", AKEY, KM_PRESS, KM_SHIFT, 0);
> +
> +       WM_keymap_add_item(keymap, "VIEW2D_OT_reset", HOMEKEY, KM_PRESS, 0, 0);
> +
>  }
>
>  static void logic_refresh(const bContext *UNUSED(C), ScrArea *UNUSED(sa))
> @@ -234,7 +236,7 @@
>         wmKeyMap *keymap;
>
>         UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
> -
> +
>         /* own keymaps */
>         keymap = WM_keymap_find(wm->defaultconf, "Logic Editor", SPACE_LOGIC, 0);
>         WM_event_add_keymap_handler(&ar->handlers, keymap);
> @@ -259,7 +261,7 @@
>         UI_view2d_view_restore(C);
>
>         /* scrollers */
> -       scrollers= UI_view2d_scrollers_calc(C, v2d, 10, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
> +       scrollers= UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
>         UI_view2d_scrollers_draw(C, v2d, scrollers);
>         UI_view2d_scrollers_free(scrollers);
>
>
> _______________________________________________
> Bf-blender-cvs mailing list
> Bf-blender-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-blender-cvs


More information about the Bf-committers mailing list