Cleanup: Deduplicate getting node tree from id

Differential Revision: https://developer.blender.org/D7438

Reviewers: mont29
This commit is contained in:
Jacques Lucke 2020-04-16 12:06:01 +02:00
parent 3468434b6b
commit 70a6c737ec
Notes: blender-bot 2023-02-14 08:45:12 +01:00
Referenced by issue #75813, Displace Modifier with global texture Coodinates i slow
1 changed files with 5 additions and 17 deletions

View File

@ -94,23 +94,11 @@ void ED_node_tree_update(const bContext *C)
static bNodeTree *node_tree_from_ID(ID *id)
{
if (id) {
short idtype = GS(id->name);
switch (idtype) {
case ID_NT:
return (bNodeTree *)id;
case ID_MA:
return ((Material *)id)->nodetree;
case ID_LA:
return ((Light *)id)->nodetree;
case ID_WO:
return ((World *)id)->nodetree;
case ID_SCE:
return ((Scene *)id)->nodetree;
case ID_TE:
return ((Tex *)id)->nodetree;
case ID_LS:
return ((FreestyleLineStyle *)id)->nodetree;
if (GS(id->name) == ID_NT) {
return (bNodeTree *)id;
}
else {
return ntreeFromID(id);
}
}