diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-03-21 19:47:22 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-03-21 19:47:49 +0300 |
commit | 80e6638ad3367ee56d40cbe8669b5e3adf9796c2 (patch) | |
tree | f3f01288173264b5af27a4631ea18c031c86314e /source/blender | |
parent | d409c483104c36be82ff29ff06a39b40636355dc (diff) |
Object Mode Engine: Support for active color.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/draw/intern/draw_armature.c | 4 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_common.c | 7 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_common.h | 5 | ||||
-rw-r--r-- | source/blender/draw/modes/object_mode.c | 37 |
4 files changed, 25 insertions, 28 deletions
diff --git a/source/blender/draw/intern/draw_armature.c b/source/blender/draw/intern/draw_armature.c index 51c269a7b97..4a700388a7c 100644 --- a/source/blender/draw/intern/draw_armature.c +++ b/source/blender/draw/intern/draw_armature.c @@ -419,10 +419,10 @@ static void DRW_shgroup_armature( } void DRW_shgroup_armature_object( - Object *ob, DRWPass *pass_bone_solid, DRWPass *pass_bone_wire, DRWShadingGroup *shgrp_relationship_lines) + Object *ob, SceneLayer *sl, DRWPass *pass_bone_solid, DRWPass *pass_bone_wire, DRWShadingGroup *shgrp_relationship_lines) { float *color; - DRW_object_wire_theme_get(ob, &color); + DRW_object_wire_theme_get(ob, sl, &color); DRW_shgroup_armature(ob, pass_bone_solid, pass_bone_wire, shgrp_relationship_lines); draw_armature_pose(ob, color); diff --git a/source/blender/draw/intern/draw_common.c b/source/blender/draw/intern/draw_common.c index 6a8848a06b0..d56c1569c45 100644 --- a/source/blender/draw/intern/draw_common.c +++ b/source/blender/draw/intern/draw_common.c @@ -249,7 +249,7 @@ DRWShadingGroup *shgroup_spot_instance(DRWPass *pass, struct Batch *geom) /* TODO FINISH */ /* Get the wire color theme_id of an object based on it's state * **color is a way to get a pointer to the static color var associated */ -int DRW_object_wire_theme_get(Object *ob, float **color) +int DRW_object_wire_theme_get(Object *ob, SceneLayer *sl, float **color) { const bool is_edit = (ob->mode & OB_MODE_EDIT) != 0; /* confusing logic here, there are 2 methods of setting the color @@ -271,7 +271,7 @@ int DRW_object_wire_theme_get(Object *ob, float **color) /* uses darker active color for non-active + selected */ theme_id = TH_GROUP_ACTIVE; - // if (scene->basact != base) { + // if (sl->basact->object != ob) { // theme_shade = -16; // } } @@ -281,8 +281,7 @@ int DRW_object_wire_theme_get(Object *ob, float **color) } else { if ((ob->base_flag & BASE_SELECTED) != 0) { - theme_id = //scene->basact == base ? TH_ACTIVE : - TH_SELECT; + theme_id = (sl->basact->object == ob) ? TH_ACTIVE : TH_SELECT; } else { if (ob->type == OB_LAMP) theme_id = TH_LAMP; diff --git a/source/blender/draw/intern/draw_common.h b/source/blender/draw/intern/draw_common.h index ad155224cdb..09d176c2b80 100644 --- a/source/blender/draw/intern/draw_common.h +++ b/source/blender/draw/intern/draw_common.h @@ -30,6 +30,7 @@ struct DRWPass; struct DRWShadingGroup; struct Batch; struct Object; +struct SceneLayer; /* Used as ubo but colors can be directly * referenced as well */ @@ -88,11 +89,11 @@ struct DRWShadingGroup *shgroup_camera_instance(struct DRWPass *pass, struct Bat struct DRWShadingGroup *shgroup_distance_lines_instance(struct DRWPass *pass, struct Batch *geom); struct DRWShadingGroup *shgroup_spot_instance(struct DRWPass *pass, struct Batch *geom); -int DRW_object_wire_theme_get(struct Object *ob, float **color); +int DRW_object_wire_theme_get(struct Object *ob, struct SceneLayer *sl, float **color); /* draw_armature.c */ void DRW_shgroup_armature_object( - struct Object *ob, struct DRWPass *pass_bone_solid, + struct Object *ob, struct SceneLayer *sl, struct DRWPass *pass_bone_solid, struct DRWPass *pass_bone_wire, struct DRWShadingGroup *shgrp_relationship_lines); void DRW_shgroup_armature_pose( diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c index 51d800ba6d9..33ecde5fd75 100644 --- a/source/blender/draw/modes/object_mode.c +++ b/source/blender/draw/modes/object_mode.c @@ -441,11 +441,11 @@ static void OBJECT_cache_init(void) } } -static void DRW_shgroup_lamp(Object *ob) +static void DRW_shgroup_lamp(Object *ob, SceneLayer *sl) { Lamp *la = ob->data; float *color; - int theme_id = DRW_object_wire_theme_get(ob, &color); + int theme_id = DRW_object_wire_theme_get(ob, sl, &color); static float zero = 0.0f; /* Don't draw the center if it's selected or active */ @@ -537,7 +537,7 @@ static void DRW_shgroup_lamp(Object *ob) DRW_shgroup_dynamic_call_add(g_data.lamp_groundpoint, ob->obmat[3]); } -static void DRW_shgroup_camera(Object *ob) +static void DRW_shgroup_camera(Object *ob, SceneLayer *sl) { const struct bContext *C = DRW_get_context(); View3D *v3d = CTX_wm_view3d(C); @@ -546,7 +546,7 @@ static void DRW_shgroup_camera(Object *ob) Camera *cam = ob->data; const bool is_active = (ob == v3d->camera); float *color; - DRW_object_wire_theme_get(ob, &color); + DRW_object_wire_theme_get(ob, sl, &color); float vec[4][3], asp[2], shift[2], scale[3], drawsize; @@ -611,10 +611,10 @@ static void DRW_shgroup_camera(Object *ob) } } -static void DRW_shgroup_empty(Object *ob) +static void DRW_shgroup_empty(Object *ob, SceneLayer *sl) { float *color; - DRW_object_wire_theme_get(ob, &color); + DRW_object_wire_theme_get(ob, sl, &color); switch (ob->empty_drawtype) { case OB_PLAINAXES: @@ -643,11 +643,11 @@ static void DRW_shgroup_empty(Object *ob) } } -static void DRW_shgroup_speaker(Object *ob) +static void DRW_shgroup_speaker(Object *ob, SceneLayer *sl) { float *color; static float one = 1.0f; - DRW_object_wire_theme_get(ob, &color); + DRW_object_wire_theme_get(ob, sl, &color); DRW_shgroup_dynamic_call_add(g_data.speaker, color, &one, ob->obmat); } @@ -674,6 +674,7 @@ static void OBJECT_cache_populate(Object *ob) { const struct bContext *C = DRW_get_context(); Scene *scene = CTX_data_scene(C); + SceneLayer *sl = CTX_data_scene_layer(C); //CollectionEngineSettings *ces_mode_ob = BKE_object_collection_engine_get(ob, COLLECTION_MODE_OBJECT, ""); @@ -684,7 +685,7 @@ static void OBJECT_cache_populate(Object *ob) case OB_MESH: { Object *obedit = scene->obedit; - int theme_id = DRW_object_wire_theme_get(ob, NULL); + int theme_id = DRW_object_wire_theme_get(ob, sl, NULL); if (ob != obedit) { if (do_outlines) { struct Batch *geom = DRW_cache_surface_get(ob); @@ -707,24 +708,24 @@ static void OBJECT_cache_populate(Object *ob) } break; case OB_LAMP: - DRW_shgroup_lamp(ob); + DRW_shgroup_lamp(ob, sl); break; case OB_CAMERA: - DRW_shgroup_camera(ob); + DRW_shgroup_camera(ob, sl); break; case OB_EMPTY: - DRW_shgroup_empty(ob); + DRW_shgroup_empty(ob, sl); break; case OB_SPEAKER: - DRW_shgroup_speaker(ob); + DRW_shgroup_speaker(ob, sl); break; case OB_ARMATURE: { bArmature *arm = ob->data; if (arm->edbo == NULL) { - DRW_shgroup_armature_object(ob, g_data.vedata->psl->bone_solid, - g_data.vedata->psl->bone_wire, - g_data.relationship_lines); + DRW_shgroup_armature_object(ob, sl, g_data.vedata->psl->bone_solid, + g_data.vedata->psl->bone_wire, + g_data.relationship_lines); } } break; @@ -755,9 +756,6 @@ static void OBJECT_draw_scene(void) DRW_framebuffer_clear(true, true, false, clearcol, 1.0f); DRW_draw_pass(psl->outlines); - /* detach textures */ - DRW_framebuffer_texture_detach(dtxl->depth); - /* Expand filled color by 1px and modulate if occluded */ DRW_framebuffer_bind(fbl->blur); DRW_draw_pass(psl->outlines_expand); @@ -777,7 +775,6 @@ static void OBJECT_draw_scene(void) /* Combine with scene buffer */ DRW_framebuffer_bind(dfbl->default_fb); - DRW_framebuffer_texture_attach(dfbl->default_fb, dtxl->depth, 0); DRW_draw_pass(psl->outlines_resolve); } |