FindNode Compiler Error

  • Benjamin Barrett

    Hi everyone. I'm new to this forum and certainly very new to the Open Asset Import Library. Only been playing with it about a day now. Anyhow, for some reason when I try to compile code where I use the FindNode member function of aiNode I get a compiler error saying FindNode is not a member of aiNode. I find this strange because the autocomplete feature of Visual Studio 2005 show's it as a member of aiNode. Any ideas what the problem could be?

  • Thomas Ziegenhagen

    This is strange… two overloads of this function are present in aiNode, and both are implemented locally AND inline, which is redundant because locally implemented functions are inline by default. What is the exact error message you get from the compiler?

  • Benjamin Barrett

    Hi there. Here's the error I'm getting:

    1>c:\documents and settings\hp_administrator\my documents\visual studio 2005\projects\camaromesh\camaromesh\sample_simpleopengl.c(193) : error C2039: 'FindNode' : is not a member of 'aiNode'

    I haven't got a clue. Any ideas what could be the problem?

  • Thomas Ziegenhagen

    That's simple: you're compiling as C, but adding methods to a struct is a C++ feature. Recode the function to C or compile your source as C++ and it should work.

    In general: I'd strongly advise against using C. Of course, at the end of the day it's your and only your decision. But I've seen too many C-defenders claiming "you can do OOD in C as well!", only to watch them manually rebuild structures which a C++ compiler would generate for them. No wins, more risk… that's the modern approach to software development.

  • Benjamin Barrett

    Alright, I did what you said but now I'm getting a different compiler error. Please forgive my ignorance about these things. Anyhow, this is the error I'm getting:

    1>c:\documents and settings\hp_administrator\my documents\visual studio 2005\projects\camaromesh\camaromesh\simpleopengl.cpp(182) : error C2663: 'aiNode::FindNode' : 2 overloads have no legal conversion for 'this' pointer

    What do you think is the problem?

  • Thomas Ziegenhagen

    Apparently you have a const aiNode*, but FindNode() is not const and can therefore not be used with it. In theory there should be two more overloads for FindNode that work exactly the same but are const and return const aiNode*. But I don't know who wrote this code, and therefore can't say why he/she omitted the const versions of these functions.

    Write your own function to recursively search for a node.

  • Thomas Ziegenhagen

    And please: brush up your C++ knowledge. const vs. non-const is basic C++ knowledge. This issue has nothing to do with Assimp.

  • Benjamin Barrett

    Thank you so much. I'm really sorry about my ignorance regarding this matter. Again, please forgive me.

  • Benjamin Barrett

    I have another question now. Does Assimp maintain somewhere in these structures/classes information about what are called "groups" in wavefront obj files?

  • Thomas Ziegenhagen

    No problem. This is an actual Assimp question now :-)

    The short answer is: no. But bear with me, there's an explanation for that. Most file formats that Assimp can read specify explicit normals per vertex. OBJ is different. It just specifies which parts of the surface belong to one "group", and expects the reader to calculate the smoothed normals from this information. The Assimp OBJ loader does this for you. It's also done because of Assimp not having a notion to address sub parts of a mesh, therefore these groups have to be resolved before setting up the aiScene.

    If you need this separation for some context-specific measures, I suggest splitting up the mesh in Wavefront. You should then get multiple meshes in Assimp.

  • Alexander Gessler

    I guess we could preserve this info in aiMesh::mName - kimmi, any thoughts on this?

    Bye, Alex

  • Kim Kulling

    Kim Kulling - 2012-08-20

    Sure, this make sence. I can do this.



Log in to post a comment.