2.5: Tool Settings
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 23 Jun 2009 00:41:55 +0000 (00:41 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 23 Jun 2009 00:41:55 +0000 (00:41 +0000)
* Moved proportional edit, snap, autokey mode, and a few others
  from Scene to ToolSettings.
* RNA wrapped properties in ToolSettings for the UV editor:
  proportional edit, snap settings, selection modes.

26 files changed:
source/blender/blenkernel/intern/scene.c
source/blender/blenloader/intern/readfile.c
source/blender/editors/armature/editarmature_sketch.c
source/blender/editors/include/ED_keyframing.h
source/blender/editors/include/UI_icons.h
source/blender/editors/mesh/editmesh.c
source/blender/editors/mesh/editmesh_mods.c
source/blender/editors/object/object_edit.c
source/blender/editors/physics/editparticle.c
source/blender/editors/space_image/image_header.c
source/blender/editors/space_time/time_header.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_buttons.c
source/blender/editors/space_view3d/view3d_header.c
source/blender/editors/space_view3d/view3d_select.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform.h
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c
source/blender/editors/transform/transform_snap.c
source/blender/editors/uvedit/uvedit_draw.c
source/blender/editors/uvedit/uvedit_ops.c
source/blender/makesdna/DNA_scene_types.h
source/blender/makesdna/DNA_space_types.h
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_wm.c

index 3b51af57e0b3203d871bec053baf876a07290dae..23da5c66850acb969bfe3b6e980f212f4a57e9be 100644 (file)
@@ -203,9 +203,6 @@ Scene *add_scene(char *name)
 
        sce= alloc_libblock(&G.main->scene, ID_SCE, name);
        sce->lay= 1;
-       sce->selectmode= SCE_SELECT_VERTEX;
-       sce->editbutsize= 0.1;
-       sce->autokey_mode= U.autokey_mode;
        
        sce->r.mode= R_GAMMA;
        sce->r.cfra= 1;
@@ -275,6 +272,10 @@ Scene *add_scene(char *name)
        sce->toolsettings->select_thresh= 0.01f;
        sce->toolsettings->jointrilimit = 0.8f;
 
+       sce->toolsettings->selectmode= SCE_SELECT_VERTEX;
+       sce->toolsettings->normalsize= 0.1;
+       sce->toolsettings->autokey_mode= U.autokey_mode;
+
        sce->toolsettings->skgen_resolution = 100;
        sce->toolsettings->skgen_threshold_internal     = 0.01f;
        sce->toolsettings->skgen_threshold_external     = 0.01f;
index 48aa3f6a3b7585fb2293a7b3afd75a81bb1a5e42..54caad7f35b85d973336f198c011fb470c888ec5 100644 (file)
@@ -7102,22 +7102,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
        
 
        if(main->versionfile <= 234) {
-               Scene *sce;
                World *wo;
                bScreen *sc;
-               int set_zbuf_sel=0;
                
                // force sumo engine to be active
                for (wo = main->world.first; wo; wo= wo->id.next) {
                        if(wo->physicsEngine==0) wo->physicsEngine = 2;
                }
                
-               for (sce= main->scene.first; sce; sce= sce->id.next) {
-                       if(sce->selectmode==0) {
-                               sce->selectmode= SCE_SELECT_VERTEX;
-                               set_zbuf_sel= 1;
-                       }
-               }
                for (sc= main->screen.first; sc; sc= sc->id.next) {
                        ScrArea *sa;
                        for (sa= sc->areabase.first; sa; sa= sa->next) {
@@ -7125,7 +7117,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                for (sl= sa->spacedata.first; sl; sl= sl->next) {
                                        if(sl->spacetype==SPACE_VIEW3D) {
                                                View3D *v3d= (View3D *)sl;
-                                               if(set_zbuf_sel) v3d->flag |= V3D_ZBUF_SELECT;
+                                               v3d->flag |= V3D_ZBUF_SELECT;
                                        }
                                        else if(sl->spacetype==SPACE_TEXT) {
                                                SpaceText *st= (SpaceText *)sl;
@@ -7160,16 +7152,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
        }
        if(main->versionfile <= 236) {
                Object *ob;
-               Scene *sce= main->scene.first;
                Camera *cam= main->camera.first;
                Material *ma;
                bScreen *sc;
 
-               while(sce) {
-                       if(sce->editbutsize==0.0) sce->editbutsize= 0.1f;
-                       
-                       sce= sce->id.next;
-               }
                while(cam) {
                        if(cam->ortho_scale==0.0) {
                                cam->ortho_scale= 256.0f/cam->lens;
@@ -8795,15 +8781,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                        }
                }
        }
-       /* autokey mode settings now used from scene, but need to be initialised off userprefs */
-       if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 8)) {
-               Scene *sce;
-               
-               for (sce= main->scene.first; sce; sce= sce->id.next) {
-                       if (sce->autokey_mode == 0)
-                               sce->autokey_mode= U.autokey_mode;
-               }
-       }
 
        if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 9)) {
                Lamp *la= main->lamp.first;
@@ -8996,6 +8973,34 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
        
        }
 
+       if (main->versionfile < 249 && main->subversionfile < 2) {
+               Scene *sce= main->scene.first;
+               Sequence *seq;
+               Editing *ed;
+               
+               while(sce) {
+                       ed= sce->ed;
+                       if(ed) {
+                               SEQP_BEGIN(ed, seq) {
+                                       if (seq->strip && seq->strip->proxy){
+                                               if (sce->r.size != 100.0) {
+                                                       seq->strip->proxy->size
+                                                               = sce->r.size;
+                                               } else {
+                                                       seq->strip->proxy->size
+                                                               = 25.0;
+                                               }
+                                               seq->strip->proxy->quality =90;
+                                       }
+                               }
+                               SEQ_END
+                       }
+                       
+                       sce= sce->id.next;
+               }
+
+       }
+
        if (main->versionfile < 250) {
                bScreen *screen;
                Scene *scene;
@@ -9081,6 +9086,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
        {
                Object *ob;
                Material *ma;
+               Scene *sce;
+               ToolSettings *ts;
                int i;
 
                for(ob = main->object.first; ob; ob = ob->id.next) {
@@ -9153,37 +9160,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                ma->mode &= ~MA_HALO;
                        }
                }
-       }
-       
-       if (main->versionfile < 249 && main->subversionfile < 2) {
-               Scene *sce= main->scene.first;
-               Sequence *seq;
-               Editing *ed;
-               
-               while(sce) {
-                       ed= sce->ed;
-                       if(ed) {
-                               SEQP_BEGIN(ed, seq) {
-                                       if (seq->strip && seq->strip->proxy){
-                                               if (sce->r.size != 100.0) {
-                                                       seq->strip->proxy->size
-                                                               = sce->r.size;
-                                               } else {
-                                                       seq->strip->proxy->size
-                                                               = 25.0;
-                                               }
-                                               seq->strip->proxy->quality =90;
-                                       }
-                               }
-                               SEQ_END
+
+               for(sce = main->scene.first; sce; sce = sce->id.next) {
+                       ts= sce->toolsettings;
+                       if(ts->normalsize == 0.0) {
+                               ts->normalsize= 0.1f;
+                               ts->selectmode= SCE_SELECT_VERTEX;
+                               ts->autokey_mode= U.autokey_mode;
                        }
-                       
-                       sce= sce->id.next;
                }
-
        }
 
-
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! */
        /* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */
 
index f010abdb7e79bba19b40da088e3118287425594a..fb030b91ce14576025c1069f183ae66f387fd5ac 100644 (file)
@@ -243,6 +243,7 @@ void BIF_makeListTemplates(bContext *C)
 {
        Object *obedit = CTX_data_edit_object(C);
        Scene *scene = CTX_data_scene(C);
+       ToolSettings *ts = CTX_data_tool_settings(C);
        Base *base;
        int index = 0;
 
@@ -263,7 +264,7 @@ void BIF_makeListTemplates(bContext *C)
                        index++;
                        BLI_ghash_insert(TEMPLATES_HASH, SET_INT_IN_POINTER(index), ob);
                        
-                       if (ob == scene->toolsettings->skgen_template)
+                       if (ob == ts->skgen_template)
                        {
                                TEMPLATES_CURRENT = index;
                        }
@@ -305,8 +306,9 @@ char *BIF_listTemplates(bContext *C)
 
 int   BIF_currentTemplate(bContext *C)
 {
-       Scene *scene = CTX_data_scene(C);
-       if (TEMPLATES_CURRENT == 0 && scene->toolsettings->skgen_template != NULL)
+       ToolSettings *ts = CTX_data_tool_settings(C);
+
+       if (TEMPLATES_CURRENT == 0 && ts->skgen_template != NULL)
        {
                GHashIterator ghi;
                BLI_ghashIterator_init(&ghi, TEMPLATES_HASH);
@@ -316,7 +318,7 @@ int   BIF_currentTemplate(bContext *C)
                        Object *ob = BLI_ghashIterator_getValue(&ghi);
                        int key = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&ghi));
                        
-                       if (ob == scene->toolsettings->skgen_template)
+                       if (ob == ts->skgen_template)
                        {
                                TEMPLATES_CURRENT = key;
                                break;
@@ -360,8 +362,8 @@ RigGraph* sk_makeTemplateGraph(bContext *C, Object *ob)
 
 int BIF_nbJointsTemplate(bContext *C)
 {
-       Scene *scene = CTX_data_scene(C);
-       RigGraph *rg = sk_makeTemplateGraph(C, scene->toolsettings->skgen_template);
+       ToolSettings *ts = CTX_data_tool_settings(C);
+       RigGraph *rg = sk_makeTemplateGraph(C, ts->skgen_template);
        
        if (rg)
        {
@@ -375,7 +377,7 @@ int BIF_nbJointsTemplate(bContext *C)
 
 char * BIF_nameBoneTemplate(bContext *C)
 {
-       Scene *scene = CTX_data_scene(C);
+       ToolSettings *ts = CTX_data_tool_settings(C);
        SK_Sketch *stk = GLOBAL_sketch;
        RigGraph *rg;
        int index = 0;
@@ -385,7 +387,7 @@ char * BIF_nameBoneTemplate(bContext *C)
                index = stk->active_stroke->nb_points;
        }
        
-       rg = sk_makeTemplateGraph(C, scene->toolsettings->skgen_template);
+       rg = sk_makeTemplateGraph(C, ts->skgen_template);
        
        if (rg == NULL)
        {
@@ -418,14 +420,14 @@ void  BIF_freeTemplates(bContext *C)
 
 void  BIF_setTemplate(bContext *C, int index)
 {
-       Scene *scene = CTX_data_scene(C);
+       ToolSettings *ts = CTX_data_tool_settings(C);
        if (index > 0)
        {
-               scene->toolsettings->skgen_template = BLI_ghash_lookup(TEMPLATES_HASH, SET_INT_IN_POINTER(index));
+               ts->skgen_template = BLI_ghash_lookup(TEMPLATES_HASH, SET_INT_IN_POINTER(index));
        }
        else
        {
-               scene->toolsettings->skgen_template = NULL;
+               ts->skgen_template = NULL;
                
                if (TEMPLATE_RIGG != NULL)
                {
@@ -439,19 +441,19 @@ void  BIF_setTemplate(bContext *C, int index)
 
 void sk_autoname(bContext *C, ReebArc *arc)
 {
-       Scene *scene = CTX_data_scene(C);
-       if (scene->toolsettings->skgen_retarget_options & SK_RETARGET_AUTONAME)
+       ToolSettings *ts = CTX_data_tool_settings(C);
+       if (ts->skgen_retarget_options & SK_RETARGET_AUTONAME)
        {
                if (arc == NULL)
                {
-                       char *num = scene->toolsettings->skgen_num_string;
+                       char *num = ts->skgen_num_string;
                        int i = atoi(num);
                        i++;
                        BLI_snprintf(num, 8, "%i", i);
                }
                else
                {
-                       char *side = scene->toolsettings->skgen_side_string;
+                       char *side = ts->skgen_side_string;
                        int valid = 0;
                        int caps = 0;
                        
@@ -525,7 +527,7 @@ ReebArc *sk_strokeToArc(SK_Stroke *stk, float imat[][4], float tmat[][3])
 
 void sk_retargetStroke(bContext *C, SK_Stroke *stk)
 {
-       Scene *scene = CTX_data_scene(C);
+       ToolSettings *ts = CTX_data_tool_settings(C);
        Object *obedit = CTX_data_edit_object(C);
        float imat[4][4];
        float tmat[3][3];
@@ -541,7 +543,7 @@ void sk_retargetStroke(bContext *C, SK_Stroke *stk)
        
        sk_autoname(C, arc);
        
-       rg = sk_makeTemplateGraph(C, scene->toolsettings->skgen_template);
+       rg = sk_makeTemplateGraph(C, ts->skgen_template);
 
        BIF_retargetArc(C, arc, rg);
        
@@ -1408,10 +1410,10 @@ void sk_startStroke(SK_Sketch *sketch)
 
 void sk_endStroke(bContext *C, SK_Sketch *sketch)
 {
-       Scene *scene = CTX_data_scene(C);
+       ToolSettings *ts = CTX_data_tool_settings(C);
        sk_shrinkStrokeBuffer(sketch->active_stroke);
 
-       if (scene->toolsettings->bone_sketching & BONE_SKETCHING_ADJUST)
+       if (ts->bone_sketching & BONE_SKETCHING_ADJUST)
        {
                sk_endOverdraw(sketch);
        }
@@ -1521,10 +1523,10 @@ int sk_addStrokeDrawPoint(bContext *C, SK_Sketch *sketch, SK_Stroke *stk, SK_Dra
 
 int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, SK_Stroke *stk, SK_DrawData *dd)
 {
-       Scene *scene = CTX_data_scene(C);
+       ToolSettings *ts = CTX_data_tool_settings(C);
        int point_added = 0;
 
-       if (scene->snap_mode == SCE_SNAP_MODE_VOLUME)
+       if (ts->snap_mode == SCE_SNAP_MODE_VOLUME)
        {
                ListBase depth_peels;
                DepthPeel *p1, *p2;
@@ -1557,7 +1559,7 @@ int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, SK_Strok
                                p1->flag = 1;
        
                                /* if peeling objects, take the first and last from each object */                      
-                               if (scene->snap_flag & SCE_SNAP_PEEL_OBJECT)
+                               if (ts->snap_flag & SCE_SNAP_PEEL_OBJECT)
                                {
                                        DepthPeel *peel;
                                        for (peel = p1->next; peel; peel = peel->next)
@@ -1627,7 +1629,7 @@ int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, SK_Strok
                int dist = SNAP_MIN_DISTANCE; // Use a user defined value here
 
                /* snap to strokes */
-               // if (scene->snap_mode == SCE_SNAP_MODE_VERTEX) /* snap all the time to strokes */
+               // if (ts->snap_mode == SCE_SNAP_MODE_VERTEX) /* snap all the time to strokes */
                for (snap_stk = sketch->strokes.first; snap_stk; snap_stk = snap_stk->next)
                {
                        SK_Point *spt = NULL;
@@ -1713,7 +1715,7 @@ int sk_addStrokeSnapPoint(bContext *C, SK_Sketch *sketch, SK_Stroke *stk, SK_Dra
 
 void sk_addStrokePoint(bContext *C, SK_Sketch *sketch, SK_Stroke *stk, SK_DrawData *dd, short snap)
 {
-       Scene *scene = CTX_data_scene(C);
+       ToolSettings *ts = CTX_data_tool_settings(C);
        int point_added = 0;
        
        if (snap)
@@ -1726,7 +1728,7 @@ void sk_addStrokePoint(bContext *C, SK_Sketch *sketch, SK_Stroke *stk, SK_DrawDa
                point_added = sk_addStrokeDrawPoint(C, sketch, stk, dd);
        }
        
-       if (stk == sketch->active_stroke && scene->toolsettings->bone_sketching & BONE_SKETCHING_ADJUST)
+       if (stk == sketch->active_stroke && ts->bone_sketching & BONE_SKETCHING_ADJUST)
        {
                sk_updateOverdraw(C, sketch, stk, dd);
        }
@@ -1951,7 +1953,7 @@ static int iteratorStopped(void *arg)
 void sk_convertStroke(bContext *C, SK_Stroke *stk)
 {
        Object *obedit = CTX_data_edit_object(C);
-       Scene *scene = CTX_data_scene(C);
+       ToolSettings *ts = CTX_data_tool_settings(C);
        bArmature *arm = obedit->data;
        SK_Point *head;
        EditBone *parent = NULL;
@@ -1990,17 +1992,17 @@ void sk_convertStroke(bContext *C, SK_Stroke *stk)
 
                                        initStrokeIterator(iter, stk, head_index, i);
                                        
-                                       if (scene->toolsettings->bone_sketching_convert == SK_CONVERT_CUT_ADAPTATIVE)
+                                       if (ts->bone_sketching_convert == SK_CONVERT_CUT_ADAPTATIVE)
                                        {
-                                               bone = subdivideArcBy(scene->toolsettings, arm, arm->edbo, iter, invmat, tmat, nextAdaptativeSubdivision);
+                                               bone = subdivideArcBy(ts, arm, arm->edbo, iter, invmat, tmat, nextAdaptativeSubdivision);
                                        }
-                                       else if (scene->toolsettings->bone_sketching_convert == SK_CONVERT_CUT_LENGTH)
+                                       else if (ts->bone_sketching_convert == SK_CONVERT_CUT_LENGTH)
                                        {
-                                               bone = subdivideArcBy(scene->toolsettings, arm, arm->edbo, iter, invmat, tmat, nextLengthSubdivision);
+                                               bone = subdivideArcBy(ts, arm, arm->edbo, iter, invmat, tmat, nextLengthSubdivision);
                                        }
-                                       else if (scene->toolsettings->bone_sketching_convert == SK_CONVERT_CUT_FIXED)
+                                       else if (ts->bone_sketching_convert == SK_CONVERT_CUT_FIXED)
                                        {
-                                               bone = subdivideArcBy(scene->toolsettings, arm, arm->edbo, iter, invmat, tmat, nextFixedSubdivision);
+                                               bone = subdivideArcBy(ts, arm, arm->edbo, iter, invmat, tmat, nextFixedSubdivision);
                                        }
                                }
                                
@@ -2042,14 +2044,14 @@ void sk_convertStroke(bContext *C, SK_Stroke *stk)
 
 void sk_convert(bContext *C, SK_Sketch *sketch)
 {
-       Scene *scene = CTX_data_scene(C);
+       ToolSettings *ts = CTX_data_tool_settings(C);
        SK_Stroke *stk;
        
        for (stk = sketch->strokes.first; stk; stk = stk->next)
        {
                if (stk->selected == 1)
                {
-                       if (scene->toolsettings->bone_sketching_convert == SK_CONVERT_RETARGET)
+                       if (ts->bone_sketching_convert == SK_CONVERT_RETARGET)
                        {
                                sk_retargetStroke(C, stk);
                        }
@@ -2693,7 +2695,7 @@ void sk_selectStroke(bContext *C, SK_Sketch *sketch, short mval[2], int extend)
        rect.ymin= mval[1]-5;
        rect.ymax= mval[1]+5;
                
-       hits= view3d_opengl_select(&vc, buffer, MAXPICKBUF, &rect);
+       hits = view3d_opengl_select(&vc, buffer, MAXPICKBUF, &rect);
 
        if (hits>0)
        {
@@ -2743,6 +2745,7 @@ void sk_queueRedrawSketch(SK_Sketch *sketch)
 
 void sk_drawSketch(Scene *scene, SK_Sketch *sketch, int with_names)
 {
+       ToolSettings *ts= scene->toolsettings;
        SK_Stroke *stk;
        
        glDisable(GL_DEPTH_TEST);
@@ -2779,7 +2782,7 @@ void sk_drawSketch(Scene *scene, SK_Sketch *sketch, int with_names)
                
                        if (stk->selected == 1)
                        {
-                               sk_drawStrokeSubdivision(scene->toolsettings, stk);
+                               sk_drawStrokeSubdivision(ts, stk);
                        }
                }
        
@@ -2794,9 +2797,9 @@ void sk_drawSketch(Scene *scene, SK_Sketch *sketch, int with_names)
                {
                        SK_Point *last = sk_lastStrokePoint(sketch->active_stroke);
                        
-                       if (scene->toolsettings->bone_sketching & BONE_SKETCHING_QUICK)
+                       if (ts->bone_sketching & BONE_SKETCHING_QUICK)
                        {
-                               sk_drawStrokeSubdivision(scene->toolsettings, sketch->active_stroke);
+                               sk_drawStrokeSubdivision(ts, sketch->active_stroke);
                        }
                        
                        if (last != NULL)
@@ -2839,7 +2842,7 @@ void sk_drawSketch(Scene *scene, SK_Sketch *sketch, int with_names)
 
 int sk_finish_stroke(bContext *C, SK_Sketch *sketch)
 {
-       Scene *scene = CTX_data_scene(C);
+       ToolSettings *ts = CTX_data_tool_settings(C);
 
        if (sketch->active_stroke != NULL)
        {
@@ -2847,9 +2850,9 @@ int sk_finish_stroke(bContext *C, SK_Sketch *sketch)
                
                sk_endStroke(C, sketch);
                
-               if (scene->toolsettings->bone_sketching & BONE_SKETCHING_QUICK)
+               if (ts->bone_sketching & BONE_SKETCHING_QUICK)
                {
-                       if (scene->toolsettings->bone_sketching_convert == SK_CONVERT_RETARGET)
+                       if (ts->bone_sketching_convert == SK_CONVERT_RETARGET)
                        {
                                sk_retargetStroke(C, stk);
                        }
@@ -3196,11 +3199,11 @@ static int sketch_draw_preview(bContext *C, wmOperator *op, wmEvent *event)
 int ED_operator_sketch_mode_active_stroke(bContext *C)
 {
        Object *obedit = CTX_data_edit_object(C);
-       Scene *scene = CTX_data_scene(C);
+       ToolSettings *ts = CTX_data_tool_settings(C);
        
        if (obedit && 
                obedit->type == OB_ARMATURE && 
-               scene->toolsettings->bone_sketching & BONE_SKETCHING &&
+               ts->bone_sketching & BONE_SKETCHING &&
                GLOBAL_sketch != NULL &&
                GLOBAL_sketch->active_stroke != NULL)
        {
@@ -3215,12 +3218,12 @@ int ED_operator_sketch_mode_active_stroke(bContext *C)
 int ED_operator_sketch_mode_gesture(bContext *C)
 {
        Object *obedit = CTX_data_edit_object(C);
-       Scene *scene = CTX_data_scene(C);
+       ToolSettings *ts = CTX_data_tool_settings(C);
        
        if (obedit && 
                obedit->type == OB_ARMATURE && 
-               scene->toolsettings->bone_sketching & BONE_SKETCHING &&
-               (scene->toolsettings->bone_sketching & BONE_SKETCHING_QUICK) == 0 &&
+               ts->bone_sketching & BONE_SKETCHING &&
+               (ts->bone_sketching & BONE_SKETCHING_QUICK) == 0 &&
                GLOBAL_sketch != NULL &&
                GLOBAL_sketch->active_stroke == NULL)
        {
@@ -3235,12 +3238,12 @@ int ED_operator_sketch_mode_gesture(bContext *C)
 int ED_operator_sketch_full_mode(bContext *C)
 {
        Object *obedit = CTX_data_edit_object(C);
-       Scene *scene = CTX_data_scene(C);
+       ToolSettings *ts = CTX_data_tool_settings(C);
        
        if (obedit && 
                obedit->type == OB_ARMATURE && 
-               scene->toolsettings->bone_sketching & BONE_SKETCHING && 
-               (scene->toolsettings->bone_sketching & BONE_SKETCHING_QUICK) == 0)
+               ts->bone_sketching & BONE_SKETCHING && 
+               (ts->bone_sketching & BONE_SKETCHING_QUICK) == 0)
        {
                return 1;
        }
@@ -3253,11 +3256,11 @@ int ED_operator_sketch_full_mode(bContext *C)
 int ED_operator_sketch_mode(bContext *C)
 {
        Object *obedit = CTX_data_edit_object(C);
-       Scene *scene = CTX_data_scene(C);
+       ToolSettings *ts = CTX_data_tool_settings(C);
        
        if (obedit && 
                obedit->type == OB_ARMATURE && 
-               scene->toolsettings->bone_sketching & BONE_SKETCHING)
+               ts->bone_sketching & BONE_SKETCHING)
        {
                return 1;
        }
index a15a258d45ada0aed4918380c79cc60f54360add..9d063910aa9b73d3f3e304f87789042d75c22973 100644 (file)
@@ -178,9 +178,9 @@ void ANIM_OT_remove_driver_button(struct wmOperatorType *ot);
 
 /* Auto-Keying macros for use by various tools */
        /* check if auto-keyframing is enabled (per scene takes presidence) */
-#define IS_AUTOKEY_ON(scene)   ((scene) ? (scene->autokey_mode & AUTOKEY_ON) : (U.autokey_mode & AUTOKEY_ON))
+#define IS_AUTOKEY_ON(scene)   ((scene) ? (scene->toolsettings->autokey_mode & AUTOKEY_ON) : (U.autokey_mode & AUTOKEY_ON))
        /* check the mode for auto-keyframing (per scene takes presidence)  */
-#define IS_AUTOKEY_MODE(scene, mode)   ((scene) ? (scene->autokey_mode == AUTOKEY_MODE_##mode) : (U.autokey_mode == AUTOKEY_MODE_##mode))
+#define IS_AUTOKEY_MODE(scene, mode)   ((scene) ? (scene->toolsettings->autokey_mode == AUTOKEY_MODE_##mode) : (U.autokey_mode == AUTOKEY_MODE_##mode))
        /* check if a flag is set for auto-keyframing (as userprefs only!) */
 #define IS_AUTOKEY_FLAG(flag)  (U.autokey_flag & AUTOKEY_FLAG_##flag)
 
index a38dfd93c3097a3b7f7d43a388babc6be6fa092d..884020ae7dce04780c0f39b819eb1e4464994940 100644 (file)
@@ -74,8 +74,8 @@ DEF_ICON(ICON_CHECKBOX_DEHLT)
 DEF_ICON(ICON_CHECKBOX_HLT)
 DEF_ICON(ICON_UNLOCKED)
 DEF_ICON(ICON_LOCKED)
-DEF_ICON(ICON_PINNED)
 DEF_ICON(ICON_UNPINNED)
+DEF_ICON(ICON_PINNED)
 DEF_ICON(ICON_BLANK015)
 DEF_ICON(ICON_RIGHTARROW)
 DEF_ICON(ICON_DOWNARROW_HLT)
index dd003d103d5b43d2a38743c8efcdda5f530542eb..c05751feddccc9d1f53677766156da19158fa470 100644 (file)
@@ -841,7 +841,7 @@ void make_editMesh(Scene *scene, Object *ob)
        
        em= me->edit_mesh;
        
-       em->selectmode= scene->selectmode; // warning needs to be synced
+       em->selectmode= scene->toolsettings->selectmode; // warning needs to be synced
        em->act_face = NULL;
        em->totvert= tot= me->totvert;
        em->totedge= me->totedge;
index a1f8b3251c8ba8ed5ca0a142d1e65e8dbf9be3d7..07ed6ae7a0136d38368e475bf488c32576ae0263 100644 (file)
@@ -3531,7 +3531,7 @@ static void mesh_selection_type(Scene *scene, EditMesh *em, int val)
                
                /* note, em stores selectmode to be able to pass it on everywhere without scene,
                   this is only until all select modes and toolsettings are settled more */
-               scene->selectmode= em->selectmode;
+               scene->toolsettings->selectmode= em->selectmode;
 //             if (EM_texFaceCheck())
        }
 }
index 74a1fc1263116f3506d3743debbed407171c5237..7a75e3875ea10c48956d13e52c415c5e52e024ed 100644 (file)
@@ -3661,7 +3661,7 @@ void special_editmenu(Scene *scene, View3D *v3d)
                        if(!psys)
                                return;
 
-                       if(scene->selectmode & SCE_SELECT_POINT)
+                       if(pset->selectmode & SCE_SELECT_POINT)
                                nr= pupmenu("Specials%t|Rekey%x1|Subdivide%x2|Select First%x3|Select Last%x4|Remove Doubles%x5");
                        else
                                nr= pupmenu("Specials%t|Rekey%x1|Remove Doubles%x5");
index a9fc65bdc37e543ec42159698e0c14449031729b..1b6b5b43522d9d89fc40d07113a7495a743f828e 100644 (file)
@@ -225,7 +225,7 @@ void PE_hide_keys_time(Scene *scene, ParticleSystem *psys, float cfra)
        ParticleEditSettings *pset=PE_settings(scene);
        int i, k, totpart= psys->totpart;
 
-       if(pset->draw_timed && scene->selectmode==SCE_SELECT_POINT) {
+       if(pset->draw_timed && pset->selectmode==SCE_SELECT_POINT) {
                LOOP_PARTICLES(i, pa) {
                        LOOP_KEYS(k, key) {
                                if(fabs(cfra-*key->time) < pset->draw_timed)
@@ -425,11 +425,12 @@ static void for_mouse_hit_keys(PEData *data, ForKeyFunc func, int nearest)
        ParticleEdit *edit= psys->edit;
        ParticleData *pa;
        ParticleEditKey *key;
+       ParticleEditSettings *pset= PE_settings(data->scene);
        int i, k, totpart, nearest_pa, nearest_key;
        float dist= data->rad;
 
        /* in path select mode we have no keys */
-       if(data->scene->selectmode==SCE_SELECT_PATH)
+       if(pset->selectmode==SCE_SELECT_PATH)
                return;
 
        totpart= psys->totpart;
@@ -439,7 +440,7 @@ static void for_mouse_hit_keys(PEData *data, ForKeyFunc func, int nearest)
        LOOP_PARTICLES(i, pa) {
                if(pa->flag & PARS_HIDE) continue;
 
-               if(data->scene->selectmode == SCE_SELECT_END) {
+               if(pset->selectmode == SCE_SELECT_END) {
                        /* only do end keys */
                        key= edit->keys[i] + pa->totkey-1;
 
@@ -481,18 +482,19 @@ static void foreach_mouse_hit_particle(PEData *data, ForParticleFunc func, int s
        ParticleSystem *psys= data->psys;
        ParticleData *pa;
        ParticleEditKey *key;
+       ParticleEditSettings *pset= PE_settings(data->scene);
        int i, k, totpart;
 
        totpart= psys->totpart;
 
        /* all is selected in path mode */
-       if(data->scene->selectmode==SCE_SELECT_PATH)
+       if(pset->selectmode==SCE_SELECT_PATH)
                selected=0;
 
        LOOP_PARTICLES(i, pa) {
                if(pa->flag & PARS_HIDE) continue;
 
-               if(data->scene->selectmode==SCE_SELECT_END) {
+               if(pset->selectmode==SCE_SELECT_END) {
                        /* only do end keys */
                        key= psys->edit->keys[i] + pa->totkey-1;
 
@@ -522,6 +524,7 @@ static void foreach_mouse_hit_key(PEData *data, ForKeyMatFunc func, int selected
        ParticleData *pa;
        ParticleEditKey *key;
        ParticleSystemModifierData *psmd=0;
+       ParticleEditSettings *pset= PE_settings(data->scene);
        int i, k, totpart;
        float mat[4][4], imat[4][4];
 
@@ -529,7 +532,7 @@ static void foreach_mouse_hit_key(PEData *data, ForKeyMatFunc func, int selected
        totpart= psys->totpart;
 
        /* all is selected in path mode */
-       if(data->scene->selectmode==SCE_SELECT_PATH)
+       if(pset->selectmode==SCE_SELECT_PATH)
                selected= 0;
 
        Mat4One(imat);
@@ -541,7 +544,7 @@ static void foreach_mouse_hit_key(PEData *data, ForKeyMatFunc func, int selected
                psys_mat_hair_to_global(data->ob, psmd->dm, psys->part->from, pa, mat);
                Mat4Invert(imat,mat);
 
-               if(data->scene->selectmode==SCE_SELECT_END) {
+               if(pset->selectmode==SCE_SELECT_END) {
                        /* only do end keys */
                        key= psys->edit->keys[i] + pa->totkey-1;
 
@@ -610,6 +613,7 @@ static int count_selected_keys(Scene *scene, ParticleSystem *psys)
 {
        ParticleData *pa;
        ParticleEditKey *key;
+       ParticleEditSettings *pset= PE_settings(scene);
        int i, k, totpart, sel= 0;
 
        totpart= psys->totpart;
@@ -619,12 +623,12 @@ static int count_selected_keys(Scene *scene, ParticleSystem *psys)
 
                key= psys->edit->keys[i];
 
-               if(scene->selectmode==SCE_SELECT_POINT) {
+               if(pset->selectmode==SCE_SELECT_POINT) {
                        for(k=0; k<pa->totkey; k++,key++)
                                if(key->flag & PEK_SELECT)
                                        sel++;
                }
-               else if(scene->selectmode==SCE_SELECT_END) {
+               else if(pset->selectmode==SCE_SELECT_END) {
                        key += pa->totkey-1;
 
                        if(key->flag & PEK_SELECT)
@@ -1454,6 +1458,7 @@ int PE_lasso_select(bContext *C, short mcords[][2], short moves, short select)
        ParticleEdit *edit;
        ParticleData *pa;
        ParticleEditKey *key;
+       ParticleEditSettings *pset= PE_settings(scene);
        float co[3], mat[4][4];
        short vertco[2];
        int i, k, totpart;
@@ -1470,7 +1475,7 @@ int PE_lasso_select(bContext *C, short mcords[][2], short moves, short select)
 
                psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, mat);
 
-               if(scene->selectmode==SCE_SELECT_POINT) {
+               if(pset->selectmode==SCE_SELECT_POINT) {
                        LOOP_KEYS(k, key) {
                                VECCOPY(co, key->co);
                                Mat4MulVecfl(mat, co);
@@ -1487,7 +1492,7 @@ int PE_lasso_select(bContext *C, short mcords[][2], short moves, short select)
                                }
                        }
                }
-               else if(scene->selectmode==SCE_SELECT_END) {
+               else if(pset->selectmode==SCE_SELECT_END) {
                        key= edit->keys[i] + pa->totkey - 1;
 
                        VECCOPY(co, key->co);
@@ -2349,7 +2354,7 @@ enum { DEL_PARTICLE, DEL_KEY };
 static EnumPropertyItem delete_type_items[]= {
        {DEL_PARTICLE, "PARTICLE", 0, "Particle", ""},
        {DEL_KEY, "KEY", 0, "Key", ""},
-       {0, NULL, NULL}};
+       {0, NULL, 0, NULL, NULL}};
 
 static void set_delete_particle(PEData *data, int pa_index)
 {
@@ -3842,6 +3847,7 @@ void PE_change_act_psys(Scene *scene, Object *ob, ParticleSystem *psys)
 static int specials_menu_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
        Scene *scene= CTX_data_scene(C);
+       ParticleEditSettings *pset=PE_settings(scene);
        uiPopupMenu *pup;
        uiLayout *layout;
 
@@ -3849,7 +3855,7 @@ static int specials_menu_invoke(bContext *C, wmOperator *op, wmEvent *event)
        layout= uiPupMenuLayout(pup);
 
        uiItemO(layout, NULL, 0, "PARTICLE_OT_rekey");
-       if(scene->selectmode & SCE_SELECT_POINT) {
+       if(pset->selectmode & SCE_SELECT_POINT) {
                uiItemO(layout, NULL, 0, "PARTICLE_OT_subdivide");
                uiItemO(layout, NULL, 0, "PARTICLE_OT_select_first");
                uiItemO(layout, NULL, 0, "PARTICLE_OT_select_last");
index adf4772efdee1ba8a03eadf94d7dd92cd9c53106..9550c4c3a2969f9a5f3a58fb3885ec4f5139eac0 100644 (file)
@@ -802,11 +802,11 @@ void image_header_buttons(const bContext *C, ARegion *ar)
                        uiBlockBeginAlign(block);
                        
                        uiDefIconButBitS(block, TOG, SCE_SELECT_VERTEX, B_REDR, ICON_VERTEXSEL,
-                               xco,yco,XIC,YIC, &scene->selectmode, 1.0, 0.0, 0, 0, "Vertex select mode");
+                               xco,yco,XIC,YIC, &scene->toolsettings->selectmode, 1.0, 0.0, 0, 0, "Vertex select mode");
                        uiDefIconButBitS(block, TOG, SCE_SELECT_EDGE, B_REDR, ICON_EDGESEL,
-                               xco+=XIC,yco,XIC,YIC, &scene->selectmode, 1.0, 0.0, 0, 0, "Edge select mode");
+                               xco+=XIC,yco,XIC,YIC, &scene->toolsettings->selectmode, 1.0, 0.0, 0, 0, "Edge select mode");
                        uiDefIconButBitS(block, TOG, SCE_SELECT_FACE, B_REDR, ICON_FACESEL,
-                               xco+=XIC,yco,XIC,YIC, &scene->selectmode, 1.0, 0.0, 0, 0, "Face select mode");
+                               xco+=XIC,yco,XIC,YIC, &scene->toolsettings->selectmode, 1.0, 0.0, 0, 0, "Face select mode");
 
                        uiBlockEndAlign(block);
                }
@@ -837,14 +837,14 @@ void image_header_buttons(const bContext *C, ARegion *ar)
                /* snap options, identical to options in 3d view header */
                uiBlockBeginAlign(block);
 
-               if (scene->snap_flag & SCE_SNAP) {
-                       uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEO,xco,yco,XIC,YIC, &scene->snap_flag, 0, 0, 0, 0, "Use Snap or Grid (Shift Tab).");
+               if (scene->toolsettings->snap_flag & SCE_SNAP) {
+                       uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEO,xco,yco,XIC,YIC, &scene->toolsettings->snap_flag, 0, 0, 0, 0, "Use Snap or Grid (Shift Tab).");
                        xco+= XIC;
-                       uiDefButS(block, MENU, B_NOP, "Mode%t|Closest%x0|Center%x1|Median%x2",xco,yco,70,YIC, &scene->snap_target, 0, 0, 0, 0, "Snap Target Mode.");
+                       uiDefButS(block, MENU, B_NOP, "Mode%t|Closest%x0|Center%x1|Median%x2",xco,yco,70,YIC, &scene->toolsettings->snap_target, 0, 0, 0, 0, "Snap Target Mode.");
                        xco+= 70;
                }
                else {
-                       uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEAR,xco,yco,XIC,YIC, &scene->snap_flag, 0, 0, 0, 0, "Snap while Ctrl is held during transform (Shift Tab)."); 
+                       uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEAR,xco,yco,XIC,YIC, &scene->toolsettings->snap_flag, 0, 0, 0, 0, "Snap while Ctrl is held during transform (Shift Tab).");   
                        xco+= XIC;
                }
 
index cf9c12f3dff9278e4235cdb99b3ae43ebe8c3168..29f316716702e75513ae322f8dddf7d4d8b262eb 100644 (file)
@@ -567,12 +567,12 @@ void time_header_buttons(const bContext *C, ARegion *ar)
        
        uiBlockBeginAlign(block);
                uiDefIconButBitS(block, TOG, AUTOKEY_ON, B_REDRAWALL, ICON_REC,
-                                                xco, yco, XIC, YIC, &(scene->autokey_mode), 0, 0, 0, 0, "Automatic keyframe insertion for Objects and Bones");
+                                                xco, yco, XIC, YIC, &(scene->toolsettings->autokey_mode), 0, 0, 0, 0, "Automatic keyframe insertion for Objects and Bones");
                xco+= XIC;
                if (IS_AUTOKEY_ON(scene)) {
                        uiDefButS(block, MENU, B_REDRAWALL, 
                                          "Auto-Keying Mode %t|Add/Replace Keys%x3|Replace Keys %x5", 
-                                         xco, yco, (int)5.5*XIC, YIC, &(scene->autokey_mode), 0, 1, 0, 0, 
+                                         xco, yco, (int)5.5*XIC, YIC, &(scene->toolsettings->autokey_mode), 0, 1, 0, 0, 
                                          "Mode of automatic keyframe insertion for Objects and Bones");
                        xco+= (6*XIC);
                }
index 42da6775d5fc837d5e9e63e1737e439290ce17f9..ea9fb66dae0d33b3f88578d0015fb95ce99f1672 100644 (file)
        (vd->drawtype==OB_SOLID && vd->flag2 & V3D_SOLID_TEX))
 
 #define CHECK_OB_DRAWFACEDOT(sce, vd, dt) \
-(      (sce->selectmode & SCE_SELECT_FACE) && \
+(      (sce->toolsettings->selectmode & SCE_SELECT_FACE) && \
        (vd->drawtype<=OB_SOLID) && \
        (((vd->drawtype==OB_SOLID) && (dt>=OB_SOLID) && (vd->flag2 & V3D_SOLID_TEX) && (vd->flag & V3D_ZBUF_SELECT)) == 0) \
        )
@@ -1493,14 +1493,14 @@ void nurbs_foreachScreenVert(ViewContext *vc, void (*func)(void *userData, Nurb
 
 static void draw_dm_face_normals__mapFunc(void *userData, int index, float *cent, float *no)
 {
-       Scene *scene= (Scene *)userData;
+       ToolSettings *ts= ((Scene *)userData)->toolsettings;
        EditFace *efa = EM_get_face_for_index(index);
 
        if (efa->h==0 && efa->fgonf!=EM_FGON) {
                glVertex3fv(cent);
-               glVertex3f(     cent[0] + no[0]*scene->editbutsize,
-                                       cent[1] + no[1]*scene->editbutsize,
-                                       cent[2] + no[2]*scene->editbutsize);
+               glVertex3f(     cent[0] + no[0]*ts->normalsize,
+                                       cent[1] + no[1]*ts->normalsize,
+                                       cent[2] + no[2]*ts->normalsize);
        }
 }
 static void draw_dm_face_normals(Scene *scene, DerivedMesh *dm) 
@@ -1529,19 +1529,20 @@ static void draw_dm_face_centers(DerivedMesh *dm, int sel)
 static void draw_dm_vert_normals__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s)
 {
        Scene *scene= (Scene *)userData;
+       ToolSettings *ts= scene->toolsettings;
        EditVert *eve = EM_get_vert_for_index(index);
 
        if (eve->h==0) {
                glVertex3fv(co);
 
                if (no_f) {
-                       glVertex3f(     co[0] + no_f[0]*scene->editbutsize,
-                                               co[1] + no_f[1]*scene->editbutsize,
-                                               co[2] + no_f[2]*scene->editbutsize);
+                       glVertex3f(     co[0] + no_f[0]*ts->normalsize,
+                                               co[1] + no_f[1]*ts->normalsize,
+                                               co[2] + no_f[2]*ts->normalsize);
                } else {
-                       glVertex3f(     co[0] + no_s[0]*scene->editbutsize/32767.0f,
-                                               co[1] + no_s[1]*scene->editbutsize/32767.0f,
-                                               co[2] + no_s[2]*scene->editbutsize/32767.0f);
+                       glVertex3f(     co[0] + no_s[0]*ts->normalsize/32767.0f,
+                                               co[1] + no_s[1]*ts->normalsize/32767.0f,
+                                               co[2] + no_s[2]*ts->normalsize/32767.0f);
                }
        }
 }
@@ -1762,7 +1763,9 @@ static void draw_dm_bweights__mapFunc(void *userData, int index, float *co, floa
 }
 static void draw_dm_bweights(Scene *scene, DerivedMesh *dm)
 {
-       if (scene->selectmode & SCE_SELECT_VERTEX) {
+       ToolSettings *ts= scene->toolsettings;
+
+       if (ts->selectmode & SCE_SELECT_VERTEX) {
                glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE) + 2);
                bglBegin(GL_POINTS);
                dm->foreachMappedVert(dm, draw_dm_bweights__mapFunc, NULL);
@@ -1786,6 +1789,7 @@ static void draw_dm_bweights(Scene *scene, DerivedMesh *dm)
 
 static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit, EditMesh *em, DerivedMesh *cageDM, EditVert *eve_act)
 {
+       ToolSettings *ts= scene->toolsettings;
        int sel;
 
        if(v3d->zbuf) glDepthMask(0);           // disable write in zbuffer, zbuf select
@@ -1817,7 +1821,7 @@ static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit, EditM
                                col[3] = fcol[3] = 255;
                        }
                                
-                       if(scene->selectmode & SCE_SELECT_VERTEX) {
+                       if(ts->selectmode & SCE_SELECT_VERTEX) {
                                glPointSize(size);
                                glColor4ubv((GLubyte *)col);
                                draw_dm_verts(cageDM, sel, eve_act);
@@ -1842,6 +1846,7 @@ static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit, EditM
 
 static void draw_em_fancy_edges(Scene *scene, View3D *v3d, Mesh *me, DerivedMesh *cageDM, short sel_only, EditEdge *eed_act)
 {
+       ToolSettings *ts= scene->toolsettings;
        int pass;
        unsigned char wireCol[4], selCol[4], actCol[4];
 
@@ -1871,11 +1876,11 @@ static void draw_em_fancy_edges(Scene *scene, View3D *v3d, Mesh *me, DerivedMesh
                        if (!sel_only) wireCol[3] = 255;
                }
 
-               if(scene->selectmode == SCE_SELECT_FACE) {
+               if(ts->selectmode == SCE_SELECT_FACE) {
                        draw_dm_edges_sel(cageDM, wireCol, selCol, actCol, eed_act);
                }       
-               else if( (me->drawflag & ME_DRAWEDGES) || (scene->selectmode & SCE_SELECT_EDGE) ) {     
-                       if(cageDM->drawMappedEdgesInterp && (scene->selectmode & SCE_SELECT_VERTEX)) {
+               else if( (me->drawflag & ME_DRAWEDGES) || (ts->selectmode & SCE_SELECT_EDGE) ) {        
+                       if(cageDM->drawMappedEdgesInterp && (ts->selectmode & SCE_SELECT_VERTEX)) {
                                glShadeModel(GL_SMOOTH);
                                draw_dm_edges_sel_interp(cageDM, wireCol, selCol);
                                glShadeModel(GL_FLAT);
@@ -3561,6 +3566,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
 
 static void draw_particle_edit(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, ParticleSystem *psys, int dt)
 {
+       ToolSettings *ts= scene->toolsettings;
        ParticleEdit *edit = psys->edit;
        ParticleData *pa;
        ParticleCacheKey **path;
@@ -3664,13 +3670,13 @@ static void draw_particle_edit(Scene *scene, View3D *v3d, RegionView3D *rv3d, Ob
        }
 
        /* draw edit vertices */
-       if(scene->selectmode!=SCE_SELECT_PATH){
+       if(pset->selectmode!=SCE_SELECT_PATH){
                glDisableClientState(GL_NORMAL_ARRAY);
                glEnableClientState(GL_COLOR_ARRAY);
                glDisable(GL_LIGHTING);
                glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
 
-               if(scene->selectmode==SCE_SELECT_POINT){
+               if(pset->selectmode==SCE_SELECT_POINT){
                        float *cd=0,*cdata=0;
                        cd=cdata=MEM_callocN(edit->totkeys*(timed?4:3)*sizeof(float), "particle edit color data");
 
@@ -3709,7 +3715,7 @@ static void draw_particle_edit(Scene *scene, View3D *v3d, RegionView3D *rv3d, Ob
                                MEM_freeN(cdata);
                        cd=cdata=0;
                }
-               else if(scene->selectmode == SCE_SELECT_END){
+               else if(pset->selectmode == SCE_SELECT_END){
                        for(i=0, pa=psys->particles; i<totpart; i++, pa++){
                                if((pa->flag & PARS_HIDE)==0){
                                        key = edit->keys[i] + pa->totkey - 1;
@@ -3947,6 +3953,7 @@ static void draw_editnurb(Object *ob, Nurb *nurb, int sel)
 
 static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, Nurb *nurb, int dt)
 {
+       ToolSettings *ts= scene->toolsettings;
        Object *ob= base->object;
        Curve *cu = ob->data;
        Nurb *nu;
@@ -3978,7 +3985,7 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
 
        /*      direction vectors for 3d curve paths
                when at its lowest, dont render normals */
-       if(cu->flag & CU_3D && scene->editbutsize > 0.0015) {
+       if(cu->flag & CU_3D && ts->normalsize > 0.0015) {
                UI_ThemeColor(TH_WIRE);
                for (bl=cu->bev.first,nu=nurb; nu && bl; bl=bl->next,nu=nu->next) {
                        BevPoint *bevp= (BevPoint *)(bl+1);             
@@ -3986,7 +3993,7 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
                        int skip= nu->resolu/16;
                        
                        while (nr-->0) { /* accounts for empty bevel lists */
-                               float fac= bevp->radius * scene->editbutsize;
+                               float fac= bevp->radius * ts->normalsize;
                                float ox,oy,oz; // Offset perpendicular to the curve
                                float dx,dy,dz; // Delta along the curve
                                
@@ -5408,6 +5415,7 @@ static void bbs_mesh_solid(Scene *scene, View3D *v3d, Object *ob)
 
 void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob)
 {
+       ToolSettings *ts= scene->toolsettings;
 
        wmMultMatrix(ob->obmat);
 
@@ -5425,8 +5433,8 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
 
                        EM_init_index_arrays(em, 1, 1, 1);
 
-                       bbs_mesh_solid_EM(scene, v3d, ob, dm, scene->selectmode & SCE_SELECT_FACE);
-                       if(scene->selectmode & SCE_SELECT_FACE)
+                       bbs_mesh_solid_EM(scene, v3d, ob, dm, ts->selectmode & SCE_SELECT_FACE);
+                       if(ts->selectmode & SCE_SELECT_FACE)
                                em_solidoffs = 1+em->totface;
                        else
                                em_solidoffs= 1;
@@ -5438,7 +5446,7 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
                        em_wireoffs= em_solidoffs + em->totedge;
                        
                        // we draw verts if vert select mode or if in transform (for snap).
-                       if(scene->selectmode & SCE_SELECT_VERTEX || G.moving & G_TRANSFORM_EDIT) {
+                       if(ts->selectmode & SCE_SELECT_VERTEX || G.moving & G_TRANSFORM_EDIT) {
                                bbs_mesh_verts(dm, em_wireoffs);
                                em_vertoffs= em_wireoffs + em->totvert;
                        }
index b6e9e05b120a8323f021fa7b091766e44e4563a0..ca911876c891a8854efb26ea3996516fc0d5bb18 100644 (file)
@@ -1663,7 +1663,7 @@ static void view3d_panel_bonesketch_spaces(const bContext *C, Panel *pa)
 
        uiBlockEndAlign(block);
        
-       uiDefButBitS(block, TOG, SCE_SNAP_PEEL_OBJECT, B_NOP, "Peel Objects", 10, yco, 200, 20, &scene->snap_flag, 0, 0, 0, 0, "Peel whole objects as one");
+       uiDefButBitS(block, TOG, SCE_SNAP_PEEL_OBJECT, B_NOP, "Peel Objects", 10, yco, 200, 20, &scene->toolsettings->snap_flag, 0, 0, 0, 0, "Peel whole objects as one");
 }
 
 
index de0680c6cc13cc596eb96ea452210e0f5eca3945..13ebeb05a5b82f2b6212f517089b4d0188476316 100644 (file)
@@ -1812,6 +1812,7 @@ static void do_view3d_transformmenu(bContext *C, void *arg, int event)
 {
 #if 0
        Scene *scene= CTX_data_scene(C);
+       ToolSettings *ts= CTX_data_tool_settings(C);
        
        switch(event) {
        case 1:
@@ -1870,22 +1871,22 @@ static void do_view3d_transformmenu(bContext *C, void *arg, int event)
                Transform();
                break;
        case 15:
-               scene->snap_flag &= ~SCE_SNAP;
+               ts->snap_flag &= ~SCE_SNAP;
                break;
        case 16:
-               scene->snap_flag |= SCE_SNAP;
+               ts->snap_flag |= SCE_SNAP;
                break;
        case 17:
-               scene->snap_target = SCE_SNAP_TARGET_CLOSEST;
+               ts->snap_target = SCE_SNAP_TARGET_CLOSEST;
                break;
        case 18:
-               scene->snap_target = SCE_SNAP_TARGET_CENTER;
+               ts->snap_target = SCE_SNAP_TARGET_CENTER;
                break;
        case 19:
-               scene->snap_target = SCE_SNAP_TARGET_MEDIAN;
+               ts->snap_target = SCE_SNAP_TARGET_MEDIAN;
                break;
        case 20:
-               scene->snap_target = SCE_SNAP_TARGET_ACTIVE;
+               ts->snap_target = SCE_SNAP_TARGET_ACTIVE;
                break;
        case 21:
                alignmenu();
@@ -1896,7 +1897,7 @@ static void do_view3d_transformmenu(bContext *C, void *arg, int event)
 
 static uiBlock *view3d_transformmenu(bContext *C, ARegion *ar, void *arg_unused)
 {
-       Scene *scene= CTX_data_scene(C);
+       ToolSettings *ts= CTX_data_tool_settings(C);
        Object *obedit = CTX_data_edit_object(C);
        uiBlock *block;
        short yco = 20, menuwidth = 120;
@@ -1948,7 +1949,7 @@ static uiBlock *view3d_transformmenu(bContext *C, ARegion *ar, void *arg_unused)
        {
                uiDefBut(block, SEPR, 0, "",                    0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
        
-               if (scene->snap_flag & SCE_SNAP)
+               if (ts->snap_flag & SCE_SNAP)
                {
                        uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Grid",                   0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, "");
                        uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Snap",                     0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
@@ -1961,7 +1962,7 @@ static uiBlock *view3d_transformmenu(bContext *C, ARegion *ar, void *arg_unused)
                        
                uiDefBut(block, SEPR, 0, "",                    0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
 
-               switch(scene->snap_target)
+               switch(ts->snap_target)
                {
                        case SCE_SNAP_TARGET_CLOSEST:
                                uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Snap Closest",                             0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 17, "");
@@ -2650,34 +2651,34 @@ static uiBlock *view3d_edit_objectmenu(bContext *C, ARegion *ar, void *arg_unuse
 
 static void do_view3d_edit_propfalloffmenu(bContext *C, void *arg, int event)
 {
-       Scene *scene= CTX_data_scene(C);
+       ToolSettings *ts= CTX_data_tool_settings(C);
        
-       scene->prop_mode= event;
+       ts->prop_mode= event;
        
 }
 
 static uiBlock *view3d_edit_propfalloffmenu(bContext *C, ARegion *ar, void *arg_unused)
 {
-       Scene *scene= CTX_data_scene(C);
+       ToolSettings *ts= CTX_data_tool_settings(C);
        uiBlock *block;
        short yco = 20, menuwidth = 120;
 
        block= uiBeginBlock(C, ar, "view3d_edit_propfalloffmenu", UI_EMBOSSP);
        uiBlockSetButmFunc(block, do_view3d_edit_propfalloffmenu, NULL);
        
-       if (scene->prop_mode==PROP_SMOOTH) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Smooth|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SMOOTH, "");
+       if (ts->prop_mode==PROP_SMOOTH) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Smooth|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SMOOTH, "");
        else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Smooth|Shift O",    0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SMOOTH, "");
-       if (scene->prop_mode==PROP_SPHERE) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Sphere|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SPHERE, "");
+       if (ts->prop_mode==PROP_SPHERE) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Sphere|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SPHERE, "");
        else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Sphere|Shift O",    0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SPHERE, "");
-       if (scene->prop_mode==PROP_ROOT) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Root|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_ROOT, "");
+       if (ts->prop_mode==PROP_ROOT) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Root|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_ROOT, "");
        else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Root|Shift O",      0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_ROOT, "");
-       if (scene->prop_mode==PROP_SHARP) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Sharp|Shift O",  0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SHARP, "");
+       if (ts->prop_mode==PROP_SHARP) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Sharp|Shift O",     0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SHARP, "");
        else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Sharp|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SHARP, "");
-       if (scene->prop_mode==PROP_LIN) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Linear|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_LIN, "");
+       if (ts->prop_mode==PROP_LIN) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Linear|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_LIN, "");
        else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Linear|Shift O",    0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_LIN, "");
-       if (scene->prop_mode==PROP_RANDOM) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Random|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_RANDOM, "");
+       if (ts->prop_mode==PROP_RANDOM) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Random|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_RANDOM, "");
        else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Random|Shift O",    0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_RANDOM, "");
-       if (scene->prop_mode==PROP_CONST) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Constant|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_CONST, "");
+       if (ts->prop_mode==PROP_CONST) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Constant|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_CONST, "");
        else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Constant|Shift O",  0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_CONST, "");
                
        uiBlockSetDirection(block, UI_RIGHT);
@@ -2698,7 +2699,7 @@ void do_view3d_edit_mesh_verticesmenu(bContext *C, void *arg, int event)
                make_parent();
                break;
        case 1: /* remove doubles */
-               count= removedoublesflag(1, 0, scene->toolsettings->doublimit);
+               count= removedoublesflag(1, 0, ts->doublimit);
                notice("Removed: %d", count);
                if (count) { /* only undo and redraw if an action is taken */
                        DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
@@ -2768,18 +2769,18 @@ void do_view3d_edit_mesh_edgesmenu(bContext *C, void *arg, int event)
        switch(event) {
                 
        case 0: /* subdivide smooth */
-               esubdivideflag(1, 0.0, scene->toolsettings->editbutflag | B_SMOOTH,1,0);
+               esubdivideflag(1, 0.0, ts->editbutflag | B_SMOOTH,1,0);
                ED_undo_push(C, "Subdivide Smooth");
                break;
        case 1: /*subdivide fractal */
                randfac= 10;
                if(button(&randfac, 1, 100, "Rand fac:")==0) return;
                fac= -( (float)randfac )/100;
-               esubdivideflag(1, fac, scene->toolsettings->editbutflag,1,0);
+               esubdivideflag(1, fac, ts->editbutflag,1,0);
                ED_undo_push(C, "Subdivide Fractal");
                break;
        case 2: /* subdivide */
-               esubdivideflag(1, 0.0, scene->toolsettings->editbutflag,1,0);
+               esubdivideflag(1, 0.0, ts->editbutflag,1,0);
                ED_undo_push(C, "Subdivide");
                break;
        case 3: /* knife subdivide */
@@ -3142,6 +3143,7 @@ static uiBlock *view3d_edit_mesh_scriptsmenu(bContext *C, ARegion *ar, void *arg
 static void do_view3d_edit_meshmenu(bContext *C, void *arg, int event)
 {
 #if 0
+       ToolSettings *ts= CTX_data_tool_settings(C);
        Scene *scene= CTX_data_scene(C);
        ScrArea *sa= CTX_wm_area(C);
        View3D *v3d= sa->spacedata.first;
@@ -3185,12 +3187,12 @@ static void do_view3d_edit_meshmenu(bContext *C, void *arg, int event)
                Transform();
                break;
        case 12: /* proportional edit (toggle) */
-               if(scene->proportional) scene->proportional= 0;
-               else scene->proportional= 1;
+               if(ts->proportional) ts->proportional= 0;
+               else ts->proportional= 1;
                break;
        case 13: /* automerge edit (toggle) */
-               if(scene->automerge) scene->automerge= 0;
-               else scene->automerge= 1;
+               if(ts->automerge) ts->automerge= 0;
+               else ts->automerge= 1;
                break;
        case 15:
                uv_autocalc_tface();
@@ -3204,7 +3206,7 @@ static void do_view3d_edit_meshmenu(bContext *C, void *arg, int event)
 
 static uiBlock *view3d_edit_meshmenu(bContext *C, ARegion *ar, void *arg_unused)
 {
-       Scene *scene= CTX_data_scene(C);
+       ToolSettings *ts= CTX_data_tool_settings(C);
        Object *obedit = CTX_data_edit_object(C);
        uiBlock *block;
        short yco= 0, menuwidth=120;
@@ -3250,7 +3252,7 @@ static uiBlock *view3d_edit_meshmenu(bContext *C, ARegion *ar, void *arg_unused)
                
        
        
-       if(scene->proportional) {
+       if(ts->proportional) {
                uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Proportional Editing|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
        } else {
                uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Proportional Editing|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
@@ -3261,7 +3263,7 @@ static uiBlock *view3d_edit_meshmenu(bContext *C, ARegion *ar, void *arg_unused)
        
        /* PITA but we should let users know that automerge cant work with multires :/ */
        uiDefIconTextBut(block, BUTM, 1,
-                       scene->automerge ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT,
+                       ts->automerge ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT,
                        ((Mesh*)obedit->data)->mr ? "AutoMerge Editing (disabled by multires)" : "AutoMerge Editing",
                        0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, "");
        
@@ -3536,8 +3538,8 @@ static void do_view3d_edit_latticemenu(bContext *C, void *arg, int event)
                Transform();
                break;
        case 5: /* proportional edit (toggle) */
-               if(scene->proportional) scene->proportional= 0;
-               else scene->proportional= 1;
+               if(ts->proportional) ts->proportional= 0;
+               else ts->proportional= 1;
                break;
        case 7: /* delete keyframe */
                common_deletekey();
@@ -3548,7 +3550,7 @@ static void do_view3d_edit_latticemenu(bContext *C, void *arg, int event)
 
 static uiBlock *view3d_edit_latticemenu(bContext *C, ARegion *ar, void *arg_unused)
 {
-       Scene *scene= CTX_data_scene(C);
+       ToolSettings *ts= CTX_data_tool_settings(C);
        uiBlock *block;
        short yco= 0, menuwidth=120;
                
@@ -3574,7 +3576,7 @@ static uiBlock *view3d_edit_latticemenu(bContext *C, ARegion *ar, void *arg_unus
        
        uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
        
-       if(scene->proportional) {
+       if(ts->proportional) {
                uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Proportional Editing|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
        } else {
                uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Proportional Editing|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
@@ -4695,7 +4697,7 @@ static uiBlock *view3d_faceselmenu(bContext *C, ARegion *ar, void *arg_unused)
 
 static void view3d_select_particlemenu(bContext *C, uiLayout *layout, void *arg_unused)
 {
-       Scene *scene= CTX_data_scene(C);
+       ToolSettings *ts= CTX_data_tool_settings(C);
 
        uiItemO(layout, NULL, 0, "VIEW3D_OT_select_border");
 
@@ -4704,7 +4706,7 @@ static void view3d_select_particlemenu(bContext *C, uiLayout *layout, void *arg_
        uiItemO(layout, NULL, 0, "PARTICLE_OT_select_all_toggle");
        uiItemO(layout, NULL, 0, "PARTICLE_OT_select_linked");
 
-       if(scene->selectmode & SCE_SELECT_POINT) {
+       if(ts->particle.selectmode & SCE_SELECT_POINT) {
                uiItemO(layout, NULL, 0, "PARTICLE_OT_select_last"); // |W, 4
                uiItemO(layout, NULL, 0, "PARTICLE_OT_select_first"); // |W, 3
        }
@@ -4724,7 +4726,7 @@ static void view3d_particle_showhidemenu(bContext *C, uiLayout *layout, void *ar
 
 static void view3d_particlemenu(bContext *C, uiLayout *layout, void *arg_unused)
 {
-       Scene *scene= CTX_data_scene(C);
+       ToolSettings *ts= CTX_data_tool_settings(C);
 
        // XXX uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Particle Edit Properties|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
        // add_blockhandler(sa, VIEW3D_HANDLER_OBJECT, UI_PNL_UNSTOW);
@@ -4739,7 +4741,7 @@ static void view3d_particlemenu(bContext *C, uiLayout *layout, void *arg_unused)
 
        uiItemO(layout, NULL, 0, "PARTICLE_OT_remove_doubles"); // |W, 5
        uiItemO(layout, NULL, 0, "PARTICLE_OT_delete");
-       if(scene->selectmode & SCE_SELECT_POINT)
+       if(ts->particle.selectmode & SCE_SELECT_POINT)
                uiItemO(layout, NULL, 0, "PARTICLE_OT_subdivide"); // |W, 2
        uiItemO(layout, NULL, 0, "PARTICLE_OT_rekey"); // |W, 1
 
@@ -4873,6 +4875,7 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event)
 {
        wmWindow *win= CTX_wm_window(C);
        Scene *scene= CTX_data_scene(C);
+       ToolSettings *ts= CTX_data_tool_settings(C);
        ScrArea *sa= CTX_wm_area(C);
        View3D *v3d= sa->spacedata.first;
        Base *basact= CTX_data_active_base(C);
@@ -5007,7 +5010,7 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event)
                if(em) {
                        if(shift==0 || em->selectmode==0)
                                em->selectmode= SCE_SELECT_VERTEX;
-                       scene->selectmode= em->selectmode;
+                       ts->selectmode= em->selectmode;
                        EM_selectmode_set(em);
                        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
                        ED_undo_push(C, "Selectmode Set: Vertex");
@@ -5021,7 +5024,7 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event)
                                }
                                em->selectmode = SCE_SELECT_EDGE;
                        }
-                       scene->selectmode= em->selectmode;
+                       ts->selectmode= em->selectmode;
                        EM_selectmode_set(em);
                        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
                        ED_undo_push(C, "Selectmode Set: Edge");
@@ -5030,12 +5033,12 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event)
        case B_SEL_FACE:
                if(em) {
                        if( shift==0 || em->selectmode==0){
-                               if( ((scene->selectmode ^ SCE_SELECT_FACE) == SCE_SELECT_VERTEX) || ((scene->selectmode ^ SCE_SELECT_FACE) == SCE_SELECT_EDGE)){
-                                       if(ctrl) EM_convertsel(em, (scene->selectmode ^ SCE_SELECT_FACE),SCE_SELECT_FACE);
+                               if( ((ts->selectmode ^ SCE_SELECT_FACE) == SCE_SELECT_VERTEX) || ((ts->selectmode ^ SCE_SELECT_FACE) == SCE_SELECT_EDGE)){
+                                       if(ctrl) EM_convertsel(em, (ts->selectmode ^ SCE_SELECT_FACE),SCE_SELECT_FACE);
                                }
                                em->selectmode = SCE_SELECT_FACE;
                        }
-                       scene->selectmode= em->selectmode;
+                       ts->selectmode= em->selectmode;
                        EM_selectmode_set(em);
                        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
                        ED_undo_push(C, "Selectmode Set: Face");
@@ -5043,15 +5046,15 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event)
                break;  
 
        case B_SEL_PATH:
-               scene->selectmode= SCE_SELECT_PATH;
+               ts->particle.selectmode= SCE_SELECT_PATH;
                ED_undo_push(C, "Selectmode Set: Path");
                break;
        case B_SEL_POINT:
-               scene->selectmode = SCE_SELECT_POINT;
+               ts->particle.selectmode = SCE_SELECT_POINT;
                ED_undo_push(C, "Selectmode Set: Point");
                break;
        case B_SEL_END:
-               scene->selectmode = SCE_SELECT_END;
+               ts->particle.selectmode = SCE_SELECT_END;
                ED_undo_push(C, "Selectmode Set: End point");
                break;  
        
@@ -5280,6 +5283,7 @@ void view3d_header_buttons(const bContext *C, ARegion *ar)
        ScrArea *sa= CTX_wm_area(C);
        View3D *v3d= sa->spacedata.first;
        Scene *scene= CTX_data_scene(C);
+       ToolSettings *ts= CTX_data_tool_settings(C);
        Object *ob= OBACT;
        Object *obedit = CTX_data_edit_object(C);
        uiBlock *block;
@@ -5449,11 +5453,11 @@ void view3d_header_buttons(const bContext *C, ARegion *ar)
                if((obedit && (obedit->type == OB_MESH || obedit->type == OB_CURVE || obedit->type == OB_SURF || obedit->type == OB_LATTICE)) || G.f & G_PARTICLEEDIT) {
                
                        uiBlockBeginAlign(block);
-                       uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_PROP_OFF, "Proportional %t|Off %x0|On %x1|Connected %x2", xco,yco,XIC+10,YIC, &(scene->proportional), 0, 1.0, 0, 0, "Proportional Edit Falloff (Hotkeys: O, Alt O) ");
+                       uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_PROP_OFF, "Proportional %t|Off %x0|On %x1|Connected %x2", xco,yco,XIC+10,YIC, &(ts->proportional), 0, 1.0, 0, 0, "Proportional Edit Falloff (Hotkeys: O, Alt O) ");
                        xco+= XIC+10;
                
-                       if(scene->proportional) {
-                               uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_SMOOTHCURVE, propfalloff_pup(), xco,yco,XIC+10,YIC, &(scene->prop_mode), 0.0, 0.0, 0, 0, "Proportional Edit Falloff (Hotkey: Shift O) ");
+                       if(ts->proportional) {
+                               uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_SMOOTHCURVE, propfalloff_pup(), xco,yco,XIC+10,YIC, &(ts->prop_mode), 0.0, 0.0, 0, 0, "Proportional Edit Falloff (Hotkey: Shift O) ");
                                xco+= XIC+10;
                        }
                        uiBlockEndAlign(block);
@@ -5464,21 +5468,21 @@ void view3d_header_buttons(const bContext *C, ARegion *ar)
                if (BIF_snappingSupported(obedit)) {
                        uiBlockBeginAlign(block);
 
-                       if (scene->snap_flag & SCE_SNAP) {
-                               uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEO,xco,yco,XIC,YIC, &scene->snap_flag, 0, 0, 0, 0, "Snap while Ctrl is held during transform (Shift Tab)");
+                       if (ts->snap_flag & SCE_SNAP) {
+                               uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEO,xco,yco,XIC,YIC, &ts->snap_flag, 0, 0, 0, 0, "Snap while Ctrl is held during transform (Shift Tab)");
                                xco+= XIC;
-                               uiDefIconButBitS(block, TOG, SCE_SNAP_ROTATE, B_REDR, ICON_SNAP_NORMAL,xco,yco,XIC,YIC, &scene->snap_flag, 0, 0, 0, 0, "Align rotation with the snapping target");      
+                               uiDefIconButBitS(block, TOG, SCE_SNAP_ROTATE, B_REDR, ICON_SNAP_NORMAL,xco,yco,XIC,YIC, &ts->snap_flag, 0, 0, 0, 0, "Align rotation with the snapping target"); 
                                xco+= XIC;
-                               if (scene->snap_mode == SCE_SNAP_MODE_VOLUME) {
-                                       uiDefIconButBitS(block, TOG, SCE_SNAP_PEEL_OBJECT, B_REDR, ICON_SNAP_PEEL_OBJECT,xco,yco,XIC,YIC, &scene->snap_flag, 0, 0, 0, 0, "Consider objects as whole when finding volume center");       
+                               if (ts->snap_mode == SCE_SNAP_MODE_VOLUME) {
+                                       uiDefIconButBitS(block, TOG, SCE_SNAP_PEEL_OBJECT, B_REDR, ICON_SNAP_PEEL_OBJECT,xco,yco,XIC,YIC, &ts->snap_flag, 0, 0, 0, 0, "Consider objects as whole when finding volume center");  
                                        xco+= XIC;
                                }
-                               uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_SNAP_VERTEX, snapmode_pup(), xco,yco,XIC+10,YIC, &(scene->snap_mode), 0.0, 0.0, 0, 0, "Snapping mode");
+                               uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_SNAP_VERTEX, snapmode_pup(), xco,yco,XIC+10,YIC, &(ts->snap_mode), 0.0, 0.0, 0, 0, "Snapping mode");
                                xco+= XIC;
-                               uiDefButS(block, MENU, B_NOP, "Snap Mode%t|Closest%x0|Center%x1|Median%x2|Active%x3",xco,yco,70,YIC, &scene->snap_target, 0, 0, 0, 0, "Snap Target Mode");
+                               uiDefButS(block, MENU, B_NOP, "Snap Mode%t|Closest%x0|Center%x1|Median%x2|Active%x3",xco,yco,70,YIC, &ts->snap_target, 0, 0, 0, 0, "Snap Target Mode");
                                xco+= XIC+70;
                        } else {
-                               uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEAR,xco,yco,XIC,YIC, &scene->snap_flag, 0, 0, 0, 0, "Snap while Ctrl is held during transform (Shift Tab)");  
+                               uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEAR,xco,yco,XIC,YIC, &ts->snap_flag, 0, 0, 0, 0, "Snap while Ctrl is held during transform (Shift Tab)");     
                                xco+= XIC;
                        }
 
@@ -5509,11 +5513,11 @@ void view3d_header_buttons(const bContext *C, ARegion *ar)
                }
                else if(G.f & G_PARTICLEEDIT) {
                        uiBlockBeginAlign(block);
-                       uiDefIconButBitS(block, TOG, SCE_SELECT_PATH, B_SEL_PATH, ICON_EDGESEL, xco,yco,XIC,YIC, &scene->selectmode, 1.0, 0.0, 0, 0, "Path edit mode");
+                       uiDefIconButBitS(block, TOG, SCE_SELECT_PATH, B_SEL_PATH, ICON_EDGESEL, xco,yco,XIC,YIC, &ts->particle.selectmode, 1.0, 0.0, 0, 0, "Path edit mode");
                        xco+= XIC;
-                       uiDefIconButBitS(block, TOG, SCE_SELECT_POINT, B_SEL_POINT, ICON_VERTEXSEL, xco,yco,XIC,YIC, &scene->selectmode, 1.0, 0.0, 0, 0, "Point select mode");
+                       uiDefIconButBitS(block, TOG, SCE_SELECT_POINT, B_SEL_POINT, ICON_VERTEXSEL, xco,yco,XIC,YIC, &ts->particle.selectmode, 1.0, 0.0, 0, 0, "Point select mode");
                        xco+= XIC;
-                       uiDefIconButBitS(block, TOG, SCE_SELECT_END, B_SEL_END, ICON_FACESEL, xco,yco,XIC,YIC, &scene->selectmode, 1.0, 0.0, 0, 0, "Tip select mode");
+                       uiDefIconButBitS(block, TOG, SCE_SELECT_END, B_SEL_END, ICON_FACESEL, xco,yco,XIC,YIC, &ts->particle.selectmode, 1.0, 0.0, 0, 0, "Tip select mode");
                        xco+= XIC;
                        uiBlockEndAlign(block);
                        
index e0e8ac7c7a7de8ba3c02904536da44b0b652423f..a153f7952922e5bf0de5d43b90036a4514b814df 100644 (file)
@@ -438,6 +438,7 @@ static void do_lasso_select_mesh__doSelectFace(void *userData, EditFace *efa, in
 static void do_lasso_select_mesh(ViewContext *vc, short mcords[][2], short moves, short select)
 {
        struct { ViewContext vc; rcti *rect; short (*mcords)[2], moves, select, pass, done; } data;
+       ToolSettings *ts= vc->scene->toolsettings;
        rcti rect;
        int bbsel;
        
@@ -456,14 +457,14 @@ static void do_lasso_select_mesh(ViewContext *vc, short mcords[][2], short moves
 
        bbsel= EM_mask_init_backbuf_border(vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
        
-       if(vc->scene->selectmode & SCE_SELECT_VERTEX) {
+       if(ts->selectmode & SCE_SELECT_VERTEX) {
                if (bbsel) {
                        EM_backbuf_checkAndSelectVerts(vc->em, select);
                } else {
                        mesh_foreachScreenVert(vc, do_lasso_select_mesh__doSelectVert, &data, 1);
                }
        }
-       if(vc->scene->selectmode & SCE_SELECT_EDGE) {
+       if(ts->selectmode & SCE_SELECT_EDGE) {
                        /* Does both bbsel and non-bbsel versions (need screen cos for both) */
 
                data.pass = 0;
@@ -475,7 +476,7 @@ static void do_lasso_select_mesh(ViewContext *vc, short mcords[][2], short moves
                }
        }
        
-       if(vc->scene->selectmode & SCE_SELECT_FACE) {
+       if(ts->selectmode & SCE_SELECT_FACE) {
                if (bbsel) {
                        EM_backbuf_checkAndSelectFaces(vc->em, select);
                } else {
@@ -1277,6 +1278,7 @@ static void do_mesh_box_select__doSelectFace(void *userData, EditFace *efa, int
 static void do_mesh_box_select(ViewContext *vc, rcti *rect, int select)
 {
        struct { ViewContext vc; rcti *rect; short select, pass, done; } data;
+       ToolSettings *ts= vc->scene->toolsettings;
        int bbsel;
        
        data.vc= *vc;
@@ -1287,14 +1289,14 @@ static void do_mesh_box_select(ViewContext *vc, rcti *rect, int select)
 
        bbsel= EM_init_backbuf_border(vc, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
 
-       if(vc->scene->selectmode & SCE_SELECT_VERTEX) {
+       if(ts->selectmode & SCE_SELECT_VERTEX) {
                if (bbsel) {
                        EM_backbuf_checkAndSelectVerts(vc->em, select);
                } else {
                        mesh_foreachScreenVert(vc, do_mesh_box_select__doSelectVert, &data, 1);
                }
        }
-       if(vc->scene->selectmode & SCE_SELECT_EDGE) {
+       if(ts->selectmode & SCE_SELECT_EDGE) {
                        /* Does both bbsel and non-bbsel versions (need screen cos for both) */
 
                data.pass = 0;
@@ -1306,7 +1308,7 @@ static void do_mesh_box_select(ViewContext *vc, rcti *rect, int select)
                }
        }
        
-       if(vc->scene->selectmode & SCE_SELECT_FACE) {
+       if(ts->selectmode & SCE_SELECT_FACE) {
                if(bbsel) {
                        EM_backbuf_checkAndSelectFaces(vc->em, select);
                } else {
@@ -1639,6 +1641,7 @@ static void mesh_circle_doSelectFace(void *userData, EditFace *efa, int x, int y
 
 static void mesh_circle_select(ViewContext *vc, int selecting, short *mval, float rad)
 {
+       ToolSettings *ts= vc->scene->toolsettings;
        int bbsel;
        
        if(vc->obedit==NULL && (FACESEL_PAINT_TEST)) {
@@ -1666,7 +1669,7 @@ static void mesh_circle_select(ViewContext *vc, int selecting, short *mval, floa
                data.mval[1] = mval[1];
                data.radius = rad;
 
-               if(vc->scene->selectmode & SCE_SELECT_VERTEX) {
+               if(ts->selectmode & SCE_SELECT_VERTEX) {
                        if(bbsel) {
                                EM_backbuf_checkAndSelectVerts(vc->em, selecting==LEFTMOUSE);
                        } else {
@@ -1674,7 +1677,7 @@ static void mesh_circle_select(ViewContext *vc, int selecting, short *mval, floa
                        }
                }
 
-               if(vc->scene->selectmode & SCE_SELECT_EDGE) {
+               if(ts->selectmode & SCE_SELECT_EDGE) {
                        if (bbsel) {
                                EM_backbuf_checkAndSelectEdges(vc->em, selecting==LEFTMOUSE);
                        } else {
@@ -1682,7 +1685,7 @@ static void mesh_circle_select(ViewContext *vc, int selecting, short *mval, floa
                        }
                }
                
-               if(vc->scene->selectmode & SCE_SELECT_FACE) {
+               if(ts->selectmode & SCE_SELECT_FACE) {
                        if(bbsel) {
                                EM_backbuf_checkAndSelectFaces(vc->em, selecting==LEFTMOUSE);
                        } else {
index 674de81a9f50ad212861a0c3fa054ee5e72f337e..3311fb7d0fe88f55dcf33c55684f35426692762e 100644 (file)
@@ -1134,7 +1134,7 @@ void drawTransform(const struct bContext *C, struct ARegion *ar, void *arg)
 
 void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
 {
-       Scene *sce = CTX_data_scene(C);
+       ToolSettings *ts = CTX_data_tool_settings(C);
        int constraint_axis[3] = {0, 0, 0};
        int proportional = 0;
 
@@ -1195,8 +1195,8 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
        // XXX If modal, save settings back in scene
        if (t->flag & T_MODAL)
        {
-               sce->prop_mode = t->prop_mode;
-               sce->proportional = proportional;
+               ts->prop_mode = t->prop_mode;
+               ts->proportional = proportional;
 
                if(t->spacetype == SPACE_VIEW3D)
                {
@@ -2359,7 +2359,7 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) {
                }
                else if (t->flag & T_EDIT) {
                        
-                       if(t->around==V3D_LOCAL && (t->scene->selectmode & SCE_SELECT_FACE)) {
+                       if(t->around==V3D_LOCAL && (t->settings->selectmode & SCE_SELECT_FACE)) {
                                VECCOPY(center, td->center);
                        }
                        else {
@@ -2660,7 +2660,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
                }
                else {
                        /* !TODO! Make this if not rely on G */
-                       if(around==V3D_LOCAL && (t->scene->selectmode & SCE_SELECT_FACE)) {
+                       if(around==V3D_LOCAL && (t->settings->selectmode & SCE_SELECT_FACE)) {
                                center = td->center;
                        }
                }
@@ -3126,7 +3126,7 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) {
                sprintf(distvec, "%.4f", dist);
                
        if(t->flag & T_AUTOIK) {
-               short chainlen= t->scene->toolsettings->autoik_chainlen;
+               short chainlen= t->settings->autoik_chainlen;
                
                if(chainlen)
                        sprintf(autoik, "AutoIK-Len: %d", chainlen);
@@ -4251,7 +4251,7 @@ int Align(TransInfo *t, short mval[2])
                        VECCOPY(t->center, td->center);
                }
                else {
-                       if(t->scene->selectmode & SCE_SELECT_FACE) {
+                       if(t->settings->selectmode & SCE_SELECT_FACE) {
                                VECCOPY(t->center, td->center);
                        }
                }
index ee767fada5811457568ac8a909c6453fdf48f262..534f142734a240eaa9c20124ed8703eeda91fa1b 100644 (file)
@@ -257,6 +257,7 @@ typedef struct TransInfo {
        struct ScrArea  *sa;
        struct ARegion  *ar;
        struct Scene    *scene;
+       struct ToolSettings *settings;
        struct wmTimer *animtimer;
     short       mval[2];        /* current mouse position               */
     struct Object   *obedit;
index efe5122ad010a0ff25b32165430447b6ad4b442c..bb1f09ec44e956e7eee26013ee6c15a07b25b9b3 100644 (file)
@@ -777,7 +777,7 @@ static void pchan_autoik_adjust (bPoseChannel *pchan, short chainlen)
 /* change the chain-length of auto-ik */
 void transform_autoik_update (TransInfo *t, short mode)
 {
-       short *chainlen= &t->scene->toolsettings->autoik_chainlen;
+       short *chainlen= &t->settings->autoik_chainlen;
        bPoseChannel *pchan;
        
        /* mode determines what change to apply to chainlen */
@@ -1631,7 +1631,7 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
        int count = 0, hasselected = 0;
        int propmode = t->flag & T_PROP_EDIT;
 
-       if(psys==NULL || t->scene->selectmode==SCE_SELECT_PATH) return;
+       if(psys==NULL || t->settings->particle.selectmode==SCE_SELECT_PATH) return;
 
        psmd = psys_get_modifier(ob,psys);
 
@@ -2101,7 +2101,7 @@ void createTransBMeshVerts(TransInfo *t, BME_Mesh *bm, BME_TransData_Head *td) {
 
 static void createTransEditVerts(bContext *C, TransInfo *t)
 {
-       Scene *scene = CTX_data_scene(C);
+       ToolSettings *ts = CTX_data_tool_settings(C);
        TransData *tob = NULL;
        EditMesh *em = ((Mesh *)t->obedit->data)->edit_mesh;
        EditVert *eve;
@@ -2119,7 +2119,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
        }
 
        // transform now requires awareness for select mode, so we tag the f1 flags in verts
-       if(scene->selectmode & SCE_SELECT_VERTEX) {
+       if(ts->selectmode & SCE_SELECT_VERTEX) {
                for(eve= em->verts.first; eve; eve= eve->next) {
                        if(eve->h==0 && (eve->f & SELECT)) 
                                eve->f1= SELECT;
@@ -2127,7 +2127,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
                                eve->f1= 0;
                }
        }
-       else if(scene->selectmode & SCE_SELECT_EDGE) {
+       else if(ts->selectmode & SCE_SELECT_EDGE) {
                EditEdge *eed;
                for(eve= em->verts.first; eve; eve= eve->next) eve->f1= 0;
                for(eed= em->edges.first; eed; eed= eed->next) {
index 171665c9282b0d6235eed7f515b0456c630c57e3..f4cb5afc3c2d4919bedb473a61c148fffd7b396f 100644 (file)
@@ -665,6 +665,7 @@ void resetTransRestrictions(TransInfo *t)
 int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
 {
        Scene *sce = CTX_data_scene(C);
+       ToolSettings *ts = CTX_data_tool_settings(C);
        ARegion *ar = CTX_wm_region(C);
        ScrArea *sa = CTX_wm_area(C);
        Object *obedit = CTX_data_edit_object(C);
@@ -679,6 +680,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
        t->sa = sa;
        t->ar = ar;
        t->obedit = obedit;
+       t->settings = ts;
 
        t->data = NULL;
        t->ext = NULL;
@@ -774,7 +776,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
        // Need stuff to take it from edit mesh or whatnot here
        else
        {
-               if (t->obedit && t->obedit->type == OB_MESH && sce->toolsettings->editbutflag & B_MESH_X_MIRROR)
+               if (t->obedit && t->obedit->type == OB_MESH && ts->editbutflag & B_MESH_X_MIRROR)
                {
                        t->flag |= T_MIRROR;
                }
@@ -794,10 +796,10 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
        }
        else
        {
-               if ((t->options & CTX_NO_PET) == 0 && (sce->proportional)) {
+               if ((t->options & CTX_NO_PET) == 0 && (ts->proportional)) {
                        t->flag |= T_PROP_EDIT;
                        
-                       if(sce->proportional == 2)
+                       if(ts->proportional == 2)
                                t->flag |= T_PROP_CONNECTED;    // yes i know, has to become define
                }
        }
@@ -808,7 +810,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
        }
        else
        {
-               t->prop_size = sce->toolsettings->proportional_size;
+               t->prop_size = ts->proportional_size;
        }
        
        if (op && RNA_struct_find_property(op->ptr, "proportional_editing_falloff") && RNA_property_is_set(op->ptr, "proportional_editing_falloff"))
@@ -817,7 +819,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
        }
        else
        {
-               t->prop_mode = sce->prop_mode;
+               t->prop_mode = ts->prop_mode;
        }
 
        /* TRANSFORM_FIX_ME rna restrictions */
index 729011103884d83b7389eaa644e93707d11fe48e..0b9a176dbdf42e18efd09403538ff6a74b37ff0c 100644 (file)
@@ -210,7 +210,7 @@ int  handleSnapping(TransInfo *t, wmEvent *event)
        if (BIF_snappingSupported(t->obedit) && event->type == TABKEY && event->shift)
        {
                /* toggle snap and reinit */
-               t->scene->snap_flag ^= SCE_SNAP;
+               t->settings->snap_flag ^= SCE_SNAP;
                initSnapping(t, NULL);
                status = 1;
        }
@@ -282,10 +282,10 @@ int validSnappingNormal(TransInfo *t)
 
 void initSnapping(TransInfo *t, wmOperator *op)
 {
-       Scene *scene = t->scene;
+       ToolSettings *ts = t->settings;
        Object *obedit = t->obedit;
        int snapping = 0;
-       short snap_mode = t->scene->snap_target;
+       short snap_mode = t->settings->snap_target;
        
        resetSnapping(t);
        
@@ -310,8 +310,8 @@ void initSnapping(TransInfo *t, wmOperator *op)
        }
        else
        {
-               snapping = ((scene->snap_flag & SCE_SNAP) == SCE_SNAP);
-               t->tsnap.align = ((t->scene->snap_flag & SCE_SNAP_ROTATE) == SCE_SNAP_ROTATE);
+               snapping = ((ts->snap_flag & SCE_SNAP) == SCE_SNAP);
+               t->tsnap.align = ((t->settings->snap_flag & SCE_SNAP_ROTATE) == SCE_SNAP_ROTATE);
        }
        
        if ((t->spacetype == SPACE_VIEW3D || t->spacetype == SPACE_IMAGE) && // Only 3D view or UV
@@ -542,7 +542,7 @@ void CalcSnapGeometry(TransInfo *t, float *vec)
                int dist = SNAP_MIN_DISTANCE; // Use a user defined value here
                SnapMode mode;
                
-               if (t->scene->snap_mode == SCE_SNAP_MODE_VOLUME)
+               if (t->settings->snap_mode == SCE_SNAP_MODE_VOLUME)
                {
                        ListBase depth_peels;
                        DepthPeel *p1, *p2;
@@ -575,7 +575,7 @@ void CalcSnapGeometry(TransInfo *t, float *vec)
                                        p1->flag = 1;
                
                                        /* if peeling objects, take the first and last from each object */                      
-                                       if (t->scene->snap_flag & SCE_SNAP_PEEL_OBJECT)
+                                       if (t->settings->snap_flag & SCE_SNAP_PEEL_OBJECT)
                                        {
                                                DepthPeel *peel;
                                                for (peel = p1->next; peel; peel = peel->next)
@@ -1346,6 +1346,7 @@ int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh *dm, E
 
 int snapObject(Scene *scene, ARegion *ar, Object *ob, int editobject, float obmat[][4], float ray_start[3], float ray_normal[3], short mval[2], float *loc, float *no, int *dist, float *depth)
 {
+       ToolSettings *ts= scene->toolsettings;
        int retval = 0;
        
        if (ob->type == OB_MESH) {
@@ -1363,13 +1364,13 @@ int snapObject(Scene *scene, ARegion *ar, Object *ob, int editobject, float obma
                        dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
                }
                
-               retval = snapDerivedMesh(scene->snap_mode, ar, ob, dm, em, obmat, ray_start, ray_normal, mval, loc, no, dist, depth);
+               retval = snapDerivedMesh(ts->snap_mode, ar, ob, dm, em, obmat, ray_start, ray_normal, mval, loc, no, dist, depth);
 
                dm->release(dm);
        }
        else if (ob->type == OB_ARMATURE)
        {
-               retval = snapArmature(scene->snap_mode, ar, ob, ob->data, obmat, ray_start, ray_normal, mval, loc, no, dist, depth);
+               retval = snapArmature(ts->snap_mode, ar, ob, ob->data, obmat, ray_start, ray_normal, mval, loc, no, dist, depth);
        }
        
        return retval;
index aded5a4cff96f26a3d0df9349aed2a78a679c9df..b811906f5e5ca9f6c5ecdf74f0e71490f219c9b5 100644 (file)
@@ -102,17 +102,19 @@ static void drawcursor_sima(SpaceImage *sima, ARegion *ar)
 
 static int draw_uvs_face_check(Scene *scene)
 {
+       ToolSettings *ts= scene->toolsettings;
+
        /* checks if we are selecting only faces */
-       if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
-               if(scene->selectmode == SCE_SELECT_FACE)
+       if(ts->uv_flag & UV_SYNC_SELECTION) {
+               if(ts->selectmode == SCE_SELECT_FACE)
                        return 2;
-               else if(scene->selectmode & SCE_SELECT_FACE)
+               else if(ts->selectmode & SCE_SELECT_FACE)
                        return 1;
                else
                        return 0;
        }
        else
-               return (scene->toolsettings->uv_selectmode == UV_SELECT_FACE);
+               return (ts->uv_selectmode == UV_SELECT_FACE);
 }
 
 static void draw_uvs_shadow(SpaceImage *sima, Object *obedit)
@@ -418,7 +420,7 @@ static void draw_uvs_other(SpaceImage *sima, Scene *scene, Object *obedit, MTFac
 /* draws uv's in the image space */
 static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
 {
-       ToolSettings *settings;
+       ToolSettings *ts;
        Mesh *me= obedit->data;
        EditMesh *em;
        EditFace *efa, *efa_act;
@@ -432,13 +434,13 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
        em= BKE_mesh_get_editmesh(me);
        activetf= EM_get_active_mtface(em, &efa_act, NULL, 0); /* will be set to NULL if hidden */
 
-       settings= scene->toolsettings;
+       ts= scene->toolsettings;
 
        drawfaces= draw_uvs_face_check(scene);
-       if(settings->uv_flag & UV_SYNC_SELECTION)
-               interpedges= (scene->selectmode & SCE_SELECT_VERTEX);
+       if(ts->uv_flag & UV_SYNC_SELECTION)
+               interpedges= (ts->selectmode & SCE_SELECT_VERTEX);
        else
-               interpedges= (settings->uv_selectmode == UV_SELECT_VERTEX);
+               interpedges= (ts->uv_selectmode == UV_SELECT_VERTEX);
        
        /* draw other uvs */
        if(sima->flag & SI_DRAW_OTHER)
@@ -454,7 +456,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
 
                        /* when sync selection is enabled, all faces are drawn (except for hidden)
                         * so if cage is the same as the final, theres no point in drawing this */
-                       if(!((settings->uv_flag & UV_SYNC_SELECTION) && (cagedm == finaldm)))
+                       if(!((ts->uv_flag & UV_SYNC_SELECTION) && (cagedm == finaldm)))
                                draw_uvs_dm_shadow(finaldm);
                        
                        /* release derivedmesh again */
index 7dca4d34c485ea6fb7c431152eda3b435dd46ea0..7582145c63bafb74ef0b896ff801f299c0598dba 100644 (file)
@@ -191,7 +191,9 @@ static void uvedit_pixel_to_float(SpaceImage *sima, float *dist, float pixeldist
 
 int uvedit_face_visible_nolocal(Scene *scene, EditFace *efa)
 {
-       if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION)
+       ToolSettings *ts= scene->toolsettings;
+
+       if(ts->uv_flag & UV_SYNC_SELECTION)
                return (efa->h==0);
        else
                return (efa->h==0 && (efa->f & SELECT));
@@ -199,7 +201,9 @@ int uvedit_face_visible_nolocal(Scene *scene, EditFace *efa)
 
 int uvedit_face_visible(Scene *scene, Image *ima, EditFace *efa, MTFace *tf)
 {
-       if(scene->toolsettings->uv_flag & UV_SHOW_SAME_IMAGE)
+       ToolSettings *ts= scene->toolsettings;
+
+       if(ts->uv_flag & UV_SHOW_SAME_IMAGE)
                return (tf->tpage==ima)? uvedit_face_visible_nolocal(scene, efa): 0;
        else
                return uvedit_face_visible_nolocal(scene, efa);
@@ -207,7 +211,9 @@ int uvedit_face_visible(Scene *scene, Image *ima, EditFace *efa, MTFace *tf)
 
 int uvedit_face_selected(Scene *scene, EditFace *efa, MTFace *tf)
 {
-       if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION)
+       ToolSettings *ts= scene->toolsettings;
+
+       if(ts->uv_flag & UV_SYNC_SELECTION)
                return (efa->f & SELECT);
        else
                return (!(~tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3)) &&(!efa->v4 || tf->flag & TF_SEL4));
@@ -215,7 +221,9 @@ int uvedit_face_selected(Scene *scene, EditFace *efa, MTFace *tf)
 
 void uvedit_face_select(Scene *scene, EditFace *efa, MTFace *tf)
 {
-       if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION)
+       ToolSettings *ts= scene->toolsettings;
+
+       if(ts->uv_flag & UV_SYNC_SELECTION)
                EM_select_face(efa, 1);
        else
                tf->flag |= (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
@@ -223,7 +231,9 @@ void uvedit_face_select(Scene *scene, EditFace *efa, MTFace *tf)
 
 void uvedit_face_deselect(Scene *scene, EditFace *efa, MTFace *tf)
 {
-       if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION)
+       ToolSettings *ts= scene->toolsettings;
+
+       if(ts->uv_flag & UV_SYNC_SELECTION)
                EM_select_face(efa, 0);
        else
                tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
@@ -231,12 +241,13 @@ void uvedit_face_deselect(Scene *scene, EditFace *efa, MTFace *tf)
 
 int uvedit_edge_selected(Scene *scene, EditFace *efa, MTFace *tf, int i)
 {
+       ToolSettings *ts= scene->toolsettings;
        int nvert= (efa->v4)? 4: 3;
 
-       if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
-               if(scene->selectmode == SCE_SELECT_FACE)
+       if(ts->uv_flag & UV_SYNC_SELECTION) {
+               if(ts->selectmode == SCE_SELECT_FACE)
                        return (efa->f & SELECT);
-               else if(scene->selectmode == SCE_SELECT_EDGE)
+               else if(ts->selectmode == SCE_SELECT_EDGE)
                        return (*(&efa->e1 + i))->f & SELECT;
                else
                        return (((efa->v1 + i)->f & SELECT) && ((efa->v1 + (i+1)%nvert)->f & SELECT));
@@ -247,12 +258,13 @@ int uvedit_edge_selected(Scene *scene, EditFace *efa, MTFace *tf, int i)
 
 void uvedit_edge_select(Scene *scene, EditFace *efa, MTFace *tf, int i)
 {
+       ToolSettings *ts= scene->toolsettings;
        int nvert= (efa->v4)? 4: 3;
 
-       if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
-               if(scene->selectmode == SCE_SELECT_FACE)
+       if(ts->uv_flag & UV_SYNC_SELECTION) {
+               if(ts->selectmode == SCE_SELECT_FACE)
                        EM_select_face(efa, 1);
-               else if(scene->selectmode == SCE_SELECT_EDGE)
+               else if(ts->selectmode == SCE_SELECT_EDGE)
                        EM_select_edge((*(&efa->e1 + i)), 1);
                else {
                        (efa->v1 + i)->f |= SELECT;
@@ -265,12 +277,13 @@ void uvedit_edge_select(Scene *scene, EditFace *efa, MTFace *tf, int i)
 
 void uvedit_edge_deselect(Scene *scene, EditFace *efa, MTFace *tf, int i)
 {
+       ToolSettings *ts= scene->toolsettings;
        int nvert= (efa->v4)? 4: 3;
 
-       if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
-               if(scene->selectmode == SCE_SELECT_FACE)
+       if(ts->uv_flag & UV_SYNC_SELECTION) {
+               if(ts->selectmode == SCE_SELECT_FACE)
                        EM_select_face(efa, 0);
-               else if(scene->selectmode == SCE_SELECT_EDGE)
+               else if(ts->selectmode == SCE_SELECT_EDGE)
                        EM_select_edge((*(&efa->e1 + i)), 0);
                else {
                        (efa->v1 + i)->f &= ~SELECT;
@@ -283,8 +296,10 @@ void uvedit_edge_deselect(Scene *scene, EditFace *efa, MTFace *tf, int i)
 
 int uvedit_uv_selected(Scene *scene, EditFace *efa, MTFace *tf, int i)
 {
-       if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
-               if(scene->selectmode == SCE_SELECT_FACE)
+       ToolSettings *ts= scene->toolsettings;
+
+       if(ts->uv_flag & UV_SYNC_SELECTION) {
+               if(ts->selectmode == SCE_SELECT_FACE)
                        return (efa->f & SELECT);
                else
                        return (*(&efa->v1 + i))->f & SELECT;
@@ -295,8 +310,10 @@ int uvedit_uv_selected(Scene *scene, EditFace *efa, MTFace *tf, int i)
 
 void uvedit_uv_select(Scene *scene, EditFace *efa, MTFace *tf, int i)
 {
-       if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
-               if(scene->selectmode == SCE_SELECT_FACE)
+       ToolSettings *ts= scene->toolsettings;
+
+       if(ts->uv_flag & UV_SYNC_SELECTION) {
+               if(ts->selectmode == SCE_SELECT_FACE)
                        EM_select_face(efa, 1);
                else
                        (*(&efa->v1 + i))->f |= SELECT;
@@ -307,8 +324,10 @@ void uvedit_uv_select(Scene *scene, EditFace *efa, MTFace *tf, int i)
 
 void uvedit_uv_deselect(Scene *scene, EditFace *efa, MTFace *tf, int i)
 {
-       if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
-               if(scene->selectmode == SCE_SELECT_FACE)
+       ToolSettings *ts= scene->toolsettings;
+
+       if(ts->uv_flag & UV_SYNC_SELECTION) {
+               if(ts->selectmode == SCE_SELECT_FACE)
                        EM_select_face(efa, 0);
                else
                        (*(&efa->v1 + i))->f &= ~SELECT;
@@ -1289,6 +1308,7 @@ void UV_OT_stitch(wmOperatorType *ot)
 static int select_inverse_exec(bContext *C, wmOperator *op)
 {
        Scene *scene;
+       ToolSettings *ts;
        Object *obedit;
        EditMesh *em;
        EditFace *efa;
@@ -1296,11 +1316,12 @@ static int select_inverse_exec(bContext *C, wmOperator *op)
        MTFace *tf;
        
        scene= CTX_data_scene(C);
+       ts= CTX_data_tool_settings(C);
        obedit= CTX_data_edit_object(C);
        em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
        ima= CTX_data_edit_image(C);
 
-       if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
+       if(ts->uv_flag & UV_SYNC_SELECTION) {
                EM_select_swap(em);
        }
        else {
@@ -1339,6 +1360,7 @@ void UV_OT_select_invert(wmOperatorType *ot)
 static int de_select_all_exec(bContext *C, wmOperator *op)
 {
        Scene *scene;
+       ToolSettings *ts;
        Object *obedit;
        EditMesh *em;
        EditFace *efa;
@@ -1347,11 +1369,12 @@ static int de_select_all_exec(bContext *C, wmOperator *op)
        int sel;
        
        scene= CTX_data_scene(C);
+       ts= CTX_data_tool_settings(C);
        obedit= CTX_data_edit_object(C);
        em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
        ima= CTX_data_edit_image(C);
        
-       if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
+       if(ts->uv_flag & UV_SYNC_SELECTION) {
                EM_toggle_select_all(em);
        }
        else {
@@ -1431,6 +1454,7 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
 {
        SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C);
        Scene *scene= CTX_data_scene(C);
+       ToolSettings *ts= CTX_data_tool_settings(C);
        Object *obedit= CTX_data_edit_object(C);
        Image *ima= CTX_data_edit_image(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
@@ -1445,12 +1469,12 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
        uvedit_pixel_to_float(sima, penalty, 5.0f);
 
        /* retrieve operation mode */
-       if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
+       if(ts->uv_flag & UV_SYNC_SELECTION) {
                sync= 1;
 
-               if(scene->selectmode & SCE_SELECT_FACE)
+               if(ts->selectmode & SCE_SELECT_FACE)
                        selectmode= UV_SELECT_FACE;
-               else if(scene->selectmode & SCE_SELECT_EDGE)
+               else if(ts->selectmode & SCE_SELECT_EDGE)
                        selectmode= UV_SELECT_EDGE;
                else
                        selectmode= UV_SELECT_VERTEX;
@@ -1459,7 +1483,7 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
        }
        else {
                sync= 0;
-               selectmode= scene->toolsettings->uv_selectmode;
+               selectmode= ts->uv_selectmode;
                sticky= sima->sticky;
        }
 
@@ -1681,7 +1705,7 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
        
        if(sync) {
                /* flush for mesh selection */
-               if(scene->selectmode != SCE_SELECT_FACE) {
+               if(ts->selectmode != SCE_SELECT_FACE) {
                        if(flush==1)            EM_select_flush(em);
                        else if(flush==-1)      EM_deselect_flush(em);
                }
@@ -1794,13 +1818,14 @@ static int select_linked_exec(bContext *C, wmOperator *op)
 {
        SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C);
        Scene *scene= CTX_data_scene(C);
+       ToolSettings *ts= CTX_data_tool_settings(C);
        Object *obedit= CTX_data_edit_object(C);
        Image *ima= CTX_data_edit_image(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
        float limit[2];
        int extend;
 
-       if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
+       if(ts->uv_flag & UV_SYNC_SELECTION) {
                BKE_report(op->reports, RPT_ERROR, "Can't select linked when sync selection is enabled.");
                BKE_mesh_end_editmesh(obedit->data, em);
                return OPERATOR_CANCELLED;
@@ -1838,13 +1863,14 @@ void UV_OT_select_linked(wmOperatorType *ot)
 static int unlink_selection_exec(bContext *C, wmOperator *op)
 {
        Scene *scene= CTX_data_scene(C);
+       ToolSettings *ts= CTX_data_tool_settings(C);
        Object *obedit= CTX_data_edit_object(C);
        Image *ima= CTX_data_edit_image(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
        EditFace *efa;
        MTFace *tf;
 
-       if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
+       if(ts->uv_flag & UV_SYNC_SELECTION) {
                BKE_report(op->reports, RPT_ERROR, "Can't unlink selection when sync selection is enabled.");
                BKE_mesh_end_editmesh(obedit->data, em);
                return OPERATOR_CANCELLED;
@@ -1901,12 +1927,13 @@ static void uv_faces_do_sticky(bContext *C, SpaceImage *sima, Scene *scene, Obje
         * This only needs to be done when the Mesh is not used for
         * selection (so for sticky modes, vertex or location based). */
        
+       ToolSettings *ts= CTX_data_tool_settings(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
        EditFace *efa;
        MTFace *tf;
        int nverts, i;
        
-       if((scene->toolsettings->uv_flag & UV_SYNC_SELECTION)==0 && sima->sticky == SI_STICKY_VERTEX) {
+       if((ts->uv_flag & UV_SYNC_SELECTION)==0 && sima->sticky == SI_STICKY_VERTEX) {
                /* Tag all verts as untouched, then touch the ones that have a face center
                 * in the loop and select all MTFace UV's that use a touched vert. */
                EditVert *eve;
@@ -1937,7 +1964,7 @@ static void uv_faces_do_sticky(bContext *C, SpaceImage *sima, Scene *scene, Obje
                        }
                }
        }
-       else if((scene->toolsettings->uv_flag & UV_SYNC_SELECTION)==0 && sima->sticky == SI_STICKY_LOC) {
+       else if((ts->uv_flag & UV_SYNC_SELECTION)==0 && sima->sticky == SI_STICKY_LOC) {
                EditFace *efa_vlist;
                MTFace *tf_vlist;
                UvMapVert *start_vlist=NULL, *vlist_iter;
@@ -2008,7 +2035,7 @@ static void uv_faces_do_sticky(bContext *C, SpaceImage *sima, Scene *scene, Obje
                EM_free_uv_vert_map(vmap);
                
        }
-       else { /* SI_STICKY_DISABLE or scene->toolsettings->uv_flag & UV_SYNC_SELECTION */
+       else { /* SI_STICKY_DISABLE or ts->uv_flag & UV_SYNC_SELECTION */
                for(efa= em->faces.first; efa; efa= efa->next) {
                        if(efa->tmp.l) {
                                tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
@@ -2026,6 +2053,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
 {
        SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C);
        Scene *scene= CTX_data_scene(C);
+       ToolSettings *ts= CTX_data_tool_settings(C);
        Object *obedit= CTX_data_edit_object(C);
        Image *ima= CTX_data_edit_image(C);
        ARegion *ar= CTX_wm_region(C);
@@ -2049,10 +2077,10 @@ static int border_select_exec(bContext *C, wmOperator *op)
        select= (RNA_int_get(op->ptr, "event_type") == LEFTMOUSE); // XXX hardcoded
        pinned= RNA_boolean_get(op->ptr, "pinned");
        
-       if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION)
-               faces= (scene->selectmode == SCE_SELECT_FACE);
+       if(ts->uv_flag & UV_SYNC_SELECTION)
+               faces= (ts->selectmode == SCE_SELECT_FACE);
        else
-               faces= (scene->toolsettings->uv_selectmode == UV_SELECT_FACE);
+               faces= (ts->uv_selectmode == UV_SELECT_FACE);
 
        /* do actual selection */
        if(faces && !pinned) {
@@ -2084,7 +2112,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
                for(efa= em->faces.first; efa; efa= efa->next) {
                        tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
                        if(uvedit_face_visible(scene, ima, efa, tface)) {
-                               if(!pinned || (scene->toolsettings->uv_flag & UV_SYNC_SELECTION) ) {
+                               if(!pinned || (ts->uv_flag & UV_SYNC_SELECTION) ) {
                                        /* UV_SYNC_SELECTION - can't do pinned selection */
                                        if(BLI_in_rctf(&rectf, tface->uv[0][0], tface->uv[0][1])) {
                                                if(select)      uvedit_uv_select(scene, efa, tface, 0);
@@ -2133,8 +2161,8 @@ static int border_select_exec(bContext *C, wmOperator *op)
 
        if(change) {
                /* make sure newly selected vert selection is updated*/
-               if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
-                       if(scene->selectmode != SCE_SELECT_FACE) {
+               if(ts->uv_flag & UV_SYNC_SELECTION) {
+                       if(ts->selectmode != SCE_SELECT_FACE) {
                                if(select)      EM_select_flush(em);
                                else            EM_deselect_flush(em);
                        }
@@ -2668,14 +2696,14 @@ void UV_OT_select_pinned(wmOperatorType *ot)
 static int hide_exec(bContext *C, wmOperator *op)
 {
        SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C);
-       Scene *scene= CTX_data_scene(C);
+       ToolSettings *ts= CTX_data_tool_settings(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
        EditFace *efa;
        MTFace *tf;
        int swap= RNA_boolean_get(op->ptr, "unselected");
 
-       if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
+       if(ts->uv_flag & UV_SYNC_SELECTION) {
                EM_hide_mesh(em, swap);
                WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
 
@@ -2811,14 +2839,14 @@ void UV_OT_hide(wmOperatorType *ot)
 static int reveal_exec(bContext *C, wmOperator *op)
 {
        SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C);
-       Scene *scene= CTX_data_scene(C);
+       ToolSettings *ts= CTX_data_tool_settings(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
        EditFace *efa;
        MTFace *tf;
        
        /* call the mesh function if we are in mesh sync sel */
-       if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
+       if(ts->uv_flag & UV_SYNC_SELECTION) {
                EM_reveal_mesh(em);
                WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
 
index 4605d1f31e26dc74dc6b4ceafc595710785273e8..828721f0abb3bd261b1d71e37add066dd4cc52c4 100644 (file)
@@ -47,6 +47,7 @@ struct Group;
 struct Text;
 struct bNodeTree;
 struct AnimData;
+struct Editing;
 
 typedef struct Base {
        struct Base *next, *prev;
@@ -382,6 +383,8 @@ typedef struct ParticleEditSettings {
 
        float emitterdist;
        int draw_timed;
+
+       int selectmode, pad;
 } ParticleEditSettings;
 
 typedef struct TransformOrientation {
@@ -441,14 +444,19 @@ typedef struct ToolSettings {
        short editbutflag;
        /*Triangle to Quad conversion threshold*/
        float jointrilimit;
-       /* Extrude Tools */
+       /* Editmode Tools */
        float degr; 
        short step;
        short turn; 
        
-       float extr_offs; 
-       float doublimit;
-       
+       float extr_offs;        /* extrude offset */
+       float doublimit;        /* remove doubles limit */
+       float normalsize;       /* size of normals */
+       short automerge;
+
+       /* Selection Mode for Mesh */
+       short selectmode;
+
        /* Primitive Settings */
        /* UV Sphere */
        short segments;
@@ -484,8 +492,11 @@ typedef struct ToolSettings {
        /* Select Group Threshold */
        float select_thresh;
        
-       /* IPO-Editor */
+       /* Graph Editor */
        float clean_thresh;
+
+       /* Auto-Keying Mode */
+       short autokey_mode, pad2;       /* defines in DNA_userdef_types.h */
        
        /* Retopo */
        char retopo_mode;
@@ -512,7 +523,6 @@ typedef struct ToolSettings {
        char  skgen_postpro_passes;
        char  skgen_subdivisions[3];
        char  skgen_multi_level;
-       int   skgen_pad;
        
        /* Skeleton Sketching */
        struct Object *skgen_template;
@@ -526,7 +536,10 @@ typedef struct ToolSettings {
        
        /* Alt+RMB option */
        char edge_mode;
-       char pad3[2];
+
+       /* transform */
+       short snap_mode, snap_flag, snap_target;
+       short proportional, prop_mode;
 } ToolSettings;
 
 typedef struct bStats {
@@ -547,28 +560,22 @@ typedef struct Scene {
        struct Image *ima;
        
        ListBase base;
-       struct Base *basact;
+       struct Base *basact;            /* active base */
        struct Object *obedit;          /* name replaces old G.obedit */
        
-       float cursor[3];
+       float cursor[3];                        /* 3d cursor location */
        float twcent[3];                        /* center for transform widget */
        float twmin[3], twmax[3];       /* boundbox of selection for transform widget */
        unsigned int lay;
        
-       /* editmode stuff */
-       float editbutsize;                      /* size of normals */
-       short selectmode;                                               /* for mesh only! */
-       short proportional, prop_mode;
-       short automerge, pad5;
        
        short flag;                                                             /* various settings */
-       short autokey_mode;                                     /* mode for autokeying (defines in DNA_userdef_types.h) */
        
        short use_nodes;
        
        struct bNodeTree *nodetree;     
        
-       void *ed;                                                               /* sequence editor data is allocated here */
+       struct Editing *ed;                                                             /* sequence editor data is allocated here */
        
        struct GameFraming framing;
 
@@ -578,20 +585,20 @@ typedef struct Scene {
        /* migrate or replace? depends on some internal things... */
        /* no, is on the right place (ton) */
        struct RenderData r;
-       struct AudioData audio;         /* DEPRICATED 2.5 */
+       struct AudioData audio;         /* DEPRECATED 2.5 */
        
        ScriptLink scriptlink;
        
        ListBase markers;
        ListBase transform_spaces;
        
-       short jumpframe;
-       short snap_mode, snap_flag, snap_target;
        
        /* none of the dependancy graph  vars is mean to be saved */
        struct  DagForest *theDag;
        short dagisvalid, dagflags;
-       short pad4, recalc;                             /* recalc = counterpart of ob->recalc */
+       short recalc;                           /* recalc = counterpart of ob->recalc */
+
+       short jumpframe;
 
        /* frame step. */
        int frame_step;
@@ -791,27 +798,27 @@ typedef struct Scene {
 
 /* base->flag is in DNA_object_types.h */
 
-/* scene->snap_flag */
+/* toolsettings->snap_flag */
 #define SCE_SNAP                               1
 #define SCE_SNAP_ROTATE                        2
 #define SCE_SNAP_PEEL_OBJECT   4
-/* scene->snap_target */
+/* toolsettings->snap_target */
 #define SCE_SNAP_TARGET_CLOSEST        0
 #define SCE_SNAP_TARGET_CENTER 1
 #define SCE_SNAP_TARGET_MEDIAN 2
 #define SCE_SNAP_TARGET_ACTIVE 3
-/* scene->snap_mode */
+/* toolsettings->snap_mode */
 #define SCE_SNAP_MODE_VERTEX   0
 #define SCE_SNAP_MODE_EDGE             1
 #define SCE_SNAP_MODE_FACE             2
 #define SCE_SNAP_MODE_VOLUME   3
 
-/* sce->selectmode */
+/* toolsettings->selectmode */
 #define SCE_SELECT_VERTEX      1 /* for mesh */
 #define SCE_SELECT_EDGE                2
 #define SCE_SELECT_FACE                4
 
-/* sce->selectmode for particles */
+/* toolsettings->particle.selectmode for particles */
 #define SCE_SELECT_PATH                1
 #define SCE_SELECT_POINT       2
 #define SCE_SELECT_END         4
@@ -819,7 +826,7 @@ typedef struct Scene {
 /* sce->recalc (now in use by previewrender) */
 #define SCE_PRV_CHANGED                1
 
-/* sce->prop_mode (proportional falloff) */
+/* toolsettings->prop_mode (proportional falloff) */
 #define PROP_SMOOTH            0
 #define PROP_SPHERE            1
 #define PROP_ROOT              2
@@ -886,7 +893,7 @@ typedef enum SculptFlags {
 
 /* toolsettings->uv_selectmode */
 #define UV_SELECT_VERTEX       1
-#define UV_SELECT_EDGE         2 /* not implemented */
+#define UV_SELECT_EDGE         2
 #define UV_SELECT_FACE         4
 #define UV_SELECT_ISLAND       8
 
index 416acd7467e7ba19083c3d5b3d26d14c792725a9..9dc7e07a95c122a618ae4d9e1f131c8385938f7b 100644 (file)
@@ -229,7 +229,7 @@ typedef struct SpaceImage {
        char dt_uv; /* UV draw type */
        char sticky; /* sticky selection type */
        char dt_uvstretch;
-       char pad;
+       char around;
        
        float xof, yof;                                 /* user defined offset, image is centered */
        float zoom, pad4;                               /* user defined zoom level */
index 5d4916bb3c658276f78c4a79ed9181092bc82033..47c9025149ab84a7493e00ca23a9c08f88f04d32 100644 (file)
@@ -151,8 +151,34 @@ void rna_def_tool_settings(BlenderRNA  *brna)
        StructRNA *srna;
        PropertyRNA *prop;
 
+       static EnumPropertyItem uv_select_mode_items[] = {
+               {UV_SELECT_VERTEX, "VERTEX", ICON_VERTEXSEL, "Vertex", "Vertex selection mode."},
+               {UV_SELECT_EDGE, "EDGE", ICON_EDGESEL, "Edge", "Edge selection mode."},
+               {UV_SELECT_FACE, "FACE", ICON_FACESEL, "Face", "Face selection mode."},
+               {UV_SELECT_ISLAND, "ISLAND", ICON_LINKEDSEL, "Island", "Island selection mode."},
+               {0, NULL, 0, NULL, NULL}};
+
+       static EnumPropertyItem mesh_select_mode_items[] = {
+               {SCE_SELECT_VERTEX, "VERTEX", ICON_VERTEXSEL, "Vertex", "Vertex selection mode."},
+               {SCE_SELECT_EDGE, "EDGE", ICON_EDGESEL, "Edge", "Edge selection mode."},
+               {SCE_SELECT_FACE, "FACE", ICON_FACESEL, "Face", "Face selection mode."},
+               {0, NULL, 0, NULL, NULL}};
+
+       static EnumPropertyItem snap_element_items[] = {
+               {SCE_SNAP_MODE_VERTEX, "VERTEX", ICON_SNAP_VERTEX, "Vertex", "Snap to vertices."},
+               {SCE_SNAP_MODE_EDGE, "EDGE", ICON_SNAP_EDGE, "Edge", "Snap to edges."},
+               {SCE_SNAP_MODE_FACE, "FACE", ICON_SNAP_FACE, "Face", "Snap to faces."},
+               {SCE_SNAP_MODE_VOLUME, "VOLUME", ICON_SNAP_VOLUME, "Volume", "Snap to volume."},
+               {0, NULL, 0, NULL, NULL}};
+
+       static EnumPropertyItem snap_mode_items[] = {
+               {SCE_SNAP_TARGET_CLOSEST, "CLOSEST", 0, "Closest", "Snap closest point onto target."},
+               {SCE_SNAP_TARGET_CENTER, "CENTER", 0, "Center", "Snap center onto target."},
+               {SCE_SNAP_TARGET_MEDIAN, "MEDIAN", 0, "Median", "Snap median onto target."},
+               {SCE_SNAP_TARGET_ACTIVE, "ACTIVE", 0, "Active", "Snap active onto target."},
+               {0, NULL, 0, NULL, NULL}};
+
        srna= RNA_def_struct(brna, "ToolSettings", NULL);
-       RNA_def_struct_nested(brna, srna, "Scene");
        RNA_def_struct_ui_text(srna, "Tool Settings", "");
        
        prop= RNA_def_property(srna, "sculpt", PROP_POINTER, PROP_NONE);
@@ -163,6 +189,62 @@ void rna_def_tool_settings(BlenderRNA  *brna)
        RNA_def_property_struct_type(prop, "VPaint");
        RNA_def_property_ui_text(prop, "Vertex Paint", "");
 
+       /* Transform */
+       prop= RNA_def_property(srna, "proportional_editing", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "proportional", 0);
+       RNA_def_property_ui_text(prop, "Proportional Editing", "Proportional editing mode.");
+
+       prop= RNA_def_property(srna, "proportional_editing_falloff", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "prop_mode");
+       RNA_def_property_enum_items(prop, prop_mode_items);
+       RNA_def_property_ui_text(prop, "Proportional Editing Falloff", "Falloff type for proportional editing mode.");
+
+       prop= RNA_def_property(srna, "snap", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP);
+       RNA_def_property_ui_text(prop, "Snap", "Snap while Ctrl is held during transform.");
+       RNA_def_property_ui_icon(prop, ICON_SNAP_GEAR, 1);
+
+       prop= RNA_def_property(srna, "snap_align_rotation", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_ROTATE);
+       RNA_def_property_ui_text(prop, "Snap Align Rotation", "Align rotation with the snapping target.");
+       RNA_def_property_ui_icon(prop, ICON_SNAP_NORMAL, 0);
+
+       prop= RNA_def_property(srna, "snap_element", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "snap_mode");
+       RNA_def_property_enum_items(prop, snap_element_items);
+       RNA_def_property_ui_text(prop, "Snap Element", "Type of element to snap to.");
+
+       prop= RNA_def_property(srna, "snap_mode", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "snap_target");
+       RNA_def_property_enum_items(prop, snap_mode_items);
+       RNA_def_property_ui_text(prop, "Snap Mode", "Which part to snap onto the target.");
+
+       prop= RNA_def_property(srna, "snap_peel_object", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PEEL_OBJECT);
+       RNA_def_property_ui_text(prop, "Snap Peel Object", "Consider objects as whole when finding volume center.");
+       RNA_def_property_ui_icon(prop, ICON_SNAP_PEEL_OBJECT, 0);
+
+       /* UV */
+       prop= RNA_def_property(srna, "uv_selection_mode", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "uv_selectmode");
+       RNA_def_property_enum_items(prop, uv_select_mode_items);
+       RNA_def_property_ui_text(prop, "UV Selection Mode", "UV selection and display mode.");
+
+       prop= RNA_def_property(srna, "uv_sync_selection", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "uv_flag", UV_SYNC_SELECTION);
+       RNA_def_property_ui_text(prop, "UV Sync Selection", "Keep UV and edit mode mesh selection in sync.");
+       RNA_def_property_ui_icon(prop, ICON_EDIT, 0);
+
+       prop= RNA_def_property(srna, "uv_local_view", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "uv_flag", UV_SHOW_SAME_IMAGE);
+       RNA_def_property_ui_text(prop, "UV Local View", "Draw only faces with the currently displayed image assigned.");
+
+       /* Mesh */
+       prop= RNA_def_property(srna, "mesh_selection_mode", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_bitflag_sdna(prop, NULL, "selectmode");
+       RNA_def_property_enum_items(prop, mesh_select_mode_items);
+       RNA_def_property_ui_text(prop, "Mesh Selection Mode", "Mesh selection and display mode.");
+
        rna_def_sculpt(brna);
 }
 
@@ -839,10 +921,6 @@ void RNA_def_scene(BlenderRNA *brna)
 {
        StructRNA *srna;
        PropertyRNA *prop;
-       static EnumPropertyItem unwrapper_items[] = {
-               {0, "CONFORMAL", 0, "Conformal", ""},
-               {1, "ANGLEBASED", 0, "Angle Based", ""}, 
-               {0, NULL, 0, NULL, NULL}};
 
        srna= RNA_def_struct(brna, "Scene", "ID");
        RNA_def_struct_ui_text(srna, "Scene", "Scene consisting objects and defining time and render related settings.");
@@ -874,11 +952,6 @@ void RNA_def_scene(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Visible Layers", "Layers visible when rendering the scene.");
        RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_layer_set");
 
-       prop= RNA_def_property(srna, "proportional_editing_falloff", PROP_ENUM, PROP_NONE);
-       RNA_def_property_enum_sdna(prop, NULL, "prop_mode");
-       RNA_def_property_enum_items(prop, prop_mode_items);
-       RNA_def_property_ui_text(prop, "Proportional Editing Falloff", "Falloff type for proportional editing mode.");
-
        prop= RNA_def_property(srna, "current_frame", PROP_INT, PROP_NONE);
        RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE);
        RNA_def_property_int_sdna(prop, NULL, "r.cfra");
@@ -911,11 +984,6 @@ void RNA_def_scene(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Stamp Note", "User define note for the render stamping.");
        RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
-       prop= RNA_def_property(srna, "unwrapper", PROP_ENUM, PROP_NONE);
-       RNA_def_property_enum_sdna(prop, NULL, "toolsettings->unwrapper");
-       RNA_def_property_enum_items(prop, unwrapper_items);
-       RNA_def_property_ui_text(prop, "Unwrapper", "Unwrap algorithm used by the Unwrap tool.");
-       
        prop= RNA_def_property(srna, "nodetree", PROP_POINTER, PROP_NONE);
        RNA_def_property_ui_text(prop, "Node Tree", "Compositing node tree.");
        
index a1b51084fca71cf9cf1060efdd4b84b08c48c5a1..1bfc3b6f8f69abca1f7f676650bac197d50e2d36 100644 (file)
@@ -202,7 +202,7 @@ static PointerRNA rna_Operator_properties_get(PointerRNA *ptr)
 }
 
 
-static int rna_Event_ascii_get(PointerRNA *ptr, char *value)
+static void rna_Event_ascii_get(PointerRNA *ptr, char *value)
 {
        wmEvent *event= (wmEvent*)ptr->id.data;
        value[0]= event->ascii;