[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15657] branches/apricot/source: svn merge -r15643:HEAD https://svn.blender.org/svnroot/bf-blender/trunk/ blender
Campbell Barton
ideasman42 at gmail.com
Sun Jul 20 19:25:14 CEST 2008
Revision: 15657
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15657
Author: campbellbarton
Date: 2008-07-20 19:25:12 +0200 (Sun, 20 Jul 2008)
Log Message:
-----------
svn merge -r15643:HEAD https://svn.blender.org/svnroot/bf-blender/trunk/blender
Modified Paths:
--------------
branches/apricot/source/blender/blenkernel/intern/lattice.c
branches/apricot/source/blender/python/api2_2x/Library.c
branches/apricot/source/blender/python/api2_2x/doc/LibData.py
branches/apricot/source/blender/render/intern/source/shadeoutput.c
branches/apricot/source/blender/src/drawobject.c
branches/apricot/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
branches/apricot/source/gameengine/Ketsji/KX_BulletPhysicsController.h
branches/apricot/source/gameengine/Ketsji/KX_GameObject.cpp
branches/apricot/source/gameengine/Ketsji/KX_GameObject.h
branches/apricot/source/gameengine/Physics/Bullet/CcdPhysicsController.h
branches/apricot/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
branches/apricot/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
branches/apricot/source/gameengine/PyDoc/KX_GameObject.py
Modified: branches/apricot/source/blender/blenkernel/intern/lattice.c
===================================================================
--- branches/apricot/source/blender/blenkernel/intern/lattice.c 2008-07-20 17:18:46 UTC (rev 15656)
+++ branches/apricot/source/blender/blenkernel/intern/lattice.c 2008-07-20 17:25:12 UTC (rev 15657)
@@ -915,7 +915,10 @@
mti->deformVerts(md, ob, NULL, vertexCos, numVerts);
}
- if (vertexCos) {
+ /* always displist to make this work like derivedmesh */
+ if (!vertexCos) vertexCos = lattice_getVertexCos(ob, &numVerts);
+
+ {
DispList *dl = MEM_callocN(sizeof(*dl), "lt_dl");
dl->type = DL_VERTS;
dl->parts = 1;
Modified: branches/apricot/source/blender/python/api2_2x/Library.c
===================================================================
--- branches/apricot/source/blender/python/api2_2x/Library.c 2008-07-20 17:18:46 UTC (rev 15656)
+++ branches/apricot/source/blender/python/api2_2x/Library.c 2008-07-20 17:25:12 UTC (rev 15657)
@@ -1135,9 +1135,78 @@
return (PyObject *)lib;
}
+static PyObject *M_Library_GetPaths(PyObject *self, PyObject * args)
+{
+ PyObject *list;
+ PyObject *name;
+ int type=0;
+ Library *lib;
+
+ if( !PyArg_ParseTuple( args, "|i", &type ) || type < 0 || type > 2 ) {
+ return EXPP_ReturnPyObjError( PyExc_TypeError,
+ "expected an int between 0 and 2." );
+ }
+
+ list = PyList_New(0);
+
+ for(lib= G.main->library.first; lib; lib= lib->id.next) {
+ if (type==0) {
+ /* any type is ok */
+ } else if (type==1 && lib->parent == 0) {
+ /* only direct linked */
+ } else if (type==2 && lib->parent != 0) {
+ /* only indirect */
+ } else {
+ continue; /* incompatible type */
+ }
+
+ name = PyString_FromString(lib->name);
+ PyList_Append(list, name);
+ Py_DECREF(name);
+ }
+ return list;
+}
+
+static PyObject *M_Library_ReplacePath(PyObject *self, PyObject * args)
+{
+ char *name_from, *name_to;
+ Library *lib;
+
+ if( !PyArg_ParseTuple( args, "ss", &name_from, &name_to )) {
+ return EXPP_ReturnPyObjError( PyExc_TypeError,
+ "expected the name of a library path" );
+ }
+
+ for(lib= G.main->library.first; lib; lib= lib->id.next) {
+ if (strcmp(lib->name, name_from)==0) {
+ if (lib->parent) {
+ return EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "path is indirectly linked, cannot be changed." );
+ }
+
+ if (strlen(name_to) > sizeof(lib->name)) {
+ return EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "string length too long, cannot set path." );
+ }
+
+ strcpy(lib->name, name_to);
+ Py_RETURN_NONE;
+ }
+ }
+
+ return EXPP_ReturnPyObjError( PyExc_ValueError,
+ "path given does not exist as a library" );
+}
+
+
+
static struct PyMethodDef M_Library_methods[] = {
{"load", (PyCFunction)M_Library_Load, METH_VARARGS,
"(string) - declare a .blend file for use as a library"},
+ {"paths", (PyCFunction)M_Library_GetPaths, METH_VARARGS,
+ "(type) - return a list of library paths, type 0 for all, 1 only direct links, 2 only indirect links"},
+ {"replace", (PyCFunction)M_Library_ReplacePath, METH_VARARGS,
+ "(from, to) - replace the path of an existing, directly linked library."},
{NULL, NULL, 0, NULL}
};
Modified: branches/apricot/source/blender/python/api2_2x/doc/LibData.py
===================================================================
--- branches/apricot/source/blender/python/api2_2x/doc/LibData.py 2008-07-20 17:18:46 UTC (rev 15656)
+++ branches/apricot/source/blender/python/api2_2x/doc/LibData.py 2008-07-20 17:25:12 UTC (rev 15657)
@@ -27,18 +27,38 @@
"""
def load(filename,relative=False):
- """
- Select an existing .blend file for use as a library. Unlike the
- Library module, multiple libraries can be defined at the same time.
-
- @type filename: string
- @param filename: The filename of a Blender file. Filenames starting with "//" will be loaded relative to the blend file's location.
- @type relative: boolean
- @param relative: Convert relative paths to absolute paths (default). Setting this parameter to True will leave paths relative.
- @rtype: Library
- @return: return a L{Library} object.
- """
+ """
+ Select an existing .blend file for use as a library. Unlike the
+ Library module, multiple libraries can be defined at the same time.
+
+ @type filename: string
+ @param filename: The filename of a Blender file. Filenames starting with "//" will be loaded relative to the blend file's location.
+ @type relative: boolean
+ @param relative: Convert relative paths to absolute paths (default). Setting this parameter to True will leave paths relative.
+ @rtype: Library
+ @return: return a L{Library} object.
+ """
+def paths(link=0):
+ """
+ Returns a list of paths used in the current blend file.
+
+ @type link: int
+ @param link: 0 (default if no args given) for all library paths, 1 for directly linked library paths only, 2 for indirectly linked library paths only.
+ @rtype: List
+ @return: return a list of path strings.
+ """
+
+def replace(pathFrom, pathTo):
+ """
+ Replaces an existing directly linked path.
+
+ @type pathFrom: string
+ @param pathFrom: An existing library path.
+ @type pathTo: string
+ @param pathTo: A new library path.
+ """
+
class Libraries:
"""
The Library object
Modified: branches/apricot/source/blender/render/intern/source/shadeoutput.c
===================================================================
--- branches/apricot/source/blender/render/intern/source/shadeoutput.c 2008-07-20 17:18:46 UTC (rev 15656)
+++ branches/apricot/source/blender/render/intern/source/shadeoutput.c 2008-07-20 17:25:12 UTC (rev 15657)
@@ -1379,6 +1379,8 @@
}
/* specularity */
+ shadfac[3]*= phongcorr; /* note, shadfac not allowed to be stored nonlocal */
+
if(shadfac[3]>0.0f && shi->spec!=0.0f && !(lar->mode & LA_NO_SPEC) && !(lar->mode & LA_ONLYSHADOW)) {
if(!(passflag & (SCE_PASS_COMBINED|SCE_PASS_SPEC)));
Modified: branches/apricot/source/blender/src/drawobject.c
===================================================================
--- branches/apricot/source/blender/src/drawobject.c 2008-07-20 17:18:46 UTC (rev 15656)
+++ branches/apricot/source/blender/src/drawobject.c 2008-07-20 17:25:12 UTC (rev 15657)
@@ -1275,7 +1275,12 @@
int use_wcol= 0;
lt= (ob==G.obedit)?editLatt:ob->data;
+
+ /* now we default make displist, this will modifiers work for non animated case */
+ if(ob->disp.first==NULL)
+ lattice_calc_modifiers(ob);
dl= find_displist(&ob->disp, DL_VERTS);
+
if(ob==G.obedit) {
cpack(0x004000);
Modified: branches/apricot/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
===================================================================
--- branches/apricot/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp 2008-07-20 17:18:46 UTC (rev 15656)
+++ branches/apricot/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp 2008-07-20 17:25:12 UTC (rev 15657)
@@ -170,10 +170,12 @@
{
btBroadphaseProxy* handle = body->getBroadphaseHandle();
m_savedCollisionFlags = body->getCollisionFlags();
+ m_savedMass = GetMass();
m_savedCollisionFilterGroup = handle->m_collisionFilterGroup;
m_savedCollisionFilterMask = handle->m_collisionFilterMask;
body->setActivationState(DISABLE_SIMULATION);
GetPhysicsEnvironment()->updateCcdPhysicsController(this,
+ 0.0,
btCollisionObject::CF_STATIC_OBJECT|((ghost)?btCollisionObject::CF_NO_CONTACT_RESPONSE:(m_savedCollisionFlags&btCollisionObject::CF_NO_CONTACT_RESPONSE)),
btBroadphaseProxy::StaticFilter,
btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter);
@@ -185,11 +187,12 @@
btRigidBody *body = GetRigidBody();
if (body->getActivationState() == DISABLE_SIMULATION)
{
- GetRigidBody()->forceActivationState(ACTIVE_TAG);
GetPhysicsEnvironment()->updateCcdPhysicsController(this,
+ m_savedMass,
m_savedCollisionFlags,
m_savedCollisionFilterGroup,
m_savedCollisionFilterMask);
+ GetRigidBody()->forceActivationState(ACTIVE_TAG);
}
}
Modified: branches/apricot/source/gameengine/Ketsji/KX_BulletPhysicsController.h
===================================================================
--- branches/apricot/source/gameengine/Ketsji/KX_BulletPhysicsController.h 2008-07-20 17:18:46 UTC (rev 15656)
+++ branches/apricot/source/gameengine/Ketsji/KX_BulletPhysicsController.h 2008-07-20 17:25:12 UTC (rev 15657)
@@ -11,6 +11,8 @@
int m_savedCollisionFlags;
short int m_savedCollisionFilterGroup;
short int m_savedCollisionFilterMask;
+ MT_Scalar m_savedMass;
+
public:
KX_BulletPhysicsController (const CcdConstructionInfo& ci, bool dyna);
Modified: branches/apricot/source/gameengine/Ketsji/KX_GameObject.cpp
===================================================================
--- branches/apricot/source/gameengine/Ketsji/KX_GameObject.cpp 2008-07-20 17:18:46 UTC (rev 15656)
+++ branches/apricot/source/gameengine/Ketsji/KX_GameObject.cpp 2008-07-20 17:25:12 UTC (rev 15657)
@@ -224,6 +224,10 @@
RemoveParent(scene);
obj->GetSGNode()->AddChild(GetSGNode());
+ if (m_pPhysicsController1)
+ {
+ m_pPhysicsController1->SuspendDynamics(true);
+ }
// Set us to our new scale, position, and orientation
scale1[0] = scale1[0]/scale2[0];
scale1[1] = scale1[1]/scale2[1];
@@ -240,10 +244,6 @@
if (rootlist->RemoveValue(this))
// the object was in parent list, decrement ref count as it's now removed
Release();
- if (m_pPhysicsController1)
- {
- m_pPhysicsController1->SuspendDynamics(true);
- }
}
}
@@ -724,8 +724,12 @@
void KX_GameObject::NodeSetLocalPosition(const MT_Point3& trans)
{
- if (m_pPhysicsController1)
+ if (m_pPhysicsController1 && (!GetSGNode() || !GetSGNode()->GetSGParent()))
{
+ // don't update physic controller if the object is a child:
+ // 1) the transformation will not be right
+ // 2) in this case, the physic controller is necessarily a static object
+ // that is updated from the normal kinematic synchronization
m_pPhysicsController1->setPosition(trans);
}
@@ -737,25 +741,22 @@
void KX_GameObject::NodeSetLocalOrientation(const MT_Matrix3x3& rot)
{
- if (m_pPhysicsController1)
+ if (m_pPhysicsController1 && (!GetSGNode() || !GetSGNode()->GetSGParent()))
{
+ // see note above
m_pPhysicsController1->setOrientation(rot.getRotation());
}
if (GetSGNode())
GetSGNode()->SetLocalOrientation(rot);
- else
- {
- int i;
- i=0;
- }
}
void KX_GameObject::NodeSetLocalScale(const MT_Vector3& scale)
{
- if (m_pPhysicsController1)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list