diff --git a/io_scene_3ds/export_3ds.py b/io_scene_3ds/export_3ds.py index 714d419af49063fa31181357e68fcaaf92912b01..125e9a8b501b96c62fed20070a577906ea44156d 100644 --- a/io_scene_3ds/export_3ds.py +++ b/io_scene_3ds/export_3ds.py @@ -121,7 +121,7 @@ SZ_INT = 4 SZ_FLOAT = 4 -class _3ds_short(object): +class _3ds_ushort(object): '''Class representing a short (2-byte integer) for a 3ds file. *** This looks like an unsigned short H is unsigned from the struct docs - Cam***''' __slots__ = ("value", ) @@ -139,7 +139,7 @@ class _3ds_short(object): return str(self.value) -class _3ds_int(object): +class _3ds_uint(object): '''Class representing an int (4-byte integer) for a 3ds file.''' __slots__ = ("value", ) @@ -258,7 +258,6 @@ class _3ds_rgb_color(object): def write(self, file): file.write(struct.pack('<3B', int(255 * self.r), int(255 * self.g), int(255 * self.b))) -# file.write(struct.pack('<3c', chr(int(255*self.r)), chr(int(255*self.g)), chr(int(255*self.b)) ) ) def __str__(self): return '{%f, %f, %f}' % (self.r, self.g, self.b) @@ -285,7 +284,7 @@ class _3ds_face(object): class _3ds_array(object): '''Class representing an array of variables for a 3ds file. - Consists of a _3ds_short to indicate the number of items, followed by the items themselves. + Consists of a _3ds_ushort to indicate the number of items, followed by the items themselves. ''' __slots__ = "values", "size" @@ -302,8 +301,8 @@ class _3ds_array(object): return self.size def write(self, file): - _3ds_short(len(self.values)).write(file) - #_3ds_int(len(self.values)).write(file) + _3ds_ushort(len(self.values)).write(file) + #_3ds_uint(len(self.values)).write(file) for value in self.values: value.write(file) @@ -352,8 +351,8 @@ class _3ds_chunk(object): __slots__ = "ID", "size", "variables", "subchunks" def __init__(self, id=0): - self.ID = _3ds_short(id) - self.size = _3ds_int(0) + self.ID = _3ds_ushort(id) + self.size = _3ds_uint(0) self.variables = [] self.subchunks = [] @@ -649,8 +648,8 @@ def make_faces_chunk(tri_list, mesh, materialDict): context_mat_face_array = _3ds_array() unique_mats[mat, img] = _3ds_string(sane_name(name_str)), context_mat_face_array - context_mat_face_array.add(_3ds_short(i)) - # obj_material_faces[tri.mat].add(_3ds_short(i)) + context_mat_face_array.add(_3ds_ushort(i)) + # obj_material_faces[tri.mat].add(_3ds_ushort(i)) face_chunk.add_variable("faces", face_list) for mat_name, mat_faces in unique_mats.values(): @@ -672,7 +671,7 @@ def make_faces_chunk(tri_list, mesh, materialDict): for i, tri in enumerate(tri_list): face_list.add(_3ds_face(tri.vertex_index)) if (tri.mat < n_materials): - obj_material_faces[tri.mat].add(_3ds_short(i)) + obj_material_faces[tri.mat].add(_3ds_ushort(i)) face_chunk.add_variable("faces", face_list) for i in range(n_materials): @@ -712,8 +711,7 @@ def make_mesh_chunk(mesh, matrix, materialDict): # Extract the triangles from the mesh: tri_list = extract_triangles(mesh) - if len(mesh.uv_textures): -# if mesh.faceUV: + if mesh.uv_textures: # Remove the face UVs and convert it to vertex UV: vert_array, uv_array, tri_list = remove_face_uv(mesh.vertices, tri_list) else: @@ -722,13 +720,10 @@ def make_mesh_chunk(mesh, matrix, materialDict): for vert in mesh.vertices: vert_array.add(_3ds_point_3d(vert.co)) # If the mesh has vertex UVs, create an array of UVs: - if len(mesh.sticky): -# if mesh.vertexUV: + if mesh.sticky: uv_array = _3ds_array() for uv in mesh.sticky: -# for vert in mesh.vertices: uv_array.add(_3ds_point_uv(uv.co)) -# uv_array.add(_3ds_point_uv(vert.uvco)) else: # no UV at all: uv_array = None @@ -757,18 +752,18 @@ def make_kfdata(start=0, stop=0, curtime=0): kfdata = _3ds_chunk(KFDATA) kfhdr = _3ds_chunk(KFDATA_KFHDR) - kfhdr.add_variable("revision", _3ds_short(0)) + kfhdr.add_variable("revision", _3ds_ushort(0)) # Not really sure what filename is used for, but it seems it is usually used # to identify the program that generated the .3ds: kfhdr.add_variable("filename", _3ds_string("Blender")) - kfhdr.add_variable("animlen", _3ds_int(stop-start)) + kfhdr.add_variable("animlen", _3ds_uint(stop-start)) kfseg = _3ds_chunk(KFDATA_KFSEG) - kfseg.add_variable("start", _3ds_int(start)) - kfseg.add_variable("stop", _3ds_int(stop)) + kfseg.add_variable("start", _3ds_uint(start)) + kfseg.add_variable("stop", _3ds_uint(stop)) kfcurtime = _3ds_chunk(KFDATA_KFCURTIME) - kfcurtime.add_variable("curtime", _3ds_int(curtime)) + kfcurtime.add_variable("curtime", _3ds_uint(curtime)) kfdata.add_subchunk(kfhdr) kfdata.add_subchunk(kfseg) @@ -782,13 +777,13 @@ def make_track_chunk(ID, obj): Depending on the ID, this will construct a position, rotation or scale track.''' track_chunk = _3ds_chunk(ID) - track_chunk.add_variable("track_flags", _3ds_short()) - track_chunk.add_variable("unknown", _3ds_int()) - track_chunk.add_variable("unknown", _3ds_int()) - track_chunk.add_variable("nkeys", _3ds_int(1)) + track_chunk.add_variable("track_flags", _3ds_ushort()) + track_chunk.add_variable("unknown", _3ds_uint()) + track_chunk.add_variable("unknown", _3ds_uint()) + track_chunk.add_variable("nkeys", _3ds_uint(1)) # Next section should be repeated for every keyframe, but for now, animation is not actually supported. - track_chunk.add_variable("tcb_frame", _3ds_int(0)) - track_chunk.add_variable("tcb_flags", _3ds_short()) + track_chunk.add_variable("tcb_frame", _3ds_uint(0)) + track_chunk.add_variable("tcb_flags", _3ds_ushort()) if obj.type=='Empty': if ID==POS_TRACK_TAG: # position vector: @@ -829,7 +824,7 @@ def make_kf_obj_node(obj, name_to_id): # chunk for the object id: obj_id_chunk = _3ds_chunk(OBJECT_NODE_ID) # object id is from the name_to_id dictionary: - obj_id_chunk.add_variable("node_id", _3ds_short(name_to_id[name])) + obj_id_chunk.add_variable("node_id", _3ds_ushort(name_to_id[name])) # object node header: obj_node_header_chunk = _3ds_chunk(OBJECT_NODE_HDR) @@ -842,18 +837,18 @@ def make_kf_obj_node(obj, name_to_id): # Add the name: obj_node_header_chunk.add_variable("name", _3ds_string(sane_name(name))) # Add Flag variables (not sure what they do): - obj_node_header_chunk.add_variable("flags1", _3ds_short(0)) - obj_node_header_chunk.add_variable("flags2", _3ds_short(0)) + obj_node_header_chunk.add_variable("flags1", _3ds_ushort(0)) + obj_node_header_chunk.add_variable("flags2", _3ds_ushort(0)) # Check parent-child relationships: parent = obj.parent if (parent is None) or (parent.name not in name_to_id): # If no parent, or the parents name is not in the name_to_id dictionary, # parent id becomes -1: - obj_node_header_chunk.add_variable("parent", _3ds_short(-1)) + obj_node_header_chunk.add_variable("parent", _3ds_ushort(-1)) else: # Get the parent's id from the name_to_id dictionary: - obj_node_header_chunk.add_variable("parent", _3ds_short(name_to_id[parent.name])) + obj_node_header_chunk.add_variable("parent", _3ds_ushort(name_to_id[parent.name])) # Add pivot chunk: obj_pivot_chunk = _3ds_chunk(OBJECT_PIVOT) @@ -907,7 +902,7 @@ def save(operator, primary = _3ds_chunk(PRIMARY) # Add version chunk: version_chunk = _3ds_chunk(VERSION) - version_chunk.add_variable("version", _3ds_int(3)) + version_chunk.add_variable("version", _3ds_uint(3)) primary.add_subchunk(version_chunk) # init main object info chunk: diff --git a/io_scene_3ds/import_3ds.py b/io_scene_3ds/import_3ds.py index d8ecb12f0d4f92a021049c9b4fb8420f03b53660..a94c7092fd96a3773ce9730a3950fb66b067c7cc 100644 --- a/io_scene_3ds/import_3ds.py +++ b/io_scene_3ds/import_3ds.py @@ -311,7 +311,6 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH): bmesh.faces[fidx].material_index = mat_idx uf = uv_faces[fidx] uf.image = img - uf.use_image = True else: for fidx in faces: bmesh.faces[fidx].material_index = mat_idx diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py index 0290d12cbaccb301f393c8db32a9736e74df0a46..61f38009351119c3758166ab3d77625a5a95e599 100644 --- a/io_scene_fbx/__init__.py +++ b/io_scene_fbx/__init__.py @@ -41,7 +41,11 @@ if "bpy" in locals(): import bpy -from bpy.props import StringProperty, BoolProperty, FloatProperty, EnumProperty +from bpy.props import (StringProperty, + BoolProperty, + FloatProperty, + EnumProperty, + ) from bpy_extras.io_utils import (ExportHelper, path_reference_mode, diff --git a/io_scene_fbx/export_fbx.py b/io_scene_fbx/export_fbx.py index c5f3126807a6f7d594072e1fedf32916c73660e4..ef87b2e648cdee64cf69e49e32d46dafd98685a7 100644 --- a/io_scene_fbx/export_fbx.py +++ b/io_scene_fbx/export_fbx.py @@ -20,11 +20,6 @@ # Script copyright (C) Campbell Barton -""" -This script is an exporter to the FBX file format. - -http://wiki.blender.org/index.php/Scripts/Manual/Export/autodesk_fbx -""" import os import time diff --git a/io_scene_x3d/import_x3d.py b/io_scene_x3d/import_x3d.py index 7ae4bb091db5dbbd530d4e31a08cefe0fb9d3fd2..660d10227c3599e9c2d027071a83406f2c0ee761 100644 --- a/io_scene_x3d/import_x3d.py +++ b/io_scene_x3d/import_x3d.py @@ -2102,7 +2102,7 @@ def importShape(node, ancestry, global_matrix): if ima_url is None: print("\twarning, image with no URL, this is odd") else: - bpyima = image_utils.image_load(ima_url, os.path.dirname(node.getFilename()), place_holder=False, recursive=False, convert_callback=imageConvertCompat) + bpyima = image_utils.load_image(ima_url, os.path.dirname(node.getFilename()), place_holder=False, recursive=False, convert_callback=imageConvertCompat) if bpyima: texture = bpy.data.textures.new("XXX", 'IMAGE') texture.image = bpyima diff --git a/space_view3d_materials_utils.py b/space_view3d_materials_utils.py index a0e433167d4bb307a8ddd75ac91d0bddfe109f3b..c34b01d7b87b11173664b99ae07307f8cbfd63f6 100644 --- a/space_view3d_materials_utils.py +++ b/space_view3d_materials_utils.py @@ -222,9 +222,8 @@ def mat_to_texface(): #check that material had an image! if images[f.material_index] != None: uvtex[f.index].image = images[f.material_index] - uvtex[f.index].use_image = True else: - uvtex[f.index].use_image = False + uvtex[f.index].image = None me.update() diff --git a/texture_paint_layer_manager.py b/texture_paint_layer_manager.py index bb05cd907b3bcab2ffff757899f16a0406b44c5c..24b7b3ec6c39acba2f104ba25df0e9e7cd10f4e5 100644 --- a/texture_paint_layer_manager.py +++ b/texture_paint_layer_manager.py @@ -351,14 +351,12 @@ def main(context,tn): if f.material_index == m_id: uvtex[f.index].select_uv uvtex[f.index].image = img - uvtex[f.index].use_image = True else: for f in me.faces: if f.material_index == m_id: - uvtex[f.index].image = img - #uvtex[f.index].use_image = False + uvtex[f.index].image = None me.update()