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):
|
def draw(layout, context):
|
||||||
if bpy.context.active_object:
|
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_linear', text='Linear')
|
||||||
row.prop(obj.data, 'retro_light_angle_quadratic', text='Quadratic')
|
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
|
# Registration
|
||||||
def register():
|
def register():
|
||||||
frame_widget_types = [
|
frame_widget_types = [
|
||||||
('RETRO_BWIG', 'Base Widget', '', 0),
|
('RETRO_NONE', 'Not a Widget', '', 0),
|
||||||
('RETRO_CAMR', 'Camera', '', 1),
|
('RETRO_BWIG', 'Base Widget', '', 1),
|
||||||
('RETRO_ENRG', 'Energy Bar', '', 2),
|
('RETRO_CAMR', 'Camera', '', 2),
|
||||||
('RETRO_GRUP', 'Group', '', 3),
|
('RETRO_ENRG', 'Energy Bar', '', 3),
|
||||||
('RETRO_HWIG', 'Head Widget', '', 4),
|
('RETRO_GRUP', 'Group', '', 4),
|
||||||
('RETRO_IMGP', 'Image Pane', '', 5),
|
('RETRO_HWIG', 'Head Widget', '', 5),
|
||||||
('RETRO_LITE', 'Light', '', 6),
|
('RETRO_IMGP', 'Image Pane', '', 6),
|
||||||
('RETRO_MODL', 'Model', '', 7),
|
('RETRO_LITE', 'Light', '', 7),
|
||||||
('RETRO_METR', 'Meter', '', 8),
|
('RETRO_MODL', 'Model', '', 8),
|
||||||
('RETRO_PANE', 'Pane', '', 9),
|
('RETRO_METR', 'Meter', '', 9),
|
||||||
('RETRO_SLGP', 'Slider Group', '', 10),
|
('RETRO_PANE', 'Pane', '', 10),
|
||||||
('RETRO_TBGP', 'Table Group', '', 11),
|
('RETRO_SLGP', 'Slider Group', '', 11),
|
||||||
('RETRO_TXPN', 'Text Pane', '', 12)]
|
('RETRO_TBGP', 'Table Group', '', 12),
|
||||||
bpy.types.Object.retro_widget_type = bpy.props.EnumProperty(items=frame_widget_types, name='Retro: FRME Widget Type', default='RETRO_BWIG')
|
('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 = [
|
model_draw_flags = [
|
||||||
('RETRO_SHADELESS', 'Shadeless', '', 0),
|
('RETRO_SHADELESS', 'Shadeless', '', 0),
|
||||||
('RETRO_OPAQUE', 'Opaque', '', 1),
|
('RETRO_OPAQUE', 'Opaque', '', 1),
|
||||||
|
|
|
@ -26,7 +26,11 @@ else:
|
||||||
err_path += "/hecl_%016X.derp" % os.getpid()
|
err_path += "/hecl_%016X.derp" % os.getpid()
|
||||||
|
|
||||||
def readpipestr():
|
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)
|
return os.read(readfd, read_len)
|
||||||
|
|
||||||
def writepipestr(linebytes):
|
def writepipestr(linebytes):
|
||||||
|
@ -223,6 +227,16 @@ def dataout_loop():
|
||||||
writepipestr(b'OK')
|
writepipestr(b'OK')
|
||||||
hecl.swld.cook(writepipebuf)
|
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':
|
elif cmdargs[0] == 'LIGHTCOMPILEALL':
|
||||||
writepipestr(b'OK')
|
writepipestr(b'OK')
|
||||||
lampCount = 0;
|
lampCount = 0;
|
||||||
|
|
|
@ -72,6 +72,8 @@ public:
|
||||||
|
|
||||||
m_specPasses.reserve(hecl::Database::DATA_SPEC_REGISTRY.size());
|
m_specPasses.reserve(hecl::Database::DATA_SPEC_REGISTRY.size());
|
||||||
for (const hecl::Database::DataSpecEntry* entry : hecl::Database::DATA_SPEC_REGISTRY)
|
for (const hecl::Database::DataSpecEntry* entry : hecl::Database::DATA_SPEC_REGISTRY)
|
||||||
|
{
|
||||||
|
if (entry->m_factory)
|
||||||
{
|
{
|
||||||
hecl::Database::IDataSpec* ds = entry->m_factory(*m_useProj, hecl::Database::DataSpecTool::Extract);
|
hecl::Database::IDataSpec* ds = entry->m_factory(*m_useProj, hecl::Database::DataSpecTool::Extract);
|
||||||
if (ds)
|
if (ds)
|
||||||
|
@ -83,6 +85,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void Help(HelpOutput& help)
|
static void Help(HelpOutput& help)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 593170cefe2fa483c697475e9ca58c2e251d864e
|
Subproject commit 8fe3e2152bba8ad547789c06a85917d924211038
|
|
@ -706,6 +706,9 @@ public:
|
||||||
/** Gather all lights in scene (AREA blends only) */
|
/** Gather all lights in scene (AREA blends only) */
|
||||||
std::vector<Light> compileLights();
|
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 */
|
/** Gather all texture paths in scene */
|
||||||
std::vector<ProjectPath> getTextures();
|
std::vector<ProjectPath> getTextures();
|
||||||
|
|
||||||
|
|
|
@ -72,10 +72,11 @@ private:
|
||||||
struct Worker
|
struct Worker
|
||||||
{
|
{
|
||||||
ClientProcess& m_proc;
|
ClientProcess& m_proc;
|
||||||
|
int m_idx;
|
||||||
std::thread m_thr;
|
std::thread m_thr;
|
||||||
BlenderToken m_blendTok;
|
BlenderToken m_blendTok;
|
||||||
bool m_didInit = false;
|
bool m_didInit = false;
|
||||||
Worker(ClientProcess& proc);
|
Worker(ClientProcess& proc, int idx);
|
||||||
void proc();
|
void proc();
|
||||||
};
|
};
|
||||||
std::vector<Worker> m_workers;
|
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.
|
* 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.
|
* 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
|
* @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.
|
* 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.
|
* 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
|
* @brief Create directory chain leading up to path
|
||||||
|
|
|
@ -1332,6 +1332,22 @@ std::vector<BlenderConnection::DataStream::Light> BlenderConnection::DataStream:
|
||||||
return ret;
|
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()
|
std::vector<ProjectPath> BlenderConnection::DataStream::getTextures()
|
||||||
{
|
{
|
||||||
m_parent->_writeStr("GETTEXTURES");
|
m_parent->_writeStr("GETTEXTURES");
|
||||||
|
|
|
@ -53,14 +53,18 @@ void ClientProcess::LambdaTransaction::run(BlenderToken& btok)
|
||||||
m_complete = true;
|
m_complete = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientProcess::Worker::Worker(ClientProcess& proc)
|
ClientProcess::Worker::Worker(ClientProcess& proc, int idx)
|
||||||
: m_proc(proc)
|
: m_proc(proc), m_idx(idx)
|
||||||
{
|
{
|
||||||
m_thr = std::thread(std::bind(&Worker::proc, this));
|
m_thr = std::thread(std::bind(&Worker::proc, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientProcess::Worker::proc()
|
void ClientProcess::Worker::proc()
|
||||||
{
|
{
|
||||||
|
char thrName[64];
|
||||||
|
snprintf(thrName, 64, "HECL Client Worker %d", m_idx);
|
||||||
|
logvisor::RegisterThreadName(thrName);
|
||||||
|
|
||||||
while (m_proc.m_running)
|
while (m_proc.m_running)
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lk(m_proc.m_mutex);
|
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)
|
for (int i=0 ; i<cpuCount ; ++i)
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lk(m_mutex);
|
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);
|
m_initCv.wait(lk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -499,7 +499,7 @@ bool Project::cookPath(const ProjectPath& path, FProgress progress,
|
||||||
std::vector<SpecInst> specInsts;
|
std::vector<SpecInst> specInsts;
|
||||||
specInsts.reserve(m_compiledSpecs.size());
|
specInsts.reserve(m_compiledSpecs.size());
|
||||||
for (const ProjectDataSpec& spec : m_compiledSpecs)
|
for (const ProjectDataSpec& spec : m_compiledSpecs)
|
||||||
if (spec.active)
|
if (spec.active && spec.spec.m_factory)
|
||||||
specInsts.emplace_back(&spec.spec,
|
specInsts.emplace_back(&spec.spec,
|
||||||
std::unique_ptr<IDataSpec>(spec.spec.m_factory(*this, DataSpecTool::Cook)));
|
std::unique_ptr<IDataSpec>(spec.spec.m_factory(*this, DataSpecTool::Cook)));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue