[Bf-blender-cvs] [cd33257798d] asset-engine: Revert hack making linked virtual datablock editables.

Bastien Montagne noreply at git.blender.org
Thu Sep 28 19:52:39 CEST 2017


Commit: cd33257798d685cd041a85a3fb153ff5a852ee14
Author: Bastien Montagne
Date:   Thu Sep 28 16:37:49 2017 +0200
Branches: asset-engine
https://developer.blender.org/rBcd33257798d685cd041a85a3fb153ff5a852ee14

Revert hack making linked virtual datablock editables.

Essentially, this reverts most ID_IS_LINKED_DATABLOCK() checks to
ID_IS_LINKED() one.

Idea of making virtual linked IDs editable was nice as a temp hack to do
quick experiment, but was never intended as final solution, correct way
to do that is to use static override, will be implemented soon.

Note that virtual library/virtually linked ID concept remains, it's
mandatory to handle mere files as assets (and potentially other, more
advanced cases in the future).

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

M	source/blender/blenkernel/intern/library.c
M	source/blender/blenkernel/intern/material.c
M	source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
M	source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M	source/blender/editors/animation/anim_filter.c
M	source/blender/editors/animation/keyframes_draw.c
M	source/blender/editors/armature/pose_edit.c
M	source/blender/editors/armature/pose_lib.c
M	source/blender/editors/interface/interface_eyedropper.c
M	source/blender/editors/interface/interface_ops.c
M	source/blender/editors/interface/interface_templates.c
M	source/blender/editors/mesh/editmesh_tools.c
M	source/blender/editors/mesh/mesh_data.c
M	source/blender/editors/object/object_add.c
M	source/blender/editors/object/object_constraint.c
M	source/blender/editors/object/object_data_transfer.c
M	source/blender/editors/object/object_edit.c
M	source/blender/editors/object/object_modifier.c
M	source/blender/editors/object/object_relations.c
M	source/blender/editors/object/object_shapekey.c
M	source/blender/editors/object/object_transform.c
M	source/blender/editors/object/object_vgroup.c
M	source/blender/editors/physics/particle_edit.c
M	source/blender/editors/physics/particle_object.c
M	source/blender/editors/screen/screen_ops.c
M	source/blender/editors/sculpt_paint/paint_image.c
M	source/blender/editors/sculpt_paint/paint_vertex.c
M	source/blender/editors/space_logic/logic_ops.c
M	source/blender/editors/space_outliner/outliner_draw.c
M	source/blender/editors/space_outliner/outliner_edit.c
M	source/blender/editors/space_outliner/outliner_tree.c
M	source/blender/editors/space_text/text_ops.c
M	source/blender/editors/space_view3d/drawobject.c
M	source/blender/editors/space_view3d/view3d_edit.c
M	source/blender/editors/space_view3d/view3d_fly.c
M	source/blender/editors/space_view3d/view3d_view.c
M	source/blender/editors/space_view3d/view3d_walk.c
M	source/blender/editors/transform/transform_conversions.c
M	source/blender/editors/util/ed_util.c
M	source/blender/makesrna/intern/rna_access.c
M	source/blender/windowmanager/intern/wm_operators.c

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

diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index ed08ed4dce9..c78b7af40a8 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -1700,8 +1700,10 @@ static ID *is_dupid(ListBase *lb, ID *id, const char *name)
 	ID *idtest = NULL;
 	
 	for (idtest = lb->first; idtest; idtest = idtest->next) {
-		/* if idtest is not a lib */ 
-		if (id != idtest && !ID_IS_LINKED_DATABLOCK(idtest)) {  /* Virtual lib IDs are considered as local ones here. */
+		/* if idtest is not a lib */
+		/* Virtual lib IDs are considered as local ones here, since we bulk-add them to virtual library datablocks,
+		 * we need to ensure ourselves there is no name collision there. */
+		if (id != idtest && !ID_IS_LINKED_DATABLOCK(idtest)) {
 			/* do not test alphabetic! */
 			/* optimized */
 			if (idtest->name[2] == name[0]) {
@@ -1847,7 +1849,7 @@ bool new_id(ListBase *lb, ID *id, const char *tname)
 	bool result;
 	char name[MAX_ID_NAME - 2];
 
-	/* if real library, don't rename */
+	/* if real library, don't rename, in virtual lib case we need to check though. */
 	if (ID_IS_LINKED_DATABLOCK(id))
 		return false;
 
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index f5be72c6b4d..314673eed43 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -716,8 +716,8 @@ void assign_material(Object *ob, Material *ma, short act, int assign_type)
 	if (act < 1) act = 1;
 	
 	/* prevent crashing when using accidentally */
-	BLI_assert(!ID_IS_LINKED_DATABLOCK(ob));
-	if (ID_IS_LINKED_DATABLOCK(ob)) return;
+	BLI_assert(!ID_IS_LINKED(ob));
+	if (ID_IS_LINKED(ob)) return;
 	
 	/* test arraylens */
 	
@@ -990,7 +990,7 @@ static void do_init_render_material(Material *ma, int r_mode, float *amb)
 		Group *group;
 
 		for (group = G.main->group.first; group; group = group->id.next) {
-			if (!ID_IS_LINKED_DATABLOCK(group) && STREQ(group->id.name, ma->group->id.name)) {
+			if (!ID_IS_LINKED(group) && STREQ(group->id.name, ma->group->id.name)) {
 				ma->group = group;
 			}
 		}
@@ -2099,7 +2099,7 @@ int do_version_tface(Main *main)
 	
 	/* 1st part: marking mesh materials to update */
 	for (me = main->mesh.first; me; me = me->id.next) {
-		if (ID_IS_LINKED_DATABLOCK(me)) continue;
+		if (ID_IS_LINKED(me)) continue;
 
 		/* get the active tface layer */
 		index = CustomData_get_active_layer_index(&me->fdata, CD_MTFACE);
@@ -2153,7 +2153,7 @@ int do_version_tface(Main *main)
 				 * at doversion time: direct_link might not have happened on it,
 				 * so ma->mtex is not pointing to valid memory yet.
 				 * later we could, but it's better not */
-				else if (ID_IS_LINKED_DATABLOCK(ma))
+				else if (ID_IS_LINKED(ma))
 					continue;
 				
 				/* material already marked as disputed */
@@ -2218,7 +2218,7 @@ int do_version_tface(Main *main)
 
 	/* we shouldn't loop through the materials created in the loop. make the loop stop at its original length) */
 	for (ma = main->mat.first, a = 0; ma; ma = ma->id.next, a++) {
-		if (ID_IS_LINKED_DATABLOCK(ma)) continue;
+		if (ID_IS_LINKED(ma)) continue;
 
 		/* disputed material */
 		if (ma->game.flag == MAT_BGE_DISPUTED) {
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index 65d8a02d15f..d32adea92da 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -395,7 +395,7 @@ void DepsgraphNodeBuilder::build_object(Scene *scene, Base *base, Object *ob)
 				break;
 
 			case OB_ARMATURE: /* Pose */
-				if (ID_IS_LINKED_DATABLOCK(ob) && ob->proxy_from != NULL) {
+				if (ID_IS_LINKED(ob) && ob->proxy_from != NULL) {
 					build_proxy_rig(ob);
 				}
 				else {
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index d42c4047691..557147c04af 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -516,7 +516,7 @@ void DepsgraphRelationBuilder::build_object(Main *bmain, Scene *scene, Object *o
 			}
 
 			case OB_ARMATURE: /* Pose */
-				if (ID_IS_LINKED_DATABLOCK(ob) && ob->proxy_from != NULL) {
+				if (ID_IS_LINKED(ob) && ob->proxy_from != NULL) {
 					build_proxy_rig(ob);
 				}
 				else {
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index e18560b95af..2ac305dbc30 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -1321,7 +1321,7 @@ static size_t animfilter_action(bAnimContext *ac, ListBase *anim_data, bDopeShee
 	/* don't include anything from this action if it is linked in from another file,
 	 * and we're getting stuff for editing...
 	 */
-	if ((filter_mode & ANIMFILTER_FOREDIT) && ID_IS_LINKED_DATABLOCK(act))
+	if ((filter_mode & ANIMFILTER_FOREDIT) && ID_IS_LINKED(act))
 		return 0;
 		
 	/* do groups */
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index 5f675e690b9..f25dbf2381c 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -751,7 +751,7 @@ void draw_fcurve_channel(View2D *v2d, AnimData *adt, FCurve *fcu, float ypos, fl
 	
 	bool locked = (fcu->flag & FCURVE_PROTECTED) ||
 	              ((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED)) ||
-	              ((adt && adt->action) && ID_IS_LINKED_DATABLOCK(adt->action));
+	              ((adt && adt->action) && ID_IS_LINKED(adt->action));
 	
 	BLI_dlrbTree_init(&keys);
 	BLI_dlrbTree_init(&blocks);
@@ -772,7 +772,7 @@ void draw_agroup_channel(View2D *v2d, AnimData *adt, bActionGroup *agrp, float y
 	DLRBT_Tree keys, blocks;
 	
 	bool locked = (agrp->flag & AGRP_PROTECTED) ||
-	              ((adt && adt->action) && ID_IS_LINKED_DATABLOCK(adt->action));
+	              ((adt && adt->action) && ID_IS_LINKED(adt->action));
 	
 	BLI_dlrbTree_init(&keys);
 	BLI_dlrbTree_init(&blocks);
@@ -792,7 +792,7 @@ void draw_action_channel(View2D *v2d, AnimData *adt, bAction *act, float ypos, f
 {
 	DLRBT_Tree keys, blocks;
 	
-	bool locked = (act && ID_IS_LINKED_DATABLOCK(act));
+	bool locked = (act && ID_IS_LINKED(act));
 	
 	BLI_dlrbTree_init(&keys);
 	BLI_dlrbTree_init(&blocks);
diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c
index 86b7271bfff..5a1f7693c65 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -86,7 +86,7 @@ void ED_armature_enter_posemode(bContext *C, Base *base)
 	ReportList *reports = CTX_wm_reports(C);
 	Object *ob = base->object;
 	
-	if (ID_IS_LINKED_DATABLOCK(ob)) {
+	if (ID_IS_LINKED(ob)) {
 		BKE_report(reports, RPT_WARNING, "Cannot pose libdata");
 		return;
 	}
diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c
index 25f1b282f14..da126027c89 100644
--- a/source/blender/editors/armature/pose_lib.c
+++ b/source/blender/editors/armature/pose_lib.c
@@ -184,7 +184,7 @@ static int has_poselib_pose_data_poll(bContext *C)
 static int has_poselib_pose_data_for_editing_poll(bContext *C)
 {
 	Object *ob = get_poselib_object(C);
-	return (ob && ob->poselib && !ID_IS_LINKED_DATABLOCK(ob->poselib));
+	return (ob && ob->poselib && !ID_IS_LINKED(ob->poselib));
 }
 
 /* ----------------------------------- */
@@ -386,7 +386,7 @@ static int poselib_add_poll(bContext *C)
 	if (ED_operator_posemode(C)) {
 		Object *ob = get_poselib_object(C);
 		if (ob) {
-			if ((ob->poselib == NULL) || !ID_IS_LINKED_DATABLOCK(ob->poselib)) {
+			if ((ob->poselib == NULL) || !ID_IS_LINKED(ob->poselib)) {
 				return true;
 			}
 		}
diff --git a/source/blender/editors/interface/interface_eyedropper.c b/source/blender/editors/interface/interface_eyedropper.c
index eab609ebe84..494e823ee3f 100644
--- a/source/blender/editors/interface/interface_eyedropper.c
+++ b/source/blender/editors/interface/interface_eyedropper.c
@@ -840,7 +840,7 @@ static int depthdropper_init(bContext *C, wmOperator *op)
 		RegionView3D *rv3d = CTX_wm_region_view3d(C);
 		if (rv3d && rv3d->persp == RV3D_CAMOB) {
 			View3D *v3d = CTX_wm_view3d(C);
-			if (v3d->camera && v3d->camera->data && !ID_IS_LINKED_DATABLOCK(v3d->camera->data)) {
+			if (v3d->camera && v3d->camera->data && !ID_IS_LINKED(v3d->camera->data)) {
 				RNA_id_pointer_create(v3d->camera->data, &ddr->ptr);
 				ddr->prop = RNA_struct_find_property(&ddr->ptr, "dof_distance");
 			}
@@ -1090,7 +1090,7 @@ static int depthdropper_poll(bContext *C)
 		RegionView3D *rv3d = CTX_wm_region_view3d(C);
 		if (rv3d && rv3d->persp == RV3D_CAMOB) {
 			View3D *v3d = CTX_wm_view3d(C);
-			if (v3d->camera && v3d->camera->data && !ID_IS_LINKED_DATABLOCK(v3d->camera->data)) {
+			if (v3d->camera && v3d->camera->data && !ID_IS_LINKED(v3d->camera->data)) {
 				return 1;
 			}
 		}
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index 8f6313a9e09..89ffa69c77d 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -649,7 +649,7 @@ bool UI_context_copy_to_selected_list(
 
 					if ((id_data == NULL) ||
 					    (id_data->tag & LIB_TAG_DOIT) == 0 ||
-					    ID_IS_LINKED_DATABLOCK(id_data) ||
+					    ID_IS_LINKED(id_data) ||
 					    (GS(id_data->name) != id_code))
 					{
 						BLI_remlink(&lb, link);
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 131584dd405..5788a5f71ea 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -981,7 +981,7 @@ static uiLayout *draw_modifier(
 			}
 			
 			UI_block_lock_clear(block);
-			UI_block_lock_set(block, ob && ID_IS_LINKED_DATABLOCK(ob), ERROR_LIBDATA_MESSAGE);
+			

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list