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 <bastien@blender.org>2020-10-08 12:36:11 +0300
committerBastien Montagne <bastien@blender.org>2020-10-08 12:40:55 +0300
commitdf5fe9718b18aa730662fb7b0fe43bd02b22d0bf (patch)
tree07eaa53b2339fb2909d9567227897f18e8bf51a9
parentfdb2240e4d06e9e552d6cd9ce4ec8d1ab2a6a448 (diff)
Cleanup: Remove `BKE_mask_copy_nolib()` and `BKE_mask_free()`.
Generic ID management code can now do those local temp copy handling, so no need for duplicated own code for that. No behavioral changes expected here.
-rw-r--r--source/blender/blenkernel/BKE_mask.h3
-rw-r--r--source/blender/blenkernel/intern/mask.c27
-rw-r--r--source/blender/compositor/operations/COM_MaskOperation.cpp9
-rw-r--r--source/blender/sequencer/intern/sequencer.c6
4 files changed, 7 insertions, 38 deletions
diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h
index 80092c1d61a..29072742f81 100644
--- a/source/blender/blenkernel/BKE_mask.h
+++ b/source/blender/blenkernel/BKE_mask.h
@@ -141,9 +141,6 @@ void BKE_mask_point_select_set_handle(struct MaskSplinePoint *point,
/* general */
struct Mask *BKE_mask_new(struct Main *bmain, const char *name);
-struct Mask *BKE_mask_copy_nolib(struct Mask *mask);
-
-void BKE_mask_free(struct Mask *mask);
void BKE_mask_coord_from_frame(float r_co[2], const float co[2], const float frame_size[2]);
void BKE_mask_coord_from_movieclip(struct MovieClip *clip,
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index 2f71d1ad99f..1f9f155ee55 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -1053,27 +1053,6 @@ Mask *BKE_mask_new(Main *bmain, const char *name)
return mask;
}
-/* TODO(sergey): Use generic BKE_libblock_copy_nolib() instead. */
-/* TODO(bastien): Use new super cool & generic BKE_id_copy_ex() instead! */
-Mask *BKE_mask_copy_nolib(Mask *mask)
-{
- Mask *mask_new;
-
- mask_new = MEM_dupallocN(mask);
-
- /*take care here! - we may want to copy anim data */
- mask_new->adt = NULL;
-
- BLI_listbase_clear(&mask_new->masklayers);
-
- BKE_mask_layer_copy_list(&mask_new->masklayers, &mask->masklayers);
-
- /* enable fake user by default */
- id_fake_user_set(&mask->id);
-
- return mask_new;
-}
-
void BKE_mask_point_free(MaskSplinePoint *point)
{
if (point->uw) {
@@ -1216,12 +1195,6 @@ void BKE_mask_layer_free_list(ListBase *masklayers)
}
}
-/** Free (or release) any data used by this mask (does not free the mask itself). */
-void BKE_mask_free(Mask *mask)
-{
- mask_free_data(&mask->id);
-}
-
void BKE_mask_coord_from_frame(float r_co[2], const float co[2], const float frame_size[2])
{
if (frame_size[0] == frame_size[1]) {
diff --git a/source/blender/compositor/operations/COM_MaskOperation.cpp b/source/blender/compositor/operations/COM_MaskOperation.cpp
index bdc954ac081..9fc7448ce42 100644
--- a/source/blender/compositor/operations/COM_MaskOperation.cpp
+++ b/source/blender/compositor/operations/COM_MaskOperation.cpp
@@ -23,6 +23,7 @@
#include "BLI_listbase.h"
#include "BLI_math.h"
+#include "BKE_lib_id.h"
#include "BKE_mask.h"
MaskOperation::MaskOperation() : NodeOperation()
@@ -59,9 +60,8 @@ void MaskOperation::initExecution()
const float frame_step = (this->m_frame_shutter * 2.0f) / this->m_rasterMaskHandleTot;
float frame_iter = frame;
- Mask *mask_temp;
-
- mask_temp = BKE_mask_copy_nolib(this->m_mask);
+ Mask *mask_temp = (Mask *)BKE_id_copy_ex(
+ NULL, &this->m_mask->id, NULL, LIB_ID_COPY_LOCALIZE | LIB_ID_COPY_NO_ANIMDATA);
/* trick so we can get unkeyed edits to display */
{
@@ -92,8 +92,7 @@ void MaskOperation::initExecution()
frame_iter += frame_step;
}
- BKE_mask_free(mask_temp);
- MEM_freeN(mask_temp);
+ BKE_id_free(NULL, &mask_temp->id);
}
}
}
diff --git a/source/blender/sequencer/intern/sequencer.c b/source/blender/sequencer/intern/sequencer.c
index b8ccdec0902..cb62ffe500b 100644
--- a/source/blender/sequencer/intern/sequencer.c
+++ b/source/blender/sequencer/intern/sequencer.c
@@ -3387,7 +3387,8 @@ static ImBuf *seq_render_mask(const SeqRenderData *context, Mask *mask, float nr
Mask *mask_temp;
MaskRasterHandle *mr_handle;
- mask_temp = BKE_mask_copy_nolib(mask);
+ mask_temp = (Mask *)BKE_id_copy_ex(
+ NULL, &mask->id, NULL, LIB_ID_COPY_LOCALIZE | LIB_ID_COPY_NO_ANIMDATA);
BKE_mask_evaluate(mask_temp, mask->sfra + nr, true);
@@ -3404,8 +3405,7 @@ static ImBuf *seq_render_mask(const SeqRenderData *context, Mask *mask, float nr
BKE_maskrasterize_handle_init(
mr_handle, mask_temp, context->rectx, context->recty, true, true, true);
- BKE_mask_free(mask_temp);
- MEM_freeN(mask_temp);
+ BKE_id_free(NULL, &mask_temp->id);
BKE_maskrasterize_buffer(mr_handle, context->rectx, context->recty, maskbuf);