Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2008-09-04 04:32:15 +0400
committerCampbell Barton <ideasman42@gmail.com>2008-09-04 04:32:15 +0400
commit7e8a3aa0b1c1217140c08bcb1c7bf489b5cc5d25 (patch)
treedeaa20687617f0145b6644d1066dc8699a7b7380 /source
parent0d5ec24a05d4bae076fa65b7bbcb0e37d0b22b5d (diff)
svn merge -r 16334:HEAD https://svn.blender.org/svnroot/bf-blender/trunk/blender
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/particle_system.c2
-rw-r--r--source/blender/blenloader/BLO_sys_types.h14
-rw-r--r--source/blender/makesdna/DNA_meshdata_types.h1
-rw-r--r--source/blender/python/BPY_interface.c11
-rw-r--r--source/blender/python/api2_2x/Text.c2
-rw-r--r--source/blender/src/drawtext.c8
-rw-r--r--source/blender/src/editmesh.c4
-rw-r--r--source/gameengine/Expressions/PyObjectPlus.cpp4
-rw-r--r--source/gameengine/Expressions/Value.cpp30
-rw-r--r--source/gameengine/GameLogic/SCA_ISensor.cpp3
-rw-r--r--source/gameengine/GameLogic/SCA_JoystickSensor.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.cpp10
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp6
-rw-r--r--source/gameengine/PyDoc/KX_GameObject.py22
14 files changed, 80 insertions, 39 deletions
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 92c2f27bc31..96eb4d5d8e3 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -76,6 +76,8 @@
#include "BKE_modifier.h"
#include "BKE_scene.h"
+#include "PIL_time.h"
+
#include "BSE_headerbuttons.h"
#include "blendef.h"
diff --git a/source/blender/blenloader/BLO_sys_types.h b/source/blender/blenloader/BLO_sys_types.h
index a9d29375eac..49155260b31 100644
--- a/source/blender/blenloader/BLO_sys_types.h
+++ b/source/blender/blenloader/BLO_sys_types.h
@@ -49,6 +49,7 @@ extern "C" {
/* The __intXX are built-in types of the visual complier! So we don't
* need to include anything else here. */
+
typedef signed __int8 int8_t;
typedef signed __int16 int16_t;
typedef signed __int32 int32_t;
@@ -59,13 +60,23 @@ typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
+#ifndef _INTPTR_T_DEFINED
#ifdef _WIN64
typedef __int64 intptr_t;
-typedef unsigned __int64 uintptr_t;
#else
typedef long intptr_t;
+#endif
+#define _INTPTR_T_DEFINED
+#endif
+
+#ifndef _UINTPTR_T_DEFINED
+#ifdef _WIN64
+typedef unsigned __int64 uintptr_t;
+#else
typedef unsigned long uintptr_t;
#endif
+#define _UINTPTR_T_DEFINED
+#endif
#elif defined(__linux__)
@@ -87,6 +98,7 @@ typedef unsigned long uintptr_t;
#endif /* ifdef platform for types */
+
#ifdef _WIN32
#define htonl(x) correctByteOrder(x)
#define ntohl(x) correctByteOrder(x)
diff --git a/source/blender/makesdna/DNA_meshdata_types.h b/source/blender/makesdna/DNA_meshdata_types.h
index 4e427ed733c..fc686a4cc10 100644
--- a/source/blender/makesdna/DNA_meshdata_types.h
+++ b/source/blender/makesdna/DNA_meshdata_types.h
@@ -82,6 +82,7 @@ typedef struct MLoopUV{
typedef struct MLoopCol{
char a, r, g, b;
+ int pad; /*waste!*/
}MLoopCol;
typedef struct MSticky {
diff --git a/source/blender/python/BPY_interface.c b/source/blender/python/BPY_interface.c
index 47bec81df7a..949556f4344 100644
--- a/source/blender/python/BPY_interface.c
+++ b/source/blender/python/BPY_interface.c
@@ -292,7 +292,7 @@ void syspath_append( char *dirname )
short ok=1;
PyErr_Clear( );
- dir = Py_BuildValue( "s", dirname );
+ dir = PyString_FromString( dirname );
mod_sys = PyImport_ImportModule( "sys" ); /* new ref */
@@ -308,32 +308,29 @@ void syspath_append( char *dirname )
}
if (PySequence_Contains(path, dir)==0) { /* Only add if we need to */
- if (ok && PyList_Append( path, dir ) != 0)
+ if (ok && PyList_Append( path, dir ) != 0) /* decref below */
ok = 0; /* append failed */
if( (ok==0) || PyErr_Occurred( ) )
Py_FatalError( "could import or build sys.path, can't continue" );
}
+ Py_DECREF( dir );
Py_XDECREF( mod_sys );
}
void init_syspath( int first_time )
{
- PyObject *path;
PyObject *mod, *d;
char *progname;
char execdir[FILE_MAXDIR]; /*defines from DNA_space_types.h */
int n;
-
-
- path = Py_BuildValue( "s", bprogname );
mod = PyImport_ImportModule( "Blender.sys" );
if( mod ) {
d = PyModule_GetDict( mod );
- EXPP_dict_set_item_str( d, "progname", path );
+ EXPP_dict_set_item_str( d, "progname", PyString_FromString( bprogname ) );
Py_DECREF( mod );
} else
printf( "Warning: could not set Blender.sys.progname\n" );
diff --git a/source/blender/python/api2_2x/Text.c b/source/blender/python/api2_2x/Text.c
index a76a6f56224..9719daaa3d4 100644
--- a/source/blender/python/api2_2x/Text.c
+++ b/source/blender/python/api2_2x/Text.c
@@ -718,7 +718,7 @@ static PyObject *Text_markSelection( BPy_Text * self, PyObject * args )
static PyObject *Text_suggest( BPy_Text * self, PyObject * args )
{
PyObject *item = NULL, *tup1 = NULL, *tup2 = NULL;
- PyObject *list = NULL, *resl = NULL;
+ PyObject *list = NULL;
int list_len, i;
char *prefix = NULL, *name, type;
SpaceText *st;
diff --git a/source/blender/src/drawtext.c b/source/blender/src/drawtext.c
index 0797a425f2a..daa2d52d485 100644
--- a/source/blender/src/drawtext.c
+++ b/source/blender/src/drawtext.c
@@ -328,12 +328,14 @@ void txt_format_line(SpaceText *st, TextLine *line, int do_next) {
int len, i;
/* Get continuation from previous line */
- if (line->prev && (fmt=line->prev->format)) {
+ if (line->prev && line->prev->format != NULL) {
+ fmt= line->prev->format;
cont = fmt[strlen(fmt)+1]; /* Just after the null-terminator */
} else cont = 0;
/* Get original continuation from this line */
- if (fmt=line->format) {
+ if (line->format != NULL) {
+ fmt= line->format;
orig = fmt[strlen(fmt)+1]; /* Just after the null-terminator */
} else orig = 0xFF;
@@ -405,7 +407,7 @@ void txt_format_line(SpaceText *st, TextLine *line, int do_next) {
prev = 'b';
if (i>0) {
while (i>1) {
- *fmt = prev; *fmt++; *str++;
+ *fmt = prev; fmt++; str++;
i--;
}
*fmt = prev;
diff --git a/source/blender/src/editmesh.c b/source/blender/src/editmesh.c
index cbf1aad2ae6..b9b74eb793d 100644
--- a/source/blender/src/editmesh.c
+++ b/source/blender/src/editmesh.c
@@ -1684,6 +1684,10 @@ void separate_mesh(void)
efa= em->faces.first;
while(efa) {
vl1= efa->next;
+ if (efa == G.editMesh->act_face && (efa->f & SELECT)) {
+ EM_set_actFace(NULL);
+ }
+
if((efa->f & SELECT)==0) {
BLI_remlink(&em->faces, efa);
BLI_addtail(&edvl, efa);
diff --git a/source/gameengine/Expressions/PyObjectPlus.cpp b/source/gameengine/Expressions/PyObjectPlus.cpp
index 8937f481922..1eca527151a 100644
--- a/source/gameengine/Expressions/PyObjectPlus.cpp
+++ b/source/gameengine/Expressions/PyObjectPlus.cpp
@@ -119,6 +119,7 @@ PyObject *PyObjectPlus::_getattr(const STR_String& attr)
int PyObjectPlus::_delattr(const STR_String& attr)
{
+ PyErr_SetString(PyExc_AttributeError, "attribute cant be deleted");
return 1;
}
@@ -126,7 +127,8 @@ int PyObjectPlus::_setattr(const STR_String& attr, PyObject *value)
{
//return PyObject::_setattr(attr,value);
//cerr << "Unknown attribute" << endl;
- return 1;
+ PyErr_SetString(PyExc_AttributeError, "attribute cant be set");
+ return 1;
}
/*------------------------------
diff --git a/source/gameengine/Expressions/Value.cpp b/source/gameengine/Expressions/Value.cpp
index 7bcb45228db..7296dfbec10 100644
--- a/source/gameengine/Expressions/Value.cpp
+++ b/source/gameengine/Expressions/Value.cpp
@@ -391,16 +391,23 @@ float CValue::GetPropertyNumber(const STR_String& inName,float defnumber)
bool CValue::RemoveProperty(const STR_String & inName)
{
// Check if there are properties at all which can be removed
- if (m_pNamedPropertyArray == NULL)
- return false;
-
- CValue* val = GetProperty(inName);
- if (NULL != val)
- {
- val->Release();
- m_pNamedPropertyArray->erase(inName);
- return true;
- }
+ if (m_pNamedPropertyArray) {
+ CValue* val = GetProperty(inName);
+ if (NULL != val)
+ {
+ val->Release();
+ m_pNamedPropertyArray->erase(inName);
+ return true;
+ }
+ }
+
+ char err[128];
+ if (m_pNamedPropertyArray)
+ sprintf(err, "attribute \"%s\" dosnt exist", inName.ReadPtr());
+ else
+ sprintf(err, "attribute \"%s\" dosnt exist (no property array)", inName.ReadPtr());
+
+ PyErr_SetString(PyExc_AttributeError, err);
return false;
}
@@ -755,7 +762,8 @@ CValue* CValue::ConvertPythonToValue(PyObject* pyobj)
int CValue::_delattr(const STR_String& attr)
{
- RemoveProperty(attr);
+ if (!RemoveProperty(attr)) /* sets error */
+ return 1;
return 0;
}
diff --git a/source/gameengine/GameLogic/SCA_ISensor.cpp b/source/gameengine/GameLogic/SCA_ISensor.cpp
index c96eb82e29e..084b1395159 100644
--- a/source/gameengine/GameLogic/SCA_ISensor.cpp
+++ b/source/gameengine/GameLogic/SCA_ISensor.cpp
@@ -226,6 +226,9 @@ void SCA_ISensor::Activate(class SCA_LogicManager* logicmgr, CValue* event)
bool result = this->Evaluate(event);
if (result) {
logicmgr->AddActivatedSensor(this);
+ // reset these counters so that pulse are synchronized with transition
+ m_pos_ticks = 0;
+ m_neg_ticks = 0;
} else
{
/* First, the pulsing behaviour, if pulse mode is
diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
index b32cbd83285..645afc8964b 100644
--- a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
@@ -329,7 +329,7 @@ PyMethodDef SCA_JoystickSensor::Methods[] = {
{"getNumAxes", (PyCFunction) SCA_JoystickSensor::sPyNumberOfAxes, METH_NOARGS, NumberOfAxes_doc},
{"getNumButtons",(PyCFunction) SCA_JoystickSensor::sPyNumberOfButtons,METH_NOARGS, NumberOfButtons_doc},
{"getNumHats", (PyCFunction) SCA_JoystickSensor::sPyNumberOfHats, METH_NOARGS, NumberOfHats_doc},
- {"getConnected", (PyCFunction) SCA_JoystickSensor::sPyConnected, METH_NOARGS, Connected_doc},
+ {"isConnected", (PyCFunction) SCA_JoystickSensor::sPyConnected, METH_NOARGS, Connected_doc},
{NULL,NULL} //Sentinel
};
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index 71bb1fc90d8..bec5d188f06 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -1021,11 +1021,15 @@ PyObject* KX_GameObject::_getattr(const STR_String& attr)
int KX_GameObject::_setattr(const STR_String& attr, PyObject *value) // _setattr method
{
- if (attr == "mass")
+ if (attr == "mass") {
+ PyErr_SetString(PyExc_AttributeError, "attribute \"mass\" is read only");
return 1;
+ }
- if (attr == "parent")
+ if (attr == "parent") {
+ PyErr_SetString(PyExc_AttributeError, "attribute \"mass\" is read only\nUse setParent()");
return 1;
+ }
if (PyInt_Check(value))
{
@@ -1092,7 +1096,7 @@ int KX_GameObject::_setattr(const STR_String& attr, PyObject *value) // _setattr
}
return 1;
}
-
+ PyErr_SetString(PyExc_AttributeError, "could not set the orientation from a 3x3 matrix, quaternion or euler sequence");
return 1;
}
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index debb06936ed..120311fb967 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -281,7 +281,7 @@ static PyObject* gPyGetBlendFileList(PyObject*, PyObject* args)
{
char cpath[sizeof(G.sce)];
char *searchpath = NULL;
- PyObject* list;
+ PyObject* list, *value;
DIR *dp;
struct dirent *dirp;
@@ -307,7 +307,9 @@ static PyObject* gPyGetBlendFileList(PyObject*, PyObject* args)
while ((dirp = readdir(dp)) != NULL) {
if (BLI_testextensie(dirp->d_name, ".blend")) {
- PyList_Append(list, PyString_FromString(dirp->d_name));
+ value = PyString_FromString(dirp->d_name);
+ PyList_Append(list, value);
+ Py_DECREF(value);
}
}
diff --git a/source/gameengine/PyDoc/KX_GameObject.py b/source/gameengine/PyDoc/KX_GameObject.py
index 916851fa2a2..9729b14a43f 100644
--- a/source/gameengine/PyDoc/KX_GameObject.py
+++ b/source/gameengine/PyDoc/KX_GameObject.py
@@ -300,12 +300,13 @@ class KX_GameObject:
@rtype: L{KX_GameObject}
@return: the first object hit or None if no object or object does not match prop
"""
- def rayCast(to,from,dist,prop,face,xray,poly):
+ def rayCast(objto,objfrom,dist,prop,face,xray,poly):
"""
Look from a point/object to another point/object and find first object hit within dist that matches prop.
if poly is 0, returns a 3-tuple with object reference, hit point and hit normal or (None,None,None) if no hit.
if poly is 1, returns a 4-tuple with in addition a L{KX_PolyProxy} as 4th element.
- Ex:
+
+ Ex::
# shoot along the axis gun-gunAim (gunAim should be collision-free)
ob,point,normal = gun.rayCast(gunAim,None,50)
if ob:
@@ -314,23 +315,26 @@ class KX_GameObject:
Notes:
The ray ignores the object on which the method is called.
It is casted from/to object center or explicit [x,y,z] points.
- The face paremeter determines the orientation of the normal:
+
+ The face paremeter determines the orientation of the normal::
0 => hit normal is always oriented towards the ray origin (as if you casted the ray from outside)
1 => hit normal is the real face normal (only for mesh object, otherwise face has no effect)
+
The ray has X-Ray capability if xray parameter is 1, otherwise the first object hit (other than self object) stops the ray.
- The prop and xray parameters interact as follow:
+ The prop and xray parameters interact as follow::
prop off, xray off: return closest hit or no hit if there is no object on the full extend of the ray.
prop off, xray on : idem.
prop on, xray off: return closest hit if it matches prop, no hit otherwise.
prop on, xray on : return closest hit matching prop or no hit if there is no object matching prop on the full extend of the ray.
The L{KX_PolyProxy} 4th element of the return tuple when poly=1 allows to retrieve information on the polygon hit by the ray.
If there is no hit or the hit object is not a static mesh, None is returned as 4th element.
- The ray ignores collision-free objects and faces that dont have the collision flag enabled, you can however use ghost objects.
+
+ The ray ignores collision-free objects and faces that dont have the collision flag enabled, you can however use ghost objects.
- @param to: [x,y,z] or object to which the ray is casted
- @type to: L{KX_GameObject} or 3-tuple
- @param from: [x,y,z] or object from which the ray is casted; None or omitted => use self object center
- @type from: L{KX_GameObject} or 3-tuple or None
+ @param objto: [x,y,z] or object to which the ray is casted
+ @type objto: L{KX_GameObject} or 3-tuple
+ @param objfrom: [x,y,z] or object from which the ray is casted; None or omitted => use self object center
+ @type objfrom: L{KX_GameObject} or 3-tuple or None
@param dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to to
@type dist: float
@param prop: property name that object must have; can be omitted => detect any object