No matching function...

fog

30-09-2005 09:17:20

Please report any "No matching function..." errors to this thread only, to not flood the forum with lots of similar topics. If possible also post a bug report to PyOgre bug tracker on http://developer.berlios.de/ .

esteban

07-10-2005 04:16:12

MaterialManager.getSingleton.parseScript() takes a DataStreamPtr. It would be nice to be able to pass it any filelike object in Python, but exposing DataStreamPtr would do.

Or, is there any other way that I can parse a script in PyOgre after root initialization?

viblo2

09-10-2005 15:16:04

I get this

AttributeError: Swig director python method error: Error detected when calling FrameListener.frameStarted.
'Resource' object has no attribute 'getTechnique'

when trying this code:

mat = ogre.MaterialManager.getSingleton().getByName("DarkSkyTerrain")
matPass = mat.getTechnique(0).getPass(0)


Even if its not missing function I think it belongs in this thread..

fog

09-10-2005 18:02:03

Yes, this is because getByName returns a generic ResourcePtr. Fortunately enough, untill we fix this using DYNAMIC_CAST you should be able to cast it in Python. Just do "ogre.MaterialPtr(mat)" and see if it works.

Clay

16-10-2005 22:42:26

I have been experimenting with making the Resource class dynamically cast to any sub object. The problem is this has no affect on the problem here. I may be able to redefine MaterialManager to return the proper pointer instead, but I'm not 100% sure it would work as I expect it to. We have to be sure to preserve the reference count so we don't get memory access violations.

These are the kind of things that should be added to the bug list so they are not forgotten. =)

fog

17-10-2005 09:12:41

This is already possible by using any XXXPtr contructor from Python. The problem is that if you try to cast to the wrong kind of shared pointer it just segfaults. If we discover why it segfaults and we can trap that in an exception we can probably generalize this method and make "Python tyepcasting" of shared pointers safe.

spike1907

18-10-2005 23:55:24

OK when i use this code
Floor.setCastShadows(false)

i get this
AddributeError: 'Entity' object has no attribute 'setCastShadows'

What is the proper attribute to use?
Or is not yet supported?

fog

19-10-2005 09:06:03

The attribute is "castShadows". When working with setters/getters always try the method name without set/get first. :D

Clay

19-10-2005 09:13:17

Yeah I think almost all of Ogre is now properly wrapped without get set methods:
class.getAttribute(something) # this is wrong
class.attribute = something # this is right


There's still a lot of functions in CEGUI that need to be wrapped though. I'll add that to the todo list.

Srekel

29-10-2005 17:18:45

I just tried creating overlays from code but I got a problem and I guess this is the thread to put it in. I followed this "guide": http://www.ogre3d.org/wiki/index.php/Cr ... s_via_Code



This is the code I've written:

om = ogre.OverlayManager.getSingleton()
print dir(om)
panel = om.createOverlayElement("Panel", "Game/CampaignPanel")
print type(panel)
print dir(panel)
print panel.container
top = 240
campaignNumber = 1
for campaign in [self.config[c] for c in self.config if c[:8] == "Campaign"]:
print campaign
print campaign["Name"]
textarea = om.createOverlayElement("TextArea", campaign["Name"])
textarea.metricsMode = ogre.GMM_PIXELS
textarea.verticalAlignment = ogre.GVA_TOP
textarea.horizontalAlignment = ogre.GVA_CENTER
textarea.left = -180
textarea.top = top
textarea.setParameter("font_name", "TrebuchetMSBold")
textarea.setParameter("char_height", "24")
textarea.setParameter("caption", "24")
textarea.setParameter("colour_top", "24")
textarea.setParameter("colour_bottom", "24")
top + 30
panel.addChild(textarea)

self.menuChoices.append((campaign["Name"], textarea, "Campaign" + str(campaignNumber)))

overlay = om.create("Game/Campaign")
overlay.add2D(panel)
overlay.show


the line that fails is

panel.addChild(textarea)


with the message

Traceback (most recent call last):
File "C:\Documents and Settings\Anders\My Documents\anders\Programmering\ViolentWorld\src\GameApplication.py", line 214, in ?
runGame()
File "C:\Documents and Settings\Anders\My Documents\anders\Programmering\ViolentWorld\src\GameApplication.py", line 182, in runGame
application.go()
File "C:\Documents and Settings\Anders\My Documents\anders\Programmering\ViolentWorld\src\GameApplication.py", line 45, in go
self.setupGame()
File "C:\Documents and Settings\Anders\My Documents\anders\Programmering\ViolentWorld\src\GameApplication.py", line 137, in setupGame
listener = StartGameListener(self.renderWindow, self.menuListener, self.dataManager)
File "C:\Documents and Settings\Anders\My Documents\anders\Programmering\ViolentWorld\src\MenuListeners\StartGameListener.py", line 54, in __init__
panel.addChild(textarea)
AttributeError: 'OverlayElement' object has no attribute 'addChild'


Any ideas?

Clay

29-10-2005 17:43:11

Ah ok, I need to add dynamic casts for the OverlayElement inheritance tree. I'll try to fix that this weekend.

Srekel

06-11-2005 14:02:50

Timer doesn't seem to be implemented (or I'm doing something wrong). This:


print "OGRE: Creating Root"
self.root = ogre.Root("../configs/plugins.cfg")

##### bunch of code omitted ######

print "OGRE: Setting up viewport"
### Set up the viewport
self.renderWindow.removeAllViewports()
self.viewport = self.renderWindow.addViewport( self.camera )
self.viewport.backgroundColour = ( 0, 0, 0 )


### Set a time variable
for x in dir(self.root.timer): print x
self.time = self.root.timer.getMilliseconds();


results in this:


OGRE: Setting up viewport
Traceback (most recent call last):
File "C:\Documents and Settings\Anders\My Documents\anders\Programmering\SGWF\src\Main.py", line 114, in ?
game = Main()
File "C:\Documents and Settings\Anders\My Documents\anders\Programmering\SGWF\src\Main.py", line 45, in __init__
exec "sys = module." + systemName + "(self.dataManager)"
File "<string>", line 1, in ?
File "C:\Documents and Settings\Anders\My Documents\anders\Programmering\SGWF\src\SubSystems\OGREGraphicsWrapper.py", line 94, in __init__
self.time = self.root.timer.getMilliseconds();
AttributeError: 'PySwigObject' object has no attribute 'getMilliseconds'
*-*-* OGRE Shutdown


Notice how "for x in dir(self.root.timer): print x" prints nothing.

Am I doing something wrong/should I do it another way, or is it just not implemented yet? :)


EDIT: Lol, I just realized by looking at the error message that I named the folder SGWF. It should of course be SGFW (Srekel's Game Framework). Not that it matters to you I guess. ;)

Clay

06-11-2005 19:18:54

Ok, Timer is now wrapped, and the Overlay problem above should be fixed.

Srekel

06-11-2005 19:39:05

Awesome, thanks. :)

dictatorfagan

15-11-2005 05:16:00

Ok, Timer is now wrapped, and the Overlay problem above should be fixed.

Is this fixed for sure? The following doesn't work for me:
panel = ogre.OverlayManager.getSingleton().createOverlayElement("Panel", "GregPanel")
overlay = ogre.OverlayManager.getSingleton().create("Greg/GregOverlay")
overlay.add2D(panel)
overlay.show()


crashing with this error:
File "C:\Python24\Lib\site-packages\pyogre\ogre.py", line 15390, in add2D
return _ogre.Overlay_add2D(*args)
TypeError: argument number 2: a 'Ogre::OverlayContainer *' is expected, 'PySwigObject(_p_Ogre__OverlayElement)' is received


edit -- I suppose I'm not using the latest code... all I have is 1.0.5.0. I don't really have the desire to go through the hassle of compiling it myself... when is the next release coming out?

Clay

15-11-2005 11:08:21

I just released it, and this should be fixed in it. New releases are done every other week, but I was a few days late on this one.

dictatorfagan

15-11-2005 19:17:43

Thanks, it works :D

chungungon

29-11-2005 06:36:08

The method SceneNode::getWorldPosition() is not implemented. I looked at ogre.py and is not there (not even as a 'worldPosition' property)

Clay

30-11-2005 20:10:38

Ok, I've added attributes for these functions in Ogre::Renderable (which exposes them to subclasses, such as SceneNode). Use standard attributes for these: worldPosition, worldOrientation, numWorldTransforms, useIdentityProjection, and useIdentityView. There are still several parts of Renderable that are not wrapped because they would require a lot of specialty code, so let me know if you need any of these functions: getRenderOperation, getWorldTransforms, getLights, getClipPlanes, and _updateCustomGpuParameter.


Also, unless you really know what you are doing, you shouldn't be using getWorldPosition at all. You should generally use SceneNode.position to get and set the position of the SceneNode (same with SceneNode.orientation to set the orientation). The functions that I just wrapped are generally for shader-manipulation anyway, so be sure this is what you want.

Committed as of revision 313. This change will be in saturday's release.

chungungon

04-12-2005 06:27:51

Thanks for the response :)

My intent is to create a 3rd person camera tracking code, as shown in this tutorial http://www.ogre3d.org/wiki/index.php/3r ... m_tutorial

They use getWorldPosition to calculate the place where the camera must move when chasing the character

esteban

23-12-2005 13:18:03

In PyOgre, LayerBlendOperationEx enum values are exposed as python ints.


>>> type(ogre.LBX_SUBTRACT)
<type 'int'>


The problem is that functions that expect LayerBlendOperationEx'es won't accept python ints in their stead.


File "c:\python24\lib\site-packages\pyogre\ogre.py", line 8168, in setColourOperationEx
return _ogre.TextureUnitState_setColourOperationEx(*args)
NotImplementedError: No matching function for overloaded 'TextureUnitState_setColourOperationEx'


Same thing happens with LayerBlendOperations and LayerBlendSources. I tried to do a typemap for these, but for some reason it didn't work. Since I'm only using these for TextureUnitState::setColourOperationEx() and since I was in a hurry, I just wrote an ad-hoc extension.


// (At the end of OgreTextureUnitState.i)

%extend Ogre::TextureUnitState
{
PyObject* setColourOperationEx(
PyObject* lboe, PyObject* lbs1, PyObject* lbs2)
{
if (!PyInt_Check(lboe) || !PyInt_Check(lbs1) || !PyInt_Check(lbs2)) {
PyErr_SetString(PyExc_TypeError, "int expected.");
return NULL;
}
self->setColourOperationEx(
(Ogre::LayerBlendOperationEx) PyInt_AsLong(lboe),
(Ogre::LayerBlendSource) PyInt_AsLong(lbs1),
(Ogre::LayerBlendSource) PyInt_AsLong(lbs2));
Py_INCREF(Py_None);
return Py_None;
}
}
%ignore Ogre::TextureUnitState::setColourOperationEx;


So this is not a priority for me, but this is of course not an acceptable solution for the official PyOgre, so I still report the problem.

Please let me know if I missed something!

Clay

23-12-2005 18:20:50

hmmm ok.

I'll take a look at this after this weekend. Holiday family-time is cutting into my programming. =)

dermont

24-12-2005 10:41:24

Would swapping the order of OgreTextureUnitState/OgreBlendMode.i in ogre.i not resolve this (?), i.e.


//%include OgreTextureUnitState.i
//%include OgreBlendMode.i

%include OgreBlendMode.i
%include OgreTextureUnitState.i

griminventions

13-01-2006 23:35:11

I ran into the No Matching Function error when I tried to call the equivalent of mySceneNode.yaw( rotY )I'm using 1.0.5-1, so maybe this is fixed in 1.0.6 (I can't get it to run on my PC). I'm still a rank noob with OGRE, so maybe it's my fault.

No matching function for overloaded 'SceneNode_yaw'

vracken

14-01-2006 19:00:56

Newbie question:

Whenever I try to use code like this:

mNode.orientation = ogre.Quaternion.nlerp(rotprogress, src, dest, True)

...for either slerp or nlerp, I get an error like "No matching function for overloaded 'Quaternion_nlerp'". Are these functions implemented in PyOgre 1.0.6, or is there a special way to call this?

dermont

22-01-2006 09:02:01

Both slerp and nlerp both appear to be implemented, I think you have to define src and dest as Quaternions, eg:

src=ogre.Quaternion.IDENTITY
mat =ogre.Matrix3()
pitch = ogre.Radian(0.5)
yaw = ogre.Radian(0.5)
roll = ogre.Radian(0.5)
print "value",pitch.valueDegrees()
mat.FromEulerAnglesXYZ(pitch, yaw, roll)
dest = ogre.Quaternion(mat)
.

headNode.orientation = ogre.Quaternion.nlerp(0.3, src, dest, True)

griminventions

22-01-2006 18:51:06

I was trying to get world position, but PyOgre says there's no such attribute or function for SceneNode.
pos = node.worldPosition
pos = node.getWorldPosition()

Neither works for me using PyOgre 1.0.5-1. Maybe I'm doing something wrong.

Edit: I installed 1.0.6 (finally) and just wanted to report that this now works. Also there is definitely a big boost in speed (about 30% more fps in my case). Great work Clay and team! :)

leau2001

14-02-2006 13:04:01

Hi all PyOgre User, i m new user, and i try with a tuto :

from pyogre import ogre
import SampleFramework

class TutorialApplication(SampleFramework.Application):
def _createScene(self):
pass

if __name__ == '__main__':
ta = TutorialApplication()
ta.go()


And it dosn't works

Traceback (most recent call last):
File "C:\Python24\pyogre\ogre_demos\basic_1.py", line 10, in -toplevel-
ta.go()
File "C:\Python24\pyogre\ogre_demos\SampleFramework.py", line 23, in go
if not self._setUp():
File "C:\Python24\pyogre\ogre_demos\SampleFramework.py", line 33, in _setUp
self.root = ogre.Root(ogre.getPluginPath())
File "C:\Python24\Lib\site-packages\pyogre\ogre.py", line 13465, in __init__
newobj = _ogre.new_Root(*args)
ExceptionPtr: ..\src\OgreDynLib.cpp(82): ogre error 9: Could not load dynamic library .\RenderSystem_Direct3D9. System Error: Le module spécifié est introuvable.



Thx for help

mthorn

03-03-2006 07:48:20


class RenderQueueListener(ogre.RenderQueueListener ):
AttributeError: 'module' object has no attribute 'RenderQueueListener'

syedhs

13-03-2006 09:45:41


AttributeError: Swig director python method error: Error detected when calling CombinedListener.frameStarted.
'NoneType' object has no attribute 'yaw'


The error shows up whenever I tried the
http://www.ogre3d.org/wiki/index.php/PyOgre_Beginner_Tutorial_2

And also, is there a guide somewhere on how to link Ogre functions into PyOgre myself?

pix

17-08-2006 16:39:28

hi,

i get "NotImplementedError: No matching function for overloaded 'SceneNode_yaw'" (or similar) for most calls that accept an ogre.Radian parameter. i can get around this by explicity converting the value to a floating point value with valueRadians(). is this normal?

here is some very minimal test code:


from pyogre import ogre

r = ogre.Root()
sm = r.createSceneManager(ogre.ST_GENERIC)
n = sm.rootSceneNode.createChildSceneNode()

print("calling yaw with a float... (works for me)")
n.yaw(1.0)

print("calling yaw with an ogre.Degree with an explicit valueRadians() call... (works for me)")
n.yaw(ogre.Degree(90.0).valueRadians())

print("calling yaw with an ogre.Degree... (gets No Matching Function for me)")
n.yaw(ogre.Degree(90.0))


i'm using ogre 1.2.1 and i just did an svn update.

oh, and i'm on linux and i built by doing (more or less)


# setup keeps dying because of some "gcc: : file not found error"
# but gcc creates files regardless, so i ran it in a loop
# (warning: this will loop endlessly if a _real_ compile error is encountered)
while ! python2.4 setup.py build ; do sleep 1 ; done
sudo python2.4 setup.py install


pix.

Istari

17-08-2006 17:07:11

I am aware of this issue and I'm working on it.
PyOgre would crash if it was passed a float instead of a Radian or Degree, so I modified a typemap. But now it seems that it doesn't accept anything but a float.
I'll probably end by removing my modified typemap and just create an overloaded method to accept floats as Radians.

If you use SCons to build, you don't need to call python setup.py build in a loop. I don't know why setup.py fails so often when SCons can get it on the first try.

pix

17-08-2006 18:36:41


If you use SCons to build, you don't need to call python setup.py build in a loop. I don't know why setup.py fails so often when SCons can get it on the first try.


SCons wasn't working for me. I just went back to try and noticed that it fails if OIS isn't installed, even though it says it will skip it. scons pyogre also would try to compile OIS at some point in the process, so I relented and just installed OIS and SCons worked for me, finally.

Also there were some problems with SCons insisting that pyogre was up to date, even after a scons --clean... But at some point it started working. Maybe it was related to the OIS issue.. I'm not so sure.

I don't really like SCons, maybe it can smell this... :wink:

pix.

ta2025

26-09-2006 03:03:34

Many of the demos are not working for me...


In the ParticleFXDemo.py, I get:


Traceback (most recent call last):
File "ParticleFXDemo.py", line 65, in ?
application.go()
File "C:\Python24\pyogre\demos\SampleFramework.py", line 23, in go
if not self._setUp():
File "C:\Python24\pyogre\demos\SampleFramework.py", line 48, in _setUp
self._createScene()
File "ParticleFXDemo.py", line 26, in _createScene
node.rotate((0, 0, -1), ogre.Radian(ogre.Degree(20)))
File "C:\Python24\lib\site-packages\pyogre\ogre.py", line 19894, in rotate
return _ogre.Node_rotate(*args)
NotImplementedError: No matching function for overloaded 'Node_rotate'
Unregistering ResourceManager for type BspLevel
*-*-* OGRE Shutdown


I've checked the API that I compiled via dOxygen and the node.rotate() *DOES* exist.

Im using pyogre 1.2 for Python 2.4 and I have downloaded the correct 1.2 demos. I've checked the resource.cfg

ta2025

26-09-2006 11:54:04


Traceback (most recent call last):
File "FresnelDemo.py", line 307, in ?
application.go()
File "C:\Python24\pyogre\demos\SampleFramework.py", line 23, in go
if not self._setUp():
File "C:\Python24\pyogre\demos\SampleFramework.py", line 48, in _setUp
self._createScene()
File "FresnelDemo.py", line 198, in _createScene
self.refractionTexture = ogre.TextureManager.getSingleton().createManualND(
'Refraction',
AttributeError: 'TextureManager' object has no attribute 'createManualND'
Unregistering ResourceManager for type BspLevel
*-*-* OGRE Shutdown

ta2025

26-09-2006 11:56:46

here is another one that balks at node.roll()


Traceback (most recent call last):
File "RenderToTextureDemo.py", line 197, in ?
application.go()
File "C:\Python24\pyogre\demos\SampleFramework.py", line 23, in go
if not self._setUp():
File "C:\Python24\pyogre\demos\SampleFramework.py", line 48, in _setUp
self._createScene()
File "RenderToTextureDemo.py", line 120, in _createScene
self.PlaneNode.roll(ogre.Degree(5))
File "C:\Python24\lib\site-packages\pyogre\ogre.py", line 19871, in roll
return _ogre.Node_roll(*args)
NotImplementedError: No matching function for overloaded 'Node_roll'
Exception exceptions.AttributeError: "'RenderToTextureApplication' object has no
attribute 'rttTex'" in <bound method RenderToTextureApplication.__del__ of <__m
ain__.RenderToTextureApplication object at 0x00CD9AF0>> ignored
Unregistering ResourceManager for type BspLevel
*-*-* OGRE Shutdown

dermont

26-09-2006 12:46:50

For the roll,yaw,rotate methods etc one of the typemaps isn't working correctly, do a search on this forum it's already been discussed:

http://www.ogre3d.org/phpBB2addons/view ... lueradians

Try replacing instances of ogre.Radian(ogre.Degree(value)) with ogre.Degree(value).valueRadians() e.g:


#node.rotate((0, 0, -1), ogre.Radian(ogre.Degree(-20)))
node.rotate((0, 0, -1), ogre.Degree(-20).valueRadians())

#self.fountainNode.yaw(ogre.Radian(ogre.Degree(frameEvent.timeSinceLastFrame * 30.0)))
self.fountainNode.yaw(ogre.Degree(frameEvent.timeSinceLastFrame * 30.0).valueRadians())


"createManualND" was implemented as patch 1333 / revision 353. Looks like it hasn't been updated in Istari's windows build or if your building from svn you don't have the most up to date version.

ta2025

26-09-2006 15:48:02

@dermont

No, I didnt build from SVN, Ive got the current 1.2 release. Actually, I have downloaded a version that was recommended on this forum that superceded the one that is in wiki.

dermont

26-09-2006 16:18:25

OK just tried out Istari's windows build (the version your referring to). The createManualND patchhas been applied to /branches/dev-1.2.0/pyogre/ogre/ but hasn't been implemented in the downloadable version.
http://svn.berlios.de/wsvn/pyogre/branc ... rev=0&sc=1

So I guess you'll have to wait until Istari updates the build.

ta2025

26-09-2006 16:38:16

Are there instructions for building from SVN? I would be happy to try! However, I dont have a C++ compiler in windows, so it might be a moot point?

dermont

26-09-2006 19:39:52

To get started You'll need to download a compiler, Ogre SDK and swig:

For compiler and SDK check install instructions here:

a) Visual C++ Express (vc 8.0) and make sure you follow the 5 steps indicated. Warning this download is 500MB+.

b) Prebuilt Ogre SDK, version 1.2.0 is probably the one you need. I'm using 1.2.3 and haven't encountered any problems.

http://www.ogre3d.org/wiki/index.php/Installing_An_SDK


c) download the latest version of pyogre
svn checkout http://svn.berlios.de/svnroot/repos/pyo ... /dev-1.2.0

d) Download swigwin-1.3.29
http://www.swig.org/download.html


pyogre version comes with solutuion files for Vc 8.0 in scripts/vc80. It's been some time since I've used the default solution files and SDK so you may have to:

i) goto Tools->External Tools and add the path to swig, e.g.

Tile : swig
Command : C:\swig\swigwin-1.3.29\swig.exe

ii) Change your C++ include directories and Library paths

If you decide to follow this route start a new thread with any problems and someone will help you out.

There's another free alternative Ogre 1.2.3 with Code::Blocks + MinGW C++ Toolbox. There aren't any project files for pyogre but I can supply them.

http://www.ogre3d.org/wiki/index.php/Co ... _and_MinGW

If you can go with Visual C++ Express.

ta2025

26-09-2006 20:06:29

wow - thanks for the play by play.

OvermindDL1

26-09-2006 21:07:20

You should probably wiki that that...