[vtkusers] SetScalar() removes my color scalars

Cory Quammen cory.quammen at kitware.com
Thu Mar 3 09:55:50 EST 2016


Doug,

This is a long-standing oddness in VTK. If you call SetScalars() on point
data, for example, a side effect is that the current active scalars is
removed from the point data! I have been bitten by this in the past. We
should probably change this behavior to avoid surprising effects like this
despite the backwards compatibility issues (which are hopefully few).

I recommend calling SetActiveScalars(const char* name) instead, which
shouldn't remove your array.

HTH,
Cory


On Thu, Mar 3, 2016 at 8:09 AM, jhirsch <jan.hirsch at st.ovgu.de> wrote:

> Hello Doug,
> your source example just creates two arrays and set their names and
> therefore has little to do with your problem, I guess. Can you copy more
> lines of code that show the problem with the scalar replacement?
>
> In general I would recommend to create a scalar array with 3 components and
> use that for colours. Like this:
>
> (that's from the example  here
> <http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/ColoredPoints>  )
>
>
>
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/SetScalar-removes-my-color-scalars-tp5736971p5736995.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>



-- 
Cory Quammen
R&D Engineer
Kitware, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160303/80d6a3d8/attachment.html>


More information about the vtkusers mailing list