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
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/api2_2x/Main.c12
-rw-r--r--source/blender/python/api2_2x/Material.c97
-rw-r--r--source/blender/python/api2_2x/NMesh.c72
-rw-r--r--source/blender/python/api2_2x/Object.c95
-rw-r--r--source/blender/python/api2_2x/Scene.c2
-rw-r--r--source/blender/python/api2_2x/Sys.c10
6 files changed, 15 insertions, 273 deletions
diff --git a/source/blender/python/api2_2x/Main.c b/source/blender/python/api2_2x/Main.c
index ec3f0afc503..8680dcbebba 100644
--- a/source/blender/python/api2_2x/Main.c
+++ b/source/blender/python/api2_2x/Main.c
@@ -451,7 +451,7 @@ PyObject *MainSeq_new(BPy_MainSeq *self, PyObject * args)
ID *id = NULL;
char *name, *ipo_type;
int img_width=256, img_height=256;
- short ipo_code=NULL;
+ short ipo_code = 0;
if (self->type == ID_IM) {
/* Image, accepts width and height*/
@@ -522,15 +522,11 @@ PyObject *MainSeq_new(BPy_MainSeq *self, PyObject * args)
break;
case ID_IM:
{
- Image *image = BKE_add_image_size(img_width, img_height, name, 0);
- if( !image )
+ id = (ID *)BKE_add_image_size(img_width, img_height, name, 0);
+ if( !id )
return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
"couldn't create PyObject Image_Type" ) );
-
- /* reset usage count, since BKE_add_image_size() incremented it */
- /* image->id.us--; */
- /* Strange, new images have a user count of one???, otherwise it messes up */
- id = (ID *)image;
+ /* new images have zero user count */
break;
}
case ID_LT:
diff --git a/source/blender/python/api2_2x/Material.c b/source/blender/python/api2_2x/Material.c
index 4ff4e23d9e9..25eebaa860e 100644
--- a/source/blender/python/api2_2x/Material.c
+++ b/source/blender/python/api2_2x/Material.c
@@ -33,7 +33,6 @@
#include "Material.h" /*This must come first*/
-#include "DNA_oops_types.h"
#include "DNA_space_types.h"
#include "DNA_material_types.h"
#include "BKE_main.h"
@@ -502,8 +501,6 @@ static int Material_setFresnelTransFac( BPy_Material * self, PyObject * value );
static int Material_setRigidBodyFriction( BPy_Material * self, PyObject * value );
static int Material_setRigidBodyRestitution( BPy_Material * self, PyObject * value );
-static int Material_setOopsLoc ( BPy_Material * self, PyObject * value );
-static int Material_setOopsSel ( BPy_Material * self, PyObject * value );
static int Material_setSpecShader( BPy_Material * self, PyObject * value );
static int Material_setDiffuseShader( BPy_Material * self, PyObject * value );
static int Material_setRoughness( BPy_Material * self, PyObject * value );
@@ -519,8 +516,6 @@ static int Material_setTranslucency( BPy_Material * self, PyObject * value );
static PyObject *Material_getColorComponent( BPy_Material * self,
void * closure );
-static PyObject *Material_getOopsLoc( BPy_Material * self );
-static PyObject *Material_getOopsSel( BPy_Material * self );
/*static int Material_setSeptex( BPy_Material * self, PyObject * value );
static PyObject *Material_getSeptex( BPy_Material * self );*/
@@ -962,14 +957,6 @@ static PyGetSetDef BPy_Material_getseters[] = {
(getter)Material_getNStars, (setter)Material_setNStars,
"Number of star points with halo",
NULL},
- {"oopsLoc",
- (getter)Material_getOopsLoc, (setter)Material_setOopsLoc,
- "Material OOPs location",
- NULL},
- {"oopsSel",
- (getter)Material_getOopsSel, (setter)Material_setOopsSel,
- "Material OOPs selection flag",
- NULL},
{"rayMirr",
(getter)Material_getRayMirr, (setter)Material_setRayMirr,
"Mirror reflection amount for raytrace",
@@ -2747,19 +2734,6 @@ static PyObject *Material_getColorComponent( BPy_Material * self,
return attr;
}
-static PyObject *Material_getOopsLoc ( BPy_Material * self )
-{
- if( G.soops ) {
- Oops *oops = G.soops->oops.first;
- while( oops ) {
- if( oops->type == ID_MA && (Material *)oops->id == self->material )
- return Py_BuildValue( "ff", oops->x, oops->y );
- oops = oops->next;
- }
- }
- Py_RETURN_NONE;
-}
-
static PyObject *Material_getColorband( BPy_Material * self, void * type)
{
switch( (long)type ) {
@@ -2782,77 +2756,6 @@ int Material_setColorband( BPy_Material * self, PyObject * value, void * type)
return 0;
}
-static PyObject *Material_getOopsSel ( BPy_Material * self )
-{
- if( G.soops ) {
- Oops *oops= G.soops->oops.first;
- while( oops ) {
- if( oops->type == ID_MA
- && (Material *)oops->id == self->material ) {
- if( oops->flag & SELECT )
- return EXPP_incr_ret_True();
- else
- return EXPP_incr_ret_False();
- }
- oops = oops->next;
- }
- }
- Py_RETURN_NONE;
-}
-
-static int Material_setOopsLoc ( BPy_Material * self, PyObject * value )
-{
- if( G.soops ) {
- Oops *oops= G.soops->oops.first;
- while( oops ) {
- if( oops->type == ID_MA ) {
- if ( (Material *)oops->id == self->material ) {
- if ( PyArg_ParseTuple( value, "ff", &(oops->x),&(oops->y)))
- return 0;
- else
- return EXPP_ReturnIntError( PyExc_AttributeError,
- "expected two floats as arguments" );
- }
- }
- oops = oops->next;
- }
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "couldn't find oopsLoc data for material" );
- }
- return 0;
-}
-
-static int Material_setOopsSel ( BPy_Material * self, PyObject * value )
-{
- int param;
-
- if( !PyInt_CheckExact ( value ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected an integer, 0 or 1" );
-
- param = PyInt_AS_LONG ( value );
- if( param < 0 || param > 1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected an integer, 0 or 1" );
-
- if( G.soops ) {
- Oops *oops = G.soops->oops.first;
- while( oops ) {
- if( oops->type==ID_MA ) {
- if( (Material *)oops->id == self->material ) {
- if( !param )
- oops->flag &= ~SELECT;
- else
- oops->flag |= SELECT;
- return 0;
- }
- }
- oops= oops->next;
- }
- }
- return 0;
-}
-
/* #####DEPRECATED###### */
static PyObject *Matr_oldsetAdd( BPy_Material * self, PyObject * args )
diff --git a/source/blender/python/api2_2x/NMesh.c b/source/blender/python/api2_2x/NMesh.c
index 5aa0eec5379..adb5163c187 100644
--- a/source/blender/python/api2_2x/NMesh.c
+++ b/source/blender/python/api2_2x/NMesh.c
@@ -39,7 +39,6 @@
#include "DNA_key_types.h"
#include "DNA_armature_types.h"
#include "DNA_scene_types.h"
-#include "DNA_oops_types.h"
#include "DNA_space_types.h"
#include "DNA_curve_types.h"
@@ -1762,45 +1761,11 @@ static PyObject *NMesh_getattr( PyObject * self, char *name )
{
return EXPP_incr_ret( me->edges );
}
- else if (strcmp(name, "oopsLoc") == 0) {
- if (G.soops) {
- Oops *oops = G.soops->oops.first;
- while(oops) {
- if(oops->type==ID_ME) {
- if ((Mesh *)oops->id == me->mesh) {
- return (Py_BuildValue ("ff", oops->x, oops->y));
- }
- }
- oops = oops->next;
- }
- }
- Py_INCREF (Py_None);
- return (Py_None);
- }
- /* Select in the oops view only since it's a mesh */
- else if (strcmp(name, "oopsSel") == 0) {
- if (G.soops) {
- Oops *oops = G.soops->oops.first;
- while(oops) {
- if(oops->type==ID_ME) {
- if ((Mesh *)oops->id == me->mesh) {
- if (oops->flag & SELECT) {
- return EXPP_incr_ret_True();
- } else {
- return EXPP_incr_ret_False();
- }
- }
- }
- oops = oops->next;
- }
- }
- return EXPP_incr_ret(Py_None);
- }
else if( strcmp( name, "__members__" ) == 0 )
return Py_BuildValue( "[s,s,s,s,s,s,s,s,s,s,s]",
"name", "materials", "verts", "users",
"faces", "maxSmoothAngle",
- "subdivLevels", "edges", "oopsLoc", "oopsSel", "key" );
+ "subdivLevels", "edges", "key" );
return Py_FindMethod( NMesh_methods, ( PyObject * ) self, name );
}
@@ -1908,41 +1873,6 @@ static int NMesh_setattr( PyObject * self, char *name, PyObject * v )
me->edges = EXPP_incr_ret( v );
}
}
- else if (!strcmp(name, "oopsLoc")) {
- if (G.soops) {
- Oops *oops = G.soops->oops.first;
- while(oops) {
- if(oops->type==ID_ME) {
- if ((Mesh *)oops->id == me->mesh) {
- return (!PyArg_ParseTuple (v, "ff", &(oops->x),&(oops->y)));
- }
- }
- oops = oops->next;
- }
- }
- return 0;
- }
- /* Select in the oops view only since its a mesh */
- else if (!strcmp(name, "oopsSel")) {
- int sel;
- if (!PyArg_Parse (v, "i", &sel))
- return EXPP_ReturnIntError
- (PyExc_TypeError, "expected an integer, 0 or 1");
- if (G.soops) {
- Oops *oops = G.soops->oops.first;
- while(oops) {
- if(oops->type==ID_ME) {
- if ((Mesh *)oops->id == me->mesh) {
- if(sel == 0) oops->flag &= ~SELECT;
- else oops->flag |= SELECT;
- return 0;
- }
- }
- oops = oops->next;
- }
- }
- return 0;
- }
else
return EXPP_ReturnIntError( PyExc_AttributeError, name );
diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c
index cfdcd67f932..9014a923cce 100644
--- a/source/blender/python/api2_2x/Object.c
+++ b/source/blender/python/api2_2x/Object.c
@@ -44,7 +44,6 @@ struct rctf;
#include "DNA_view3d_types.h"
#include "DNA_object_force.h"
#include "DNA_userdef_types.h"
-#include "DNA_oops_types.h"
#include "BKE_action.h"
#include "BKE_anim.h" /* used for dupli-objects */
@@ -4293,92 +4292,6 @@ static int Object_setIpo( BPy_Object * self, PyObject * value )
return GenericLib_assignData(value, (void **) &self->object->ipo, 0, 1, ID_IP, ID_OB);
}
-static PyObject *Object_getOopsLoc( BPy_Object * self )
-{
- if( G.soops ) {
- Oops *oops = G.soops->oops.first;
- while( oops ) {
- if( oops->type == ID_OB && (Object *)oops->id == self->object )
- return Py_BuildValue( "ff", oops->x, oops->y );
- oops = oops->next;
- }
- }
- Py_RETURN_NONE;
-}
-
-static PyObject *Object_getOopsSel ( BPy_Object * self )
-{
- if( G.soops ) {
- Oops *oops= G.soops->oops.first;
- while( oops ) {
- if( oops->type == ID_OB
- && (Object *)oops->id == self->object ) {
- if( oops->flag & SELECT )
- Py_RETURN_TRUE;
- else
- Py_RETURN_FALSE;
- }
- oops = oops->next;
- }
- }
- Py_RETURN_NONE;
-}
-
-static int Object_setOopsLoc( BPy_Object * self, PyObject * value )
-{
- if( G.soops ) {
- Oops *oops= G.soops->oops.first;
- while( oops ) {
- if( oops->type == ID_OB && (Object *)oops->id == self->object ) {
- if( !PyArg_ParseTuple( value, "ff", &oops->x, &oops->y ) )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected two floats as arguments" );
- return 0;
- }
- oops = oops->next;
- }
- return EXPP_ReturnIntError( PyExc_RuntimeError,
- "couldn't find oopsLoc data for object" );
- }
- return 0;
-}
-
-static int Object_setOopsSel( BPy_Object * self, PyObject * value )
-{
- int setting = PyObject_IsTrue( value );
-
- if( setting == -1 )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected true/false argument" );
-
- if( G.soops ) {
- Oops *oops = G.soops->oops.first;
- while( oops ) {
- if( oops->type==ID_OB ) {
- if( (Object *)oops->id == self->object ) {
-#if 0
- /* this code is what other modules do; it doesn't seem to work */
- if( !setting )
- oops->flag &= ~SELECT;
- else
- oops->flag |= SELECT;
-#else
- printf ("warning: Object.oopsSel setter may not be coded correctly\n");
- /* this code seems to work, but may not be the correct thing to do */
- if( !setting )
- self->object->flag &= ~SELECT;
- else
- self->object->flag |= SELECT;
-#endif
- return 0;
- }
- }
- oops= oops->next;
- }
- }
- return 0;
-}
-
static int Object_setTracked( BPy_Object * self, PyObject * value )
{
int ret;
@@ -4793,14 +4706,6 @@ static PyGetSetDef BPy_Object_getseters[] = {
(getter)Object_getMatrixOldWorld, (setter)NULL,
"old-type worldspace matrix (prior to Blender 2.34)",
NULL},
- {"oopsLoc",
- (getter)Object_getOopsLoc, (setter)Object_setOopsLoc,
- "Object OOPs location",
- NULL},
- {"oopsSel",
- (getter)Object_getOopsSel, (setter)Object_setOopsSel,
- "Object OOPs selection flag",
- NULL},
{"data",
(getter)get_obj_data, (setter)NULL,
"The Datablock object linked to this object",
diff --git a/source/blender/python/api2_2x/Scene.c b/source/blender/python/api2_2x/Scene.c
index 1518e953eba..c8a1e7d3102 100644
--- a/source/blender/python/api2_2x/Scene.c
+++ b/source/blender/python/api2_2x/Scene.c
@@ -1456,7 +1456,7 @@ static PyObject *SceneObSeq_new( BPy_SceneObSeq * self, PyObject *args )
if( !PyArg_ParseTuple( args, "O|s", &py_data, &name ) )
return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected an object and optionally a string as arguments" );
+ "scene.objects.new(obdata) - expected obdata to be\n\ta python obdata type or the string 'Empty'" );
if( Armature_CheckPyObject( py_data ) ) {
data = ( void * ) Armature_FromPyObject( py_data );
diff --git a/source/blender/python/api2_2x/Sys.c b/source/blender/python/api2_2x/Sys.c
index 1f8c9fa732a..db74ce40b4a 100644
--- a/source/blender/python/api2_2x/Sys.c
+++ b/source/blender/python/api2_2x/Sys.c
@@ -175,8 +175,12 @@ static PyObject *M_sys_basename( PyObject * self, PyObject * args )
"expected string argument" );
len = strlen( name );
-
+
+#ifdef WIN32
+ p = MAX2(strrchr( name, '/' ), strrchr( name, '\\' ));
+#else
p = strrchr( name, DIRSEP );
+#endif
if( p ) {
n = name + len - p - 1; /* - 1 because we don't want the sep */
@@ -201,7 +205,11 @@ static PyObject *M_sys_dirname( PyObject * self, PyObject * args )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected string argument" );
+#ifdef WIN32
+ p = MAX2(strrchr( name, '/' ), strrchr( name, '\\' ));
+#else
p = strrchr( name, DIRSEP );
+#endif
if( p ) {
n = p - name;