Commit 561b04fd authored by David Partyka's avatar David Partyka
Browse files

Merge branch '11855_fix_exporters' into release

parents db328008 5ab3b3d7
......@@ -20,6 +20,8 @@
#include "vtkCamera.h"
#include "vtkCellArray.h"
#include "vtkCellData.h"
#include "vtkCompositeDataSet.h"
#include "vtkCompositeDataGeometryFilter.h"
#include "vtkGeometryFilter.h"
#include "vtkImageData.h"
#include "vtkLightCollection.h"
......@@ -364,7 +366,7 @@ void vtkX3DExporter::WriteALight(vtkLight *aLight,
void vtkX3DExporter::WriteAnActor(vtkActor *anActor,
vtkX3DExporterWriter* writer, int index)
{
vtkDataSet *ds;
vtkSmartPointer<vtkDataSet> ds;
vtkPolyData *pd;
vtkSmartPointer<vtkGeometryFilter> gf;
vtkPointData *pntData;
......@@ -386,22 +388,27 @@ void vtkX3DExporter::WriteAnActor(vtkActor *anActor,
return;
}
// Essential to turn of interpolate scalars otherwise GetScalars() may return
// NULL. We restore value before returning.
int isbm = anActor->GetMapper()->GetInterpolateScalarsBeforeMapping();
anActor->GetMapper()->SetInterpolateScalarsBeforeMapping(0);
// first stuff out the transform
trans = vtkSmartPointer<vtkTransform>::New();
trans->SetMatrix(anActor->vtkProp3D::GetMatrix());
writer->StartNode(Transform);
writer->SetField(translation, SFVEC3F, trans->GetPosition());
writer->SetField(rotation, SFROTATION, trans->GetOrientationWXYZ());
writer->SetField(scale, SFVEC3F, trans->GetScale());
vtkDataObject* dObj = anActor->GetMapper()->GetInputDataObject(0, 0);
// get the mappers input and matrix
ds = anActor->GetMapper()->GetInput();
vtkCompositeDataSet* cd = vtkCompositeDataSet::SafeDownCast(dObj);
if (cd)
{
vtkCompositeDataGeometryFilter* gf = vtkCompositeDataGeometryFilter::New();
gf->SetInput(cd);
gf->Update();
ds = gf->GetOutput();
gf->Delete();
}
else
{
ds = anActor->GetMapper()->GetInput();
}
if (!ds)
{
return;
}
// we really want polydata
if ( ds->GetDataObjectType() != VTK_POLY_DATA )
......@@ -413,9 +420,23 @@ void vtkX3DExporter::WriteAnActor(vtkActor *anActor,
}
else
{
pd = static_cast<vtkPolyData *>(ds);
pd = static_cast<vtkPolyData *>(ds.GetPointer());
}
// Essential to turn of interpolate scalars otherwise GetScalars() may return
// NULL. We restore value before returning.
int isbm = anActor->GetMapper()->GetInterpolateScalarsBeforeMapping();
anActor->GetMapper()->SetInterpolateScalarsBeforeMapping(0);
// first stuff out the transform
trans = vtkSmartPointer<vtkTransform>::New();
trans->SetMatrix(anActor->vtkProp3D::GetMatrix());
writer->StartNode(Transform);
writer->SetField(translation, SFVEC3F, trans->GetPosition());
writer->SetField(rotation, SFROTATION, trans->GetOrientationWXYZ());
writer->SetField(scale, SFVEC3F, trans->GetScale());
prop = anActor->GetProperty();
points = pd->GetPoints();
pntData = pd->GetPointData();
......
......@@ -62,23 +62,27 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vtkPOVExporter.h"
#include "vtkAssemblyPath.h"
#include "vtkRenderer.h"
#include "vtkCamera.h"
#include "vtkLight.h"
#include "vtkLightCollection.h"
#include "vtkCellArray.h"
#include "vtkCompositeDataGeometryFilter.h"
#include "vtkCompositeDataSet.h"
#include "vtkFloatArray.h"
#include "vtkUnsignedCharArray.h"
#include "vtkPointData.h"
#include "vtkPolyData.h"
#include "vtkGeometryFilter.h"
#include "vtkProperty.h"
#include "vtkTexture.h"
#include "vtkLightCollection.h"
#include "vtkLight.h"
#include "vtkMapper.h"
#include "vtkMatrix4x4.h"
#include "vtkRenderWindow.h"
#include "vtkPointData.h"
#include "vtkPolyData.h"
#include "vtkProperty.h"
#include "vtkRendererCollection.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkSmartPointer.h"
#include "vtkTexture.h"
#include "vtkTypeTraits.h"
#include "vtkUnsignedCharArray.h"
#include <vtksys/ios/sstream>
#include "vtkObjectFactory.h"
......@@ -313,7 +317,26 @@ void vtkPOVExporter::WriteActor(vtkActor *actor)
}
// write geometry, first ask the pipeline to update data
vtkDataSet *dataset = actor->GetMapper()->GetInput();
vtkDataSet *dataset = NULL;
vtkSmartPointer<vtkDataSet> tempDS;
vtkDataObject* dObj = actor->GetMapper()->GetInputDataObject(0, 0);
vtkCompositeDataSet* cd = vtkCompositeDataSet::SafeDownCast(dObj);
if (cd)
{
vtkCompositeDataGeometryFilter* gf = vtkCompositeDataGeometryFilter::New();
gf->SetInput(cd);
gf->Update();
tempDS = gf->GetOutput();
gf->Delete();
dataset = tempDS;
}
else
{
dataset = actor->GetMapper()->GetInput();
}
if (dataset == NULL)
{
return;
......
......@@ -278,7 +278,7 @@ void vtkVRMLExporter::WriteAnActor(vtkActor *anActor, FILE *fp)
fprintf(fp," children [\n");
trans->Delete();
vtkDataObject* inputDO = anActor->GetMapper()->GetInput();
vtkDataObject* inputDO = anActor->GetMapper()->GetInputDataObject(0, 0);
if (inputDO == NULL)
{
return;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment