Commit 2c51b38b authored by eric pellegrini's avatar eric pellegrini
Browse files

Bug fix when viewing a newly created element (no color set in the db)

parent 80e330c9
...@@ -301,7 +301,7 @@ class MolecularViewerPanel(ComponentPlugin): ...@@ -301,7 +301,7 @@ class MolecularViewerPanel(ComponentPlugin):
# The array that will store the scale for all the atoms. # The array that will store the scale for all the atoms.
self._atomsScales = numpy.array([ELEMENTS[at.symbol,'vdw_radius'] for at in self._atoms]).astype(numpy.float32) self._atomsScales = numpy.array([ELEMENTS[at.symbol,'vdw_radius'] for at in self._atoms]).astype(numpy.float32)
scalars = ndarray_to_vtkarray(self.atomsColours, self._atomsScales, self._nAtoms) scalars = ndarray_to_vtkarray(self.atomsColours, self._atomsScales, self._nAtoms)
bonds = vtk.vtkCellArray() bonds = vtk.vtkCellArray()
...@@ -334,6 +334,9 @@ class MolecularViewerPanel(ComponentPlugin): ...@@ -334,6 +334,9 @@ class MolecularViewerPanel(ComponentPlugin):
def color_string_to_RGB(self, s): def color_string_to_RGB(self, s):
if not s.strip():
s = "1;1;1"
return numpy.array(s.split(';')).astype(numpy.float32)/255. return numpy.array(s.split(';')).astype(numpy.float32)/255.
def build_ColorTransferFunction(self): def build_ColorTransferFunction(self):
......
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