mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
minor build errors
This commit is contained in:
parent
6f2591c642
commit
4edcad8821
@ -324,7 +324,7 @@ handle_pyobj_command(TiXmlElement *xcommand, int want_response_id) {
|
||||
result = PyObject_Str(obj);
|
||||
|
||||
} else if (strcmp(method_name, "__setattr__") == 0) {
|
||||
const char *property_name;
|
||||
char *property_name;
|
||||
PyObject *value;
|
||||
if (PyArg_ParseTuple(params, "sO", &property_name, &value)) {
|
||||
PyObject_SetAttrString(obj, property_name, value);
|
||||
@ -333,7 +333,7 @@ handle_pyobj_command(TiXmlElement *xcommand, int want_response_id) {
|
||||
}
|
||||
|
||||
} else if (strcmp(method_name, "__delattr__") == 0) {
|
||||
const char *property_name;
|
||||
char *property_name;
|
||||
if (PyArg_ParseTuple(params, "s", &property_name)) {
|
||||
if (PyObject_HasAttrString(obj, property_name)) {
|
||||
PyObject_DelAttrString(obj, property_name);
|
||||
@ -345,7 +345,7 @@ handle_pyobj_command(TiXmlElement *xcommand, int want_response_id) {
|
||||
}
|
||||
|
||||
} else if (strcmp(method_name, "__getattr__") == 0) {
|
||||
const char *property_name;
|
||||
char *property_name;
|
||||
if (PyArg_ParseTuple(params, "s", &property_name)) {
|
||||
if (PyObject_HasAttrString(obj, property_name)) {
|
||||
result = PyObject_GetAttrString(obj, property_name);
|
||||
@ -356,7 +356,7 @@ handle_pyobj_command(TiXmlElement *xcommand, int want_response_id) {
|
||||
|
||||
} else {
|
||||
// Not a special-case name. Call the named method.
|
||||
PyObject *method = PyObject_GetAttrString(obj, method_name);
|
||||
PyObject *method = PyObject_GetAttrString(obj, (char *)method_name);
|
||||
if (method != NULL) {
|
||||
result = PyObject_CallObject(method, params);
|
||||
Py_DECREF(method);
|
||||
|
@ -405,26 +405,28 @@ handle_request(P3D_request *request) {
|
||||
<< "\n";
|
||||
// Ignore notifications.
|
||||
|
||||
// Temporary.
|
||||
P3D_object *obj = P3D_instance_get_script_object(request->_instance);
|
||||
cerr << "script_object is " << obj << "\n";
|
||||
if (obj != NULL) {
|
||||
if (P3D_OBJECT_SET_PROPERTY(obj, "foo", P3D_new_int_object(1))) {
|
||||
cerr << "set_property succeeded\n";
|
||||
P3D_object *prop = P3D_OBJECT_GET_PROPERTY(obj, "foo");
|
||||
cerr << "get_property returned " << prop << "\n";
|
||||
if (prop != NULL) {
|
||||
int size = P3D_OBJECT_GET_STRING(prop, NULL, 0);
|
||||
char *buffer = new char[size];
|
||||
P3D_OBJECT_GET_STRING(prop, buffer, size);
|
||||
cerr << " property is " << buffer << "\n";
|
||||
delete buffer;
|
||||
P3D_OBJECT_FINISH(prop);
|
||||
{
|
||||
// Temporary.
|
||||
P3D_object *obj = P3D_instance_get_script_object(request->_instance);
|
||||
cerr << "script_object is " << obj << "\n";
|
||||
if (obj != NULL) {
|
||||
if (P3D_OBJECT_SET_PROPERTY(obj, "foo", P3D_new_int_object(1))) {
|
||||
cerr << "set_property succeeded\n";
|
||||
P3D_object *prop = P3D_OBJECT_GET_PROPERTY(obj, "foo");
|
||||
cerr << "get_property returned " << prop << "\n";
|
||||
if (prop != NULL) {
|
||||
int size = P3D_OBJECT_GET_STRING(prop, NULL, 0) + 1;
|
||||
char *buffer = new char[size];
|
||||
P3D_OBJECT_GET_STRING(prop, buffer, size);
|
||||
cerr << " property is " << buffer << "\n";
|
||||
delete buffer;
|
||||
P3D_OBJECT_FINISH(prop);
|
||||
}
|
||||
} else {
|
||||
cerr << "set_property failed\n";
|
||||
}
|
||||
} else {
|
||||
cerr << "set_property failed\n";
|
||||
P3D_OBJECT_FINISH(obj);
|
||||
}
|
||||
P3D_OBJECT_FINISH(obj);
|
||||
}
|
||||
break;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user