2.5: Various
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 9 Jul 2009 19:49:04 +0000 (19:49 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 9 Jul 2009 19:49:04 +0000 (19:49 +0000)
* Weight paint: brush strength was changed to both define weight
  and strength, this can't work, made them separate buttons.
* Allow adding particle system as modifier (fix crash).
* 3D view modal ops (zoom ..) could not be ended when invoked
  from a button.
* Fix some warnings.
* Fix spelling in particle RNA property.

source/blender/blenloader/intern/readfile.c
source/blender/editors/object/object_modifier.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/space_file/file_ops.c
source/blender/editors/space_file/file_panels.c
source/blender/editors/space_view3d/view3d_buttons.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/transform/transform_input.c
source/blender/makesrna/intern/rna_object_force.c
source/blender/makesrna/intern/rna_particle.c

index d816708f8a41c1a99a77c0c8fe732a51ab4e416a..c36a287b9811d6dc970e35a825a6fb3a7db2128d 100644 (file)
@@ -9009,14 +9009,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                //do_versions_ipos_to_animato(main);
                
                /* toolsettings */
-               for(scene= main->scene.first; scene; scene= scene->id.next) {
+               for(scene= main->scene.first; scene; scene= scene->id.next)
                        scene->r.audio = scene->audio;
-                       
-                       if(!scene->toolsettings->uv_selectmode) {
-                               scene->toolsettings->uv_selectmode= UV_SELECT_VERTEX;
-                               scene->toolsettings->vgroup_weight= 1.0f;
-                       }
-               }
                
                /* shader, composit and texture node trees have id.name empty, put something in
                 * to have them show in RNA viewer and accessible otherwise.
@@ -9152,10 +9146,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 
                for(sce = main->scene.first; sce; sce = sce->id.next) {
                        ts= sce->toolsettings;
-                       if(ts->normalsize == 0.0) {
+                       if(ts->normalsize == 0.0 || !ts->uv_selectmode || ts->vgroup_weight == 0.0) {
                                ts->normalsize= 0.1f;
                                ts->selectmode= SCE_SELECT_VERTEX;
                                ts->autokey_mode= U.autokey_mode;
+                               ts->uv_selectmode= UV_SELECT_VERTEX;
+                               ts->vgroup_weight= 1.0f;
                        }
                }
        }
index eb723dcca6c13450c1beab3b62b224a99b76b5b8..6b9f2db0d961fdde4594f7a4feb281512183d334 100644 (file)
@@ -83,33 +83,38 @@ int ED_object_modifier_add(ReportList *reports, Scene *scene, Object *ob, int ty
                }
        }
 
-       if(mti->flags&eModifierTypeFlag_RequiresOriginalData) {
-               md = ob->modifiers.first;
+       if(type == eModifierType_ParticleSystem) {
+               object_add_particle_system(scene, ob);
+       }
+       else {
+               if(mti->flags&eModifierTypeFlag_RequiresOriginalData) {
+                       md = ob->modifiers.first;
 
-               while(md && modifierType_getInfo(md->type)->type==eModifierTypeType_OnlyDeform)
-                       md = md->next;
+                       while(md && modifierType_getInfo(md->type)->type==eModifierTypeType_OnlyDeform)
+                               md = md->next;
 
-               BLI_insertlinkbefore(&ob->modifiers, md, modifier_new(type));
-       }
-       else
-               BLI_addtail(&ob->modifiers, modifier_new(type));
-       
-       /* special cases */
-       if(type == eModifierType_Softbody) {
-               if(!ob->soft) {
-                       ob->soft= sbNew(scene);
-                       ob->softflag |= OB_SB_GOAL|OB_SB_EDGES;
+                       BLI_insertlinkbefore(&ob->modifiers, md, modifier_new(type));
                }
-       }
-       else if(type == eModifierType_Collision) {
-               if(!ob->pd)
-                       ob->pd= object_add_collision_fields();
+               else
+                       BLI_addtail(&ob->modifiers, modifier_new(type));
+               
+               /* special cases */
+               if(type == eModifierType_Softbody) {
+                       if(!ob->soft) {
+                               ob->soft= sbNew(scene);
+                               ob->softflag |= OB_SB_GOAL|OB_SB_EDGES;
+                       }
+               }
+               else if(type == eModifierType_Collision) {
+                       if(!ob->pd)
+                               ob->pd= object_add_collision_fields();
 
-               ob->pd->deflect= 1;
-        DAG_scene_sort(scene);
+                       ob->pd->deflect= 1;
+                       DAG_scene_sort(scene);
+               }
+               else if(type == eModifierType_Surface)
+                       DAG_scene_sort(scene);
        }
-       else if(type == eModifierType_Surface)
-        DAG_scene_sort(scene);
 
        DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
 
index 0710079301b9e2710b100fc9acb1ac0e04bb2a31..74b5d5a4206fcd541a80006dd63ff9753cb245c7 100644 (file)
@@ -424,8 +424,9 @@ void clear_vpaint_selectedfaces(Scene *scene)
 /* fills in the selected faces with the current weight and vertex group */
 void clear_wpaint_selectedfaces(Scene *scene)
 {
-       VPaint *wp= scene->toolsettings->wpaint;
-       float paintweight= wp->brush->alpha;
+       ToolSettings *ts= scene->toolsettings;
+       VPaint *wp= ts->wpaint;
+       float paintweight= ts->vgroup_weight;
        Mesh *me;
        MFace *mface;
        Object *ob;
@@ -909,7 +910,7 @@ static void wpaint_blend(VPaint *wp, MDeformWeight *dw, MDeformWeight *uw, float
 void sample_wpaint(Scene *scene, ARegion *ar, View3D *v3d, int mode)
 {
        ViewContext vc;
-       VPaint *wp= scene->toolsettings->wpaint;
+       ToolSettings *ts= scene->toolsettings;
        Object *ob= OBACT;
        Mesh *me= get_mesh(ob);
        int index;
@@ -1019,20 +1020,20 @@ void sample_wpaint(Scene *scene, ARegion *ar, View3D *v3d, int mode)
                                fac= MIN4(w1, w2, w3, w4);
                                if(w1==fac) {
                                        dw= get_defweight(me->dvert+mface->v1, ob->actdef-1);
-                                       if(dw) wp->brush->alpha= dw->weight; else wp->brush->alpha= 0.0f;
+                                       if(dw) ts->vgroup_weight= dw->weight; else ts->vgroup_weight= 0.0f;
                                }
                                else if(w2==fac) {
                                        dw= get_defweight(me->dvert+mface->v2, ob->actdef-1);
-                                       if(dw) wp->brush->alpha= dw->weight; else wp->brush->alpha= 0.0f;
+                                       if(dw) ts->vgroup_weight= dw->weight; else ts->vgroup_weight= 0.0f;
                                }
                                else if(w3==fac) {
                                        dw= get_defweight(me->dvert+mface->v3, ob->actdef-1);
-                                       if(dw) wp->brush->alpha= dw->weight; else wp->brush->alpha= 0.0f;
+                                       if(dw) ts->vgroup_weight= dw->weight; else ts->vgroup_weight= 0.0f;
                                }
                                else if(w4==fac) {
                                        if(mface->v4) {
                                                dw= get_defweight(me->dvert+mface->v4, ob->actdef-1);
-                                               if(dw) wp->brush->alpha= dw->weight; else wp->brush->alpha= 0.0f;
+                                               if(dw) ts->vgroup_weight= dw->weight; else ts->vgroup_weight= 0.0f;
                                        }
                                }
                        }
@@ -1308,7 +1309,7 @@ static int wpaint_modal(bContext *C, wmOperator *op, wmEvent *event)
                        Object *ob= vc->obact;
                        Mesh *me= ob->data;
                        float mat[4][4];
-                       float paintweight= wp->brush->alpha;
+                       float paintweight= ts->vgroup_weight;
                        int *indexar= wpd->indexar;
                        int totindex, index, alpha, totw;
                        short mval[2];
@@ -1365,7 +1366,7 @@ static int wpaint_modal(bContext *C, wmOperator *op, wmEvent *event)
                        if(wp->mode==VP_BLUR) 
                                paintweight= 0.0f;
                        else
-                               paintweight= wp->brush->alpha;
+                               paintweight= ts->vgroup_weight;
                        
                        for(index=0; index<totindex; index++) {
                                if(indexar[index] && indexar[index]<=me->totface) {
index 9f703a9802b2063f14ddcb8fb45df04d44790a55..c4435e85749d023efc23aa65de3e6920c3ca4903 100644 (file)
@@ -770,4 +770,5 @@ void FILE_OT_filenum(struct wmOperatorType *ot)
 
        /* props */
        RNA_def_int(ot->srna, "increment", 1, 0, 100, "Increment", "", 0,100);
-}
\ No newline at end of file
+}
+
index 72a4133fe750f6b3dc7dba6273644610775cf6aa..96366b9f82b4b6d5ca06375ff9013a5b87cecc89 100644 (file)
@@ -160,4 +160,5 @@ void file_panels_register(ARegionType *art)
        strcpy(pt->label, "Operator");
        pt->draw= file_panel_operator;
        BLI_addtail(&art->paneltypes, pt);
-}
\ No newline at end of file
+}
+
index cf197f1d40525c55cc2e54752a3bb2a90253b735..7db577bf139061f7316068323ad3108bc8026dd2 100644 (file)
@@ -1107,6 +1107,7 @@ static int view3d_panel_brush_poll(const bContext *C, PanelType *pt)
 static void view3d_panel_brush(const bContext *C, Panel *pa)
 {
        uiBlock *block;
+       ToolSettings *ts= CTX_data_tool_settings(C);
        Brush **brp = current_brush_source(CTX_data_scene(C)), *br;
        short w = 268, h = 400, cx = 10, cy = h;
        rctf rect;
@@ -1143,6 +1144,10 @@ static void view3d_panel_brush(const bContext *C, Panel *pa)
        uiBlockBeginAlign(block);
        uiDefButI(block,NUMSLI,B_NOP,"Size: ",cx,cy,w,19,&br->size,1.0,200.0,0,0,"Set brush radius in pixels");
        cy-= 20;
+       if(G.f & G_WEIGHTPAINT) {
+               uiDefButF(block,NUMSLI,B_NOP,"Weight: ",cx,cy,w,19,&ts->vgroup_weight,0,1.0,0,0,"Set vertex weight");
+               cy-= 20;
+       }
        uiDefButF(block,NUMSLI,B_NOP,"Strength: ",cx,cy,w,19,&br->alpha,0,1.0,0,0,"Set brush strength");
        cy-= 25;
        uiBlockEndAlign(block);
index bd89bd519f30c465ac935eaf62c2503332542b66..5e77c932a6ca87240d01a253f3c2d411d0a2156d 100644 (file)
@@ -503,7 +503,8 @@ static int viewrotate_modal(bContext *C, wmOperator *op, wmEvent *event)
                        break;
 
                default:
-                       if(event->type==vod->origkey && event->val==0) {
+                       /* origkey may be zero when invoked from a button */
+                       if(ELEM3(event->type, ESCKEY, LEFTMOUSE, RIGHTMOUSE) || (event->type==vod->origkey && event->val==0)) {
                                request_depth_update(CTX_wm_region_view3d(C));
 
                                MEM_freeN(vod);
@@ -603,7 +604,8 @@ static int viewmove_modal(bContext *C, wmOperator *op, wmEvent *event)
                        break;
 
                default:
-                       if(event->type==vod->origkey && event->val==0) {
+                       /* origkey may be zero when invoked from a button */
+                       if(ELEM3(event->type, ESCKEY, LEFTMOUSE, RIGHTMOUSE) || (event->type==vod->origkey && event->val==0)) {
                                request_depth_update(CTX_wm_region_view3d(C));
 
                                MEM_freeN(vod);
@@ -763,7 +765,8 @@ static int viewzoom_modal(bContext *C, wmOperator *op, wmEvent *event)
                        break;
 
                default:
-                       if(event->type==vod->origkey && event->val==0) {
+                       /* origkey may be zero when invoked from a button */
+                       if(ELEM3(event->type, ESCKEY, LEFTMOUSE, RIGHTMOUSE) || (event->type==vod->origkey && event->val==0)) {
                                request_depth_update(CTX_wm_region_view3d(C));
 
                                MEM_freeN(vod);
index 678d581b2b4d27aa6963eeed9facbccc832030cd..ae8aacb3477cf731b69dc5bd49396e1aa272d733 100644 (file)
@@ -270,7 +270,7 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
                break;
        case INPUT_TRACKBALL:
                /* factor has to become setting or so */
-               mi->factor = 0.02f;
+               mi->factor = 0.01f;
                mi->apply = InputTrackBall;
                t->helpline = HLP_TRACKBALL;
                break;
index 45a9dc448750d0dbdffbdf5025956f9e54e95473..269437a8fae01dc0927f26ce26f3bb5d2b148c97 100644 (file)
@@ -107,7 +107,7 @@ static void rna_Cache_idname_change(bContext *C, PointerRNA *ptr)
 {
        Object *ob = CTX_data_active_object(C);
        PointCache *cache = (PointCache*)ptr->data;
-       PTCacheID *pid = NULL, *pid2;
+       PTCacheID *pid = NULL, *pid2= NULL;
        ListBase pidlist;
        int new_name = 1;
        char name[80];
index 5c94c81da1f2518784cc4b9355a7de82d6a597fa..bb19b66b34d14889a3319c9777df6db7070c17ac 100644 (file)
@@ -1249,7 +1249,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
        RNA_def_property_float_sdna(prop, NULL, "acc");
        RNA_def_property_array(prop, 3);
        RNA_def_property_range(prop, -200.0f, 200.0f);
-       RNA_def_property_ui_text(prop, "Accelaration", "Constant acceleration");
+       RNA_def_property_ui_text(prop, "Acceleration", "Constant acceleration");
        RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
 
        prop= RNA_def_property(srna, "drag_factor", PROP_FLOAT, PROP_NONE);