function for getting object texspace settings, without dealing with curve/mball/mesh separately.

This commit is contained in:
2008-04-01 11:14:34 +00:00
parent 22149c95ba
commit 7d6e7c716f
4 changed files with 46 additions and 26 deletions

View File

@@ -53,6 +53,8 @@
#include "DNA_lattice_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meta_types.h"
#include "DNA_curve_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
#include "DNA_nla_types.h"
@@ -2288,3 +2290,42 @@ float give_timeoffset(Object *ob) {
return ob->sf;
}
}
int give_obdata_texspace(Object *ob, int **texflag, float **loc, float **size, float **rot) {
if (ob->data==NULL)
return 0;
switch (GS(((ID *)ob->data)->name)) {
case ID_ME:
{
Mesh *me= ob->data;
if (texflag) *texflag = &me->texflag;
if (loc) *loc = me->loc;
if (size) *size = me->size;
if (rot) *rot = me->rot;
break;
}
case ID_CU:
{
Curve *cu= ob->data;
if (texflag) *texflag = &cu->texflag;
if (loc) *loc = cu->loc;
if (size) *size = cu->size;
if (rot) *rot = cu->rot;
break;
}
case ID_MB:
{
MetaBall *mb= ob->data;
if (texflag) *texflag = &mb->texflag;
if (loc) *loc = mb->loc;
if (size) *size = mb->size;
if (rot) *rot = mb->rot;
break;
}
default:
return 0;
}
return 1;
}