Farewell Scene->base
While getting rid of Scene->base we got the following fixes: * Fix "Convert To" operator * Fix "NLA allowing to selected objects that are not selectable * Fix scene.objects (readonly, no option to link/unlink) Note: Collada needs to use the context SceneLayer for adding objects however I added a placeholder, so Collada maintainers can fix this properly.
This commit is contained in:
		@@ -67,8 +67,10 @@ void BKE_scene_layer_free(struct SceneLayer *sl);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void BKE_scene_layer_selected_objects_tag(struct SceneLayer *sl, const int tag);
 | 
					void BKE_scene_layer_selected_objects_tag(struct SceneLayer *sl, const int tag);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct Object *BKE_scene_layer_camera_find(struct SceneLayer *sl);
 | 
				
			||||||
struct SceneLayer *BKE_scene_layer_find_from_collection(const struct Scene *scene, struct LayerCollection *lc);
 | 
					struct SceneLayer *BKE_scene_layer_find_from_collection(const struct Scene *scene, struct LayerCollection *lc);
 | 
				
			||||||
struct Base *BKE_scene_layer_base_find(struct SceneLayer *sl, struct Object *ob);
 | 
					struct Base *BKE_scene_layer_base_find(struct SceneLayer *sl, struct Object *ob);
 | 
				
			||||||
 | 
					struct Base *BKE_scene_layer_base_find_by_name(struct SceneLayer *sl, struct Object *ob);
 | 
				
			||||||
void BKE_scene_layer_base_deselect_all(struct SceneLayer *sl);
 | 
					void BKE_scene_layer_base_deselect_all(struct SceneLayer *sl);
 | 
				
			||||||
void BKE_scene_layer_base_select(struct SceneLayer *sl, struct Base *selbase);
 | 
					void BKE_scene_layer_base_select(struct SceneLayer *sl, struct Base *selbase);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -63,7 +63,6 @@ void BKE_object_free_particlesystems(struct Object *ob);
 | 
				
			|||||||
void BKE_object_free_softbody(struct Object *ob);
 | 
					void BKE_object_free_softbody(struct Object *ob);
 | 
				
			||||||
void BKE_object_free_bulletsoftbody(struct Object *ob);
 | 
					void BKE_object_free_bulletsoftbody(struct Object *ob);
 | 
				
			||||||
void BKE_object_free_curve_cache(struct Object *ob);
 | 
					void BKE_object_free_curve_cache(struct Object *ob);
 | 
				
			||||||
void BKE_object_update_base_layer(struct Scene *scene, struct Object *ob);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
void BKE_object_free(struct Object *ob);
 | 
					void BKE_object_free(struct Object *ob);
 | 
				
			||||||
void BKE_object_free_derived_caches(struct Object *ob);
 | 
					void BKE_object_free_derived_caches(struct Object *ob);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -88,13 +88,8 @@ struct Scene *BKE_scene_add(struct Main *bmain, const char *name);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void BKE_scene_remove_rigidbody_object(struct Scene *scene, struct Object *ob);
 | 
					void BKE_scene_remove_rigidbody_object(struct Scene *scene, struct Object *ob);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* base functions */
 | 
					bool BKE_scene_object_find(struct Scene *scene, struct Object *ob);
 | 
				
			||||||
struct BaseLegacy *BKE_scene_base_find_by_name(struct Scene *scene, const char *name);
 | 
					struct Object *BKE_scene_object_find_by_name(struct Scene *scene, const char *name);
 | 
				
			||||||
struct BaseLegacy *BKE_scene_base_find(struct Scene *scene, struct Object *ob);
 | 
					 | 
				
			||||||
struct BaseLegacy *BKE_scene_base_add(struct Scene *sce, struct Object *ob);
 | 
					 | 
				
			||||||
void         BKE_scene_base_unlink(struct Scene *sce, struct BaseLegacy *base);
 | 
					 | 
				
			||||||
void         BKE_scene_base_deselect_all(struct Scene *sce);
 | 
					 | 
				
			||||||
void         BKE_scene_base_select(struct Scene *sce, struct BaseLegacy *selbase);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Scene base iteration function.
 | 
					/* Scene base iteration function.
 | 
				
			||||||
 * Define struct here, so no need to bother with alloc/free it.
 | 
					 * Define struct here, so no need to bother with alloc/free it.
 | 
				
			||||||
@@ -129,7 +124,6 @@ void BKE_scene_make_local(struct Main *bmain, struct Scene *sce, const bool lib_
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
struct Scene *BKE_scene_find_from_collection(const struct Main *bmain, const struct SceneCollection *scene_collection);
 | 
					struct Scene *BKE_scene_find_from_collection(const struct Main *bmain, const struct SceneCollection *scene_collection);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct Object *BKE_scene_camera_find(struct Scene *sc);
 | 
					 | 
				
			||||||
#ifdef DURIAN_CAMERA_SWITCH
 | 
					#ifdef DURIAN_CAMERA_SWITCH
 | 
				
			||||||
struct Object *BKE_scene_camera_switch_find(struct Scene *scene); // DURIAN_CAMERA_SWITCH
 | 
					struct Object *BKE_scene_camera_switch_find(struct Scene *scene); // DURIAN_CAMERA_SWITCH
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -45,6 +45,7 @@
 | 
				
			|||||||
#include "BKE_blendfile.h"
 | 
					#include "BKE_blendfile.h"
 | 
				
			||||||
#include "BKE_context.h"
 | 
					#include "BKE_context.h"
 | 
				
			||||||
#include "BKE_global.h"
 | 
					#include "BKE_global.h"
 | 
				
			||||||
 | 
					#include "BKE_layer.h"
 | 
				
			||||||
#include "BKE_library.h"
 | 
					#include "BKE_library.h"
 | 
				
			||||||
#include "BKE_main.h"
 | 
					#include "BKE_main.h"
 | 
				
			||||||
#include "BKE_scene.h"
 | 
					#include "BKE_scene.h"
 | 
				
			||||||
@@ -119,7 +120,7 @@ bool BKE_copybuffer_paste(bContext *C, const char *libname, const short flag, Re
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	Main *bmain = CTX_data_main(C);
 | 
						Main *bmain = CTX_data_main(C);
 | 
				
			||||||
	Scene *scene = CTX_data_scene(C);
 | 
						Scene *scene = CTX_data_scene(C);
 | 
				
			||||||
	SceneLayer *sl = CTX_data_scene_layer(C);
 | 
						SceneLayer *scene_layer = CTX_data_scene_layer(C);
 | 
				
			||||||
	Main *mainl = NULL;
 | 
						Main *mainl = NULL;
 | 
				
			||||||
	Library *lib;
 | 
						Library *lib;
 | 
				
			||||||
	BlendHandle *bh;
 | 
						BlendHandle *bh;
 | 
				
			||||||
@@ -131,7 +132,7 @@ bool BKE_copybuffer_paste(bContext *C, const char *libname, const short flag, Re
 | 
				
			|||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	BKE_scene_base_deselect_all(scene);
 | 
						BKE_scene_layer_base_deselect_all(scene_layer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* tag everything, all untagged data can be made local
 | 
						/* tag everything, all untagged data can be made local
 | 
				
			||||||
	 * its also generally useful to know what is new
 | 
						 * its also generally useful to know what is new
 | 
				
			||||||
@@ -144,7 +145,7 @@ bool BKE_copybuffer_paste(bContext *C, const char *libname, const short flag, Re
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	BLO_library_link_copypaste(mainl, bh);
 | 
						BLO_library_link_copypaste(mainl, bh);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	BLO_library_link_end(mainl, &bh, flag, scene, sl);
 | 
						BLO_library_link_end(mainl, &bh, flag, scene, scene_layer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* mark all library linked objects to be updated */
 | 
						/* mark all library linked objects to be updated */
 | 
				
			||||||
	BKE_main_lib_objects_recalc_all(bmain);
 | 
						BKE_main_lib_objects_recalc_all(bmain);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -49,6 +49,7 @@
 | 
				
			|||||||
#include "BKE_camera.h"
 | 
					#include "BKE_camera.h"
 | 
				
			||||||
#include "BKE_object.h"
 | 
					#include "BKE_object.h"
 | 
				
			||||||
#include "BKE_global.h"
 | 
					#include "BKE_global.h"
 | 
				
			||||||
 | 
					#include "BKE_layer.h"
 | 
				
			||||||
#include "BKE_library.h"
 | 
					#include "BKE_library.h"
 | 
				
			||||||
#include "BKE_library_query.h"
 | 
					#include "BKE_library_query.h"
 | 
				
			||||||
#include "BKE_library_remap.h"
 | 
					#include "BKE_library_remap.h"
 | 
				
			||||||
@@ -885,9 +886,9 @@ static Object *camera_multiview_advanced(Scene *scene, Object *camera, const cha
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (name[0] != '\0') {
 | 
						if (name[0] != '\0') {
 | 
				
			||||||
		BaseLegacy *base = BKE_scene_base_find_by_name(scene, name);
 | 
							Object *ob = BKE_scene_object_find_by_name(scene, name);
 | 
				
			||||||
		if (base) {
 | 
							if (ob != NULL) {
 | 
				
			||||||
			return base->object;
 | 
								return ob;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -51,7 +51,7 @@
 | 
				
			|||||||
#include "BKE_library.h"
 | 
					#include "BKE_library.h"
 | 
				
			||||||
#include "BKE_main.h"
 | 
					#include "BKE_main.h"
 | 
				
			||||||
#include "BKE_object.h"
 | 
					#include "BKE_object.h"
 | 
				
			||||||
#include "BKE_scene.h" /* BKE_scene_base_find */
 | 
					#include "BKE_scene.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void free_group_object(GroupObject *go)
 | 
					static void free_group_object(GroupObject *go)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -203,6 +203,24 @@ static bool find_scene_collection_in_scene_collections(ListBase *lb, const Layer
 | 
				
			|||||||
	return false;
 | 
						return false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Fallback for when a Scene has no camera to use
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * \param scene_layer: in general you want to use the same SceneLayer that is used
 | 
				
			||||||
 | 
					 * for depsgraph. If rendering you pass the scene active layer, when viewing in the viewport
 | 
				
			||||||
 | 
					 * you want to get SceneLayer from context.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					Object *BKE_scene_layer_camera_find(SceneLayer *scene_layer)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						for (Base *base = scene_layer->object_bases.first; base; base = base->next) {
 | 
				
			||||||
 | 
							if (base->object->type == OB_CAMERA) {
 | 
				
			||||||
 | 
								return base->object;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return NULL;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Find the SceneLayer a LayerCollection belongs to
 | 
					 * Find the SceneLayer a LayerCollection belongs to
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -408,7 +408,6 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
 | 
				
			|||||||
				Scene *scene = (Scene *) id;
 | 
									Scene *scene = (Scene *) id;
 | 
				
			||||||
				ToolSettings *toolsett = scene->toolsettings;
 | 
									ToolSettings *toolsett = scene->toolsettings;
 | 
				
			||||||
				SceneRenderLayer *srl;
 | 
									SceneRenderLayer *srl;
 | 
				
			||||||
				BaseLegacy *legacy_base;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
				CALLBACK_INVOKE(scene->camera, IDWALK_CB_NOP);
 | 
									CALLBACK_INVOKE(scene->camera, IDWALK_CB_NOP);
 | 
				
			||||||
				CALLBACK_INVOKE(scene->world, IDWALK_CB_USER);
 | 
									CALLBACK_INVOKE(scene->world, IDWALK_CB_USER);
 | 
				
			||||||
@@ -466,10 +465,6 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
				CALLBACK_INVOKE(scene->gpd, IDWALK_CB_USER);
 | 
									CALLBACK_INVOKE(scene->gpd, IDWALK_CB_USER);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				for (legacy_base = scene->base.first; legacy_base; legacy_base = legacy_base->next) {
 | 
					 | 
				
			||||||
					CALLBACK_INVOKE(legacy_base->object, IDWALK_CB_USER);
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
				FOREACH_SCENE_COLLECTION(scene, sc)
 | 
									FOREACH_SCENE_COLLECTION(scene, sc)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					for (LinkData *link = sc->objects.first; link; link = link->next) {
 | 
										for (LinkData *link = sc->objects.first; link; link = link->next) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -85,6 +85,7 @@
 | 
				
			|||||||
#include "BKE_key.h"
 | 
					#include "BKE_key.h"
 | 
				
			||||||
#include "BKE_lamp.h"
 | 
					#include "BKE_lamp.h"
 | 
				
			||||||
#include "BKE_lattice.h"
 | 
					#include "BKE_lattice.h"
 | 
				
			||||||
 | 
					#include "BKE_layer.h"
 | 
				
			||||||
#include "BKE_library.h"
 | 
					#include "BKE_library.h"
 | 
				
			||||||
#include "BKE_library_query.h"
 | 
					#include "BKE_library_query.h"
 | 
				
			||||||
#include "BKE_library_remap.h"
 | 
					#include "BKE_library_remap.h"
 | 
				
			||||||
@@ -256,24 +257,6 @@ static int foreach_libblock_remap_callback(void *user_data, ID *id_self, ID **id
 | 
				
			|||||||
	return IDWALK_RET_NOP;
 | 
						return IDWALK_RET_NOP;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Some remapping unfortunately require extra and/or specific handling, tackle those here. */
 | 
					 | 
				
			||||||
static void libblock_remap_data_preprocess_scene_base_unlink(
 | 
					 | 
				
			||||||
        IDRemap *r_id_remap_data, Scene *sce, BaseLegacy *base, const bool skip_indirect, const bool is_indirect)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	if (skip_indirect && is_indirect) {
 | 
					 | 
				
			||||||
		r_id_remap_data->skipped_indirect++;
 | 
					 | 
				
			||||||
		r_id_remap_data->skipped_refcounted++;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	else {
 | 
					 | 
				
			||||||
		id_us_min((ID *)base->object);
 | 
					 | 
				
			||||||
		BKE_scene_base_unlink(sce, base);
 | 
					 | 
				
			||||||
		MEM_freeN(base);
 | 
					 | 
				
			||||||
		if (!is_indirect) {
 | 
					 | 
				
			||||||
			r_id_remap_data->status |= ID_REMAP_IS_LINKED_DIRECT;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Some remapping unfortunately require extra and/or specific handling, tackle those here. */
 | 
					/* Some remapping unfortunately require extra and/or specific handling, tackle those here. */
 | 
				
			||||||
static void libblock_remap_data_preprocess_scene_object_unlink(
 | 
					static void libblock_remap_data_preprocess_scene_object_unlink(
 | 
				
			||||||
        IDRemap *r_id_remap_data, Scene *sce, Object *ob, const bool skip_indirect, const bool is_indirect)
 | 
					        IDRemap *r_id_remap_data, Scene *sce, Object *ob, const bool skip_indirect, const bool is_indirect)
 | 
				
			||||||
@@ -310,27 +293,12 @@ static void libblock_remap_data_preprocess(IDRemap *r_id_remap_data)
 | 
				
			|||||||
						            r_id_remap_data, sce, ob_iter, skip_indirect, is_indirect);
 | 
											            r_id_remap_data, sce, ob_iter, skip_indirect, is_indirect);
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					FOREACH_SCENE_OBJECT_END
 | 
										FOREACH_SCENE_OBJECT_END
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
					BaseLegacy *base, *base_next;
 | 
					 | 
				
			||||||
					for (base = sce->base.first; base; base = base_next) {
 | 
					 | 
				
			||||||
						base_next = base->next;
 | 
					 | 
				
			||||||
						libblock_remap_data_preprocess_scene_base_unlink(
 | 
					 | 
				
			||||||
						            r_id_remap_data, sce, base, skip_indirect, is_indirect);
 | 
					 | 
				
			||||||
					}
 | 
					 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				else if (GS(r_id_remap_data->old_id->name) == ID_OB) {
 | 
									else if (GS(r_id_remap_data->old_id->name) == ID_OB) {
 | 
				
			||||||
					/* ... a specific object from scene. */
 | 
										/* ... a specific object from scene. */
 | 
				
			||||||
					Object *old_ob = (Object *)r_id_remap_data->old_id;
 | 
										Object *old_ob = (Object *)r_id_remap_data->old_id;
 | 
				
			||||||
 | 
					 | 
				
			||||||
					libblock_remap_data_preprocess_scene_object_unlink(
 | 
										libblock_remap_data_preprocess_scene_object_unlink(
 | 
				
			||||||
					            r_id_remap_data, sce, old_ob, skip_indirect, is_indirect);
 | 
										            r_id_remap_data, sce, old_ob, skip_indirect, is_indirect);
 | 
				
			||||||
 | 
					 | 
				
			||||||
					BaseLegacy *base = BKE_scene_base_find(sce, old_ob);
 | 
					 | 
				
			||||||
					if (base) {
 | 
					 | 
				
			||||||
						libblock_remap_data_preprocess_scene_base_unlink(
 | 
					 | 
				
			||||||
						            r_id_remap_data, sce, base, skip_indirect, is_indirect);
 | 
					 | 
				
			||||||
					}
 | 
					 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
@@ -392,8 +360,8 @@ static void libblock_remap_data_postprocess_group_scene_unlink(Main *UNUSED(bmai
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	/* Note that here we assume no object has no base (i.e. all objects are assumed instanced
 | 
						/* Note that here we assume no object has no base (i.e. all objects are assumed instanced
 | 
				
			||||||
	 * in one scene...). */
 | 
						 * in one scene...). */
 | 
				
			||||||
	for (BaseLegacy *base = sce->base.first; base; base = base->next) {
 | 
						FOREACH_SCENE_OBJECT(sce, ob)
 | 
				
			||||||
		Object *ob = base->object;
 | 
						{
 | 
				
			||||||
		if (ob->flag & OB_FROMGROUP) {
 | 
							if (ob->flag & OB_FROMGROUP) {
 | 
				
			||||||
			Group *grp = BKE_group_object_find(NULL, ob);
 | 
								Group *grp = BKE_group_object_find(NULL, ob);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -406,6 +374,7 @@ static void libblock_remap_data_postprocess_group_scene_unlink(Main *UNUSED(bmai
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						FOREACH_SCENE_OBJECT_END
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void libblock_remap_data_postprocess_obdata_relink(Main *UNUSED(bmain), Object *ob, ID *new_id)
 | 
					static void libblock_remap_data_postprocess_obdata_relink(Main *UNUSED(bmain), Object *ob, ID *new_id)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -159,16 +159,6 @@ void BKE_object_workob_clear(Object *workob)
 | 
				
			|||||||
	workob->rotmode = ROT_MODE_EUL;
 | 
						workob->rotmode = ROT_MODE_EUL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void BKE_object_update_base_layer(struct Scene *scene, Object *ob)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	BaseLegacy *base = scene->base.first;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	while (base) {
 | 
					 | 
				
			||||||
		if (base->object == ob) base->lay = ob->lay;
 | 
					 | 
				
			||||||
		base = base->next;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void BKE_object_free_particlesystems(Object *ob)
 | 
					void BKE_object_free_particlesystems(Object *ob)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	ParticleSystem *psys;
 | 
						ParticleSystem *psys;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -242,16 +242,6 @@ void BKE_scene_copy_data(Main *bmain, Scene *sce_dst, const Scene *sce_src, cons
 | 
				
			|||||||
	sce_dst->obedit = NULL;
 | 
						sce_dst->obedit = NULL;
 | 
				
			||||||
	sce_dst->fps_info = NULL;
 | 
						sce_dst->fps_info = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	BLI_duplicatelist(&(sce_dst->base), &(sce_src->base));
 | 
					 | 
				
			||||||
	for (BaseLegacy *base_dst = sce_dst->base.first, *base_src = sce_src->base.first;
 | 
					 | 
				
			||||||
	     base_dst;
 | 
					 | 
				
			||||||
	     base_dst = base_dst->next, base_src = base_src->next)
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		if (base_src == sce_src->basact) {
 | 
					 | 
				
			||||||
			sce_dst->basact = base_dst;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* layers and collections */
 | 
						/* layers and collections */
 | 
				
			||||||
	sce_dst->collection = MEM_dupallocN(sce_src->collection);
 | 
						sce_dst->collection = MEM_dupallocN(sce_src->collection);
 | 
				
			||||||
	SceneCollection *mc_src = BKE_collection_master(sce_src);
 | 
						SceneCollection *mc_src = BKE_collection_master(sce_src);
 | 
				
			||||||
@@ -590,7 +580,6 @@ void BKE_scene_free_ex(Scene *sce, const bool do_id_user)
 | 
				
			|||||||
	BKE_sequencer_clear_scene_in_allseqs(G.main, sce);
 | 
						BKE_sequencer_clear_scene_in_allseqs(G.main, sce);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sce->basact = NULL;
 | 
						sce->basact = NULL;
 | 
				
			||||||
	BLI_freelistN(&sce->base);
 | 
					 | 
				
			||||||
	BKE_sequencer_editing_free(sce);
 | 
						BKE_sequencer_editing_free(sce);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	BKE_keyingsets_free(&sce->keyingsets);
 | 
						BKE_keyingsets_free(&sce->keyingsets);
 | 
				
			||||||
@@ -1081,22 +1070,29 @@ Scene *BKE_scene_add(Main *bmain, const char *name)
 | 
				
			|||||||
	return sce;
 | 
						return sce;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
BaseLegacy *BKE_scene_base_find_by_name(struct Scene *scene, const char *name)
 | 
					/**
 | 
				
			||||||
 | 
					 * Check if there is any intance of the object in the scene
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					bool BKE_scene_object_find(Scene *scene, Object *ob)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	BaseLegacy *base;
 | 
						for (SceneLayer *scene_layer = scene->render_layers.first; scene_layer; scene_layer = scene_layer->next) {
 | 
				
			||||||
 | 
							if (BLI_findptr(&scene_layer->object_bases, ob, offsetof(Base, object))) {
 | 
				
			||||||
	for (base = scene->base.first; base; base = base->next) {
 | 
							    return true;
 | 
				
			||||||
		if (STREQ(base->object->id.name + 2, name)) {
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						return false;
 | 
				
			||||||
	return base;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
BaseLegacy *BKE_scene_base_find(Scene *scene, Object *ob)
 | 
					Object *BKE_scene_object_find_by_name(Scene *scene, const char *name)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return BLI_findptr(&scene->base, ob, offsetof(BaseLegacy, object));
 | 
						for (SceneLayer *scene_layer = scene->render_layers.first; scene_layer; scene_layer = scene_layer->next) {
 | 
				
			||||||
 | 
							for (Base *base = scene_layer->object_bases.first; base; base = base->next) {
 | 
				
			||||||
 | 
								if (STREQ(base->object->id.name + 2, name)) {
 | 
				
			||||||
 | 
									return base->object;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@@ -1106,7 +1102,6 @@ BaseLegacy *BKE_scene_base_find(Scene *scene, Object *ob)
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
void BKE_scene_set_background(Main *bmain, Scene *scene)
 | 
					void BKE_scene_set_background(Main *bmain, Scene *scene)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	BaseLegacy *base;
 | 
					 | 
				
			||||||
	Object *ob;
 | 
						Object *ob;
 | 
				
			||||||
	Group *group;
 | 
						Group *group;
 | 
				
			||||||
	GroupObject *go;
 | 
						GroupObject *go;
 | 
				
			||||||
@@ -1132,12 +1127,12 @@ void BKE_scene_set_background(Main *bmain, Scene *scene)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* copy layers and flags from bases to objects */
 | 
						/* copy layers and flags from bases to objects */
 | 
				
			||||||
	for (base = scene->base.first; base; base = base->next) {
 | 
						for (SceneLayer *scene_layer = scene->render_layers.first; scene_layer; scene_layer = scene_layer->next) {
 | 
				
			||||||
 | 
							for (Base *base = scene_layer->object_bases.first; base; base = base->next) {
 | 
				
			||||||
			ob = base->object;
 | 
								ob = base->object;
 | 
				
			||||||
		ob->lay = base->lay;
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
			/* group patch... */
 | 
								/* group patch... */
 | 
				
			||||||
		BKE_scene_base_flag_sync_from_base(base);
 | 
								BKE_scene_object_base_flag_sync_from_base(base);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	/* no full animation update, this to enable render code to work (render code calls own animation updates) */
 | 
						/* no full animation update, this to enable render code to work (render code calls own animation updates) */
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -1177,17 +1172,19 @@ int BKE_scene_base_iter_next(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			/* the first base */
 | 
								/* the first base */
 | 
				
			||||||
			if (iter->phase == F_START) {
 | 
								if (iter->phase == F_START) {
 | 
				
			||||||
				*base = (*scene)->base.first;
 | 
									SceneLayer *scene_layer = eval_ctx->scene_layer;
 | 
				
			||||||
 | 
									*base = scene_layer->object_bases.first;
 | 
				
			||||||
				if (*base) {
 | 
									if (*base) {
 | 
				
			||||||
					*ob = (*base)->object;
 | 
										*ob = (*base)->object;
 | 
				
			||||||
					iter->phase = F_SCENE;
 | 
										iter->phase = F_SCENE;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				else {
 | 
									else {
 | 
				
			||||||
					/* exception: empty scene */
 | 
										/* exception: empty scene layer */
 | 
				
			||||||
					while ((*scene)->set) {
 | 
										while ((*scene)->set) {
 | 
				
			||||||
						(*scene) = (*scene)->set;
 | 
											(*scene) = (*scene)->set;
 | 
				
			||||||
						if ((*scene)->base.first) {
 | 
											SceneLayer *scene_layer_set = BKE_scene_layer_from_scene_get((*scene));
 | 
				
			||||||
							*base = (*scene)->base.first;
 | 
											if (scene_layer_set->object_bases.first) {
 | 
				
			||||||
 | 
												*base = scene_layer_set->object_bases.first;
 | 
				
			||||||
							*ob = (*base)->object;
 | 
												*ob = (*base)->object;
 | 
				
			||||||
							iter->phase = F_SCENE;
 | 
												iter->phase = F_SCENE;
 | 
				
			||||||
							break;
 | 
												break;
 | 
				
			||||||
@@ -1206,8 +1203,9 @@ int BKE_scene_base_iter_next(
 | 
				
			|||||||
							/* (*scene) is finished, now do the set */
 | 
												/* (*scene) is finished, now do the set */
 | 
				
			||||||
							while ((*scene)->set) {
 | 
												while ((*scene)->set) {
 | 
				
			||||||
								(*scene) = (*scene)->set;
 | 
													(*scene) = (*scene)->set;
 | 
				
			||||||
								if ((*scene)->base.first) {
 | 
													SceneLayer *scene_layer_set = BKE_scene_layer_from_scene_get((*scene));
 | 
				
			||||||
									*base = (*scene)->base.first;
 | 
													if (scene_layer_set->object_bases.first) {
 | 
				
			||||||
 | 
														*base = scene_layer_set->object_bases.first;
 | 
				
			||||||
									*ob = (*base)->object;
 | 
														*ob = (*base)->object;
 | 
				
			||||||
									break;
 | 
														break;
 | 
				
			||||||
								}
 | 
													}
 | 
				
			||||||
@@ -1298,17 +1296,6 @@ Scene *BKE_scene_find_from_collection(const Main *bmain, const SceneCollection *
 | 
				
			|||||||
	return NULL;
 | 
						return NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Object *BKE_scene_camera_find(Scene *sc)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	BaseLegacy *base;
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	for (base = sc->base.first; base; base = base->next)
 | 
					 | 
				
			||||||
		if (base->object->type == OB_CAMERA)
 | 
					 | 
				
			||||||
			return base->object;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return NULL;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifdef DURIAN_CAMERA_SWITCH
 | 
					#ifdef DURIAN_CAMERA_SWITCH
 | 
				
			||||||
Object *BKE_scene_camera_switch_find(Scene *scene)
 | 
					Object *BKE_scene_camera_switch_find(Scene *scene)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -1412,48 +1399,6 @@ void BKE_scene_remove_rigidbody_object(Scene *scene, Object *ob)
 | 
				
			|||||||
		BKE_rigidbody_remove_object(scene, ob);
 | 
							BKE_rigidbody_remove_object(scene, ob);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
BaseLegacy *BKE_scene_base_add(Scene *sce, Object *ob)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	BaseLegacy *b = MEM_callocN(sizeof(*b), __func__);
 | 
					 | 
				
			||||||
	BLI_addhead(&sce->base, b);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	b->object = ob;
 | 
					 | 
				
			||||||
	b->flag_legacy = ob->flag;
 | 
					 | 
				
			||||||
	b->lay = ob->lay;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return b;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void BKE_scene_base_unlink(Scene *sce, BaseLegacy *base)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	BKE_scene_remove_rigidbody_object(sce, base->object);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	BLI_remlink(&sce->base, base);
 | 
					 | 
				
			||||||
	if (sce->basact == base)
 | 
					 | 
				
			||||||
		sce->basact = NULL;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* deprecated, use BKE_scene_layer_base_deselect_all */
 | 
					 | 
				
			||||||
void BKE_scene_base_deselect_all(Scene *sce)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	BaseLegacy *b;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	for (b = sce->base.first; b; b = b->next) {
 | 
					 | 
				
			||||||
		b->flag_legacy &= ~SELECT;
 | 
					 | 
				
			||||||
		int flag = b->object->flag & (OB_FROMGROUP);
 | 
					 | 
				
			||||||
		b->object->flag = b->flag_legacy;
 | 
					 | 
				
			||||||
		b->object->flag |= flag;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void BKE_scene_base_select(Scene *sce, BaseLegacy *selbase)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	selbase->flag_legacy |= SELECT;
 | 
					 | 
				
			||||||
	selbase->object->flag = selbase->flag_legacy;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	sce->basact = selbase;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* checks for cycle, returns 1 if it's all OK */
 | 
					/* checks for cycle, returns 1 if it's all OK */
 | 
				
			||||||
bool BKE_scene_validate_setscene(Main *bmain, Scene *sce)
 | 
					bool BKE_scene_validate_setscene(Main *bmain, Scene *sce)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -61,6 +61,7 @@
 | 
				
			|||||||
#include "BKE_movieclip.h"
 | 
					#include "BKE_movieclip.h"
 | 
				
			||||||
#include "BKE_object.h"
 | 
					#include "BKE_object.h"
 | 
				
			||||||
#include "BKE_scene.h"
 | 
					#include "BKE_scene.h"
 | 
				
			||||||
 | 
					#include "BKE_layer.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "IMB_imbuf_types.h"
 | 
					#include "IMB_imbuf_types.h"
 | 
				
			||||||
#include "IMB_imbuf.h"
 | 
					#include "IMB_imbuf.h"
 | 
				
			||||||
@@ -400,7 +401,7 @@ void BKE_tracking_get_camera_object_matrix(Scene *scene, Object *ob, float mat[4
 | 
				
			|||||||
		if (scene->camera)
 | 
							if (scene->camera)
 | 
				
			||||||
			ob = scene->camera;
 | 
								ob = scene->camera;
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			ob = BKE_scene_camera_find(scene);
 | 
								ob = BKE_scene_layer_camera_find(BKE_scene_layer_from_scene_get(scene));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (ob)
 | 
						if (ob)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5831,7 +5831,7 @@ static void lib_link_scene(FileData *fd, Main *main)
 | 
				
			|||||||
			
 | 
								
 | 
				
			||||||
			sce->toolsettings->particle.shape_object = newlibadr(fd, sce->id.lib, sce->toolsettings->particle.shape_object);
 | 
								sce->toolsettings->particle.shape_object = newlibadr(fd, sce->id.lib, sce->toolsettings->particle.shape_object);
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			for (BaseLegacy *base_legacy_next, *base_legacy = sce->base.first; base_legacy; base_legacy = base_legacy_next) {
 | 
								for (Base *base_legacy_next, *base_legacy = sce->base.first; base_legacy; base_legacy = base_legacy_next) {
 | 
				
			||||||
				base_legacy_next = base_legacy->next;
 | 
									base_legacy_next = base_legacy->next;
 | 
				
			||||||
				
 | 
									
 | 
				
			||||||
				base_legacy->object = newlibadr_us(fd, sce->id.lib, base_legacy->object);
 | 
									base_legacy->object = newlibadr_us(fd, sce->id.lib, base_legacy->object);
 | 
				
			||||||
@@ -9778,13 +9778,12 @@ static void expand_scene_collection(FileData *fd, Main *mainvar, SceneCollection
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static void expand_scene(FileData *fd, Main *mainvar, Scene *sce)
 | 
					static void expand_scene(FileData *fd, Main *mainvar, Scene *sce)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	BaseLegacy *base;
 | 
					 | 
				
			||||||
	SceneRenderLayer *srl;
 | 
						SceneRenderLayer *srl;
 | 
				
			||||||
	FreestyleModuleConfig *module;
 | 
						FreestyleModuleConfig *module;
 | 
				
			||||||
	FreestyleLineSet *lineset;
 | 
						FreestyleLineSet *lineset;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	for (base = sce->base.first; base; base = base->next) {
 | 
						for (Base *base_legacy = sce->base.first; base_legacy; base_legacy = base_legacy->next) {
 | 
				
			||||||
		expand_doit(fd, mainvar, base->object);
 | 
							expand_doit(fd, mainvar, base_legacy->object);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	expand_doit(fd, mainvar, sce->camera);
 | 
						expand_doit(fd, mainvar, sce->camera);
 | 
				
			||||||
	expand_doit(fd, mainvar, sce->world);
 | 
						expand_doit(fd, mainvar, sce->world);
 | 
				
			||||||
@@ -10108,7 +10107,7 @@ static bool object_in_any_scene(Main *mainvar, Object *ob)
 | 
				
			|||||||
	Scene *sce;
 | 
						Scene *sce;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	for (sce = mainvar->scene.first; sce; sce = sce->id.next) {
 | 
						for (sce = mainvar->scene.first; sce; sce = sce->id.next) {
 | 
				
			||||||
		if (BKE_scene_base_find(sce, ob)) {
 | 
							if (BKE_scene_object_find(sce, ob)) {
 | 
				
			||||||
			return true;
 | 
								return true;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -736,7 +736,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
 | 
				
			|||||||
	if (main->versionfile < 250) {
 | 
						if (main->versionfile < 250) {
 | 
				
			||||||
		bScreen *screen;
 | 
							bScreen *screen;
 | 
				
			||||||
		Scene *scene;
 | 
							Scene *scene;
 | 
				
			||||||
		BaseLegacy *base;
 | 
							Base *base;
 | 
				
			||||||
		Material *ma;
 | 
							Material *ma;
 | 
				
			||||||
		Camera *cam;
 | 
							Camera *cam;
 | 
				
			||||||
		Mesh *me;
 | 
							Mesh *me;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2604,10 +2604,6 @@ static void write_scene(WriteData *wd, Scene *sce)
 | 
				
			|||||||
	write_keyingsets(wd, &sce->keyingsets);
 | 
						write_keyingsets(wd, &sce->keyingsets);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* direct data */
 | 
						/* direct data */
 | 
				
			||||||
	for (BaseLegacy *base = sce->base.first; base; base = base->next) {
 | 
					 | 
				
			||||||
		writestruct(wd, DATA, BaseLegacy, 1, base);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	ToolSettings *tos = sce->toolsettings;
 | 
						ToolSettings *tos = sce->toolsettings;
 | 
				
			||||||
	writestruct(wd, DATA, ToolSettings, 1, tos);
 | 
						writestruct(wd, DATA, ToolSettings, 1, tos);
 | 
				
			||||||
	if (tos->vpaint) {
 | 
						if (tos->vpaint) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -59,6 +59,7 @@ extern "C" {
 | 
				
			|||||||
#include "BKE_camera.h"
 | 
					#include "BKE_camera.h"
 | 
				
			||||||
#include "BKE_collection.h"
 | 
					#include "BKE_collection.h"
 | 
				
			||||||
#include "BKE_main.h"
 | 
					#include "BKE_main.h"
 | 
				
			||||||
 | 
					#include "BKE_layer.h"
 | 
				
			||||||
#include "BKE_lamp.h"
 | 
					#include "BKE_lamp.h"
 | 
				
			||||||
#include "BKE_library.h"
 | 
					#include "BKE_library.h"
 | 
				
			||||||
#include "BKE_texture.h"
 | 
					#include "BKE_texture.h"
 | 
				
			||||||
@@ -133,7 +134,7 @@ bool DocumentImporter::import()
 | 
				
			|||||||
	loader.registerExtraDataCallbackHandler(ehandler);
 | 
						loader.registerExtraDataCallbackHandler(ehandler);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// deselect all to select new objects
 | 
						// deselect all to select new objects
 | 
				
			||||||
	BKE_scene_base_deselect_all(CTX_data_scene(mContext));
 | 
						BKE_scene_layer_base_deselect_all(CTX_data_scene_layer(mContext));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	std::string mFilename = std::string(this->import_settings->filepath);
 | 
						std::string mFilename = std::string(this->import_settings->filepath);
 | 
				
			||||||
	const std::string encodedFilename = bc_url_encode(mFilename);
 | 
						const std::string encodedFilename = bc_url_encode(mFilename);
 | 
				
			||||||
@@ -266,15 +267,7 @@ void DocumentImporter::finish()
 | 
				
			|||||||
		std::vector<Object *>::iterator it;
 | 
							std::vector<Object *>::iterator it;
 | 
				
			||||||
		for (it = libnode_ob.begin(); it != libnode_ob.end(); it++) {
 | 
							for (it = libnode_ob.begin(); it != libnode_ob.end(); it++) {
 | 
				
			||||||
			Object *ob = *it;
 | 
								Object *ob = *it;
 | 
				
			||||||
 | 
								BKE_collections_object_remove(G.main, sce, ob, true);
 | 
				
			||||||
			BaseLegacy *base = (BaseLegacy *)BKE_scene_base_find(sce, ob);
 | 
					 | 
				
			||||||
			if (base) {
 | 
					 | 
				
			||||||
				BLI_remlink(&sce->base, base);
 | 
					 | 
				
			||||||
				BKE_libblock_free_us(G.main, base->object);
 | 
					 | 
				
			||||||
				if (sce->basact == base)
 | 
					 | 
				
			||||||
					sce->basact = NULL;
 | 
					 | 
				
			||||||
				MEM_freeN(base);
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		libnode_ob.clear();
 | 
							libnode_ob.clear();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -44,6 +44,7 @@ extern "C" {
 | 
				
			|||||||
	#include "DNA_texture_types.h"
 | 
						#include "DNA_texture_types.h"
 | 
				
			||||||
	#include "DNA_world_types.h"
 | 
						#include "DNA_world_types.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						#include "BKE_collection.h"
 | 
				
			||||||
	#include "BKE_customdata.h"
 | 
						#include "BKE_customdata.h"
 | 
				
			||||||
	#include "BKE_mesh.h"
 | 
						#include "BKE_mesh.h"
 | 
				
			||||||
	#include "BKE_material.h"
 | 
						#include "BKE_material.h"
 | 
				
			||||||
@@ -66,10 +67,8 @@ EffectsExporter::EffectsExporter(COLLADASW::StreamWriter *sw, const ExportSettin
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
bool EffectsExporter::hasEffects(Scene *sce)
 | 
					bool EffectsExporter::hasEffects(Scene *sce)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	BaseLegacy *base = (BaseLegacy *)sce->base.first;
 | 
						FOREACH_SCENE_OBJECT(scene, ob)
 | 
				
			||||||
	
 | 
						{
 | 
				
			||||||
	while (base) {
 | 
					 | 
				
			||||||
		Object *ob = base->object;
 | 
					 | 
				
			||||||
		int a;
 | 
							int a;
 | 
				
			||||||
		for (a = 0; a < ob->totcol; a++) {
 | 
							for (a = 0; a < ob->totcol; a++) {
 | 
				
			||||||
			Material *ma = give_current_material(ob, a + 1);
 | 
								Material *ma = give_current_material(ob, a + 1);
 | 
				
			||||||
@@ -79,8 +78,8 @@ bool EffectsExporter::hasEffects(Scene *sce)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			return true;
 | 
								return true;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		base = base->next;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						FOREACH_SCENE_OBJECT_END
 | 
				
			||||||
	return false;
 | 
						return false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -47,6 +47,7 @@ extern "C" {
 | 
				
			|||||||
#include "BKE_customdata.h"
 | 
					#include "BKE_customdata.h"
 | 
				
			||||||
#include "BKE_object.h"
 | 
					#include "BKE_object.h"
 | 
				
			||||||
#include "BKE_global.h"
 | 
					#include "BKE_global.h"
 | 
				
			||||||
 | 
					#include "BKE_layer.h"
 | 
				
			||||||
#include "BKE_mesh.h"
 | 
					#include "BKE_mesh.h"
 | 
				
			||||||
#include "BKE_scene.h"
 | 
					#include "BKE_scene.h"
 | 
				
			||||||
#include "BKE_DerivedMesh.h"
 | 
					#include "BKE_DerivedMesh.h"
 | 
				
			||||||
@@ -142,7 +143,14 @@ Object *bc_add_object(Scene *scene, int type, const char *name)
 | 
				
			|||||||
	ob->lay = scene->lay;
 | 
						ob->lay = scene->lay;
 | 
				
			||||||
	DEG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
 | 
						DEG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	BKE_scene_base_select(scene, BKE_scene_base_add(scene, ob));
 | 
						/* XXX Collada should use the context scene layer, not the scene one. (dfelinto/gaia). */
 | 
				
			||||||
 | 
						SceneLayer *scene_layer = BKE_scene_layer_context_active_PLACEHOLDER(scene);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						LayerCollection *layer_collection = BKE_layer_collection_get_active_ensure(scene, scene_layer);
 | 
				
			||||||
 | 
						BKE_collection_object_add(scene, layer_collection->scene_collection, ob);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						Base *base = BKE_scene_layer_base_find(scene_layer, ob);
 | 
				
			||||||
 | 
						BKE_scene_layer_base_select(scene_layer, base);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return ob;
 | 
						return ob;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2684,6 +2684,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
 | 
				
			|||||||
		{
 | 
							{
 | 
				
			||||||
			bDopeSheet *ads = (bDopeSheet *)ac->data;
 | 
								bDopeSheet *ads = (bDopeSheet *)ac->data;
 | 
				
			||||||
			Scene *sce = (Scene *)ads->source;
 | 
								Scene *sce = (Scene *)ads->source;
 | 
				
			||||||
 | 
								SceneLayer *scene_layer = ac->scene_layer;
 | 
				
			||||||
			BaseLegacy *base = (BaseLegacy *)ale->data;
 | 
								BaseLegacy *base = (BaseLegacy *)ale->data;
 | 
				
			||||||
			Object *ob = base->object;
 | 
								Object *ob = base->object;
 | 
				
			||||||
			AnimData *adt = ob->adt;
 | 
								AnimData *adt = ob->adt;
 | 
				
			||||||
@@ -2691,30 +2692,30 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
 | 
				
			|||||||
			/* set selection status */
 | 
								/* set selection status */
 | 
				
			||||||
			if (selectmode == SELECT_INVERT) {
 | 
								if (selectmode == SELECT_INVERT) {
 | 
				
			||||||
				/* swap select */
 | 
									/* swap select */
 | 
				
			||||||
				base->flag_legacy ^= SELECT;
 | 
									ED_object_base_select(base, BA_INVERT);
 | 
				
			||||||
				BKE_scene_base_flag_sync_from_base(base);
 | 
									BKE_scene_object_base_flag_sync_from_base(base);
 | 
				
			||||||
				
 | 
									
 | 
				
			||||||
				if (adt) adt->flag ^= ADT_UI_SELECTED;
 | 
									if (adt) adt->flag ^= ADT_UI_SELECTED;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			else {
 | 
								else {
 | 
				
			||||||
				BaseLegacy *b;
 | 
									Base *b;
 | 
				
			||||||
				
 | 
									
 | 
				
			||||||
				/* deselect all */
 | 
									/* deselect all */
 | 
				
			||||||
				/* TODO: should this deselect all other types of channels too? */
 | 
									/* TODO: should this deselect all other types of channels too? */
 | 
				
			||||||
				for (b = sce->base.first; b; b = b->next) {
 | 
									for (b = scene_layer->object_bases.first; b; b = b->next) {
 | 
				
			||||||
					b->flag_legacy &= ~SELECT;
 | 
										ED_object_base_select(b, BA_DESELECT);
 | 
				
			||||||
					BKE_scene_base_flag_sync_from_base(b);
 | 
										BKE_scene_object_base_flag_sync_from_base(b);
 | 
				
			||||||
					if (b->object->adt) b->object->adt->flag &= ~(ADT_UI_SELECTED | ADT_UI_ACTIVE);
 | 
										if (b->object->adt) b->object->adt->flag &= ~(ADT_UI_SELECTED | ADT_UI_ACTIVE);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				
 | 
									
 | 
				
			||||||
				/* select object now */
 | 
									/* select object now */
 | 
				
			||||||
				base->flag_legacy |= SELECT;
 | 
									ED_object_base_select(base, BA_SELECT);
 | 
				
			||||||
				ob->flag |= SELECT;
 | 
									BKE_scene_object_base_flag_sync_from_base(base);
 | 
				
			||||||
				if (adt) adt->flag |= ADT_UI_SELECTED;
 | 
									if (adt) adt->flag |= ADT_UI_SELECTED;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			/* change active object - regardless of whether it is now selected [T37883] */
 | 
								/* change active object - regardless of whether it is now selected [T37883] */
 | 
				
			||||||
			ED_base_object_activate(C, base); /* adds notifier */
 | 
								ED_object_base_activate(C, base); /* adds notifier */
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			if ((adt) && (adt->flag & ADT_UI_SELECTED))
 | 
								if ((adt) && (adt->flag & ADT_UI_SELECTED))
 | 
				
			||||||
				adt->flag |= ADT_UI_ACTIVE;
 | 
									adt->flag |= ADT_UI_ACTIVE;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1143,13 +1143,13 @@ static int ed_marker_select(bContext *C, const wmEvent *event, bool extend, bool
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (camera) {
 | 
						if (camera) {
 | 
				
			||||||
		Scene *scene = CTX_data_scene(C);
 | 
							Scene *scene = CTX_data_scene(C);
 | 
				
			||||||
		SceneLayer *sl = CTX_data_scene_layer(C);
 | 
							SceneLayer *scene_layer = CTX_data_scene_layer(C);
 | 
				
			||||||
		Base *base;
 | 
							Base *base;
 | 
				
			||||||
		TimeMarker *marker;
 | 
							TimeMarker *marker;
 | 
				
			||||||
		int sel = 0;
 | 
							int sel = 0;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if (!extend)
 | 
							if (!extend)
 | 
				
			||||||
			BKE_scene_base_deselect_all(scene);
 | 
								BKE_scene_layer_base_deselect_all(scene_layer);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		for (marker = markers->first; marker; marker = marker->next) {
 | 
							for (marker = markers->first; marker; marker = marker->next) {
 | 
				
			||||||
			if (marker->frame == cfra) {
 | 
								if (marker->frame == cfra) {
 | 
				
			||||||
@@ -1161,7 +1161,7 @@ static int ed_marker_select(bContext *C, const wmEvent *event, bool extend, bool
 | 
				
			|||||||
		for (marker = markers->first; marker; marker = marker->next) {
 | 
							for (marker = markers->first; marker; marker = marker->next) {
 | 
				
			||||||
			if (marker->camera) {
 | 
								if (marker->camera) {
 | 
				
			||||||
				if (marker->frame == cfra) {
 | 
									if (marker->frame == cfra) {
 | 
				
			||||||
					base = BKE_scene_layer_base_find(sl, marker->camera);
 | 
										base = BKE_scene_layer_base_find(scene_layer, marker->camera);
 | 
				
			||||||
					if (base) {
 | 
										if (base) {
 | 
				
			||||||
						ED_object_base_select(base, sel);
 | 
											ED_object_base_select(base, sel);
 | 
				
			||||||
						if (sel)
 | 
											if (sel)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -83,6 +83,12 @@ typedef enum eParentType {
 | 
				
			|||||||
	PAR_VERTEX_TRI,
 | 
						PAR_VERTEX_TRI,
 | 
				
			||||||
} eParentType;
 | 
					} eParentType;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef enum eObjectSelect_Mode{
 | 
				
			||||||
 | 
						BA_DESELECT = 0,
 | 
				
			||||||
 | 
						BA_SELECT = 1,
 | 
				
			||||||
 | 
						BA_INVERT = 2,
 | 
				
			||||||
 | 
					} eObjectSelect_Mode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __RNA_TYPES_H__
 | 
					#ifdef __RNA_TYPES_H__
 | 
				
			||||||
extern struct EnumPropertyItem prop_clear_parent_types[];
 | 
					extern struct EnumPropertyItem prop_clear_parent_types[];
 | 
				
			||||||
extern struct EnumPropertyItem prop_make_parent_types[];
 | 
					extern struct EnumPropertyItem prop_make_parent_types[];
 | 
				
			||||||
@@ -104,7 +110,7 @@ void ED_base_object_select(struct BaseLegacy *base, short mode);
 | 
				
			|||||||
/* includes notifier */
 | 
					/* includes notifier */
 | 
				
			||||||
void ED_base_object_activate(struct bContext *C, struct BaseLegacy *base);
 | 
					void ED_base_object_activate(struct bContext *C, struct BaseLegacy *base);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ED_object_base_select(struct Base *base, short mode);
 | 
					void ED_object_base_select(struct Base *base, eObjectSelect_Mode mode);
 | 
				
			||||||
void ED_object_base_activate(struct bContext *C, struct Base *base);
 | 
					void ED_object_base_activate(struct bContext *C, struct Base *base);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ED_base_object_free_and_unlink(struct Main *bmain, struct Scene *scene, struct Object *ob);
 | 
					void ED_base_object_free_and_unlink(struct Main *bmain, struct Scene *scene, struct Object *ob);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -49,6 +49,7 @@ struct WorkSpace;
 | 
				
			|||||||
struct WorkSpaceInstanceHook;
 | 
					struct WorkSpaceInstanceHook;
 | 
				
			||||||
struct bContext;
 | 
					struct bContext;
 | 
				
			||||||
struct Scene;
 | 
					struct Scene;
 | 
				
			||||||
 | 
					struct SceneLayer;
 | 
				
			||||||
struct bScreen;
 | 
					struct bScreen;
 | 
				
			||||||
struct ARegion;
 | 
					struct ARegion;
 | 
				
			||||||
struct uiBlock;
 | 
					struct uiBlock;
 | 
				
			||||||
@@ -113,7 +114,10 @@ void    ED_screen_draw(struct wmWindow *win);
 | 
				
			|||||||
void    ED_screen_refresh(struct wmWindowManager *wm, struct wmWindow *win);
 | 
					void    ED_screen_refresh(struct wmWindowManager *wm, struct wmWindow *win);
 | 
				
			||||||
void    ED_screen_do_listen(struct bContext *C, struct wmNotifier *note);
 | 
					void    ED_screen_do_listen(struct bContext *C, struct wmNotifier *note);
 | 
				
			||||||
bool    ED_screen_change(struct bContext *C, struct bScreen *sc);
 | 
					bool    ED_screen_change(struct bContext *C, struct bScreen *sc);
 | 
				
			||||||
void    ED_screen_update_after_scene_change(const struct bScreen *screen, struct Scene *scene_new);
 | 
					void    ED_screen_update_after_scene_change(
 | 
				
			||||||
 | 
					        const struct bScreen *screen,
 | 
				
			||||||
 | 
					        struct Scene *scene_new,
 | 
				
			||||||
 | 
					        struct SceneLayer *scene_layer);
 | 
				
			||||||
void    ED_screen_set_subwinactive(struct bContext *C, const struct wmEvent *event);
 | 
					void    ED_screen_set_subwinactive(struct bContext *C, const struct wmEvent *event);
 | 
				
			||||||
void    ED_screen_exit(struct bContext *C, struct wmWindow *window, struct bScreen *screen);
 | 
					void    ED_screen_exit(struct bContext *C, struct wmWindow *window, struct bScreen *screen);
 | 
				
			||||||
void    ED_screen_animation_timer(struct bContext *C, int redraws, int refresh, int sync, int enable);
 | 
					void    ED_screen_animation_timer(struct bContext *C, int redraws, int refresh, int sync, int enable);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -40,6 +40,7 @@
 | 
				
			|||||||
#include "BLI_math_vector.h"
 | 
					#include "BLI_math_vector.h"
 | 
				
			||||||
#include "BLI_linklist.h"
 | 
					#include "BLI_linklist.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "BKE_layer.h"
 | 
				
			||||||
#include "BKE_library.h"
 | 
					#include "BKE_library.h"
 | 
				
			||||||
#include "BKE_context.h"
 | 
					#include "BKE_context.h"
 | 
				
			||||||
#include "BKE_mesh.h"
 | 
					#include "BKE_mesh.h"
 | 
				
			||||||
@@ -337,7 +338,7 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh,
 | 
				
			|||||||
	int i, j, k;
 | 
						int i, j, k;
 | 
				
			||||||
	unsigned short *v;
 | 
						unsigned short *v;
 | 
				
			||||||
	int face[3];
 | 
						int face[3];
 | 
				
			||||||
	Scene *scene = CTX_data_scene(C);
 | 
						SceneLayer *scene_layer = CTX_data_scene_layer(C);
 | 
				
			||||||
	Object *obedit;
 | 
						Object *obedit;
 | 
				
			||||||
	int createob = base == NULL;
 | 
						int createob = base == NULL;
 | 
				
			||||||
	int nverts, nmeshes, nvp;
 | 
						int nverts, nmeshes, nvp;
 | 
				
			||||||
@@ -355,8 +356,8 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh,
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	else {
 | 
						else {
 | 
				
			||||||
		obedit = base->object;
 | 
							obedit = base->object;
 | 
				
			||||||
		BKE_scene_base_deselect_all(scene);
 | 
							BKE_scene_layer_base_deselect_all(scene_layer);
 | 
				
			||||||
		BKE_scene_base_select(scene, base);
 | 
							BKE_scene_layer_base_select(scene_layer, base);
 | 
				
			||||||
		copy_v3_v3(obedit->loc, co);
 | 
							copy_v3_v3(obedit->loc, co);
 | 
				
			||||||
		copy_v3_v3(obedit->rot, rot);
 | 
							copy_v3_v3(obedit->rot, rot);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1665,11 +1665,12 @@ static void curvetomesh(EvaluationContext *eval_ctx, Main *bmain, Scene *scene,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static int convert_poll(bContext *C)
 | 
					static int convert_poll(bContext *C)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	Object *obact = CTX_data_active_object(C);
 | 
					 | 
				
			||||||
	Scene *scene = CTX_data_scene(C);
 | 
						Scene *scene = CTX_data_scene(C);
 | 
				
			||||||
 | 
						Base *base_act = CTX_data_active_base(C);
 | 
				
			||||||
 | 
						Object *obact = base_act ? base_act->object : NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return (!ID_IS_LINKED(scene) && obact && scene->obedit != obact &&
 | 
						return (!ID_IS_LINKED(scene) && obact && scene->obedit != obact &&
 | 
				
			||||||
	        (obact->flag & SELECT) && !ID_IS_LINKED(obact));
 | 
						        (base_act->flag & BASE_SELECTED) && !ID_IS_LINKED(obact));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Helper for convert_exec */
 | 
					/* Helper for convert_exec */
 | 
				
			||||||
@@ -1699,7 +1700,7 @@ static int convert_exec(bContext *C, wmOperator *op)
 | 
				
			|||||||
	SceneLayer *sl = CTX_data_scene_layer(C);
 | 
						SceneLayer *sl = CTX_data_scene_layer(C);
 | 
				
			||||||
	EvaluationContext eval_ctx;
 | 
						EvaluationContext eval_ctx;
 | 
				
			||||||
	Base *basen = NULL, *basact = NULL;
 | 
						Base *basen = NULL, *basact = NULL;
 | 
				
			||||||
	Object *ob, *ob1, *newob, *obact = CTX_data_active_object(C);
 | 
						Object *ob1, *newob, *obact = CTX_data_active_object(C);
 | 
				
			||||||
	DerivedMesh *dm;
 | 
						DerivedMesh *dm;
 | 
				
			||||||
	Curve *cu;
 | 
						Curve *cu;
 | 
				
			||||||
	Nurb *nu;
 | 
						Nurb *nu;
 | 
				
			||||||
@@ -1714,10 +1715,8 @@ static int convert_exec(bContext *C, wmOperator *op)
 | 
				
			|||||||
	/* don't forget multiple users! */
 | 
						/* don't forget multiple users! */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		BaseLegacy *base;
 | 
							FOREACH_SCENE_OBJECT(scene, ob)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
		for (base = scene->base.first; base; base = base->next) {
 | 
					 | 
				
			||||||
			ob = base->object;
 | 
					 | 
				
			||||||
			ob->flag &= ~OB_DONE;
 | 
								ob->flag &= ~OB_DONE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			/* flag data thats not been edited (only needed for !keep_original) */
 | 
								/* flag data thats not been edited (only needed for !keep_original) */
 | 
				
			||||||
@@ -1736,6 +1735,7 @@ static int convert_exec(bContext *C, wmOperator *op)
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							FOREACH_SCENE_OBJECT_END
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ListBase selected_editable_bases = CTX_data_collection_get(C, "selected_editable_bases");
 | 
						ListBase selected_editable_bases = CTX_data_collection_get(C, "selected_editable_bases");
 | 
				
			||||||
@@ -1745,8 +1745,8 @@ static int convert_exec(bContext *C, wmOperator *op)
 | 
				
			|||||||
	 * on other objects data masks too, see: T50950. */
 | 
						 * on other objects data masks too, see: T50950. */
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		for (CollectionPointerLink *link = selected_editable_bases.first; link; link = link->next) {
 | 
							for (CollectionPointerLink *link = selected_editable_bases.first; link; link = link->next) {
 | 
				
			||||||
			BaseLegacy *base = link->ptr.data;
 | 
								Base *base = link->ptr.data;
 | 
				
			||||||
			ob = base->object;
 | 
								Object *ob = base->object;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			/* The way object type conversion works currently (enforcing conversion of *all* objetcs using converted
 | 
								/* The way object type conversion works currently (enforcing conversion of *all* objetcs using converted
 | 
				
			||||||
			 * obdata, even some un-selected/hidden/inother scene ones, sounds totally bad to me.
 | 
								 * obdata, even some un-selected/hidden/inother scene ones, sounds totally bad to me.
 | 
				
			||||||
@@ -1770,8 +1770,8 @@ static int convert_exec(bContext *C, wmOperator *op)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (CollectionPointerLink *link = selected_editable_bases.first; link; link = link->next) {
 | 
						for (CollectionPointerLink *link = selected_editable_bases.first; link; link = link->next) {
 | 
				
			||||||
		BaseLegacy *base = link->ptr.data;
 | 
							Base *base = link->ptr.data;
 | 
				
			||||||
		ob = base->object;
 | 
							Object *ob = base->object;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (ob->flag & OB_DONE || !IS_TAGGED(ob->data)) {
 | 
							if (ob->flag & OB_DONE || !IS_TAGGED(ob->data)) {
 | 
				
			||||||
			if (ob->type != target) {
 | 
								if (ob->type != target) {
 | 
				
			||||||
@@ -1941,8 +1941,8 @@ static int convert_exec(bContext *C, wmOperator *op)
 | 
				
			|||||||
		else if (ob->type == OB_MBALL && target == OB_MESH) {
 | 
							else if (ob->type == OB_MBALL && target == OB_MESH) {
 | 
				
			||||||
			Object *baseob;
 | 
								Object *baseob;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			base->flag &= ~SELECT;
 | 
								base->flag &= ~BASE_SELECTED;
 | 
				
			||||||
			ob->flag &= ~SELECT;
 | 
								ob->base_flag &= ~BASE_SELECTED;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			baseob = BKE_mball_basis_find(scene, ob);
 | 
								baseob = BKE_mball_basis_find(scene, ob);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -2007,8 +2007,8 @@ static int convert_exec(bContext *C, wmOperator *op)
 | 
				
			|||||||
		if (mballConverted) {
 | 
							if (mballConverted) {
 | 
				
			||||||
			FOREACH_SCENE_OBJECT(scene, ob_mball)
 | 
								FOREACH_SCENE_OBJECT(scene, ob_mball)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				if (ob->type == OB_MBALL) {
 | 
									if (ob_mball->type == OB_MBALL) {
 | 
				
			||||||
					if (ob->flag & OB_DONE) {
 | 
										if (ob_mball->flag & OB_DONE) {
 | 
				
			||||||
						Object *ob_basis = NULL;
 | 
											Object *ob_basis = NULL;
 | 
				
			||||||
						if (BKE_mball_is_basis(ob_mball) ||
 | 
											if (BKE_mball_is_basis(ob_mball) ||
 | 
				
			||||||
						    ((ob_basis = BKE_mball_basis_find(scene, ob_mball)) && (ob_basis->flag & OB_DONE)))
 | 
											    ((ob_basis = BKE_mball_basis_find(scene, ob_mball)) && (ob_basis->flag & OB_DONE)))
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -355,7 +355,6 @@ static int make_proxy_exec(bContext *C, wmOperator *op)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (ob) {
 | 
						if (ob) {
 | 
				
			||||||
		Object *newob;
 | 
							Object *newob;
 | 
				
			||||||
		Base *newbase, *oldbase = BASACT_NEW(scene_layer);
 | 
					 | 
				
			||||||
		char name[MAX_ID_NAME + 4];
 | 
							char name[MAX_ID_NAME + 4];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		BLI_snprintf(name, sizeof(name), "%s_proxy", ((ID *)(gob ? gob : ob))->name + 2);
 | 
							BLI_snprintf(name, sizeof(name), "%s_proxy", ((ID *)(gob ? gob : ob))->name + 2);
 | 
				
			||||||
@@ -364,16 +363,6 @@ static int make_proxy_exec(bContext *C, wmOperator *op)
 | 
				
			|||||||
		newob = BKE_object_add_from(bmain, scene, scene_layer, OB_EMPTY, name, gob ? gob : ob);
 | 
							newob = BKE_object_add_from(bmain, scene, scene_layer, OB_EMPTY, name, gob ? gob : ob);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/* set layers OK */
 | 
							/* set layers OK */
 | 
				
			||||||
		newbase = BASACT_NEW(scene_layer);    /* BKE_object_add sets active... */
 | 
					 | 
				
			||||||
		newbase->lay = oldbase->lay;
 | 
					 | 
				
			||||||
		newob->lay = newbase->lay;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		/* remove base, leave user count of object, it gets linked in BKE_object_make_proxy */
 | 
					 | 
				
			||||||
		if (gob == NULL) {
 | 
					 | 
				
			||||||
			BKE_scene_base_unlink(scene, oldbase);
 | 
					 | 
				
			||||||
			MEM_freeN(oldbase);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		BKE_object_make_proxy(newob, ob, gob);
 | 
							BKE_object_make_proxy(newob, ob, gob);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/* Set back pointer immediately so dependency graph knows that this is
 | 
							/* Set back pointer immediately so dependency graph knows that this is
 | 
				
			||||||
@@ -2048,12 +2037,13 @@ void ED_object_single_users(Main *bmain, Scene *scene, const bool full, const bo
 | 
				
			|||||||
	{
 | 
						{
 | 
				
			||||||
		IDP_RelinkProperty(scene->id.properties);
 | 
							IDP_RelinkProperty(scene->id.properties);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		for (Base *base = scene->base.first; base; base = base->next) {
 | 
							FOREACH_SCENE_OBJECT(scene, ob)
 | 
				
			||||||
			Object *ob = base->object;
 | 
							{
 | 
				
			||||||
			if (!ID_IS_LINKED(ob)) {
 | 
								if (!ID_IS_LINKED(ob)) {
 | 
				
			||||||
				IDP_RelinkProperty(ob->id.properties);
 | 
									IDP_RelinkProperty(ob->id.properties);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							FOREACH_SCENE_OBJECT_END
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (scene->nodetree) {
 | 
							if (scene->nodetree) {
 | 
				
			||||||
			IDP_RelinkProperty(scene->nodetree->id.properties);
 | 
								IDP_RelinkProperty(scene->nodetree->id.properties);
 | 
				
			||||||
@@ -2236,15 +2226,15 @@ static int make_local_exec(bContext *C, wmOperator *op)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	/* Note: we (ab)use LIB_TAG_PRE_EXISTING to cherry pick which ID to make local... */
 | 
						/* Note: we (ab)use LIB_TAG_PRE_EXISTING to cherry pick which ID to make local... */
 | 
				
			||||||
	if (mode == MAKE_LOCAL_ALL) {
 | 
						if (mode == MAKE_LOCAL_ALL) {
 | 
				
			||||||
		SceneLayer *sl = CTX_data_scene_layer(C);
 | 
							SceneLayer *scene_layer = CTX_data_scene_layer(C);
 | 
				
			||||||
		SceneCollection *sc = CTX_data_scene_collection(C);
 | 
							SceneCollection *scene_collection = CTX_data_scene_collection(C);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		BKE_main_id_tag_all(bmain, LIB_TAG_PRE_EXISTING, false);
 | 
							BKE_main_id_tag_all(bmain, LIB_TAG_PRE_EXISTING, false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/* de-select so the user can differentiate newly instanced from existing objects */
 | 
							/* De-select so the user can differentiate newly instanced from existing objects. */
 | 
				
			||||||
		BKE_scene_base_deselect_all(scene);
 | 
							BKE_scene_layer_base_deselect_all(scene_layer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (make_local_all__instance_indirect_unused(bmain, scene, sl, sc)) {
 | 
							if (make_local_all__instance_indirect_unused(bmain, scene, scene_layer, scene_collection)) {
 | 
				
			||||||
			BKE_report(op->reports, RPT_INFO, "Orphan library objects added to the current scene to avoid loss");
 | 
								BKE_report(op->reports, RPT_INFO, "Orphan library objects added to the current scene to avoid loss");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -127,16 +127,25 @@ void ED_base_object_activate(bContext *C, BaseLegacy *base)
 | 
				
			|||||||
		WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, NULL);
 | 
							WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, NULL);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ED_object_base_select(Base *base, short mode)
 | 
					void ED_object_base_select(Base *base, eObjectSelect_Mode mode)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						if (mode == BA_INVERT) {
 | 
				
			||||||
 | 
							mode = (base->flag & BASE_SELECTED) != 0 ? BA_DESELECT : BA_SELECT;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (base) {
 | 
						if (base) {
 | 
				
			||||||
		if (mode == BA_SELECT) {
 | 
							switch (mode) {
 | 
				
			||||||
 | 
								case BA_SELECT:
 | 
				
			||||||
				if ((base->flag & BASE_SELECTABLED) != 0) {
 | 
									if ((base->flag & BASE_SELECTABLED) != 0) {
 | 
				
			||||||
					base->flag |= BASE_SELECTED;
 | 
										base->flag |= BASE_SELECTED;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
		}
 | 
									break;
 | 
				
			||||||
		else if (mode == BA_DESELECT) {
 | 
								case BA_DESELECT:
 | 
				
			||||||
				base->flag &= ~BASE_SELECTED;
 | 
									base->flag &= ~BASE_SELECTED;
 | 
				
			||||||
 | 
									break;
 | 
				
			||||||
 | 
								case BA_INVERT:
 | 
				
			||||||
 | 
									/* Never happens. */
 | 
				
			||||||
 | 
									break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -132,7 +132,7 @@ void ED_scene_changed_update(Main *bmain, bContext *C, Scene *scene_new, const b
 | 
				
			|||||||
	DEG_graph_relations_update(depsgraph, bmain, scene_new);
 | 
						DEG_graph_relations_update(depsgraph, bmain, scene_new);
 | 
				
			||||||
	DEG_on_visible_update(bmain, false);
 | 
						DEG_on_visible_update(bmain, false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ED_screen_update_after_scene_change(active_screen, scene_new);
 | 
						ED_screen_update_after_scene_change(active_screen, scene_new, layer_new);
 | 
				
			||||||
	ED_render_engine_changed(bmain);
 | 
						ED_render_engine_changed(bmain);
 | 
				
			||||||
	ED_update_for_newframe(bmain, scene_new, depsgraph);
 | 
						ED_update_for_newframe(bmain, scene_new, depsgraph);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -45,6 +45,7 @@
 | 
				
			|||||||
#include "BKE_icons.h"
 | 
					#include "BKE_icons.h"
 | 
				
			||||||
#include "BKE_image.h"
 | 
					#include "BKE_image.h"
 | 
				
			||||||
#include "BKE_global.h"
 | 
					#include "BKE_global.h"
 | 
				
			||||||
 | 
					#include "BKE_layer.h"
 | 
				
			||||||
#include "BKE_library.h"
 | 
					#include "BKE_library.h"
 | 
				
			||||||
#include "BKE_library_remap.h"
 | 
					#include "BKE_library_remap.h"
 | 
				
			||||||
#include "BKE_main.h"
 | 
					#include "BKE_main.h"
 | 
				
			||||||
@@ -1302,13 +1303,13 @@ bool ED_screen_change(bContext *C, bScreen *sc)
 | 
				
			|||||||
	return false;
 | 
						return false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void screen_set_3dview_camera(Scene *scene, ScrArea *sa, View3D *v3d)
 | 
					static void screen_set_3dview_camera(Scene *scene, SceneLayer *scene_layer, ScrArea *sa, View3D *v3d)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	/* fix any cameras that are used in the 3d view but not in the scene */
 | 
						/* fix any cameras that are used in the 3d view but not in the scene */
 | 
				
			||||||
	BKE_screen_view3d_sync(v3d, scene);
 | 
						BKE_screen_view3d_sync(v3d, scene);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!v3d->camera || !BKE_scene_base_find(scene, v3d->camera)) {
 | 
						if (!v3d->camera || !BKE_scene_layer_base_find(scene_layer, v3d->camera)) {
 | 
				
			||||||
		v3d->camera = BKE_scene_camera_find(scene);
 | 
							v3d->camera = BKE_scene_layer_camera_find(scene_layer);
 | 
				
			||||||
		// XXX if (sc == curscreen) handle_view3d_lock();
 | 
							// XXX if (sc == curscreen) handle_view3d_lock();
 | 
				
			||||||
		if (!v3d->camera) {
 | 
							if (!v3d->camera) {
 | 
				
			||||||
			ARegion *ar;
 | 
								ARegion *ar;
 | 
				
			||||||
@@ -1332,13 +1333,13 @@ static void screen_set_3dview_camera(Scene *scene, ScrArea *sa, View3D *v3d)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ED_screen_update_after_scene_change(const bScreen *screen, Scene *scene_new)
 | 
					void ED_screen_update_after_scene_change(const bScreen *screen, Scene *scene_new, SceneLayer *scene_layer)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
 | 
						for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
 | 
				
			||||||
		for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
 | 
							for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
 | 
				
			||||||
			if (sl->spacetype == SPACE_VIEW3D) {
 | 
								if (sl->spacetype == SPACE_VIEW3D) {
 | 
				
			||||||
				View3D *v3d = (View3D *)sl;
 | 
									View3D *v3d = (View3D *)sl;
 | 
				
			||||||
				screen_set_3dview_camera(scene_new, sa, v3d);
 | 
									screen_set_3dview_camera(scene_new, scene_layer, sa, v3d);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -124,9 +124,8 @@ static int mouse_nla_channels(bContext *C, bAnimContext *ac, float x, int channe
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		case ANIMTYPE_OBJECT:
 | 
							case ANIMTYPE_OBJECT:
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			bDopeSheet *ads = (bDopeSheet *)ac->data;
 | 
								SceneLayer *scene_layer = ac->scene_layer;
 | 
				
			||||||
			Scene *sce = (Scene *)ads->source;
 | 
								Base *base = (Base *)ale->data;
 | 
				
			||||||
			BaseLegacy *base = (BaseLegacy *)ale->data;
 | 
					 | 
				
			||||||
			Object *ob = base->object;
 | 
								Object *ob = base->object;
 | 
				
			||||||
			AnimData *adt = ob->adt;
 | 
								AnimData *adt = ob->adt;
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
@@ -134,30 +133,28 @@ static int mouse_nla_channels(bContext *C, bAnimContext *ac, float x, int channe
 | 
				
			|||||||
				/* set selection status */
 | 
									/* set selection status */
 | 
				
			||||||
				if (selectmode == SELECT_INVERT) {
 | 
									if (selectmode == SELECT_INVERT) {
 | 
				
			||||||
					/* swap select */
 | 
										/* swap select */
 | 
				
			||||||
					base->flag_legacy ^= SELECT;
 | 
										ED_object_base_select(base, BA_INVERT);
 | 
				
			||||||
					BKE_scene_base_flag_sync_from_base(base);
 | 
										BKE_scene_object_base_flag_sync_from_base(base);
 | 
				
			||||||
					
 | 
										
 | 
				
			||||||
					if (adt) adt->flag ^= ADT_UI_SELECTED;
 | 
										if (adt) adt->flag ^= ADT_UI_SELECTED;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				else {
 | 
									else {
 | 
				
			||||||
					BaseLegacy *b;
 | 
					 | 
				
			||||||
					
 | 
					 | 
				
			||||||
					/* deselect all */
 | 
										/* deselect all */
 | 
				
			||||||
					/* TODO: should this deselect all other types of channels too? */
 | 
										/* TODO: should this deselect all other types of channels too? */
 | 
				
			||||||
					for (b = sce->base.first; b; b = b->next) {
 | 
										for (Base *b = scene_layer->object_bases.first; b; b = b->next) {
 | 
				
			||||||
						b->flag_legacy &= ~SELECT;
 | 
											ED_object_base_select(b, BA_DESELECT);
 | 
				
			||||||
						BKE_scene_base_flag_sync_from_base(b);
 | 
											BKE_scene_object_base_flag_sync_from_base(b);
 | 
				
			||||||
						if (b->object->adt) b->object->adt->flag &= ~(ADT_UI_SELECTED | ADT_UI_ACTIVE);
 | 
											if (b->object->adt) b->object->adt->flag &= ~(ADT_UI_SELECTED | ADT_UI_ACTIVE);
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					
 | 
										
 | 
				
			||||||
					/* select object now */
 | 
										/* select object now */
 | 
				
			||||||
					base->flag_legacy |= SELECT;
 | 
										ED_object_base_select(base, BA_SELECT);
 | 
				
			||||||
					ob->flag |= SELECT;
 | 
										BKE_scene_object_base_flag_sync_from_base(base);
 | 
				
			||||||
					if (adt) adt->flag |= ADT_UI_SELECTED;
 | 
										if (adt) adt->flag |= ADT_UI_SELECTED;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				
 | 
									
 | 
				
			||||||
				/* change active object - regardless of whether it is now selected [T37883] */
 | 
									/* change active object - regardless of whether it is now selected [T37883] */
 | 
				
			||||||
				ED_base_object_activate(C, base); /* adds notifier */
 | 
									ED_object_base_activate(C, base); /* adds notifier */
 | 
				
			||||||
				
 | 
									
 | 
				
			||||||
				if ((adt) && (adt->flag & ADT_UI_SELECTED))
 | 
									if ((adt) && (adt->flag & ADT_UI_SELECTED))
 | 
				
			||||||
					adt->flag |= ADT_UI_ACTIVE;
 | 
										adt->flag |= ADT_UI_ACTIVE;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,6 +39,7 @@
 | 
				
			|||||||
#include "BLI_mempool.h"
 | 
					#include "BLI_mempool.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "BKE_context.h"
 | 
					#include "BKE_context.h"
 | 
				
			||||||
 | 
					#include "BKE_layer.h"
 | 
				
			||||||
#include "BKE_screen.h"
 | 
					#include "BKE_screen.h"
 | 
				
			||||||
#include "BKE_scene.h"
 | 
					#include "BKE_scene.h"
 | 
				
			||||||
#include "BKE_outliner_treehash.h"
 | 
					#include "BKE_outliner_treehash.h"
 | 
				
			||||||
@@ -122,8 +123,17 @@ static int outliner_parent_drop_poll(bContext *C, wmDrag *drag, const wmEvent *e
 | 
				
			|||||||
				 * element for object it means that all displayed objects belong to
 | 
									 * element for object it means that all displayed objects belong to
 | 
				
			||||||
				 * active scene and parenting them is allowed (sergey)
 | 
									 * active scene and parenting them is allowed (sergey)
 | 
				
			||||||
				 */
 | 
									 */
 | 
				
			||||||
				if (!scene || BKE_scene_base_find(scene, (Object *)id)) {
 | 
									if (!scene) {
 | 
				
			||||||
					return 1;
 | 
										return 1;
 | 
				
			||||||
 | 
									} else {
 | 
				
			||||||
 | 
										for (SceneLayer *scene_layer = scene->render_layers.first;
 | 
				
			||||||
 | 
										     scene_layer;
 | 
				
			||||||
 | 
										     scene_layer = scene_layer->next)
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
											if (BKE_scene_layer_base_find(scene_layer, (Object *)id)) {
 | 
				
			||||||
 | 
												return 1;
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			else if (ELEM(tselem->type, TSE_LAYER_COLLECTION, TSE_SCENE_COLLECTION)) {
 | 
								else if (ELEM(tselem->type, TSE_LAYER_COLLECTION, TSE_SCENE_COLLECTION)) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -787,24 +787,13 @@ static void *view3d_main_region_duplicate(void *poin)
 | 
				
			|||||||
	return NULL;
 | 
						return NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void view3d_recalc_used_layers(ARegion *ar, wmNotifier *wmn, const Scene *scene)
 | 
					static void view3d_recalc_used_layers(ARegion *ar, wmNotifier *wmn, const Scene *UNUSED(scene))
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	wmWindow *win = wmn->wm->winactive;
 | 
						wmWindow *win = wmn->wm->winactive;
 | 
				
			||||||
	unsigned int lay_used = 0;
 | 
						unsigned int lay_used = 0;
 | 
				
			||||||
	BaseLegacy *base;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!win) return;
 | 
						if (!win) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	base = scene->base.first;
 | 
					 | 
				
			||||||
	while (base) {
 | 
					 | 
				
			||||||
		lay_used |= base->lay & ((1 << 20) - 1); /* ignore localview */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if (lay_used == (1 << 20) - 1)
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		base = base->next;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	const bScreen *screen = WM_window_get_active_screen(win);
 | 
						const bScreen *screen = WM_window_get_active_screen(win);
 | 
				
			||||||
	for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
 | 
						for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
 | 
				
			||||||
		if (sa->spacetype == SPACE_VIEW3D) {
 | 
							if (sa->spacetype == SPACE_VIEW3D) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -52,6 +52,7 @@
 | 
				
			|||||||
#include "BKE_camera.h"
 | 
					#include "BKE_camera.h"
 | 
				
			||||||
#include "BKE_context.h"
 | 
					#include "BKE_context.h"
 | 
				
			||||||
#include "BKE_font.h"
 | 
					#include "BKE_font.h"
 | 
				
			||||||
 | 
					#include "BKE_layer.h"
 | 
				
			||||||
#include "BKE_library.h"
 | 
					#include "BKE_library.h"
 | 
				
			||||||
#include "BKE_object.h"
 | 
					#include "BKE_object.h"
 | 
				
			||||||
#include "BKE_paint.h"
 | 
					#include "BKE_paint.h"
 | 
				
			||||||
@@ -3914,7 +3915,7 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
 | 
				
			|||||||
	ARegion *ar;
 | 
						ARegion *ar;
 | 
				
			||||||
	RegionView3D *rv3d;
 | 
						RegionView3D *rv3d;
 | 
				
			||||||
	Scene *scene = CTX_data_scene(C);
 | 
						Scene *scene = CTX_data_scene(C);
 | 
				
			||||||
	SceneLayer *sl = CTX_data_scene_layer(C);
 | 
						SceneLayer *scene_layer = CTX_data_scene_layer(C);
 | 
				
			||||||
	static int perspo = RV3D_PERSP;
 | 
						static int perspo = RV3D_PERSP;
 | 
				
			||||||
	int viewnum, nextperspo;
 | 
						int viewnum, nextperspo;
 | 
				
			||||||
	bool align_active;
 | 
						bool align_active;
 | 
				
			||||||
@@ -3949,7 +3950,7 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
 | 
				
			|||||||
			/* lastview -  */
 | 
								/* lastview -  */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (rv3d->persp != RV3D_CAMOB) {
 | 
								if (rv3d->persp != RV3D_CAMOB) {
 | 
				
			||||||
				Object *ob = OBACT_NEW(sl);
 | 
									Object *ob = OBACT_NEW(scene_layer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (!rv3d->smooth_timer) {
 | 
									if (!rv3d->smooth_timer) {
 | 
				
			||||||
					/* store settings of current view before allowing overwriting with camera view
 | 
										/* store settings of current view before allowing overwriting with camera view
 | 
				
			||||||
@@ -3984,7 +3985,7 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
 | 
				
			|||||||
					v3d->camera = ob;
 | 
										v3d->camera = ob;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (v3d->camera == NULL)
 | 
									if (v3d->camera == NULL)
 | 
				
			||||||
					v3d->camera = BKE_scene_camera_find(scene);
 | 
										v3d->camera = BKE_scene_layer_camera_find(scene_layer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				/* couldnt find any useful camera, bail out */
 | 
									/* couldnt find any useful camera, bail out */
 | 
				
			||||||
				if (v3d->camera == NULL)
 | 
									if (v3d->camera == NULL)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -209,7 +209,6 @@ BlenderStrokeRenderer::~BlenderStrokeRenderer()
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	FOREACH_SCENE_COLLECTION_END
 | 
						FOREACH_SCENE_COLLECTION_END
 | 
				
			||||||
	BLI_freelistN(&scene_layer->object_bases);
 | 
						BLI_freelistN(&scene_layer->object_bases);
 | 
				
			||||||
	BLI_freelistN(&freestyle_scene->base);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// release materials
 | 
						// release materials
 | 
				
			||||||
	Link *lnk = (Link *)freestyle_bmain->mat.first;
 | 
						Link *lnk = (Link *)freestyle_bmain->mat.first;
 | 
				
			||||||
@@ -951,8 +950,6 @@ Object *BlenderStrokeRenderer::NewMesh() const
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	SceneCollection *sc_master = BKE_collection_master(freestyle_scene);
 | 
						SceneCollection *sc_master = BKE_collection_master(freestyle_scene);
 | 
				
			||||||
	BKE_collection_object_add(freestyle_scene, sc_master, ob);
 | 
						BKE_collection_object_add(freestyle_scene, sc_master, ob);
 | 
				
			||||||
 | 
					 | 
				
			||||||
	BKE_scene_base_add(freestyle_scene, ob);
 | 
					 | 
				
			||||||
	DEG_graph_tag_relations_update(freestyle_depsgraph);
 | 
						DEG_graph_tag_relations_update(freestyle_depsgraph);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	DEG_graph_id_tag_update(freestyle_bmain,
 | 
						DEG_graph_id_tag_update(freestyle_bmain,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -543,12 +543,6 @@ enum {
 | 
				
			|||||||
#define BA_TRANSFORM_CHILD  (1 << 8)  /* child of a transformed object */
 | 
					#define BA_TRANSFORM_CHILD  (1 << 8)  /* child of a transformed object */
 | 
				
			||||||
#define BA_TRANSFORM_PARENT (1 << 13)  /* parent of a transformed object */
 | 
					#define BA_TRANSFORM_PARENT (1 << 13)  /* parent of a transformed object */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
/* an initial attempt as making selection more specific! */
 | 
					 | 
				
			||||||
#define BA_DESELECT     0
 | 
					 | 
				
			||||||
#define BA_SELECT       1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define OB_FROMDUPLI        (1 << 9)
 | 
					#define OB_FROMDUPLI        (1 << 9)
 | 
				
			||||||
#define OB_DONE             (1 << 10)  /* unknown state, clear before use */
 | 
					#define OB_DONE             (1 << 10)  /* unknown state, clear before use */
 | 
				
			||||||
/* #define OB_RADIO            (1 << 11) */  /* deprecated */
 | 
					/* #define OB_RADIO            (1 << 11) */  /* deprecated */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1614,7 +1614,7 @@ typedef struct Scene {
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	struct Scene *set;
 | 
						struct Scene *set;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	ListBase base;
 | 
						ListBase base DNA_DEPRECATED;
 | 
				
			||||||
	struct BaseLegacy *basact;		/* active base */
 | 
						struct BaseLegacy *basact;		/* active base */
 | 
				
			||||||
	struct Object *obedit;		/* name replaces old G.obedit */
 | 
						struct Object *obedit;		/* name replaces old G.obedit */
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -57,6 +57,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "BLI_sys_types.h" /* needed for intptr_t used in ED_mesh.h */
 | 
					#include "BLI_sys_types.h" /* needed for intptr_t used in ED_mesh.h */
 | 
				
			||||||
#include "ED_mesh.h"
 | 
					#include "ED_mesh.h"
 | 
				
			||||||
 | 
					#include "ED_object.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "WM_api.h"
 | 
					#include "WM_api.h"
 | 
				
			||||||
#include "WM_types.h"
 | 
					#include "WM_types.h"
 | 
				
			||||||
@@ -311,61 +312,6 @@ static void rna_Object_dependency_update(Main *bmain, Scene *UNUSED(scene), Poin
 | 
				
			|||||||
	WM_main_add_notifier(NC_OBJECT | ND_PARENT, ptr->id.data);
 | 
						WM_main_add_notifier(NC_OBJECT | ND_PARENT, ptr->id.data);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* when changing the selection flag the scene needs updating */
 | 
					 | 
				
			||||||
static void rna_Base_select_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	BaseLegacy *base = (BaseLegacy *)ptr->data;
 | 
					 | 
				
			||||||
	short mode = (base->flag_legacy & BA_SELECT) ? BA_SELECT : BA_DESELECT;
 | 
					 | 
				
			||||||
	ED_base_object_select(base, mode);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void rna_Object_layer_update__internal(Main *bmain, Scene *scene, BaseLegacy *base, Object *ob)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	/* try to avoid scene sort */
 | 
					 | 
				
			||||||
	if (scene == NULL) {
 | 
					 | 
				
			||||||
		/* pass - unlikely but when running scripts on startup it happens */
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	else if ((ob->lay & scene->lay) && (base->lay & scene->lay)) {
 | 
					 | 
				
			||||||
		/* pass */
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	else if ((ob->lay & scene->lay) == 0 && (base->lay & scene->lay) == 0) {
 | 
					 | 
				
			||||||
		/* pass */
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	else {
 | 
					 | 
				
			||||||
		DEG_relations_tag_update(bmain);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	DEG_id_type_tag(bmain, ID_OB);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void rna_Object_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	Object *ob = (Object *)ptr->id.data;
 | 
					 | 
				
			||||||
	BaseLegacy *base;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	base = scene ? BKE_scene_base_find(scene, ob) : NULL;
 | 
					 | 
				
			||||||
	if (!base)
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	SWAP(unsigned int, base->lay, ob->lay);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	rna_Object_layer_update__internal(bmain, scene, base, ob);
 | 
					 | 
				
			||||||
	ob->lay = base->lay;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, scene);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void rna_Base_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	BaseLegacy *base = (BaseLegacy *)ptr->data;
 | 
					 | 
				
			||||||
	Object *ob = (Object *)base->object;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	rna_Object_layer_update__internal(bmain, scene, base, ob);
 | 
					 | 
				
			||||||
	ob->lay = base->lay;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, scene);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value)
 | 
					static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	Object *ob = (Object *)ptr->data;
 | 
						Object *ob = (Object *)ptr->data;
 | 
				
			||||||
@@ -1200,49 +1146,6 @@ static PointerRNA rna_Object_game_settings_get(PointerRNA *ptr)
 | 
				
			|||||||
	return rna_pointer_inherit_refine(ptr, &RNA_GameObjectSettings, ptr->id.data);
 | 
						return rna_pointer_inherit_refine(ptr, &RNA_GameObjectSettings, ptr->id.data);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
static unsigned int rna_Object_layer_validate__internal(const int *values, unsigned int lay)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	int i, tot = 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* ensure we always have some layer selected */
 | 
					 | 
				
			||||||
	for (i = 0; i < 20; i++)
 | 
					 | 
				
			||||||
		if (values[i])
 | 
					 | 
				
			||||||
			tot++;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (tot == 0)
 | 
					 | 
				
			||||||
		return 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	for (i = 0; i < 20; i++) {
 | 
					 | 
				
			||||||
		if (values[i]) lay |=  (1 << i);
 | 
					 | 
				
			||||||
		else           lay &= ~(1 << i);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return lay;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void rna_Object_layer_set(PointerRNA *ptr, const int *values)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	Object *ob = (Object *)ptr->data;
 | 
					 | 
				
			||||||
	unsigned int lay;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	lay = rna_Object_layer_validate__internal(values, ob->lay);
 | 
					 | 
				
			||||||
	if (lay)
 | 
					 | 
				
			||||||
		ob->lay = lay;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void rna_Base_layer_set(PointerRNA *ptr, const int *values)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	BaseLegacy *base = (BaseLegacy *)ptr->data;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	unsigned int lay;
 | 
					 | 
				
			||||||
	lay = rna_Object_layer_validate__internal(values, base->lay);
 | 
					 | 
				
			||||||
	if (lay)
 | 
					 | 
				
			||||||
		base->lay = lay;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* rna_Base_layer_update updates the objects layer */
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void rna_GameObjectSettings_state_get(PointerRNA *ptr, int *values)
 | 
					static void rna_GameObjectSettings_state_get(PointerRNA *ptr, int *values)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	Object *ob = (Object *)ptr->data;
 | 
						Object *ob = (Object *)ptr->data;
 | 
				
			||||||
@@ -2502,15 +2405,6 @@ static void rna_def_object(BlenderRNA *brna)
 | 
				
			|||||||
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 | 
						RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 | 
				
			||||||
	RNA_def_property_ui_text(prop, "Mode", "Object interaction mode");
 | 
						RNA_def_property_ui_text(prop, "Mode", "Object interaction mode");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
 | 
					 | 
				
			||||||
	RNA_def_property_boolean_sdna(prop, NULL, "lay", 1);
 | 
					 | 
				
			||||||
	RNA_def_property_array(prop, 20);
 | 
					 | 
				
			||||||
	RNA_def_property_ui_text(prop, "Layers", "Layers the object is on");
 | 
					 | 
				
			||||||
	RNA_def_property_boolean_funcs(prop, NULL, "rna_Object_layer_set");
 | 
					 | 
				
			||||||
	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
 | 
					 | 
				
			||||||
	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_layer_update");
 | 
					 | 
				
			||||||
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	prop = RNA_def_property(srna, "layers_local_view", PROP_BOOLEAN, PROP_LAYER_MEMBER);
 | 
						prop = RNA_def_property(srna, "layers_local_view", PROP_BOOLEAN, PROP_LAYER_MEMBER);
 | 
				
			||||||
	RNA_def_property_boolean_sdna(prop, NULL, "lay", 0x01000000);
 | 
						RNA_def_property_boolean_sdna(prop, NULL, "lay", 0x01000000);
 | 
				
			||||||
	RNA_def_property_array(prop, 8);
 | 
						RNA_def_property_array(prop, 8);
 | 
				
			||||||
@@ -3186,49 +3080,12 @@ static void rna_def_dupli_object(BlenderRNA *brna)
 | 
				
			|||||||
	RNA_def_property_ui_text(prop, "Dupli random id", "Random id for this dupli object");
 | 
						RNA_def_property_ui_text(prop, "Dupli random id", "Random id for this dupli object");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void rna_def_object_base_legacy(BlenderRNA *brna)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	StructRNA *srna;
 | 
					 | 
				
			||||||
	PropertyRNA *prop;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	srna = RNA_def_struct(brna, "ObjectBaseLegacy", NULL);
 | 
					 | 
				
			||||||
	RNA_def_struct_sdna(srna, "Base");
 | 
					 | 
				
			||||||
	RNA_def_struct_ui_text(srna, "Object Base Legacy", "An object instance in a scene (deprecated)");
 | 
					 | 
				
			||||||
	RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
 | 
					 | 
				
			||||||
	RNA_def_property_pointer_sdna(prop, NULL, "object");
 | 
					 | 
				
			||||||
	RNA_def_property_ui_text(prop, "Object", "Object this base links to");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* same as object layer */
 | 
					 | 
				
			||||||
	prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
 | 
					 | 
				
			||||||
	RNA_def_property_boolean_sdna(prop, NULL, "lay", 1);
 | 
					 | 
				
			||||||
	RNA_def_property_array(prop, 20);
 | 
					 | 
				
			||||||
	RNA_def_property_ui_text(prop, "Layers", "Layers the object base is on");
 | 
					 | 
				
			||||||
	RNA_def_property_boolean_funcs(prop, NULL, "rna_Base_layer_set");
 | 
					 | 
				
			||||||
	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Base_layer_update");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	prop = RNA_def_property(srna, "layers_local_view", PROP_BOOLEAN, PROP_LAYER_MEMBER);
 | 
					 | 
				
			||||||
	RNA_def_property_boolean_sdna(prop, NULL, "lay", 0x01000000);
 | 
					 | 
				
			||||||
	RNA_def_property_array(prop, 8);
 | 
					 | 
				
			||||||
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 | 
					 | 
				
			||||||
	RNA_def_property_ui_text(prop, "Local View Layers", "3D local view layers the object base is on");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
 | 
					 | 
				
			||||||
	RNA_def_property_boolean_sdna(prop, NULL, "flag_legacy", BA_SELECT);
 | 
					 | 
				
			||||||
	RNA_def_property_ui_text(prop, "Select", "Object base selection state");
 | 
					 | 
				
			||||||
	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Base_select_update");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	RNA_api_object_base_legacy(srna);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void RNA_def_object(BlenderRNA *brna)
 | 
					void RNA_def_object(BlenderRNA *brna)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	rna_def_object(brna);
 | 
						rna_def_object(brna);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	RNA_define_animate_sdna(false);
 | 
						RNA_define_animate_sdna(false);
 | 
				
			||||||
	rna_def_object_game_settings(brna);
 | 
						rna_def_object_game_settings(brna);
 | 
				
			||||||
	rna_def_object_base_legacy(brna);
 | 
					 | 
				
			||||||
	rna_def_vertex_group(brna);
 | 
						rna_def_vertex_group(brna);
 | 
				
			||||||
	rna_def_face_map(brna);
 | 
						rna_def_face_map(brna);
 | 
				
			||||||
	rna_def_material_slot(brna);
 | 
						rna_def_material_slot(brna);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -476,13 +476,6 @@ finally:
 | 
				
			|||||||
	free_bvhtree_from_mesh(&treeData);
 | 
						free_bvhtree_from_mesh(&treeData);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* ObjectBaseLegacy */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void rna_ObjectBaseLegacy_layers_from_view(BaseLegacy *base, View3D *v3d)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	base->lay = base->object->lay = v3d->lay;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static int rna_Object_is_modified(Object *ob, Scene *scene, int settings)
 | 
					static int rna_Object_is_modified(Object *ob, Scene *scene, int settings)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return BKE_object_is_modified(scene, ob) & settings;
 | 
						return BKE_object_is_modified(scene, ob) & settings;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -618,86 +618,38 @@ static void rna_SpaceImageEditor_uv_sculpt_update(Main *bmain, Scene *scene, Poi
 | 
				
			|||||||
	ED_space_image_uv_sculpt_update(bmain->wm.first, scene);
 | 
						ED_space_image_uv_sculpt_update(bmain->wm.first, scene);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int rna_Scene_object_bases_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)
 | 
					
 | 
				
			||||||
 | 
					/* Read-only Iterator of all the scene objects. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void rna_Scene_objects_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	Scene *scene = (Scene *)ptr->data;
 | 
						Scene *scene = (Scene *)ptr->data;
 | 
				
			||||||
	BaseLegacy *base;
 | 
						iter->internal.custom = MEM_callocN(sizeof(BLI_Iterator), __func__);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (base = scene->base.first; base; base = base->next) {
 | 
						((BLI_Iterator *)iter->internal.custom)->valid = true;
 | 
				
			||||||
		if (STREQLEN(base->object->id.name + 2, key, sizeof(base->object->id.name) - 2)) {
 | 
						BKE_scene_objects_iterator_begin(iter->internal.custom, (void *)scene);
 | 
				
			||||||
			*r_ptr = rna_pointer_inherit_refine(ptr, &RNA_ObjectBaseLegacy, base);
 | 
						iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
 | 
				
			||||||
			return true;
 | 
					}
 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return false;
 | 
					static void rna_Scene_objects_next(CollectionPropertyIterator *iter)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						BKE_scene_objects_iterator_next(iter->internal.custom);
 | 
				
			||||||
 | 
						iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void rna_Scene_objects_end(CollectionPropertyIterator *iter)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						BKE_scene_objects_iterator_end(iter->internal.custom);
 | 
				
			||||||
 | 
						MEM_freeN(iter->internal.custom);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static PointerRNA rna_Scene_objects_get(CollectionPropertyIterator *iter)
 | 
					static PointerRNA rna_Scene_objects_get(CollectionPropertyIterator *iter)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	ListBaseIterator *internal = &iter->internal.listbase;
 | 
						Object *ob = ((BLI_Iterator *)iter->internal.custom)->current;
 | 
				
			||||||
 | 
						return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ob);
 | 
				
			||||||
	/* we are actually iterating a Base list, so override get */
 | 
					 | 
				
			||||||
	return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ((BaseLegacy *)internal->link)->object);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static BaseLegacy *rna_Scene_object_link(Scene *scene, bContext *C, ReportList *reports, Object *ob)
 | 
					/* End of read-only Iterator of all the scene objects. */
 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	Scene *scene_act = CTX_data_scene(C);
 | 
					 | 
				
			||||||
	BaseLegacy *base;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (BKE_scene_base_find(scene, ob)) {
 | 
					 | 
				
			||||||
		BKE_reportf(reports, RPT_ERROR, "Object '%s' is already in scene '%s'", ob->id.name + 2, scene->id.name + 2);
 | 
					 | 
				
			||||||
		return NULL;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	base = BKE_scene_base_add(scene, ob);
 | 
					 | 
				
			||||||
	id_us_plus(&ob->id);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* this is similar to what object_add_type and BKE_object_add do */
 | 
					 | 
				
			||||||
	base->lay = scene->lay;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* when linking to an inactive scene don't touch the layer */
 | 
					 | 
				
			||||||
	if (scene == scene_act)
 | 
					 | 
				
			||||||
		ob->lay = base->lay;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* TODO(sergey): Only update relations for the current scene. */
 | 
					 | 
				
			||||||
	DEG_relations_tag_update(CTX_data_main(C));
 | 
					 | 
				
			||||||
	DEG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* slows down importers too much, run scene.update() */
 | 
					 | 
				
			||||||
	/* DEG_srelations_tag_update(G.main); */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	WM_main_add_notifier(NC_SCENE | ND_OB_ACTIVE, scene);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return base;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void rna_Scene_object_unlink(Scene *scene, ReportList *reports, Object *ob)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	BaseLegacy *base = BKE_scene_base_find(scene, ob);
 | 
					 | 
				
			||||||
	if (!base) {
 | 
					 | 
				
			||||||
		BKE_reportf(reports, RPT_ERROR, "Object '%s' is not in this scene '%s'", ob->id.name + 2, scene->id.name + 2);
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if (base == scene->basact && ob->mode != OB_MODE_OBJECT) {
 | 
					 | 
				
			||||||
		BKE_reportf(reports, RPT_ERROR, "Object '%s' must be in object mode to unlink", ob->id.name + 2);
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if (scene->basact == base) {
 | 
					 | 
				
			||||||
		scene->basact = NULL;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	BKE_scene_base_unlink(scene, base);
 | 
					 | 
				
			||||||
	MEM_freeN(base);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	id_us_min(&ob->id);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* needed otherwise the depgraph will contain freed objects which can crash, see [#20958] */
 | 
					 | 
				
			||||||
	DEG_relations_tag_update(G.main);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	WM_main_add_notifier(NC_SCENE | ND_OB_ACTIVE, scene);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void rna_Scene_skgen_etch_template_set(PointerRNA *ptr, PointerRNA value)
 | 
					static void rna_Scene_skgen_etch_template_set(PointerRNA *ptr, PointerRNA value)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -708,21 +660,6 @@ static void rna_Scene_skgen_etch_template_set(PointerRNA *ptr, PointerRNA value)
 | 
				
			|||||||
		ts->skgen_template = NULL;
 | 
							ts->skgen_template = NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static PointerRNA rna_Scene_active_object_get(PointerRNA *ptr)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	Scene *scene = (Scene *)ptr->data;
 | 
					 | 
				
			||||||
	return rna_pointer_inherit_refine(ptr, &RNA_Object, scene->basact ? scene->basact->object : NULL);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void rna_Scene_active_object_set(PointerRNA *ptr, PointerRNA value)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	Scene *scene = (Scene *)ptr->data;
 | 
					 | 
				
			||||||
	if (value.data)
 | 
					 | 
				
			||||||
		scene->basact = BKE_scene_base_find(scene, (Object *)value.data);
 | 
					 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
		scene->basact = NULL;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void rna_Scene_set_set(PointerRNA *ptr, PointerRNA value)
 | 
					static void rna_Scene_set_set(PointerRNA *ptr, PointerRNA value)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	Scene *scene = (Scene *)ptr->data;
 | 
						Scene *scene = (Scene *)ptr->data;
 | 
				
			||||||
@@ -6658,60 +6595,11 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
 | 
				
			|||||||
static void rna_def_scene_objects(BlenderRNA *brna, PropertyRNA *cprop)
 | 
					static void rna_def_scene_objects(BlenderRNA *brna, PropertyRNA *cprop)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	StructRNA *srna;
 | 
						StructRNA *srna;
 | 
				
			||||||
	PropertyRNA *prop;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	FunctionRNA *func;
 | 
					 | 
				
			||||||
	PropertyRNA *parm;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	RNA_def_property_srna(cprop, "SceneObjects");
 | 
						RNA_def_property_srna(cprop, "SceneObjects");
 | 
				
			||||||
	srna = RNA_def_struct(brna, "SceneObjects", NULL);
 | 
						srna = RNA_def_struct(brna, "SceneObjects", NULL);
 | 
				
			||||||
	RNA_def_struct_sdna(srna, "Scene");
 | 
						RNA_def_struct_sdna(srna, "Scene");
 | 
				
			||||||
	RNA_def_struct_ui_text(srna, "Scene Objects", "Collection of scene objects");
 | 
						RNA_def_struct_ui_text(srna, "Scene Objects", "All the of scene objects");
 | 
				
			||||||
 | 
					 | 
				
			||||||
	func = RNA_def_function(srna, "link", "rna_Scene_object_link");
 | 
					 | 
				
			||||||
	RNA_def_function_ui_description(func, "Link object to scene, run scene.update() after");
 | 
					 | 
				
			||||||
	RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
 | 
					 | 
				
			||||||
	parm = RNA_def_pointer(func, "object", "Object", "", "Object to add to scene");
 | 
					 | 
				
			||||||
	RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
 | 
					 | 
				
			||||||
	parm = RNA_def_pointer(func, "base", "ObjectBaseLegacy", "", "The newly created base");
 | 
					 | 
				
			||||||
	RNA_def_function_return(func, parm);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	func = RNA_def_function(srna, "unlink", "rna_Scene_object_unlink");
 | 
					 | 
				
			||||||
	RNA_def_function_ui_description(func, "Unlink object from scene");
 | 
					 | 
				
			||||||
	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 | 
					 | 
				
			||||||
	parm = RNA_def_pointer(func, "object", "Object", "", "Object to remove from scene");
 | 
					 | 
				
			||||||
	RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
 | 
					 | 
				
			||||||
	RNA_def_property_struct_type(prop, "Object");
 | 
					 | 
				
			||||||
	RNA_def_property_pointer_funcs(prop, "rna_Scene_active_object_get", "rna_Scene_active_object_set", NULL, NULL);
 | 
					 | 
				
			||||||
	RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
 | 
					 | 
				
			||||||
	RNA_def_property_ui_text(prop, "Active Object", "Active object for this scene");
 | 
					 | 
				
			||||||
	/* Could call: ED_base_object_activate(C, scene->basact);
 | 
					 | 
				
			||||||
	 * but would be a bad level call and it seems the notifier is enough */
 | 
					 | 
				
			||||||
	RNA_def_property_update(prop, NC_SCENE | ND_OB_ACTIVE, NULL);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* scene.bases.* */
 | 
					 | 
				
			||||||
static void rna_def_scene_bases(BlenderRNA *brna, PropertyRNA *cprop)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	StructRNA *srna;
 | 
					 | 
				
			||||||
	PropertyRNA *prop;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*	FunctionRNA *func; */
 | 
					 | 
				
			||||||
/*	PropertyRNA *parm; */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	RNA_def_property_srna(cprop, "SceneBases");
 | 
					 | 
				
			||||||
	srna = RNA_def_struct(brna, "SceneBases", NULL);
 | 
					 | 
				
			||||||
	RNA_def_struct_sdna(srna, "Scene");
 | 
					 | 
				
			||||||
	RNA_def_struct_ui_text(srna, "Scene Bases", "Collection of scene bases");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
 | 
					 | 
				
			||||||
	RNA_def_property_struct_type(prop, "ObjectBaseLegacy");
 | 
					 | 
				
			||||||
	RNA_def_property_pointer_sdna(prop, NULL, "basact");
 | 
					 | 
				
			||||||
	RNA_def_property_flag(prop, PROP_EDITABLE);
 | 
					 | 
				
			||||||
	RNA_def_property_ui_text(prop, "Active Base", "Active object base in the scene");
 | 
					 | 
				
			||||||
	RNA_def_property_update(prop, NC_SCENE | ND_OB_ACTIVE, NULL);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* scene.timeline_markers */
 | 
					/* scene.timeline_markers */
 | 
				
			||||||
@@ -6947,20 +6835,15 @@ void RNA_def_scene(BlenderRNA *brna)
 | 
				
			|||||||
	RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4);
 | 
						RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4);
 | 
				
			||||||
	RNA_def_property_update(prop, NC_WINDOW, NULL);
 | 
						RNA_def_property_update(prop, NC_WINDOW, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Bases/Objects */
 | 
					 | 
				
			||||||
	prop = RNA_def_property(srna, "object_bases", PROP_COLLECTION, PROP_NONE);
 | 
					 | 
				
			||||||
	RNA_def_property_collection_sdna(prop, NULL, "base", NULL);
 | 
					 | 
				
			||||||
	RNA_def_property_struct_type(prop, "ObjectBaseLegacy");
 | 
					 | 
				
			||||||
	RNA_def_property_ui_text(prop, "Bases", "");
 | 
					 | 
				
			||||||
	RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL,
 | 
					 | 
				
			||||||
	                                  "rna_Scene_object_bases_lookup_string", NULL);
 | 
					 | 
				
			||||||
	rna_def_scene_bases(brna, prop);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
 | 
						prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
 | 
				
			||||||
	RNA_def_property_collection_sdna(prop, NULL, "base", NULL);
 | 
					 | 
				
			||||||
	RNA_def_property_struct_type(prop, "Object");
 | 
						RNA_def_property_struct_type(prop, "Object");
 | 
				
			||||||
	RNA_def_property_ui_text(prop, "Objects", "");
 | 
						RNA_def_property_ui_text(prop, "Objects", "");
 | 
				
			||||||
	RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_Scene_objects_get", NULL, NULL, NULL, NULL);
 | 
						RNA_def_property_collection_funcs(prop,
 | 
				
			||||||
 | 
						                                  "rna_Scene_objects_begin",
 | 
				
			||||||
 | 
						                                  "rna_Scene_objects_next",
 | 
				
			||||||
 | 
						                                  "rna_Scene_objects_end",
 | 
				
			||||||
 | 
						                                  "rna_Scene_objects_get",
 | 
				
			||||||
 | 
						                                  NULL, NULL, NULL, NULL);
 | 
				
			||||||
	rna_def_scene_objects(brna, prop);
 | 
						rna_def_scene_objects(brna, prop);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Layers */
 | 
						/* Layers */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2899,7 +2899,7 @@ static bool check_valid_compositing_camera(Scene *scene, Object *camera_override
 | 
				
			|||||||
			if (node->type == CMP_NODE_R_LAYERS && (node->flag & NODE_MUTED) == 0) {
 | 
								if (node->type == CMP_NODE_R_LAYERS && (node->flag & NODE_MUTED) == 0) {
 | 
				
			||||||
				Scene *sce = node->id ? (Scene *)node->id : scene;
 | 
									Scene *sce = node->id ? (Scene *)node->id : scene;
 | 
				
			||||||
				if (sce->camera == NULL) {
 | 
									if (sce->camera == NULL) {
 | 
				
			||||||
					sce->camera = BKE_scene_camera_find(sce);
 | 
										sce->camera = BKE_scene_layer_camera_find(BKE_scene_layer_from_scene_get(sce));
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				if (sce->camera == NULL) {
 | 
									if (sce->camera == NULL) {
 | 
				
			||||||
					/* all render layers nodes need camera */
 | 
										/* all render layers nodes need camera */
 | 
				
			||||||
@@ -2957,7 +2957,7 @@ static int check_valid_camera(Scene *scene, Object *camera_override, ReportList
 | 
				
			|||||||
	const char *err_msg = "No camera found in scene \"%s\"";
 | 
						const char *err_msg = "No camera found in scene \"%s\"";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (camera_override == NULL && scene->camera == NULL)
 | 
						if (camera_override == NULL && scene->camera == NULL)
 | 
				
			||||||
		scene->camera = BKE_scene_camera_find(scene);
 | 
							scene->camera = BKE_scene_layer_camera_find(BKE_scene_layer_from_scene_get(scene));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!check_valid_camera_multiview(scene, scene->camera, reports))
 | 
						if (!check_valid_camera_multiview(scene, scene->camera, reports))
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
@@ -2972,7 +2972,9 @@ static int check_valid_camera(Scene *scene, Object *camera_override, ReportList
 | 
				
			|||||||
				    (seq->scene != NULL))
 | 
									    (seq->scene != NULL))
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					if (!seq->scene_camera) {
 | 
										if (!seq->scene_camera) {
 | 
				
			||||||
						if (!seq->scene->camera && !BKE_scene_camera_find(seq->scene)) {
 | 
											if (!seq->scene->camera &&
 | 
				
			||||||
 | 
											    !BKE_scene_layer_camera_find(BKE_scene_layer_from_scene_get(seq->scene)))
 | 
				
			||||||
 | 
											{
 | 
				
			||||||
							/* camera could be unneeded due to composite nodes */
 | 
												/* camera could be unneeded due to composite nodes */
 | 
				
			||||||
							Object *override = (seq->scene == scene) ? camera_override : NULL;
 | 
												Object *override = (seq->scene == scene) ? camera_override : NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -551,7 +551,7 @@ struct bScreen *ED_screen_animation_playing(const struct wmWindowManager *wm) RE
 | 
				
			|||||||
struct Scene *ED_screen_scene_find(const struct bScreen *screen, const struct wmWindowManager *wm) RET_NULL
 | 
					struct Scene *ED_screen_scene_find(const struct bScreen *screen, const struct wmWindowManager *wm) RET_NULL
 | 
				
			||||||
bool ED_scene_render_layer_delete(struct Main *bmain, Scene *scene, SceneLayer *layer, ReportList *reports) RET_ZERO
 | 
					bool ED_scene_render_layer_delete(struct Main *bmain, Scene *scene, SceneLayer *layer, ReportList *reports) RET_ZERO
 | 
				
			||||||
void ED_base_object_select(struct BaseLegacy *base, short mode) RET_NONE
 | 
					void ED_base_object_select(struct BaseLegacy *base, short mode) RET_NONE
 | 
				
			||||||
void ED_object_base_select(struct Base *base, short mode) RET_NONE
 | 
					void ED_object_base_select(struct Base *base, eObjectSelect_Mode mode) RET_NONE
 | 
				
			||||||
bool ED_object_modifier_remove(struct ReportList *reports, struct Main *bmain, struct Object *ob, struct ModifierData *md) RET_ZERO
 | 
					bool ED_object_modifier_remove(struct ReportList *reports, struct Main *bmain, struct Object *ob, struct ModifierData *md) RET_ZERO
 | 
				
			||||||
struct ModifierData *ED_object_modifier_add(struct ReportList *reports, struct Main *bmain, struct Scene *scene, struct Object *ob, const char *name, int type) RET_ZERO
 | 
					struct ModifierData *ED_object_modifier_add(struct ReportList *reports, struct Main *bmain, struct Scene *scene, struct Object *ob, const char *name, int type) RET_ZERO
 | 
				
			||||||
void ED_object_modifier_clear(struct Main *bmain, struct Object *ob) RET_NONE
 | 
					void ED_object_modifier_clear(struct Main *bmain, struct Object *ob) RET_NONE
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -65,7 +65,6 @@ KX_LightObject::KX_LightObject(void* sgReplicationInfo,SG_Callbacks callbacks,
 | 
				
			|||||||
	m_rasterizer->AddLight(m_lightobj);
 | 
						m_rasterizer->AddLight(m_lightobj);
 | 
				
			||||||
	m_lightobj->m_glsl = glsl;
 | 
						m_lightobj->m_glsl = glsl;
 | 
				
			||||||
	m_blenderscene = ((KX_Scene*)sgReplicationInfo)->GetBlenderScene();
 | 
						m_blenderscene = ((KX_Scene*)sgReplicationInfo)->GetBlenderScene();
 | 
				
			||||||
	m_base = NULL;
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -75,11 +74,6 @@ KX_LightObject::~KX_LightObject()
 | 
				
			|||||||
		m_rasterizer->RemoveLight(m_lightobj);
 | 
							m_rasterizer->RemoveLight(m_lightobj);
 | 
				
			||||||
		delete(m_lightobj);
 | 
							delete(m_lightobj);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (m_base) {
 | 
					 | 
				
			||||||
		BKE_scene_base_unlink(m_blenderscene, m_base);
 | 
					 | 
				
			||||||
		MEM_freeN(m_base);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -103,7 +97,6 @@ void KX_LightObject::UpdateScene(KX_Scene *kxscene)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	m_lightobj->m_scene = (void*)kxscene;
 | 
						m_lightobj->m_scene = (void*)kxscene;
 | 
				
			||||||
	m_blenderscene = kxscene->GetBlenderScene();
 | 
						m_blenderscene = kxscene->GetBlenderScene();
 | 
				
			||||||
	m_base = BKE_scene_base_add(m_blenderscene, GetBlenderObject());
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void KX_LightObject::SetLayer(int layer)
 | 
					void KX_LightObject::SetLayer(int layer)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user