Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/intern/draw_manager.c
| Show First 20 Lines • Show All 161 Lines • ▼ Show 20 Lines | |||||
| /** \name Settings | /** \name Settings | ||||
| * \{ */ | * \{ */ | ||||
| bool DRW_object_is_renderable(const Object *ob) | bool DRW_object_is_renderable(const Object *ob) | ||||
| { | { | ||||
| BLI_assert((ob->base_flag & BASE_VISIBLE_DEPSGRAPH) != 0); | BLI_assert((ob->base_flag & BASE_VISIBLE_DEPSGRAPH) != 0); | ||||
| if (ob->type == OB_MESH) { | if (ob->type == OB_MESH) { | ||||
| if ((ob == DST.draw_ctx.object_edit) || BKE_object_is_in_editmode(ob)) { | if ((ob == DST.draw_ctx.object_edit) || DRW_object_is_in_edit_mode(ob)) { | ||||
| View3D *v3d = DST.draw_ctx.v3d; | View3D *v3d = DST.draw_ctx.v3d; | ||||
| const int mask = (V3D_OVERLAY_EDIT_OCCLUDE_WIRE | V3D_OVERLAY_EDIT_WEIGHT); | const int mask = (V3D_OVERLAY_EDIT_OCCLUDE_WIRE | V3D_OVERLAY_EDIT_WEIGHT); | ||||
| if (v3d && v3d->overlay.edit_flag & mask) { | if (v3d && v3d->overlay.edit_flag & mask) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| return true; | return true; | ||||
| } | } | ||||
| /* Does `ob` needs to be rendered in edit mode. | |||||
| * | |||||
| * When using duplicate linked a mesh could be edited in a different object. If | |||||
jbakker: Make comment humanreadable | |||||
| * this is the case we can render the edit mesh overlay based on the active modifiers in | |||||
| * both the object that is rendered or the object that is being edited. */ | |||||
| bool DRW_object_is_in_edit_mode(const Object *ob) | |||||
| { | |||||
| if (BKE_object_is_in_editmode(ob)) { | |||||
| if (ob->type == OB_MESH) { | |||||
| if ((ob->mode & OB_MODE_EDIT) == 0) { | |||||
| Mesh *me = (Mesh *)ob->data; | |||||
| BMEditMesh *embm = me->edit_mesh; | |||||
| /* Sanity check when rendering in multiple windows. */ | |||||
| if (embm && embm->mesh_eval_final == NULL) { | |||||
| return false; | |||||
| } | |||||
| /* Do not draw ob with edit overlay when edit data is present and is modified. */ | |||||
| if (embm && embm->mesh_eval_cage && (embm->mesh_eval_cage != embm->mesh_eval_final)) { | |||||
| return false; | |||||
| } | |||||
| /* Check if the object that we are drawing is modified. */ | |||||
| if (!DEG_is_original_id(&me->id)) { | |||||
| return false; | |||||
| } | |||||
| return true; | |||||
| } | |||||
| } | |||||
| return true; | |||||
| } | |||||
| return false; | |||||
| } | |||||
| /** | /** | ||||
| * Return whether this object is visible depending if | * Return whether this object is visible depending if | ||||
| * we are rendering or drawing in the viewport. | * we are rendering or drawing in the viewport. | ||||
| */ | */ | ||||
| int DRW_object_visibility_in_active_context(const Object *ob) | int DRW_object_visibility_in_active_context(const Object *ob) | ||||
| { | { | ||||
| const eEvaluationMode mode = DRW_state_is_scene_render() ? DAG_EVAL_RENDER : DAG_EVAL_VIEWPORT; | const eEvaluationMode mode = DRW_state_is_scene_render() ? DAG_EVAL_RENDER : DAG_EVAL_VIEWPORT; | ||||
| return BKE_object_visibility(ob, mode); | return BKE_object_visibility(ob, mode); | ||||
| ▲ Show 20 Lines • Show All 2,807 Lines • Show Last 20 Lines | |||||
Make comment humanreadable