mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 09:23:03 -04:00
Eliminate p3dpython's problematic link-type dependency on core.pyd
This commit is contained in:
parent
c9f8ccf901
commit
ea7144e87d
@ -19,10 +19,7 @@
|
||||
#include "virtualFileSystem.h"
|
||||
#include "nativeWindowHandle.h"
|
||||
|
||||
#ifndef CPPPARSER
|
||||
#include "py_panda.h"
|
||||
IMPORT_THIS struct Dtool_PyTypedObject Dtool_WindowHandle;
|
||||
#endif
|
||||
|
||||
// There is only one P3DPythonRun object in any given process space.
|
||||
// Makes the statics easier to deal with, and we don't need multiple
|
||||
@ -298,14 +295,12 @@ run_python() {
|
||||
|
||||
// Now pass that func pointer back to our AppRunner instance, so it
|
||||
// can call up to us.
|
||||
result = PyObject_CallMethod(_runner, (char *)"setRequestFunc", (char *)"O", request_func);
|
||||
result = PyObject_CallMethod(_runner, (char *)"setRequestFunc", (char *)"N", request_func);
|
||||
if (result == NULL) {
|
||||
PyErr_Print();
|
||||
return false;
|
||||
}
|
||||
Py_DECREF(result);
|
||||
Py_DECREF(request_func);
|
||||
|
||||
|
||||
// Now add check_comm() as a task. It can be a threaded task, but
|
||||
// this does mean that application programmers will have to be alert
|
||||
@ -326,14 +321,14 @@ run_python() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// We have to make it a PythonTask, not just a GenericAsyncTask,
|
||||
// because we need the code in PythonTask that supports calling into
|
||||
// Python from a separate thread.
|
||||
_check_comm_task = new PythonTask(check_comm, "check_comm");
|
||||
_check_comm_task->set_task_chain("JavaScript");
|
||||
task_mgr->add(_check_comm_task);
|
||||
|
||||
Py_DECREF(check_comm);
|
||||
// Add it to the task manager. We do this instead of constructing a
|
||||
// PythonTask because linking p3dpython with core.pyd is problematic.
|
||||
result = PyObject_CallMethod(_taskMgr, (char *)"add", (char *)"Ns", check_comm, "check_comm");
|
||||
if (result == NULL) {
|
||||
PyErr_Print();
|
||||
return false;
|
||||
}
|
||||
Py_DECREF(result);
|
||||
|
||||
// Finally, get lost in AppRunner.run() (which is really a call to
|
||||
// taskMgr.run()).
|
||||
@ -603,10 +598,8 @@ handle_pyobj_command(TiXmlElement *xcommand, bool needs_response,
|
||||
Py_INCREF(obj);
|
||||
}
|
||||
|
||||
PyObject *result = PyObject_CallMethod
|
||||
(_runner, (char *)"setBrowserScriptObject", (char *)"O", obj);
|
||||
Py_DECREF(obj);
|
||||
Py_XDECREF(result);
|
||||
Py_XDECREF(PyObject_CallMethod
|
||||
(_runner, (char *)"setBrowserScriptObject", (char *)"N", obj));
|
||||
|
||||
} else if (strcmp(op, "call") == 0) {
|
||||
// Call the named method on the indicated object, or the object
|
||||
@ -1215,9 +1208,8 @@ set_instance_info(P3DCInstance *inst, TiXmlElement *xinstance) {
|
||||
xinstance->Attribute("respect_per_platform", &respect_per_platform);
|
||||
|
||||
PyObject *result = PyObject_CallMethod
|
||||
(_runner, (char *)"setInstanceInfo", (char *)"sssiOi", root_dir,
|
||||
(_runner, (char *)"setInstanceInfo", (char *)"sssiNi", root_dir,
|
||||
log_directory, super_mirror, verify_contents, main, respect_per_platform);
|
||||
Py_DECREF(main);
|
||||
|
||||
if (result == NULL) {
|
||||
PyErr_Print();
|
||||
@ -1331,11 +1323,9 @@ set_p3d_filename(P3DCInstance *inst, TiXmlElement *xfparams) {
|
||||
}
|
||||
|
||||
PyObject *result = PyObject_CallMethod
|
||||
(_runner, (char *)"setP3DFilename", (char *)"sOOiiis", p3d_filename.c_str(),
|
||||
(_runner, (char *)"setP3DFilename", (char *)"sNNiiis", p3d_filename.c_str(),
|
||||
token_list, arg_list, inst->get_instance_id(), _interactive_console, p3d_offset,
|
||||
p3d_url.c_str());
|
||||
Py_DECREF(token_list);
|
||||
Py_DECREF(arg_list);
|
||||
|
||||
if (result == NULL) {
|
||||
PyErr_Print();
|
||||
@ -1425,18 +1415,16 @@ setup_window(P3DCInstance *inst, TiXmlElement *xwparams) {
|
||||
// setupWindow() call. For this, we need to create a Python
|
||||
// wrapper objcet.
|
||||
parent_window_handle->ref();
|
||||
py_handle = DTool_CreatePyInstanceTyped(parent_window_handle, Dtool_WindowHandle, true, false, parent_window_handle->get_type_index());
|
||||
py_handle = DTool_CreatePyInstanceTyped(parent_window_handle.p(), true);
|
||||
}
|
||||
Py_INCREF(py_handle);
|
||||
|
||||
// TODO: direct this into the particular instance. This will
|
||||
// require a specialized ShowBase replacement.
|
||||
PyObject *result = PyObject_CallMethod
|
||||
(_runner, (char *)"setupWindow", (char *)"siiiiO", window_type.c_str(),
|
||||
(_runner, (char *)"setupWindow", (char *)"siiiiN", window_type.c_str(),
|
||||
win_x, win_y, win_width, win_height, py_handle);
|
||||
|
||||
Py_DECREF(py_handle);
|
||||
|
||||
if (result == NULL) {
|
||||
PyErr_Print();
|
||||
if (_interactive_console) {
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "handleStream.h"
|
||||
#include "p3dCInstance.h"
|
||||
#include "pandaFileStreamBuf.h"
|
||||
#include "pythonTask.h"
|
||||
#include "pmap.h"
|
||||
#include "pdeque.h"
|
||||
#include "pmutex.h"
|
||||
@ -173,8 +172,6 @@ private:
|
||||
PyObject *_browser_object_class;
|
||||
PyObject *_taskMgr;
|
||||
|
||||
PT(PythonTask) _check_comm_task;
|
||||
|
||||
// This map keeps track of the PyObject pointers we have delivered
|
||||
// to the parent process. We have to hold the reference count on
|
||||
// each of these until the parent process tells us it's safe to
|
||||
|
@ -4783,13 +4783,11 @@ if (RTDIST or RUNTIME):
|
||||
TargetAdd('p3dpython.exe', input='p3dpython_p3dpython_composite1.obj')
|
||||
TargetAdd('p3dpython.exe', input='p3dpython_p3dPythonMain.obj')
|
||||
TargetAdd('p3dpython.exe', input=COMMON_PANDA_LIBS)
|
||||
TargetAdd('p3dpython.exe', input='core.pyd')
|
||||
TargetAdd('p3dpython.exe', input='libp3tinyxml.ilb')
|
||||
TargetAdd('p3dpython.exe', opts=['PYTHON', 'WINUSER'])
|
||||
|
||||
TargetAdd('libp3dpython.dll', input='p3dpython_p3dpython_composite1.obj')
|
||||
TargetAdd('libp3dpython.dll', input=COMMON_PANDA_LIBS)
|
||||
TargetAdd('libp3dpython.dll', input='core.pyd')
|
||||
TargetAdd('libp3dpython.dll', input='libp3tinyxml.ilb')
|
||||
TargetAdd('libp3dpython.dll', opts=['PYTHON', 'WINUSER'])
|
||||
|
||||
@ -4801,7 +4799,6 @@ if (RTDIST or RUNTIME):
|
||||
TargetAdd('p3dpythonw.exe', input='p3dpythonw_p3dpython_composite1.obj')
|
||||
TargetAdd('p3dpythonw.exe', input='p3dpythonw_p3dPythonMain.obj')
|
||||
TargetAdd('p3dpythonw.exe', input=COMMON_PANDA_LIBS)
|
||||
TargetAdd('p3dpythonw.exe', input='core.pyd')
|
||||
TargetAdd('p3dpythonw.exe', input='libp3tinyxml.ilb')
|
||||
TargetAdd('p3dpythonw.exe', opts=['SUBSYSTEM:WINDOWS', 'PYTHON', 'WINUSER'])
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user