[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36767] branches/soc-2011-sven: port initial node logic code from old nodelogic branch
Benoit Bolsee
benoit.bolsee at online.be
Thu May 19 10:50:32 CEST 2011
Revision: 36767
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36767
Author: ben2610
Date: 2011-05-19 08:50:32 +0000 (Thu, 19 May 2011)
Log Message:
-----------
port initial node logic code from old nodelogic branch
Modified Paths:
--------------
branches/soc-2011-sven/source/blender/windowmanager/CMakeLists.txt
branches/soc-2011-sven/source/blender/windowmanager/SConscript
branches/soc-2011-sven/source/blender/windowmanager/intern/wm_init_exit.c
branches/soc-2011-sven/source/creator/CMakeLists.txt
branches/soc-2011-sven/source/gameengine/CMakeLists.txt
branches/soc-2011-sven/source/gameengine/SConscript
Added Paths:
-----------
branches/soc-2011-sven/release/scripts/modules/NodeLogic/
branches/soc-2011-sven/release/scripts/modules/NodeLogic/__init__.py
branches/soc-2011-sven/release/scripts/modules/NodeLogic/types.py
branches/soc-2011-sven/source/gameengine/NodeLogic/
branches/soc-2011-sven/source/gameengine/NodeLogic/CMakeLists.txt
branches/soc-2011-sven/source/gameengine/NodeLogic/NL_DList.h
branches/soc-2011-sven/source/gameengine/NodeLogic/NL_ILinkData.h
branches/soc-2011-sven/source/gameengine/NodeLogic/NL_INode.h
branches/soc-2011-sven/source/gameengine/NodeLogic/NL_INodePin.h
branches/soc-2011-sven/source/gameengine/NodeLogic/NL_IQueueItem.h
branches/soc-2011-sven/source/gameengine/NodeLogic/NL_Node.cpp
branches/soc-2011-sven/source/gameengine/NodeLogic/NL_Node.h
branches/soc-2011-sven/source/gameengine/NodeLogic/NL_NodeEngine.cpp
branches/soc-2011-sven/source/gameengine/NodeLogic/NL_NodeEngine.h
branches/soc-2011-sven/source/gameengine/NodeLogic/NL_NodeGraph.cpp
branches/soc-2011-sven/source/gameengine/NodeLogic/NL_NodeGraph.h
branches/soc-2011-sven/source/gameengine/NodeLogic/NL_NodeLink.cpp
branches/soc-2011-sven/source/gameengine/NodeLogic/NL_NodeLink.h
branches/soc-2011-sven/source/gameengine/NodeLogic/NL_NodeLogic.cpp
branches/soc-2011-sven/source/gameengine/NodeLogic/NL_NodeLogic.h
branches/soc-2011-sven/source/gameengine/NodeLogic/NL_NodePin.cpp
branches/soc-2011-sven/source/gameengine/NodeLogic/NL_NodePin.h
branches/soc-2011-sven/source/gameengine/NodeLogic/NL_NodePushInputPin.h
branches/soc-2011-sven/source/gameengine/NodeLogic/NL_QList.h
branches/soc-2011-sven/source/gameengine/NodeLogic/SConscript
Added: branches/soc-2011-sven/release/scripts/modules/NodeLogic/__init__.py
===================================================================
--- branches/soc-2011-sven/release/scripts/modules/NodeLogic/__init__.py (rev 0)
+++ branches/soc-2011-sven/release/scripts/modules/NodeLogic/__init__.py 2011-05-19 08:50:32 UTC (rev 36767)
@@ -0,0 +1,48 @@
+# bring all the builtin functions in NodeLogic
+from _NodeLogic import *
+# type database for GUI
+from NodeLogic import types
+
+# load nodes
+from bpy import utils
+import sys
+DEBUG = ("-d" in sys.argv)
+
+def load_nodes(reload_nodes=False):
+ import os
+ import traceback
+ import time
+ t_main = time.time()
+
+ def test_import(module_name):
+ try:
+ t = time.time()
+ ret= __import__(module_name)
+ if DEBUG:
+ print("time %s %.4f" % (module_name, time.time() - t))
+ return ret
+ except:
+ traceback.print_exc()
+ return None
+
+
+ for base_path in utils.script_paths():
+ for path_subdir in ("nodes",):
+ path = os.path.join(base_path, path_subdir)
+ if os.path.isdir(path):
+ sys.path.insert(0, path)
+ for f in sorted(os.listdir(path)):
+ if f.endswith(".py"):
+ # python module
+ mod = test_import(f[0:-3])
+ elif "." not in f:
+ # python package
+ mod = test_import(f)
+ else:
+ mod = None
+
+ if reload_nodes and mod:
+ print("Reloading:", mod)
+ reload(mod)
+
+load_nodes()
Property changes on: branches/soc-2011-sven/release/scripts/modules/NodeLogic/__init__.py
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: branches/soc-2011-sven/release/scripts/modules/NodeLogic/types.py
===================================================================
--- branches/soc-2011-sven/release/scripts/modules/NodeLogic/types.py (rev 0)
+++ branches/soc-2011-sven/release/scripts/modules/NodeLogic/types.py 2011-05-19 08:50:32 UTC (rev 36767)
@@ -0,0 +1,29 @@
+# define data types for pins.
+# These are just placeholders, only the name is used in the UI to match
+# The poll function is used by the UI to determine which data types are compatible
+import _NodeLogic as nl
+
+class Int(nl.datatype):
+ @staticmethod
+ def poll(other):
+ return other is Float or other is Int
+
+class Float(nl.datatype):
+ @staticmethod
+ def poll(other):
+ return other is Float or other is Int
+
+class Pulse(nl.datatype):
+ @staticmethod
+ def poll(other):
+ return other is Pulse
+
+class Any(nl.datatype):
+ @staticmethod
+ def poll(other):
+ return True
+
+class Vector(nl.datatype):
+ @staticmethod
+ def poll(other):
+ return other is Vector
Property changes on: branches/soc-2011-sven/release/scripts/modules/NodeLogic/types.py
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: branches/soc-2011-sven/source/blender/windowmanager/CMakeLists.txt
===================================================================
--- branches/soc-2011-sven/source/blender/windowmanager/CMakeLists.txt 2011-05-19 07:55:48 UTC (rev 36766)
+++ branches/soc-2011-sven/source/blender/windowmanager/CMakeLists.txt 2011-05-19 08:50:32 UTC (rev 36767)
@@ -43,6 +43,7 @@
../../../intern/ghost
../../../intern/opennl/extern
../../../source/gameengine/BlenderRoutines
+ ../../../source/gameengine/NodeLogic
${ZLIB_INCLUDE_DIRS}
${OPENGL_INCLUDE_DIR}
${GLEW_INCLUDE_PATH}
Modified: branches/soc-2011-sven/source/blender/windowmanager/SConscript
===================================================================
--- branches/soc-2011-sven/source/blender/windowmanager/SConscript 2011-05-19 07:55:48 UTC (rev 36766)
+++ branches/soc-2011-sven/source/blender/windowmanager/SConscript 2011-05-19 08:50:32 UTC (rev 36767)
@@ -10,7 +10,7 @@
incs += ' ../nodes ../imbuf ../blenloader ../render/extern/include'
incs += ' ../radiosity/extern/include'
incs += ' ../makesrna ../gpu ../blenfont'
-
+incs += ' ../../gameengine/NodeLogic'
incs += ' #/intern/guardedalloc #/intern/memutil #/intern/ghost'
incs += ' #/intern/elbeem #/extern/glew/include'
incs += ' #source/gameengine/BlenderRoutines'
Modified: branches/soc-2011-sven/source/blender/windowmanager/intern/wm_init_exit.c
===================================================================
--- branches/soc-2011-sven/source/blender/windowmanager/intern/wm_init_exit.c 2011-05-19 07:55:48 UTC (rev 36766)
+++ branches/soc-2011-sven/source/blender/windowmanager/intern/wm_init_exit.c 2011-05-19 08:50:32 UTC (rev 36767)
@@ -69,6 +69,7 @@
#ifdef WITH_PYTHON
#include "BPY_extern.h"
+#include "NL_NodeLogic.h"
#endif
#ifdef WITH_GAMEENGINE
@@ -155,6 +156,7 @@
BPY_driver_reset();
BPY_modules_load_user(C);
+ NL_Init();
#else
(void)argc; /* unused */
(void)argv; /* unused */
Modified: branches/soc-2011-sven/source/creator/CMakeLists.txt
===================================================================
--- branches/soc-2011-sven/source/creator/CMakeLists.txt 2011-05-19 07:55:48 UTC (rev 36766)
+++ branches/soc-2011-sven/source/creator/CMakeLists.txt 2011-05-19 08:50:32 UTC (rev 36767)
@@ -808,6 +808,7 @@
bf_blenfont
bf_intern_audaspace
bf_intern_mikktspace
+ bf_nodelogic
)
if(WITH_MOD_CLOTH_ELTOPO)
Modified: branches/soc-2011-sven/source/gameengine/CMakeLists.txt
===================================================================
--- branches/soc-2011-sven/source/gameengine/CMakeLists.txt 2011-05-19 07:55:48 UTC (rev 36766)
+++ branches/soc-2011-sven/source/gameengine/CMakeLists.txt 2011-05-19 08:50:32 UTC (rev 36767)
@@ -50,6 +50,10 @@
endif()
if(WITH_PYTHON)
+ add_subdirectory(NodeLogic)
+endif()
+
+if(WITH_PYTHON)
add_subdirectory(VideoTexture)
endif()
Added: branches/soc-2011-sven/source/gameengine/NodeLogic/CMakeLists.txt
===================================================================
--- branches/soc-2011-sven/source/gameengine/NodeLogic/CMakeLists.txt (rev 0)
+++ branches/soc-2011-sven/source/gameengine/NodeLogic/CMakeLists.txt 2011-05-19 08:50:32 UTC (rev 36767)
@@ -0,0 +1,48 @@
+# $Id$
+#
+# Copyright (c) 2009-2011 Benoit Bolsee
+#
+# This software is provided 'as-is', without any express or implied warranty.
+# In no event will the authors be held liable for any damages arising from the use
+# of this software.
+# Permission is granted to anyone to use this software for any purpose,
+# including commercial applications, and to alter it and redistribute it freely,
+# subject to the following restrictions:
+#
+# 1. The origin of this software must not be misrepresented; you must not claim that you
+# wrote the original software. If you use this software in a product, an acknowledgment
+# in the product documentation would be appreciated but is not required.
+# 2. Altered source versions must be plainly marked as such, and must not be misrepresented
+# as being the original software.
+# 3. This notice may not be removed or altered from any source distribution.
+#
+
+set(INC
+ .
+)
+
+set(SRC
+ NL_NodeEngine.cpp
+ NL_NodeGraph.cpp
+ NL_NodeLink.cpp
+ NL_NodeLogic.cpp
+ NL_NodePin.cpp
+
+ NL_DList.h
+ NL_ILinkData.h
+ NL_INode.h
+ NL_INodePin.h
+ NL_IQueueItem.h
+ NL_Node.cpp
+ NL_Node.h
+ NL_NodeEngine.h
+ NL_NodeGraph.h
+ NL_NodeLink.h
+ NL_NodeLogic.h
+ NL_NodePin.h
+ NL_NodePushInputPin.h
+ NL_QList.h
+)
+
+blender_add_lib(bf_nodelogic "${SRC}" "${INC}")
+
Property changes on: branches/soc-2011-sven/source/gameengine/NodeLogic/CMakeLists.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: branches/soc-2011-sven/source/gameengine/NodeLogic/NL_DList.h
===================================================================
--- branches/soc-2011-sven/source/gameengine/NodeLogic/NL_DList.h (rev 0)
+++ branches/soc-2011-sven/source/gameengine/NodeLogic/NL_DList.h 2011-05-19 08:50:32 UTC (rev 36767)
@@ -0,0 +1,232 @@
+/**
+ * $Id$
+ *
+ * Copyright (c) 2009-2011 Benoit Bolsee
+ *
+ * This software is provided 'as-is', without any express or implied warranty.
+ * In no event will the authors be held liable for any damages arising from the use
+ * of this software.
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it freely,
+ * subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not claim that you
+ * wrote the original software. If you use this software in a product, an acknowledgment
+ * in the product documentation would be appreciated but is not required.
+ * 2. Altered source versions must be plainly marked as such, and must not be misrepresented
+ * as being the original software.
+ * 3. This notice may not be removed or altered from any source distribution.
+ *
+ */
+#ifndef _NL_DLIST
+#define _NL_DLIST
+
+#include <stdlib.h>
+
+/**
+ * Double circular linked list
+ */
+class NL_DList
+{
+protected :
+ NL_DList* m_flink;
+ NL_DList* m_blink;
+
+public:
+ template<typename T> class iterator
+ {
+ private:
+ NL_DList& m_head;
+ T* m_current;
+ public:
+ typedef iterator<T> _myT;
+ iterator(NL_DList& head) : m_head(head), m_current(NULL) {}
+ ~iterator() {}
+
+ void begin()
+ {
+ m_current = (T*)m_head.Peek();
+ }
+ void back()
+ {
+ m_current = (T*)m_head.Back();
+ }
+ bool end()
+ {
+ return (m_current == (T*)m_head.Self());
+ }
+ bool add_back(T* item)
+ {
+ return m_current->AddBack(item);
+ }
+ T* operator*()
+ {
+ return m_current;
+ }
+ _myT& operator++()
+ {
+ // no check of NULL! make sure you don't try to increment beyond end
+ m_current = (T*)m_current->Peek();
+ return *this;
+ }
+ _myT& operator--()
+ {
+ // no check of NULL! make sure you don't try to increment beyond end
+ m_current = (T*)m_current->Back();
+ return *this;
+ }
+ };
+
+ template<typename T> class const_iterator
+ {
+ private:
+ const NL_DList& m_head;
+ const T* m_current;
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list