-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
assetManager_ScriptBinding.h
executable file
·952 lines (778 loc) · 36.1 KB
/
assetManager_ScriptBinding.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
//-----------------------------------------------------------------------------
// Copyright (c) 2013 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
ConsoleMethodGroupBeginWithDocs(AssetManager, SimObject)
/*! Compile the referenced assets determined by the specified module definition.
@param moduleDefinition The module definition specifies the asset manifest.
@return Whether the compilation was successful or not.
*/
ConsoleMethodWithDocs( AssetManager, compileReferencedAssets, ConsoleBool, 3, 3, (moduleDefinition))
{
// Fetch module definition.
ModuleDefinition* pModuleDefinition = Sim::findObject<ModuleDefinition>( argv[2] );
// Did we find the module definition?
if ( pModuleDefinition == NULL )
{
// No, so warn.
Con::warnf( "AssetManager::compileReferencedAssets() - Could not find the module definition '%s'.", argv[2] );
return false;
}
// Compile referenced assets.
return object->compileReferencedAssets( pModuleDefinition );
}
//-----------------------------------------------------------------------------
/*! Add any the declared assets specified by the module definition.
@param moduleDefinition The module definition specifies the asset manifest.
@return Whether adding declared assets was successful or not.
*/
ConsoleMethodWithDocs( AssetManager, addModuleDeclaredAssets, ConsoleBool, 3, 3, (moduleDefinition))
{
// Fetch module definition.
ModuleDefinition* pModuleDefinition = Sim::findObject<ModuleDefinition>( argv[2] );
// Did we find the module definition?
if ( pModuleDefinition == NULL )
{
// No, so warn.
Con::warnf( "AssetManager::addDeclaredAssets() - Could not find the module definition '%s'.", argv[2] );
return false;
}
// Add module declared assets.
return object->addModuleDeclaredAssets( pModuleDefinition );
}
//-----------------------------------------------------------------------------
/*! Add the specified asset against the specified module definition.
@param moduleDefinition The module definition that may contain declared assets.
@return Whether adding declared assets was successful or not.
*/
ConsoleMethodWithDocs( AssetManager, addDeclaredAsset, ConsoleBool, 4, 4, (moduleDefinition, assetFilePath))
{
// Fetch module definition.
ModuleDefinition* pModuleDefinition = Sim::findObject<ModuleDefinition>( argv[2] );
// Did we find the module definition?
if ( pModuleDefinition == NULL )
{
// No, so warn.
Con::warnf( "AssetManager::addDeclaredAsset() - Could not find the module definition '%s'.", argv[2] );
return false;
}
// Fetch asset file-path.
const char* pAssetFilePath = argv[3];
// Add declared asset.
return object->addDeclaredAsset( pModuleDefinition, pAssetFilePath );
}
//-----------------------------------------------------------------------------
/*! Adds a private asset object.
@param assetObject The asset object to add as a private asset.
@return The allocated private asset Id.
*/
ConsoleMethodWithDocs( AssetManager, addPrivateAsset, ConsoleString, 3, 3, (assetObject))
{
// Fetch asset.
AssetBase* pAssetBase = Sim::findObject<AssetBase>( argv[2] );
// Did we find the asset?
if ( pAssetBase == NULL )
{
// No, so warn.
Con::warnf( "AssetManager::addPrivateAsset() - Could not find the asset '%s'.", argv[2] );
return StringTable->EmptyString;
}
// Add private asset.
return object->addPrivateAsset( pAssetBase );
}
//-----------------------------------------------------------------------------
/*! Remove any the declared assets specified by the module definition.
@param moduleDefinition The module definition that may contain declared assets.
@return Whether removing declared assets was successful or not.
*/
ConsoleMethodWithDocs( AssetManager, removeDeclaredAssets, ConsoleBool, 3, 3, (moduleDefinition))
{
// Fetch module definition.
ModuleDefinition* pModuleDefinition = Sim::findObject<ModuleDefinition>( argv[2] );
// Did we find the module definition?
if ( pModuleDefinition == NULL )
{
// No, so warn.
Con::warnf( "AssetManager::removeDeclaredAssets() - Could not find the module definition '%s'.", argv[2] );
return false;
}
// Remove declared assets.
return object->removeDeclaredAssets( pModuleDefinition );
}
//-----------------------------------------------------------------------------
/*! Remove the specified declared asset Id.
@param assetId The selected asset Id.
@return Whether removing the declared asset was successful or not.
*/
ConsoleMethodWithDocs( AssetManager, removeDeclaredAsset, ConsoleBool, 3, 3, (assetId))
{
// Remove the declared asset Id.
return object->removeDeclaredAsset( argv[2] );
}
//-----------------------------------------------------------------------------
/*! Gets the asset name from the specified asset Id.
@param assetId The selected asset Id.
@return The asset name from the specified asset Id.
*/
ConsoleMethodWithDocs( AssetManager, getAssetName, ConsoleString, 3, 3, (assetId))
{
return object->getAssetName( argv[2] );
}
//-----------------------------------------------------------------------------
/*! Gets the asset description from the specified asset Id.
@param assetId The selected asset Id.
@return The asset description from the specified asset Id.
*/
ConsoleMethodWithDocs( AssetManager, getAssetDescription, ConsoleString, 3, 3, (assetId))
{
return object->getAssetDescription( argv[2] );
}
//-----------------------------------------------------------------------------
/*! Gets the asset category from the specified asset Id.
@param assetId The selected asset Id.
@return The asset category from the specified asset Id.
*/
ConsoleMethodWithDocs( AssetManager, getAssetCategory, ConsoleString, 3, 3, (assetId))
{
return object->getAssetCategory( argv[2] );
}
//-----------------------------------------------------------------------------
/*! Gets the asset type from the specified asset Id.
@param assetId The selected asset Id.
@return The asset type from the specified asset Id.
*/
ConsoleMethodWithDocs( AssetManager, getAssetType, ConsoleString, 3, 3, (assetId))
{
return object->getAssetType( argv[2] );
}
//-----------------------------------------------------------------------------
/*! Gets the asset file-path from the specified asset Id.
@param assetId The selected asset Id.
@return The asset file-path from the specified asset Id.
*/
ConsoleMethodWithDocs( AssetManager, getAssetFilePath, ConsoleString, 3, 3, (assetId))
{
return object->getAssetFilePath( argv[2] );
}
//-----------------------------------------------------------------------------
/*! Gets the asset path (not including the asset file) from the specified asset Id.
@param assetId The selected asset Id.
@return The asset path (not including the asset file) from the specified asset Id.
*/
ConsoleMethodWithDocs( AssetManager, getAssetPath, ConsoleString, 3, 3, (assetId))
{
return object->getAssetPath( argv[2] );
}
//-----------------------------------------------------------------------------
/*! Gets the module definition where the the specified asset Id is located.
@param assetId The selected asset Id.
@return The module definition where the the specified asset Id is located
*/
ConsoleMethodWithDocs( AssetManager, getAssetModule, ConsoleString, 3, 3, (assetId))
{
// Fetch module definition.
ModuleDefinition* pModuleDefinition = object->getAssetModuleDefinition( argv[2] );
return pModuleDefinition == NULL ? StringTable->EmptyString : pModuleDefinition->getIdString();
}
//-----------------------------------------------------------------------------
/*! Check whether the specified asset Id is internal or not.
@param assetId The selected asset Id.
@return Whether the specified asset Id is internal or not.
*/
ConsoleMethodWithDocs( AssetManager, isAssetInternal, ConsoleBool, 3, 3, (assetId))
{
return object->isAssetInternal( argv[2] );
}
//-----------------------------------------------------------------------------
/*! Check whether the specified asset Id is private or not.
@param assetId The selected asset Id.
@return Whether the specified asset Id is private or not.
*/
ConsoleMethodWithDocs( AssetManager, isAssetPrivate, ConsoleBool, 3, 3, (assetId))
{
return object->isAssetPrivate( argv[2] );
}
//-----------------------------------------------------------------------------
/*! Check whether the specified asset Id is auto-unload or not.
@param assetId The selected asset Id.
@return Whether the specified asset Id is auto-unload or not.
*/
ConsoleMethodWithDocs( AssetManager, isAssetAutoUnload, ConsoleBool, 3, 3, (assetId))
{
return object->isAssetAutoUnload( argv[2] );
}
//-----------------------------------------------------------------------------
/*! Check whether the specified asset Id is loaded or not.
@param assetId The selected asset Id.
@return Whether the specified asset Id is loaded or not.
*/
ConsoleMethodWithDocs( AssetManager, isAssetLoaded, ConsoleBool, 3, 3, (assetId))
{
return object->isAssetLoaded( argv[2] );
}
//-----------------------------------------------------------------------------
/*! Check whether the specified asset Id is declared or not.
@param assetId The selected asset Id.
@return Whether the specified asset Id is declared or not.
*/
ConsoleMethodWithDocs( AssetManager, isDeclaredAsset, ConsoleBool, 3, 3, (assetId))
{
return object->isDeclaredAsset( argv[2] );
}
//-----------------------------------------------------------------------------
/*! Check whether the specified asset Id is referenced or not.
@param assetId The selected asset Id.
@return Whether the specified asset Id is referenced or not.
*/
ConsoleMethodWithDocs( AssetManager, isReferencedAsset, ConsoleBool, 3, 3, (assetId))
{
return object->isReferencedAsset( argv[2] );
}
//-----------------------------------------------------------------------------
/*! Rename declared asset Id.
@param assetIdFrom The selected asset Id to rename from.
@param assetIdFrom The selected asset Id to rename to.
@return Whether the rename was successful or not.
*/
ConsoleMethodWithDocs( AssetManager, renameDeclaredAsset, ConsoleBool, 4, 4, (assetIdFrom, assetIdTo))
{
return object->renameDeclaredAsset( argv[2], argv[3] );
}
//-----------------------------------------------------------------------------
/*! Rename referenced asset Id.
@param assetIdFrom The selected asset Id to rename from.
@param assetIdFrom The selected asset Id to rename to.
@return Whether the rename was successful or not.
*/
ConsoleMethodWithDocs( AssetManager, renameReferencedAsset, ConsoleBool, 4, 4, (assetIdFrom, assetIdTo))
{
return object->renameReferencedAsset( argv[2], argv[3] );
}
//-----------------------------------------------------------------------------
/*! Acquire the specified asset Id.
You must release the asset once you're finish with it using 'releaseAsset'.
@param assetId The selected asset Id.
@param asPrivate Whether to acquire the asset Id as a private asset.
@return The acquired asset or NULL if not acquired.
*/
ConsoleMethodWithDocs( AssetManager, acquireAsset, ConsoleString, 3, 4, (assetId, [asPrivate?]))
{
// Fetch asset Id.
const char* pAssetId = argv[2];
// Fetch private asset flag.
const bool asPrivate = argc >= 4 ? dAtob(argv[3]) : false;
// Reset asset reference.
AssetBase* pAssetBase = NULL;
// Acquire private asset?
if ( asPrivate )
{
// Acquire private asset.
pAssetBase = object->acquireAsPrivateAsset<AssetBase>( pAssetId );
}
else
{
// Acquire public asset.
pAssetBase = object->acquireAsset<AssetBase>( pAssetId );
}
return pAssetBase != NULL ? pAssetBase->getIdString() : StringTable->EmptyString;
}
//-----------------------------------------------------------------------------
/*! Release the specified asset Id.
The asset should have been acquired using 'acquireAsset'.
@param assetId The selected asset Id.
@return Whether the asset was released or not.
*/
ConsoleMethodWithDocs( AssetManager, releaseAsset, ConsoleBool, 3, 3, (assetId))
{
// Release asset.
return object->releaseAsset( argv[2] );
}
//-----------------------------------------------------------------------------
/*! Purge all assets that are not referenced even if they are set to not auto-unload.
Assets can be in this state because they are either set to not auto-unload or the asset manager has/is disabling auto-unload.
@return No return value.
*/
ConsoleMethodWithDocs( AssetManager, purgeAssets, ConsoleVoid, 2, 2, ())
{
// Purge assets.
object->purgeAssets();
}
//-----------------------------------------------------------------------------
/*! Deletes the specified asset Id and optionally its loose files and asset dependencies.
@param assetId The selected asset Id.
@param deleteLooseFiles Whether to delete an assets loose files or not.
@param deleteDependencies Whether to delete assets that depend on this asset or not.
@return Whether the asset deletion was successful or not. A failure only indicates that the specified asset was not deleted but dependent assets and their loose files may have being deleted.
*/
ConsoleMethodWithDocs( AssetManager, deleteAsset, ConsoleBool, 5, 5, (assetId, deleteLooseFiles, deleteDependencies))
{
// Fetch asset Id.
const char* pAssetId = argv[2];
// Fetch delete loose-files flag.
const bool deleteLooseFiles = dAtob(argv[3]);
// Fetch delete dependencies flag.
const bool deleteDependencies = dAtob(argv[4]);
// Delete asset.
return object->deleteAsset( pAssetId, deleteLooseFiles, deleteDependencies );
}
//-----------------------------------------------------------------------------
/*! Refresh the specified asset Id.
@param assetId The selected asset Id.
@return No return value.
*/
ConsoleMethodWithDocs( AssetManager, refreshAsset, ConsoleVoid, 3, 3, (assetId))
{
object->refreshAsset( argv[2] );
}
//-----------------------------------------------------------------------------
/*! Refresh all declared assets.
@param Whether to include currently unloaded assets in the refresh or not. Optional: Defaults to false.
Refreshing all assets can be an expensive (time-consuming) operation to perform.
@return No return value.
*/
ConsoleMethodWithDocs( AssetManager, refreshAllAssets, ConsoleVoid, 2, 3, ([bool includeUnloaded]))
{
// Refresh assets without flag.
if ( argc == 2 )
object->refreshAllAssets();
// Refresh assets with flag.
object->refreshAllAssets(dAtob(argv[2]));
}
//-----------------------------------------------------------------------------
/*! Save the currently loaded asset tags manifest.
@return Whether the save was successful or not.
*/
ConsoleMethodWithDocs( AssetManager, saveAssetTags, ConsoleBool, 2, 2, ())
{
// Save asset tags.
return object->saveAssetTags();
}
//-----------------------------------------------------------------------------
/*! Restore the currently loaded asset tags manifest from disk (replace anything in memory).
@return Whether the restore was successful or not.
*/
ConsoleMethodWithDocs( AssetManager, restoreAssetTags, ConsoleBool, 2, 2, ())
{
// Restore asset tags.
return object->restoreAssetTags();
}
//-----------------------------------------------------------------------------
/*! Gets the currently loaded asset tags manifest.
@return The currently loaded asset tags manifest or zero if not loaded.
*/
ConsoleMethodWithDocs( AssetManager, getAssetTags, ConsoleInt, 2, 2, ())
{
// Fetch the asset tags manifest.
AssetTagsManifest* pAssetTagsManifest = object->getAssetTags();
return pAssetTagsManifest == NULL ? 0 : pAssetTagsManifest->getId();
}
//-----------------------------------------------------------------------------
/*! Performs an asset query searching for all assets optionally ignoring internal assets.
@param assetQuery The asset query object that will be populated with the results.
@param ignoreInternal Whether to ignore internal assets or not. Optional: Defaults to true.
@param ignorePrivate Whether to ignore private assets or not. Optional: Defaults to true.
@return The number of asset Ids found or (-1) if an error occurred.
*/
ConsoleMethodWithDocs( AssetManager, findAllAssets, ConsoleInt, 3, 5, (assetQuery, [ignoreInternal?], [ignorePrivate?]))
{
// Fetch asset query.
AssetQuery* pAssetQuery = Sim::findObject<AssetQuery>( argv[2] );
// Did we find the asset query?
if ( pAssetQuery == NULL )
{
// No, so warn.
Con::warnf( "AssetManager::findAllAssets() - Could not find the asset query object '%s'.", argv[2] );
return -1;
}
// Perform query if no more arguments.
if ( argc == 3 )
return object->findAllAssets( pAssetQuery );
// Fetch ignore internal flag.
const bool ignoreInternal = dAtob(argv[3]);
// Perform query if no more arguments.
if ( argc == 4 )
return object->findAllAssets( pAssetQuery, ignoreInternal );
// Fetch ignore private flag.
const bool ignorePrivate = dAtob(argv[4]);
// Perform query.
return object->findAllAssets( pAssetQuery, ignoreInternal, ignorePrivate );
}
//-----------------------------------------------------------------------------
/*! Performs an asset query searching for the specified asset name.
@param assetQuery The asset query object that will be populated with the results.
@param assetName The asset name to search for. This may be a partial name if 'partialName' is true.
@param partialName Whether the asset name is to be used as a partial name or not. Optional: Defaults to false.
@return The number of asset Ids found or (-1) if an error occurred.
*/
ConsoleMethodWithDocs( AssetManager, findAssetName, ConsoleInt, 4, 5, (assetQuery, assetName, [partialName?]))
{
// Fetch asset query.
AssetQuery* pAssetQuery = Sim::findObject<AssetQuery>( argv[2] );
// Did we find the asset query?
if ( pAssetQuery == NULL )
{
// No, so warn.
Con::warnf( "AssetManager::findAssetName() - Could not find the asset query object '%s'.", argv[2] );
return -1;
}
// Fetch asset name.
const char* pAssetName = argv[3];
// Perform query if no more arguments.
if ( argc == 4 )
return object->findAssetName( pAssetQuery, pAssetName );
// Yes, so fetch partial name flag.
const bool partialName = dAtob( argv[4] );
// Perform query.
return object->findAssetName( pAssetQuery, pAssetName, partialName );
}
//-----------------------------------------------------------------------------
/*! Performs an asset query searching for the specified asset category.
@param assetQuery The asset query object that will be populated with the results.
@param assetCategory The asset category to search for.
@param assetQueryAsSource Whether to use the asset query as the data-source rather than the asset managers database or not. Doing this effectively filters the asset query. Optional: Defaults to false.
@return The number of asset Ids found or (-1) if an error occurred.
*/
ConsoleMethodWithDocs( AssetManager, findAssetCategory, ConsoleInt, 4, 5, (assetQuery, assetCategory, [assetQueryAsSource?]))
{
// Fetch asset query.
AssetQuery* pAssetQuery = Sim::findObject<AssetQuery>( argv[2] );
// Did we find the asset query?
if ( pAssetQuery == NULL )
{
// No, so warn.
Con::warnf( "AssetManager::findAssetCategory() - Could not find the asset query object '%s'.", argv[2] );
return -1;
}
// Fetch asset category.
const char* pAssetCategory = argv[3];
// Any more arguments?
if ( argc == 4 )
{
// No, so perform query.
return object->findAssetCategory( pAssetQuery, pAssetCategory );
}
// Fetch asset-query-as-source flag.
const bool assetQueryAsSource = dAtob(argv[4]);
// Perform query.
return object->findAssetCategory( pAssetQuery, pAssetCategory, assetQueryAsSource );
}
//-----------------------------------------------------------------------------
/*! Performs an asset query searching for the specified asset auto-unload flag.
@param assetQuery The asset query object that will be populated with the results.
@param assetInternal The asset internal flag to search for.
@param assetQueryAsSource Whether to use the asset query as the data-source rather than the asset managers database or not. Doing this effectively filters the asset query. Optional: Defaults to false.
@return The number of asset Ids found or (-1) if an error occurred.
*/
ConsoleMethodWithDocs( AssetManager, findAssetAutoUnload, ConsoleInt, 4, 5, (assetQuery, assetAutoUnload, [assetQueryAsSource?]))
{
// Fetch asset query.
AssetQuery* pAssetQuery = Sim::findObject<AssetQuery>( argv[2] );
// Did we find the asset query?
if ( pAssetQuery == NULL )
{
// No, so warn.
Con::warnf( "AssetManager::findAssetAutoUnload() - Could not find the asset query object '%s'.", argv[2] );
return -1;
}
// Fetch asset auto-unload flag.
const bool assetAutoUnload = dAtob(argv[3]);
// Any more arguments?
if ( argc == 4 )
{
// No, so perform query.
return object->findAssetAutoUnload( pAssetQuery, assetAutoUnload );
}
// Fetch asset-query-as-source flag.
const bool assetQueryAsSource = dAtob(argv[4]);
// Perform query.
return object->findAssetAutoUnload( pAssetQuery, assetAutoUnload, assetQueryAsSource );
}
//-----------------------------------------------------------------------------
/*! Performs an asset query searching for the specified asset internal flag.
@param assetQuery The asset query object that will be populated with the results.
@param assetInternal The asset internal flag to search for.
@param assetQueryAsSource Whether to use the asset query as the data-source rather than the asset managers database or not. Doing this effectively filters the asset query. Optional: Defaults to false.
@return The number of asset Ids found or (-1) if an error occurred.
*/
ConsoleMethodWithDocs( AssetManager, findAssetInternal, ConsoleInt, 4, 5, (assetQuery, assetInternal, [assetQueryAsSource?]))
{
// Fetch asset query.
AssetQuery* pAssetQuery = Sim::findObject<AssetQuery>( argv[2] );
// Did we find the asset query?
if ( pAssetQuery == NULL )
{
// No, so warn.
Con::warnf( "AssetManager::findAssetInternal() - Could not find the asset query object '%s'.", argv[2] );
return -1;
}
// Fetch asset internal flag.
const bool assetInternal = dAtob(argv[3]);
// Any more arguments?
if ( argc == 4 )
{
// No, so perform query.
return object->findAssetInternal( pAssetQuery, assetInternal );
}
// Fetch asset-query-as-source flag.
const bool assetQueryAsSource = dAtob(argv[4]);
// Perform query.
return object->findAssetInternal( pAssetQuery, assetInternal, assetQueryAsSource );
}
//-----------------------------------------------------------------------------
/*! Performs an asset query searching for the specified asset private flag.
@param assetQuery The asset query object that will be populated with the results.
@param assetPrivate The asset private flag to search for.
@param assetQueryAsSource Whether to use the asset query as the data-source rather than the asset managers database or not. Doing this effectively filters the asset query. Optional: Defaults to false.
@return The number of asset Ids found or (-1) if an error occurred.
*/
ConsoleMethodWithDocs( AssetManager, findAssetPrivate, ConsoleInt, 4, 5, (assetQuery, assetPrivate, [assetQueryAsSource?]))
{
// Fetch asset query.
AssetQuery* pAssetQuery = Sim::findObject<AssetQuery>( argv[2] );
// Did we find the asset query?
if ( pAssetQuery == NULL )
{
// No, so warn.
Con::warnf( "AssetManager::findAssetPrivate() - Could not find the asset query object '%s'.", argv[2] );
return -1;
}
// Fetch asset private flag.
const bool assetPrivate = dAtob(argv[3]);
// Any more arguments?
if ( argc == 4 )
{
// No, so perform query.
return object->findAssetPrivate( pAssetQuery, assetPrivate );
}
// Fetch asset-query-as-source flag.
const bool assetQueryAsSource = dAtob(argv[4]);
// Perform query.
return object->findAssetInternal( pAssetQuery, assetPrivate, assetQueryAsSource );
}
//-----------------------------------------------------------------------------
/*! Performs an asset query searching for the specified asset type.
@param assetQuery The asset query object that will be populated with the results.
@param assetType The asset type to search for.
@param assetQueryAsSource Whether to use the asset query as the data-source rather than the asset managers database or not. Doing this effectively filters the asset query. Optional: Defaults to false.
@return The number of asset Ids found or (-1) if an error occurred.
*/
ConsoleMethodWithDocs( AssetManager, findAssetType, ConsoleInt, 4, 5, (assetQuery, assetType, [assetQueryAsSource?]))
{
// Fetch asset query.
AssetQuery* pAssetQuery = Sim::findObject<AssetQuery>( argv[2] );
// Did we find the asset query?
if ( pAssetQuery == NULL )
{
// No, so warn.
Con::warnf( "AssetManager::findAssetType() - Could not find the asset query object '%s'.", argv[2] );
return -1;
}
// Fetch asset type.
const char* pAssetType = argv[3];
// Any more arguments?
if ( argc == 4 )
{
// No, so perform query.
return object->findAssetType( pAssetQuery, pAssetType );
}
// Fetch asset-query-as-source flag.
const bool assetQueryAsSource = dAtob(argv[4]);
// Perform query.
return object->findAssetType( pAssetQuery, pAssetType, assetQueryAsSource );
}
//-----------------------------------------------------------------------------
/*! Performs an asset query searching for asset Ids that the specified asset Id depends on.
@param assetQuery The asset query object that will be populated with the results.
@param assetId The asset Id to query for any asset Ids that it depends on.
@return The number of asset Ids found or (-1) if an error occurred.
*/
ConsoleMethodWithDocs( AssetManager, findAssetDependsOn, ConsoleInt, 4, 4, (assetQuery, assetId))
{
// Fetch asset query.
AssetQuery* pAssetQuery = Sim::findObject<AssetQuery>( argv[2] );
// Did we find the asset query?
if ( pAssetQuery == NULL )
{
// No, so warn.
Con::warnf( "AssetManager::findAssetDependsOn() - Could not find the asset query object '%s'.", argv[2] );
return -1;
}
// Fetch asset Id.
const char* pAssetId = argv[3];
// Perform query.
return object->findAssetDependsOn( pAssetQuery, pAssetId );
}
//-----------------------------------------------------------------------------
/*! Performs an asset query searching for asset Ids that depend on the specified asset Id.
@param assetQuery The asset query object that will be populated with the results.
@param assetId The asset Id to query for any asset Ids that may depend on it.
@return The number of asset Ids found or (-1) if an error occurred.
*/
ConsoleMethodWithDocs( AssetManager, findAssetIsDependedOn, ConsoleInt, 4, 4, (assetQuery, assetId))
{
// Fetch asset query.
AssetQuery* pAssetQuery = Sim::findObject<AssetQuery>( argv[2] );
// Did we find the asset query?
if ( pAssetQuery == NULL )
{
// No, so warn.
Con::warnf( "AssetManager::findAssetIsDependedOn() - Could not find the asset query object '%s'.", argv[2] );
return -1;
}
// Fetch asset Id.
const char* pAssetId = argv[3];
// Perform query.
return object->findAssetIsDependedOn( pAssetQuery, pAssetId );
}
//-----------------------------------------------------------------------------
/*! Performs an asset query searching for invalid asset references.
@param assetQuery The asset query object that will be populated with the results.
@return The number of asset Ids found that are invalid or (-1) if an error occurred.
*/
ConsoleMethodWithDocs( AssetManager, findInvalidAssetReferences, ConsoleInt, 3, 3, (assetQuery))
{
// Fetch asset query.
AssetQuery* pAssetQuery = Sim::findObject<AssetQuery>( argv[2] );
// Did we find the asset query?
if ( pAssetQuery == NULL )
{
// No, so warn.
Con::warnf( "AssetManager::findInvalidAssetReferences() - Could not find the asset query object '%s'.", argv[2] );
return -1;
}
// Perform query.
return object->findInvalidAssetReferences( pAssetQuery );
}
//-----------------------------------------------------------------------------
/*! Performs an asset query searching for the specified asset tag name(s).
@param assetQuery The asset query object that will be populated with the results.
@param assetTagNames The asset tag name or names to search for. Multiple names can be specified using comma, space, tab or newline separation. Tags use an OR operation i.e. only assets tagged with ANY of the specified tags will be returned.
@param assetQueryAsSource Whether to use the asset query as the data-source rather than the asset managers database or not. Doing this effectively filters the asset query. Optional: Defaults to false.
@return The number of asset Ids found or (-1) if an error occurred.
*/
ConsoleMethodWithDocs( AssetManager, findTaggedAssets, ConsoleInt, 4, 5, (assetQuery, assetTagNames, [assetQueryAsSource?]))
{
// Fetch asset query.
AssetQuery* pAssetQuery = Sim::findObject<AssetQuery>( argv[2] );
// Did we find the asset query?
if ( pAssetQuery == NULL )
{
// No, so warn.
Con::warnf( "AssetManager::findTaggedAssets() - Could not find the asset query object '%s'.", argv[2] );
return -1;
}
// Fetch asset tag name(s).
const char* pAssetTagNames = argv[3];
// Perform query if no more arguments.
if ( argc == 4 )
return object->findTaggedAssets( pAssetQuery, pAssetTagNames );
// Fetch asset-query-as-source flag.
const bool assetQueryAsSource = dAtob(argv[4]);
// Perform query.
return object->findTaggedAssets( pAssetQuery, pAssetTagNames, assetQueryAsSource );
}
//-----------------------------------------------------------------------------
/*! Performs an asset query searching for the specified loose file.
@param assetQuery The asset query object that will be populated with the results.
@param assetLooseFile The loose-file used by the asset to search for.
@param assetQueryAsSource Whether to use the asset query as the data-source rather than the asset managers database or not. Doing this effectively filters the asset query. Optional: Defaults to false.
@return The number of asset Ids found or (-1) if an error occurred.
*/
ConsoleMethodWithDocs( AssetManager, findAssetLooseFile, ConsoleInt, 4, 5, (assetQuery, assetLooseFile, [assetQueryAsSource?]))
{
// Fetch asset query.
AssetQuery* pAssetQuery = Sim::findObject<AssetQuery>( argv[2] );
// Did we find the asset query?
if ( pAssetQuery == NULL )
{
// No, so warn.
Con::warnf( "AssetManager::findAssetLooseFile() - Could not find the asset query object '%s'.", argv[2] );
return -1;
}
// Fetch asset loose file.
const char* pAssetLooseFile = argv[3];
// Any more arguments?
if ( argc == 4 )
{
// No, so perform query.
return object->findAssetLooseFile( pAssetQuery, pAssetLooseFile );
}
// Fetch asset-query-as-source flag.
const bool assetQueryAsSource = dAtob(argv[4]);
// Perform query.
return object->findAssetLooseFile( pAssetQuery, pAssetLooseFile, assetQueryAsSource );
}
//-----------------------------------------------------------------------------
/*! Gets the number of declared assets.
@return Returns the number of declared assets.
*/
ConsoleMethodWithDocs( AssetManager, getDeclaredAssetCount, ConsoleBool, 2, 2, ())
{
return object->getDeclaredAssetCount();
}
//-----------------------------------------------------------------------------
/*! Gets the number of asset referenced.
@return Returns the number of asset references.
*/
ConsoleMethodWithDocs( AssetManager, getReferencedAssetCount, ConsoleBool, 2, 2, ())
{
return object->getReferencedAssetCount();
}
//-----------------------------------------------------------------------------
/*! Gets the number of loaded internal assets.
@return Returns the number of loaded internal assets.
*/
ConsoleMethodWithDocs( AssetManager, getLoadedInternalAssetCount, ConsoleBool, 2, 2, ())
{
return object->getLoadedInternalAssetCount();
}
//-----------------------------------------------------------------------------
/*! Gets the maximum number of loaded internal assets.
@return Returns the maximum number of loaded internal assets.
*/
ConsoleMethodWithDocs( AssetManager, getMaxLoadedInternalAssetCount, ConsoleBool, 2, 2, ())
{
return object->getMaxLoadedInternalAssetCount();
}
//-----------------------------------------------------------------------------
/*! Gets the number of loaded external assets.
@return Returns the number of loaded external assets.
*/
ConsoleMethodWithDocs( AssetManager, getLoadedExternalAssetCount, ConsoleBool, 2, 2, ())
{
return object->getLoadedExternalAssetCount();
}
//-----------------------------------------------------------------------------
/*! Gets the maximum number of loaded external assets.
@return Returns the maximum number of loaded external assets.
*/
ConsoleMethodWithDocs( AssetManager, getMaxLoadedExternalAssetCount, ConsoleBool, 2, 2, ())
{
return object->getMaxLoadedExternalAssetCount();
}
//-----------------------------------------------------------------------------
/*! Dumps a breakdown of all declared assets.
@return No return value.
*/
ConsoleMethodWithDocs( AssetManager, dumpDeclaredAssets, ConsoleVoid, 2, 2, ())
{
return object->dumpDeclaredAssets();
}
ConsoleMethodGroupEndWithDocs(AssetManager)