Add visibility mode field for mappable objects

This commit is contained in:
Jack Andersen 2017-04-22 11:44:18 -10:00
parent de671c592d
commit a0efeb3c07
4 changed files with 16 additions and 5 deletions

View File

@ -8,6 +8,8 @@ def cook(writebuf, mesh_obj):
if mesh_obj.type != 'MESH':
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
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]))
@ -169,7 +171,7 @@ def cook(writebuf, mesh_obj):
for obj in bpy.context.scene.objects:
if obj.retro_mappable_type != -1:
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',
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],
@ -180,16 +182,21 @@ def draw(layout, context):
obj = context.active_object
layout.prop(context.scene, 'retro_map_vis_mode', text='Visibility Mode')
if obj and obj.retro_mappable_type != -1:
layout.prop(obj, 'retro_mappable_type', text='Type')
layout.prop(obj, 'retro_mappable_unk', text='Unk')
layout.prop(obj, 'retro_mappable_type', text='Object Type')
layout.prop(obj, 'retro_mapobj_vis_mode', text='Object Visibility Mode')
layout.prop(obj, 'retro_mappable_sclyid', text='Object ID')
def register():
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.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),
('VISIT', 'Visit', 'Visible after Visit', 2),
('NEVER', 'Never', 'Never Visible', 3)],
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')

View File

@ -734,7 +734,7 @@ public:
struct POI
{
uint32_t type;
uint32_t unk;
uint32_t visMode;
uint32_t objid;
Matrix4f xf;
POI(BlenderConnection& conn);

View File

@ -21,12 +21,14 @@ namespace hecl
template <typename UniformStruct>
class UniformBufferPool
{
public:
/* Resolve div_t type using ssize_t as basis */
#if _WIN32
using IndexTp = SSIZE_T;
#else
using IndexTp = ssize_t;
#endif
private:
struct InvalidTp {};
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,

View File

@ -21,12 +21,14 @@ namespace hecl
template <typename VertStruct>
class VertexBufferPool
{
public:
/* Resolve div_t type using ssize_t as basis */
#if _WIN32
using IndexTp = SSIZE_T;
#else
using IndexTp = ssize_t;
#endif
private:
struct InvalidTp {};
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,