-
Notifications
You must be signed in to change notification settings - Fork 254
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
1,072 additions
and
539 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
898 changes: 444 additions & 454 deletions
898
blender-for-unrealengine/bfu_import_module/asset_import.py
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
blender-for-unrealengine/bfu_import_module/bps/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# ====================== BEGIN GPL LICENSE BLOCK ============================ | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# All rights reserved. | ||
# | ||
# ======================= END GPL LICENSE BLOCK ============================= | ||
|
||
# ---------------------------------------------- | ||
# BPS -> BleuRaven Python Script | ||
# BleuRaven.fr | ||
# XavierLoux.com | ||
# ---------------------------------------------- | ||
|
||
import importlib | ||
|
||
from . import advprint | ||
from . import utils | ||
from . import math | ||
from . import color_set | ||
|
||
if "advprint" in locals(): | ||
importlib.reload(advprint) | ||
if "utils" in locals(): | ||
importlib.reload(utils) | ||
if "math" in locals(): | ||
importlib.reload(math) | ||
if "math" in locals(): | ||
importlib.reload(color_set) |
127 changes: 127 additions & 0 deletions
127
blender-for-unrealengine/bfu_import_module/bps/advprint.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
# ====================== BEGIN GPL LICENSE BLOCK ============================ | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# All rights reserved. | ||
# | ||
# ======================= END GPL LICENSE BLOCK ============================= | ||
|
||
# ---------------------------------------------- | ||
# BPS -> BleuRaven Python Script | ||
# BleuRaven.fr | ||
# XavierLoux.com | ||
# ---------------------------------------------- | ||
|
||
|
||
import sys | ||
import time | ||
|
||
|
||
class ProgressionBarClass(): | ||
|
||
def _get_name(self): | ||
return self.__name | ||
|
||
def _set_name(self, value): | ||
if not isinstance(value, str): | ||
raise TypeError("name must be set to an String") | ||
self.__name = value | ||
|
||
name = property(_get_name, _set_name) | ||
|
||
def _get_length(self): | ||
return self.__length | ||
|
||
def _set_length(self, value): | ||
if not isinstance(value, int): | ||
raise TypeError("length must be set to an Integer") | ||
self.__length = value | ||
|
||
length = property(_get_length, _set_length) | ||
|
||
previous_step = 0.0 | ||
|
||
def _get_total_step(self): | ||
return self.__total_step | ||
|
||
def _set_total_step(self, value): | ||
if not (isinstance(value, int) or isinstance(value, float)): | ||
raise TypeError("total_step must be set to an Integer or Float") | ||
|
||
self.__total_step = value | ||
|
||
total_step = property(_get_total_step, _set_total_step) | ||
|
||
# Visual | ||
show_block = True | ||
show_steps = True | ||
show_percentage = True | ||
|
||
def __init__(self): | ||
self.__name = "My progression bar" | ||
self.__length = 20 # modify this to change the length | ||
self.__previous_step = 0.0 | ||
self.__total_step = 1.0 # from 0 to 1 | ||
self.__counter_start = time.perf_counter() | ||
|
||
def update_progress(self, progress): | ||
job_title = self.__name | ||
length = self.__length | ||
total_step = self.__total_step | ||
self.__previous_step = progress # Update the previous step. | ||
|
||
is_done = False | ||
if progress >= total_step: | ||
is_done = True | ||
|
||
# Write message. | ||
msg = "\r{0}:".format(job_title) | ||
|
||
if self.show_block: | ||
block = int(round(length*progress/total_step)) | ||
msg += " [{0}]".format("#"*block + "-"*(length-block)) | ||
|
||
if self.show_steps: | ||
msg += " {0}/{1}".format(progress, total_step) | ||
|
||
if is_done: | ||
msg += " DONE IN {0}s\r\n".format(round(time.perf_counter()-self.__counter_start, 3)) | ||
|
||
else: | ||
if self.show_percentage: | ||
msg += " {0}%".format(round((progress*100)/total_step, 2)) | ||
|
||
sys.stdout.write(msg) | ||
sys.stdout.flush() | ||
|
||
|
||
def print_separation(number=60, char="-"): | ||
""" | ||
Prints a separation line consisting of '#' characters. | ||
Args: | ||
number (int, optional): The number of '#' characters in the line. Defaults to 60. | ||
""" | ||
print("# {0} #".format(char * number)) | ||
|
||
|
||
def print_title(text, number=60): | ||
""" | ||
Prints a title surrounded by a line of '#' characters. | ||
Args: | ||
text (str): The text of the title. | ||
number (int, optional): The total number of characters in the line. Defaults to 60. | ||
""" | ||
remain_number = len(text) - number - 2 | ||
print("# {0} {1} {2} #".format("-" * remain_number, text, "-" * remain_number)) |
156 changes: 156 additions & 0 deletions
156
blender-for-unrealengine/bfu_import_module/bps/color_set.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
# ====================== BEGIN GPL LICENSE BLOCK ============================ | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# All rights reserved. | ||
# | ||
# ======================= END GPL LICENSE BLOCK ============================= | ||
|
||
# ---------------------------------------------- | ||
# BPS -> BleuRaven Python Script | ||
# BleuRaven.fr | ||
# XavierLoux.com | ||
# ---------------------------------------------- | ||
|
||
# This use ANSI color codes. | ||
# You can found it all here -> https://gist.github.com/JBlond/2fea43a3049b38287e5e9cefc87b2124 | ||
# This file use the code of rene-d -> https://gist.github.com/rene-d/9e584a7dd2935d0f461904b9f2950007 | ||
|
||
|
||
|
||
# SGR color constants | ||
# rene-d 2018 | ||
|
||
class Colors: | ||
""" ANSI color codes """ | ||
|
||
# Color | ||
BLACK = "\033[0;30m" | ||
RED = "\033[0;31m" | ||
GREEN = "\033[0;32m" | ||
BROWN = "\033[0;33m" | ||
BLUE = "\033[0;34m" | ||
PURPLE = "\033[0;35m" | ||
CYAN = "\033[0;36m" | ||
LIGHT_GRAY = "\033[0;37m" | ||
DARK_GRAY = "\033[1;30m" | ||
LIGHT_RED = "\033[1;31m" | ||
LIGHT_GREEN = "\033[1;32m" | ||
YELLOW = "\033[1;33m" | ||
LIGHT_BLUE = "\033[1;34m" | ||
LIGHT_PURPLE = "\033[1;35m" | ||
LIGHT_CYAN = "\033[1;36m" | ||
LIGHT_WHITE = "\033[1;37m" | ||
|
||
#Style | ||
BOLD = "\033[1m" | ||
FAINT = "\033[2m" | ||
ITALIC = "\033[3m" | ||
UNDERLINE = "\033[4m" | ||
BLINK = "\033[5m" | ||
NEGATIVE = "\033[7m" | ||
CROSSED = "\033[9m" | ||
END = "\033[0m" | ||
|
||
|
||
@staticmethod | ||
def black(string): | ||
return Colors.BLACK + string + Colors.END | ||
|
||
@staticmethod | ||
def red(string): | ||
return Colors.RED + string + Colors.END | ||
|
||
@staticmethod | ||
def green(string): | ||
return Colors.GREEN + string + Colors.END | ||
|
||
@staticmethod | ||
def brown(string): | ||
return Colors.BROWN + string + Colors.END | ||
|
||
@staticmethod | ||
def blue(string): | ||
return Colors.BLUE + string + Colors.END | ||
|
||
@staticmethod | ||
def purple(string): | ||
return Colors.PURPLE + string + Colors.END | ||
|
||
@staticmethod | ||
def cyan(string): | ||
return Colors.CYAN + string + Colors.END | ||
|
||
@staticmethod | ||
def light_gray(string): | ||
return Colors.LIGHT_GRAY + string + Colors.END | ||
|
||
@staticmethod | ||
def dark_gray(string): | ||
return Colors.DARK_GRAY + string + Colors.END | ||
|
||
@staticmethod | ||
def light_red(string): | ||
return Colors.LIGHT_RED + string + Colors.END | ||
|
||
@staticmethod | ||
def light_green(string): | ||
return Colors.LIGHT_GREEN + string + Colors.END | ||
|
||
@staticmethod | ||
def yellow(string): | ||
return Colors.YELLOW + string + Colors.END | ||
|
||
@staticmethod | ||
def light_blue(string): | ||
return Colors.LIGHT_BLUE + string + Colors.END | ||
|
||
@staticmethod | ||
def light_purple(string): | ||
return Colors.LIGHT_PURPLE + string + Colors.END | ||
|
||
@staticmethod | ||
def light_cyan(string): | ||
return Colors.LIGHT_CYAN + string + Colors.END | ||
|
||
@staticmethod | ||
def light_white(string): | ||
return Colors.LIGHT_WHITE + string + Colors.END | ||
|
||
@staticmethod | ||
def bold(string): | ||
return Colors.BOLD + string + Colors.END | ||
|
||
@staticmethod | ||
def faint(string): | ||
return Colors.FAINT + string + Colors.END | ||
|
||
@staticmethod | ||
def italic(string): | ||
return Colors.ITALIC + string + Colors.END | ||
|
||
@staticmethod | ||
def underline(string): | ||
return Colors.UNDERLINE + string + Colors.END | ||
|
||
@staticmethod | ||
def blink(string): | ||
return Colors.BLINK + string + Colors.END | ||
|
||
@staticmethod | ||
def negative(string): | ||
return Colors.NEGATIVE + string + Colors.END | ||
|
||
@staticmethod | ||
def crossed(string): | ||
return Colors.CROSSED + string + Colors.END |
Oops, something went wrong.