- for some reason mesh_create_derived_no_deform took the raw data (not
an object) but this is not going to work... I can't remember the reason I did it this way in the first place either! oops! regardless, switch to all mesh_ derived accessors taking object argument. there is still a bug in render orco calculation though. (hunt hunt) - removed python files that should have been ditched in previous commit
This commit is contained in:
@@ -153,8 +153,8 @@ DerivedMesh *mesh_get_derived_final(struct Object *ob, int *needsFree_r);
|
||||
DerivedMesh *mesh_get_derived_deform(struct Object *ob, int *needsFree_r);
|
||||
|
||||
DerivedMesh *mesh_create_derived_render(struct Object *ob);
|
||||
DerivedMesh *mesh_create_derived_no_deform(struct Mesh *me, float (*vertCos)[3]);
|
||||
DerivedMesh *mesh_create_derived_no_deform_render(struct Mesh *me, float (*vertCos)[3]);
|
||||
DerivedMesh *mesh_create_derived_no_deform(struct Object *ob, float (*vertCos)[3]);
|
||||
DerivedMesh *mesh_create_derived_no_deform_render(struct Object *ob, float (*vertCos)[3]);
|
||||
|
||||
DerivedMesh *editmesh_get_derived(void);
|
||||
DerivedMesh *editmesh_get_derived_proxy(void);
|
||||
|
@@ -58,7 +58,6 @@ typedef enum {
|
||||
eModifierTypeFlag_AcceptsMesh = (1<<0),
|
||||
eModifierTypeFlag_AcceptsCVs = (1<<1),
|
||||
eModifierTypeFlag_SupportsMapping = (1<<2),
|
||||
eModifierTypeFlag_RequiresObject = (1<<3),
|
||||
} ModifierTypeFlag;
|
||||
|
||||
typedef struct ModifierTypeInfo {
|
||||
@@ -95,15 +94,14 @@ typedef struct ModifierTypeInfo {
|
||||
int (*dependsOnTime)(struct ModifierData *md);
|
||||
|
||||
/* Only for deform types, should apply the deformation
|
||||
* to the given vertex array. Object is guaranteed to be
|
||||
* non-NULL.
|
||||
* to the given vertex array.
|
||||
*/
|
||||
void (*deformVerts)(struct ModifierData *md, struct Object *ob, float (*vertexCos)[3], int numVerts);
|
||||
|
||||
/* For non-deform types: apply the modifier and return a new derived
|
||||
* data object (type is dependent on object type). If the _derivedData_
|
||||
* argument is non-NULL then the modifier should read the object data
|
||||
* from the derived object instead of the _data_ object.
|
||||
* from the derived object instead of the actual object data.
|
||||
*
|
||||
* If the _vertexCos_ argument is non-NULL then the modifier should read
|
||||
* the vertex coordinates from that (even if _derivedData_ is non-NULL).
|
||||
@@ -116,13 +114,8 @@ typedef struct ModifierTypeInfo {
|
||||
*
|
||||
* The modifier is expected to release (or reuse) the _derivedData_ argument
|
||||
* if non-NULL. The modifier *MAY NOT* share the _vertexCos_ argument.
|
||||
*
|
||||
* It is possible for _ob_ to be NULL if the modifier type is not flagged
|
||||
* to require an object. A NULL _ob_ occurs when original coordinate data
|
||||
* is requested for an object.
|
||||
*/
|
||||
void *(*applyModifier)(struct ModifierData *md, void *data, struct Object *ob,
|
||||
void *derivedData, float (*vertexCos)[3], int useRenderParams);
|
||||
void *(*applyModifier)(struct ModifierData *md, struct Object *ob, void *derivedData, float (*vertexCos)[3], int useRenderParams);
|
||||
} ModifierTypeInfo;
|
||||
|
||||
ModifierTypeInfo *modifierType_get_info(ModifierType type);
|
||||
|
@@ -994,9 +994,10 @@ DerivedMesh *derivedmesh_from_displistmesh(DispListMesh *dlm)
|
||||
|
||||
/***/
|
||||
|
||||
static void mesh_calc_modifiers(Mesh *me, Object *ob, float (*inputVertexCos)[3], DerivedMesh **deform_r, DerivedMesh **final_r, int useRenderParams, int useDeform)
|
||||
static void mesh_calc_modifiers(Object *ob, float (*inputVertexCos)[3], DerivedMesh **deform_r, DerivedMesh **final_r, int useRenderParams, int useDeform)
|
||||
{
|
||||
ModifierData *md= ob?ob->modifiers.first:NULL;
|
||||
Mesh *me = ob->data;
|
||||
ModifierData *md= ob->modifiers.first;
|
||||
float (*deformedVerts)[3];
|
||||
DerivedMesh *dm;
|
||||
int a, numVerts = me->totvert;
|
||||
@@ -1040,8 +1041,7 @@ static void mesh_calc_modifiers(Mesh *me, Object *ob, float (*inputVertexCos)[3]
|
||||
}
|
||||
|
||||
/* Now apply all remaining modifiers. If useDeform is off then skip
|
||||
* OnlyDeform ones. If we have no _ob_ and the modifier requires one
|
||||
* also skip.
|
||||
* OnlyDeform ones.
|
||||
*/
|
||||
dm = NULL;
|
||||
for (; md; md=md->next) {
|
||||
@@ -1049,7 +1049,6 @@ static void mesh_calc_modifiers(Mesh *me, Object *ob, float (*inputVertexCos)[3]
|
||||
|
||||
if (!(md->mode&(1<<useRenderParams))) continue;
|
||||
if (mti->type==eModifierTypeType_OnlyDeform && !useDeform) continue;
|
||||
if (!ob && (mti->flags&eModifierTypeFlag_RequiresObject)) continue;
|
||||
if (mti->isDisabled(md)) continue;
|
||||
|
||||
/* How to apply modifier depends on (a) what we already have as
|
||||
@@ -1082,7 +1081,7 @@ static void mesh_calc_modifiers(Mesh *me, Object *ob, float (*inputVertexCos)[3]
|
||||
* by the modifier apply function, which will also free the DerivedMesh if
|
||||
* it exists.
|
||||
*/
|
||||
dm = mti->applyModifier(md, me, ob, dm, deformedVerts, useRenderParams);
|
||||
dm = mti->applyModifier(md, ob, dm, deformedVerts, useRenderParams);
|
||||
|
||||
if (deformedVerts) {
|
||||
if (deformedVerts!=inputVertexCos) {
|
||||
@@ -1105,7 +1104,7 @@ static void mesh_calc_modifiers(Mesh *me, Object *ob, float (*inputVertexCos)[3]
|
||||
smd.renderLevels = me->subdivr;
|
||||
smd.subdivType = me->subsurftype;
|
||||
|
||||
dm = mti->applyModifier(&smd.modifier, me, ob, dm, deformedVerts, useRenderParams);
|
||||
dm = mti->applyModifier(&smd.modifier, ob, dm, deformedVerts, useRenderParams);
|
||||
|
||||
if (deformedVerts) {
|
||||
if (deformedVerts!=inputVertexCos) {
|
||||
@@ -1182,7 +1181,7 @@ static void clear_and_build_mesh_data(Object *ob, int mustBuildForMesh)
|
||||
}
|
||||
|
||||
if (ob!=G.obedit || mustBuildForMesh) {
|
||||
mesh_calc_modifiers(ob->data, ob, NULL, &ob->derivedDeform, &ob->derivedFinal, 0, 1);
|
||||
mesh_calc_modifiers(ob, NULL, &ob->derivedDeform, &ob->derivedFinal, 0, 1);
|
||||
|
||||
INIT_MINMAX(min, max);
|
||||
|
||||
@@ -1227,25 +1226,25 @@ DerivedMesh *mesh_create_derived_render(Object *ob)
|
||||
{
|
||||
DerivedMesh *final;
|
||||
|
||||
mesh_calc_modifiers(ob->data, ob, NULL, NULL, &final, 1, 1);
|
||||
mesh_calc_modifiers(ob, NULL, NULL, &final, 1, 1);
|
||||
|
||||
return final;
|
||||
}
|
||||
|
||||
DerivedMesh *mesh_create_derived_no_deform(Mesh *me, float (*vertCos)[3])
|
||||
DerivedMesh *mesh_create_derived_no_deform(Object *ob, float (*vertCos)[3])
|
||||
{
|
||||
DerivedMesh *final;
|
||||
|
||||
mesh_calc_modifiers(me, NULL, vertCos, NULL, &final, 0, 0);
|
||||
mesh_calc_modifiers(ob, vertCos, NULL, &final, 0, 0);
|
||||
|
||||
return final;
|
||||
}
|
||||
|
||||
DerivedMesh *mesh_create_derived_no_deform_render(Mesh *me, float (*vertCos)[3])
|
||||
DerivedMesh *mesh_create_derived_no_deform_render(Object *ob, float (*vertCos)[3])
|
||||
{
|
||||
DerivedMesh *final;
|
||||
|
||||
mesh_calc_modifiers(me, NULL, vertCos, NULL, &final, 1, 0);
|
||||
mesh_calc_modifiers(ob, vertCos, NULL, &final, 1, 0);
|
||||
|
||||
return final;
|
||||
}
|
||||
|
@@ -422,8 +422,9 @@ void mesh_get_texspace(Mesh *me, float *loc_r, float *rot_r, float *size_r)
|
||||
if (size_r) VECCOPY(size_r, me->size);
|
||||
}
|
||||
|
||||
static float *make_orco_mesh_internal(Mesh *me, int render)
|
||||
static float *make_orco_mesh_internal(Object *ob, int render)
|
||||
{
|
||||
Mesh *me = ob->data;
|
||||
float (*orcoData)[3];
|
||||
int a, totvert;
|
||||
float loc[3], size[3];
|
||||
@@ -458,9 +459,9 @@ static float *make_orco_mesh_internal(Mesh *me, int render)
|
||||
/* Apply orco-changing modifiers */
|
||||
|
||||
if (render) {
|
||||
dm = mesh_create_derived_no_deform_render(me, vcos);
|
||||
dm = mesh_create_derived_no_deform_render(ob, vcos);
|
||||
} else {
|
||||
dm = mesh_create_derived_no_deform(me, vcos);
|
||||
dm = mesh_create_derived_no_deform(ob, vcos);
|
||||
}
|
||||
totvert = dm->getNumVerts(dm);
|
||||
|
||||
@@ -483,12 +484,12 @@ static float *make_orco_mesh_internal(Mesh *me, int render)
|
||||
|
||||
float *mesh_create_orco_render(Object *ob)
|
||||
{
|
||||
return make_orco_mesh_internal(ob->data, 1);
|
||||
return make_orco_mesh_internal(ob, 1);
|
||||
}
|
||||
|
||||
float *mesh_create_orco(Object *ob)
|
||||
{
|
||||
return make_orco_mesh_internal(ob->data, 0);
|
||||
return make_orco_mesh_internal(ob, 0);
|
||||
}
|
||||
|
||||
/** rotates the vertices of a face in case v[2] or v[3] (vertex index)
|
||||
|
@@ -123,11 +123,11 @@ static int subsurfModifier_isDisabled(ModifierData *md)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void *subsurfModifier_applyModifier(ModifierData *md, void *data, Object *ob, DerivedMesh *dm, float (*vertexCos)[3], int useRenderParams)
|
||||
static void *subsurfModifier_applyModifier(ModifierData *md, Object *ob, DerivedMesh *dm, float (*vertexCos)[3], int useRenderParams)
|
||||
{
|
||||
SubsurfModifierData *smd = (SubsurfModifierData*) md;
|
||||
int levels = useRenderParams?smd->renderLevels:smd->levels;
|
||||
Mesh *me = data;
|
||||
Mesh *me = ob->data;
|
||||
|
||||
if (dm) {
|
||||
DispListMesh *dlm = dm->convertToDispListMesh(dm); // XXX what if verts were shared
|
||||
@@ -173,7 +173,7 @@ static int buildModifier_dependsOnTime(ModifierData *md)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void *buildModifier_applyModifier(ModifierData *md, void *data, Object *ob, DerivedMesh *dm, float (*vertexCos)[3], int useRenderParams)
|
||||
static void *buildModifier_applyModifier(ModifierData *md, Object *ob, DerivedMesh *dm, float (*vertexCos)[3], int useRenderParams)
|
||||
{
|
||||
BuildModifierData *bmd = (BuildModifierData*) md;
|
||||
DispListMesh *dlm=NULL, *ndlm = MEM_callocN(sizeof(*ndlm), "build_dlm");
|
||||
@@ -197,7 +197,7 @@ static void *buildModifier_applyModifier(ModifierData *md, void *data, Object *o
|
||||
totedge = dlm->totedge;
|
||||
totface = dlm->totface;
|
||||
} else {
|
||||
Mesh *me = data;
|
||||
Mesh *me = ob->data;
|
||||
mvert = me->mvert;
|
||||
medge = me->medge;
|
||||
mface = me->mface;
|
||||
|
@@ -1,364 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL/BL DUAL 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. The Blender
|
||||
* Foundation also sells licenses for use in proprietary software under
|
||||
* the Blender License. See http://www.blender.org/BL/ for information
|
||||
* about this.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This is a new part of Blender.
|
||||
*
|
||||
* Contributor(s): Jacques Guignot
|
||||
*
|
||||
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include "Build.h" /*This must come first */
|
||||
|
||||
#include "DNA_object_types.h"
|
||||
#include "BKE_effect.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_main.h"
|
||||
#include "gen_utils.h"
|
||||
|
||||
/* prototypes */
|
||||
PyObject *Build_Init( void );
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Python BPy_Build methods table: */
|
||||
/*****************************************************************************/
|
||||
static PyMethodDef BPy_Build_methods[] = {
|
||||
{"getLen", ( PyCFunction ) Build_getLen,
|
||||
METH_NOARGS, "()-Return Build len"},
|
||||
{"setLen", ( PyCFunction ) Build_setLen, METH_VARARGS,
|
||||
"()- Sets Build len"},
|
||||
{"getSfra", ( PyCFunction ) Build_getSfra,
|
||||
METH_NOARGS, "()-Return Build sfra"},
|
||||
{"setSfra", ( PyCFunction ) Build_setSfra, METH_VARARGS,
|
||||
"()- Sets Build sfra"},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Python Build_Type structure definition: */
|
||||
/*****************************************************************************/
|
||||
PyTypeObject Build_Type = {
|
||||
PyObject_HEAD_INIT( NULL )
|
||||
0, /* ob_size */
|
||||
"Build", /* tp_name */
|
||||
sizeof( BPy_Build ), /* tp_basicsize */
|
||||
0, /* tp_itemsize */
|
||||
/* methods */
|
||||
( destructor ) BuildDeAlloc, /* tp_dealloc */
|
||||
0, /* tp_print */
|
||||
( getattrfunc ) BuildGetAttr, /* tp_getattr */
|
||||
( setattrfunc ) BuildSetAttr, /* tp_setattr */
|
||||
0, /* tp_compare */
|
||||
( reprfunc ) BuildRepr, /* tp_repr */
|
||||
0, /* tp_as_number */
|
||||
0, /* tp_as_sequence */
|
||||
0, /* tp_as_mapping */
|
||||
0, /* tp_as_hash */
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, /* tp_doc */
|
||||
0, 0, 0, 0, 0, 0,
|
||||
BPy_Build_methods, /* tp_methods */
|
||||
0, /* tp_members */
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* The following string definitions are used for documentation strings. */
|
||||
/* In Python these will be written to the console when doing a */
|
||||
/* Blender.Camera.__doc__ */
|
||||
/*****************************************************************************/
|
||||
|
||||
static char M_Build_doc[] = "The Blender Build module\n\
|
||||
This module provides access to **Build Data** objects in Blender\n";
|
||||
|
||||
static char M_Build_New_doc[] = "Build.New ():\n\
|
||||
Return a new Build Data object with the given type and name.";
|
||||
|
||||
static char M_Build_Get_doc[] = "Build.Get (name = None):\n\
|
||||
Return the build data with the given 'name', None if not found, or\n\
|
||||
Return a list with all Build Data objects in the current scene,\n\
|
||||
if no argument was given.";
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Function: M_Build_New */
|
||||
/* Python equivalent: Blender.Effect.Build.New */
|
||||
/*****************************************************************************/
|
||||
PyObject *M_Build_New( PyObject * self, PyObject * args )
|
||||
{
|
||||
int type = EFF_BUILD;
|
||||
BPy_Effect *pyeffect;
|
||||
Effect *bleffect = 0;
|
||||
|
||||
|
||||
bleffect = add_effect( type );
|
||||
if( bleffect == NULL )
|
||||
return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
|
||||
"couldn't create Effect Data in Blender" ) );
|
||||
|
||||
pyeffect = ( BPy_Effect * ) PyObject_NEW( BPy_Effect, &Effect_Type );
|
||||
|
||||
|
||||
if( pyeffect == NULL )
|
||||
return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
|
||||
"couldn't create Effect Data object" ) );
|
||||
|
||||
pyeffect->effect = bleffect;
|
||||
|
||||
return ( PyObject * ) pyeffect;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Function: M_Build_Get */
|
||||
/* Python equivalent: Blender.Effect.Build.Get */
|
||||
/*****************************************************************************/
|
||||
PyObject *M_Build_Get( PyObject * self, PyObject * args )
|
||||
{
|
||||
/*arguments : string object name
|
||||
int : position of effect in the obj's effect list */
|
||||
char *name = 0;
|
||||
Object *object_iter;
|
||||
Effect *eff;
|
||||
BPy_Build *wanted_eff;
|
||||
int num, i;
|
||||
if( !PyArg_ParseTuple( args, "si", &name, &num ) )
|
||||
return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
|
||||
"expected string int argument" ) );
|
||||
|
||||
object_iter = G.main->object.first;
|
||||
if( !object_iter )
|
||||
return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
|
||||
"Scene contains no object" ) );
|
||||
|
||||
while( object_iter ) {
|
||||
if( strcmp( name, object_iter->id.name + 2 ) ) {
|
||||
object_iter = object_iter->id.next;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if( object_iter->effect.first != NULL ) {
|
||||
eff = object_iter->effect.first;
|
||||
for( i = 0; i < num; i++ ) {
|
||||
if( eff->type != EFF_BUILD )
|
||||
continue;
|
||||
eff = eff->next;
|
||||
if( !eff )
|
||||
return ( EXPP_ReturnPyObjError
|
||||
( PyExc_AttributeError,
|
||||
"object not created" ) );
|
||||
}
|
||||
wanted_eff =
|
||||
( BPy_Build * ) PyObject_NEW( BPy_Build,
|
||||
&Build_Type );
|
||||
wanted_eff->build = eff;
|
||||
return ( PyObject * ) wanted_eff;
|
||||
}
|
||||
object_iter = object_iter->id.next;
|
||||
}
|
||||
Py_INCREF( Py_None );
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
|
||||
|
||||
struct PyMethodDef M_Build_methods[] = {
|
||||
{"New", ( PyCFunction ) M_Build_New, METH_VARARGS, M_Build_New_doc},
|
||||
{"Get", M_Build_Get, METH_VARARGS, M_Build_Get_doc},
|
||||
{"get", M_Build_Get, METH_VARARGS, M_Build_Get_doc},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Function: Build_Init */
|
||||
/*****************************************************************************/
|
||||
|
||||
PyObject *Build_Init( void )
|
||||
{
|
||||
PyObject *submodule;
|
||||
|
||||
Build_Type.ob_type = &PyType_Type;
|
||||
submodule =
|
||||
Py_InitModule3( "Blender.Build", M_Build_methods,
|
||||
M_Build_doc );
|
||||
return ( submodule );
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Python BPy_Build methods: */
|
||||
/*****************************************************************************/
|
||||
|
||||
PyObject *Build_getLen( BPy_Build * self )
|
||||
{
|
||||
BuildEff *ptr = ( BuildEff * ) self->build;
|
||||
return PyFloat_FromDouble( ptr->len );
|
||||
}
|
||||
|
||||
|
||||
PyObject *Build_setLen( BPy_Build * self, PyObject * args )
|
||||
{
|
||||
BuildEff *ptr = ( BuildEff * ) self->build;
|
||||
float val = 0;
|
||||
if( !PyArg_ParseTuple( args, "f", &val ) )
|
||||
return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
|
||||
"expected float argument" ) );
|
||||
ptr->len = val;
|
||||
Py_INCREF( Py_None );
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
|
||||
PyObject *Build_getSfra( BPy_Build * self )
|
||||
{
|
||||
BuildEff *ptr = ( BuildEff * ) self->build;
|
||||
return PyFloat_FromDouble( ptr->sfra );
|
||||
}
|
||||
|
||||
PyObject *Build_setSfra( BPy_Build * self, PyObject * args )
|
||||
{
|
||||
BuildEff *ptr = ( BuildEff * ) self->build;
|
||||
float val = 0;
|
||||
if( !PyArg_ParseTuple( args, "f", &val ) )
|
||||
return ( EXPP_ReturnPyObjError
|
||||
( PyExc_AttributeError, "expected float argument" ) );
|
||||
|
||||
ptr->sfra = val;
|
||||
Py_INCREF( Py_None );
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Function: BuildDeAlloc */
|
||||
/* Description: This is a callback function for the BPy_Build type. It is */
|
||||
/* the destructor function. */
|
||||
/*****************************************************************************/
|
||||
void BuildDeAlloc( BPy_Build * self )
|
||||
{
|
||||
BuildEff *ptr = ( BuildEff * ) self;
|
||||
PyObject_DEL( ptr );
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Function: BuildGetAttr */
|
||||
/* Description: This is a callback function for the BPy_Build type. It is */
|
||||
/* the function that accesses BPy_Build "member variables" and */
|
||||
/* methods. */
|
||||
/*****************************************************************************/
|
||||
|
||||
PyObject *BuildGetAttr( BPy_Build * self, char *name )
|
||||
{
|
||||
if( !strcmp( name, "sfra" ) )
|
||||
return Build_getSfra( self );
|
||||
if( !strcmp( name, "len" ) )
|
||||
return Build_getLen( self );
|
||||
return Py_FindMethod( BPy_Build_methods, ( PyObject * ) self, name );
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Function: BuildSetAttr */
|
||||
/* Description: This is a callback function for the BPy_Build type. It */
|
||||
/* sets Build Data attributes (member variables). */
|
||||
/*****************************************************************************/
|
||||
int BuildSetAttr( BPy_Build * self, char *name, PyObject * value )
|
||||
{
|
||||
PyObject *valtuple;
|
||||
PyObject *error = NULL;
|
||||
valtuple = Py_BuildValue( "(N)", value );
|
||||
|
||||
if( !valtuple )
|
||||
return EXPP_ReturnIntError( PyExc_MemoryError,
|
||||
"CameraSetAttr: couldn't create PyTuple" );
|
||||
|
||||
if( !strcmp( name, "sfra" ) )
|
||||
error = Build_setSfra( self, valtuple );
|
||||
else if( !strcmp( name, "len" ) )
|
||||
error = Build_setLen( self, valtuple );
|
||||
|
||||
else {
|
||||
Py_DECREF( valtuple );
|
||||
return ( EXPP_ReturnIntError
|
||||
( PyExc_KeyError, "attribute not found" ) );
|
||||
}
|
||||
|
||||
Py_DECREF(valtuple);
|
||||
|
||||
if( error != Py_None )
|
||||
return -1;
|
||||
|
||||
Py_DECREF( Py_None );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Function: BuildPrint */
|
||||
/* Description: This is a callback function for the BPy_Build type. It */
|
||||
/* builds a meaninful string to 'print' build objects. */
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
int BuildPrint(BPy_Build *self, FILE *fp, int flags)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
/*****************************************************************************/
|
||||
/* Function: BuildRepr */
|
||||
/* Description: This is a callback function for the BPy_Build type. It */
|
||||
/* builds a meaninful string to represent build objects. */
|
||||
/*****************************************************************************/
|
||||
PyObject *BuildRepr( BPy_Build * self )
|
||||
{
|
||||
return PyString_FromString( "Build effect" );
|
||||
}
|
||||
|
||||
PyObject *BuildCreatePyObject( struct Effect * build )
|
||||
{
|
||||
BPy_Build *blen_object;
|
||||
|
||||
|
||||
blen_object = ( BPy_Build * ) PyObject_NEW( BPy_Build, &Build_Type );
|
||||
|
||||
if( blen_object == NULL ) {
|
||||
return ( NULL );
|
||||
}
|
||||
blen_object->build = build;
|
||||
return ( ( PyObject * ) blen_object );
|
||||
|
||||
}
|
||||
|
||||
int BuildCheckPyObject( PyObject * py_obj )
|
||||
{
|
||||
return ( py_obj->ob_type == &Build_Type );
|
||||
}
|
||||
|
||||
|
||||
struct Build *BuildFromPyObject( PyObject * py_obj )
|
||||
{
|
||||
BPy_Build *blen_obj;
|
||||
|
||||
blen_obj = ( BPy_Build * ) py_obj;
|
||||
return ( ( struct Build * ) blen_obj->build );
|
||||
|
||||
}
|
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL/BL DUAL 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. The Blender
|
||||
* Foundation also sells licenses for use in proprietary software under
|
||||
* the Blender License. See http://www.blender.org/BL/ for information
|
||||
* about this.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This is a new part of Blender.
|
||||
*
|
||||
* Contributor(s): Jacques Guignot
|
||||
*
|
||||
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#ifndef EXPP_BUILD_H
|
||||
#define EXPP_BUILD_H
|
||||
|
||||
#include <Python.h>
|
||||
#include "Effect.h"
|
||||
|
||||
extern PyTypeObject Build_Type;
|
||||
|
||||
#define BPy_Build_Check(v) ((v)->ob_type==&Build_Type)
|
||||
|
||||
/* Python BPy_Build structure definition */
|
||||
typedef struct {
|
||||
PyObject_HEAD /* required py macro */
|
||||
Effect * build;
|
||||
} BPy_Build;
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Python API function prototypes for the Build module. */
|
||||
/*****************************************************************************/
|
||||
PyObject *M_Build_New( PyObject * self, PyObject * args );
|
||||
PyObject *M_Build_Get( PyObject * self, PyObject * args );
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Python BPy_Build methods declarations: */
|
||||
/*****************************************************************************/
|
||||
PyObject *Build_getLen( BPy_Build * self );
|
||||
PyObject *Build_setLen( BPy_Build * self, PyObject * a );
|
||||
PyObject *Build_getSfra( BPy_Build * self );
|
||||
PyObject *Build_setSfra( BPy_Build * self, PyObject * a );
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Python Build_Type callback function prototypes: */
|
||||
/*****************************************************************************/
|
||||
void BuildDeAlloc( BPy_Build * msh );
|
||||
//int BuildPrint (BPy_Build *msh, FILE *fp, int flags);
|
||||
int BuildSetAttr( BPy_Build * msh, char *name, PyObject * v );
|
||||
PyObject *BuildGetAttr( BPy_Build * msh, char *name );
|
||||
PyObject *BuildRepr( BPy_Build * msh );
|
||||
PyObject *BuildCreatePyObject( struct Effect *build );
|
||||
int BuildCheckPyObject( PyObject * py_obj );
|
||||
struct Build *BuildFromPyObject( PyObject * py_obj );
|
||||
|
||||
|
||||
|
||||
#endif /* EXPP_BUILD_H */
|
@@ -2209,7 +2209,7 @@ void convertmenu(void)
|
||||
for(a=0; a<ob1->totcol; a++) id_us_plus((ID *)me->mat[a]);
|
||||
}
|
||||
|
||||
dm= mesh_create_derived_no_deform(ob->data, NULL);
|
||||
dm= mesh_create_derived_no_deform(ob, NULL);
|
||||
dlm= dm->convertToDispListMesh(dm);
|
||||
dm->release(dm);
|
||||
|
||||
|
Reference in New Issue
Block a user