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
path: root/source
diff options
context:
space:
mode:
authorBastien Montagne <b.mont29@gmail.com>2020-03-09 18:36:36 +0300
committerBastien Montagne <b.mont29@gmail.com>2020-03-09 18:56:53 +0300
commitdab1d14a512b02e32327a222a61e3433a07d4885 (patch)
tree2e4aeaf761ee6aaa285d93877346f23cb1d5c7ae /source
parent6965bcc0c90dad86275187a7572b5dc97ed6858a (diff)
Cleanup: Mask: Move to IDTypeInfo and remove unused BKE API.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_idtype.h2
-rw-r--r--source/blender/blenkernel/BKE_mask.h6
-rw-r--r--source/blender/blenkernel/intern/idtype.c2
-rw-r--r--source/blender/blenkernel/intern/lib_id.c8
-rw-r--r--source/blender/blenkernel/intern/lib_id_delete.c2
-rw-r--r--source/blender/blenkernel/intern/mask.c78
6 files changed, 51 insertions, 47 deletions
diff --git a/source/blender/blenkernel/BKE_idtype.h b/source/blender/blenkernel/BKE_idtype.h
index 226b35080b1..bf205a7615f 100644
--- a/source/blender/blenkernel/BKE_idtype.h
+++ b/source/blender/blenkernel/BKE_idtype.h
@@ -153,7 +153,7 @@ extern IDTypeInfo IDType_ID_PA;
// extern IDTypeInfo IDType_ID_GD;
extern IDTypeInfo IDType_ID_WM;
extern IDTypeInfo IDType_ID_MC;
-// extern IDTypeInfo IDType_ID_MSK;
+extern IDTypeInfo IDType_ID_MSK;
// extern IDTypeInfo IDType_ID_LS;
// extern IDTypeInfo IDType_ID_PAL;
extern IDTypeInfo IDType_ID_PC;
diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h
index cdfc406c0a6..9c7d19ea151 100644
--- a/source/blender/blenkernel/BKE_mask.h
+++ b/source/blender/blenkernel/BKE_mask.h
@@ -142,15 +142,9 @@ void BKE_mask_point_select_set_handle(struct MaskSplinePoint *point,
/* general */
struct Mask *BKE_mask_new(struct Main *bmain, const char *name);
-void BKE_mask_copy_data(struct Main *bmain,
- struct Mask *mask_dst,
- const struct Mask *mask_src,
- const int flag);
struct Mask *BKE_mask_copy_nolib(struct Mask *mask);
struct Mask *BKE_mask_copy(struct Main *bmain, const struct Mask *mask);
-void BKE_mask_make_local(struct Main *bmain, struct Mask *mask, const int flags);
-
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]);
diff --git a/source/blender/blenkernel/intern/idtype.c b/source/blender/blenkernel/intern/idtype.c
index 2c19e8bc113..49bf948054e 100644
--- a/source/blender/blenkernel/intern/idtype.c
+++ b/source/blender/blenkernel/intern/idtype.c
@@ -80,7 +80,7 @@ static void id_type_init(void)
// INIT_TYPE(ID_GD);
INIT_TYPE(ID_WM);
INIT_TYPE(ID_MC);
- // INIT_TYPE(ID_MSK);
+ INIT_TYPE(ID_MSK);
// INIT_TYPE(ID_LS);
// INIT_TYPE(ID_PAL);
INIT_TYPE(ID_PC);
diff --git a/source/blender/blenkernel/intern/lib_id.c b/source/blender/blenkernel/intern/lib_id.c
index ff07b6e579c..69f62e8e023 100644
--- a/source/blender/blenkernel/intern/lib_id.c
+++ b/source/blender/blenkernel/intern/lib_id.c
@@ -544,9 +544,7 @@ bool BKE_lib_id_make_local(Main *bmain, ID *id, const bool test, const int flags
BLI_assert(0);
return true;
case ID_MSK:
- if (!test) {
- BKE_mask_make_local(bmain, (Mask *)id, flags);
- }
+ BLI_assert(0);
return true;
case ID_LS:
if (!test) {
@@ -750,7 +748,7 @@ bool BKE_id_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int flag)
BLI_assert(0);
break;
case ID_MSK:
- BKE_mask_copy_data(bmain, (Mask *)*r_newid, (Mask *)id, flag);
+ BLI_assert(0);
break;
case ID_LS:
BKE_linestyle_copy_data(
@@ -1376,7 +1374,7 @@ void BKE_libblock_init_empty(ID *id)
/* Nothing to do. */
break;
case ID_MSK:
- /* Nothing to do. */
+ BLI_assert(0);
break;
case ID_LS:
BKE_linestyle_init((FreestyleLineStyle *)id);
diff --git a/source/blender/blenkernel/intern/lib_id_delete.c b/source/blender/blenkernel/intern/lib_id_delete.c
index 3ccfcfbd8a1..004eedb6164 100644
--- a/source/blender/blenkernel/intern/lib_id_delete.c
+++ b/source/blender/blenkernel/intern/lib_id_delete.c
@@ -226,7 +226,7 @@ void BKE_libblock_free_datablock(ID *id, const int UNUSED(flag))
BLI_assert(0);
break;
case ID_MSK:
- BKE_mask_free((Mask *)id);
+ BLI_assert(0);
break;
case ID_LS:
BKE_linestyle_free((FreestyleLineStyle *)id);
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index a6535bc9b4a..ceb03ec6779 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -45,6 +45,7 @@
#include "BKE_animsys.h"
#include "BKE_curve.h"
+#include "BKE_idtype.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
@@ -59,6 +60,49 @@
static CLG_LogRef LOG = {"bke.mask"};
+static void mask_copy_data(Main *UNUSED(bmain),
+ ID *id_dst,
+ const ID *id_src,
+ const int UNUSED(flag))
+{
+ Mask *mask_dst = (Mask *)id_dst;
+ const Mask *mask_src = (const Mask *)id_src;
+
+ BLI_listbase_clear(&mask_dst->masklayers);
+
+ /* TODO add unused flag to those as well. */
+ BKE_mask_layer_copy_list(&mask_dst->masklayers, &mask_src->masklayers);
+
+ /* enable fake user by default */
+ id_fake_user_set(&mask_dst->id);
+}
+
+static void mask_free_data(ID *id)
+{
+ Mask *mask = (Mask *)id;
+
+ BKE_animdata_free((ID *)mask, false);
+
+ /* free mask data */
+ BKE_mask_layer_free_list(&mask->masklayers);
+}
+
+IDTypeInfo IDType_ID_MSK = {
+ .id_code = ID_MSK,
+ .id_filter = FILTER_ID_MSK,
+ .main_listbase_index = INDEX_ID_MSK,
+ .struct_size = sizeof(Mask),
+ .name = "Mask",
+ .name_plural = "masks",
+ .translation_context = BLT_I18NCONTEXT_ID_MASK,
+ .flags = 0,
+
+ .init_data = NULL,
+ .copy_data = mask_copy_data,
+ .free_data = mask_free_data,
+ .make_local = NULL,
+};
+
static struct {
ListBase splines;
struct GHash *id_hash;
@@ -875,30 +919,6 @@ Mask *BKE_mask_copy_nolib(Mask *mask)
return mask_new;
}
-/**
- * Only copy internal data of Mask ID from source
- * to already allocated/initialized destination.
- * You probably never want to use that directly,
- * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
- *
- * WARNING! This function will not handle ID user count!
- *
- * \param flag: Copying options (see BKE_lib_id.h's LIB_ID_COPY_... flags for more).
- */
-void BKE_mask_copy_data(Main *UNUSED(bmain),
- Mask *mask_dst,
- const Mask *mask_src,
- const int UNUSED(flag))
-{
- BLI_listbase_clear(&mask_dst->masklayers);
-
- /* TODO add unused flag to those as well. */
- BKE_mask_layer_copy_list(&mask_dst->masklayers, &mask_src->masklayers);
-
- /* enable fake user by default */
- id_fake_user_set(&mask_dst->id);
-}
-
Mask *BKE_mask_copy(Main *bmain, const Mask *mask)
{
Mask *mask_copy;
@@ -906,11 +926,6 @@ Mask *BKE_mask_copy(Main *bmain, const Mask *mask)
return mask_copy;
}
-void BKE_mask_make_local(Main *bmain, Mask *mask, const int flags)
-{
- BKE_lib_id_make_local_generic(bmain, &mask->id, flags);
-}
-
void BKE_mask_point_free(MaskSplinePoint *point)
{
if (point->uw) {
@@ -1059,10 +1074,7 @@ 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)
{
- BKE_animdata_free((ID *)mask, false);
-
- /* free mask data */
- BKE_mask_layer_free_list(&mask->masklayers);
+ mask_free_data(&mask->id);
}
void BKE_mask_coord_from_frame(float r_co[2], const float co[2], const float frame_size[2])