1 # ======================================================================
2 # collectAssetCustomizationInfo.pl
3 # Copyright 2003, Sony Online Entertainment, Inc.
5 # ======================================================================
9 use AppearanceTemplate
;
10 use BlueprintTextureRendererTemplate
;
11 use ComponentAppearanceTemplate
;
12 use CustomizableShaderTemplate
;
13 use CustomizationVariableCollector
;
14 use DetailAppearanceTemplate
;
15 use LightsaberAppearanceTemplate
;
16 use LodMeshGeneratorTemplate
;
17 use MeshAppearanceTemplate
;
18 use PortalAppearanceTemplate
;
19 use SkeletalAppearanceTemplate
;
20 use SkeletalMeshGeneratorTemplate
;
21 use SwitchShaderTemplate
;
23 use VehicleCustomizationVariableGenerator
;
25 # ======================================================================
27 my $branch = "current";
29 my $treeFileLookupDataFile;
31 # ======================================================================
36 print "\tperl collectAssetCustomizationInfo.pl [-d] [-h] [-b <branch>] -t <treefile lookup filename>\n";
38 print "-d: if specified, turns on debugging info (Default: off)\n";
39 print "-h: print this help\n";
40 print "-t: loads the TreeFile lookup data from the specified filename\n";
43 # ----------------------------------------------------------------------
45 sub processCommandLineArgs
48 my $requestedHelp = 0;
50 # Grab options from commandline.
51 while ((scalar @_) && !$printHelp)
58 elsif ($_[0] =~ m/^-b/)
62 if (!defined($branch))
64 print "User must specify a branch name after the -t option, printing help.\n";
69 print "\$branch=[$branch]\n" if $debug;
72 elsif ($_[0] =~ m/^-d/)
76 elsif ($_[0] =~ m/^-t/)
79 $treeFileLookupDataFile = $_[0];
80 if (!defined($treeFileLookupDataFile))
82 print "User must specify a treefile lookup data filename after the -t option, printing help.\n";
87 print "\$treeFileLookupDataFile=[$treeFileLookupDataFile]\n" if $debug;
92 print "Unsupported option [$_[0]], printing help.\n";
96 # Shift past current argument.
100 # Check if we're missing anything required.
103 if (!defined($treeFileLookupDataFile))
105 print "No TreeFile lookup data file specified, printing usage info.\n";
113 exit ($requestedHelp ?
0 : -1);
117 # ----------------------------------------------------------------------
121 # Initialize data handlers.
122 &AppearanceTemplate
::install
();
123 &BlueprintTextureRendererTemplate
::install
();
124 &ComponentAppearanceTemplate
::install
();
125 &CustomizableShaderTemplate
::install
();
126 &DetailAppearanceTemplate
::install
();
127 &LightsaberAppearanceTemplate
::install
();
128 &LodMeshGeneratorTemplate
::install
();
129 &MeshAppearanceTemplate
::install
();
130 &PortalAppearanceTemplate
::install
();
131 &SkeletalAppearanceTemplate
::install
();
132 &SkeletalMeshGeneratorTemplate
::install
();
133 &SwitchShaderTemplate
::install
();
134 &VehicleCustomizationVariableGenerator
::install
();
136 # Open the TreeFile lookup datafile.
138 die "Failed to open [$treeFileLookupDataFile]: $!" unless open($dataFileHandle, "< " . $treeFileLookupDataFile);
140 # Initialize the treefile.
141 TreeFile
::loadFileLookupTable
($dataFileHandle);
143 # Close the TreeFile lookup datafile.
144 die "Failed to close [$treeFileLookupDataFile]: $!" unless close($dataFileHandle);
147 # ======================================================================
149 # ======================================================================
151 # Handle command line.
152 processCommandLineArgs
(@ARGV);
154 # Initialize subsystems (e.g. TreeFile)
157 # Setup the list of patterns to match against
158 # TreeFile-relative filenames. Any files in the TreeFile system
159 # that match one of these patterns will be processed by the
160 # CustomizationVariableCollector.
162 my @processFilePatterns =
164 '^texturerenderer/.+\.trt$', '^shader/.+\.sht$',
165 '^appearance/.+\.(apt|cmp|lmg|lod|lsb|mgn|msh|sat|pob)$'
167 # TEST ENTRIES: don't include these for real processing, used to test formats one-at-a-time.
169 # '^appearance/.+\.sat$'
170 # '^appearance/.+\.mgn$'
172 # '^appearance/.+\.lsb$'
173 # '^appearance/.+\.lod$'
174 # '^appearance/.+\.apt$'
175 # '^appearance/.+\.msh$'
176 # '^appearance/.+\.cmp$'
180 CustomizationVariableCollector
::collectData
(@processFilePatterns);
182 # Handle vehicle customization steps that cannot be handled by analyzing IFF file contents.
183 VehicleCustomizationVariableGenerator
::collectData
($branch);