From ec3808f8f1148788aff20eed2f5736f8c4392ebb Mon Sep 17 00:00:00 2001 From: ranjian0 Date: Tue, 17 Jan 2023 01:49:48 +0300 Subject: [PATCH 1/7] cleanup unused import --- btools/building/material.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/btools/building/material.py b/btools/building/material.py index f493b29..7bf6e3f 100644 --- a/btools/building/material.py +++ b/btools/building/material.py @@ -6,7 +6,7 @@ CollectionProperty, ) -from ..utils import create_object_material, bmesh_from_active_object +from ..utils import create_object_material from .facemap import ( clear_empty_facemaps, set_material_for_active_facemap, From 2571b015a29a6b8e1ae9cab7255324b9dd7985af Mon Sep 17 00:00:00 2001 From: ranjian0 Date: Tue, 17 Jan 2023 01:57:20 +0300 Subject: [PATCH 2/7] more unused imports --- btools/building/removegeom.py | 1 - btools/utils/util_skeleton.py | 2 -- 2 files changed, 3 deletions(-) diff --git a/btools/building/removegeom.py b/btools/building/removegeom.py index e3dd42b..ee0c928 100644 --- a/btools/building/removegeom.py +++ b/btools/building/removegeom.py @@ -1,5 +1,4 @@ import bpy -import math import bmesh from .facemap import FaceMap, add_faces_to_map from ..utils import ( diff --git a/btools/utils/util_skeleton.py b/btools/utils/util_skeleton.py index 930d0c6..7d6835e 100644 --- a/btools/utils/util_skeleton.py +++ b/btools/utils/util_skeleton.py @@ -5,8 +5,6 @@ import heapq import operator as op import itertools as it - -from enum import Enum from collections import namedtuple From 4706b5911e0471641fee4d06f6b1bbaedff03c4f Mon Sep 17 00:00:00 2001 From: ranjian0 Date: Sun, 12 Mar 2023 05:50:42 +0300 Subject: [PATCH 3/7] fix float error on clamp array count --- btools/building/array.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/btools/building/array.py b/btools/building/array.py index f5e7fd8..ad48666 100644 --- a/btools/building/array.py +++ b/btools/building/array.py @@ -68,7 +68,7 @@ def spread(self, val): def clamp_array_count(face, prop): """Keep array count to minimum number that fits all elements in the parent face""" - prop.count = clamp(prop.count, 1, calc_face_dimensions(face)[0] // prop.width) + prop.count = clamp(prop.count, 1, int(calc_face_dimensions(face)[0] // prop.width)) def get_array_split_edges(afaces): From 6814ef9899dc58b27429413012580b0e072982dd Mon Sep 17 00:00:00 2001 From: ranjian0 Date: Sun, 12 Mar 2023 12:42:17 +0300 Subject: [PATCH 4/7] cleanup --- __init__.py | 1 - btools/building/window/window_props.py | 4 ++-- btools/utils/util_common.py | 32 +++++++++++++++++++++++--- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/__init__.py b/__init__.py index d1e7d28..6b61a02 100644 --- a/__init__.py +++ b/__init__.py @@ -212,7 +212,6 @@ def unregister(): if __name__ == "__main__": import os - os.system("clear") # -- custom unregister for script watcher diff --git a/btools/building/window/window_props.py b/btools/building/window/window_props.py index 653c751..94072e9 100644 --- a/btools/building/window/window_props.py +++ b/btools/building/window/window_props.py @@ -7,10 +7,10 @@ PointerProperty ) -from ..fill import FillBars, FillLouver, FillGlassPanes -from ...utils import get_scaled_unit from ..arch import ArchProperty +from ...utils import get_scaled_unit from ..array import ArrayProperty, ArrayGetSet +from ..fill import FillBars, FillLouver, FillGlassPanes from ..sizeoffset import SizeOffsetGetSet, SizeOffsetProperty diff --git a/btools/utils/util_common.py b/btools/utils/util_common.py index 8bf9501..bee8d93 100644 --- a/btools/utils/util_common.py +++ b/btools/utils/util_common.py @@ -1,8 +1,9 @@ -import traceback -import enum import bpy +import enum import bmesh +import traceback from mathutils import Vector +from bpy.props import PointerProperty from .util_constants import VEC_UP, VEC_RIGHT @@ -135,11 +136,13 @@ def local_xyz(face): y = x.cross(z) return x, y, z + def XYDir(vec): """Remove the z component from a vector and normalize""" vec.z = 0 return vec.normalized() + def get_scaled_unit(value): """Mostly to scale prop values to current scene unit scale """ @@ -148,4 +151,27 @@ def get_scaled_unit(value): except AttributeError: # Addon Registration, context.scene is not available scale = 1.0 - return value / scale \ No newline at end of file + return value / scale + + +def get_defaults(prop): + defaults = dict() + for name, data in prop.__annotations__.items(): + if data.function == PointerProperty: + defaults[name] = get_defaults(getattr(prop, name)) + else: + defaults[name] = data.keywords.get('default') + + for name in list(defaults.keys()): + data = defaults[name] + if isinstance(data, dict): + for k, v in data.items(): + defaults[f'{name}.{k}'] = v + del defaults[name] + return defaults + + +def set_defaults(prop): + defaults = get_defaults(prop) + for name, value in defaults.items(): + setattr(prop, name, value) \ No newline at end of file From 9b11bf09bc1167000c75f48bf6fad43718d8792d Mon Sep 17 00:00:00 2001 From: ranjian0 Date: Sun, 12 Mar 2023 12:42:32 +0300 Subject: [PATCH 5/7] clamp size and offset on prop init --- btools/building/sizeoffset.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/btools/building/sizeoffset.py b/btools/building/sizeoffset.py index 886b6d3..90c3348 100644 --- a/btools/building/sizeoffset.py +++ b/btools/building/sizeoffset.py @@ -136,6 +136,8 @@ def init(self, parent_dimensions, default_size=(1.0, 1.0), default_offset=(0.0, if self.size == Vector((0, 0)): self.size = default_size self.offset = default_offset + self.clamp_size() + self.clamp_offset() def draw(self, context, box): From 4642e318b9f93601defd1f35eb9f27df5964442b Mon Sep 17 00:00:00 2001 From: ranjian0 Date: Sun, 12 Mar 2023 12:53:35 +0300 Subject: [PATCH 6/7] fix cone parameter --- btools/utils/util_geometry.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/btools/utils/util_geometry.py b/btools/utils/util_geometry.py index 97413fd..a4747df 100644 --- a/btools/utils/util_geometry.py +++ b/btools/utils/util_geometry.py @@ -32,8 +32,8 @@ def cone(bm, r1=0.5, r2=0.01, height=2, segs=32): """Create a cone in the bmesh""" return bmesh.ops.create_cone( bm, - diameter1=r1 * 2, - diameter2=r2 * 2, + radius1=r1, + radius2=r2, depth=height, cap_ends=True, cap_tris=True, From 570b175c8e09fb6dc1c766ff0f481263fcea4eb8 Mon Sep 17 00:00:00 2001 From: ranjian0 Date: Sun, 12 Mar 2023 12:56:34 +0300 Subject: [PATCH 7/7] bump version --- README.md | 4 ++-- __init__.py | 2 +- docs/_config.yml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4f589a5..a513983 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ and `Building Tools` was born. ## Installation -1. Download add-on (zipped) from this [link](https://github.com/ranjian0/building_tools/releases/download/v1.0.8/building_tools-v1.0.8.zip). +1. Download add-on (zipped) from this [link](https://github.com/ranjian0/building_tools/releases/download/v1.0.10/building_tools-v1.0.10.zip). 2. In blender, go to : Edit -> Preferences -> Add-ons -> Install. 3. Select the downloaded file and you're good to go. @@ -47,7 +47,7 @@ and `Building Tools` was born. ## Status -`Version` : `v1.0.9` +`Version` : `v1.0.10` **Blender 3.0 Compatible** diff --git a/__init__.py b/__init__.py index 6b61a02..0f87807 100644 --- a/__init__.py +++ b/__init__.py @@ -4,7 +4,7 @@ bl_info = { "name": "Building Tools", "author": "Ian Karanja (ranjian0), Lucky Kadam (luckykadam), Marcus (MCrafterzz)", - "version": (1, 0, 9), + "version": (1, 0, 10), "blender": (2, 80, 0), "location": "View3D > Toolshelf > Building Tools", "description": "Building Creation Tools", diff --git a/docs/_config.yml b/docs/_config.yml index 7655acf..a473ad2 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -1,11 +1,11 @@ theme: jekyll-theme-cayman title: [Building Tools] -description: [v1.0.9] +description: [v1.0.10] show_downloads: true github: - zip_url: https://github.com/ranjian0/building_tools/releases/download/v1.0.9/building_tools-v1.0.9.zip + zip_url: https://github.com/ranjian0/building_tools/releases/download/v1.0.10/building_tools-v1.0.10.zip google_analytics: UA-154906120-2