{
const char *name;
u32 name_hash;
+ u32 reference_count;
mdl_context mdl;
ref = &_cutscene.refs[ ref_id ];
ref->name = name;
ref->name_hash = name_hash;
+ ref->reference_count = 0;
vg_info( "Indexed reference '%s'\n", name );
_cutscene.unique_refs ++;
}
+ ref->reference_count ++;
+
_cutscene.instances[ i ].ref_id = ref_id;
_cutscene.instances[ i ].skinning_data = NULL;
}
void cutscene_update( f32 delta )
{
+ if( !_cutscene.ready )
+ return;
+
_cutscene.time += delta;
u32 frame = _cutscene.time * _cutscene.meta.info.framerate;
ms_strip *usage[8];
for( u32 i=0; i<VG_ARRAY_LEN(usage); i ++ ) usage[i] = NULL;
- ui_px root[2] = { rect[0]+8, rect[1]+8 };
+ ui_rect panel_l, panel_r;
+ ui_split( rect, k_ui_axis_v, 400, 4, panel_l, panel_r );
- for( u32 i=0; i<af_arrcount(&_cutscene.meta.strips); i ++ )
+ if( ui_clip( rect, panel_l, panel_l ) )
{
- ms_strip *strip = af_arritm(&_cutscene.meta.strips, i );
+ ui_px root[2] = { panel_l[0]+8, panel_l[1]+8 };
+ ui_rect box = { root[0], root[1], panel_l[2]-16, 16 };
- if( strip->data_mode == 2 )
+ for( u32 i=0; i<_cutscene.unique_refs; i ++ )
{
- ui_rect box = { root[0] + strip->offset, root[1], 1, rect[3]-16 };
- ui_fill( ctx, box, 0xff00ff00 );
+ struct model_ref *mref = &_cutscene.refs[i];
- box[1] += box[3] -16;
- box[2] = 200;
- box[3] = 16;
+ char inf[128];
+ snprintf( inf, sizeof(inf), "%s (%u references)",
+ mref->name, mref->reference_count );
- if( ui_clip( rect, box, box ) )
- {
- ui_text( ctx, box, af_str( &_cutscene.meta.af, strip->pstr_name ),
- 1, k_ui_align_middle_left, 0 );
- }
- continue;
+ ui_text( ctx, box, inf, 1, k_ui_align_middle_left, 0 );
+ box[1] += 16;
}
-
- u32 layer = 0;
- for( u32 k=0; k<VG_ARRAY_LEN(usage); k ++ )
+ }
+
+ if( ui_clip( rect, panel_r, panel_r ) )
+ {
+ ui_px root[2] = { panel_r[0]+8, panel_r[1]+8 };
+
+ for( u32 i=0; i<af_arrcount(&_cutscene.meta.strips); i ++ )
{
- if( usage[k] )
+ ms_strip *strip = af_arritm(&_cutscene.meta.strips, i );
+
+ if( strip->data_mode == 2 )
{
- if( usage[k]->offset + usage[k]->length < strip->offset )
+ ui_rect box = { root[0]+strip->offset, root[1], 1, panel_r[3]-16 };
+ ui_fill( ctx, box, 0xff00ff00 );
+
+ box[1] += box[3] -16;
+ box[2] = 200;
+ box[3] = 16;
+
+ if( ui_clip( panel_r, box, box ) )
{
- usage[k] = NULL;
+ ui_text( ctx, box, af_str( &_cutscene.meta.af, strip->pstr_name ),
+ 1, k_ui_align_middle_left, 0 );
}
+ continue;
}
-
- if( !usage[k] )
+
+ u32 layer = 0;
+ for( u32 k=0; k<VG_ARRAY_LEN(usage); k ++ )
{
- usage[k] = strip;
- layer = k;
- break;
+ if( usage[k] )
+ {
+ if( usage[k]->offset + usage[k]->length < strip->offset )
+ {
+ usage[k] = NULL;
+ }
+ }
+
+ if( !usage[k] )
+ {
+ usage[k] = strip;
+ layer = k;
+ break;
+ }
}
- }
- ui_rect box = { strip->offset, layer*32, strip->length, 30 };
- box[0] += root[0];
- box[1] += root[1];
+ ui_rect box = { strip->offset, layer*32, strip->length, 30 };
+ box[0] += root[0];
+ box[1] += root[1];
- if( ui_clip( rect, box, box ) )
- {
- u32 colour = af_str_hash( &_cutscene.meta.af, strip->pstr_name );
+ if( ui_clip( panel_r, box, box ) )
+ {
+ u32 colour = af_str_hash( &_cutscene.meta.af, strip->pstr_name );
- ui_fill( ctx, box, colour | 0xff000000 );
- ui_text( ctx, box, af_str( &_cutscene.meta.af, strip->pstr_name ), 1,
- k_ui_align_middle_center, 0 );
+ ui_fill( ctx, box, colour | 0xff000000 );
+ ui_text( ctx, box, af_str( &_cutscene.meta.af, strip->pstr_name ), 1,
+ k_ui_align_middle_center, 0 );
+ }
}
- }
- ui_rect cursor = { (f32)_cutscene.time*_cutscene.meta.info.framerate,
- 0, 1, VG_ARRAY_LEN(usage)*32 };
- cursor[0] += root[0];
- cursor[1] += root[1];
- if( ui_clip( rect, cursor, cursor ) )
- ui_fill( ctx, cursor, 0xffffffff );
+ ui_rect cursor = { (f32)_cutscene.time*_cutscene.meta.info.framerate,
+ 0, 1, VG_ARRAY_LEN(usage)*32 };
+ cursor[0] += root[0];
+ cursor[1] += root[1];
+ if( ui_clip( panel_r, cursor, cursor ) )
+ ui_fill( ctx, cursor, 0xffffffff );
+ }
}
static int cmd_cutscene_inspector( int argc, const char *argv[] )