ok, apparently didn't commit this either. apparently includes a merge with trunk/2.5 at r24811 I thought I'd committed but did not, yeek.
This commit is contained in:
@@ -45,7 +45,7 @@
|
||||
#include "BLI_math.h"
|
||||
|
||||
#define SWAP_FLOAT(a,b,tmp) tmp=a; a=b; b=tmp
|
||||
#define eul 0.000001
|
||||
#define eps 0.000001
|
||||
|
||||
/*-- forward declarations -- */
|
||||
static PyObject *M_Geometry_PolyFill( PyObject * self, PyObject * polyLineSeq );
|
||||
@@ -252,18 +252,18 @@ static PyObject *M_Geometry_LineIntersect2D( PyObject * self, PyObject * args )
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
/* Make sure the hoz/vert line comes first. */
|
||||
if (fabs(b1x - b2x) < eul || fabs(b1y - b2y) < eul) {
|
||||
if (fabs(b1x - b2x) < eps || fabs(b1y - b2y) < eps) {
|
||||
SWAP_FLOAT(a1x, b1x, xi); /*abuse xi*/
|
||||
SWAP_FLOAT(a1y, b1y, xi);
|
||||
SWAP_FLOAT(a2x, b2x, xi);
|
||||
SWAP_FLOAT(a2y, b2y, xi);
|
||||
}
|
||||
|
||||
if (fabs(a1x-a2x) < eul) { /* verticle line */
|
||||
if (fabs(b1x-b2x) < eul){ /*verticle second line */
|
||||
if (fabs(a1x-a2x) < eps) { /* verticle line */
|
||||
if (fabs(b1x-b2x) < eps){ /*verticle second line */
|
||||
Py_RETURN_NONE; /* 2 verticle lines dont intersect. */
|
||||
}
|
||||
else if (fabs(b1y-b2y) < eul) {
|
||||
else if (fabs(b1y-b2y) < eps) {
|
||||
/*X of vert, Y of hoz. no calculation needed */
|
||||
newvec[0]= a1x;
|
||||
newvec[1]= b1y;
|
||||
@@ -280,8 +280,8 @@ static PyObject *M_Geometry_LineIntersect2D( PyObject * self, PyObject * args )
|
||||
newvec[0]= a1x;
|
||||
newvec[1]= yi;
|
||||
return newVectorObject(newvec, 2, Py_NEW, NULL);
|
||||
} else if (fabs(a2y-a1y) < eul) { /* hoz line1 */
|
||||
if (fabs(b2y-b1y) < eul) { /*hoz line2*/
|
||||
} else if (fabs(a2y-a1y) < eps) { /* hoz line1 */
|
||||
if (fabs(b2y-b1y) < eps) { /*hoz line2*/
|
||||
Py_RETURN_NONE; /*2 hoz lines dont intersect*/
|
||||
}
|
||||
|
||||
|
||||
1026
source/blender/python/generic/IDProp.c
Normal file
1026
source/blender/python/generic/IDProp.c
Normal file
File diff suppressed because it is too large
Load Diff
64
source/blender/python/generic/IDProp.h
Normal file
64
source/blender/python/generic/IDProp.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* $Id: IDProp.h
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Contributor(s): Joseph Eagar, Campbell Barton
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
struct ID;
|
||||
struct IDProperty;
|
||||
struct BPy_IDGroup_Iter;
|
||||
|
||||
typedef struct BPy_IDProperty {
|
||||
PyObject_VAR_HEAD
|
||||
struct ID *id;
|
||||
struct IDProperty *prop, *parent;
|
||||
PyObject *data_wrap;
|
||||
} BPy_IDProperty;
|
||||
|
||||
typedef struct BPy_IDArray {
|
||||
PyObject_VAR_HEAD
|
||||
struct ID *id;
|
||||
struct IDProperty *prop;
|
||||
} BPy_IDArray;
|
||||
|
||||
typedef struct BPy_IDGroup_Iter {
|
||||
PyObject_VAR_HEAD
|
||||
BPy_IDProperty *group;
|
||||
struct IDProperty *cur;
|
||||
int mode;
|
||||
} BPy_IDGroup_Iter;
|
||||
|
||||
PyObject *BPy_Wrap_IDProperty(struct ID *id, struct IDProperty *prop, struct IDProperty *parent);
|
||||
PyObject *BPy_Wrap_GetKeys(IDProperty *prop);
|
||||
PyObject *BPy_Wrap_GetValues(ID *id, IDProperty *prop);
|
||||
PyObject *BPy_Wrap_GetItems(ID *id, IDProperty *prop);
|
||||
int BPy_Wrap_SetMapItem(IDProperty *prop, PyObject *key, PyObject *val);
|
||||
|
||||
|
||||
PyObject *BPy_IDGroup_WrapData( ID *id, IDProperty *prop );
|
||||
char *BPy_IDProperty_Map_ValidateAndCreate(char *name, IDProperty *group, PyObject *ob);
|
||||
|
||||
void IDProp_Init_Types(void);
|
||||
|
||||
#define IDPROP_ITER_KEYS 0
|
||||
#define IDPROP_ITER_ITEMS 1
|
||||
@@ -54,12 +54,35 @@ void bpy_import_main_set(struct Main *maggie)
|
||||
bpy_import_main= maggie;
|
||||
}
|
||||
|
||||
PyObject *bpy_text_import( Text *text )
|
||||
{
|
||||
char *buf = NULL;
|
||||
char modulename[24];
|
||||
int len;
|
||||
|
||||
PyObject *bpy_text_import( char *name, int *found )
|
||||
if( !text->compiled ) {
|
||||
buf = txt_to_buf( text );
|
||||
text->compiled = Py_CompileString( buf, text->id.name+2, Py_file_input );
|
||||
MEM_freeN( buf );
|
||||
|
||||
if( PyErr_Occurred( ) ) {
|
||||
PyErr_Print( );
|
||||
PyErr_Clear( );
|
||||
PySys_SetObject("last_traceback", NULL);
|
||||
free_compiled_text( text );
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
len= strlen(text->id.name+2) - 3;
|
||||
strncpy(modulename, text->id.name+2, len);
|
||||
return PyImport_ExecCodeModule(modulename, text->compiled);
|
||||
}
|
||||
|
||||
PyObject *bpy_text_import_name( char *name, int *found )
|
||||
{
|
||||
Text *text;
|
||||
char txtname[22]; /* 21+NULL */
|
||||
char *buf = NULL;
|
||||
int namelen = strlen( name );
|
||||
//XXX Main *maggie= bpy_import_main ? bpy_import_main:G.main;
|
||||
Main *maggie= bpy_import_main;
|
||||
@@ -86,21 +109,7 @@ PyObject *bpy_text_import( char *name, int *found )
|
||||
else
|
||||
*found = 1;
|
||||
|
||||
if( !text->compiled ) {
|
||||
buf = txt_to_buf( text );
|
||||
text->compiled = Py_CompileString( buf, text->id.name+2, Py_file_input );
|
||||
MEM_freeN( buf );
|
||||
|
||||
if( PyErr_Occurred( ) ) {
|
||||
PyErr_Print( );
|
||||
PyErr_Clear( );
|
||||
PySys_SetObject("last_traceback", NULL);
|
||||
free_compiled_text( text );
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return PyImport_ExecCodeModule( name, text->compiled );
|
||||
return bpy_text_import(text);
|
||||
}
|
||||
|
||||
|
||||
@@ -195,7 +204,7 @@ static PyObject *blender_import( PyObject * self, PyObject * args, PyObject * k
|
||||
PyErr_Fetch( &exception, &err, &tb ); /* get the python error incase we cant import as blender text either */
|
||||
|
||||
/* importing from existing modules failed, see if we have this module as blender text */
|
||||
newmodule = bpy_text_import( name, &found );
|
||||
newmodule = bpy_text_import_name( name, &found );
|
||||
|
||||
if( newmodule ) {/* found module as blender text, ignore above exception */
|
||||
PyErr_Clear( );
|
||||
|
||||
@@ -44,7 +44,10 @@
|
||||
#include "compile.h" /* for the PyCodeObject */
|
||||
#include "eval.h" /* for PyEval_EvalCode */
|
||||
|
||||
PyObject* bpy_text_import( char *name, int *found );
|
||||
struct Text;
|
||||
|
||||
PyObject* bpy_text_import( struct Text *text );
|
||||
PyObject* bpy_text_import_name( char *name, int *found );
|
||||
PyObject* bpy_text_reimport( PyObject *module, int *found );
|
||||
/* void bpy_text_clear_modules( int clear_all );*/ /* Clear user modules */
|
||||
extern PyMethodDef bpy_import_meth[];
|
||||
|
||||
Reference in New Issue
Block a user