Changeset View
Changeset View
Standalone View
Standalone View
source/blender/python/bmesh/bmesh_py_types.c
| Show First 20 Lines • Show All 1,059 Lines • ▼ Show 20 Lines | 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 | /* 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 */ | * since the references arrays for the objects derived meshes are now invalid */ | ||||
| DEG_id_tag_update(&me->id, ID_RECALC_GEOMETRY); | DEG_id_tag_update(&me->id, ID_RECALC_GEOMETRY); | ||||
| Py_RETURN_NONE; | Py_RETURN_NONE; | ||||
| } | } | ||||
| PyDoc_STRVAR( | PyDoc_STRVAR(bpy_bmesh_from_object_doc, | ||||
| bpy_bmesh_from_object_doc, | ".. method:: from_object(object, depsgraph, cage=False, face_normals=True)\n" | ||||
| ".. method:: from_object(object, depsgraph, deform=True, cage=False, face_normals=True)\n" | |||||
| "\n" | "\n" | ||||
| " Initialize this bmesh from existing object datablock (currently only meshes are " | " Initialize this bmesh from existing object data-block (only meshes are currently " | ||||
| "supported).\n" | "supported).\n" | ||||
| "\n" | "\n" | ||||
| " :arg object: The object data to load.\n" | " :arg object: The object data to load.\n" | ||||
| " :type object: :class:`Object`\n" | " :type object: :class:`Object`\n" | ||||
| " :arg deform: Apply deformation modifiers.\n" | |||||
| " :type deform: boolean\n" | |||||
| " :arg cage: Get the mesh as a deformed cage.\n" | " :arg cage: Get the mesh as a deformed cage.\n" | ||||
| " :type cage: boolean\n" | " :type cage: boolean\n" | ||||
| " :arg face_normals: Calculate face normals.\n" | " :arg face_normals: Calculate face normals.\n" | ||||
| " :type face_normals: boolean\n" | " :type face_normals: boolean\n"); | ||||
| "\n" | |||||
| " .. deprecated:: 2.93\n" | |||||
| "\n" | |||||
| " The deform parameter is deprecated, assumed to be True, and will be removed in version " | |||||
| "3.0.\n"); | |||||
| static PyObject *bpy_bmesh_from_object(BPy_BMesh *self, PyObject *args, PyObject *kw) | static PyObject *bpy_bmesh_from_object(BPy_BMesh *self, PyObject *args, PyObject *kw) | ||||
| { | { | ||||
| static const char *kwlist[] = {"object", "depsgraph", "deform", "cage", "face_normals", NULL}; | static const char *kwlist[] = {"object", "depsgraph", "deform", "cage", "face_normals", NULL}; | ||||
| PyObject *py_object; | PyObject *py_object; | ||||
| PyObject *py_depsgraph; | PyObject *py_depsgraph; | ||||
| Object *ob, *ob_eval; | Object *ob, *ob_eval; | ||||
| struct Depsgraph *depsgraph; | struct Depsgraph *depsgraph; | ||||
| struct Scene *scene_eval; | struct Scene *scene_eval; | ||||
| ▲ Show 20 Lines • Show All 2,159 Lines • ▼ Show 20 Lines | if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop)) { | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| if (start < 0 || stop < 0) { | if (start < 0 || stop < 0) { | ||||
| /* only get the length for negative values */ | /* only get the length for negative values */ | ||||
| const Py_ssize_t len = bpy_bmelemseq_length(self); | const Py_ssize_t len = bpy_bmelemseq_length(self); | ||||
| if (start < 0) { | if (start < 0) { | ||||
| start += len; | start += len; | ||||
| CLAMP_MIN(start, 0); | |||||
| } | } | ||||
| if (stop < 0) { | if (stop < 0) { | ||||
| stop += len; | stop += len; | ||||
| CLAMP_MIN(stop, 0); | |||||
| } | } | ||||
| } | } | ||||
| if (stop - start <= 0) { | if (stop - start <= 0) { | ||||
| return PyList_New(0); | return PyList_New(0); | ||||
| } | } | ||||
| return bpy_bmelemseq_subscript_slice(self, start, stop); | return bpy_bmelemseq_subscript_slice(self, start, stop); | ||||
| ▲ Show 20 Lines • Show All 1,022 Lines • Show Last 20 Lines | |||||