mirror of https://github.com/AxioDL/metaforce.git
Additional BlenderConnection World capabilities
This commit is contained in:
parent
d307e645b1
commit
7f5ba744da
|
@ -204,12 +204,7 @@ def write_action_aabb(writebuf, arm_obj, mesh_obj):
|
|||
root_aabb_min[0], root_aabb_min[1], root_aabb_min[2],
|
||||
root_aabb_max[0], root_aabb_max[1], root_aabb_max[2]))
|
||||
|
||||
# Cook
|
||||
def cook(writebuf):
|
||||
bpy.context.scene.hecl_auto_remap = False
|
||||
sact_data = bpy.context.scene.hecl_sact_data
|
||||
|
||||
# Output armatures
|
||||
def _out_armatures(sact_data, writebuf):
|
||||
writebuf(struct.pack('I', len(bpy.data.armatures)))
|
||||
for arm in bpy.data.armatures:
|
||||
writebuf(struct.pack('I', len(arm.name)))
|
||||
|
@ -231,7 +226,7 @@ def cook(writebuf):
|
|||
for child in bone.children:
|
||||
writebuf(struct.pack('i', arm.bones.find(child.name)))
|
||||
|
||||
# Output subtypes
|
||||
def _out_subtypes(sact_data, writebuf):
|
||||
writebuf(struct.pack('I', len(sact_data.subtypes)))
|
||||
for subtype in sact_data.subtypes:
|
||||
writebuf(struct.pack('I', len(subtype.name)))
|
||||
|
@ -273,8 +268,7 @@ def cook(writebuf):
|
|||
else:
|
||||
writebuf(struct.pack('I', 0))
|
||||
|
||||
|
||||
# Output actions
|
||||
def _out_actions(sact_data, writebuf):
|
||||
writebuf(struct.pack('I', len(sact_data.actions)))
|
||||
for action_idx in range(len(sact_data.actions)):
|
||||
sact_data.active_action = action_idx
|
||||
|
@ -306,6 +300,33 @@ def cook(writebuf):
|
|||
mesh = bpy.data.objects[subtype.linked_mesh]
|
||||
write_action_aabb(writebuf, arm, mesh)
|
||||
|
||||
# Cook
|
||||
def cook(writebuf):
|
||||
bpy.context.scene.hecl_auto_remap = False
|
||||
sact_data = bpy.context.scene.hecl_sact_data
|
||||
|
||||
# Output armatures
|
||||
_out_armatures(sact_data, writebuf)
|
||||
|
||||
# Output subtypes
|
||||
_out_subtypes(sact_data, writebuf)
|
||||
|
||||
# Output actions
|
||||
_out_actions(sact_data, writebuf)
|
||||
|
||||
# Cook Character Data only
|
||||
def cook_character_only(writebuf):
|
||||
sact_data = bpy.context.scene.hecl_sact_data
|
||||
|
||||
# Output armatures
|
||||
_out_armatures(sact_data, writebuf)
|
||||
|
||||
# Output subtypes
|
||||
_out_subtypes(sact_data, writebuf)
|
||||
|
||||
# Output no actions
|
||||
writebuf(struct.pack('I', 0))
|
||||
|
||||
# Access actor's contained armature names
|
||||
def get_armature_names(writebuf):
|
||||
writebuf(struct.pack('I', len(bpy.data.armatures)))
|
||||
|
|
|
@ -5,7 +5,7 @@ def build_dock_connections():
|
|||
areas = []
|
||||
docks = []
|
||||
|
||||
for obj in bpy.context.scene.objects:
|
||||
for obj in sorted(bpy.context.scene.objects, key=lambda x: x.name):
|
||||
if obj.type == 'MESH' and obj.parent is None:
|
||||
dock_list = []
|
||||
for ch in obj.children:
|
||||
|
@ -29,8 +29,8 @@ def build_dock_connections():
|
|||
dock_dict[dockA[2].name] = dockB
|
||||
match = True
|
||||
break
|
||||
if not match:
|
||||
raise RuntimeError('No dock match for %s' % dockA[2].name)
|
||||
#if not match:
|
||||
# raise RuntimeError('No dock match for %s' % dockA[2].name)
|
||||
|
||||
return (areas, dock_dict)
|
||||
|
||||
|
@ -66,10 +66,13 @@ def cook(writebuf):
|
|||
for vi in range(4):
|
||||
v = wmtx * ch.data.vertices[vi].co
|
||||
writebuf(struct.pack('fff', v[0], v[1], v[2]))
|
||||
if ch.name in dock_conns:
|
||||
conn_dock = dock_conns[ch.name]
|
||||
writebuf(struct.pack('I', conn_dock[0]))
|
||||
writebuf(struct.pack('I', conn_dock[1]))
|
||||
|
||||
else:
|
||||
writebuf(struct.pack('I', 0xffffffff))
|
||||
writebuf(struct.pack('I', 0xffffffff))
|
||||
|
||||
# Panel draw
|
||||
def draw(layout, context):
|
||||
|
|
|
@ -310,6 +310,10 @@ def dataout_loop():
|
|||
writepipeline(b'OK')
|
||||
hecl.sact.cook(writepipebuf)
|
||||
|
||||
elif cmdargs[0] == 'ACTORCOMPILECHARACTERONLY':
|
||||
writepipeline(b'OK')
|
||||
hecl.sact.cook_character_only(writepipebuf)
|
||||
|
||||
elif cmdargs[0] == 'GETARMATURENAMES':
|
||||
writepipeline(b'OK')
|
||||
hecl.sact.get_armature_names(writepipebuf)
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit b3ca9a0a9023580db5dff68158606a64841b7f4e
|
||||
Subproject commit a5a3244e1aee88f683f95bc1ffc226759acf9ca1
|
|
@ -750,6 +750,7 @@ public:
|
|||
};
|
||||
|
||||
Actor compileActor();
|
||||
Actor compileActorCharacterOnly();
|
||||
std::vector<std::string> getArmatureNames();
|
||||
std::vector<std::string> getSubtypeNames();
|
||||
std::vector<std::string> getActionNames();
|
||||
|
|
|
@ -110,7 +110,7 @@ public:
|
|||
{(void)path;LogModule.report(logvisor::Error, "not implemented");return false;}
|
||||
virtual const DataSpecEntry* overrideDataSpec(const ProjectPath& path,
|
||||
const Database::DataSpecEntry* oldEntry,
|
||||
BlenderToken& btok)
|
||||
BlenderToken& btok) const
|
||||
{(void)path;return oldEntry;}
|
||||
virtual void doCook(const ProjectPath& path, const ProjectPath& cookedPath,
|
||||
bool fast, BlenderToken& btok, FCookProgress progress)
|
||||
|
@ -454,19 +454,13 @@ public:
|
|||
PackageDepsgraph buildPackageDepsgraph(const ProjectPath& path);
|
||||
|
||||
/** Add ProjectPath to bridge cache */
|
||||
void addBridgePathToCache(uint64_t id, const ProjectPath& path) { m_bridgePathCache[id] = path; }
|
||||
void addBridgePathToCache(uint64_t id, const ProjectPath& path);
|
||||
|
||||
/** Clear all ProjectPaths in bridge cache */
|
||||
void clearBridgePathCache() { m_bridgePathCache.clear(); }
|
||||
void clearBridgePathCache();
|
||||
|
||||
/** Lookup ProjectPath from bridge cache */
|
||||
const ProjectPath* lookupBridgePath(uint64_t id) const
|
||||
{
|
||||
auto search = m_bridgePathCache.find(id);
|
||||
if (search == m_bridgePathCache.cend())
|
||||
return nullptr;
|
||||
return &search->second;
|
||||
}
|
||||
const ProjectPath* lookupBridgePath(uint64_t id) const;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1377,6 +1377,23 @@ BlenderConnection::DataStream::Actor BlenderConnection::DataStream::compileActor
|
|||
return Actor(*m_parent);
|
||||
}
|
||||
|
||||
BlenderConnection::DataStream::Actor
|
||||
BlenderConnection::DataStream::compileActorCharacterOnly()
|
||||
{
|
||||
if (m_parent->m_loadedType != BlendType::Actor)
|
||||
BlenderLog.report(logvisor::Fatal, _S("%s is not an ACTOR blend"),
|
||||
m_parent->m_loadedBlend.getAbsolutePath().c_str());
|
||||
|
||||
m_parent->_writeLine("ACTORCOMPILECHARACTERONLY");
|
||||
|
||||
char readBuf[256];
|
||||
m_parent->_readLine(readBuf, 256);
|
||||
if (strcmp(readBuf, "OK"))
|
||||
BlenderLog.report(logvisor::Fatal, "unable to compile actor: %s", readBuf);
|
||||
|
||||
return Actor(*m_parent);
|
||||
}
|
||||
|
||||
BlenderConnection::DataStream::World
|
||||
BlenderConnection::DataStream::compileWorld()
|
||||
{
|
||||
|
|
|
@ -543,5 +543,23 @@ PackageDepsgraph Project::buildPackageDepsgraph(const ProjectPath& path)
|
|||
return PackageDepsgraph();
|
||||
}
|
||||
|
||||
void Project::addBridgePathToCache(uint64_t id, const ProjectPath& path)
|
||||
{
|
||||
m_bridgePathCache[id] = path;
|
||||
}
|
||||
|
||||
void Project::clearBridgePathCache()
|
||||
{
|
||||
m_bridgePathCache.clear();
|
||||
}
|
||||
|
||||
const ProjectPath* Project::lookupBridgePath(uint64_t id) const
|
||||
{
|
||||
auto search = m_bridgePathCache.find(id);
|
||||
if (search == m_bridgePathCache.cend())
|
||||
return nullptr;
|
||||
return &search->second;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue