Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2012-07-03 13:01:43 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2012-07-03 13:01:43 +0400
commit2dc06f6d50d14a97ff0c37f88b6979d18a0fd279 (patch)
tree60728ddc2bb420bcf11901e27a11a677276cb889 /io_scene_3ds
parent842985a49773634076d45f845957216006fc683e (diff)
Style edit (mostly), use """ for docstrings (not ''').
Diffstat (limited to 'io_scene_3ds')
-rw-r--r--io_scene_3ds/__init__.py4
-rw-r--r--io_scene_3ds/export_3ds.py88
-rw-r--r--io_scene_3ds/import_3ds.py4
3 files changed, 48 insertions, 48 deletions
diff --git a/io_scene_3ds/__init__.py b/io_scene_3ds/__init__.py
index 9ac41168..aba53bdd 100644
--- a/io_scene_3ds/__init__.py
+++ b/io_scene_3ds/__init__.py
@@ -50,7 +50,7 @@ from bpy_extras.io_utils import (ImportHelper,
class Import3DS(bpy.types.Operator, ImportHelper):
- '''Import from 3DS file format (.3ds)'''
+ """Import from 3DS file format (.3ds)"""
bl_idname = "import_scene.autodesk_3ds"
bl_label = 'Import 3DS'
bl_options = {'UNDO'}
@@ -120,7 +120,7 @@ class Import3DS(bpy.types.Operator, ImportHelper):
class Export3DS(bpy.types.Operator, ExportHelper):
- '''Export to 3DS file format (.3ds)'''
+ """Export to 3DS file format (.3ds)"""
bl_idname = "export_scene.autodesk_3ds"
bl_label = 'Export 3DS'
diff --git a/io_scene_3ds/export_3ds.py b/io_scene_3ds/export_3ds.py
index 40fdeda3..1856659b 100644
--- a/io_scene_3ds/export_3ds.py
+++ b/io_scene_3ds/export_3ds.py
@@ -135,8 +135,8 @@ SZ_FLOAT = 4
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***'''
+ """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", )
def __init__(self, val=0):
@@ -153,7 +153,7 @@ class _3ds_ushort(object):
class _3ds_uint(object):
- '''Class representing an int (4-byte integer) for a 3ds file.'''
+ """Class representing an int (4-byte integer) for a 3ds file."""
__slots__ = ("value", )
def __init__(self, val):
@@ -170,7 +170,7 @@ class _3ds_uint(object):
class _3ds_float(object):
- '''Class representing a 4-byte IEEE floating point number for a 3ds file.'''
+ """Class representing a 4-byte IEEE floating point number for a 3ds file."""
__slots__ = ("value", )
def __init__(self, val):
@@ -187,7 +187,7 @@ class _3ds_float(object):
class _3ds_string(object):
- '''Class representing a zero-terminated string for a 3ds file.'''
+ """Class representing a zero-terminated string for a 3ds file."""
__slots__ = ("value", )
def __init__(self, val):
@@ -206,7 +206,7 @@ class _3ds_string(object):
class _3ds_point_3d(object):
- '''Class representing a three-dimensional point for a 3ds file.'''
+ """Class representing a three-dimensional point for a 3ds file."""
__slots__ = "x", "y", "z"
def __init__(self, point):
@@ -224,7 +224,7 @@ class _3ds_point_3d(object):
# Used for writing a track
"""
class _3ds_point_4d(object):
- '''Class representing a four-dimensional point for a 3ds file, for instance a quaternion.'''
+ """Class representing a four-dimensional point for a 3ds file, for instance a quaternion."""
__slots__ = "x","y","z","w"
def __init__(self, point=(0.0,0.0,0.0,0.0)):
self.x, self.y, self.z, self.w = point
@@ -242,7 +242,7 @@ class _3ds_point_4d(object):
class _3ds_point_uv(object):
- '''Class representing a UV-coordinate for a 3ds file.'''
+ """Class representing a UV-coordinate for a 3ds file."""
__slots__ = ("uv", )
def __init__(self, point):
@@ -260,7 +260,7 @@ class _3ds_point_uv(object):
class _3ds_rgb_color(object):
- '''Class representing a (24-bit) rgb color for a 3ds file.'''
+ """Class representing a (24-bit) rgb color for a 3ds file."""
__slots__ = "r", "g", "b"
def __init__(self, col):
@@ -277,7 +277,7 @@ class _3ds_rgb_color(object):
class _3ds_face(object):
- '''Class representing a face for a 3ds file.'''
+ """Class representing a face for a 3ds file."""
__slots__ = ("vindex", )
def __init__(self, vindex):
@@ -298,10 +298,10 @@ class _3ds_face(object):
class _3ds_array(object):
- '''Class representing an array of variables for a 3ds file.
+ """Class representing an array of variables for a 3ds file.
Consists of a _3ds_ushort to indicate the number of items, followed by the items themselves.
- '''
+ """
__slots__ = "values", "size"
def __init__(self):
@@ -331,7 +331,7 @@ class _3ds_array(object):
class _3ds_named_variable(object):
- '''Convenience class for named variables.'''
+ """Convenience class for named variables."""
__slots__ = "value", "name"
@@ -359,10 +359,10 @@ class _3ds_named_variable(object):
#the chunk class
class _3ds_chunk(object):
- '''Class representing a chunk in a 3ds file.
+ """Class representing a chunk in a 3ds file.
Chunks contain zero or more variables, followed by zero or more subchunks.
- '''
+ """
__slots__ = "ID", "size", "variables", "subchunks"
def __init__(self, chunk_id=0):
@@ -372,19 +372,19 @@ class _3ds_chunk(object):
self.subchunks = []
def add_variable(self, name, var):
- '''Add a named variable.
+ """Add a named variable.
- The name is mostly for debugging purposes.'''
+ The name is mostly for debugging purposes."""
self.variables.append(_3ds_named_variable(name, var))
def add_subchunk(self, chunk):
- '''Add a subchunk.'''
+ """Add a subchunk."""
self.subchunks.append(chunk)
def get_size(self):
- '''Calculate the size of the chunk and return it.
+ """Calculate the size of the chunk and return it.
- The sizes of the variables and subchunks are used to determine this chunk\'s size.'''
+ The sizes of the variables and subchunks are used to determine this chunk\'s size."""
tmpsize = self.ID.get_size() + self.size.get_size()
for variable in self.variables:
tmpsize += variable.get_size()
@@ -407,9 +407,9 @@ class _3ds_chunk(object):
return True
def write(self, file):
- '''Write the chunk to a file.
+ """Write the chunk to a file.
- Uses the write function of the variables and the subchunks to do the actual work.'''
+ Uses the write function of the variables and the subchunks to do the actual work."""
#write header
self.ID.write(file)
self.size.write(file)
@@ -419,10 +419,10 @@ class _3ds_chunk(object):
subchunk.write(file)
def dump(self, indent=0):
- '''Write the chunk to a file.
+ """Write the chunk to a file.
Dump is used for debugging purposes, to dump the contents of a chunk to the standard output.
- Uses the dump function of the named variables and the subchunks to do the actual work.'''
+ Uses the dump function of the named variables and the subchunks to do the actual work."""
print(indent * " ",
"ID=%r" % hex(self.ID.value),
"size=%r" % self.get_size())
@@ -453,9 +453,9 @@ def get_material_image_texslots(material):
def make_material_subchunk(chunk_id, color):
- '''Make a material subchunk.
+ """Make a material subchunk.
- Used for color subchunks, such as diffuse color or ambient color subchunks.'''
+ Used for color subchunks, such as diffuse color or ambient color subchunks."""
mat_sub = _3ds_chunk(chunk_id)
col1 = _3ds_chunk(RGB1)
col1.add_variable("color1", _3ds_rgb_color(color))
@@ -540,7 +540,7 @@ def make_material_texture_chunk(chunk_id, texslots, tess_uv_image=None):
def make_material_chunk(material, image):
- '''Make a material chunk out of a blender material.'''
+ """Make a material chunk out of a blender material."""
material_chunk = _3ds_chunk(MATERIAL)
name = _3ds_chunk(MATNAME)
@@ -601,9 +601,9 @@ def make_material_chunk(material, image):
class tri_wrapper(object):
- '''Class representing a triangle.
+ """Class representing a triangle.
- Used when converting faces to triangles'''
+ Used when converting faces to triangles"""
__slots__ = "vertex_index", "mat", "image", "faceuvs", "offset"
@@ -616,9 +616,9 @@ class tri_wrapper(object):
def extract_triangles(mesh):
- '''Extract triangles from a mesh.
+ """Extract triangles from a mesh.
- If the mesh contains quads, they will be split into triangles.'''
+ If the mesh contains quads, they will be split into triangles."""
tri_list = []
do_uv = bool(mesh.tessface_uv_textures)
@@ -656,11 +656,11 @@ def extract_triangles(mesh):
def remove_face_uv(verts, tri_list):
- '''Remove face UV coordinates from a list of triangles.
+ """Remove face UV coordinates from a list of triangles.
Since 3ds files only support one pair of uv coordinates for each vertex, face uv coordinates
need to be converted to vertex uv coordinates. That means that vertices need to be duplicated when
- there are multiple uv coordinates per vertex.'''
+ there are multiple uv coordinates per vertex."""
# initialize a list of UniqueLists, one per vertex:
#uv_list = [UniqueList() for i in xrange(len(verts))]
@@ -722,9 +722,9 @@ def remove_face_uv(verts, tri_list):
def make_faces_chunk(tri_list, mesh, materialDict):
- '''Make a chunk for the faces.
+ """Make a chunk for the faces.
- Also adds subchunks assigning materials to all faces.'''
+ Also adds subchunks assigning materials to all faces."""
materials = mesh.materials
if not materials:
@@ -793,14 +793,14 @@ def make_faces_chunk(tri_list, mesh, materialDict):
def make_vert_chunk(vert_array):
- '''Make a vertex chunk out of an array of vertices.'''
+ """Make a vertex chunk out of an array of vertices."""
vert_chunk = _3ds_chunk(OBJECT_VERTICES)
vert_chunk.add_variable("vertices", vert_array)
return vert_chunk
def make_uv_chunk(uv_array):
- '''Make a UV chunk out of an array of UVs.'''
+ """Make a UV chunk out of an array of UVs."""
uv_chunk = _3ds_chunk(OBJECT_UV)
uv_chunk.add_variable("uv coords", uv_array)
return uv_chunk
@@ -815,7 +815,7 @@ def make_matrix_4x3_chunk(matrix):
def make_mesh_chunk(mesh, matrix, materialDict):
- '''Make a chunk out of a Blender mesh.'''
+ """Make a chunk out of a Blender mesh."""
# Extract the triangles from the mesh:
tri_list = extract_triangles(mesh)
@@ -857,7 +857,7 @@ def make_mesh_chunk(mesh, matrix, materialDict):
""" # COMMENTED OUT FOR 2.42 RELEASE!! CRASHES 3DS MAX
def make_kfdata(start=0, stop=0, curtime=0):
- '''Make the basic keyframe data chunk'''
+ """Make the basic keyframe data chunk"""
kfdata = _3ds_chunk(KFDATA)
kfhdr = _3ds_chunk(KFDATA_KFHDR)
@@ -882,9 +882,9 @@ def make_kfdata(start=0, stop=0, curtime=0):
"""
def make_track_chunk(ID, obj):
- '''Make a chunk for track data.
+ """Make a chunk for track data.
- Depending on the ID, this will construct a position, rotation or scale track.'''
+ 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_ushort())
track_chunk.add_variable("unknown", _3ds_uint())
@@ -922,10 +922,10 @@ def make_track_chunk(ID, obj):
"""
def make_kf_obj_node(obj, name_to_id):
- '''Make a node chunk for a Blender object.
+ """Make a node chunk for a Blender object.
Takes the Blender object as a parameter. Object id's are taken from the dictionary name_to_id.
- Blender Empty objects are converted to dummy nodes.'''
+ Blender Empty objects are converted to dummy nodes."""
name = obj.name
# main object node chunk:
@@ -995,7 +995,7 @@ def save(operator,
import time
from bpy_extras.io_utils import create_derived_objects, free_derived_objects
- '''Save the Blender scene to a 3ds file.'''
+ """Save the Blender scene to a 3ds file."""
# Time the export
time1 = time.clock()
diff --git a/io_scene_3ds/import_3ds.py b/io_scene_3ds/import_3ds.py
index 77fdcf70..09dddb52 100644
--- a/io_scene_3ds/import_3ds.py
+++ b/io_scene_3ds/import_3ds.py
@@ -608,9 +608,9 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
# print 'Found an OBJECT_MESH chunk'
pass
elif new_chunk.ID == OBJECT_VERTICES:
- '''
+ """
Worldspace vertex locations
- '''
+ """
# print 'elif new_chunk.ID == OBJECT_VERTICES:'
temp_data = file.read(STRUCT_SIZE_UNSIGNED_SHORT)
num_verts = struct.unpack('<H', temp_data)[0]