Sunday merger of orange branch with bf-blender

This commit is contained in:
Ton Roosendaal
2005-12-11 23:04:27 +00:00
15 changed files with 184 additions and 78 deletions

View File

@@ -1182,8 +1182,11 @@ void makebevelcurve(Object *ob, ListBase *disp)
int nr, a;
cu= ob->data;
disp->first = disp->last = NULL;
/* if a font object is being edited, then do nothing */
if( ob == G.obedit && ob->type == OB_FONT ) return;
if(cu->bevobj && cu->bevobj!=ob) {
if(cu->bevobj->type==OB_CURVE) {
bevcu= cu->bevobj->data;

View File

@@ -437,11 +437,14 @@ void BLI_makestringcode(const char *relfile, char *file)
char * q;
char * lslash;
int len=0;
char temp[FILE_MAXDIR+FILE_MAXFILE];
char res[FILE_MAXDIR+FILE_MAXFILE];
/* if file is already relative, bail out */
if(file[0]=='/' && file[1]=='/') return;
strcpy(temp, relfile);
#ifdef WIN32
if (strlen(file) > 2) {
if ( temp[1] == ':' && file[1] == ':' && temp[0] != file[0] )

View File

@@ -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;
/*

View File

@@ -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; */

View File

@@ -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)

View File

@@ -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;
}

View File

@@ -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
"""

View File

@@ -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;
}
}
}
}

View File

@@ -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;

View File

@@ -2314,18 +2314,27 @@ void *shadepixel(float x, float y, int z, int facenr, int mask, float *col, floa
shi.co[1]= (0.5 + y - 0.5*R.recty)*fy - R.winmat[3][1]/R.winmat[1][1];
/* using a*x + b*y + c*z = d equation, (a b c) is normal */
shi.co[2]= (dface - shi.facenor[0]*shi.co[0] - shi.facenor[1]*shi.co[1])/shi.facenor[2];
if(shi.facenor[2]!=0.0f)
shi.co[2]= (dface - shi.facenor[0]*shi.co[0] - shi.facenor[1]*shi.co[1])/shi.facenor[2];
else
shi.co[2]= 0.0f;
zcor= 1.0; // only to prevent not-initialize
if(shi.osatex || (R.r.mode & R_SHADOW) ) {
shi.dxco[0]= fx;
shi.dxco[1]= 0.0;
shi.dxco[2]= (shi.facenor[0]*fx)/shi.facenor[2];
if(shi.facenor[2]!=0.0f)
shi.dxco[2]= (shi.facenor[0]*fx)/shi.facenor[2];
else
shi.dxco[2]= 0.0f;
shi.dyco[0]= 0.0;
shi.dyco[1]= fy;
shi.dyco[2]= (shi.facenor[1]*fy)/shi.facenor[2];
if(shi.facenor[2]!=0.0f)
shi.dyco[2]= (shi.facenor[1]*fy)/shi.facenor[2];
else
shi.dyco[2]= 0.0f;
}
}
else {

View File

@@ -1027,12 +1027,14 @@ static void modifiers_setOnCage(void *ob_v, void *md_v)
Object *ob = ob_v;
ModifierData *md;
for (md=ob->modifiers.first; md; md=md->next)
if (md!=md_v)
md->mode &= ~eModifierMode_OnCage;
int i, cageIndex = modifiers_getCageIndex(ob, NULL );
md = md_v;
md->mode ^= eModifierMode_OnCage;
for( i = 0, md=ob->modifiers.first; md; ++i, md=md->next )
if( md == md_v ) {
if( i >= cageIndex )
md->mode ^= eModifierMode_OnCage;
break;
}
}
static void modifiers_clearHookOffset(void *ob_v, void *md_v)

View File

@@ -34,10 +34,6 @@
#include <math.h>
#include <string.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifndef WIN32
#include <unistd.h>
#else
@@ -714,7 +710,7 @@ static char *actuator_name(int type)
case ACT_GAME:
return "Game";
case ACT_VISIBILITY:
return "Game";
return "Visibility";
}
return "unknown";
}
@@ -1444,14 +1440,14 @@ static int get_col_actuator(int type)
case ACT_SOUND: return TH_BUT_SETTING2;
case ACT_CD: return TH_BUT_NUM;
case ACT_CAMERA: return TH_BUT_TEXTFIELD;
case ACT_EDIT_OBJECT: return TH_BUT_POPUP;
case ACT_EDIT_OBJECT: return TH_BUT_POPUP;
case ACT_GROUP: return TH_BUT_ACTION;
case ACT_RANDOM: return TH_BUT_NEUTRAL;
case ACT_SCENE: return TH_BUT_SETTING;
case ACT_MESSAGE: return TH_BUT_SETTING1;
case ACT_GAME: return TH_BUT_SETTING2;
case ACT_VISIBILITY: return TH_BUT_NUM;
case ACT_CONSTRAINT: return TH_BUT_ACTION;
case ACT_VISIBILITY: return TH_BUT_NUM;
case ACT_CONSTRAINT: return TH_BUT_ACTION;
default: return TH_BUT_NEUTRAL;
}
}

View File

@@ -1157,6 +1157,7 @@ void free_editText(void)
{
if(oldstr) MEM_freeN(oldstr);
if(oldstrinfo) MEM_freeN(oldstrinfo);
if(textbuf) MEM_freeN(textbuf);
textbuf = oldstr = NULL;
textbufinfo = oldstrinfo = NULL;
textediting= 0;

View File

@@ -384,9 +384,9 @@ void CutEdgeloop(int numcuts)
/* now cut the loops */
if(smooth){
fac= 1.0f;
if(fbutton(&fac, 0.0f, 5.0f, 10, 10, "Smooth:")==0) return;
fac= 0.292f*fac;
fac= 1.0f;
if(fbutton(&fac, 0.0f, 5.0f, 10, 10, "Smooth:")==0) return;
fac= 0.292f*fac;
esubdivideflag(SELECT,fac,B_SMOOTH,numcuts,SUBDIV_SELECT_INNER_SEL);
} else {
esubdivideflag(SELECT,0,0,numcuts,SUBDIV_SELECT_INNER_SEL);

View File

@@ -2584,8 +2584,12 @@ static void outliner_buttons(uiBlock *block, SpaceOops *soops, ListBase *lb)
// signal for button to open
addqueue(curarea->win, BUT_ACTIVATE, OL_NAMEBUTTON);
/* otherwise keeps open on ESC */
tselem->flag &= ~TSE_TEXTBUT;
}
if((tselem->flag & TSE_CLOSED)==0) outliner_buttons(block, soops, &te->subtree);
else
if((tselem->flag & TSE_CLOSED)==0) outliner_buttons(block, soops, &te->subtree);
}
}