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:
authorWillian Padovani Germano <wpgermano@gmail.com>2008-03-16 20:24:29 +0300
committerWillian Padovani Germano <wpgermano@gmail.com>2008-03-16 20:24:29 +0300
commitdae503187c9c77a6f51bc4cb7bad81e78590b692 (patch)
treead923d077ed0b54b167a54e4e9d438f348047a8d /source/blender/nodes
parent6a2e538d98a3d28929160ebd7a2247e242e623c3 (diff)
== PyNodes ==
Ongoing updates to the Blender.Node Python API: - Changed Blender.Node.node to Blender.Node.Scripted to be more specific and conform to bpython API. - Added a Blender.Node.Socket type to be used to define node sockets in a PyNode script. Also, socket type is inferred from the value(s) passed in, instead of also being defined by the script author. - Added attr access to input and output sockets in the __call__ method. Ex: an input socket called 'color' can be accessed as self.input.color now. These changes break existing pynode scripts, which shouldn't be a problem yet, of course, since we're still finishing this feature for 2.46. The wiki page and sample .blends have already been updated: http://wiki.blender.org/index.php/BlenderDev/PyNodes http://wiki.blender.org/index.php/BlenderDev/PyNodes/API
Diffstat (limited to 'source/blender/nodes')
-rw-r--r--source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c80
1 files changed, 6 insertions, 74 deletions
diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c b/source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c
index ec3a9f3e5d6..36a3bd5b171 100644
--- a/source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c
+++ b/source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c
@@ -59,14 +59,6 @@ static PyObject *init_dynamicdict(void) {
return newscriptdict;
}
-/* unused for now
-static void free_dynamicdict(PyObject *dict) {
- if (dict!=NULL) {
- Py_DECREF(dict);
- }
-}
-*/
-
static bNodeType *node_dynamic_find_typeinfo(ListBase *list, ID *id)
{
bNodeType *ntype = list->first;
@@ -309,68 +301,6 @@ int nodeDynamicUnlinkText(ID *txtid) {
return 0; /* no pynodes used this text */
}
-/*
-static void node_dynamic_free_all_typeinfos(ListBase *list)
-{
- bNodeType *ntype, *ntnext;
-
- ntype = list->first;
-
- while (ntype) {
- ntnext = ntype->next;
- if (ntype->type == NODE_DYNAMIC && ntype->id) {
- BLI_remlink(list, ntype);
- node_dynamic_free_typeinfo_sockets(ntype);
- node_dynamic_free_typeinfo(ntype);
- }
- ntype = ntnext;
- }
-}
-*/
-/* Unload all pynodes: since the Game Engine restarts Python, we need
- * to recreate pynodes dicts and objects. First we get rid of them here: */
-/*
-void nodeDynamicUnloadAll(void)
-{
- Material *ma;
- bNode *nd;
- PyGILState_STATE gilstate = PyGILState_Ensure();
-
- for (ma= G.main->mat.first; ma; ma= ma->id.next) {
- if (ma->nodetree) {
- for (nd= ma->nodetree->nodes.first; nd; nd = nd->next) {
- if ((nd->type == NODE_DYNAMIC) && nd->id) {
- node_dynamic_free_storage_cb(nd);
- nd->typeinfo = NULL;
- nd->custom1 = 0;
- nd->custom1 = BSET(nd->custom1, NODE_DYNAMIC_LOADED);
- }
- }
- }
- }
-
- node_dynamic_free_all_typeinfos(&node_all_shaders);
-
- PyGILState_Release(gilstate);
-}
-
-void nodeDynamicReloadAll(void)
-{
- Material *ma;
- bNode *nd;
-
- for (ma= G.main->mat.first; ma; ma= ma->id.next) {
- if (ma->nodetree) {
- for (nd= ma->nodetree->nodes.first; nd; nd = nd->next) {
- if ((nd->type == NODE_DYNAMIC) && nd->id) {
- node_dynamic_setup(nd);
- }
- }
- }
- }
-}
-*/
-
static void node_dynamic_pyerror_print(bNode *node)
{
PyGILState_STATE gilstate = PyGILState_Ensure();
@@ -426,15 +356,17 @@ static int node_dynamic_parse(struct bNode *node)
while (PyDict_Next( (PyObject *)(nsd->dict), &pos, &key, &value)) {
/* look for the node object */
+ if (strcmp("Socket", PyString_AsString(key)) == 0)
+ continue; /* XXX ugly, fix it */
if (PyObject_TypeCheck(value, &PyType_Type)==1) {
- BPy_NodeSockets *sockets = Node_CreateSockets(node);
+ BPy_NodeSocketLists *socklists = Node_CreateSocketLists(node);
- args = Py_BuildValue("(O)", sockets);
+ args = Py_BuildValue("(O)", socklists);
/* init it to get the input and output sockets */
pynode = PyObject_Call(value, args, NULL);
- Py_DECREF(sockets);
+ Py_DECREF(socklists);
Py_DECREF(args);
if (!PyErr_Occurred() && pynode && pytype_is_pynode(pynode)) {
@@ -466,7 +398,7 @@ static int node_dynamic_parse(struct bNode *node)
node->custom1 = BSET(node->custom1, NODE_DYNAMIC_READY);
break;
}
- break;
+ //break;
}
}