From 72200de8666bcae25ff1876852336642abab55cb Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 27 Oct 2008 15:26:53 +0000 Subject: [PATCH] From Katharina Plugge, "I found a bug in the OpenFlight-Plugin. When exporting to OpenFlight it could happen that palettes of an external reference like the texture palette are set wrong, because they are overwritten by parent settings (userData), which actually do not refer to palette entries respectively ParentPools (happens for example if a Transform is parent of a ProxyNode). The static cast from userData to ParentPools should therefore be a dynamic cast. --------------------------- function FltExportVisitor::writeExternalReference( const osg::ProxyNode& proxy ): Line 423 in file expPrimaryRecords.cpp has to be changed from const ParentPools* pp = static_cast(proxy.getUserData() ); to const ParentPools* pp = dynamic_cast(proxy.getUserData() ); " --- src/osgPlugins/OpenFlight/expPrimaryRecords.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/osgPlugins/OpenFlight/expPrimaryRecords.cpp b/src/osgPlugins/OpenFlight/expPrimaryRecords.cpp index ec4f5c2e0..bcd4d3a19 100644 --- a/src/osgPlugins/OpenFlight/expPrimaryRecords.cpp +++ b/src/osgPlugins/OpenFlight/expPrimaryRecords.cpp @@ -420,7 +420,8 @@ FltExportVisitor::writeExternalReference( const osg::ProxyNode& proxy ) SHADER_PALETTE_OVERRIDE ; // Selectively turn off overrides for resources we don't need - const ParentPools* pp = static_cast(proxy.getUserData() ); + const ParentPools* pp = dynamic_cast(proxy.getUserData() ); + if (pp && pp->getColorPool() ) flags &= ~COLOR_PALETTE_OVERRIDE;