bugfix [#24449] User Preferences - Interface - Manipulator
authorCampbell Barton <ideasman42@gmail.com>
Mon, 1 Nov 2010 02:22:20 +0000 (02:22 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 1 Nov 2010 02:22:20 +0000 (02:22 +0000)
source/blender/editors/space_view3d/space_view3d.c
source/blender/makesrna/intern/rna_userdef.c

index 77f6e63..22143db 100644 (file)
@@ -206,6 +206,7 @@ static SpaceLink *view3d_new(const bContext *C)
        v3d->near= 0.01f;
        v3d->far= 500.0f;
 
+       v3d->twflag |= U.tw_flag & V3D_USE_MANIPULATOR;
        v3d->twtype= V3D_MANIP_TRANSLATE;
        v3d->around= V3D_CENTROID;
        
index b00afa7..161ce2e 100644 (file)
@@ -33,6 +33,7 @@
 #include "DNA_space_types.h"
 #include "DNA_userdef_types.h"
 #include "DNA_brush_types.h"
+#include "DNA_view3d_types.h"
 
 #include "WM_api.h"
 #include "WM_types.h"
@@ -47,6 +48,7 @@
 #include "BKE_DerivedMesh.h"
 #include "BKE_depsgraph.h"
 #include "DNA_object_types.h"
+#include "DNA_screen_types.h"
 #include "GPU_draw.h"
 #include "BKE_global.h"
 
@@ -58,6 +60,34 @@ static void rna_userdef_update(Main *bmain, Scene *scene, PointerRNA *ptr)
        WM_main_add_notifier(NC_WINDOW, NULL);
 }
 
+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 *bmain, Scene *scene, PointerRNA *ptr)
 {
        UserDef *userdef = (UserDef*)ptr->data;
@@ -2008,9 +2038,9 @@ static void rna_def_userdef_view(BlenderRNA *brna)
 
        /* 3D transform widget */
        prop= RNA_def_property(srna, "show_manipulator", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "tw_flag", 1);
+       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_update");
+       RNA_def_property_update(prop, 0, "rna_userdef_show_manipulator_update");
 
        prop= RNA_def_property(srna, "manipulator_size", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "tw_size");