[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16293] branches/apricot/source: svn merge -r 16287:HEAD https://svn.blender.org/svnroot/bf-blender/trunk/ blender still getting errors compiling blenderplayer
Campbell Barton
ideasman42 at gmail.com
Fri Aug 29 01:13:06 CEST 2008
Revision: 16293
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16293
Author: campbellbarton
Date: 2008-08-29 01:12:29 +0200 (Fri, 29 Aug 2008)
Log Message:
-----------
svn merge -r 16287:HEAD https://svn.blender.org/svnroot/bf-blender/trunk/blender still getting errors compiling blenderplayer
Modified Paths:
--------------
branches/apricot/source/blender/include/BIF_editarmature.h
branches/apricot/source/blender/makesdna/DNA_sensor_types.h
branches/apricot/source/blender/src/buttons_logic.c
branches/apricot/source/blender/src/editarmature.c
branches/apricot/source/blender/src/editobject.c
branches/apricot/source/blender/src/space.c
branches/apricot/source/gameengine/Converter/KX_ConvertSensors.cpp
branches/apricot/source/gameengine/Ketsji/KX_RaySensor.cpp
branches/apricot/source/gameengine/Ketsji/KX_RaySensor.h
branches/apricot/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
Modified: branches/apricot/source/blender/include/BIF_editarmature.h
===================================================================
--- branches/apricot/source/blender/include/BIF_editarmature.h 2008-08-28 22:08:37 UTC (rev 16292)
+++ branches/apricot/source/blender/include/BIF_editarmature.h 2008-08-28 23:12:29 UTC (rev 16293)
@@ -91,6 +91,7 @@
int join_armature(void);
void separate_armature(void);
+void apply_armature_pose2bones(void);
void load_editArmature(void);
void make_bone_parent(void);
Modified: branches/apricot/source/blender/makesdna/DNA_sensor_types.h
===================================================================
--- branches/apricot/source/blender/makesdna/DNA_sensor_types.h 2008-08-28 22:08:37 UTC (rev 16292)
+++ branches/apricot/source/blender/makesdna/DNA_sensor_types.h 2008-08-28 23:12:29 UTC (rev 16293)
@@ -237,6 +237,9 @@
* */
/* #define SENS_COLLISION_PROPERTY 0 */
#define SENS_COLLISION_MATERIAL 1
+/* ray specific mode */
+/* X-Ray means that the ray will traverse objects that don't have the property/material */
+#define SENS_RAY_XRAY 2
/* Some stuff for the mouse sensor Type: */
#define BL_SENS_MOUSE_LEFT_BUTTON 1
Modified: branches/apricot/source/blender/src/buttons_logic.c
===================================================================
--- branches/apricot/source/blender/src/buttons_logic.c 2008-08-28 22:08:37 UTC (rev 16292)
+++ branches/apricot/source/blender/src/buttons_logic.c 2008-08-28 23:12:29 UTC (rev 16293)
@@ -1390,9 +1390,14 @@
&raySens->propname, 0, 31, 0, 0,
"Only look for Objects with this property");
}
-
+
+ /* X-Ray option */
+ uiDefButBitS(block, TOG, SENS_RAY_XRAY, 1, "X",
+ xco + 10,yco - 68, 0.10 * (width-20), 19,
+ &raySens->mode, 0.0, 0.0, 0, 0,
+ "Toggle X-Ray option (see through objects that don't have the property)");
/* 2. sensing range */
- uiDefButF(block, NUM, 1, "Range", xco+10, yco-68, 0.6 * (width-20), 19,
+ uiDefButF(block, NUM, 1, "Range", xco+10 + 0.10 * (width-20), yco-68, 0.5 * (width-20), 19,
&raySens->range, 0.01, 10000.0, 100, 0,
"Sense objects no farther than this distance");
Modified: branches/apricot/source/blender/src/editarmature.c
===================================================================
--- branches/apricot/source/blender/src/editarmature.c 2008-08-28 22:08:37 UTC (rev 16292)
+++ branches/apricot/source/blender/src/editarmature.c 2008-08-28 23:12:29 UTC (rev 16293)
@@ -439,6 +439,90 @@
}
}
+/* helper for apply_armature_pose2bones - fixes parenting of objects that are bone-parented to armature */
+static void applyarmature_fix_boneparents (Object *ob)
+{
+
+}
+
+/* set the current pose as the restpose */
+void apply_armature_pose2bones(void)
+{
+ Object *ob;
+ bArmature *arm;
+ bPose *pose;
+ bPoseChannel *pchan;
+ EditBone *curbone;
+
+ /* don't check if editmode (should be done by caller) */
+ ob= OBACT;
+ if (ob->type!=OB_ARMATURE) return;
+ if (object_data_is_libdata(ob)) {
+ error_libdata();
+ return;
+ }
+ arm= get_armature(ob);
+
+ /* Get editbones of active armature to alter */
+ if (G.edbo.first) BLI_freelistN(&G.edbo);
+ make_boneList(&G.edbo, &arm->bonebase, NULL);
+
+ /* get pose of active object and move it out of posemode */
+ pose= ob->pose;
+
+ for (pchan=pose->chanbase.first; pchan; pchan=pchan->next) {
+ curbone= editbone_name_exists(&G.edbo, pchan->name);
+
+ /* simply copy the head/tail values from pchan over to curbone */
+ VECCOPY(curbone->head, pchan->pose_head);
+ VECCOPY(curbone->tail, pchan->pose_tail);
+
+ /* fix roll:
+ * 1. find auto-calculated roll value for this bone now
+ * 2. remove this from the 'visual' y-rotation
+ */
+ {
+ float premat[3][3], imat[3][3],pmat[3][3], tmat[3][3];
+ float delta[3], eul[3];
+
+ /* obtain new auto-yrotation */
+ VecSubf(delta, curbone->tail, curbone->head);
+ vec_roll_to_mat3(delta, curbone->roll, premat);
+ Mat3Inv(imat, premat);
+
+ /* get pchan 'visual' matrix */
+ Mat3CpyMat4(pmat, pchan->pose_mat);
+
+ /* remove auto from visual and get euler rotation */
+ Mat3MulMat3(tmat, imat, pmat);
+ Mat3ToEul(tmat, eul);
+
+ /* just use this euler-y as new roll value */
+ curbone->roll= eul[1];
+ }
+
+ /* clear transform values for pchan */
+ pchan->loc[0]= pchan->loc[1]= pchan->loc[2]= 0;
+ pchan->size[0]= pchan->size[1]= pchan->size[2]= 1;
+ pchan->quat[1]= pchan->quat[2]= pchan->quat[3]= 0;
+ pchan->quat[0]= 1;
+ }
+
+ /* convert editbones back to bones */
+ editbones_to_armature(&G.edbo, ob);
+ if (G.edbo.first) BLI_freelistN(&G.edbo);
+
+ /* flush positions of posebones */
+ where_is_pose(ob);
+
+ /* fix parenting of objects which are bone-parented */
+ applyarmature_fix_boneparents(ob);
+
+ BIF_undo_push("Apply new restpose");
+ allqueue(REDRAWVIEW3D, 0);
+}
+
+
/* Helper function for armature joining - link fixing */
static void joined_armature_fix_links(Object *tarArm, Object *srcArm, bPoseChannel *pchan, EditBone *curbone)
{
Modified: branches/apricot/source/blender/src/editobject.c
===================================================================
--- branches/apricot/source/blender/src/editobject.c 2008-08-28 22:08:37 UTC (rev 16292)
+++ branches/apricot/source/blender/src/editobject.c 2008-08-28 23:12:29 UTC (rev 16293)
@@ -4130,15 +4130,26 @@
}
allqueue(REDRAWVIEW3D, 0);
- } else {
+ }
+ else {
+ ob= OBACT;
- evt = pupmenu("Apply Object%t|Scale and Rotation to ObData|Visual Transform to Objects Loc/Scale/Rot");
+ if ((ob->pose) && (ob->flag & OB_POSEMODE))
+ evt = pupmenu("Apply Object%t|Current Pose as RestPose%x3");
+ else
+ evt = pupmenu("Apply Object%t|Scale and Rotation to ObData%x1|Visual Transform to Objects Loc/Scale/Rot%x2");
if (evt==-1) return;
- if (evt==1) {
- apply_objects_locrot();
- } else if (evt==2) {
- apply_objects_visual_tx();
+ switch (evt) {
+ case 1:
+ apply_objects_locrot();
+ break;
+ case 2:
+ apply_objects_visual_tx();
+ break;
+ case 3:
+ apply_armature_pose2bones();
+ break;
}
}
}
Modified: branches/apricot/source/blender/src/space.c
===================================================================
--- branches/apricot/source/blender/src/space.c 2008-08-28 22:08:37 UTC (rev 16292)
+++ branches/apricot/source/blender/src/space.c 2008-08-28 23:12:29 UTC (rev 16293)
@@ -1976,7 +1976,7 @@
G.vd->drawtype= pupval;
doredraw= 1;
}
- }
+ }
break;
case EKEY:
Modified: branches/apricot/source/gameengine/Converter/KX_ConvertSensors.cpp
===================================================================
--- branches/apricot/source/gameengine/Converter/KX_ConvertSensors.cpp 2008-08-28 22:08:37 UTC (rev 16292)
+++ branches/apricot/source/gameengine/Converter/KX_ConvertSensors.cpp 2008-08-28 23:12:29 UTC (rev 16293)
@@ -633,6 +633,7 @@
if (eventmgr)
{
bool bFindMaterial = (blenderraysensor->mode & SENS_COLLISION_MATERIAL);
+ bool bXRay = (blenderraysensor->mode & SENS_RAY_XRAY);
STR_String checkname = (bFindMaterial? blenderraysensor->matname : blenderraysensor->propname);
@@ -645,6 +646,7 @@
gameobj,
checkname,
bFindMaterial,
+ bXRay,
distance,
axis,
kxscene);
Modified: branches/apricot/source/gameengine/Ketsji/KX_RaySensor.cpp
===================================================================
--- branches/apricot/source/gameengine/Ketsji/KX_RaySensor.cpp 2008-08-28 22:08:37 UTC (rev 16292)
+++ branches/apricot/source/gameengine/Ketsji/KX_RaySensor.cpp 2008-08-28 23:12:29 UTC (rev 16293)
@@ -51,6 +51,7 @@
SCA_IObject* gameobj,
const STR_String& propname,
bool bFindMaterial,
+ bool bXRay,
double distance,
int axis,
KX_Scene* ketsjiScene,
@@ -58,6 +59,7 @@
: SCA_ISensor(gameobj,eventmgr, T),
m_propertyname(propname),
m_bFindMaterial(bFindMaterial),
+ m_bXRay(bXRay),
m_distance(distance),
m_scene(ketsjiScene),
m_axis(axis)
@@ -153,7 +155,21 @@
printf("Invalid client type %d found ray casting\n", client->m_type);
return false;
}
- // no X-Ray function yet
+ if (m_bXRay && m_propertyname.Length() != 0)
+ {
+ if (m_bFindMaterial)
+ {
+ // not quite correct: an object may have multiple material
+ // should check all the material and not only the first one
+ if (!client->m_auxilary_info || (m_propertyname != ((char*)client->m_auxilary_info)))
+ return false;
+ }
+ else
+ {
+ if (client->m_gameobject->GetProperty(m_propertyname) == NULL)
+ return false;
+ }
+ }
return true;
}
Modified: branches/apricot/source/gameengine/Ketsji/KX_RaySensor.h
===================================================================
--- branches/apricot/source/gameengine/Ketsji/KX_RaySensor.h 2008-08-28 22:08:37 UTC (rev 16292)
+++ branches/apricot/source/gameengine/Ketsji/KX_RaySensor.h 2008-08-28 23:12:29 UTC (rev 16293)
@@ -43,6 +43,7 @@
Py_Header;
STR_String m_propertyname;
bool m_bFindMaterial;
+ bool m_bXRay;
double m_distance;
class KX_Scene* m_scene;
bool m_bTriggered;
@@ -57,7 +58,8 @@
KX_RaySensor(class SCA_EventManager* eventmgr,
SCA_IObject* gameobj,
const STR_String& propname,
- bool fFindMaterial,
+ bool bFindMaterial,
+ bool bXRay,
double distance,
int axis,
class KX_Scene* ketsjiScene,
Modified: branches/apricot/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
===================================================================
--- branches/apricot/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp 2008-08-28 22:08:37 UTC (rev 16292)
+++ branches/apricot/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp 2008-08-28 23:12:29 UTC (rev 16293)
@@ -53,6 +53,7 @@
#include <stdio.h>
+#include <string.h> // for memset
#ifdef NEW_BULLET_VEHICLE_SUPPORT
class WrapperVehicle : public PHY_IVehicle
More information about the Bf-blender-cvs
mailing list