Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Susano Pinto <andresusanopinto@gmail.com>2008-06-21 01:36:15 +0400
committerAndre Susano Pinto <andresusanopinto@gmail.com>2008-06-21 01:36:15 +0400
commitffbe42129e0d043214daf9b07125d9d8140d1c74 (patch)
tree6c99776cfcfadd32347eacb287c69deaa1b35651 /source/blender
parent824eac5095924ffdc1fea213a925054c88bf05d7 (diff)
svn merge -r 15202:15292 https://svn.blender.org/svnroot/bf-blender/trunk/blender
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_action.h5
-rw-r--r--source/blender/blenkernel/BKE_key.h11
-rw-r--r--source/blender/blenkernel/BKE_scene.h2
-rw-r--r--source/blender/blenkernel/intern/action.c24
-rw-r--r--source/blender/blenkernel/intern/armature.c61
-rw-r--r--source/blender/blenkernel/intern/key.c2
-rw-r--r--source/blender/blenkernel/intern/modifier.c207
-rw-r--r--source/blender/blenkernel/intern/object.c2
-rw-r--r--source/blender/blenkernel/intern/sca.c1
-rw-r--r--source/blender/blenlib/intern/util.c19
-rw-r--r--source/blender/blenloader/intern/readfile.c8
-rw-r--r--source/blender/blenloader/intern/writefile.c1
-rw-r--r--source/blender/imbuf/intern/cineon/dpxlib.c45
-rw-r--r--source/blender/include/BDR_editcurve.h1
-rw-r--r--source/blender/include/BIF_oops.h8
-rw-r--r--source/blender/makesdna/DNA_actuator_types.h1
-rw-r--r--source/blender/makesdna/DNA_modifier_types.h6
-rw-r--r--source/blender/makesdna/DNA_space_types.h1
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_math.c18
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_math.c18
-rw-r--r--source/blender/python/api2_2x/Mathutils.c49
-rw-r--r--source/blender/render/intern/source/convertblender.c2
-rw-r--r--source/blender/render/intern/source/shadbuf.c4
-rw-r--r--source/blender/src/CMakeLists.txt2
-rw-r--r--source/blender/src/Makefile1
-rw-r--r--source/blender/src/SConscript2
-rw-r--r--source/blender/src/buttons_editing.c11
-rw-r--r--source/blender/src/buttons_logic.c14
-rw-r--r--source/blender/src/drawaction.c2
-rw-r--r--source/blender/src/drawnode.c2
-rw-r--r--source/blender/src/drawoops.c9
-rw-r--r--source/blender/src/editcurve.c56
-rw-r--r--source/blender/src/editobject.c5
-rw-r--r--source/blender/src/header_oops.c4
-rw-r--r--source/blender/src/oops.c114
-rw-r--r--source/blender/src/transform_constraints.c16
-rw-r--r--source/blender/src/transform_snap.c154
-rw-r--r--source/blender/src/usiblender.c12
-rw-r--r--source/blender/src/view.c60
39 files changed, 755 insertions, 205 deletions
diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h
index b5e34444d13..716eac81b55 100644
--- a/source/blender/blenkernel/BKE_action.h
+++ b/source/blender/blenkernel/BKE_action.h
@@ -44,6 +44,7 @@ struct bActionChannel;
struct bPose;
struct bPoseChannel;
struct Object;
+struct ID;
/* Kernel prototypes */
#ifdef __cplusplus
@@ -157,6 +158,10 @@ void rest_pose(struct bPose *pose);
float get_action_frame(struct Object *ob, float cframe);
/* map strip time to global time (frame nr) */
float get_action_frame_inv(struct Object *ob, float cframe);
+/* builds a list of NlaIpoChannel with ipo values to write in datablock */
+void extract_ipochannels_from_action(ListBase *lb, struct ID *id, struct bAction *act, char *name, float ctime);
+/* write values returned by extract_ipochannels_from_action, returns the number of value written */
+int execute_ipochannels(ListBase *lb);
#ifdef __cplusplus
};
diff --git a/source/blender/blenkernel/BKE_key.h b/source/blender/blenkernel/BKE_key.h
index a6871aa837f..faf8692b89a 100644
--- a/source/blender/blenkernel/BKE_key.h
+++ b/source/blender/blenkernel/BKE_key.h
@@ -40,6 +40,11 @@ struct Object;
struct Lattice;
struct Mesh;
+/* Kernel prototypes */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void free_key(struct Key *sc);
struct Key *add_key(struct ID *id);
struct Key *copy_key(struct Key *key);
@@ -57,6 +62,12 @@ int do_ob_key(struct Object *ob);
struct Key *ob_get_key(struct Object *ob);
struct KeyBlock *ob_get_keyblock(struct Object *ob);
struct KeyBlock *key_get_keyblock(struct Key *key, int index);
+// needed for the GE
+void do_rel_key(int start, int end, int tot, char *basispoin, struct Key *key, int mode);
+
+#ifdef __cplusplus
+};
+#endif
#endif
diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h
index c50f5498de9..2bd528ab8c8 100644
--- a/source/blender/blenkernel/BKE_scene.h
+++ b/source/blender/blenkernel/BKE_scene.h
@@ -53,7 +53,7 @@ struct RenderData;
}
/* note; doesn't work when scene is empty */
-#define SETLOOPER(s, b) sce= s, b= sce->base.first; b; b= (b->next?b->next:sce->set?(sce=sce->set)->base.first:NULL)
+#define SETLOOPER(s, b) sce= s, b= (Base*)sce->base.first; b; b= (Base*)(b->next?b->next:sce->set?(sce=sce->set)->base.first:NULL)
void free_avicodecdata(struct AviCodecData *acd);
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 5fb3d6f869a..05f2e69fce1 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -290,6 +290,12 @@ void copy_pose(bPose **dst, bPose *src, int copycon)
return;
}
+ if (*dst==src) {
+ printf("copy_pose source and target are the same\n");
+ *dst=NULL;
+ return;
+ }
+
outPose= MEM_callocN(sizeof(bPose), "pose");
duplicatelist(&outPose->chanbase, &src->chanbase);
@@ -740,6 +746,11 @@ void extract_pose_from_pose(bPose *pose, const bPose *src)
const bPoseChannel *schan;
bPoseChannel *pchan= pose->chanbase.first;
+ if (pose==src) {
+ printf("extract_pose_from_pose source and target are the same\n");
+ return;
+ }
+
for (schan=src->chanbase.first; schan; schan=schan->next, pchan= pchan->next) {
copy_pose_channel_data(pchan, schan);
}
@@ -817,6 +828,12 @@ void copy_pose_result(bPose *to, bPose *from)
return;
}
+ if (to==from) {
+ printf("copy_pose_result source and target are the same\n");
+ return;
+ }
+
+
for(pchanfrom= from->chanbase.first; pchanfrom; pchanfrom= pchanfrom->next) {
pchanto= get_pose_channel(to, pchanfrom->name);
if(pchanto) {
@@ -843,7 +860,7 @@ typedef struct NlaIpoChannel {
int type;
} NlaIpoChannel;
-static void extract_ipochannels_from_action(ListBase *lb, ID *id, bAction *act, char *name, float ctime)
+void extract_ipochannels_from_action(ListBase *lb, ID *id, bAction *act, char *name, float ctime)
{
bActionChannel *achan= get_action_channel(act, name);
IpoCurve *icu;
@@ -936,15 +953,18 @@ static void blend_ipochannels(ListBase *dst, ListBase *src, float srcweight, int
}
}
-static void execute_ipochannels(ListBase *lb)
+int execute_ipochannels(ListBase *lb)
{
NlaIpoChannel *nic;
+ int count = 0;
for(nic= lb->first; nic; nic= nic->next) {
if(nic->poin) {
write_ipo_poin(nic->poin, nic->type, nic->val);
+ count++;
}
}
+ return count;
}
/* nla timing */
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index eca10e5b079..fb7d59c137a 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -1709,13 +1709,13 @@ static void execute_posetree(Object *ob, PoseTree *tree)
if (tree->totchannel == 0)
return;
-
+
iktree= MEM_mallocN(sizeof(void*)*tree->totchannel, "ik tree");
for(a=0; a<tree->totchannel; a++) {
pchan= tree->pchan[a];
bone= pchan->bone;
-
+
/* set DoF flag */
flag= 0;
if(!(pchan->ikflag & BONE_IK_NO_XDOF) && !(pchan->ikflag & BONE_IK_NO_XDOF_TEMP))
@@ -1724,32 +1724,32 @@ static void execute_posetree(Object *ob, PoseTree *tree)
flag |= IK_YDOF;
if(!(pchan->ikflag & BONE_IK_NO_ZDOF) && !(pchan->ikflag & BONE_IK_NO_ZDOF_TEMP))
flag |= IK_ZDOF;
-
+
if(tree->stretch && (pchan->ikstretch > 0.0)) {
flag |= IK_TRANS_YDOF;
hasstretch = 1;
}
-
+
seg= iktree[a]= IK_CreateSegment(flag);
-
+
/* find parent */
if(a == 0)
parent= NULL;
else
parent= iktree[tree->parent[a]];
-
+
IK_SetParent(seg, parent);
-
+
/* get the matrix that transforms from prevbone into this bone */
Mat3CpyMat4(R_bonemat, pchan->pose_mat);
-
+
/* gather transformations for this IK segment */
-
+
if (pchan->parent)
Mat3CpyMat4(R_parmat, pchan->parent->pose_mat);
else
Mat3One(R_parmat);
-
+
/* bone offset */
if (pchan->parent && (a > 0))
VecSubf(start, pchan->pose_head, pchan->parent->pose_tail);
@@ -1759,37 +1759,37 @@ static void execute_posetree(Object *ob, PoseTree *tree)
/* change length based on bone size */
length= bone->length*VecLength(R_bonemat[1]);
-
+
/* compute rest basis and its inverse */
Mat3CpyMat3(rest_basis, bone->bone_mat);
Mat3CpyMat3(irest_basis, bone->bone_mat);
Mat3Transp(irest_basis);
-
+
/* compute basis with rest_basis removed */
Mat3Inv(iR_parmat, R_parmat);
Mat3MulMat3(full_basis, iR_parmat, R_bonemat);
Mat3MulMat3(basis, irest_basis, full_basis);
-
+
/* basis must be pure rotation */
Mat3Ortho(basis);
-
+
/* transform offset into local bone space */
Mat3Ortho(iR_parmat);
Mat3MulVecfl(iR_parmat, start);
-
+
IK_SetTransform(seg, start, rest_basis, basis, length);
-
+
if (pchan->ikflag & BONE_IK_XLIMIT)
IK_SetLimit(seg, IK_X, pchan->limitmin[0], pchan->limitmax[0]);
if (pchan->ikflag & BONE_IK_YLIMIT)
IK_SetLimit(seg, IK_Y, pchan->limitmin[1], pchan->limitmax[1]);
if (pchan->ikflag & BONE_IK_ZLIMIT)
IK_SetLimit(seg, IK_Z, pchan->limitmin[2], pchan->limitmax[2]);
-
+
IK_SetStiffness(seg, IK_X, pchan->stiffness[0]);
IK_SetStiffness(seg, IK_Y, pchan->stiffness[1]);
IK_SetStiffness(seg, IK_Z, pchan->stiffness[2]);
-
+
if(tree->stretch && (pchan->ikstretch > 0.0)) {
float ikstretch = pchan->ikstretch*pchan->ikstretch;
IK_SetStiffness(seg, IK_TRANS_Y, MIN2(1.0-ikstretch, 0.99));
@@ -1818,7 +1818,7 @@ static void execute_posetree(Object *ob, PoseTree *tree)
for (target=tree->targets.first; target; target=target->next) {
float polepos[3];
int poleconstrain= 0;
-
+
data= (bKinematicConstraint*)target->con->data;
/* 1.0=ctime, we pass on object for auto-ik (owner-type here is object, even though
@@ -1835,7 +1835,7 @@ static void execute_posetree(Object *ob, PoseTree *tree)
/* same for pole vector target */
if(data->poletar) {
get_constraint_target_matrix(target->con, 1, CONSTRAINT_OBTYPE_OBJECT, ob, rootmat, 1.0);
-
+
if(data->flag & CONSTRAINT_IK_SETANGLE) {
/* don't solve IK when we are setting the pole angle */
break;
@@ -1844,7 +1844,7 @@ static void execute_posetree(Object *ob, PoseTree *tree)
Mat4MulMat4(goal, rootmat, goalinv);
VECCOPY(polepos, goal[3]);
poleconstrain= 1;
-
+
if(data->flag & CONSTRAINT_IK_GETANGLE) {
poleangledata= data;
data->flag &= ~CONSTRAINT_IK_GETANGLE;
@@ -1903,36 +1903,35 @@ static void execute_posetree(Object *ob, PoseTree *tree)
tree->basis_change= MEM_mallocN(sizeof(float[3][3])*tree->totchannel, "ik basis change");
if(hasstretch)
ikstretch= MEM_mallocN(sizeof(float)*tree->totchannel, "ik stretch");
-
+
for(a=0; a<tree->totchannel; a++) {
IK_GetBasisChange(iktree[a], tree->basis_change[a]);
-
+
if(hasstretch) {
/* have to compensate for scaling received from parent */
float parentstretch, stretch;
-
+
pchan= tree->pchan[a];
parentstretch= (tree->parent[a] >= 0)? ikstretch[tree->parent[a]]: 1.0;
-
+
if(tree->stretch && (pchan->ikstretch > 0.0)) {
float trans[3], length;
-
+
IK_GetTranslationChange(iktree[a], trans);
length= pchan->bone->length*VecLength(pchan->pose_mat[1]);
-
+
ikstretch[a]= (length == 0.0)? 1.0: (trans[1]+length)/length;
}
else
ikstretch[a] = 1.0;
-
+
stretch= (parentstretch == 0.0)? 1.0: ikstretch[a]/parentstretch;
-
+
VecMulf(tree->basis_change[a][0], stretch);
VecMulf(tree->basis_change[a][1], stretch);
VecMulf(tree->basis_change[a][2], stretch);
-
}
-
+
IK_FreeSegment(iktree[a]);
}
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index 3b4e562a87a..dd6c7ddacd2 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -630,7 +630,7 @@ void cp_cu_key(Curve *cu, KeyBlock *kb, int start, int end)
}
-static void do_rel_key(int start, int end, int tot, char *basispoin, Key *key, int mode)
+void do_rel_key(int start, int end, int tot, char *basispoin, Key *key, int mode)
{
KeyBlock *kb;
int *ofsp, ofs[3], elemsize, b;
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index dfd76a9c9d4..e64064d01c2 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -40,6 +40,7 @@
#include "stdarg.h"
#include "math.h"
#include "float.h"
+#include "ctype.h"
#include "BLI_arithb.h"
#include "BLI_blenlib.h"
@@ -1270,7 +1271,7 @@ static void mirrorModifier_initData(ModifierData *md)
{
MirrorModifierData *mmd = (MirrorModifierData*) md;
- mmd->flag |= MOD_MIR_AXIS_X;
+ mmd->flag |= (MOD_MIR_AXIS_X | MOD_MIR_VGROUP);
mmd->tolerance = 0.001;
mmd->mirror_ob = NULL;
}
@@ -1309,6 +1310,118 @@ static void mirrorModifier_updateDepgraph(ModifierData *md, DagForest *forest,
}
}
+/* finds the best possible flipped name. For renaming; check for unique names afterwards */
+/* if strip_number: removes number extensions */
+void vertgroup_flip_name (char *name, int strip_number)
+{
+ int len;
+ char prefix[128]={""}; /* The part before the facing */
+ char suffix[128]={""}; /* The part after the facing */
+ char replace[128]={""}; /* The replacement string */
+ char number[128]={""}; /* The number extension string */
+ char *index=NULL;
+
+ len= strlen(name);
+ if(len<3) return; // we don't do names like .R or .L
+
+ /* We first check the case with a .### extension, let's find the last period */
+ if(isdigit(name[len-1])) {
+ index= strrchr(name, '.'); // last occurrance
+ if (index && isdigit(index[1]) ) { // doesnt handle case bone.1abc2 correct..., whatever!
+ if(strip_number==0)
+ strcpy(number, index);
+ *index= 0;
+ len= strlen(name);
+ }
+ }
+
+ strcpy (prefix, name);
+
+#define IS_SEPARATOR(a) ((a)=='.' || (a)==' ' || (a)=='-' || (a)=='_')
+
+ /* first case; separator . - _ with extensions r R l L */
+ if( IS_SEPARATOR(name[len-2]) ) {
+ switch(name[len-1]) {
+ case 'l':
+ prefix[len-1]= 0;
+ strcpy(replace, "r");
+ break;
+ case 'r':
+ prefix[len-1]= 0;
+ strcpy(replace, "l");
+ break;
+ case 'L':
+ prefix[len-1]= 0;
+ strcpy(replace, "R");
+ break;
+ case 'R':
+ prefix[len-1]= 0;
+ strcpy(replace, "L");
+ break;
+ }
+ }
+ /* case; beginning with r R l L , with separator after it */
+ else if( IS_SEPARATOR(name[1]) ) {
+ switch(name[0]) {
+ case 'l':
+ strcpy(replace, "r");
+ strcpy(suffix, name+1);
+ prefix[0]= 0;
+ break;
+ case 'r':
+ strcpy(replace, "l");
+ strcpy(suffix, name+1);
+ prefix[0]= 0;
+ break;
+ case 'L':
+ strcpy(replace, "R");
+ strcpy(suffix, name+1);
+ prefix[0]= 0;
+ break;
+ case 'R':
+ strcpy(replace, "L");
+ strcpy(suffix, name+1);
+ prefix[0]= 0;
+ break;
+ }
+ }
+ else if(len > 5) {
+ /* hrms, why test for a separator? lets do the rule 'ultimate left or right' */
+ index = BLI_strcasestr(prefix, "right");
+ if (index==prefix || index==prefix+len-5) {
+ if(index[0]=='r')
+ strcpy (replace, "left");
+ else {
+ if(index[1]=='I')
+ strcpy (replace, "LEFT");
+ else
+ strcpy (replace, "Left");
+ }
+ *index= 0;
+ strcpy (suffix, index+5);
+ }
+ else {
+ index = BLI_strcasestr(prefix, "left");
+ if (index==prefix || index==prefix+len-4) {
+ if(index[0]=='l')
+ strcpy (replace, "right");
+ else {
+ if(index[1]=='E')
+ strcpy (replace, "RIGHT");
+ else
+ strcpy (replace, "Right");
+ }
+ *index= 0;
+ strcpy (suffix, index+4);
+ }
+ }
+ }
+
+#undef IS_SEPARATOR
+
+ sprintf (name, "%s%s%s%s", prefix, replace, suffix, number);
+}
+
static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd,
Object *ob,
DerivedMesh *dm,
@@ -1322,6 +1435,9 @@ static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd,
int maxVerts = dm->getNumVerts(dm);
int maxEdges = dm->getNumEdges(dm);
int maxFaces = dm->getNumFaces(dm);
+ int vector_size, j, a, b;
+ bDeformGroup *def, *defb;
+ bDeformGroup **vector_def = NULL;
int (*indexMap)[2];
float mtx[4][4], imtx[4][4];
@@ -1331,6 +1447,21 @@ static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd,
result = CDDM_from_template(dm, maxVerts * 2, maxEdges * 2, maxFaces * 2);
+
+ if (mmd->flag & MOD_MIR_VGROUP) {
+ /* calculate the number of deformedGroups */
+ for(vector_size = 0, def = ob->defbase.first; def;
+ def = def->next, vector_size++);
+
+ /* load the deformedGroups for fast access */
+ vector_def =
+ (bDeformGroup **)MEM_mallocN(sizeof(bDeformGroup*) * vector_size,
+ "group_index");
+ for(a = 0, def = ob->defbase.first; def; def = def->next, a++) {
+ vector_def[a] = def;
+ }
+ }
+
if (mmd->mirror_ob) {
float obinv[4][4];
@@ -1375,16 +1506,48 @@ static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd,
mv->flag |= ME_VERT_MERGED;
} else {
MVert *mv2 = CDDM_get_vert(result, numVerts);
+ MDeformVert *dvert = NULL;
DM_copy_vert_data(dm, result, i, numVerts, 1);
*mv2 = *mv;
- numVerts++;
co[axis] = -co[axis];
if (mmd->mirror_ob) {
VecMat4MulVecfl(co, imtx, co);
}
VecCopyf(mv2->co, co);
+
+ if (mmd->flag & MOD_MIR_VGROUP){
+ dvert = DM_get_vert_data(result, numVerts, CD_MDEFORMVERT);
+
+ if (dvert)
+ {
+ for(j = 0; j < dvert[0].totweight; ++j)
+ {
+ char tmpname[32];
+
+ if(dvert->dw[j].def_nr < 0 ||
+ dvert->dw[j].def_nr >= vector_size)
+ continue;
+
+ def = vector_def[dvert->dw[j].def_nr];
+ strcpy(tmpname, def->name);
+ vertgroup_flip_name(tmpname,0);
+
+ for(b = 0, defb = ob->defbase.first; defb;
+ defb = defb->next, b++)
+ {
+ if(!strcmp(defb->name, tmpname))
+ {
+ dvert->dw[j].def_nr = b;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ numVerts++;
}
}
@@ -1468,6 +1631,8 @@ static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd,
}
}
+ if (vector_def) MEM_freeN(vector_def);
+
MEM_freeN(indexMap);
CDDM_lower_num_verts(result, numVerts);
@@ -4361,13 +4526,13 @@ static void castModifier_deformVertsEM(
/* Wave */
-static void waveModifier_initData(ModifierData *md)
+static void waveModifier_initData(ModifierData *md)
{
WaveModifierData *wmd = (WaveModifierData*) md; // whadya know, moved here from Iraq
-
+
wmd->flag |= (MOD_WAVE_X | MOD_WAVE_Y | MOD_WAVE_CYCL
| MOD_WAVE_NORM_X | MOD_WAVE_NORM_Y | MOD_WAVE_NORM_Z);
-
+
wmd->objectcenter = NULL;
wmd->texture = NULL;
wmd->map_object = NULL;
@@ -4377,6 +4542,7 @@ static void waveModifier_initData(ModifierData *md)
wmd->narrow= 1.5f;
wmd->lifetime= 0.0f;
wmd->damp= 10.0f;
+ wmd->falloff= 0.0f;
wmd->texmapping = MOD_WAV_MAP_LOCAL;
wmd->defgrp_name[0] = 0;
}
@@ -4396,6 +4562,7 @@ static void waveModifier_copyData(ModifierData *md, ModifierData *target)
twmd->starty = wmd->starty;
twmd->timeoffs = wmd->timeoffs;
twmd->width = wmd->width;
+ twmd->falloff = wmd->falloff;
twmd->objectcenter = wmd->objectcenter;
twmd->texture = wmd->texture;
twmd->map_object = wmd->map_object;
@@ -4606,7 +4773,7 @@ static void waveModifier_do(
if(x > wmd->lifetime) {
lifefac = x - wmd->lifetime;
-
+
if(lifefac > wmd->damp) lifefac = 0.0;
else lifefac =
(float)(wmd->height * (1.0 - sqrt(lifefac / wmd->damp)));
@@ -4627,6 +4794,8 @@ static void waveModifier_do(
float x = co[0] - wmd->startx;
float y = co[1] - wmd->starty;
float amplit= 0.0f;
+ float dist = 0.0f;
+ float falloff_fac = 0.0f;
TexResult texres;
MDeformWeight *def_weight = NULL;
@@ -4649,14 +4818,29 @@ static void waveModifier_do(
get_texture_value(wmd->texture, tex_co[i], &texres);
}
+ /*get dist*/
+ if(wmd->flag & MOD_WAVE_X) {
+ if(wmd->flag & MOD_WAVE_Y){
+ dist = (float)sqrt(x*x + y*y);
+ }
+ else{
+ dist = fabs(x);
+ }
+ }
+ else if(wmd->flag & MOD_WAVE_Y) {
+ dist = fabs(y);
+ }
+
+ falloff_fac = (1.0-(dist / wmd->falloff));
+ CLAMP(falloff_fac,0,1);
if(wmd->flag & MOD_WAVE_X) {
if(wmd->flag & MOD_WAVE_Y) amplit = (float)sqrt(x*x + y*y);
else amplit = x;
}
- else if(wmd->flag & MOD_WAVE_Y)
+ else if(wmd->flag & MOD_WAVE_Y)
amplit= y;
-
+
/* this way it makes nice circles */
amplit -= (ctime - wmd->timeoffs) * wmd->speed;
@@ -4669,12 +4853,19 @@ static void waveModifier_do(
if(amplit > -wmd->width && amplit < wmd->width) {
amplit = amplit * wmd->narrow;
amplit = (float)(1.0 / exp(amplit * amplit) - minfac);
+
+ /*apply texture*/
if(wmd->texture)
amplit = amplit * texres.tin;
+ /*apply weight*/
if(def_weight)
amplit = amplit * def_weight->weight;
+ /*apply falloff*/
+ if (wmd->falloff > 0)
+ amplit = amplit * falloff_fac;
+
if(mvert) {
/* move along normals */
if(wmd->flag & MOD_WAVE_NORM_X) {
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 125243bc56f..b72d9a0b044 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1100,6 +1100,8 @@ static void copy_object_pose(Object *obn, Object *ob)
{
bPoseChannel *chan;
+ /* note: need to clear obn->pose pointer first, so that copy_pose works (otherwise there's a crash) */
+ obn->pose= NULL;
copy_pose(&obn->pose, ob->pose, 1); /* 1 = copy constraints */
for (chan = obn->pose->chanbase.first; chan; chan=chan->next){
diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c
index 86e395b3770..92544f19721 100644
--- a/source/blender/blenkernel/intern/sca.c
+++ b/source/blender/blenkernel/intern/sca.c
@@ -411,6 +411,7 @@ void init_actuator(bActuator *act)
switch(act->type) {
#ifdef __NLA
case ACT_ACTION:
+ case ACT_SHAPEACTION:
act->data= MEM_callocN(sizeof(bActionActuator), "actionact");
break;
#endif
diff --git a/source/blender/blenlib/intern/util.c b/source/blender/blenlib/intern/util.c
index a353015052c..5a85fbfc375 100644
--- a/source/blender/blenlib/intern/util.c
+++ b/source/blender/blenlib/intern/util.c
@@ -905,8 +905,11 @@ void BLI_cleanup_file(const char *relabase, char *dir)
if (dir[a] == '\\') break;
a--;
}
- memmove( dir+a, eind, strlen(eind)+1 );
-
+ if (a<0) {
+ break;
+ } else {
+ memmove( dir+a, eind, strlen(eind)+1 );
+ }
}
while ( (start = strstr(dir,"\\.\\")) ){
@@ -939,7 +942,11 @@ void BLI_cleanup_file(const char *relabase, char *dir)
if (dir[a] == '/') break;
a--;
}
- memmove( dir+a, eind, strlen(eind)+1 );
+ if (a<0) {
+ break;
+ } else {
+ memmove( dir+a, eind, strlen(eind)+1 );
+ }
}
while ( (start = strstr(dir,"/./")) ){
@@ -1128,8 +1135,8 @@ int BLI_convertstringcode(char *path, const char *basepath)
char vol[3] = {'\0', '\0', '\0'};
BLI_strncpy(vol, path, 3);
- wasrelative= (strncmp(vol, "//", 2)==0);
-
+ wasrelative= (vol[0]=='/' && vol[1]=='/');
+
#ifdef WIN32
/* we are checking here if we have an absolute path that is not in the current
blend file as a lib main - we are basically checking for the case that a
@@ -1166,7 +1173,7 @@ int BLI_convertstringcode(char *path, const char *basepath)
/* Paths starting with // will get the blend file as their base,
* this isnt standard in any os but is uesed in blender all over the place */
- if (tmp[0] == '/' && tmp[1] == '/') {
+ if (wasrelative) {
char *lslash= BLI_last_slash(base);
if (lslash) {
int baselen= (int) (lslash-base) + 1;
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 7d0dd9e41c1..fa7cbb06139 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2991,6 +2991,10 @@ static void lib_link_object(FileData *fd, Main *main)
bActionActuator *aa= act->data;
aa->act= newlibadr(fd, ob->id.lib, aa->act);
}
+ else if(act->type==ACT_SHAPEACTION) {
+ bActionActuator *aa= act->data;
+ aa->act= newlibadr(fd, ob->id.lib, aa->act);
+ }
else if(act->type==ACT_PROPERTY) {
bPropertyActuator *pa= act->data;
pa->ob= newlibadr(fd, ob->id.lib, pa->ob);
@@ -8399,6 +8403,10 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob)
bActionActuator *aa= act->data;
expand_doit(fd, mainvar, aa->act);
}
+ else if(act->type==ACT_SHAPEACTION) {
+ bActionActuator *aa= act->data;
+ expand_doit(fd, mainvar, aa->act);
+ }
else if(act->type==ACT_PROPERTY) {
bPropertyActuator *pa= act->data;
expand_doit(fd, mainvar, pa->ob);
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index b4a9f225470..2595b95bbf0 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -664,6 +664,7 @@ static void write_actuators(WriteData *wd, ListBase *lb)
switch(act->type) {
case ACT_ACTION:
+ case ACT_SHAPEACTION:
writestruct(wd, DATA, "bActionActuator", 1, act->data);
break;
case ACT_SOUND:
diff --git a/source/blender/imbuf/intern/cineon/dpxlib.c b/source/blender/imbuf/intern/cineon/dpxlib.c
index a81e632a797..500c09ba265 100644
--- a/source/blender/imbuf/intern/cineon/dpxlib.c
+++ b/source/blender/imbuf/intern/cineon/dpxlib.c
@@ -441,10 +441,15 @@ intern_dpxOpen(int mode, const char* bytestuff, int bufsize) {
default: break;
}
}
- dpx->bitsPerPixel = 10;
- /* dpx->bitsPerPixel = header.imageInfo.channel[0].bits_per_pixel; */
- dpx->imageOffset = ntohl(header.fileInfo.offset);
+ /* dpx->bitsPerPixel = 10; */
+ dpx->bitsPerPixel = header.imageInfo.channel[0].bits_per_pixel;
+ if (dpx->bitsPerPixel != 10) {
+ if (verbose) d_printf("Don't support depth: %d\n", dpx->bitsPerPixel);
+ dpxClose(dpx);
+ return 0;
+ }
+ dpx->imageOffset = ntohl(header.fileInfo.offset);
dpx->lineBufferLength = pixelsToLongs(dpx->width * dpx->depth);
dpx->lineBuffer = malloc(dpx->lineBufferLength * 4);
if (dpx->lineBuffer == 0) {
@@ -471,6 +476,26 @@ intern_dpxOpen(int mode, const char* bytestuff, int bufsize) {
dpx->fileYPos = 0;
logImageGetByteConversionDefaults(&dpx->params);
+ /* The SMPTE define this code:
+ * 2 - Linear
+ * 3 - Logarithmic
+ *
+ * Note that transfer_characteristics is U8, don't need
+ * check the byte order.
+ */
+ switch (header.imageInfo.channel[0].transfer_characteristics) {
+ case 2:
+ dpx->params.doLogarithm= 0;
+ break;
+ case 3:
+ dpx->params.doLogarithm= 1;
+ break;
+ default:
+ if (verbose) d_printf("Un-supported Transfer Characteristics: %d\n", header.imageInfo.channel[0].transfer_characteristics);
+ dpxClose(dpx);
+ return 0;
+ break;
+ }
setupLut(dpx);
dpx->getRow = &dpxGetRowBytes;
@@ -563,6 +588,18 @@ dpxCreate(const char* filename, int width, int height, int depth) {
++shortFilename;
}
initDpxMainHeader(dpx, &header, shortFilename);
+ logImageGetByteConversionDefaults(&dpx->params);
+ /* Need set the file type before write the header!
+ * 2 - Linear
+ * 3 - Logarithmic
+ *
+ * Note that transfer characteristics is U8, don't need
+ * check the byte order.
+ */
+ if (dpx->params.doLogarithm == 0)
+ header.imageInfo.channel[0].transfer_characteristics= 2;
+ else
+ header.imageInfo.channel[0].transfer_characteristics= 3;
if (fwrite(&header, sizeof(header), 1, dpx->file) == 0) {
if (verbose) d_printf("Couldn't write image header\n");
@@ -570,8 +607,6 @@ dpxCreate(const char* filename, int width, int height, int depth) {
return 0;
}
dpx->fileYPos = 0;
-
- logImageGetByteConversionDefaults(&dpx->params);
setupLut(dpx);
dpx->getRow = 0;
diff --git a/source/blender/include/BDR_editcurve.h b/source/blender/include/BDR_editcurve.h
index 4604359fcc9..363a6567f3e 100644
--- a/source/blender/include/BDR_editcurve.h
+++ b/source/blender/include/BDR_editcurve.h
@@ -99,6 +99,7 @@ int bezt_compare (const void *e1, const void *e2);
void setweightNurb( void );
void setradiusNurb( void );
void smoothradiusNurb( void );
+void smoothNurb( void );
extern void undo_push_curve(char *name);
diff --git a/source/blender/include/BIF_oops.h b/source/blender/include/BIF_oops.h
index f6984a23f47..adeac4f3871 100644
--- a/source/blender/include/BIF_oops.h
+++ b/source/blender/include/BIF_oops.h
@@ -39,6 +39,10 @@ struct Mesh;
struct MetaBall;
struct Object;
struct Lamp;
+struct Camera;
+struct Texture;
+struct Lattice;
+struct bArmature;
void add_curve_oopslinks(struct Curve *cu, struct Oops *oops, short flag);
void add_from_link(struct Oops *from, struct Oops *oops);
void add_material_oopslinks(struct Material *ma, struct Oops *oops, short flag);
@@ -46,6 +50,9 @@ void add_mball_oopslinks(struct MetaBall *mb, struct Oops *oops, short flag);
void add_mesh_oopslinks(struct Mesh *me, struct Oops *oops, short flag);
void add_object_oopslinks(struct Object *ob, struct Oops *oops, short flag);
void add_lamp_oopslinks(struct Lamp *la, struct Oops *oops, short flag);
+void add_camera_oopslinks(struct Camera *ca, struct Oops *oops, short flag);
+void add_texture_oopslinks(struct Tex *tex, struct Oops *oops, short flag);
+void add_lattice_oopslinks(struct Lattice *lt, struct Oops *oops, short flag);
struct Oops *add_oops(void *id);
struct OopsLink *add_oopslink(char *name, struct Oops *oops, short type, void *from, float xof, float yof);
struct Oops *add_test_oops(void *id); /* incl links */
@@ -66,3 +73,4 @@ void test_oopslinko(struct OopsLink *ol);
#endif
+
diff --git a/source/blender/makesdna/DNA_actuator_types.h b/source/blender/makesdna/DNA_actuator_types.h
index e34b376737a..a326f5b01d6 100644
--- a/source/blender/makesdna/DNA_actuator_types.h
+++ b/source/blender/makesdna/DNA_actuator_types.h
@@ -278,6 +278,7 @@ typedef struct FreeCamera {
#define ACT_VISIBILITY 18
#define ACT_2DFILTER 19
#define ACT_PARENT 20
+#define ACT_SHAPEACTION 21
/* actuator flag */
#define ACT_SHOW 1
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index a0a41377a24..c960a78aefa 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -177,6 +177,7 @@ typedef struct MirrorModifierData {
#define MOD_MIR_AXIS_X 1<<3
#define MOD_MIR_AXIS_Y 1<<4
#define MOD_MIR_AXIS_Z 1<<5
+#define MOD_MIR_VGROUP 1<<6
typedef struct EdgeSplitModifierData {
ModifierData modifier;
@@ -329,13 +330,14 @@ typedef struct WaveModifierData {
short flag, pad;
float startx, starty, height, width;
- float narrow, speed, damp;
+ float narrow, speed, damp, falloff;
int texmapping, uvlayer_tmp;
char uvlayer_name[32];
-
+
float timeoffs, lifetime;
+ float pad1;
} WaveModifierData;
typedef struct ArmatureModifierData {
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 619dfbb43a0..af60f9ca713 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -559,6 +559,7 @@ typedef struct SpaceImaSel {
#define OOPS_IM 4096
#define OOPS_AR 8192
#define OOPS_GR 16384
+#define OOPS_CA 32768
/* SpaceOops->outlinevis */
#define SO_ALL_SCENES 0
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_math.c b/source/blender/nodes/intern/CMP_nodes/CMP_math.c
index e317998b5fc..d00ce18a44f 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_math.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_math.c
@@ -131,7 +131,23 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
{
out[0]= (int)(in[0] + 0.5f);
}
- break;
+ break;
+ case 15: /* Less Than */
+ {
+ if( in[0] < in2[0] )
+ out[0]= 1.0f;
+ else
+ out[0]= 0.0f;
+ }
+ break;
+ case 16: /* Greater Than */
+ {
+ if( in[0] > in2[0] )
+ out[0]= 1.0f;
+ else
+ out[0]= 0.0f;
+ }
+ break;
}
}
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_math.c b/source/blender/nodes/intern/SHD_nodes/SHD_math.c
index 95162e508d5..2e156cf12bf 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_math.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_math.c
@@ -174,7 +174,23 @@ bNodeStack **out)
else
out[0]->vec[0]= (int)(in[1]->vec[0] + 0.5f);
}
- break;
+ break;
+ case 15: /* Less Than */
+ {
+ if( in[0]->vec[0] < in[1]->vec[0] )
+ out[0]->vec[0]= 1.0f;
+ else
+ out[0]->vec[0]= 0.0f;
+ }
+ break;
+ case 16: /* Greater Than */
+ {
+ if( in[0]->vec[0] > in[1]->vec[0] )
+ out[0]->vec[0]= 1.0f;
+ else
+ out[0]->vec[0]= 0.0f;
+ }
+ break;
}
}
diff --git a/source/blender/python/api2_2x/Mathutils.c b/source/blender/python/api2_2x/Mathutils.c
index e63fc5ef38f..87ac3e3e6ba 100644
--- a/source/blender/python/api2_2x/Mathutils.c
+++ b/source/blender/python/api2_2x/Mathutils.c
@@ -725,28 +725,33 @@ PyObject *M_Mathutils_RotationMatrix(PyObject * self, PyObject * args)
vec->vec[0] /= norm;
vec->vec[1] /= norm;
vec->vec[2] /= norm;
-
- //create matrix
- cosAngle = (float) cos(angle);
- sinAngle = (float) sin(angle);
- mat[0] = ((vec->vec[0] * vec->vec[0]) * (1 - cosAngle)) +
- cosAngle;
- mat[1] = ((vec->vec[0] * vec->vec[1]) * (1 - cosAngle)) +
- (vec->vec[2] * sinAngle);
- mat[2] = ((vec->vec[0] * vec->vec[2]) * (1 - cosAngle)) -
- (vec->vec[1] * sinAngle);
- mat[3] = ((vec->vec[0] * vec->vec[1]) * (1 - cosAngle)) -
- (vec->vec[2] * sinAngle);
- mat[4] = ((vec->vec[1] * vec->vec[1]) * (1 - cosAngle)) +
- cosAngle;
- mat[5] = ((vec->vec[1] * vec->vec[2]) * (1 - cosAngle)) +
- (vec->vec[0] * sinAngle);
- mat[6] = ((vec->vec[0] * vec->vec[2]) * (1 - cosAngle)) +
- (vec->vec[1] * sinAngle);
- mat[7] = ((vec->vec[1] * vec->vec[2]) * (1 - cosAngle)) -
- (vec->vec[0] * sinAngle);
- mat[8] = ((vec->vec[2] * vec->vec[2]) * (1 - cosAngle)) +
- cosAngle;
+
+ if (isnan(vec->vec[0]) || isnan(vec->vec[1]) || isnan(vec->vec[2])) {
+ /* zero length vector, return an identity matrix, could also return an error */
+ mat[0]= mat[4] = mat[8] = 1.0f;
+ } else {
+ /* create matrix */
+ cosAngle = (float) cos(angle);
+ sinAngle = (float) sin(angle);
+ mat[0] = ((vec->vec[0] * vec->vec[0]) * (1 - cosAngle)) +
+ cosAngle;
+ mat[1] = ((vec->vec[0] * vec->vec[1]) * (1 - cosAngle)) +
+ (vec->vec[2] * sinAngle);
+ mat[2] = ((vec->vec[0] * vec->vec[2]) * (1 - cosAngle)) -
+ (vec->vec[1] * sinAngle);
+ mat[3] = ((vec->vec[0] * vec->vec[1]) * (1 - cosAngle)) -
+ (vec->vec[2] * sinAngle);
+ mat[4] = ((vec->vec[1] * vec->vec[1]) * (1 - cosAngle)) +
+ cosAngle;
+ mat[5] = ((vec->vec[1] * vec->vec[2]) * (1 - cosAngle)) +
+ (vec->vec[0] * sinAngle);
+ mat[6] = ((vec->vec[0] * vec->vec[2]) * (1 - cosAngle)) +
+ (vec->vec[1] * sinAngle);
+ mat[7] = ((vec->vec[1] * vec->vec[2]) * (1 - cosAngle)) -
+ (vec->vec[0] * sinAngle);
+ mat[8] = ((vec->vec[2] * vec->vec[2]) * (1 - cosAngle)) +
+ cosAngle;
+ }
} else {
return EXPP_ReturnPyObjError(PyExc_AttributeError,
"Mathutils.RotationMatrix(): unrecognizable axis of rotation type - expected x,y,z or r\n");
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index 89a0a5ba7cb..796a99ca796 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -4434,7 +4434,7 @@ void RE_Database_Free(Render *re)
LampRen *lar;
/* statistics for debugging render memory usage */
- if(G.f & G_DEBUG) {
+ if((G.f & G_DEBUG) && (G.rendering)) {
if((re->r.scemode & R_PREVIEWBUTS)==0) {
BKE_image_print_memlist();
MEM_printmemlist_stats();
diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c
index 796272eab2e..f3258b601de 100644
--- a/source/blender/render/intern/source/shadbuf.c
+++ b/source/blender/render/intern/source/shadbuf.c
@@ -636,7 +636,7 @@ static float readshadowbuf(ShadBuf *shb, ShadSampleBuf *shsample, int bias, int
else {
/* got warning on this for 64 bits.... */
/* but it's working code! in this case rz is not a pointer but zvalue (ton) */
- zsamp= (int) rz;
+ zsamp= GET_INT_FROM_POINTER(rz);
}
/* tricky stuff here; we use ints which can overflow easily with bias values */
@@ -816,7 +816,7 @@ static float readshadowbuf_halo(ShadBuf *shb, ShadSampleBuf *shsample, int xs, i
else {
/* same as before */
/* still working code! (ton) */
- zsamp= (int) rz;
+ zsamp= GET_INT_FROM_POINTER(rz);
}
/* NO schadow when sampled at 'eternal' distance */
diff --git a/source/blender/src/CMakeLists.txt b/source/blender/src/CMakeLists.txt
index d6874cdd4db..342579fb3b0 100644
--- a/source/blender/src/CMakeLists.txt
+++ b/source/blender/src/CMakeLists.txt
@@ -35,7 +35,7 @@ SET(INC
../../kernel/gen_system ../../../intern/SoundSystem ../readstreamglue
../quicktime ../../../intern/elbeem/extern
../../../intern/ghost ../../../intern/opennl/extern
- ../nodes
+ ../nodes ../../../extern/glew/include
${PYTHON_INC}
${SDL_INC}
)
diff --git a/source/blender/src/Makefile b/source/blender/src/Makefile
index c1c0ef8b1f2..001efc58b5d 100644
--- a/source/blender/src/Makefile
+++ b/source/blender/src/Makefile
@@ -143,4 +143,5 @@ ifeq ($(NAN_TWEAK_MODE), true)
CPPFLAGS += -DTWEAK_MODE
endif
+CPPFLAGS += -I$(NAN_GLEW)/include
CPPFLAGS += -I$(OPENGL_HEADERS)
diff --git a/source/blender/src/SConscript b/source/blender/src/SConscript
index f466798c40c..229cc87ef37 100644
--- a/source/blender/src/SConscript
+++ b/source/blender/src/SConscript
@@ -26,7 +26,7 @@ incs += ' #/intern/bsp/extern ../radiosity/extern/include'
incs += ' #/intern/decimation/extern ../blenloader ../python'
incs += ' ../../kernel/gen_system #/intern/SoundSystem ../readstreamglue ../nodes'
incs += ' ../quicktime #/intern/elbeem/extern'
-incs += ' #/intern/ghost #/intern/opennl/extern'
+incs += ' #/intern/ghost #/intern/opennl/extern #/extern/glew/include'
incs += ' ' + env['BF_PYTHON_INC']
diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c
index 8faad1c20ae..bdf22dfe8d8 100644
--- a/source/blender/src/buttons_editing.c
+++ b/source/blender/src/buttons_editing.c
@@ -1767,7 +1767,7 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco
} else if (md->type==eModifierType_Build) {
height = 86;
} else if (md->type==eModifierType_Mirror) {
- height = 86;
+ height = 105;
} else if (md->type==eModifierType_Bevel) {
BevelModifierData *bmd = (BevelModifierData*) md;
height = 105; /* height = 124; */
@@ -1792,7 +1792,7 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco
height = 143;
} else if (md->type==eModifierType_Wave) {
WaveModifierData *wmd = (WaveModifierData *)md;
- height = 294;
+ height = 315;
if(wmd->texmapping == MOD_WAV_MAP_OBJECT ||
wmd->texmapping == MOD_WAV_MAP_UV)
height += 19;
@@ -1904,6 +1904,7 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco
uiDefButBitS(block, TOG, MOD_MIR_AXIS_Y, B_MODIFIER_RECALC, "Y", lx+20,cy,20,19, &mmd->flag, 0, 0, 0, 0, "Enable Y axis mirror");
uiDefButBitS(block, TOG, MOD_MIR_AXIS_Z, B_MODIFIER_RECALC, "Z", lx+40,cy,20,19, &mmd->flag, 0, 0, 0, 0, "Enable Z axis mirror");
uiDefButBitS(block, TOG, MOD_MIR_CLIPPING, B_MODIFIER_RECALC, "Do Clipping", lx+60, cy, buttonWidth-60,19, &mmd->flag, 1, 2, 0, 0, "Prevents during Transform vertices to go through Mirror");
+ uiDefButBitS(block, TOG, MOD_MIR_VGROUP, B_MODIFIER_RECALC, "Mirror Vgroups", lx, (cy-=19), buttonWidth,19, &mmd->flag, 1, 2, 0, 0, "Mirror vertex groups (e.g. .R->.L)");
uiDefButBitS(block, TOG, MOD_MIR_MIRROR_U, B_MODIFIER_RECALC,
"Mirror U",
lx, (cy-=19), buttonWidth/2, 19,
@@ -2158,6 +2159,8 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Time end:", lx,(cy-=19),buttonWidth,19, &wmd->timeoffs, -MAXFRAMEF, MAXFRAMEF, 100, 0, "Specify ending frame of the wave");
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Lifetime:", lx,(cy-=19),buttonWidth,19, &wmd->lifetime, -MAXFRAMEF, MAXFRAMEF, 100, 0, "Specify the lifespan of the wave");
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Damptime:", lx,(cy-=19),buttonWidth,19, &wmd->damp, -MAXFRAMEF, MAXFRAMEF, 100, 0, "Specify the dampingtime of the wave");
+ uiDefButF(block, NUM, B_MODIFIER_RECALC, "Falloff:", lx,(cy-=19),buttonWidth,19, &wmd->falloff, 0, 100, 100, 0, "Specify the falloff radius of the waves");
+
cy -= 9;
uiBlockBeginAlign(block);
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Sta x:", lx,(cy-=19),113,19, &wmd->startx, -100.0, 100.0, 100, 0, "Starting position for the X axis");
@@ -2194,7 +2197,7 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco
&wmd->map_object,
"Object to get texture coordinates from");
}
- cy -= 9;
+ cy -= 9;
uiBlockBeginAlign(block);
uiDefButF(block, NUMSLI, B_MODIFIER_RECALC, "Speed:", lx,(cy-=19),220,19, &wmd->speed, -2.0, 2.0, 0, 0, "Specify the wave speed");
uiDefButF(block, NUMSLI, B_MODIFIER_RECALC, "Height:", lx,(cy-=19),220,19, &wmd->height, -2.0, 2.0, 0, 0, "Specify the amplitude of the wave");
@@ -2407,7 +2410,7 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco
but= uiDefBut(block, BUT, B_MODIFIER_RECALC, "Bind", lx,(cy-=24), buttonWidth,19, 0, 0, 0, 0, 0, "Bind mesh to cage");
uiButSetFunc(but,modifiers_bindMeshDeform,ob,md);
uiDefButS(block, NUM, B_NOP, "Precision:", lx,(cy-19), buttonWidth/2 + 20,19, &mmd->gridsize, 2, 10, 0.5, 0, "The grid size for binding");
- uiDefButBitS(block, TOG, MOD_MDEF_DYNAMIC_BIND, B_MODIFIER_RECALC, "Dynamic", lx+(buttonWidth+1)/2 + 20, (cy-=19), buttonWidth/2 - 20,19, &mmd->flag, 0.0, 31.0, 0, 0, "Invert vertex group influence");
+ uiDefButBitS(block, TOG, MOD_MDEF_DYNAMIC_BIND, B_MODIFIER_RECALC, "Dynamic", lx+(buttonWidth+1)/2 + 20, (cy-=19), buttonWidth/2 - 20,19, &mmd->flag, 0.0, 31.0, 0, 0, "Recompute binding dynamically on top of other deformers like Shape Keys (slower and more memory consuming!)");
}
uiBlockEndAlign(block);
} else if (md->type==eModifierType_ParticleSystem) {
diff --git a/source/blender/src/buttons_logic.c b/source/blender/src/buttons_logic.c
index 27caedf0cdd..b6877b2e2b7 100644
--- a/source/blender/src/buttons_logic.c
+++ b/source/blender/src/buttons_logic.c
@@ -677,6 +677,8 @@ static char *controller_pup(void)
static char *actuator_name(int type)
{
switch (type) {
+ case ACT_SHAPEACTION:
+ return "Shape Action";
case ACT_ACTION:
return "Action";
case ACT_OBJECT:
@@ -732,6 +734,14 @@ static char *actuator_pup(Object *owner)
"|Scene %x11|Random %x13|Message %x14|CD %x16|Game %x17"
"|Visibility %x18|2D Filter %x19|Parent %x20";
break;
+
+ case OB_MESH:
+ return "Actuators %t|Shape Action %x21|Motion %x0|Constraint %x9|Ipo %x1"
+ "|Camera %x3|Sound %x5|Property %x6|Edit Object %x10"
+ "|Scene %x11|Random %x13|Message %x14|CD %x16|Game %x17"
+ "|Visibility %x18|2D Filter %x19|Parent %x20";
+ break;
+
default:
return "Actuators %t|Motion %x0|Constraint %x9|Ipo %x1"
"|Camera %x3|Sound %x5|Property %x6|Edit Object %x10"
@@ -1433,6 +1443,7 @@ static int get_col_actuator(int type)
{
switch(type) {
case ACT_ACTION: return TH_BUT_ACTION;
+ case ACT_SHAPEACTION: return TH_BUT_ACTION;
case ACT_OBJECT: return TH_BUT_NEUTRAL;
case ACT_IPO: return TH_BUT_SETTING;
case ACT_PROPERTY: return TH_BUT_SETTING1;
@@ -1541,6 +1552,7 @@ static short draw_actuatorbuttons(bActuator *act, uiBlock *block, short xco, sho
break;
}
case ACT_ACTION:
+ case ACT_SHAPEACTION:
{
/* DrawAct */
#ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
@@ -2137,7 +2149,7 @@ static short draw_actuatorbuttons(bActuator *act, uiBlock *block, short xco, sho
uiDefBut(block, TEX, 1, "To: ",
(xco+10), (yco-(myline++*24)), (width-20), 19,
&ma->toPropName, 0, 31, 0, 0,
- "Optional send message to objects with this name only"
+ "Optional send message to objects with this name only (Prefix name with OB)"
", or empty to broadcast");
#endif
diff --git a/source/blender/src/drawaction.c b/source/blender/src/drawaction.c
index 65221dceaf9..8c4958a651a 100644
--- a/source/blender/src/drawaction.c
+++ b/source/blender/src/drawaction.c
@@ -730,7 +730,7 @@ void check_action_context(SpaceAction *saction)
for (achan=saction->action->chanbase.first; achan; achan=achan->next) {
pchan= get_pose_channel(ob->pose, achan->name);
- if (pchan) {
+ if (pchan && pchan->bone) {
if ((pchan->bone->layer & arm->layer)==0)
achan->flag |= ACHAN_HIDDEN;
else if (pchan->bone->flag & BONE_HIDDEN_P)
diff --git a/source/blender/src/drawnode.c b/source/blender/src/drawnode.c
index cea33685744..1169062fdd0 100644
--- a/source/blender/src/drawnode.c
+++ b/source/blender/src/drawnode.c
@@ -517,7 +517,7 @@ static int node_buts_math(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *b
if(block) {
uiBut *bt;
- bt=uiDefButS(block, MENU, B_NODE_EXEC, "Add %x0|Subtract %x1|Multiply %x2|Divide %x3|Sine %x4|Cosine %x5|Tangent %x6|Arcsine %x7|Arccosine %x8|Arctangent %x9|Power %x10|Logarithm %x11|Minimum %x12|Maximum %x13|Round %x14", butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, &node->custom1, 0, 0, 0, 0, "");
+ bt=uiDefButS(block, MENU, B_NODE_EXEC, "Add %x0|Subtract %x1|Multiply %x2|Divide %x3|Sine %x4|Cosine %x5|Tangent %x6|Arcsine %x7|Arccosine %x8|Arctangent %x9|Power %x10|Logarithm %x11|Minimum %x12|Maximum %x13|Round %x14|Less Than %x15|Greater Than %x16", butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, &node->custom1, 0, 0, 0, 0, "");
uiButSetFunc(bt, node_but_title_cb, node, bt);
}
return 20;
diff --git a/source/blender/src/drawoops.c b/source/blender/src/drawoops.c
index 5da38135be3..75bea40a8b4 100644
--- a/source/blender/src/drawoops.c
+++ b/source/blender/src/drawoops.c
@@ -229,6 +229,8 @@ void draw_icon_oops(float *co, short type)
case ID_LI: icon= ICON_LIBRARY_HLT; break;
case ID_IM: icon= ICON_IMAGE_HLT; break;
case ID_GR: icon= ICON_CIRCLE_DEHLT; break;
+ case ID_CA: icon= ICON_CAMERA_DEHLT; break;
+ case ID_AR: icon= ICON_ARMATURE; break;
}
glEnable(GL_BLEND);
@@ -282,6 +284,12 @@ unsigned int give_oops_color(short type, short sel, unsigned int *border)
body= 0x35659F; break;
case ID_GR:
body= 0x507050; break;
+ case ID_CA:
+ body= 0x7570A0; break;
+ case ID_LT:
+ body= 0xA08090; break;
+ case ID_AR:
+ body= 0x70B0C0; break;
default:
body= 0x606070; break;
}
@@ -516,3 +524,4 @@ void drawoopsspace(ScrArea *sa, void *spacedata)
+
diff --git a/source/blender/src/editcurve.c b/source/blender/src/editcurve.c
index bd0abe83ee4..261bb26b0c4 100644
--- a/source/blender/src/editcurve.c
+++ b/source/blender/src/editcurve.c
@@ -1158,6 +1158,62 @@ void setradiusNurb( void )
allqueue(REDRAWINFO, 1); /* 1, because header->win==0! */
}
+void smoothNurb( void )
+{
+
+ extern ListBase editNurb;
+ Nurb *nu;
+ BezTriple *bezt, *beztOrig;
+ BPoint *bp, *bpOrig;
+ int a, i, change = 0;
+
+ /* floats for smoothing */
+ float val, newval, offset;
+
+ for(nu= editNurb.first; nu; nu= nu->next) {
+ if(nu->bezt) {
+ change = 0;
+ beztOrig = MEM_dupallocN( nu->bezt );
+ for(bezt=nu->bezt+1, a=1; a<nu->pntsu-1; a++, bezt++) {
+ if(bezt->f2 & SELECT) {
+ for(i=0; i<3; i++) {
+ val = bezt->vec[1][i];
+ newval = ((beztOrig+(a-1))->vec[1][i] * 0.5) + ((beztOrig+(a+1))->vec[1][i] * 0.5);
+ offset = (val*((1.0/6.0)*5)) + (newval*(1.0/6.0)) - val;
+ /* offset handles */
+ bezt->vec[1][i] += offset;
+ bezt->vec[0][i] += offset;
+ bezt->vec[2][i] += offset;
+ }
+ change = 1;
+ }
+ }
+ MEM_freeN(beztOrig);
+ if (change)
+ calchandlesNurb(nu);
+ } else if (nu->bp) {
+ bpOrig = MEM_dupallocN( nu->bp );
+ /* Same as above, keep these the same! */
+ for(bp=nu->bp+1, a=1; a<nu->pntsu-1; a++, bp++) {
+ if(bp->f1 & SELECT) {
+ for(i=0; i<3; i++) {
+ val = bp->vec[i];
+ newval = ((bpOrig+(a-1))->vec[i] * 0.5) + ((bpOrig+(a+1))->vec[i] * 0.5);
+ offset = (val*((1.0/6.0)*5)) + (newval*(1.0/6.0)) - val;
+
+ bp->vec[i] += offset;
+ }
+ }
+ }
+ MEM_freeN(bpOrig);
+ }
+ }
+ BIF_undo_push("Smooth Curve");
+ DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
+ allqueue(REDRAWVIEW3D, 0);
+ allqueue(REDRAWBUTSALL, 0);
+ allqueue(REDRAWINFO, 1); /* 1, because header->win==0! */
+}
/* TODO, make smoothing distance based */
void smoothradiusNurb( void )
diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c
index 4029e031b63..3c945775b5b 100644
--- a/source/blender/src/editobject.c
+++ b/source/blender/src/editobject.c
@@ -2735,7 +2735,7 @@ void special_editmenu(void)
}
else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
- nr= pupmenu("Specials%t|Subdivide%x1|Switch Direction%x2|Set Goal Weight %x3|Set Radius %x4|Smooth Radius %x5");
+ nr= pupmenu("Specials%t|Subdivide%x1|Switch Direction%x2|Set Goal Weight%x3|Set Radius%x4|Smooth%x5|Smooth Radius%x6");
switch(nr) {
case 1:
@@ -2751,6 +2751,9 @@ void special_editmenu(void)
setradiusNurb();
break;
case 5:
+ smoothNurb();
+ break;
+ case 6:
smoothradiusNurb();
break;
}
diff --git a/source/blender/src/header_oops.c b/source/blender/src/header_oops.c
index 7bfbf0ee667..ad65705b79d 100644
--- a/source/blender/src/header_oops.c
+++ b/source/blender/src/header_oops.c
@@ -509,8 +509,9 @@ void oops_buttons(void)
uiDefIconButBitS(block, TOG, OOPS_IM, B_NEWOOPS, ICON_IMAGE_HLT, (short)(xco+=XIC),0,XIC,YIC, &soops->visiflag, 0, 0, 0, 0, "Displays Image datablocks");
uiDefIconButBitS(block, TOG, OOPS_GR, B_NEWOOPS, ICON_CIRCLE_DEHLT, (short)(xco+=XIC),0,XIC,YIC, &soops->visiflag, 0, 0, 0, 0, "Displays Group datablocks");
uiDefIconButBitS(block, TOG, OOPS_LI, B_NEWOOPS, ICON_LIBRARY_HLT, (short)(xco+=XIC),0,XIC,YIC, &soops->visiflag, 0, 0, 0, 0, "Displays Library datablocks");
+ uiDefIconButBitS(block, TOG, OOPS_CA, B_NEWOOPS, ICON_CAMERA_DEHLT, (short)(xco+=XIC),0,XIC,YIC, &soops->visiflag, 0, 0, 0, 0, "Displays Camera datablocks");
+ uiDefIconButBitS(block, TOG, OOPS_AR, B_NEWOOPS, ICON_ARMATURE, (short)(xco+=XIC),0,XIC,YIC, &soops->visiflag, 0, 0, 0, 0, "Displays Armature datablocks");
-
uiBlockEndAlign(block);
/* name */
@@ -576,3 +577,4 @@ void oops_buttons(void)
uiDrawBlock(block);
}
+
diff --git a/source/blender/src/oops.c b/source/blender/src/oops.c
index 1f851d2fa6c..99645b5e71f 100644
--- a/source/blender/src/oops.c
+++ b/source/blender/src/oops.c
@@ -48,6 +48,9 @@
#include "DNA_texture_types.h"
#include "DNA_key_types.h"
#include "DNA_group_types.h"
+#include "DNA_camera_types.h"
+#include "DNA_lattice_types.h"
+#include "DNA_armature_types.h"
#include "BKE_utildefines.h"
#include "BKE_global.h"
@@ -661,7 +664,6 @@ void add_material_oopslinks(Material *ma, Oops *oops, short flag)
add_oopslink("group", oops, ID_GR, &(ma->group), OOPSX, (float)(0.5*OOPSY));
}
-
void add_group_oopslinks(Group *gp, Oops *oops, short flag)
{
GroupObject *gob;
@@ -672,7 +674,6 @@ void add_group_oopslinks(Group *gp, Oops *oops, short flag)
}
}
-
void add_object_oopslinks(Object *ob, Oops *oops, short flag)
{
ID *id;
@@ -698,6 +699,12 @@ void add_object_oopslinks(Object *ob, Oops *oops, short flag)
case ID_LA:
if(flag & OOPS_LA) add_oopslink("data", oops, ID_LA, &ob->data, (float)(.5*OOPSX), (float)OOPSY);
break;
+ case ID_CA:
+ if(flag & OOPS_CA) add_oopslink("data", oops, ID_CA, &ob->data, (float)(.5*OOPSX), (float)OOPSY);
+ break;
+ case ID_AR:
+ if(flag & OOPS_AR) add_oopslink("data", oops, ID_AR, &ob->data, (float)(.5*OOPSX), (float)OOPSY);
+ break;
}
}
@@ -748,7 +755,6 @@ void add_curve_oopslinks(Curve *cu, Oops *oops, short flag)
add_oopslink("speed", oops, ID_IP, &cu->ipo, OOPSX, (float)(0.5*OOPSY));
if(cu->key) add_oopslink("ipo", oops, ID_IP, &cu->key->ipo, OOPSX, (float)(0.5*OOPSY));
}
-
}
void add_mball_oopslinks(MetaBall *mb, Oops *oops, short flag)
@@ -775,15 +781,36 @@ void add_lamp_oopslinks(Lamp *la, Oops *oops, short flag)
}
}
}
+ if(flag & OOPS_IP) {
+ add_oopslink("ipo", oops, ID_IP, &la->ipo, OOPSX, (float)(0.5*OOPSY));
+ }
+}
+
+void add_camera_oopslinks(Camera *ca, Oops *oops, short flag)
+{
+ if(flag & OOPS_IP) {
+ add_oopslink("ipo", oops, ID_IP, &ca->ipo, OOPSX, (float)(0.5*OOPSY));
+ }
}
+void add_texture_oopslinks(Tex *tex, Oops *oops, short flag)
+{
+ if(flag & OOPS_IM) {
+ add_oopslink("image", oops, ID_IM, &tex->ima, OOPSX, (float)(0.5*OOPSY));
+ }
+}
+
+void add_lattice_oopslinks(Lattice *lt, Oops *oops, short flag)
+{
+ if(flag & OOPS_IP) {
+ if(lt->key) add_oopslink("ipo", oops, ID_IP, &lt->key->ipo, OOPSX, (float)(0.5*OOPSY));
+ }
+}
Oops *add_test_oops(void *id) /* incl links */
{
Oops *oops;
Object *ob;
- Lamp *la;
- Tex *tex;
if(id==0) return NULL;
@@ -821,9 +848,10 @@ Oops *add_test_oops(void *id) /* incl links */
add_mball_oopslinks((MetaBall *)id, oops, G.soops->visiflag);
break;
case ID_LA:
- la= (Lamp *)id;
- add_lamp_oopslinks(la, oops, G.soops->visiflag);
- if(la->ipo) if(G.soops->visiflag & OOPS_IP) add_oopslink("ipo", oops, ID_IP, &la->ipo, OOPSX, (float)(0.3*OOPSY));
+ add_lamp_oopslinks((Lamp *)id, oops, G.soops->visiflag);
+ break;
+ case ID_CA:
+ add_camera_oopslinks((Camera *)id, oops, G.soops->visiflag);
break;
case ID_IP:
@@ -835,8 +863,14 @@ Oops *add_test_oops(void *id) /* incl links */
add_group_oopslinks((Group *)id, oops, G.soops->visiflag);
break;
case ID_TE:
- tex= (Tex *)id;
- if(tex->ima) if(G.soops->visiflag & OOPS_IM) add_oopslink("image", oops, ID_IM, &tex->ima, OOPSX, (float)(0.3*OOPSY));
+ add_texture_oopslinks((Tex *)id, oops, G.soops->visiflag);
+ break;
+ case ID_LT:
+ add_lattice_oopslinks((Lattice *)id, oops, G.soops->visiflag);
+ break;
+ case ID_AR:
+
+ break;
}
return oops;
@@ -897,7 +931,7 @@ void build_oops()
while(sce) {
oops= add_test_oops(sce);
-
+
if(G.soops->visiflag & OOPS_OB) {
base= sce->base.first;
while(base) {
@@ -912,12 +946,13 @@ void build_oops()
if(G.soops->visiflag & OOPS_OB) {
Object *ob= G.main->object.first;
-
+
while(ob) {
oops= add_test_oops(ob);
ob= ob->id.next;
}
}
+
if(G.soops->visiflag & OOPS_ME) {
Mesh *me= G.main->mesh.first;
while(me) {
@@ -925,7 +960,7 @@ void build_oops()
me= me->id.next;
}
}
-
+
if(G.soops->visiflag & OOPS_CU) {
Curve *cu= G.main->curve.first;
while(cu) {
@@ -933,7 +968,7 @@ void build_oops()
cu= cu->id.next;
}
}
-
+
if(G.soops->visiflag & OOPS_MB) {
MetaBall *mb= G.main->mball.first;
while(mb) {
@@ -941,7 +976,7 @@ void build_oops()
mb= mb->id.next;
}
}
-
+
if(G.soops->visiflag & OOPS_LA) {
Lamp *la= G.main->lamp.first;
while(la) {
@@ -950,6 +985,14 @@ void build_oops()
}
}
+ if(G.soops->visiflag & OOPS_CA) {
+ Camera *ca= G.main->camera.first;
+ while(ca) {
+ oops= add_test_oops(ca);
+ ca= ca->id.next;
+ }
+ }
+
if(G.soops->visiflag & OOPS_IP) {
Ipo *ipo= G.main->ipo.first;
while(ipo) {
@@ -972,6 +1015,7 @@ void build_oops()
tex= tex->id.next;
}
}
+
if(G.soops->visiflag & OOPS_IM) {
Image *ima= G.main->image.first;
while(ima) {
@@ -979,6 +1023,7 @@ void build_oops()
ima= ima->id.next;
}
}
+
if(G.soops->visiflag & OOPS_GR) {
Group *gp= G.main->group.first;
while(gp) {
@@ -986,6 +1031,23 @@ void build_oops()
gp= gp->id.next;
}
}
+
+ if(G.soops->visiflag & OOPS_LT) {
+ Lattice *lt= G.main->latt.first;
+ while(lt) {
+ oops= add_test_oops(lt);
+ lt= lt->id.next;
+ }
+ }
+
+ if(G.soops->visiflag & OOPS_AR) {
+ bArmature *ar= G.main->armature.first;
+ while(ar) {
+ oops= add_test_oops(ar);
+ ar= ar->id.next;
+ }
+ }
+
}
else {
@@ -1068,6 +1130,7 @@ void build_oops()
else if(type==ID_LA && G.soops->visiflag & OOPS_LA) {
Lamp *la= ob->data;
oops= add_test_oops(ob->data);
+
if(G.soops->visiflag & OOPS_IP) add_test_oops(la->ipo);
if(G.soops->visiflag & OOPS_TE) {
for(a=0; a<MAX_MTEX; a++) {
@@ -1075,14 +1138,29 @@ void build_oops()
}
}
}
+ else if(type==ID_CA && G.soops->visiflag & OOPS_CA) {
+ Camera *ca= ob->data;
+ oops= add_test_oops(ob->data);
+
+ if(G.soops->visiflag & OOPS_IP) add_test_oops(ca->ipo);
+ }
+ else if(type==ID_LT && G.soops->visiflag & OOPS_LT) {
+ Lattice *lt= ob->data;
+ oops= add_test_oops(ob->data);
+
+ if(G.soops->visiflag & OOPS_IP) {
+ if(lt->key) oops= add_test_oops(lt->key->ipo);
+ }
+ }
+ else if(type==ID_AR && G.soops->visiflag & OOPS_AR) {
+ bArmature *ar= ob->data;
+ oops= add_test_oops(ob->data);
+ }
}
}
base= base->next;
}
}
-
-
-
/* test links */
oops= G.soops->oops.first;
diff --git a/source/blender/src/transform_constraints.c b/source/blender/src/transform_constraints.c
index 769ebd2ea97..2d01c2303fc 100644
--- a/source/blender/src/transform_constraints.c
+++ b/source/blender/src/transform_constraints.c
@@ -550,6 +550,10 @@ void setUserConstraint(TransInfo *t, int mode, const char ftext[]) {
void BIF_setLocalLockConstraint(char axis, char *text) {
TransInfo *t = BIF_GetTransInfo();
+ if (t->total == 0) {
+ return;
+ }
+
switch (axis) {
case 'x':
setLocalConstraint(t, (CON_AXIS1|CON_AXIS2), text);
@@ -566,6 +570,10 @@ void BIF_setLocalLockConstraint(char axis, char *text) {
void BIF_setLocalAxisConstraint(char axis, char *text) {
TransInfo *t = BIF_GetTransInfo();
+ if (t->total == 0) {
+ return;
+ }
+
switch (axis) {
case 'X':
setLocalConstraint(t, CON_AXIS0, text);
@@ -584,6 +592,10 @@ void BIF_setSingleAxisConstraint(float vec[3], char *text) {
TransInfo *t = BIF_GetTransInfo();
float space[3][3], v[3];
+ if (t->total == 0) {
+ return;
+ }
+
VECCOPY(space[0], vec);
v[0] = vec[2];
@@ -622,6 +634,10 @@ void BIF_setDualAxisConstraint(float vec1[3], float vec2[3], char *text) {
TransInfo *t = BIF_GetTransInfo();
float space[3][3];
+ if (t->total == 0) {
+ return;
+ }
+
VECCOPY(space[0], vec1);
VECCOPY(space[1], vec2);
Crossf(space[2], space[0], space[1]);
diff --git a/source/blender/src/transform_snap.c b/source/blender/src/transform_snap.c
index 83940fa3729..295cfa4574c 100644
--- a/source/blender/src/transform_snap.c
+++ b/source/blender/src/transform_snap.c
@@ -739,9 +739,10 @@ void TargetSnapClosest(TransInfo *t)
/* find snapping point on face, return 1 on success */
-int snapFace(MFace *face, MVert *verts, float *intersect, float *loc, float *no)
+int snapFace(MFace *face, EditFace *efa, MVert *verts, float *intersect, float *loc, float *no)
{
MVert *v[4];
+ EditVert *eve[4];
int totvert;
int result = 0;
@@ -760,6 +761,14 @@ int snapFace(MFace *face, MVert *verts, float *intersect, float *loc, float *no)
totvert = 3;
}
+ if (efa)
+ {
+ eve[0] = efa->v1;
+ eve[1] = efa->v2;
+ eve[2] = efa->v3;
+ eve[3] = efa->v4;
+ }
+
switch(G.scene->snap_mode)
{
case SCE_SNAP_MODE_VERTEX:
@@ -769,16 +778,20 @@ int snapFace(MFace *face, MVert *verts, float *intersect, float *loc, float *no)
for(i = 0; i < totvert; i++)
{
- float vert_dist = VecLenf(v[i]->co, intersect);
- if (vert_dist < min_dist)
+ if (efa == NULL || (eve[i]->f1 & SELECT) == 0)
{
- result = 1;
+ float vert_dist = VecLenf(v[i]->co, intersect);
- min_dist = vert_dist;
-
- VECCOPY(loc, v[i]->co);
- NormalShortToFloat(no, v[i]->no);
+ if (vert_dist < min_dist)
+ {
+ result = 1;
+
+ min_dist = vert_dist;
+
+ VECCOPY(loc, v[i]->co);
+ NormalShortToFloat(no, v[i]->no);
+ }
}
}
break;
@@ -791,51 +804,62 @@ int snapFace(MFace *face, MVert *verts, float *intersect, float *loc, float *no)
for(i = 0; i < totvert; i++)
{
MVert *v1, *v2;
- float edge_loc[3];
- float vec[3];
- float mul;
- float edge_dist;
+ EditVert *eve1, *eve2;
v1 = v[i];
v2 = v[(i + 1) % totvert];
- VecSubf(edge_loc, v2->co, v1->co);
- VecSubf(vec, intersect, v1->co);
-
- mul = Inpf(vec, edge_loc) / Inpf(edge_loc, edge_loc);
+ eve1 = eve[i];
+ eve2 = eve[(i + 1) % totvert];
- VecMulf(edge_loc, mul);
- VecAddf(edge_loc, edge_loc, v1->co);
-
- edge_dist = VecLenf(edge_loc, intersect);
-
- if (edge_dist < min_dist)
+ if (efa == NULL || ((eve1->f1 & SELECT) == 0 && (eve2->f1 & SELECT) == 0))
{
- float n1[3], n2[3];
- result = 1;
+ float edge_loc[3];
+ float vec[3];
+ float mul;
+ float edge_dist;
- min_dist = edge_dist;
-
- VECCOPY(loc, edge_loc);
+ VecSubf(edge_loc, v2->co, v1->co);
+ VecSubf(vec, intersect, v1->co);
+
+ mul = Inpf(vec, edge_loc) / Inpf(edge_loc, edge_loc);
+
+ VecMulf(edge_loc, mul);
+ VecAddf(edge_loc, edge_loc, v1->co);
- NormalShortToFloat(n1, v1->no);
- NormalShortToFloat(n2, v2->no);
- VecLerpf(no, n1, n2, mul);
- Normalize(no);
+ edge_dist = VecLenf(edge_loc, intersect);
+
+ if (edge_dist < min_dist)
+ {
+ float n1[3], n2[3];
+ result = 1;
+
+ min_dist = edge_dist;
+
+ VECCOPY(loc, edge_loc);
+
+ NormalShortToFloat(n1, v1->no);
+ NormalShortToFloat(n2, v2->no);
+ VecLerpf(no, n1, n2, mul);
+ Normalize(no);
+ }
}
}
break;
}
case SCE_SNAP_MODE_FACE:
{
- result = 1;
-
- VECCOPY(loc, intersect);
-
- if (totvert == 4)
- CalcNormFloat4(v[0]->co, v[1]->co, v[2]->co, v[3]->co, no);
- else
- CalcNormFloat(v[0]->co, v[1]->co, v[2]->co, no);
+ if (efa == NULL || ((efa->f1 & SELECT) == 0))
+ {
+ result = 1;
+
+ VECCOPY(loc, intersect);
+
+ if (totvert == 4)
+ CalcNormFloat4(v[0]->co, v[1]->co, v[2]->co, v[3]->co, no);
+ else
+ CalcNormFloat(v[0]->co, v[1]->co, v[2]->co, no);
+ }
break;
}
}
@@ -845,7 +869,6 @@ int snapFace(MFace *face, MVert *verts, float *intersect, float *loc, float *no)
int snapDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float ray_start[3], float ray_normal[3], short mval[2], float *loc, float *no, int *dist, float *depth, short EditMesh)
{
- float object_depth = FLT_MAX;
int retval = 0;
int totvert = dm->getNumVerts(dm);
int totface = dm->getNumFaces(dm);
@@ -879,12 +902,10 @@ int snapDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float ray_sta
if (test == 1) {
MVert *verts = dm->getVertArray(dm);
MFace *faces = dm->getFaceArray(dm);
- int *index_array;
+ int *index_array = NULL;
int index = 0;
int i;
- test = 1;
-
if (EditMesh)
{
index_array = dm->getFaceDataArray(dm, CD_ORIGINDEX);
@@ -892,14 +913,15 @@ int snapDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float ray_sta
}
for( i = 0; i < totface; i++) {
+ EditFace *efa = NULL;
MFace *f = faces + i;
float lambda;
int result;
+ test = 1; /* reset for every face */
+
if (EditMesh)
{
- EditFace *efa = NULL;
-
if (index_array)
{
index = index_array[i];
@@ -917,12 +939,9 @@ int snapDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float ray_sta
{
efa = EM_get_face_for_index(index);
- if (efa)
+ if (efa && efa->f1 & SELECT)
{
- if (efa->v1->f1 & SELECT || efa->v2->f1 & SELECT || efa->v3->f1 & SELECT || (efa->v4 && efa->v4->f1 & SELECT))
- {
- test = 0;
- }
+ test = 0;
}
}
}
@@ -932,7 +951,7 @@ int snapDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float ray_sta
{
result = RayIntersectsTriangle(ray_start_local, ray_normal_local, verts[f->v1].co, verts[f->v2].co, verts[f->v3].co, &lambda, NULL);
- if (result && lambda < object_depth) {
+ if (result) {
float location[3], normal[3];
float intersect[3];
@@ -940,18 +959,21 @@ int snapDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float ray_sta
VecMulf(intersect, lambda);
VecAddf(intersect, intersect, ray_start_local);
- if (snapFace(f, verts, intersect, location, normal))
+ if (snapFace(f, efa, verts, intersect, location, normal))
{
float new_depth;
int screen_loc[2];
+ int new_dist;
Mat4MulVecfl(obmat, location);
new_depth = VecLenf(location, ray_start);
- if (new_depth < *depth)
+ project_int(location, screen_loc);
+ new_dist = abs(screen_loc[0] - mval[0]) + abs(screen_loc[1] - mval[1]);
+
+ if (new_dist <= *dist && new_depth < *depth)
{
- object_depth = lambda;
*depth = new_depth;
retval = 1;
@@ -963,7 +985,7 @@ int snapDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float ray_sta
project_int(loc, screen_loc);
- *dist = abs(screen_loc[0] - mval[0]) + abs(screen_loc[1] - mval[1]);
+ *dist = new_dist;
}
}
}
@@ -972,7 +994,7 @@ int snapDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float ray_sta
{
result = RayIntersectsTriangle(ray_start_local, ray_normal_local, verts[f->v3].co, verts[f->v4].co, verts[f->v1].co, &lambda, NULL);
- if (result && lambda < object_depth) {
+ if (result) {
float location[3], normal[3];
float intersect[3];
@@ -980,18 +1002,21 @@ int snapDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float ray_sta
VecMulf(intersect, lambda);
VecAddf(intersect, intersect, ray_start_local);
- if (snapFace(f, verts, intersect, location, normal))
+ if (snapFace(f, efa, verts, intersect, location, normal))
{
float new_depth;
int screen_loc[2];
+ int new_dist;
Mat4MulVecfl(obmat, location);
- new_depth = VecLenf(location, ray_start);
+ new_depth = VecLenf(location, ray_start);
- if (new_depth < *depth)
+ project_int(location, screen_loc);
+ new_dist = abs(screen_loc[0] - mval[0]) + abs(screen_loc[1] - mval[1]);
+
+ if (new_dist <= *dist && new_depth < *depth)
{
- object_depth = lambda;
*depth = new_depth;
retval = 1;
@@ -1001,9 +1026,7 @@ int snapDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float ray_sta
Mat3MulVecfl(timat, no);
Normalize(no);
- project_int(loc, screen_loc);
-
- *dist = abs(screen_loc[0] - mval[0]) + abs(screen_loc[1] - mval[1]);
+ *dist = new_dist;
}
}
}
@@ -1033,14 +1056,13 @@ int snapObjects(int *dist, float *loc, float *no, int mode) {
if (mode == NOT_ACTIVE)
{
- DerivedMesh *dm, *dm_cage;
+ DerivedMesh *dm;
Object *ob = G.obedit;
- dm_cage = editmesh_get_derived_cage_and_final(&dm, CD_MASK_BAREMESH);
+ dm = editmesh_get_derived_cage(CD_MASK_BAREMESH);
retval = snapDerivedMesh(ob, dm, ob->obmat, ray_start, ray_normal, mval, loc, no, dist, &depth, 1);
- dm_cage->release(dm_cage);
dm->release(dm);
}
diff --git a/source/blender/src/usiblender.c b/source/blender/src/usiblender.c
index 6c0838288b8..2a4672e3052 100644
--- a/source/blender/src/usiblender.c
+++ b/source/blender/src/usiblender.c
@@ -925,7 +925,7 @@ void BIF_write_file(char *target)
writeBlog();
} else {
- error("%s", err);
+ error("failed to write blend file: %s", err);
}
waitcursor(0);
@@ -940,7 +940,10 @@ void BIF_write_homefile(void)
/* force save as regular blend file */
write_flags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_LOCK | G_FILE_SIGN);
- BLO_write_file(tstr, write_flags, &err);
+
+ if (!BLO_write_file(tstr, write_flags, &err)) {
+ error("failed writing defaults: %s", err);
+ }
}
void BIF_write_autosave(void)
@@ -952,7 +955,9 @@ void BIF_write_autosave(void)
/* force save as regular blend file */
write_flags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_LOCK | G_FILE_SIGN);
- BLO_write_file(tstr, write_flags, &err);
+ if (!BLO_write_file(tstr, write_flags, &err)) {
+ fprintf(stderr, "failed to write autosave: %s\n", err); /* using error(...) is too annoying here */
+ }
}
/* remove temp files assosiated with this blend file when quitting, loading or saving in a new path */
@@ -1033,6 +1038,7 @@ void BIF_init(void)
BIF_filelist_init_icons();
init_gl_stuff(); /* drawview.c, after homefile */
+ glewInit();
readBlog();
BLI_strncpy(G.lib, G.sce, FILE_MAX);
}
diff --git a/source/blender/src/view.c b/source/blender/src/view.c
index 008387d5a70..356a297b284 100644
--- a/source/blender/src/view.c
+++ b/source/blender/src/view.c
@@ -753,10 +753,11 @@ void viewmoveNDOFfly(int mode)
// Apply rotation
-
- rvec[0] = -dval[3];
- rvec[1] = -dval[4];
- rvec[2] = dval[5];
+ // Rotations feel relatively faster than translations only in fly mode, so
+ // we have no choice but to fix that here (not in the plugins)
+ rvec[0] = -0.5 * dval[3];
+ rvec[1] = -0.5 * dval[4];
+ rvec[2] = -0.5 * dval[5];
// rotate device x and y by view z
@@ -824,8 +825,7 @@ void viewmove(int mode)
return;
}
- // dist correction from other movement devices
-
+ // dist correction from other movement devices
if((dz_flag)||G.vd->dist==0) {
dz_flag = 0;
G.vd->dist = m_dist;
@@ -1166,6 +1166,8 @@ void viewmoveNDOF(int mode)
float reverse;
float diff[4];
float d, curareaX, curareaY;
+ float mat[3][3];
+ float upvec[3];
/* Sensitivity will control how fast the view rotates. The value was
* obtained experimentally by tweaking until the author didn't get dizzy watching.
@@ -1186,6 +1188,16 @@ void viewmoveNDOF(int mode)
use_sel = 1;
}
+ if((dz_flag)||G.vd->dist==0) {
+ dz_flag = 0;
+ G.vd->dist = m_dist;
+ upvec[0] = upvec[1] = 0;
+ upvec[2] = G.vd->dist;
+ Mat3CpyMat4(mat, G.vd->viewinv);
+ Mat3MulVecfl(mat, upvec);
+ VecAddf(G.vd->ofs, G.vd->ofs, upvec);
+ }
+
/*----------------------------------------------------
* sometimes this routine is called from headerbuttons
* viewmove needs to refresh the screen
@@ -1212,25 +1224,25 @@ void viewmoveNDOF(int mode)
filterNDOFvalues(fval);
- // put scaling back here, was previously in ghostwinlay
- fval[0] = fval[0] * (1.0f/800.0f);
- fval[1] = fval[1] * (1.0f/800.0f);
- fval[2] = fval[2] * (1.0f/800.0f);
- fval[3] = fval[3] * 0.00005f;
- fval[4] = fval[4] * 0.00005f;
- fval[5] = fval[5] * 0.00005f;
- fval[6] = fval[6] / 1000000.0f;
+ // put scaling back here, was previously in ghostwinlay
+ fval[0] = fval[0] * (1.0f/1200.0f);
+ fval[1] = fval[1] * (1.0f/1200.0f);
+ fval[2] = fval[2] * (1.0f/1200.0f);
+ fval[3] = fval[3] * 0.00005f;
+ fval[4] =-fval[4] * 0.00005f;
+ fval[5] = fval[5] * 0.00005f;
+ fval[6] = fval[6] / 1000000.0f;
- // scale more if not in perspective mode
- if (G.vd->persp == V3D_ORTHO) {
- fval[0] = fval[0] * 0.05f;
- fval[1] = fval[1] * 0.05f;
- fval[2] = fval[2] * 0.05f;
- fval[3] = fval[3] * 0.9f;
- fval[4] = fval[4] * 0.9f;
- fval[5] = fval[5] * 0.9f;
- zsens *= 8;
- }
+ // scale more if not in perspective mode
+ if (G.vd->persp == V3D_ORTHO) {
+ fval[0] = fval[0] * 0.05f;
+ fval[1] = fval[1] * 0.05f;
+ fval[2] = fval[2] * 0.05f;
+ fval[3] = fval[3] * 0.9f;
+ fval[4] = fval[4] * 0.9f;
+ fval[5] = fval[5] * 0.9f;
+ zsens *= 8;
+ }
/* set object offset */