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:
authorNicholas Bishop <nicholasbishop@gmail.com>2008-08-14 05:36:55 +0400
committerNicholas Bishop <nicholasbishop@gmail.com>2008-08-14 05:36:55 +0400
commit860975969364667a262a7d7ca7de20c31e746154 (patch)
tree77d62c9363e18a3c8347619cdaaca6df832fc0fe /source/blender/src
parente0c83d03ba3200c704d82fb1ae175914ef514f44 (diff)
parentd2750f7bda1e5e4e43df330ab49e677105e00d4f (diff)
Merge with r16081
Diffstat (limited to 'source/blender/src')
-rw-r--r--source/blender/src/buttons_editing.c89
-rw-r--r--source/blender/src/buttons_logic.c89
-rw-r--r--source/blender/src/buttons_object.c3
-rw-r--r--source/blender/src/buttons_scene.c11
-rw-r--r--source/blender/src/drawgpencil.c378
-rw-r--r--source/blender/src/drawseq.c24
-rw-r--r--source/blender/src/editarmature.c307
-rw-r--r--source/blender/src/editimasel.c6
-rw-r--r--source/blender/src/editipo.c9
-rw-r--r--source/blender/src/editmesh_mods.c653
-rw-r--r--source/blender/src/editobject.c21
-rw-r--r--source/blender/src/editseq.c1
-rw-r--r--source/blender/src/editview.c4
-rw-r--r--source/blender/src/gpencil.c378
-rw-r--r--source/blender/src/header_info.c53
-rw-r--r--source/blender/src/header_ipo.c2
-rw-r--r--source/blender/src/header_view3d.c86
-rw-r--r--source/blender/src/meshlaplacian.c2
-rw-r--r--source/blender/src/outliner.c19
-rw-r--r--source/blender/src/poselib.c7
-rw-r--r--source/blender/src/poseobject.c61
-rw-r--r--source/blender/src/space.c22
-rw-r--r--source/blender/src/toolbox.c9
-rw-r--r--source/blender/src/transform_conversions.c4
24 files changed, 1468 insertions, 770 deletions
diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c
index 5639e0116de..8fad9fc0a87 100644
--- a/source/blender/src/buttons_editing.c
+++ b/source/blender/src/buttons_editing.c
@@ -5704,13 +5704,9 @@ void sculptmode_draw_interface_textures(uiBlock *block, unsigned short cx, unsig
void do_fpaintbuts(unsigned short event)
{
- Mesh *me;
Object *ob;
bDeformGroup *defGroup;
- MTFace *activetf, *tf;
- MFace *mf;
- MCol *activemcol;
- int a;
+ MTFace *activetf;
SculptData *sd= &G.scene->sculptdata;
ID *id, *idtest;
extern VPaint Gwp; /* from vpaint */
@@ -5728,45 +5724,19 @@ void do_fpaintbuts(unsigned short event)
vpaint_dogamma();
break;
case B_COPY_TF_MODE:
+ EM_mesh_copy_face(4); /* todo, get rid of magic numbers */
+ break;
+ case B_COPY_TF_TRANSP:
+ EM_mesh_copy_face(5);
+ break;
case B_COPY_TF_UV:
+ EM_mesh_copy_face(3);
+ break;
case B_COPY_TF_COL:
+ EM_mesh_copy_face(6);
+ break;
case B_COPY_TF_TEX:
- me= get_mesh(OBACT);
- activetf= get_active_mtface(NULL, &activemcol, 0);
-
- if(me && activetf) {
- for (a=0, tf=me->mtface, mf=me->mface; a < me->totface; a++, tf++, mf++) {
- if(tf!=activetf && (mf->flag & ME_FACE_SEL)) {
- if(event==B_COPY_TF_MODE) {
- tf->mode= activetf->mode;
- tf->transp= activetf->transp;
- }
- else if(event==B_COPY_TF_UV) {
- memcpy(tf->uv, activetf->uv, sizeof(tf->uv));
- tf->tpage= activetf->tpage;
- tf->tile= activetf->tile;
-
- if(activetf->mode & TF_TILES) tf->mode |= TF_TILES;
- else tf->mode &= ~TF_TILES;
-
- }
- else if(event==B_COPY_TF_TEX) {
- tf->tpage= activetf->tpage;
- tf->tile= activetf->tile;
-
- if(activetf->mode & TF_TILES) tf->mode |= TF_TILES;
- else tf->mode &= ~TF_TILES;
- }
- else if(event==B_COPY_TF_COL && activemcol)
- memcpy(&me->mcol[a*4], activemcol, sizeof(MCol)*4);
- }
- }
-
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- do_shared_vertexcol(me);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIMAGE, 0);
- }
+ EM_mesh_copy_face(2);
break;
case B_SET_VCOL:
if(FACESEL_PAINT_TEST)
@@ -6201,8 +6171,20 @@ static void editing_panel_mesh_texface(void)
if(uiNewPanel(curarea, block, "Texture Face", "Editing", 960, 0, 318, 204)==0) return;
tf = get_active_mtface(NULL, NULL, 0);
+
if(tf) {
+ uiDefBut(block, LABEL, B_NOP, "Active Face Mode", 600,185,300,19, NULL, 0.0, 0.0, 0, 0, "Face mode its used for TexFace display and the game engine ");
+ uiDefBut(block, BUT,B_COPY_TF_MODE, "Copy", 850,185,50,19, 0, 0, 0, 0, 0, "Copy active faces mode to other selected (View3D Ctrl+C)");
+
+ /* Other copy buttons, layout isnt that nice */
uiBlockBeginAlign(block);
+ uiDefBut(block, BUT,B_COPY_TF_UV, "CopyUV", 600,15,100,19, 0, 0, 0, 0, 0, "Copy active faces UVs to other selected (View3D Ctrl+C)");
+ uiDefBut(block, BUT,B_COPY_TF_TEX, "CopyTex", 700,15,100,19, 0, 0, 0, 0, 0, "Copy active faces Texture to other selected (View3D Ctrl+C)");
+ uiDefBut(block, BUT,B_COPY_TF_COL, "CopyColor", 800,15,100,19, 0, 0, 0, 0, 0, "Copy active faces Color to other selected (View3D Ctrl+C)");
+ uiBlockEndAlign(block);
+
+ uiBlockBeginAlign(block);
+
uiDefButBitS(block, TOG, TF_TEX, B_REDR_3D_IMA, "Tex", 600,160,60,19, &tf->mode, 0, 0, 0, 0, "Render face with texture");
uiDefButBitS(block, TOG, TF_TILES, B_REDR_3D_IMA, "Tiles", 660,160,60,19, &tf->mode, 0, 0, 0, 0, "Use tilemode for face");
uiDefButBitS(block, TOG, TF_LIGHT, REDRAWVIEW3D, "Light", 720,160,60,19, &tf->mode, 0, 0, 0, 0, "Use light for face");
@@ -6213,23 +6195,30 @@ static void editing_panel_mesh_texface(void)
uiDefButBitS(block, TOG, TF_SHAREDCOL, REDRAWVIEW3D, "Shared", 600,135,60,19, &tf->mode, 0, 0, 0, 0, "Blend vertex colors across face when vertices are shared");
uiDefButBitS(block, TOG, TF_TWOSIDE, REDRAWVIEW3D, "Twoside",660,135,60,19, &tf->mode, 0, 0, 0, 0, "Render face twosided");
uiDefButBitS(block, TOG, TF_OBCOL, REDRAWVIEW3D, "ObColor",720,135,60,19, &tf->mode, 0, 0, 0, 0, "Use ObColor instead of vertex colors");
-
- uiBlockBeginAlign(block);
+ uiBlockEndAlign(block);
+ uiBlockBeginAlign(block);
uiDefButBitS(block, TOG, TF_BILLBOARD, B_TFACE_HALO, "Halo", 600,110,60,19, &tf->mode, 0, 0, 0, 0, "Screen aligned billboard");
uiDefButBitS(block, TOG, TF_BILLBOARD2, B_TFACE_BILLB, "Billboard",660,110,60,19, &tf->mode, 0, 0, 0, 0, "Billboard with Z-axis constraint");
uiDefButBitS(block, TOG, TF_SHADOW, REDRAWVIEW3D, "Shadow", 720,110,60,19, &tf->mode, 0, 0, 0, 0, "Face is used for shadow");
uiDefButBitS(block, TOG, TF_BMFONT, REDRAWVIEW3D, "Text", 780,110,60,19, &tf->mode, 0, 0, 0, 0, "Enable bitmap text on face");
-
+ uiDefButBitS(block, TOG, TF_ALPHASORT, REDRAWVIEW3D, "Sort", 840,110,60,19, &tf->mode, 0, 0, 0, 0, "Enable sorting of faces for correct alpha drawing (slow, use Clip Alpha instead when possible)");
+ uiBlockEndAlign(block);
+
+ uiDefBut(block, LABEL, B_NOP, "Active Face Alpha Blending (Transp)", 600,75,300,19, NULL, 0.0, 0.0, 0, 0, "Face mode its used for TexFace display and the game engine");
+ uiDefBut(block, BUT,B_COPY_TF_TRANSP, "Copy", 850,75,50,19, 0, 0, 0, 0, 0, "Copy active faces transp to other selected (View3D Ctrl+C)");
+
uiBlockBeginAlign(block);
uiBlockSetCol(block, TH_BUT_SETTING1);
- uiDefButC(block, ROW, REDRAWVIEW3D, "Opaque", 600,80,60,19, &tf->transp, 2.0, (float)TF_SOLID,0, 0, "Render color of textured face as color");
- uiDefButC(block, ROW, REDRAWVIEW3D, "Add", 660,80,60,19, &tf->transp, 2.0, (float)TF_ADD, 0, 0, "Render face transparent and add color of face");
- uiDefButC(block, ROW, REDRAWVIEW3D, "Alpha", 720,80,60,19, &tf->transp, 2.0, (float)TF_ALPHA,0, 0, "Render polygon transparent, depending on alpha channel of the texture");
- uiDefButC(block, ROW, REDRAWVIEW3D, "Clip Alpha", 780,80,80,19, &tf->transp, 2.0, (float)TF_CLIP,0, 0, "Use the images alpha values clipped with no blending (binary alpha)");
- }
- else
+ uiDefButC(block, ROW, REDRAWVIEW3D, "Opaque", 600,50,60,19, &tf->transp, 2.0, (float)TF_SOLID,0, 0, "Render color of textured face as color");
+ uiDefButC(block, ROW, REDRAWVIEW3D, "Add", 660,50,60,19, &tf->transp, 2.0, (float)TF_ADD, 0, 0, "Render face transparent and add color of face");
+ uiDefButC(block, ROW, REDRAWVIEW3D, "Alpha", 720,50,60,19, &tf->transp, 2.0, (float)TF_ALPHA,0, 0, "Render polygon transparent, depending on alpha channel of the texture");
+ uiDefButC(block, ROW, REDRAWVIEW3D, "Clip Alpha", 780,50,80,19, &tf->transp, 2.0, (float)TF_CLIP,0, 0, "Use the images alpha values clipped with no blending (binary alpha)");
+ uiBlockEndAlign(block);
+
+ } else {
uiDefBut(block,LABEL,B_NOP, "(No Active Face)", 10,200,150,19,0,0,0,0,0,"");
+ }
}
diff --git a/source/blender/src/buttons_logic.c b/source/blender/src/buttons_logic.c
index 498edc0dfed..5cf1958678e 100644
--- a/source/blender/src/buttons_logic.c
+++ b/source/blender/src/buttons_logic.c
@@ -1654,53 +1654,66 @@ static short draw_actuatorbuttons(Object *ob, bActuator *act, uiBlock *block, sh
wval = (width-100)/3;
if (oa->type == ACT_OBJECT_NORMAL)
{
- ysize= 175;
-
+ if ( ob->gameflag & OB_DYNAMIC )
+ {
+ ysize= 175;
+ }
+ else
+ {
+ ysize= 72;
+ }
+
glRects(xco, yco-ysize, xco+width, yco);
uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
- uiDefBut(block, LABEL, 0, "Force", xco, yco-45, 55, 19, NULL, 0, 0, 0, 0, "Sets the force");
- uiDefButF(block, NUM, 0, "", xco+45, yco-45, wval, 19, oa->forceloc, -10000.0, 10000.0, 10, 0, "");
- uiDefButF(block, NUM, 0, "", xco+45+wval, yco-45, wval, 19, oa->forceloc+1, -10000.0, 10000.0, 10, 0, "");
- uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-45, wval, 19, oa->forceloc+2, -10000.0, 10000.0, 10, 0, "");
-
- uiDefBut(block, LABEL, 0, "Torque", xco, yco-64, 55, 19, NULL, 0, 0, 0, 0, "Sets the torque");
- uiDefButF(block, NUM, 0, "", xco+45, yco-64, wval, 19, oa->forcerot, -10000.0, 10000.0, 10, 0, "");
- uiDefButF(block, NUM, 0, "", xco+45+wval, yco-64, wval, 19, oa->forcerot+1, -10000.0, 10000.0, 10, 0, "");
- uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-64, wval, 19, oa->forcerot+2, -10000.0, 10000.0, 10, 0, "");
+ uiDefBut(block, LABEL, 0, "Loc", xco, yco-45, 45, 19, NULL, 0, 0, 0, 0, "Sets the location");
+ uiDefButF(block, NUM, 0, "", xco+45, yco-45, wval, 19, oa->dloc, -10000.0, 10000.0, 10, 0, "");
+ uiDefButF(block, NUM, 0, "", xco+45+wval, yco-45, wval, 19, oa->dloc+1, -10000.0, 10000.0, 10, 0, "");
+ uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-45, wval, 19, oa->dloc+2, -10000.0, 10000.0, 10, 0, "");
- uiDefBut(block, LABEL, 0, "dLoc", xco, yco-87, 45, 19, NULL, 0, 0, 0, 0, "Sets the dLoc");
- uiDefButF(block, NUM, 0, "", xco+45, yco-87, wval, 19, oa->dloc, -10000.0, 10000.0, 10, 0, "");
- uiDefButF(block, NUM, 0, "", xco+45+wval, yco-87, wval, 19, oa->dloc+1, -10000.0, 10000.0, 10, 0, "");
- uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-87, wval, 19, oa->dloc+2, -10000.0, 10000.0, 10, 0, "");
-
- uiDefBut(block, LABEL, 0, "dRot", xco, yco-106, 45, 19, NULL, 0, 0, 0, 0, "Sets the dRot");
- uiDefButF(block, NUM, 0, "", xco+45, yco-106, wval, 19, oa->drot, -10000.0, 10000.0, 10, 0, "");
- uiDefButF(block, NUM, 0, "", xco+45+wval, yco-106, wval, 19, oa->drot+1, -10000.0, 10000.0, 10, 0, "");
- uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-106, wval, 19, oa->drot+2, -10000.0, 10000.0, 10, 0, "");
+ uiDefBut(block, LABEL, 0, "Rot", xco, yco-64, 45, 19, NULL, 0, 0, 0, 0, "Sets the rotation");
+ uiDefButF(block, NUM, 0, "", xco+45, yco-64, wval, 19, oa->drot, -10000.0, 10000.0, 10, 0, "");
+ uiDefButF(block, NUM, 0, "", xco+45+wval, yco-64, wval, 19, oa->drot+1, -10000.0, 10000.0, 10, 0, "");
+ uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-64, wval, 19, oa->drot+2, -10000.0, 10000.0, 10, 0, "");
+
+ uiDefButBitS(block, TOG, ACT_DLOC_LOCAL, 0, "L", xco+45+3*wval, yco-45, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
+ uiDefButBitS(block, TOG, ACT_DROT_LOCAL, 0, "L", xco+45+3*wval, yco-64, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
+
+ if ( ob->gameflag & OB_DYNAMIC )
+ {
+ uiDefBut(block, LABEL, 0, "Force", xco, yco-87, 55, 19, NULL, 0, 0, 0, 0, "Sets the force");
+ uiDefButF(block, NUM, 0, "", xco+45, yco-87, wval, 19, oa->forceloc, -10000.0, 10000.0, 10, 0, "");
+ uiDefButF(block, NUM, 0, "", xco+45+wval, yco-87, wval, 19, oa->forceloc+1, -10000.0, 10000.0, 10, 0, "");
+ uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-87, wval, 19, oa->forceloc+2, -10000.0, 10000.0, 10, 0, "");
- uiDefBut(block, LABEL, 0, "linV", xco, yco-129, 45, 19, NULL, 0, 0, 0, 0, "Sets the linear velocity");
- uiDefButF(block, NUM, 0, "", xco+45, yco-129, wval, 19, oa->linearvelocity, -10000.0, 10000.0, 10, 0, "");
- uiDefButF(block, NUM, 0, "", xco+45+wval, yco-129, wval, 19, oa->linearvelocity+1, -10000.0, 10000.0, 10, 0, "");
- uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-129, wval, 19, oa->linearvelocity+2, -10000.0, 10000.0, 10, 0, "");
+ uiDefBut(block, LABEL, 0, "Torque", xco, yco-106, 55, 19, NULL, 0, 0, 0, 0, "Sets the torque");
+ uiDefButF(block, NUM, 0, "", xco+45, yco-106, wval, 19, oa->forcerot, -10000.0, 10000.0, 10, 0, "");
+ uiDefButF(block, NUM, 0, "", xco+45+wval, yco-106, wval, 19, oa->forcerot+1, -10000.0, 10000.0, 10, 0, "");
+ uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-6106, wval, 19, oa->forcerot+2, -10000.0, 10000.0, 10, 0, "");
+ }
- uiDefBut(block, LABEL, 0, "angV", xco, yco-148, 45, 19, NULL, 0, 0, 0, 0, "Sets the angular velocity");
- uiDefButF(block, NUM, 0, "", xco+45, yco-148, wval, 19, oa->angularvelocity, -10000.0, 10000.0, 10, 0, "");
- uiDefButF(block, NUM, 0, "", xco+45+wval, yco-148, wval, 19, oa->angularvelocity+1, -10000.0, 10000.0, 10, 0, "");
- uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-148, wval, 19, oa->angularvelocity+2, -10000.0, 10000.0, 10, 0, "");
+ if ( ob->gameflag & OB_DYNAMIC )
+ {
+ uiDefBut(block, LABEL, 0, "LinV", xco, yco-129, 45, 19, NULL, 0, 0, 0, 0, "Sets the linear velocity");
+ uiDefButF(block, NUM, 0, "", xco+45, yco-129, wval, 19, oa->linearvelocity, -10000.0, 10000.0, 10, 0, "");
+ uiDefButF(block, NUM, 0, "", xco+45+wval, yco-129, wval, 19, oa->linearvelocity+1, -10000.0, 10000.0, 10, 0, "");
+ uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-129, wval, 19, oa->linearvelocity+2, -10000.0, 10000.0, 10, 0, "");
- uiDefBut(block, LABEL, 0, "damp", xco, yco-171, 45, 19, NULL, 0, 0, 0, 0, "Number of frames to reach the target velocity");
- uiDefButS(block, NUM, 0, "", xco+45, yco-171, wval, 19, &oa->damping, 0.0, 1000.0, 100, 0, "");
-
- uiDefButBitS(block, TOG, ACT_FORCE_LOCAL, 0, "L", xco+45+3*wval, yco-45, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
- uiDefButBitS(block, TOG, ACT_TORQUE_LOCAL, 0, "L", xco+45+3*wval, yco-64, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
- uiDefButBitS(block, TOG, ACT_DLOC_LOCAL, 0, "L", xco+45+3*wval, yco-87, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
- uiDefButBitS(block, TOG, ACT_DROT_LOCAL, 0, "L", xco+45+3*wval, yco-106, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
- uiDefButBitS(block, TOG, ACT_LIN_VEL_LOCAL, 0, "L", xco+45+3*wval, yco-129, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
- uiDefButBitS(block, TOG, ACT_ANG_VEL_LOCAL, 0, "L", xco+45+3*wval, yco-148, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
+ uiDefBut(block, LABEL, 0, "AngV", xco, yco-148, 45, 19, NULL, 0, 0, 0, 0, "Sets the angular velocity");
+ uiDefButF(block, NUM, 0, "", xco+45, yco-148, wval, 19, oa->angularvelocity, -10000.0, 10000.0, 10, 0, "");
+ uiDefButF(block, NUM, 0, "", xco+45+wval, yco-148, wval, 19, oa->angularvelocity+1, -10000.0, 10000.0, 10, 0, "");
+ uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-148, wval, 19, oa->angularvelocity+2, -10000.0, 10000.0, 10, 0, "");
- uiDefButBitS(block, TOG, ACT_ADD_LIN_VEL, 0, "add",xco+45+3*wval+15, yco-129, 35, 19, &oa->flag, 0.0, 0.0, 0, 0, "Toggles between ADD and SET linV");
+ uiDefBut(block, LABEL, 0, "Damp", xco, yco-171, 45, 19, NULL, 0, 0, 0, 0, "Number of frames to reach the target velocity");
+ uiDefButS(block, NUM, 0, "", xco+45, yco-171, wval, 19, &oa->damping, 0.0, 1000.0, 100, 0, "");
+
+ uiDefButBitS(block, TOG, ACT_FORCE_LOCAL, 0, "L", xco+45+3*wval, yco-87, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
+ uiDefButBitS(block, TOG, ACT_TORQUE_LOCAL, 0, "L", xco+45+3*wval, yco-106, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
+ uiDefButBitS(block, TOG, ACT_LIN_VEL_LOCAL, 0, "L", xco+45+3*wval, yco-129, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
+ uiDefButBitS(block, TOG, ACT_ANG_VEL_LOCAL, 0, "L", xco+45+3*wval, yco-148, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
+ uiDefButBitS(block, TOG, ACT_ADD_LIN_VEL, 0, "add",xco+45+3*wval+15, yco-129, 35, 19, &oa->flag, 0.0, 0.0, 0, 0, "Toggles between ADD and SET linV");
+ }
} else if (oa->type == ACT_OBJECT_SERVO)
{
ysize= 172;
diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c
index 2c7802c3302..58f3bff09c8 100644
--- a/source/blender/src/buttons_object.c
+++ b/source/blender/src/buttons_object.c
@@ -173,6 +173,7 @@ static void constraint_active_func(void *ob_v, void *con_v)
}
lb= get_active_constraints(ob);
+ if (lb == NULL) return;
for(con= lb->first; con; con= con->next) {
if(con==con_v) con->flag |= CONSTRAINT_ACTIVE;
@@ -307,7 +308,7 @@ void del_constr_func (void *ob_v, void *con_v)
}
/* remove constraint itself */
lb= get_active_constraints(ob_v);
- free_constraint_data (con);
+ free_constraint_data(con);
BLI_freelinkN(lb, con);
constraint_active_func(ob_v, NULL);
diff --git a/source/blender/src/buttons_scene.c b/source/blender/src/buttons_scene.c
index 3b0167d673c..fb6a7636e16 100644
--- a/source/blender/src/buttons_scene.c
+++ b/source/blender/src/buttons_scene.c
@@ -763,7 +763,16 @@ static void seq_panel_input()
}
if (last_seq->type == SEQ_IMAGE) {
- StripElem * se = give_stripelem(last_seq, CFRA);
+ int cfra = CFRA;
+ StripElem * se;
+
+ if(last_seq->startdisp >cfra) {
+ cfra = last_seq->startdisp;
+ } else if (last_seq->enddisp <= cfra) {
+ cfra = last_seq->enddisp - 1;
+ }
+
+ se = give_stripelem(last_seq, cfra);
if (se) {
uiDefBut(block, TEX,
diff --git a/source/blender/src/drawgpencil.c b/source/blender/src/drawgpencil.c
index e07dec90629..ee28049e2c0 100644
--- a/source/blender/src/drawgpencil.c
+++ b/source/blender/src/drawgpencil.c
@@ -280,11 +280,15 @@ short draw_gpencil_panel (uiBlock *block, bGPdata *gpd, ScrArea *sa)
/* show override lmb-clicks button + painting lock */
uiBlockBeginAlign(block);
- uiDefButBitI(block, TOG, GP_DATA_EDITPAINT, B_REDR, "Draw Mode", 170, 225, 130, 20, &gpd->flag, 0, 0, 0, 0, "Interpret LMB-click as new strokes (same as holding Shift-Key per stroke)");
-
- uiBlockSetCol(block, TH_BUT_SETTING);
- uiDefIconButBitI(block, ICONTOG, GP_DATA_LMBPLOCK, B_REDR, ICON_UNLOCKED, 300, 225, 20, 20, &gpd->flag, 0.0, 0.0, 0, 0, "Painting cannot occur with Shift-LMB (when making selections)");
- uiBlockSetCol(block, TH_AUTO);
+ if ((gpd->flag & GP_DATA_EDITPAINT)==0) {
+ uiDefButBitI(block, TOG, GP_DATA_EDITPAINT, B_REDR, "Draw Mode", 170, 225, 130, 20, &gpd->flag, 0, 0, 0, 0, "Interpret click-drag as new strokes");
+
+ uiBlockSetCol(block, TH_BUT_SETTING);
+ uiDefIconButBitI(block, ICONTOG, GP_DATA_LMBPLOCK, B_REDR, ICON_UNLOCKED, 300, 225, 20, 20, &gpd->flag, 0.0, 0.0, 0, 0, "Painting cannot occur with Shift-LMB (when making selections)");
+ uiBlockSetCol(block, TH_AUTO);
+ }
+ else
+ uiDefButBitI(block, TOG, GP_DATA_EDITPAINT, B_REDR, "Draw Mode", 170, 225, 150, 20, &gpd->flag, 0, 0, 0, 0, "Interpret click-drag as new strokes");
uiBlockEndAlign(block);
/* 'view align' button (naming depends on context) */
@@ -306,6 +310,8 @@ short draw_gpencil_panel (uiBlock *block, bGPdata *gpd, ScrArea *sa)
/* ************************************************** */
/* GREASE PENCIL DRAWING */
+/* ----- General Defines ------ */
+
/* flags for sflag */
enum {
GP_DRAWDATA_NOSTATUS = (1<<0), /* don't draw status info */
@@ -313,115 +319,294 @@ enum {
GP_DRAWDATA_ONLYV2D = (1<<2), /* only draw 'canvas' strokes */
};
-/* draw a given stroke */
-static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness, short dflag, short sflag, short debug, int winx, int winy)
+/* ----- Tool Buffer Drawing ------ */
+
+/* draw stroke defined in buffer (simple ogl lines/points for now, as dotted lines) */
+static void gp_draw_stroke_buffer (tGPspoint *points, int totpoints, short thickness, short dflag, short sflag)
{
- bGPDspoint *pt;
+ tGPspoint *pt;
int i;
/* error checking */
if ((points == NULL) || (totpoints <= 0))
return;
- /* check if stroke can be drawn */
- if ((dflag & GP_DRAWDATA_ONLY3D) && !(sflag & GP_STROKE_3DSPACE))
- return;
- if (!(dflag & GP_DRAWDATA_ONLY3D) && (sflag & GP_STROKE_3DSPACE))
- return;
- if ((dflag & GP_DRAWDATA_ONLYV2D) && !(sflag & GP_STROKE_2DSPACE))
- return;
- if (!(dflag & GP_DRAWDATA_ONLYV2D) && (sflag & GP_STROKE_2DSPACE))
+ /* check if buffer can be drawn */
+ if (dflag & (GP_DRAWDATA_ONLY3D|GP_DRAWDATA_ONLYV2D))
return;
- /* if drawing a single point, draw it larger */
+ /* if drawing a single point, draw it larger */
if (totpoints == 1) {
/* draw point */
- if (sflag & GP_STROKE_3DSPACE) {
- glBegin(GL_POINTS);
- glVertex3f(points->x, points->y, points->z);
- glEnd();
- }
- else if (sflag & GP_STROKE_2DSPACE) {
- glBegin(GL_POINTS);
- glVertex2f(points->x, points->y);
- glEnd();
- }
- else {
- const float x= (points->x / 1000 * winx);
- const float y= (points->y / 1000 * winy);
-
- glBegin(GL_POINTS);
- glVertex2f(x, y);
- glEnd();
+ glBegin(GL_POINTS);
+ glVertex2f(points->x, points->y);
+ glEnd();
+ }
+ else if (sflag & GP_STROKE_ERASER) {
+ /* draw stroke curve - just standard thickness */
+ setlinestyle(4);
+ glLineWidth(1.0f);
+
+ glBegin(GL_LINE_STRIP);
+ for (i=0, pt=points; i < totpoints && pt; i++, pt++) {
+ glVertex2f(pt->x, pt->y);
}
+ glEnd();
+
+ setlinestyle(0);
}
else {
float oldpressure = 0.0f;
/* draw stroke curve */
+ setlinestyle(2);
+
glBegin(GL_LINE_STRIP);
for (i=0, pt=points; i < totpoints && pt; i++, pt++) {
- float x, y, z;
-
- if (sflag & GP_STROKE_3DSPACE) {
- x= pt->x;
- y= pt->y;
- z= pt->z;
- }
- else if (sflag & GP_STROKE_2DSPACE) {
- x= pt->x;
- y= pt->y;
- z= 0;
- }
- else {
- x= (pt->x / 1000 * winx);
- y= (pt->y / 1000 * winy);
- z= 0;
- }
-
if (fabs(pt->pressure - oldpressure) > 0.2f) {
glEnd();
glLineWidth(pt->pressure * thickness);
glBegin(GL_LINE_STRIP);
- if (sflag & GP_STROKE_3DSPACE)
- glVertex3f(x, y, z);
- else
- glVertex2f(x, y);
+ glVertex2f(pt->x, pt->y);
oldpressure = pt->pressure;
}
+ else
+ glVertex2f(pt->x, pt->y);
+ }
+ glEnd();
+
+ setlinestyle(0);
+ }
+}
+
+/* ----- Existing Strokes Drawing (3D and Point) ------ */
+
+/* draw a given stroke - just a single dot (only one point) */
+static void gp_draw_stroke_point (bGPDspoint *points, short sflag, int winx, int winy)
+{
+ /* draw point */
+ if (sflag & GP_STROKE_3DSPACE) {
+ glBegin(GL_POINTS);
+ glVertex3f(points->x, points->y, points->z);
+ glEnd();
+ }
+ else if (sflag & GP_STROKE_2DSPACE) {
+ glBegin(GL_POINTS);
+ glVertex2f(points->x, points->y);
+ glEnd();
+ }
+ else {
+ const float x= (points->x / 1000 * winx);
+ const float y= (points->y / 1000 * winy);
+
+ glBegin(GL_POINTS);
+ glVertex2f(x, y);
+ glEnd();
+ }
+}
+
+/* draw a given stroke in 3d (i.e. in 3d-space), using simple ogl lines */
+static void gp_draw_stroke_3d (bGPDspoint *points, int totpoints, short thickness, short dflag, short sflag, short debug, int winx, int winy)
+{
+ bGPDspoint *pt;
+ float oldpressure = 0.0f;
+ int i;
+
+ /* draw stroke curve */
+ glBegin(GL_LINE_STRIP);
+ for (i=0, pt=points; i < totpoints && pt; i++, pt++) {
+ if (fabs(pt->pressure - oldpressure) > 0.2f) {
+ glEnd();
+ glLineWidth(pt->pressure * thickness);
+ glBegin(GL_LINE_STRIP);
+
+ glVertex3f(pt->x, pt->y, pt->z);
+
+ oldpressure = pt->pressure;
+ }
+ else
+ glVertex3f(pt->x, pt->y, pt->z);
+ }
+ glEnd();
+
+ /* draw debug points of curve on top? */
+ if (debug) {
+ glBegin(GL_POINTS);
+ for (i=0, pt=points; i < totpoints && pt; i++, pt++)
+ glVertex3f(pt->x, pt->y, pt->z);
+ glEnd();
+ }
+}
+
+/* ----- Fancy 2D-Stroke Drawing ------ */
+
+/* draw a given stroke in 2d */
+static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness, short dflag, short sflag, short debug, int winx, int winy)
+{
+ /* if thickness is less than 3, 'smooth' opengl lines look better */
+ if ((thickness < 3) || (G.rt==0)) {
+ bGPDspoint *pt;
+ int i;
+
+ glBegin(GL_LINE_STRIP);
+ for (i=0, pt=points; i < totpoints && pt; i++, pt++) {
+ if (sflag & GP_STROKE_2DSPACE) {
+ glVertex2f(pt->x, pt->y);
+ }
else {
- if (sflag & GP_STROKE_3DSPACE)
- glVertex3f(x, y, z);
- else
- glVertex2f(x, y);
+ const float x= (pt->x / 1000 * winx);
+ const float y= (pt->y / 1000 * winy);
+
+ glVertex2f(x, y);
}
}
glEnd();
+ }
+ else { /* tesselation code: currently only enabled with rt != 0 */
+ bGPDspoint *pt1, *pt2;
+ float p0[2], p1[2], pm[2];
+ int i;
- /* draw debug points of curve on top? */
- if (debug) {
- glBegin(GL_POINTS);
- for (i=0, pt=points; i < totpoints && pt; i++, pt++) {
- if (sflag & GP_STROKE_3DSPACE) {
- glVertex3f(pt->x, pt->y, pt->z);
- }
- else if (sflag & GP_STROKE_2DSPACE) {
- glVertex2f(pt->x, pt->y);
- }
- else {
- const float x= (pt->x / 1000 * winx);
- const float y= (pt->y / 1000 * winy);
+ glShadeModel(GL_FLAT);
+ glBegin(GL_QUAD_STRIP);
+
+ for (i=0, pt1=points, pt2=points+1; i < (totpoints-1); i++, pt1++, pt2++) {
+ float s0[2], s1[2]; /* segment 'center' points */
+ float t0[2], t1[2]; /* tesselated coordinates */
+ float m1[2], m2[2]; /* gradient and normal */
+ float pthick, dist; /* thickness at segment point, and length of segment */
+ float sminorang; /* minor angle between strokes */
+
+ /* get x and y coordinates from points */
+ if (sflag & GP_STROKE_2DSPACE) {
+ s0[0]= pt1->x; s0[1]= pt1->y;
+ s1[0]= pt2->x; s1[1]= pt2->y;
+ }
+ else {
+ s0[0]= (pt1->x / 1000 * winx);
+ s0[1]= (pt1->y / 1000 * winy);
+ s1[0]= (pt2->x / 1000 * winx);
+ s1[1]= (pt2->y / 1000 * winy);
+ }
+
+ /* calculate gradient and normal - 'angle'=(ny/nx) */
+ m1[1]= s1[1] - s0[1];
+ m1[0]= s1[0] - s0[0];
+ dist = Vec2Lenf(s0, s1);
+ m2[1]= -(m1[0]) / dist;
+ m2[0]= m1[1] / dist;
+
+ /* if the first segment, initialise the first segment using segment's normal */
+ if (i == 0) {
+ pthick= (pt1->pressure * thickness);
+
+ // TODO: also draw/do a round end-cap first
+
+ p0[0]= s0[0] - (pthick * m2[0]);
+ p0[1]= s0[1] - (pthick * m2[1]);
+ p1[0]= s1[0] + (pthick * m2[0]);
+ p1[1]= s1[1] + (pthick * m2[1]);
+
+ Vec2Copyf(pm, m1);
+ }
+
+ /* if the minor angle between the current segment and the previous one is less than 90 degrees */
+ if (i)
+ sminorang= NormalizedVecAngle2_2D(pm, m1);
+ else
+ sminorang= 0.0f;
+
+ if ((IS_EQ(sminorang, 0)==0) && (abs(sminorang) < M_PI_2) )
+ {
+ float closep[2];
+
+ /* recalculate startpoint of segment, where the new start-line:
+ * - starts a new gl-quad-strip
+ * - uses the vert of old startpoint closer to our endpoint
+ * - distance between new startpoints = distance between old startpoints
+ * - new startpoints occur on same gradient as old segment does (has potential for some 'minor' overlap, but ok)
+ */
+
+ /* find the closer vertex, and distance between startpoints */
+ if (Vec2Lenf(p0, s1) > Vec2Lenf(p1, s1))
+ Vec2Copyf(closep, p1);
+ else
+ Vec2Copyf(closep, p0);
- glVertex2f(x, y);
+ /* determine which side this closer vertex should be on */
+ pthick= (pt1->pressure * thickness * 2);
+ if ( ((closep[0] - s0[0]) > 0) || ((closep[1] - s0[1]) > 0) ) {
+ /* assumes this is the 'second' point, (i.e. the 'plus' one), so the other is subtracting */
+ p0[0]= closep[0] - (pthick * pm[0]);
+ p0[1]= closep[1] - (pthick * pm[1]);
+ p1[0]= closep[0];
+ p1[1]= closep[1];
+ }
+ else if ( ((closep[0] - s0[0]) < 0) || ((closep[1] - s0[1]) < 0) ) {
+ /* assumes this is the 'first' point, (i.e. the 'minus' one), so the other is adding */
+ p0[0]= closep[0];
+ p0[1]= closep[1];
+ p1[0]= closep[0] + (pthick * pm[0]);
+ p1[1]= closep[1] + (pthick * pm[1]);
}
+
+ /* reset gl-states! */
+ glEnd();
+ glBegin(GL_QUAD_STRIP);
}
- glEnd();
+
+ /* do the end of this segment */
+ pthick= (pt2->pressure * thickness);
+ t0[0] = s1[0] - (pthick * m2[0]);
+ t0[1] = s1[1] - (pthick * m2[1]);
+ t1[0] = s1[0] + (pthick * m2[0]);
+ t1[1] = s1[1] + (pthick * m2[1]);
+
+ /* draw this segment */
+ glVertex2f(p0[0], p0[1]);
+ glVertex2f(p1[0], p1[1]);
+ glVertex2f(t0[0], t0[1]);
+ glVertex2f(t1[0], t1[1]);
+
+ // TODO: draw end cap if last segment
+ if (i == totpoints-2) {
+
+ }
+
+ /* store current points for next segment to use */
+ Vec2Copyf(p0, t0);
+ Vec2Copyf(p1, t1);
+ Vec2Copyf(pm, m1);
}
+
+ glEnd();
+ }
+
+ /* draw debug points of curve on top? (original stroke points) */
+ if (debug) {
+ bGPDspoint *pt;
+ int i;
+
+ glBegin(GL_POINTS);
+ for (i=0, pt=points; i < totpoints && pt; i++, pt++) {
+ if (sflag & GP_STROKE_2DSPACE) {
+ glVertex2f(pt->x, pt->y);
+ }
+ else {
+ const float x= (pt->x / 1000 * winx);
+ const float y= (pt->y / 1000 * winy);
+
+ glVertex2f(x, y);
+ }
+ }
+ glEnd();
}
}
+/* ----- General Drawing ------ */
+
/* draw a set of strokes */
static void gp_draw_strokes (bGPDframe *gpf, int winx, int winy, int dflag, short debug,
short lthick, float color[4])
@@ -431,9 +616,26 @@ static void gp_draw_strokes (bGPDframe *gpf, int winx, int winy, int dflag, shor
/* set color first (may need to reset it again later too) */
glColor4f(color[0], color[1], color[2], color[3]);
- for (gps= gpf->strokes.first; gps; gps= gps->next) {
- /* just draw the stroke once */
- gp_draw_stroke(gps->points, gps->totpoints, lthick, dflag, gps->flag, debug, winx, winy);
+ for (gps= gpf->strokes.first; gps; gps= gps->next) {
+ /* check if stroke can be drawn */
+ if ((dflag & GP_DRAWDATA_ONLY3D) && !(gps->flag & GP_STROKE_3DSPACE))
+ continue;
+ if (!(dflag & GP_DRAWDATA_ONLY3D) && (gps->flag & GP_STROKE_3DSPACE))
+ continue;
+ if ((dflag & GP_DRAWDATA_ONLYV2D) && !(gps->flag & GP_STROKE_2DSPACE))
+ continue;
+ if (!(dflag & GP_DRAWDATA_ONLYV2D) && (gps->flag & GP_STROKE_2DSPACE))
+ continue;
+ if ((gps->points == 0) || (gps->totpoints < 1))
+ continue;
+
+ /* check which stroke-drawer to use */
+ if (gps->totpoints == 1)
+ gp_draw_stroke_point(gps->points, gps->flag, winx, winy);
+ else if (dflag & GP_DRAWDATA_ONLY3D)
+ gp_draw_stroke_3d(gps->points, gps->totpoints, lthick, dflag, gps->flag, debug, winx, winy);
+ else if (gps->totpoints > 1)
+ gp_draw_stroke(gps->points, gps->totpoints, lthick, dflag, gps->flag, debug, winx, winy);
}
}
@@ -489,8 +691,8 @@ static void gp_draw_data (bGPdata *gpd, int winx, int winy, int dflag)
/* check if frame is drawable */
if ((gpf->framenum - gf->framenum) <= gpl->gstep) {
/* alpha decreases with distance from curframe index */
- tcolor[3] = color[3] - (i * 0.7);
- gp_draw_strokes(gpf, winx, winy, dflag, debug, lthick, tcolor);
+ tcolor[3] = color[3] - (i/gpl->gstep);
+ gp_draw_strokes(gf, winx, winy, dflag, debug, lthick, tcolor);
}
else
break;
@@ -501,8 +703,8 @@ static void gp_draw_data (bGPdata *gpd, int winx, int winy, int dflag)
/* check if frame is drawable */
if ((gf->framenum - gpf->framenum) <= gpl->gstep) {
/* alpha decreases with distance from curframe index */
- tcolor[3] = color[3] - (i * 0.7);
- gp_draw_strokes(gpf, winx, winy, dflag, debug, lthick, tcolor);
+ tcolor[3] = color[3] - (i/gpl->gstep);
+ gp_draw_strokes(gf, winx, winy, dflag, debug, lthick, tcolor);
}
else
break;
@@ -515,12 +717,12 @@ static void gp_draw_data (bGPdata *gpd, int winx, int winy, int dflag)
/* draw the strokes for the ghost frames (at half of the alpha set by user) */
if (gpf->prev) {
tcolor[3] = (color[3] / 7);
- gp_draw_strokes(gpf, winx, winy, dflag, debug, lthick, tcolor);
+ gp_draw_strokes(gpf->prev, winx, winy, dflag, debug, lthick, tcolor);
}
if (gpf->next) {
tcolor[3] = (color[3] / 4);
- gp_draw_strokes(gpf, winx, winy, dflag, debug, lthick, tcolor);
+ gp_draw_strokes(gpf->next, winx, winy, dflag, debug, lthick, tcolor);
}
/* restore alpha */
@@ -533,15 +735,13 @@ static void gp_draw_data (bGPdata *gpd, int winx, int winy, int dflag)
gp_draw_strokes(gpf, winx, winy, dflag, debug, lthick, tcolor);
/* Check if may need to draw the active stroke cache, only if this layer is the active layer
- * that is being edited. (Stroke cache is currently stored in gp-data)
+ * that is being edited. (Stroke buffer is currently stored in gp-data)
*/
if ((G.f & G_GREASEPENCIL) && (gpl->flag & GP_LAYER_ACTIVE) &&
(gpf->flag & GP_FRAME_PAINT))
{
/* Buffer stroke needs to be drawn with a different linestyle to help differentiate them from normal strokes. */
- setlinestyle(2);
- gp_draw_stroke(gpd->sbuffer, gpd->sbuffer_size, lthick, dflag, gpd->sbuffer_sflag, debug, winx, winy);
- setlinestyle(0);
+ gp_draw_stroke_buffer(gpd->sbuffer, gpd->sbuffer_size, lthick, dflag, gpd->sbuffer_sflag);
}
}
@@ -594,7 +794,7 @@ static void gp_draw_data (bGPdata *gpd, int winx, int winy, int dflag)
glColor4f(0, 0, 0, 1);
}
-/* ----------- */
+/* ----- Grease Pencil Sketches Drawing API ------ */
/* draw grease-pencil sketches to specified 2d-view assuming that matrices are already set correctly
* Note: this gets called twice - first time with onlyv2d=1 to draw 'canvas' strokes, second time with onlyv2d=0 for screen-aligned strokes
diff --git a/source/blender/src/drawseq.c b/source/blender/src/drawseq.c
index cc431c73a2e..71a777c9056 100644
--- a/source/blender/src/drawseq.c
+++ b/source/blender/src/drawseq.c
@@ -98,7 +98,7 @@
int no_rightbox=0, no_leftbox= 0;
static void draw_seq_handle(Sequence *seq, SpaceSeq *sseq, float pixelx, short direction);
static void draw_seq_extensions(Sequence *seq, SpaceSeq *sseq);
-static void draw_seq_text(Sequence *seq, float x1, float x2, float y1, float y2);
+static void draw_seq_text(Sequence *seq, float x1, float x2, float y1, float y2, char *background_col);
static void draw_shadedstrip(Sequence *seq, char *col, float x1, float y1, float x2, float y2);
static void draw_seq_strip(struct Sequence *seq, struct ScrArea *sa, struct SpaceSeq *sseq, int outline_tint, float pixelx);
@@ -604,7 +604,7 @@ static void draw_seq_extensions(Sequence *seq, SpaceSeq *sseq)
}
/* draw info text on a sequence strip */
-static void draw_seq_text(Sequence *seq, float x1, float x2, float y1, float y2)
+static void draw_seq_text(Sequence *seq, float x1, float x2, float y1, float y2, char *background_col)
{
float v1[2], v2[2];
int len, size;
@@ -670,8 +670,13 @@ static void draw_seq_text(Sequence *seq, float x1, float x2, float y1, float y2)
mval[1]= 1;
areamouseco_to_ipoco(G.v2d, mval, &x1, &x2);
- if(seq->flag & SELECT) cpack(0xFFFFFF);
- else cpack(0);
+ if(seq->flag & SELECT){
+ cpack(0xFFFFFF);
+ }else if ((((int)background_col[0] + (int)background_col[1] + (int)background_col[2]) / 3) < 50){
+ cpack(0x505050); /* use lighter text colour for dark background */
+ }else{
+ cpack(0);
+ }
glRasterPos3f(x1, y1+SEQ_STRIP_OFSBOTTOM, 0.0);
BMF_DrawString(G.font, strp);
}
@@ -740,7 +745,7 @@ so wave file sample drawing precission is zoom adjusted
static void draw_seq_strip(Sequence *seq, ScrArea *sa, SpaceSeq *sseq, int outline_tint, float pixelx)
{
float x1, x2, y1, y2;
- char col[3], is_single_image;
+ char col[3], background_col[3], is_single_image;
/* we need to know if this is a single image/color or not for drawing */
is_single_image = (char)check_single_seq(seq);
@@ -755,13 +760,14 @@ static void draw_seq_strip(Sequence *seq, ScrArea *sa, SpaceSeq *sseq, int outli
/* get the correct color per strip type*/
- get_seq_color3ubv(seq, col);
+ //get_seq_color3ubv(seq, col);
+ get_seq_color3ubv(seq, background_col);
/* draw the main strip body */
if (is_single_image) /* single image */
- draw_shadedstrip(seq, col, seq_tx_get_final_left(seq, 0), y1, seq_tx_get_final_right(seq, 0), y2);
+ draw_shadedstrip(seq, background_col, seq_tx_get_final_left(seq, 0), y1, seq_tx_get_final_right(seq, 0), y2);
else /* normal operation */
- draw_shadedstrip(seq, col, x1, y1, x2, y2);
+ draw_shadedstrip(seq, background_col, x1, y1, x2, y2);
/* draw additional info and controls */
if (seq->type == SEQ_RAM_SOUND)
@@ -814,7 +820,7 @@ static void draw_seq_strip(Sequence *seq, ScrArea *sa, SpaceSeq *sseq, int outli
/* nice text here would require changing the view matrix for texture text */
if( (x2-x1) / pixelx > 32) {
- draw_seq_text(seq, x1, x2, y1, y2);
+ draw_seq_text(seq, x1, x2, y1, y2, background_col);
}
}
diff --git a/source/blender/src/editarmature.c b/source/blender/src/editarmature.c
index d0f44263fb7..35986fcff4a 100644
--- a/source/blender/src/editarmature.c
+++ b/source/blender/src/editarmature.c
@@ -854,6 +854,7 @@ static void separate_armature_bones (Object *ob, short sel)
BLI_freelistN(&edbo);
}
+/* separate selected bones into their armature */
void separate_armature (void)
{
Object *oldob, *newob;
@@ -1033,87 +1034,6 @@ static void *get_nearest_bone (short findunsel)
return NULL;
}
-/* used by posemode and editmode */
-void select_bone_parent (void)
-{
- Object *ob;
- bArmature *arm;
-
- /* get data */
- if (G.obedit)
- ob= G.obedit;
- else if (OBACT)
- ob= OBACT;
- else
- return;
- arm= (bArmature *)ob->data;
-
- /* determine which mode armature is in */
- if ((!G.obedit) && (ob->flag & OB_POSEMODE)) {
- /* deal with pose channels */
- /* channels are sorted on dependency, so the loop below won't result in a flood-select */
- bPoseChannel *pchan=NULL;
-
- for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- /* check if bone in original selection */
- if (pchan->bone->flag & BONE_SELECTED) {
- bPoseChannel *chanpar= pchan->parent;
-
- /* check if any parent */
- if ((chanpar) && ((chanpar->bone->flag & BONE_SELECTED)==0)) {
- chanpar->bone->flag |= BONE_SELECTED;
- select_actionchannel_by_name (ob->action, pchan->name, 1);
- }
- }
- }
- }
- else if (G.obedit) {
- /* deal with editbones */
- EditBone *curbone, *parbone, *parpar;
-
- /* prevent floods */
- for (curbone= G.edbo.first; curbone; curbone= curbone->next)
- curbone->temp= NULL;
-
- for (curbone= G.edbo.first; curbone; curbone= curbone->next) {
- /* check if bone selected */
- if ((curbone->flag & BONE_SELECTED) && curbone->temp==NULL) {
- parbone= curbone->parent;
-
- /* check if any parent */
- if ((parbone) && ((parbone->flag & BONE_SELECTED)==0)) {
- /* select the parent bone */
- parbone->flag |= (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
-
- /* check if parent has parent */
- parpar= parbone->parent;
-
- if ((parpar) && (parbone->flag & BONE_CONNECTED)) {
- parpar->flag |= BONE_TIPSEL;
- }
- /* tag this bone to not flood selection */
- parbone->temp= parbone;
- }
- }
- }
-
- /* to be sure... */
- for (curbone= G.edbo.first; curbone; curbone= curbone->next)
- curbone->temp= NULL;
-
- }
-
- /* undo + redraw pushes */
- countall(); // flushes selection!
-
- allqueue (REDRAWVIEW3D, 0);
- allqueue (REDRAWBUTSEDIT, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWOOPS, 0);
-
- BIF_undo_push("Select Parent");
-}
-
/* helper for setflag_sel_bone() */
static void bone_setflag (int *bone, int flag, short mode)
{
@@ -1139,6 +1059,90 @@ static void bone_setflag (int *bone, int flag, short mode)
}
}
+/* Get the first available child of an editbone */
+static EditBone *editbone_get_child(EditBone *pabone, short use_visibility)
+{
+ Object *ob;
+ bArmature *arm;
+ EditBone *curbone, *chbone=NULL;
+
+ if (!G.obedit) return NULL;
+ else ob= G.obedit;
+ arm= (bArmature *)ob->data;
+
+ for (curbone= G.edbo.first; curbone; curbone= curbone->next) {
+ if (curbone->parent == pabone) {
+ if (use_visibility) {
+ if ((arm->layer & curbone->layer) && !(pabone->flag & BONE_HIDDEN_A))
+ chbone = curbone;
+ }
+ else
+ chbone = curbone;
+ }
+ }
+
+ return chbone;
+}
+
+void armature_select_hierarchy(short direction, short add_to_sel)
+{
+ Object *ob;
+ bArmature *arm;
+ EditBone *curbone, *pabone, *chbone;
+
+ if (!G.obedit) return;
+ else ob= G.obedit;
+ arm= (bArmature *)ob->data;
+
+ for (curbone= G.edbo.first; curbone; curbone= curbone->next) {
+ if (EBONE_VISIBLE(arm, curbone)) {
+ if (curbone->flag & (BONE_ACTIVE)) {
+ if (direction == BONE_SELECT_PARENT) {
+ if (curbone->parent == NULL) continue;
+ else pabone = curbone->parent;
+
+ if (EBONE_VISIBLE(arm, pabone)) {
+ pabone->flag |= (BONE_ACTIVE|BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
+ if (pabone->parent) pabone->parent->flag |= BONE_TIPSEL;
+
+ if (!add_to_sel) curbone->flag &= ~(BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
+ curbone->flag &= ~BONE_ACTIVE;
+ break;
+ }
+
+ }
+ else { // BONE_SELECT_CHILD
+ chbone = editbone_get_child(curbone, 1);
+ if (chbone == NULL) continue;
+
+ if (EBONE_VISIBLE(arm, chbone)) {
+ chbone->flag |= (BONE_ACTIVE|BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
+
+ if (!add_to_sel) {
+ curbone->flag &= ~(BONE_SELECTED|BONE_ROOTSEL);
+ if (curbone->parent) curbone->parent->flag &= ~BONE_TIPSEL;
+ }
+ curbone->flag &= ~BONE_ACTIVE;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ countall(); // flushes selection!
+
+ allqueue (REDRAWVIEW3D, 0);
+ allqueue (REDRAWBUTSEDIT, 0);
+ allqueue (REDRAWBUTSOBJECT, 0);
+ allqueue (REDRAWOOPS, 0);
+
+ if (direction==BONE_SELECT_PARENT)
+ BIF_undo_push("Select edit bone parent");
+ if (direction==BONE_SELECT_CHILD)
+ BIF_undo_push("Select edit bone child");
+}
+
/* used by posemode and editmode */
void setflag_armature (short mode)
{
@@ -1157,17 +1161,18 @@ void setflag_armature (short mode)
/* get flag to set (sync these with the ones used in eBone_Flag */
if (mode == 2)
- flag= pupmenu("Disable Setting%t|Draw Wire%x1|Deform%x2|Mult VG%x3|Hinge%x4|No Scale%x5");
+ flag= pupmenu("Disable Setting%t|Draw Wire%x1|Deform%x2|Mult VG%x3|Hinge%x4|No Scale%x5|Locked%x6");
else if (mode == 1)
- flag= pupmenu("Enable Setting%t|Draw Wire%x1|Deform%x2|Mult VG%x3|Hinge%x4|No Scale%x5");
+ flag= pupmenu("Enable Setting%t|Draw Wire%x1|Deform%x2|Mult VG%x3|Hinge%x4|No Scale%x5|Locked%x6");
else
- flag= pupmenu("Toggle Setting%t|Draw Wire%x1|Deform%x2|Mult VG%x3|Hinge%x4|No Scale%x5");
+ flag= pupmenu("Toggle Setting%t|Draw Wire%x1|Deform%x2|Mult VG%x3|Hinge%x4|No Scale%x5|Locked%x6");
switch (flag) {
case 1: flag = BONE_DRAWWIRE; break;
case 2: flag = BONE_NO_DEFORM; break;
case 3: flag = BONE_MULT_VG_ENV; break;
case 4: flag = BONE_HINGE; break;
case 5: flag = BONE_NO_SCALE; break;
+ case 6: flag = BONE_EDITMODE_LOCKED; break;
default: return;
}
@@ -1723,12 +1728,12 @@ void auto_align_armature(short mode)
float *cursor= give_cursor();
for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
- if (arm->layer & ebone->layer) {
+ if (EBONE_VISIBLE(arm, ebone)) {
if (arm->flag & ARM_MIRROR_EDIT)
flipbone = armature_bone_get_mirrored(ebone);
if ((ebone->flag & BONE_SELECTED) ||
- (flipbone && flipbone->flag & BONE_SELECTED))
+ (flipbone && (flipbone->flag & BONE_SELECTED)))
{
/* specific method used to calculate roll depends on mode */
if (mode == 1) {
@@ -1973,7 +1978,7 @@ void addvert_armature(void)
/* find the active or selected bone */
for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
- if (arm->layer & ebone->layer) {
+ if (EBONE_VISIBLE(arm, ebone)) {
if (ebone->flag & (BONE_ACTIVE|BONE_TIPSEL))
break;
}
@@ -1981,7 +1986,7 @@ void addvert_armature(void)
if (ebone==NULL) {
for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
- if (arm->layer & ebone->layer) {
+ if (EBONE_VISIBLE(arm, ebone)) {
if (ebone->flag & (BONE_ACTIVE|BONE_ROOTSEL))
break;
}
@@ -2064,11 +2069,12 @@ static EditBone *get_named_editbone(char *name)
{
EditBone *eBone;
- if (name)
+ if (name) {
for (eBone=G.edbo.first; eBone; eBone=eBone->next) {
if (!strcmp(name, eBone->name))
return eBone;
}
+ }
return NULL;
}
@@ -2134,7 +2140,7 @@ void adduplicate_armature(void)
/* Select mirrored bones */
if (arm->flag & ARM_MIRROR_EDIT) {
for (curBone=G.edbo.first; curBone; curBone=curBone->next) {
- if (arm->layer & curBone->layer) {
+ if (EBONE_VISIBLE(arm, curBone)) {
if (curBone->flag & BONE_SELECTED) {
eBone = armature_bone_get_mirrored(curBone);
if (eBone)
@@ -2146,13 +2152,13 @@ void adduplicate_armature(void)
/* Find the selected bones and duplicate them as needed */
for (curBone=G.edbo.first; curBone && curBone!=firstDup; curBone=curBone->next) {
- if (arm->layer & curBone->layer) {
+ if (EBONE_VISIBLE(arm, curBone)) {
if (curBone->flag & BONE_SELECTED) {
eBone=MEM_callocN(sizeof(EditBone), "addup_editbone");
eBone->flag |= BONE_SELECTED;
/* Copy data from old bone to new bone */
- memcpy (eBone, curBone, sizeof(EditBone));
+ memcpy(eBone, curBone, sizeof(EditBone));
curBone->temp = eBone;
eBone->temp = curBone;
@@ -2202,7 +2208,7 @@ void adduplicate_armature(void)
/* Run though the list and fix the pointers */
for (curBone=G.edbo.first; curBone && curBone!=firstDup; curBone=curBone->next) {
- if (arm->layer & curBone->layer) {
+ if (EBONE_VISIBLE(arm, curBone)) {
if (curBone->flag & BONE_SELECTED) {
eBone=(EditBone*) curBone->temp;
@@ -2234,7 +2240,7 @@ void adduplicate_armature(void)
/* Deselect the old bones and select the new ones */
for (curBone=G.edbo.first; curBone && curBone!=firstDup; curBone=curBone->next) {
- if (arm->layer & curBone->layer)
+ if (EBONE_VISIBLE(arm, curBone))
curBone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL | BONE_ACTIVE);
}
@@ -2371,7 +2377,7 @@ void fill_bones_armature(void)
/* loop over all bones, and only consider if visible */
for (ebo= G.edbo.first; ebo; ebo= ebo->next) {
- if ((arm->layer & ebo->layer) && !(ebo->flag & BONE_HIDDEN_A)) {
+ if (EBONE_VISIBLE(arm, ebo)) {
if (!(ebo->flag & BONE_CONNECTED) && (ebo->flag & BONE_ROOTSEL))
fill_add_joint(ebo, 0, &points);
if (ebo->flag & BONE_TIPSEL)
@@ -2606,7 +2612,7 @@ void merge_armature(void)
/* only consider bones that are visible and selected */
for (ebo=chain->data; ebo; child=ebo, ebo=ebo->parent) {
/* check if visible + selected */
- if ( (arm->layer & ebo->layer) && !(ebo->flag & BONE_HIDDEN_A) &&
+ if ( EBONE_VISIBLE(arm, ebo) &&
((ebo->flag & BONE_CONNECTED) || (ebo->parent==NULL)) &&
(ebo->flag & (BONE_SELECTED|BONE_ACTIVE)) )
{
@@ -2657,7 +2663,7 @@ void hide_selected_armature_bones(void)
EditBone *ebone;
for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
- if (arm->layer & ebone->layer) {
+ if (EBONE_VISIBLE(arm, ebone)) {
if (ebone->flag & (BONE_SELECTED)) {
ebone->flag &= ~(BONE_TIPSEL|BONE_SELECTED|BONE_ROOTSEL|BONE_ACTIVE);
ebone->flag |= BONE_HIDDEN_A;
@@ -2676,7 +2682,7 @@ void hide_unselected_armature_bones(void)
for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
bArmature *arm= G.obedit->data;
- if (arm->layer & ebone->layer) {
+ if (EBONE_VISIBLE(arm, ebone)) {
if (ebone->flag & (BONE_TIPSEL|BONE_SELECTED|BONE_ROOTSEL));
else {
ebone->flag &= ~BONE_ACTIVE;
@@ -2709,32 +2715,6 @@ 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|BONE_TIPSEL|BONE_ROOTSEL)) {
- 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)
{
@@ -2801,7 +2781,7 @@ void make_bone_parent(void)
/* find active bone to parent to */
for (actbone = G.edbo.first; actbone; actbone=actbone->next) {
- if (arm->layer & actbone->layer) {
+ if (EBONE_VISIBLE(arm, actbone)) {
if (actbone->flag & BONE_ACTIVE)
break;
}
@@ -2813,7 +2793,7 @@ void make_bone_parent(void)
/* find selected bones */
for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
- if (arm->layer & ebone->layer) {
+ if (EBONE_VISIBLE(arm, ebone)) {
if ((ebone->flag & BONE_SELECTED) && (ebone != actbone)) {
foundselbone++;
if (ebone->parent != actbone) allchildbones= 1;
@@ -2849,7 +2829,7 @@ void make_bone_parent(void)
else {
/* loop through all editbones, parenting all selected bones to the active bone */
for (selbone = G.edbo.first; selbone; selbone=selbone->next) {
- if (arm->layer & selbone->layer) {
+ if (EBONE_VISIBLE(arm, selbone)) {
if ((selbone->flag & BONE_SELECTED) && (selbone!=actbone)) {
/* parent selbone to actbone */
bone_connect_to_new_parent(selbone, actbone, val);
@@ -2907,7 +2887,7 @@ void clear_bone_parent(void)
if (val<1) return;
for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
- if (arm->layer & ebone->layer) {
+ if (EBONE_VISIBLE(arm, ebone)) {
if (ebone->flag & BONE_SELECTED) {
if (arm->flag & ARM_MIRROR_EDIT)
flipbone = armature_bone_get_mirrored(ebone);
@@ -2957,7 +2937,7 @@ void unique_editbone_name (ListBase *ebones, char *name)
}
for (number = 1; number <=999; number++) {
- sprintf (tempname, "%s.%03d", name, number);
+ sprintf(tempname, "%s.%03d", name, number);
if (!editbone_name_exists(ebones, tempname)) {
BLI_strncpy(name, tempname, 32);
return;
@@ -2978,7 +2958,7 @@ void extrude_armature(int forked)
/* since we allow root extrude too, we have to make sure selection is OK */
for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
- if (arm->layer & ebone->layer) {
+ if (EBONE_VISIBLE(arm, ebone)) {
if (ebone->flag & BONE_ROOTSEL) {
if (ebone->parent && (ebone->flag & BONE_CONNECTED)) {
if (ebone->parent->flag & BONE_TIPSEL)
@@ -2990,7 +2970,7 @@ void extrude_armature(int forked)
/* Duplicate the necessary bones */
for (ebone = G.edbo.first; ((ebone) && (ebone!=first)); ebone=ebone->next) {
- if (arm->layer & ebone->layer) {
+ if (EBONE_VISIBLE(arm, ebone)) {
/* we extrude per definition the tip */
do_extrude= 0;
if (ebone->flag & (BONE_TIPSEL|BONE_SELECTED))
@@ -3004,7 +2984,7 @@ void extrude_armature(int forked)
if (do_extrude) {
/* we re-use code for mirror editing... */
flipbone= NULL;
- if(arm->flag & ARM_MIRROR_EDIT) {
+ if (arm->flag & ARM_MIRROR_EDIT) {
flipbone= armature_bone_get_mirrored(ebone);
if (flipbone) {
forked= 0; // we extrude 2 different bones
@@ -3034,7 +3014,7 @@ void extrude_armature(int forked)
newbone->parent = ebone;
newbone->flag = ebone->flag & BONE_TIPSEL; // copies it, in case mirrored bone
-
+
if (newbone->parent) newbone->flag |= BONE_CONNECTED;
}
else {
@@ -3044,7 +3024,7 @@ void extrude_armature(int forked)
newbone->flag= BONE_TIPSEL;
- if (newbone->parent && ebone->flag & BONE_CONNECTED) {
+ if (newbone->parent && (ebone->flag & BONE_CONNECTED)) {
newbone->flag |= BONE_CONNECTED;
}
}
@@ -3063,8 +3043,8 @@ void extrude_armature(int forked)
BLI_strncpy (newbone->name, ebone->name, 32);
if (flipbone && forked) { // only set if mirror edit
- if(strlen(newbone->name)<30) {
- if(a==0) strcat(newbone->name, "_L");
+ if (strlen(newbone->name)<30) {
+ if (a==0) strcat(newbone->name, "_L");
else strcat(newbone->name, "_R");
}
}
@@ -3109,7 +3089,7 @@ void subdivide_armature(int numcuts)
if (numcuts < 1) return;
for (mbone = G.edbo.last; mbone; mbone= mbone->prev) {
- if (arm->layer & mbone->layer) {
+ if (EBONE_VISIBLE(arm, mbone)) {
if (mbone->flag & BONE_SELECTED) {
for (i=numcuts+1; i>1; i--) {
/* compute cut ratio first */
@@ -3174,6 +3154,59 @@ void subdivide_armature(int numcuts)
else BIF_undo_push("Subdivide multi");
}
+/* switch direction of bone chains */
+void switch_direction_armature (void)
+{
+ bArmature *arm= (G.obedit) ? G.obedit->data : NULL;
+ ListBase chains = {NULL, NULL};
+ LinkData *chain;
+
+ /* error checking paranoia */
+ if (arm == NULL)
+ return;
+
+ /* get chains of bones (ends on chains) */
+ chains_find_tips(&chains);
+ if (chains.first == NULL) return;
+
+ /* loop over chains, only considering selected and visible bones */
+ for (chain= chains.first; chain; chain= chain->next) {
+ EditBone *ebo, *child=NULL, *parent=NULL;
+
+ /* loop over bones in chain */
+ for (ebo= chain->data; ebo; child= ebo, ebo=parent) {
+ parent= ebo->parent;
+
+ /* only if selected and editable */
+ if (EBONE_VISIBLE(arm, ebo) && EBONE_EDITABLE(ebo)) {
+ /* swap head and tail coordinates */
+ SWAP(float, ebo->head[0], ebo->tail[0]);
+ SWAP(float, ebo->head[1], ebo->tail[1]);
+ SWAP(float, ebo->head[2], ebo->tail[2]);
+
+ /* do parent swapping:
+ * - use 'child' as new parent
+ * - connected flag is only set if points are coincidental
+ */
+ ebo->parent= child;
+ if ((child) && VecEqual(ebo->head, child->tail))
+ ebo->flag |= BONE_CONNECTED;
+ else
+ ebo->flag &= ~BONE_CONNECTED;
+
+ /* FIXME: other things that need fixing?
+ * i.e. roll?
+ */
+ }
+ }
+ }
+
+ /* free chains */
+ BLI_freelistN(&chains);
+
+ BIF_undo_push("Switch Direction");
+}
+
/* ***************** Pose tools ********************* */
void clear_armature(Object *ob, char mode)
diff --git a/source/blender/src/editimasel.c b/source/blender/src/editimasel.c
index 67e10d771e0..97ddc2e0f1d 100644
--- a/source/blender/src/editimasel.c
+++ b/source/blender/src/editimasel.c
@@ -1076,6 +1076,12 @@ void winqreadimaselspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
toggle_blockhandler(sa, IMASEL_HANDLER_IMAGE, UI_PNL_UNSTOW);
scrarea_queue_winredraw(sa);
break;
+ case HKEY:
+ simasel->flag ^= FILE_HIDE_DOT;
+ BIF_filelist_free(simasel->files);
+ do_draw= 1;
+ do_headdraw= 1;
+ break;
case PKEY:
if(G.qual & LR_SHIFTKEY) {
extern char bprogname[]; /* usiblender.c */
diff --git a/source/blender/src/editipo.c b/source/blender/src/editipo.c
index c5dd41e16d5..aa7787c5905 100644
--- a/source/blender/src/editipo.c
+++ b/source/blender/src/editipo.c
@@ -82,6 +82,7 @@
#include "BKE_group.h"
#include "BKE_ipo.h"
#include "BKE_key.h"
+#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_particle.h"
#include "BKE_texture.h"
@@ -933,6 +934,9 @@ static void make_editipo(void)
ob->ipowin= ID_TE;
make_texture_editipo(G.sipo);
}
+ else if(G.scene->world && give_current_world_texture()) {
+ make_texture_editipo(G.sipo);
+ }
}
else if(G.sipo->blocktype==ID_CA) {
if (ob) {
@@ -1120,6 +1124,11 @@ static void get_ipo_context(short blocktype, ID **from, Ipo **ipo, char *actname
*from= (ID *)tex;
if(tex) *ipo= tex->ipo;
}
+ else if(G.scene->world) {
+ Tex *tex= give_current_world_texture();
+ *from= (ID *)tex;
+ if(tex) *ipo= tex->ipo;
+ }
}
else if(blocktype==ID_MA) {
if(ob) {
diff --git a/source/blender/src/editmesh_mods.c b/source/blender/src/editmesh_mods.c
index 448a1019d29..d1a4f77cd27 100644
--- a/source/blender/src/editmesh_mods.c
+++ b/source/blender/src/editmesh_mods.c
@@ -1429,361 +1429,398 @@ int mesh_layers_menu(CustomData *data, int type) {
return ret;
}
-/* ctrl+c in mesh editmode */
-void mesh_copy_menu(void)
+void EM_mesh_copy_edge(short type)
{
EditMesh *em = G.editMesh;
EditSelection *ese;
- short ret, change=0;
+ short change=0;
+
+ EditEdge *eed, *eed_act;
+ float vec[3], vec_mid[3], eed_len, eed_len_act;
if (!em) return;
ese = em->selected.last;
+ if (!ese) return;
- /* Faces can have a NULL ese, so dont return on a NULL ese here */
+ eed_act = (EditEdge*)ese->data;
- if(ese && ese->type == EDITVERT) {
-
- if (!ese) return;
- /*EditVert *ev, *ev_act = (EditVert*)ese->data;
- ret= pupmenu("");*/
- } else if(ese && ese->type == EDITEDGE) {
- EditEdge *eed, *eed_act;
- float vec[3], vec_mid[3], eed_len, eed_len_act;
-
- if (!ese) return;
-
- eed_act = (EditEdge*)ese->data;
-
- ret= pupmenu("Copy Active Edge to Selected%t|Crease%x1|Bevel Weight%x2|Length%x3");
- if (ret<1) return;
-
- eed_len_act = VecLenf(eed_act->v1->co, eed_act->v2->co);
-
- switch (ret) {
- case 1: /* copy crease */
- for(eed=em->edges.first; eed; eed=eed->next) {
- if (eed->f & SELECT && eed != eed_act && eed->crease != eed_act->crease) {
- eed->crease = eed_act->crease;
- change = 1;
- }
+ switch (type) {
+ case 1: /* copy crease */
+ for(eed=em->edges.first; eed; eed=eed->next) {
+ if (eed->f & SELECT && eed != eed_act && eed->crease != eed_act->crease) {
+ eed->crease = eed_act->crease;
+ change = 1;
}
- break;
- case 2: /* copy bevel weight */
- for(eed=em->edges.first; eed; eed=eed->next) {
- if (eed->f & SELECT && eed != eed_act && eed->bweight != eed_act->bweight) {
- eed->bweight = eed_act->bweight;
- change = 1;
- }
+ }
+ break;
+ case 2: /* copy bevel weight */
+ for(eed=em->edges.first; eed; eed=eed->next) {
+ if (eed->f & SELECT && eed != eed_act && eed->bweight != eed_act->bweight) {
+ eed->bweight = eed_act->bweight;
+ change = 1;
}
- break;
-
- case 3: /* copy length */
-
- for(eed=em->edges.first; eed; eed=eed->next) {
- if (eed->f & SELECT && eed != eed_act) {
-
- eed_len = VecLenf(eed->v1->co, eed->v2->co);
-
- if (eed_len == eed_len_act) continue;
- /* if this edge is zero length we cont do anything with it*/
- if (eed_len == 0.0f) continue;
- if (eed_len_act == 0.0f) {
- VecAddf(vec_mid, eed->v1->co, eed->v2->co);
- VecMulf(vec_mid, 0.5);
- VECCOPY(eed->v1->co, vec_mid);
- VECCOPY(eed->v2->co, vec_mid);
- } else {
- /* copy the edge length */
- VecAddf(vec_mid, eed->v1->co, eed->v2->co);
- VecMulf(vec_mid, 0.5);
-
- /* SCALE 1 */
- VecSubf(vec, eed->v1->co, vec_mid);
- VecMulf(vec, eed_len_act/eed_len);
- VecAddf(eed->v1->co, vec, vec_mid);
-
- /* SCALE 2 */
- VecSubf(vec, eed->v2->co, vec_mid);
- VecMulf(vec, eed_len_act/eed_len);
- VecAddf(eed->v2->co, vec, vec_mid);
- }
- change = 1;
+ }
+ break;
+
+ case 3: /* copy length */
+ eed_len_act = VecLenf(eed_act->v1->co, eed_act->v2->co);
+ for(eed=em->edges.first; eed; eed=eed->next) {
+ if (eed->f & SELECT && eed != eed_act) {
+
+ eed_len = VecLenf(eed->v1->co, eed->v2->co);
+
+ if (eed_len == eed_len_act) continue;
+ /* if this edge is zero length we cont do anything with it*/
+ if (eed_len == 0.0f) continue;
+ if (eed_len_act == 0.0f) {
+ VecAddf(vec_mid, eed->v1->co, eed->v2->co);
+ VecMulf(vec_mid, 0.5);
+ VECCOPY(eed->v1->co, vec_mid);
+ VECCOPY(eed->v2->co, vec_mid);
+ } else {
+ /* copy the edge length */
+ VecAddf(vec_mid, eed->v1->co, eed->v2->co);
+ VecMulf(vec_mid, 0.5);
+
+ /* SCALE 1 */
+ VecSubf(vec, eed->v1->co, vec_mid);
+ VecMulf(vec, eed_len_act/eed_len);
+ VecAddf(eed->v1->co, vec, vec_mid);
+
+ /* SCALE 2 */
+ VecSubf(vec, eed->v2->co, vec_mid);
+ VecMulf(vec, eed_len_act/eed_len);
+ VecAddf(eed->v2->co, vec, vec_mid);
}
+ change = 1;
}
-
- if (change)
- recalc_editnormals();
-
-
- break;
}
+
+ if (change)
+ recalc_editnormals();
+
+ break;
+ }
+
+ if (change) {
+ DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
+ allqueue(REDRAWVIEW3D, 0);
+ allqueue(REDRAWBUTSEDIT, 0);
- } else if(ese==NULL || ese->type == EDITFACE) {
- EditFace *efa, *efa_act;
- MTFace *tf, *tf_act = NULL;
- MCol *mcol, *mcol_act = NULL;
-
- efa_act = EM_get_actFace(0);
-
- if (efa_act) {
- ret= pupmenu(
- "Copy Face Selected%t|"
- "Active Material%x1|Active Image%x2|Active UV Coords%x3|"
- "Active Mode%x4|Active Transp%x5|Active Vertex Colors%x6|%l|"
-
- "TexFace UVs from layer%x7|"
- "TexFace Images from layer%x8|"
- "TexFace All from layer%x9|"
- "Vertex Colors from layer%x10");
- if (ret<1) return;
- tf_act = CustomData_em_get(&em->fdata, efa_act->data, CD_MTFACE);
- mcol_act = CustomData_em_get(&em->fdata, efa_act->data, CD_MCOL);
- } else {
- ret= pupmenu(
- "Copy Face Selected%t|"
-
- /* Make sure these are always the same as above */
- "TexFace UVs from layer%x7|"
- "TexFace Images from layer%x8|"
- "TexFace All from layer%x9|"
- "Vertex Colors from layer%x10");
- if (ret<1) return;
+ BIF_undo_push("Copy Edge Attribute");
+ }
+}
+
+void EM_mesh_copy_face(short type)
+{
+ EditMesh *em = G.editMesh;
+ short change=0;
+
+ EditFace *efa, *efa_act;
+ MTFace *tf, *tf_act = NULL;
+ MCol *mcol, *mcol_act = NULL;
+ if (!em) return;
+ efa_act = EM_get_actFace(0);
+
+ if (!efa_act) return;
+
+ tf_act = CustomData_em_get(&em->fdata, efa_act->data, CD_MTFACE);
+ mcol_act = CustomData_em_get(&em->fdata, efa_act->data, CD_MCOL);
+
+ switch (type) {
+ case 1: /* copy material */
+ for(efa=em->faces.first; efa; efa=efa->next) {
+ if (efa->f & SELECT && efa->mat_nr != efa_act->mat_nr) {
+ efa->mat_nr = efa_act->mat_nr;
+ change = 1;
+ }
}
-
- switch (ret) {
- case 1: /* copy material */
- for(efa=em->faces.first; efa; efa=efa->next) {
- if (efa->f & SELECT && efa->mat_nr != efa_act->mat_nr) {
- efa->mat_nr = efa_act->mat_nr;
- change = 1;
+ break;
+ case 2: /* copy image */
+ if (!tf_act) {
+ error("mesh has no uv/image layers");
+ return;
+ }
+ for(efa=em->faces.first; efa; efa=efa->next) {
+ if (efa->f & SELECT && efa != efa_act) {
+ tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+ if (tf_act->tpage) {
+ tf->tpage = tf_act->tpage;
+ tf->mode |= TF_TEX;
+ } else {
+ tf->tpage = NULL;
+ tf->mode &= ~TF_TEX;
}
+ tf->tile= tf_act->tile;
+ change = 1;
}
- break;
- case 2: /* copy image */
- if (!tf_act) {
- error("mesh has no uv/image layers");
- return;
+ }
+ break;
+
+ case 3: /* copy UV's */
+ if (!tf_act) {
+ error("mesh has no uv/image layers");
+ return;
+ }
+ for(efa=em->faces.first; efa; efa=efa->next) {
+ if (efa->f & SELECT && efa != efa_act) {
+ tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+ memcpy(tf->uv, tf_act->uv, sizeof(tf->uv));
+ change = 1;
}
- for(efa=em->faces.first; efa; efa=efa->next) {
- if (efa->f & SELECT && efa != efa_act) {
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (tf_act->tpage) {
- tf->tpage = tf_act->tpage;
- tf->mode |= TF_TEX;
- } else {
- tf->tpage = NULL;
- tf->mode &= ~TF_TEX;
- }
- tf->tile= tf_act->tile;
- change = 1;
- }
+ }
+ break;
+ case 4: /* mode's */
+ if (!tf_act) {
+ error("mesh has no uv/image layers");
+ return;
+ }
+ for(efa=em->faces.first; efa; efa=efa->next) {
+ if (efa->f & SELECT && efa != efa_act) {
+ tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+ tf->mode= tf_act->mode;
+ change = 1;
}
- break;
-
- case 3: /* copy UV's */
- if (!tf_act) {
- error("mesh has no uv/image layers");
- return;
+ }
+ break;
+ case 5: /* copy transp's */
+ if (!tf_act) {
+ error("mesh has no uv/image layers");
+ return;
+ }
+ for(efa=em->faces.first; efa; efa=efa->next) {
+ if (efa->f & SELECT && efa != efa_act) {
+ tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+ tf->transp= tf_act->transp;
+ change = 1;
}
+ }
+ break;
+
+ case 6: /* copy vcols's */
+ if (!mcol_act) {
+ error("mesh has no color layers");
+ return;
+ } else {
+ /* guess the 4th color if needs be */
+ float val =- 1;
+
+ if (!efa_act->v4) {
+ /* guess the othe vale, we may need to use it
+ *
+ * Modifying the 4th value of the mcol is ok here since its not seen
+ * on a triangle
+ * */
+ val = ((float)(mcol_act->r + (mcol_act+1)->r + (mcol_act+2)->r)) / 3; CLAMP(val, 0, 255);
+ (mcol_act+3)->r = (char)val;
+
+ val = ((float)(mcol_act->g + (mcol_act+1)->g + (mcol_act+2)->g)) / 3; CLAMP(val, 0, 255);
+ (mcol_act+3)->g = (char)val;
+
+ val = ((float)(mcol_act->b + (mcol_act+1)->b + (mcol_act+2)->b)) / 3; CLAMP(val, 0, 255);
+ (mcol_act+3)->b = (char)val;
+ }
+
+
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT && efa != efa_act) {
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- memcpy(tf->uv, tf_act->uv, sizeof(tf->uv));
+ /* TODO - make copy from tri to quad guess the 4th vert */
+ mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
+ memcpy(mcol, mcol_act, sizeof(MCol)*4);
change = 1;
}
}
- break;
- case 4: /* mode's */
- if (!tf_act) {
- error("mesh has no uv/image layers");
+ }
+ break;
+ }
+
+ if (change) {
+ DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
+ allqueue(REDRAWVIEW3D, 0);
+ allqueue(REDRAWBUTSEDIT, 0);
+ if (type==3) {
+ allqueue(REDRAWIMAGE, 0);
+ }
+
+ BIF_undo_push("Copy Face Attribute");
+ }
+}
+
+
+void EM_mesh_copy_face_layer(short type)
+{
+ EditMesh *em = G.editMesh;
+ short change=0;
+
+ EditFace *efa;
+ MTFace *tf, *tf_from;
+ MCol *mcol, *mcol_from;
+
+ if (!em) return;
+
+ switch(type) {
+ case 7:
+ case 8:
+ case 9:
+ if (CustomData_number_of_layers(&em->fdata, CD_MTFACE)<2) {
+ error("mesh does not have multiple uv/image layers");
+ return;
+ } else {
+ int layer_orig_idx, layer_idx;
+
+ layer_idx = mesh_layers_menu(&em->fdata, CD_MTFACE);
+ if (layer_idx<0) return;
+
+ /* warning, have not updated mesh pointers however this is not needed since we swicth back */
+ layer_orig_idx = CustomData_get_active_layer(&em->fdata, CD_MTFACE);
+ if (layer_idx==layer_orig_idx)
return;
- }
+
+ /* get the tfaces */
+ CustomData_set_layer_active(&em->fdata, CD_MTFACE, (int)layer_idx);
+ /* store the tfaces in our temp */
for(efa=em->faces.first; efa; efa=efa->next) {
- if (efa->f & SELECT && efa != efa_act) {
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- tf->mode= tf_act->mode;
- change = 1;
- }
+ if (efa->f & SELECT) {
+ efa->tmp.p = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+ }
}
- break;
- case 5: /* copy transp's */
- if (!tf_act) {
- error("mesh has no uv/image layers");
+ CustomData_set_layer_active(&em->fdata, CD_MTFACE, layer_orig_idx);
+ }
+ break;
+
+ case 10: /* select vcol layers - make sure this stays in sync with above code */
+ if (CustomData_number_of_layers(&em->fdata, CD_MCOL)<2) {
+ error("mesh does not have multiple color layers");
+ return;
+ } else {
+ int layer_orig_idx, layer_idx;
+
+ layer_idx = mesh_layers_menu(&em->fdata, CD_MCOL);
+ if (layer_idx<0) return;
+
+ /* warning, have not updated mesh pointers however this is not needed since we swicth back */
+ layer_orig_idx = CustomData_get_active_layer(&em->fdata, CD_MCOL);
+ if (layer_idx==layer_orig_idx)
return;
- }
+
+ /* get the tfaces */
+ CustomData_set_layer_active(&em->fdata, CD_MCOL, (int)layer_idx);
+ /* store the tfaces in our temp */
for(efa=em->faces.first; efa; efa=efa->next) {
- if (efa->f & SELECT && efa != efa_act) {
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- tf->transp= tf_act->transp;
- change = 1;
- }
- }
- break;
-
- case 6: /* copy vcols's */
- if (!mcol_act) {
- error("mesh has no color layers");
- return;
- } else {
- /* guess the 4th color if needs be */
- float val =- 1;
-
- if (!efa_act->v4) {
- /* guess the othe vale, we may need to use it
- *
- * Modifying the 4th value of the mcol is ok here since its not seen
- * on a triangle
- * */
- val = ((float)(mcol_act->r + (mcol_act+1)->r + (mcol_act+2)->r)) / 3; CLAMP(val, 0, 255);
- (mcol_act+3)->r = (char)val;
-
- val = ((float)(mcol_act->g + (mcol_act+1)->g + (mcol_act+2)->g)) / 3; CLAMP(val, 0, 255);
- (mcol_act+3)->g = (char)val;
-
- val = ((float)(mcol_act->b + (mcol_act+1)->b + (mcol_act+2)->b)) / 3; CLAMP(val, 0, 255);
- (mcol_act+3)->b = (char)val;
- }
-
-
- for(efa=em->faces.first; efa; efa=efa->next) {
- if (efa->f & SELECT && efa != efa_act) {
- /* TODO - make copy from tri to quad guess the 4th vert */
- mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
- memcpy(mcol, mcol_act, sizeof(MCol)*4);
- change = 1;
- }
- }
- }
-
- break;
-
- /* Copy from layer - Warning! tf_act and mcol_act will be NULL here */
- case 7:
- case 8:
- case 9:
- if (CustomData_number_of_layers(&em->fdata, CD_MTFACE)<2) {
- error("mesh does not have multiple uv/image layers");
- return;
- } else {
- int layer_orig_idx, layer_idx;
-
- layer_idx = mesh_layers_menu(&em->fdata, CD_MTFACE);
- if (layer_idx<0) return;
-
- /* warning, have not updated mesh pointers however this is not needed since we swicth back */
- layer_orig_idx = CustomData_get_active_layer(&em->fdata, CD_MTFACE);
- if (layer_idx==layer_orig_idx)
- return;
-
- /* get the tfaces */
- CustomData_set_layer_active(&em->fdata, CD_MTFACE, (int)layer_idx);
- /* store the tfaces in our temp */
- for(efa=em->faces.first; efa; efa=efa->next) {
- if (efa->f & SELECT) {
- efa->tmp.p = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- }
- }
- CustomData_set_layer_active(&em->fdata, CD_MTFACE, layer_orig_idx);
- }
- break;
-
- case 10: /* select vcol layers - make sure this stays in sync with above code */
- if (CustomData_number_of_layers(&em->fdata, CD_MCOL)<2) {
- error("mesh does not have multiple color layers");
- return;
- } else {
- int layer_orig_idx, layer_idx;
-
- layer_idx = mesh_layers_menu(&em->fdata, CD_MCOL);
- if (layer_idx<0) return;
-
- /* warning, have not updated mesh pointers however this is not needed since we swicth back */
- layer_orig_idx = CustomData_get_active_layer(&em->fdata, CD_MCOL);
- if (layer_idx==layer_orig_idx)
- return;
-
- /* get the tfaces */
- CustomData_set_layer_active(&em->fdata, CD_MCOL, (int)layer_idx);
- /* store the tfaces in our temp */
- for(efa=em->faces.first; efa; efa=efa->next) {
- if (efa->f & SELECT) {
- efa->tmp.p = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
- }
- }
- CustomData_set_layer_active(&em->fdata, CD_MCOL, layer_orig_idx);
-
+ if (efa->f & SELECT) {
+ efa->tmp.p = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
+ }
}
- break;
+ CustomData_set_layer_active(&em->fdata, CD_MCOL, layer_orig_idx);
+
}
-
- /* layer copy only - sanity checks done above */
- switch (ret) {
- case 7: /* copy UV's only */
- for(efa=em->faces.first; efa; efa=efa->next) {
- if (efa->f & SELECT) {
- tf_act = (MTFace *)efa->tmp.p; /* not active but easier to use this way */
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- memcpy(tf->uv, tf_act->uv, sizeof(tf->uv));
- change = 1;
- }
+ break;
+ }
+
+ /* layer copy only - sanity checks done above */
+ switch (type) {
+ case 7: /* copy UV's only */
+ for(efa=em->faces.first; efa; efa=efa->next) {
+ if (efa->f & SELECT) {
+ tf_from = (MTFace *)efa->tmp.p; /* not active but easier to use this way */
+ tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+ memcpy(tf->uv, tf_from->uv, sizeof(tf->uv));
+ change = 1;
}
- break;
- case 8: /* copy image settings only */
- for(efa=em->faces.first; efa; efa=efa->next) {
- if (efa->f & SELECT) {
- tf_act = (MTFace *)efa->tmp.p; /* not active but easier to use this way */
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (tf_act->tpage) {
- tf->tpage = tf_act->tpage;
- tf->mode |= TF_TEX;
- } else {
- tf->tpage = NULL;
- tf->mode &= ~TF_TEX;
- }
- tf->tile= tf_act->tile;
- change = 1;
+ }
+ break;
+ case 8: /* copy image settings only */
+ for(efa=em->faces.first; efa; efa=efa->next) {
+ if (efa->f & SELECT) {
+ tf_from = (MTFace *)efa->tmp.p; /* not active but easier to use this way */
+ tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+ if (tf_from->tpage) {
+ tf->tpage = tf_from->tpage;
+ tf->mode |= TF_TEX;
+ } else {
+ tf->tpage = NULL;
+ tf->mode &= ~TF_TEX;
}
+ tf->tile= tf_from->tile;
+ change = 1;
}
- break;
- case 9: /* copy all tface info */
- for(efa=em->faces.first; efa; efa=efa->next) {
- if (efa->f & SELECT) {
- tf_act = (MTFace *)efa->tmp.p; /* not active but easier to use this way */
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- memcpy(tf->uv, ((MTFace *)efa->tmp.p)->uv, sizeof(tf->uv));
- tf->tpage = tf_act->tpage;
- tf->mode = tf_act->mode;
- tf->transp = tf_act->transp;
- change = 1;
- }
+ }
+ break;
+ case 9: /* copy all tface info */
+ for(efa=em->faces.first; efa; efa=efa->next) {
+ if (efa->f & SELECT) {
+ tf_from = (MTFace *)efa->tmp.p; /* not active but easier to use this way */
+ tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+ memcpy(tf->uv, ((MTFace *)efa->tmp.p)->uv, sizeof(tf->uv));
+ tf->tpage = tf_from->tpage;
+ tf->mode = tf_from->mode;
+ tf->transp = tf_from->transp;
+ change = 1;
}
- break;
- case 10:
- for(efa=em->faces.first; efa; efa=efa->next) {
- if (efa->f & SELECT) {
- mcol_act = (MCol *)efa->tmp.p;
- mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
- memcpy(mcol, mcol_act, sizeof(MCol)*4);
- change = 1;
- }
+ }
+ break;
+ case 10:
+ for(efa=em->faces.first; efa; efa=efa->next) {
+ if (efa->f & SELECT) {
+ mcol_from = (MCol *)efa->tmp.p;
+ mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
+ memcpy(mcol, mcol_from, sizeof(MCol)*4);
+ change = 1;
}
- break;
}
-
+ break;
}
-
+
if (change) {
DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWBUTSEDIT, 0);
- if (ese==NULL || ese->type == EDITFACE) BIF_undo_push("Copy Face Attribute");
- else if ( ese->type == EDITEDGE) BIF_undo_push("Copy Edge Attribute");
- else if ( ese->type == EDITVERT) BIF_undo_push("Copy Vert Attribute");
-
+ BIF_undo_push("Copy Face Layer");
}
+}
+
+
+/* ctrl+c in mesh editmode */
+void mesh_copy_menu(void)
+{
+ EditMesh *em = G.editMesh;
+ EditSelection *ese;
+ int ret;
+ if (!em) return;
+ ese = em->selected.last;
+
+ /* Faces can have a NULL ese, so dont return on a NULL ese here */
+
+ if(ese && ese->type == EDITVERT) {
+ /* EditVert *ev, *ev_act = (EditVert*)ese->data;
+ ret= pupmenu(""); */
+ } else if(ese && ese->type == EDITEDGE) {
+ ret= pupmenu("Copy Active Edge to Selected%t|Crease%x1|Bevel Weight%x2|Length%x3");
+ if (ret<1) return;
+
+ EM_mesh_copy_edge(ret);
+
+ } else if(ese==NULL || ese->type == EDITFACE) {
+ ret= pupmenu(
+ "Copy Face Selected%t|"
+ "Active Material%x1|Active Image%x2|Active UV Coords%x3|"
+ "Active Mode%x4|Active Transp%x5|Active Vertex Colors%x6|%l|"
+
+ "TexFace UVs from layer%x7|"
+ "TexFace Images from layer%x8|"
+ "TexFace All from layer%x9|"
+ "Vertex Colors from layer%x10");
+ if (ret<1) return;
+
+ if (ret<=6) {
+ EM_mesh_copy_face(ret);
+ } else {
+ EM_mesh_copy_face_layer(ret);
+ }
+ }
}
diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c
index b2b66deeb8a..7da09aaac42 100644
--- a/source/blender/src/editobject.c
+++ b/source/blender/src/editobject.c
@@ -2757,7 +2757,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|%l|Lock%x7|Unlock%x8");
+ nr= pupmenu("Specials%t|Subdivide %x1|Subdivide Multi%x2|Switch Direction%x7|Flip Left-Right Names%x3|%l|AutoName Left-Right%x4|AutoName Front-Back%x5|AutoName Top-Bottom%x6");
if(nr==1)
subdivide_armature(1);
if(nr==2) {
@@ -2770,10 +2770,8 @@ 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(nr == 7)
+ switch_direction_armature();
}
else if(G.obedit->type==OB_LATTICE) {
static float weight= 1.0f;
@@ -3503,6 +3501,17 @@ void copy_attr(short event)
base->object->damping= ob->damping;
base->object->rdamping= ob->rdamping;
}
+ else if(event==11) { /* all physical attributes */
+ base->object->gameflag = ob->gameflag;
+ base->object->inertia = ob->inertia;
+ base->object->formfactor = ob->formfactor;
+ base->object->damping= ob->damping;
+ base->object->rdamping= ob->rdamping;
+ base->object->mass= ob->mass;
+ if (ob->gameflag & OB_BOUNDS) {
+ base->object->boundtype = ob->boundtype;
+ }
+ }
else if(event==17) { /* tex space */
copy_texture_space(base->object, ob);
}
@@ -3689,7 +3698,7 @@ void copy_attr_menu()
* view3d_edit_object_copyattrmenu() and in toolbox.c
*/
- strcpy(str, "Copy Attributes %t|Location%x1|Rotation%x2|Size%x3|Draw Options%x4|Time Offset%x5|Dupli%x6|%l|Mass%x7|Damping%x8|Properties%x9|Logic Bricks%x10|Protected Transform%x29|%l");
+ strcpy(str, "Copy Attributes %t|Location%x1|Rotation%x2|Size%x3|Draw Options%x4|Time Offset%x5|Dupli%x6|%l|Mass%x7|Damping%x8|All Physical Attributes%x11|Properties%x9|Logic Bricks%x10|Protected Transform%x29|%l");
strcat (str, "|Object Constraints%x22");
strcat (str, "|NLA Strips%x26");
diff --git a/source/blender/src/editseq.c b/source/blender/src/editseq.c
index 12019a9dab9..e9d0b57a166 100644
--- a/source/blender/src/editseq.c
+++ b/source/blender/src/editseq.c
@@ -644,6 +644,7 @@ static int seq_is_parent(Sequence *par, Sequence *seq)
static int seq_is_predecessor(Sequence *pred, Sequence *seq)
{
+ if (!pred) return 0;
if(pred == seq) return 0;
else if(seq_is_parent(pred, seq)) return 1;
else if(pred->seq1 && seq_is_predecessor(pred->seq1, seq)) return 1;
diff --git a/source/blender/src/editview.c b/source/blender/src/editview.c
index e3ec69975de..a3fcad7885c 100644
--- a/source/blender/src/editview.c
+++ b/source/blender/src/editview.c
@@ -298,7 +298,7 @@ int lasso_inside(short mcords[][2], short moves, short sx, short sy)
}
/* edge version for lasso select. we assume boundbox check was done */
-static int lasso_inside_edge(short mcords[][2], short moves, int x0, int y0, int x1, int y1)
+int lasso_inside_edge(short mcords[][2], short moves, int x0, int y0, int x1, int y1)
{
short v1[2], v2[2];
int a;
@@ -371,7 +371,7 @@ static void do_lasso_select_objects(short mcords[][2], short moves, short select
}
}
-static void lasso_select_boundbox(rcti *rect, short mcords[][2], short moves)
+void lasso_select_boundbox(rcti *rect, short mcords[][2], short moves)
{
short a;
diff --git a/source/blender/src/gpencil.c b/source/blender/src/gpencil.c
index 24ed6a7b0ba..eef21323a44 100644
--- a/source/blender/src/gpencil.c
+++ b/source/blender/src/gpencil.c
@@ -48,6 +48,7 @@
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_userdef_types.h"
+#include "DNA_vec_types.h"
#include "DNA_view3d_types.h"
#include "BKE_global.h"
@@ -57,6 +58,7 @@
#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "BIF_butspace.h"
+#include "BIF_editview.h"
#include "BIF_graphics.h"
#include "BIF_interface.h"
#include "BIF_mywindow.h"
@@ -683,7 +685,7 @@ typedef struct tGPsdata {
bGPDframe *gpf; /* frame we're working on */
short status; /* current status of painting */
- short paintmode; /* mode for painting (L_MOUSE or R_MOUSE for now) */
+ short paintmode; /* mode for painting */
} tGPsdata;
/* values for tGPsdata->status */
@@ -693,6 +695,12 @@ enum {
GP_STATUS_DONE /* painting done */
};
+/* values for tGPsdata->paintmode */
+enum {
+ GP_PAINTMODE_DRAW = 0,
+ GP_PAINTMODE_ERASER
+};
+
/* Return flags for adding points to stroke buffer */
enum {
GP_STROKEADD_INVALID = -2, /* error occurred - insufficient info to do so */
@@ -710,9 +718,9 @@ static void gp_session_validatebuffer (tGPsdata *p)
/* clear memory of buffer (or allocate it if starting a new session) */
if (gpd->sbuffer)
- memset(gpd->sbuffer, 0, sizeof(bGPDspoint)*GP_STROKE_BUFFER_MAX);
+ memset(gpd->sbuffer, 0, sizeof(tGPspoint)*GP_STROKE_BUFFER_MAX);
else
- gpd->sbuffer= MEM_callocN(sizeof(bGPDspoint)*GP_STROKE_BUFFER_MAX, "gp_session_strokebuffer");
+ gpd->sbuffer= MEM_callocN(sizeof(tGPspoint)*GP_STROKE_BUFFER_MAX, "gp_session_strokebuffer");
/* reset indices */
gpd->sbuffer_size = 0;
@@ -850,6 +858,25 @@ static void gp_session_cleanup (tGPsdata *p)
gpd->sbuffer_sflag= 0;
}
+/* check if the current mouse position is suitable for adding a new point */
+static short gp_stroke_filtermval (tGPsdata *p, short mval[2], short pmval[2])
+{
+ short dx= abs(mval[0] - pmval[0]);
+ short dy= abs(mval[1] - pmval[1]);
+
+ /* check if mouse moved at least certain distance on both axes (best case) */
+ 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_EUCLIDEAN_PX)
+ return 1;
+
+ /* mouse 'didn't move' */
+ else
+ return 0;
+}
+
/* convert screen-coordinates to buffer-coordinates */
static void gp_stroke_convertcoords (tGPsdata *p, short mval[], float out[])
{
@@ -884,43 +911,24 @@ static void gp_stroke_convertcoords (tGPsdata *p, short mval[], float out[])
}
}
-/* check if the current mouse position is suitable for adding a new point */
-static short gp_stroke_filtermval (tGPsdata *p, short mval[2], short pmval[2])
-{
- short dx= abs(mval[0] - pmval[0]);
- short dy= abs(mval[1] - pmval[1]);
-
- /* check if mouse moved at least certain distance on both axes (best case) */
- 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_EUCLIDEAN_PX)
- return 1;
-
- /* mouse 'didn't move' */
- else
- return 0;
-}
-
/* add current stroke-point to buffer (returns whether point was successfully added) */
static short gp_stroke_addpoint (tGPsdata *p, short mval[2], float pressure)
{
bGPdata *gpd= p->gpd;
- bGPDspoint *pt;
+ tGPspoint *pt;
/* check if still room in buffer */
if (gpd->sbuffer_size >= GP_STROKE_BUFFER_MAX)
return GP_STROKEADD_OVERFLOW;
-
/* get pointer to destination point */
- pt= gpd->sbuffer + gpd->sbuffer_size;
+ pt= ((tGPspoint *)(gpd->sbuffer) + gpd->sbuffer_size);
- /* convert screen-coordinates to appropriate coordinates (and store them) */
- gp_stroke_convertcoords(p, mval, &pt->x);
-
- /* store other settings */
+ /* store settings */
+ pt->x= mval[0];
+ pt->y= mval[1];
+ pt->xf= (float)mval[0];
+ pt->yf= (float)mval[0];
pt->pressure= pressure;
/* increment counters */
@@ -933,38 +941,13 @@ static short gp_stroke_addpoint (tGPsdata *p, short mval[2], float pressure)
return GP_STROKEADD_NORMAL;
}
-/* smooth a stroke (in buffer) before storing it */
-static void gp_stroke_smooth (tGPsdata *p)
-{
- bGPdata *gpd= p->gpd;
- int i=0, cmx=gpd->sbuffer_size;
-
- // fixme: currently disabled as it damages too much sometimes
- return;
-
- /* don't try if less than 2 points in buffer */
- if ((cmx <= 2) || (gpd->sbuffer == NULL))
- return;
-
- /* apply weighting-average (note doing this along path sequentially does introduce slight error) */
- for (i=0; i < gpd->sbuffer_size; i++) {
- bGPDspoint *pc= (gpd->sbuffer + i);
- bGPDspoint *pb= (i-1 > 0)?(pc-1):(pc);
- bGPDspoint *pa= (i-2 > 0)?(pc-2):(pb);
- bGPDspoint *pd= (i+1 < cmx)?(pc+1):(pc);
- bGPDspoint *pe= (i+2 < cmx)?(pc+2):(pd);
-
- pc->x= (0.1*pa->x + 0.2*pb->x + 0.4*pc->x + 0.2*pd->x + 0.1*pe->x);
- pc->y= (0.1*pa->y + 0.2*pb->y + 0.4*pc->y + 0.2*pd->y + 0.1*pe->y);
- }
-}
-
/* make a new stroke from the buffer data */
static void gp_stroke_newfrombuffer (tGPsdata *p)
{
bGPdata *gpd= p->gpd;
bGPDstroke *gps;
- bGPDspoint *pt, *ptc;
+ bGPDspoint *pt;
+ tGPspoint *ptc;
int i, totelem;
/* get total number of points to allocate space for */
@@ -990,7 +973,12 @@ static void gp_stroke_newfrombuffer (tGPsdata *p)
/* copy points from the buffer to the stroke */
for (i=0, ptc=gpd->sbuffer; i < gpd->sbuffer_size && ptc; i++, ptc++) {
- memcpy(pt, ptc, sizeof(bGPDspoint));
+ /* convert screen-coordinates to appropriate coordinates (and store them) */
+ gp_stroke_convertcoords(p, &ptc->x, &pt->x);
+
+ /* copy pressure */
+ pt->pressure= ptc->pressure;
+
pt++;
}
@@ -998,10 +986,220 @@ static void gp_stroke_newfrombuffer (tGPsdata *p)
BLI_addtail(&p->gpf->strokes, gps);
}
+/* --- 'Eraser' for 'Paint' Tool ------ */
+/* User should draw 'circles' around the parts of the sketches they wish to
+ * delete instead of drawing squiggles over existing lines. This should be
+ * easier to manage than if it was done otherwise.
+ */
+
+/* convert gp-buffer stroke into mouse-coordinates array */
+static short (*gp_stroke_eraser_2mco (bGPdata *gpd))[2]
+{
+ tGPspoint *pt;
+ short (*mcoords)[2];
+ int i;
+
+ /* allocate memory for coordinates array */
+ mcoords= MEM_mallocN(sizeof(*mcoords)*gpd->sbuffer_size,"gp_buf_mcords");
+
+ /* copy coordinates */
+ for (pt=gpd->sbuffer, i=0; i < gpd->sbuffer_size; i++, pt++) {
+ mcoords[i][0]= pt->x;
+ mcoords[i][1]= pt->y;
+ }
+
+ /* return */
+ return mcoords;
+}
+
+/* eraser tool - remove segment from stroke/split stroke (after lasso inside) */
+static short gp_stroke_eraser_splitdel (bGPDframe *gpf, bGPDstroke *gps, int i)
+{
+ bGPDspoint *pt_tmp= gps->points;
+ bGPDstroke *gsn = NULL;
+
+ /* if stroke only had two points, get rid of stroke */
+ if (gps->totpoints == 2) {
+ /* free stroke points, then stroke */
+ MEM_freeN(pt_tmp);
+ BLI_freelinkN(&gpf->strokes, gps);
+
+ /* nothing left in stroke, so stop */
+ return 1;
+ }
+
+ /* if last segment, just remove segment from the stroke */
+ else if (i == gps->totpoints - 2) {
+ /* allocate new points array, and assign most of the old stroke there */
+ gps->totpoints--;
+ gps->points= MEM_callocN(sizeof(bGPDspoint)*gps->totpoints, "gp_stroke_points");
+ memcpy(gps->points, pt_tmp, sizeof(bGPDspoint)*gps->totpoints);
+
+ /* free temp buffer */
+ MEM_freeN(pt_tmp);
+
+ /* nothing left in stroke, so stop */
+ return 1;
+ }
+
+ /* if first segment, just remove segment from the stroke */
+ else if (i == 0) {
+ /* allocate new points array, and assign most of the old stroke there */
+ gps->totpoints--;
+ gps->points= MEM_callocN(sizeof(bGPDspoint)*gps->totpoints, "gp_stroke_points");
+ memcpy(gps->points, pt_tmp + 1, sizeof(bGPDspoint)*gps->totpoints);
+
+ /* free temp buffer */
+ MEM_freeN(pt_tmp);
+
+ /* no break here, as there might still be stuff to remove in this stroke */
+ return 0;
+ }
+
+ /* segment occurs in 'middle' of stroke, so split */
+ else {
+ /* duplicate stroke, and assign 'later' data to that stroke */
+ gsn= MEM_dupallocN(gps);
+ gsn->prev= gsn->next= NULL;
+ BLI_insertlinkafter(&gpf->strokes, gps, gsn);
+
+ gsn->totpoints= gps->totpoints - i;
+ gsn->points= MEM_callocN(sizeof(bGPDspoint)*gsn->totpoints, "gp_stroke_points");
+ memcpy(gsn->points, pt_tmp + i, sizeof(bGPDspoint)*gsn->totpoints);
+
+ /* adjust existing stroke */
+ gps->totpoints= i;
+ gps->points= MEM_callocN(sizeof(bGPDspoint)*gps->totpoints, "gp_stroke_points");
+ memcpy(gps->points, pt_tmp, sizeof(bGPDspoint)*i);
+
+ /* free temp buffer */
+ MEM_freeN(pt_tmp);
+
+ /* nothing left in stroke, so stop */
+ return 1;
+ }
+}
+
+/* eraser tool - evaluation per stroke */
+static void gp_stroke_eraser_dostroke (tGPsdata *p, short mcoords[][2], short moves, rcti *rect, bGPDframe *gpf, bGPDstroke *gps)
+{
+ bGPDspoint *pt1, *pt2;
+ short x0=0, y0=0, x1=0, y1=0;
+ short xyval[2];
+ int i;
+
+ if (gps->totpoints == 0) {
+ /* just free stroke */
+ if (gps->points)
+ MEM_freeN(gps->points);
+ BLI_freelinkN(&gpf->strokes, gps);
+ }
+ else if (gps->totpoints == 1) {
+ /* get coordinates */
+ if (gps->flag & GP_STROKE_3DSPACE) {
+ // FIXME: this may not be the correct correction
+ project_short(&gps->points->x, xyval);
+ x0= xyval[0];
+ x1= xyval[1];
+ }
+ else if (gps->flag & GP_STROKE_2DSPACE) {
+ ipoco_to_areaco_noclip(p->v2d, &gps->points->x, xyval);
+ x0= xyval[0];
+ y0= xyval[1];
+ }
+ else {
+ x0= (gps->points->x / 1000 * p->sa->winx);
+ y0= (gps->points->y / 1000 * p->sa->winy);
+ }
+
+ /* do boundbox check first */
+ if (BLI_in_rcti(rect, x0, y0)) {
+ /* only check if point is inside */
+ if (lasso_inside(mcoords, moves, x0, y0)) {
+ /* free stroke */
+ MEM_freeN(gps->points);
+ BLI_freelinkN(&gpf->strokes, gps);
+ }
+ }
+ }
+ else {
+ /* loop over the points in the stroke, checking for intersections
+ * - an intersection will require the stroke to be split
+ */
+ for (i=0; (i+1) < gps->totpoints; i++) {
+ /* get points to work with */
+ pt1= gps->points + i;
+ pt2= gps->points + i + 1;
+
+ /* get coordinates */
+ if (gps->flag & GP_STROKE_3DSPACE) {
+ // FIXME: may not be correct correction
+ project_short(&gps->points->x, xyval);
+ x0= xyval[0];
+ x1= xyval[1];
+ }
+ else if (gps->flag & GP_STROKE_2DSPACE) {
+ ipoco_to_areaco_noclip(p->v2d, &pt1->x, xyval);
+ x0= xyval[0];
+ y0= xyval[1];
+
+ ipoco_to_areaco_noclip(p->v2d, &pt2->x, xyval);
+ x1= xyval[0];
+ y1= xyval[1];
+ }
+ else {
+ x0= (pt1->x / 1000 * p->sa->winx);
+ y0= (pt1->y / 1000 * p->sa->winy);
+ x1= (pt2->x / 1000 * p->sa->winx);
+ y1= (pt2->y / 1000 * p->sa->winy);
+ }
+
+ /* check that point segment of the boundbox of the eraser stroke */
+ if (BLI_in_rcti(rect, x0, y0) || BLI_in_rcti(rect, x1, y1)) {
+ /* check if point segment of stroke had anything to do with
+ * eraser region (either within stroke painted, or on its lines)
+ * - this assumes that linewidth is irrelevant
+ * - handled using the lasso-select checking code
+ */
+ if (lasso_inside_edge(mcoords, moves, x0, y0, x1, x1)) {
+ /* if function returns true, break this loop (as no more point to check) */
+ if (gp_stroke_eraser_splitdel(gpf, gps, i))
+ break;
+ }
+ }
+ }
+ }
+}
+
+/* -------- */
+
+/* erase strokes which fall under the eraser strokes */
+static void gp_stroke_doeraser (tGPsdata *p)
+{
+ bGPdata *gpd= p->gpd;
+ bGPDframe *gpf= p->gpf;
+ bGPDstroke *gps, *gpn;
+ short (*mcoords)[2];
+ rcti rect;
+
+ /* get buffer-stroke coordinates as shorts array, and then get bounding box */
+ mcoords= gp_stroke_eraser_2mco(gpd);
+ lasso_select_boundbox(&rect, mcoords, gpd->sbuffer_size);
+
+ /* loop over strokes, checking segments for intersections */
+ for (gps= gpf->strokes.first; gps; gps= gpn) {
+ gpn= gps->next;
+ gp_stroke_eraser_dostroke(p, mcoords, gpd->sbuffer_size, &rect, gpf, gps);
+ }
+
+ /* free mcoords array */
+ MEM_freeN(mcoords);
+}
+
/* ---------- 'Paint' Tool ------------ */
/* init new stroke */
-static void gp_paint_initstroke (tGPsdata *p, short mousebutton)
+static void gp_paint_initstroke (tGPsdata *p, short paintmode)
{
/* get active layer (or add a new one if non-existent) */
p->gpl= gpencil_layer_getactive(p->gpd);
@@ -1025,14 +1223,10 @@ static void gp_paint_initstroke (tGPsdata *p, short mousebutton)
else
p->gpf->flag |= GP_FRAME_PAINT;
- /* set 'eraser' for this stroke if using eraser or right-mouse in action */
- if ( get_activedevice() == 2 || (mousebutton & R_MOUSE) ) {
+ /* set 'eraser' for this stroke if using eraser */
+ p->paintmode= paintmode;
+ if (p->paintmode == GP_PAINTMODE_ERASER)
p->gpd->sbuffer_sflag |= GP_STROKE_ERASER;
-
- // for now: eraser isn't ready for prime-time yet, so no painting available here yet
- p->status= GP_STATUS_ERROR;
- return;
- }
/* check if points will need to be made in view-aligned space */
if (p->gpd->flag & GP_DATA_VIEWALIGN) {
@@ -1062,12 +1256,10 @@ static void gp_paint_initstroke (tGPsdata *p, short mousebutton)
/* finish off a stroke (clears buffer, but doesn't finish the paint operation) */
static void gp_paint_strokeend (tGPsdata *p)
{
- /* sanitize stroke-points in buffer (remove jitter) */
- gp_stroke_smooth(p);
-
/* check if doing eraser or not */
if (p->gpd->sbuffer_sflag & GP_STROKE_ERASER) {
/* get rid of relevant sections of strokes */
+ gp_stroke_doeraser(p);
}
else {
/* transfer stroke to frame */
@@ -1100,7 +1292,7 @@ static void gp_paint_cleanup (tGPsdata *p)
/* -------- */
/* main call to paint a new stroke */
-short gpencil_paint (short mousebutton)
+short gpencil_paint (short mousebutton, short paintmode)
{
tGPsdata p;
short prevmval[2], mval[2];
@@ -1113,7 +1305,7 @@ short gpencil_paint (short mousebutton)
gp_session_cleanup(&p);
return 0;
}
- gp_paint_initstroke(&p, mousebutton);
+ gp_paint_initstroke(&p, paintmode);
if (p.status == GP_STATUS_ERROR) {
gp_session_cleanup(&p);
return 0;
@@ -1188,7 +1380,10 @@ short gpencil_paint (short mousebutton)
setcursor_space(p.sa->spacetype, CURSOR_STD);
/* check size of buffer before cleanup, to determine if anything happened here */
- ok= p.gpd->sbuffer_size;
+ if (paintmode == GP_PAINTMODE_ERASER)
+ ok= (p.gpd->sbuffer_size > 1);
+ else
+ ok= p.gpd->sbuffer_size;
/* cleanup */
gp_paint_cleanup(&p);
@@ -1202,7 +1397,7 @@ short gpencil_paint (short mousebutton)
/* All event (loops) handling checking if stroke drawing should be initiated
* should call this function.
*/
-short gpencil_do_paint (ScrArea *sa, short mousebutton)
+short gpencil_do_paint (ScrArea *sa, short mbut)
{
bGPdata *gpd = gpencil_data_getactive(sa);
short retval= 0;
@@ -1211,18 +1406,43 @@ short gpencil_do_paint (ScrArea *sa, short mousebutton)
if (gpd == NULL)
return 0;
- /* currently, we will only paint if:
+ /* currently, we will only 'paint' if:
* 1. draw-mode on gpd is set (for accessibility reasons)
* (single 'dots' are only available via this method)
* 2. if shift-modifier is held + lmb -> 'quick paint'
+ *
+ * OR
+ *
+ * draw eraser stroke if:
+ * 1. using the eraser on a tablet
+ * 2. draw-mode on gpd is set (for accessiblity reasons)
+ * (eraser is mapped to right-mouse)
+ * 3. Alt + 'select' mouse-button
+ * i.e. if LMB = select: Alt-LMB
+ * if RMB = select: Alt-RMB
*/
- if (gpd->flag & GP_DATA_EDITPAINT) {
- /* try to paint */
- retval = gpencil_paint(mousebutton);
+ if (get_activedevice() == 2) {
+ /* eraser on a tablet - always try to erase strokes */
+ retval = gpencil_paint(mbut, GP_PAINTMODE_ERASER);
+ }
+ else if (gpd->flag & GP_DATA_EDITPAINT) {
+ /* try to paint/erase */
+ if (mbut == L_MOUSE)
+ retval = gpencil_paint(mbut, GP_PAINTMODE_DRAW);
+ else if (mbut == R_MOUSE)
+ retval = gpencil_paint(mbut, GP_PAINTMODE_ERASER);
}
- else if (!(gpd->flag & GP_DATA_LMBPLOCK) && (G.qual == LR_SHIFTKEY)) {
- /* try to paint */
- retval = gpencil_paint(mousebutton);
+ else if (!(gpd->flag & GP_DATA_LMBPLOCK)) {
+ /* try to paint/erase as not locked */
+ if ((G.qual == LR_SHIFTKEY) && (mbut == L_MOUSE)) {
+ retval = gpencil_paint(mbut, GP_PAINTMODE_DRAW);
+ }
+ else if (G.qual == LR_ALTKEY) {
+ if ((U.flag & USER_LMOUSESELECT) && (mbut == L_MOUSE))
+ retval = gpencil_paint(mbut, GP_PAINTMODE_ERASER);
+ else if (!(U.flag & USER_LMOUSESELECT) && (mbut == R_MOUSE))
+ retval = gpencil_paint(mbut, GP_PAINTMODE_ERASER);
+ }
}
/* return result of trying to paint */
diff --git a/source/blender/src/header_info.c b/source/blender/src/header_info.c
index dac7c7bc2c6..a9280d9dd19 100644
--- a/source/blender/src/header_info.c
+++ b/source/blender/src/header_info.c
@@ -540,6 +540,42 @@ static void check_packAll()
}
}
+#ifdef _WIN32
+static void copy_game_dll(char *dll_filename, char *source_dir, char *dest_dir)
+{
+ char source_filename[FILE_MAX];
+ char dest_filename[FILE_MAX];
+
+ strcpy( source_filename, source_dir );
+ strcat( source_filename, dll_filename );
+
+ strcpy( dest_filename, dest_dir );
+ strcat( dest_filename, dll_filename );
+
+ if(!BLI_exists(dest_filename)) {
+ BLI_copy_fileops( source_filename, dest_filename );
+ }
+}
+
+static void copy_all_game_dlls(char *str)
+{
+#define GAME_DLL_COUNT 7
+ char *game_dll_list[GAME_DLL_COUNT]={"gnu_gettext.dll", "libpng.dll", "libtiff.dll", "pthreadVC2.dll", "python25.dll", "SDL.dll", "zlib.dll"};
+
+ char dest_dir[FILE_MAX];
+ char source_dir[FILE_MAX];
+ int i;
+
+ strcpy(source_dir, get_install_dir());
+ strcat(source_dir, "\\");
+ BLI_split_dirfile_basic(str, dest_dir, NULL);
+
+ for (i= 0; i< GAME_DLL_COUNT; i++) {
+ copy_game_dll(game_dll_list[i], source_dir, dest_dir );
+ };
+}
+#endif
+
static int write_runtime(char *str, char *exename)
{
char *freestr= NULL;
@@ -587,7 +623,14 @@ static void write_runtime_check(char *str)
#endif
write_runtime(str, player);
+
+#ifdef _WIN32
+ // get a list of the .DLLs in the Blender folder and copy all of these to the destination folder if they don't exist
+ copy_all_game_dlls(str);
+#endif
}
+
+
/* end keyed functions */
/************************** MAIN MENU *****************************/
@@ -1026,7 +1069,7 @@ static uiBlock *info_externalfiles(void *arg_unused)
block= uiNewBlock(&curarea->uiblocks, "info_externalfiles", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
uiBlockSetButmFunc(block, do_info_externalfiles, NULL);
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Pack into Blend", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 1, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Pack into .blend file", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 1, "");
#if 0
uiDefBut(block, BUTM, 1, "Unpack Data to current dir", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 2, "Removes all packed files from the project and saves them to the current directory");
#endif
@@ -1036,8 +1079,8 @@ static uiBlock *info_externalfiles(void *arg_unused)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make all Paths Relative", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 10, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make all Paths Absolute", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 11, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Report Missing Files", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 12, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Find Missing Files", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 13, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Report Missing Files...", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 12, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Find Missing Files...", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 13, "");
uiBlockSetDirection(block, UI_RIGHT);
uiTextBoundsBlock(block, 60);
@@ -1078,9 +1121,9 @@ static uiBlock *info_filemenu(void *arg_unused)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Screenshot Subwindow|Ctrl F3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 24, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Screenshot All|Ctrl Shift F3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 25, "");
#if GAMEBLENDER == 1
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Save Runtime...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 22, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Save Game As Runtime...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 22, "");
#ifdef _WIN32
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Save Dynamic Runtime...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 23, "");
+// uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Save Dynamic Runtime...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 23, "");
#endif
#endif
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
diff --git a/source/blender/src/header_ipo.c b/source/blender/src/header_ipo.c
index 15caf325ec6..59d542e72ec 100644
--- a/source/blender/src/header_ipo.c
+++ b/source/blender/src/header_ipo.c
@@ -970,7 +970,7 @@ static char *ipo_modeselect_pup(void)
if(ob && ob->type==OB_LAMP)
str += sprintf(str,formatstring, "Lamp",ID_LA, ICON_LAMP);
- if(ob && give_current_texture(ob, ob->actcol))
+ if((ob && give_current_texture(ob, ob->actcol))||(give_current_world_texture()))
str += sprintf(str,formatstring, "Texture",ID_TE, ICON_TEXTURE);
if(ob){
diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c
index 2b8da83dc1d..1b0500b15b3 100644
--- a/source/blender/src/header_view3d.c
+++ b/source/blender/src/header_view3d.c
@@ -165,9 +165,9 @@ void do_layer_buttons(short event)
if(event==-1 && (G.qual & LR_CTRLKEY)) {
G.vd->scenelock= !G.vd->scenelock;
do_view3d_buttons(B_SCENELOCK);
- } else if (event==-1) {
+ } else if (event<0) {
if(G.vd->lay== (1<<20)-1) {
- if(G.qual & LR_SHIFTKEY) G.vd->lay= oldlay;
+ if(event==-2 || G.qual & LR_SHIFTKEY) G.vd->lay= oldlay;
}
else {
oldlay= G.vd->lay;
@@ -604,6 +604,9 @@ static void do_view3d_viewmenu(void *arg, int event)
case 21: /* Grease Pencil */
add_blockhandler(curarea, VIEW3D_HANDLER_GREASEPENCIL, UI_PNL_UNSTOW);
break;
+ case 22: /* View all layers */
+ do_layer_buttons(-2);
+ break;
}
allqueue(REDRAWVIEW3D, 1);
}
@@ -647,6 +650,11 @@ static uiBlock *view3d_viewmenu(void *arg_unused)
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+ if(G.vd->lay== (1<<20)-1) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Previous Layers|Shift ~", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 22, "");
+ else uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show All Layers| ~", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 22, "");
+
+ uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+
if(G.vd->localview) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Local View|NumPad /", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Local View|NumPad /", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
if(!G.vd->localview) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Global View|NumPad /", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
@@ -725,6 +733,9 @@ void do_view3d_select_object_typemenu(void *arg, int event)
case 10: /* Lamp */
selectall_type(OB_LAMP);
break;
+ case 20:
+ do_layer_buttons(-2);
+ break;
}
allqueue(REDRAWVIEW3D, 0);
}
@@ -1313,12 +1324,21 @@ static void do_view3d_select_armaturemenu(void *arg, int event)
case 2: /* Select/Deselect all */
deselectall_armature(1, 1);
break;
- case 3: /* Select Parent(s) */
- select_bone_parent();
- break;
- case 4: /* Swap Select All */
+ case 3: /* Swap Select All */
deselectall_armature(3, 1);
break;
+ case 4: /* Select parent */
+ armature_select_hierarchy(BONE_SELECT_PARENT, 0);
+ break;
+ case 5: /* Select child */
+ armature_select_hierarchy(BONE_SELECT_CHILD, 0);
+ break;
+ case 6: /* Extend Select parent */
+ armature_select_hierarchy(BONE_SELECT_PARENT, 1);
+ break;
+ case 7: /* Extend Select child */
+ armature_select_hierarchy(BONE_SELECT_CHILD, 1);
+ break;
}
allqueue(REDRAWVIEW3D, 0);
}
@@ -1336,11 +1356,18 @@ static uiBlock *view3d_select_armaturemenu(void *arg_unused)
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Inverse|Ctrl I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
+
+ uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Swap Select All|Ctrl I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Parent|[", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Child|]", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
+
+ uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Select Parent|Shift [", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Select Child|Shift ]", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Parent(s)|P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-
if(curarea->headertype==HEADERTOP) {
uiBlockSetDirection(block, UI_DOWN);
}
@@ -1367,12 +1394,21 @@ static void do_view3d_select_pose_armaturemenu(void *arg, int event)
case 3: /* Select Target(s) of Constraint(s) */
pose_select_constraint_target();
break;
- case 4: /* Select Bone's Parent */
- select_bone_parent();
- break;
case 5: /* Swap Select All */
deselectall_posearmature(OBACT, 3, 1);
break;
+ case 6: /* Select parent */
+ pose_select_hierarchy(BONE_SELECT_PARENT, 0);
+ break;
+ case 7: /* Select child */
+ pose_select_hierarchy(BONE_SELECT_CHILD, 0);
+ break;
+ case 8: /* Extend Select parent */
+ pose_select_hierarchy(BONE_SELECT_PARENT, 1);
+ break;
+ case 9: /* Extend Select child */
+ pose_select_hierarchy(BONE_SELECT_CHILD, 1);
+ break;
}
allqueue(REDRAWVIEW3D, 0);
}
@@ -1392,8 +1428,17 @@ static uiBlock *view3d_select_pose_armaturemenu(void *arg_unused)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Swap Select All|Ctrl I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Constraint Target|W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Parent(s)|P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
-
+
+ uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Parent|[", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Child|]", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
+
+ uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Select Parent|Shift [", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Select Child|Shift ]", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
+
if(curarea->headertype==HEADERTOP) {
uiBlockSetDirection(block, UI_DOWN);
}
@@ -2195,6 +2240,7 @@ static uiBlock *view3d_edit_object_copyattrmenu(void *arg_unused)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Mass|Ctrl C, 7", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Damping|Ctrl C, 8", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "All Physical Attributes|Ctrl C, 11", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Properties|Ctrl C, 9", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Logic Bricks|Ctrl C, 10", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Protected Transform |Ctrl C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 29, "");
@@ -2465,8 +2511,11 @@ static void do_view3d_edit_objectmenu(void *arg, int event)
case 15: /* Object Panel */
add_blockhandler(curarea, VIEW3D_HANDLER_OBJECT, UI_PNL_UNSTOW);
break;
+ case 16: /* make proxy object*/
+ make_proxy();
+ break;
#ifdef WITH_VERSE
- case 16: /* Share Object at Verse server */
+ case 17: /* Share Object at Verse server */
if(session_list.first != session_list.last) session = session_menu();
else session = session_list.first;
if(session) b_verse_push_object(session, ob);
@@ -2491,7 +2540,7 @@ static uiBlock *view3d_edit_objectmenu(void *arg_unused)
if (base) ob= base->object;
if(ob && (ob->type == OB_MESH) && (!ob->vnode)) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Share at Verse Server", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Share at Verse Server", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 17, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
}
}
@@ -2517,6 +2566,7 @@ static uiBlock *view3d_edit_objectmenu(void *arg_unused)
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Proxy|Ctrl Alt P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
uiDefIconTextBlockBut(block, view3d_edit_object_makelinksmenu, NULL, ICON_RIGHTARROW_THIN, "Make Links", 0, yco-=20, 120, 19, "");
uiDefIconTextBlockBut(block, view3d_edit_object_singleusermenu, NULL, ICON_RIGHTARROW_THIN, "Make Single User", 0, yco-=20, 120, 19, "");
uiDefIconTextBlockBut(block, view3d_edit_object_makelocalmenu, NULL, ICON_RIGHTARROW_THIN, "Make Local", 0, yco-=20, 120, 19, "");
@@ -5084,7 +5134,7 @@ static char *snapmode_pup(void)
static char string[512];
char *str = string;
- str += sprintf(str, "%s", "Snap Mode: %t");
+ str += sprintf(str, "%s", "Snap Element: %t");
str += sprintf(str, "%s", "|Vertex%x0");
str += sprintf(str, "%s", "|Edge%x1");
str += sprintf(str, "%s", "|Face%x2");
@@ -5722,7 +5772,7 @@ void view3d_buttons(void)
xco+= XIC;
uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_VERTEXSEL, snapmode_pup(), xco,0,XIC+10,YIC, &(G.scene->snap_mode), 0.0, 0.0, 0, 0, "Snapping mode");
xco+= XIC;
- uiDefButS(block, MENU, B_NOP, "Mode%t|Closest%x0|Center%x1|Median%x2|Active%x3",xco,0,70,YIC, &G.scene->snap_target, 0, 0, 0, 0, "Snap Target Mode");
+ uiDefButS(block, MENU, B_NOP, "Snap Mode%t|Closest%x0|Center%x1|Median%x2|Active%x3",xco,0,70,YIC, &G.scene->snap_target, 0, 0, 0, 0, "Snap Target Mode");
xco+= 70;
} else {
uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEAR,xco,0,XIC,YIC, &G.scene->snap_flag, 0, 0, 0, 0, "Snap while Ctrl is held during transform (Shift Tab)");
diff --git a/source/blender/src/meshlaplacian.c b/source/blender/src/meshlaplacian.c
index 4d84672185a..60f569ecf0e 100644
--- a/source/blender/src/meshlaplacian.c
+++ b/source/blender/src/meshlaplacian.c
@@ -1281,9 +1281,9 @@ static int meshdeform_inside_cage(MeshDeformBind *mdb, float *co)
outside[1] = co[1] + (mdb->max[1] - mdb->min[1] + 1.0f)*MESHDEFORM_OFFSET[i][1];
outside[2] = co[2] + (mdb->max[2] - mdb->min[2] + 1.0f)*MESHDEFORM_OFFSET[i][2];
+ VECCOPY(start, co);
VECSUB(dir, outside, start);
Normalize(dir);
- VECCOPY(start, co);
isect = meshdeform_ray_tree_intersect(mdb, start, outside);
if(isect && !isect->facing)
diff --git a/source/blender/src/outliner.c b/source/blender/src/outliner.c
index a8e864998b1..3f328a0cfb2 100644
--- a/source/blender/src/outliner.c
+++ b/source/blender/src/outliner.c
@@ -3718,13 +3718,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);
@@ -3733,24 +3726,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;
-
- ob = (Object *)tselem->id;
-
+
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;
-
- ob = (Object *)tselem->id;
-
+
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/poselib.c b/source/blender/src/poselib.c
index fb2bfe5b605..6aeef7c75c2 100644
--- a/source/blender/src/poselib.c
+++ b/source/blender/src/poselib.c
@@ -312,7 +312,7 @@ void poselib_add_current_pose (Object *ob, int val)
/* mode - add new or replace existing */
if (val == 0) {
if ((ob->poselib) && (ob->poselib->markers.first)) {
- val= pupmenu("PoseLib Add Current Pose%t|Add New%x1|Replace Existing%x2");
+ val= pupmenu("PoseLib Add Current Pose%t|Add New%x1|Add New (Current Frame)%x3|Replace Existing%x2");
if (val <= 0) return;
}
else
@@ -347,7 +347,10 @@ void poselib_add_current_pose (Object *ob, int val)
act= poselib_validate(ob);
/* get frame */
- frame= poselib_get_free_index(act);
+ if (val == 3)
+ frame= CFRA;
+ else /* if (val == 1) */
+ frame= poselib_get_free_index(act);
/* add pose to poselib - replaces any existing pose there */
for (marker= act->markers.first; marker; marker= marker->next) {
diff --git a/source/blender/src/poseobject.c b/source/blender/src/poseobject.c
index b054b435002..28b8729a247 100644
--- a/source/blender/src/poseobject.c
+++ b/source/blender/src/poseobject.c
@@ -479,6 +479,67 @@ void pose_select_constraint_target(void)
}
+void pose_select_hierarchy(short direction, short add_to_sel)
+{
+ Object *ob= OBACT;
+ bArmature *arm= ob->data;
+ bPoseChannel *pchan;
+ Bone *curbone, *pabone, *chbone;
+
+ /* paranoia checks */
+ if (!ob && !ob->pose) return;
+ if (ob==G.obedit || (ob->flag & OB_POSEMODE)==0) return;
+
+ for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+ curbone= pchan->bone;
+
+ if (arm->layer & curbone->layer) {
+ if (curbone->flag & (BONE_ACTIVE)) {
+ if (direction == BONE_SELECT_PARENT) {
+
+ if (pchan->parent == NULL) continue;
+ else pabone= pchan->parent->bone;
+
+ if ((arm->layer & pabone->layer) && !(pabone->flag & BONE_HIDDEN_P)) {
+
+ if (!add_to_sel) curbone->flag &= ~BONE_SELECTED;
+ curbone->flag &= ~BONE_ACTIVE;
+ pabone->flag |= (BONE_ACTIVE|BONE_SELECTED);
+
+ select_actionchannel_by_name (ob->action, pchan->name, 0);
+ select_actionchannel_by_name (ob->action, pchan->parent->name, 1);
+ break;
+ }
+ } else { // BONE_SELECT_CHILD
+
+ if (pchan->child == NULL) continue;
+ else chbone = pchan->child->bone;
+
+ if ((arm->layer & chbone->layer) && !(chbone->flag & BONE_HIDDEN_P)) {
+
+ if (!add_to_sel) curbone->flag &= ~BONE_SELECTED;
+ curbone->flag &= ~BONE_ACTIVE;
+ chbone->flag |= (BONE_ACTIVE|BONE_SELECTED);
+
+ select_actionchannel_by_name (ob->action, pchan->name, 0);
+ select_actionchannel_by_name (ob->action, pchan->child->name, 1);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ allqueue (REDRAWVIEW3D, 0);
+ allqueue (REDRAWBUTSOBJECT, 0);
+ allqueue (REDRAWOOPS, 0);
+
+ if (direction==BONE_SELECT_PARENT)
+ BIF_undo_push("Select pose bone parent");
+ if (direction==BONE_SELECT_CHILD)
+ BIF_undo_push("Select pose bone child");
+}
+
/* context: active channel */
void pose_special_editmenu(void)
{
diff --git a/source/blender/src/space.c b/source/blender/src/space.c
index 400509012c6..b7e80e6eb68 100644
--- a/source/blender/src/space.c
+++ b/source/blender/src/space.c
@@ -2420,7 +2420,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
else if(G.qual==LR_ALTKEY && G.obedit->type==OB_ARMATURE)
clear_bone_parent();
else if((G.qual==0) && (G.obedit->type==OB_ARMATURE))
- select_bone_parent();
+ armature_select_hierarchy(BONE_SELECT_PARENT, 1); // 1 = add to selection
else if((G.qual==(LR_CTRLKEY|LR_ALTKEY)) && (G.obedit->type==OB_ARMATURE))
separate_armature();
else if((G.qual==0) && G.obedit->type==OB_MESH)
@@ -2450,7 +2450,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
start_RBSimulation();
}
else if((G.qual==0) && (OBACT) && (OBACT->type==OB_ARMATURE) && (OBACT->flag & OB_POSEMODE))
- select_bone_parent();
+ pose_select_hierarchy(BONE_SELECT_PARENT, 1); // 1 = add to selection
else if((G.qual==0)) {
start_game();
}
@@ -2753,6 +2753,19 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
scrarea_queue_winredraw(curarea);
break;
+ case LEFTBRACKETKEY:
+ if ((G.obedit) && (G.obedit->type == OB_ARMATURE))
+ armature_select_hierarchy(BONE_SELECT_PARENT, (G.qual == LR_SHIFTKEY));
+ else if ((ob) && (ob->flag & OB_POSEMODE))
+ pose_select_hierarchy(BONE_SELECT_PARENT, (G.qual == LR_SHIFTKEY));
+ break;
+ case RIGHTBRACKETKEY:
+ if ((G.obedit) && (G.obedit->type == OB_ARMATURE))
+ armature_select_hierarchy(BONE_SELECT_CHILD, (G.qual == LR_SHIFTKEY));
+ if ((ob) && (ob->flag & OB_POSEMODE))
+ pose_select_hierarchy(BONE_SELECT_CHILD, (G.qual == LR_SHIFTKEY));
+ break;
+
case PADSLASHKEY:
if(G.qual==0) {
if(G.vd->localview) {
@@ -5111,7 +5124,10 @@ static void winqreadseqspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
}
}
- if(doredraw) scrarea_queue_winredraw(curarea);
+ if(doredraw) {
+ scrarea_queue_winredraw(curarea);
+ scrarea_queue_headredraw(curarea);
+ }
}
diff --git a/source/blender/src/toolbox.c b/source/blender/src/toolbox.c
index 94d38ee1635..8a8d7c8cec7 100644
--- a/source/blender/src/toolbox.c
+++ b/source/blender/src/toolbox.c
@@ -125,8 +125,6 @@
void asciitoraw(int ch, unsigned short *event, unsigned short *qual)
{
- if( isalpha(ch)==0 ) return;
-
if( isupper(ch) ) {
*qual= LEFTSHIFTKEY;
ch= tolower(ch);
@@ -804,7 +802,10 @@ static void tb_do_hotkey(void *arg, int event)
case 'd': key= PAGEDOWNKEY; break;
}
}
- else asciitoraw(event, &key, &qual[3]);
+ else if (isalpha(event))
+ asciitoraw(event, &key, &qual[3]);
+ else if (event == '~')
+ key = ACCENTGRAVEKEY;
for (i=0;i<4;i++)
{
@@ -1213,6 +1214,8 @@ static TBitem tb_view[]= {
{ 0, "Ortho/Perspective|NumPad 5", TB_PAD|'5', NULL},
{ 0, "Local/Global View|NumPad /", TB_PAD|'/', NULL},
{ 0, "SEPR", 0, NULL},
+{ 0, "Show All Layers|Shift ~", TB_SHIFT|'~', NULL},
+{ 0, "SEPR", 0, NULL},
{ 0, "Align View", 0, tb_view_alignview},
{ 0, "SEPR", 0, NULL},
{ 0, "View Selected|NumPad .", TB_PAD|'.', NULL},
diff --git a/source/blender/src/transform_conversions.c b/source/blender/src/transform_conversions.c
index 8f83434e528..9f2f58d0cdb 100644
--- a/source/blender/src/transform_conversions.c
+++ b/source/blender/src/transform_conversions.c
@@ -913,8 +913,8 @@ static void createTransPose(TransInfo *t, Object *ob)
if (arm==NULL || ob->pose==NULL) return;
if (arm->flag & ARM_RESTPOS) {
- if(t->mode!=TFM_BONESIZE) {
- notice ("Pose edit not possible while Rest Position is enabled");
+ if(ELEM(t->mode, TFM_DUMMY, TFM_BONESIZE)==0) {
+ notice("Pose edit not possible while Rest Position is enabled");
return;
}
}