mirror of https://github.com/H-uru/korman.git
Browse Source
... And commence more work on the exporter. We now export CoordinateInterfaces! Go us.pull/6/head
Adam Johnson
11 years ago
6 changed files with 224 additions and 31 deletions
@ -0,0 +1,72 @@ |
|||||||
|
# This file is part of Korman. |
||||||
|
# |
||||||
|
# Korman 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. |
||||||
|
# |
||||||
|
# Korman 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 Korman. If not, see <http://www.gnu.org/licenses/>. |
||||||
|
|
||||||
|
import sys |
||||||
|
|
||||||
|
class ExportAnalysis: |
||||||
|
"""This is used to collect artist action items from the export process. You can warn about |
||||||
|
portability issues, possible oversights, etc. The benefit here is that the user doesn't have |
||||||
|
to look through all of the gobbledygook in the export log. |
||||||
|
""" |
||||||
|
|
||||||
|
_notices = {} |
||||||
|
_warnings = {} |
||||||
|
|
||||||
|
def save(self): |
||||||
|
# TODO |
||||||
|
pass |
||||||
|
|
||||||
|
def _stash(self, _d, category, message): |
||||||
|
if category not in _d: |
||||||
|
_d[category] = [message,] |
||||||
|
else: |
||||||
|
_d[category].append(message) |
||||||
|
|
||||||
|
def note(self, category, message): |
||||||
|
self._stash(self._notices, category, message) |
||||||
|
print("NOTICE {}: {}".format(category, message)) |
||||||
|
|
||||||
|
def warn(self, category, message): |
||||||
|
self._stash(self._warnings, category, message) |
||||||
|
print("WARNING {}: {}".format(category, message)) |
||||||
|
|
||||||
|
|
||||||
|
class ExportLogger: |
||||||
|
"""Yet Another Logger(TM)""" |
||||||
|
|
||||||
|
def __init__(self, fn): |
||||||
|
self._stdout = sys.stdout |
||||||
|
self._stderr = sys.stderr |
||||||
|
self._file = open(fn, "w") |
||||||
|
|
||||||
|
for i in dir(self._file): |
||||||
|
if not hasattr(self, i): |
||||||
|
setattr(self, i, getattr(self._file, i)) |
||||||
|
|
||||||
|
def __enter__(self): |
||||||
|
sys.stdout = self._file |
||||||
|
sys.stderr = self._file |
||||||
|
|
||||||
|
def __exit__(self, type, value, traceback): |
||||||
|
sys.stdout = self._stdout |
||||||
|
sys.stderr = self._stderr |
||||||
|
|
||||||
|
def write(self, str): |
||||||
|
self._file.write(str) |
||||||
|
self._stdout.write(str) |
||||||
|
|
||||||
|
def writelines(self, seq): |
||||||
|
self._file.writelines(seq) |
||||||
|
self._stdout.writelines(seq) |
@ -0,0 +1,21 @@ |
|||||||
|
# This file is part of Korman. |
||||||
|
# |
||||||
|
# Korman 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. |
||||||
|
# |
||||||
|
# Korman 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 Korman. If not, see <http://www.gnu.org/licenses/>. |
||||||
|
|
||||||
|
import bpy |
||||||
|
from PyHSPlasma import * |
||||||
|
|
||||||
|
class MeshConverter: |
||||||
|
# TODO |
||||||
|
pass |
@ -0,0 +1,26 @@ |
|||||||
|
# This file is part of Korman. |
||||||
|
# |
||||||
|
# Korman 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. |
||||||
|
# |
||||||
|
# Korman 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 Korman. If not, see <http://www.gnu.org/licenses/>. |
||||||
|
|
||||||
|
from PyHSPlasma import * |
||||||
|
|
||||||
|
def matrix44(blmat): |
||||||
|
"""Converts a mathutils.Matrix to an hsMatrix44""" |
||||||
|
hsmat = hsMatrix44() |
||||||
|
for i in range(4): |
||||||
|
hsmat[0, i] = blmat[i][0] |
||||||
|
hsmat[1, i] = blmat[i][1] |
||||||
|
hsmat[2, i] = blmat[i][2] |
||||||
|
hsmat[3, i] = blmat[i][3] |
||||||
|
return hsmat |
Loading…
Reference in new issue