[Bf-blender-cvs] [11e9ad412ea] master: UI: Graph Editor Show Cursor panel

William Reynish noreply at git.blender.org
Mon Feb 10 13:26:10 CET 2020


Commit: 11e9ad412ea9321a3719a9deed3642c11cb528e3
Author: William Reynish
Date:   Mon Feb 10 13:26:08 2020 +0100
Branches: master
https://developer.blender.org/rB11e9ad412ea9321a3719a9deed3642c11cb528e3

UI: Graph Editor Show Cursor panel

Make the Graph Editor Cursor panel fit in and use the split layout.

Also removed the snap buttons, since they were only a subset of the snapping possibilities, all of which are in Key > Snap anyway, and also in the context menu.

Update the theme to use correct hierarchy progression like in other editors.

Differential Revision: https://developer.blender.org/D6785

Reviewed by Brecht van Lommel

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

M	release/datafiles/userdef/userdef_default_theme.c
M	source/blender/editors/space_graph/graph_buttons.c
M	source/blender/makesrna/intern/rna_pose.c

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

diff --git a/release/datafiles/userdef/userdef_default_theme.c b/release/datafiles/userdef/userdef_default_theme.c
index 1eff85b6129..df8fde40f3c 100644
--- a/release/datafiles/userdef/userdef_default_theme.c
+++ b/release/datafiles/userdef/userdef_default_theme.c
@@ -413,7 +413,7 @@ const bTheme U_theme_default = {
     .tab_inactive = RGBA(0x2b2b2bff),
     .tab_back = RGBA(0x232323ff),
     .tab_outline = RGBA(0x232323ff),
-    .button = RGBA(0x282828ff),
+    .button = RGBA(0x424242ff),
     .button_title = RGBA(0xffffffff),
     .button_text = RGBA(0xe5e5e5ff),
     .button_text_hi = RGBA(0xffffffff),
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index 0a3663372be..02bf97495c1 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -111,14 +111,13 @@ static bool graph_panel_poll(const bContext *C, PanelType *UNUSED(pt))
 
 /* -------------- */
 
-/* Graph Editor View Settings */
-static void graph_panel_view(const bContext *C, Panel *pa)
+static void graph_panel_cursor_header(const bContext *C, Panel *pa)
 {
   bScreen *sc = CTX_wm_screen(C);
   SpaceGraph *sipo = CTX_wm_space_graph(C);
   Scene *scene = CTX_data_scene(C);
   PointerRNA spaceptr, sceneptr;
-  uiLayout *col, *sub, *row;
+  uiLayout *col;
 
   /* get RNA pointers for use when creating the UI elements */
   RNA_id_pointer_create(&scene->id, &sceneptr);
@@ -126,26 +125,43 @@ static void graph_panel_view(const bContext *C, Panel *pa)
 
   /* 2D-Cursor */
   col = uiLayoutColumn(pa->layout, false);
-  uiItemR(col, &spaceptr, "show_cursor", 0, NULL, ICON_NONE);
+  uiItemR(col, &spaceptr, "show_cursor", 0, "", ICON_NONE);
+}
 
-  sub = uiLayoutColumn(col, true);
-  uiLayoutSetActive(sub, RNA_boolean_get(&spaceptr, "show_cursor"));
-  uiItemO(sub, IFACE_("Cursor from Selection"), ICON_NONE, "GRAPH_OT_frame_jump");
+static void graph_panel_cursor(const bContext *C, Panel *pa)
+{
+  bScreen *sc = CTX_wm_screen(C);
+  SpaceGraph *sipo = CTX_wm_space_graph(C);
+  Scene *scene = CTX_data_scene(C);
+  PointerRNA spaceptr, sceneptr;
+  uiLayout *layout = pa->layout;
+  uiLayout *col, *sub;
+  uiBlock *block;
+
+  /* get RNA pointers for use when creating the UI elements */
+  RNA_id_pointer_create(&scene->id, &sceneptr);
+  RNA_pointer_create(&sc->id, &RNA_SpaceGraphEditor, sipo, &spaceptr);
+
+  block = uiLayoutGetBlock(layout);
+  uiLayoutSetPropSep(layout, true);
+  uiLayoutSetPropDecorate(layout, false);
+
+  /* 2D-Cursor */
+  col = uiLayoutColumn(layout, false);
+  uiLayoutSetActive(col, RNA_boolean_get(&spaceptr, "show_cursor"));
 
   sub = uiLayoutColumn(col, true);
-  uiLayoutSetActive(sub, RNA_boolean_get(&spaceptr, "show_cursor"));
-  row = uiLayoutSplit(sub, 0.7f, true);
   if (sipo->mode == SIPO_MODE_DRIVERS) {
-    uiItemR(row, &spaceptr, "cursor_position_x", 0, IFACE_("Cursor X"), ICON_NONE);
+    uiItemR(sub, &spaceptr, "cursor_position_x", 0, IFACE_("Cursor X"), ICON_NONE);
   }
   else {
-    uiItemR(row, &sceneptr, "frame_current", 0, IFACE_("Cursor X"), ICON_NONE);
+    uiItemR(sub, &sceneptr, "frame_current", 0, IFACE_("Cursor X"), ICON_NONE);
   }
-  uiItemEnumO(row, "GRAPH_OT_snap", IFACE_("To Keys"), 0, "type", GRAPHKEYS_SNAP_CFRA);
 
-  row = uiLayoutSplit(sub, 0.7f, true);
-  uiItemR(row, &spaceptr, "cursor_position_y", 0, IFACE_("Cursor Y"), ICON_NONE);
-  uiItemEnumO(row, "GRAPH_OT_snap", IFACE_("To Keys"), 0, "type", GRAPHKEYS_SNAP_VALUE);
+  uiItemR(sub, &spaceptr, "cursor_position_y", 0, IFACE_("Y"), ICON_NONE);
+
+  sub = uiLayoutColumn(col, true);
+  uiItemO(sub, IFACE_("Cursor to Selection"), ICON_NONE, "GRAPH_OT_frame_jump");
 }
 
 /* ******************* active F-Curve ************** */
@@ -1429,9 +1445,10 @@ void graph_buttons_register(ARegionType *art)
 
   pt = MEM_callocN(sizeof(PanelType), "spacetype graph panel view");
   strcpy(pt->idname, "GRAPH_PT_view");
-  strcpy(pt->label, N_("View Properties"));
+  strcpy(pt->label, N_("Show Cursor"));
   strcpy(pt->category, "View");
   strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
-  pt->draw = graph_panel_view;
+  pt->draw = graph_panel_cursor;
+  pt->draw_header = graph_panel_cursor_header;
   BLI_addtail(&art->paneltypes, pt);
 }
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c
index 85c4352d277..c6175f85bd8 100644
--- a/source/blender/makesrna/intern/rna_pose.c
+++ b/source/blender/makesrna/intern/rna_pose.c
@@ -1313,7 +1313,8 @@ static void rna_def_pose_channel(BlenderRNA *brna)
 
   prop = RNA_def_property(srna, "use_custom_shape_bone_size", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_negative_sdna(prop, NULL, "drawflag", PCHAN_DRAW_NO_CUSTOM_BONE_SIZE);
-  RNA_def_property_ui_text(prop, "Use Bone Size", "Scale the custom object by the bone length");
+  RNA_def_property_ui_text(
+      prop, "Scale to Bone Length", "Scale the custom object by the bone length");
   RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
 
   prop = RNA_def_property(srna, "custom_shape_transform", PROP_POINTER, PROP_NONE);



More information about the Bf-blender-cvs mailing list