Comments (8)
Hmm, that codebase has quite strange inheritance. Why does everything virtually inherit from TypedObject? Only one base need do so; since ClickablePopup already inherits indirectly from TypedObject, for example, there's nothing to gain from a class that derives from ClickablePopup also inheriting from TypedObject.
Which class in question is interrogate erroring about, though? It would help to also see the error message itself.
from panda3d.
The error itself is "2>..\src\nametag_igate.cxx(2542): error C2385: ambiguous access of 'as_typed_object'
2> could be the 'as_typed_object' in base 'TypedObject'
2> or could be the 'as_typed_object' in base 'TypedObject'
2>..\src\nametag_igate.cxx(2542): error C3861: 'as_typed_object': identifier not found
2>..\src\nametag_igate.cxx(4028): error C2385: ambiguous access of 'as_typed_object'
2> could be the 'as_typed_object' in base 'TypedObject'
2> or could be the 'as_typed_object' in base 'TypedObject'
2>..\src\nametag_igate.cxx(4028): error C3861: 'as_typed_object': identifier not found"
and i can't get rid of TypedObject for either of the bases for Nametag2d as both bases have things that need to be published. The rest of the virtual bases are for inheritance or to prevent conflicting class usage.
from panda3d.
And both sections the error happens just in case you're curious about that
/**
* Python function wrapper for:
* Nametag2d &Nametag2d::operator =(Nametag2d const &tag)
*/
static PyObject *Dtool_Nametag2d_operator_86(PyObject *self, PyObject *arg) {
Nametag2d *local_this = NULL;
if (!Dtool_Call_ExtractThisPointer_NonConst(self, Dtool_Nametag2d, (void **)&local_this, "Nametag2d.assign")) {
return NULL;
}
// 1-Nametag2d &Nametag2d::operator =(Nametag2d const &tag)
Nametag2d const *arg_this = (Nametag2d *)DTOOL_Call_GetPointerThisClass(arg, Dtool_Ptr_Nametag2d, 1, "Nametag2d.assign", true, true);
if (arg_this != NULL) {
(*local_this).operator =(*arg_this);
Nametag2d *return_value = local_this;
if (return_value != (Nametag2d *)NULL) {
return_value->ref();
}
if (Dtool_CheckErrorOccurred()) {
if (return_value != (Nametag2d *)NULL) {
unref_delete(return_value);
}
return NULL;
}
if (return_value == NULL) {
Py_INCREF(Py_None);
return Py_None;
} else {
return DTool_CreatePyInstanceTyped((void *)return_value, *Dtool_Ptr_Nametag2d, true, false, return_value->as_typed_object()->get_type_index());
}
}
if (!_PyErr_OCCURRED()) {
return Dtool_Raise_BadArgumentsError(
"assign(const Nametag2d self, const Nametag2d tag)\n");
}
return NULL;
}
/**
* Python function wrapper for:
* Nametag2d *NametagGroup::get_nametag_2d(void)
*/
static PyObject *Dtool_NametagGroup_get_nametag_2d_131(PyObject *self, PyObject *) {
NametagGroup *local_this = NULL;
if (!Dtool_Call_ExtractThisPointer_NonConst(self, Dtool_NametagGroup, (void **)&local_this, "NametagGroup.get_nametag_2d")) {
return NULL;
}
// 1-Nametag2d *NametagGroup::get_nametag_2d(void)
Nametag2d *return_value = (*local_this).get_nametag_2d();
if (return_value != (Nametag2d *)NULL) {
return_value->ref();
}
if (Dtool_CheckErrorOccurred()) {
if (return_value != (Nametag2d *)NULL) {
unref_delete(return_value);
}
return NULL;
}
if (return_value == NULL) {
Py_INCREF(Py_None);
return Py_None;
} else {
return DTool_CreatePyInstanceTyped((void *)return_value, *Dtool_Ptr_Nametag2d, true, false, return_value->as_typed_object()->get_type_index());
}
}
from panda3d.
This is not really an issue of Interrogate, but of your odd inheritance that makes the call to the inherited method as_typed_object()
ambiguous. This applies to any code that calls it, including the interrogate-generated code. The compiler gets confused; since your object inherits from TypedObject several times, it won't know which version of the inherited method to pick.
(In theory, interrogate could pick a class and force a devirtualised call. But how would it know which one to pick?)
It's usually a bad idea to inherit multiple times from TypedObject. But if you must do so, you need to define a method in the class that inherits multiple times, to disambiguate the call to as_typed_object()
.
CollisionVisualizer is a Panda class that inherits multiple times from TypedObject, and it defines the following methods to resolve this conflict:
panda3d/panda/src/collide/collisionVisualizer.h
Lines 62 to 64 in 0fcfb8e
panda3d/panda/src/collide/collisionVisualizer.I
Lines 65 to 85 in 0fcfb8e
from panda3d.
Oh, and for the record:
and i can't get rid of TypedObject for either of the bases for Nametag2d as both bases have things that need to be published. The rest of the virtual bases are for inheritance or to prevent conflicting class usage.
You don't need to inherit from TypedObject to publish anything via Interrogate. It will wrap the types just fine without any TypedObject in your inheritance tree.
(It's only needed for dynamic upcasting; so that a method that returns a PandaNode pointer will automatically upcast to a GeomNode on the Python side if it's really a GeomNode. Even then, you only need one TypedObject in the class hierarchy; adding multiple inheritances to TypedObject will just confuse matters.)
Needing virtual inheritance is usually a sign that you may need to rethink your class hierarchy. It's a tool that should be used sparingly; I don't believe virtual inheritance is needed in any part of the Panda3D codebase.
from panda3d.
I wrote this code a few years ago. It's broken and unfinished (how did it even get leaked?). I do not recommend using it.
from panda3d.
It was public Loblao. Also i only plan on using it as a base as i slowly RE Disney's Nametags
from panda3d.
Also thanks for the help rdb. (Didn't know you didn't need a TypedObject to publish...) And the class hierarchy will now finally be able to under go some renovations as i needed that to compile to do some testing and etc.
from panda3d.
Related Issues (20)
- Add FuncReverse() to the Interval system
- Interval: `LerpFunctionInterval()` returns `toData` when played backwards and duration is 0.0
- RPM package generation fails
- Implement SteamAudio SDK HOT 9
- Font.setOutline does not work entirely correctly HOT 2
- how to use LerpFunctionInterval and functools.partial not working HOT 2
- finalize_distribution_options entry point requires panda3d import
- TransformStat::get_mat() returns singular matrix on macOS HOT 5
- font.setPixelsPerUnit crashes when values get too high HOT 3
- identical condition HOT 1
- return twice
- unclear error with possibly non BMP character HOT 3
- Standardize TypedWritable HOT 2
- PGEntry getCursorY fails on word-wrapped or multiline text HOT 2
- Grammar railroad diagram HOT 5
- 2 small Preprocessor bugs HOT 11
- Reimplement core functionality of DIRECT in C++ codebase HOT 1
- Cppparser preprocessor do not expand macros with arguments correctly HOT 94
- bam_model_extensions changes external path references in distributions
- FSM object has no attribute 'notifier' in requestNext/requestPrev
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from panda3d.