Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-04-11 09:51:14 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-04-11 09:51:14 +0400
commit79d1a85d09520ea2a32d19da363489324fbb1ed0 (patch)
tree7f740db9fda25d754bee1aa0ea883171422d4c14 /io_scene_x3d
parent93be85532ba2a3bf030f3211f201c0fe4e055d53 (diff)
fix [#34606] x3d file with comma separated coordinates doesn't import
Diffstat (limited to 'io_scene_x3d')
-rw-r--r--io_scene_x3d/import_x3d.py20
1 files changed, 7 insertions, 13 deletions
diff --git a/io_scene_x3d/import_x3d.py b/io_scene_x3d/import_x3d.py
index 0a9d373c..f74eb585 100644
--- a/io_scene_x3d/import_x3d.py
+++ b/io_scene_x3d/import_x3d.py
@@ -532,7 +532,7 @@ class vrmlNode(object):
child.searchNodeTypeID(node_spec, results)
return results
- def getFieldName(self, field, ancestry, AS_CHILD=False):
+ def getFieldName(self, field, ancestry, AS_CHILD=False, SPLIT_COMMAS=False):
self_real = self.getRealNode() # in case we're an instance
for f in self_real.fields:
@@ -739,7 +739,7 @@ class vrmlNode(object):
self_real = self.getRealNode() # in case we're an instance
- child_array = self_real.getFieldName(field, ancestry, True)
+ child_array = self_real.getFieldName(field, ancestry, True, SPLIT_COMMAS=True)
#if type(child_array)==list: # happens occasionaly
# array_data = child_array
@@ -747,23 +747,15 @@ class vrmlNode(object):
if child_array is None:
# For x3d, should work ok with vrml too
# for x3d arrays are fields, vrml they are nodes, annoying but not tooo bad.
- data_split = self.getFieldName(field, ancestry)
+ data_split = self.getFieldName(field, ancestry, SPLIT_COMMAS=True)
if not data_split:
return []
- array_data = ' '.join(data_split)
- if array_data is None:
- return []
-
- array_data = array_data.replace(',', ' ')
- data_split = array_data.split()
array_data = array_as_number(data_split)
elif type(child_array) == list:
# x3d creates these
- data_split = [w.strip(",") for w in child_array]
-
- array_data = array_as_number(data_split)
+ array_data = array_as_number(child_array)
else:
# print(child_array)
# Normal vrml
@@ -1344,7 +1336,7 @@ class x3dNode(vrmlNode):
# Other funcs operate from vrml, but this means we can wrap XML fields, still use nice utility funcs
# getFieldAsArray getFieldAsBool etc
- def getFieldName(self, field, ancestry, AS_CHILD=False):
+ def getFieldName(self, field, ancestry, AS_CHILD=False, SPLIT_COMMAS=False):
# ancestry and AS_CHILD are ignored, only used for VRML now
self_real = self.getRealNode() # in case we're an instance
@@ -1354,6 +1346,8 @@ class x3dNode(vrmlNode):
# We may want to edit. for x3d specific stuff
# Sucks a bit to return the field name in the list but vrml excepts this :/
+ if SPLIT_COMMAS:
+ value = value.replace(",", " ")
return value.split()
else:
return None