mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-08-05 02:55:35 +00:00
Initial world blend type
This commit is contained in:
parent
fc64c4d4a4
commit
9892d2176c
@ -372,6 +372,7 @@ static const char* BlendTypeStrs[] =
|
||||
"MESH",
|
||||
"ACTOR",
|
||||
"AREA",
|
||||
"WORLD",
|
||||
nullptr
|
||||
};
|
||||
|
||||
@ -455,8 +456,8 @@ void BlenderConnection::deleteBlend()
|
||||
}
|
||||
}
|
||||
|
||||
void BlenderConnection::PyOutStream::linkBlend(const std::string& target,
|
||||
const std::string& objName,
|
||||
void BlenderConnection::PyOutStream::linkBlend(const char* target,
|
||||
const char* objName,
|
||||
bool link)
|
||||
{
|
||||
format("if '%s' not in bpy.data.scenes:\n"
|
||||
@ -476,8 +477,27 @@ void BlenderConnection::PyOutStream::linkBlend(const std::string& target,
|
||||
"else:\n"
|
||||
" obj = bpy.data.objects['%s']\n"
|
||||
"\n",
|
||||
objName.c_str(), target.c_str(), link?"True":"False",
|
||||
objName.c_str(), objName.c_str(), target.c_str(), objName.c_str());
|
||||
objName, target, link?"True":"False",
|
||||
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
|
||||
|
@ -37,7 +37,8 @@ public:
|
||||
TypeNone,
|
||||
TypeMesh,
|
||||
TypeActor,
|
||||
TypeArea
|
||||
TypeArea,
|
||||
TypeWorld
|
||||
};
|
||||
private:
|
||||
bool m_lock = false;
|
||||
@ -163,7 +164,56 @@ public:
|
||||
this->write(result, length);
|
||||
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
|
||||
{
|
||||
|
@ -8,7 +8,8 @@ list(APPEND PY_SOURCES
|
||||
hecl/sact/__init__.py
|
||||
hecl/sact/SACTAction.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)
|
||||
|
||||
|
@ -9,7 +9,7 @@ bl_info = {
|
||||
"category": "System"}
|
||||
|
||||
# Package import
|
||||
from . import hmdl, sact, srea, Nodegrid, Patching
|
||||
from . import hmdl, sact, srea, swld, Nodegrid, Patching
|
||||
Nodegrid = Nodegrid.Nodegrid
|
||||
import bpy, os, sys
|
||||
from bpy.app.handlers import persistent
|
||||
@ -20,7 +20,8 @@ hecl_typeS = [
|
||||
('NONE', "None", "Active scene not using HECL", None),
|
||||
('MESH', "Mesh", "Active scene represents an HMDL Mesh", hmdl.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
|
||||
class hecl_scene_panel(bpy.types.Panel):
|
||||
|
8
hecl/blender/hecl/swld/__init__.py
Normal file
8
hecl/blender/hecl/swld/__init__.py
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
# Cook
|
||||
def cook(writebuf):
|
||||
pass
|
||||
|
||||
# Panel draw
|
||||
def draw(layout, context):
|
||||
pass
|
2
hecl/extern/Athena
vendored
2
hecl/extern/Athena
vendored
@ -1 +1 @@
|
||||
Subproject commit e8616914801e274155bfe8d9fe3353448f0ec219
|
||||
Subproject commit f46edcd4b8cc6d3d49e7967c3710e0b39b925ba7
|
Loading…
x
Reference in New Issue
Block a user