Commit: c32a5ce17c7609c29c832a2d229c60e12d0ccbb5
Author: Jacques Lucke
Date:   Fri Nov 6 14:09:58 2020 +0100
Branches: master
https://developer.blender.org/rBc32a5ce17c7609c29c832a2d229c60e12d0ccbb5

Refactor: move Paint lib linking to blenkernel

Ref T76372.

===================================================================

M       source/blender/blenkernel/BKE_paint.h
M       source/blender/blenkernel/intern/paint.c
M       source/blender/blenloader/intern/readfile.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_paint.h 
b/source/blender/blenkernel/BKE_paint.h
index 59291b1c7cb..a58bf760ad5 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -68,6 +68,7 @@ struct bToolRef;
 struct tPaletteColorHSV;
 struct BlendWriter;
 struct BlendDataReader;
+struct BlendLibReader;
 
 enum eOverlayFlags;
 
@@ -224,6 +225,9 @@ void BKE_paint_blend_write(struct BlendWriter *writer, 
struct Paint *paint);
 void BKE_paint_blend_read_data(struct BlendDataReader *reader,
                                const struct Scene *scene,
                                struct Paint *paint);
+void BKE_paint_blend_read_lib(struct BlendLibReader *reader,
+                              struct Scene *scene,
+                              struct Paint *paint);
 
 #define SCULPT_FACE_SET_NONE 0
 
diff --git a/source/blender/blenkernel/intern/paint.c 
b/source/blender/blenkernel/intern/paint.c
index 3e8bdbf0481..d726a4b1e37 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -1210,6 +1210,22 @@ void BKE_paint_blend_read_data(BlendDataReader *reader, 
const Scene *scene, Pain
   BKE_paint_runtime_init(scene->toolsettings, p);
 }
 
+void BKE_paint_blend_read_lib(BlendLibReader *reader, Scene *sce, Paint *p)
+{
+  if (p) {
+    BLO_read_id_address(reader, sce->id.lib, &p->brush);
+    for (int i = 0; i < p->tool_slots_len; i++) {
+      if (p->tool_slots[i].brush != NULL) {
+        BLO_read_id_address(reader, sce->id.lib, &p->tool_slots[i].brush);
+      }
+    }
+    BLO_read_id_address(reader, sce->id.lib, &p->palette);
+    p->paint_cursor = NULL;
+
+    BKE_paint_runtime_init(sce->toolsettings, p);
+  }
+}
+
 /* returns non-zero if any of the face's vertices
  * are hidden, zero otherwise */
 bool paint_is_face_hidden(const MLoopTri *lt, const MVert *mvert, const MLoop 
*mloop)
diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index 187ecd74739..ab6a178ec4d 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -3859,22 +3859,6 @@ static void composite_patch(bNodeTree *ntree, Scene 
*scene)
   }
 }
 
-static void link_paint(BlendLibReader *reader, Scene *sce, Paint *p)
-{
-  if (p) {
-    BLO_read_id_address(reader, sce->id.lib, &p->brush);
-    for (int i = 0; i < p->tool_slots_len; i++) {
-      if (p->tool_slots[i].brush != NULL) {
-        BLO_read_id_address(reader, sce->id.lib, &p->tool_slots[i].brush);
-      }
-    }
-    BLO_read_id_address(reader, sce->id.lib, &p->palette);
-    p->paint_cursor = NULL;
-
-    BKE_paint_runtime_init(sce->toolsettings, p);
-  }
-}
-
 static void lib_link_sequence_modifiers(BlendLibReader *reader, Scene *scene, 
ListBase *lb)
 {
   LISTBASE_FOREACH (SequenceModifierData *, smd, lb) {
@@ -3933,30 +3917,30 @@ static void lib_link_scene(BlendLibReader *reader, 
Scene *sce)
   BLO_read_id_address(reader, sce->id.lib, &sce->set);
   BLO_read_id_address(reader, sce->id.lib, &sce->gpd);
 
-  link_paint(reader, sce, &sce->toolsettings->imapaint.paint);
+  BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->imapaint.paint);
   if (sce->toolsettings->sculpt) {
-    link_paint(reader, sce, &sce->toolsettings->sculpt->paint);
+    BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->sculpt->paint);
   }
   if (sce->toolsettings->vpaint) {
-    link_paint(reader, sce, &sce->toolsettings->vpaint->paint);
+    BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->vpaint->paint);
   }
   if (sce->toolsettings->wpaint) {
-    link_paint(reader, sce, &sce->toolsettings->wpaint->paint);
+    BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->wpaint->paint);
   }
   if (sce->toolsettings->uvsculpt) {
-    link_paint(reader, sce, &sce->toolsettings->uvsculpt->paint);
+    BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->uvsculpt->paint);
   }
   if (sce->toolsettings->gp_paint) {
-    link_paint(reader, sce, &sce->toolsettings->gp_paint->paint);
+    BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->gp_paint->paint);
   }
   if (sce->toolsettings->gp_vertexpaint) {
-    link_paint(reader, sce, &sce->toolsettings->gp_vertexpaint->paint);
+    BKE_paint_blend_read_lib(reader, sce, 
&sce->toolsettings->gp_vertexpaint->paint);
   }
   if (sce->toolsettings->gp_sculptpaint) {
-    link_paint(reader, sce, &sce->toolsettings->gp_sculptpaint->paint);
+    BKE_paint_blend_read_lib(reader, sce, 
&sce->toolsettings->gp_sculptpaint->paint);
   }
   if (sce->toolsettings->gp_weightpaint) {
-    link_paint(reader, sce, &sce->toolsettings->gp_weightpaint->paint);
+    BKE_paint_blend_read_lib(reader, sce, 
&sce->toolsettings->gp_weightpaint->paint);
   }
 
   if (sce->toolsettings->sculpt) {

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to