Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_nodetree.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
| Show First 20 Lines • Show All 174 Lines • ▼ Show 20 Lines | |||||
| #include "BKE_idprop.h" | #include "BKE_idprop.h" | ||||
| #include "BKE_library.h" | #include "BKE_library.h" | ||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| #include "ED_node.h" | #include "ED_node.h" | ||||
| #include "ED_render.h" | #include "ED_render.h" | ||||
| #include "GPU_material.h" | |||||
| #include "NOD_common.h" | #include "NOD_common.h" | ||||
| #include "NOD_socket.h" | #include "NOD_socket.h" | ||||
| #include "RE_engine.h" | #include "RE_engine.h" | ||||
| #include "RE_pipeline.h" | #include "RE_pipeline.h" | ||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| ▲ Show 20 Lines • Show All 2,077 Lines • ▼ Show 20 Lines | static void rna_NodeSocketStandard_vector_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax) | ||||
| } | } | ||||
| *min = -FLT_MAX; | *min = -FLT_MAX; | ||||
| *max = FLT_MAX; | *max = FLT_MAX; | ||||
| *softmin = dval->min; | *softmin = dval->min; | ||||
| *softmax = dval->max; | *softmax = dval->max; | ||||
| } | } | ||||
| static void rna_NodeSocket_value_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) | |||||
| { | |||||
| bNodeTree *ntree = (bNodeTree *)ptr->id.data; | |||||
| /* XXX: TODO (sergey/dalai) move this to depsgraph. */ | |||||
| for (Material *ma = bmain->mat.first; ma; ma = ma->id.next) { | |||||
| if ((ma->nodetree == ntree) && (ma->gpumaterial.first != NULL)) { | |||||
brecht: This doesn't take into account node groups. There is a utility function somewhere to iterate… | |||||
Not Done Inline ActionsDone, and done. dfelinto: Done, and done. | |||||
| GPU_material_uniform_buffer_tag_dirty(&ma->gpumaterial); | |||||
| } | |||||
| } | |||||
| for (World *wo = bmain->world.first; wo; wo = wo->id.next) { | |||||
| if ((wo->nodetree == ntree) && (wo->gpumaterial.first != NULL)) { | |||||
| GPU_material_uniform_buffer_tag_dirty(&wo->gpumaterial); | |||||
| } | |||||
| } | |||||
| } | |||||
| /* using a context update function here, to avoid searching the node if possible */ | /* using a context update function here, to avoid searching the node if possible */ | ||||
| static void rna_NodeSocketStandard_value_update(struct bContext *C, PointerRNA *ptr) | static void rna_NodeSocketStandard_value_update(struct bContext *C, PointerRNA *ptr) | ||||
| { | { | ||||
| bNode *node; | bNode *node; | ||||
| /* default update */ | /* default update */ | ||||
| rna_NodeSocket_update(CTX_data_main(C), CTX_data_scene(C), ptr); | rna_NodeSocket_value_update(CTX_data_main(C), CTX_data_scene(C), ptr); | ||||
| /* try to use node from context, faster */ | /* try to use node from context, faster */ | ||||
| node = CTX_data_pointer_get(C, "node").data; | node = CTX_data_pointer_get(C, "node").data; | ||||
| if (!node) { | if (!node) { | ||||
| bNodeTree *ntree = ptr->id.data; | bNodeTree *ntree = ptr->id.data; | ||||
| bNodeSocket *sock = ptr->data; | bNodeSocket *sock = ptr->data; | ||||
| /* fall back to searching node in the tree */ | /* fall back to searching node in the tree */ | ||||
| nodeFindNode(ntree, sock, &node, NULL); | nodeFindNode(ntree, sock, &node, NULL); | ||||
| } | } | ||||
| if (node) { | if (node) { | ||||
| nodeSynchronizeID(node, true); | nodeSynchronizeID(node, true); | ||||
| /* extra update for sockets that get synced to material */ | /* extra update for sockets that get synced to material */ | ||||
| if (node->id && ELEM(node->type, SH_NODE_MATERIAL, SH_NODE_MATERIAL_EXT)) | if (node->id && ELEM(node->type, SH_NODE_MATERIAL, SH_NODE_MATERIAL_EXT)) | ||||
| WM_main_add_notifier(NC_MATERIAL | ND_SHADING_DRAW, node->id); | WM_main_add_notifier(NC_MATERIAL | ND_SHADING_DRAW, node->id); | ||||
| WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, NULL); | |||||
Done Inline ActionsThis notifier is being run also for e.g. compositing nodes which it shouldn't. I think should be more fine grained in any case, the 3D view only needs to be redrawn if there is an actual gpumaterial being changed, and I would expect we already had some other notifier for that? brecht: This notifier is being run also for e.g. compositing nodes which it shouldn't. I think should… | |||||
| } | } | ||||
| } | } | ||||
| /* ******** Node Types ******** */ | /* ******** Node Types ******** */ | ||||
| static void rna_NodeInternalSocketTemplate_name_get(PointerRNA *ptr, char *value) | static void rna_NodeInternalSocketTemplate_name_get(PointerRNA *ptr, char *value) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 6,119 Lines • Show Last 20 Lines | |||||
This doesn't take into account node groups. There is a utility function somewhere to iterate over all shading node trees. This should also be done only if ntree is a shading node tree.