~ubuntu-branches/ubuntu/lucid/blender/lucid

« back to all changes in this revision

Viewing changes to source/gameengine/Ketsji/KX_VisibilityActuator.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Chris Coulson
  • Date: 2009-08-06 22:32:19 UTC
  • mfrom: (1.2.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20090806223219-8z4eej1u8levu4pz
Tags: 2.49a+dfsg-0ubuntu1
* Merge from debian unstable, remaining changes:
  - debian/control: Build-depend on python-2.6 rather than python-2.5.
  - debian/misc/*.desktop: Add Spanish translation to .desktop 
    files.
  - debian/pyversions: 2.6.
  - debian/rules: Clean *.o of source/blender/python/api2_2x/
* New upstream release (LP: #382153).
* Refreshed patches:
  - 01_sanitize_sys.patch
  - 02_tmp_in_HOME
  - 10_use_systemwide_ftgl
  - 70_portability_platform_detection
* Removed patches merged upstream:
  - 30_fix_python_syntax_warning
  - 90_ubuntu_ffmpeg_52_changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * $Id: KX_VisibilityActuator.cpp 16873 2008-10-02 00:22:28Z campbellbarton $
 
2
 * $Id: KX_VisibilityActuator.cpp 20210 2009-05-15 03:26:53Z campbellbarton $
3
3
 *
4
4
 * ***** BEGIN GPL LICENSE BLOCK *****
5
5
 *
38
38
KX_VisibilityActuator::KX_VisibilityActuator(
39
39
        SCA_IObject* gameobj,
40
40
        bool visible,
 
41
        bool occlusion,
41
42
        bool recursive,
42
43
        PyTypeObject* T
43
44
        ) 
44
45
        : SCA_IActuator(gameobj,T),
45
46
          m_visible(visible),
 
47
          m_occlusion(occlusion),
46
48
          m_recursive(recursive)
47
49
{
48
50
        // intentionally empty
62
64
{
63
65
        KX_VisibilityActuator* replica = new KX_VisibilityActuator(*this);
64
66
        replica->ProcessReplica();
65
 
        // this will copy properties and so on...
66
 
        CValue::AddDataToReplica(replica);
67
67
        return replica;
68
68
}
69
69
 
78
78
        KX_GameObject *obj = (KX_GameObject*) GetParent();
79
79
        
80
80
        obj->SetVisible(m_visible, m_recursive);
 
81
        obj->SetOccluder(m_occlusion, m_recursive);
81
82
        obj->UpdateBuckets(m_recursive);
82
83
 
83
84
        return false;
90
91
 
91
92
 
92
93
/* Integration hooks ------------------------------------------------------- */
93
 
PyTypeObject 
94
 
KX_VisibilityActuator::Type = {
95
 
        PyObject_HEAD_INIT(&PyType_Type)
96
 
        0,
 
94
PyTypeObject KX_VisibilityActuator::Type = {
 
95
#if (PY_VERSION_HEX >= 0x02060000)
 
96
        PyVarObject_HEAD_INIT(NULL, 0)
 
97
#else
 
98
        /* python 2.5 and below */
 
99
        PyObject_HEAD_INIT( NULL )  /* required py macro */
 
100
        0,                          /* ob_size */
 
101
#endif
97
102
        "KX_VisibilityActuator",
98
 
        sizeof(KX_VisibilityActuator),
99
 
        0,
100
 
        PyDestructor,
101
 
        0,
102
 
        __getattr,
103
 
        __setattr,
104
 
        0, //&MyPyCompare,
105
 
        __repr,
106
 
        0, //&cvalue_as_number,
107
 
        0,
108
 
        0,
109
 
        0,
110
 
        0
 
103
        sizeof(PyObjectPlus_Proxy),
 
104
        0,
 
105
        py_base_dealloc,
 
106
        0,
 
107
        0,
 
108
        0,
 
109
        0,
 
110
        py_base_repr,
 
111
        0,0,0,0,0,0,
 
112
        py_base_getattro,
 
113
        py_base_setattro,
 
114
        0,0,0,0,0,0,0,0,0,
 
115
        Methods
 
116
 
111
117
};
112
118
 
113
119
PyParentObject 
121
127
 
122
128
PyMethodDef 
123
129
KX_VisibilityActuator::Methods[] = {
124
 
        {"set", (PyCFunction) KX_VisibilityActuator::sPySetVisible, 
125
 
         METH_VARARGS, (PY_METHODCHAR)SetVisible_doc},
 
130
        // Deprecated ----->
 
131
        {"set", (PyCFunction) KX_VisibilityActuator::sPySetVisible, METH_VARARGS,
 
132
                (PY_METHODCHAR) SetVisible_doc},
 
133
        // <-----
126
134
        {NULL,NULL} //Sentinel
127
135
};
128
136
 
129
 
PyObject* 
130
 
KX_VisibilityActuator::_getattr(
131
 
        const STR_String& attr
132
 
        ) 
133
 
{
134
 
        _getattr_up(SCA_IActuator);
 
137
PyAttributeDef KX_VisibilityActuator::Attributes[] = {
 
138
        KX_PYATTRIBUTE_BOOL_RW("visibility", KX_VisibilityActuator, m_visible),
 
139
        KX_PYATTRIBUTE_BOOL_RW("useOcclusion", KX_VisibilityActuator, m_occlusion),
 
140
        KX_PYATTRIBUTE_BOOL_RW("useRecursion", KX_VisibilityActuator, m_recursive),
 
141
        { NULL }        //Sentinel
135
142
};
136
143
 
 
144
PyObject* KX_VisibilityActuator::py_getattro(PyObject *attr)
 
145
{
 
146
        py_getattro_up(SCA_IActuator);
 
147
}
 
148
 
 
149
PyObject* KX_VisibilityActuator::py_getattro_dict() {
 
150
        py_getattro_dict_up(SCA_IActuator);
 
151
}
 
152
 
 
153
int KX_VisibilityActuator::py_setattro(PyObject *attr, PyObject *value)
 
154
{
 
155
        py_setattro_up(SCA_IActuator);
 
156
}
137
157
 
138
158
 
139
159
/* set visibility ---------------------------------------------------------- */
144
164
"\tSet the properties of the actuator.\n";
145
165
PyObject* 
146
166
 
147
 
KX_VisibilityActuator::PySetVisible(PyObject* self, 
148
 
                                    PyObject* args, 
149
 
                                    PyObject* kwds) {
 
167
KX_VisibilityActuator::PySetVisible(PyObject* args) {
150
168
        int vis;
 
169
        ShowDeprecationWarning("SetVisible()", "the visible property");
151
170
 
152
 
        if(!PyArg_ParseTuple(args, "i", &vis)) {
 
171
        if(!PyArg_ParseTuple(args, "i:setVisible", &vis)) {
153
172
                return NULL;
154
173
        }
155
174
 
156
175
        m_visible = PyArgToBool(vis);
157
176
 
158
 
        Py_Return;
 
177
        Py_RETURN_NONE;
159
178
}
160
179
 
161
180