Import_3ds: Improved aspect calculation #104815
@ -1632,16 +1632,10 @@ def load_3ds(filepath, context, CONSTRAIN=10.0, UNITS=False, IMAGE_SEARCH=True,
|
|||||||
# Select all new objects
|
# Select all new objects
|
||||||
for ob in imported_objects:
|
for ob in imported_objects:
|
||||||
if ob.type == 'LIGHT' and ob.data.type == 'SPOT':
|
if ob.type == 'LIGHT' and ob.data.type == 'SPOT':
|
||||||
|
square = math.sqrt(pow(1.0,2) + pow(1.0,2))
|
||||||
aspect = ob.empty_display_size
|
aspect = ob.empty_display_size
|
||||||
fac = 1.0
|
ob.scale.x = (aspect * square / (math.sqrt(pow(aspect,2) + 1.0)))
|
||||||
ratio = (fac / aspect)
|
ob.scale.y = (square / (math.sqrt(pow(aspect,2) + 1.0)))
|
||||||
align = fac - (ratio - aspect if ratio > fac else aspect - ratio)
|
|
||||||
if aspect > 1.0:
|
|
||||||
ob.scale.x = fac + align
|
|
||||||
ob.scale.y = fac - align
|
|
||||||
elif aspect < 1.0:
|
|
||||||
ob.scale.x = fac - align
|
|
||||||
ob.scale.y = fac + align
|
|
||||||
ob.select_set(True)
|
ob.select_set(True)
|
||||||
if not APPLY_MATRIX: # Reset transform
|
if not APPLY_MATRIX: # Reset transform
|
||||||
bpy.ops.object.rotation_clear()
|
bpy.ops.object.rotation_clear()
|
||||||
|
Loading…
Reference in New Issue
Block a user