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/src
parent824eac5095924ffdc1fea213a925054c88bf05d7 (diff)
svn merge -r 15202:15292 https://svn.blender.org/svnroot/bf-blender/trunk/blender
Diffstat (limited to 'source/blender/src')
-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
16 files changed, 342 insertions, 122 deletions
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 */