Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/object.c
| Show First 20 Lines • Show All 481 Lines • ▼ Show 20 Lines | void BKE_object_free(Object *ob) | ||||
| BKE_previewimg_free(&ob->preview); | BKE_previewimg_free(&ob->preview); | ||||
| /* don't free, let the base free it */ | /* don't free, let the base free it */ | ||||
| ob->base_collection_properties = NULL; | ob->base_collection_properties = NULL; | ||||
| } | } | ||||
| /* actual check for internal data, not context or flags */ | /* actual check for internal data, not context or flags */ | ||||
| bool BKE_object_is_in_editmode(Object *ob) | bool BKE_object_is_in_editmode(const Object *ob) | ||||
| { | { | ||||
| if (ob->data == NULL) | if (ob->data == NULL) | ||||
| return false; | return false; | ||||
| if (ob->type == OB_MESH) { | if (ob->type == OB_MESH) { | ||||
| Mesh *me = ob->data; | Mesh *me = ob->data; | ||||
| if (me->edit_btmesh) | if (me->edit_btmesh) | ||||
| return true; | return true; | ||||
| Show All 26 Lines | else if (ob->type == OB_SURF || ob->type == OB_CURVE) { | ||||
| Curve *cu = ob->data; | Curve *cu = ob->data; | ||||
| if (cu->editnurb) | if (cu->editnurb) | ||||
| return true; | return true; | ||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| bool BKE_object_is_in_editmode_and_selected(const Object *ob) | |||||
| { | |||||
| if ((ob->flag & SELECT) && (BKE_object_is_in_editmode(ob))) { | |||||
| return true; | |||||
| } | |||||
| return false; | |||||
| } | |||||
| bool BKE_object_is_in_editmode_vgroup(Object *ob) | bool BKE_object_is_in_editmode_vgroup(Object *ob) | ||||
| { | { | ||||
| return (OB_TYPE_SUPPORT_VGROUP(ob->type) && | return (OB_TYPE_SUPPORT_VGROUP(ob->type) && | ||||
| BKE_object_is_in_editmode(ob)); | BKE_object_is_in_editmode(ob)); | ||||
| } | } | ||||
| bool BKE_object_is_in_wpaint_select_vert(const Object *ob) | bool BKE_object_is_in_wpaint_select_vert(const Object *ob) | ||||
| { | { | ||||
| if (ob->type == OB_MESH) { | if (ob->type == OB_MESH) { | ||||
| Mesh *me = ob->data; | Mesh *me = ob->data; | ||||
| return ((ob->mode & OB_MODE_WEIGHT_PAINT) && | return ((ob->mode & OB_MODE_WEIGHT_PAINT) && | ||||
| (me->edit_btmesh == NULL) && | (me->edit_btmesh == NULL) && | ||||
| (ME_EDIT_PAINT_SEL_MODE(me) == SCE_SELECT_VERTEX)); | (ME_EDIT_PAINT_SEL_MODE(me) == SCE_SELECT_VERTEX)); | ||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| bool BKE_object_has_mode_data(const struct Object *ob, eObjectMode object_mode) | |||||
| { | |||||
| if (object_mode & OB_MODE_EDIT) { | |||||
| if (BKE_object_is_in_editmode(ob)) { | |||||
| return true; | |||||
| } | |||||
| } | |||||
| else if (object_mode & OB_MODE_VERTEX_PAINT) { | |||||
| if (ob->sculpt && (ob->sculpt->mode_type == OB_MODE_VERTEX_PAINT)) { | |||||
| return true; | |||||
| } | |||||
| } | |||||
| else if (object_mode & OB_MODE_WEIGHT_PAINT) { | |||||
| if (ob->sculpt && (ob->sculpt->mode_type == OB_MODE_WEIGHT_PAINT)) { | |||||
| return true; | |||||
| } | |||||
| } | |||||
| else if (object_mode & OB_MODE_SCULPT) { | |||||
| if (ob->sculpt && (ob->sculpt->mode_type == OB_MODE_SCULPT)) { | |||||
| return true; | |||||
| } | |||||
| } | |||||
| else if (object_mode & OB_MODE_POSE) { | |||||
| if (ob->pose != NULL) { | |||||
| return true; | |||||
| } | |||||
| } | |||||
| return false; | |||||
| } | |||||
| /** | /** | ||||
| * Return if the object is visible, as evaluated by depsgraph | * Return if the object is visible, as evaluated by depsgraph | ||||
| */ | */ | ||||
| bool BKE_object_is_visible(Object *ob, const eObjectVisibilityCheck mode) | bool BKE_object_is_visible(Object *ob, const eObjectVisibilityCheck mode) | ||||
| { | { | ||||
| if ((ob->base_flag & BASE_VISIBLED) == 0) { | if ((ob->base_flag & BASE_VISIBLED) == 0) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 3,229 Lines • Show Last 20 Lines | |||||