formating
auto format made this, i like most of the changes so let's keep it
This commit is contained in:
parent
5c79c7e06e
commit
33dac5eae1
3 changed files with 941 additions and 650 deletions
602
__init__.py
602
__init__.py
File diff suppressed because it is too large
Load diff
|
@ -1,25 +1,33 @@
|
||||||
# NOTE: also change version in ../__init__.py
|
# NOTE: also change version in ../__init__.py
|
||||||
def get_version_major():
|
def get_version_major():
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
def get_version_minor():
|
def get_version_minor():
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
def get_version_patch():
|
def get_version_patch():
|
||||||
return 5
|
return 5
|
||||||
|
|
||||||
|
|
||||||
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():
|
||||||
return "ABC3D"
|
return "ABC3D"
|
||||||
|
|
||||||
import time
|
|
||||||
import datetime
|
import datetime
|
||||||
from mathutils import (
|
import time
|
||||||
Vector,
|
|
||||||
)
|
from mathutils import Vector
|
||||||
|
|
||||||
|
|
||||||
def get_timestamp():
|
def get_timestamp():
|
||||||
return datetime.datetime \
|
return datetime.datetime.fromtimestamp(time.time()).strftime("%Y.%m.%d-%H:%M:%S")
|
||||||
.fromtimestamp(time.time()) \
|
|
||||||
.strftime('%Y.%m.%d-%H:%M:%S')
|
|
||||||
|
|
||||||
def mapRange(in_value, in_min, in_max, out_min, out_max, clamp=False):
|
def mapRange(in_value, in_min, in_max, out_min, out_max, clamp=False):
|
||||||
output = out_min + ((out_max - out_min) / (in_max - in_min)) * (in_value - in_min)
|
output = out_min + ((out_max - out_min) / (in_max - in_min)) * (in_value - in_min)
|
||||||
|
@ -32,36 +40,43 @@ def mapRange(in_value, in_min, in_max, out_min, out_max, clamp=False):
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
import warnings
|
|
||||||
import functools
|
import functools
|
||||||
|
import warnings
|
||||||
|
|
||||||
|
|
||||||
def deprecated(func):
|
def deprecated(func):
|
||||||
"""This is a decorator which can be used to mark functions
|
"""This is a decorator which can be used to mark functions
|
||||||
as deprecated. It will result in a warning being emitted
|
as deprecated. It will result in a warning being emitted
|
||||||
when the function is used."""
|
when the function is used."""
|
||||||
|
|
||||||
@functools.wraps(func)
|
@functools.wraps(func)
|
||||||
def new_func(*args, **kwargs):
|
def new_func(*args, **kwargs):
|
||||||
warnings.simplefilter('always', DeprecationWarning) # turn off filter
|
warnings.simplefilter("always", DeprecationWarning) # turn off filter
|
||||||
warnings.warn("Call to deprecated function {}.".format(func.__name__),
|
warnings.warn(
|
||||||
|
"Call to deprecated function {}.".format(func.__name__),
|
||||||
category=DeprecationWarning,
|
category=DeprecationWarning,
|
||||||
stacklevel=2)
|
stacklevel=2,
|
||||||
warnings.simplefilter('default', DeprecationWarning) # reset filter
|
)
|
||||||
|
warnings.simplefilter("default", DeprecationWarning) # reset filter
|
||||||
return func(*args, **kwargs)
|
return func(*args, **kwargs)
|
||||||
|
|
||||||
return new_func
|
return new_func
|
||||||
|
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
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)
|
||||||
|
|
||||||
elif sys.platform=='darwin':
|
elif sys.platform == "darwin":
|
||||||
subprocess.Popen(['open', directory])
|
subprocess.Popen(["open", directory])
|
||||||
|
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
subprocess.Popen(['xdg-open', directory])
|
subprocess.Popen(["xdg-open", directory])
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
# er, think of something else to try
|
# er, think of something else to try
|
||||||
|
@ -73,7 +88,7 @@ def printerr(*args, **kwargs):
|
||||||
|
|
||||||
|
|
||||||
def removeNonAlphabetic(s):
|
def removeNonAlphabetic(s):
|
||||||
return ''.join([i for i in s if i.isalpha()])
|
return "".join([i for i in s if i.isalpha()])
|
||||||
|
|
||||||
|
|
||||||
# # Evaluate a bezier curve for the parameter 0<=t<=1 along its length
|
# # Evaluate a bezier curve for the parameter 0<=t<=1 along its length
|
||||||
|
|
Loading…
Add table
Reference in a new issue