esteban
11-10-2005 08:54:34
... I mean, in current SVN.
The problem I have is getting the DataStreamPtr that parseScript() expects. I tried creating a FileHandleDataStream in Python, but it doesn't work. Maybe SWIG doesn't know to map Python file objects to FILE*s?
Later I discovered FileSystemArchive and FileSystemArchiveFactory, but neither is wrapped in PyOgre and I'm not sure whether I'm supposed to use these anyway. At least the Archive class says you shouldn't instantiate it directly, but through an ArchiveFactory.
So, in short, do you know of any way to use *Manager.parseScript() in current PyOgre? Do I create an FileSystemArchiveFactory, then ask it to give me a FileSystemArchive, then call load() on that? I'd have to wrap these in SWIG first. That's no problem, but could someone confirm this is what is needed? If not, any pointers?
Maybe the über-pythonic way to use parseScript would be to just let it take a python file object, or a python string. But to do this I'd still need to know what is the canonical way to use parseScript() in C++ Ogre, i.e. where are you expected to get the DataStreamPtr from.
TIA,
Esteban.
The problem I have is getting the DataStreamPtr that parseScript() expects. I tried creating a FileHandleDataStream in Python, but it doesn't work. Maybe SWIG doesn't know to map Python file objects to FILE*s?
>>> s = ogre.FileHandleDataStream(file("d:\\lala.txt"))
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "c:\python24\lib\site-packages\pyogre\ogre.py", line 4890, in __init__
newobj = _ogre.new_FileHandleDataStream(*args)
NotImplementedError: No matching function for overloaded 'new_FileHandleDataStre
am'
>>> f = file("d:\\lala.txt")
>>> f.fileno()
4
>>> s = ogre.FileHandleDataStream(f.fileno())
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "c:\python24\lib\site-packages\pyogre\ogre.py", line 4890, in __init__
newobj = _ogre.new_FileHandleDataStream(*args)
NotImplementedError: No matching function for overloaded 'new_FileHandleDataStre
am'
Later I discovered FileSystemArchive and FileSystemArchiveFactory, but neither is wrapped in PyOgre and I'm not sure whether I'm supposed to use these anyway. At least the Archive class says you shouldn't instantiate it directly, but through an ArchiveFactory.
So, in short, do you know of any way to use *Manager.parseScript() in current PyOgre? Do I create an FileSystemArchiveFactory, then ask it to give me a FileSystemArchive, then call load() on that? I'd have to wrap these in SWIG first. That's no problem, but could someone confirm this is what is needed? If not, any pointers?
Maybe the über-pythonic way to use parseScript would be to just let it take a python file object, or a python string. But to do this I'd still need to know what is the canonical way to use parseScript() in C++ Ogre, i.e. where are you expected to get the DataStreamPtr from.
TIA,
Esteban.