1. Coin3D
  2. Coin
  3. Pull requests

Pull requests

#11 Merged at ad4f070

Use SoType::fromName() in SO_KIT_ADD_CATALOG_ENTRY()

  1. Thomas Moeller

Solution for issue #61. Look up type in SO_KIT_ADD_CATALOG_ENTRY() via SoType class to avoid compile time dependencies to all parts. Tested change on Win7 and OS X (use of SoTrackballManip).

Comments (4)

  1. Roy Walmsley

    This looks OK. I will also test it in my own viewer application (running on Win8.1) - I can try all the manipulators very easily.

    Any observations on impact on execution speed?

  2. Thomas Moeller author

    I didn’t observe any performance impact in normal use cases. But to be sure I wrote a simple test program that creates 100000 instances of SoShapeKit (15 catalog entries each). Without the change this took 8.19 seconds on my laptop. With the type lookup via SoType::fromName() from the pull request the same loop took 9.16 seconds, which means it adds about 10%. Note though that the node configuration by the application is where typically most of the time is spent. For example, initializing those 100000 shapes with orientation, color and position as in the “Random Discs” example (https://github.com/TheHubbit/PyInventor/wiki/PyInventor-Examples) takes about 30 seconds. In performance critical situations (several thousands of scene objects) node kits might not the best choice to begin with (creating 100000 SoSphere instances for example is done in less than half a second).

    Furthermore I checked the header files of the original SGI and also VSG inventor libraries. Both are looking up the type via SoType class instead of calling getClassTypeId() directly. I believe the performance penalty is not relevant for normal use cases and worth accepting given the compatibility gain to the original Inventor library.

    In case this is not acceptable an alternative proposal would be to add another macro called SO_KIT_ADD_CATALOG_ENTRY_EXT() that does the type lookup for external nodes to be added to a node kit.