Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/overlay/overlay_armature.c
| Show All 20 Lines | |||||
| */ | */ | ||||
| #include <math.h> | #include <math.h> | ||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include <string.h> | #include <string.h> | ||||
| #include "DNA_armature_types.h" | #include "DNA_armature_types.h" | ||||
| #include "DNA_constraint_types.h" | #include "DNA_constraint_types.h" | ||||
| #include "DNA_mesh_types.h" | |||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "DNA_view3d_types.h" | #include "DNA_view3d_types.h" | ||||
| #include "DRW_render.h" | #include "DRW_render.h" | ||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BKE_action.h" | #include "BKE_action.h" | ||||
| #include "BKE_armature.h" | #include "BKE_armature.h" | ||||
| #include "BKE_deform.h" | #include "BKE_deform.h" | ||||
| #include "BKE_modifier.h" | #include "BKE_modifier.h" | ||||
| #include "BKE_object.h" | |||||
| #include "DEG_depsgraph_query.h" | #include "DEG_depsgraph_query.h" | ||||
| #include "ED_armature.h" | #include "ED_armature.h" | ||||
| #include "ED_view3d.h" | #include "ED_view3d.h" | ||||
| #include "UI_resources.h" | #include "UI_resources.h" | ||||
| #include "draw_common.h" | #include "draw_common.h" | ||||
| #include "draw_manager_text.h" | #include "draw_manager_text.h" | ||||
| #include "overlay_private.h" | #include "overlay_private.h" | ||||
| #include "draw_cache_impl.h" | |||||
| #define BONE_VAR(eBone, pchan, var) ((eBone) ? (eBone->var) : (pchan->var)) | #define BONE_VAR(eBone, pchan, var) ((eBone) ? (eBone->var) : (pchan->var)) | ||||
| #define BONE_FLAG(eBone, pchan) ((eBone) ? (eBone->flag) : (pchan->bone->flag)) | #define BONE_FLAG(eBone, pchan) ((eBone) ? (eBone->flag) : (pchan->bone->flag)) | ||||
| #define PT_DEFAULT_RAD 0.05f /* radius of the point batch. */ | #define PT_DEFAULT_RAD 0.05f /* radius of the point batch. */ | ||||
| typedef struct ArmatureDrawContext { | typedef struct ArmatureDrawContext { | ||||
| /* Current armature object */ | /* Current armature object */ | ||||
| Object *ob; | Object *ob; | ||||
| ▲ Show 20 Lines • Show All 471 Lines • ▼ Show 20 Lines | static void drw_shgroup_bone_custom_solid(ArmatureDrawContext *ctx, | ||||
| const float hint_color[4], | const float hint_color[4], | ||||
| const float outline_color[4], | const float outline_color[4], | ||||
| Object *custom) | Object *custom) | ||||
| { | { | ||||
| /* TODO(fclem): arg... less than ideal but we never iter on this object | /* TODO(fclem): arg... less than ideal but we never iter on this object | ||||
| * to assure batch cache is valid. */ | * to assure batch cache is valid. */ | ||||
| drw_batch_cache_validate(custom); | drw_batch_cache_validate(custom); | ||||
| struct GPUBatch *surf = DRW_cache_object_surface_get(custom); | /* The custom object is not an evaluated object, so its object->data field hasn't been replaced | ||||
| struct GPUBatch *edges = DRW_cache_object_edge_detection_get(custom, NULL); | * by #data_eval. This is bad since it gives preference to an object's evaluated mesh over any | ||||
| struct GPUBatch *ledges = DRW_cache_object_loose_edges_get(custom); | * other data type, but supporting all evaluated geometry components would require a much larger | ||||
| * refactor of this area. */ | |||||
| Mesh *mesh = BKE_object_get_evaluated_mesh(custom); | |||||
| if (mesh == NULL) { | |||||
| return; | |||||
| } | |||||
| struct GPUBatch *surf = DRW_mesh_batch_cache_get_surface(mesh); | |||||
| struct GPUBatch *edges = DRW_mesh_batch_cache_get_edge_detection(mesh, NULL); | |||||
| struct GPUBatch *ledges = DRW_mesh_batch_cache_get_loose_edges(mesh); | |||||
| BoneInstanceData inst_data; | BoneInstanceData inst_data; | ||||
| DRWCallBuffer *buf; | DRWCallBuffer *buf; | ||||
| if (surf || edges || ledges) { | if (surf || edges || ledges) { | ||||
| mul_m4_m4m4(inst_data.mat, ctx->ob->obmat, bone_mat); | mul_m4_m4m4(inst_data.mat, ctx->ob->obmat, bone_mat); | ||||
| } | } | ||||
| if (surf && ctx->custom_solid) { | if (surf && ctx->custom_solid) { | ||||
| ▲ Show 20 Lines • Show All 1,764 Lines • Show Last 20 Lines | |||||