From 9f56a959c28cb0ad51953999f400353086baf50a Mon Sep 17 00:00:00 2001 From: David Rose Date: Thu, 9 Jul 2009 01:30:13 +0000 Subject: [PATCH] unwrap p3d_object --- direct/src/plugin_npapi/ppInstance.cxx | 12 +++++++++++- direct/src/plugin_npapi/ppPandaObject.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/direct/src/plugin_npapi/ppInstance.cxx b/direct/src/plugin_npapi/ppInstance.cxx index d679145fc3..1f1ffd4f22 100644 --- a/direct/src/plugin_npapi/ppInstance.cxx +++ b/direct/src/plugin_npapi/ppInstance.cxx @@ -565,7 +565,17 @@ variant_to_p3dobj(const NPVariant *variant) { NPString str = NPVARIANT_TO_STRING(*variant); return P3D_new_string_object(str.utf8characters, str.utf8length); } else if (NPVARIANT_IS_OBJECT(*variant)) { - return new PPBrowserObject(this, NPVARIANT_TO_OBJECT(*variant)); + NPObject *object = NPVARIANT_TO_OBJECT(*variant); + if (object->_class == &PPPandaObject::_object_class) { + // This is really a PPPandaObject. + PPPandaObject *ppobject = (PPPandaObject *)object; + P3D_object *obj = ppobject->get_p3d_object(); + logfile << "Found nested Panda Object " << obj << "\n" << flush; + return P3D_OBJECT_COPY(obj); + } + + // It's a generic NPObject of some kind. + return new PPBrowserObject(this, object); } // Hmm, none of the above? diff --git a/direct/src/plugin_npapi/ppPandaObject.h b/direct/src/plugin_npapi/ppPandaObject.h index b2ccd47f32..2653dd1d93 100644 --- a/direct/src/plugin_npapi/ppPandaObject.h +++ b/direct/src/plugin_npapi/ppPandaObject.h @@ -86,6 +86,7 @@ private: PPInstance *_instance; P3D_object *_p3d_object; +public: static NPClass _object_class; };