You need to change the style of highlight to 'EMISSIVE_DIFFUSE'.tomkcook wrote: ↑Sat May 23, 2020 8:10 pm One more thing to add to this: I've found that if I take the last gist I posted and replace the SoIndexedPointSet objects with SoTranslation and SoSphere objects, then those sphere objects show correct highlight and selection behaviour. So it is something particular about SoIndexedPointSet and SoIndexedLineSet that means the highlight and selection behaviour doesn't work for them.
Code: Select all
sel1.style = 'EMISSIVE_DIFFUSE'
By default, the style is 'EMISSIVE', which means the highlight is achieved by overriding the emissive color, this is so that the original diffuse color can still show through. I guess the coin SoIndexedPoint/LineSet simply ignore emissive color when rendering.
BTW, I made a mistake before in my getDetailPath() function, it should be something like
Code: Select all
def getDetailPath(self, subname, path, append):
vobj = self.ViewObject
if append:
path.append(vobj.RootNode)
path.append(vobj.SwitchNode)
path.append(self.parent)
sub = Part.splitSubname(subname)[-1]
if sub == 'Atom1':
path.append(self.sel1)
elif sub == 'Atom2':
path.append(self.sel2)
elif sub == 'Line':
path.append(self.sel3)
return True