Undo revision 23130 which was a merge with 2.5, a messy one because I did something...
[blender.git] / source / gameengine / Ketsji / KX_VisibilityActuator.cpp
index b4693a7..97c893c 100644 (file)
 KX_VisibilityActuator::KX_VisibilityActuator(
        SCA_IObject* gameobj,
        bool visible,
-       PyTypeObject* T
+       bool occlusion,
+       bool recursive
        ) 
-       : SCA_IActuator(gameobj,T),
-         m_visible(visible)
+       : SCA_IActuator(gameobj),
+         m_visible(visible),
+         m_occlusion(occlusion),
+         m_recursive(recursive)
 {
        // intentionally empty
 }
@@ -60,8 +63,6 @@ KX_VisibilityActuator::GetReplica(
 {
        KX_VisibilityActuator* replica = new KX_VisibilityActuator(*this);
        replica->ProcessReplica();
-       // this will copy properties and so on...
-       CValue::AddDataToReplica(replica);
        return replica;
 }
 
@@ -75,10 +76,11 @@ KX_VisibilityActuator::Update()
 
        KX_GameObject *obj = (KX_GameObject*) GetParent();
        
-       obj->SetVisible(m_visible);
-       obj->MarkVisible();
+       obj->SetVisible(m_visible, m_recursive);
+       obj->SetOccluder(m_occlusion, m_recursive);
+       obj->UpdateBuckets(m_recursive);
 
-       return true;
+       return false;
 }
 
 /* ------------------------------------------------------------------------- */
@@ -88,72 +90,62 @@ KX_VisibilityActuator::Update()
 
 
 /* Integration hooks ------------------------------------------------------- */
-PyTypeObject 
-KX_VisibilityActuator::Type = {
-       PyObject_HEAD_INIT(&PyType_Type)
-       0,
+PyTypeObject KX_VisibilityActuator::Type = {
+       PyVarObject_HEAD_INIT(NULL, 0)
        "KX_VisibilityActuator",
-       sizeof(KX_VisibilityActuator),
+       sizeof(PyObjectPlus_Proxy),
        0,
-       PyDestructor,
+       py_base_dealloc,
        0,
-       __getattr,
-       __setattr,
-       0, //&MyPyCompare,
-       __repr,
-       0, //&cvalue_as_number,
        0,
        0,
        0,
-       0
-};
-
-PyParentObject 
-KX_VisibilityActuator::Parents[] = {
-       &KX_VisibilityActuator::Type,
+       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,
-       &SCA_ILogicBrick::Type,
-       &CValue::Type,
-       NULL
+       0,0,0,0,0,0,
+       py_base_new
 };
 
-PyMethodDef 
-KX_VisibilityActuator::Methods[] = {
-       {"set", (PyCFunction) KX_VisibilityActuator::sPySetVisible, 
-        METH_VARARGS, SetVisible_doc},
+PyMethodDef KX_VisibilityActuator::Methods[] = {
+       // Deprecated ----->
+       {"set", (PyCFunction) KX_VisibilityActuator::sPySetVisible, METH_VARARGS,
+               (const char *) SetVisible_doc},
+       // <-----
        {NULL,NULL} //Sentinel
 };
 
-PyObject* 
-KX_VisibilityActuator::_getattr(
-       const STR_String& attr
-       ) 
-{
-       _getattr_up(SCA_IActuator);
+PyAttributeDef KX_VisibilityActuator::Attributes[] = {
+       KX_PYATTRIBUTE_BOOL_RW("visibility", KX_VisibilityActuator, m_visible),
+       KX_PYATTRIBUTE_BOOL_RW("useOcclusion", KX_VisibilityActuator, m_occlusion),
+       KX_PYATTRIBUTE_BOOL_RW("useRecursion", KX_VisibilityActuator, m_recursive),
+       { NULL }        //Sentinel
 };
 
-
-
 /* set visibility ---------------------------------------------------------- */
-char 
+const char 
 KX_VisibilityActuator::SetVisible_doc[] = 
 "setVisible(visible?)\n"
 "\t - visible? : Make the object visible? (KX_TRUE, KX_FALSE)"
 "\tSet the properties of the actuator.\n";
 PyObject* 
 
-KX_VisibilityActuator::PySetVisible(PyObject* self, 
-                                   PyObject* args, 
-                                   PyObject* kwds) {
+KX_VisibilityActuator::PySetVisible(PyObject* args) {
        int vis;
+       ShowDeprecationWarning("SetVisible()", "the visible property");
 
-       if(!PyArg_ParseTuple(args, "i", &vis)) {
+       if(!PyArg_ParseTuple(args, "i:setVisible", &vis)) {
                return NULL;
        }
 
        m_visible = PyArgToBool(vis);
 
-       Py_Return;
+       Py_RETURN_NONE;
 }