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
path: root/source
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2008-07-28 18:35:56 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2008-07-28 18:35:56 +0400
commit3131858792e9a99c19d698e092e2b975c1b3aec9 (patch)
treebea8efa3a10818f75582562a1d12060e4668b36e /source
parent42f957f910867e2a99f923cd458a1b65fe6d88a9 (diff)
svn merge -r15780:HEAD https://svn.blender.org/svnroot/bf-blender/trunk/blender
Diffstat (limited to 'source')
-rw-r--r--source/blender/include/BIF_editarmature.h1
-rw-r--r--source/blender/makesdna/DNA_armature_types.h3
-rw-r--r--source/blender/makesdna/DNA_constraint_types.h10
-rw-r--r--source/blender/makesdna/DNA_object_types.h2
-rw-r--r--source/blender/python/api2_2x/Armature.c2
-rw-r--r--source/blender/python/api2_2x/Bone.c10
-rw-r--r--source/blender/python/api2_2x/doc/Armature.py3
-rw-r--r--source/blender/python/api2_2x/sceneRender.c38
-rw-r--r--source/blender/src/buttons_editing.c11
-rw-r--r--source/blender/src/buttons_object.c4
-rw-r--r--source/blender/src/drawgpencil.c7
-rw-r--r--source/blender/src/drawview.c2
-rw-r--r--source/blender/src/editarmature.c26
-rw-r--r--source/blender/src/editobject.c6
-rw-r--r--source/blender/src/gpencil.c15
-rw-r--r--source/blender/src/interface.c2
-rw-r--r--source/blender/src/outliner.c19
-rw-r--r--source/blender/src/poseobject.c156
-rw-r--r--source/blender/src/transform_conversions.c4
-rw-r--r--source/blender/src/transform_manipulator.c10
-rw-r--r--source/creator/creator.c22
-rw-r--r--source/gameengine/Converter/BL_BlenderDataConversion.cpp3
22 files changed, 254 insertions, 102 deletions
diff --git a/source/blender/include/BIF_editarmature.h b/source/blender/include/BIF_editarmature.h
index 24112c7f11a..da98eb3d4f1 100644
--- a/source/blender/include/BIF_editarmature.h
+++ b/source/blender/include/BIF_editarmature.h
@@ -134,6 +134,7 @@ void transform_armature_mirror_update(void);
void hide_selected_armature_bones(void);
void hide_unselected_armature_bones(void);
void show_all_armature_bones(void);
+void set_locks_armature_bones(short lock);
#define BONESEL_ROOT 0x10000000
#define BONESEL_TIP 0x20000000
diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h
index 673855a6932..0648c535353 100644
--- a/source/blender/makesdna/DNA_armature_types.h
+++ b/source/blender/makesdna/DNA_armature_types.h
@@ -154,7 +154,8 @@ typedef enum eBone_Flag {
BONE_NO_SCALE = (1<<15), /* No parent scale */
BONE_HIDDEN_PG = (1<<16), /* hidden bone when drawing PoseChannels (for ghost drawing) */
BONE_DRAWWIRE = (1<<17), /* bone should be drawn as OB_WIRE, regardless of draw-types of view+armature */
- BONE_NO_CYCLICOFFSET = (1<<18) /* when no parent, bone will not get cyclic offset */
+ BONE_NO_CYCLICOFFSET = (1<<18), /* when no parent, bone will not get cyclic offset */
+ BONE_EDITMODE_LOCKED = (1<<19), /* bone transforms are locked in EditMode */
} eBone_Flag;
#endif
diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h
index 0fe0dace016..fa5b5a75941 100644
--- a/source/blender/makesdna/DNA_constraint_types.h
+++ b/source/blender/makesdna/DNA_constraint_types.h
@@ -375,11 +375,13 @@ typedef enum B_CONSTRAINT_SPACETYPES {
/* for objects (relative to parent/without parent influence),
* for bones (along normals of bone, without parent/restpositions)
*/
- CONSTRAINT_SPACE_LOCAL,
+ CONSTRAINT_SPACE_LOCAL, /* = 1 */
/* for posechannels - pose space */
- CONSTRAINT_SPACE_POSE,
- /* for posechannels - local with parent */
- CONSTRAINT_SPACE_PARLOCAL,
+ CONSTRAINT_SPACE_POSE, /* = 2 */
+ /* for posechannels - local with parent */
+ CONSTRAINT_SPACE_PARLOCAL, /* = 3 */
+ /* for files from between 2.43-2.46 (should have been parlocal) */
+ CONSTRAINT_SPACE_INVALID, /* = 4. do not exchange for anything! */
} B_CONSTRAINT_SPACETYPES;
/* bConstraintChannel.flag */
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index df0cf1bd787..8b3a9f17367 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -469,9 +469,11 @@ extern Object workob;
#define OB_LOCK_ROTX 8
#define OB_LOCK_ROTY 16
#define OB_LOCK_ROTZ 32
+#define OB_LOCK_ROT 56
#define OB_LOCK_SCALEX 64
#define OB_LOCK_SCALEY 128
#define OB_LOCK_SCALEZ 256
+#define OB_LOCK_SCALE 448
/* ob->softflag in DNA_object_force.h */
diff --git a/source/blender/python/api2_2x/Armature.c b/source/blender/python/api2_2x/Armature.c
index e9dff098773..0db87c00dd2 100644
--- a/source/blender/python/api2_2x/Armature.c
+++ b/source/blender/python/api2_2x/Armature.c
@@ -1469,6 +1469,8 @@ PyObject *Armature_Init(void)
PyConstant_NewInt("BONE_SELECTED", BONE_SELECTED));
PyModule_AddObject(module, "TIP_SELECTED",
PyConstant_NewInt("TIP_SELECTED", BONE_TIPSEL));
+ PyModule_AddObject(module, "LOCKED_EDIT",
+ PyConstant_NewInt("LOCKED_EDIT", BONE_EDITMODE_LOCKED));
PyModule_AddObject(module, "OCTAHEDRON",
PyConstant_NewInt("OCTAHEDRON", ARM_OCTA));
diff --git a/source/blender/python/api2_2x/Bone.c b/source/blender/python/api2_2x/Bone.c
index 84faf416c5f..948eb007803 100644
--- a/source/blender/python/api2_2x/Bone.c
+++ b/source/blender/python/api2_2x/Bone.c
@@ -368,6 +368,10 @@ static PyObject *EditBone_getOptions(BPy_EditBone *self, void *closure)
if (PyList_Append(list,
EXPP_GetModuleConstant("Blender.Armature", "TIP_SELECTED")) == -1)
goto RuntimeError;
+ if(self->editbone->flag & BONE_EDITMODE_LOCKED)
+ if (PyList_Append(list,
+ EXPP_GetModuleConstant("Blender.Armature", "LOCKED_EDIT")) == -1)
+ goto RuntimeError;
}else{
if(self->flag & BONE_CONNECTED)
if (PyList_Append(list,
@@ -401,6 +405,10 @@ static PyObject *EditBone_getOptions(BPy_EditBone *self, void *closure)
if (PyList_Append(list,
EXPP_GetModuleConstant("Blender.Armature", "TIP_SELECTED")) == -1)
goto RuntimeError;
+ if(self->flag & BONE_EDITMODE_LOCKED)
+ if (PyList_Append(list,
+ EXPP_GetModuleConstant("Blender.Armature", "LOCKED_EDIT")) == -1)
+ goto RuntimeError;
}
return list;
@@ -422,7 +430,7 @@ static int EditBone_CheckValidConstant(PyObject *constant)
return 0;
if (!STREQ3(PyString_AsString(name), "CONNECTED", "HINGE", "NO_DEFORM") &&
!STREQ3(PyString_AsString(name), "ROOT_SELECTED", "BONE_SELECTED", "TIP_SELECTED") &&
- !STREQ2(PyString_AsString(name), "MULTIPLY", "HIDDEN_EDIT"))
+ !STREQ3(PyString_AsString(name), "MULTIPLY", "HIDDEN_EDIT", "LOCKED_EDIT"))
return 0;
else
return 1;
diff --git a/source/blender/python/api2_2x/doc/Armature.py b/source/blender/python/api2_2x/doc/Armature.py
index 68916af6166..9aceb0105e3 100644
--- a/source/blender/python/api2_2x/doc/Armature.py
+++ b/source/blender/python/api2_2x/doc/Armature.py
@@ -89,6 +89,8 @@ Example::
@type BONE_SELECTED: Constant
@var TIP_SELECTED: Tip of the Bone is selected
@type TIP_SELECTED: Constant
+@var LOCKED_EDIT: Prevents the bone from being transformed in editmode
+@type LOCKED_EDIT: Constant
@var OCTAHEDRON: Bones drawn as octahedrons
@type OCTAHEDRON: Constant
@var STICK: Bones drawn as a line
@@ -286,6 +288,7 @@ class Bone:
- Armature.ROOT_SELECTED: Selection of root ball of bone
- Armature.BONE_SELECTED: Selection of bone
- Armature.TIP_SELECTED: Selection of tip ball of bone
+ - Armature.LOCKED_EDIT: Prevents the bone from being transformed in editmode
@type options: List of Constants
@ivar subdivision: The number of bone subdivisions.
@type subdivision: Int
diff --git a/source/blender/python/api2_2x/sceneRender.c b/source/blender/python/api2_2x/sceneRender.c
index 8f251fc8452..22e165cbe9f 100644
--- a/source/blender/python/api2_2x/sceneRender.c
+++ b/source/blender/python/api2_2x/sceneRender.c
@@ -56,6 +56,7 @@ struct View3D; /* keep me up here */
#include "gen_utils.h"
#include "gen_library.h"
+#include "../BPY_extern.h" /* for BPY_do_all_scripts() */
#include "Scene.h"
#include "Group.h"
@@ -469,19 +470,20 @@ PyObject *M_Render_EnableDispWin( PyObject * self )
PyObject *RenderData_Render( BPy_RenderData * self )
{
Scene *oldsce;
+ /* unlock to prevent a deadlock when there are pynodes: */
+ PyThreadState *tstate = NULL;
if (!G.background) {
oldsce = G.scene;
set_scene( self->scene );
+ tstate = PyEval_SaveThread();
BIF_do_render( 0 );
set_scene( oldsce );
}
-
else { /* background mode (blender -b file.blend -P script) */
+ int slink_flag = 0;
Render *re= RE_NewRender(G.scene->id.name);
-
-
int end_frame = G.scene->r.efra;
if (G.scene != self->scene)
@@ -490,11 +492,25 @@ PyObject *RenderData_Render( BPy_RenderData * self )
G.scene->r.efra = G.scene->r.sfra;
+ if (G.f & G_DOSCRIPTLINKS) {
+ BPY_do_all_scripts(SCRIPT_RENDER);
+ G.f &= ~G_DOSCRIPTLINKS; /* avoid FRAMECHANGED events*/
+ slink_flag = 1;
+ }
+
+ tstate = PyEval_SaveThread();
+
RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra);
+ if (slink_flag) {
+ G.f |= G_DOSCRIPTLINKS;
+ BPY_do_all_scripts(SCRIPT_POSTRENDER);
+ }
+
G.scene->r.efra = end_frame;
}
+ PyEval_RestoreThread(tstate);
Py_RETURN_NONE;
}
@@ -565,12 +581,13 @@ PyObject *RenderData_SaveRenderedImage ( BPy_RenderData * self, PyObject *args )
PyObject *RenderData_RenderAnim( BPy_RenderData * self )
{
Scene *oldsce;
- /* this prevents a deadlock when there are pynodes: */
- PyThreadState *tstate = PyEval_SaveThread();
-
+ /* unlock to prevent a deadlock when there are pynodes: */
+ PyThreadState *tstate = NULL;
+
if (!G.background) {
oldsce = G.scene;
set_scene( self->scene );
+ tstate = PyEval_SaveThread();
BIF_do_render( 1 );
set_scene( oldsce );
}
@@ -584,8 +601,17 @@ PyObject *RenderData_RenderAnim( BPy_RenderData * self )
if (G.scene->r.sfra > G.scene->r.efra)
return EXPP_ReturnPyObjError (PyExc_RuntimeError,
"start frame must be less or equal to end frame");
+
+ if (G.f & G_DOSCRIPTLINKS)
+ BPY_do_all_scripts(SCRIPT_RENDER);
+
+ tstate = PyEval_SaveThread();
RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra);
+
+ if (G.f & G_DOSCRIPTLINKS)
+ BPY_do_all_scripts(SCRIPT_POSTRENDER);
}
+
PyEval_RestoreThread(tstate);
Py_RETURN_NONE;
}
diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c
index 53b9c4feabe..44409dd9459 100644
--- a/source/blender/src/buttons_editing.c
+++ b/source/blender/src/buttons_editing.c
@@ -4371,11 +4371,12 @@ static void editing_panel_armature_bones(Object *ob, bArmature *arm)
uiDefButF(block, NUM,B_ARM_RECALCDATA, "Weight:", 225, by-19,105, 18, &curBone->weight, 0.0F, 1000.0F, 10.0F, 0.0F, "Bone deformation weight");
/* bone types */
- uiDefButBitI(block, TOG, BONE_HINGE, B_ARM_RECALCDATA, "Hinge", -10,by-38,80,18, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Don't inherit rotation or scale from parent Bone");
- uiDefButBitI(block, TOG, BONE_NO_SCALE, B_ARM_RECALCDATA, "S", 70,by-38,20,18, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Don't inherit scale from parent Bone");
- uiDefButBitI(block, TOGN, BONE_NO_DEFORM, B_ARM_RECALCDATA, "Deform", 90, by-38, 80, 18, &curBone->flag, 0.0, 0.0, 0.0, 0.0, "Indicate if Bone deforms geometry");
- uiDefButBitI(block, TOG, BONE_MULT_VG_ENV, B_ARM_RECALCDATA, "Mult", 170,by-38,80,18, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Multiply Bone Envelope with VertexGroup");
- uiDefButBitI(block, TOG, BONE_HIDDEN_A, REDRAWVIEW3D, "Hide", 250,by-38,80,18, &curBone->flag, 0, 0, 0, 0, "Toggles display of this bone in Edit Mode");
+ uiDefButBitI(block, TOG, BONE_HINGE, B_ARM_RECALCDATA, "Hinge", -10,by-38,60,18, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Don't inherit rotation or scale from parent Bone");
+ uiDefButBitI(block, TOG, BONE_NO_SCALE, B_ARM_RECALCDATA, "S", 50,by-38,20,18, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Don't inherit scale from parent Bone");
+ uiDefButBitI(block, TOGN, BONE_NO_DEFORM, B_ARM_RECALCDATA, "Deform", 70, by-38, 80, 18, &curBone->flag, 0.0, 0.0, 0.0, 0.0, "Indicate if Bone deforms geometry");
+ uiDefButBitI(block, TOG, BONE_MULT_VG_ENV, B_ARM_RECALCDATA, "Mult", 150,by-38,60,18, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Multiply Bone Envelope with VertexGroup");
+ uiDefButBitI(block, TOG, BONE_HIDDEN_A, REDRAWVIEW3D, "Hide", 210,by-38,60,18, &curBone->flag, 0, 0, 0, 0, "Toggles display of this bone in Edit Mode");
+ uiDefButBitI(block, TOG, BONE_EDITMODE_LOCKED, REDRAWVIEW3D, "Lock", 270,by-38,60,18, &curBone->flag, 0, 0, 0, 0, "Prevents this bone from being transformed in Edit Mode");
/* layers */
uiBlockBeginAlign(block);
diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c
index 0e733c20344..1ac3c775ad6 100644
--- a/source/blender/src/buttons_object.c
+++ b/source/blender/src/buttons_object.c
@@ -480,7 +480,7 @@ static void draw_constraint_spaceselect (uiBlock *block, bConstraint *con, short
/* Target-Space */
if (target == 1) {
- uiDefButC(block, MENU, B_CONSTRAINT_TEST, "Target Space %t|World Space %x0|Pose Space %x3|Local with Parent %x4|Local Space %x1",
+ uiDefButC(block, MENU, B_CONSTRAINT_TEST, "Target Space %t|World Space %x0|Pose Space %x2|Local with Parent %x3|Local Space %x1",
tarx, yco, bwidth, 18, &con->tarspace, 0, 0, 0, 0, "Choose space that target is evaluated in");
}
else if (target == 0) {
@@ -490,7 +490,7 @@ static void draw_constraint_spaceselect (uiBlock *block, bConstraint *con, short
/* Owner-Space */
if (owner == 1) {
- uiDefButC(block, MENU, B_CONSTRAINT_TEST, "Owner Space %t|World Space %x0|Pose Space %x3|Local with Parent %x4|Local Space %x1",
+ uiDefButC(block, MENU, B_CONSTRAINT_TEST, "Owner Space %t|World Space %x0|Pose Space %x2|Local with Parent %x3|Local Space %x1",
ownx, yco, bwidth, 18, &con->ownspace, 0, 0, 0, 0, "Choose space that owner is evaluated in");
}
else if (owner == 0) {
diff --git a/source/blender/src/drawgpencil.c b/source/blender/src/drawgpencil.c
index 7abb922f67e..e07dec90629 100644
--- a/source/blender/src/drawgpencil.c
+++ b/source/blender/src/drawgpencil.c
@@ -187,10 +187,15 @@ static void gp_drawui_layer (uiBlock *block, bGPdata *gpd, bGPDlayer *gpl, short
sprintf(name, "%s (Locked)", gpl->info);
uiDefBut(block, LABEL, 1, name, *xco+35, *yco, 240, 20, NULL, 0.0, 0.0, 0, 0, "Short description of what this layer is for (optional)");
+ /* delete button (only if hidden but not locked!) */
+ if ((gpl->flag & GP_LAYER_HIDE) & !(gpl->flag & GP_LAYER_LOCKED)) {
+ but= uiDefIconBut(block, BUT, B_REDR, ICON_X, *xco+(width-30), *yco, 19, 19, NULL, 0.0, 0.0, 0.0, 0.0, "Delete layer");
+ uiButSetFunc(but, gp_ui_dellayer_cb, gpd, NULL);
+ }
uiBlockSetEmboss(block, UI_EMBOSS);
}
else {
- height= 100;
+ height= 97;
/* draw rest of header */
{
diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c
index 747457cbe06..765cb3697ad 100644
--- a/source/blender/src/drawview.c
+++ b/source/blender/src/drawview.c
@@ -1873,6 +1873,8 @@ static void v3d_editarmature_buts(uiBlock *block, Object *ob, float lim)
tfp->ob_eul[0]= 180.0*ebone->roll/M_PI;
uiDefButF(block, NUM, B_ARMATUREPANEL1, "Roll:", 10, 100, 140, 19, tfp->ob_eul, -lim, lim, 1000, 3, "");
+ uiDefButBitI(block, TOG, BONE_EDITMODE_LOCKED, REDRAWVIEW3D, "Lock", 160, 100, 140, 19, &(ebone->flag), 0, 0, 0, 0, "Prevents bone from being transformed in edit mode");
+
uiBlockBeginAlign(block);
uiDefButF(block, NUM, B_ARMATUREPANEL1, "TailRadius:", 10, 150, 140, 19, &ebone->rad_tail, 0, lim, 10, 3, "");
if (ebone->parent && ebone->flag & BONE_CONNECTED )
diff --git a/source/blender/src/editarmature.c b/source/blender/src/editarmature.c
index 6310dd0a262..3d0f26960d6 100644
--- a/source/blender/src/editarmature.c
+++ b/source/blender/src/editarmature.c
@@ -2709,6 +2709,32 @@ void show_all_armature_bones(void)
BIF_undo_push("Reveal Bones");
}
+/* Sets editmode transform locks for bones (adds if lock==1, clears otherwise) */
+void set_locks_armature_bones(short lock)
+{
+ bArmature *arm= G.obedit->data;
+ EditBone *ebone;
+
+ for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
+ if (arm->layer & ebone->layer) {
+ if (ebone->flag & BONE_SELECTED) {
+ if (lock)
+ ebone->flag |= BONE_EDITMODE_LOCKED;
+ else
+ ebone->flag &= ~BONE_EDITMODE_LOCKED;
+ }
+ }
+ }
+ countall();
+ allqueue(REDRAWVIEW3D, 0);
+ allqueue(REDRAWBUTSEDIT, 0);
+
+ if (lock)
+ BIF_undo_push("Lock Bones");
+ else
+ BIF_undo_push("Unlock Bones");
+}
+
/* check for null, before calling! */
static void bone_connect_to_existing_parent(EditBone *bone)
{
diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c
index 6af4f47ed11..2f9addb106e 100644
--- a/source/blender/src/editobject.c
+++ b/source/blender/src/editobject.c
@@ -2760,7 +2760,7 @@ void special_editmenu(void)
DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
}
else if(G.obedit->type==OB_ARMATURE) {
- nr= pupmenu("Specials%t|Subdivide %x1|Subdivide Multi%x2|Flip Left-Right Names%x3|%l|AutoName Left-Right%x4|AutoName Front-Back%x5|AutoName Top-Bottom%x6");
+ nr= pupmenu("Specials%t|Subdivide %x1|Subdivide Multi%x2|Flip Left-Right Names%x3|%l|AutoName Left-Right%x4|AutoName Front-Back%x5|AutoName Top-Bottom%x6|%l|Lock%x7|Unlock%x8");
if(nr==1)
subdivide_armature(1);
if(nr==2) {
@@ -2773,6 +2773,10 @@ void special_editmenu(void)
else if(ELEM3(nr, 4, 5, 6)) {
armature_autoside_names(nr-4);
}
+ else if(nr==7)
+ set_locks_armature_bones(1);
+ else if(nr==8)
+ set_locks_armature_bones(0);
}
else if(G.obedit->type==OB_LATTICE) {
static float weight= 1.0f;
diff --git a/source/blender/src/gpencil.c b/source/blender/src/gpencil.c
index 2f2913f13e1..24ed6a7b0ba 100644
--- a/source/blender/src/gpencil.c
+++ b/source/blender/src/gpencil.c
@@ -664,11 +664,12 @@ void gpencil_delete_menu (void)
/* maximum sizes of gp-session buffer */
#define GP_STROKE_BUFFER_MAX 5000
- /* 'Hardcoded' sensitivity thresholds... */
-/* minimum number of pixels mouse should move before new point created */
-#define MIN_MMOVE_PX 3
-/* minimum length of new segment before new point can be added */
-#define MIN_MDIST_PX 20
+/* Hardcoded sensitivity thresholds... */
+// TODO: one day, these might be added to the UI if it is necessary
+ /* minimum number of pixels mouse should move before new point created */
+#define MIN_MANHATTEN_PX 3
+ /* minimum length of new segment before new point can be added */
+#define MIN_EUCLIDEAN_PX 20
/* ------ */
@@ -890,11 +891,11 @@ static short gp_stroke_filtermval (tGPsdata *p, short mval[2], short pmval[2])
short dy= abs(mval[1] - pmval[1]);
/* check if mouse moved at least certain distance on both axes (best case) */
- if ((dx > MIN_MMOVE_PX) && (dy > MIN_MMOVE_PX))
+ if ((dx > MIN_MANHATTEN_PX) && (dy > MIN_MANHATTEN_PX))
return 1;
/* check if the distance since the last point is significant enough */
- else if (sqrt(dx*dx + dy*dy) > MIN_MDIST_PX)
+ else if (sqrt(dx*dx + dy*dy) > MIN_EUCLIDEAN_PX)
return 1;
/* mouse 'didn't move' */
diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c
index 18e596abcc7..e7b5b176979 100644
--- a/source/blender/src/interface.c
+++ b/source/blender/src/interface.c
@@ -532,7 +532,7 @@ static int ui_but_copy_paste(uiBut *but, char mode)
/* give butfunc the original text too */
/* feature used for bone renaming, channels, etc */
if(but->func_arg2==NULL) {
- strncpy(backstr, but->drawstr, UI_MAX_DRAW_STR);
+ strncpy(backstr, but->poin, UI_MAX_DRAW_STR);
but->func_arg2= backstr;
}
strncpy(but->poin, but_copypaste_str, but->max);
diff --git a/source/blender/src/outliner.c b/source/blender/src/outliner.c
index ce9916a51d0..ea7e5b268bd 100644
--- a/source/blender/src/outliner.c
+++ b/source/blender/src/outliner.c
@@ -3848,7 +3848,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, SpaceOops *soops, ListBas
uiBut *bt;
TreeElement *te;
TreeStoreElem *tselem;
- Object *ob;
+ Object *ob = NULL;
for(te= lb->first; te; te= te->next) {
tselem= TREESTORE(te);
@@ -3856,7 +3856,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, SpaceOops *soops, ListBas
/* objects have toggle-able restriction flags */
if(tselem->type==0 && te->idcode==ID_OB) {
ob = (Object *)tselem->id;
-
+
uiBlockSetEmboss(block, UI_EMBOSSN);
bt= uiDefIconButBitS(block, ICONTOG, OB_RESTRICT_VIEW, REDRAWALL, ICON_RESTRICT_VIEW_OFF,
(int)soops->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, te->ys, 17, OL_H-1, &(ob->restrictflag), 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View");
@@ -3912,13 +3912,6 @@ static void outliner_draw_restrictbuts(uiBlock *block, SpaceOops *soops, ListBas
uiButSetFunc(bt, restrictbutton_modifier_cb, ob, NULL);
uiButSetFlag(bt, UI_NO_HILITE);
- /*
- bt= uiDefIconButBitI(block, ICONTOGN, eModifierMode_Editmode, REDRAWALL, VICON_EDIT,
- (int)soops->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, te->ys, 17, OL_H-1, &(md->mode), 0, 0, 0, 0, "Restrict/Allow selection in the 3D View");
- uiButSetFunc(bt, restrictbutton_modifier_cb, ob, NULL);
- uiButSetFlag(bt, UI_NO_HILITE);
- */
-
bt= uiDefIconButBitI(block, ICONTOGN, eModifierMode_Render, REDRAWALL, ICON_RESTRICT_RENDER_OFF,
(int)soops->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX, te->ys, 17, OL_H-1, &(md->mode), 0, 0, 0, 0, "Restrict/Allow renderability");
uiButSetFunc(bt, restrictbutton_modifier_cb, ob, NULL);
@@ -3927,20 +3920,20 @@ static void outliner_draw_restrictbuts(uiBlock *block, SpaceOops *soops, ListBas
else if(tselem->type==TSE_POSE_CHANNEL) {
bPoseChannel *pchan= (bPoseChannel *)te->directdata;
Bone *bone = pchan->bone;
-
+
uiBlockSetEmboss(block, UI_EMBOSSN);
bt= uiDefIconButBitI(block, ICONTOG, BONE_HIDDEN_P, REDRAWALL, ICON_RESTRICT_VIEW_OFF,
(int)soops->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, te->ys, 17, OL_H-1, &(bone->flag), 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View");
- uiButSetFunc(bt, restrictbutton_bone_cb, ob, NULL);
+ uiButSetFunc(bt, restrictbutton_bone_cb, NULL, NULL);
uiButSetFlag(bt, UI_NO_HILITE);
}
else if(tselem->type==TSE_EBONE) {
EditBone *ebone= (EditBone *)te->directdata;
-
+
uiBlockSetEmboss(block, UI_EMBOSSN);
bt= uiDefIconButBitI(block, ICONTOG, BONE_HIDDEN_A, REDRAWALL, ICON_RESTRICT_VIEW_OFF,
(int)soops->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, te->ys, 17, OL_H-1, &(ebone->flag), 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View");
- uiButSetFunc(bt, restrictbutton_bone_cb, ob, NULL);
+ uiButSetFunc(bt, restrictbutton_bone_cb, NULL, NULL);
uiButSetFlag(bt, UI_NO_HILITE);
}
}
diff --git a/source/blender/src/poseobject.c b/source/blender/src/poseobject.c
index cc08bf53a72..b054b435002 100644
--- a/source/blender/src/poseobject.c
+++ b/source/blender/src/poseobject.c
@@ -180,27 +180,26 @@ bPoseChannel *get_active_posechannel (Object *ob)
return NULL;
}
-/* if a selected or active bone is protected, throw error and return 1 */
+/* if a selected or active bone is protected, throw error (oonly if warn==1) and return 1 */
/* only_selected==1 : the active bone is allowed to be protected */
-static int pose_has_protected_selected(Object *ob, int only_selected)
+static short pose_has_protected_selected(Object *ob, short only_selected, short warn)
{
-
/* check protection */
- if(ob->proxy) {
+ if (ob->proxy) {
bPoseChannel *pchan;
bArmature *arm= ob->data;
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if(pchan->bone && (pchan->bone->layer & arm->layer)) {
- if(pchan->bone->layer & arm->layer_protected) {
- if(only_selected && (pchan->bone->flag & BONE_ACTIVE));
- else if(pchan->bone->flag & (BONE_ACTIVE|BONE_SELECTED))
+ for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+ if (pchan->bone && (pchan->bone->layer & arm->layer)) {
+ if (pchan->bone->layer & arm->layer_protected) {
+ if (only_selected && (pchan->bone->flag & BONE_ACTIVE));
+ else if (pchan->bone->flag & (BONE_ACTIVE|BONE_SELECTED))
break;
}
}
}
- if(pchan) {
- error("Cannot change Proxy protected bones");
+ if (pchan) {
+ if (warn) error("Cannot change Proxy protected bones");
return 1;
}
}
@@ -540,7 +539,7 @@ void pose_clear_IK(void)
if(!ob && !ob->pose) return;
if(ob==G.obedit || (ob->flag & OB_POSEMODE)==0) return;
- if(pose_has_protected_selected(ob, 0))
+ if(pose_has_protected_selected(ob, 0, 1))
return;
if(okee("Remove IK constraint(s)")==0) return;
@@ -581,7 +580,7 @@ void pose_clear_constraints(void)
if(!ob && !ob->pose) return;
if(ob==G.obedit || (ob->flag & OB_POSEMODE)==0) return;
- if(pose_has_protected_selected(ob, 0))
+ if(pose_has_protected_selected(ob, 0, 1))
return;
if(okee("Remove Constraints")==0) return;
@@ -612,38 +611,49 @@ void pose_copy_menu(void)
Object *ob= OBACT;
bArmature *arm= ob->data;
bPoseChannel *pchan, *pchanact;
- short nr;
+ short nr=0;
int i=0;
/* paranoia checks */
- if(!ob && !ob->pose) return;
- if(ob==G.obedit || (ob->flag & OB_POSEMODE)==0) return;
+ if (ELEM(NULL, ob, ob->pose)) return;
+ if ((ob==G.obedit) || (ob->flag & OB_POSEMODE)==0) return;
/* find active */
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if(pchan->bone->flag & BONE_ACTIVE) break;
+ for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+ if (pchan->bone->flag & BONE_ACTIVE)
+ break;
}
- if(pchan==NULL) return;
-
- if(pose_has_protected_selected(ob, 1))
- return;
-
+ if (pchan==NULL) return;
pchanact= pchan;
- i= BLI_countlist(&(pchanact->constraints)); /* if there are 24 or less, allow for the user to select constraints */
- if (i<25)
- nr= pupmenu("Copy Pose Attributes %t|Local Location%x1|Local Rotation%x2|Local Size%x3|%l|Visual Location %x9|Visual Rotation%x10|Visual Size%x11|%l|Constraints (All)%x4|Constraints...%x5|%l|Transform Locks%x6|IK Limits%x7|Bone Shape%x8");
- else
- nr= pupmenu("Copy Pose Attributes %t|Local Location%x1|Local Rotation%x2|Local Size%x3|%l|Visual Location %x9|Visual Rotation%x10|Visual Size%x11|%l|Constraints (All)%x4|%l|Transform Locks%x6|IK Limits%x7|Bone Shape%x8");
+ /* if proxy-protected bones selected, some things (such as locks + displays) shouldn't be changable,
+ * but for constraints (just add local constraints)
+ */
+ if (pose_has_protected_selected(ob, 1, 0)) {
+ i= BLI_countlist(&(pchanact->constraints)); /* if there are 24 or less, allow for the user to select constraints */
+ if (i < 25)
+ nr= pupmenu("Copy Pose Attributes %t|Local Location%x1|Local Rotation%x2|Local Size%x3|%l|Visual Location %x9|Visual Rotation%x10|Visual Size%x11|%l|Constraints (All)%x4|Constraints...%x5");
+ else
+ nr= pupmenu("Copy Pose Attributes %t|Local Location%x1|Local Rotation%x2|Local Size%x3|%l|Visual Location %x9|Visual Rotation%x10|Visual Size%x11|%l|Constraints (All)%x4");
+ }
+ else {
+ i= BLI_countlist(&(pchanact->constraints)); /* if there are 24 or less, allow for the user to select constraints */
+ if (i < 25)
+ nr= pupmenu("Copy Pose Attributes %t|Local Location%x1|Local Rotation%x2|Local Size%x3|%l|Visual Location %x9|Visual Rotation%x10|Visual Size%x11|%l|Constraints (All)%x4|Constraints...%x5|%l|Transform Locks%x6|IK Limits%x7|Bone Shape%x8");
+ else
+ nr= pupmenu("Copy Pose Attributes %t|Local Location%x1|Local Rotation%x2|Local Size%x3|%l|Visual Location %x9|Visual Rotation%x10|Visual Size%x11|%l|Constraints (All)%x4|%l|Transform Locks%x6|IK Limits%x7|Bone Shape%x8");
+ }
- if(nr==-1) return;
- if(nr!=5) {
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if( (arm->layer & pchan->bone->layer) &&
- (pchan->bone->flag & BONE_SELECTED) &&
- (pchan!=pchanact)
- ) {
+ if (nr <= 0)
+ return;
+
+ if (nr != 5) {
+ for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+ if ( (arm->layer & pchan->bone->layer) &&
+ (pchan->bone->flag & BONE_SELECTED) &&
+ (pchan != pchanact) )
+ {
switch (nr) {
case 1: /* Local Location */
VECCOPY(pchan->loc, pchanact->loc);
@@ -656,13 +666,26 @@ void pose_copy_menu(void)
break;
case 4: /* All Constraints */
{
- free_constraints(&pchan->constraints);
- copy_constraints(&pchan->constraints, &pchanact->constraints);
- pchan->constflag = pchanact->constflag;
+ ListBase tmp_constraints = {NULL, NULL};
- if (ob->pose) {
- ob->pose->flag |= POSE_RECALC;
+ /* copy constraints to tmpbase and apply 'local' tags before
+ * appending to list of constraints for this channel
+ */
+ copy_constraints(&tmp_constraints, &pchanact->constraints);
+ if ((ob->proxy) && (pchan->bone->layer & arm->layer_protected)) {
+ bConstraint *con;
+
+ /* add proxy-local tags */
+ for (con= tmp_constraints.first; con; con= con->next)
+ con->flag |= CONSTRAINT_PROXY_LOCAL;
}
+ addlisttolist(&pchan->constraints, &tmp_constraints);
+
+ /* update flags (need to add here, not just copy) */
+ pchan->constflag |= pchanact->constflag;
+
+ if (ob->pose)
+ ob->pose->flag |= POSE_RECALC;
}
break;
case 6: /* Transform Locks */
@@ -703,12 +726,13 @@ void pose_copy_menu(void)
}
}
}
- } else { /* constraints, optional */
+ }
+ else { /* constraints, optional (note: max we can have is 24 constraints) */
bConstraint *con, *con_back;
int const_toggle[24];
- ListBase const_copy={0, 0};
+ ListBase const_copy = {NULL, NULL};
- duplicatelist (&const_copy, &(pchanact->constraints));
+ duplicatelist(&const_copy, &(pchanact->constraints));
/* build the puplist of constraints */
for (con = pchanact->constraints.first, i=0; con; con=con->next, i++){
@@ -723,32 +747,46 @@ void pose_copy_menu(void)
/* now build a new listbase from the options selected */
for (i=0, con=const_copy.first; con; i++) {
+ /* if not selected, free/remove it from the list */
if (!const_toggle[i]) {
con_back= con->next;
BLI_freelinkN(&const_copy, con);
con= con_back;
- } else {
+ }
+ else
con= con->next;
- }
}
/* Copy the temo listbase to the selected posebones */
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if( (arm->layer & pchan->bone->layer) &&
- (pchan->bone->flag & BONE_SELECTED) &&
- (pchan!=pchanact)
- ) {
- free_constraints(&pchan->constraints);
- copy_constraints(&pchan->constraints, &const_copy);
- pchan->constflag = pchanact->constflag;
+ for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+ if ( (arm->layer & pchan->bone->layer) &&
+ (pchan->bone->flag & BONE_SELECTED) &&
+ (pchan!=pchanact) )
+ {
+ ListBase tmp_constraints = {NULL, NULL};
+
+ /* copy constraints to tmpbase and apply 'local' tags before
+ * appending to list of constraints for this channel
+ */
+ copy_constraints(&tmp_constraints, &const_copy);
+ if ((ob->proxy) && (pchan->bone->layer & arm->layer_protected)) {
+ bConstraint *con;
+
+ /* add proxy-local tags */
+ for (con= tmp_constraints.first; con; con= con->next)
+ con->flag |= CONSTRAINT_PROXY_LOCAL;
+ }
+ addlisttolist(&pchan->constraints, &tmp_constraints);
+
+ /* update flags (need to add here, not just copy) */
+ pchan->constflag |= pchanact->constflag;
}
}
BLI_freelistN(&const_copy);
update_pose_constraint_flags(ob->pose); /* we could work out the flags but its simpler to do this */
- if (ob->pose) {
+ if (ob->pose)
ob->pose->flag |= POSE_RECALC;
- }
}
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); // and all its relations
@@ -808,7 +846,7 @@ void paste_posebuf (int flip)
/*
// disabled until protected bones in proxies follow the rules everywhere else!
- if(pose_has_protected_selected(ob, 1))
+ if(pose_has_protected_selected(ob, 1, 1))
return;
*/
@@ -1249,7 +1287,7 @@ void pose_flip_names(void)
if(!ob && !ob->pose) return;
if(ob==G.obedit || (ob->flag & OB_POSEMODE)==0) return;
- if(pose_has_protected_selected(ob, 0))
+ if(pose_has_protected_selected(ob, 0, 1))
return;
for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
@@ -1282,7 +1320,7 @@ void pose_autoside_names(short axis)
if (ELEM(NULL, ob, ob->pose)) return;
if (ob==G.obedit || (ob->flag & OB_POSEMODE)==0) return;
- if (pose_has_protected_selected(ob, 0))
+ if (pose_has_protected_selected(ob, 0, 1))
return;
for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
@@ -1415,7 +1453,7 @@ void pose_movetolayer(void)
/* pose-channel layers */
bPoseChannel *pchan;
- if (pose_has_protected_selected(ob, 0))
+ if (pose_has_protected_selected(ob, 0, 1))
return;
for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
diff --git a/source/blender/src/transform_conversions.c b/source/blender/src/transform_conversions.c
index 6e81fd34761..83ce7ef991a 100644
--- a/source/blender/src/transform_conversions.c
+++ b/source/blender/src/transform_conversions.c
@@ -1089,6 +1089,8 @@ static void createTransArmatureVerts(TransInfo *t)
VECCOPY (td->center, td->iloc);
td->loc= ebo->tail;
td->flag= TD_SELECTED;
+ if (ebo->flag & BONE_EDITMODE_LOCKED)
+ td->protectflag = OB_LOCK_LOC|OB_LOCK_ROT|OB_LOCK_SCALE;
Mat3CpyMat3(td->smtx, smtx);
Mat3CpyMat3(td->mtx, mtx);
@@ -1104,6 +1106,8 @@ static void createTransArmatureVerts(TransInfo *t)
VECCOPY (td->center, td->iloc);
td->loc= ebo->head;
td->flag= TD_SELECTED;
+ if (ebo->flag & BONE_EDITMODE_LOCKED)
+ td->protectflag = OB_LOCK_LOC|OB_LOCK_ROT|OB_LOCK_SCALE;
Mat3CpyMat3(td->smtx, smtx);
Mat3CpyMat3(td->mtx, mtx);
diff --git a/source/blender/src/transform_manipulator.c b/source/blender/src/transform_manipulator.c
index 050360887b4..709879f142b 100644
--- a/source/blender/src/transform_manipulator.c
+++ b/source/blender/src/transform_manipulator.c
@@ -170,6 +170,13 @@ static void stats_pose(View3D *v3d, bPoseChannel *pchan)
}
}
+/* for editmode*/
+static void stats_editbone(View3D *v3d, EditBone *ebo)
+{
+ if (ebo->flag & BONE_EDITMODE_LOCKED)
+ protectflag_to_drawflags(OB_LOCK_LOC|OB_LOCK_ROT|OB_LOCK_SCALE, &v3d->twdrawflag);
+}
+
/* only counts the parent selection, and tags transform flag */
/* bad call... should re-use method from transform_conversion once */
static void count_bone_select(TransInfo *t, bArmature *arm, ListBase *lb, int do_it)
@@ -258,6 +265,9 @@ int calc_manipulator_stats(ScrArea *sa)
calc_tw_center(ebo->head);
totsel++;
}
+ if (ebo->flag & BONE_SELECTED) {
+ stats_editbone(v3d, ebo);
+ }
}
}
}
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 95cff108a4f..ec87cdd8cf7 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -618,8 +618,23 @@ int main(int argc, char **argv)
if (G.scene) {
if (a < argc) {
int frame= MIN2(MAXFRAME, MAX2(1, atoi(argv[a])));
+ int slink_flag= 0;
Render *re= RE_NewRender(G.scene->id.name);
+
+ if (G.f & G_DOSCRIPTLINKS) {
+ BPY_do_all_scripts(SCRIPT_RENDER);
+ /* avoid FRAMECHANGED slink event
+ * (should only be triggered in anims): */
+ G.f &= ~G_DOSCRIPTLINKS;
+ slink_flag= 1;
+ }
+
RE_BlenderAnim(re, G.scene, frame, frame);
+
+ if (slink_flag) {
+ G.f |= G_DOSCRIPTLINKS;
+ BPY_do_all_scripts(SCRIPT_POSTRENDER);
+ }
}
} else {
printf("\nError: no blend loaded. cannot use '-f'.\n");
@@ -628,7 +643,14 @@ int main(int argc, char **argv)
case 'a':
if (G.scene) {
Render *re= RE_NewRender(G.scene->id.name);
+
+ if (G.f & G_DOSCRIPTLINKS)
+ BPY_do_all_scripts(SCRIPT_RENDER);
+
RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra);
+
+ if (G.f & G_DOSCRIPTLINKS)
+ BPY_do_all_scripts(SCRIPT_POSTRENDER);
} else {
printf("\nError: no blend loaded. cannot use '-a'.\n");
}
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index 9531c203640..1809e41b91c 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -2189,7 +2189,8 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
}
}
- if (blenderscene->camera) {
+ // non-camera objects not supported as camera currently
+ if (blenderscene->camera && blenderscene->camera->type == OB_CAMERA) {
KX_Camera *gamecamera= (KX_Camera*) converter->FindGameObject(blenderscene->camera);
if(gamecamera)