diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-04-20 19:06:46 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-04-20 19:06:46 +0400 |
commit | 874c29cea8e6f9bc411fccf2d6f4cb07e94328d0 (patch) | |
tree | 5971e577cf7c02e05a1e37b5ad058c71a6744877 /source/blender/editors | |
parent | 7555bfa793a2b0fc187c6211c56986f35b2d7b09 (diff) | |
parent | c5bc4e4fb1a33eda8c31f2ea02e91f32f74c8fa5 (diff) |
2.50: svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r19323:HEAD
Notes:
* blenderbuttons and ICON_SNAP_PEEL_OBJECT were not merged.
Diffstat (limited to 'source/blender/editors')
29 files changed, 352 insertions, 334 deletions
diff --git a/source/blender/editors/armature/BIF_generate.h b/source/blender/editors/armature/BIF_generate.h index bc655a4cdff..bde079c45fb 100644 --- a/source/blender/editors/armature/BIF_generate.h +++ b/source/blender/editors/armature/BIF_generate.h @@ -1,5 +1,5 @@ /** - * $Id: $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/armature/BIF_retarget.h b/source/blender/editors/armature/BIF_retarget.h index 049ddf5baa5..c39f410424a 100644 --- a/source/blender/editors/armature/BIF_retarget.h +++ b/source/blender/editors/armature/BIF_retarget.h @@ -1,5 +1,5 @@ /** - * $Id: $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/armature/editarmature_generate.c b/source/blender/editors/armature/editarmature_generate.c index a1990814a02..6d271375c64 100644 --- a/source/blender/editors/armature/editarmature_generate.c +++ b/source/blender/editors/armature/editarmature_generate.c @@ -1,5 +1,5 @@ /** - * $Id: editarmature_generate.c $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -53,14 +53,14 @@ void setBoneRollFromNormal(EditBone *bone, float *no, float invmat[][4], float t { if (no != NULL && !VecIsNull(no)) { - float tangent[3], cotangent[3], normal[3]; + float tangent[3], vec[3], normal[3]; VECCOPY(normal, no); Mat3MulVecfl(tmat, normal); VecSubf(tangent, bone->tail, bone->head); - Crossf(cotangent, tangent, normal); - Crossf(normal, cotangent, tangent); + Projf(vec, tangent, normal); + VecSubf(normal, normal, vec); Normalize(normal); diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c index 4da7eaf9440..68e8b45e7d2 100644 --- a/source/blender/editors/armature/editarmature_retarget.c +++ b/source/blender/editors/armature/editarmature_retarget.c @@ -206,12 +206,12 @@ float rollBoneByQuatAligned(EditBone *bone, float old_up_axis[3], float qrot[4], } } -float rollBoneByQuatJoint(RigEdge *edge, RigEdge *previous, float qrot[4], float qroll[4]) +float rollBoneByQuatJoint(RigEdge *edge, RigEdge *previous, float qrot[4], float qroll[4], float up_axis[3]) { if (previous == NULL) { - QuatOne(qroll); - return rollBoneByQuat(edge->bone, edge->up_axis, qrot); + /* default to up_axis if no previous */ + return rollBoneByQuatAligned(edge->bone, edge->up_axis, qrot, qroll, up_axis); } else { @@ -228,9 +228,8 @@ float rollBoneByQuatJoint(RigEdge *edge, RigEdge *previous, float qrot[4], float } else { - /* SHOULDN'T BE HERE */ - QuatOne(qroll); - return rollBoneByQuat(edge->bone, edge->up_axis, qrot); + /* default to up_axis if first bone in the chain is an offset */ + return rollBoneByQuatAligned(edge->bone, edge->up_axis, qrot, qroll, up_axis); } VecSubf(vec_second, edge->bone->tail, edge->bone->head); @@ -1859,7 +1858,7 @@ static void repositionBone(bContext *C, RigGraph *rigg, RigEdge *edge, float vec } else if (scene->toolsettings->skgen_retarget_roll == SK_RETARGET_ROLL_JOINT) { - bone->roll = rollBoneByQuatJoint(edge, edge->next, qrot, qroll); + bone->roll = rollBoneByQuatJoint(edge, edge->prev, qrot, qroll, up_axis); } else { diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index 5d0b954046c..45605ad472d 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -1,5 +1,5 @@ /** - * $Id: $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -293,7 +293,7 @@ char *BIF_listTemplates(bContext *C) while (!BLI_ghashIterator_isDone(&ghi)) { Object *ob = BLI_ghashIterator_getValue(&ghi); - int key = (int)BLI_ghashIterator_getKey(&ghi); + int key = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&ghi)); p += sprintf(p, "|%s%%x%i", ob->id.name+2, key); @@ -314,7 +314,7 @@ int BIF_currentTemplate(bContext *C) while (!BLI_ghashIterator_isDone(&ghi)) { Object *ob = BLI_ghashIterator_getValue(&ghi); - int key = (int)BLI_ghashIterator_getKey(&ghi); + int key = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&ghi)); if (ob == scene->toolsettings->skgen_template) { @@ -1035,7 +1035,22 @@ void sk_drawStroke(SK_Stroke *stk, int id, float color[3], int start, int end) } glEnd(); - + +#if 0 + glColor3f(0, 0, 1); + glBegin(GL_LINES); + + for (i = 0; i < stk->nb_points; i++) + { + float *p = stk->points[i].p; + float *no = stk->points[i].no; + glVertex3fv(p); + glVertex3f(p[0] + no[0], p[1] + no[1], p[2] + no[2]); + } + + glEnd(); +#endif + glColor3f(0, 0, 0); glBegin(GL_POINTS); @@ -1998,7 +2013,7 @@ void sk_convertStroke(bContext *C, SK_Stroke *stk) Mat4MulVecfl(invmat, bone->head); Mat4MulVecfl(invmat, bone->tail); - setBoneRollFromNormal(bone, pt->no, invmat, tmat); + setBoneRollFromNormal(bone, head->no, invmat, tmat); } new_parent = bone; diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 09edc5549c1..3d8d446c579 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -1237,7 +1237,6 @@ static short pose_select_same_layer (Object *ob) return changed; } - void pose_select_grouped (Scene *scene, short nr) { short changed = 0; @@ -1669,9 +1668,7 @@ void pose_special_editmenu(Scene *scene) pose_clear_paths(ob); } else if(nr==5) { - rest_pose(ob->pose); - DAG_object_flush_update(scene, ob, OB_RECALC_DATA); - BIF_undo_push("Clear User Transform Pose"); + pose_clear_user_transforms(scene, ob); } else if(nr==6) { pose_relax(); @@ -1682,3 +1679,29 @@ void pose_special_editmenu(Scene *scene) #endif } +/* Restore selected pose-bones to 'action'-defined pose */ +void pose_clear_user_transforms(Scene *scene, Object *ob) +{ + bArmature *arm= ob->data; + bPoseChannel *pchan; + + if (ob->pose == NULL) + return; + + /* find selected bones */ + for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { + if (pchan->bone && (pchan->bone->flag & BONE_SELECTED) && (pchan->bone->layer & arm->layer)) { + /* just clear the BONE_UNKEYED flag, allowing this bone to get overwritten by actions again */ + pchan->bone->flag &= ~BONE_UNKEYED; + } + } + + /* clear pose locking flag + * - this will only clear the user-defined pose in the selected bones, where BONE_UNKEYED has been cleared + */ + ob->pose->flag |= POSE_DO_UNLOCK; + + DAG_object_flush_update(scene, ob, OB_RECALC_DATA); + BIF_undo_push("Clear User Transform"); +} + diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 8c9a282d4ef..72806a79c50 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -652,7 +652,7 @@ static int deleteflagNurb(bContext *C, wmOperator *op, int flag) nu->bp= newbp; clamp_nurb_order_v(nu); - makeknots(nu, 2, nu->flagv>>1); + makeknots(nu, 2); } else { /* is the nurb in V direction selected */ @@ -698,7 +698,7 @@ static int deleteflagNurb(bContext *C, wmOperator *op, int flag) nu->pntsu= newu; clamp_nurb_order_u(nu); } - makeknots(nu, 1, nu->flagu>>1); + makeknots(nu, 1); } } } @@ -746,7 +746,7 @@ static short extrudeflagNurb(ListBase *editnurb, int flag) nu->pntsv= 2; nu->orderv= 2; - makeknots(nu, 2, nu->flagv>>1); + makeknots(nu, 2); } } else { @@ -789,7 +789,7 @@ static short extrudeflagNurb(ListBase *editnurb, int flag) MEM_freeN(nu->bp); nu->bp= newbp; nu->pntsv++; - makeknots(nu, 2, nu->flagv>>1); + makeknots(nu, 2); } else if(v==0 || v== nu->pntsu-1) { /* collumn in v-direction selected */ ok= 1; @@ -816,7 +816,7 @@ static short extrudeflagNurb(ListBase *editnurb, int flag) MEM_freeN(nu->bp); nu->bp= newbp; nu->pntsu++; - makeknots(nu, 1, nu->flagu>>1); + makeknots(nu, 1); } } } @@ -911,7 +911,7 @@ static void adduplicateflagNurb(Object *obedit, short flag) /* knots */ newnu->knotsu= NULL; - makeknots(newnu, 1, newnu->flagu>>1); + makeknots(newnu, 1); } bp++; } @@ -975,14 +975,14 @@ static void adduplicateflagNurb(Object *obedit, short flag) if(nu->pntsu==newnu->pntsu && nu->knotsu) { newnu->knotsu= MEM_dupallocN( nu->knotsu ); } else { - makeknots(newnu, 1, newnu->flagu>>1); + makeknots(newnu, 1); } } if (check_valid_nurb_v(newnu)) { if(nu->pntsv==newnu->pntsv && nu->knotsv) { newnu->knotsv= MEM_dupallocN( nu->knotsv ); } else { - makeknots(newnu, 2, newnu->flagv>>1); + makeknots(newnu, 2); } } } @@ -1962,8 +1962,8 @@ static int subdivide_exec(bContext *C, wmOperator *op) nu->bp= bpnew; nu->pntsu+= amount; - if(nu->type & 4) { - makeknots(nu, 1, nu->flagu>>1); + if(nu->type & CU_NURBS) { + makeknots(nu, 1); } } } /* End of 'else if(nu->pntsv==1)' */ @@ -2074,8 +2074,8 @@ static int subdivide_exec(bContext *C, wmOperator *op) nu->bp= bpnew; nu->pntsu= 2*nu->pntsu-1; nu->pntsv= 2*nu->pntsv-1; - makeknots(nu, 1, nu->flagu>>1); - makeknots(nu, 2, nu->flagv>>1); + makeknots(nu, 1); + makeknots(nu, 2); } /* End of 'if(sel== nu->pntsu*nu->pntsv)' (subdivide entire NURB) */ else { /* subdivide in v direction? */ @@ -2118,7 +2118,7 @@ static int subdivide_exec(bContext *C, wmOperator *op) MEM_freeN(nu->bp); nu->bp= bpnew; nu->pntsv+= sel; - makeknots(nu, 2, nu->flagv>>1); + makeknots(nu, 2); } else { /* or in u direction? */ @@ -2158,7 +2158,7 @@ static int subdivide_exec(bContext *C, wmOperator *op) MEM_freeN(nu->bp); nu->bp= bpnew; nu->pntsu+= sel; - makeknots(nu, 1, nu->flagu>>1); /* shift knots + makeknots(nu, 1); /* shift knots forward */ } } @@ -2316,7 +2316,7 @@ static int convertspline(short type, Nurb *nu) BPoint *bp; int a, c, nr; - if((nu->type & 7)==0) { /* Poly */ + if((nu->type & 7)==CU_POLY) { if(type==CU_BEZIER) { /* to Bezier with vecthandles */ nr= nu->pntsu; bezt = @@ -2337,16 +2337,16 @@ static int convertspline(short type, Nurb *nu) nu->bp= 0; nu->pntsu= nr; nu->type &= ~7; - nu->type |= 1; + nu->type |= CU_BEZIER; calchandlesNurb(nu); } else if(type==CU_NURBS) { nu->type &= ~7; - nu->type+= 4; + nu->type |= CU_NURBS; nu->orderu= 4; nu->flagu &= CU_CYCLIC; /* disable all flags except for cyclic */ nu->flagu += 4; - makeknots(nu, 1, nu->flagu>>1); + makeknots(nu, 1); a= nu->pntsu*nu->pntsv; bp= nu->bp; while(a--) { @@ -2400,7 +2400,7 @@ static int convertspline(short type, Nurb *nu) if(type== 4) { nu->flagu &= CU_CYCLIC; /* disable all flags except for cyclic */ nu->flagu += 4; - makeknots(nu, 1, nu->flagu>>1); + makeknots(nu, 1); } } } @@ -2442,7 +2442,7 @@ static int convertspline(short type, Nurb *nu) nu->knotsu= NULL; nu->pntsu= nr; nu->type &= ~7; - nu->type+= 1; + nu->type |= CU_BEZIER; } } } @@ -2803,12 +2803,12 @@ static void merge_2_nurb(wmOperator *op, ListBase *editnurb, Nurb *nu1, Nurb *nu } } - if((nu1->type & 7)==4) { + if((nu1->type & 7)==CU_NURBS) { /* merge knots */ - makeknots(nu1, 1, nu1->flagu>>1); + makeknots(nu1, 1); /* make knots, for merged curved for example */ - makeknots(nu1, 2, nu1->flagv>>1); + makeknots(nu1, 2); } MEM_freeN(temp); @@ -2991,9 +2991,9 @@ static int make_segment_exec(bContext *C, wmOperator *op) BLI_remlink(editnurb, nu2); /* now join the knots */ - if((nu1->type & 7)==4) { + if((nu1->type & 7)==CU_NURBS) { if(nu1->knotsu==NULL) { - makeknots(nu1, 1, nu1->flagu>>1); + makeknots(nu1, 1); } else { fp= MEM_mallocN(sizeof(float)*KNOTSU(nu1), "addsegment3"); @@ -3216,7 +3216,7 @@ static int spin_nurb(bContext *C, Scene *scene, Object *obedit, float *dvec, sho if(isNurbsel(nu)) { nu->orderv= 4; nu->flagv |= CU_CYCLIC; - makeknots(nu, 2, nu->flagv>>1); + makeknots(nu, 2); } } } @@ -3352,7 +3352,7 @@ static int addvert_Nurb(bContext *C, short mode, float location[3]) if(bp) { nu->pntsu++; - makeknots(nu, 1, nu->flagu>>1); + makeknots(nu, 1); if(mode=='e') { VECCOPY(newbp->vec, bp->vec); @@ -3492,7 +3492,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op) for(nu= editnurb->first; nu; nu= nu->next) { if( nu->pntsu>1 || nu->pntsv>1) { - if( (nu->type & 7)==0 ) { + if( (nu->type & 7)==CU_POLY ) { a= nu->pntsu; bp= nu->bp; while(a--) { @@ -3522,7 +3522,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op) while(a--) { if( bp->f1 & SELECT ) { nu->flagu ^= CU_CYCLIC; - makeknots(nu, 1, nu->flagu>>1); /* 1==u type is ignored for cyclic curves */ + makeknots(nu, 1); /* 1==u type is ignored for cyclic curves */ break; } bp++; @@ -3537,11 +3537,11 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op) if( bp->f1 & SELECT) { if(direction==0 && nu->pntsu>1) { nu->flagu ^= CU_CYCLIC; - makeknots(nu, 1, nu->flagu>>1); /* 1==u type is ignored for cyclic curves */ + makeknots(nu, 1); /* 1==u type is ignored for cyclic curves */ } if(direction==1 && nu->pntsv>1) { nu->flagv ^= CU_CYCLIC; - makeknots(nu, 2, nu->flagv>>1); /* 2==v type is ignored for cyclic curves */ + makeknots(nu, 2); /* 2==v type is ignored for cyclic curves */ } break; } @@ -4349,7 +4349,7 @@ static int delete_exec(bContext *C, wmOperator *op) clamp_nurb_order_u(nu); }*/ } - makeknots(nu, 1, nu->flagu>>1); + makeknots(nu, 1); } nu= next; } @@ -4810,7 +4810,7 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname) if(cutype==CU_NURBS) { nu->knotsu= 0; /* makeknots allocates */ - makeknots(nu, 1, nu->flagu>>1); + makeknots(nu, 1); } } @@ -4845,7 +4845,7 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname) if(cutype==CU_NURBS) { nu->knotsu= 0; /* makeknots allocates */ - makeknots(nu, 1, nu->flagu>>1); + makeknots(nu, 1); } break; @@ -4930,7 +4930,7 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname) bp++; } - makeknots(nu, 1, nu->flagu>>1); + makeknots(nu, 1); } break; case CU_PRIM_PATCH: /* 4x4 patch */ @@ -4967,8 +4967,8 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname) } } - makeknots(nu, 1, nu->flagu>>1); - makeknots(nu, 2, nu->flagv>>1); + makeknots(nu, 1); + makeknots(nu, 2); } break; case CU_PRIM_TUBE: /* tube */ @@ -5030,7 +5030,7 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname) bp++; } nu->flagu= 4; - makeknots(nu, 1, nu->flagu>>1); + makeknots(nu, 1); BLI_addtail(editnurb, nu); /* temporal for spin */ if(newname && (U.flag & USER_ADD_VIEWALIGNED) == 0) @@ -5038,7 +5038,7 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname) else spin_nurb(C, scene, obedit, 0, 0); - makeknots(nu, 2, nu->flagv>>1); + makeknots(nu, 2); a= nu->pntsu*nu->pntsv; bp= nu->bp; diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index 2b63c1f2d3b..fd59539bb56 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -133,8 +133,10 @@ void gp_ui_delstroke_cb (void *gpd, void *gpl) { bGPDframe *gpf= gpencil_layer_getframe(gpl, CFRA, 0); + if (gpf->framenum != CFRA) return; + gpencil_layer_setactive(gpd, gpl); - gpencil_frame_delete_laststroke(gpf); + gpencil_frame_delete_laststroke(gpl, gpf); scrarea_queue_winredraw(curarea); } diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index fc3c8b1dc77..f3868b1f01c 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -2603,11 +2603,13 @@ void esubdivideflag(Object *obedit, EditMesh *em, int flag, float rad, int beaut } } } - sort[hold]->f &= ~SELECT; - sort[hold]->f2 |= EDGENEW; - length[hold] = -1; - } - } + if (hold > -1) { + sort[hold]->f &= ~SELECT; + sort[hold]->f2 |= EDGENEW; + length[hold] = -1; + } + } + } // Beauty Long Edges else { @@ -2624,13 +2626,15 @@ void esubdivideflag(Object *obedit, EditMesh *em, int flag, float rad, int beaut } } } - sort[hold]->f &= ~SELECT; - sort[hold]->f2 |= EDGENEW; - length[hold] = -1; - } - } + if (hold > -1) { + sort[hold]->f &= ~SELECT; + sort[hold]->f2 |= EDGENEW; + length[hold] = -1; + } + } + } } - } + } } gh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp); @@ -3255,11 +3259,9 @@ void join_triangles(EditMesh *em) if(v1 && v2 && v3 && v4){ /*test if simple island first. This mimics 2.42 behaviour and the tests are less restrictive.*/ if(efaa[0]->tmp.l == 1 && efaa[1]->tmp.l == 1){ - if( convex(v1->co, v2->co, v3->co, v4->co) ){ - eed->f1 |= T2QJOIN; - efaa[0]->f1 = 1; //mark for join - efaa[1]->f1 = 1; //mark for join - } + eed->f1 |= T2QJOIN; + efaa[0]->f1 = 1; //mark for join + efaa[1]->f1 = 1; //mark for join } else{ @@ -3503,10 +3505,6 @@ static void edge_rotate(EditMesh *em, wmOperator *op, EditEdge *eed,int dir) if(numshared > 1) return; - /* coplaner faces only please */ - if(Inpf(face[0]->n,face[1]->n) <= 0.000001) - return; - /* we want to construct an array of vertex indicis in both faces, starting at the last vertex of the edge being rotated. - first we find the two vertices that lie on the rotating edge diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 69d580afea9..5a86180a60f 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -45,6 +45,7 @@ #include "BKE_context.h" #include "BKE_global.h" +#include "BKE_mesh.h" #include "BKE_utildefines.h" #include "RNA_access.h" diff --git a/source/blender/editors/object/editconstraint.c b/source/blender/editors/object/editconstraint.c index c8d8ece30dc..d0e487f98c7 100644 --- a/source/blender/editors/object/editconstraint.c +++ b/source/blender/editors/object/editconstraint.c @@ -379,6 +379,8 @@ void add_constraint (Scene *scene, View3D *v3d, short only_IK) nr= pupmenu("Add Constraint to Active Bone%t|Child Of%x19|Transformation%x20|%l|Copy Location%x1|Copy Rotation%x2|Copy Scale%x8|%l|Limit Location%x13|Limit Rotation%x14|Limit Scale%x15|Limit Distance%x21|%l|Track To%x3|Floor%x4|Locked Track%x5|Stretch To%x7|%l|Action%x16|Script%x18"); else if ((obsel) && (obsel->type==OB_CURVE)) nr= pupmenu("Add Constraint to Active Object%t|Child Of%x19|Transformation%x20|%l|Copy Location%x1|Copy Rotation%x2|Copy Scale%x8|%l|Limit Location%x13|Limit Rotation%x14|Limit Scale%x15|Limit Distance%x21|%l|Track To%x3|Floor%x4|Locked Track%x5|Follow Path%x6|Clamp To%x17|Stretch To%x7|%l|Action%x16|Script%x18"); + else if ((obsel) && (obsel->type==OB_MESH)) + nr= pupmenu("Add Constraint to Active Object%t|Child Of%x19|Transformation%x20|%l|Copy Location%x1|Copy Rotation%x2|Copy Scale%x8|%l|Limit Location%x13|Limit Rotation%x14|Limit Scale%x15|Limit Distance%x21|%l|Track To%x3|Floor%x4|Locked Track%x5|Shrinkwrap%x22|Stretch To%x7|%l|Action%x16|Script%x18"); else if (obsel) nr= pupmenu("Add Constraint to Active Object%t|Child Of%x19|Transformation%x20|%l|Copy Location%x1|Copy Rotation%x2|Copy Scale%x8|%l|Limit Location%x13|Limit Rotation%x14|Limit Scale%x15|Limit Distance%x21|%l|Track To%x3|Floor%x4|Locked Track%x5|Stretch To%x7|%l|Action%x16|Script%x18"); else @@ -387,6 +389,8 @@ void add_constraint (Scene *scene, View3D *v3d, short only_IK) else { if ((obsel) && (obsel->type==OB_CURVE)) nr= pupmenu("Add Constraint to Active Object%t|Child Of%x19|Transformation%x20|%l|Copy Location%x1|Copy Rotation%x2|Copy Scale%x8|%l|Limit Location%x13|Limit Rotation%x14|Limit Scale%x15|Limit Distance%x21|%l|Track To%x3|Floor%x4|Locked Track%x5|Follow Path%x6|Clamp To%x17|%l|Action%x16|Script%x18"); + else if ((obsel) && (obsel->type==OB_MESH)) + nr= pupmenu("Add Constraint to Active Object%t|Child Of%x19|Transformation%x20|%l|Copy Location%x1|Copy Rotation%x2|Copy Scale%x8|%l|Limit Location%x13|Limit Rotation%x14|Limit Scale%x15|Limit Distance%x21|%l|Track To%x3|Floor%x4|Locked Track%x5|Shrinkwrap%x22|%l|Action%x16|Script%x18"); else if (obsel) nr= pupmenu("Add Constraint to Active Object%t|Child Of%x19|Transformation%x20|%l|Copy Location%x1|Copy Rotation%x2|Copy Scale%x8|%l|Limit Location%x13|Limit Rotation%x14|Limit Scale%x15|Limit Distance%x21|%l|Track To%x3|Floor%x4|Locked Track%x5|%l|Action%x16|Script%x18"); else @@ -489,6 +493,7 @@ void add_constraint (Scene *scene, View3D *v3d, short only_IK) } else if (nr==20) con = add_new_constraint(CONSTRAINT_TYPE_TRANSFORM); else if (nr==21) con = add_new_constraint(CONSTRAINT_TYPE_DISTLIMIT); + else if (nr==22) con = add_new_constraint(CONSTRAINT_TYPE_SHRINKWRAP); if (con==NULL) return; /* paranoia */ diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index a5c811be164..eeba0ad22ae 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -3076,7 +3076,7 @@ static int object_center_set_exec(bContext *C, wmOperator *op) nu= nu1; while(nu) { - if( (nu->type & 7)==1) { + if( (nu->type & 7)==CU_BEZIER) { a= nu->pntsu; while (a--) { VecSubf(nu->bezt[a].vec[0], nu->bezt[a].vec[0], cent); @@ -4338,14 +4338,12 @@ static void copymenu_properties(Scene *scene, View3D *v3d, Object *ob) prop= prop->next; } - if(tot==0) { - error("No properties in the active object to copy"); - return; - } - str= MEM_callocN(50 + 33*tot, "copymenu prop"); - strcpy(str, "Copy Property %t|Replace All|Merge All|%l"); + if (tot) + strcpy(str, "Copy Property %t|Replace All|Merge All|%l"); + else + strcpy(str, "Copy Property %t|Clear All (no properties on active)"); tot= 0; prop= ob->prop.first; @@ -4648,7 +4646,8 @@ void copy_attr(Scene *scene, View3D *v3d, short event) base->object->formfactor = ob->formfactor; base->object->damping= ob->damping; base->object->rdamping= ob->rdamping; - base->object->mass= ob->mass; + base->object->min_vel= ob->min_vel; + base->object->max_vel= ob->max_vel; if (ob->gameflag & OB_BOUNDS) { base->object->boundtype = ob->boundtype; } @@ -5192,7 +5191,7 @@ static void apply_objects_internal(Scene *scene, View3D *v3d, int apply_scale, i nu= cu->nurb.first; while(nu) { - if( (nu->type & 7)==1) { + if( (nu->type & 7)==CU_BEZIER) { a= nu->pntsu; bezt= nu->bezt; while(a--) { diff --git a/source/blender/editors/physics/editparticle.c b/source/blender/editors/physics/editparticle.c index 3212494234b..96f3ad2f8df 100644 --- a/source/blender/editors/physics/editparticle.c +++ b/source/blender/editors/physics/editparticle.c @@ -1,5 +1,5 @@ /* - * $Id: editparticle.c $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/physics/physics_intern.h b/source/blender/editors/physics/physics_intern.h index 9ca4f864e48..e03649575cb 100644 --- a/source/blender/editors/physics/physics_intern.h +++ b/source/blender/editors/physics/physics_intern.h @@ -1,7 +1,5 @@ -/* BIF_editparticle.h - * - * - * $Id: BIF_editparticle.h $ +/* + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 7d0c3e3e3ba..bf57e2e7d52 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -47,6 +47,7 @@ #include "BKE_idprop.h" #include "BKE_library.h" #include "BKE_main.h" +#include "BKE_mesh.h" #include "BKE_multires.h" #include "BKE_report.h" #include "BKE_screen.h" diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 1ce5f3a348b..22fb8e61789 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -753,8 +753,7 @@ static int project_paint_PickColor(const ProjPaintState *ps, float pt[2], float } ibuf = BKE_image_get_ibuf((Image *)tf->tpage, NULL); /* TODO - this may be slow, the only way around it is to have an ibuf index per face */ - - + if (!ibuf) return 0; if (interp) { float x, y; diff --git a/source/blender/editors/space_image/image_header.c b/source/blender/editors/space_image/image_header.c index 1ff71bd2225..288fc76d8e4 100644 --- a/source/blender/editors/space_image/image_header.c +++ b/source/blender/editors/space_image/image_header.c @@ -45,6 +45,7 @@ #include "BKE_context.h" #include "BKE_customdata.h" #include "BKE_image.h" +#include "BKE_mesh.h" #include "BKE_screen.h" #include "BKE_utildefines.h" diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 934d58926e2..fcafcd22a3d 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1062,6 +1062,7 @@ void IMAGE_OT_new(wmOperatorType *ot) /* api callbacks */ ot->exec= new_exec; + ot->invoke= WM_operator_redo; ot->poll= ED_operator_image_active; /* flags */ diff --git a/source/blender/editors/space_image/image_panels.c b/source/blender/editors/space_image/image_panels.c index 2fe7f3990ff..971f3a70a8a 100644 --- a/source/blender/editors/space_image/image_panels.c +++ b/source/blender/editors/space_image/image_panels.c @@ -55,6 +55,7 @@ #include "BKE_global.h" #include "BKE_library.h" #include "BKE_main.h" +#include "BKE_mesh.h" #include "BKE_node.h" #include "BKE_packedFile.h" #include "BKE_screen.h" diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c index 81508066199..0ab43cbf455 100644 --- a/source/blender/editors/space_text/text_header.c +++ b/source/blender/editors/space_text/text_header.c @@ -56,6 +56,7 @@ #include "BKE_global.h" #include "BKE_library.h" #include "BKE_main.h" +#include "BKE_scene.h" #include "BKE_screen.h" #include "BKE_text.h" @@ -278,6 +279,7 @@ static void text_unlink(Main *bmain, Text *text) // XXX BPY_clear_bad_scriptlinks(text); // XXX BPY_free_pyconstraint_links(text); // XXX free_text_controllers(text); + // XXX free_dome_warp_text(text); /* check if this text was used as script link: * this check function unsets the pointers and returns how many diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 2bb532288ef..5276ca8f0a5 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -2832,16 +2832,14 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv ParticleSettings *part; ParticleData *pars, *pa; ParticleKey state, *states=0; - ParticleCacheKey *cache=0; + ParticleBillboardData bb; Material *ma; - Object *bb_ob=0; - float vel[3], vec[3], vec2[3], imat[4][4], onevec[3]={0.0f,0.0f,0.0f}, bb_center[3]; + float vel[3], vec[3], vec2[3], imat[4][4], bb_center[3]; float timestep, pixsize=1.0, pa_size, pa_time, r_tilt; float cfra= bsystem_time(scene, ob,(float)CFRA,0.0); float *vdata=0, *vedata=0, *cdata=0, *ndata=0, *vd=0, *ved=0, *cd=0, *nd=0, xvec[3], yvec[3], zvec[3]; float ma_r=0.0f, ma_g=0.0f, ma_b=0.0f; - int a, k, k_max=0, totpart, totpoint=0, draw_as, path_nbr=0; - int path_possible=0, keys_possible=0, draw_keys=0, totchild=0; + int a, totpart, totpoint=0, draw_as, totchild=0; int select=ob->flag&SELECT, create_cdata=0; GLint polygonmode[2]; char val[32]; @@ -2928,18 +2926,9 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv if(part->flag&PART_GLOB_TIME) cfra=bsystem_time(scene, 0, (float)CFRA, 0.0f); - if(psys->pathcache){ - path_possible=1; - keys_possible=1; - } - if(draw_as==PART_DRAW_PATH && path_possible==0) + if(draw_as==PART_DRAW_PATH && psys->pathcache==NULL) draw_as=PART_DRAW_DOT; - if(draw_as!=PART_DRAW_PATH && keys_possible && part->draw&PART_DRAW_KEYS){ - path_nbr=part->keys_step; - draw_keys=1; - } - /* 3. */ switch(draw_as){ case PART_DRAW_DOT: @@ -2988,12 +2977,15 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv glPointSize(2.0); /* default dot size */ } else if(part->bb_ob) - bb_ob=part->bb_ob; + bb.ob=part->bb_ob; else - bb_ob=v3d->camera; + bb.ob=v3d->camera; - if(part->bb_align<PART_BB_VIEW) - onevec[part->bb_align]=1.0f; + bb.align = part->bb_align; + bb.anim = part->bb_anim; + bb.lock = part->draw & PART_DRAW_BB_LOCK; + bb.offset[0] = part->bb_offset[0]; + bb.offset[1] = part->bb_offset[1]; break; case PART_DRAW_PATH: break; @@ -3005,35 +2997,37 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv } /* 4. */ - if(draw_as && draw_as!=PART_DRAW_PATH){ - if(draw_as!=PART_DRAW_CIRC){ - switch(draw_as){ + if(draw_as && draw_as!=PART_DRAW_PATH) { + int tot_vec_size = (totpart + totchild) * 3 * sizeof(float); + + if(draw_as!=PART_DRAW_CIRC) { + switch(draw_as) { case PART_DRAW_AXIS: case PART_DRAW_CROSS: - if(draw_as!=PART_DRAW_CROSS || create_cdata) - cdata=MEM_callocN((totpart+totchild)*(path_nbr+1)*6*3*sizeof(float), "particle_cdata"); - vdata=MEM_callocN((totpart+totchild)*(path_nbr+1)*6*3*sizeof(float), "particle_vdata"); + if(draw_as != PART_DRAW_CROSS || create_cdata) + cdata = MEM_callocN(tot_vec_size * 6, "particle_cdata"); + vdata = MEM_callocN(tot_vec_size * 6, "particle_vdata"); break; case PART_DRAW_LINE: if(create_cdata) - cdata=MEM_callocN((totpart+totchild)*(path_nbr+1)*2*3*sizeof(float), "particle_cdata"); - vdata=MEM_callocN((totpart+totchild)*(path_nbr+1)*2*3*sizeof(float), "particle_vdata"); + cdata = MEM_callocN(tot_vec_size * 2, "particle_cdata"); + vdata = MEM_callocN(tot_vec_size * 2, "particle_vdata"); break; case PART_DRAW_BB: if(create_cdata) - cdata=MEM_callocN((totpart+totchild)*(path_nbr+1)*4*3*sizeof(float), "particle_cdata"); - vdata=MEM_callocN((totpart+totchild)*(path_nbr+1)*4*3*sizeof(float), "particle_vdata"); - ndata=MEM_callocN((totpart+totchild)*(path_nbr+1)*4*3*sizeof(float), "particle_vdata"); + cdata = MEM_callocN(tot_vec_size * 4, "particle_cdata"); + vdata = MEM_callocN(tot_vec_size * 4, "particle_vdata"); + ndata = MEM_callocN(tot_vec_size * 4, "particle_vdata"); break; default: if(create_cdata) - cdata=MEM_callocN((totpart+totchild)*(path_nbr+1)*3*sizeof(float), "particle_cdata"); - vdata=MEM_callocN((totpart+totchild)*(path_nbr+1)*3*sizeof(float), "particle_vdata"); + cdata=MEM_callocN(tot_vec_size, "particle_cdata"); + vdata=MEM_callocN(tot_vec_size, "particle_vdata"); } } - if(part->draw&PART_DRAW_VEL && draw_as!=PART_DRAW_LINE) - vedata=MEM_callocN((totpart+totchild)*2*3*(path_nbr+1)*sizeof(float), "particle_vedata"); + if(part->draw & PART_DRAW_VEL && draw_as != PART_DRAW_LINE) + vedata = MEM_callocN(tot_vec_size * 2, "particle_vedata"); vd=vdata; ved=vedata; @@ -3046,6 +3040,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv if(draw_as){ /* 5. */ for(a=0,pa=pars; a<totpart+totchild; a++, pa++){ + /* setup per particle individual stuff */ if(a<totpart){ if(totchild && (part->draw&PART_DRAW_PARENT)==0) continue; if(pa->flag & PARS_NO_DISP || pa->flag & PARS_UNEXIST) continue; @@ -3085,11 +3080,6 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv } r_tilt=1.0f+pa->r_ave[0]; - - if(path_nbr){ - cache=psys->pathcache[a]; - k_max=(int)(cache->steps); - } } else{ ChildParticle *cpa= &psys->child[a-totpart]; @@ -3119,47 +3109,23 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv pa_size=psys_get_child_size(psys,cpa,cfra,0); r_tilt=2.0f*cpa->rand[2]; - if(path_nbr){ - cache=psys->childcache[a-totpart]; - k_max=(int)(cache->steps); - } } if(draw_as!=PART_DRAW_PATH){ - int next_pa=0; - for(k=0; k<=path_nbr; k++){ - if(draw_keys){ - state.time=(float)k/(float)path_nbr; - psys_get_particle_on_path(scene, ob, psys, a, &state,1); - } - else if(path_nbr){ - if(k<=k_max){ - VECCOPY(state.co,(cache+k)->co); - VECCOPY(state.vel,(cache+k)->vel); - QUATCOPY(state.rot,(cache+k)->rot); - } - else - continue; - } - else{ - state.time=cfra; - if(psys_get_particle_state(scene, ob, psys, a, &state,0)==0){ - next_pa=1; - break; - } - } - + state.time=cfra; + if(psys_get_particle_state(scene,ob,psys,a,&state,0)){ + /* create actiual particle data */ switch(draw_as){ case PART_DRAW_DOT: + if(vd){ + VECCOPY(vd,state.co) vd+=3; + } if(cd) { cd[0]=ma_r; cd[1]=ma_g; cd[2]=ma_b; cd+=3; } - if(vd){ - VECCOPY(vd,state.co) vd+=3; - } break; case PART_DRAW_CROSS: case PART_DRAW_AXIS: @@ -3242,59 +3208,15 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv cd[2]=cd[5]=cd[8]=cd[11]=ma_b; cd+=12; } - if(part->draw&PART_DRAW_BB_LOCK && part->bb_align==PART_BB_VIEW){ - VECCOPY(xvec,bb_ob->obmat[0]); - Normalize(xvec); - VECCOPY(yvec,bb_ob->obmat[1]); - Normalize(yvec); - VECCOPY(zvec,bb_ob->obmat[2]); - Normalize(zvec); - } - else if(part->bb_align==PART_BB_VEL){ - float temp[3]; - VECCOPY(temp,state.vel); - Normalize(temp); - VECSUB(zvec,bb_ob->obmat[3],state.co); - if(part->draw&PART_DRAW_BB_LOCK){ - float fac=-Inpf(zvec,temp); - VECADDFAC(zvec,zvec,temp,fac); - } - Normalize(zvec); - Crossf(xvec,temp,zvec); - Normalize(xvec); - Crossf(yvec,zvec,xvec); - } - else{ - VECSUB(zvec,bb_ob->obmat[3],state.co); - if(part->draw&PART_DRAW_BB_LOCK) - zvec[part->bb_align]=0.0f; - Normalize(zvec); - - if(part->bb_align<PART_BB_VIEW) - Crossf(xvec,onevec,zvec); - else - Crossf(xvec,bb_ob->obmat[1],zvec); - Normalize(xvec); - Crossf(yvec,zvec,xvec); - } - VECCOPY(vec,xvec); - VECCOPY(vec2,yvec); - - VecMulf(xvec,cos(part->bb_tilt*(1.0f-part->bb_rand_tilt*r_tilt)*(float)M_PI)); - VecMulf(vec2,sin(part->bb_tilt*(1.0f-part->bb_rand_tilt*r_tilt)*(float)M_PI)); - VECADD(xvec,xvec,vec2); - - VecMulf(yvec,cos(part->bb_tilt*(1.0f-part->bb_rand_tilt*r_tilt)*(float)M_PI)); - VecMulf(vec,-sin(part->bb_tilt*(1.0f-part->bb_rand_tilt*r_tilt)*(float)M_PI)); - VECADD(yvec,yvec,vec); - - VecMulf(xvec,pa_size); - VecMulf(yvec,pa_size); - - VECADDFAC(bb_center,state.co,xvec,part->bb_offset[0]); - VECADDFAC(bb_center,bb_center,yvec,part->bb_offset[1]); + bb.size = pa_size; + bb.tilt = part->bb_tilt * (1.0f - part->bb_rand_tilt * r_tilt); + bb.time = pa_time; + VECCOPY(bb.vec, state.co); + VECCOPY(bb.vel, state.vel); + psys_make_billboard(&bb, xvec, yvec, zvec, bb_center); + VECADD(vd,bb_center,xvec); VECADD(vd,vd,yvec); vd+=3; @@ -3314,6 +3236,10 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv break; } + totpoint++; + + /* additional things to draw for each particle */ + /* (velocity, size and number) */ if(vedata){ VECCOPY(ved,state.co); ved+=3; @@ -3329,15 +3255,12 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv setlinestyle(0); } - totpoint++; - } - if(next_pa) - continue; - if(part->draw&PART_DRAW_NUM && !(G.f & G_RENDER_SHADOW)){ - /* in path drawing state.co is the end point */ - glRasterPos3f(state.co[0], state.co[1], state.co[2]); - sprintf(val," %i",a); - BMF_DrawString(G.font, val); + if(part->draw&PART_DRAW_NUM && !(G.f & G_RENDER_SHADOW)){ + /* in path drawing state.co is the end point */ + glRasterPos3f(state.co[0], state.co[1], state.co[2]); + sprintf(val," %i",a); + BMF_DrawString(G.font, val); + } } } } @@ -3346,51 +3269,39 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv glGetIntegerv(GL_POLYGON_MODE, polygonmode); glDisableClientState(GL_NORMAL_ARRAY); - if(draw_as != PART_DRAW_CIRC){ - if(draw_as==PART_DRAW_PATH){ - ParticleCacheKey **cache, *path; - float *cd2=0,*cdata2=0; - - glEnableClientState(GL_VERTEX_ARRAY); - - if(dt > OB_WIRE) { - glEnableClientState(GL_NORMAL_ARRAY); + if(draw_as==PART_DRAW_PATH){ + ParticleCacheKey **cache, *path; + float *cd2=0,*cdata2=0; - if(part->draw&PART_DRAW_MAT_COL) - glEnableClientState(GL_COLOR_ARRAY); + glEnableClientState(GL_VERTEX_ARRAY); - glEnable(GL_LIGHTING); - glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE); - glEnable(GL_COLOR_MATERIAL); - } - else { - glDisableClientState(GL_NORMAL_ARRAY); + /* setup gl flags */ + if(dt > OB_WIRE) { + glEnableClientState(GL_NORMAL_ARRAY); - glDisable(GL_COLOR_MATERIAL); - glDisable(GL_LIGHTING); - UI_ThemeColor(TH_WIRE); - } + if(part->draw&PART_DRAW_MAT_COL) + glEnableClientState(GL_COLOR_ARRAY); - if(totchild && (part->draw&PART_DRAW_PARENT)==0) - totpart=0; + glEnable(GL_LIGHTING); + glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE); + glEnable(GL_COLOR_MATERIAL); + } + else { + glDisableClientState(GL_NORMAL_ARRAY); - cache=psys->pathcache; - for(a=0, pa=psys->particles; a<totpart; a++, pa++){ - path=cache[a]; - glVertexPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), path->co); + glDisable(GL_COLOR_MATERIAL); + glDisable(GL_LIGHTING); + UI_ThemeColor(TH_WIRE); + } - if(dt > OB_WIRE) { - glNormalPointer(GL_FLOAT, sizeof(ParticleCacheKey), path->vel); - if(part->draw&PART_DRAW_MAT_COL) - glColorPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), path->col); - } + if(totchild && (part->draw&PART_DRAW_PARENT)==0) + totpart=0; - glDrawArrays(GL_LINE_STRIP, 0, path->steps + 1); - } - - cache=psys->childcache; - for(a=0; a<totchild; a++){ - path=cache[a]; + /* draw actual/parent particles */ + cache=psys->pathcache; + for(a=0, pa=psys->particles; a<totpart; a++, pa++){ + path=cache[a]; + if(path->steps > 0) { glVertexPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), path->co); if(dt > OB_WIRE) { @@ -3401,68 +3312,85 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv glDrawArrays(GL_LINE_STRIP, 0, path->steps + 1); } + } + + /* draw child particles */ + cache=psys->childcache; + for(a=0; a<totchild; a++){ + path=cache[a]; + glVertexPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), path->co); if(dt > OB_WIRE) { + glNormalPointer(GL_FLOAT, sizeof(ParticleCacheKey), path->vel); if(part->draw&PART_DRAW_MAT_COL) - glDisable(GL_COLOR_ARRAY); - glDisable(GL_COLOR_MATERIAL); + glColorPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), path->col); } - if(cdata2) - MEM_freeN(cdata2); - cd2=cdata2=0; + glDrawArrays(GL_LINE_STRIP, 0, path->steps + 1); + } - glLineWidth(1.0f); - /* draw particle edit mode key points*/ + /* restore & clean up */ + if(dt > OB_WIRE) { + if(part->draw&PART_DRAW_MAT_COL) + glDisable(GL_COLOR_ARRAY); + glDisable(GL_COLOR_MATERIAL); } - if(draw_as!=PART_DRAW_PATH){ - glDisableClientState(GL_COLOR_ARRAY); + if(cdata2) + MEM_freeN(cdata2); + cd2=cdata2=0; - if(vdata){ - glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(3, GL_FLOAT, 0, vdata); - } - else - glDisableClientState(GL_VERTEX_ARRAY); + glLineWidth(1.0f); + } + else if(draw_as!=PART_DRAW_CIRC){ + glDisableClientState(GL_COLOR_ARRAY); - if(ndata && dt>OB_WIRE){ - glEnableClientState(GL_NORMAL_ARRAY); - glNormalPointer(GL_FLOAT, 0, ndata); - glEnable(GL_LIGHTING); - } - else{ - glDisableClientState(GL_NORMAL_ARRAY); - glDisable(GL_LIGHTING); - } + /* setup created data arrays */ + if(vdata){ + glEnableClientState(GL_VERTEX_ARRAY); + glVertexPointer(3, GL_FLOAT, 0, vdata); + } + else + glDisableClientState(GL_VERTEX_ARRAY); - if(cdata){ - glEnableClientState(GL_COLOR_ARRAY); - glColorPointer(3, GL_FLOAT, 0, cdata); - } + if(ndata && dt>OB_WIRE){ + glEnableClientState(GL_NORMAL_ARRAY); + glNormalPointer(GL_FLOAT, 0, ndata); + glEnable(GL_LIGHTING); + } + else{ + glDisableClientState(GL_NORMAL_ARRAY); + glDisable(GL_LIGHTING); + } - switch(draw_as){ - case PART_DRAW_AXIS: - case PART_DRAW_CROSS: - glDrawArrays(GL_LINES, 0, 6*totpoint); - break; - case PART_DRAW_LINE: - glDrawArrays(GL_LINES, 0, 2*totpoint); - break; - case PART_DRAW_BB: - if(dt<=OB_WIRE) - glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); - - glDrawArrays(GL_QUADS, 0, 4*totpoint); - break; - default: - glDrawArrays(GL_POINTS, 0, totpoint); - break; - } + if(cdata){ + glEnableClientState(GL_COLOR_ARRAY); + glColorPointer(3, GL_FLOAT, 0, cdata); } + + /* draw created data arrays */ + switch(draw_as){ + case PART_DRAW_AXIS: + case PART_DRAW_CROSS: + glDrawArrays(GL_LINES, 0, 6*totpoint); + break; + case PART_DRAW_LINE: + glDrawArrays(GL_LINES, 0, 2*totpoint); + break; + case PART_DRAW_BB: + if(dt<=OB_WIRE) + glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); + + glDrawArrays(GL_QUADS, 0, 4*totpoint); + break; + default: + glDrawArrays(GL_POINTS, 0, totpoint); + break; + } } + if(vedata){ glDisableClientState(GL_COLOR_ARRAY); cpack(0xC0C0C0); @@ -3705,7 +3633,7 @@ static void tekenhandlesN(Nurb *nu, short sel) glBegin(GL_LINES); - if( (nu->type & 7)==1) { + if( (nu->type & 7)==CU_BEZIER) { if(sel) col= nurbcol+4; else col= nurbcol; @@ -3762,7 +3690,7 @@ static void tekenvertsN(Nurb *nu, short sel) bglBegin(GL_POINTS); - if((nu->type & 7)==1) { + if((nu->type & 7)==CU_BEZIER) { bezt= nu->bezt; a= nu->pntsu; diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 94d53a64f32..9a9786cebff 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -63,6 +63,7 @@ #include "BKE_customdata.h" #include "BKE_depsgraph.h" #include "BKE_idprop.h" +#include "BKE_mesh.h" #include "BKE_object.h" #include "BKE_global.h" #include "BKE_scene.h" @@ -404,7 +405,7 @@ static void v3d_editvertex_buts(const bContext *C, uiBlock *block, View3D *v3d, nu= cu->editnurb->first; while(nu) { - if((nu->type & 7)==1) { + if((nu->type & 7)==CU_BEZIER) { bezt= nu->bezt; a= nu->pntsu; while(a--) { diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 57d227f33bf..36490650415 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -3865,7 +3865,7 @@ static void do_view3d_pose_armature_transformmenu(bContext *C, void *arg, int ev { #if 0 Scene *scene= CTX_data_scene(C); - Object *ob= OBACT; + Object *ob= CTX_data_active_object(C); switch(event) { case 0: /* clear origin */ @@ -3881,9 +3881,7 @@ static void do_view3d_pose_armature_transformmenu(bContext *C, void *arg, int ev clear_object('g'); break; case 4: /* clear user transform */ - rest_pose(ob->pose); - DAG_object_flush_update(scene, ob, OB_RECALC_DATA); - ED_undo_push(C, "Pose, Clear User Transform"); + clear_user_transform(scene, ob); break; } #endif @@ -5466,6 +5464,10 @@ void view3d_header_buttons(const bContext *C, ARegion *ar) 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"); xco+= XIC; + if (scene->snap_mode == SCE_SNAP_MODE_VOLUME) { + uiDefIconButBitS(block, TOG, SCE_SNAP_PEEL_OBJECT, B_REDR, 0 /* XXX 2.5 ICON_SNAP_PEEL_OBJECT */,xco,0,XIC,YIC, &scene->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"); 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"); diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index dfbc22b1e14..4ac82fcd73f 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -83,8 +83,8 @@ typedef struct TransSnap { short mode; short align; short status; - float snapPoint[3]; - float snapTarget[3]; + float snapPoint[3]; /* snapping from this point */ + float snapTarget[3]; /* to this point */ float snapNormal[3]; float snapTangent[3]; float dist; // Distance from snapPoint to snapTarget diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index dc32a46a301..72901110388 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -554,13 +554,13 @@ void CalcSnapGeometry(TransInfo *t, float *vec) peelObjectsTransForm(t, &depth_peels, t->mval); -// if (stk->nb_points > 0 && stk->points[stk->nb_points - 1].type == PT_CONTINUOUS) +// if (LAST_SNAP_POINT_VALID) // { -// last_p = stk->points[stk->nb_points - 1].p; +// last_p = LAST_SNAP_POINT; // } -// else if (LAST_SNAP_POINT_VALID) +// else // { -// last_p = LAST_SNAP_POINT; + last_p = t->tsnap.snapPoint; // } @@ -1617,13 +1617,26 @@ int peelObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, ListBase Object *ob = dupli_ob->ob; if (ob->type == OB_MESH) { - DerivedMesh *dm; + EditMesh *em; + DerivedMesh *dm = NULL; int val; - - val = peelDerivedMesh(ob, dm, dupli_ob->mat, ray_start, ray_normal, mval, depth_peels); - + + if (ob != obedit) + { + dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH); + + val = peelDerivedMesh(ob, dm, ob->obmat, ray_start, ray_normal, mval, depth_peels); + } + else + { + em = ((Mesh *)ob->data)->edit_mesh; + dm = editmesh_get_derived_cage(scene, obedit, em, CD_MASK_BAREMESH); + + val = peelDerivedMesh(ob, dm, ob->obmat, ray_start, ray_normal, mval, depth_peels); + } + retval = retval || val; - + dm->release(dm); } } diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index 7b5a264a440..aded5a4cff9 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -38,6 +38,7 @@ #include "BKE_customdata.h" #include "BKE_DerivedMesh.h" +#include "BKE_mesh.h" #include "BKE_object.h" #include "BKE_utildefines.h" diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 0fcd0062044..5cc471ebc22 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -4311,8 +4311,8 @@ void param_smooth_area(ParamHandle *handle) } } -void param_pack(ParamHandle *handle) -{ +void param_pack(ParamHandle *handle, float margin) +{ /* box packing variables */ boxPack *boxarray, *box; float tot_width, tot_height, scale; @@ -4320,6 +4320,7 @@ void param_pack(ParamHandle *handle) PChart *chart; int i, unpacked=0; float trans[2]; + double area= 0.0; PHandle *phandle = (PHandle*)handle; @@ -4332,6 +4333,7 @@ void param_pack(ParamHandle *handle) /* we may not use all these boxes */ boxarray = MEM_mallocN( phandle->ncharts*sizeof(boxPack), "boxPack box"); + for (i = 0; i < phandle->ncharts; i++) { chart = phandle->charts[i]; @@ -4352,6 +4354,32 @@ void param_pack(ParamHandle *handle) box->w = chart->u.pack.size[0] + trans[0]; box->h = chart->u.pack.size[1] + trans[1]; box->index = i; /* warning this index skips PCHART_NOPACK boxes */ + + if(margin>0.0f) + area += sqrt(box->w*box->h); + } + + if(margin>0.0f) { + /* multiply the margin by the area to give pradictable results not dependant on UV scale, + * ...Without using the area running pack multiple times also gives a bad feedback loop. + * multiply by 0.1 so the margin value from the UI can be from 0.0 to 1.0 but not give a massive margin */ + margin = (margin*(float)area) * 0.1; + unpacked= 0; + for (i = 0; i < phandle->ncharts; i++) { + chart = phandle->charts[i]; + + if (chart->flag & PCHART_NOPACK) { + unpacked++; + continue; + } + + box = boxarray+(i-unpacked); + trans[0] = margin * area; + trans[1] = margin * area; + p_chart_uv_translate(chart, trans); + box->w += (margin * area) *2; + box->h += (margin * area) *2; + } } boxPack2D(boxarray, phandle->ncharts-unpacked, &tot_width, &tot_height); diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.h b/source/blender/editors/uvedit/uvedit_parametrizer.h index c468b8d62c5..f1454ee3865 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.h +++ b/source/blender/editors/uvedit/uvedit_parametrizer.h @@ -73,7 +73,7 @@ void param_smooth_area(ParamHandle *handle); /* Packing */ -void param_pack(ParamHandle *handle); +void param_pack(ParamHandle *handle, float margin); /* Average area for all charts */ diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index e9dd1969ee2..4d12700d98c 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -409,7 +409,7 @@ static int pack_islands_exec(bContext *C, wmOperator *op) ParamHandle *handle; handle = construct_param_handle(scene, em, 1, 0, 1, 1); - param_pack(handle); + param_pack(handle, scene->toolsettings->uvcalc_margin); param_flush(handle); param_delete(handle); @@ -804,7 +804,7 @@ static int unwrap_exec(bContext *C, wmOperator *op) param_lscm_solve(handle); param_lscm_end(handle); - param_pack(handle); + param_pack(handle, scene->toolsettings->uvcalc_margin); param_flush(handle); |