Skip to content

Commit

Permalink
Initial (2.0) Release
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin113D committed Sep 1, 2023
0 parents commit a09381b
Show file tree
Hide file tree
Showing 104 changed files with 19,990 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
__pycache__/
.vscode/
.venv/
*.blend1
*_updater_status.json
/DLL
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Sonic Adventure Blender I/O Addon

### Current Minimum Blender Version: 3.6+

This addon adds support for the Sonic Adventure formats regarding import, export, animation editing, and additional features.

The latest release can always be found [here](https://github.com/X-Hax/SonicAdventureBlenderIO/releases).

Please visit the [wiki](https://github.com/X-Hax/SonicAdventureBlenderIO/wiki) for general usage and setup.

**The addon supports automatic updating.** This can be setup when installing the addon.
Binary file added SAIOTemplates.blend
Binary file not shown.
47 changes: 47 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
"""Main entry point for the Sonic Adventure I/O blender addon"""

from .source import register as reg

bl_info = {
"name": "Sonic Adventure I/O",
"author": "Justin113D, ItsEasyActually, X-Hax",
"description": "Import/Exporter for Sonic Adventure Model, Animation and other Formats.",
"version": (2, 0, 0),
"blender": (3, 6, 0),
"location": "",
"warning": "",
"doc_url": "https://x-hax.github.io/SonicAdventureBlenderIODocs/",
"tracker_url": "https://github.com/X-Hax/SonicAdventureBlenderIO/issues/new",
"category": "Import-Export"
}


def register():
reg.register_classes(bl_info)


def unregister():
reg.unregister_classes()


# When refreshing the addon, reload all modules
if locals().get('LOADED'):
LOADED = False
from importlib import reload
from sys import modules

modules[__name__] = reload(modules[__name__])
to_reload = {}
for name, module in modules.items():
if name.startswith(f"{__package__}."):
to_reload[name] = module

for name, module in to_reload.items():
globals()[name] = reload(module)

del reload, modules

if __name__ == "__main__":
register()

LOADED = True
30 changes: 30 additions & 0 deletions setup_python_virtual_environment.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@echo off
echo Setting up python virtual environment for the project
cd %~dp0

rem getting the python path
set /P python=Enter Blender Python Path:
echo %python%
IF EXIST %python% (
echo Python found

rem creating the virtual environment
%python% -m venv .venv
cd .venv\Scripts

rem first, we gotta upgrade pip
python.exe -m pip install --upgrade pip

rem now install the packages
pip.exe install pep8
pip.exe install autopep8
pip.exe install pycodestyle
pip.exe install pylint
pip.exe install pythonnet
pip.exe install fake-bpy-module-3.4

echo set up!

) ELSE (
echo Python path not valid. aborting
)
7 changes: 7 additions & 0 deletions source/exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class UserException(BaseException):

message: str

def __init__(self, message: str, *args: object):
self.message = message
super().__init__(*args)
84 changes: 84 additions & 0 deletions source/exporting/o_enum.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
from ..utility.enum_lut import *


def to_node_attributes(node_properties):
from SA3D.Modeling.Blender import Flags
return Flags.ComposeNodeAttributes(
node_properties.ignore_position,
node_properties.ignore_rotation,
node_properties.ignore_scale,
node_properties.skip_draw,
node_properties.skip_children,
node_properties.rotate_zyx,
node_properties.no_animate,
node_properties.no_morph
)


def to_evententry_attributes(evententry_properties):
from SA3D.Modeling.Blender import Flags
return Flags.ComposeEventEntryAttributes(
evententry_properties.unk0,
evententry_properties.enable_lighting,
evententry_properties.unk2,
evententry_properties.disable_shadow_catching,
evententry_properties.unk4,
evententry_properties.unk5,
evententry_properties.unk6,
evententry_properties.reflection,
evententry_properties.blare,
evententry_properties.unk9
)


def to_surface_attributes(saio_land_entry):
from SA3D.Modeling.Blender import Flags

names = [
name_to
for name_from, name_to in SURFACE_ATTRIBUTES.items()
if name_from.startswith("sf_")
and getattr(saio_land_entry, name_from)]

return Flags.ComposeSurfaceAttributes(names)


def to_blend_mode(blend_mode: str):
from SA3D.Modeling.ModelData import BlendMode
return getattr(BlendMode, BLEND_MODE[blend_mode])


def to_filter_mode(filter_mode: str):
from SA3D.Modeling.ModelData import FilterMode
return getattr(FilterMode, FILTER_MODE[filter_mode])


def to_tex_coord_id(tex_coord_id: str):
from SA3D.Modeling.ModelData.GC import TexCoordID
return getattr(TexCoordID, TEX_COORD_ID[tex_coord_id])


def to_tex_gen_type(tex_gen_type: str):
from SA3D.Modeling.ModelData.GC import TexGenType
return getattr(TexGenType, TEX_GEN_TYPE[tex_gen_type])


def to_tex_gen_matrix(tex_gen_matrix: str):
from SA3D.Modeling.ModelData.GC import TexGenMatrix
return getattr(TexGenMatrix, TEX_GEN_MATRIX[tex_gen_matrix])


def to_tex_gen_source(texgen_source):
from SA3D.Modeling.ModelData.GC import TexGenSrc
return getattr(TexGenSrc, TEX_GEN_SOURCE[texgen_source])


def to_attach_format(format):
from SA3D.Modeling.ModelData import AttachFormat
return getattr(AttachFormat, ATTACH_FORMAT[format])


def to_model_format(format):
from SA3D.Modeling.ObjectData import ModelFormat
return getattr(ModelFormat, MODEL_FORMAT[format])

Loading

0 comments on commit a09381b

Please sign in to comment.