pgtools 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +25 -0
- data/bin/bxm_decoder +2 -0
- data/bin/bxm_encoder +2 -0
- data/bin/clh_convert +2 -0
- data/bin/clp_convert +2 -0
- data/bin/clw_convert +2 -0
- data/bin/dat_creator +2 -0
- data/bin/dat_extractor +2 -0
- data/bin/dat_ls +2 -0
- data/bin/eff_idd_creator +2 -0
- data/bin/eff_idd_extractor +2 -0
- data/bin/exp_convert_wiiu_pc +2 -0
- data/bin/exp_tool +2 -0
- data/bin/mot_convert_wiiu_pc +2 -0
- data/bin/mot_tool +2 -0
- data/bin/pkz_extractor +2 -0
- data/bin/scr_creator +2 -0
- data/bin/scr_extractor +2 -0
- data/bin/wmb_cleanup +2 -0
- data/bin/wmb_common_bones +2 -0
- data/bin/wmb_convert_pc_switch +2 -0
- data/bin/wmb_convert_wiiu_pc +2 -0
- data/bin/wmb_export_assimp +2 -0
- data/bin/wmb_get_bone_map +2 -0
- data/bin/wmb_import_assimp +2 -0
- data/bin/wmb_import_nier +2 -0
- data/bin/wmb_import_wiiu +2 -0
- data/bin/wtb_convert_wiiu_pc +2 -0
- data/bin/wtx_creator +2 -0
- data/bin/wtx_extractor +2 -0
- data/lib/bayonetta/alignment.rb +14 -0
- data/lib/bayonetta/bone.rb +55 -0
- data/lib/bayonetta/bxm.rb +180 -0
- data/lib/bayonetta/clh.rb +159 -0
- data/lib/bayonetta/clp.rb +212 -0
- data/lib/bayonetta/clw.rb +166 -0
- data/lib/bayonetta/dat.rb +261 -0
- data/lib/bayonetta/eff.rb +314 -0
- data/lib/bayonetta/endianness.rb +53 -0
- data/lib/bayonetta/exp.rb +768 -0
- data/lib/bayonetta/linalg.rb +416 -0
- data/lib/bayonetta/material_database.yaml +2581 -0
- data/lib/bayonetta/mot.rb +763 -0
- data/lib/bayonetta/pkz.rb +63 -0
- data/lib/bayonetta/scr.rb +393 -0
- data/lib/bayonetta/tools/bxm_decoder.rb +23 -0
- data/lib/bayonetta/tools/bxm_encoder.rb +37 -0
- data/lib/bayonetta/tools/clh_convert.rb +60 -0
- data/lib/bayonetta/tools/clp_convert.rb +70 -0
- data/lib/bayonetta/tools/clw_convert.rb +60 -0
- data/lib/bayonetta/tools/dat_creator.rb +57 -0
- data/lib/bayonetta/tools/dat_extractor.rb +94 -0
- data/lib/bayonetta/tools/dat_ls.rb +106 -0
- data/lib/bayonetta/tools/eff_idd_creator.rb +66 -0
- data/lib/bayonetta/tools/eff_idd_extractor.rb +73 -0
- data/lib/bayonetta/tools/exp_convert_wiiu_pc.rb +33 -0
- data/lib/bayonetta/tools/exp_tool.rb +48 -0
- data/lib/bayonetta/tools/mot_convert_wiiu_pc.rb +33 -0
- data/lib/bayonetta/tools/mot_tool.rb +60 -0
- data/lib/bayonetta/tools/pkz_extractor.rb +75 -0
- data/lib/bayonetta/tools/scr_creator.rb +63 -0
- data/lib/bayonetta/tools/scr_extractor.rb +78 -0
- data/lib/bayonetta/tools/wmb_cleanup.rb +250 -0
- data/lib/bayonetta/tools/wmb_common_bones.rb +45 -0
- data/lib/bayonetta/tools/wmb_convert_pc_switch.rb +35 -0
- data/lib/bayonetta/tools/wmb_convert_wiiu_pc.rb +33 -0
- data/lib/bayonetta/tools/wmb_export_assimp.rb +479 -0
- data/lib/bayonetta/tools/wmb_get_bone_map.rb +50 -0
- data/lib/bayonetta/tools/wmb_import_assimp.rb +735 -0
- data/lib/bayonetta/tools/wmb_import_geometry_wiiu_pc.rb +472 -0
- data/lib/bayonetta/tools/wmb_import_nier.rb +309 -0
- data/lib/bayonetta/tools/wtb_convert_wiiu_pc.rb +95 -0
- data/lib/bayonetta/tools/wtb_import_textures.rb +103 -0
- data/lib/bayonetta/tools/wtx_creator.rb +69 -0
- data/lib/bayonetta/tools/wtx_extractor.rb +85 -0
- data/lib/bayonetta/vertex_types.yaml +213 -0
- data/lib/bayonetta/vertex_types2.yaml +164 -0
- data/lib/bayonetta/vertex_types_nier.yaml +145 -0
- data/lib/bayonetta/wmb.rb +2443 -0
- data/lib/bayonetta/wmb3.rb +759 -0
- data/lib/bayonetta/wtb.rb +481 -0
- data/lib/bayonetta.rb +60 -0
- metadata +254 -0
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
require 'yaml'
|
3
|
+
require_relative '../../bayonetta'
|
4
|
+
|
5
|
+
$options = {
|
6
|
+
output: nil
|
7
|
+
}
|
8
|
+
OptionParser.new do |opts|
|
9
|
+
opts.banner = <<EOF
|
10
|
+
Usage: scr_creator target_directory
|
11
|
+
EOF
|
12
|
+
opts.on("-h", "--help", "Prints this help") do
|
13
|
+
puts opts
|
14
|
+
exit
|
15
|
+
end
|
16
|
+
|
17
|
+
opts.on("-o", "--output=filename", "file to output result") do |name|
|
18
|
+
$options[:output] = name
|
19
|
+
end
|
20
|
+
|
21
|
+
end.parse!
|
22
|
+
|
23
|
+
input_dir = ARGV[0]
|
24
|
+
|
25
|
+
raise "Not a directory: #{input_dir}!" unless input_dir && File.directory?(input_dir)
|
26
|
+
|
27
|
+
pwd = Dir.pwd
|
28
|
+
Dir.chdir(input_dir)
|
29
|
+
Dir.mkdir("scr_output") unless Dir.exist?("scr_output")
|
30
|
+
|
31
|
+
big = YAML::load_file(".metadata/big.yaml")
|
32
|
+
bayo2 = YAML::load_file(".metadata/bayo2.yaml")
|
33
|
+
|
34
|
+
if bayo2
|
35
|
+
scr = Bayonetta::SCR2File::new(nil, big)
|
36
|
+
else
|
37
|
+
scr = Bayonetta::SCRFile::new(nil, big)
|
38
|
+
end
|
39
|
+
|
40
|
+
scr.models_metadata = YAML::load_file(".metadata/models_metadata.yaml")
|
41
|
+
scr.unknown = YAML::load_file(".metadata/unknown.yaml")
|
42
|
+
|
43
|
+
files = Dir.entries(".")
|
44
|
+
models = files.select { |name| name.match "wmb" }
|
45
|
+
models.sort!
|
46
|
+
textures = files.select { |name| name.match "wtb" }.first
|
47
|
+
|
48
|
+
models.each { |name|
|
49
|
+
scr.push_model(File::new(name, "rb"))
|
50
|
+
}
|
51
|
+
|
52
|
+
scr.textures = File::new("000.wtb", "rb") unless bayo2
|
53
|
+
|
54
|
+
output_file = $options[:output]
|
55
|
+
if !output_file
|
56
|
+
Dir.mkdir("scr_output") unless Dir.exist?("scr_output")
|
57
|
+
Dir.chdir("scr_output")
|
58
|
+
output_file = "#{File.basename(input_dir).gsub("_scr", ".scr")}"
|
59
|
+
else
|
60
|
+
Dir.chdir(pwd)
|
61
|
+
end
|
62
|
+
|
63
|
+
scr.dump(output_file)
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
require 'yaml'
|
3
|
+
require_relative '../../bayonetta'
|
4
|
+
|
5
|
+
$options = {
|
6
|
+
output: nil
|
7
|
+
}
|
8
|
+
|
9
|
+
OptionParser.new do |opts|
|
10
|
+
opts.banner = <<EOF
|
11
|
+
Usage: scr_extractor file
|
12
|
+
EOF
|
13
|
+
opts.on("-h", "--help", "Prints this help") do
|
14
|
+
puts opts
|
15
|
+
exit
|
16
|
+
end
|
17
|
+
|
18
|
+
opts.on("-o", "--output=dirname", "directory to output result") do |name|
|
19
|
+
$options[:output] = name
|
20
|
+
end
|
21
|
+
|
22
|
+
end.parse!
|
23
|
+
|
24
|
+
save_pwd = Dir.pwd
|
25
|
+
|
26
|
+
raise "Invalid output directory #{$options[:output]}" if $options[:output] && !Dir.exist?($options[:output])
|
27
|
+
|
28
|
+
filename = ARGV[0]
|
29
|
+
raise "Invalid file: #{filename}!" unless filename && File.exist?(filename)
|
30
|
+
directory = File.dirname(filename)
|
31
|
+
name = File.basename(filename)
|
32
|
+
ext_name = File.extname(name)
|
33
|
+
|
34
|
+
raise "Invalid file: #{filename}!" unless ext_name == ".scr"
|
35
|
+
|
36
|
+
f = File::open(filename, "rb")
|
37
|
+
|
38
|
+
if $options[:output]
|
39
|
+
Dir.chdir(save_pwd)
|
40
|
+
Dir.chdir($options[:output])
|
41
|
+
else
|
42
|
+
Dir.chdir(directory)
|
43
|
+
end
|
44
|
+
dir_name = File.basename(name, ext_name) + "#{ext_name.gsub(".","_")}"
|
45
|
+
Dir.mkdir(dir_name) unless Dir.exist?(dir_name)
|
46
|
+
Dir.chdir(dir_name)
|
47
|
+
|
48
|
+
scr = Bayonetta::SCRFile::load(f)
|
49
|
+
|
50
|
+
scr.each_model.each_with_index { |f1, i|
|
51
|
+
File::open("%03d.wmb" % [i] , "wb") { |f2|
|
52
|
+
f1.rewind
|
53
|
+
f2.write(f1.read)
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
f1 = scr.textures
|
58
|
+
if f1
|
59
|
+
File::open("000.wtb", "wb") { |f2|
|
60
|
+
f1.rewind
|
61
|
+
f2.write(f1.read)
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
Dir.mkdir(".metadata") unless Dir.exist?(".metadata")
|
66
|
+
Dir.chdir(".metadata")
|
67
|
+
File::open("models_metadata.yaml", "w") { |fl|
|
68
|
+
fl.print YAML::dump( scr.models_metadata )
|
69
|
+
}
|
70
|
+
File::open("big.yaml","w") { |fl|
|
71
|
+
fl.print YAML::dump( scr.big )
|
72
|
+
}
|
73
|
+
File::open("bayo2.yaml","w") { |fl|
|
74
|
+
fl.print YAML::dump( scr.bayo2? )
|
75
|
+
}
|
76
|
+
File::open("unknown.yaml", "w") { |fl|
|
77
|
+
fl.print YAML::dump( scr.unknown )
|
78
|
+
}
|
@@ -0,0 +1,250 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
require 'yaml'
|
3
|
+
require_relative '../../bayonetta'
|
4
|
+
include Bayonetta
|
5
|
+
|
6
|
+
$options = {
|
7
|
+
:vertexes => false,
|
8
|
+
:bones => false,
|
9
|
+
:remap_bones => false,
|
10
|
+
:textures => false,
|
11
|
+
:cleanup_mat => false,
|
12
|
+
:cleanup_mat_sizes => false,
|
13
|
+
:maximize_mat_sizes => false,
|
14
|
+
:delete_bones => nil,
|
15
|
+
:offsets => false,
|
16
|
+
:fix => false,
|
17
|
+
:swap => nil,
|
18
|
+
:swap_meshes => nil,
|
19
|
+
:move_meshes => nil,
|
20
|
+
:delete_meshes => nil,
|
21
|
+
:delete_batches => nil,
|
22
|
+
:merge_meshes => nil,
|
23
|
+
:overwrite => nil
|
24
|
+
}
|
25
|
+
|
26
|
+
OptionParser.new do |opts|
|
27
|
+
opts.banner = "Usage: wmb_cleanup.rb target_file [options]"
|
28
|
+
|
29
|
+
opts.on("--[no-]bone-refs", "Cleanup bone refs in batches") do |bone_refs|
|
30
|
+
$options[:bone_refs] = bone_refs
|
31
|
+
end
|
32
|
+
|
33
|
+
opts.on("--[no-]add-parents-bone-refs", "Add ancestry to bone refs and sort them") do |bone_refs|
|
34
|
+
$options[:submodel_bone_refs] = bone_refs
|
35
|
+
end
|
36
|
+
|
37
|
+
opts.on("--[no-]add-previous-bone-refs", "Add all previous bones to bone refs and sort them") do |bone_refs|
|
38
|
+
$options[:previous_bone_refs] = bone_refs
|
39
|
+
end
|
40
|
+
|
41
|
+
opts.on("-b", "--[no-]bones", "Cleanup bones") do |bones|
|
42
|
+
$options[:bones] = bones
|
43
|
+
end
|
44
|
+
|
45
|
+
opts.on("--remap-bones=BONEMAP", "Remaps specified local bones to global bone indexes") do |bone_map|
|
46
|
+
if File.exist?(bone_map)
|
47
|
+
$options[:remap_bones] = YAML::load_file(bone_map)
|
48
|
+
else
|
49
|
+
$options[:remap_bones] = eval(bone_map).to_h
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
opts.on("--[no-]order-bones", "Order bones in their global numbering if possible") do |order_bones|
|
54
|
+
$options[:order_bones] = order_bones
|
55
|
+
end
|
56
|
+
|
57
|
+
opts.on("-v", "--[no-]vertexes", "Cleanup vertexes") do |vertexes|
|
58
|
+
$options[:vertexes] = vertexes
|
59
|
+
end
|
60
|
+
|
61
|
+
opts.on("--[no-]remove_duplicate_vertexes", "Ensure no vertex is used more than once") do |rdv|
|
62
|
+
$options[:remove_duplicate_vertexes] = rdv
|
63
|
+
end
|
64
|
+
|
65
|
+
opts.on("--[no-]normalize-vertex-usage", "Ensure no vertex is used in more than 1 batch") do |nvu|
|
66
|
+
$options[:normalize_vertex_usage] = nvu
|
67
|
+
end
|
68
|
+
|
69
|
+
opts.on("-o", "--[no-]remove-batch-offsets", "Remove batch vertex offsets") do |o|
|
70
|
+
$options[:offsets] = o
|
71
|
+
end
|
72
|
+
|
73
|
+
opts.on("--[no-]check-normals", "Try to detect wide normals (Switch)") do |cn|
|
74
|
+
$options[:check_normals] = cn
|
75
|
+
end
|
76
|
+
|
77
|
+
opts.on("-f", "--[no-]fix-ex-data", "Put normal map u v in ex data") do |fix|
|
78
|
+
$options[:fix] = fix
|
79
|
+
end
|
80
|
+
|
81
|
+
opts.on("--copy-uv1to2=MESHLIST", "Copy the first UV mapping to the second one") do |copy_uv|
|
82
|
+
$options[:copy_uv] = eval(copy_uv).to_a
|
83
|
+
end
|
84
|
+
|
85
|
+
opts.on("--[no-]remove-triangle-strips", "Remove triangle strips and replace by triangles") do |strips|
|
86
|
+
$options[:strips] = strips
|
87
|
+
end
|
88
|
+
|
89
|
+
opts.on("--revert-triangles=MESHLIST", "Revert traiangle faces") do |revert|
|
90
|
+
$options[:revert] = eval(revert).to_a
|
91
|
+
end
|
92
|
+
|
93
|
+
opts.on("-e", "--swap-endianness", "Swap endianness") do |swap|
|
94
|
+
$options[:swap] = swap
|
95
|
+
end
|
96
|
+
|
97
|
+
opts.on("--duplicate-meshes=MESHLIST", "Duplicate specified meshes") do |mesh_list|
|
98
|
+
$options[:duplicate_meshes] = eval(mesh_list).to_a
|
99
|
+
end
|
100
|
+
|
101
|
+
opts.on("-s", "--swap-meshes=MESHHASH", "Swap specified meshes") do |mesh_hash|
|
102
|
+
$options[:swap_meshes] = eval(mesh_hash).to_h
|
103
|
+
end
|
104
|
+
|
105
|
+
opts.on("--merge-meshes=MESHHASH", "Merge specified meshes") do |mesh_hash|
|
106
|
+
$options[:merge_meshes] = eval(mesh_hash).to_h
|
107
|
+
end
|
108
|
+
|
109
|
+
opts.on("--move-meshes=MESHHASH", "Move the specified meshes to the specified positions") do |mesh_positions|
|
110
|
+
$options[:move_meshes] = eval(mesh_positions).to_h
|
111
|
+
end
|
112
|
+
|
113
|
+
opts.on("-m", "--delete-meshes=MESHLIST", "Delete specified meshes") do |mesh_list|
|
114
|
+
$options[:delete_meshes] = eval(mesh_list).to_a
|
115
|
+
end
|
116
|
+
|
117
|
+
opts.on("--delete-batches=BATCHLIST", "Delete specified batch list (WMB3) or { mesh => batch list } hash") do |batch_list|
|
118
|
+
$options[:delete_batches] = eval(batch_list).to_a
|
119
|
+
end
|
120
|
+
|
121
|
+
opts.on("--dummy=MESHHLIST", "Replace a given meshes by dummy mesh with one dummy batch") do |mesh_list|
|
122
|
+
$options[:dummy_meshes] = eval(mesh_list).to_a
|
123
|
+
end
|
124
|
+
|
125
|
+
opts.on("--split-meshes=MESHLIST", "Split the selected meshes into meshes containing only one batch") do |split_meshes|
|
126
|
+
$options[:split_meshes] = eval(split_meshes).to_a
|
127
|
+
end
|
128
|
+
|
129
|
+
opts.on("-d", "--delete-bones=BONELIST", "Delete specified bones") do |bone_list|
|
130
|
+
$options[:delete_bones] = eval(bone_list).to_a
|
131
|
+
end
|
132
|
+
|
133
|
+
opts.on("-t", "--[no-]textures", "Cleanup textures") do |textures|
|
134
|
+
$options[:textures] = textures
|
135
|
+
end
|
136
|
+
|
137
|
+
opts.on("-c", "--cleanup-materials", "Cleanup materials") do |cleanup_mat|
|
138
|
+
$options[:cleanup_mat] = cleanup_mat
|
139
|
+
end
|
140
|
+
|
141
|
+
opts.on("--cleanup-material-sizes", "Cleanup material sizes") do |cleanup_mat_sizes|
|
142
|
+
$options[:cleanup_mat_sizes] = cleanup_mat_sizes
|
143
|
+
end
|
144
|
+
|
145
|
+
opts.on("--maximize-material-sizes", "Maximize material sizes") do |maximize_mat_sizes|
|
146
|
+
$options[:maximize_mat_sizes] = maximize_mat_sizes
|
147
|
+
end
|
148
|
+
|
149
|
+
opts.on("--overwrite", "Overwrite input file") do |overwrite|
|
150
|
+
$options[:overwrite] = overwrite
|
151
|
+
end
|
152
|
+
|
153
|
+
opts.on("--scale=SCALE", "Scales the model by a factor") do |scale|
|
154
|
+
$options[:scale] = scale.to_f
|
155
|
+
end
|
156
|
+
|
157
|
+
opts.on("--shift=SHIFT_VECTOR", "Shifts the model") do |shift|
|
158
|
+
$options[:shift] = eval(shift).to_a
|
159
|
+
end
|
160
|
+
|
161
|
+
opts.on("--reverse-tangents-byte-order=MESH_LIST", "Fixes the tangents import that was buggy, only use on bayo 2 imported meshes...") do |tan|
|
162
|
+
$options[:reverse_tangents] = eval(tan).to_a
|
163
|
+
end
|
164
|
+
|
165
|
+
opts.on("--[no-]recompute-relative-positions", "Recomputes relative bone positions...") do |recomp|
|
166
|
+
$options[:recompute_relative_positions] = recomp
|
167
|
+
end
|
168
|
+
|
169
|
+
opts.on("--set-pose=POSE_FILE", "Set model to the given pose") do |pose|
|
170
|
+
$options[:set_pose] = YAML::load_file(pose)
|
171
|
+
end
|
172
|
+
|
173
|
+
opts.on("--[no-]set-t-pose", "Set the model to a t pose (WMB3)") do |tpose|
|
174
|
+
$options[:set_tpose] = tpose
|
175
|
+
end
|
176
|
+
|
177
|
+
opts.on("--rotate=ROTATE_INFO", "Rotates the model.",
|
178
|
+
" ROTATE_INFO is either:",
|
179
|
+
" [rx, ry, rz] rotation (in radian) respectively around the x, y and z axis (in this order)",
|
180
|
+
" [[rx, ry, rz], [x, y, z]] with the center of the rotation specified" ) do |rotate|
|
181
|
+
$options[:rotate] = eval(rotate).to_a
|
182
|
+
end
|
183
|
+
|
184
|
+
opts.on("-h", "--help", "Prints this help") do
|
185
|
+
puts opts
|
186
|
+
exit
|
187
|
+
end
|
188
|
+
|
189
|
+
end.parse!
|
190
|
+
|
191
|
+
|
192
|
+
input_file = ARGV[0]
|
193
|
+
|
194
|
+
raise "Invalid file: #{input_file}" unless input_file && File::file?(input_file)
|
195
|
+
Dir.mkdir("wmb_output") unless Dir.exist?("wmb_output")
|
196
|
+
Dir.mkdir("wtb_output") unless Dir.exist?("wtb_output")
|
197
|
+
wmb = WMBFile::load(input_file)
|
198
|
+
wmb.check_normals if $options[:check_normals]
|
199
|
+
wmb.scale($options[:scale]) if $options[:scale]
|
200
|
+
wmb.rotate(*($options[:rotate])) if $options[:rotate]
|
201
|
+
wmb.shift(*($options[:shift])) if $options[:shift]
|
202
|
+
wmb.delete_batches($options[:delete_batches]) if $options[:delete_batches]
|
203
|
+
wmb.split_meshes($options[:split_meshes]) if $options[:split_meshes]
|
204
|
+
wmb.duplicate_meshes($options[:duplicate_meshes]) if $options[:duplicate_meshes]
|
205
|
+
wmb.move_meshes($options[:move_meshes]) if $options[:move_meshes]
|
206
|
+
wmb.swap_meshes($options[:swap_meshes]) if $options[:swap_meshes]
|
207
|
+
wmb.merge_meshes($options[:merge_meshes]) if $options[:merge_meshes]
|
208
|
+
wmb.dummy_meshes($options[:dummy_meshes]) if $options[:dummy_meshes]
|
209
|
+
wmb.delete_meshes($options[:delete_meshes]) if $options[:delete_meshes]
|
210
|
+
wmb.cleanup_bone_refs if $options[:bone_refs]
|
211
|
+
wmb.add_ancestors_bone_refs if $options[:submodel_bone_refs]
|
212
|
+
wmb.add_previous_bone_refs if $options[:previous_bone_refs]
|
213
|
+
wmb.cleanup_bones if $options[:bones]
|
214
|
+
wmb.recompute_relative_positions if $options[:recompute_relative_positions]
|
215
|
+
wmb.remove_duplicate_vertexes if $options[:remove_duplicate_vertexes]
|
216
|
+
wmb.normalize_vertex_usage if $options[:normalize_vertex_usage]
|
217
|
+
wmb.remove_triangle_strips if $options[:strips]
|
218
|
+
wmb.revert_triangles($options[:revert]) if $options[:revert]
|
219
|
+
wmb.cleanup_vertexes if $options[:vertexes]
|
220
|
+
wmb.remove_batch_vertex_offsets if $options[:offsets]
|
221
|
+
wmb.fix_ex_data if $options[:fix]
|
222
|
+
wmb.copy_uv12($options[:copy_uv]) if $options[:copy_uv]
|
223
|
+
wmb.reverse_tangents_byte_order($options[:reverse_tangents]) if $options[:reverse_tangents]
|
224
|
+
if $options[:set_pose]
|
225
|
+
exp_name = input_file.gsub(".wmb", ".exp")
|
226
|
+
exp = nil
|
227
|
+
if File::file?(exp_name)
|
228
|
+
exp = EXPFile::load(exp_name)
|
229
|
+
end
|
230
|
+
wmb.set_pose($options[:set_pose], exp)
|
231
|
+
end
|
232
|
+
if $options[:set_tpose]
|
233
|
+
wmb.set_tpose
|
234
|
+
end
|
235
|
+
wmb.delete_bones($options[:delete_bones]) if $options[:delete_bones]
|
236
|
+
wmb.remap_bones($options[:remap_bones]) if $options[:remap_bones]
|
237
|
+
wmb.order_bones if $options[:order_bones]
|
238
|
+
wmb.cleanup_materials if $options[:cleanup_mat]
|
239
|
+
wmb.cleanup_material_sizes if $options[:cleanup_mat_sizes]
|
240
|
+
wmb.maximize_material_sizes if $options[:maximize_mat_sizes]
|
241
|
+
wmb.cleanup_textures(input_file, $options[:overwrite]) if $options[:textures]
|
242
|
+
unless wmb.class == WMB3File
|
243
|
+
wmb.renumber_batches
|
244
|
+
end
|
245
|
+
wmb.recompute_layout
|
246
|
+
if $options[:overwrite]
|
247
|
+
wmb.dump(input_file, $options[:swap] ? !wmb.was_big? : wmb.was_big? )
|
248
|
+
else
|
249
|
+
wmb.dump("wmb_output/"+File.basename(input_file), $options[:swap] ? !wmb.was_big? : wmb.was_big? )
|
250
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'set'
|
2
|
+
require 'yaml'
|
3
|
+
require 'optparse'
|
4
|
+
require_relative '../../bayonetta'
|
5
|
+
include Bayonetta
|
6
|
+
|
7
|
+
OptionParser.new do |opts|
|
8
|
+
opts.banner = <<EOF
|
9
|
+
Usage: wmb_common_bones target_file [target_file2 ...]
|
10
|
+
This script finds the common bones between a list of models.
|
11
|
+
This was used to find the minimal skeleton.
|
12
|
+
Target files should be dat files or wmb files.
|
13
|
+
EOF
|
14
|
+
opts.on("-h", "--help", "Prints this help") do
|
15
|
+
puts opts
|
16
|
+
exit
|
17
|
+
end
|
18
|
+
|
19
|
+
end.parse!
|
20
|
+
|
21
|
+
bone_set = Set::new
|
22
|
+
bone_set.merge((0..0xfff).to_a)
|
23
|
+
found = false
|
24
|
+
ARGV.each { |input_file|
|
25
|
+
raise "Invalid file #{input_file}" unless File::file?(input_file)
|
26
|
+
if File.extname(input_file) == ".dat"
|
27
|
+
search = File.basename(input_file, ".dat")+".wmb"
|
28
|
+
wmb = DATFile::load(input_file).each.select { |name, f|
|
29
|
+
name == search
|
30
|
+
}.first
|
31
|
+
if !wmb
|
32
|
+
warn "Could not find #{search} in #{File.basename(input_file)}"
|
33
|
+
next
|
34
|
+
end
|
35
|
+
wmb = wmb[1]
|
36
|
+
wmb = WMBFile::load(wmb)
|
37
|
+
else
|
38
|
+
wmb = WMBFile::load(input_file)
|
39
|
+
end
|
40
|
+
found = true
|
41
|
+
tt = wmb.bone_index_translate_table.table
|
42
|
+
bone_set &= tt.collect{ |mot_index, bone_index| mot_index }
|
43
|
+
}
|
44
|
+
|
45
|
+
puts YAML::dump(bone_set.to_a) if found
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
require_relative '../../bayonetta.rb'
|
3
|
+
include Bayonetta
|
4
|
+
|
5
|
+
$options = {
|
6
|
+
output: nil
|
7
|
+
}
|
8
|
+
|
9
|
+
OptionParser.new do |opts|
|
10
|
+
opts.banner = <<EOF
|
11
|
+
Usage: wmb_convert_pc_switch target_file
|
12
|
+
EOF
|
13
|
+
opts.on("-h", "--help", "Prints this help") do
|
14
|
+
puts opts
|
15
|
+
exit
|
16
|
+
end
|
17
|
+
|
18
|
+
opts.on("-o", "--output=filename", "file to output result") do |name|
|
19
|
+
$options[:output] = name
|
20
|
+
end
|
21
|
+
|
22
|
+
end.parse!
|
23
|
+
|
24
|
+
input_file = ARGV[0]
|
25
|
+
|
26
|
+
raise "Invalid file #{input_file}" unless input_file && File::file?(input_file)
|
27
|
+
wmb = WMBFile::load(input_file)
|
28
|
+
wmb.normals_to_wide
|
29
|
+
|
30
|
+
output_file = $options[:output]
|
31
|
+
if !output_file
|
32
|
+
Dir.mkdir("wmb_output") unless Dir.exist?("wmb_output")
|
33
|
+
output_file = File.join("wmb_output", File.basename(input_file))
|
34
|
+
end
|
35
|
+
wmb.dump(output_file, wmb.was_big?)
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
require_relative '../../bayonetta'
|
3
|
+
include Bayonetta
|
4
|
+
|
5
|
+
$options = {
|
6
|
+
output: nil
|
7
|
+
}
|
8
|
+
|
9
|
+
OptionParser.new do |opts|
|
10
|
+
opts.banner = <<EOF
|
11
|
+
Usage: wmb_convert_wiiu_pc target_file
|
12
|
+
EOF
|
13
|
+
opts.on("-h", "--help", "Prints this help") do
|
14
|
+
puts opts
|
15
|
+
exit
|
16
|
+
end
|
17
|
+
|
18
|
+
opts.on("-o", "--output=filename", "file to output result") do |name|
|
19
|
+
$options[:output] = name
|
20
|
+
end
|
21
|
+
|
22
|
+
end.parse!
|
23
|
+
|
24
|
+
input_file = ARGV[0]
|
25
|
+
|
26
|
+
raise "Invalid file #{input_file}" unless input_file && File::file?(input_file)
|
27
|
+
|
28
|
+
output_file = $options[:output]
|
29
|
+
if !output_file
|
30
|
+
Dir.mkdir("wmb_output") unless Dir.exist?("wmb_output")
|
31
|
+
output_file = File.join("wmb_output", File.basename(input_file))
|
32
|
+
end
|
33
|
+
WMBFile::convert(input_file, output_file)
|