bugfix [#20639] BF25_SVN_25888 and below - OBJ and 3DS import fails

blender supports type changing for textures in a way that python doesnt.
add a new general function.

Example usage:
 tex = bpy.data.textures.new("Foo")
 tex.type = 'IMAGE'
 tex = tex.recast_type()

Macro to give the number of users accounting for fake user.
 ID_REAL_USERS(id)
Use this so you can remove a datablock if it has a fake users as well as apply transformations to it in the 3D view.

Move api function bpy.data.add_texture() --> bpy.data.textures.new()/remove()
This commit is contained in:
2010-01-17 20:06:34 +00:00
parent 55756719fb
commit c7dfa96aea
12 changed files with 116 additions and 49 deletions

View File

@@ -1713,6 +1713,13 @@ static PyObject *pyrna_struct_path_to_id(BPy_StructRNA *self, PyObject *args)
return ret;
}
static PyObject *pyrna_struct_recast_type(BPy_StructRNA *self, PyObject *args)
{
PointerRNA r_ptr;
RNA_pointer_recast(&self->ptr, &r_ptr);
return pyrna_struct_CreatePyObject(&r_ptr);
}
static PyObject *pyrna_prop_path_to_id(BPy_PropertyRNA *self)
{
char *path;
@@ -2537,6 +2544,7 @@ static struct PyMethodDef pyrna_struct_methods[] = {
{"is_property_hidden", (PyCFunction)pyrna_struct_is_property_hidden, METH_VARARGS, NULL},
{"path_resolve", (PyCFunction)pyrna_struct_path_resolve, METH_O, NULL},
{"path_to_id", (PyCFunction)pyrna_struct_path_to_id, METH_VARARGS, NULL},
{"recast_type", (PyCFunction)pyrna_struct_recast_type, METH_NOARGS, NULL},
{"__dir__", (PyCFunction)pyrna_struct_dir, METH_NOARGS, NULL},
{NULL, NULL, 0, NULL}
};