doxygen: prevent GPL license block from being parsed as doxygen comment.
[blender.git] / source / gameengine / GameLogic / SCA_2DFilterActuator.cpp
index 9ec4ea0..6a05622 100644 (file)
@@ -1,10 +1,33 @@
-#include "SCA_IActuator.h"
+/*
+ * SCA_2DFilterActuator.cpp
+ *
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <stddef.h>
 
+#include "SCA_IActuator.h"
 #include "SCA_2DFilterActuator.h"
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
 #include <iostream>
 
 SCA_2DFilterActuator::~SCA_2DFilterActuator()
@@ -18,15 +41,14 @@ SCA_2DFilterActuator::SCA_2DFilterActuator(
                float float_arg,
                int int_arg,
                RAS_IRasterizer* rasterizer,
-               RAS_IRenderTools* rendertools,
-        PyTypeObject* T)
-    : SCA_IActuator(gameobj, T),
+               SCA_IScene* scene)
+    : SCA_IActuator(gameobj, KX_ACT_2DFILTER),
      m_type(type),
-        m_flag(flag),
+        m_disableMotionBlur(flag),
         m_float_arg(float_arg),
         m_int_arg(int_arg),
         m_rasterizer(rasterizer),
-        m_rendertools(rendertools)
+        m_scene(scene)
 {
        m_gameObj = NULL;
        if(gameobj){
@@ -35,19 +57,11 @@ SCA_2DFilterActuator::SCA_2DFilterActuator(
        }
 }
 
-void SCA_2DFilterActuator::SetShaderText(STR_String text)
-{
-       m_shaderText = text;
-}
-
-
 
 CValue* SCA_2DFilterActuator::GetReplica()
 {
     SCA_2DFilterActuator* replica = new SCA_2DFilterActuator(*this);
     replica->ProcessReplica();
-    CValue::AddDataToReplica(replica);
-
     return replica;
 }
 
@@ -63,7 +77,7 @@ bool SCA_2DFilterActuator::Update()
 
        if( m_type == RAS_2DFilterManager::RAS_2DFILTER_MOTIONBLUR )
        {
-               if(!m_flag)
+               if(!m_disableMotionBlur)
                        m_rasterizer->EnableMotionBlur(m_float_arg);
                else
                        m_rasterizer->DisableMotionBlur();
@@ -72,47 +86,59 @@ bool SCA_2DFilterActuator::Update()
        }
        else if(m_type < RAS_2DFilterManager::RAS_2DFILTER_NUMBER_OF_FILTERS)
        {
-               m_rendertools->Update2DFilter(m_propNames, m_gameObj, m_type, m_int_arg, m_shaderText);
+               m_scene->Update2DFilter(m_propNames, m_gameObj, m_type, m_int_arg, m_shaderText);
        }
-    return true;
+       // once the filter is in place, no need to update it again => disable the actuator
+    return false;
 }
 
 
-PyTypeObject SCA_2DFilterActuator::Type = {
-        PyObject_HEAD_INIT(&PyType_Type)
-        0,
-        "SCA_2DFilterActuator",
-        sizeof(SCA_2DFilterActuator),
-        0,
-        PyDestructor,
-        0,
-        __getattr,
-        __setattr,
-        0, 
-         __repr,
-        0,
-        0,
-        0,
-        0,
-        0
-};
+void SCA_2DFilterActuator::SetShaderText(const char *text)
+{
+       m_shaderText = text;
+}
 
+#ifdef WITH_PYTHON
 
-PyParentObject SCA_2DFilterActuator::Parents[] = {
-        &SCA_2DFilterActuator::Type,
-        &SCA_IActuator::Type,
-        &SCA_ILogicBrick::Type,
-        &CValue::Type,
-        NULL
-};
+/* ------------------------------------------------------------------------- */
+/* Python functions                                                          */
+/* ------------------------------------------------------------------------- */
 
+/* Integration hooks ------------------------------------------------------- */
+PyTypeObject SCA_2DFilterActuator::Type = {
+       PyVarObject_HEAD_INIT(NULL, 0)
+       "SCA_2DFilterActuator",
+       sizeof(PyObjectPlus_Proxy),
+       0,
+       py_base_dealloc,
+       0,
+       0,
+       0,
+       0,
+       py_base_repr,
+       0,0,0,0,0,0,0,0,0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_IActuator::Type,
+       0,0,0,0,0,0,
+       py_base_new
+};
 
 PyMethodDef SCA_2DFilterActuator::Methods[] = {
-    /* add python functions to deal with m_msg... */
+       /* add python functions to deal with m_msg... */
     {NULL,NULL}
 };
 
+PyAttributeDef SCA_2DFilterActuator::Attributes[] = {
+       KX_PYATTRIBUTE_STRING_RW("shaderText", 0, 64000, false, SCA_2DFilterActuator, m_shaderText),
+       KX_PYATTRIBUTE_SHORT_RW("disableMotionBlur", 0, 1, true, SCA_2DFilterActuator, m_disableMotionBlur),
+       KX_PYATTRIBUTE_ENUM_RW("mode",RAS_2DFilterManager::RAS_2DFILTER_ENABLED,RAS_2DFilterManager::RAS_2DFILTER_NUMBER_OF_FILTERS,false,SCA_2DFilterActuator,m_type),
+       KX_PYATTRIBUTE_INT_RW("passNumber", 0, 100, true, SCA_2DFilterActuator, m_int_arg),
+       KX_PYATTRIBUTE_FLOAT_RW("value", 0.0, 100.0, SCA_2DFilterActuator, m_float_arg),
+       { NULL }        //Sentinel
+};
 
-PyObject* SCA_2DFilterActuator::_getattr(const STR_String& attr) {
-    _getattr_up(SCA_IActuator);
-}
+#endif