[Bf-extensions-cvs] [b48df33c] master: archipack: version 1.2.3
Stephen Leger
noreply at git.blender.org
Sun Jun 4 05:10:49 CEST 2017
Commit: b48df33cfe49601d5e749d8f82707c03ff729cd6
Author: Stephen Leger
Date: Sun Jun 4 05:10:14 2017 +0200
Branches: master
https://developer.blender.org/rBACb48df33cfe49601d5e749d8f82707c03ff729cd6
archipack: version 1.2.3
===================================================================
M archipack/__init__.py
M archipack/archipack_2d.py
M archipack/archipack_door.py
M archipack/archipack_fence.py
M archipack/archipack_gl.py
M archipack/archipack_manipulator.py
M archipack/archipack_polylib.py
M archipack/archipack_slab.py
M archipack/archipack_stair.py
A archipack/archipack_truss.py
M archipack/archipack_wall2.py
M archipack/archipack_window.py
A archipack/icons/slab.png
A archipack/icons/truss.png
===================================================================
diff --git a/archipack/__init__.py b/archipack/__init__.py
index 1f7f8f13..6a28d816 100644
--- a/archipack/__init__.py
+++ b/archipack/__init__.py
@@ -1,4 +1,4 @@
-# -*- coding:utf-8 -*-
+# -*- coding:utf-8 -*-
# ##### BEGIN GPL LICENSE BLOCK #####
#
@@ -31,7 +31,7 @@ bl_info = {
'author': 's-leger',
'license': 'GPL',
'deps': 'shapely',
- 'version': (1, 2, 2),
+ 'version': (1, 2, 3),
'blender': (2, 7, 8),
'location': 'View3D > Tools > Create > Archipack',
'warning': '',
@@ -58,6 +58,7 @@ if "bpy" in locals():
# imp.reload(archipack_roof2d)
imp.reload(archipack_slab)
imp.reload(archipack_fence)
+ imp.reload(archipack_truss)
imp.reload(archipack_rendering)
try:
imp.reload(archipack_polylib)
@@ -80,6 +81,7 @@ else:
# from . import archipack_roof2d
from . import archipack_slab
from . import archipack_fence
+ from . import archipack_truss
from . import archipack_rendering
try:
"""
@@ -105,9 +107,9 @@ from bpy.types import (
AddonPreferences
)
from bpy.props import (
- EnumProperty,
- PointerProperty,
- StringProperty
+ EnumProperty, PointerProperty,
+ StringProperty,
+ IntProperty, FloatProperty, FloatVectorProperty
)
from bpy.utils import previews
icons_coll = {}
@@ -149,6 +151,83 @@ class Archipack_Pref(AddonPreferences):
update=update_panel
)
+ # Arrow sizes (world units)
+ arrow_size = FloatProperty(
+ name="Arrow",
+ description="Manipulators arrow size (blender units)",
+ default=0.05
+ )
+ # Handle area size (pixels)
+ handle_size = IntProperty(
+ name="Handle",
+ description="Manipulators handle sensitive area size (pixels)",
+ min=2,
+ default=10
+ )
+ # Font sizes and basic colour scheme
+ # kept outside of addon prefs until now
+ # as for a generic toolkit it is not appropriate
+ # we could provide a template for addon prefs
+ # matching those one
+ feedback_size_main = IntProperty(
+ name="Main",
+ description="Main title font size (pixels)",
+ min=2,
+ default=16
+ )
+ feedback_size_title = IntProperty(
+ name="Title",
+ description="Tool name font size (pixels)",
+ min=2,
+ default=14
+ )
+ feedback_size_shortcut = IntProperty(
+ name="Shortcut",
+ description="Shortcuts font size (pixels)",
+ min=2,
+ default=11
+ )
+ feedback_shortcut_area = FloatVectorProperty(
+ name="Background Shortcut",
+ description="Shortcut area background color",
+ subtype='COLOR_GAMMA',
+ default=(0, 0.4, 0.6, 0.2),
+ size=4,
+ min=0, max=1
+ )
+ feedback_title_area = FloatVectorProperty(
+ name="Background Main",
+ description="Title area background color",
+ subtype='COLOR_GAMMA',
+ default=(0, 0.4, 0.6, 0.5),
+ size=4,
+ min=0, max=1
+ )
+ feedback_colour_main = FloatVectorProperty(
+ name="Font Main",
+ description="Title color",
+ subtype='COLOR_GAMMA',
+ default=(0.95, 0.95, 0.95, 1.0),
+ size=4,
+ min=0, max=1
+ )
+ feedback_colour_key = FloatVectorProperty(
+ name="Font Shortcut key",
+ description="KEY label color",
+ subtype='COLOR_GAMMA',
+ default=(0.67, 0.67, 0.67, 1.0),
+ size=4,
+ min=0, max=1
+ )
+ feedback_colour_shortcut = FloatVectorProperty(
+ name="Font Shortcut hint",
+ description="Shortcuts text color",
+ subtype='COLOR_GAMMA',
+ default=(0.51, 0.51, 0.51, 1.0),
+ size=4,
+ min=0, max=1
+ )
+
def draw(self, context):
layout = self.layout
row = layout.row()
@@ -156,7 +235,30 @@ class Archipack_Pref(AddonPreferences):
col.label(text="Tab Category:")
col.prop(self, "tools_category")
col.prop(self, "create_category")
-
+ box = layout.box()
+ row = box.row()
+ split = row.split(percentage=0.5)
+ col = split.column()
+ col.label(text="Colors:")
+ row = col.row(align=True)
+ row.prop(self, "feedback_title_area")
+ row = col.row(align=True)
+ row.prop(self, "feedback_shortcut_area")
+ row = col.row(align=True)
+ row.prop(self, "feedback_colour_main")
+ row = col.row(align=True)
+ row.prop(self, "feedback_colour_key")
+ row = col.row(align=True)
+ row.prop(self, "feedback_colour_shortcut")
+ col = split.column()
+ col.label(text="Font size:")
+ col.prop(self, "feedback_size_main")
+ col.prop(self, "feedback_size_title")
+ col.prop(self, "feedback_size_shortcut")
+ col.label(text="Manipulators:")
+ col.prop(self, "arrow_size")
+ col.prop(self, "handle_size")
+
# ----------------------------------------------------
# Archipack panels
@@ -341,12 +443,21 @@ class TOOLS_PT_Archipack_Create(Panel):
# row = box.row(align=True)
# row.operator("archipack.roof", icon='CURVE_DATA')
row = box.row(align=True)
- # row.operator("archipack.pad")
- row.operator("archipack.slab_from_curve", icon='CURVE_DATA')
+ row.operator("archipack.truss",
+ icon_value=icons_coll["truss"].icon_id
+ )
+ row = box.row(align=True)
+ # row.operator("archipack.slab")
+ row.operator("archipack.slab_from_curve",
+ icon_value=icons_coll["slab"].icon_id
+ )
row = box.row(align=True)
- row.operator("archipack.wall2_from_slab")
- row.operator("archipack.slab_from_wall")
+ row.operator("archipack.wall2_from_slab",
+ icon_value=icons_coll["wall"].icon_id)
+ row.operator("archipack.slab_from_wall",
+ icon_value=icons_coll["slab"].icon_id
+ )
# ----------------------------------------------------
@@ -378,6 +489,10 @@ def menu_func(self, context):
text="Fence",
icon_value=icons_coll["fence"].icon_id
)
+ layout.operator("archipack.truss",
+ text="Truss",
+ icon_value=icons_coll["truss"].icon_id
+ )
# ----------------------------------------------------
@@ -420,6 +535,7 @@ def register():
# archipack_roof2d.register()
archipack_slab.register()
archipack_fence.register()
+ archipack_truss.register()
archipack_rendering.register()
if HAS_POLYLIB:
@@ -454,6 +570,7 @@ def unregister():
# archipack_roof2d.unregister()
archipack_slab.unregister()
archipack_fence.unregister()
+ archipack_truss.unregister()
archipack_rendering.unregister()
if HAS_POLYLIB:
diff --git a/archipack/archipack_2d.py b/archipack/archipack_2d.py
index 8d10395c..c5252a56 100644
--- a/archipack/archipack_2d.py
+++ b/archipack/archipack_2d.py
@@ -24,8 +24,8 @@
# Author: Stephen Leger (s-leger)
#
# ----------------------------------------------------------
-from mathutils import Vector
-from math import sin, cos, pi, atan2, sqrt, acos
+from mathutils import Vector, Matrix
+from math import sin, cos, pi, atan2, sqrt, acos, degrees
class Projection():
@@ -187,6 +187,21 @@ class Line(Projection):
def pts(self):
return [self.p0, self.p1]
+ def signed_angle(self, u, v):
+ """
+ signed angle between two vectors
+ """
+ return atan2(u.x * v.y - u.y * v.x, u.x * v.x + u.y * v.y)
+
+ def delta_angle(self, last):
+ """
+ signed delta angle between end of line and start of this one
+ this value is object's a0 for segment = self
+ """
+ if last is None:
+ return self.angle
+ return self.signed_angle(last.straight(1).v, self.straight(0).v)
+
def normal(self, t=0):
"""
2d Line perpendicular on plane xy
@@ -294,6 +309,66 @@ class Line(Projection):
"""
return NotImplementedError
+ def make_offset(self, offset, last=None):
+ """
+ Return offset between last and self.
+ Adjust last and self start to match
+ intersection point
+ """
+ line = self.offset(offset)
+ if last is None:
+ return line
+
+ if type(last).__name__ == 'Arc':
+ res, d, t = line.point_sur_segment(last.c)
+ c = (last.r * last.r) - (d * d)
+ print("t:%s" % t)
+ if c <= 0:
+ # no intersection !
+ p0 = line.lerp(t)
+ else:
+ # center is past start of line
+ if t > 0:
+ p0 = line.lerp(t) - line.v.normalized() * sqrt(c)
+ else:
+ p0 = line.lerp(t) + line.v.normalized() * sqrt(c)
+ # compute da of arc
+ u = last.p0 - last.c
+ v = p0 - last.c
+ da = self.signed_angle(u, v)
+ # da is ccw
+ if last.ccw:
+ # da is cw
+ if da < 0:
+ # so take inverse
+ da = 2 * pi + da
+ elif da > 0:
+ # da is ccw
+ da = 2 * pi - da
+ last.da = da
+ print("last.da %s" % (degrees(last.da)))
+ line.p0 = p0
+ else:
+ # intersect line / line
+ # 1 line -> 2 line
+ c = line.cross_z
+ d = last.v * c
+ if d == 0:
+ return line
+ v = line.p - last.p
+ t = (c * v) / d
+ c2 = last.cross_z
+ u = (c2 * v) / d
+ # intersect past this segment end
+ # or before last s
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list