Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
ranjian0 committed Mar 12, 2023
2 parents 08a7911 + 570b175 commit 4a5950e
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 18 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.9/building_tools-v1.0.9.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.

Expand All @@ -47,7 +47,7 @@ and `Building Tools` was born.

## Status

`Version` : `v1.0.9`
`Version` : `v1.0.10`

**Blender 3.0 Compatible**

Expand Down
3 changes: 1 addition & 2 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -212,7 +212,6 @@ def unregister():

if __name__ == "__main__":
import os

os.system("clear")

# -- custom unregister for script watcher
Expand Down
2 changes: 1 addition & 1 deletion btools/building/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion btools/building/material.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion btools/building/removegeom.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import bpy
import math
import bmesh
from .facemap import FaceMap, add_faces_to_map
from ..utils import (
Expand Down
2 changes: 2 additions & 0 deletions btools/building/sizeoffset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand Down
4 changes: 2 additions & 2 deletions btools/building/window/window_props.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
32 changes: 29 additions & 3 deletions btools/utils/util_common.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down Expand Up @@ -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
"""
Expand All @@ -148,4 +151,27 @@ def get_scaled_unit(value):
except AttributeError:
# Addon Registration, context.scene is not available
scale = 1.0
return value / scale
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)
4 changes: 2 additions & 2 deletions btools/utils/util_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions btools/utils/util_skeleton.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import heapq
import operator as op
import itertools as it

from enum import Enum
from collections import namedtuple


Expand Down
4 changes: 2 additions & 2 deletions docs/_config.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 4a5950e

Please sign in to comment.