mirror of https://github.com/AxioDL/metaforce.git
Add visibility mode field for mappable objects
This commit is contained in:
parent
de671c592d
commit
a0efeb3c07
|
@ -8,6 +8,8 @@ def cook(writebuf, mesh_obj):
|
||||||
if mesh_obj.type != 'MESH':
|
if mesh_obj.type != 'MESH':
|
||||||
raise RuntimeError("%s is not a mesh" % mesh_obj.name)
|
raise RuntimeError("%s is not a mesh" % mesh_obj.name)
|
||||||
|
|
||||||
|
obj_vismodes = dict((i[0], i[3]) for i in bpy.types.Object.retro_mapobj_vis_mode[1]['items'])
|
||||||
|
|
||||||
# Write out visibility type
|
# Write out visibility type
|
||||||
vis_types = dict((i[0], i[3]) for i in bpy.types.Scene.retro_map_vis_mode[1]['items'])
|
vis_types = dict((i[0], i[3]) for i in bpy.types.Scene.retro_map_vis_mode[1]['items'])
|
||||||
writebuf(struct.pack('I', vis_types[bpy.context.scene.retro_map_vis_mode]))
|
writebuf(struct.pack('I', vis_types[bpy.context.scene.retro_map_vis_mode]))
|
||||||
|
@ -169,7 +171,7 @@ def cook(writebuf, mesh_obj):
|
||||||
for obj in bpy.context.scene.objects:
|
for obj in bpy.context.scene.objects:
|
||||||
if obj.retro_mappable_type != -1:
|
if obj.retro_mappable_type != -1:
|
||||||
writebuf(struct.pack('III',
|
writebuf(struct.pack('III',
|
||||||
obj.retro_mappable_type, obj.retro_mappable_unk, int(obj.retro_mappable_sclyid, 0)))
|
obj.retro_mappable_type, obj_vismodes[obj.retro_mapobj_vis_mode], int(obj.retro_mappable_sclyid, 0)))
|
||||||
writebuf(struct.pack('ffffffffffffffff',
|
writebuf(struct.pack('ffffffffffffffff',
|
||||||
obj.matrix_world[0][0], obj.matrix_world[0][1], obj.matrix_world[0][2], obj.matrix_world[0][3],
|
obj.matrix_world[0][0], obj.matrix_world[0][1], obj.matrix_world[0][2], obj.matrix_world[0][3],
|
||||||
obj.matrix_world[1][0], obj.matrix_world[1][1], obj.matrix_world[1][2], obj.matrix_world[1][3],
|
obj.matrix_world[1][0], obj.matrix_world[1][1], obj.matrix_world[1][2], obj.matrix_world[1][3],
|
||||||
|
@ -180,16 +182,21 @@ def draw(layout, context):
|
||||||
obj = context.active_object
|
obj = context.active_object
|
||||||
layout.prop(context.scene, 'retro_map_vis_mode', text='Visibility Mode')
|
layout.prop(context.scene, 'retro_map_vis_mode', text='Visibility Mode')
|
||||||
if obj and obj.retro_mappable_type != -1:
|
if obj and obj.retro_mappable_type != -1:
|
||||||
layout.prop(obj, 'retro_mappable_type', text='Type')
|
layout.prop(obj, 'retro_mappable_type', text='Object Type')
|
||||||
layout.prop(obj, 'retro_mappable_unk', text='Unk')
|
layout.prop(obj, 'retro_mapobj_vis_mode', text='Object Visibility Mode')
|
||||||
layout.prop(obj, 'retro_mappable_sclyid', text='Object ID')
|
layout.prop(obj, 'retro_mappable_sclyid', text='Object ID')
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
bpy.types.Object.retro_mappable_type = bpy.props.IntProperty(name='Retro: MAPA object type', default=-1)
|
bpy.types.Object.retro_mappable_type = bpy.props.IntProperty(name='Retro: MAPA object type', default=-1)
|
||||||
bpy.types.Object.retro_mappable_unk = bpy.props.IntProperty(name='Retro: MAPA object unk')
|
|
||||||
bpy.types.Object.retro_mappable_sclyid = bpy.props.StringProperty(name='Retro: MAPA object SCLY ID')
|
bpy.types.Object.retro_mappable_sclyid = bpy.props.StringProperty(name='Retro: MAPA object SCLY ID')
|
||||||
bpy.types.Scene.retro_map_vis_mode = bpy.props.EnumProperty(items=[('ALWAYS', 'Always', 'Always Visible', 0),
|
bpy.types.Scene.retro_map_vis_mode = bpy.props.EnumProperty(items=[('ALWAYS', 'Always', 'Always Visible', 0),
|
||||||
('MAPSTATIONORVISIT', 'Map Station or Visit', 'Visible after Map Station or Visit', 1),
|
('MAPSTATIONORVISIT', 'Map Station or Visit', 'Visible after Map Station or Visit', 1),
|
||||||
('VISIT', 'Visit', 'Visible after Visit', 2),
|
('VISIT', 'Visit', 'Visible after Visit', 2),
|
||||||
('NEVER', 'Never', 'Never Visible', 3)],
|
('NEVER', 'Never', 'Never Visible', 3)],
|
||||||
name='Retro: Map Visibility Mode')
|
name='Retro: Map Visibility Mode')
|
||||||
|
bpy.types.Object.retro_mapobj_vis_mode = bpy.props.EnumProperty(items=[('ALWAYS', 'Always', 'Always Visible', 0),
|
||||||
|
('MAPSTATIONORVISIT', 'Map Station or Visit', 'Visible after Map Station or Visit', 1),
|
||||||
|
('VISIT', 'Visit', 'Visible after Door Visit', 2),
|
||||||
|
('NEVER', 'Never', 'Never Visible', 3),
|
||||||
|
('MAPSTATIONORVISIT2', 'Map Station or Visit 2', 'Visible after Map Station or Visit', 4)],
|
||||||
|
name='Retro: Map Object Visibility Mode')
|
||||||
|
|
|
@ -734,7 +734,7 @@ public:
|
||||||
struct POI
|
struct POI
|
||||||
{
|
{
|
||||||
uint32_t type;
|
uint32_t type;
|
||||||
uint32_t unk;
|
uint32_t visMode;
|
||||||
uint32_t objid;
|
uint32_t objid;
|
||||||
Matrix4f xf;
|
Matrix4f xf;
|
||||||
POI(BlenderConnection& conn);
|
POI(BlenderConnection& conn);
|
||||||
|
|
|
@ -21,12 +21,14 @@ namespace hecl
|
||||||
template <typename UniformStruct>
|
template <typename UniformStruct>
|
||||||
class UniformBufferPool
|
class UniformBufferPool
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
/* Resolve div_t type using ssize_t as basis */
|
/* Resolve div_t type using ssize_t as basis */
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
using IndexTp = SSIZE_T;
|
using IndexTp = SSIZE_T;
|
||||||
#else
|
#else
|
||||||
using IndexTp = ssize_t;
|
using IndexTp = ssize_t;
|
||||||
#endif
|
#endif
|
||||||
|
private:
|
||||||
struct InvalidTp {};
|
struct InvalidTp {};
|
||||||
using DivTp = std::conditional_t<std::is_same<IndexTp, long long>::value, std::lldiv_t,
|
using DivTp = std::conditional_t<std::is_same<IndexTp, long long>::value, std::lldiv_t,
|
||||||
std::conditional_t<std::is_same<IndexTp, long>::value, std::ldiv_t,
|
std::conditional_t<std::is_same<IndexTp, long>::value, std::ldiv_t,
|
||||||
|
|
|
@ -21,12 +21,14 @@ namespace hecl
|
||||||
template <typename VertStruct>
|
template <typename VertStruct>
|
||||||
class VertexBufferPool
|
class VertexBufferPool
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
/* Resolve div_t type using ssize_t as basis */
|
/* Resolve div_t type using ssize_t as basis */
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
using IndexTp = SSIZE_T;
|
using IndexTp = SSIZE_T;
|
||||||
#else
|
#else
|
||||||
using IndexTp = ssize_t;
|
using IndexTp = ssize_t;
|
||||||
#endif
|
#endif
|
||||||
|
private:
|
||||||
struct InvalidTp {};
|
struct InvalidTp {};
|
||||||
using DivTp = std::conditional_t<std::is_same<IndexTp, long long>::value, std::lldiv_t,
|
using DivTp = std::conditional_t<std::is_same<IndexTp, long long>::value, std::lldiv_t,
|
||||||
std::conditional_t<std::is_same<IndexTp, long>::value, std::ldiv_t,
|
std::conditional_t<std::is_same<IndexTp, long>::value, std::ldiv_t,
|
||||||
|
|
Loading…
Reference in New Issue