From 39ca3e3fa411e2a14bdfb71fe20823c8b85b775b Mon Sep 17 00:00:00 2001 From: Ken Hughes Date: Tue, 6 Dec 2005 17:08:09 +0000 Subject: [PATCH 01/15] -- Bugfix #3548: material.setMode() was doing incorrect range check on inputs, returned error setting RAYMIRROR or RAYTRANSP modes. --- source/blender/python/api2_2x/Material.c | 30 +++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/source/blender/python/api2_2x/Material.c b/source/blender/python/api2_2x/Material.c index 50390025ee2..e0fe70b54f8 100644 --- a/source/blender/python/api2_2x/Material.c +++ b/source/blender/python/api2_2x/Material.c @@ -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; /* From 4cf83c2c14e5c15c3fc6522bd14081b45699e962 Mon Sep 17 00:00:00 2001 From: Kent Mein Date: Tue, 6 Dec 2005 18:52:55 +0000 Subject: [PATCH 02/15] Fix for bug #3529 Provided by Jorge Bernal (lordloki) Function was returning a wrong value in a switch statement. Kent --- source/blender/src/buttons_logic.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/source/blender/src/buttons_logic.c b/source/blender/src/buttons_logic.c index f56aefbeedd..9933a907897 100644 --- a/source/blender/src/buttons_logic.c +++ b/source/blender/src/buttons_logic.c @@ -34,10 +34,6 @@ #include #include -#ifdef HAVE_CONFIG_H -#include -#endif - #ifndef WIN32 #include #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; } } From b558edd62984dbf29bcedfbddaf1acf6011c98cd Mon Sep 17 00:00:00 2001 From: Ken Hughes Date: Wed, 7 Dec 2005 05:41:58 +0000 Subject: [PATCH 03/15] Fix memory leak; if Blender quits while in text edit mode, free textbuf inside of free_editText(). --- source/blender/src/editfont.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/blender/src/editfont.c b/source/blender/src/editfont.c index b161538423c..e7b65f15f16 100644 --- a/source/blender/src/editfont.c +++ b/source/blender/src/editfont.c @@ -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; From b02ff5f2a2e142a2b422fa7f8f4bb8c017e2e6ea Mon Sep 17 00:00:00 2001 From: Ken Hughes Date: Wed, 7 Dec 2005 05:44:29 +0000 Subject: [PATCH 04/15] -- Bugfix #3551: fix memory corruption problem if Text3d.setText() called while selected text is in edit mode. (Future note: now that there is Unicode support in Blender, we need to add support for it in the BPy Text3d API.) --- source/blender/python/api2_2x/Text3d.c | 51 +++++++++++++++++--------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/source/blender/python/api2_2x/Text3d.c b/source/blender/python/api2_2x/Text3d.c index 504ca9252c3..0561245b7c4 100644 --- a/source/blender/python/api2_2x/Text3d.c +++ b/source/blender/python/api2_2x/Text3d.c @@ -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) From 2f0ae40979926c2b298dbed81f18890e020ea1b4 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Wed, 7 Dec 2005 19:59:26 +0000 Subject: [PATCH 05/15] Bugfix from own collection: Rename option in Outliner didn't handle an ESC correctly. Button wasn't closed then. --- source/blender/src/outliner.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/blender/src/outliner.c b/source/blender/src/outliner.c index 76ab56fb574..b565fb2f340 100644 --- a/source/blender/src/outliner.c +++ b/source/blender/src/outliner.c @@ -2505,8 +2505,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); } } From e67360cb979142a510538d7625b4427e3d7df7fa Mon Sep 17 00:00:00 2001 From: Ken Hughes Date: Wed, 7 Dec 2005 21:12:33 +0000 Subject: [PATCH 06/15] Made Mesh verts/edges/faces hashable (as they were in NMesh); this will make it easier for some scripts to be converted. --- source/blender/python/api2_2x/Mesh.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/source/blender/python/api2_2x/Mesh.c b/source/blender/python/api2_2x/Mesh.c index ab286b20761..d4ef5b79c0e 100644 --- a/source/blender/python/api2_2x/Mesh.c +++ b/source/blender/python/api2_2x/Mesh.c @@ -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; */ From cf42e62ebba9295e16496ebe1e6d2d31feac8a0a Mon Sep 17 00:00:00 2001 From: Ken Hughes Date: Fri, 9 Dec 2005 13:57:27 +0000 Subject: [PATCH 07/15] -- Bugfix #3545: Toggling the "apply modifier to editing cage during Editmode" flag in one modifier cleared the flag for all other modifiers. It now only allows toggling of the last modifier in the stack. --- source/blender/src/buttons_editing.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index 815282720ea..bf53f60fec6 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -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) From 1e589f59d01699bfa0c94bcf83bab5eca9a9a2ad Mon Sep 17 00:00:00 2001 From: Ken Hughes Date: Fri, 9 Dec 2005 14:30:51 +0000 Subject: [PATCH 08/15] -- Bugfix #3520: Text with extrusion and/or bevelling would would disappear when edit mode was entered. --- source/blender/blenkernel/intern/curve.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index d0f46bfbaa8..f0bf3672a35 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -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; From e4c375ef0b0cfd8104b6654fb759b2b88f241252 Mon Sep 17 00:00:00 2001 From: Johnny Matthews Date: Fri, 9 Dec 2005 14:49:41 +0000 Subject: [PATCH 09/15] bugfix #3550 Fixing Loopcut smooth to actually cut smooth I think this will go to HEAD now... --- source/blender/src/editmesh_loop.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/blender/src/editmesh_loop.c b/source/blender/src/editmesh_loop.c index 0c6b6e10928..e3d910fef10 100644 --- a/source/blender/src/editmesh_loop.c +++ b/source/blender/src/editmesh_loop.c @@ -216,6 +216,7 @@ void CutEdgeloop(int numcuts) short event,val,choosing=1,cancel=0,dist,cuthalf = 0,smooth=0; char msg[128]; short hasHidden = 0; + float fac; selectmode = G.scene->selectmode; @@ -383,7 +384,10 @@ void CutEdgeloop(int numcuts) /* now cut the loops */ if(smooth){ - esubdivideflag(SELECT,0,B_SMOOTH,numcuts,SUBDIV_SELECT_INNER_SEL); + 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); } From 7b2f1d47761dc184e1ba686beb522ad3ccf25092 Mon Sep 17 00:00:00 2001 From: Joilnen Leite Date: Fri, 9 Dec 2005 15:00:54 +0000 Subject: [PATCH 10/15] change return of getMarked method for dict {framnum:['nameframe']} . --- source/blender/python/api2_2x/sceneTimeLine.c | 58 +++++++++++++------ 1 file changed, 40 insertions(+), 18 deletions(-) diff --git a/source/blender/python/api2_2x/sceneTimeLine.c b/source/blender/python/api2_2x/sceneTimeLine.c index f1480347e73..58830d28ab4 100644 --- a/source/blender/python/api2_2x/sceneTimeLine.c +++ b/source/blender/python/api2_2x/sceneTimeLine.c @@ -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; From ccb285006c5924bc17781d93cc15c792aef4c3ce Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Fri, 9 Dec 2005 17:22:50 +0000 Subject: [PATCH 11/15] Bugfix #3526 Division with zero caused wrong pixels to be rendered with Ortho camera. --- source/blender/render/intern/source/rendercore.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index 73d57e453b8..5cf63d5cb51 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -2156,18 +2156,27 @@ void *shadepixel(float x, float y, int z, int facenr, int mask, float *col) 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 { From 080eb9b3fa2507db4bf0e849eead1b978b94307b Mon Sep 17 00:00:00 2001 From: Ken Hughes Date: Fri, 9 Dec 2005 23:19:00 +0000 Subject: [PATCH 12/15] -- Bugfix #3564: Texture.getImage() always returned None for Env maps, even if an image was assigned. --- source/blender/python/api2_2x/Texture.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/blender/python/api2_2x/Texture.c b/source/blender/python/api2_2x/Texture.c index 7f576069795..157f2e19cb7 100644 --- a/source/blender/python/api2_2x/Texture.c +++ b/source/blender/python/api2_2x/Texture.c @@ -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; } From 76e79057363c824d2757221db092d62de0cce6f2 Mon Sep 17 00:00:00 2001 From: Ken Hughes Date: Sat, 10 Dec 2005 19:36:05 +0000 Subject: [PATCH 13/15] -- Bugfix #3573: Deleting a scriptlink when some other scriptlinks were no longer linked to a script would cause a crash. We now delete all scriptlinks which are not linked. --- source/blender/python/api2_2x/gen_utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/python/api2_2x/gen_utils.c b/source/blender/python/api2_2x/gen_utils.c index 25d3a7912b8..4e42c06d2a8 100644 --- a/source/blender/python/api2_2x/gen_utils.c +++ b/source/blender/python/api2_2x/gen_utils.c @@ -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; - } } } } From e0d20e00ce7860a47a5b57b036ceadbe16b79e15 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 11 Dec 2005 04:20:37 +0000 Subject: [PATCH 14/15] Added some details in the Mathutils documentation. --- .../blender/python/api2_2x/doc/Mathutils.py | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/source/blender/python/api2_2x/doc/Mathutils.py b/source/blender/python/api2_2x/doc/Mathutils.py index 5f552a69494..2d4e0a0c092 100644 --- a/source/blender/python/api2_2x/doc/Mathutils.py +++ b/source/blender/python/api2_2x/doc/Mathutils.py @@ -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 """ From e58eecbea567bc21edf36d65edb07fc44c9ee439 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sun, 11 Dec 2005 22:03:04 +0000 Subject: [PATCH 15/15] Fix: reading library files with option "Relative Paths" set, whilst library was read already AND relative, caused the path for libraries to corrupt... Error caused big headaches in studio Orange... :) --- source/blender/blenlib/intern/util.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/blender/blenlib/intern/util.c b/source/blender/blenlib/intern/util.c index 62aa663409e..74e8e575fda 100644 --- a/source/blender/blenlib/intern/util.c +++ b/source/blender/blenlib/intern/util.c @@ -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] )