Cleanup: naming

Use 'ob' prefix for objects, 'eval' suffix for evaluated data.
This commit is contained in:
2018-05-22 07:48:12 +02:00
parent ac476375b1
commit 17778ddeb7
7 changed files with 64 additions and 55 deletions

View File

@@ -268,8 +268,8 @@ void BKE_camera_params_from_view3d(CameraParams *params, Depsgraph *depsgraph, c
if (rv3d->persp == RV3D_CAMOB) {
/* camera view */
Object *camera_object = DEG_get_evaluated_object(depsgraph, v3d->camera);
BKE_camera_params_from_object(params, camera_object);
Object *ob_camera_eval = DEG_get_evaluated_object(depsgraph, v3d->camera);
BKE_camera_params_from_object(params, ob_camera_eval);
params->zoom = BKE_screen_view3d_zoom_to_fac(rv3d->camzoom);

View File

@@ -121,14 +121,15 @@ int EEVEE_motion_blur_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *veda
float persmat[4][4];
float ctime = DEG_get_ctime(draw_ctx->depsgraph);
float delta = scene_eval->eevee.motion_blur_shutter;
Object *camera_object = DEG_get_evaluated_object(draw_ctx->depsgraph, camera);
Object *ob_camera_eval = DEG_get_evaluated_object(draw_ctx->depsgraph, camera);
/* Current matrix */
eevee_motion_blur_camera_get_matrix_at_time(scene,
ar, rv3d, v3d,
camera_object,
ctime,
effects->current_ndc_to_world);
eevee_motion_blur_camera_get_matrix_at_time(
scene,
ar, rv3d, v3d,
ob_camera_eval,
ctime,
effects->current_ndc_to_world);
/* Viewport Matrix */
DRW_viewport_matrix_get(persmat, DRW_MAT_PERS);
@@ -138,19 +139,21 @@ int EEVEE_motion_blur_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *veda
compare_m4m4(persmat, effects->current_ndc_to_world, 0.0001f))
{
/* Past matrix */
eevee_motion_blur_camera_get_matrix_at_time(scene,
ar, rv3d, v3d,
camera_object,
ctime - delta,
effects->past_world_to_ndc);
eevee_motion_blur_camera_get_matrix_at_time(
scene,
ar, rv3d, v3d,
ob_camera_eval,
ctime - delta,
effects->past_world_to_ndc);
#if 0 /* for future high quality blur */
/* Future matrix */
eevee_motion_blur_camera_get_matrix_at_time(scene,
ar, rv3d, v3d,
camera_object,
ctime + delta,
effects->future_world_to_ndc);
eevee_motion_blur_camera_get_matrix_at_time(
scene,
ar, rv3d, v3d,
ob_camera_eval,
ctime + delta,
effects->future_world_to_ndc);
#endif
invert_m4(effects->current_ndc_to_world);

View File

@@ -96,10 +96,10 @@ void EEVEE_render_init(EEVEE_Data *ved, RenderEngine *engine, struct Depsgraph *
/* Set the pers & view matrix. */
/* TODO(sergey): Shall render hold pointer to an evaluated camera instead? */
struct Object *camera = DEG_get_evaluated_object(depsgraph, RE_GetCamera(engine->re));
struct Object *ob_camera_eval = DEG_get_evaluated_object(depsgraph, RE_GetCamera(engine->re));
float frame = BKE_scene_frame_get(scene);
RE_GetCameraWindow(engine->re, camera, frame, g_data->winmat);
RE_GetCameraModelMatrix(engine->re, camera, g_data->viewinv);
RE_GetCameraWindow(engine->re, ob_camera_eval, frame, g_data->winmat);
RE_GetCameraModelMatrix(engine->re, ob_camera_eval, g_data->viewinv);
invert_m4_m4(g_data->viewmat, g_data->viewinv);
mul_m4_m4m4(g_data->persmat, g_data->winmat, g_data->viewmat);
@@ -114,7 +114,7 @@ void EEVEE_render_init(EEVEE_Data *ved, RenderEngine *engine, struct Depsgraph *
DRW_viewport_matrix_override_set(g_data->viewinv, DRW_MAT_VIEWINV);
/* EEVEE_effects_init needs to go first for TAA */
EEVEE_effects_init(sldata, vedata, camera);
EEVEE_effects_init(sldata, vedata, ob_camera_eval);
EEVEE_materials_init(sldata, stl, fbl);
EEVEE_lights_init(sldata);
EEVEE_lightprobes_init(sldata, vedata);

View File

@@ -151,7 +151,9 @@ static void POSE_cache_init(void *vedata)
{
if (POSE_is_bone_selection_overlay_active()) {
DRWShadingGroup *grp;
psl->bone_selection = DRW_pass_create("Bone Selection", DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_BLEND);
psl->bone_selection = DRW_pass_create(
"Bone Selection",
DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_BLEND);
grp = DRW_shgroup_create(e_data.bone_selection_sh, psl->bone_selection);
DRW_shgroup_uniform_vec4(grp, "color", blend_color, 1);
stl->g_data->bone_selection_shgrp = grp;
@@ -161,19 +163,19 @@ static void POSE_cache_init(void *vedata)
static bool POSE_is_driven_by_active_armature(Object *ob)
{
Object *armature = modifiers_isDeformedByArmature(ob);
if (armature) {
Object *ob_arm = modifiers_isDeformedByArmature(ob);
if (ob_arm) {
const DRWContextState *draw_ctx = DRW_context_state_get();
bool is_active = DRW_pose_mode_armature(armature, draw_ctx->obact);
if (!is_active && armature->proxy_from) {
is_active = DRW_pose_mode_armature(armature->proxy_from, draw_ctx->obact);
bool is_active = DRW_pose_mode_armature(ob_arm, draw_ctx->obact);
if (!is_active && ob_arm->proxy_from) {
is_active = DRW_pose_mode_armature(ob_arm->proxy_from, draw_ctx->obact);
}
return is_active;
}
else {
Object *meshDeform = modifiers_isDeformedByMeshDeform(ob);
if (meshDeform) {
return POSE_is_driven_by_active_armature(meshDeform);
Object *ob_mesh_deform = modifiers_isDeformedByMeshDeform(ob);
if (ob_mesh_deform) {
return POSE_is_driven_by_active_armature(ob_mesh_deform);
}
}
return false;
@@ -202,7 +204,11 @@ static void POSE_cache_populate(void *vedata, Object *ob)
DRW_shgroup_armature_pose(ob, passes);
}
}
else if (ob->type == OB_MESH && !DRW_state_is_select() && POSE_is_bone_selection_overlay_active() && POSE_is_driven_by_active_armature(ob)) {
else if (ob->type == OB_MESH &&
!DRW_state_is_select() &&
POSE_is_bone_selection_overlay_active() &&
POSE_is_driven_by_active_armature(ob))
{
struct Gwn_Batch *geom = DRW_cache_object_surface_get(ob);
if (geom) {
DRW_shgroup_call_object_add(stl->g_data->bone_selection_shgrp, geom, ob);

View File

@@ -401,9 +401,9 @@ void ED_view3d_persp_switch_from_camera(const Depsgraph *depsgraph, View3D *v3d,
BLI_assert(persp != RV3D_CAMOB);
if (v3d->camera) {
Object *camera_eval = DEG_get_evaluated_object(depsgraph, v3d->camera);
rv3d->dist = ED_view3d_offset_distance(camera_eval->obmat, rv3d->ofs, VIEW3D_DIST_FALLBACK);
ED_view3d_from_object(camera_eval, rv3d->ofs, rv3d->viewquat, &rv3d->dist, NULL);
Object *ob_camera_eval = DEG_get_evaluated_object(depsgraph, v3d->camera);
rv3d->dist = ED_view3d_offset_distance(ob_camera_eval->obmat, rv3d->ofs, VIEW3D_DIST_FALLBACK);
ED_view3d_from_object(ob_camera_eval, rv3d->ofs, rv3d->viewquat, &rv3d->dist, NULL);
}
if (!ED_view3d_camera_lock_check(v3d, rv3d)) {
@@ -467,12 +467,12 @@ bool ED_view3d_camera_lock_check(const View3D *v3d, const RegionView3D *rv3d)
void ED_view3d_camera_lock_init_ex(const Depsgraph *depsgraph, View3D *v3d, RegionView3D *rv3d, const bool calc_dist)
{
if (ED_view3d_camera_lock_check(v3d, rv3d)) {
Object *camera_eval = DEG_get_evaluated_object(depsgraph, v3d->camera);
Object *ob_camera_eval = DEG_get_evaluated_object(depsgraph, v3d->camera);
if (calc_dist) {
/* using a fallback dist is OK here since ED_view3d_from_object() compensates for it */
rv3d->dist = ED_view3d_offset_distance(camera_eval->obmat, rv3d->ofs, VIEW3D_DIST_FALLBACK);
rv3d->dist = ED_view3d_offset_distance(ob_camera_eval->obmat, rv3d->ofs, VIEW3D_DIST_FALLBACK);
}
ED_view3d_from_object(camera_eval, rv3d->ofs, rv3d->viewquat, &rv3d->dist, NULL);
ED_view3d_from_object(ob_camera_eval, rv3d->ofs, rv3d->viewquat, &rv3d->dist, NULL);
}
}
@@ -503,12 +503,12 @@ bool ED_view3d_camera_lock_sync(const Depsgraph *depsgraph, View3D *v3d, RegionV
while (root_parent->parent) {
root_parent = root_parent->parent;
}
Object *camera_eval = DEG_get_evaluated_object(depsgraph, v3d->camera);
Object *ob_camera_eval = DEG_get_evaluated_object(depsgraph, v3d->camera);
Object *root_parent_eval = DEG_get_evaluated_object(depsgraph, root_parent);
ED_view3d_to_m4(view_mat, rv3d->ofs, rv3d->viewquat, rv3d->dist);
normalize_m4_m4(tmat, camera_eval->obmat);
normalize_m4_m4(tmat, ob_camera_eval->obmat);
invert_m4_m4(imat, tmat);
mul_m4_m4m4(diff_mat, view_mat, imat);

View File

@@ -177,9 +177,9 @@ void ED_view3d_smooth_view_ex(
}
if (sview->camera) {
Object *camera_eval = DEG_get_evaluated_object(depsgraph, sview->camera);
sms.dst.dist = ED_view3d_offset_distance(camera_eval->obmat, sview->ofs, VIEW3D_DIST_FALLBACK);
ED_view3d_from_object(camera_eval, sms.dst.ofs, sms.dst.quat, &sms.dst.dist, &sms.dst.lens);
Object *ob_camera_eval = DEG_get_evaluated_object(depsgraph, sview->camera);
sms.dst.dist = ED_view3d_offset_distance(ob_camera_eval->obmat, sview->ofs, VIEW3D_DIST_FALLBACK);
ED_view3d_from_object(ob_camera_eval, sms.dst.ofs, sms.dst.quat, &sms.dst.dist, &sms.dst.lens);
sms.to_camera = true; /* restore view3d values in end */
}
@@ -203,10 +203,10 @@ void ED_view3d_smooth_view_ex(
if (changed) {
/* original values */
if (sview->camera_old) {
Object *camera_old_eval = DEG_get_evaluated_object(depsgraph, sview->camera_old);
sms.src.dist = ED_view3d_offset_distance(camera_old_eval->obmat, rv3d->ofs, 0.0f);
Object *ob_camera_old_eval = DEG_get_evaluated_object(depsgraph, sview->camera_old);
sms.src.dist = ED_view3d_offset_distance(ob_camera_old_eval->obmat, rv3d->ofs, 0.0f);
/* this */
ED_view3d_from_object(camera_old_eval, sms.src.ofs, sms.src.quat, &sms.src.dist, &sms.src.lens);
ED_view3d_from_object(ob_camera_old_eval, sms.src.ofs, sms.src.quat, &sms.src.dist, &sms.src.lens);
}
/* grid draw as floor */
if ((rv3d->viewlock & RV3D_LOCKED) == 0) {
@@ -228,10 +228,10 @@ void ED_view3d_smooth_view_ex(
/* ensure it shows correct */
if (sms.to_camera) {
/* use ortho if we move from an ortho view to an ortho camera */
Object *camera_eval = DEG_get_evaluated_object(depsgraph, sview->camera);
Object *ob_camera_eval = DEG_get_evaluated_object(depsgraph, sview->camera);
rv3d->persp = (((rv3d->is_persp == false) &&
(camera_eval->type == OB_CAMERA) &&
(((Camera *)camera_eval->data)->type == CAM_ORTHO)) ?
(ob_camera_eval->type == OB_CAMERA) &&
(((Camera *)ob_camera_eval->data)->type == CAM_ORTHO)) ?
RV3D_ORTHO : RV3D_PERSP);
}
@@ -762,9 +762,9 @@ void view3d_viewmatrix_set(
{
if (rv3d->persp == RV3D_CAMOB) { /* obs/camera */
if (v3d->camera) {
Object *camera_object = DEG_get_evaluated_object(depsgraph, v3d->camera);
BKE_object_where_is_calc(depsgraph, scene, camera_object);
obmat_to_viewmat(rv3d, camera_object);
Object *ob_camera_eval = DEG_get_evaluated_object(depsgraph, v3d->camera);
BKE_object_where_is_calc(depsgraph, scene, ob_camera_eval);
obmat_to_viewmat(rv3d, ob_camera_eval);
}
else {
quat_to_mat4(rv3d->viewmat, rv3d->viewquat);

View File

@@ -620,14 +620,14 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje
/* 1. draw shadow mesh */
if (sima->flag & SI_DRAWSHADOW) {
Object *ob_cage = DEG_get_evaluated_object(depsgraph, obedit);
Object *ob_cage_eval = DEG_get_evaluated_object(depsgraph, obedit);
/* XXX TODO: Need to check if shadow mesh is different than original mesh. */
bool is_cage_like_final_meshes = (ob_cage == obedit);
bool is_cage_like_final_meshes = (ob_cage_eval == obedit);
/* When sync selection is enabled, all faces are drawn (except for hidden)
* so if cage is the same as the final, there is no point in drawing this. */
if (((ts->uv_flag & UV_SYNC_SELECTION) == 0) || is_cage_like_final_meshes) {
draw_uvs_shadow(ob_cage);
draw_uvs_shadow(ob_cage_eval);
}
}