fix quote detection of multi-line VRMLscripts #5

Merged
Cedric Steiert merged 2 commits from Bujus_Krachus/io_scene_x3d:fix-quotes-multiline-vrml-scripts into main 2024-08-06 17:25:18 +02:00

View File

@ -715,7 +715,7 @@ class vrmlNode(object):
for v in f:
if v != ',':
try:
ret.append(float(v))
ret.append(float(v.strip('"')))
except:
break # quit of first non float, perhaps its a new field name on the same line? - if so we are going to ignore it :/ TODO
# print(ret)
@ -1219,6 +1219,11 @@ class vrmlNode(object):
else:
value += '\n' + l
# append a final quote if it is not there, like it's e.g. the case with multiline javascripts (#101717)
quote_count = l.count('"')
if quote_count % 2: # odd number?
value += '"'
# use shlex so we get '"a b" "b v"' --> '"a b"', '"b v"'
value_all = shlex.split(value, posix=False)