Browse Source

Change logic: copy textures -> export textures, embed depends on export

Matt Hirsch 9 years ago
parent
commit
4e7f1cbc3d

+ 14 - 14
utils/exporters/blender/addons/io_three/__init__.py

@@ -374,9 +374,9 @@ def restore_export_settings(properties, settings):
         constants.INDENT,
         constants.INDENT,
         constants.EXPORT_OPTIONS[constants.INDENT])
         constants.EXPORT_OPTIONS[constants.INDENT])
 
 
-    properties.option_copy_textures = settings.get(
-        constants.COPY_TEXTURES,
-        constants.EXPORT_OPTIONS[constants.COPY_TEXTURES])
+    properties.option_export_textures = settings.get(
+        constants.EXPORT_TEXTURES,
+        constants.EXPORT_OPTIONS[constants.EXPORT_TEXTURES])
 
 
     properties.option_embed_textures = settings.get(
     properties.option_embed_textures = settings.get(
         constants.EMBED_TEXTURES,
         constants.EMBED_TEXTURES,
@@ -471,7 +471,7 @@ def set_settings(properties):
         constants.LOGGING: properties.option_logging,
         constants.LOGGING: properties.option_logging,
         constants.COMPRESSION: properties.option_compression,
         constants.COMPRESSION: properties.option_compression,
         constants.INDENT: properties.option_indent,
         constants.INDENT: properties.option_indent,
-        constants.COPY_TEXTURES: properties.option_copy_textures,
+        constants.EXPORT_TEXTURES: properties.option_export_textures,
         constants.EMBED_TEXTURES: properties.option_embed_textures,
         constants.EMBED_TEXTURES: properties.option_embed_textures,
         constants.TEXTURE_FOLDER: properties.option_texture_folder,
         constants.TEXTURE_FOLDER: properties.option_texture_folder,
 
 
@@ -527,8 +527,8 @@ def animation_options():
     return anim
     return anim
 
 
 def resolve_conflicts(self, context):
 def resolve_conflicts(self, context):
-    if(self.option_embed_textures):
-        self.option_copy_textures = False;
+    if(not self.option_export_textures):
+        self.option_embed_textures = False;
 
 
 class ExportThree(bpy.types.Operator, ExportHelper):
 class ExportThree(bpy.types.Operator, ExportHelper):
     """Class that handles the export properties"""
     """Class that handles the export properties"""
@@ -674,16 +674,16 @@ class ExportThree(bpy.types.Operator, ExportHelper):
         description="Embed animation data with the geometry data",
         description="Embed animation data with the geometry data",
         default=constants.EXPORT_OPTIONS[constants.EMBED_ANIMATION])
         default=constants.EXPORT_OPTIONS[constants.EMBED_ANIMATION])
 
 
-    option_copy_textures = BoolProperty(
-        name="Copy textures",
-        description="Copy textures",
-        default=constants.EXPORT_OPTIONS[constants.COPY_TEXTURES])
+    option_export_textures = BoolProperty(
+        name="Export textures",
+        description="Export textures",
+        default=constants.EXPORT_OPTIONS[constants.EXPORT_TEXTURES],
+        update=resolve_conflicts)
 
 
     option_embed_textures = BoolProperty(
     option_embed_textures = BoolProperty(
         name="Embed textures",
         name="Embed textures",
         description="Embed base64 textures in .json",
         description="Embed base64 textures in .json",
-        default=constants.EXPORT_OPTIONS[constants.EMBED_TEXTURES],
-        update=resolve_conflicts)
+        default=constants.EXPORT_OPTIONS[constants.EMBED_TEXTURES])
 
 
     option_texture_folder = StringProperty(
     option_texture_folder = StringProperty(
         name="Texture folder",
         name="Texture folder",
@@ -929,11 +929,11 @@ class ExportThree(bpy.types.Operator, ExportHelper):
         row.prop(self.properties, 'option_maps')
         row.prop(self.properties, 'option_maps')
 
 
         row = layout.row()
         row = layout.row()
-        row.prop(self.properties, 'option_copy_textures')
-        row.enabled = not self.properties.option_embed_textures
+        row.prop(self.properties, 'option_export_textures')
 
 
         row = layout.row()
         row = layout.row()
         row.prop(self.properties, 'option_embed_textures')
         row.prop(self.properties, 'option_embed_textures')
+        row.enabled = self.properties.option_export_textures
 
 
         row = layout.row()
         row = layout.row()
         row.prop(self.properties, 'option_texture_folder')
         row.prop(self.properties, 'option_texture_folder')

+ 2 - 2
utils/exporters/blender/addons/io_three/constants.py

@@ -93,7 +93,7 @@ LIGHTS = 'lights'
 HIERARCHY = 'hierarchy'
 HIERARCHY = 'hierarchy'
 FACE_MATERIALS = 'faceMaterials'
 FACE_MATERIALS = 'faceMaterials'
 SKINNING = 'skinning'
 SKINNING = 'skinning'
-COPY_TEXTURES = 'copyTextures'
+EXPORT_TEXTURES = 'exportTextures'
 EMBED_TEXTURES = 'embedTextures'
 EMBED_TEXTURES = 'embedTextures'
 TEXTURE_FOLDER = 'textureFolder'
 TEXTURE_FOLDER = 'textureFolder'
 ENABLE_PRECISION = 'enablePrecision'
 ENABLE_PRECISION = 'enablePrecision'
@@ -154,7 +154,7 @@ EXPORT_OPTIONS = {
     CAMERAS: False,
     CAMERAS: False,
     LIGHTS: False,
     LIGHTS: False,
     HIERARCHY: False,
     HIERARCHY: False,
-    COPY_TEXTURES: True,
+    EXPORT_TEXTURES: True,
     EMBED_TEXTURES: False,
     EMBED_TEXTURES: False,
     TEXTURE_FOLDER: '',
     TEXTURE_FOLDER: '',
     LOGGING: DEBUG,
     LOGGING: DEBUG,

+ 1 - 1
utils/exporters/blender/addons/io_three/exporter/geometry.py

@@ -148,7 +148,7 @@ class Geometry(base_classes.BaseNode):
     def copy_textures(self, texture_folder=''):
     def copy_textures(self, texture_folder=''):
         """Copy the textures to the destination directory."""
         """Copy the textures to the destination directory."""
         logger.debug("Geometry().copy_textures()")
         logger.debug("Geometry().copy_textures()")
-        if self.options.get(constants.COPY_TEXTURES):
+        if self.options.get(constants.EXPORT_TEXTURES) and not self.options.get(constants.EMBED_TEXTURES):
             texture_registration = self.register_textures()
             texture_registration = self.register_textures()
             if texture_registration:
             if texture_registration:
                 logger.info("%s has registered textures", self.node)
                 logger.info("%s has registered textures", self.node)

+ 1 - 1
utils/exporters/blender/addons/io_three/exporter/scene.py

@@ -171,7 +171,7 @@ class Scene(base_classes.BaseScene):
 
 
         io.dump(self.filepath, data, options=self.options)
         io.dump(self.filepath, data, options=self.options)
 
 
-        if self.options.get(constants.COPY_TEXTURES):
+        if self.options.get(constants.EXPORT_TEXTURES) and not self.options.get(constants.EMBED_TEXTURES):
             texture_folder = self.options.get(constants.TEXTURE_FOLDER)
             texture_folder = self.options.get(constants.TEXTURE_FOLDER)
             for geo in self[constants.GEOMETRIES]:
             for geo in self[constants.GEOMETRIES]:
                 logger.info("Copying textures from %s", geo.node)
                 logger.info("Copying textures from %s", geo.node)