Hi Chris,

On Thu, Oct 22, 2009 at 7:27 PM, Chris 'Xenon' Hanson
<[email protected]> wrote:
>  Add support for "OutputTextureFiles" option to IVE plugin to permit creation 
> of external
> .dds texture files from internally-embedded textures during IVE writes.


I'm just reviewing your changes to the .ive plugin and believe the
follow code has a bug in it - the last name where the filename string
is written out is wrong:

        case IMAGE_REFERENCE_FILE:
        {
            // Only include image name in stream
            std::string fileName = "";
            if(!(image->getFileName().empty()))
                fileName = image->getFileName();
            // Export an image, if requested
            if (image && getOutputTextureFiles())
            {
                if (fileName.empty())
                { // synthesize a new faux filename
                    fileName = getTextureFileNameForOutput();
                }
                osgDB::writeImageFile(*image, fileName);
            }
            writeString(image->getFileName());
            break;
        }

I believe the code should read something like:

        case IMAGE_REFERENCE_FILE:
        {
            if (image)
            {
                // Only include image name in stream
                std::string fileName = image->getFileName();
                // Export an image, if requested
                if (getOutputTextureFiles())
                {
                    if (fileName.empty())
                    { // synthesize a new faux filename
                        fileName = getTextureFileNameForOutput();
                    }
                    osgDB::writeImageFile(*image, fileName);
                }
                writeString(fileName);
            }
            else
            {
                writeString("");
            }
            break;
        }

I'll be merging this on the assumption that my version is more
appropriate, let me know if I've missed something.

Another issue that was introduced is that you've
ReaderWriterIVE::write*(*, istream&..) methods so that they now have a
string& filename.  This breaks the .ive's plugin ability to handle
reading from istreams (including http supported) as these methods
should be straight overriding of the virtual methods provided by the
base ReaderWriter class.

The way we've tackled adding details of the filename of the original
file to the istream methods has been to add the filename into the
Options object and then extract this.  The .curl plugin does this I
will have a bash at working in such an approach to this code.

Robert.
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to