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/bmesh')
-rw-r--r--source/blender/python/bmesh/CMakeLists.txt1
-rw-r--r--source/blender/python/bmesh/bmesh_py_api.c23
-rw-r--r--source/blender/python/bmesh/bmesh_py_ops.c25
-rw-r--r--source/blender/python/bmesh/bmesh_py_ops_call.c46
-rw-r--r--source/blender/python/bmesh/bmesh_py_types.c92
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_customdata.c21
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_meshdata.c92
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_meshdata.h4
8 files changed, 118 insertions, 186 deletions
diff --git a/source/blender/python/bmesh/CMakeLists.txt b/source/blender/python/bmesh/CMakeLists.txt
index 3b38fead7b9..48213b7eed5 100644
--- a/source/blender/python/bmesh/CMakeLists.txt
+++ b/source/blender/python/bmesh/CMakeLists.txt
@@ -23,6 +23,7 @@ set(INC
../../bmesh
../../blenkernel
../../blenlib
+ ../../depsgraph
../../makesdna
../../../../intern/guardedalloc
)
diff --git a/source/blender/python/bmesh/bmesh_py_api.c b/source/blender/python/bmesh/bmesh_py_api.c
index 5819d7ce2bb..012f7b1232d 100644
--- a/source/blender/python/bmesh/bmesh_py_api.c
+++ b/source/blender/python/bmesh/bmesh_py_api.c
@@ -113,30 +113,30 @@ static PyObject *bpy_bm_from_edit_mesh(PyObject *UNUSED(self), PyObject *value)
}
PyDoc_STRVAR(bpy_bm_update_edit_mesh_doc,
-".. method:: update_edit_mesh(mesh, tessface=True, destructive=True)\n"
+".. method:: update_edit_mesh(mesh, loop_triangles=True, destructive=True)\n"
"\n"
" Update the mesh after changes to the BMesh in editmode,\n"
" optionally recalculating n-gon tessellation.\n"
"\n"
" :arg mesh: The editmode mesh.\n"
" :type mesh: :class:`bpy.types.Mesh`\n"
-" :arg tessface: Option to recalculate n-gon tessellation.\n"
-" :type tessface: boolean\n"
+" :arg loop_triangles: Option to recalculate n-gon tessellation.\n"
+" :type loop_triangles: boolean\n"
" :arg destructive: Use when geometry has been added or removed.\n"
" :type destructive: boolean\n"
);
static PyObject *bpy_bm_update_edit_mesh(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
{
- static const char *kwlist[] = {"mesh", "tessface", "destructive", NULL};
+ static const char *kwlist[] = {"mesh", "loop_triangles", "destructive", NULL};
PyObject *py_me;
Mesh *me;
- bool do_tessface = true;
+ bool do_loop_triangles = true;
bool is_destructive = true;
if (!PyArg_ParseTupleAndKeywords(
args, kw, "O|O&O&:update_edit_mesh", (char **)kwlist,
&py_me,
- PyC_ParseBool, &do_tessface,
+ PyC_ParseBool, &do_loop_triangles,
PyC_ParseBool, &is_destructive))
{
return NULL;
@@ -156,13 +156,8 @@ static PyObject *bpy_bm_update_edit_mesh(PyObject *UNUSED(self), PyObject *args,
{
extern void EDBM_update_generic(BMEditMesh *em, const bool do_tessface, const bool is_destructive);
- BMEditMesh *em = me->edit_btmesh;
- BMesh *bm = em->bm;
- /* python won't ensure matching uv/mtex */
- BM_mesh_cd_validate(bm);
-
- EDBM_update_generic(me->edit_btmesh, do_tessface, is_destructive);
+ EDBM_update_generic(me->edit_btmesh, do_loop_triangles, is_destructive);
}
Py_RETURN_NONE;
@@ -208,21 +203,17 @@ PyObject *BPyInit_bmesh(void)
/* bmesh.types */
PyModule_AddObject(mod, "types", (submodule = BPyInit_bmesh_types()));
PyDict_SetItem(sys_modules, PyModule_GetNameObject(submodule), submodule);
- Py_INCREF(submodule);
/* bmesh.ops (not a real module, exposes module like access). */
PyModule_AddObject(mod, "ops", (submodule = BPyInit_bmesh_ops()));
/* PyDict_SetItemString(sys_modules, PyModule_GetNameObject(submodule), submodule); */
PyDict_SetItemString(sys_modules, "bmesh.ops", submodule); /* fake module */
- Py_INCREF(submodule);
PyModule_AddObject(mod, "utils", (submodule = BPyInit_bmesh_utils()));
PyDict_SetItem(sys_modules, PyModule_GetNameObject(submodule), submodule);
- Py_INCREF(submodule);
PyModule_AddObject(mod, "geometry", (submodule = BPyInit_bmesh_geometry()));
PyDict_SetItem(sys_modules, PyModule_GetNameObject(submodule), submodule);
- Py_INCREF(submodule);
return mod;
}
diff --git a/source/blender/python/bmesh/bmesh_py_ops.c b/source/blender/python/bmesh/bmesh_py_ops.c
index ee96c859858..49e71da3bc3 100644
--- a/source/blender/python/bmesh/bmesh_py_ops.c
+++ b/source/blender/python/bmesh/bmesh_py_ops.c
@@ -75,10 +75,14 @@ static char *bmp_slots_as_args(const BMOSlotType slot_types[BMO_OP_MAX_SLOTS], c
{
DynStr *dyn_str = BLI_dynstr_new();
char *ret;
+ bool quoted;
+ bool set;
int i = 0;
while (*slot_types[i].name) {
+ quoted = false;
+ set = false;
/* cut off '.out' by using a string size arg */
const int name_len = is_out ?
(strchr(slot_types[i].name, '.') - slot_types[i].name) :
@@ -86,7 +90,19 @@ static char *bmp_slots_as_args(const BMOSlotType slot_types[BMO_OP_MAX_SLOTS], c
const char *value = "<Unknown>";
switch (slot_types[i].type) {
case BMO_OP_SLOT_BOOL: value = "False"; break;
- case BMO_OP_SLOT_INT: value = "0"; break;
+ case BMO_OP_SLOT_INT:
+ if (slot_types[i].subtype.intg == BMO_OP_SLOT_SUBTYPE_INT_ENUM) {
+ value = slot_types[i].enum_flags[0].identifier;
+ quoted = true;
+ }
+ else if (slot_types[i].subtype.intg == BMO_OP_SLOT_SUBTYPE_INT_FLAG) {
+ value = "";
+ set = true;
+ }
+ else {
+ value = "0";
+ }
+ break;
case BMO_OP_SLOT_FLT: value = "0.0"; break;
case BMO_OP_SLOT_PTR: value = "None"; break;
case BMO_OP_SLOT_MAT: value = "Matrix()"; break;
@@ -95,7 +111,12 @@ static char *bmp_slots_as_args(const BMOSlotType slot_types[BMO_OP_MAX_SLOTS], c
(slot_types[i].subtype.elem & BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE) ? "None" : "[]"; break;
case BMO_OP_SLOT_MAPPING: value = "{}"; break;
}
- BLI_dynstr_appendf(dyn_str, i ? ", %.*s=%s" : "%.*s=%s", name_len, slot_types[i].name, value);
+ BLI_dynstr_appendf(
+ dyn_str, i ? ", %.*s=%s%s%s%s%s" : "%.*s=%s%s%s%s%s",
+ name_len, slot_types[i].name,
+ set ? "{" : "", quoted ? "'" : "",
+ value,
+ quoted ? "'" : "", set ? "}" : "");
i++;
}
diff --git a/source/blender/python/bmesh/bmesh_py_ops_call.c b/source/blender/python/bmesh/bmesh_py_ops_call.c
index 14e14cd5fe3..ac328e852ac 100644
--- a/source/blender/python/bmesh/bmesh_py_ops_call.c
+++ b/source/blender/python/bmesh/bmesh_py_ops_call.c
@@ -46,6 +46,8 @@
#include "../generic/python_utildefines.h"
#include "../generic/py_capi_utils.h"
+BLI_STATIC_ASSERT(sizeof(PyC_FlagSet) == sizeof(BMO_FlagSet), "size mismatch");
+
static int bpy_bm_op_as_py_error(BMesh *bm)
{
if (BMO_error_occurred(bm)) {
@@ -169,16 +171,46 @@ static int bpy_slot_from_py(
}
case BMO_OP_SLOT_INT:
{
- const int param = PyC_Long_AsI32(value);
+ if (slot->slot_subtype.intg == BMO_OP_SLOT_SUBTYPE_INT_ENUM) {
+ int enum_val = -1;
+ PyC_FlagSet *items = (PyC_FlagSet *)slot->data.enum_flags;
+ const char *enum_str = _PyUnicode_AsString(value);
- if (param == -1 && PyErr_Occurred()) {
- PyErr_Format(PyExc_TypeError,
- "%.200s: keyword \"%.200s\" expected an int, not %.200s",
- opname, slot_name, Py_TYPE(value)->tp_name);
- return -1;
+ if (enum_str == NULL) {
+ PyErr_Format(PyExc_TypeError,
+ "%.200s: keyword \"%.200s\" expected a string, not %.200s",
+ opname, slot_name, Py_TYPE(value)->tp_name);
+ return -1;
+ }
+
+ if (PyC_FlagSet_ValueFromID(items, enum_str, &enum_val, slot_name) == -1) {
+ return -1;
+ }
+
+ BMO_SLOT_AS_INT(slot) = enum_val;
+ }
+ else if (slot->slot_subtype.intg == BMO_OP_SLOT_SUBTYPE_INT_FLAG) {
+ int flag = 0;
+ PyC_FlagSet *items = (PyC_FlagSet *)slot->data.enum_flags;
+
+ if (PyC_FlagSet_ToBitfield(items, value, &flag, slot_name) == -1) {
+ return -1;
+ }
+
+ BMO_SLOT_AS_INT(slot) = flag;
}
else {
- BMO_SLOT_AS_INT(slot) = param;
+ const int param = PyC_Long_AsI32(value);
+
+ if (param == -1 && PyErr_Occurred()) {
+ PyErr_Format(PyExc_TypeError,
+ "%.200s: keyword \"%.200s\" expected an int, not %.200s",
+ opname, slot_name, Py_TYPE(value)->tp_name);
+ return -1;
+ }
+ else {
+ BMO_SLOT_AS_INT(slot) = param;
+ }
}
break;
}
diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c
index 21239f7494a..c1be2cd20d1 100644
--- a/source/blender/python/bmesh/bmesh_py_types.c
+++ b/source/blender/python/bmesh/bmesh_py_types.c
@@ -34,11 +34,13 @@
#include "DNA_object_types.h"
#include "DNA_material_types.h"
-#include "BKE_depsgraph.h"
#include "BKE_customdata.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_global.h"
#include "BKE_library.h"
+#include "BKE_mesh_runtime.h"
+
+#include "DEG_depsgraph.h"
+#include "DEG_depsgraph_query.h"
#include "bmesh.h"
@@ -903,10 +905,7 @@ static PyObject *bpy_bmesh_to_mesh(BPy_BMesh *self, PyObject *args)
bm = self->bm;
- /* python won't ensure matching uv/mtex */
- BM_mesh_cd_validate(bm);
-
- BLI_assert(BKE_id_is_in_gobal_main(&me->id));
+ BLI_assert(BKE_id_is_in_global_main(&me->id));
BM_mesh_bm_to_me(
G_MAIN, /* XXX UGLY! */
bm, me,
@@ -916,13 +915,13 @@ static PyObject *bpy_bmesh_to_mesh(BPy_BMesh *self, PyObject *args)
/* we could have the user do this but if they forget blender can easy crash
* since the references arrays for the objects derived meshes are now invalid */
- DAG_id_tag_update(&me->id, OB_RECALC_DATA);
+ DEG_id_tag_update(&me->id, ID_RECALC_GEOMETRY);
Py_RETURN_NONE;
}
PyDoc_STRVAR(bpy_bmesh_from_object_doc,
-".. method:: from_object(object, scene, deform=True, render=False, cage=False, face_normals=True)\n"
+".. method:: from_object(object, depsgraph, deform=True, cage=False, face_normals=True)\n"
"\n"
" Initialize this bmesh from existing object datablock (currently only meshes are supported).\n"
"\n"
@@ -930,8 +929,6 @@ PyDoc_STRVAR(bpy_bmesh_from_object_doc,
" :type object: :class:`Object`\n"
" :arg deform: Apply deformation modifiers.\n"
" :type deform: boolean\n"
-" :arg render: Use render settings.\n"
-" :type render: boolean\n"
" :arg cage: Get the mesh as a deformed cage.\n"
" :type cage: boolean\n"
" :arg face_normals: Calculate face normals.\n"
@@ -939,30 +936,29 @@ PyDoc_STRVAR(bpy_bmesh_from_object_doc,
);
static PyObject *bpy_bmesh_from_object(BPy_BMesh *self, PyObject *args, PyObject *kw)
{
- static const char *kwlist[] = {"object", "scene", "deform", "render", "cage", "face_normals", NULL};
+ static const char *kwlist[] = {"object", "depsgraph", "deform", "cage", "face_normals", NULL};
PyObject *py_object;
- PyObject *py_scene;
- Object *ob;
- struct Scene *scene;
+ PyObject *py_depsgraph;
+ Object *ob, *ob_eval;
+ struct Depsgraph *depsgraph;
+ struct Scene *scene_eval;
+ Mesh *me_eval;
BMesh *bm;
bool use_deform = true;
- bool use_render = false;
bool use_cage = false;
bool use_fnorm = true;
- DerivedMesh *dm;
const int mask = CD_MASK_BMESH;
BPY_BM_CHECK_OBJ(self);
if (!PyArg_ParseTupleAndKeywords(
- args, kw, "OO|O&O&O&O&:from_object", (char **)kwlist,
- &py_object, &py_scene,
+ args, kw, "OO|O&O&O&:from_object", (char **)kwlist,
+ &py_object, &py_depsgraph,
PyC_ParseBool, &use_deform,
- PyC_ParseBool, &use_render,
PyC_ParseBool, &use_cage,
PyC_ParseBool, &use_fnorm) ||
- !(ob = PyC_RNA_AsPointer(py_object, "Object")) ||
- !(scene = PyC_RNA_AsPointer(py_scene, "Scene")))
+ !(ob = PyC_RNA_AsPointer(py_object, "Object")) ||
+ !(depsgraph = PyC_RNA_AsPointer(py_depsgraph, "Depsgraph")))
{
return NULL;
}
@@ -973,52 +969,47 @@ static PyObject *bpy_bmesh_from_object(BPy_BMesh *self, PyObject *args, PyObject
return NULL;
}
+ const bool use_render = DEG_get_mode(depsgraph) == DAG_EVAL_RENDER;
+ scene_eval = DEG_get_evaluated_scene(depsgraph);
+ ob_eval = DEG_get_evaluated_object(depsgraph, ob);
+
/* Write the display mesh into the dummy mesh */
if (use_deform) {
if (use_render) {
if (use_cage) {
PyErr_SetString(PyExc_ValueError,
- "from_object(...): cage arg is unsupported when (render=True)");
+ "from_object(...): cage arg is unsupported when dependency graph evaluation mode is RENDER");
return NULL;
}
else {
- dm = mesh_create_derived_render(scene, ob, mask);
+ me_eval = mesh_create_eval_final_render(depsgraph, scene_eval, ob_eval, mask);
}
}
else {
if (use_cage) {
- dm = mesh_get_derived_deform(scene, ob, mask); /* ob->derivedDeform */
+ me_eval = mesh_get_eval_deform(depsgraph, scene_eval, ob_eval, mask);
}
else {
- dm = mesh_get_derived_final(scene, ob, mask); /* ob->derivedFinal */
+ me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, mask);
}
}
}
else {
/* !use_deform */
- if (use_render) {
- if (use_cage) {
- PyErr_SetString(PyExc_ValueError,
- "from_object(...): cage arg is unsupported when (render=True)");
- return NULL;
- }
- else {
- dm = mesh_create_derived_no_deform_render(scene, ob, NULL, mask);
- }
+ if (use_cage) {
+ PyErr_SetString(PyExc_ValueError,
+ "from_object(...): cage arg is unsupported when deform=False");
+ return NULL;
+ }
+ else if (use_render) {
+ me_eval = mesh_create_eval_no_deform_render(depsgraph, scene_eval, ob, NULL, mask);
}
else {
- if (use_cage) {
- PyErr_SetString(PyExc_ValueError,
- "from_object(...): cage arg is unsupported when (deform=False, render=False)");
- return NULL;
- }
- else {
- dm = mesh_create_derived_no_deform(scene, ob, NULL, mask);
- }
+ me_eval = mesh_create_eval_no_deform(depsgraph, scene_eval, ob, NULL, mask);
}
}
- if (dm == NULL) {
+ if (me_eval == NULL) {
PyErr_Format(PyExc_ValueError,
"from_object(...): Object '%s' has no usable mesh data", ob->id.name + 2);
return NULL;
@@ -1026,9 +1017,10 @@ static PyObject *bpy_bmesh_from_object(BPy_BMesh *self, PyObject *args, PyObject
bm = self->bm;
- DM_to_bmesh_ex(dm, bm, use_fnorm);
-
- dm->release(dm);
+ BM_mesh_bm_from_me(
+ bm, me_eval, (&(struct BMeshFromMeshParams){
+ .calc_face_normal = use_fnorm
+ }));
Py_RETURN_NONE;
}
@@ -1243,15 +1235,15 @@ static PyObject *bpy_bmesh_calc_volume(BPy_BMElem *self, PyObject *args, PyObjec
}
}
-PyDoc_STRVAR(bpy_bmesh_calc_tessface_doc,
-".. method:: calc_tessface()\n"
+PyDoc_STRVAR(bpy_bmesh_calc_loop_triangles_doc,
+".. method:: calc_loop_triangles()\n"
"\n"
" Calculate triangle tessellation from quads/ngons.\n"
"\n"
" :return: The triangulated faces.\n"
" :rtype: list of :class:`BMLoop` tuples\n"
);
-static PyObject *bpy_bmesh_calc_tessface(BPy_BMElem *self)
+static PyObject *bpy_bmesh_calc_loop_triangles(BPy_BMElem *self)
{
BMesh *bm;
@@ -2730,7 +2722,7 @@ static struct PyMethodDef bpy_bmesh_methods[] = {
/* calculations */
{"calc_volume", (PyCFunction)bpy_bmesh_calc_volume, METH_VARARGS | METH_KEYWORDS, bpy_bmesh_calc_volume_doc},
- {"calc_tessface", (PyCFunction)bpy_bmesh_calc_tessface, METH_NOARGS, bpy_bmesh_calc_tessface_doc},
+ {"calc_loop_triangles", (PyCFunction)bpy_bmesh_calc_loop_triangles, METH_NOARGS, bpy_bmesh_calc_loop_triangles_doc},
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c b/source/blender/python/bmesh/bmesh_py_types_customdata.c
index ecf5cce8bd2..f49766c93ab 100644
--- a/source/blender/python/bmesh/bmesh_py_types_customdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c
@@ -105,9 +105,6 @@ PyDoc_STRVAR(bpy_bmlayeraccess_collection__bevel_weight_doc,
PyDoc_STRVAR(bpy_bmlayeraccess_collection__crease_doc,
"Edge crease for subsurf - float in [0 - 1].\n\n:type: :class:`BMLayerCollection`"
);
-PyDoc_STRVAR(bpy_bmlayeraccess_collection__tex_doc,
-"Accessor for :class:`BMTexPoly` layer (TODO).\n\ntype: :class:`BMLayerCollection`" // TYPE DOESN'T EXIST YET
-);
PyDoc_STRVAR(bpy_bmlayeraccess_collection__uv_doc,
"Accessor for :class:`BMLoopUV` UV (as a 2D Vector).\n\ntype: :class:`BMLayerCollection`"
);
@@ -120,6 +117,9 @@ PyDoc_STRVAR(bpy_bmlayeraccess_collection__skin_doc,
PyDoc_STRVAR(bpy_bmlayeraccess_collection__paint_mask_doc,
"Accessor for paint mask layer.\n\ntype: :class:`BMLayerCollection`"
);
+PyDoc_STRVAR(bpy_bmlayeraccess_collection__face_map_doc,
+"FaceMap custom-data layer.\n\ntype: :class:`BMLayerCollection`"
+);
#ifdef WITH_FREESTYLE
PyDoc_STRVAR(bpy_bmlayeraccess_collection__freestyle_edge_doc,
"Accessor for Freestyle edge layer.\n\ntype: :class:`BMLayerCollection`"
@@ -222,8 +222,7 @@ static PyGetSetDef bpy_bmlayeraccess_face_getseters[] = {
{(char *)"float", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__float_doc, (void *)CD_PROP_FLT},
{(char *)"int", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__int_doc, (void *)CD_PROP_INT},
{(char *)"string", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__string_doc, (void *)CD_PROP_STR},
-
- {(char *)"tex", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__tex_doc, (void *)CD_MTEXPOLY},
+ {(char *)"face_map", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__face_map_doc, (void *)CD_FACEMAP},
#ifdef WITH_FREESTYLE
{(char *)"freestyle", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__freestyle_face_doc, (void *)CD_FREESTYLE_FACE},
@@ -989,6 +988,7 @@ PyObject *BPy_BMLayerItem_GetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer)
break;
}
case CD_PROP_INT:
+ case CD_FACEMAP:
{
ret = PyLong_FromLong(*(int *)value);
break;
@@ -999,11 +999,6 @@ PyObject *BPy_BMLayerItem_GetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer)
ret = PyBytes_FromStringAndSize(mstring->s, mstring->s_len);
break;
}
- case CD_MTEXPOLY:
- {
- ret = BPy_BMTexPoly_CreatePyObject(value);
- break;
- }
case CD_MLOOPUV:
{
ret = BPy_BMLoopUV_CreatePyObject(value);
@@ -1074,6 +1069,7 @@ int BPy_BMLayerItem_SetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer, PyObj
break;
}
case CD_PROP_INT:
+ case CD_FACEMAP:
{
int tmp_val = PyC_Long_AsI32(py_value);
if (UNLIKELY(tmp_val == -1 && PyErr_Occurred())) {
@@ -1102,11 +1098,6 @@ int BPy_BMLayerItem_SetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer, PyObj
}
break;
}
- case CD_MTEXPOLY:
- {
- ret = BPy_BMTexPoly_AssignPyObject(value, py_value);
- break;
- }
case CD_MLOOPUV:
{
ret = BPy_BMLoopUV_AssignPyObject(value, py_value);
diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
index d2ea87dd03f..2a0f3817f35 100644
--- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
@@ -42,103 +42,12 @@
#include "BLI_math_vector.h"
#include "BKE_deform.h"
-#include "BKE_library.h"
#include "bmesh_py_types_meshdata.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_utildefines.h"
-
-/* Mesh BMTexPoly
- * ************** */
-
-#define BPy_BMTexPoly_Check(v) (Py_TYPE(v) == &BPy_BMTexPoly_Type)
-
-typedef struct BPy_BMTexPoly {
- PyObject_VAR_HEAD
- MTexPoly *data;
-} BPy_BMTexPoly;
-
-extern PyObject *pyrna_id_CreatePyObject(ID *id);
-extern bool pyrna_id_FromPyObject(PyObject *obj, ID **id);
-
-PyDoc_STRVAR(bpy_bmtexpoly_image_doc,
-"Image or None.\n\n:type: :class:`bpy.types.Image`"
-);
-static PyObject *bpy_bmtexpoly_image_get(BPy_BMTexPoly *self, void *UNUSED(closure))
-{
- return pyrna_id_CreatePyObject((ID *)self->data->tpage);
-}
-
-static int bpy_bmtexpoly_image_set(BPy_BMTexPoly *self, PyObject *value, void *UNUSED(closure))
-{
- ID *id;
-
- if (value == Py_None) {
- id = NULL;
- }
- else if (pyrna_id_FromPyObject(value, &id) && id && GS(id->name) == ID_IM) {
- /* pass */
- }
- else {
- PyErr_Format(PyExc_KeyError, "BMTexPoly.image = x"
- "expected an image or None, not '%.200s'",
- Py_TYPE(value)->tp_name);
- return -1;
- }
-
- id_lib_extern(id);
- self->data->tpage = (struct Image *)id;
-
- return 0;
-}
-
-static PyGetSetDef bpy_bmtexpoly_getseters[] = {
- /* attributes match rna_def_mtpoly */
- {(char *)"image", (getter)bpy_bmtexpoly_image_get, (setter)bpy_bmtexpoly_image_set, (char *)bpy_bmtexpoly_image_doc, NULL},
-
- {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
-};
-
-static PyTypeObject BPy_BMTexPoly_Type; /* bm.loops.layers.uv.active */
-
-static void bm_init_types_bmtexpoly(void)
-{
- BPy_BMTexPoly_Type.tp_basicsize = sizeof(BPy_BMTexPoly);
-
- BPy_BMTexPoly_Type.tp_name = "BMTexPoly";
-
- BPy_BMTexPoly_Type.tp_doc = NULL; // todo
-
- BPy_BMTexPoly_Type.tp_getset = bpy_bmtexpoly_getseters;
-
- BPy_BMTexPoly_Type.tp_flags = Py_TPFLAGS_DEFAULT;
-
- PyType_Ready(&BPy_BMTexPoly_Type);
-}
-
-int BPy_BMTexPoly_AssignPyObject(struct MTexPoly *mtpoly, PyObject *value)
-{
- if (UNLIKELY(!BPy_BMTexPoly_Check(value))) {
- PyErr_Format(PyExc_TypeError, "expected BMTexPoly, not a %.200s", Py_TYPE(value)->tp_name);
- return -1;
- }
- else {
- *((MTexPoly *)mtpoly) = *(((BPy_BMTexPoly *)value)->data);
- return 0;
- }
-}
-
-PyObject *BPy_BMTexPoly_CreatePyObject(struct MTexPoly *mtpoly)
-{
- BPy_BMTexPoly *self = PyObject_New(BPy_BMTexPoly, &BPy_BMTexPoly_Type);
- self->data = mtpoly;
- return (PyObject *)self;
-}
-
-/* --- End Mesh BMTexPoly --- */
-
/* Mesh Loop UV
* ************ */
@@ -797,7 +706,6 @@ PyObject *BPy_BMDeformVert_CreatePyObject(struct MDeformVert *dvert)
/* call to init all types */
void BPy_BM_init_types_meshdata(void)
{
- bm_init_types_bmtexpoly();
bm_init_types_bmloopuv();
bm_init_types_bmloopcol();
bm_init_types_bmdvert();
diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.h b/source/blender/python/bmesh/bmesh_py_types_meshdata.h
index 07d8a46cc65..c8ae2596f99 100644
--- a/source/blender/python/bmesh/bmesh_py_types_meshdata.h
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.h
@@ -40,15 +40,11 @@ typedef struct BPy_BMGenericMeshData {
void *data;
} BPy_BMGenericMeshData;
-struct MTexPoly;
struct MLoopUV;
struct MLoopCol;
struct MDeformVert;
struct MVertSkin;
-int BPy_BMTexPoly_AssignPyObject(struct MTexPoly *mloopuv, PyObject *value);
-PyObject *BPy_BMTexPoly_CreatePyObject(struct MTexPoly *mloopuv);
-
int BPy_BMLoopUV_AssignPyObject(struct MLoopUV *data, PyObject *value);
PyObject *BPy_BMLoopUV_CreatePyObject(struct MLoopUV *data);