[Bf-extensions-cvs] [f476cfd] master: Archimesh: Cleanup - Replace generic import

Antonioya noreply at git.blender.org
Tue Aug 9 18:23:47 CEST 2016


Commit: f476cfdd3149e75d7ee40887230339b927d52da9
Author: Antonioya
Date:   Tue Aug 9 13:45:46 2016 +0200
Branches: master
https://developer.blender.org/rBAf476cfdd3149e75d7ee40887230339b927d52da9

Archimesh: Cleanup - Replace generic import

Replace generic import by the list of used functions or types

===================================================================

M	archimesh/__init__.py
M	archimesh/achm_books_maker.py
M	archimesh/achm_column_maker.py
M	archimesh/achm_curtain_maker.py
M	archimesh/achm_door_maker.py
M	archimesh/achm_gltools.py
M	archimesh/achm_kitchen_maker.py
M	archimesh/achm_lamp_maker.py
M	archimesh/achm_main_panel.py
M	archimesh/achm_roof_maker.py
M	archimesh/achm_room_maker.py
M	archimesh/achm_shelves_maker.py
M	archimesh/achm_stairs_maker.py
M	archimesh/achm_tools.py
M	archimesh/achm_venetian_maker.py
M	archimesh/achm_window_maker.py
M	archimesh/achm_window_panel.py

===================================================================

diff --git a/archimesh/__init__.py b/archimesh/__init__.py
index 2104760..33118f8 100644
--- a/archimesh/__init__.py
+++ b/archimesh/__init__.py
@@ -80,14 +80,16 @@ else:
 # noinspection PyUnresolvedReferences
 import bpy
 # noinspection PyUnresolvedReferences
-from bpy.props import *
+from bpy.props import BoolProperty, FloatVectorProperty, IntProperty, FloatProperty
+# noinspection PyUnresolvedReferences
+from bpy.types import Menu, Scene, INFO_MT_mesh_add, WindowManager
 
 # ----------------------------------------------------------
 # Decoration assets
 # ----------------------------------------------------------
 
 
-class AchmInfoMtMeshDecorationAdd(bpy.types.Menu):
+class AchmInfoMtMeshDecorationAdd(Menu):
     bl_idname = "INFO_MT_mesh_decoration_add"
     bl_label = "Decoration assets"
 
@@ -104,7 +106,7 @@ class AchmInfoMtMeshDecorationAdd(bpy.types.Menu):
 # ----------------------------------------------------------
 
 
-class AchmInfoMtMeshCustomMenuAdd(bpy.types.Menu):
+class AchmInfoMtMeshCustomMenuAdd(Menu):
     bl_idname = "INFO_MT_mesh_custom_menu_add"
     bl_label = "Archimesh"
 
@@ -162,32 +164,32 @@ def register():
     bpy.utils.register_class(achm_main_panel.AchmRunHintDisplayButton)
     bpy.utils.register_class(achm_window_panel.AchmWinPanel)
     bpy.utils.register_class(achm_window_panel.AchmWindowEditPanel)
-    bpy.types.INFO_MT_mesh_add.append(AchmMenu_func)
+    INFO_MT_mesh_add.append(AchmMenu_func)
 
     # Define properties
-    bpy.types.Scene.archimesh_select_only = bpy.props.BoolProperty(
+    Scene.archimesh_select_only = BoolProperty(
             name="Only selected",
             description="Apply auto holes only to selected objects",
             default=False,
             )
-    bpy.types.Scene.archimesh_ceiling = bpy.props.BoolProperty(
+    Scene.archimesh_ceiling = BoolProperty(
             name="Ceiling",
             description="Create a ceiling",
             default=False,
             )
-    bpy.types.Scene.archimesh_floor = bpy.props.BoolProperty(
+    Scene.archimesh_floor = BoolProperty(
             name="Floor",
             description="Create a floor automatically",
             default=False,
             )
 
-    bpy.types.Scene.archimesh_merge = bpy.props.BoolProperty(
+    Scene.archimesh_merge = BoolProperty(
             name="Close walls",
             description="Close walls to create a full closed room",
             default=False,
             )
 
-    bpy.types.Scene.archimesh_text_color = bpy.props.FloatVectorProperty(
+    Scene.archimesh_text_color = FloatVectorProperty(
             name="Hint color",
             description="Color for the text and lines",
             default=(0.173, 0.545, 1.0, 1.0),
@@ -196,7 +198,7 @@ def register():
             subtype='COLOR',
             size=4,
             )
-    bpy.types.Scene.archimesh_walltext_color = bpy.props.FloatVectorProperty(
+    Scene.archimesh_walltext_color = FloatVectorProperty(
             name="Hint color",
             description="Color for the wall label",
             default=(1, 0.8, 0.1, 1.0),
@@ -205,32 +207,32 @@ def register():
             subtype='COLOR',
             size=4,
             )
-    bpy.types.Scene.archimesh_font_size = bpy.props.IntProperty(
+    Scene.archimesh_font_size = IntProperty(
             name="Text Size",
             description="Text size for hints",
             default=14, min=10, max=150,
             )
-    bpy.types.Scene.archimesh_wfont_size = bpy.props.IntProperty(
+    Scene.archimesh_wfont_size = IntProperty(
             name="Text Size",
             description="Text size for wall labels",
             default=16, min=10, max=150,
             )
-    bpy.types.Scene.archimesh_hint_space = bpy.props.FloatProperty(
+    Scene.archimesh_hint_space = FloatProperty(
             name='Separation', min=0, max=5, default=0.1,
             precision=2,
             description='Distance from object to display hint',
             )
-    bpy.types.Scene.archimesh_gl_measure = bpy.props.BoolProperty(
+    Scene.archimesh_gl_measure = BoolProperty(
             name="Measures",
             description="Display measures",
             default=True,
             )
-    bpy.types.Scene.archimesh_gl_name = bpy.props.BoolProperty(
+    Scene.archimesh_gl_name = BoolProperty(
             name="Names",
             description="Display names",
             default=True,
             )
-    bpy.types.Scene.archimesh_gl_ghost = bpy.props.BoolProperty(
+    Scene.archimesh_gl_ghost = BoolProperty(
             name="All",
             description="Display measures for all objects,"
             " not only selected",
@@ -238,9 +240,9 @@ def register():
             )
 
     # OpenGL flag
-    wm = bpy.types.WindowManager
+    wm = WindowManager
     # register internal property
-    wm.archimesh_run_opengl = bpy.props.BoolProperty(default=False)
+    wm.archimesh_run_opengl = BoolProperty(default=False)
 
 
 def unregister():
@@ -272,21 +274,21 @@ def unregister():
     bpy.utils.unregister_class(achm_main_panel.AchmRunHintDisplayButton)
     bpy.utils.unregister_class(achm_window_panel.AchmWinPanel)
     bpy.utils.unregister_class(achm_window_panel.AchmWindowEditPanel)
-    bpy.types.INFO_MT_mesh_add.remove(AchmMenu_func)
+    INFO_MT_mesh_add.remove(AchmMenu_func)
 
     # Remove properties
-    del bpy.types.Scene.archimesh_select_only
-    del bpy.types.Scene.archimesh_ceiling
-    del bpy.types.Scene.archimesh_floor
-    del bpy.types.Scene.archimesh_merge
-    del bpy.types.Scene.archimesh_text_color
-    del bpy.types.Scene.archimesh_walltext_color
-    del bpy.types.Scene.archimesh_font_size
-    del bpy.types.Scene.archimesh_wfont_size
-    del bpy.types.Scene.archimesh_hint_space
-    del bpy.types.Scene.archimesh_gl_measure
-    del bpy.types.Scene.archimesh_gl_name
-    del bpy.types.Scene.archimesh_gl_ghost
+    del Scene.archimesh_select_only
+    del Scene.archimesh_ceiling
+    del Scene.archimesh_floor
+    del Scene.archimesh_merge
+    del Scene.archimesh_text_color
+    del Scene.archimesh_walltext_color
+    del Scene.archimesh_font_size
+    del Scene.archimesh_wfont_size
+    del Scene.archimesh_hint_space
+    del Scene.archimesh_gl_measure
+    del Scene.archimesh_gl_name
+    del Scene.archimesh_gl_ghost
     # remove OpenGL data
     achm_main_panel.AchmRunHintDisplayButton.handle_remove(achm_main_panel.AchmRunHintDisplayButton, bpy.context)
     wm = bpy.context.window_manager
diff --git a/archimesh/achm_books_maker.py b/archimesh/achm_books_maker.py
index 0d9c34e..e8d9fce 100644
--- a/archimesh/achm_books_maker.py
+++ b/archimesh/achm_books_maker.py
@@ -25,10 +25,12 @@
 # ----------------------------------------------------------
 # noinspection PyUnresolvedReferences
 import bpy
-import math
-import random
-import copy
-import colorsys
+from math import cos, sin, radians
+from random import randint
+from copy import copy
+from colorsys import rgb_to_hsv, hsv_to_rgb
+from bpy.types import Operator
+from bpy.props import BoolProperty, IntProperty, FloatProperty, FloatVectorProperty
 from .achm_tools import *
 
 
@@ -36,59 +38,59 @@ from .achm_tools import *
 # Define UI class
 # Books
 # ------------------------------------------------------------------
-class AchmBooks(bpy.types.Operator):
+class AchmBooks(Operator):
     bl_idname = "mesh.archimesh_books"
     bl_label = "Books"
     bl_description = "Books Generator"
     bl_category = 'Archimesh'
     bl_options = {'REGISTER', 'UNDO'}
 
-    width = bpy.props.FloatProperty(
+    width = FloatProperty(
             name='Width', min=0.001, max=1, default=0.045, precision=3,
             description='Bounding book width',
             )
-    depth = bpy.props.FloatProperty(
+    depth = FloatProperty(
             name='Depth', min=0.001, max=1, default=0.22, precision=3,
             description='Bounding book depth',
             )
-    height = bpy.props.FloatProperty(
+    height = FloatProperty(
             name='Height', min=0.001, max=1, default=0.30, precision=3,
             description='Bounding book height',
             )
-    num = bpy.props.IntProperty(
+    num = IntProperty(
             name='Number of books', min=1, max=100, default=20,
             description='Number total of books',
             )
 
-    rX = bpy.props.FloatProperty(
+    rX = FloatProperty(
             name='X', min=0.000, max=0.999, default=0, precision=3,
             description='Randomness for X axis',
             )
-    rY = bpy.props.FloatProperty(
+    rY = FloatProperty(
             name='Y', min=0.000, max=0.999, default=0, precision=3,
             description='Randomness for Y axis',
             )
-    rZ = bpy.props.FloatProperty(
+    rZ = FloatProperty(
             name='Z', min=0.000, max=0.999, default=0, precision=3,
             description='Randomness for Z axis',
             )
 
-    rot = bpy.props.FloatProperty(
+    rot = FloatProperty(
             name='Rotation', min=0.000, max=1, default=0, precision=3,
             description='Randomness for vertical position (0-> All straight)',
             )
-    afn = bpy.props.IntProperty(
+    afn = IntProperty(
             name='Affinity', min=0, max=10, default=5,
             description='Number of books with same rotation angle',
             )
 
     # Materials
-    crt_mat = bpy.props.BoolProperty(
+    crt_mat = BoolProperty(
             name="Create default Cycles materials",
             description="Create default materials for Cycles render",
             default=True,
             )
-    objcol = bpy.props.FloatVectorProperty(
+    objcol = FloatVectorProperty(
             name="Color",
             description="Color for material",
             default=(1.0, 1.0, 1.0, 1.0),
@@ -96,7 +98,7 @@ class AchmBooks(bpy.types.Operator):
             subtype='COLOR',
             size=4,
             )
-    rC = bpy.props.FloatProperty(
+    rC = FloatProperty(
             name='Randomness',
             min=0.000, max=1, default=0, precision=3,
             description='Randomness for color ',
@@ -181,7 +183,7 @@ def create_book_mesh(self):
 def generate_books(self):
     boxes = []
     location = bpy.context.scene.cursor_

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list