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:
authorAntonioya <blendergit@gmail.com>2016-08-09 14:45:46 +0300
committerAntonioya <blendergit@gmail.com>2016-08-09 14:46:07 +0300
commitf476cfdd3149e75d7ee40887230339b927d52da9 (patch)
tree80efa8209a2dd2397302ea2dd912750e7d9899e0 /archimesh
parent5828ecf0deca616fbc14cc48d94a9cbe15fd58fb (diff)
Archimesh: Cleanup - Replace generic import
Replace generic import by the list of used functions or types
Diffstat (limited to 'archimesh')
-rw-r--r--archimesh/__init__.py64
-rw-r--r--archimesh/achm_books_maker.py64
-rw-r--r--archimesh/achm_column_maker.py52
-rw-r--r--archimesh/achm_curtain_maker.py24
-rw-r--r--archimesh/achm_door_maker.py41
-rw-r--r--archimesh/achm_gltools.py48
-rw-r--r--archimesh/achm_kitchen_maker.py132
-rw-r--r--archimesh/achm_lamp_maker.py100
-rw-r--r--archimesh/achm_main_panel.py13
-rw-r--r--archimesh/achm_roof_maker.py22
-rw-r--r--archimesh/achm_room_maker.py121
-rw-r--r--archimesh/achm_shelves_maker.py78
-rw-r--r--archimesh/achm_stairs_maker.py50
-rw-r--r--archimesh/achm_tools.py4
-rw-r--r--archimesh/achm_venetian_maker.py133
-rw-r--r--archimesh/achm_window_maker.py69
-rw-r--r--archimesh/achm_window_panel.py310
17 files changed, 673 insertions, 652 deletions
diff --git a/archimesh/__init__.py b/archimesh/__init__.py
index 2104760f..33118f87 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 0d9c34eb..e8d9fcef 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_location
- myloc = copy.copy(location) # copy location to keep 3D cursor position
+ myloc = copy(location) # copy location to keep 3D cursor position
# Create
lastx = myloc.x
@@ -214,7 +216,7 @@ def generate_books(self):
if i < self.afn:
size = 0.0002
else:
- size = 0.0003 + math.cos(math.radians(90 - bookdata[3])) * bookdata[2] # the height is the radius
+ size = 0.0003 + cos(radians(90 - bookdata[3])) * bookdata[2] # the height is the radius
oz = bookdata[2]
lastx = lastx + bookdata[0] + size
@@ -261,11 +263,11 @@ def generate_books(self):
def create_book(objname, sx, sy, sz, px, py, pz, mat, frx,
fry, frz, frr, ox, oy, oz, ot, objcol, frc):
# gap Randomness
- ri = random.randint(10, 150)
+ ri = randint(10, 150)
gap = ri / 100000
# Randomness X
if ox == 0:
- ri = random.randint(0, int(frx * 1000))
+ ri = randint(0, int(frx * 1000))
factor = ri / 1000
sx -= sx * factor
if sx < (gap * 3):
@@ -275,7 +277,7 @@ def create_book(objname, sx, sy, sz, px, py, pz, mat, frx,
# Randomness Y
if oy == 0:
- ri = random.randint(0, int(fry * 1000))
+ ri = randint(0, int(fry * 1000))
factor = ri / 1000
sy -= sy * factor
if sy < (gap * 3):
@@ -285,7 +287,7 @@ def create_book(objname, sx, sy, sz, px, py, pz, mat, frx,
# Randomness Z
if oz == 0:
- ri = random.randint(0, int(frz * 1000))
+ ri = randint(0, int(frz * 1000))
factor = ri / 1000
sz -= sz * factor
if sz < (gap * 3):
@@ -297,26 +299,26 @@ def create_book(objname, sx, sy, sz, px, py, pz, mat, frx,
rot = 0
if frr > 0 and ot != -1:
if ot == 0:
- ri = random.randint(0, int(frr * 1000))
+ ri = randint(0, int(frr * 1000))
factor = ri / 1000
rot = 30 * factor
else:
rot = ot
# Randomness color (only hue)
- hsv = colorsys.rgb_to_hsv(objcol[0], objcol[1], objcol[2])
+ hsv = rgb_to_hsv(objcol[0], objcol[1], objcol[2])
hue = hsv[0]
if frc > 0:
- rc1 = random.randint(0, int(hue * 1000)) # 0 to hue
- rc2 = random.randint(int(hue * 1000), 1000) # hue to maximum
- rc3 = random.randint(0, 1000) # sign
+ rc1 = randint(0, int(hue * 1000)) # 0 to hue
+ rc2 = randint(int(hue * 1000), 1000) # hue to maximum
+ rc3 = randint(0, 1000) # sign
if rc3 >= hue * 1000:
hue += (rc2 * frc) / 1000
else:
hue -= (rc1 * frc) / 1000
# Convert random color
- objcol = colorsys.hsv_to_rgb(hue, hsv[1], hsv[2])
+ objcol = hsv_to_rgb(hue, hsv[1], hsv[2])
myvertex = []
myfaces = []
@@ -356,7 +358,7 @@ def create_book(objname, sx, sy, sz, px, py, pz, mat, frx,
mybook.location[0] = px
mybook.location[1] = py
- mybook.location[2] = pz + math.sin(math.radians(rot)) * sx
+ mybook.location[2] = pz + sin(radians(rot)) * sx
bpy.context.scene.objects.link(mybook)
mymesh.from_pydata(myvertex, [], myfaces)
@@ -395,7 +397,7 @@ def create_book(objname, sx, sy, sz, px, py, pz, mat, frx,
# ---------------------------------
# Rotation on Y axis
# ---------------------------------
- mybook.rotation_euler = (0.0, math.radians(rot), 0.0) # radians
+ mybook.rotation_euler = (0.0, radians(rot), 0.0) # radians
# add some gap to the size between books
return mybook, (sx, sy, sz, rot)
diff --git a/archimesh/achm_column_maker.py b/archimesh/achm_column_maker.py
index aff15b7e..40b46169 100644
--- a/archimesh/achm_column_maker.py
+++ b/archimesh/achm_column_maker.py
@@ -25,7 +25,7 @@
# ----------------------------------------------------------
# noinspection PyUnresolvedReferences
import bpy
-import math
+from math import cos, sin, radians, atan, sqrt
from .achm_tools import *
@@ -568,20 +568,20 @@ def create_circular_column(self, objname, radio_top, radio_mid, radio_bottom, he
# Add bottom circle
for pie in pies:
- x = math.cos(math.radians(pie)) * radio_bottom
- y = math.sin(math.radians(pie)) * radio_bottom
+ x = cos(radians(pie)) * radio_bottom
+ y = sin(radians(pie)) * radio_bottom
mypoint = [(x, y, 0.0)]
myvertex.extend(mypoint)
# Add middle circle
for pie in pies:
- x = math.cos(math.radians(pie)) * radio_mid
- y = math.sin(math.radians(pie)) * radio_mid
+ x = cos(radians(pie)) * radio_mid
+ y = sin(radians(pie)) * radio_mid
mypoint = [(x, y, (height / 2) + ((height / 2) * self.shift))]
myvertex.extend(mypoint)
# Add top circle
for pie in pies:
- x = math.cos(math.radians(pie)) * radio_top
- y = math.sin(math.radians(pie)) * radio_top
+ x = cos(radians(pie)) * radio_top
+ y = sin(radians(pie)) * radio_top
mypoint = [(x, y, height)]
myvertex.extend(mypoint)
# -------------------------------------
@@ -622,37 +622,37 @@ def create_torus(objname, radio_inside, radio_outside, height):
radio_mid = radio_outside + radio_inside - (height / 2)
# Add internal circles Top
for pie in pies:
- x = math.cos(math.radians(pie)) * radio_inside
- y = math.sin(math.radians(pie)) * radio_inside
+ x = cos(radians(pie)) * radio_inside
+ y = sin(radians(pie)) * radio_inside
mypoint = [(x, y, height / 2)]
myvertex.extend(mypoint)
# Add external circles Top
for pie in pies:
- x = math.cos(math.radians(pie)) * radio_mid
- y = math.sin(math.radians(pie)) * radio_mid
+ x = cos(radians(pie)) * radio_mid
+ y = sin(radians(pie)) * radio_mid
mypoint = [(x, y, height / 2)]
myvertex.extend(mypoint)
# Add Intermediate lines
for segment in segments:
for pie in pies:
- radio_externo = radio_mid + (height * math.cos(math.radians(segment)))
- x = math.cos(math.radians(pie)) * radio_externo
- y = math.sin(math.radians(pie)) * radio_externo
- z = math.sin(math.radians(segment)) * (height / 2)
+ radio_externo = radio_mid + (height * cos(radians(segment)))
+ x = cos(radians(pie)) * radio_externo
+ y = sin(radians(pie)) * radio_externo
+ z = sin(radians(segment)) * (height / 2)
mypoint = [(x, y, z)]
myvertex.extend(mypoint)
# Add internal circles Bottom
for pie in pies:
- x = math.cos(math.radians(pie)) * radio_inside
- y = math.sin(math.radians(pie)) * radio_inside
+ x = cos(radians(pie)) * radio_inside
+ y = sin(radians(pie)) * radio_inside
mypoint = [(x, y, height / 2 * -1)]
myvertex.extend(mypoint)
# Add external circles bottom
for pie in pies:
- x = math.cos(math.radians(pie)) * radio_mid
- y = math.sin(math.radians(pie)) * radio_mid
+ x = cos(radians(pie)) * radio_mid
+ y = sin(radians(pie)) * radio_mid
mypoint = [(x, y, height / 2 * -1)]
myvertex.extend(mypoint)
@@ -690,12 +690,12 @@ def create_rectangular_base(self, objname, x, y, z, ramp=False):
height = self.array_space_z * elements
width = self.array_space_x * elements
if width > 0:
- angle = math.atan(height / width)
+ angle = atan(height / width)
else:
angle = 0
- radio = math.sqrt((x * x) + (self.array_space_z * self.array_space_z))
- disp = radio * math.sin(angle)
+ radio = sqrt((x * x) + (self.array_space_z * self.array_space_z))
+ disp = radio * sin(angle)
if ramp is False or self.arc_top:
addz1 = 0
@@ -749,7 +749,7 @@ def create_arc(objname, radio, gap, thickness, center):
# Flat cuts
angle = 13 * (180 / 16)
for i in range(1, 4):
- z = math.sin(math.radians(angle)) * radio
+ z = sin(radians(angle)) * radio
mypoint = [(-radio - gap, pos_y, z)]
myvertex.extend(mypoint)
angle += 180 / 16
@@ -760,8 +760,8 @@ def create_arc(objname, radio, gap, thickness, center):
# --------------------------------
angle = 180
for i in range(0, 9):
- x = math.cos(math.radians(angle)) * radio
- z = math.sin(math.radians(angle)) * radio
+ x = cos(radians(angle)) * radio
+ z = sin(radians(angle)) * radio
mypoint = [(x, pos_y, z)]
myvertex.extend(mypoint)
@@ -771,7 +771,7 @@ def create_arc(objname, radio, gap, thickness, center):
# --------------------------------
angle = 8 * (180 / 16)
for i in range(1, 5):
- x = math.cos(math.radians(angle)) * radio
+ x = cos(radians(angle)) * radio
mypoint = [(x, pos_y, radio + radio / 10)]
myvertex.extend(mypoint)
diff --git a/archimesh/achm_curtain_maker.py b/archimesh/achm_curtain_maker.py
index 1e94d6b1..d7ff1011 100644
--- a/archimesh/achm_curtain_maker.py
+++ b/archimesh/achm_curtain_maker.py
@@ -25,9 +25,9 @@
# ----------------------------------------------------------
# noinspection PyUnresolvedReferences
import bpy
-import colorsys
-import copy
-import math
+from copy import copy
+from math import cos, sin, radians
+from bpy.types import Operator
from .achm_tools import *
@@ -35,7 +35,7 @@ from .achm_tools import *
# Define UI class
# Japanese curtains
# ------------------------------------------------------------------
-class AchmJapan(bpy.types.Operator):
+class AchmJapan(Operator):
bl_idname = "mesh.archimesh_japan"
bl_label = "Japanese curtains"
bl_description = "Japanese curtains Generator"
@@ -174,7 +174,7 @@ def create_japan_mesh(self):
# Define UI class
# Roller curtains
# ------------------------------------------------------------------
-class AchmRoller(bpy.types.Operator):
+class AchmRoller(Operator):
bl_idname = "mesh.archimesh_roller"
bl_label = "Roller curtains"
bl_description = "Roller_curtains Generator"
@@ -262,7 +262,7 @@ def generate_japan(self):
panel = []
location = bpy.context.scene.cursor_location
- myloc = copy.copy(location) # copy location to keep 3D cursor position
+ myloc = copy(location) # copy location to keep 3D cursor position
# ------------------
# Rail
@@ -621,7 +621,7 @@ def create_bezier(objname, points, origin, depth=0.001, fill='FULL'):
# ------------------------------------------------------------------------------
def generate_roller(self):
location = bpy.context.scene.cursor_location
- myloc = copy.copy(location) # copy location to keep 3D cursor position
+ myloc = copy(location) # copy location to keep 3D cursor position
# ------------------
# Roller Top
@@ -738,16 +738,16 @@ def create_roller_rail(objname, width, radio, px, py, pz, mat, mymaterial):
# Add right circle
for i in range(pies):
- x = math.cos(math.radians(seg)) * radio
- y = math.sin(math.radians(seg)) * radio
+ x = cos(radians(seg)) * radio
+ y = sin(radians(seg)) * radio
mypoint = [(0.0, x, y)]
myvertex.extend(mypoint)
seg += 360 / pies
# Add left circle
seg = 0
for i in range(pies):
- x = math.cos(math.radians(seg)) * radio
- y = math.sin(math.radians(seg)) * radio
+ x = cos(radians(seg)) * radio
+ y = sin(radians(seg)) * radio
mypoint = [(width, x, y)]
myvertex.extend(mypoint)
seg += 360 / pies
@@ -816,7 +816,7 @@ def create_roller_sides(myroller, side, px, py, pz, mat, plastic):
myside.location.z = pz
# rotate
if side == "L":
- myside.rotation_euler = (0, 0, math.radians(180))
+ myside.rotation_euler = (0, 0, radians(180))
# parent
myside.parent = myroller
diff --git a/archimesh/achm_door_maker.py b/archimesh/achm_door_maker.py
index 36eba64e..b0908209 100644
--- a/archimesh/achm_door_maker.py
+++ b/archimesh/achm_door_maker.py
@@ -26,14 +26,15 @@
import bpy
import math
# noinspection PyUnresolvedReferences
-from bpy.props import *
+from bpy.types import Operator, PropertyGroup, Object, Panel
+from bpy.props import FloatProperty, BoolProperty, EnumProperty, FloatVectorProperty, CollectionProperty
from .achm_tools import *
# ------------------------------------------------------------------
# Define operator class to create object
# ------------------------------------------------------------------
-class AchmDoor(bpy.types.Operator):
+class AchmDoor(Operator):
bl_idname = "mesh.archimesh_door"
bl_label = "Door"
bl_description = "Door"
@@ -277,50 +278,50 @@ def shape_children(mainobject, update=False):
# ------------------------------------------------------------------
# Define property group class to create or modify
# ------------------------------------------------------------------
-class ObjectProperties(bpy.types.PropertyGroup):
- frame_width = bpy.props.FloatProperty(
+class ObjectProperties(PropertyGroup):
+ frame_width = FloatProperty(
name='Frame width',
min=0.25, max=10,
default=1, precision=2,
description='Doorframe width', update=update_object,
)
- frame_height = bpy.props.FloatProperty(
+ frame_height = FloatProperty(
name='Frame height',
min=0.25, max=10,
default=2.1, precision=2,
description='Doorframe height', update=update_object,
)
- frame_thick = bpy.props.FloatProperty(
+ frame_thick = FloatProperty(
name='Frame thickness',
min=0.05, max=0.50,
default=0.08, precision=2,
description='Doorframe thickness', update=update_object,
)
- frame_size = bpy.props.FloatProperty(
+ frame_size = FloatProperty(
name='Frame size',
min=0.05, max=0.25,
default=0.08, precision=2,
description='Doorframe size', update=update_object,
)
- crt_mat = bpy.props.BoolProperty(
+ crt_mat = BoolProperty(
name="Create default Cycles materials",
description="Create default materials for Cycles render",
default=True,
update=update_object,
)
- factor = bpy.props.FloatProperty(
+ factor = FloatProperty(
name='',
min=0.2, max=1,
default=0.5, precision=3, description='Door ratio',
update=update_object,
)
- r = bpy.props.FloatProperty(
+ r = FloatProperty(
name='Rotation', min=0, max=360,
default=0, precision=1,
description='Door rotation', update=update_object,
)
- openside = bpy.props.EnumProperty(
+ openside = EnumProperty(
name="Open side",
items=(
('1', "Right open", ""),
@@ -331,7 +332,7 @@ class ObjectProperties(bpy.types.PropertyGroup):
update=update_object,
)
- model = bpy.props.EnumProperty(
+ model = EnumProperty(
name="Model",
items=(
('1', "Model 01", ""),
@@ -345,7 +346,7 @@ class ObjectProperties(bpy.types.PropertyGroup):
update=update_object,
)
- handle = bpy.props.EnumProperty(
+ handle = EnumProperty(
name="Handle",
items=(
('1', "Handle 01", ""),
@@ -359,27 +360,27 @@ class ObjectProperties(bpy.types.PropertyGroup):
)
# opengl internal data
- glpoint_a = bpy.props.FloatVectorProperty(
+ glpoint_a = FloatVectorProperty(
name="glpointa",
description="Hidden property for opengl",
default=(0, 0, 0),
)
- glpoint_b = bpy.props.FloatVectorProperty(
+ glpoint_b = FloatVectorProperty(
name="glpointb",
description="Hidden property for opengl",
default=(0, 0, 0),
)
- glpoint_c = bpy.props.FloatVectorProperty(
+ glpoint_c = FloatVectorProperty(
name="glpointc",
description="Hidden property for opengl",
default=(0, 0, 0),
)
- glpoint_d = bpy.props.FloatVectorProperty(
+ glpoint_d = FloatVectorProperty(
name="glpointc",
description="Hidden property for opengl",
default=(0, 0, 0),
)
- glpoint_e = bpy.props.FloatVectorProperty(
+ glpoint_e = FloatVectorProperty(
name="glpointc",
description="Hidden property for opengl",
default=(0, 0, 0),
@@ -387,13 +388,13 @@ class ObjectProperties(bpy.types.PropertyGroup):
# Register
bpy.utils.register_class(ObjectProperties)
-bpy.types.Object.DoorObjectGenerator = bpy.props.CollectionProperty(type=ObjectProperties)
+Object.DoorObjectGenerator = CollectionProperty(type=ObjectProperties)
# ------------------------------------------------------------------
# Define panel class to modify object
# ------------------------------------------------------------------
-class AchmDoorObjectgeneratorpanel(bpy.types.Panel):
+class AchmDoorObjectgeneratorpanel(Panel):
bl_idname = "OBJECT_PT_door_generator"
bl_label = "Door"
bl_space_type = 'VIEW_3D'
diff --git a/archimesh/achm_gltools.py b/archimesh/achm_gltools.py
index 1cadedb1..aaddbeaf 100644
--- a/archimesh/achm_gltools.py
+++ b/archimesh/achm_gltools.py
@@ -29,9 +29,9 @@ import bpy
import bgl
# noinspection PyUnresolvedReferences
import blf
-import math
+from math import fabs, sqrt, sin, cos
# noinspection PyUnresolvedReferences
-import mathutils
+from mathutils import Vector
# noinspection PyUnresolvedReferences
from bpy_extras import view3d_utils
from .achm_room_maker import get_wall_points
@@ -209,7 +209,7 @@ def draw_room_data(myobj, op, region, rv3d, rgb, rgbw, fsize, wfsize, space, mea
if measure is True:
# Draw text
dist = distance(a2_p, b2_p)
- txtpoint3d = interpolate3d(a2_p, b2_p, math.fabs(dist / 2))
+ txtpoint3d = interpolate3d(a2_p, b2_p, fabs(dist / 2))
# add a gap
gap3d = (txtpoint3d[0], txtpoint3d[1], txtpoint3d[2] + 0.05)
@@ -237,7 +237,7 @@ def draw_room_data(myobj, op, region, rv3d, rgb, rgbw, fsize, wfsize, space, mea
bp = get_point((op.walls[i].glpoint_b[0], op.walls[i].glpoint_b[1], op.walls[i].glpoint_b[2]), myobj)
dist = distance(ap, bp)
- txtpoint3d = interpolate3d(ap, bp, math.fabs(dist / 2))
+ txtpoint3d = interpolate3d(ap, bp, fabs(dist / 2))
# add a gap
gap3d = (txtpoint3d[0], txtpoint3d[1], txtpoint3d[2]) # + op.room_height / 2)
txtpoint2d = view3d_utils.location_3d_to_region_2d(region, rv3d, gap3d)
@@ -320,7 +320,7 @@ def draw_door_data(myobj, op, region, rv3d, rgb, fsize, space, measure):
if measure is True:
# Vertical
dist = distance(a_p1, t_p1)
- txtpoint3d = interpolate3d(a_p1, t_p1, math.fabs(dist / 2))
+ txtpoint3d = interpolate3d(a_p1, t_p1, fabs(dist / 2))
gap3d = (a_p2[0], txtpoint3d[1], txtpoint3d[2])
txtpoint2d = view3d_utils.location_3d_to_region_2d(region, rv3d, gap3d)
draw_text(txtpoint2d[0], txtpoint2d[1], "%6.2f" % dist, rgb, fsize, True)
@@ -331,7 +331,7 @@ def draw_door_data(myobj, op, region, rv3d, rgb, fsize, space, measure):
# Horizontal
dist = distance(b_p1, c_p1)
- txtpoint3d = interpolate3d(b_p1, c_p1, math.fabs(dist / 2))
+ txtpoint3d = interpolate3d(b_p1, c_p1, fabs(dist / 2))
gap3d = (txtpoint3d[0], txtpoint3d[1], b_p2[2] + 0.02)
txtpoint2d = view3d_utils.location_3d_to_region_2d(region, rv3d, gap3d)
draw_text(txtpoint2d[0], txtpoint2d[1], "%6.2f" % dist, rgb, fsize)
@@ -342,7 +342,7 @@ def draw_door_data(myobj, op, region, rv3d, rgb, fsize, space, measure):
# Door size
dist = distance(d_p1, e_p1)
- txtpoint3d = interpolate3d(d_p1, e_p1, math.fabs(dist / 2))
+ txtpoint3d = interpolate3d(d_p1, e_p1, fabs(dist / 2))
gap3d = (txtpoint3d[0], txtpoint3d[1], txtpoint3d[2] + 0.02)
txtpoint2d = view3d_utils.location_3d_to_region_2d(region, rv3d, gap3d)
draw_text(txtpoint2d[0], txtpoint2d[1], "%6.2f" % dist, rgb, fsize)
@@ -405,7 +405,7 @@ def draw_window_rail_data(myobj, op, region, rv3d, rgb, fsize, space, measure):
if measure is True:
# Vertical
dist = distance(a_p1, t_p1)
- txtpoint3d = interpolate3d(a_p1, t_p1, math.fabs(dist / 2))
+ txtpoint3d = interpolate3d(a_p1, t_p1, fabs(dist / 2))
gap3d = (a_p2[0], txtpoint3d[1], txtpoint3d[2])
txtpoint2d = view3d_utils.location_3d_to_region_2d(region, rv3d, gap3d)
draw_text(txtpoint2d[0], txtpoint2d[1], "%6.2f" % dist, rgb, fsize, True)
@@ -416,7 +416,7 @@ def draw_window_rail_data(myobj, op, region, rv3d, rgb, fsize, space, measure):
# Horizontal
dist = distance(b_p1, c_p1)
- txtpoint3d = interpolate3d(b_p1, c_p1, math.fabs(dist / 2))
+ txtpoint3d = interpolate3d(b_p1, c_p1, fabs(dist / 2))
gap3d = (txtpoint3d[0], txtpoint3d[1], b_p2[2] + 0.02)
txtpoint2d = view3d_utils.location_3d_to_region_2d(region, rv3d, gap3d)
draw_text(txtpoint2d[0], txtpoint2d[1], "%6.2f" % dist, rgb, fsize)
@@ -512,7 +512,7 @@ def draw_window_panel_data(myobj, op, region, rv3d, rgb, fsize, space, measure):
if measure is True:
# Vertical (right)
dist = distance(a_p1, t_p1)
- txtpoint3d = interpolate3d(a_p1, t_p1, math.fabs(dist / 2))
+ txtpoint3d = interpolate3d(a_p1, t_p1, fabs(dist / 2))
gap3d = (a_p2[0], txtpoint3d[1], txtpoint3d[2])
txtpoint2d = view3d_utils.location_3d_to_region_2d(region, rv3d, gap3d)
draw_text(txtpoint2d[0], txtpoint2d[1], "%6.2f" % dist, rgb, fsize, True)
@@ -523,7 +523,7 @@ def draw_window_panel_data(myobj, op, region, rv3d, rgb, fsize, space, measure):
# Vertical (Left)
dist = distance(f_p1, d_p1)
- txtpoint3d = interpolate3d(f_p1, d_p1, math.fabs(dist / 2))
+ txtpoint3d = interpolate3d(f_p1, d_p1, fabs(dist / 2))
gap3d = (f_p2[0], txtpoint3d[1], txtpoint3d[2])
txtpoint2d = view3d_utils.location_3d_to_region_2d(region, rv3d, gap3d)
draw_text(txtpoint2d[0], txtpoint2d[1], "%6.2f" % dist, rgb, fsize)
@@ -535,7 +535,7 @@ def draw_window_panel_data(myobj, op, region, rv3d, rgb, fsize, space, measure):
# Horizontal (not triangle nor arch)
if op.UST != "4" and op.UST != "2":
dist = distance(b_p1, c_p1)
- txtpoint3d = interpolate3d(b_p2, c_p2, math.fabs(dist / 2))
+ txtpoint3d = interpolate3d(b_p2, c_p2, fabs(dist / 2))
gap3d = (txtpoint3d[0], txtpoint3d[1], txtpoint3d[2] + 0.05)
txtpoint2d = view3d_utils.location_3d_to_region_2d(region, rv3d, gap3d)
draw_text(txtpoint2d[0], txtpoint2d[1], "%6.2f" % dist, rgb, fsize)
@@ -545,13 +545,13 @@ def draw_window_panel_data(myobj, op, region, rv3d, rgb, fsize, space, measure):
draw_line(screen_point_cp3, screen_point_cp1)
else:
dist = distance(b_p1, g_p3)
- txtpoint3d = interpolate3d(b_p2, g_p4, math.fabs(dist / 2))
+ txtpoint3d = interpolate3d(b_p2, g_p4, fabs(dist / 2))
gap3d = (txtpoint3d[0], txtpoint3d[1], txtpoint3d[2] + 0.05)
txtpoint2d = view3d_utils.location_3d_to_region_2d(region, rv3d, gap3d)
draw_text(txtpoint2d[0], txtpoint2d[1], "%6.2f" % dist, rgb, fsize, True)
dist = distance(g_p3, c_p1)
- txtpoint3d = interpolate3d(g_p4, c_p2, math.fabs(dist / 2))
+ txtpoint3d = interpolate3d(g_p4, c_p2, fabs(dist / 2))
gap3d = (txtpoint3d[0], txtpoint3d[1], txtpoint3d[2] + 0.05)
txtpoint2d = view3d_utils.location_3d_to_region_2d(region, rv3d, gap3d)
draw_text(txtpoint2d[0], txtpoint2d[1], "%6.2f" % dist, rgb, fsize)
@@ -565,7 +565,7 @@ def draw_window_panel_data(myobj, op, region, rv3d, rgb, fsize, space, measure):
# Only for Triangle or arch
if op.UST == "2" or op.UST == "4":
dist = distance(g_p2, g_p3)
- txtpoint3d = interpolate3d(g_p2, g_p3, math.fabs(dist / 2))
+ txtpoint3d = interpolate3d(g_p2, g_p3, fabs(dist / 2))
gap3d = (txtpoint3d[0] + 0.05, txtpoint3d[1], txtpoint3d[2])
txtpoint2d = view3d_utils.location_3d_to_region_2d(region, rv3d, gap3d)
draw_text(txtpoint2d[0], txtpoint2d[1], "%6.2f" % dist, rgb, fsize)
@@ -581,7 +581,7 @@ def draw_window_panel_data(myobj, op, region, rv3d, rgb, fsize, space, measure):
screen_point_hp5 = view3d_utils.location_3d_to_region_2d(region, rv3d, h_p5)
dist = distance(h_p1, h_p3)
- txtpoint3d = interpolate3d(h_p1, h_p3, math.fabs(dist / 2))
+ txtpoint3d = interpolate3d(h_p1, h_p3, fabs(dist / 2))
gap3d = (txtpoint3d[0], txtpoint3d[1], txtpoint3d[2] - space - 0.05)
txtpoint2d = view3d_utils.location_3d_to_region_2d(region, rv3d, gap3d)
draw_text(txtpoint2d[0], txtpoint2d[1], "%6.2f" % dist, rgb, fsize)
@@ -600,7 +600,7 @@ def draw_window_panel_data(myobj, op, region, rv3d, rgb, fsize, space, measure):
# return: distance
# --------------------------------------------------------------------
def distance(v1, v2):
- return math.sqrt((v2[0] - v1[0]) ** 2 + (v2[1] - v1[1]) ** 2 + (v2[2] - v1[2]) ** 2)
+ return sqrt((v2[0] - v1[0]) ** 2 + (v2[1] - v1[1]) ** 2 + (v2[2] - v1[2]) ** 2)
# --------------------------------------------------------------------
@@ -634,7 +634,7 @@ def interpolate3d(v1, v2, d1):
def get_point(v1, mainobject):
# Using World Matrix
- vt = mathutils.Vector((v1[0], v1[1], v1[2], 1))
+ vt = Vector((v1[0], v1[1], v1[2], 1))
m4 = mainobject.matrix_world
vt2 = m4 * vt
v2 = [vt2[0], vt2[1], vt2[2]]
@@ -654,8 +654,8 @@ def rotate_x(v1, rot):
# X axis
v2[0] = v1[0]
- v2[1] = v1[1] * math.cos(radx) - v1[2] * math.sin(radx)
- v2[2] = v1[1] * math.sin(radx) + v1[2] * math.cos(radx)
+ v2[1] = v1[1] * cos(radx) - v1[2] * sin(radx)
+ v2[2] = v1[1] * sin(radx) + v1[2] * cos(radx)
return v2
@@ -671,9 +671,9 @@ def rotate_y(v1, rot):
rady = rot[1]
# Y axis
- v2[0] = v1[0] * math.cos(rady) + v1[2] * math.sin(rady)
+ v2[0] = v1[0] * cos(rady) + v1[2] * sin(rady)
v2[1] = v1[1]
- v2[2] = v1[2] * math.cos(rady) - v1[0] * math.sin(rady)
+ v2[2] = v1[2] * cos(rady) - v1[0] * sin(rady)
return v2
@@ -689,8 +689,8 @@ def rotate_z(v1, rot):
radz = rot[2]
# Z axis
- v2[0] = v1[0] * math.cos(radz) - v1[1] * math.sin(radz)
- v2[1] = v1[0] * math.sin(radz) + v1[1] * math.cos(radz)
+ v2[0] = v1[0] * cos(radz) - v1[1] * sin(radz)
+ v2[1] = v1[0] * sin(radz) + v1[1] * cos(radz)
v2[2] = v1[2]
return v2
diff --git a/archimesh/achm_kitchen_maker.py b/archimesh/achm_kitchen_maker.py
index 21a3e565..d34bc929 100644
--- a/archimesh/achm_kitchen_maker.py
+++ b/archimesh/achm_kitchen_maker.py
@@ -24,13 +24,15 @@
#
# ----------------------------------------------------------
import bpy
-import math
-import copy
-import sys
-import datetime
-import time
-from .achm_tools import *
+from math import pi, fabs
+from copy import copy
+from sys import exc_info
+from datetime import datetime
+from time import time
+from bpy.types import Operator, PropertyGroup
+from bpy.props import StringProperty, EnumProperty, FloatProperty, IntProperty, BoolProperty, CollectionProperty
from bpy_extras.io_utils import ExportHelper
+from .achm_tools import *
# ----------------------------------------------------------
# Define rotation types
@@ -44,7 +46,7 @@ RotationType_R180 = 3
# ----------------------------------------------------------
# Export menu UI
# ----------------------------------------------------------
-class AchmExportInventory(bpy.types.Operator, ExportHelper):
+class AchmExportInventory(Operator, ExportHelper):
bl_idname = "io_export.kitchen_inventory"
bl_description = 'Export kitchen inventory (.txt)'
bl_category = 'Archimesh'
@@ -52,12 +54,12 @@ class AchmExportInventory(bpy.types.Operator, ExportHelper):
# From ExportHelper. Filter filenames.
filename_ext = ".txt"
- filter_glob = bpy.props.StringProperty(
+ filter_glob = StringProperty(
default="*.txt",
options={'HIDDEN'},
)
- filepath = bpy.props.StringProperty(
+ filepath = StringProperty(
name="File Path",
description="File path used for exporting room data file",
maxlen=1024, default="",
@@ -81,7 +83,7 @@ class AchmExportInventory(bpy.types.Operator, ExportHelper):
realpath = os.path.realpath(os.path.expanduser(self.properties.filepath))
fout = open(realpath, 'w')
- st = datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S')
+ st = datetime.fromtimestamp(time()).strftime('%Y-%m-%d %H:%M:%S')
fout.write("# Archimesh kitchen inventory\n")
fout.write("# " + st + "\n")
mylist = getinventory()
@@ -91,7 +93,7 @@ class AchmExportInventory(bpy.types.Operator, ExportHelper):
fout.close()
self.report({'INFO'}, realpath + "successfully exported")
except:
- e = sys.exc_info()[0]
+ e = exc_info()[0]
self.report({'ERROR'}, "Unable to export inventory " + e)
return {'FINISHED'}
@@ -247,37 +249,37 @@ def getinventory():
# Define property group class for cabinet properties
# This is managed as an array of objects
# ------------------------------------------------------------------
-class CabinetProperties(bpy.types.PropertyGroup):
+class CabinetProperties(PropertyGroup):
# Cabinet width
- sX = bpy.props.FloatProperty(
+ sX = FloatProperty(
name='width', min=0.001, max=10, default=0.60, precision=3,
description='Cabinet width',
)
- wY = bpy.props.FloatProperty(
+ wY = FloatProperty(
name='', min=-10, max=10, default=0, precision=3,
description='Modify depth size',
)
- wZ = bpy.props.FloatProperty(
+ wZ = FloatProperty(
name='', min=-10, max=10, default=0, precision=3,
description='Modify height size',
)
# Cabinet position shift
- pX = bpy.props.FloatProperty(
+ pX = FloatProperty(
name='', min=-10, max=10, default=0, precision=3,
description='Position x shift',
)
- pY = bpy.props.FloatProperty(
+ pY = FloatProperty(
name='', min=-10, max=10, default=0, precision=3,
description='Position y shift',
)
- pZ = bpy.props.FloatProperty(
+ pZ = FloatProperty(
name='', min=-10, max=10, default=0, precision=3,
description='Position z shift',
)
# Door type
- dType = bpy.props.EnumProperty(
+ dType = EnumProperty(
items=(
('1', "Single R", ""),
('2', "Single L", ""),
@@ -296,47 +298,47 @@ class CabinetProperties(bpy.types.PropertyGroup):
)
# Shelves
- sNum = bpy.props.IntProperty(
+ sNum = IntProperty(
name='Shelves', min=0, max=10, default=1,
description='Number total of shelves',
)
# Drawers
- dNum = bpy.props.IntProperty(
+ dNum = IntProperty(
name='Num', min=1, max=10, default=3,
description='Number total of drawers',
)
# Glass Factor
- gF = bpy.props.FloatProperty(
+ gF = FloatProperty(
name='', min=0.001, max=1, default=0.1, precision=3,
description='Glass ratio',
)
# Handle flag
- hand = bpy.props.BoolProperty(
+ hand = BoolProperty(
name="Handle",
description="Create a handle", default=True,
)
# Left baseboard
- bL = bpy.props.BoolProperty(
+ bL = BoolProperty(
name="Left Baseboard",
description="Create a left baseboard", default=False,
)
# Right baseboard
- bR = bpy.props.BoolProperty(
+ bR = BoolProperty(
name="Right Baseboard",
description="Create a left baseboard", default=False,
)
# Fill countertop spaces
- tC = bpy.props.BoolProperty(
+ tC = BoolProperty(
name="Countertop fill",
description="Fill empty spaces with countertop", default=True,
)
# Add countertop edge
- tE = bpy.props.BoolProperty(
+ tE = BoolProperty(
name="Countertop edge",
description="Add edge to countertop", default=True,
)
# cabinet rotation
- rotate = bpy.props.EnumProperty(
+ rotate = EnumProperty(
items=(
('9', "Default", ""),
('1', "90 CW", ""),
@@ -355,7 +357,7 @@ bpy.utils.register_class(CabinetProperties)
# Define UI class
# Kitchens
# ------------------------------------------------------------------
-class AchmKitchen(bpy.types.Operator):
+class AchmKitchen(Operator):
bl_idname = "mesh.archimesh_kitchen"
bl_label = "Cabinets"
bl_description = "Cabinet Generator"
@@ -363,7 +365,7 @@ class AchmKitchen(bpy.types.Operator):
bl_options = {'REGISTER', 'UNDO'}
# Define properties
- type_cabinet = bpy.props.EnumProperty(
+ type_cabinet = EnumProperty(
items=(('1', "Floor", ""),
('2', "Wall", "")),
name="Type",
@@ -371,19 +373,19 @@ class AchmKitchen(bpy.types.Operator):
)
oldtype = type_cabinet
- thickness = bpy.props.FloatProperty(
+ thickness = FloatProperty(
name='Thickness', min=0.001, max=5, default=0.018, precision=3,
description='Board thickness',
)
- depth = bpy.props.FloatProperty(
+ depth = FloatProperty(
name='Depth', min=0.001, max=50, default=0.59, precision=3,
description='Default cabinet depth',
)
- height = bpy.props.FloatProperty(
+ height = FloatProperty(
name='Height', min=0.001, max=50, default=0.70, precision=3,
description='Default cabinet height',
)
- handle = bpy.props.EnumProperty(
+ handle = EnumProperty(
items=(
('1', "Model 1", ""),
('2', "Model 2", ""),
@@ -398,69 +400,69 @@ class AchmKitchen(bpy.types.Operator):
name="Handle",
description="Type of handle",
)
- handle_x = bpy.props.FloatProperty(
+ handle_x = FloatProperty(
name='', min=0.001, max=10,
default=0.05, precision=3,
description='Displacement in X relative position (limited to door size)',
)
- handle_z = bpy.props.FloatProperty(
+ handle_z = FloatProperty(
name='', min=0.001, max=10,
default=0.05, precision=3,
description='Displacement in Z relative position (limited to door size)',
)
- baseboard = bpy.props.BoolProperty(
+ baseboard = BoolProperty(
name="Baseboard",
description="Create a baseboard automatically",
default=True,
)
- baseheight = bpy.props.FloatProperty(
+ baseheight = FloatProperty(
name='height', min=0.001, max=10,
default=0.16, precision=3,
description='Baseboard height',
)
- basefactor = bpy.props.FloatProperty(
+ basefactor = FloatProperty(
name='sink', min=0, max=1,
default=0.90, precision=3,
description='Baseboard sink',
)
- countertop = bpy.props.BoolProperty(
+ countertop = BoolProperty(
name="Countertop",
description="Create a countertop automatically (only default cabinet height)",
default=True,
)
- counterheight = bpy.props.FloatProperty(
+ counterheight = FloatProperty(
name='height', min=0.001, max=10,
default=0.02, precision=3,
description='Countertop height',
)
- counterextend = bpy.props.FloatProperty(
+ counterextend = FloatProperty(
name='extend', min=0.001, max=10,
default=0.03, precision=3,
description='Countertop extent',
)
- fitZ = bpy.props.BoolProperty(
+ fitZ = BoolProperty(
name="Floor origin in Z=0",
description="Use Z=0 axis as vertical origin floor position",
default=True,
)
- moveZ = bpy.props.FloatProperty(
+ moveZ = FloatProperty(
name='Z position', min=0.001, max=10,
default=1.5, precision=3,
description='Wall cabinet Z position from floor',
)
- cabinet_num = bpy.props.IntProperty(
+ cabinet_num = IntProperty(
name='Number of Cabinets', min=1, max=30,
default=1,
description='Number total of cabinets in the Kitchen',
)
- cabinets = bpy.props.CollectionProperty(type=CabinetProperties)
+ cabinets = CollectionProperty(type=CabinetProperties)
# Materials
- crt_mat = bpy.props.BoolProperty(
+ crt_mat = BoolProperty(
name="Create default Cycles materials",
description="Create default materials for Cycles render",
default=True,
@@ -621,7 +623,7 @@ def generate_cabinets(self):
boxes = []
bases = []
location = bpy.context.scene.cursor_location
- myloc = copy.copy(location) # copy location to keep 3D cursor position
+ myloc = copy(location) # copy location to keep 3D cursor position
# Fit to floor
if self.fitZ:
myloc[2] = 0
@@ -678,21 +680,21 @@ def generate_cabinets(self):
# 90 CW
# ----------
if myrotationtype == RotationType_R90CW:
- myrot += -math.pi / 2
+ myrot += -pi / 2
# ----------
# 90 CCW
# ----------
if myrotationtype == RotationType_R90CCW:
- myrot += math.pi / 2
+ myrot += pi / 2
# ----------
# 180
# ----------
if myrotationtype == RotationType_R180:
- myrot = myrot + math.pi
+ myrot = myrot + pi
# Save the rotation for next cabinet
lastrot = myrot
- angle = myrot - ((2 * math.pi) * (myrot // (2 * math.pi))) # clamp one revolution
+ angle = myrot - ((2 * pi) * (myrot // (2 * pi))) # clamp one revolution
# -------------------------------------------
# Countertop (only default height cabinet)
@@ -703,11 +705,11 @@ def generate_cabinets(self):
# fill (depend on orientation)
if self.cabinets[i].tC:
# 0 or 180 degrees
- if angle == 0 or angle == math.pi:
- w += math.fabs(self.cabinets[i].pX)
+ if angle == 0 or angle == pi:
+ w += fabs(self.cabinets[i].pX)
# 90 or 270 degrees
- if angle == (3 * math.pi) / 2 or angle == math.pi / 2:
- w += math.fabs(self.cabinets[i].pY)
+ if angle == (3 * pi) / 2 or angle == pi / 2:
+ w += fabs(self.cabinets[i].pY)
mycountertop = create_countertop("Countertop" + str(i + 1),
w,
@@ -727,19 +729,19 @@ def generate_cabinets(self):
mycountertop.location[0] = 0
# 90CW
- if angle == (3 * math.pi) / 2:
+ if angle == (3 * pi) / 2:
if self.cabinets[i].pY >= 0:
mycountertop.location[0] = 0
else:
mycountertop.location[0] = self.cabinets[i].pY
# 90CCW
- if angle == math.pi / 2:
+ if angle == pi / 2:
if self.cabinets[i].pY >= 0:
mycountertop.location[0] = self.cabinets[i].pY * -1
else:
mycountertop.location[0] = 0
# 180
- if angle == math.pi:
+ if angle == pi:
mycountertop.location[0] = 0
mycountertop.location[2] = self.height
@@ -796,15 +798,15 @@ def generate_cabinets(self):
lastx = lastx
lasty = lasty
# 90 degrees
- if angle == math.pi / 2:
+ if angle == pi / 2:
ym = -self.cabinets[i].sX
lastx = lastx - self.cabinets[i].sX - self.cabinets[i].pX
lasty = lasty + self.cabinets[i].sX + self.cabinets[i].pY
# 180 degrees
- if angle == math.pi:
+ if angle == pi:
lastx -= 2 * (self.cabinets[i].sX + self.cabinets[i].pX)
# 270 degrees
- if angle == (3 * math.pi) / 2:
+ if angle == (3 * pi) / 2:
xm = self.depth - self.counterextend
lastx = lastx - self.cabinets[i].sX - self.cabinets[i].pX
lasty = lasty - self.cabinets[i].sX - self.cabinets[i].pX + self.cabinets[i].pY
@@ -1430,13 +1432,13 @@ def create_handle(model, mydoor, thickness, handle_position, mat, handle_x, hand
if handle_position != "T" and handle_position != "B" and handle_position != "TM":
yrot = 0
if model == "1":
- yrot = math.pi / 2
+ yrot = pi / 2
if model == "4":
if handle_position == "LT" or handle_position == "LB":
- yrot = -math.pi / 2
+ yrot = -pi / 2
else:
- yrot = math.pi / 2
+ yrot = pi / 2
myhandle.rotation_euler = (0, yrot, 0.0) # radians PI=180
diff --git a/archimesh/achm_lamp_maker.py b/archimesh/achm_lamp_maker.py
index fe21beab..e8918a4a 100644
--- a/archimesh/achm_lamp_maker.py
+++ b/archimesh/achm_lamp_maker.py
@@ -24,8 +24,10 @@
#
# ----------------------------------------------------------
import bpy
-import math
-import copy
+from math import cos, sin, radians
+from copy import copy
+from bpy.types import Operator
+from bpy.props import EnumProperty, FloatProperty, IntProperty, BoolProperty, FloatVectorProperty
from .achm_tools import *
@@ -127,14 +129,14 @@ def set_preset(self):
# Define UI class
# Lamps
# ------------------------------------------------------------------
-class AchmLamp(bpy.types.Operator):
+class AchmLamp(Operator):
bl_idname = "mesh.archimesh_lamp"
bl_label = "Lamp"
bl_description = "Lamp Generator"
bl_category = 'Archimesh'
bl_options = {'REGISTER', 'UNDO'}
# preset
- preset = bpy.props.EnumProperty(
+ preset = EnumProperty(
items=(
('0', "None", ""),
('1', "Sphere", ""),
@@ -147,107 +149,107 @@ class AchmLamp(bpy.types.Operator):
)
oldpreset = preset
- base_height = bpy.props.FloatProperty(
+ base_height = FloatProperty(
name='Height',
min=0.01, max=10, default=0.20, precision=3,
description='lamp base height',
)
- base_segments = bpy.props.IntProperty(
+ base_segments = IntProperty(
name='Segments',
min=3, max=128, default=16,
description='Number of segments (vertical)',
)
- base_rings = bpy.props.IntProperty(
+ base_rings = IntProperty(
name='Rings',
min=2, max=12, default=6,
description='Number of rings (horizontal)',
)
- holder = bpy.props.FloatProperty(
+ holder = FloatProperty(
name='Lampholder',
min=0.001, max=10, default=0.02, precision=3,
description='Lampholder height',
)
- smooth = bpy.props.BoolProperty(
+ smooth = BoolProperty(
name="Smooth",
description="Use smooth shader",
default=True,
)
- subdivide = bpy.props.BoolProperty(
+ subdivide = BoolProperty(
name="Subdivide",
description="Add subdivision modifier",
default=True,
)
- bz01 = bpy.props.FloatProperty(name='S1', min=-1, max=1, default=0, precision=3, description='Z shift factor')
- bz02 = bpy.props.FloatProperty(name='S2', min=-1, max=1, default=0, precision=3, description='Z shift factor')
- bz03 = bpy.props.FloatProperty(name='S3', min=-1, max=1, default=0, precision=3, description='Z shift factor')
- bz04 = bpy.props.FloatProperty(name='S4', min=-1, max=1, default=0, precision=3, description='Z shift factor')
- bz05 = bpy.props.FloatProperty(name='S5', min=-1, max=1, default=0, precision=3, description='Z shift factor')
- bz06 = bpy.props.FloatProperty(name='S6', min=-1, max=1, default=0, precision=3, description='Z shift factor')
- bz07 = bpy.props.FloatProperty(name='S7', min=-1, max=1, default=0, precision=3, description='Z shift factor')
- bz08 = bpy.props.FloatProperty(name='S8', min=-1, max=1, default=0, precision=3, description='Z shift factor')
- bz09 = bpy.props.FloatProperty(name='S9', min=-1, max=1, default=0, precision=3, description='Z shift factor')
- bz10 = bpy.props.FloatProperty(name='S10', min=-1, max=1, default=0, precision=3, description='Z shift factor')
- bz11 = bpy.props.FloatProperty(name='S11', min=-1, max=1, default=0, precision=3, description='Z shift factor')
- bz12 = bpy.props.FloatProperty(name='S12', min=-1, max=1, default=0, precision=3, description='Z shift factor')
-
- br01 = bpy.props.FloatProperty(name='R1', min=0.001, max=10, default=0.06, precision=3, description='Ring radio')
- br02 = bpy.props.FloatProperty(name='R2', min=0.001, max=10, default=0.08, precision=3, description='Ring radio')
- br03 = bpy.props.FloatProperty(name='R3', min=0.001, max=10, default=0.09, precision=3, description='Ring radio')
- br04 = bpy.props.FloatProperty(name='R4', min=0.001, max=10, default=0.08, precision=3, description='Ring radio')
- br05 = bpy.props.FloatProperty(name='R5', min=0.001, max=10, default=0.06, precision=3, description='Ring radio')
- br06 = bpy.props.FloatProperty(name='R6', min=0.001, max=10, default=0.03, precision=3, description='Ring radio')
- br07 = bpy.props.FloatProperty(name='R7', min=0.001, max=10, default=0.10, precision=3, description='Ring radio')
- br08 = bpy.props.FloatProperty(name='R8', min=0.001, max=10, default=0.10, precision=3, description='Ring radio')
- br09 = bpy.props.FloatProperty(name='R9', min=0.001, max=10, default=0.10, precision=3, description='Ring radio')
- br10 = bpy.props.FloatProperty(name='R10', min=0.001, max=10, default=0.10, precision=3, description='Ring radio')
- br11 = bpy.props.FloatProperty(name='R11', min=0.001, max=10, default=0.10, precision=3, description='Ring radio')
- br12 = bpy.props.FloatProperty(name='R12', min=0.001, max=10, default=0.10, precision=3, description='Ring radio')
-
- top_height = bpy.props.FloatProperty(
+ bz01 = FloatProperty(name='S1', min=-1, max=1, default=0, precision=3, description='Z shift factor')
+ bz02 = FloatProperty(name='S2', min=-1, max=1, default=0, precision=3, description='Z shift factor')
+ bz03 = FloatProperty(name='S3', min=-1, max=1, default=0, precision=3, description='Z shift factor')
+ bz04 = FloatProperty(name='S4', min=-1, max=1, default=0, precision=3, description='Z shift factor')
+ bz05 = FloatProperty(name='S5', min=-1, max=1, default=0, precision=3, description='Z shift factor')
+ bz06 = FloatProperty(name='S6', min=-1, max=1, default=0, precision=3, description='Z shift factor')
+ bz07 = FloatProperty(name='S7', min=-1, max=1, default=0, precision=3, description='Z shift factor')
+ bz08 = FloatProperty(name='S8', min=-1, max=1, default=0, precision=3, description='Z shift factor')
+ bz09 = FloatProperty(name='S9', min=-1, max=1, default=0, precision=3, description='Z shift factor')
+ bz10 = FloatProperty(name='S10', min=-1, max=1, default=0, precision=3, description='Z shift factor')
+ bz11 = FloatProperty(name='S11', min=-1, max=1, default=0, precision=3, description='Z shift factor')
+ bz12 = FloatProperty(name='S12', min=-1, max=1, default=0, precision=3, description='Z shift factor')
+
+ br01 = FloatProperty(name='R1', min=0.001, max=10, default=0.06, precision=3, description='Ring radio')
+ br02 = FloatProperty(name='R2', min=0.001, max=10, default=0.08, precision=3, description='Ring radio')
+ br03 = FloatProperty(name='R3', min=0.001, max=10, default=0.09, precision=3, description='Ring radio')
+ br04 = FloatProperty(name='R4', min=0.001, max=10, default=0.08, precision=3, description='Ring radio')
+ br05 = FloatProperty(name='R5', min=0.001, max=10, default=0.06, precision=3, description='Ring radio')
+ br06 = FloatProperty(name='R6', min=0.001, max=10, default=0.03, precision=3, description='Ring radio')
+ br07 = FloatProperty(name='R7', min=0.001, max=10, default=0.10, precision=3, description='Ring radio')
+ br08 = FloatProperty(name='R8', min=0.001, max=10, default=0.10, precision=3, description='Ring radio')
+ br09 = FloatProperty(name='R9', min=0.001, max=10, default=0.10, precision=3, description='Ring radio')
+ br10 = FloatProperty(name='R10', min=0.001, max=10, default=0.10, precision=3, description='Ring radio')
+ br11 = FloatProperty(name='R11', min=0.001, max=10, default=0.10, precision=3, description='Ring radio')
+ br12 = FloatProperty(name='R12', min=0.001, max=10, default=0.10, precision=3, description='Ring radio')
+
+ top_height = FloatProperty(
name='Height', min=0.01, max=10,
default=0.20, precision=3,
description='lampshade height',
)
- top_segments = bpy.props.IntProperty(
+ top_segments = IntProperty(
name='Segments', min=3, max=128,
default=32,
description='Number of segments (vertical)',
)
- tr01 = bpy.props.FloatProperty(
+ tr01 = FloatProperty(
name='R1', min=0.001, max=10,
default=0.16, precision=3,
description='lampshade bottom radio',
)
- tr02 = bpy.props.FloatProperty(name='R2', min=0.001, max=10,
+ tr02 = FloatProperty(name='R2', min=0.001, max=10,
default=0.08, precision=3,
description='lampshade top radio')
- pleats = bpy.props.BoolProperty(
+ pleats = BoolProperty(
name="Pleats", description="Create pleats in the lampshade",
default=False,
)
- tr03 = bpy.props.FloatProperty(
+ tr03 = FloatProperty(
name='R3', min=0.001, max=1,
default=0.01, precision=3, description='Pleats size',
)
- energy = bpy.props.FloatProperty(
+ energy = FloatProperty(
name='Light', min=0.00, max=1000,
default=15, precision=3,
description='Light intensity',
)
- opacity = bpy.props.FloatProperty(
+ opacity = FloatProperty(
name='Translucency', min=0.00, max=1,
default=0.3, precision=3,
description='Lampshade translucency factor (1 completely translucent)',
)
# 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),
@@ -399,7 +401,7 @@ def create_lamp_mesh(self):
# ------------------------------------------------------------------------------
def generate_lamp(self):
location = bpy.context.scene.cursor_location
- myloc = copy.copy(location) # copy location to keep 3D cursor position
+ myloc = copy(location) # copy location to keep 3D cursor position
# ---------------------
# Lamp base
# ---------------------
@@ -738,8 +740,8 @@ def create_cylinder_data(segments, listheight, listradio, bottom, top, pleats, p
for z in listheight:
seg = 0
for i in range(segments):
- x = math.cos(math.radians(seg)) * (listradio[idx] + rp)
- y = math.sin(math.radians(seg)) * (listradio[idx] + rp)
+ x = cos(radians(seg)) * (listradio[idx] + rp)
+ y = sin(radians(seg)) * (listradio[idx] + rp)
mypoint = [(x, y, z)]
myvertex.extend(mypoint)
seg += 360 / segments
diff --git a/archimesh/achm_main_panel.py b/archimesh/achm_main_panel.py
index f665057a..70293df0 100644
--- a/archimesh/achm_main_panel.py
+++ b/archimesh/achm_main_panel.py
@@ -27,6 +27,7 @@
import bpy
# noinspection PyUnresolvedReferences
import bgl
+from bpy.types import Operator, Panel, SpaceView3D
from .achm_tools import *
from .achm_gltools import *
@@ -47,7 +48,7 @@ def isboolean(myobject, childobject):
# ------------------------------------------------------
# Button: Action to link windows and doors
# ------------------------------------------------------
-class AchmHoleAction(bpy.types.Operator):
+class AchmHoleAction(Operator):
bl_idname = "object.archimesh_cut_holes"
bl_label = "Auto Holes"
bl_description = "Enable windows and doors holes for any selected object (needs wall thickness)"
@@ -190,7 +191,7 @@ class AchmHoleAction(bpy.types.Operator):
# ------------------------------------------------------
# Button: Action to create room from grease pencil
# ------------------------------------------------------
-class AchmPencilAction(bpy.types.Operator):
+class AchmPencilAction(Operator):
bl_idname = "object.archimesh_pencil_room"
bl_label = "Room from Draw"
bl_description = "Create a room base on grease pencil strokes (draw from top view (7 key))"
@@ -394,7 +395,7 @@ class AchmPencilAction(bpy.types.Operator):
# ------------------------------------------------------------------
# Define panel class for main functions.
# ------------------------------------------------------------------
-class ArchimeshMainPanel(bpy.types.Panel):
+class ArchimeshMainPanel(Panel):
bl_idname = "archimesh_main_panel"
bl_label = "Archimesh"
bl_space_type = 'VIEW_3D'
@@ -520,7 +521,7 @@ class ArchimeshMainPanel(bpy.types.Panel):
# Defines button for enable/disable the tip display
#
# -------------------------------------------------------------
-class AchmRunHintDisplayButton(bpy.types.Operator):
+class AchmRunHintDisplayButton(Operator):
bl_idname = "archimesh.runopenglbutton"
bl_label = "Display hint data manager"
bl_description = "Display aditional information in the viewport"
@@ -534,7 +535,7 @@ class AchmRunHintDisplayButton(bpy.types.Operator):
@staticmethod
def handle_add(self, context):
if AchmRunHintDisplayButton._handle is None:
- AchmRunHintDisplayButton._handle = bpy.types.SpaceView3D.draw_handler_add(draw_callback_px, (self, context),
+ AchmRunHintDisplayButton._handle = SpaceView3D.draw_handler_add(draw_callback_px, (self, context),
'WINDOW',
'POST_PIXEL')
context.window_manager.archimesh_run_opengl = True
@@ -546,7 +547,7 @@ class AchmRunHintDisplayButton(bpy.types.Operator):
@staticmethod
def handle_remove(self, context):
if AchmRunHintDisplayButton._handle is not None:
- bpy.types.SpaceView3D.draw_handler_remove(AchmRunHintDisplayButton._handle, 'WINDOW')
+ SpaceView3D.draw_handler_remove(AchmRunHintDisplayButton._handle, 'WINDOW')
AchmRunHintDisplayButton._handle = None
context.window_manager.archimesh_run_opengl = False
diff --git a/archimesh/achm_roof_maker.py b/archimesh/achm_roof_maker.py
index c4330dfd..35d5a60d 100644
--- a/archimesh/achm_roof_maker.py
+++ b/archimesh/achm_roof_maker.py
@@ -25,7 +25,9 @@
# ----------------------------------------------------------
# noinspection PyUnresolvedReferences
import bpy
-import math
+from math import radians
+from bpy.types import Operator
+from bpy.props import IntProperty, FloatProperty, BoolProperty, EnumProperty
from .achm_tools import *
@@ -33,7 +35,7 @@ from .achm_tools import *
# Define UI class
# Rooms
# ------------------------------------------------------------------
-class AchmRoof(bpy.types.Operator):
+class AchmRoof(Operator):
bl_idname = "mesh.archimesh_roof"
bl_label = "Roof"
bl_description = "Roof Generator"
@@ -41,38 +43,38 @@ class AchmRoof(bpy.types.Operator):
bl_options = {'REGISTER', 'UNDO'}
# Define properties
- roof_width = bpy.props.IntProperty(
+ roof_width = IntProperty(
name='Num tiles X',
min=1, max=100, default=6,
description='Tiles in X axis',
)
- roof_height = bpy.props.IntProperty(
+ roof_height = IntProperty(
name='Num tiles Y',
min=1, max=100, default=3,
description='Tiles in Y axis',
)
- roof_thick = bpy.props.FloatProperty(
+ roof_thick = FloatProperty(
name='Tile thickness',
min=0.000, max=0.50, default=0.012, precision=3,
description='Thickness of the roof tile',
)
- roof_angle = bpy.props.FloatProperty(
+ roof_angle = FloatProperty(
name='Roof slope', min=0.0, max=70.0, default=0.0, precision=1,
description='Roof angle of slope',
)
- roof_scale = bpy.props.FloatProperty(
+ roof_scale = FloatProperty(
name='Tile scale', min=0.001, max=10, default=1, precision=3,
description='Scale of roof tile',
)
- crt_mat = bpy.props.BoolProperty(
+ crt_mat = BoolProperty(
name="Create default Cycles materials",
description="Create default materials for Cycles render",
default=True,
)
- model = bpy.props.EnumProperty(
+ model = EnumProperty(
items=(
('1', "Model 01", ""),
('2', "Model 02", ""),
@@ -198,7 +200,7 @@ def create_roof_mesh(self):
set_modifier_array(myroof, "Y", a_y, self.roof_height)
# Slope
- myroof.rotation_euler = (math.radians(self.roof_angle), 0.0, 0.0)
+ myroof.rotation_euler = (radians(self.roof_angle), 0.0, 0.0)
# Create materials
if self.crt_mat:
diff --git a/archimesh/achm_room_maker.py b/archimesh/achm_room_maker.py
index fec4d23d..36138ac0 100644
--- a/archimesh/achm_room_maker.py
+++ b/archimesh/achm_room_maker.py
@@ -25,20 +25,21 @@
# ----------------------------------------------------------
# noinspection PyUnresolvedReferences
import bpy
-import math
-# noinspection PyUnresolvedReferences
-import mathutils
-import datetime
-import time
-from .achm_tools import *
-# noinspection PyUnresolvedReferences
+from math import sin, cos, fabs, radians
+from mathutils import Vector
+from datetime import datetime
+from time import time
+from bpy.types import Operator, PropertyGroup, Object, Panel
+from bpy.props import StringProperty, FloatProperty, BoolProperty, IntProperty, FloatVectorProperty, \
+ CollectionProperty, EnumProperty
from bpy_extras.io_utils import ExportHelper, ImportHelper
+from .achm_tools import *
# ----------------------------------------------------------
# Export menu UI
# ----------------------------------------------------------
-class AchmExportRoom(bpy.types.Operator, ExportHelper):
+class AchmExportRoom(Operator, ExportHelper):
bl_idname = "io_export.roomdata"
bl_description = 'Export Room data (.dat)'
bl_category = 'Archimesh'
@@ -46,12 +47,12 @@ class AchmExportRoom(bpy.types.Operator, ExportHelper):
# From ExportHelper. Filter filenames.
filename_ext = ".dat"
- filter_glob = bpy.props.StringProperty(
+ filter_glob = StringProperty(
default="*.dat",
options={'HIDDEN'},
)
- filepath = bpy.props.StringProperty(
+ filepath = StringProperty(
name="File Path",
description="File path used for exporting room data file",
maxlen=1024, default="",
@@ -79,7 +80,7 @@ class AchmExportRoom(bpy.types.Operator, ExportHelper):
realpath = os.path.realpath(os.path.expanduser(self.properties.filepath))
fout = open(realpath, 'w')
- st = datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S')
+ st = datetime.fromtimestamp(time()).strftime('%Y-%m-%d %H:%M:%S')
fout.write("# Archimesh room export data\n")
fout.write("# " + st + "\n")
fout.write("#======================================================\n")
@@ -150,7 +151,7 @@ class AchmExportRoom(bpy.types.Operator, ExportHelper):
# ----------------------------------------------------------
# Import menu UI
# ----------------------------------------------------------
-class AchmImportRoom(bpy.types.Operator, ImportHelper):
+class AchmImportRoom(Operator, ImportHelper):
bl_idname = "io_import.roomdata"
bl_description = 'Import Room data (.dat)'
bl_category = 'Archimesh'
@@ -158,12 +159,12 @@ class AchmImportRoom(bpy.types.Operator, ImportHelper):
# From Helper. Filter filenames.
filename_ext = ".dat"
- filter_glob = bpy.props.StringProperty(
+ filter_glob = StringProperty(
default="*.dat",
options={'HIDDEN'},
)
- filepath = bpy.props.StringProperty(
+ filepath = StringProperty(
name="File Path",
description="File path used for exporting room data file",
maxlen=1024, default="",
@@ -310,7 +311,7 @@ class AchmImportRoom(bpy.types.Operator, ImportHelper):
# ------------------------------------------------------------------
# Define operator class to create rooms
# ------------------------------------------------------------------
-class AchmRoom(bpy.types.Operator):
+class AchmRoom(Operator):
bl_idname = "mesh.archimesh_room"
bl_label = "Room"
bl_description = "Generate room with walls, baseboard, floor and ceiling"
@@ -660,8 +661,8 @@ def make_wall(prv, wall, baseboard, lastface, lastx, lasty, height, myvertex, my
over = get_blendunits(over)
# Calculate size using angle
- sizex = math.cos(math.radians(angle)) * size
- sizey = math.sin(math.radians(angle)) * size
+ sizex = cos(radians(angle)) * size
+ sizey = sin(radians(angle)) * size
# Create faces
if advanced is False or baseboard is True:
@@ -697,13 +698,13 @@ def make_wall(prv, wall, baseboard, lastface, lastx, lasty, height, myvertex, my
else:
# Wall with peak and without curve.
mid = size / 2 + ((size / 2) * factor)
- midx = math.cos(math.radians(angle)) * mid
- midy = math.sin(math.radians(angle)) * mid
+ midx = cos(radians(angle)) * mid
+ midy = sin(radians(angle)) * mid
# first face
myvertex.extend([(lastx + midx, lasty + midy, height + over),
(lastx + midx, lasty + midy, 0.0)])
if check_visibility(hide, baseboard):
- if math.fabs(factor) != 1:
+ if fabs(factor) != 1:
if prv is False:
# Previous no advance or advance with curve
myfaces.extend([(lastface, lastface + 2, lastface + 3, lastface + 1)])
@@ -714,7 +715,7 @@ def make_wall(prv, wall, baseboard, lastface, lastx, lasty, height, myvertex, my
myvertex.extend([(lastx + sizex, lasty + sizey, 0.0),
(lastx + sizex, lasty + sizey, height)])
if check_visibility(hide, baseboard):
- if math.fabs(factor) != 1:
+ if fabs(factor) != 1:
myfaces.extend([(lastface + 2, lastface + 3, lastface + 4, lastface + 5)])
else:
if prv is False:
@@ -764,12 +765,12 @@ def make_curved_wall(myvertex, myfaces, size, wall_angle, lastx, lasty, height,
curvex = None
curvey = None
# Calculate size using angle
- sizex = math.cos(math.radians(wall_angle)) * size
- sizey = math.sin(math.radians(wall_angle)) * size
+ sizex = cos(radians(wall_angle)) * size
+ sizey = sin(radians(wall_angle)) * size
for step in range(0, arc_angle + step_angle, step_angle):
- curvex = sizex / 2 - math.cos(math.radians(step + wall_angle)) * size / 2
- curvey = sizey / 2 - math.sin(math.radians(step + wall_angle)) * size / 2
+ curvex = sizex / 2 - cos(radians(step + wall_angle)) * size / 2
+ curvey = sizey / 2 - sin(radians(step + wall_angle)) * size / 2
curvey = curvey * curve_factor
myvertex.extend([(lastx + curvex, lasty + curvey, height),
(lastx + curvex, lasty + curvey, 0.0)])
@@ -831,8 +832,8 @@ def create_floor(rp, typ, myroom):
# ------------------------------------------------------------------
# Define property group class to create, or modify, room walls.
# ------------------------------------------------------------------
-class WallProperties(bpy.types.PropertyGroup):
- w = bpy.props.FloatProperty(
+class WallProperties(PropertyGroup):
+ w = FloatProperty(
name='Length',
min=-150, max=150,
default=1, precision=3,
@@ -840,33 +841,33 @@ class WallProperties(bpy.types.PropertyGroup):
update=update_room,
)
- a = bpy.props.BoolProperty(
+ a = BoolProperty(
name="Advance",
description="Define advance parameters of the wall",
default=False,
update=update_room,
)
- curved = bpy.props.BoolProperty(
+ curved = BoolProperty(
name="Curved",
description="Enable curved wall parameters",
default=False,
update=update_room,
)
- curve_factor = bpy.props.FloatProperty(
+ curve_factor = FloatProperty(
name='Factor',
min=-5, max=5,
default=1, precision=1,
description='Curvature variation',
update=update_room,
)
- curve_arc_deg = bpy.props.FloatProperty(
+ curve_arc_deg = FloatProperty(
name='Degrees', min=1, max=359,
default=180, precision=1,
description='Degrees of the curve arc (must be >= steps)',
update=update_room,
)
- curve_steps = bpy.props.IntProperty(
+ curve_steps = IntProperty(
name='Steps',
min=2, max=50,
default=12,
@@ -874,19 +875,19 @@ class WallProperties(bpy.types.PropertyGroup):
update=update_room,
)
- m = bpy.props.FloatProperty(
+ m = FloatProperty(
name='Peak', min=0, max=50,
default=0, precision=3,
description='Middle height variation',
update=update_room,
)
- f = bpy.props.FloatProperty(
+ f = FloatProperty(
name='Factor', min=-1, max=1,
default=0, precision=3,
description='Middle displacement',
update=update_room,
)
- r = bpy.props.FloatProperty(
+ r = FloatProperty(
name='Angle',
min=-180, max=180,
default=0, precision=1,
@@ -894,7 +895,7 @@ class WallProperties(bpy.types.PropertyGroup):
update=update_room,
)
- h = bpy.props.EnumProperty(
+ h = EnumProperty(
items=(
('0', "Visible", ""),
('1', "Baseboard", ""),
@@ -907,12 +908,12 @@ class WallProperties(bpy.types.PropertyGroup):
)
# opengl internal data
- glpoint_a = bpy.props.FloatVectorProperty(
+ glpoint_a = FloatVectorProperty(
name="glpointa",
description="Hidden property for opengl",
default=(0, 0, 0),
)
- glpoint_b = bpy.props.FloatVectorProperty(
+ glpoint_b = FloatVectorProperty(
name="glpointb",
description="Hidden property for opengl",
default=(0, 0, 0),
@@ -1167,13 +1168,13 @@ def add_shell(selobject, objname, rp):
# pf: Comparision face +/-
# ---------------------------------------------------------
def project_point(idx, point, normals, m, pf):
- v1 = mathutils.Vector(normals[idx])
+ v1 = Vector(normals[idx])
if idx + pf >= len(normals):
vf = v1
elif idx + pf < 0:
vf = v1
else:
- v2 = mathutils.Vector(normals[idx + pf])
+ v2 = Vector(normals[idx + pf])
if v1 != v2:
vf = v1 + v2
vf.normalize() # must be length equal to 1
@@ -1496,98 +1497,98 @@ def is_in_nextface(idx, activefaces, verts, x, y):
# ------------------------------------------------------------------
# Define property group class to create or modify a rooms.
# ------------------------------------------------------------------
-class RoomProperties(bpy.types.PropertyGroup):
- room_height = bpy.props.FloatProperty(
+class RoomProperties(PropertyGroup):
+ room_height = FloatProperty(
name='Height', min=0.001, max=50,
default=2.4, precision=3,
description='Room height', update=update_room,
)
- wall_width = bpy.props.FloatProperty(
+ wall_width = FloatProperty(
name='Thickness', min=0.000, max=10,
default=0.0, precision=3,
description='Thickness of the walls', update=update_room,
)
- inverse = bpy.props.BoolProperty(
+ inverse = BoolProperty(
name="Inverse", description="Inverse normals to outside",
default=False,
update=update_room,
)
- crt_mat = bpy.props.BoolProperty(
+ crt_mat = BoolProperty(
name="Create default Cycles materials",
description="Create default materials for Cycles render",
default=True,
update=update_room,
)
- wall_num = bpy.props.IntProperty(
+ wall_num = IntProperty(
name='Number of Walls', min=1, max=50,
default=1,
description='Number total of walls in the room', update=add_room_wall,
)
- baseboard = bpy.props.BoolProperty(
+ baseboard = BoolProperty(
name="Baseboard", description="Create a baseboard automatically",
default=True,
update=update_room,
)
- base_width = bpy.props.FloatProperty(
+ base_width = FloatProperty(
name='Width', min=0.001, max=10,
default=0.015, precision=3,
description='Baseboard width', update=update_room,
)
- base_height = bpy.props.FloatProperty(
+ base_height = FloatProperty(
name='Height', min=0.05, max=20,
default=0.12, precision=3,
description='Baseboard height', update=update_room,
)
- ceiling = bpy.props.BoolProperty(
+ ceiling = BoolProperty(
name="Ceiling", description="Create a ceiling",
default=False, update=update_room,
)
- floor = bpy.props.BoolProperty(
+ floor = BoolProperty(
name="Floor", description="Create a floor automatically",
default=False,
update=update_room,
)
- merge = bpy.props.BoolProperty(
+ merge = BoolProperty(
name="Close walls", description="Close walls to create a full closed room",
default=False, update=update_room,
)
- walls = bpy.props.CollectionProperty(
+ walls = CollectionProperty(
type=WallProperties,
)
- shell = bpy.props.BoolProperty(
+ shell = BoolProperty(
name="Wall cover", description="Create a cover of boards",
default=False, update=update_room,
)
- shell_thick = bpy.props.FloatProperty(
+ shell_thick = FloatProperty(
name='Thickness', min=0.001, max=1,
default=0.025, precision=3,
description='Cover board thickness', update=update_room,
)
- shell_height = bpy.props.FloatProperty(
+ shell_height = FloatProperty(
name='Height', min=0.05, max=1,
default=0.20, precision=3,
description='Cover board height', update=update_room,
)
- shell_factor = bpy.props.FloatProperty(
+ shell_factor = FloatProperty(
name='Top', min=0.1, max=1,
default=1, precision=1,
description='Percentage for top covering (1 Full)', update=update_room,
)
- shell_bfactor = bpy.props.FloatProperty(
+ shell_bfactor = FloatProperty(
name='Bottom', min=0.1, max=1,
default=1, precision=1,
description='Percentage for bottom covering (1 Full)', update=update_room,
)
bpy.utils.register_class(RoomProperties)
-bpy.types.Object.RoomGenerator = bpy.props.CollectionProperty(type=RoomProperties)
+Object.RoomGenerator = CollectionProperty(type=RoomProperties)
# -----------------------------------------------------
@@ -1620,7 +1621,7 @@ def add_wall(idx, box, wall):
# ------------------------------------------------------------------
# Define panel class to modify rooms.
# ------------------------------------------------------------------
-class AchmRoomGeneratorPanel(bpy.types.Panel):
+class AchmRoomGeneratorPanel(Panel):
bl_idname = "OBJECT_PT_room_generator"
bl_label = "Room"
bl_space_type = 'VIEW_3D'
diff --git a/archimesh/achm_shelves_maker.py b/archimesh/achm_shelves_maker.py
index 704ae485..0bc0b299 100644
--- a/archimesh/achm_shelves_maker.py
+++ b/archimesh/achm_shelves_maker.py
@@ -24,42 +24,44 @@
#
# ----------------------------------------------------------
import bpy
-import copy
+from copy import copy
+from bpy.types import Operator, PropertyGroup
+from bpy.props import FloatProperty, BoolProperty, IntProperty, CollectionProperty, EnumProperty
from .achm_tools import *
# ------------------------------------------------------------------
# Define property group class for shelves properties
# ------------------------------------------------------------------
-class ShelvesProperties(bpy.types.PropertyGroup):
- sX = bpy.props.FloatProperty(name='width', min=0.001, max=10, default=1,
- precision=3, description='Furniture width')
- wY = bpy.props.FloatProperty(name='', min=-10, max=10, default=0, precision=3, description='Modify y size')
- wZ = bpy.props.FloatProperty(name='', min=-10, max=10, default=0, precision=3, description='Modify z size')
+class ShelvesProperties(PropertyGroup):
+ sX = FloatProperty(name='width', min=0.001, max=10, default=1,
+ precision=3, description='Furniture width')
+ wY = FloatProperty(name='', min=-10, max=10, default=0, precision=3, description='Modify y size')
+ wZ = FloatProperty(name='', min=-10, max=10, default=0, precision=3, description='Modify z size')
# Cabinet position shift
- pX = bpy.props.FloatProperty(name='', min=0, max=10, default=0, precision=3, description='Position x shift')
- pY = bpy.props.FloatProperty(name='', min=-10, max=10, default=0, precision=3, description='Position y shift')
- pZ = bpy.props.FloatProperty(name='', min=-10, max=10, default=0, precision=3, description='Position z shift')
+ pX = FloatProperty(name='', min=0, max=10, default=0, precision=3, description='Position x shift')
+ pY = FloatProperty(name='', min=-10, max=10, default=0, precision=3, description='Position y shift')
+ pZ = FloatProperty(name='', min=-10, max=10, default=0, precision=3, description='Position z shift')
# Shelves
- sNum = bpy.props.IntProperty(name='Shelves', min=0, max=12, default=6, description='Number total of shelves')
+ sNum = IntProperty(name='Shelves', min=0, max=12, default=6, description='Number total of shelves')
# 12 shelves (shelf)
- Z01 = bpy.props.FloatProperty(name='zS1', min=-10, max=10, default=0, precision=3, description='Position z shift')
- Z02 = bpy.props.FloatProperty(name='zS2', min=-10, max=10, default=0, precision=3, description='Position z shift')
- Z03 = bpy.props.FloatProperty(name='zS3', min=-10, max=10, default=0, precision=3, description='Position z shift')
- Z04 = bpy.props.FloatProperty(name='zS4', min=-10, max=10, default=0, precision=3, description='Position z shift')
- Z05 = bpy.props.FloatProperty(name='zS5', min=-10, max=10, default=0, precision=3, description='Position z shift')
- Z06 = bpy.props.FloatProperty(name='zS6', min=-10, max=10, default=0, precision=3, description='Position z shift')
- Z07 = bpy.props.FloatProperty(name='zS7', min=-10, max=10, default=0, precision=3, description='Position z shift')
- Z08 = bpy.props.FloatProperty(name='zS8', min=-10, max=10, default=0, precision=3, description='Position z shift')
- Z09 = bpy.props.FloatProperty(name='zS9', min=-10, max=10, default=0, precision=3, description='Position z shift')
- Z10 = bpy.props.FloatProperty(name='zS10', min=-10, max=10, default=0, precision=3, description='Position z shift')
- Z11 = bpy.props.FloatProperty(name='zS11', min=-10, max=10, default=0, precision=3, description='Position z shift')
- Z12 = bpy.props.FloatProperty(name='zS12', min=-10, max=10, default=0, precision=3, description='Position z shift')
-
- right = bpy.props.BoolProperty(name="Right", description="Create right side", default=True)
- left = bpy.props.BoolProperty(name="Left", description="Create left side", default=True)
+ Z01 = FloatProperty(name='zS1', min=-10, max=10, default=0, precision=3, description='Position z shift')
+ Z02 = FloatProperty(name='zS2', min=-10, max=10, default=0, precision=3, description='Position z shift')
+ Z03 = FloatProperty(name='zS3', min=-10, max=10, default=0, precision=3, description='Position z shift')
+ Z04 = FloatProperty(name='zS4', min=-10, max=10, default=0, precision=3, description='Position z shift')
+ Z05 = FloatProperty(name='zS5', min=-10, max=10, default=0, precision=3, description='Position z shift')
+ Z06 = FloatProperty(name='zS6', min=-10, max=10, default=0, precision=3, description='Position z shift')
+ Z07 = FloatProperty(name='zS7', min=-10, max=10, default=0, precision=3, description='Position z shift')
+ Z08 = FloatProperty(name='zS8', min=-10, max=10, default=0, precision=3, description='Position z shift')
+ Z09 = FloatProperty(name='zS9', min=-10, max=10, default=0, precision=3, description='Position z shift')
+ Z10 = FloatProperty(name='zS10', min=-10, max=10, default=0, precision=3, description='Position z shift')
+ Z11 = FloatProperty(name='zS11', min=-10, max=10, default=0, precision=3, description='Position z shift')
+ Z12 = FloatProperty(name='zS12', min=-10, max=10, default=0, precision=3, description='Position z shift')
+
+ right = BoolProperty(name="Right", description="Create right side", default=True)
+ left = BoolProperty(name="Left", description="Create left side", default=True)
bpy.utils.register_class(ShelvesProperties)
@@ -68,44 +70,44 @@ bpy.utils.register_class(ShelvesProperties)
# Define UI class
# Shelves
# ------------------------------------------------------------------
-class AchmShelves(bpy.types.Operator):
+class AchmShelves(Operator):
bl_idname = "mesh.archimesh_shelves"
bl_label = "Shelves"
bl_description = "Shelves Generator"
bl_category = 'Archimesh'
bl_options = {'REGISTER', 'UNDO'}
- thickness = bpy.props.FloatProperty(
+ thickness = FloatProperty(
name='Side Thickness', min=0.001, max=5,
default=0.03, precision=3,
description='Board thickness',
)
- sthickness = bpy.props.FloatProperty(
+ sthickness = FloatProperty(
name='Shelves Thickness', min=0.001, max=5,
default=0.03, precision=3,
description='Board thickness',
)
- depth = bpy.props.FloatProperty(
+ depth = FloatProperty(
name='Depth', min=0.001, max=50,
default=0.28, precision=3,
description='Default unit depth',
)
- height = bpy.props.FloatProperty(
+ height = FloatProperty(
name='Height', min=0.001, max=50,
default=2, precision=3,
description='Default unit height',
)
- top = bpy.props.FloatProperty(
+ top = FloatProperty(
name='Top', min=0, max=50,
default=0.03, precision=3,
description='Default top shelf position',
)
- bottom = bpy.props.FloatProperty(
+ bottom = FloatProperty(
name='Bottom', min=0, max=50,
default=0.07, precision=3,
description='Default bottom self position',
)
- stype = bpy.props.EnumProperty(
+ stype = EnumProperty(
items=(
('1', "Full side", ""),
('4', "4 Legs", ""),
@@ -114,22 +116,22 @@ class AchmShelves(bpy.types.Operator):
description="Type of side construction",
)
- fitZ = bpy.props.BoolProperty(
+ fitZ = BoolProperty(
name="Floor origin in Z=0",
description="Use Z=0 axis as vertical origin floor position",
default=True,
)
- shelves_num = bpy.props.IntProperty(
+ shelves_num = IntProperty(
name='Number of Units',
min=1, max=10,
default=1,
description='Number total of shelves units',
)
- shelves = bpy.props.CollectionProperty(type=ShelvesProperties)
+ shelves = CollectionProperty(type=ShelvesProperties)
# Materials
- crt_mat = bpy.props.BoolProperty(
+ crt_mat = BoolProperty(
name="Create default Cycles materials",
description="Create default materials for Cycles render",
default=True,
@@ -275,7 +277,7 @@ def generate_shelves(self):
boxes = []
location = bpy.context.scene.cursor_location
- myloc = copy.copy(location) # copy location to keep 3D cursor position
+ myloc = copy(location) # copy location to keep 3D cursor position
# Fit to floor
if self.fitZ:
myloc[2] = 0
diff --git a/archimesh/achm_stairs_maker.py b/archimesh/achm_stairs_maker.py
index 78ab57f1..e293dad1 100644
--- a/archimesh/achm_stairs_maker.py
+++ b/archimesh/achm_stairs_maker.py
@@ -25,7 +25,9 @@
# ----------------------------------------------------------
# noinspection PyUnresolvedReferences
import bpy
-import math
+from math import radians, sin, cos
+from bpy.types import Operator
+from bpy.props import FloatProperty, BoolProperty, IntProperty, EnumProperty
from .achm_tools import *
@@ -33,7 +35,7 @@ from .achm_tools import *
# Define UI class
# Stairs
# ------------------------------------------------------------------
-class AchmStairs(bpy.types.Operator):
+class AchmStairs(Operator):
bl_idname = "mesh.archimesh_stairs"
bl_label = "Stairs"
bl_description = "Stairs Generator"
@@ -41,7 +43,7 @@ class AchmStairs(bpy.types.Operator):
bl_options = {'REGISTER', 'UNDO'}
# Define properties
- model = bpy.props.EnumProperty(
+ model = EnumProperty(
items=(
('1', "Rectangular", ""),
('2', "Rounded", ""),
@@ -49,85 +51,85 @@ class AchmStairs(bpy.types.Operator):
name="Model",
description="Type of steps",
)
- radio = bpy.props.FloatProperty(
+ radio = FloatProperty(
name='',
min=0.001, max=0.500,
default=0.20, precision=3,
description='Radius factor for rounded',
)
- curve = bpy.props.BoolProperty(
+ curve = BoolProperty(
name="Include deformation handles",
description="Include a curve to modify the stairs curve",
default=False,
)
- step_num = bpy.props.IntProperty(
+ step_num = IntProperty(
name='Number of steps',
min=1, max=1000,
default=3,
description='Number total of steps',
)
- max_width = bpy.props.FloatProperty(
+ max_width = FloatProperty(
name='Width',
min=0.001, max=10,
default=1, precision=3,
description='Step maximum width',
)
- depth = bpy.props.FloatProperty(
+ depth = FloatProperty(
name='Depth',
min=0.001, max=10,
default=0.30, precision=3,
description='Depth of the step',
)
- shift = bpy.props.FloatProperty(
+ shift = FloatProperty(
name='Shift',
min=0.001, max=1,
default=1, precision=3,
description='Step shift in Y axis',
)
- thickness = bpy.props.FloatProperty(
+ thickness = FloatProperty(
name='Thickness',
min=0.001, max=10,
default=0.03, precision=3,
description='Step thickness',
)
- sizev = bpy.props.BoolProperty(
+ sizev = BoolProperty(
name="Variable width",
description="Steps are not equal in width",
default=False,
)
- back = bpy.props.BoolProperty(
+ back = BoolProperty(
name="Close sides",
description="Close all steps side to make a solid structure",
default=False,
)
- min_width = bpy.props.FloatProperty(
+ min_width = FloatProperty(
name='',
min=0.001, max=10,
default=1, precision=3,
description='Step minimum width',
)
- height = bpy.props.FloatProperty(
+ height = FloatProperty(
name='height',
min=0.001, max=10,
default=0.14, precision=3,
description='Step height',
)
- front_gap = bpy.props.FloatProperty(
+ front_gap = FloatProperty(
name='Front',
min=0, max=10,
default=0.03,
precision=3,
description='Front gap',
)
- side_gap = bpy.props.FloatProperty(
+ side_gap = FloatProperty(
name='Side',
min=0, max=10,
default=0, precision=3,
description='Side gap',
)
- crt_mat = bpy.props.BoolProperty(
+ crt_mat = BoolProperty(
name="Create default Cycles materials",
description="Create default materials for Cycles render",
default=True,
@@ -335,8 +337,8 @@ def create_round_step(self, origin, myvertex, myfaces, index, step):
z = origin[2]
pos_x = None
i = index
- li = [math.radians(270), math.radians(288), math.radians(306), math.radians(324), math.radians(342),
- math.radians(0)]
+ li = [radians(270), radians(288), radians(306), radians(324), radians(342),
+ radians(0)]
max_width = self.max_width
max_depth = y + self.depth
@@ -358,8 +360,8 @@ def create_round_step(self, origin, myvertex, myfaces, index, step):
myvertex.extend([(x, y, z), (x, y, z + self.height)])
# Round
for e in li:
- pos_x = (math.cos(e) * myradio) + x + width - myradio
- pos_y = (math.sin(e) * myradio) + y + myradio
+ pos_x = (cos(e) * myradio) + x + width - myradio
+ pos_y = (sin(e) * myradio) + y + myradio
myvertex.extend([(pos_x, pos_y, z), (pos_x, pos_y, z + self.height)])
@@ -382,8 +384,8 @@ def create_round_step(self, origin, myvertex, myfaces, index, step):
myvertex.extend([(x, y - self.front_gap, z), (x, y - self.front_gap, z + self.thickness)])
# Round
for e in li:
- pos_x = (math.cos(e) * myradio) + x + width - myradio
- pos_y = (math.sin(e) * myradio) + y + myradio - self.front_gap
+ pos_x = (cos(e) * myradio) + x + width - myradio
+ pos_y = (sin(e) * myradio) + y + myradio - self.front_gap
myvertex.extend([(pos_x, pos_y, z), (pos_x, pos_y, z + self.thickness)])
@@ -416,7 +418,7 @@ def create_bezier(objname, points, origin):
myobject = bpy.data.objects.new(objname, curvedata)
myobject.location = origin
- myobject.rotation_euler[2] = math.radians(90)
+ myobject.rotation_euler[2] = radians(90)
bpy.context.scene.objects.link(myobject)
diff --git a/archimesh/achm_tools.py b/archimesh/achm_tools.py
index 7af503ef..3ae6618a 100644
--- a/archimesh/achm_tools.py
+++ b/archimesh/achm_tools.py
@@ -25,7 +25,7 @@
# ----------------------------------------------------------
# noinspection PyUnresolvedReferences
import bpy
-import os
+from os import path
# --------------------------------------------------------------------
@@ -857,7 +857,7 @@ def create_fabric_material(matname, replace, r, g, b, rv=0.8, gv=0.636, bv=0.315
# ===========================================================================
# Load image file.
- realpath = os.path.join(os.path.dirname(__file__), "images", "fabric_diffuse.png")
+ realpath = path.join(path.dirname(__file__), "images", "fabric_diffuse.png")
print("Loading: " + realpath)
try:
img = bpy.data.images.load(realpath)
diff --git a/archimesh/achm_venetian_maker.py b/archimesh/achm_venetian_maker.py
index 4e8ae336..107e2e7b 100644
--- a/archimesh/achm_venetian_maker.py
+++ b/archimesh/achm_venetian_maker.py
@@ -24,16 +24,17 @@
# ----------------------------------------------------------
# noinspection PyUnresolvedReferences
import bpy
-import math
+from math import atan, sin, cos, radians
# noinspection PyUnresolvedReferences
-from bpy.props import *
+from bpy.types import Operator, PropertyGroup, Object, Panel
+from bpy.props import FloatProperty, BoolProperty, IntProperty, FloatVectorProperty, CollectionProperty
from .achm_tools import *
# ------------------------------------------------------------------
# Define operator class to create object
# ------------------------------------------------------------------
-class AchmVenetian(bpy.types.Operator):
+class AchmVenetian(Operator):
bl_idname = "mesh.archimesh_venetian"
bl_label = "Venetian blind"
bl_description = "Venetian"
@@ -209,7 +210,7 @@ def shape_mesh_and_create_children(mainobject, tmp_mesh, update=False):
# Strings (Front)
# ------------------------
myp = [((0, 0, margin), (0, 0, 0), (0, 0, 0)),
- ((0, 0, mypoints[len(mypoints) - 1] - 0.003 - math.sin(math.radians(angleused)) * mp.depth / 2), (0, 0, 0),
+ ((0, 0, mypoints[len(mypoints) - 1] - 0.003 - sin(radians(angleused)) * mp.depth / 2), (0, 0, 0),
(0, 0, 0))]
mycurvelf = create_bezier("String.f.L", myp, (0, 0, 0), 0.001, 'FRONT')
@@ -225,15 +226,15 @@ def shape_mesh_and_create_children(mainobject, tmp_mesh, update=False):
sep = 0.148
mycurvelf.location.x = (mp.width / 2) - sep
- mycurvelf.location.y = ((-mp.depth / 2) * math.cos(math.radians(mp.angle))) - 0.001
+ mycurvelf.location.y = ((-mp.depth / 2) * cos(radians(mp.angle))) - 0.001
mycurvelf.location.z = 0
mycurvecf.location.x = 0
- mycurvecf.location.y = ((-mp.depth / 2) * math.cos(math.radians(mp.angle))) - 0.001
+ mycurvecf.location.y = ((-mp.depth / 2) * cos(radians(mp.angle))) - 0.001
mycurvecf.location.z = 0
mycurverf.location.x = -(mp.width / 2) + sep
- mycurverf.location.y = ((-mp.depth / 2) * math.cos(math.radians(mp.angle))) - 0.001
+ mycurverf.location.y = ((-mp.depth / 2) * cos(radians(mp.angle))) - 0.001
mycurverf.location.z = 0
if mp.crt_mat:
@@ -245,7 +246,7 @@ def shape_mesh_and_create_children(mainobject, tmp_mesh, update=False):
# Strings (Back)
# ------------------------
myp = [((0, 0, margin), (0, 0, 0), (0, 0, 0)),
- ((0, 0, mypoints[len(mypoints) - 1] - 0.003 + math.sin(math.radians(angleused)) * mp.depth / 2),
+ ((0, 0, mypoints[len(mypoints) - 1] - 0.003 + sin(radians(angleused)) * mp.depth / 2),
(0, 0, 0),
(0, 0, 0))]
@@ -262,15 +263,15 @@ def shape_mesh_and_create_children(mainobject, tmp_mesh, update=False):
sep = 0.148
mycurvelb.location.x = (mp.width / 2) - sep
- mycurvelb.location.y = ((mp.depth / 2) * math.cos(math.radians(mp.angle))) + 0.001
+ mycurvelb.location.y = ((mp.depth / 2) * cos(radians(mp.angle))) + 0.001
mycurvelb.location.z = 0
mycurvecb.location.x = 0
- mycurvecb.location.y = ((mp.depth / 2) * math.cos(math.radians(mp.angle))) + 0.001
+ mycurvecb.location.y = ((mp.depth / 2) * cos(radians(mp.angle))) + 0.001
mycurvecb.location.z = 0
mycurverb.location.x = -(mp.width / 2) + sep
- mycurverb.location.y = ((mp.depth / 2) * math.cos(math.radians(mp.angle))) + 0.001
+ mycurverb.location.y = ((mp.depth / 2) * cos(radians(mp.angle))) + 0.001
mycurverb.location.z = 0
if mp.crt_mat:
@@ -286,7 +287,7 @@ def shape_mesh_and_create_children(mainobject, tmp_mesh, update=False):
mybase.location.x = 0
mybase.location.y = 0
mybase.location.z = mypoints[len(mypoints) - 1]
- mybase.rotation_euler = (math.radians(angleused), 0, 0)
+ mybase.rotation_euler = (radians(angleused), 0, 0)
# materials
if mp.crt_mat:
@@ -326,39 +327,39 @@ def shape_mesh_and_create_children(mainobject, tmp_mesh, update=False):
# ------------------------------------------------------------------
# Define property group class to create or modify
# ------------------------------------------------------------------
-class ObjectProperties(bpy.types.PropertyGroup):
- width = bpy.props.FloatProperty(
+class ObjectProperties(PropertyGroup):
+ width = FloatProperty(
name='Width',
min=0.30, max=4, default=1, precision=3,
description='Total width', update=update_object,
)
- height = bpy.props.FloatProperty(
+ height = FloatProperty(
name='Height',
min=0.20, max=10, default=1.7, precision=3,
description='Total height',
update=update_object,
)
- depth = bpy.props.FloatProperty(
+ depth = FloatProperty(
name='Slat depth', min=0.02, max=0.30, default=0.04,
precision=3,
description='Slat depth', update=update_object,
)
- angle = bpy.props.FloatProperty(
+ angle = FloatProperty(
name='Angle', min=0, max=85, default=0, precision=1,
description='Angle of the slats', update=update_object,
)
- ratio = bpy.props.IntProperty(
+ ratio = IntProperty(
name='Extend', min=0, max=100, default=100,
description='% of extension (100 full extend)', update=update_object,
)
# Materials
- crt_mat = bpy.props.BoolProperty(
+ crt_mat = BoolProperty(
name="Create default Cycles materials",
description="Create default materials for Cycles render",
default=True, update=update_object,
)
- objcol = bpy.props.FloatVectorProperty(
+ objcol = FloatVectorProperty(
name="Color",
description="Color for material",
default=(0.616, 0.435, 1.0, 1.0),
@@ -369,13 +370,13 @@ class ObjectProperties(bpy.types.PropertyGroup):
# Register
bpy.utils.register_class(ObjectProperties)
-bpy.types.Object.VenetianObjectGenerator = bpy.props.CollectionProperty(type=ObjectProperties)
+Object.VenetianObjectGenerator = CollectionProperty(type=ObjectProperties)
# ------------------------------------------------------------------
# Define panel class to modify object
# ------------------------------------------------------------------
-class AchmVenetianObjectgeneratorpanel(bpy.types.Panel):
+class AchmVenetianObjectgeneratorpanel(Panel):
bl_idname = "OBJECT_PT_venetian_generator"
bl_label = "Venetian"
bl_space_type = 'VIEW_3D'
@@ -508,7 +509,7 @@ def create_slat_mesh(objname, width, depth, height, angle, ratio):
posz -= gap
# Transition to horizontal
if angleused == angle / 2:
- sinheight = math.sin(math.radians(angle / 2)) * depth / 2
+ sinheight = sin(radians(angle / 2)) * depth / 2
posz -= sinheight
mesh = bpy.data.meshes.new(objname)
@@ -542,9 +543,9 @@ def get_slat_data(v, angle, width, depth, posz):
maxz = 0.0028
gap = 0.0025
radio = 0.00195
- sinv = math.sin(math.atan(maxz / (maxy - gap)))
- cos = math.cos(math.radians(angle))
- sin = math.sin(math.radians(angle))
+ sinv = sin(atan(maxz / (maxy - gap)))
+ cos_value = cos(radians(angle))
+ sin_value = sin(radians(angle))
if width < 0.60:
sep = 0.06
@@ -557,48 +558,48 @@ def get_slat_data(v, angle, width, depth, posz):
myvertex = []
myvertex.extend(
- [(maxx - 0.0017, (miny + 0.00195) * cos, posz + (-maxz + (radio * sinv)) + ((miny + 0.00195) * sin)),
- (maxx - 0.0017, (maxy - 0.00195) * cos, posz + (-maxz + (radio * sinv)) + ((maxy - 0.00195) * sin)),
- (maxx - 0.0045, miny * cos, posz + -maxz + (miny * sin)),
- (maxx - 0.0045, maxy * cos, posz + -maxz + (maxy * sin)),
- (maxx, -gap * cos, posz + (-gap * sin)),
- (maxx, gap * cos, posz + (gap * sin)),
- (maxx - 0.0045, -gap * cos, posz + (-gap * sin)),
- (maxx - 0.0045, gap * cos, posz + (gap * sin)),
- (0.001172, miny * cos, posz + -maxz + (miny * sin)),
- (0.001172, maxy * cos, posz + -maxz + (maxy * sin)),
- (0.001172, -gap * cos, posz + (-gap * sin)),
- (0.001172, gap * cos, posz + (gap * sin)),
- (maxx - sep, miny * cos, posz + -maxz + (miny * sin)),
- (maxx - sep, maxy * cos, posz + -maxz + (maxy * sin)),
- (maxx - sep, -gap * cos, posz + (-gap * sin)),
- (maxx - sep, gap * cos, posz + (gap * sin)),
- (maxx - sep2, miny * cos, posz + -maxz + (miny * sin)),
- (maxx - sep2, maxy * cos, posz + -maxz + (maxy * sin)),
- (maxx - sep2, -gap * cos, posz + (-gap * sin)),
- (maxx - sep2, gap * cos, posz + (gap * sin))])
+ [(maxx - 0.0017, (miny + 0.00195) * cos_value, posz + (-maxz + (radio * sinv)) + ((miny + 0.00195) * sin_value)),
+ (maxx - 0.0017, (maxy - 0.00195) * cos_value, posz + (-maxz + (radio * sinv)) + ((maxy - 0.00195) * sin_value)),
+ (maxx - 0.0045, miny * cos_value, posz + -maxz + (miny * sin_value)),
+ (maxx - 0.0045, maxy * cos_value, posz + -maxz + (maxy * sin_value)),
+ (maxx, -gap * cos_value, posz + (-gap * sin_value)),
+ (maxx, gap * cos_value, posz + (gap * sin_value)),
+ (maxx - 0.0045, -gap * cos_value, posz + (-gap * sin_value)),
+ (maxx - 0.0045, gap * cos_value, posz + (gap * sin_value)),
+ (0.001172, miny * cos_value, posz + -maxz + (miny * sin_value)),
+ (0.001172, maxy * cos_value, posz + -maxz + (maxy * sin_value)),
+ (0.001172, -gap * cos_value, posz + (-gap * sin_value)),
+ (0.001172, gap * cos_value, posz + (gap * sin_value)),
+ (maxx - sep, miny * cos_value, posz + -maxz + (miny * sin_value)),
+ (maxx - sep, maxy * cos_value, posz + -maxz + (maxy * sin_value)),
+ (maxx - sep, -gap * cos_value, posz + (-gap * sin_value)),
+ (maxx - sep, gap * cos_value, posz + (gap * sin_value)),
+ (maxx - sep2, miny * cos_value, posz + -maxz + (miny * sin_value)),
+ (maxx - sep2, maxy * cos_value, posz + -maxz + (maxy * sin_value)),
+ (maxx - sep2, -gap * cos_value, posz + (-gap * sin_value)),
+ (maxx - sep2, gap * cos_value, posz + (gap * sin_value))])
myvertex.extend(
- [(-maxx + 0.0017, (miny + 0.00195) * cos, posz + (-maxz + (radio * sinv)) + ((miny + 0.00195) * sin)),
- (-maxx + 0.0017, (maxy - 0.00195) * cos, posz + (-maxz + (radio * sinv)) + ((maxy - 0.00195) * sin)),
- (-maxx + 0.0045, miny * cos, posz + -maxz + (miny * sin)),
- (-maxx + 0.0045, maxy * cos, posz + -maxz + (maxy * sin)),
- (-maxx, -gap * cos, posz + (-gap * sin)),
- (-maxx, gap * cos, posz + (gap * sin)),
- (-maxx + 0.0045, -gap * cos, posz + (-gap * sin)),
- (-maxx + 0.0045, gap * cos, posz + (gap * sin)),
- (-0.001172, miny * cos, posz + -maxz + (miny * sin)),
- (-0.001172, maxy * cos, posz + -maxz + (maxy * sin)),
- (-0.001172, -gap * cos, posz + (-gap * sin)),
- (-0.001172, gap * cos, posz + (gap * sin)),
- (-maxx + sep, miny * cos, posz + -maxz + (miny * sin)),
- (-maxx + sep, maxy * cos, posz + -maxz + (maxy * sin)),
- (-maxx + sep, -gap * cos, posz + (-gap * sin)),
- (-maxx + sep, gap * cos, posz + (gap * sin)),
- (-maxx + sep2, miny * cos, posz + -maxz + (miny * sin)),
- (-maxx + sep2, maxy * cos, posz + -maxz + (maxy * sin)),
- (-maxx + sep2, -gap * cos, posz + (-gap * sin)),
- (-maxx + sep2, gap * cos, posz + (gap * sin))])
+ [(-maxx + 0.0017, (miny + 0.00195) * cos_value, posz + (-maxz + (radio * sinv)) + ((miny + 0.00195) * sin_value)),
+ (-maxx + 0.0017, (maxy - 0.00195) * cos_value, posz + (-maxz + (radio * sinv)) + ((maxy - 0.00195) * sin_value)),
+ (-maxx + 0.0045, miny * cos_value, posz + -maxz + (miny * sin_value)),
+ (-maxx + 0.0045, maxy * cos_value, posz + -maxz + (maxy * sin_value)),
+ (-maxx, -gap * cos_value, posz + (-gap * sin_value)),
+ (-maxx, gap * cos_value, posz + (gap * sin_value)),
+ (-maxx + 0.0045, -gap * cos_value, posz + (-gap * sin_value)),
+ (-maxx + 0.0045, gap * cos_value, posz + (gap * sin_value)),
+ (-0.001172, miny * cos_value, posz + -maxz + (miny * sin_value)),
+ (-0.001172, maxy * cos_value, posz + -maxz + (maxy * sin_value)),
+ (-0.001172, -gap * cos_value, posz + (-gap * sin_value)),
+ (-0.001172, gap * cos_value, posz + (gap * sin_value)),
+ (-maxx + sep, miny * cos_value, posz + -maxz + (miny * sin_value)),
+ (-maxx + sep, maxy * cos_value, posz + -maxz + (maxy * sin_value)),
+ (-maxx + sep, -gap * cos_value, posz + (-gap * sin_value)),
+ (-maxx + sep, gap * cos_value, posz + (gap * sin_value)),
+ (-maxx + sep2, miny * cos_value, posz + -maxz + (miny * sin_value)),
+ (-maxx + sep2, maxy * cos_value, posz + -maxz + (maxy * sin_value)),
+ (-maxx + sep2, -gap * cos_value, posz + (-gap * sin_value)),
+ (-maxx + sep2, gap * cos_value, posz + (gap * sin_value))])
# Faces
myfaces = [(v + 7, v + 5, v + 1, v + 3), (v + 19, v + 7, v + 3, v + 17), (v + 2, v + 0, v + 4, v + 6),
diff --git a/archimesh/achm_window_maker.py b/archimesh/achm_window_maker.py
index 069c31db..ad7731a3 100644
--- a/archimesh/achm_window_maker.py
+++ b/archimesh/achm_window_maker.py
@@ -24,16 +24,17 @@
# ----------------------------------------------------------
# noinspection PyUnresolvedReferences
import bpy
-import math
-# noinspection PyUnresolvedReferences
-from bpy.props import *
+from math import pi, radians
+from bpy.types import Operator, PropertyGroup, Object, Panel
+from bpy.props import StringProperty, FloatProperty, BoolProperty, IntProperty, FloatVectorProperty, \
+ CollectionProperty, EnumProperty
from .achm_tools import *
# ------------------------------------------------------------------
# Define operator class to create object
# ------------------------------------------------------------------
-class AchmWindows(bpy.types.Operator):
+class AchmWindows(Operator):
bl_idname = "mesh.archimesh_window"
bl_label = "Rail Windows"
bl_description = "Rail Windows Generator"
@@ -193,7 +194,7 @@ def shape_mesh_and_create_children(mainobject, tmp_mesh, update=False):
parentobject(myempty, mainobject)
mainobject["archimesh.hole_enable"] = True
# Rotate Empty
- myempty.rotation_euler.z = math.radians(mp.r)
+ myempty.rotation_euler.z = radians(mp.r)
# Create control box to open wall holes
gap = 0.002
y = 0
@@ -239,41 +240,41 @@ def shape_mesh_and_create_children(mainobject, tmp_mesh, update=False):
# ------------------------------------------------------------------
# Define property group class to create or modify
# ------------------------------------------------------------------
-class ObjectProperties(bpy.types.PropertyGroup):
- width = bpy.props.FloatProperty(
+class ObjectProperties(PropertyGroup):
+ width = FloatProperty(
name='Width',
min=0.20, max=50,
default=1.20, precision=3,
description='window width',
update=update_object,
)
- depth = bpy.props.FloatProperty(
+ depth = FloatProperty(
name='Depth',
min=0.07, max=1,
default=0.10, precision=3,
description='window depth',
update=update_object,
)
- height = bpy.props.FloatProperty(
+ height = FloatProperty(
name='Height',
min=0.20, max=50,
default=1, precision=3,
description='window height',
update=update_object,
)
- r = bpy.props.FloatProperty(
+ r = FloatProperty(
name='Rotation', min=0, max=360, default=0, precision=1,
description='Window rotation',
update=update_object,
)
- external = bpy.props.BoolProperty(
+ external = BoolProperty(
name="External frame",
description="Create an external front frame",
default=True,
update=update_object,
)
- frame = bpy.props.FloatProperty(
+ frame = FloatProperty(
name='External Frame',
min=0.001, max=1,
default=0.01, precision=3,
@@ -281,21 +282,21 @@ class ObjectProperties(bpy.types.PropertyGroup):
update=update_object,
)
- frame_L = bpy.props.FloatProperty(
+ frame_L = FloatProperty(
name='Frame',
min=0.02, max=1,
default=0.06, precision=3,
description='Frame size',
update=update_object,
)
- wf = bpy.props.FloatProperty(
+ wf = FloatProperty(
name='WinFrame',
min=0.001, max=1,
default=0.05, precision=3,
description='Window Frame size',
update=update_object,
)
- leafratio = bpy.props.FloatProperty(
+ leafratio = FloatProperty(
name='Leaf ratio',
min=0.001, max=0.999,
default=0.50,
@@ -303,7 +304,7 @@ class ObjectProperties(bpy.types.PropertyGroup):
description='Leaf thickness ratio',
update=update_object,
)
- opentype = bpy.props.EnumProperty(
+ opentype = EnumProperty(
items=(
('1', "Rail window", ""),
('2', "Two leaf", ""),
@@ -313,34 +314,34 @@ class ObjectProperties(bpy.types.PropertyGroup):
description="Defines type of window",
update=update_object,
)
- handle = bpy.props.BoolProperty(
+ handle = BoolProperty(
name="Create handles",
description="Create default handle to the leaf",
default=True,
update=update_object,
)
- sill = bpy.props.BoolProperty(
+ sill = BoolProperty(
name="Sill",
description="Add sill to window",
default=True,
update=update_object,
)
- sill_thickness = bpy.props.FloatProperty(
+ sill_thickness = FloatProperty(
name='Thickness',
min=0, max=50,
default=0.01, precision=3,
description='Sill thickness',
update=update_object,
)
- sill_back = bpy.props.FloatProperty(
+ sill_back = FloatProperty(
name='Back',
min=0, max=10,
default=0.0, precision=3,
description='Extrusion in back side',
update=update_object,
)
- sill_front = bpy.props.FloatProperty(
+ sill_front = FloatProperty(
name='Front',
min=0, max=10,
default=0.12, precision=3,
@@ -348,39 +349,39 @@ class ObjectProperties(bpy.types.PropertyGroup):
update=update_object,
)
- blind = bpy.props.BoolProperty(
+ blind = BoolProperty(
name="Blind",
description="Create an external blind",
default=False,
update=update_object,
)
- blind_box = bpy.props.BoolProperty(
+ blind_box = BoolProperty(
name="Blind box", description="Create a box over frame for blind",
default=True,
update=update_object,
)
- blind_height = bpy.props.FloatProperty(
+ blind_height = FloatProperty(
name='Height',
min=0.001, max=10,
default=0.12, precision=3,
description='Blind box height',
update=update_object,
)
- blind_back = bpy.props.FloatProperty(
+ blind_back = FloatProperty(
name='Back',
min=0.001, max=10,
default=0.002, precision=3,
description='Extrusion in back side',
update=update_object,
)
- blind_rail = bpy.props.FloatProperty(
+ blind_rail = FloatProperty(
name='Separation',
min=0.001, max=10,
default=0.10, precision=3,
description='Separation from frame',
update=update_object,
)
- blind_ratio = bpy.props.IntProperty(
+ blind_ratio = IntProperty(
name='Extend',
min=0, max=100,
default=20,
@@ -389,24 +390,24 @@ class ObjectProperties(bpy.types.PropertyGroup):
)
# Materials
- crt_mat = bpy.props.BoolProperty(
+ crt_mat = BoolProperty(
name="Create default Cycles materials",
description="Create default materials for Cycles render",
default=True,
update=update_object,
)
# opengl internal data
- glpoint_a = bpy.props.FloatVectorProperty(
+ glpoint_a = FloatVectorProperty(
name="glpointa",
description="Hidden property for opengl",
default=(0, 0, 0),
)
- glpoint_b = bpy.props.FloatVectorProperty(
+ glpoint_b = FloatVectorProperty(
name="glpointb",
description="Hidden property for opengl",
default=(0, 0, 0),
)
- glpoint_c = bpy.props.FloatVectorProperty(
+ glpoint_c = FloatVectorProperty(
name="glpointc",
description="Hidden property for opengl",
default=(0, 0, 0),
@@ -414,13 +415,13 @@ class ObjectProperties(bpy.types.PropertyGroup):
# Register
bpy.utils.register_class(ObjectProperties)
-bpy.types.Object.WindowObjectGenerator = bpy.props.CollectionProperty(type=ObjectProperties)
+Object.WindowObjectGenerator = CollectionProperty(type=ObjectProperties)
# ------------------------------------------------------------------
# Define panel class to modify object
# ------------------------------------------------------------------
-class AchmWindowObjectgeneratorpanel(bpy.types.Panel):
+class AchmWindowObjectgeneratorpanel(Panel):
bl_idname = "OBJECT_PT_window_generator"
bl_label = "Window Rail"
bl_space_type = 'VIEW_3D'
@@ -1317,7 +1318,7 @@ def create_leaf_window_leaf(objname, hand, sx, sy, sz, f, px, py, pz, mat, matda
if handle:
myhandle = create_leaf_handle("Handle", mat)
if hand == "L":
- myhandle.rotation_euler = (0, math.pi, 0)
+ myhandle.rotation_euler = (0, pi, 0)
myhandle.parent = mywindow
if hand == "R":
diff --git a/archimesh/achm_window_panel.py b/archimesh/achm_window_panel.py
index 4c5e5dd0..27f0dd6f 100644
--- a/archimesh/achm_window_panel.py
+++ b/archimesh/achm_window_panel.py
@@ -28,9 +28,11 @@
# ----------------------------------------------------------
# noinspection PyUnresolvedReferences
import bpy
-import math
-# noinspection PyUnresolvedReferences
-import mathutils
+from math import cos, sin, radians, sqrt, pi
+from mathutils import Vector
+from bpy.types import Operator, PropertyGroup, Object, Panel
+from bpy.props import StringProperty, FloatProperty, BoolProperty, IntProperty, FloatVectorProperty, \
+ CollectionProperty, EnumProperty
from .achm_tools import *
@@ -194,7 +196,7 @@ def set_defaults(s):
# ------------------------------------------------------------------
# Define operator class to create window panels
# ------------------------------------------------------------------
-class AchmWinPanel(bpy.types.Operator):
+class AchmWinPanel(Operator):
bl_idname = "mesh.archimesh_winpanel"
bl_label = "Panel Window"
bl_description = "Generate editable flat windows"
@@ -380,7 +382,7 @@ def do_ctrl_box(myobject):
parentobject(myempty, myobject)
myobject["archimesh.hole_enable"] = True
# Rotate Empty
- myempty.rotation_euler.z = math.radians(op.r)
+ myempty.rotation_euler.z = radians(op.r)
# Create control box to open wall holes
myctrl = create_ctrl_box(myobject, "CTRL_Hole")
@@ -679,16 +681,16 @@ def generate_vertex_data(op, myvertex, myfaces):
if h1 < 0.07:
h1 = 0.07
- h = math.sqrt(u ** 2 + h1 ** 2) / 2
+ h = sqrt(u ** 2 + h1 ** 2) / 2
e = h * (u / h1)
- c = math.sqrt(h ** 2 + e ** 2)
+ c = sqrt(h ** 2 + e ** 2)
t1 = zlist[-1] - h1
elif op.DT2 == '2':
c = op.VL2 / 100
if c < u + 0.01:
c = u + 0.01
# op.VL2 = c * 100
- t1 = math.sqrt(c ** 2 - u ** 2) + zlist[-1] - c
+ t1 = sqrt(c ** 2 - u ** 2) + zlist[-1] - c
r = c - k1
z = zlist[-1] - c
@@ -697,15 +699,15 @@ def generate_vertex_data(op, myvertex, myfaces):
myvertex[son[0]][2] = t1
myvertex[son[1]][2] = t1
for i in alt:
- myvertex[i][2] = math.sqrt(r ** 2 - myvertex[i][0] ** 2) + z
+ myvertex[i][2] = sqrt(r ** 2 - myvertex[i][0] ** 2) + z
on = [son[0]]
u1 = []
for i in range(0, res):
- a = i * math.pi / res
- x = math.cos(a) * c
+ a = i * pi / res
+ x = cos(a) * c
if -u < x < u:
- myvertex.append([x, -k1 / 2, math.sin(a) * c + z])
+ myvertex.append([x, -k1 / 2, sin(a) * c + z])
on.append(len(myvertex) - 1)
u1.extend(on)
u1.append(ust[0])
@@ -721,10 +723,10 @@ def generate_vertex_data(op, myvertex, myfaces):
t1 = [alt[i + 0]]
t2 = [alt[i + 1]]
for j in range(0, res):
- a = j * math.pi / res
- x = -math.cos(a) * r
+ a = j * pi / res
+ x = -cos(a) * r
if x1 < x < x2:
- myvertex.extend([[x, -k1 / 2, math.sin(a) * r + z], [x, k1 / 2, math.sin(a) * r + z]])
+ myvertex.extend([[x, -k1 / 2, sin(a) * r + z], [x, k1 / 2, sin(a) * r + z]])
on.append(len(myvertex) - 2)
ar.append(len(myvertex) - 1)
t1.append(len(myvertex) - 2)
@@ -738,10 +740,10 @@ def generate_vertex_data(op, myvertex, myfaces):
ar.append(son[1])
u2 = [son[1]]
for i in range(0, res):
- a = i * math.pi / res
- x = math.cos(a) * c
+ a = i * pi / res
+ x = cos(a) * c
if -u < x < u:
- myvertex.append([x, k1 / 2, math.sin(a) * c + z])
+ myvertex.append([x, k1 / 2, sin(a) * c + z])
ar.append(len(myvertex) - 1)
u2.append(len(myvertex) - 1)
ar.append(ust[1])
@@ -790,31 +792,31 @@ def generate_vertex_data(op, myvertex, myfaces):
[[n - 8, n - 7, n - 3, n - 4], [n - 7, n - 6, n - 2, n - 3], [n - 6, n - 5, n - 1, n - 2],
[n - 5, n - 8, n - 4, n - 1]])
alt = [n - 16, n - 15, n - 14, n - 13, n - 4, n - 3, n - 2, n - 1]
- myvertex[alt[0]][2] = math.sqrt(r ** 2 - myvertex[alt[0]][0] ** 2) + z
- myvertex[alt[1]][2] = math.sqrt(k ** 2 - myvertex[alt[1]][0] ** 2) + z
- myvertex[alt[2]][2] = math.sqrt(k ** 2 - myvertex[alt[2]][0] ** 2) + z
- myvertex[alt[3]][2] = math.sqrt(r ** 2 - myvertex[alt[3]][0] ** 2) + z
- myvertex[alt[4]][2] = math.sqrt(r ** 2 - myvertex[alt[4]][0] ** 2) + z
- myvertex[alt[5]][2] = math.sqrt(k ** 2 - myvertex[alt[5]][0] ** 2) + z
- myvertex[alt[6]][2] = math.sqrt(k ** 2 - myvertex[alt[6]][0] ** 2) + z
- myvertex[alt[7]][2] = math.sqrt(r ** 2 - myvertex[alt[7]][0] ** 2) + z
+ myvertex[alt[0]][2] = sqrt(r ** 2 - myvertex[alt[0]][0] ** 2) + z
+ myvertex[alt[1]][2] = sqrt(k ** 2 - myvertex[alt[1]][0] ** 2) + z
+ myvertex[alt[2]][2] = sqrt(k ** 2 - myvertex[alt[2]][0] ** 2) + z
+ myvertex[alt[3]][2] = sqrt(r ** 2 - myvertex[alt[3]][0] ** 2) + z
+ myvertex[alt[4]][2] = sqrt(r ** 2 - myvertex[alt[4]][0] ** 2) + z
+ myvertex[alt[5]][2] = sqrt(k ** 2 - myvertex[alt[5]][0] ** 2) + z
+ myvertex[alt[6]][2] = sqrt(k ** 2 - myvertex[alt[6]][0] ** 2) + z
+ myvertex[alt[7]][2] = sqrt(r ** 2 - myvertex[alt[7]][0] ** 2) + z
d1 = []
d2 = []
t1 = []
t2 = []
for i in range(0, res):
- a = i * math.pi / res
- y1 = math.cos(a) * r
- y2 = -math.cos(a) * k
+ a = i * pi / res
+ y1 = cos(a) * r
+ y2 = -cos(a) * k
if x1 < y1 < x2:
- myvertex.extend([[y1, fr - k2 / 2, math.sin(a) * r + z], [y1, fr + k2 / 2,
- math.sin(a) * r + z]])
+ myvertex.extend([[y1, fr - k2 / 2, sin(a) * r + z], [y1, fr + k2 / 2,
+ sin(a) * r + z]])
t1.append(len(myvertex) - 2)
t2.append(len(myvertex) - 1)
if x1 + k2 < y2 < x2 - k2:
- myvertex.extend([[y2, fr - k2 / 2, math.sin(a) * k + z], [y2, fr + k2 / 2,
- math.sin(a) * k + z]])
+ myvertex.extend([[y2, fr - k2 / 2, sin(a) * k + z], [y2, fr + k2 / 2,
+ sin(a) * k + z]])
d1.append(len(myvertex) - 2)
d2.append(len(myvertex) - 1)
on = [alt[1], alt[0]]
@@ -887,29 +889,29 @@ def generate_vertex_data(op, myvertex, myfaces):
m = len(myfaces)
ftl.extend([m - 1, m - 2, m - 3, m - 4, m - 5, m - 6, m - 7, m - 8, m - 9])
alt = [n - 16, n - 15, n - 14, n - 13, n - 4, n - 3, n - 2, n - 1]
- myvertex[alt[0]][2] = math.sqrt(r ** 2 - myvertex[alt[0]][0] ** 2) + z
- myvertex[alt[1]][2] = math.sqrt(k ** 2 - myvertex[alt[1]][0] ** 2) + z
- myvertex[alt[2]][2] = math.sqrt(k ** 2 - myvertex[alt[2]][0] ** 2) + z
- myvertex[alt[3]][2] = math.sqrt(r ** 2 - myvertex[alt[3]][0] ** 2) + z
- myvertex[alt[4]][2] = math.sqrt(r ** 2 - myvertex[alt[4]][0] ** 2) + z
- myvertex[alt[5]][2] = math.sqrt(k ** 2 - myvertex[alt[5]][0] ** 2) + z
- myvertex[alt[6]][2] = math.sqrt(k ** 2 - myvertex[alt[6]][0] ** 2) + z
- myvertex[alt[7]][2] = math.sqrt(r ** 2 - myvertex[alt[7]][0] ** 2) + z
+ myvertex[alt[0]][2] = sqrt(r ** 2 - myvertex[alt[0]][0] ** 2) + z
+ myvertex[alt[1]][2] = sqrt(k ** 2 - myvertex[alt[1]][0] ** 2) + z
+ myvertex[alt[2]][2] = sqrt(k ** 2 - myvertex[alt[2]][0] ** 2) + z
+ myvertex[alt[3]][2] = sqrt(r ** 2 - myvertex[alt[3]][0] ** 2) + z
+ myvertex[alt[4]][2] = sqrt(r ** 2 - myvertex[alt[4]][0] ** 2) + z
+ myvertex[alt[5]][2] = sqrt(k ** 2 - myvertex[alt[5]][0] ** 2) + z
+ myvertex[alt[6]][2] = sqrt(k ** 2 - myvertex[alt[6]][0] ** 2) + z
+ myvertex[alt[7]][2] = sqrt(r ** 2 - myvertex[alt[7]][0] ** 2) + z
d1 = []
d2 = []
t1 = []
t2 = []
for i in range(0, res):
- a = i * math.pi / res
- y1 = math.cos(a) * r
- y2 = -math.cos(a) * k
+ a = i * pi / res
+ y1 = cos(a) * r
+ y2 = -cos(a) * k
if x1 < y1 < x2:
- myvertex.extend([[y1, fr - k3, math.sin(a) * r + z], [y1, fr + k3, math.sin(a) * r + z]])
+ myvertex.extend([[y1, fr - k3, sin(a) * r + z], [y1, fr + k3, sin(a) * r + z]])
t1.append(len(myvertex) - 2)
t2.append(len(myvertex) - 1)
ftl.extend([len(myfaces) - 1, len(myfaces) - 2])
if x1 + k3 * 2 < y2 < x2 - k3 * 2:
- myvertex.extend([[y2, fr - k3, math.sin(a) * k + z], [y2, fr + k3, math.sin(a) * k + z]])
+ myvertex.extend([[y2, fr - k3, sin(a) * k + z], [y2, fr + k3, sin(a) * k + z]])
d1.append(len(myvertex) - 2)
d2.append(len(myvertex) - 1)
ftl.extend([len(myfaces) - 1, len(myfaces) - 2])
@@ -944,21 +946,21 @@ def generate_vertex_data(op, myvertex, myfaces):
on = []
ar = []
for i in range(0, res):
- a = i * math.pi / res
- y1 = -math.cos(a) * k
+ a = i * pi / res
+ y1 = -cos(a) * k
if x1 < y1 < x2:
- myvertex.extend([[y1, fr - 0.005, math.sin(a) * k + z], [y1, fr + 0.005, math.sin(a) * k + z]])
+ myvertex.extend([[y1, fr - 0.005, sin(a) * k + z], [y1, fr + 0.005, sin(a) * k + z]])
n = len(myvertex)
on.append(n - 1)
ar.append(n - 2)
myvertex.extend(
- [[x1, fr - 0.005, math.sqrt(k ** 2 - x1 ** 2) + z], [x1, fr + 0.005,
- math.sqrt(k ** 2 - x1 ** 2) + z]])
+ [[x1, fr - 0.005, sqrt(k ** 2 - x1 ** 2) + z], [x1, fr + 0.005,
+ sqrt(k ** 2 - x1 ** 2) + z]])
myvertex.extend([[x1, fr - 0.005, zlist[-3] + ek + k3 * 2], [x1, fr + 0.005, zlist[-3] + ek + k3 * 2]])
myvertex.extend([[x2, fr - 0.005, zlist[-3] + ek + k3 * 2], [x2, fr + 0.005, zlist[-3] + ek + k3 * 2]])
myvertex.extend(
- [[x2, fr - 0.005, math.sqrt(k ** 2 - x2 ** 2) + z], [x2, fr + 0.005,
- math.sqrt(k ** 2 - x2 ** 2) + z]])
+ [[x2, fr - 0.005, sqrt(k ** 2 - x2 ** 2) + z], [x2, fr + 0.005,
+ sqrt(k ** 2 - x2 ** 2) + z]])
n = len(myvertex)
on.extend([n - 1, n - 3, n - 5, n - 7])
ar.extend([n - 2, n - 4, n - 6, n - 8])
@@ -974,10 +976,10 @@ def generate_vertex_data(op, myvertex, myfaces):
elif op.DT3 == '2':
h1 = op.VL3 / 100
elif op.DT3 == '3':
- h1 = math.sin(op.VL4 * math.pi / 180) / math.cos(op.VL4 * math.pi / 180)
- z = math.sqrt(k1 ** 2 + (k1 * h1) ** 2)
- k = math.sqrt(k2 ** 2 + (k2 * h1) ** 2)
- f = math.sqrt(k3 ** 2 + (k3 * h1) ** 2) * 2
+ h1 = sin(op.VL4 * pi / 180) / cos(op.VL4 * pi / 180)
+ z = sqrt(k1 ** 2 + (k1 * h1) ** 2)
+ k = sqrt(k2 ** 2 + (k2 * h1) ** 2)
+ f = sqrt(k3 ** 2 + (k3 * h1) ** 2) * 2
myvertex[ust[0]][2] = zlist[-1] + myvertex[ust[0]][0] * h1
myvertex[ust[1]][2] = zlist[-1] + myvertex[ust[1]][0] * h1
for i in alt:
@@ -1048,10 +1050,10 @@ def generate_vertex_data(op, myvertex, myfaces):
elif op.DT3 == '2':
h1 = op.VL3 / 100
elif op.DT3 == '3':
- h1 = math.sin(op.VL4 * math.pi / 180) / math.cos(op.VL4 * math.pi / 180)
- z = math.sqrt(k1 ** 2 + (k1 * h1) ** 2)
- k = math.sqrt(k2 ** 2 + (k2 * h1) ** 2)
- f = math.sqrt(k3 ** 2 + (k3 * h1) ** 2) * 2
+ h1 = sin(op.VL4 * pi / 180) / cos(op.VL4 * pi / 180)
+ z = sqrt(k1 ** 2 + (k1 * h1) ** 2)
+ k = sqrt(k2 ** 2 + (k2 * h1) ** 2)
+ f = sqrt(k3 ** 2 + (k3 * h1) ** 2) * 2
myvertex[ust[0]][2] = zlist[-1] + myvertex[ust[0]][0] * h1
myvertex[ust[1]][2] = zlist[-1] + myvertex[ust[1]][0] * h1
for i in alt:
@@ -1375,8 +1377,8 @@ class Cpoint:
# Get angle between two vectors
# ---------------------------------------------------------
def get_angle(p1, p2):
- v1 = mathutils.Vector((p1[0], 0.0, p1[1]))
- v2 = mathutils.Vector((p2[0], 0.0, p2[1]))
+ v1 = Vector((p1[0], 0.0, p1[1]))
+ v2 = Vector((p2[0], 0.0, p2[1]))
a = v1.angle(v2)
return a
@@ -1407,7 +1409,7 @@ def get_circle_center(a, b, c):
center = Cpoint(s2.x + l * d2.x, s2.y + l * d2.y)
dx = center.x - a.x
dy = center.y - a.y
- radio = math.sqrt(dx * dx + dy * dy)
+ radio = sqrt(dx * dx + dy * dy)
# angle
v1 = (a.x - center.x, a.y - center.y)
@@ -1500,14 +1502,14 @@ def create_ctrl_box(parentobj, objname):
cz = center.y
sg = op.res
- arc = ((math.pi / 2) + ang) - ((math.pi / 2) - ang)
+ arc = ((pi / 2) + ang) - ((pi / 2) - ang)
step = arc / sg
- a = (math.pi / 2) + ang
+ a = (pi / 2) + ang
myvertex.extend([(lb, ypos, lt), (lb, -ypos, lt)])
for x in range(0, sg):
- myvertex.extend([(r * math.cos(a), ypos, r * math.sin(a) + cz),
- (r * math.cos(a), -ypos, r * math.sin(a) + cz)])
+ myvertex.extend([(r * cos(a), ypos, r * sin(a) + cz),
+ (r * cos(a), -ypos, r * sin(a) + cz)])
a -= step
# close sides
@@ -1549,8 +1551,8 @@ def create_ctrl_box(parentobj, objname):
# ------------------------------------------------------------------
# Define property group class to create or modify
# ------------------------------------------------------------------
-class GeneralPanelProperties(bpy.types.PropertyGroup):
- prs = bpy.props.EnumProperty(
+class GeneralPanelProperties(PropertyGroup):
+ prs = EnumProperty(
items=(
('1', "WINDOW 250X200", ""),
('2', "WINDOW 200X200", ""),
@@ -1566,40 +1568,40 @@ class GeneralPanelProperties(bpy.types.PropertyGroup):
update=update_using_default,
)
son = prs
- gen = bpy.props.IntProperty(
+ gen = IntProperty(
name='H Count', min=1, max=8, default=3,
description='Horizontal Panes',
update=update_window,
)
- yuk = bpy.props.IntProperty(
+ yuk = IntProperty(
name='V Count', min=1, max=5, default=1,
description='Vertical Panes',
update=update_window,
)
- kl1 = bpy.props.IntProperty(
+ kl1 = IntProperty(
name='Outer Frame', min=2, max=50, default=5,
description='Outside Frame Thickness',
update=update_window,
)
- kl2 = bpy.props.IntProperty(
+ kl2 = IntProperty(
name='Risers', min=2, max=50, default=5,
description='Risers Width',
update=update_window,
)
- fk = bpy.props.IntProperty(
+ fk = IntProperty(
name='Inner Frame', min=1, max=20, default=2,
description='Inside Frame Thickness',
update=update_window,
)
- mr = bpy.props.BoolProperty(name='Sill', default=True, description='Window Sill', update=update_window)
- mr1 = bpy.props.IntProperty(name='', min=1, max=20, default=4, description='Height', update=update_window)
- mr2 = bpy.props.IntProperty(name='', min=0, max=20, default=4, description='First Depth', update=update_window)
- mr3 = bpy.props.IntProperty(name='', min=1, max=50, default=20, description='Second Depth', update=update_window)
- mr4 = bpy.props.IntProperty(name='', min=0, max=50, default=0, description='Extrusion for Jamb',
+ mr = BoolProperty(name='Sill', default=True, description='Window Sill', update=update_window)
+ mr1 = IntProperty(name='', min=1, max=20, default=4, description='Height', update=update_window)
+ mr2 = IntProperty(name='', min=0, max=20, default=4, description='First Depth', update=update_window)
+ mr3 = IntProperty(name='', min=1, max=50, default=20, description='Second Depth', update=update_window)
+ mr4 = IntProperty(name='', min=0, max=50, default=0, description='Extrusion for Jamb',
update=update_window)
- mt1 = bpy.props.EnumProperty(
+ mt1 = EnumProperty(
items=(
('1', "PVC", ""),
('2', "WOOD", ""),
@@ -1610,7 +1612,7 @@ class GeneralPanelProperties(bpy.types.PropertyGroup):
description='Material to use',
update=update_window,
)
- mt2 = bpy.props.EnumProperty(
+ mt2 = EnumProperty(
items=(
('1', "PVC", ""),
('2', "WOOD", ""),
@@ -1622,14 +1624,14 @@ class GeneralPanelProperties(bpy.types.PropertyGroup):
update=update_window,
)
- r = bpy.props.FloatProperty(
+ r = FloatProperty(
name='Rotation',
min=0, max=360, default=0, precision=1,
description='Panel rotation',
update=update_window,
)
- UST = bpy.props.EnumProperty(
+ UST = EnumProperty(
items=(
('1', "Flat", ""),
('2', "Arch", ""),
@@ -1640,7 +1642,7 @@ class GeneralPanelProperties(bpy.types.PropertyGroup):
description='Type of window upper section',
update=update_window,
)
- DT2 = bpy.props.EnumProperty(
+ DT2 = EnumProperty(
items=(
('1', "Difference", ""),
('2', "Radius", ""),
@@ -1649,7 +1651,7 @@ class GeneralPanelProperties(bpy.types.PropertyGroup):
default='1',
update=update_window,
)
- DT3 = bpy.props.EnumProperty(
+ DT3 = EnumProperty(
items=(
('1', "Difference", ""),
('2', "Incline %", ""),
@@ -1659,102 +1661,102 @@ class GeneralPanelProperties(bpy.types.PropertyGroup):
default='1', update=update_window,
)
- VL1 = bpy.props.IntProperty(name='', min=-10000, max=10000, default=30, update=update_window) # Fark
- VL2 = bpy.props.IntProperty(name='', min=1, max=10000, default=30, update=update_window) # Cap
- VL3 = bpy.props.IntProperty(name='', min=-100, max=100, default=30, update=update_window) # Egim %
- VL4 = bpy.props.IntProperty(name='', min=-45, max=45, default=30, update=update_window) # Egim Aci
+ VL1 = IntProperty(name='', min=-10000, max=10000, default=30, update=update_window) # Fark
+ VL2 = IntProperty(name='', min=1, max=10000, default=30, update=update_window) # Cap
+ VL3 = IntProperty(name='', min=-100, max=100, default=30, update=update_window) # Egim %
+ VL4 = IntProperty(name='', min=-45, max=45, default=30, update=update_window) # Egim Aci
- res = bpy.props.IntProperty(name='Resolution', min=2, max=360, default=36, update=update_window) # Res
+ res = IntProperty(name='Resolution', min=2, max=360, default=36, update=update_window) # Res
- gnx0 = bpy.props.IntProperty(name='', min=1, max=300, default=60, description='1st Window Width',
+ gnx0 = IntProperty(name='', min=1, max=300, default=60, description='1st Window Width',
update=update_window)
- gnx1 = bpy.props.IntProperty(name='', min=1, max=300, default=110, description='2nd Window Width',
+ gnx1 = IntProperty(name='', min=1, max=300, default=110, description='2nd Window Width',
update=update_window)
- gnx2 = bpy.props.IntProperty(name='', min=1, max=300, default=60, description='3rd Window Width',
+ gnx2 = IntProperty(name='', min=1, max=300, default=60, description='3rd Window Width',
update=update_window)
- gnx3 = bpy.props.IntProperty(name='', min=1, max=300, default=60, description='4th Window Width',
+ gnx3 = IntProperty(name='', min=1, max=300, default=60, description='4th Window Width',
update=update_window)
- gnx4 = bpy.props.IntProperty(name='', min=1, max=300, default=60, description='5th Window Width',
+ gnx4 = IntProperty(name='', min=1, max=300, default=60, description='5th Window Width',
update=update_window)
- gnx5 = bpy.props.IntProperty(name='', min=1, max=300, default=60, description='6th Window Width',
+ gnx5 = IntProperty(name='', min=1, max=300, default=60, description='6th Window Width',
update=update_window)
- gnx6 = bpy.props.IntProperty(name='', min=1, max=300, default=60, description='7th Window Width',
+ gnx6 = IntProperty(name='', min=1, max=300, default=60, description='7th Window Width',
update=update_window)
- gnx7 = bpy.props.IntProperty(name='', min=1, max=300, default=60, description='8th Window Width',
+ gnx7 = IntProperty(name='', min=1, max=300, default=60, description='8th Window Width',
update=update_window)
- gny0 = bpy.props.IntProperty(name='', min=1, max=300, default=190, description='1st Row Height',
+ gny0 = IntProperty(name='', min=1, max=300, default=190, description='1st Row Height',
update=update_window)
- gny1 = bpy.props.IntProperty(name='', min=1, max=300, default=45, description='2nd Row Height',
+ gny1 = IntProperty(name='', min=1, max=300, default=45, description='2nd Row Height',
update=update_window)
- gny2 = bpy.props.IntProperty(name='', min=1, max=300, default=45, description='3rd Row Height',
+ gny2 = IntProperty(name='', min=1, max=300, default=45, description='3rd Row Height',
update=update_window)
- gny3 = bpy.props.IntProperty(name='', min=1, max=300, default=45, description='4th Row Height',
+ gny3 = IntProperty(name='', min=1, max=300, default=45, description='4th Row Height',
update=update_window)
- gny4 = bpy.props.IntProperty(name='', min=1, max=300, default=45, description='5th Row Height',
+ gny4 = IntProperty(name='', min=1, max=300, default=45, description='5th Row Height',
update=update_window)
- k00 = bpy.props.BoolProperty(name='', default=True, update=update_window)
- k01 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k02 = bpy.props.BoolProperty(name='', default=True, update=update_window)
- k03 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k04 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k05 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k06 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k07 = bpy.props.BoolProperty(name='', default=False, update=update_window)
-
- k10 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k11 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k12 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k13 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k14 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k15 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k16 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k17 = bpy.props.BoolProperty(name='', default=False, update=update_window)
-
- k20 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k21 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k22 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k23 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k24 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k25 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k26 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k27 = bpy.props.BoolProperty(name='', default=False, update=update_window)
-
- k30 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k31 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k32 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k33 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k34 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k35 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k36 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k37 = bpy.props.BoolProperty(name='', default=False, update=update_window)
-
- k40 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k41 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k42 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k43 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k44 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k45 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k46 = bpy.props.BoolProperty(name='', default=False, update=update_window)
- k47 = bpy.props.BoolProperty(name='', default=False, update=update_window)
+ k00 = BoolProperty(name='', default=True, update=update_window)
+ k01 = BoolProperty(name='', default=False, update=update_window)
+ k02 = BoolProperty(name='', default=True, update=update_window)
+ k03 = BoolProperty(name='', default=False, update=update_window)
+ k04 = BoolProperty(name='', default=False, update=update_window)
+ k05 = BoolProperty(name='', default=False, update=update_window)
+ k06 = BoolProperty(name='', default=False, update=update_window)
+ k07 = BoolProperty(name='', default=False, update=update_window)
+
+ k10 = BoolProperty(name='', default=False, update=update_window)
+ k11 = BoolProperty(name='', default=False, update=update_window)
+ k12 = BoolProperty(name='', default=False, update=update_window)
+ k13 = BoolProperty(name='', default=False, update=update_window)
+ k14 = BoolProperty(name='', default=False, update=update_window)
+ k15 = BoolProperty(name='', default=False, update=update_window)
+ k16 = BoolProperty(name='', default=False, update=update_window)
+ k17 = BoolProperty(name='', default=False, update=update_window)
+
+ k20 = BoolProperty(name='', default=False, update=update_window)
+ k21 = BoolProperty(name='', default=False, update=update_window)
+ k22 = BoolProperty(name='', default=False, update=update_window)
+ k23 = BoolProperty(name='', default=False, update=update_window)
+ k24 = BoolProperty(name='', default=False, update=update_window)
+ k25 = BoolProperty(name='', default=False, update=update_window)
+ k26 = BoolProperty(name='', default=False, update=update_window)
+ k27 = BoolProperty(name='', default=False, update=update_window)
+
+ k30 = BoolProperty(name='', default=False, update=update_window)
+ k31 = BoolProperty(name='', default=False, update=update_window)
+ k32 = BoolProperty(name='', default=False, update=update_window)
+ k33 = BoolProperty(name='', default=False, update=update_window)
+ k34 = BoolProperty(name='', default=False, update=update_window)
+ k35 = BoolProperty(name='', default=False, update=update_window)
+ k36 = BoolProperty(name='', default=False, update=update_window)
+ k37 = BoolProperty(name='', default=False, update=update_window)
+
+ k40 = BoolProperty(name='', default=False, update=update_window)
+ k41 = BoolProperty(name='', default=False, update=update_window)
+ k42 = BoolProperty(name='', default=False, update=update_window)
+ k43 = BoolProperty(name='', default=False, update=update_window)
+ k44 = BoolProperty(name='', default=False, update=update_window)
+ k45 = BoolProperty(name='', default=False, update=update_window)
+ k46 = BoolProperty(name='', default=False, update=update_window)
+ k47 = BoolProperty(name='', default=False, update=update_window)
# opengl internal data
- glpoint_a = bpy.props.FloatVectorProperty(
+ glpoint_a = FloatVectorProperty(
name="glpointa",
description="Hidden property for opengl",
default=(0, 0, 0),
)
- glpoint_b = bpy.props.FloatVectorProperty(
+ glpoint_b = FloatVectorProperty(
name="glpointb",
description="Hidden property for opengl",
default=(0, 0, 0),
)
- glpoint_c = bpy.props.FloatVectorProperty(
+ glpoint_c = FloatVectorProperty(
name="glpointc",
description="Hidden property for opengl",
default=(0, 0, 0),
)
- glpoint_d = bpy.props.FloatVectorProperty(
+ glpoint_d = FloatVectorProperty(
name="glpointc",
description="Hidden property for opengl",
default=(0, 0, 0),
@@ -1762,13 +1764,13 @@ class GeneralPanelProperties(bpy.types.PropertyGroup):
bpy.utils.register_class(GeneralPanelProperties)
-bpy.types.Object.WindowPanelGenerator = bpy.props.CollectionProperty(type=GeneralPanelProperties)
+Object.WindowPanelGenerator = CollectionProperty(type=GeneralPanelProperties)
# ------------------------------------------------------------------
# Define panel class to modify myobjects.
# ------------------------------------------------------------------
-class AchmWindowEditPanel(bpy.types.Panel):
+class AchmWindowEditPanel(Panel):
bl_idname = "window.edit_panel2"
bl_label = "Window Panel"
bl_space_type = 'VIEW_3D'