Changeset View
Changeset View
Standalone View
Standalone View
source/blender/python/intern/bpy_rna.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
| Show First 20 Lines • Show All 2,779 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 = (Py_ssize_t)RNA_property_collection_length(&self->ptr, self->prop); | const Py_ssize_t len = (Py_ssize_t)RNA_property_collection_length(&self->ptr, self->prop); | ||||
| 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 pyrna_prop_collection_subscript_slice(self, start, stop); | return pyrna_prop_collection_subscript_slice(self, start, stop); | ||||
| ▲ Show 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | else { | ||||
| 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. */ | ||||
| Py_ssize_t len = (Py_ssize_t)RNA_property_collection_length(&self->ptr, self->prop); | Py_ssize_t len = (Py_ssize_t)RNA_property_collection_length(&self->ptr, self->prop); | ||||
| 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); | ||||
| } | } | ||||
| else { | else { | ||||
| return pyrna_prop_collection_subscript_slice(self, start, stop); | return pyrna_prop_collection_subscript_slice(self, start, stop); | ||||
| ▲ Show 20 Lines • Show All 6,273 Lines • Show Last 20 Lines | |||||