Add feature #12: Scale geometry options for shape import #16
@ -56,7 +56,7 @@ class ImportX3D(bpy.types.Operator, ImportHelper):
|
||||
default=1.0,
|
||||
Hombre57 marked this conversation as resolved
|
||||
precision=4,
|
||||
step=1.0,
|
||||
description="Scale value used when 'File Unit' is set to 'Use scale'",
|
||||
description="Scale value used when 'File Unit' is set to 'CUSTOM'",
|
||||
Bujus_Krachus marked this conversation as resolved
Outdated
Cedric Steiert
commented
'Use scale' now needs to be adjusted to the new name (CUSTOM) 'Use scale' now needs to be adjusted to the new name (CUSTOM)
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
|
@ -815,7 +815,6 @@ class vrmlNode(object):
|
||||
# print(child_array)
|
||||
# Normal vrml
|
||||
array_data = child_array.array_data
|
||||
apply_scale = scale_factor != 1.0
|
||||
|
||||
# print('array_data', array_data)
|
||||
if group == -1 or len(array_data) == 0:
|
||||
@ -828,13 +827,15 @@ class vrmlNode(object):
|
||||
flat = False
|
||||
break
|
||||
|
||||
apply_scale = scale_factor != 1.0
|
||||
|
||||
# make a flat array
|
||||
if flat:
|
||||
flat_array = array_data # we are already flat.
|
||||
if apply_scale:
|
||||
# applying scale
|
||||
for item in array_data:
|
||||
item *= scale_factor
|
||||
flat_array = [n*scale_factor for n in array_data] # scaling the data
|
||||
else:
|
||||
flat_array = array_data # we are already flat.
|
||||
|
||||
else:
|
||||
flat_array = []
|
||||
@ -1511,7 +1512,7 @@ def translateScale(sca):
|
||||
def translateTransform(node, ancestry):
|
||||
cent = node.getFieldAsFloatTuple('center', None, ancestry, conversion_scale) # (0.0, 0.0, 0.0)
|
||||
rot = node.getFieldAsFloatTuple('rotation', None, ancestry) # (0.0, 0.0, 1.0, 0.0)
|
||||
sca = node.getFieldAsFloatTuple('scale', None, ancestry, conversion_scale) # (1.0, 1.0, 1.0)
|
||||
sca = node.getFieldAsFloatTuple('scale', None, ancestry) # (1.0, 1.0, 1.0)
|
||||
scaori = node.getFieldAsFloatTuple('scaleOrientation', None, ancestry) # (0.0, 0.0, 1.0, 0.0)
|
||||
tx = node.getFieldAsFloatTuple('translation', None, ancestry, conversion_scale) # (0.0, 0.0, 0.0)
|
||||
|
||||
@ -1693,7 +1694,7 @@ def importMesh_ReadVertices(bpymesh, geom, ancestry):
|
||||
# IndexedFaceSet presumes a 2D one.
|
||||
# The case for caching is stronger over there.
|
||||
coord = geom.getChildBySpec('Coordinate')
|
||||
points = coord.getFieldAsArray('point', 0, ancestry)
|
||||
points = coord.getFieldAsArray('point', 0, ancestry, conversion_scale)
|
||||
bpymesh.vertices.add(len(points) // 3)
|
||||
bpymesh.vertices.foreach_set("co", points)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user
please also add
step=1.0,
. Currently it steps in intervals of 0.03, 0.01 seems more appropriate (or is 0.03 more comfy?). Could be also adjusted for the x3d exporter in line 220.Done