ResourceSystem problems

mcaden

10-08-2008 22:26:18

Resource doesn't seem to want to go up a directory, only down in the tree.

my basic directory structure as it relates to this problem is:

/
/media/models
/Bin/Release/mygame.exe

so I can't get a .nxs file within media/models?

I plan on eventually moving the exe to the root project directory, but during development it seems easier to have /Bin/(configuration).

Is there no way to accomplish this as-is?

betajaen

10-08-2008 22:35:53

Not even?

../../../media/models/my_mesh.nxs

mcaden

10-08-2008 22:51:15


NxOgre::Resources::ResourceSystem::getSingleton()->addMesh("file://../../../media/models/room.nxs");

nxogrefileresource.h

Resources::ResourceSystem::getSingleton()->getCallback()->ResourceOpened(this);

if (reading) {
fseek(mFile, 0, SEEK_END); // << assertion
mSize = ftell(mFile);
fseek(mFile, 0, SEEK_SET);
}




I've tried different variations but anything else gives me an exception in nxogremesh.cpp:

MeshType Mesh::getMeshTypeFromResource(Resource* resource) {

if (resource->size() < 8) // << exception
return MT_Unknown;






I HAVE applied the patches to fix collision meshes in 1.0'21

Mesh::Mesh(const ResourceIdentifier& ri) {
mMesh.zero(); // << fix
load(ri);
}

/////////////////////////////////////////////////////////////

Mesh::Mesh(Resource* rs) {
mMesh.zero(); // << fix
load(rs);
}

//...


void Mesh::MeshData::zero() {
mTriangleMesh = 0;
mConvexMesh = 0;
mSkeletonMesh = 0;
mClothMesh = 0;
mSoftBodyMesh = 0;
mType = MT_Unknown;
mNbReferences = 0;
mMaterialAlias = 0; // << fix
}

betajaen

10-08-2008 23:02:12

Hmm; I have used "../../" style paths in NxOgre before, and nobody else has reported an error.

Are you sure the current working directory is where you said it was?

mcaden

10-08-2008 23:09:06

I'm doubly certain that's the directory setup ('doubly' because after you asked, I checked anyway).


Did I miss a fix? All I could find was that last code block I posted.

betajaen

10-08-2008 23:14:07

I'm sure your fix is correct. You can check by loading in a mesh in the same folder as your executable; if not then the fix hasn't been completely patched up.

mcaden

11-08-2008 11:15:28


NxOgre::Resources::ResourceSystem::getSingleton()->addMesh("file://room.nxs");


Loads just fine.

betajaen

11-08-2008 11:44:32

Looks like your relative path isn't correct then, or the current working directory is something else.

mcaden

13-08-2008 06:05:00

file://room.nxs = the same directory as the .exe...which is also set as the working directory (otherwise I wouldn't be able to run it b/c it would be missing all the dlls and such).

I've verified that the directory structure is as I stated in the first post.

I've tried

file://../../../media
file://../../media
file://./../../media

with the results being as I stated in my 2nd post





Sorry it took so long to get back with my results to this post. My wife went into labor. As of 16 hours ago I'm a father. Now, off I go back to the hospital, ending this short trip home I had in which to shower and upload pictures for my family.

betajaen

13-08-2008 09:15:50

Congratulations! Please spend time with your new member of your family than fiddle around with horrible NxOgre.

I'll see if I can can come up with a solution for you myself.

mcaden

27-08-2008 16:35:24

I guess no update on this? it's been 2 weeks

If there's no fix for it it's really not that big of a deal since on a final build or in demos the exe will be in the root of the installation, I suppose I'd have to redo the paths no matter what. I'll just have to have extraneous copies for now.

Prophet

27-08-2008 17:01:57

I think I had this problem and solved it by using addMeshAs(). Worth a shot?

Oh, and a late congratulations!

I just checked, and I know I've had this problem and that's the solution. I never reported it since I though I was just bad at it. (Which I'm still is)