mirror of https://github.com/AxioDL/metaforce.git
Create directory chains at a late point during extract
This commit is contained in:
parent
e64168090c
commit
aecaab27a4
|
@ -1,4 +1,4 @@
|
|||
import bpy
|
||||
import bpy, struct
|
||||
|
||||
def draw(layout, context):
|
||||
if bpy.context.active_object:
|
||||
|
@ -63,24 +63,28 @@ def draw(layout, context):
|
|||
row.prop(obj.data, 'retro_light_angle_linear', text='Linear')
|
||||
row.prop(obj.data, 'retro_light_angle_quadratic', text='Quadratic')
|
||||
|
||||
def cook(path_out, version):
|
||||
fout = open(path_out, 'wb')
|
||||
fout.write(struct.pack('>IIIII'))
|
||||
|
||||
# Registration
|
||||
def register():
|
||||
frame_widget_types = [
|
||||
('RETRO_BWIG', 'Base Widget', '', 0),
|
||||
('RETRO_CAMR', 'Camera', '', 1),
|
||||
('RETRO_ENRG', 'Energy Bar', '', 2),
|
||||
('RETRO_GRUP', 'Group', '', 3),
|
||||
('RETRO_HWIG', 'Head Widget', '', 4),
|
||||
('RETRO_IMGP', 'Image Pane', '', 5),
|
||||
('RETRO_LITE', 'Light', '', 6),
|
||||
('RETRO_MODL', 'Model', '', 7),
|
||||
('RETRO_METR', 'Meter', '', 8),
|
||||
('RETRO_PANE', 'Pane', '', 9),
|
||||
('RETRO_SLGP', 'Slider Group', '', 10),
|
||||
('RETRO_TBGP', 'Table Group', '', 11),
|
||||
('RETRO_TXPN', 'Text Pane', '', 12)]
|
||||
bpy.types.Object.retro_widget_type = bpy.props.EnumProperty(items=frame_widget_types, name='Retro: FRME Widget Type', default='RETRO_BWIG')
|
||||
('RETRO_NONE', 'Not a Widget', '', 0),
|
||||
('RETRO_BWIG', 'Base Widget', '', 1),
|
||||
('RETRO_CAMR', 'Camera', '', 2),
|
||||
('RETRO_ENRG', 'Energy Bar', '', 3),
|
||||
('RETRO_GRUP', 'Group', '', 4),
|
||||
('RETRO_HWIG', 'Head Widget', '', 5),
|
||||
('RETRO_IMGP', 'Image Pane', '', 6),
|
||||
('RETRO_LITE', 'Light', '', 7),
|
||||
('RETRO_MODL', 'Model', '', 8),
|
||||
('RETRO_METR', 'Meter', '', 9),
|
||||
('RETRO_PANE', 'Pane', '', 10),
|
||||
('RETRO_SLGP', 'Slider Group', '', 11),
|
||||
('RETRO_TBGP', 'Table Group', '', 12),
|
||||
('RETRO_TXPN', 'Text Pane', '', 13)]
|
||||
bpy.types.Object.retro_widget_type = bpy.props.EnumProperty(items=frame_widget_types, name='Retro: FRME Widget Type', default='RETRO_NONE')
|
||||
model_draw_flags = [
|
||||
('RETRO_SHADELESS', 'Shadeless', '', 0),
|
||||
('RETRO_OPAQUE', 'Opaque', '', 1),
|
||||
|
|
|
@ -26,7 +26,11 @@ else:
|
|||
err_path += "/hecl_%016X.derp" % os.getpid()
|
||||
|
||||
def readpipestr():
|
||||
read_len = struct.unpack('I', os.read(readfd, 4))[0]
|
||||
read_bytes = os.read(readfd, 4)
|
||||
if len(read_bytes) != 4:
|
||||
print('HECL connection lost or desynchronized')
|
||||
bpy.ops.wm.quit_blender()
|
||||
read_len = struct.unpack('I', read_bytes)[0]
|
||||
return os.read(readfd, read_len)
|
||||
|
||||
def writepipestr(linebytes):
|
||||
|
@ -223,6 +227,16 @@ def dataout_loop():
|
|||
writepipestr(b'OK')
|
||||
hecl.swld.cook(writepipebuf)
|
||||
|
||||
elif cmdargs[0] == 'FRAMECOMPILE':
|
||||
pathOut = cmdargs[1]
|
||||
version = int(cmdargs[2])
|
||||
if version != 1:
|
||||
writepipestr(b'bad version')
|
||||
continue
|
||||
|
||||
writepipestr(b'OK')
|
||||
hecl.frme.cook(pathOut, version)
|
||||
|
||||
elif cmdargs[0] == 'LIGHTCOMPILEALL':
|
||||
writepipestr(b'OK')
|
||||
lampCount = 0;
|
||||
|
|
|
@ -73,13 +73,16 @@ public:
|
|||
m_specPasses.reserve(hecl::Database::DATA_SPEC_REGISTRY.size());
|
||||
for (const hecl::Database::DataSpecEntry* entry : hecl::Database::DATA_SPEC_REGISTRY)
|
||||
{
|
||||
hecl::Database::IDataSpec* ds = entry->m_factory(*m_useProj, hecl::Database::DataSpecTool::Extract);
|
||||
if (ds)
|
||||
if (entry->m_factory)
|
||||
{
|
||||
if (ds->canExtract(m_einfo, m_reps))
|
||||
m_specPasses.emplace_back(entry, ds);
|
||||
else
|
||||
delete ds;
|
||||
hecl::Database::IDataSpec* ds = entry->m_factory(*m_useProj, hecl::Database::DataSpecTool::Extract);
|
||||
if (ds)
|
||||
{
|
||||
if (ds->canExtract(m_einfo, m_reps))
|
||||
m_specPasses.emplace_back(entry, ds);
|
||||
else
|
||||
delete ds;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 593170cefe2fa483c697475e9ca58c2e251d864e
|
||||
Subproject commit 8fe3e2152bba8ad547789c06a85917d924211038
|
|
@ -706,6 +706,9 @@ public:
|
|||
/** Gather all lights in scene (AREA blends only) */
|
||||
std::vector<Light> compileLights();
|
||||
|
||||
/** Compile GUI into FRME data (FRAME blends only) */
|
||||
void compileGuiFrame(const std::string& pathOut, int version);
|
||||
|
||||
/** Gather all texture paths in scene */
|
||||
std::vector<ProjectPath> getTextures();
|
||||
|
||||
|
|
|
@ -72,10 +72,11 @@ private:
|
|||
struct Worker
|
||||
{
|
||||
ClientProcess& m_proc;
|
||||
int m_idx;
|
||||
std::thread m_thr;
|
||||
BlenderToken m_blendTok;
|
||||
bool m_didInit = false;
|
||||
Worker(ClientProcess& proc);
|
||||
Worker(ClientProcess& proc, int idx);
|
||||
void proc();
|
||||
};
|
||||
std::vector<Worker> m_workers;
|
||||
|
|
|
@ -706,7 +706,7 @@ public:
|
|||
* Fatal log report is issued if directory is not able to be created or doesn't already exist.
|
||||
* If directory already exists, no action taken.
|
||||
*/
|
||||
void makeDir() const {MakeDir(m_projRoot.c_str());}
|
||||
void makeDir() const { MakeDir(m_projRoot.c_str()); }
|
||||
|
||||
/**
|
||||
* @brief HECL-specific xxhash
|
||||
|
@ -1188,7 +1188,7 @@ public:
|
|||
* Fatal log report is issued if directory is not able to be created or doesn't already exist.
|
||||
* If directory already exists, no action taken.
|
||||
*/
|
||||
void makeDir() const {MakeDir(m_absPath.c_str());}
|
||||
void makeDir() const { MakeDir(m_absPath.c_str()); }
|
||||
|
||||
/**
|
||||
* @brief Create directory chain leading up to path
|
||||
|
|
|
@ -1332,6 +1332,22 @@ std::vector<BlenderConnection::DataStream::Light> BlenderConnection::DataStream:
|
|||
return ret;
|
||||
}
|
||||
|
||||
void BlenderConnection::DataStream::compileGuiFrame(const std::string& pathOut, int version)
|
||||
{
|
||||
if (m_parent->m_loadedType != BlendType::Frame)
|
||||
BlenderLog.report(logvisor::Fatal, _S("%s is not a FRAME blend"),
|
||||
m_parent->m_loadedBlend.getAbsolutePath().c_str());
|
||||
|
||||
char req[512];
|
||||
snprintf(req, 512, "FRAMECOMPILE %s %d", pathOut.c_str(), version);
|
||||
m_parent->_writeStr(req);
|
||||
|
||||
char readBuf[256];
|
||||
m_parent->_readStr(readBuf, 256);
|
||||
if (strcmp(readBuf, "OK"))
|
||||
BlenderLog.report(logvisor::Fatal, "unable to compile frame: %s", readBuf);
|
||||
}
|
||||
|
||||
std::vector<ProjectPath> BlenderConnection::DataStream::getTextures()
|
||||
{
|
||||
m_parent->_writeStr("GETTEXTURES");
|
||||
|
|
|
@ -53,14 +53,18 @@ void ClientProcess::LambdaTransaction::run(BlenderToken& btok)
|
|||
m_complete = true;
|
||||
}
|
||||
|
||||
ClientProcess::Worker::Worker(ClientProcess& proc)
|
||||
: m_proc(proc)
|
||||
ClientProcess::Worker::Worker(ClientProcess& proc, int idx)
|
||||
: m_proc(proc), m_idx(idx)
|
||||
{
|
||||
m_thr = std::thread(std::bind(&Worker::proc, this));
|
||||
}
|
||||
|
||||
void ClientProcess::Worker::proc()
|
||||
{
|
||||
char thrName[64];
|
||||
snprintf(thrName, 64, "HECL Client Worker %d", m_idx);
|
||||
logvisor::RegisterThreadName(thrName);
|
||||
|
||||
while (m_proc.m_running)
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(m_proc.m_mutex);
|
||||
|
@ -100,7 +104,7 @@ ClientProcess::ClientProcess(int verbosityLevel)
|
|||
for (int i=0 ; i<cpuCount ; ++i)
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(m_mutex);
|
||||
m_workers.emplace_back(*this);
|
||||
m_workers.emplace_back(*this, m_workers.size());
|
||||
m_initCv.wait(lk);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -499,7 +499,7 @@ bool Project::cookPath(const ProjectPath& path, FProgress progress,
|
|||
std::vector<SpecInst> specInsts;
|
||||
specInsts.reserve(m_compiledSpecs.size());
|
||||
for (const ProjectDataSpec& spec : m_compiledSpecs)
|
||||
if (spec.active)
|
||||
if (spec.active && spec.spec.m_factory)
|
||||
specInsts.emplace_back(&spec.spec,
|
||||
std::unique_ptr<IDataSpec>(spec.spec.m_factory(*this, DataSpecTool::Cook)));
|
||||
|
||||
|
|
Loading…
Reference in New Issue