Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2012-11-03 18:32:26 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-11-03 18:32:26 +0400
commite02b23b81ab05579c0ee11ee3a1acb283643e528 (patch)
tree59b14c01bcb4c274d57c89a42e5a5d80c41ff06d /source/blender/blenkernel/intern/text.c
parent615fe0295fe13c229d7376b02a50ac110b636c47 (diff)
Render API: shader script node for custom shaders.
* Shader script node added, which stores either a link to a text datablock or file on disk, and has functions to add and remove sockets. * Callback RenderEngine.update_script_node(self, node) added for render engines to compile the shader and update the node with new sockets. Thanks to Thomas, Lukas and Dalai for the implementation.
Diffstat (limited to 'source/blender/blenkernel/intern/text.c')
-rw-r--r--source/blender/blenkernel/intern/text.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index b9ca3c9cc63..5995e69a73a 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -55,12 +55,15 @@
#include "DNA_text_types.h"
#include "DNA_userdef_types.h"
#include "DNA_object_types.h"
+#include "DNA_node_types.h"
+#include "DNA_material_types.h"
#include "BKE_depsgraph.h"
#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_text.h"
+#include "BKE_node.h"
#ifdef WITH_PYTHON
@@ -531,6 +534,9 @@ void BKE_text_unlink(Main *bmain, Text *text)
bController *cont;
bActuator *act;
bConstraint *con;
+ bNodeTree *ntree;
+ bNode *node;
+ Material *mat;
short update;
for (ob = bmain->object.first; ob; ob = ob->id.next) {
@@ -582,6 +588,26 @@ void BKE_text_unlink(Main *bmain, Text *text)
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
+ /* nodes */
+ for (mat = bmain->mat.first; mat; mat = mat->id.next) {
+ ntree = mat->nodetree;
+ for (node = ntree->nodes.first; node; node = node->next) {
+ if (node->type == SH_NODE_SCRIPT) {
+ Text *ntext = (Text *)node->id;
+ if (ntext == text) node->id = NULL;
+ }
+ }
+ }
+
+ for (ntree = bmain->nodetree.first; ntree; ntree = ntree->id.next) {
+ for (node = ntree->nodes.first; node; node = node->next) {
+ if (node->type == SH_NODE_SCRIPT) {
+ Text *ntext = (Text *)node->id;
+ if (ntext == text) node->id = NULL;
+ }
+ }
+ }
+
/* text space */
for (scr = bmain->screen.first; scr; scr = scr->id.next) {
for (area = scr->areabase.first; area; area = area->next) {