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:
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/curve/editcurve.c3
-rw-r--r--source/blender/editors/curve/editfont.c5
-rw-r--r--source/blender/editors/mesh/meshtools.c6
-rw-r--r--source/blender/editors/object/object_add.c44
-rw-r--r--source/blender/editors/object/object_edit.c12
-rw-r--r--source/blender/editors/object/object_relations.c28
-rw-r--r--source/blender/editors/physics/particle_object.c2
-rw-r--r--source/blender/editors/render/render_shading.c10
-rw-r--r--source/blender/editors/sound/sound_ops.c2
-rw-r--r--source/blender/editors/space_action/action_data.c4
-rw-r--r--source/blender/editors/space_clip/clip_ops.c3
-rw-r--r--source/blender/editors/space_image/image_ops.c4
-rw-r--r--source/blender/editors/space_logic/logic_window.c8
-rw-r--r--source/blender/editors/space_nla/nla_edit.c2
-rw-r--r--source/blender/editors/space_node/drawnode.c2
-rw-r--r--source/blender/editors/space_node/node_add.c2
-rw-r--r--source/blender/editors/space_node/node_edit.c4
-rw-r--r--source/blender/editors/space_node/node_templates.c2
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c4
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c2
-rw-r--r--source/blender/editors/transform/transform_generics.c3
21 files changed, 84 insertions, 68 deletions
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index f7dab0c0935..5a47cc148d2 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -49,6 +49,7 @@
#include "BKE_fcurve.h"
#include "BKE_global.h"
#include "BKE_key.h"
+#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_report.h"
#include "BKE_animsys.h"
@@ -1298,7 +1299,7 @@ static int separate_exec(bContext *C, wmOperator *op)
newob = newbase->object;
newcu = newob->data = BKE_curve_copy(oldcu);
newcu->editnurb = NULL;
- oldcu->id.us--; /* because new curve is a copy: reduce user count */
+ id_us_min(&oldcu->id); /* because new curve is a copy: reduce user count */
/* 3. put new object in editmode, clear it and set separated nurbs */
make_editNurb(newob);
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index ea6b6154be8..1eee5d04c56 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -51,6 +51,7 @@
#include "BKE_curve.h"
#include "BKE_depsgraph.h"
#include "BKE_font.h"
+#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_report.h"
@@ -538,7 +539,7 @@ static void txt_add_object(bContext *C, TextLine *firstline, int totline, const
cu = obedit->data;
cu->vfont = BKE_vfont_builtin_get();
- cu->vfont->id.us++;
+ id_us_plus(&cu->vfont->id);
for (tmp = firstline, a = 0; nbytes < MAXTEXT && a < totline; tmp = tmp->next, a++) {
size_t nchars_line, nbytes_line;
@@ -1727,7 +1728,7 @@ static int font_open_exec(bContext *C, wmOperator *op)
if (pprop->prop) {
/* when creating new ID blocks, use is already 1, but RNA
* pointer se also increases user, so this compensates it */
- font->id.us--;
+ id_us_min(&font->id);
RNA_id_pointer_create(&font->id, &idptr);
RNA_property_pointer_set(&pprop->ptr, pprop->prop, idptr);
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index 2491685161c..dee003135a2 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -513,11 +513,13 @@ int join_mesh_exec(bContext *C, wmOperator *op)
/* old material array */
for (a = 1; a <= ob->totcol; a++) {
ma = ob->mat[a - 1];
- if (ma) ma->id.us--;
+ if (ma)
+ id_us_min(&ma->id);
}
for (a = 1; a <= me->totcol; a++) {
ma = me->mat[a - 1];
- if (ma) ma->id.us--;
+ if (ma)
+ id_us_min(&ma->id);
}
if (ob->mat) MEM_freeN(ob->mat);
if (ob->matbits) MEM_freeN(ob->matbits);
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 269700c3aef..2cead58300d 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -1587,7 +1587,7 @@ static int convert_exec(bContext *C, wmOperator *op)
/* decrement original mesh's usage count */
me = newob->data;
- me->id.us--;
+ id_us_min(&me->id);
/* make a new copy of the mesh */
newob->data = BKE_mesh_copy(me);
@@ -1612,7 +1612,7 @@ static int convert_exec(bContext *C, wmOperator *op)
/* decrement original mesh's usage count */
me = newob->data;
- me->id.us--;
+ id_us_min(&me->id);
/* make a new copy of the mesh */
newob->data = BKE_mesh_copy(me);
@@ -1643,7 +1643,7 @@ static int convert_exec(bContext *C, wmOperator *op)
newob = basen->object;
/* decrement original curve's usage count */
- ((Curve *)newob->data)->id.us--;
+ id_us_min(&((Curve *)newob->data)->id);
/* make a new copy of the curve */
newob->data = BKE_curve_copy(ob->data);
@@ -1664,19 +1664,19 @@ static int convert_exec(bContext *C, wmOperator *op)
cu->type = OB_CURVE;
if (cu->vfont) {
- cu->vfont->id.us--;
+ id_us_min(&cu->vfont->id);
cu->vfont = NULL;
}
if (cu->vfontb) {
- cu->vfontb->id.us--;
+ id_us_min(&cu->vfontb->id);
cu->vfontb = NULL;
}
if (cu->vfonti) {
- cu->vfonti->id.us--;
+ id_us_min(&cu->vfonti->id);
cu->vfonti = NULL;
}
if (cu->vfontbi) {
- cu->vfontbi->id.us--;
+ id_us_min(&cu->vfontbi->id);
cu->vfontbi = NULL;
}
@@ -1714,7 +1714,7 @@ static int convert_exec(bContext *C, wmOperator *op)
newob = basen->object;
/* decrement original curve's usage count */
- ((Curve *)newob->data)->id.us--;
+ id_us_min(&((Curve *)newob->data)->id);
/* make a new copy of the curve */
newob->data = BKE_curve_copy(ob->data);
@@ -1749,7 +1749,7 @@ static int convert_exec(bContext *C, wmOperator *op)
newob = basen->object;
mb = newob->data;
- mb->id.us--;
+ id_us_min(&mb->id);
newob->data = BKE_mesh_add(bmain, "Mesh");
newob->type = OB_MESH;
@@ -1915,7 +1915,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
ID_NEW_US(obn->mat[a])
else
obn->mat[a] = BKE_material_copy(obn->mat[a]);
- id->us--;
+ id_us_min(id);
if (dupflag & USER_DUP_ACT) {
BKE_animdata_copy_id_action(&obn->mat[a]->id);
@@ -1936,7 +1936,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
BKE_animdata_copy_id_action(&psys->part->id);
}
- id->us--;
+ id_us_min(id);
}
}
}
@@ -1952,7 +1952,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
obn->data = BKE_mesh_copy(obn->data);
didit = 1;
}
- id->us--;
+ id_us_min(id);
}
break;
case OB_CURVE:
@@ -1962,7 +1962,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
obn->data = BKE_curve_copy(obn->data);
didit = 1;
}
- id->us--;
+ id_us_min(id);
}
break;
case OB_SURF:
@@ -1972,7 +1972,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
obn->data = BKE_curve_copy(obn->data);
didit = 1;
}
- id->us--;
+ id_us_min(id);
}
break;
case OB_FONT:
@@ -1982,7 +1982,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
obn->data = BKE_curve_copy(obn->data);
didit = 1;
}
- id->us--;
+ id_us_min(id);
}
break;
case OB_MBALL:
@@ -1992,7 +1992,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
obn->data = BKE_mball_copy(obn->data);
didit = 1;
}
- id->us--;
+ id_us_min(id);
}
break;
case OB_LAMP:
@@ -2002,7 +2002,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
obn->data = BKE_lamp_copy(obn->data);
didit = 1;
}
- id->us--;
+ id_us_min(id);
}
break;
case OB_ARMATURE:
@@ -2016,7 +2016,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
BKE_pose_rebuild(obn, obn->data);
didit = 1;
}
- id->us--;
+ id_us_min(id);
}
break;
case OB_LATTICE:
@@ -2026,7 +2026,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
obn->data = BKE_lattice_copy(obn->data);
didit = 1;
}
- id->us--;
+ id_us_min(id);
}
break;
case OB_CAMERA:
@@ -2036,7 +2036,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
obn->data = BKE_camera_copy(obn->data);
didit = 1;
}
- id->us--;
+ id_us_min(id);
}
break;
case OB_SPEAKER:
@@ -2046,7 +2046,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
obn->data = BKE_speaker_copy(obn->data);
didit = 1;
}
- id->us--;
+ id_us_min(id);
}
break;
}
@@ -2083,7 +2083,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
ID_NEW_US((*matarar)[a])
else
(*matarar)[a] = BKE_material_copy((*matarar)[a]);
- id->us--;
+ id_us_min(id);
}
}
}
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index c87eeaeb4a3..9b7563ae729 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -934,16 +934,20 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
cu1->wordspace = cu->wordspace;
cu1->ulpos = cu->ulpos;
cu1->ulheight = cu->ulheight;
- if (cu1->vfont) cu1->vfont->id.us--;
+ if (cu1->vfont)
+ id_us_min(&cu1->vfont->id);
cu1->vfont = cu->vfont;
id_us_plus((ID *)cu1->vfont);
- if (cu1->vfontb) cu1->vfontb->id.us--;
+ if (cu1->vfontb)
+ id_us_min(&cu1->vfontb->id);
cu1->vfontb = cu->vfontb;
id_us_plus((ID *)cu1->vfontb);
- if (cu1->vfonti) cu1->vfonti->id.us--;
+ if (cu1->vfonti)
+ id_us_min(&cu1->vfonti->id);
cu1->vfonti = cu->vfonti;
id_us_plus((ID *)cu1->vfonti);
- if (cu1->vfontbi) cu1->vfontbi->id.us--;
+ if (cu1->vfontbi)
+ id_us_min(&cu1->vfontbi->id);
cu1->vfontbi = cu->vfontbi;
id_us_plus((ID *)cu1->vfontbi);
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 3d030f1a770..a89ef8b7e85 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -1555,7 +1555,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
switch (type) {
case MAKE_LINKS_OBDATA: /* obdata */
- obdata_id->us--;
+ id_us_min(obdata_id);
obdata_id = ob_src->data;
id_us_plus(obdata_id);
@@ -1624,16 +1624,20 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
break;
}
- if (cu_dst->vfont) cu_dst->vfont->id.us--;
+ if (cu_dst->vfont)
+ id_us_min(&cu_dst->vfont->id);
cu_dst->vfont = cu_src->vfont;
id_us_plus((ID *)cu_dst->vfont);
- if (cu_dst->vfontb) cu_dst->vfontb->id.us--;
+ if (cu_dst->vfontb)
+ id_us_min(&cu_dst->vfontb->id);
cu_dst->vfontb = cu_src->vfontb;
id_us_plus((ID *)cu_dst->vfontb);
- if (cu_dst->vfonti) cu_dst->vfonti->id.us--;
+ if (cu_dst->vfonti)
+ id_us_min(&cu_dst->vfonti->id);
cu_dst->vfonti = cu_src->vfonti;
id_us_plus((ID *)cu_dst->vfonti);
- if (cu_dst->vfontbi) cu_dst->vfontbi->id.us--;
+ if (cu_dst->vfontbi)
+ id_us_min(&cu_dst->vfontbi->id);
cu_dst->vfontbi = cu_src->vfontbi;
id_us_plus((ID *)cu_dst->vfontbi);
@@ -1758,7 +1762,7 @@ static void single_object_users(Main *bmain, Scene *scene, View3D *v3d, const in
}
base->flag = obn->flag;
- ob->id.us--;
+ id_us_min(&ob->id);
}
}
}
@@ -1826,11 +1830,11 @@ static void new_id_matar(Material **matar, const int totcol)
if (id->newid) {
matar[a] = (Material *)id->newid;
id_us_plus(id->newid);
- id->us--;
+ id_us_min(id);
}
else if (id->us > 1) {
matar[a] = BKE_material_copy(matar[a]);
- id->us--;
+ id_us_min(id);
id->newid = (ID *)matar[a];
}
}
@@ -1912,7 +1916,7 @@ static void single_obdata_users(Main *bmain, Scene *scene, const int flag)
*/
BKE_animdata_copy_id_action((ID *)ob->data);
- id->us--;
+ id_us_min(id);
id->newid = ob->data;
}
}
@@ -1966,7 +1970,7 @@ static void single_mat_users(Scene *scene, const int flag, const bool do_texture
for (b = 0; b < MAX_MTEX; b++) {
if (ma->mtex[b] && (tex = ma->mtex[b]->tex)) {
if (tex->id.us > 1) {
- tex->id.us--;
+ id_us_min(&tex->id);
tex = BKE_texture_copy(tex);
BKE_animdata_copy_id_action(&tex->id);
man->mtex[b]->tex = tex;
@@ -1991,13 +1995,13 @@ static void do_single_tex_user(Tex **from)
if (tex->id.newid) {
*from = (Tex *)tex->id.newid;
id_us_plus(tex->id.newid);
- tex->id.us--;
+ id_us_min(&tex->id);
}
else if (tex->id.us > 1) {
texn = BKE_texture_copy(tex);
BKE_animdata_copy_id_action(&texn->id);
tex->id.newid = (ID *)texn;
- tex->id.us--;
+ id_us_min(&tex->id);
*from = texn;
}
}
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index 337e7e99929..6d143fb13f3 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -202,7 +202,7 @@ static int new_particle_settings_exec(bContext *C, wmOperator *UNUSED(op))
ob= ptr.id.data;
if (psys->part)
- psys->part->id.us--;
+ id_us_min(&psys->part->id);
psys->part = part;
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index 2e07e19e366..b540b9df16f 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -481,7 +481,7 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op))
if (prop) {
/* when creating new ID blocks, use is already 1, but RNA
* pointer use also increases user, so this compensates it */
- ma->id.us--;
+ id_us_min(&ma->id);
RNA_id_pointer_create(&ma->id, &idptr);
RNA_property_pointer_set(&ptr, prop, idptr);
@@ -530,7 +530,7 @@ static int new_texture_exec(bContext *C, wmOperator *UNUSED(op))
if (prop) {
/* when creating new ID blocks, use is already 1, but RNA
* pointer se also increases user, so this compensates it */
- tex->id.us--;
+ id_us_min(&tex->id);
if (ptr.id.data && GS(((ID *)ptr.id.data)->name) == ID_MA &&
RNA_property_pointer_get(&ptr, prop).id.data == NULL)
@@ -593,7 +593,7 @@ static int new_world_exec(bContext *C, wmOperator *UNUSED(op))
if (prop) {
/* when creating new ID blocks, use is already 1, but RNA
* pointer se also increases user, so this compensates it */
- wo->id.us--;
+ id_us_min(&wo->id);
RNA_id_pointer_create(&wo->id, &idptr);
RNA_property_pointer_set(&ptr, prop, idptr);
@@ -1039,7 +1039,7 @@ static int freestyle_linestyle_new_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
if (lineset->linestyle) {
- lineset->linestyle->id.us--;
+ id_us_min(&lineset->linestyle->id);
lineset->linestyle = BKE_linestyle_copy(bmain, lineset->linestyle);
}
else {
@@ -1826,7 +1826,7 @@ static void paste_mtex_copybuf(ID *id)
*mtex = MEM_mallocN(sizeof(MTex), "mtex copy");
}
else if ((*mtex)->tex) {
- (*mtex)->tex->id.us--;
+ id_us_min(&(*mtex)->tex->id);
}
memcpy(*mtex, &mtexcopybuf, sizeof(MTex));
diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c
index f8d84cc0276..ffb1898d816 100644
--- a/source/blender/editors/sound/sound_ops.c
+++ b/source/blender/editors/sound/sound_ops.c
@@ -137,7 +137,7 @@ static int sound_open_exec(bContext *C, wmOperator *op)
if (pprop->prop) {
/* when creating new ID blocks, use is already 1, but RNA
* pointer se also increases user, so this compensates it */
- sound->id.us--;
+ id_us_min(&sound->id);
RNA_id_pointer_create(&sound->id, &idptr);
RNA_property_pointer_set(&pprop->ptr, pprop->prop, idptr);
diff --git a/source/blender/editors/space_action/action_data.c b/source/blender/editors/space_action/action_data.c
index c3519423773..8ce126b439e 100644
--- a/source/blender/editors/space_action/action_data.c
+++ b/source/blender/editors/space_action/action_data.c
@@ -133,7 +133,7 @@ static bAction *action_create_new(bContext *C, bAction *oldact)
* for that here
*/
BLI_assert(action->id.us == 1);
- action->id.us--;
+ id_us_min(&action->id);
/* set ID-Root type */
if (sa->spacetype == SPACE_ACTION) {
@@ -583,7 +583,7 @@ void ED_animedit_unlink_action(bContext *C, ID *id, AnimData *adt, bAction *act,
/* Clear Fake User */
if (act->id.flag & LIB_FAKEUSER) {
act->id.flag &= ~LIB_FAKEUSER;
- act->id.us--;
+ id_us_min(&act->id);
}
}
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index af3d460fe0f..f66425e0a1a 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -57,6 +57,7 @@
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_report.h"
+#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_movieclip.h"
#include "BKE_sound.h"
@@ -234,7 +235,7 @@ static int open_exec(bContext *C, wmOperator *op)
if (pprop->prop) {
/* when creating new ID blocks, use is already 1, but RNA
* pointer se also increases user, so this compensates it */
- clip->id.us--;
+ id_us_min(&clip->id);
RNA_id_pointer_create(&clip->id, &idptr);
RNA_property_pointer_set(&pprop->ptr, pprop->prop, idptr);
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index ab062eb133b..a07d274b69b 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -1169,7 +1169,7 @@ static int image_open_exec(bContext *C, wmOperator *op)
if (iod->pprop.prop) {
/* when creating new ID blocks, use is already 1, but RNA
* pointer se also increases user, so this compensates it */
- ima->id.us--;
+ id_us_min(&ima->id);
if ((frame_seq_len > 1) && ima->source == IMA_SRC_FILE) {
ima->source = IMA_SRC_SEQUENCE;
}
@@ -2276,7 +2276,7 @@ static int image_new_exec(bContext *C, wmOperator *op)
if (prop) {
/* when creating new ID blocks, use is already 1, but RNA
* pointer se also increases user, so this compensates it */
- ima->id.us--;
+ id_us_min(&ima->id);
RNA_id_pointer_create(&ima->id, &idptr);
RNA_property_pointer_set(&ptr, prop, idptr);
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c
index 8802ab52725..874e54ba5e7 100644
--- a/source/blender/editors/space_logic/logic_window.c
+++ b/source/blender/editors/space_logic/logic_window.c
@@ -52,6 +52,7 @@
#include "BKE_action.h"
#include "BKE_context.h"
+#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_sca.h"
@@ -308,12 +309,13 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
}
if (sa->sound)
- ((ID *)sa->sound)->us--;
+ id_us_min(((ID *)sa->sound));
sa->sound= (struct bSound *)sound;
- if (sound)
- sound->us++;
+ if (sound) {
+ id_us_plus(sound);
+ }
sa->sndnr= 0;
didit= 1;
diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c
index f7673d86f94..36a4800b59d 100644
--- a/source/blender/editors/space_nla/nla_edit.c
+++ b/source/blender/editors/space_nla/nla_edit.c
@@ -1953,7 +1953,7 @@ static int nlaedit_apply_scale_exec(bContext *C, wmOperator *UNUSED(op))
bAction *act = BKE_action_copy(strip->act);
/* set this as the new referenced action, decrementing the users of the old one */
- strip->act->id.us--;
+ id_us_min(&strip->act->id);
strip->act = act;
}
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index c830b94588c..960a5614097 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -247,7 +247,7 @@ static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v)
if (node->menunr < 1) return;
if (node->id) {
- node->id->us--;
+ id_us_min(node->id);
node->id = NULL;
}
tex = BLI_findlink(&bmain->tex, node->menunr - 1);
diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c
index ab7fa51856a..aef1116b0b8 100644
--- a/source/blender/editors/space_node/node_add.c
+++ b/source/blender/editors/space_node/node_add.c
@@ -487,7 +487,7 @@ static int new_node_tree_exec(bContext *C, wmOperator *op)
/* RNA_property_pointer_set increases the user count,
* fixed here as the editor is the initial user.
*/
- ntree->id.us--;
+ id_us_min(&ntree->id);
RNA_id_pointer_create(&ntree->id, &idptr);
RNA_property_pointer_set(&ptr, prop, idptr);
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index ffd51bcc44e..108f12f592f 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -1669,7 +1669,7 @@ static int node_delete_exec(bContext *C, wmOperator *UNUSED(op))
if (node->flag & SELECT) {
/* check id user here, nodeFreeNode is called for free dbase too */
if (node->id)
- node->id->us--;
+ id_us_min(node->id);
nodeFreeNode(snode->edittree, node);
}
}
@@ -1760,7 +1760,7 @@ static int node_delete_reconnect_exec(bContext *C, wmOperator *UNUSED(op))
/* check id user here, nodeFreeNode is called for free dbase too */
if (node->id)
- node->id->us--;
+ id_us_min(node->id);
nodeFreeNode(snode->edittree, node);
}
}
diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c
index ec6ef3c4697..d8dca7b63d4 100644
--- a/source/blender/editors/space_node/node_templates.c
+++ b/source/blender/editors/space_node/node_templates.c
@@ -150,7 +150,7 @@ static void node_remove_linked(bNodeTree *ntree, bNode *rem_node)
if (node->flag & NODE_TEST) {
if (node->id)
- node->id->us--;
+ id_us_min(node->id);
nodeFreeNode(ntree, node);
}
}
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index a209681e18c..c0464c84061 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -172,7 +172,7 @@ static void unlink_material_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeEl
if (LIKELY(matar != NULL)) {
for (a = 0; a < totcol; a++) {
if (a == te->index && matar[a]) {
- matar[a]->id.us--;
+ id_us_min(&matar[a]->id);
matar[a] = NULL;
}
}
@@ -208,7 +208,7 @@ static void unlink_texture_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeEle
for (a = 0; a < MAX_MTEX; a++) {
if (a == te->index && mtex[a]) {
if (mtex[a]->tex) {
- mtex[a]->tex->id.us--;
+ id_us_min(&mtex[a]->tex->id);
mtex[a]->tex = NULL;
}
}
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 9d8db67b3ee..e9a4bc81e14 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -2386,7 +2386,7 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
/* remove seq so overlap tests don't conflict,
* see seq_free_sequence below for the real free'ing */
BLI_remlink(ed->seqbasep, seq);
- /* if (seq->ipo) seq->ipo->id.us--; */
+ /* if (seq->ipo) id_us_min(&seq->ipo->id); */
/* XXX, remove fcurve and assign to split image strips */
start_ofs = cfra = BKE_sequence_tx_get_final_left(seq, false);
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index b57941c2f1f..baafaece2e5 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -73,6 +73,7 @@
#include "BKE_depsgraph.h"
#include "BKE_fcurve.h"
#include "BKE_lattice.h"
+#include "BKE_library.h"
#include "BKE_nla.h"
#include "BKE_context.h"
#include "BKE_paint.h"
@@ -278,7 +279,7 @@ static void animrecord_check_state(Scene *scene, ID *id, wmTimer *animtimer)
NlaStrip *strip = add_nlastrip_to_stack(adt, adt->action);
/* clear reference to action now that we've pushed it onto the stack */
- adt->action->id.us--;
+ id_us_min(&adt->action->id);
adt->action = NULL;
/* adjust blending + extend so that they will behave correctly */