From 736729fc389ac8f3b6b78ca43aec020cc9a629e4 Mon Sep 17 00:00:00 2001 From: Matt Hirsch Date: Thu, 4 Feb 2016 01:34:17 -0500 Subject: [PATCH] export textures from blender with correct clip/repeat mode --- .../addons/io_three/exporter/api/texture.py | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/utils/exporters/blender/addons/io_three/exporter/api/texture.py b/utils/exporters/blender/addons/io_three/exporter/api/texture.py index 9880750d2b..bebdbcb8c9 100644 --- a/utils/exporters/blender/addons/io_three/exporter/api/texture.py +++ b/utils/exporters/blender/addons/io_three/exporter/api/texture.py @@ -155,12 +155,20 @@ def wrap(texture): """ logger.debug("texture.wrap(%s)", texture) - wrapping = { - True: constants.WRAPPING.MIRROR, - False: constants.WRAPPING.REPEAT - } - return (wrapping[texture.use_mirror_x], - wrapping[texture.use_mirror_y]) + + if(texture.extension == "REPEAT"): + wrapping = { + True: constants.WRAPPING.MIRROR, + False: constants.WRAPPING.REPEAT + } + return (wrapping[texture.use_mirror_x], + wrapping[texture.use_mirror_y]) + + # provide closest available three.js behavior. + # other possible values: "CLIP", "EXTEND", "CLIP_CUBE", "CHECKER", + # best match CLAMP behavior + else: + return (constants.WRAPPING.CLAMP, constants.WRAPPING.CLAMP); def textures(): -- GitLab