Depsgraph: Use explicit material update operation code
Avoids string comparison on key matching.
This commit is contained in:
parent
83b0bf9166
commit
21f27692da
|
@ -1097,8 +1097,10 @@ void DepsgraphNodeBuilder::build_material(Material *ma)
|
|||
/* material itself */
|
||||
add_id_node(ma_id);
|
||||
|
||||
add_operation_node(ma_id, DEG_NODE_TYPE_SHADING, NULL,
|
||||
DEG_OPCODE_PLACEHOLDER, "Material Update");
|
||||
add_operation_node(ma_id,
|
||||
DEG_NODE_TYPE_SHADING,
|
||||
NULL,
|
||||
DEG_OPCODE_MATERIAL_UPDATE);
|
||||
|
||||
/* material animation */
|
||||
build_animdata(ma_id);
|
||||
|
|
|
@ -1513,8 +1513,7 @@ void DepsgraphRelationBuilder::build_obdata_geom(Main *bmain, Scene *scene, Obje
|
|||
if (ob->type == OB_MESH) {
|
||||
OperationKey material_key(&ma->id,
|
||||
DEG_NODE_TYPE_SHADING,
|
||||
DEG_OPCODE_PLACEHOLDER,
|
||||
"Material Update");
|
||||
DEG_OPCODE_MATERIAL_UPDATE);
|
||||
OperationKey shading_key(&ob->id, DEG_NODE_TYPE_SHADING, DEG_OPCODE_SHADING);
|
||||
add_relation(material_key, shading_key, "Material Update");
|
||||
}
|
||||
|
@ -1754,8 +1753,7 @@ void DepsgraphRelationBuilder::build_material(Material *ma)
|
|||
DEG_OPCODE_PARAMETERS_EVAL);
|
||||
OperationKey material_key(&ma->id,
|
||||
DEG_NODE_TYPE_SHADING,
|
||||
DEG_OPCODE_PLACEHOLDER,
|
||||
"Material Update");
|
||||
DEG_OPCODE_MATERIAL_UPDATE);
|
||||
add_relation(ntree_key, material_key, "Material's NTree");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -141,6 +141,7 @@ static const char *stringify_opcode(eDepsOperation_Code opcode)
|
|||
STRINGIFY_OPCODE(COPY_ON_WRITE);
|
||||
/* Shading. */
|
||||
STRINGIFY_OPCODE(SHADING);
|
||||
STRINGIFY_OPCODE(MATERIAL_UPDATE);
|
||||
|
||||
case DEG_NUM_OPCODES: return "SpecialCase";
|
||||
#undef STRINGIFY_OPCODE
|
||||
|
|
|
@ -224,6 +224,7 @@ typedef enum eDepsOperation_Code {
|
|||
|
||||
/* Shading. ------------------------------------------- */
|
||||
DEG_OPCODE_SHADING,
|
||||
DEG_OPCODE_MATERIAL_UPDATE,
|
||||
|
||||
DEG_NUM_OPCODES,
|
||||
} eDepsOperation_Code;
|
||||
|
|
|
@ -298,10 +298,6 @@ static void material_changed(Main *bmain, Material *ma)
|
|||
/* icons */
|
||||
BKE_icon_changed(BKE_icon_id_ensure(&ma->id));
|
||||
|
||||
/* glsl */
|
||||
if (ma->gpumaterial.first)
|
||||
GPU_material_free(&ma->gpumaterial);
|
||||
|
||||
/* find node materials using this */
|
||||
for (parent = bmain->mat.first; parent; parent = parent->id.next) {
|
||||
if (parent->use_nodes && parent->nodetree && nodes_use_material(parent->nodetree, ma)) {
|
||||
|
|
Loading…
Reference in New Issue