[Bf-blender-cvs] [76ef2f55d28] greasepencil-object: Cleanup: Remove unused function: give_node_material()

Antonio Vazquez noreply at git.blender.org
Wed Feb 5 15:59:52 CET 2020


Commit: 76ef2f55d2897561e324f1ce65899498c86c462d
Author: Antonio Vazquez
Date:   Wed Feb 5 11:25:50 2020 +0100
Branches: greasepencil-object
https://developer.blender.org/rB76ef2f55d2897561e324f1ce65899498c86c462d

Cleanup: Remove unused function: give_node_material()

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

M	source/blender/blenkernel/BKE_material.h
M	source/blender/blenkernel/intern/material.c
M	source/blender/editors/animation/anim_filter.c

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

diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h
index a0a41a048e3..0fd08dc3246 100644
--- a/source/blender/blenkernel/BKE_material.h
+++ b/source/blender/blenkernel/BKE_material.h
@@ -60,7 +60,6 @@ void BKE_material_copy_data(struct Main *bmain,
                             const int flag);
 struct Material *BKE_material_copy(struct Main *bmain, const struct Material *ma);
 struct Material *BKE_material_localize(struct Material *ma);
-struct Material *give_node_material(struct Material *ma); /* returns node material or self */
 void BKE_material_make_local(struct Main *bmain, struct Material *ma, const bool lib_local);
 void BKE_gpencil_material_attr_init(struct Material *ma);
 
@@ -87,7 +86,10 @@ struct Material *BKE_object_material_get(struct Object *ob, short act);
 void BKE_id_material_assign(struct Main *bmain, struct ID *id, struct Material *ma, short act);
 void BKE_object_material_assign(
     struct Main *bmain, struct Object *ob, struct Material *ma, short act, int assign_type);
-void BKE_object_material_array_assign(struct Main *bmain, struct Object *ob, struct Material ***matar, short totcol);
+void BKE_object_material_array_assign(struct Main *bmain,
+                                      struct Object *ob,
+                                      struct Material ***matar,
+                                      short totcol);
 
 short BKE_object_material_slot_find_index(struct Object *ob, struct Material *ma);
 bool BKE_object_material_slot_add(struct Main *bmain, struct Object *ob);
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 91fc0519c07..8159cc03414 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -618,19 +618,6 @@ MaterialGPencilStyle *BKE_gpencil_material_settings(Object *ob, short act)
   }
 }
 
-Material *give_node_material(Material *ma)
-{
-  if (ma && ma->use_nodes && ma->nodetree) {
-    bNode *node = nodeGetActiveID(ma->nodetree, ID_MA);
-
-    if (node) {
-      return (Material *)node->id;
-    }
-  }
-
-  return NULL;
-}
-
 void BKE_material_resize_object(Main *bmain, Object *ob, const short totcol, bool do_id_user)
 {
   Material **newmatar;
@@ -937,7 +924,10 @@ void BKE_material_remap_object_calc(Object *ob_dst, Object *ob_src, short *remap
 }
 
 /* XXX - this calls many more update calls per object then are needed, could be optimized */
-void BKE_object_material_array_assign(Main *bmain, struct Object *ob, struct Material ***matar, short totcol)
+void BKE_object_material_array_assign(Main *bmain,
+                                      struct Object *ob,
+                                      struct Material ***matar,
+                                      short totcol)
 {
   int actcol_orig = ob->actcol;
   short i;
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index b3a9353bb74..a9ddc53e5bb 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -2290,7 +2290,6 @@ static size_t animdata_filter_ds_material(
 static size_t animdata_filter_ds_materials(
     bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Object *ob, int filter_mode)
 {
-  bool has_nested = false;
   size_t items = 0;
   int a = 0;
 
@@ -2302,34 +2301,6 @@ static size_t animdata_filter_ds_materials(
     if (ma) {
       /* add channels */
       items += animdata_filter_ds_material(ac, anim_data, ads, ma, filter_mode);
-
-      /* for optimising second pass - check if there's a nested material here to come back for */
-      if (has_nested == false) {
-        has_nested = (give_node_material(ma) != NULL);
-      }
-    }
-  }
-
-  /* Second pass: go through a second time looking for "nested" materials
-   * (material.material references).
-   *
-   * NOTE: here we ignore the expanded status of the parent, as it could be too confusing as to
-   * why these are disappearing/not available,
-   * since the relationships between these is not that clear.
-   */
-  if (has_nested) {
-    for (a = 1; a <= ob->totcol; a++) {
-      Material *base = BKE_object_material_get(ob, a);
-      Material *ma = give_node_material(base);
-
-      /* add channels from the nested material if it exists
-       *   - skip if the same material is referenced in its node tree
-       *     (which is common for BI materials) as that results in
-       *     confusing duplicates
-       */
-      if ((ma) && (ma != base)) {
-        items += animdata_filter_ds_material(ac, anim_data, ads, ma, filter_mode);
-      }
     }
   }



More information about the Bf-blender-cvs mailing list