I’m attempting to create a blank OnscreenImage – that is to say, one that has no image at all. From what I’ve seen in the documentation, it should be perfectly valid to construct one without the “image” parameter and to then assign an image at a later point via “setImage”.
Unfortunately, I seem to be getting the following error on the second line above:
If I comment out the “setBin” line above I seem to just get a similar error at a later point, with a later attempt at using the “self.mapBackdrop” object.
Am I doing something incorrectly? Is this a bug? Is there something that I might do to fix this?
Indeed, an OnscreenImage that has no image also has no node, so you can’t call setBin() on it. But you could call setBin() on a parent. Try just using self.handleNode.setBin() instead. If you have other children of handleNode that you don’t want to inherit this property, then create a parent node specifically for your image.
This behaviour might be worth clarifying in the manual, I think, since I got the impression there that I should be getting a perfectly valid (if geom-less) NodePath when I constructed an “empty” OnscreenImage.
(I take it that the manual is no longer freely editable? I just took another look at the page regarding OnscreenImage, and don’t seem to have found the control that I vaguely recall being once present that allowed one to edit a page.)