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:
-rw-r--r--io_import_gimp_image_to_scene.py78
-rw-r--r--io_import_images_as_planes.py34
-rw-r--r--io_mesh_ply/__init__.py7
-rw-r--r--io_mesh_ply/export_ply.py3
-rw-r--r--io_mesh_raw/__init__.py10
-rw-r--r--io_mesh_raw/export_raw.py8
-rw-r--r--io_mesh_raw/import_raw.py6
7 files changed, 75 insertions, 71 deletions
diff --git a/io_import_gimp_image_to_scene.py b/io_import_gimp_image_to_scene.py
index 1fd98b28..5439713c 100644
--- a/io_import_gimp_image_to_scene.py
+++ b/io_import_gimp_image_to_scene.py
@@ -25,19 +25,19 @@ bl_info = {
"location": "File > Import > GIMP Image to Scene(.xcf/.xjt)",
"description": "Imports GIMP multilayer image files as a series of multiple planes",
"warning": "XCF import requires xcftools installed",
- "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"\
- "Scripts/Import-Export/GIMPImageToScene",
- "tracker_url": "http://projects.blender.org/tracker/index.php?"\
- "func=detail&aid=25136",
+ "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"
+ "Scripts/Import-Export/GIMPImageToScene",
+ "tracker_url": "http://projects.blender.org/tracker/index.php?"
+ "func=detail&aid=25136",
"category": "Import-Export"}
"""
This script imports GIMP layered image files into 3D Scenes (.xcf, .xjt)
"""
-def main(File, Path, LayerViewers, MixerViewers, LayerOffset,\
- LayerScale, OpacityMode, PremulAlpha, ShadelessMats,\
- SetCamera, SetupCompo, GroupUntagged, Ext):
+def main(File, Path, LayerViewers, MixerViewers, LayerOffset,
+ LayerScale, OpacityMode, PremulAlpha, ShadelessMats,
+ SetCamera, SetupCompo, GroupUntagged, Ext):
#-------------------------------------------------
@@ -147,8 +147,8 @@ def main(File, Path, LayerViewers, MixerViewers, LayerOffset,\
os.rename(PathSaveRaw+imageFile, PathSaveRaw+NameShort+'.jpg')
if HasAlpha: os.rename(PathSaveRaw+imageFileAlpha, PathSaveRaw+NameShort+'_A'+'.jpg')
- IMGs.append({'LayerMode':md, 'LayerOpacity':op,\
- 'LayerName':n, 'LayerNameShort':NameShort,\
+ IMGs.append({'LayerMode':md, 'LayerOpacity':op,
+ 'LayerName':n, 'LayerNameShort':NameShort,
'RenderLayer':RenderLayer, 'LayerCoords':[ow, oh, ox, oy], 'HasAlpha':HasAlpha})
else: # Ext == '.xcf':
@@ -194,14 +194,14 @@ def main(File, Path, LayerViewers, MixerViewers, LayerOffset,\
Mode = LineThree[:Slash]
Opacity = float(LineThree[Slash+1:LineThree.find('%')])*.01
- IMGs.append ({\
- 'LayerMode':Mode,\
- 'LayerOpacity':Opacity,\
- 'LayerName':Line[4].rstrip(),\
- 'LayerNameShort':NameShort,\
- 'LayerCoords':list(map(int, Line[1].replace('x', ' ').replace('+', ' +').replace('-', ' -').split())),\
- 'RenderLayer':RenderLayer,\
- 'HasAlpha':True,\
+ IMGs.append ({
+ 'LayerMode': Mode,
+ 'LayerOpacity': Opacity,
+ 'LayerName': Line[4].rstrip(),
+ 'LayerNameShort': NameShort,
+ 'LayerCoords': list(map(int, Line[1].replace('x', ' ').replace('+', ' +').replace('-', ' -').split())),
+ 'RenderLayer': RenderLayer,
+ 'HasAlpha': True,
})
elif Line.startswith('Version'):
ResX, ResY = map (int, Line.split()[2].split('x'))
@@ -213,8 +213,8 @@ def main(File, Path, LayerViewers, MixerViewers, LayerOffset,\
else:
Opacity = ' --percent 100'
for Layer in IMGs:
- CMD = '%s -C %s%s -o %s%s.png "%s"%s' %\
- (XCF2PNG, Path, File, PathSave, Layer['LayerName'].replace(' ', '_'), Layer['LayerName'], Opacity)
+ CMD = ('%s -C %s%s -o %s%s.png "%s"%s' %
+ (XCF2PNG, Path, File, PathSave, Layer['LayerName'].replace(' ', '_'), Layer['LayerName'], Opacity))
os.system(CMD)
#-------------------------------------------------
@@ -286,13 +286,12 @@ def main(File, Path, LayerViewers, MixerViewers, LayerOffset,\
LayerList.append([RenderLayer, LayerMode, LayerOpacity])
LayerNum += 1
-
+
# Object
- bpy.ops.mesh.primitive_plane_add(\
- view_align=False,\
- enter_editmode=False,\
- rotation=(0, 0, pi))
-
+ bpy.ops.mesh.primitive_plane_add(view_align=False,
+ enter_editmode=False,
+ rotation=(0, 0, pi))
+
bpy.ops.object.transform_apply(location=False, rotation=True, scale=False)
@@ -301,8 +300,8 @@ def main(File, Path, LayerViewers, MixerViewers, LayerOffset,\
if SetupCompo:
Active.layers = LayerFlags[RenderLayer]
- Active.location = (\
- (float(Coords[2])-(ResX*0.5))*LayerScale,\
+ Active.location = (
+ (float(Coords[2])-(ResX*0.5))*LayerScale,
(-float(Coords[3])+(ResY*0.5))*LayerScale, Z)
for Vert in Active.data.vertices:
@@ -420,16 +419,15 @@ def main(File, Path, LayerViewers, MixerViewers, LayerOffset,\
LayerList = []
for Layer in IMGs:
- Make3DLayer(\
- Layer['LayerName'].replace(' ', '_'),\
- Layer['LayerNameShort'].replace(' ', '_'),\
- Z,\
- Layer['LayerCoords'],\
- Layer['RenderLayer'],\
- Layer['LayerMode'],\
- Layer['LayerOpacity'],\
- Layer['HasAlpha'],\
- )
+ Make3DLayer(Layer['LayerName'].replace(' ', '_'),
+ Layer['LayerNameShort'].replace(' ', '_'),
+ Z,
+ Layer['LayerCoords'],
+ Layer['RenderLayer'],
+ Layer['LayerMode'],
+ Layer['LayerOpacity'],
+ Layer['HasAlpha'],
+ )
Z -= LayerOffset
@@ -647,9 +645,9 @@ class GIMPImageToScene(bpy.types.Operator):
# Call Main Function
if Ext:
- main(filename, directory, LayerViewers, MixerViewers, LayerOffset,\
- LayerScale, OpacityMode, PremulAlpha, ShadelessMats,\
- SetCamera, SetupCompo, GroupUntagged, Ext)
+ main(filename, directory, LayerViewers, MixerViewers, LayerOffset,
+ LayerScale, OpacityMode, PremulAlpha, ShadelessMats,
+ SetCamera, SetupCompo, GroupUntagged, Ext)
else:
self.report({'ERROR'},"Selected file wasn't valid, try .xcf or .xjt")
diff --git a/io_import_images_as_planes.py b/io_import_images_as_planes.py
index 1c3989e3..d62dddfc 100644
--- a/io_import_images_as_planes.py
+++ b/io_import_images_as_planes.py
@@ -23,17 +23,25 @@ bl_info = {
"blender": (2, 5, 7),
"api": 35622,
"location": "File > Import > Images as Planes",
- "description": "Imports images and creates planes with the appropriate aspect ratio. "\
- "The images are mapped to the planes.",
+ "description": "Imports images and creates planes with the appropriate "
+ "aspect ratio. The images are mapped to the planes.",
"warning": "",
- "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"\
- "Scripts/Add_Mesh/Planes_from_Images",
- "tracker_url": "https://projects.blender.org/tracker/index.php?"\
- "func=detail&aid=21751",
+ "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"
+ "Scripts/Add_Mesh/Planes_from_Images",
+ "tracker_url": "https://projects.blender.org/tracker/index.php?"
+ "func=detail&aid=21751",
"category": "Import-Export"}
-import bpy, os, mathutils
-from bpy.props import *
+import bpy
+import mathutils
+import os
+
+from bpy.props import (BoolProperty,
+ EnumProperty,
+ IntProperty,
+ FloatProperty,
+ )
+
from add_utils import *
from bpy_extras.io_utils import ImportHelper
from bpy_extras.image_utils import load_image
@@ -54,7 +62,7 @@ EXT_LIST = {
'cin': ['cin'],
'dpx': ['dpx'],
'psd': ['psd']}
-EXT_VALS = [val for val in EXT_LIST.values()]
+EXT_VALS = list(EXT_LIST.values())
EXTENSIONS = []
for i in EXT_VALS:
EXTENSIONS.extend(i)
@@ -189,12 +197,12 @@ def align_planes(self, planes):
gap = self.align_offset
offset = 0
for i, plane in enumerate(planes):
- offset += (plane.dimensions.x / 2) + gap
+ offset += (plane.dimensions.x / 2.0) + gap
if i == 0: continue
move_local = mathutils.Vector((offset, 0, 0))
move_world = plane.location + move_local * plane.matrix_world.inverted()
plane.location += move_world
- offset += (plane.dimensions.x / 2)
+ offset += (plane.dimensions.x / 2.0)
##### MAIN #####
def import_images(self, context):
@@ -363,7 +371,9 @@ class IMPORT_OT_image_to_plane(bpy.types.Operator, ImportHelper, AddObjectHelper
##### REGISTER #####
def import_images_button(self, context):
- self.layout.operator(IMPORT_OT_image_to_plane.bl_idname, text="Images as Planes", icon='PLUGIN')
+ self.layout.operator(IMPORT_OT_image_to_plane.bl_idname,
+ text="Images as Planes",
+ icon='PLUGIN')
def register():
bpy.utils.register_module(__name__)
diff --git a/io_mesh_ply/__init__.py b/io_mesh_ply/__init__.py
index 26d701a1..7ef22e59 100644
--- a/io_mesh_ply/__init__.py
+++ b/io_mesh_ply/__init__.py
@@ -26,12 +26,15 @@ bl_info = {
"location": "File > Import-Export",
"description": "Import-Export PLY mesh data withs UV's and vertex colors",
"warning": "",
- "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"\
- "Scripts/Import-Export/Stanford_PLY",
+ "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"
+ "Scripts/Import-Export/Stanford_PLY",
"tracker_url": "",
"support": 'OFFICIAL',
"category": "Import-Export"}
+# Copyright (C) 2004, 2005: Bruce Merry, bmerry@cs.uct.ac.za
+# Contributors: Bruce Merry, Campbell Barton
+
# To support reload properly, try to access a package var,
# if it's there, reload everything
if "bpy" in locals():
diff --git a/io_mesh_ply/export_ply.py b/io_mesh_ply/export_ply.py
index 84d9a45c..89eade75 100644
--- a/io_mesh_ply/export_ply.py
+++ b/io_mesh_ply/export_ply.py
@@ -18,9 +18,6 @@
# <pep8-80 compliant>
-# Copyright (C) 2004, 2005: Bruce Merry, bmerry@cs.uct.ac.za
-# Contributors: Bruce Merry, Campbell Barton
-
"""
This script exports Stanford PLY files from Blender. It supports normals,
colours, and texture coordinates per face or per vertex.
diff --git a/io_mesh_raw/__init__.py b/io_mesh_raw/__init__.py
index f712a7a1..6c8f1e21 100644
--- a/io_mesh_raw/__init__.py
+++ b/io_mesh_raw/__init__.py
@@ -16,7 +16,7 @@
#
# ##### END GPL LICENSE BLOCK #####
-# <pep8 compliant>
+# <pep8-80 compliant>
bl_info = {
@@ -28,10 +28,10 @@ bl_info = {
"location": "File > Import-Export > Raw Faces (.raw) ",
"description": "Import-Export Raw Faces",
"warning": "",
- "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"\
- "Scripts/Import-Export/Raw_Mesh_IO",
- "tracker_url": "https://projects.blender.org/tracker/index.php?"\
- "func=detail&aid=25692",
+ "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"
+ "Scripts/Import-Export/Raw_Mesh_IO",
+ "tracker_url": "https://projects.blender.org/tracker/index.php?"
+ "func=detail&aid=25692",
"category": "Import-Export"}
if "bpy" in locals():
diff --git a/io_mesh_raw/export_raw.py b/io_mesh_raw/export_raw.py
index b44fbda2..d33cfbae 100644
--- a/io_mesh_raw/export_raw.py
+++ b/io_mesh_raw/export_raw.py
@@ -16,11 +16,9 @@
#
# ##### END GPL LICENSE BLOCK #####
-# <pep8 compliant>
+# <pep8-80 compliant>
-__author__ = ["Aurel Wildfellner"]
-__version__ = '0.2'
-__bpydoc__ = """\
+"""
This script exports a Mesh to a RAW triangle format file.
The raw triangle format is very simple; it has no verts or faces lists.
@@ -40,7 +38,7 @@ import bpy
def faceToTriangles(face):
triangles = []
- if (len(face) == 4):
+ if len(face) == 4:
triangles.append([face[0], face[1], face[2]])
triangles.append([face[2], face[3], face[0]])
else:
diff --git a/io_mesh_raw/import_raw.py b/io_mesh_raw/import_raw.py
index f17a41ee..e2cec4fa 100644
--- a/io_mesh_raw/import_raw.py
+++ b/io_mesh_raw/import_raw.py
@@ -16,11 +16,9 @@
#
# ##### END GPL LICENSE BLOCK #####
-# <pep8 compliant>
+# <pep8-80 compliant>
-__author__ = ["Anthony D'Agostino (Scorpius)", "Aurel Wildfellner"]
-__version__ = '0.2'
-__bpydoc__ = """\
+"""
This script imports Raw Triangle File format files to Blender.
The raw triangle format is very simple; it has no verts or faces lists.