Various extract tweaks; ResourceLock integration

This commit is contained in:
Jack Andersen 2016-08-11 16:33:38 -10:00
parent 02a4d5501f
commit 42d39bf6b9
7 changed files with 22 additions and 8 deletions

View File

@ -420,7 +420,8 @@ public:
};
void InitGeomBlenderContext(hecl::BlenderConnection::PyOutStream& os,
const hecl::ProjectPath& masterShaderPath)
const hecl::ProjectPath& masterShaderPath,
bool solidShading)
{
os << "import math\n"
"from mathutils import Vector\n"
@ -505,6 +506,14 @@ void InitGeomBlenderContext(hecl::BlenderConnection::PyOutStream& os,
" return result\n"
"\n";
if (solidShading)
{
os << "for ar in bpy.context.screen.areas:\n"
" for sp in ar.spaces:\n"
" if sp.type == 'VIEW_3D':\n"
" sp.viewport_shade = 'SOLID'\n";
}
/* Link master shader library */
os.format("# Master shader library\n"
"with bpy.data.libraries.load('%s', link=True, relative=True) as (data_from, data_to):\n"
@ -1102,7 +1111,7 @@ bool ReadCMDLToBlender(hecl::BlenderConnection& conn,
"bpy.context.scene.name = '%s'\n"
"bpy.context.scene.hecl_mesh_obj = bpy.context.scene.name\n",
pakRouter.getBestEntryName(entry).c_str());
InitGeomBlenderContext(os, dataspec.getMasterShaderPath());
InitGeomBlenderContext(os, dataspec.getMasterShaderPath(), false);
MaterialSet::RegisterMaterialProps(os);
os << "# Materials\n"

View File

@ -131,7 +131,8 @@ void ReadMaterialSetToBlender_3(hecl::BlenderConnection::PyOutStream& os,
unsigned setIdx);
void InitGeomBlenderContext(hecl::BlenderConnection::PyOutStream& os,
const hecl::ProjectPath& masterShaderPath);
const hecl::ProjectPath& masterShaderPath,
bool solidShading);
void FinishBlenderMesh(hecl::BlenderConnection::PyOutStream& os,
unsigned matSetCount, int meshIdx);

View File

@ -459,6 +459,11 @@ bool PAKRouter<BRIDGETYPE>::extractResources(const BRIDGETYPE& pakBridge, bool f
const nod::Node* node = m_node.get();
hecl::ProjectPath working = getWorking(item, extractor);
hecl::ResourceLock resLk(working);
if (!resLk)
continue;
/* Extract first, so they start out invalid */
hecl::ProjectPath cooked = getCooked(item);
if (force || cooked.getPathType() == hecl::ProjectPath::Type::None)
@ -469,7 +474,6 @@ bool PAKRouter<BRIDGETYPE>::extractResources(const BRIDGETYPE& pakBridge, bool f
fclose(fout);
}
hecl::ProjectPath working = getWorking(item, extractor);
if (extractor.func_a) /* Doesn't need PAKRouter access */
{
if (force || working.getPathType() == hecl::ProjectPath::Type::None)

View File

@ -93,7 +93,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
"\n"
"bpy.context.scene.name = '%s'\n",
pakRouter.getBestEntryName(entry).c_str());
DNACMDL::InitGeomBlenderContext(os, dataSpec.getMasterShaderPath());
DNACMDL::InitGeomBlenderContext(os, dataSpec.getMasterShaderPath(), true);
MaterialSet::RegisterMaterialProps(os);
os << "# Clear Scene\n"
"for ob in bpy.data.objects:\n"

View File

@ -223,7 +223,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
"\n"
"bpy.context.scene.name = '%s'\n",
pakRouter.getBestEntryName(entry).c_str());
DNACMDL::InitGeomBlenderContext(os, dataSpec.getMasterShaderPath());
DNACMDL::InitGeomBlenderContext(os, dataSpec.getMasterShaderPath(), true);
MaterialSet::RegisterMaterialProps(os);
os << "# Clear Scene\n"
"for ob in bpy.data.objects:\n"

View File

@ -122,7 +122,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
"\n"
"bpy.context.scene.name = '%s'\n",
pakRouter.getBestEntryName(entry).c_str());
DNACMDL::InitGeomBlenderContext(os, dataSpec.getMasterShaderPath());
DNACMDL::InitGeomBlenderContext(os, dataSpec.getMasterShaderPath(), true);
MaterialSet::RegisterMaterialProps(os);
os << "# Clear Scene\n"
"for ob in bpy.data.objects:\n"

2
hecl

@ -1 +1 @@
Subproject commit c3403284714be1dbeba736e04194af57ae6e8e17
Subproject commit 700b166efaf9d548f1fc9e92f65894a398efee42