Sunday merger of orange branch with bf-blender
This commit is contained in:
@@ -2938,6 +2938,34 @@ static PyObject *Matr_oldsetMode( BPy_Material * self, PyObject * args )
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL
|
||||
};
|
||||
static int bitmask = MA_TRACEBLE
|
||||
| MA_SHADOW
|
||||
| MA_SHLESS
|
||||
| MA_WIRE
|
||||
| MA_VERTEXCOL
|
||||
| MA_VERTEXCOLP
|
||||
| MA_HALO
|
||||
| MA_ZTRA
|
||||
| MA_ZINV
|
||||
| MA_HALO_RINGS
|
||||
| MA_HALO_LINES
|
||||
| MA_ONLYSHADOW
|
||||
| MA_HALO_XALPHA
|
||||
| MA_STAR
|
||||
| MA_FACETEXTURE
|
||||
| MA_HALOTEX
|
||||
| MA_HALOPUNO
|
||||
| MA_NOMIST
|
||||
| MA_HALO_SHADE
|
||||
| MA_HALO_FLARE
|
||||
| MA_RADIO
|
||||
| MA_RAYMIRROR
|
||||
| MA_ZTRA
|
||||
| MA_RAYTRANSP
|
||||
| MA_ONLYSHADOW
|
||||
| MA_NOMIST
|
||||
| MA_ENV;
|
||||
|
||||
|
||||
/*
|
||||
* check for a single integer argument; do a quick check for now
|
||||
@@ -2947,7 +2975,7 @@ static PyObject *Matr_oldsetMode( BPy_Material * self, PyObject * args )
|
||||
if ( (PySequence_Size( args ) == 1)
|
||||
&& PyInt_Check ( PyTuple_GET_ITEM ( args , 0 ) )
|
||||
&& PyArg_ParseTuple( args, "i", &flag )
|
||||
&& flag < (MA_RAYMIRROR >> 1) ) {
|
||||
&& (flag & bitmask) == flag ) {
|
||||
ok = 1;
|
||||
|
||||
/*
|
||||
|
||||
@@ -1122,6 +1122,11 @@ static PyObject *MVert_repr( BPy_MVert * self )
|
||||
return PyString_FromString( format );
|
||||
}
|
||||
|
||||
static long MVert_hash( BPy_MVert *self )
|
||||
{
|
||||
return (long)self->index;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
*
|
||||
* Python MVert_Type structure definition
|
||||
@@ -1153,7 +1158,7 @@ PyTypeObject MVert_Type = {
|
||||
|
||||
/* More standard operations (here for binary compatibility) */
|
||||
|
||||
NULL, /* hashfunc tp_hash; */
|
||||
( hashfunc ) MVert_hash, /* hashfunc tp_hash; */
|
||||
NULL, /* ternaryfunc tp_call; */
|
||||
NULL, /* reprfunc tp_str; */
|
||||
NULL, /* getattrofunc tp_getattro; */
|
||||
@@ -1252,7 +1257,7 @@ PyTypeObject PVert_Type = {
|
||||
|
||||
/* More standard operations (here for binary compatibility) */
|
||||
|
||||
NULL, /* hashfunc tp_hash; */
|
||||
( hashfunc ) MVert_hash, /* hashfunc tp_hash; */
|
||||
NULL, /* ternaryfunc tp_call; */
|
||||
NULL, /* reprfunc tp_str; */
|
||||
NULL, /* getattrofunc tp_getattro; */
|
||||
@@ -2207,6 +2212,11 @@ static PyObject *MEdge_repr( BPy_MEdge * self )
|
||||
(int)self->index );
|
||||
}
|
||||
|
||||
static long MEdge_hash( BPy_MEdge *self )
|
||||
{
|
||||
return (long)self->index;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
*
|
||||
* Python MEdge_Type structure definition
|
||||
@@ -2238,7 +2248,7 @@ PyTypeObject MEdge_Type = {
|
||||
|
||||
/* More standard operations (here for binary compatibility) */
|
||||
|
||||
NULL, /* hashfunc tp_hash; */
|
||||
( hashfunc ) MEdge_hash, /* hashfunc tp_hash; */
|
||||
NULL, /* ternaryfunc tp_call; */
|
||||
NULL, /* reprfunc tp_str; */
|
||||
NULL, /* getattrofunc tp_getattro; */
|
||||
@@ -3665,6 +3675,11 @@ static PyObject *MFace_repr( BPy_MFace* self )
|
||||
(int)face->v3, (int)self->index );
|
||||
}
|
||||
|
||||
static long MFace_hash( BPy_MFace *self )
|
||||
{
|
||||
return (long)self->index;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
*
|
||||
* Python MFace_Type structure definition
|
||||
@@ -3696,7 +3711,7 @@ PyTypeObject MFace_Type = {
|
||||
|
||||
/* More standard operations (here for binary compatibility) */
|
||||
|
||||
NULL, /* hashfunc tp_hash; */
|
||||
( hashfunc ) MFace_hash, /* hashfunc tp_hash; */
|
||||
NULL, /* ternaryfunc tp_call; */
|
||||
NULL, /* reprfunc tp_str; */
|
||||
NULL, /* getattrofunc tp_getattro; */
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "BKE_library.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BIF_editfont.h" /* do_textedit() */
|
||||
#include "Curve.h"
|
||||
#include "constant.h"
|
||||
#include "Types.h"
|
||||
@@ -48,7 +49,6 @@
|
||||
//no prototypes declared in header files - external linkage outside of python
|
||||
extern VFont *get_builtin_font(void);
|
||||
extern void freedisplist(struct ListBase *lb);
|
||||
extern VFont *get_builtin_font(void);
|
||||
extern VFont *give_vfontpointer(int);
|
||||
extern VFont *exist_vfont(char *str);
|
||||
extern VFont *load_vfont(char *name);
|
||||
@@ -486,29 +486,46 @@ static PyObject *Text3d_setName( BPy_Text3d * self, PyObject * args )
|
||||
static PyObject *Text3d_setText( BPy_Text3d * self, PyObject * args )
|
||||
{
|
||||
char *text;
|
||||
if( !PyArg_ParseTuple( args, "s", &text ) )
|
||||
return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
|
||||
"expected string argument" ) );
|
||||
if( self ) {
|
||||
|
||||
if( !PyArg_ParseTuple( args, "s", &text ) )
|
||||
return EXPP_ReturnPyObjError( PyExc_AttributeError,
|
||||
"expected string argument" );
|
||||
|
||||
/*
|
||||
* If the text is currently being edited, then we have to put the
|
||||
* text into the edit buffer.
|
||||
*/
|
||||
|
||||
if( G.obedit && G.obedit->data == self->curve ) {
|
||||
short qual = G.qual;
|
||||
G.qual = 0; /* save key qualifier, then clear it */
|
||||
self->curve->pos = self->curve->len = 0;
|
||||
while ( *text )
|
||||
do_textedit( 0, 0, *text++ );
|
||||
G.qual = qual;
|
||||
} else {
|
||||
short len = (short)strlen(text);
|
||||
MEM_freeN( self->curve->str );
|
||||
if(self->curve->strinfo != NULL)
|
||||
MEM_freeN(self->curve->strinfo);
|
||||
self->curve->strinfo = MEM_callocN((strlen(text)+1)*sizeof(CharInfo), "strinfo");
|
||||
self->curve->str = MEM_mallocN( strlen (text)+1, "str" );
|
||||
self->curve->str = MEM_callocN( len+sizeof(wchar_t), "str" );
|
||||
strcpy( self->curve->str, text );
|
||||
self->curve->pos = (short)strlen ( text );
|
||||
self->curve->len = (short)strlen ( text );
|
||||
self->curve->pos = len;
|
||||
self->curve->len = len;
|
||||
|
||||
if( self->curve->strinfo )
|
||||
MEM_freeN( self->curve->strinfo );
|
||||
/* don't know why this is +4, just duplicating load_editText() */
|
||||
self->curve->strinfo = MEM_callocN( (len+4) *sizeof(CharInfo),
|
||||
"strinfo");
|
||||
}
|
||||
Py_INCREF( Py_None );
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyObject *Text3d_getText( BPy_Text3d * self )
|
||||
{
|
||||
if ( strlen(self->curve->str) )
|
||||
return PyString_FromString (self->curve->str);
|
||||
else
|
||||
return Py_None;
|
||||
if( self->curve->str )
|
||||
return PyString_FromString( self->curve->str );
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyObject* Text3d_getDrawMode(BPy_Text3d* self)
|
||||
|
||||
@@ -1341,12 +1341,12 @@ static PyObject *Texture_getExtend( BPy_Texture * self )
|
||||
static PyObject *Texture_getImage( BPy_Texture * self )
|
||||
{
|
||||
/* we need this to be an IMAGE texture, and we must have an image */
|
||||
if( ( self->texture->type != TEX_IMAGE ) || !self->texture->ima ) {
|
||||
Py_INCREF( Py_None );
|
||||
return Py_None;
|
||||
}
|
||||
if( ( self->texture->type == TEX_IMAGE ||
|
||||
self->texture->type == TEX_ENVMAP )
|
||||
&& self->texture->ima )
|
||||
return Image_CreatePyObject( self->texture->ima );
|
||||
|
||||
return Image_CreatePyObject( self->texture->ima );
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ def Intersect(vec1, vec2, vec3, ray, orig, clip=1):
|
||||
@type vec3: Vector object.
|
||||
@param vec3: A 3d vector, one corner of the triangle.
|
||||
@type ray: Vector object.
|
||||
@param ray: A 3d vector, the orientation of the ray.
|
||||
@param ray: A 3d vector, the orientation of the ray. the length of the ray is not used, only the direction.
|
||||
@type orig: Vector object.
|
||||
@param orig: A 3d vector, the origin of the ray.
|
||||
@type clip: integer
|
||||
@@ -117,6 +117,7 @@ def LineIntersect(vec1, vec2, vec3, vec4):
|
||||
def CopyVec(vector):
|
||||
"""
|
||||
Create a copy of the Vector object.
|
||||
@attention: B{DEPRECATED} use Vector(vector) instead.
|
||||
@type vector: Vector object.
|
||||
@param vector: A 2d,3d or 4d vector to be copied.
|
||||
@rtype: Vector object.
|
||||
@@ -148,7 +149,7 @@ def DotVecs(vec1, vec2):
|
||||
|
||||
def AngleBetweenVecs(vec1, vec2):
|
||||
"""
|
||||
Return the angle between two vectors.
|
||||
Return the angle between two vectors. Zero length vectors raise an error.
|
||||
@type vec1: Vector object.
|
||||
@param vec1: A 2d or 3d vector.
|
||||
@type vec2: Vector object.
|
||||
@@ -437,7 +438,9 @@ class Vector:
|
||||
|
||||
def __init__(list = None):
|
||||
"""
|
||||
Create a new 2d, 3d, or 4d Vector object from a list of numbers.
|
||||
Create a new 2d, 3d, or 4d Vector object from a list of floating point numbers.
|
||||
@note: that python uses higher precission floating point numbers, so values assigned to a vector may have some rounding error.
|
||||
|
||||
|
||||
Example::
|
||||
v = Vector(1,0,0)
|
||||
@@ -460,7 +463,9 @@ class Vector:
|
||||
|
||||
def normalize():
|
||||
"""
|
||||
Normalize the vector.
|
||||
Normalize the vector, making the length of the vector always 1.0
|
||||
@note: Normalize works for vectors of all sizes, however 4D Vectors w axis is left untouched.
|
||||
@note: Normalizing a vector where all values are zero results in all axis having a nan value (not a number).
|
||||
@return: a copy of itself
|
||||
"""
|
||||
|
||||
@@ -481,13 +486,13 @@ class Vector:
|
||||
|
||||
def resize3D():
|
||||
"""
|
||||
Resize the vector to 3d.
|
||||
Resize the vector to 3d. New axis will be 0.0.
|
||||
@return: a copy of itself
|
||||
"""
|
||||
|
||||
def resize4D():
|
||||
"""
|
||||
Resize the vector to 4d.
|
||||
Resize the vector to 4d. New axis will be 0.0.
|
||||
@return: a copy of itself
|
||||
"""
|
||||
|
||||
@@ -630,8 +635,8 @@ class Quaternion:
|
||||
Example::
|
||||
quat = Quaternion(1,2,3,4)
|
||||
quat = Quaternion(axis, angle)
|
||||
quat = Quaternion()
|
||||
quat = Quaternion(180, list)
|
||||
quat = Quaternion()
|
||||
quat = Quaternion(180, list)
|
||||
|
||||
@type list: PyList of int/float
|
||||
@param list: A 3d or 4d list to initialize quaternion.
|
||||
@@ -757,6 +762,7 @@ class Matrix:
|
||||
def identity():
|
||||
"""
|
||||
Set the matrix to the identity matrix.
|
||||
An object with zero location and rotation, a scale of 1, will have an identity matrix.
|
||||
@return: a copy of itself
|
||||
"""
|
||||
|
||||
|
||||
@@ -486,10 +486,10 @@ PyObject *EXPP_clearScriptLinks( ScriptLink * slink, PyObject * args )
|
||||
char *str;
|
||||
str = PyString_AsString ( PySequence_GetItem( seq, i ) );
|
||||
for ( j = 0 ; j < slink->totscript ; ++j ) {
|
||||
if ( slink->scripts[j] && !strcmp ( slink->scripts[j]->name+2, str ) ) {
|
||||
if ( slink->scripts[j] && !strcmp( slink->scripts[j]->name+2, str ) )
|
||||
slink->scripts[j] = NULL;
|
||||
if( !slink->scripts[j] )
|
||||
++deleted;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,34 +166,56 @@ PyObject *M_TimeLine_Get (PyObject *self, PyObject *args) {
|
||||
|
||||
static PyObject *TimeLine_getFramesMarked (BPy_TimeLine *self, PyObject *args) {
|
||||
|
||||
PyObject *marker_list= PyDict_New ();
|
||||
PyObject *marker_dict= PyDict_New ();
|
||||
TimeMarker *marker_it= NULL;
|
||||
PyObject *tmarker= NULL;
|
||||
PyObject *tmarker= NULL, *pyo= NULL;
|
||||
|
||||
if (!PyArg_ParseTuple( args, "|O", &tmarker ))
|
||||
if (!PyArg_ParseTuple (args, "|O", &tmarker))
|
||||
return EXPP_ReturnPyObjError (PyExc_TypeError,
|
||||
"expected nothing, or or two ints as arguments.");
|
||||
"expected nothing, string or int.");
|
||||
if (tmarker) {
|
||||
int f;
|
||||
int f= (int)PyInt_AS_LONG (tmarker);
|
||||
char s[64];
|
||||
f = PyInt_AsLong (tmarker);
|
||||
if (PyInt_Check (tmarker) && f != 0) {
|
||||
for (marker_it= self->marker_list->first; marker_it; marker_it= marker_it->next)
|
||||
if (marker_it->frame==f) PyDict_SetItem (marker_list, PyInt_FromLong ((long int)marker_it->frame), PyString_FromString (marker_it->name));
|
||||
}
|
||||
else if (PyString_Check (tmarker) && (BLI_strncpy(s, PyString_AsString (tmarker), 64)) ) {
|
||||
for (marker_it= self->marker_list->first; marker_it; marker_it= marker_it->next)
|
||||
if (!strcmp (marker_it->name, s)) PyDict_SetItem (marker_list, PyInt_FromLong ((long int)marker_it->frame), PyString_FromString (marker_it->name));
|
||||
|
||||
}
|
||||
if (PyString_Check (tmarker) && (BLI_strncpy (s, PyString_AsString(tmarker), 64)) )
|
||||
for (marker_it= self->marker_list->first; marker_it; marker_it= marker_it->next)
|
||||
if (!strcmp (marker_it->name, s)) {
|
||||
f= (int)marker_it->frame;
|
||||
tmarker= PyInt_FromLong ((long int)marker_it->frame);
|
||||
break;
|
||||
}
|
||||
if (PyInt_Check (tmarker) && f!=0)
|
||||
for (marker_it= self->marker_list->first; marker_it; marker_it= marker_it->next)
|
||||
if (marker_it->frame==f) {
|
||||
if ((pyo= PyDict_GetItem ((PyObject*)marker_dict, PyInt_FromLong ((long int)marker_it->frame))) )
|
||||
PyList_Append (pyo, PyString_FromString (marker_it->name));
|
||||
else {
|
||||
if (!pyo) pyo= PyList_New (0);
|
||||
PyList_Append (pyo, PyString_FromString (marker_it->name));
|
||||
}
|
||||
|
||||
PyDict_SetItem (marker_dict, PyInt_FromLong ((long int)marker_it->frame), pyo);
|
||||
}
|
||||
}
|
||||
else
|
||||
for (marker_it= self->marker_list->first; marker_it; marker_it= marker_it->next)
|
||||
PyDict_SetItem (marker_list, PyInt_FromLong ((long int)marker_it->frame), PyString_FromString (marker_it->name));
|
||||
|
||||
return marker_list;
|
||||
for (marker_it= self->marker_list->first; marker_it; marker_it= marker_it->next) {
|
||||
if ((pyo= PyDict_GetItem ((PyObject *)marker_dict, PyInt_FromLong ((long int)marker_it->frame))) )
|
||||
PyList_Append (pyo, PyString_FromString (marker_it->name));
|
||||
else {
|
||||
pyo= PyList_New (0);
|
||||
PyList_Append (pyo, PyString_FromString (marker_it->name));
|
||||
}
|
||||
PyDict_SetItem (marker_dict, PyInt_FromLong ((long int)marker_it->frame), pyo);
|
||||
}
|
||||
|
||||
if (pyo) { /** because warnings messages **/
|
||||
Py_DECREF (pyo);
|
||||
}
|
||||
|
||||
return marker_dict;
|
||||
}
|
||||
|
||||
|
||||
static PyObject *TimeLine_addMarker (BPy_TimeLine *self, PyObject *args) {
|
||||
int frame= 0;
|
||||
TimeMarker *marker= NULL, *marker_it= NULL;
|
||||
|
||||
Reference in New Issue
Block a user