Commit ca2e364c authored by Haocheng LIU's avatar Haocheng LIU Committed by Kitware Robot

Merge topic 'fix-glyph-scale-and-iterator'

a7e599d5 Fix the wrong scale of vtkGlyph3DMapper and resurrect create instance op
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: David Thompson's avatarDavid Thompson <david.thompson@kitware.com>
Merge-request: !1520
parents dd26333d a7e599d5
Pipeline #134591 running with stage
# Fix glyphing wth wrong scale and resurrect create instance
Now smtk will glyph prototypes with a per point scale array(default to [1,1,1])
instead of the magnitude.
Create instace operation is made to be SMTK3 compatible.
......@@ -99,7 +99,8 @@ void AddRenderables(
return;
}
auto mbit = data->NewTreeIterator();
mbit->VisitOnlyLeavesOn();
// Some entity might uses composite data sets.
mbit->VisitOnlyLeavesOff();
for (mbit->GoToFirstItem(); !mbit->IsDoneWithTraversal(); mbit->GoToNextItem())
{
auto obj = mbit->GetCurrentDataObject();
......@@ -152,9 +153,11 @@ void vtkSMTKModelRepresentation::SetupDefaults()
vtkNew<vtkCompositeDataDisplayAttributes> glyphAtt;
this->GlyphMapper->SetBlockAttributes(glyphAtt);
this->GlyphMapper->SetScaleModeToNoDataScaling(); // We use a per point scale array
vtkNew<vtkCompositeDataDisplayAttributes> selGlyphAtt;
this->SelectedGlyphMapper->SetBlockAttributes(selGlyphAtt);
this->SelectedGlyphMapper->SetScaleModeToNoDataScaling(); // We use a per point scale array
this->Entities->SetMapper(this->EntityMapper);
this->SelectedEntities->SetMapper(this->SelectedEntityMapper);
......@@ -862,7 +865,8 @@ void vtkSMTKModelRepresentation::ClearSelection(vtkMapper* mapper)
// Glyph3DMapper does not behave as vtkCompositePolyDataMapper2, hence it is
// necessary to update the block visibility of each node directly.
auto mbds = vtkMultiBlockDataSet::SafeDownCast(gm->GetInputDataObject(0, 0));
vtkCompositeDataIterator* iter = mbds->NewIterator();
vtkDataObjectTreeIterator* iter = mbds->NewTreeIterator();
iter->VisitOnlyLeavesOff();
iter->GoToFirstItem();
while (!iter->IsDoneWithTraversal())
......@@ -1208,7 +1212,7 @@ void vtkSMTKModelRepresentation::ColorByField()
}
}
void vtkSMTKModelRepresentation::ColorByVolume(vtkCompositeDataSet* data)
void vtkSMTKModelRepresentation::ColorByVolume(vtkMultiBlockDataSet* data)
{
if (!this->UpdateColorBy)
return;
......@@ -1216,7 +1220,8 @@ void vtkSMTKModelRepresentation::ColorByVolume(vtkCompositeDataSet* data)
// Traverse the blocks and set the volume's color
this->EntityMapper->GetCompositeDataDisplayAttributes()->RemoveBlockColors();
this->EntityMapper->GetCompositeDataDisplayAttributes()->RemoveBlockOpacities();
vtkCompositeDataIterator* it = data->NewIterator();
vtkDataObjectTreeIterator* it = data->NewTreeIterator();
it->VisitOnlyLeavesOff();
it->GoToFirstItem();
while (!it->IsDoneWithTraversal())
{
......@@ -1255,7 +1260,8 @@ void vtkSMTKModelRepresentation::ColorByEntity(vtkMultiBlockDataSet* data)
// Traverse the blocks and set the entity's color
this->EntityMapper->GetCompositeDataDisplayAttributes()->RemoveBlockColors();
this->EntityMapper->GetCompositeDataDisplayAttributes()->RemoveBlockOpacities();
vtkCompositeDataIterator* it = data->NewIterator();
vtkDataObjectTreeIterator* it = data->NewTreeIterator();
it->VisitOnlyLeavesOff();
it->GoToFirstItem();
while (!it->IsDoneWithTraversal())
{
......
......@@ -346,7 +346,7 @@ protected:
* Entities bounding a volume entity (if any), use the color defined by
* the bounded entity. Currently uses only volume 0.
*/
void ColorByVolume(vtkCompositeDataSet* data);
void ColorByVolume(vtkMultiBlockDataSet* data);
void ColorByEntity(vtkMultiBlockDataSet* data);
void ColorByField();
......
......@@ -79,7 +79,7 @@ void CreateInstances::addUniformRandomRule(Instance& instance, const EntityRef&
void CreateInstances::addSnappingConstraints(Instance& instance, const EntityRef& prototype)
{
(void)prototype;
auto snapItem = this->parameters()->findModelEntity("snap to entity");
auto snapItem = this->parameters()->findComponent("snap to entity");
if (snapItem->isEnabled())
{
// TODO? Check whether extension is available?
......@@ -125,7 +125,7 @@ CreateInstances::Result CreateInstances::operateInternal()
instance.assignDefaultName();
createdItem->appendValue(prototype.component());
modifiedItem->appendValue(instance.component());
result->findModelEntity("tess_changed")->appendValue(instance);
result->findComponent("tess_changed")->appendValue(instance.component());
if (rule == "tabular")
{
this->addTabularRule(instance, prototype);
......
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