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:
authorJacques Lucke <jacques@blender.org>2020-09-10 17:23:53 +0300
committerJacques Lucke <jacques@blender.org>2020-09-10 17:23:53 +0300
commitea1094bdb0419b97174dd95a5887cd6cf2732d22 (patch)
treea2ab492975f0cdc3b175453624d8aba43b1e1c54 /source/blender/blenloader
parent94c533ac35d4ad5d944c214d4809011b61be4a94 (diff)
Refactor: move Material .blend I/O to IDTypeInfo callbacks
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c59
-rw-r--r--source/blender/blenloader/intern/writefile.c34
2 files changed, 3 insertions, 90 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 85b7c1e5623..277ccce3560 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -3115,43 +3115,6 @@ static void direct_link_texture(BlendDataReader *reader, Tex *tex)
/** \} */
/* -------------------------------------------------------------------- */
-/** \name Read ID: Material
- * \{ */
-
-static void lib_link_material(BlendLibReader *reader, Material *ma)
-{
- BLO_read_id_address(reader, ma->id.lib, &ma->ipo); // XXX deprecated - old animation system
-
- /* relink grease pencil settings */
- if (ma->gp_style != NULL) {
- MaterialGPencilStyle *gp_style = ma->gp_style;
- if (gp_style->sima != NULL) {
- BLO_read_id_address(reader, ma->id.lib, &gp_style->sima);
- }
- if (gp_style->ima != NULL) {
- BLO_read_id_address(reader, ma->id.lib, &gp_style->ima);
- }
- }
-}
-
-static void direct_link_material(BlendDataReader *reader, Material *ma)
-{
- BLO_read_data_address(reader, &ma->adt);
- BKE_animdata_blend_read_data(reader, ma->adt);
-
- ma->texpaintslot = NULL;
-
- BLO_read_data_address(reader, &ma->preview);
- BKE_previewimg_blend_read(reader, ma->preview);
-
- BLI_listbase_clear(&ma->gpumaterial);
-
- BLO_read_data_address(reader, &ma->gp_style);
-}
-
-/** \} */
-
-/* -------------------------------------------------------------------- */
/** \name Read ID: Particle Settings
* \{ */
@@ -7079,9 +7042,6 @@ static bool direct_link_id(FileData *fd, Main *main, const int tag, ID *id, ID *
case ID_MB:
direct_link_mball(&reader, (MetaBall *)id);
break;
- case ID_MA:
- direct_link_material(&reader, (Material *)id);
- break;
case ID_TE:
direct_link_texture(&reader, (Tex *)id);
break;
@@ -7155,6 +7115,7 @@ static bool direct_link_id(FileData *fd, Main *main, const int tag, ID *id, ID *
case ID_BR:
case ID_IM:
case ID_LA:
+ case ID_MA:
/* Do nothing. Handled by IDTypeInfo callback. */
break;
}
@@ -7823,9 +7784,6 @@ static void lib_link_all(FileData *fd, Main *bmain)
case ID_VO:
lib_link_volume(&reader, (Volume *)id);
break;
- case ID_MA:
- lib_link_material(&reader, (Material *)id);
- break;
case ID_TE:
lib_link_texture(&reader, (Tex *)id);
break;
@@ -7858,6 +7816,7 @@ static void lib_link_all(FileData *fd, Main *bmain)
case ID_BR:
case ID_IM:
case ID_LA:
+ case ID_MA:
/* Do nothing. Handled by IDTypeInfo callback. */
break;
}
@@ -8554,17 +8513,6 @@ static void expand_texture(BlendExpander *expander, Tex *tex)
BLO_expand(expander, tex->ipo); // XXX deprecated - old animation system
}
-static void expand_material(BlendExpander *expander, Material *ma)
-{
- BLO_expand(expander, ma->ipo); // XXX deprecated - old animation system
-
- if (ma->gp_style) {
- MaterialGPencilStyle *gp_style = ma->gp_style;
- BLO_expand(expander, gp_style->sima);
- BLO_expand(expander, gp_style->ima);
- }
-}
-
static void expand_world(BlendExpander *expander, World *wrld)
{
BLO_expand(expander, wrld->ipo); // XXX deprecated - old animation system
@@ -9006,9 +8954,6 @@ void BLO_expand_main(void *fdhandle, Main *mainvar)
case ID_SCE:
expand_scene(&expander, (Scene *)id);
break;
- case ID_MA:
- expand_material(&expander, (Material *)id);
- break;
case ID_TE:
expand_texture(&expander, (Tex *)id);
break;
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 24ca503b895..acf4e1ca635 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1531,36 +1531,6 @@ static void write_texture(BlendWriter *writer, Tex *tex, const void *id_address)
}
}
-static void write_material(BlendWriter *writer, Material *ma, const void *id_address)
-{
- if (ma->id.us > 0 || BLO_write_is_undo(writer)) {
- /* Clean up, important in undo case to reduce false detection of changed datablocks. */
- ma->texpaintslot = NULL;
- BLI_listbase_clear(&ma->gpumaterial);
-
- /* write LibData */
- BLO_write_id_struct(writer, Material, id_address, &ma->id);
- BKE_id_blend_write(writer, &ma->id);
-
- if (ma->adt) {
- BKE_animdata_blend_write(writer, ma->adt);
- }
-
- /* nodetree is integral part of material, no libdata */
- if (ma->nodetree) {
- BLO_write_struct(writer, bNodeTree, ma->nodetree);
- ntreeBlendWrite(writer, ma->nodetree);
- }
-
- BKE_previewimg_blend_write(writer, ma->preview);
-
- /* grease pencil settings */
- if (ma->gp_style) {
- BLO_write_struct(writer, MaterialGPencilStyle, ma->gp_style);
- }
- }
-}
-
static void write_world(BlendWriter *writer, World *wrld, const void *id_address)
{
if (wrld->id.us > 0 || BLO_write_is_undo(writer)) {
@@ -2891,9 +2861,6 @@ static bool write_file_handle(Main *mainvar,
case ID_OB:
write_object(&writer, (Object *)id_buffer, id);
break;
- case ID_MA:
- write_material(&writer, (Material *)id_buffer, id);
- break;
case ID_TE:
write_texture(&writer, (Tex *)id_buffer, id);
break;
@@ -2931,6 +2898,7 @@ static bool write_file_handle(Main *mainvar,
case ID_BR:
case ID_IM:
case ID_LA:
+ case ID_MA:
/* Do nothing, handled in IDTypeInfo callback. */
break;
case ID_LI: