[Bf-blender-cvs] [7e3d2a8baa] blender2.8: Sorted BaseLegacy > Base convertions

Dalai Felinto noreply at git.blender.org
Tue Feb 14 18:55:41 CET 2017


Commit: 7e3d2a8baaca06965ee6a244ef124bc33c92b693
Author: Dalai Felinto
Date:   Tue Feb 14 16:33:13 2017 +0100
Branches: blender2.8
https://developer.blender.org/rB7e3d2a8baaca06965ee6a244ef124bc33c92b693

Sorted BaseLegacy > Base convertions

Including bring back UV Edit show other objects

===================================================================

M	source/blender/editors/include/ED_uvedit.h
M	source/blender/editors/object/object_vgroup.c
M	source/blender/editors/physics/physics_pointcache.c
M	source/blender/editors/render/render_preview.c
M	source/blender/editors/space_image/space_image.c
M	source/blender/editors/space_time/space_time.c
M	source/blender/editors/uvedit/uvedit_draw.c
M	source/blender/modifiers/intern/MOD_fluidsim.c
M	source/blender/render/intern/source/envmap.c

===================================================================

diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h
index 535683823b..8d68fba84f 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 67ef4515c1..d93275a353 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 4b19e235d9..5a2bb1e74c 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 cb54f0efd8..b4c92ef0f9 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 6ddf78290a..22b70e0439 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 66ce6d6bb8..986ac062b0 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 3510e1e708..996b07b72f 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)

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list