2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-08-08 15:39:05 +00:00

Initial world blend type

This commit is contained in:
Jack Andersen 2015-10-23 15:21:58 -10:00
parent fc64c4d4a4
commit 9892d2176c
6 changed files with 90 additions and 10 deletions

View File

@ -372,6 +372,7 @@ static const char* BlendTypeStrs[] =
"MESH", "MESH",
"ACTOR", "ACTOR",
"AREA", "AREA",
"WORLD",
nullptr nullptr
}; };
@ -455,8 +456,8 @@ void BlenderConnection::deleteBlend()
} }
} }
void BlenderConnection::PyOutStream::linkBlend(const std::string& target, void BlenderConnection::PyOutStream::linkBlend(const char* target,
const std::string& objName, const char* objName,
bool link) bool link)
{ {
format("if '%s' not in bpy.data.scenes:\n" format("if '%s' not in bpy.data.scenes:\n"
@ -476,8 +477,27 @@ void BlenderConnection::PyOutStream::linkBlend(const std::string& target,
"else:\n" "else:\n"
" obj = bpy.data.objects['%s']\n" " obj = bpy.data.objects['%s']\n"
"\n", "\n",
objName.c_str(), target.c_str(), link?"True":"False", objName, target, link?"True":"False",
objName.c_str(), objName.c_str(), target.c_str(), objName.c_str()); objName, objName, target, objName);
}
void BlenderConnection::PyOutStream::linkBackground(const char* target,
const char* sceneName)
{
format("if '%s' not in bpy.data.scenes:\n"
" with bpy.data.libraries.load('''%s''', link=True, relative=True) as (data_from, data_to):\n"
" data_to.scenes = data_from.scenes\n"
" obj_scene = None\n"
" for scene in data_to.scenes:\n"
" if scene.name == '%s':\n"
" obj_scene = scene\n"
" break\n"
" if not obj_scene:\n"
" raise RuntimeError('''unable to find %s in %s. try deleting it and restart the extract.''')\n"
"\n"
"bpy.context.scene.background_set = bpy.data.scenes['%s']\n",
sceneName, target,
sceneName, sceneName, target, sceneName);
} }
BlenderConnection::DataStream::Mesh::Mesh BlenderConnection::DataStream::Mesh::Mesh

View File

@ -37,7 +37,8 @@ public:
TypeNone, TypeNone,
TypeMesh, TypeMesh,
TypeActor, TypeActor,
TypeArea TypeArea,
TypeWorld
}; };
private: private:
bool m_lock = false; bool m_lock = false;
@ -163,7 +164,56 @@ public:
this->write(result, length); this->write(result, length);
free(result); free(result);
} }
void linkBlend(const std::string& target, const std::string& objName, bool link=true); void linkBlend(const char* target, const char* objName, bool link=true);
void linkBackground(const char* target, const char* sceneName);
void AABBToBMesh(const atVec3f& min, const atVec3f& max)
{
format("bm = bmesh.new()\n"
"bm.verts.new((%f,%f,%f))\n"
"bm.verts.new((%f,%f,%f))\n"
"bm.verts.new((%f,%f,%f))\n"
"bm.verts.new((%f,%f,%f))\n"
"bm.verts.new((%f,%f,%f))\n"
"bm.verts.new((%f,%f,%f))\n"
"bm.verts.new((%f,%f,%f))\n"
"bm.verts.new((%f,%f,%f))\n"
"bm.verts.ensure_lookup_table()\n"
"bm.edges.new((bm.verts[0], bm.verts[1]))\n"
"bm.edges.new((bm.verts[0], bm.verts[2]))\n"
"bm.edges.new((bm.verts[0], bm.verts[4]))\n"
"bm.edges.new((bm.verts[3], bm.verts[1]))\n"
"bm.edges.new((bm.verts[3], bm.verts[2]))\n"
"bm.edges.new((bm.verts[3], bm.verts[7]))\n"
"bm.edges.new((bm.verts[5], bm.verts[1]))\n"
"bm.edges.new((bm.verts[5], bm.verts[4]))\n"
"bm.edges.new((bm.verts[5], bm.verts[7]))\n"
"bm.edges.new((bm.verts[6], bm.verts[2]))\n"
"bm.edges.new((bm.verts[6], bm.verts[4]))\n"
"bm.edges.new((bm.verts[6], bm.verts[7]))\n",
min.vec[0], min.vec[1], min.vec[2],
max.vec[0], min.vec[1], min.vec[2],
min.vec[0], max.vec[1], min.vec[2],
max.vec[0], max.vec[1], min.vec[2],
min.vec[0], min.vec[1], max.vec[2],
max.vec[0], min.vec[1], max.vec[2],
min.vec[0], max.vec[1], max.vec[2],
max.vec[0], max.vec[1], max.vec[2]);
}
void centerView()
{
*this << "bpy.context.user_preferences.view.smooth_view = 0\n"
"for window in bpy.context.window_manager.windows:\n"
" screen = window.screen\n"
" for area in screen.areas:\n"
" if area.type == 'VIEW_3D':\n"
" for region in area.regions:\n"
" if region.type == 'WINDOW':\n"
" override = {'scene': bpy.context.scene, 'window': window, 'screen': screen, 'area': area, 'region': region}\n"
" bpy.ops.view3d.view_all(override)\n"
" break\n";
}
class ANIMOutStream class ANIMOutStream
{ {

View File

@ -8,7 +8,8 @@ list(APPEND PY_SOURCES
hecl/sact/__init__.py hecl/sact/__init__.py
hecl/sact/SACTAction.py hecl/sact/SACTAction.py
hecl/sact/SACTSubtype.py hecl/sact/SACTSubtype.py
hecl/srea/__init__.py) hecl/srea/__init__.py
hecl/swld/__init__.py)
bintoc(hecl_blendershell.c hecl_blendershell.py HECL_BLENDERSHELL) bintoc(hecl_blendershell.c hecl_blendershell.py HECL_BLENDERSHELL)

View File

@ -9,7 +9,7 @@ bl_info = {
"category": "System"} "category": "System"}
# Package import # Package import
from . import hmdl, sact, srea, Nodegrid, Patching from . import hmdl, sact, srea, swld, Nodegrid, Patching
Nodegrid = Nodegrid.Nodegrid Nodegrid = Nodegrid.Nodegrid
import bpy, os, sys import bpy, os, sys
from bpy.app.handlers import persistent from bpy.app.handlers import persistent
@ -20,7 +20,8 @@ hecl_typeS = [
('NONE', "None", "Active scene not using HECL", None), ('NONE', "None", "Active scene not using HECL", None),
('MESH', "Mesh", "Active scene represents an HMDL Mesh", hmdl.draw), ('MESH', "Mesh", "Active scene represents an HMDL Mesh", hmdl.draw),
('ACTOR', "Actor", "Active scene represents a HECL Actor", sact.draw), ('ACTOR', "Actor", "Active scene represents a HECL Actor", sact.draw),
('AREA', "Area", "Active scene represents a HECL Area", srea.draw)] ('AREA', "Area", "Active scene represents a HECL Area", srea.draw),
('WORLD', "World", "Active scene represents a HECL World", swld.draw)]
# Main Scene Panel # Main Scene Panel
class hecl_scene_panel(bpy.types.Panel): class hecl_scene_panel(bpy.types.Panel):

View File

@ -0,0 +1,8 @@
# Cook
def cook(writebuf):
pass
# Panel draw
def draw(layout, context):
pass

2
hecl/extern/Athena vendored

@ -1 +1 @@
Subproject commit e8616914801e274155bfe8d9fe3353448f0ec219 Subproject commit f46edcd4b8cc6d3d49e7967c3710e0b39b925ba7