Compare commits
12 commits
65710b05ee
...
36ae68761d
Author | SHA1 | Date | |
---|---|---|---|
|
36ae68761d | ||
|
56904287a3 | ||
|
a7e6bdf082 | ||
|
30251a635f | ||
|
4a10584710 | ||
|
77fdf7d93a | ||
|
5e74787bb0 | ||
|
c302676ae3 | ||
|
e8fd0d8243 | ||
|
b6d76ae958 | ||
|
e5e8a1b053 | ||
|
dfd08de27d |
8 changed files with 3893 additions and 342 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -5,3 +5,4 @@ venv
|
||||||
# vim
|
# vim
|
||||||
*.swo
|
*.swo
|
||||||
*.swp
|
*.swp
|
||||||
|
/abc3d_updater/*
|
||||||
|
|
|
@ -5,6 +5,12 @@ source venv/bin/activate
|
||||||
pip install bpy
|
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:
|
# install addon:
|
||||||
```bash
|
```bash
|
||||||
cd <root directory>
|
cd <root directory>
|
||||||
|
|
827
__init__.py
827
__init__.py
File diff suppressed because it is too large
Load diff
|
@ -6,12 +6,15 @@ let g:jedi#environment_path = "venv"
|
||||||
|
|
||||||
""""""""""""""""""""""""""""""""" ALE
|
""""""""""""""""""""""""""""""""" ALE
|
||||||
|
|
||||||
"let g:ale_python_pylint_executable = '/home/jrkb/git/pointer/neomatter/font3d/font3d_blender_addon/venv/bin/pylint'
|
"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/font3d_blender_addon/venv/bin/python'
|
"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_python_pylint_use_global=1
|
||||||
"let g:ale_use_global_executables=1
|
"let g:ale_use_global_executables=1
|
||||||
"let g:ale_python_auto_pipenv=1
|
"let g:ale_python_auto_pipenv=1
|
||||||
"let g:ale_python_auto_virtualenv=1
|
"let g:ale_python_auto_virtualenv=1
|
||||||
"let g:ale_virtualenv_dir_names = ['venv']
|
"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}}
|
let g:ale_pattern_options = {'\.py$': {'ale_enabled': 0}}
|
||||||
|
|
1787
addon_updater.py
Normal file
1787
addon_updater.py
Normal file
File diff suppressed because it is too large
Load diff
1539
addon_updater_ops.py
Normal file
1539
addon_updater_ops.py
Normal file
File diff suppressed because it is too large
Load diff
39
butils.py
39
butils.py
|
@ -605,9 +605,21 @@ def is_mesh(o):
|
||||||
return type(o.data) == bpy.types.Mesh
|
return type(o.data) == bpy.types.Mesh
|
||||||
|
|
||||||
def is_metrics_object(o):
|
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)
|
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):
|
def is_glyph(o):
|
||||||
|
if f"{utils.prefix()}_type" in o:
|
||||||
|
return o[f"{utils.prefix()}_type"] == 'glyph'
|
||||||
try:
|
try:
|
||||||
return type(o.parent) is not type(None) \
|
return type(o.parent) is not type(None) \
|
||||||
and "glyphs" in o.parent.name \
|
and "glyphs" in o.parent.name \
|
||||||
|
@ -616,6 +628,14 @@ def is_glyph(o):
|
||||||
except ReferenceError as e:
|
except ReferenceError as e:
|
||||||
return False
|
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
|
# blender bound_box vertices
|
||||||
#
|
#
|
||||||
# 3------7.
|
# 3------7.
|
||||||
|
@ -678,6 +698,11 @@ def set_text_on_curve(text_properties, recursive=True):
|
||||||
if len(text_properties.text) != len(text_properties.glyphs):
|
if len(text_properties.text) != len(text_properties.glyphs):
|
||||||
regenerate = True
|
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 we regenerate.... delete objects
|
||||||
if regenerate:
|
if regenerate:
|
||||||
completely_delete_objects(glyph_objects)
|
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)
|
location, tangent, spline_index = calc_point_on_bezier_curve(mom, advance, True, True)
|
||||||
if spline_index != previous_spline_index:
|
if spline_index != previous_spline_index:
|
||||||
is_newline = True
|
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:
|
if not text_properties.ignore_orientation:
|
||||||
mask = [0]
|
mask = [0]
|
||||||
input_rotations = [mathutils.Vector((0.0, 0.0, 0.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'
|
ob.rotation_mode = 'QUATERNION'
|
||||||
q = mathutils.Quaternion()
|
q = mathutils.Quaternion()
|
||||||
q.rotate(text_properties.orientation)
|
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:
|
else:
|
||||||
q = mathutils.Quaternion()
|
q = mathutils.Quaternion()
|
||||||
q.rotate(text_properties.orientation)
|
q.rotate(text_properties.orientation)
|
||||||
|
@ -812,6 +845,8 @@ def set_text_on_curve(text_properties, recursive=True):
|
||||||
|
|
||||||
if regenerate:
|
if regenerate:
|
||||||
mom.select_set(True)
|
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()}_type"] = "textobject"
|
||||||
mom[f"{utils.prefix()}_linked_textobject"] = text_properties.text_id
|
mom[f"{utils.prefix()}_linked_textobject"] = text_properties.text_id
|
||||||
mom[f"{utils.prefix()}_font_name"] = text_properties.font_name
|
mom[f"{utils.prefix()}_font_name"] = text_properties.font_name
|
||||||
|
|
|
@ -4,7 +4,7 @@ def get_version_major():
|
||||||
def get_version_minor():
|
def get_version_minor():
|
||||||
return 0
|
return 0
|
||||||
def get_version_patch():
|
def get_version_patch():
|
||||||
return 1
|
return 2
|
||||||
def get_version_string():
|
def get_version_string():
|
||||||
return f"{get_version_major()}.{get_version_minor()}.{get_version_patch}"
|
return f"{get_version_major()}.{get_version_minor()}.{get_version_patch}"
|
||||||
def prefix():
|
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))
|
return max(out_max, min(out_min, output))
|
||||||
else:
|
else:
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
import warnings
|
import warnings
|
||||||
import functools
|
import functools
|
||||||
|
|
||||||
|
@ -47,6 +49,9 @@ def deprecated(func):
|
||||||
return func(*args, **kwargs)
|
return func(*args, **kwargs)
|
||||||
return new_func
|
return new_func
|
||||||
|
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
def open_file_browser(directory):
|
def open_file_browser(directory):
|
||||||
if sys.platform=='win32':
|
if sys.platform=='win32':
|
||||||
os.startfile(directory)
|
os.startfile(directory)
|
||||||
|
|
Loading…
Reference in a new issue