Results 1 to 2 of 2

Thread: How to read value of <init_from>

  1. #1
    Junior Member
    Join Date
    Jun 2008
    Posts
    2

    How to read value of <init_from>

    Hi,

    I have reading the value of the element <init_from> using this code snippet:

    Code :
    domFx_surface_commonRef surface;
    //Surface initialized here...
    const domFx_surface_init_commonRef surfaceInit = surface->getFx_surface_init_common();
    if (surfaceInit)
    {
    	const daeElementRefArray& initContent = surfaceInit->getContents();
    	for (Uint32 index=0; index < initContent.getCount(); ++index)
    	{
    		daeElement* element = initContent[index];
                   //element has been verified non-null
    		if (element->hasCharData())
    		{
    			const char* data = element->getCharData().c_str();
                           ...
    		}
    	}
    }

    This code keeps throwing an access violation on call to getCharData(). Please advise.

    Thanks,

  2. #2
    Junior Member
    Join Date
    Jun 2008
    Posts
    2

    Found the answer to my question

    OK, I found the answer to my own question.

    Instead of calling getContents(), I should have called getInit_from_array(). So the code that will give me the texture file name will look like this:

    Code :
    domFx_surface_commonRef surface;
    //Surface initialized here...
    const domFx_surface_init_commonRef surfaceInit = surface->getFx_surface_init_common();
    if (surfaceInit)
    {    
        const domFx_surface_init_from_common_Array& initFromList = surfaceInit->getInit_from_array();
        for (Uint32 initFrom=0; initFrom < initFromList.getCount(); ++initFrom){
            domImage* image = daeSafeCast<domImage>(InitFromList[initFrom]->getValue().getElement(););cout<<image->getInit_from()->getValue().getOriginalURI(<<endl;
        }
    }

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •