Skip to content

Commit b4982b1

Browse files
committed
Updated python3_unigine_objectmeshdynamic.cpp
1 parent e9afbc0 commit b4982b1

File tree

1 file changed

+107
-11
lines changed

1 file changed

+107
-11
lines changed

source/plugins/Sea5kg/Python3Scripting/src/python3_wrapper/pytypesobjects/python3_unigine_objectmeshdynamic.cpp

Lines changed: 107 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ static PyObject * unigine_ObjectMeshDynamic_is_flushed(unigine_ObjectMeshDynamic
304304
return ret;
305305
};
306306

307-
// public : flushIndices
307+
// public (inherit from Node): setShowInEditorEnabledRecursive
308308
static PyObject * unigine_ObjectMeshDynamic_set_show_in_editor_enabled_recursive(unigine_ObjectMeshDynamic* self, PyObject *args) {
309309
PyErr_Clear();
310310
PyObject *ret = NULL;
@@ -354,9 +354,105 @@ static PyObject * unigine_ObjectMeshDynamic_set_show_in_editor_enabled_recursive
354354
return ret;
355355
};
356356

357-
// void setSaveToWorldEnabledRecursive(bool enable);
358-
// void setName(const char *name);
357+
// public (inherit from Node): setSaveToWorldEnabledRecursive
358+
static PyObject * unigine_ObjectMeshDynamic_set_save_to_world_enabled_recursive(unigine_ObjectMeshDynamic* self, PyObject *args) {
359+
PyErr_Clear();
360+
PyObject *ret = NULL;
361+
// parse args:
362+
PyObject *pArg1; // bool enable;
363+
PyArg_ParseTuple(args, "O", &pArg1);
364+
365+
// pArg1
366+
if (!PyBool_Check(pArg1)) {
367+
PyErr_Format(PyExc_TypeError,
368+
"Argument \"enable\" to %s must be a bool object not a \"%s\"",
369+
__FUNCTION__, Py_TYPE(pArg1)->tp_name);
370+
return NULL;
371+
}
372+
bool enable = pArg1 == Py_True;
373+
374+
class LocalRunner : public Python3Runner {
375+
public:
376+
virtual void run() override {
377+
unigine_object_ptr->setSaveToWorldEnabledRecursive(enable);
378+
};
379+
bool enable;
380+
Unigine::Ptr<Unigine::ObjectMeshDynamic> unigine_object_ptr;
381+
};
382+
auto *pRunner = new LocalRunner();
383+
pRunner->enable = enable;
384+
pRunner->unigine_object_ptr = self->unigine_object_ptr;
385+
Python3Runner::runInMainThread(pRunner);
386+
while (!pRunner->mutexAsync.tryLock(5)) { // milliseconds
387+
}
388+
pRunner->mutexAsync.unlock();
389+
delete pRunner;
390+
Py_INCREF(Py_None);
391+
ret = Py_None;
392+
assert(!PyErr_Occurred());
393+
assert(ret);
394+
goto finally;
395+
except:
396+
Py_XDECREF(ret);
397+
ret = NULL;
398+
finally:
399+
/* If we were to treat arg as a borrowed reference and had Py_INCREF'd above we
400+
* should do this. See below. */
401+
402+
// end
403+
// return: void
404+
return ret;
405+
};
406+
407+
// public (inherit from Node): setName
408+
static PyObject * unigine_ObjectMeshDynamic_set_name(unigine_ObjectMeshDynamic* self, PyObject *args) {
409+
PyErr_Clear();
410+
PyObject *ret = NULL;
411+
// parse args:
412+
PyObject *pArg1; // bool enable;
413+
PyArg_ParseTuple(args, "O", &pArg1);
414+
415+
// pArg1
416+
if (!PyUnicode_Check(pArg1)) {
417+
PyErr_Format(PyExc_TypeError,
418+
"Argument \"name\" to %s must be a string object not a \"%s\"",
419+
__FUNCTION__, Py_TYPE(pArg1)->tp_name);
420+
return NULL;
421+
}
422+
const char * name = PyUnicode_AsUTF8(pArg1);
423+
424+
class LocalRunner : public Python3Runner {
425+
public:
426+
virtual void run() override {
427+
unigine_object_ptr->setName(name);
428+
};
429+
const char * name;
430+
Unigine::Ptr<Unigine::ObjectMeshDynamic> unigine_object_ptr;
431+
};
432+
auto *pRunner = new LocalRunner();
433+
pRunner->name = name;
434+
pRunner->unigine_object_ptr = self->unigine_object_ptr;
435+
Python3Runner::runInMainThread(pRunner);
436+
while (!pRunner->mutexAsync.tryLock(5)) { // milliseconds
437+
}
438+
pRunner->mutexAsync.unlock();
439+
delete pRunner;
440+
Py_INCREF(Py_None);
441+
ret = Py_None;
442+
assert(!PyErr_Occurred());
443+
assert(ret);
444+
goto finally;
445+
except:
446+
Py_XDECREF(ret);
447+
ret = NULL;
448+
finally:
449+
/* If we were to treat arg as a borrowed reference and had Py_INCREF'd above we
450+
* should do this. See below. */
359451

452+
// end
453+
// return: void
454+
return ret;
455+
};
360456

361457
static PyMethodDef unigine_ObjectMeshDynamic_methods[] = {
362458
{
@@ -395,14 +491,14 @@ static PyMethodDef unigine_ObjectMeshDynamic_methods[] = {
395491
"set_show_in_editor_enabled_recursive", (PyCFunction)unigine_ObjectMeshDynamic_set_show_in_editor_enabled_recursive, METH_VARARGS,
396492
"public (inherit from Node) : setShowInEditorEnabledRecursive"
397493
},
398-
// {
399-
// "set_save_to_world_enabled_recursive", (PyCFunction)unigine_ObjectMeshDynamic_set_save_to_world_enabled_recursive, METH_VARARGS,
400-
// "public (inherit from Node) : setSaveToWorldEnabledRecursive"
401-
// },
402-
// {
403-
// "set_name", (PyCFunction)unigine_ObjectMeshDynamic_set_name, METH_VARARGS,
404-
// "public (inherit from Node) : setName"
405-
// },
494+
{
495+
"set_save_to_world_enabled_recursive", (PyCFunction)unigine_ObjectMeshDynamic_set_save_to_world_enabled_recursive, METH_VARARGS,
496+
"public (inherit from Node) : setSaveToWorldEnabledRecursive"
497+
},
498+
{
499+
"set_name", (PyCFunction)unigine_ObjectMeshDynamic_set_name, METH_VARARGS,
500+
"public (inherit from Node) : setName"
501+
},
406502
{NULL} /* Sentinel */
407503
};
408504

0 commit comments

Comments
 (0)