Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTianwei Shen <shentianweipku@gmail.com>2016-10-21 11:39:57 +0300
committerTianwei Shen <shentianweipku@gmail.com>2016-10-21 11:39:57 +0300
commita9e071d12d1583ee746e542f0bc9633c393ce952 (patch)
tree213a8137271e39ce419185cc8542f090860b243f /source/blender/editors/interface
parent487284db94f9c82f26915efd8b12cefe2429221a (diff)
parentf7ce482385b760135a36ff778e8c3436cdcf5404 (diff)
Merge branch 'master' into soc-2016-multiview
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r--source/blender/editors/interface/interface_handlers.c35
-rw-r--r--source/blender/editors/interface/interface_layout.c28
-rw-r--r--source/blender/editors/interface/interface_ops.c34
-rw-r--r--source/blender/editors/interface/interface_regions.c2
-rw-r--r--source/blender/editors/interface/interface_widgets.c1
-rw-r--r--source/blender/editors/interface/resources.c23
6 files changed, 64 insertions, 59 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 369eba66f32..863f5e3852c 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -2218,32 +2218,6 @@ static void ui_but_drop(bContext *C, const wmEvent *event, uiBut *but, uiHandleB
/* ******************* copy and paste ******************** */
-static void ui_but_copy_data_path(uiBut *but, const bool full_path)
-{
- char *id_path;
-
- if (but->rnapoin.id.data == NULL) {
- return;
- }
-
- if (full_path) {
- if (but->rnaprop) {
- id_path = RNA_path_full_property_py_ex(&but->rnapoin, but->rnaprop, but->rnaindex, true);
- }
- else {
- id_path = RNA_path_full_struct_py(&but->rnapoin);
- }
- }
- else {
- id_path = RNA_path_from_ID_to_property(&but->rnapoin, but->rnaprop);
- }
-
- if (id_path) {
- WM_clipboard_text_set(id_path, false);
- MEM_freeN(id_path);
- }
-}
-
/* c = copy, v = paste */
static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, char mode)
{
@@ -6985,7 +6959,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent *
if ((data->state == BUTTON_STATE_HIGHLIGHT) || (event->type == EVT_DROP)) {
/* handle copy-paste */
if (ELEM(event->type, CKEY, VKEY) && event->val == KM_PRESS &&
- IS_EVENT_MOD(event, ctrl, oskey))
+ IS_EVENT_MOD(event, ctrl, oskey) && !event->shift && !event->alt)
{
/* Specific handling for listrows, we try to find their overlapping tex button. */
if (but->type == UI_BTYPE_LISTROW) {
@@ -6995,13 +6969,6 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent *
data = but->active;
}
}
-
- /* special case, copy-data-path */
- if ((event->type == CKEY) && event->shift) {
- ui_but_copy_data_path(but, event->alt != 0);
- return WM_UI_HANDLER_BREAK;
- }
-
ui_but_copy_paste(C, but, data, (event->type == CKEY) ? 'c' : 'v');
return WM_UI_HANDLER_BREAK;
}
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 976b5ed1193..875522e01c6 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -184,11 +184,8 @@ static const char *ui_item_name_add_colon(const char *name, char namestr[UI_MAX_
return name;
}
-static int ui_item_fit(int item, int pos, int all, int available, bool is_last, int alignment, int *offset)
+static int ui_item_fit(int item, int pos, int all, int available, bool is_last, int alignment)
{
- if (offset)
- *offset = 0;
-
/* available == 0 is unlimited */
if (available == 0)
return item;
@@ -2110,7 +2107,7 @@ static void ui_litem_layout_row(uiLayout *litem)
minw = ui_litem_min_width(itemw);
if (w - lastw > 0)
- neww = ui_item_fit(itemw, x, totw, w - lastw, !item->next, litem->alignment, NULL);
+ neww = ui_item_fit(itemw, x, totw, w - lastw, !item->next, litem->alignment);
else
neww = 0; /* no space left, all will need clamping to minimum size */
@@ -2144,12 +2141,12 @@ static void ui_litem_layout_row(uiLayout *litem)
if (item->flag) {
/* fixed minimum size items */
- itemw = ui_item_fit(minw, fixedx, fixedw, min_ii(w, fixedw), !item->next, litem->alignment, NULL);
+ itemw = ui_item_fit(minw, fixedx, fixedw, min_ii(w, fixedw), !item->next, litem->alignment);
fixedx += itemw;
}
else {
/* free size item */
- itemw = ui_item_fit(itemw, freex, freew, w - fixedw, !item->next, litem->alignment, NULL);
+ itemw = ui_item_fit(itemw, freex, freew, w - fixedw, !item->next, litem->alignment);
freex += itemw;
}
@@ -2469,7 +2466,7 @@ static void ui_litem_layout_column_flow(uiLayout *litem)
uiLayoutItemFlow *flow = (uiLayoutItemFlow *)litem;
uiItem *item;
int col, x, y, w, emh, emy, miny, itemw, itemh;
- int toth, totitem, offset;
+ int toth, totitem;
/* compute max needed width and total height */
toth = 0;
@@ -2491,22 +2488,27 @@ static void ui_litem_layout_column_flow(uiLayout *litem)
/* create column per column */
col = 0;
+ w = (litem->w - (flow->totcol - 1) * style->columnspace) / flow->totcol;
for (item = litem->items.first; item; item = item->next) {
- ui_item_size(item, NULL, &itemh);
- itemw = ui_item_fit(1, x - litem->x, flow->totcol, w, col == flow->totcol - 1, litem->alignment, &offset);
-
+ ui_item_size(item, &itemw, &itemh);
+
+ itemw = (litem->alignment == UI_LAYOUT_ALIGN_EXPAND) ? w : min_ii(w, itemw);
+
y -= itemh;
emy -= itemh;
- ui_item_position(item, x + offset, y, itemw, itemh);
+ ui_item_position(item, x, y, itemw, itemh);
y -= style->buttonspacey;
miny = min_ii(miny, y);
/* decide to go to next one */
if (col < flow->totcol - 1 && emy <= -emh) {
- x += itemw + style->columnspace;
+ x += w + style->columnspace;
y = litem->y;
emy = 0; /* need to reset height again for next column */
col++;
+
+ /* (< remaining width > - < space between remaining columns >) / <remamining columns > */
+ w = ((litem->w - (x - litem->x)) - (flow->totcol - col - 1) * style->columnspace) / (flow->totcol - col);
}
}
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index 7e516474bfd..40ebc946e79 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -113,19 +113,33 @@ static int copy_data_path_button_poll(bContext *C)
return 0;
}
-static int copy_data_path_button_exec(bContext *C, wmOperator *UNUSED(op))
+static int copy_data_path_button_exec(bContext *C, wmOperator *op)
{
PointerRNA ptr;
PropertyRNA *prop;
char *path;
int index;
+ const bool full_path = RNA_boolean_get(op->ptr, "full_path");
+
/* try to create driver using property retrieved from UI */
UI_context_active_but_prop_get(C, &ptr, &prop, &index);
- if (ptr.id.data && ptr.data && prop) {
- path = RNA_path_from_ID_to_property(&ptr, prop);
-
+ if (ptr.id.data != NULL) {
+
+ if (full_path) {
+
+ if (prop) {
+ path = RNA_path_full_property_py_ex(&ptr, prop, index, true);
+ }
+ else {
+ path = RNA_path_full_struct_py(&ptr);
+ }
+ }
+ else {
+ path = RNA_path_from_ID_to_property(&ptr, prop);
+ }
+
if (path) {
WM_clipboard_text_set(path, false);
MEM_freeN(path);
@@ -138,6 +152,8 @@ static int copy_data_path_button_exec(bContext *C, wmOperator *UNUSED(op))
static void UI_OT_copy_data_path_button(wmOperatorType *ot)
{
+ PropertyRNA *prop;
+
/* identifiers */
ot->name = "Copy Data Path";
ot->idname = "UI_OT_copy_data_path_button";
@@ -149,6 +165,10 @@ static void UI_OT_copy_data_path_button(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER;
+
+ /* properties */
+ prop = RNA_def_boolean(ot->srna, "full_path", false, "full_path", "Copy full data path");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
static int copy_python_command_button_poll(bContext *C)
@@ -1115,6 +1135,7 @@ void ED_operatortypes_ui(void)
void ED_keymap_ui(wmKeyConfig *keyconf)
{
wmKeyMap *keymap = WM_keymap_find(keyconf, "User Interface", 0, 0);
+ wmKeyMapItem *kmi;
/* eyedroppers - notice they all have the same shortcut, but pass the event
* through until a suitable eyedropper for the active button is found */
@@ -1122,6 +1143,11 @@ void ED_keymap_ui(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "UI_OT_eyedropper_id", EKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "UI_OT_eyedropper_depth", EKEY, KM_PRESS, 0, 0);
+ /* Copy Data Path */
+ WM_keymap_add_item(keymap, "UI_OT_copy_data_path_button", CKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "UI_OT_copy_data_path_button", CKEY, KM_PRESS, KM_CTRL | KM_SHIFT | KM_ALT, 0);
+ RNA_boolean_set(kmi->ptr, "full_path", true);
+
/* keyframes */
WM_keymap_add_item(keymap, "ANIM_OT_keyframe_insert_button", IKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "ANIM_OT_keyframe_delete_button", IKEY, KM_PRESS, KM_ALT, 0);
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 5602e2b9c6d..cdf34642a8d 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -808,7 +808,7 @@ int UI_searchbox_size_y(void)
int UI_searchbox_size_x(void)
{
- return 10 * UI_UNIT_X;
+ return 12 * UI_UNIT_X;
}
int UI_search_items_find_index(uiSearchItems *items, const char *name)
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 02981b543f3..c285d753b96 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -2625,6 +2625,7 @@ static void ui_draw_separator(const rcti *rect, uiWidgetColors *wcol)
glEnable(GL_BLEND);
glColor4ubv(col);
+ glLineWidth(1.0f);
sdrawline(rect->xmin, y, rect->xmax, y);
glDisable(GL_BLEND);
}
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index b2bfd3db023..93d47211e75 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -971,6 +971,10 @@ void ui_theme_init_default(void)
btheme->tv3d.gradients.show_grad = false;
rgba_char_args_set(btheme->tv3d.clipping_border_3d, 50, 50, 50, 255);
+
+ rgba_char_args_set(btheme->tv3d.time_keyframe, 0xDD, 0xD7, 0x00, 0xFF);
+ rgba_char_args_set(btheme->tv3d.time_gp_keyframe, 0xB5, 0xE6, 0x1D, 0xFF);
+
/* space buttons */
/* to have something initialized */
btheme->tbuts = btheme->tv3d;
@@ -1158,8 +1162,8 @@ void ui_theme_init_default(void)
rgba_char_args_set_fl(btheme->ttime.grid, 0.36, 0.36, 0.36, 1.0);
rgba_char_args_set(btheme->ttime.shade1, 173, 173, 173, 255); /* sliders */
- rgba_char_args_set(btheme->ttime.time_keyframe, 0xDD, 0xD7, 0x00, 1.0);
- rgba_char_args_set(btheme->ttime.time_gp_keyframe, 0xB5, 0xE6, 0x1D, 1.0);
+ rgba_char_args_set(btheme->ttime.time_keyframe, 0xDD, 0xD7, 0x00, 0xFF);
+ rgba_char_args_set(btheme->ttime.time_gp_keyframe, 0xB5, 0xE6, 0x1D, 0xFF);
/* space node, re-uses syntax and console color storage */
btheme->tnode = btheme->tv3d;
@@ -2640,8 +2644,8 @@ void init_userdef_do_versions(void)
btheme->tnode.gp_vertex_size = 3;
/* Timeline Keyframe Indicators */
- rgba_char_args_set(btheme->ttime.time_keyframe, 0xDD, 0xD7, 0x00, 1.0);
- rgba_char_args_set(btheme->ttime.time_gp_keyframe, 0xB5, 0xE6, 0x1D, 1.0);
+ rgba_char_args_set(btheme->ttime.time_keyframe, 0xDD, 0xD7, 0x00, 0xFF);
+ rgba_char_args_set(btheme->ttime.time_gp_keyframe, 0xB5, 0xE6, 0x1D, 0xFF);
}
}
@@ -2721,8 +2725,8 @@ void init_userdef_do_versions(void)
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
/* 3dView Keyframe Indicators */
- rgba_char_args_set(btheme->tv3d.time_keyframe, 0xDD, 0xD7, 0x00, 1.0);
- rgba_char_args_set(btheme->tv3d.time_gp_keyframe, 0xB5, 0xE6, 0x1D, 1.0);
+ rgba_char_args_set(btheme->tv3d.time_keyframe, 0xDD, 0xD7, 0x00, 0xFF);
+ rgba_char_args_set(btheme->tv3d.time_gp_keyframe, 0xB5, 0xE6, 0x1D, 0xFF);
}
}
@@ -2747,7 +2751,7 @@ void init_userdef_do_versions(void)
}
}
- if (!USER_VERSION_ATLEAST(278, 1)) {
+ if (!USER_VERSION_ATLEAST(278, 2)) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
rgba_char_args_set(btheme->tv3d.vertex_bevel, 0, 165, 255, 255);
@@ -2761,6 +2765,11 @@ void init_userdef_do_versions(void)
* (keep this block even if it becomes empty).
*/
{
+ for (bTheme *btheme = U.themes.first; btheme; btheme = btheme->next) {
+ /* Keyframe Indicators (were using wrong alpha) */
+ btheme->tv3d.time_keyframe[3] = btheme->tv3d.time_gp_keyframe[3] = 255;
+ btheme->ttime.time_keyframe[3] = btheme->ttime.time_gp_keyframe[3] = 255;
+ }
}
if (U.pixelsize == 0.0f)