[vtk-developers] A weird 6.x specific bug with ModifiedEvents

David Gobbi david.gobbi at gmail.com
Mon Apr 14 12:50:37 EDT 2014


But if GetColor doesn't call ComputeComposite color, then what
should GetColor return?

I can clearly see the source of the strange behavior now, at least.
When SetColor() is called, the following sequence occurs:

  this->SetAmbientColor(this->Color);
  # SetAmbient triggers ModifedEvent
  # GetColor() is called, which changes this->Color back to its original value
  this->SetDiffuseColor(this->Color); # no color change, so no ModifiedEvent
  this->SetSpecularColor(this->Color); # no color change, so no ModifiedEvent

  David


On Mon, Apr 14, 2014 at 10:40 AM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> I do not think that GetColor should change the value of Color. If we
> need the composite color, we could have a method GetCompositeColor().
> No SetCompositeColor.
>
> Bill
>
>
> On Mon, Apr 14, 2014 at 12:24 PM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
>> Really bad stuff. ComputeCompositeColor "sets" this->Color directly.
>> ComputeCompositeColor was added about a year ago...
>>
>>
>>
>> On Mon, Apr 14, 2014 at 12:18 PM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
>>> This is indeed weird.
>>>
>>> GetColor does not return the value set by SetColor. It calls
>>> ComputeCompositeColor.
>>>
>>> Also, SetColor calls SetAmbientColor, SetDiffuseColor and
>>> SetSpecularColor. Each should cause a Modified event. In fact if you
>>> remove the o.GetColor() call in the Modified callback, you will see
>>> three modified events and each call will change one more of the color
>>> s (ambeint, diffuse, specular).
>>>
>>>
>>> Very strange.
>>>
>>> Bill
>>>
>>>
>>> On Mon, Apr 14, 2014 at 11:35 AM, Prabhu Ramachandran
>>> <prabhu at aero.iitb.ac.in> wrote:
>>>> Hi everyone,
>>>>
>>>> I just discovered a weird bug with VTK 6.1 and 6.0 that doesn't happen with
>>>> VTK 5.x.  Here is a tiny Python script:
>>>>
>>>> ##################################################
>>>> import vtk
>>>> def f(o, e):
>>>>     print e, o.GetAmbientColor(), o.GetColor(),
>>>>     print o.GetDiffuseColor(), o.GetSpecularColor()
>>>>
>>>> p = vtk.vtkProperty()
>>>> p.AddObserver('ModifiedEvent', f)
>>>> p.SetColor(0,0,0)
>>>> print p.GetColor()
>>>> ##################################################
>>>>
>>>> If you comment out the AddObserver line, everything works correctly but with
>>>> it, you can never set the color of the property!  This doesn't seem to be
>>>> specific to Python and happens with a small C++ example as well.
>>>>
>>>> Thoughts?
>>>>
>>>> cheers,
>>>> Prabhu
>>>> _______________________________________________
>>>> Powered by www.kitware.com
>>>>
>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/opensource/opensource.html
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.vtk.org/mailman/listinfo/vtk-developers
>>>>
>>>
>>>
>>>
>>> --
>>> Unpaid intern in BillsBasement at noware dot com
>>
>>
>>
>> --
>> Unpaid intern in BillsBasement at noware dot com
>
>
>
> --
> Unpaid intern in BillsBasement at noware dot com
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>



More information about the vtk-developers mailing list