diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-02-14 18:33:13 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-02-14 20:21:47 +0300 |
commit | 7e3d2a8baaca06965ee6a244ef124bc33c92b693 (patch) | |
tree | 8d55158df280c41cab13a0c23620c1e08b0b19ed | |
parent | a76d45cf721db03a88583b660fa2926aefd5fdd8 (diff) |
Sorted BaseLegacy > Base convertions
Including bring back UV Edit show other objects
-rw-r--r-- | source/blender/editors/include/ED_uvedit.h | 3 | ||||
-rw-r--r-- | source/blender/editors/object/object_vgroup.c | 24 | ||||
-rw-r--r-- | source/blender/editors/physics/physics_pointcache.c | 14 | ||||
-rw-r--r-- | source/blender/editors/render/render_preview.c | 21 | ||||
-rw-r--r-- | source/blender/editors/space_image/space_image.c | 3 | ||||
-rw-r--r-- | source/blender/editors/space_time/space_time.c | 7 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_draw.c | 36 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_fluidsim.c | 7 | ||||
-rw-r--r-- | source/blender/render/intern/source/envmap.c | 16 |
9 files changed, 69 insertions, 62 deletions
diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h index 535683823bf..8d68fba84f5 100644 --- a/source/blender/editors/include/ED_uvedit.h +++ b/source/blender/editors/include/ED_uvedit.h @@ -41,6 +41,7 @@ struct MTexPoly; struct Main; struct Object; struct Scene; +struct SceneLayer; struct SpaceImage; struct bNode; struct wmKeyConfig; @@ -109,7 +110,7 @@ void ED_unwrap_lscm(struct Scene *scene, struct Object *obedit, const short sel) /* uvedit_draw.c */ void ED_image_draw_cursor(struct ARegion *ar, const float cursor[2]); -void ED_uvedit_draw_main(struct SpaceImage *sima, struct ARegion *ar, struct Scene *scene, struct Object *obedit, struct Object *obact); +void ED_uvedit_draw_main(struct SpaceImage *sima, struct ARegion *ar, struct Scene *scene, struct SceneLayer *sl, struct Object *obedit, struct Object *obact); /* uvedit_buttons.c */ void ED_uvedit_buttons_register(struct ARegionType *art); diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 67ef4515c18..d93275a353e 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -59,6 +59,7 @@ #include "BKE_depsgraph.h" #include "BKE_mesh_mapping.h" #include "BKE_editmesh.h" +#include "BKE_layer.h" #include "BKE_modifier.h" #include "BKE_report.h" #include "BKE_DerivedMesh.h" @@ -3300,25 +3301,26 @@ void OBJECT_OT_vertex_group_mirror(wmOperatorType *ot) static int vertex_group_copy_to_linked_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); - Object *ob = ED_object_context(C); - BaseLegacy *base; + Object *ob_active = ED_object_context(C); int retval = OPERATOR_CANCELLED; - for (base = scene->base.first; base; base = base->next) { - if (base->object->type == ob->type) { - if (base->object != ob && base->object->data == ob->data) { - BLI_freelistN(&base->object->defbase); - BLI_duplicatelist(&base->object->defbase, &ob->defbase); - base->object->actdef = ob->actdef; + FOREACH_SCENE_OBJECT(scene, ob_iter) + { + if (ob_iter->type == ob_active->type) { + if (ob_iter != ob_active && ob_iter->data == ob_active->data) { + BLI_freelistN(&ob_iter->defbase); + BLI_duplicatelist(&ob_iter->defbase, &ob_active->defbase); + ob_iter->actdef = ob_active->actdef; - DAG_id_tag_update(&base->object->id, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, base->object); - WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, base->object->data); + DAG_id_tag_update(&ob_iter->id, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob_iter); + WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, ob_iter->data); retval = OPERATOR_FINISHED; } } } + FOREACH_SCENE_OBJECT_END return retval; } diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c index 4b19e235d9c..5a2bb1e74c7 100644 --- a/source/blender/editors/physics/physics_pointcache.c +++ b/source/blender/editors/physics/physics_pointcache.c @@ -42,6 +42,7 @@ #include "BKE_context.h" #include "BKE_screen.h" #include "BKE_global.h" +#include "BKE_layer.h" #include "BKE_main.h" #include "BKE_particle.h" #include "BKE_pointcache.h" @@ -253,22 +254,23 @@ static void ptcache_bake_cancel(bContext *C, wmOperator *op) static int ptcache_free_bake_all_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); - BaseLegacy *base; + Scene *scene = CTX_data_scene(C); PTCacheID *pid; ListBase pidlist; - for (base=scene->base.first; base; base= base->next) { - BKE_ptcache_ids_from_object(&pidlist, base->object, scene, MAX_DUPLI_RECUR); + FOREACH_SCENE_OBJECT(scene, ob) + { + BKE_ptcache_ids_from_object(&pidlist, ob, scene, MAX_DUPLI_RECUR); - for (pid=pidlist.first; pid; pid=pid->next) { + for (pid = pidlist.first; pid; pid = pid->next) { ptcache_free_bake(pid->cache); } BLI_freelistN(&pidlist); - WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, base->object); + WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, ob); } + FOREACH_SCENE_OBJECT_END WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index cb54f0efd85..b4c92ef0f9a 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -69,6 +69,7 @@ #include "BKE_image.h" #include "BKE_icons.h" #include "BKE_lamp.h" +#include "BKE_layer.h" #include "BKE_library.h" #include "BKE_library_remap.h" #include "BKE_main.h" @@ -358,29 +359,33 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty /* this only works in a specific case where the preview.blend contains * an object starting with 'c' which has a material linked to it (not the obdata) * and that material has a fake shadow texture in the active texture slot */ - for (base = sce->base.first; base; base = base->next) { - if (base->object->id.name[2] == 'c') { - Material *shadmat = give_current_material(base->object, base->object->actcol); + FOREACH_SCENE_OBJECT(sce, ob) + { + if (ob->id.name[2] == 'c') { + Material *shadmat = give_current_material(ob, ob->actcol); if (shadmat) { if (mat->mode2 & MA_CASTSHADOW) shadmat->septex = 0; else shadmat->septex |= 1; } } } + FOREACH_SCENE_OBJECT_END /* turn off bounce lights for volume, * doesn't make much visual difference and slows it down too */ - for (base = sce->base.first; base; base = base->next) { - if (base->object->type == OB_LAMP) { + FOREACH_SCENE_OBJECT(sce, ob) + { + if (ob->type == OB_LAMP) { /* if doesn't match 'Lamp.002' --> main key light */ - if (!STREQ(base->object->id.name + 2, "Lamp.002")) { + if (!STREQ(ob->id.name + 2, "Lamp.002")) { if (mat->material_type == MA_TYPE_VOLUME) - base->object->restrictflag |= OB_RESTRICT_RENDER; + ob->restrictflag |= OB_RESTRICT_RENDER; else - base->object->restrictflag &= ~OB_RESTRICT_RENDER; + ob->restrictflag &= ~OB_RESTRICT_RENDER; } } } + FOREACH_SCENE_OBJECT_END } else { /* use current scene world to light sphere */ diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 6ddf78290aa..22b70e04397 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -687,6 +687,7 @@ static void image_main_region_draw(const bContext *C, ARegion *ar) Mask *mask = NULL; bool curve = false; Scene *scene = CTX_data_scene(C); + SceneLayer *sl = CTX_data_scene_layer(C); View2D *v2d = &ar->v2d; //View2DScrollers *scrollers; float col[3]; @@ -722,7 +723,7 @@ static void image_main_region_draw(const bContext *C, ARegion *ar) ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW); - ED_uvedit_draw_main(sima, ar, scene, obedit, obact); + ED_uvedit_draw_main(sima, ar, scene, sl, obedit, obact); /* check for mask (delay draw) */ if (ED_space_image_show_uvedit(sima, obedit)) { diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index 66ce6d6bb8e..986ac062b05 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -346,7 +346,7 @@ static void time_draw_idblock_keyframes(View2D *v2d, ID *id, short onlysel, cons BLI_dlrbTree_free(&keys); } -static void time_draw_caches_keyframes(Main *bmain, Scene *scene, View2D *v2d, bool onlysel, const unsigned char color[3]) +static void time_draw_caches_keyframes(Main *bmain, SceneLayer *sl, View2D *v2d, bool onlysel, const unsigned char color[3]) { CacheFile *cache_file; @@ -357,7 +357,7 @@ static void time_draw_caches_keyframes(Main *bmain, Scene *scene, View2D *v2d, b cache_file->draw_flag &= ~CACHEFILE_KEYFRAME_DRAWN; } - for (BaseLegacy *base = scene->base.first; base; base = base->next) { + for (Base *base = sl->object_bases.first; base; base = base->next) { Object *ob = base->object; ModifierData *md = modifiers_findByType(ob, eModifierType_MeshSequenceCache); @@ -400,6 +400,7 @@ static void time_draw_caches_keyframes(Main *bmain, Scene *scene, View2D *v2d, b static void time_draw_keyframes(const bContext *C, ARegion *ar) { Scene *scene = CTX_data_scene(C); + SceneLayer *sl = CTX_data_scene_layer(C); Object *ob = CTX_data_active_object(C); View2D *v2d = &ar->v2d; bool onlysel = ((scene->flag & SCE_KEYS_NO_SELONLY) == 0); @@ -410,7 +411,7 @@ static void time_draw_keyframes(const bContext *C, ARegion *ar) /* draw cache files keyframes (if available) */ UI_GetThemeColor3ubv(TH_TIME_KEYFRAME, color); - time_draw_caches_keyframes(CTX_data_main(C), scene, v2d, onlysel, color); + time_draw_caches_keyframes(CTX_data_main(C), sl, v2d, onlysel, color); /* draw grease pencil keyframes (if available) */ UI_GetThemeColor3ubv(TH_TIME_GP_KEYFRAME, color); diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index 3510e1e7088..996b07b72ff 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -532,33 +532,29 @@ static void draw_uvs_other_mesh(Object *ob, const Image *curimage, const bool ne } } -static void draw_uvs_other(Scene *scene, Object *obedit, const Image *curimage, const bool new_shading_nodes, +static void draw_uvs_other(SceneLayer *sl, Object *obedit, const Image *curimage, const bool new_shading_nodes, const int other_uv_filter) { - BaseLegacy *base; - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_UV_OTHERS); - for (base = scene->base.first; base; base = base->next) { - Object *ob = base->object; - - if (!(base->flag_legacy & SELECT)) continue; - if (!(base->lay & scene->lay)) continue; - if (ob->restrictflag & OB_RESTRICT_VIEW) continue; - - if ((ob->type == OB_MESH) && (ob != obedit) && ((Mesh *)ob->data)->mloopuv) { - draw_uvs_other_mesh(ob, curimage, new_shading_nodes, other_uv_filter, pos); + for (Base *base = sl->object_bases.first; base; base = base->next) { + if (((base->flag & BASE_SELECTED) != 0) && + ((base->flag & BASE_VISIBLED) != 0)) + { + Object *ob = base->object; + if ((ob->type == OB_MESH) && (ob != obedit) && ((Mesh *)ob->data)->mloopuv) { + draw_uvs_other_mesh(ob, curimage, new_shading_nodes, other_uv_filter, pos); + } } } - immUnbindProgram(); } -static void draw_uvs_texpaint(SpaceImage *sima, Scene *scene, Object *ob) +static void draw_uvs_texpaint(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *ob) { const bool new_shading_nodes = BKE_scene_use_new_shading_nodes(scene); Image *curimage = ED_space_image(sima); @@ -566,7 +562,7 @@ static void draw_uvs_texpaint(SpaceImage *sima, Scene *scene, Object *ob) Material *ma; if (sima->flag & SI_DRAW_OTHER) { - draw_uvs_other(scene, ob, curimage, new_shading_nodes, sima->other_uv_filter); + draw_uvs_other(sl, ob, curimage, new_shading_nodes, sima->other_uv_filter); } ma = give_current_material(ob, ob->actcol); @@ -625,7 +621,7 @@ static void draw_uvs_looptri(BMEditMesh *em, unsigned int *r_loop_index, const i #endif /* draws uv's in the image space */ -static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit) +static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obedit) { const bool new_shading_nodes = BKE_scene_use_new_shading_nodes(scene); ToolSettings *ts; @@ -679,7 +675,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit) curimage = (activetf) ? activetf->tpage : ima; } - draw_uvs_other(scene, obedit, curimage, new_shading_nodes, sima->other_uv_filter); + draw_uvs_other(sl, obedit, curimage, new_shading_nodes, sima->other_uv_filter); } /* 1. draw shadow mesh */ @@ -1140,7 +1136,7 @@ static void draw_uv_shadows_get(SpaceImage *sima, Object *ob, Object *obedit, bo *show_texpaint = (ob && ob->type == OB_MESH && ob->mode == OB_MODE_TEXTURE_PAINT); } -void ED_uvedit_draw_main(SpaceImage *sima, ARegion *ar, Scene *scene, Object *obedit, Object *obact) +void ED_uvedit_draw_main(SpaceImage *sima, ARegion *ar, Scene *scene, SceneLayer *sl, Object *obedit, Object *obact) { ToolSettings *toolsettings = scene->toolsettings; bool show_uvedit, show_uvshadow, show_texpaint_uvshadow; @@ -1152,9 +1148,9 @@ void ED_uvedit_draw_main(SpaceImage *sima, ARegion *ar, Scene *scene, Object *ob if (show_uvshadow) draw_uvs_shadow(obedit); else if (show_uvedit) - draw_uvs(sima, scene, obedit); + draw_uvs(sima, scene, sl, obedit); else - draw_uvs_texpaint(sima, scene, obact); + draw_uvs_texpaint(sima, scene, sl, obact); if (show_uvedit && !(toolsettings->use_uv_sculpt)) ED_image_draw_cursor(ar, sima->cursor); diff --git a/source/blender/modifiers/intern/MOD_fluidsim.c b/source/blender/modifiers/intern/MOD_fluidsim.c index 35e9afe722b..9e91a76ecb8 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim.c +++ b/source/blender/modifiers/intern/MOD_fluidsim.c @@ -41,6 +41,7 @@ #include "BKE_cdderivedmesh.h" +#include "BKE_layer.h" #include "BKE_modifier.h" #include "depsgraph_private.h" @@ -109,9 +110,8 @@ static void updateDepsgraph(ModifierData *md, FluidsimModifierData *fluidmd = (FluidsimModifierData *) md; if (fluidmd && fluidmd->fss) { if (fluidmd->fss->type == OB_FLUIDSIM_DOMAIN) { - BaseLegacy *base; - for (base = scene->base.first; base; base = base->next) { - Object *ob1 = base->object; + FOREACH_SCENE_OBJECT(scene, ob1) + { if (ob1 != ob) { FluidsimModifierData *fluidmdtmp = (FluidsimModifierData *)modifiers_findByType(ob1, eModifierType_Fluidsim); @@ -122,6 +122,7 @@ static void updateDepsgraph(ModifierData *md, } } } + FOREACH_SCENE_OBJECT_END } } } diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index 7de20ab2056..33258d04673 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -51,6 +51,7 @@ #include "BKE_main.h" #include "BKE_image.h" /* BKE_imbuf_write */ +#include "BKE_layer.h" #include "BKE_texture.h" #include "BKE_scene.h" @@ -247,17 +248,14 @@ static void envmap_transmatrix(float mat[4][4], int part) static void env_set_imats(Render *re) { - BaseLegacy *base; float mat[4][4]; - - base = re->scene->base.first; - while (base) { - mul_m4_m4m4(mat, re->viewmat, base->object->obmat); - invert_m4_m4(base->object->imat, mat); - - base = base->next; + + FOREACH_SCENE_OBJECT(re->scene, ob) + { + mul_m4_m4m4(mat, re->viewmat, ob->obmat); + invert_m4_m4(ob->imat, mat); } - + FOREACH_SCENE_OBJECT_END } /* ------------------------------------------------------------------------- */ |