Draft: reset the list of strings in the Label viewprovider
When the value of the `Text` is changed, in the Coin node
only the first element in the list of strings is updated,
the other elements remain the same, resulting in an incorrect
label.
So we empty the value of the Coin string with `setValue("")`,
and then we can assign the new string list, producing the correct
expected result.
This commit is contained in:
@@ -210,15 +210,17 @@ class ViewProviderLabel(ViewProviderDraftAnnotation):
|
||||
else:
|
||||
self.text2d.justification = coin.SoText2.LEFT
|
||||
self.text3d.justification = coin.SoAsciiText.LEFT
|
||||
elif prop == "Text":
|
||||
if obj.Text:
|
||||
if sys.version_info.major >= 3:
|
||||
self.text2d.string.setValues([l for l in obj.Text if l])
|
||||
self.text3d.string.setValues([l for l in obj.Text if l])
|
||||
else:
|
||||
self.text2d.string.setValues([l.encode("utf8") for l in obj.Text if l])
|
||||
self.text3d.string.setValues([l.encode("utf8") for l in obj.Text if l])
|
||||
self.onChanged(obj.ViewObject,"TextAlignment")
|
||||
elif prop == "Text" and obj.Text:
|
||||
self.text2d.string.setValue("")
|
||||
self.text3d.string.setValue("")
|
||||
|
||||
if sys.version_info.major >= 3:
|
||||
self.text2d.string.setValues([l for l in obj.Text if l])
|
||||
self.text3d.string.setValues([l for l in obj.Text if l])
|
||||
else:
|
||||
self.text2d.string.setValues([l.encode("utf8") for l in obj.Text if l])
|
||||
self.text3d.string.setValues([l.encode("utf8") for l in obj.Text if l])
|
||||
self.onChanged(obj.ViewObject, "TextAlignment")
|
||||
|
||||
def getTextSize(self,vobj):
|
||||
if vobj.DisplayMode == "3D text":
|
||||
|
||||
Reference in New Issue
Block a user