Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2015-12-27 13:53:50 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2015-12-27 14:00:33 +0300
commit3fcf535d2e003ad939fa1f1c7aa4d5da1b38aef7 (patch)
tree0cc5b044cdc1f7b6fa58ad1d0c3c6cafc51a7759 /source/blender/editors/object
parentec2ca11cba496294838bfb5fb76f7bfcef2fe8cc (diff)
Split id->flag in two, persistent flags and runtime tags.
This is purely internal sanitizing/cleanup, no change in behavior is expected at all. This change was also needed because we were getting short on ID flags, and future enhancement of 'user_one' ID behavior requires two new ones. id->flag remains for persistent data (fakeuser only, so far!), this also allows us 100% backward & forward compatibility. New id->tag is used for most flags. Though written in .blend files, its content is cleared at read time. Note that .blend file version was bumped, so that we can clear runtimeflags from old .blends, important in case we add new persistent flags in future. Also, behavior of tags (either status ones, or whether they need to be cleared before/after use) has been added as comments to their declaration. Reviewers: sergey, campbellbarton Differential Revision: https://developer.blender.org/D1683
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r--source/blender/editors/object/object_add.c10
-rw-r--r--source/blender/editors/object/object_bake.c10
-rw-r--r--source/blender/editors/object/object_bake_api.c8
-rw-r--r--source/blender/editors/object/object_data_transfer.c8
-rw-r--r--source/blender/editors/object/object_relations.c40
-rw-r--r--source/blender/editors/object/object_transform.c22
6 files changed, 49 insertions, 49 deletions
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 7650be941d4..1cab8918abc 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -1159,12 +1159,12 @@ static int object_delete_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* delete has to handle all open scenes */
- BKE_main_id_flag_listbase(&bmain->scene, LIB_DOIT, 1);
+ BKE_main_id_flag_listbase(&bmain->scene, LIB_TAG_DOIT, 1);
for (win = wm->windows.first; win; win = win->next) {
scene = win->screen->scene;
- if (scene->id.flag & LIB_DOIT) {
- scene->id.flag &= ~LIB_DOIT;
+ if (scene->id.tag & LIB_TAG_DOIT) {
+ scene->id.tag &= ~LIB_TAG_DOIT;
DAG_relations_tag_update(bmain);
@@ -1545,7 +1545,7 @@ static int convert_exec(bContext *C, wmOperator *op)
/* flag data thats not been edited (only needed for !keep_original) */
if (ob->data) {
- ((ID *)ob->data)->flag |= LIB_DOIT;
+ ((ID *)ob->data)->tag |= LIB_TAG_DOIT;
}
/* possible metaball basis is not in this scene */
@@ -1791,7 +1791,7 @@ static int convert_exec(bContext *C, wmOperator *op)
if (!keep_original && (ob->flag & OB_DONE)) {
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- ((ID *)ob->data)->flag &= ~LIB_DOIT; /* flag not to convert this datablock again */
+ ((ID *)ob->data)->tag &= ~LIB_TAG_DOIT; /* flag not to convert this datablock again */
}
}
CTX_DATA_END;
diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c
index ecaa05ace99..888bf832042 100644
--- a/source/blender/editors/object/object_bake.c
+++ b/source/blender/editors/object/object_bake.c
@@ -267,7 +267,7 @@ static void clear_single_image(Image *image, ClearFlag flag)
const float disp_alpha[4] = {0.5f, 0.5f, 0.5f, 0.0f};
const float disp_solid[4] = {0.5f, 0.5f, 0.5f, 1.0f};
- if ((image->id.flag & LIB_DOIT) == 0) {
+ if ((image->id.tag & LIB_TAG_DOIT) == 0) {
ImBuf *ibuf = BKE_image_acquire_ibuf(image, NULL, NULL);
if (flag == CLEAR_TANGENT_NORMAL)
@@ -277,7 +277,7 @@ static void clear_single_image(Image *image, ClearFlag flag)
else
IMB_rectfill(ibuf, (ibuf->planes == R_IMF_PLANES_RGBA) ? vec_alpha : vec_solid);
- image->id.flag |= LIB_DOIT;
+ image->id.tag |= LIB_TAG_DOIT;
BKE_image_release_ibuf(image, ibuf, NULL);
}
@@ -288,7 +288,7 @@ static void clear_images_poly(MTexPoly *mtpoly, int totpoly, ClearFlag flag)
int a;
for (a = 0; a < totpoly; a++) {
- mtpoly[a].tpage->id.flag &= ~LIB_DOIT;
+ mtpoly[a].tpage->id.tag &= ~LIB_TAG_DOIT;
}
for (a = 0; a < totpoly; a++) {
@@ -296,7 +296,7 @@ static void clear_images_poly(MTexPoly *mtpoly, int totpoly, ClearFlag flag)
}
for (a = 0; a < totpoly; a++) {
- mtpoly[a].tpage->id.flag &= ~LIB_DOIT;
+ mtpoly[a].tpage->id.tag &= ~LIB_TAG_DOIT;
}
}
@@ -670,7 +670,7 @@ static void finish_bake_internal(BakeRender *bkr)
Mesh *me;
BLI_assert(BLI_thread_is_main());
for (me = G.main->mesh.first; me; me = me->id.next) {
- if (me->id.flag & LIB_DOIT) {
+ if (me->id.tag & LIB_TAG_DOIT) {
DAG_id_tag_update(&me->id, OB_RECALC_DATA);
BKE_mesh_tessface_clear(me);
}
diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c
index e69f6174c98..93f9856b51a 100644
--- a/source/blender/editors/object/object_bake_api.c
+++ b/source/blender/editors/object/object_bake_api.c
@@ -421,7 +421,7 @@ static bool bake_object_check(Object *ob, ReportList *reports)
return false;
}
- image->id.flag |= LIB_DOIT;
+ image->id.tag |= LIB_TAG_DOIT;
}
return true;
}
@@ -478,7 +478,7 @@ static void bake_images_clear(Main *bmain, const bool is_tangent)
{
Image *image;
for (image = bmain->image.first; image; image = image->id.next) {
- if ((image->id.flag & LIB_DOIT) != 0) {
+ if ((image->id.tag & LIB_TAG_DOIT) != 0) {
RE_bake_ibuf_clear(image, is_tangent);
}
}
@@ -497,7 +497,7 @@ static void build_image_lookup(Main *bmain, Object *ob, BakeImages *bake_images)
Image *image;
ED_object_get_active_image(ob, i + 1, &image, NULL, NULL, NULL);
- if ((image->id.flag & LIB_DOIT)) {
+ if ((image->id.tag & LIB_TAG_DOIT)) {
for (j = 0; j < i; j++) {
if (bake_images->data[j].image == image) {
bake_images->lookup[i] = j;
@@ -508,7 +508,7 @@ static void build_image_lookup(Main *bmain, Object *ob, BakeImages *bake_images)
else {
bake_images->lookup[i] = tot_images;
bake_images->data[tot_images].image = image;
- image->id.flag |= LIB_DOIT;
+ image->id.tag |= LIB_TAG_DOIT;
tot_images++;
}
}
diff --git a/source/blender/editors/object/object_data_transfer.c b/source/blender/editors/object/object_data_transfer.c
index ac1935e9652..47ee6752e51 100644
--- a/source/blender/editors/object/object_data_transfer.c
+++ b/source/blender/editors/object/object_data_transfer.c
@@ -304,11 +304,11 @@ static void data_transfer_exec_preprocess_objects(
/* Do not transfer to linked data, not supported. */
BKE_reportf(op->reports, RPT_WARNING, "Skipping object '%s', linked data '%s' cannot be modified",
ob->id.name + 2, me->id.name + 2);
- me->id.flag &= ~LIB_DOIT;
+ me->id.tag &= ~LIB_TAG_DOIT;
continue;
}
- me->id.flag |= LIB_DOIT;
+ me->id.tag |= LIB_TAG_DOIT;
}
}
@@ -326,8 +326,8 @@ static bool data_transfer_exec_is_object_valid(
}
me = ob_dst->data;
- if (me->id.flag & LIB_DOIT) {
- me->id.flag &= ~LIB_DOIT;
+ if (me->id.tag & LIB_TAG_DOIT) {
+ me->id.tag &= ~LIB_TAG_DOIT;
return true;
}
else if (me->id.lib == NULL) {
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index a1f59166c81..32a7806907b 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -1959,7 +1959,7 @@ static void single_mat_users(Scene *scene, const int flag, const bool do_texture
for (a = 1; a <= ob->totcol; a++) {
ma = give_current_material(ob, a);
if (ma) {
- /* do not test for LIB_NEW: this functions guaranteed delivers single_users! */
+ /* do not test for LIB_TAG_NEW: this functions guaranteed delivers single_users! */
if (ma->id.us > 1) {
man = BKE_material_copy(ma);
@@ -2010,14 +2010,14 @@ static void do_single_tex_user(Tex **from)
static void single_tex_users_expand(Main *bmain)
{
- /* only when 'parent' blocks are LIB_NEW */
+ /* only when 'parent' blocks are LIB_TAG_NEW */
Material *ma;
Lamp *la;
World *wo;
int b;
for (ma = bmain->mat.first; ma; ma = ma->id.next) {
- if (ma->id.flag & LIB_NEW) {
+ if (ma->id.tag & LIB_TAG_NEW) {
for (b = 0; b < MAX_MTEX; b++) {
if (ma->mtex[b] && ma->mtex[b]->tex) {
do_single_tex_user(&(ma->mtex[b]->tex));
@@ -2027,7 +2027,7 @@ static void single_tex_users_expand(Main *bmain)
}
for (la = bmain->lamp.first; la; la = la->id.next) {
- if (la->id.flag & LIB_NEW) {
+ if (la->id.tag & LIB_TAG_NEW) {
for (b = 0; b < MAX_MTEX; b++) {
if (la->mtex[b] && la->mtex[b]->tex) {
do_single_tex_user(&(la->mtex[b]->tex));
@@ -2037,7 +2037,7 @@ static void single_tex_users_expand(Main *bmain)
}
for (wo = bmain->world.first; wo; wo = wo->id.next) {
- if (wo->id.flag & LIB_NEW) {
+ if (wo->id.tag & LIB_TAG_NEW) {
for (b = 0; b < MAX_MTEX; b++) {
if (wo->mtex[b] && wo->mtex[b]->tex) {
do_single_tex_user(&(wo->mtex[b]->tex));
@@ -2049,7 +2049,7 @@ static void single_tex_users_expand(Main *bmain)
static void single_mat_users_expand(Main *bmain)
{
- /* only when 'parent' blocks are LIB_NEW */
+ /* only when 'parent' blocks are LIB_TAG_NEW */
Object *ob;
Mesh *me;
Curve *cu;
@@ -2058,24 +2058,24 @@ static void single_mat_users_expand(Main *bmain)
int a;
for (ob = bmain->object.first; ob; ob = ob->id.next)
- if (ob->id.flag & LIB_NEW)
+ if (ob->id.tag & LIB_TAG_NEW)
new_id_matar(ob->mat, ob->totcol);
for (me = bmain->mesh.first; me; me = me->id.next)
- if (me->id.flag & LIB_NEW)
+ if (me->id.tag & LIB_TAG_NEW)
new_id_matar(me->mat, me->totcol);
for (cu = bmain->curve.first; cu; cu = cu->id.next)
- if (cu->id.flag & LIB_NEW)
+ if (cu->id.tag & LIB_TAG_NEW)
new_id_matar(cu->mat, cu->totcol);
for (mb = bmain->mball.first; mb; mb = mb->id.next)
- if (mb->id.flag & LIB_NEW)
+ if (mb->id.tag & LIB_TAG_NEW)
new_id_matar(mb->mat, mb->totcol);
/* material imats */
for (ma = bmain->mat.first; ma; ma = ma->id.next)
- if (ma->id.flag & LIB_NEW)
+ if (ma->id.tag & LIB_TAG_NEW)
for (a = 0; a < MAX_MTEX; a++)
if (ma->mtex[a])
ID_NEW(ma->mtex[a]->object);
@@ -2126,7 +2126,7 @@ enum {
static bool tag_localizable_looper(void *UNUSED(user_data), ID **id_pointer, const int UNUSED(cd_flag))
{
if (*id_pointer) {
- (*id_pointer)->flag &= ~LIB_DOIT;
+ (*id_pointer)->tag &= ~LIB_TAG_DOIT;
}
return true;
}
@@ -2137,19 +2137,19 @@ static void tag_localizable_objects(bContext *C, const int mode)
BKE_main_id_tag_all(bmain, false);
- /* Set LIB_DOIT flag for all selected objects, so next we can check whether
+ /* Set LIB_TAG_DOIT flag for all selected objects, so next we can check whether
* object is gonna to become local or not.
*/
CTX_DATA_BEGIN (C, Object *, object, selected_objects)
{
- object->id.flag |= LIB_DOIT;
+ object->id.tag |= LIB_TAG_DOIT;
/* If data is also gonna to become local, mark data we're interested in
* as gonna-to-be-local.
*/
if (mode == MAKE_LOCAL_SELECT_OBDATA && object->data) {
ID *data_id = (ID *) object->data;
- data_id->flag |= LIB_DOIT;
+ data_id->tag |= LIB_TAG_DOIT;
}
}
CTX_DATA_END;
@@ -2158,12 +2158,12 @@ static void tag_localizable_objects(bContext *C, const int mode)
* them for modifiers or constraints.
*/
for (Object *object = bmain->object.first; object; object = object->id.next) {
- if ((object->id.flag & LIB_DOIT) == 0) {
+ if ((object->id.tag & LIB_TAG_DOIT) == 0) {
BKE_library_foreach_ID_link(&object->id, tag_localizable_looper, NULL, IDWALK_READONLY);
}
if (object->data) {
ID *data_id = (ID *) object->data;
- if ((data_id->flag & LIB_DOIT) == 0) {
+ if ((data_id->tag & LIB_TAG_DOIT) == 0) {
BKE_library_foreach_ID_link(data_id, tag_localizable_looper, NULL, IDWALK_READONLY);
}
}
@@ -2230,7 +2230,7 @@ static int make_local_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN (C, Object *, ob, selected_objects)
{
- if ((ob->id.flag & LIB_DOIT) == 0) {
+ if ((ob->id.tag & LIB_TAG_DOIT) == 0) {
continue;
}
@@ -2250,7 +2250,7 @@ static int make_local_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN (C, Object *, ob, selected_objects)
{
- if ((ob->id.flag & LIB_DOIT) == 0) {
+ if ((ob->id.tag & LIB_TAG_DOIT) == 0) {
continue;
}
@@ -2283,7 +2283,7 @@ static int make_local_exec(bContext *C, wmOperator *op)
if (mode == MAKE_LOCAL_SELECT_OBDATA_MATERIAL) {
CTX_DATA_BEGIN (C, Object *, ob, selected_objects)
{
- if ((ob->id.flag & LIB_DOIT) == 0) {
+ if ((ob->id.tag & LIB_TAG_DOIT) == 0) {
continue;
}
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index 8f00c0eb467..d2bbb73b597 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -768,9 +768,9 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
for (tob = bmain->object.first; tob; tob = tob->id.next) {
if (tob->data)
- ((ID *)tob->data)->flag &= ~LIB_DOIT;
+ ((ID *)tob->data)->tag &= ~LIB_TAG_DOIT;
if (tob->dup_group)
- ((ID *)tob->dup_group)->flag &= ~LIB_DOIT;
+ ((ID *)tob->dup_group)->tag &= ~LIB_TAG_DOIT;
}
for (ctx_ob = ctx_data_list.first;
@@ -791,7 +791,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
if (ob->data == NULL) {
/* special support for dupligroups */
- if ((ob->transflag & OB_DUPLIGROUP) && ob->dup_group && (ob->dup_group->id.flag & LIB_DOIT) == 0) {
+ if ((ob->transflag & OB_DUPLIGROUP) && ob->dup_group && (ob->dup_group->id.tag & LIB_TAG_DOIT) == 0) {
if (ob->dup_group->id.lib) {
tot_lib_error++;
}
@@ -812,7 +812,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
add_v3_v3(ob->dup_group->dupli_ofs, cent);
tot_change++;
- ob->dup_group->id.flag |= LIB_DOIT;
+ ob->dup_group->id.tag |= LIB_TAG_DOIT;
do_inverse_offset = true;
}
}
@@ -833,7 +833,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
BKE_mesh_translate(me, cent_neg, 1);
tot_change++;
- me->id.flag |= LIB_DOIT;
+ me->id.tag |= LIB_TAG_DOIT;
do_inverse_offset = true;
}
else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
@@ -851,7 +851,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
BKE_curve_translate(cu, cent_neg, 1);
tot_change++;
- cu->id.flag |= LIB_DOIT;
+ cu->id.tag |= LIB_TAG_DOIT;
do_inverse_offset = true;
if (obedit) {
@@ -885,7 +885,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
cu->yof = cu->yof - (cent[1] / cu->fsize);
tot_change++;
- cu->id.flag |= LIB_DOIT;
+ cu->id.tag |= LIB_TAG_DOIT;
do_inverse_offset = true;
}
}
@@ -906,7 +906,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
ED_armature_origin_set(scene, ob, cursor, centermode, around);
tot_change++;
- arm->id.flag |= LIB_DOIT;
+ arm->id.tag |= LIB_TAG_DOIT;
/* do_inverse_offset = true; */ /* docenter_armature() handles this */
BKE_object_where_is_calc(scene, ob);
@@ -929,7 +929,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
BKE_mball_translate(mb, cent_neg);
tot_change++;
- mb->id.flag |= LIB_DOIT;
+ mb->id.tag |= LIB_TAG_DOIT;
do_inverse_offset = true;
if (obedit) {
@@ -950,7 +950,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
BKE_lattice_translate(lt, cent_neg, 1);
tot_change++;
- lt->id.flag |= LIB_DOIT;
+ lt->id.tag |= LIB_TAG_DOIT;
do_inverse_offset = true;
}
@@ -1011,7 +1011,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
BLI_freelistN(&ctx_data_list);
for (tob = bmain->object.first; tob; tob = tob->id.next)
- if (tob->data && (((ID *)tob->data)->flag & LIB_DOIT))
+ if (tob->data && (((ID *)tob->data)->tag & LIB_TAG_DOIT))
DAG_id_tag_update(&tob->id, OB_RECALC_OB | OB_RECALC_DATA);
if (tot_change) {