New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using COLLADA 1.4.1 DAE::open always returns NULL #6

Closed
sadmac7000 opened this Issue Apr 17, 2014 · 5 comments

Comments

Projects
None yet
2 participants
@sadmac7000
Copy link

sadmac7000 commented Apr 17, 2014

Attempting to port my code to collada-dom 2.4.2, I discovered that dae.open now always returns NULL.

Looking at the code, it appears the issue happens here:

domCOLLADAProxy* DAE::openCommon(const string& path, daeString buffer) {
close(path);
string uri = makeFullUri(path);
plugin->setDatabase(database);
if (plugin->read(daeURI(*this, uri.c_str()), buffer) != DAE_OK)
return NULL;
return getRoot(uri);
}

the return NULL in the if statement is being triggered. That appears to come from here:

daeInt daeIOPluginCommon::read(const daeURI& uri, daeString docBuffer)
{
// Make sure topMeta has been set before proceeding
if (topMeta == NULL)
{
return DAE_ERR_BACKEND_IO;
}

snip

The topMeta variable should be populated by the owning DAE object at DAE::setIOPlugin on this line:

int res = plugin->setMeta(getMeta(getDomCOLLADAID()));

The nested getDomCOLLADAID call is to this code:

daeInt getDomCOLLADAID(const char* specversion)
{

ifdef COLLADA_DOM_SUPPORT150

if( specversion == NULL || strcmp(specversion,"1.5.0") == 0 ) {
    return ColladaDOM150::domCOLLADA::ID();
}

endif

ifdef COLLADA_DOM_SUPPORT141

if( specversion == NULL || strcmp(specversion,"1.4.1") == 0 ) {
    return ColladaDOM141::domCOLLADA::ID();
}

endif

return NULL;

}

You'll note we expect a specversion argument but have none passed, so we'll always return the version 150 ID it seems.

@rdiankov

This comment has been minimized.

Copy link
Owner

rdiankov commented Apr 18, 2014

can you try the following and tell me if it fixes the problem:

int res = plugin->setMeta(getMeta(getDomCOLLADAID(COLLADA_VERSION)));
@sadmac7000

This comment has been minimized.

Copy link

sadmac7000 commented Apr 18, 2014

On Fri, Apr 18, 2014 at 05:48:29AM -0700, Rosen Diankov wrote:

can you try the following and tell me if it fixes the problem:

int res = plugin->setMeta(getMeta(getDomCOLLADAID(COLLADA_VERSION)));

Where should I add this? In the library itself?

--CJD

@rdiankov

This comment has been minimized.

Copy link
Owner

rdiankov commented Apr 19, 2014

in dom/src/dae/dae.cpp in the place you mentioned

@sadmac7000

This comment has been minimized.

Copy link

sadmac7000 commented Apr 25, 2014

Yep. Works now.

@rdiankov

This comment has been minimized.

Copy link
Owner

rdiankov commented Apr 26, 2014

great! just committed 6706dd1

@rdiankov rdiankov closed this Apr 26, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment