[Bf-blender-cvs] [65552f9] wiggly-widgets: Rework widget UserPref options
Julian Eisel
noreply at git.blender.org
Mon Aug 24 22:46:47 CEST 2015
Commit: 65552f9bc9f8efbe55c7d615a933cf0ce782d996
Author: Julian Eisel
Date: Mon Aug 24 22:44:33 2015 +0200
Branches: wiggly-widgets
https://developer.blender.org/rB65552f9bc9f8efbe55c7d615a933cf0ce782d996
Rework widget UserPref options
Improved naming and tooltip descriptions, removed unnecessary options
===================================================================
M release/scripts/startup/bl_ui/space_userpref.py
M source/blender/editors/interface/resources.c
M source/blender/makesdna/DNA_userdef_types.h
M source/blender/makesrna/intern/rna_userdef.c
M source/blender/windowmanager/intern/wm_widgets.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index c319f0c..9eb2da5 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -216,18 +216,12 @@ class USERPREF_PT_interface(Panel):
#col.label(text="Open Toolbox Delay:")
#col.prop(view, "open_left_mouse_delay", text="Hold LMB")
#col.prop(view, "open_right_mouse_delay", text="Hold RMB")
- col.prop(view, "show_manipulator")
- sub = col.column()
- sub.active = view.show_manipulator
- sub.prop(view, "manipulator_size", text="Size")
- sub.prop(view, "manipulator_handle_size", text="Handle Size")
- sub.prop(view, "manipulator_hotspot", text="Hotspot")
- col.separator()
- sub = col.column()
- sub.prop(view, "shaded_widgets")
- sub.prop(view, "widgets_3d")
-
+ col.label(text="Widgets:")
+ col.prop(view, "manipulator_size")
+ col.prop(view, "shaded_widgets")
+ col.prop(view, "widgets_3d")
+
col.separator()
col.separator()
col.separator()
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 545092b..d8cf550 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1609,10 +1609,8 @@ void init_userdef_do_versions(void)
// XXX error(STRINGIFY(BLENDER_STARTUP_FILE)" is buggy, please consider removing it.\n");
}
/* transform widget settings */
- if (U.tw_hotspot == 0) {
- U.tw_hotspot = 14;
+ if (U.tw_size == 0) {
U.tw_size = 25; /* percentage of window size */
- U.tw_handlesize = 16; /* percentage of widget radius */
}
if (U.pad_rot_angle == 0.0f)
U.pad_rot_angle = 15.0f;
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index bc2c746..aa7a73f 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -485,7 +485,8 @@ typedef struct UserDef {
short gp_settings;
short tb_leftmouse, tb_rightmouse;
struct SolidLight light[3];
- short tw_hotspot, tw_flag, tw_handlesize, tw_size;
+ short tw_flag, tw_size;
+ int pad3;
short textimeout, texcollectrate;
short wmdrawmethod; /* removed wmpad */
short dragthreshold;
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 2085361..d28334e 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -180,33 +180,6 @@ static void rna_userdef_vbo_update(Main *bmain, Scene *UNUSED(scene), PointerRNA
GPU_buffer_multires_free(false);
}
-static void rna_userdef_show_manipulator_update(Main *bmain, Scene *scene, PointerRNA *ptr)
-{
- UserDef *userdef = (UserDef *)ptr->data;
-
- /* lame, loop over all views and set */
- bScreen *sc;
- ScrArea *sa;
- SpaceLink *sl;
-
- /* from scene copy to the other views */
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
- for (sa = sc->areabase.first; sa; sa = sa->next) {
- for (sl = sa->spacedata.first; sl; sl = sl->next) {
- if (sl->spacetype == SPACE_VIEW3D) {
- View3D *v3d = (View3D *)sl;
- if (userdef->tw_flag & V3D_USE_MANIPULATOR)
- v3d->twflag |= V3D_USE_MANIPULATOR;
- else
- v3d->twflag &= ~V3D_USE_MANIPULATOR;
- }
- }
- }
- }
-
- rna_userdef_update(bmain, scene, ptr);
-}
-
static void rna_userdef_script_autoexec_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
@@ -3560,41 +3533,23 @@ static void rna_def_userdef_view(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Rotation Angle", "Rotation step for numerical pad keys (2 4 6 8)");
/* 3D transform widget */
- prop = RNA_def_property(srna, "show_manipulator", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "tw_flag", V3D_USE_MANIPULATOR);
- RNA_def_property_ui_text(prop, "Manipulator", "Use 3D transform manipulator");
- RNA_def_property_update(prop, 0, "rna_userdef_show_manipulator_update");
-
prop = RNA_def_property(srna, "shaded_widgets", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "tw_flag", V3D_SHADED_WIDGETS);
- RNA_def_property_ui_text(prop, "Shaded Widgets", "3D shading for widgets");
+ RNA_def_property_ui_text(prop, "Shaded Widgets", "Use 3D shading for widgets");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "widgets_3d", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "tw_flag", V3D_3D_WIDGETS);
- RNA_def_property_ui_text(prop, "3D widgets", "Widgets size stays constant in world space");
+ RNA_def_property_ui_text(prop, "3D Widgets", "Use 3D view world space for widget sizes");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "manipulator_size", PROP_INT, PROP_PIXEL);
RNA_def_property_int_sdna(prop, NULL, "tw_size");
RNA_def_property_range(prop, 10, 200);
RNA_def_property_int_default(prop, 75);
- RNA_def_property_ui_text(prop, "Manipulator Size", "Diameter of the manipulator");
+ RNA_def_property_ui_text(prop, "Manipulator Size", "Size of the transform manipulator");
RNA_def_property_update(prop, 0, "rna_userdef_update");
- prop = RNA_def_property(srna, "manipulator_handle_size", PROP_INT, PROP_PERCENTAGE);
- RNA_def_property_int_sdna(prop, NULL, "tw_handlesize");
- RNA_def_property_range(prop, 2, 40);
- RNA_def_property_int_default(prop, 25);
- RNA_def_property_ui_text(prop, "Manipulator Handle Size", "Size of manipulator handles as percentage of the radius");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
- prop = RNA_def_property(srna, "manipulator_hotspot", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "tw_hotspot");
- RNA_def_property_range(prop, 4, 40);
- RNA_def_property_int_default(prop, 14);
- RNA_def_property_ui_text(prop, "Manipulator Hotspot", "Distance around the handles to accept mouse clicks");
-
prop = RNA_def_property(srna, "object_origin_size", PROP_INT, PROP_PIXEL);
RNA_def_property_int_sdna(prop, NULL, "obcenter_dia");
RNA_def_property_range(prop, 4, 10);
diff --git a/source/blender/windowmanager/intern/wm_widgets.c b/source/blender/windowmanager/intern/wm_widgets.c
index fd79b37..b32fa7b 100644
--- a/source/blender/windowmanager/intern/wm_widgets.c
+++ b/source/blender/windowmanager/intern/wm_widgets.c
@@ -676,10 +676,10 @@ static void wm_prepare_visible_widgets_3D(wmWidgetMap *wmap, ListBase *visible_w
wmWidget *wm_widget_find_highlighted_3D(wmWidgetMap *wmap, bContext *C, const wmEvent *event, unsigned char *part)
{
- int ret;
wmWidget *result = NULL;
-
ListBase visible_widgets = {0};
+ const float hotspot = 14.0f;
+ int ret;
wm_prepare_visible_widgets_3D(wmap, &visible_widgets, C);
@@ -687,12 +687,12 @@ wmWidget *wm_widget_find_highlighted_3D(wmWidgetMap *wmap, bContext *C, const wm
/* set up view matrices */
view3d_operator_needs_opengl(C);
- ret = wm_widget_find_highlighted_3D_intern(&visible_widgets, C, event, 0.5f * (float)U.tw_hotspot);
+ ret = wm_widget_find_highlighted_3D_intern(&visible_widgets, C, event, 0.5f * hotspot);
if (ret != -1) {
LinkData *link;
int retsec;
- retsec = wm_widget_find_highlighted_3D_intern(&visible_widgets, C, event, 0.2f * (float)U.tw_hotspot);
+ retsec = wm_widget_find_highlighted_3D_intern(&visible_widgets, C, event, 0.2f * hotspot);
if (retsec != -1)
ret = retsec;
More information about the Bf-blender-cvs
mailing list