Compare commits

...

12 commits

Author SHA1 Message Date
themancalledjakob
36ae68761d cosmetics 2024-11-05 16:03:09 +01:00
themancalledjakob
56904287a3 fix import
forgotten to add to older commit
2024-11-05 16:02:58 +01:00
themancalledjakob
a7e6bdf082 nothing
for local development, documenting optional setup
2024-11-05 16:01:52 +01:00
themancalledjakob
30251a635f cosmetics 2024-11-05 16:01:15 +01:00
themancalledjakob
4a10584710 possibly better description 2024-11-05 16:00:52 +01:00
themancalledjakob
77fdf7d93a add auto_updater 2024-11-05 15:45:50 +01:00
themancalledjakob
5e74787bb0 documentation 2024-11-05 15:42:14 +01:00
themancalledjakob
c302676ae3 bump version 2024-10-31 19:34:47 +01:00
themancalledjakob
e8fd0d8243 reset text on depsgraph update 2024-10-31 19:34:31 +01:00
themancalledjakob
b6d76ae958 update types automatically 2024-10-31 19:33:49 +01:00
themancalledjakob
e5e8a1b053 open asset directory 2024-10-31 19:33:22 +01:00
themancalledjakob
dfd08de27d fix offset when altering first point
fix #2
2024-10-31 19:31:45 +01:00
8 changed files with 3893 additions and 342 deletions

1
.gitignore vendored
View file

@ -5,3 +5,4 @@ venv
# vim
*.swo
*.swp
/abc3d_updater/*

View file

@ -5,6 +5,12 @@ source venv/bin/activate
pip install bpy
```
to install mathutils, this was necessary for me:
```
sudo xbps-install -Sy python3.11-devel
CFLAGS=$(python3.11-config --cflags) LDFLAGS=$(python3.11-config --ldflags) pip install mathutils
```
# install addon:
```bash
cd <root directory>

File diff suppressed because it is too large Load diff

View file

@ -6,12 +6,15 @@ let g:jedi#environment_path = "venv"
""""""""""""""""""""""""""""""""" ALE
"let g:ale_python_pylint_executable = '/home/jrkb/git/pointer/neomatter/font3d/font3d_blender_addon/venv/bin/pylint'
"let g:ale_python_executable='/home/jrkb/git/pointer/neomatter/font3d/font3d_blender_addon/venv/bin/python'
"let g:ale_python_pylint_executable = '/home/jrkb/git/pointer/neomatter/font3d/abc3d/venv/bin/pylint'
"let g:ale_python_executable='/home/jrkb/git/pointer/neomatter/font3d/abc3d/venv/bin/python'
"let g:ale_python_pylint_use_global=1
"let g:ale_use_global_executables=1
"let g:ale_python_auto_pipenv=1
"let g:ale_python_auto_virtualenv=1
"let g:ale_virtualenv_dir_names = ['venv']
"let g:ale_linters = { 'javascript': ['eslint', 'tsserver'], 'python': ['jedils', 'pylint', 'flake8'], 'cpp': ['cc', 'clangcheck', 'clangd', 'clangtidy', 'clazy', 'cppcheck', 'cpplint', 'cquery', 'cspell', 'flawfinder'], 'php': ['php_cs_fixer'] }
"let g:ale_fixers = { '*': ['remove_trailing_lines', 'trim_whitespace'], 'python': ['autopep8'], 'cpp': ['uncrustify'], 'javascript': js_fixers, 'css': ['prettier'], 'json': ['prettier'], 'php': ['php_cs_fixer'] }
let g:ale_pattern_options = {'\.py$': {'ale_enabled': 0}}

1787
addon_updater.py Normal file

File diff suppressed because it is too large Load diff

1539
addon_updater_ops.py Normal file

File diff suppressed because it is too large Load diff

View file

@ -605,9 +605,21 @@ def is_mesh(o):
return type(o.data) == bpy.types.Mesh
def is_metrics_object(o):
if f"{utils.prefix()}_type" in o:
return o[f"{utils.prefix()}_type"] == 'metrics'
return (re.match(".*_metrics$", o.name) != None or re.match(".*_metrics.[\d]{3}$", o.name) != None) and is_mesh(o)
def is_text_object(o):
if f"{utils.prefix()}_type" in o:
return o[f"{utils.prefix()}_type"] == 'textobject'
for t in bpy.context.scene.abc3d_data.available_texts:
if o == t.text_object:
return True
return False
def is_glyph(o):
if f"{utils.prefix()}_type" in o:
return o[f"{utils.prefix()}_type"] == 'glyph'
try:
return type(o.parent) is not type(None) \
and "glyphs" in o.parent.name \
@ -616,6 +628,14 @@ def is_glyph(o):
except ReferenceError as e:
return False
def update_types():
scene = bpy.context.scene
abc3d_data = scene.abc3d_data
for t in abc3d_data.available_texts:
t.text_object[f"{utils.prefix()}_type"] = "textobject"
for g in t.glyphs:
g.glyph_object[f"{utils.prefix()}_type"] = "glyph"
# blender bound_box vertices
#
# 3------7.
@ -678,6 +698,11 @@ def set_text_on_curve(text_properties, recursive=True):
if len(text_properties.text) != len(text_properties.glyphs):
regenerate = True
# blender bug
# https://projects.blender.org/blender/blender/issues/100661
if mom.data.use_path:
regenerate = True
# if we regenerate.... delete objects
if regenerate:
completely_delete_objects(glyph_objects)
@ -749,7 +774,12 @@ def set_text_on_curve(text_properties, recursive=True):
location, tangent, spline_index = calc_point_on_bezier_curve(mom, advance, True, True)
if spline_index != previous_spline_index:
is_newline = True
ob.location = mom.matrix_world @ (location + text_properties.translation)
if regenerate:
ob.location = mom.matrix_world @ (location + text_properties.translation)
else:
ob.location = (location + text_properties.translation)
if not text_properties.ignore_orientation:
mask = [0]
input_rotations = [mathutils.Vector((0.0, 0.0, 0.0))]
@ -765,7 +795,10 @@ def set_text_on_curve(text_properties, recursive=True):
ob.rotation_mode = 'QUATERNION'
q = mathutils.Quaternion()
q.rotate(text_properties.orientation)
ob.rotation_quaternion = (mom.matrix_world @ motor[0] @ q.to_matrix().to_4x4()).to_quaternion()
if regenerate:
ob.rotation_quaternion = (mom.matrix_world @ motor[0] @ q.to_matrix().to_4x4()).to_quaternion()
else:
ob.rotation_quaternion = (motor[0] @ q.to_matrix().to_4x4()).to_quaternion()
else:
q = mathutils.Quaternion()
q.rotate(text_properties.orientation)
@ -812,6 +845,8 @@ def set_text_on_curve(text_properties, recursive=True):
if regenerate:
mom.select_set(True)
# https://projects.blender.org/blender/blender/issues/100661
mom.data.use_path = False
mom[f"{utils.prefix()}_type"] = "textobject"
mom[f"{utils.prefix()}_linked_textobject"] = text_properties.text_id
mom[f"{utils.prefix()}_font_name"] = text_properties.font_name

View file

@ -4,7 +4,7 @@ def get_version_major():
def get_version_minor():
return 0
def get_version_patch():
return 1
return 2
def get_version_string():
return f"{get_version_major()}.{get_version_minor()}.{get_version_patch}"
def prefix():
@ -30,6 +30,8 @@ def mapRange(in_value, in_min, in_max, out_min, out_max, clamp=False):
return max(out_max, min(out_min, output))
else:
return output
import warnings
import functools
@ -47,6 +49,9 @@ def deprecated(func):
return func(*args, **kwargs)
return new_func
import subprocess
import sys
def open_file_browser(directory):
if sys.platform=='win32':
os.startfile(directory)