Created
October 1, 2010 03:31
-
-
Save valda/605678 to your computer and use it in GitHub Desktop.
kf を開いて定型の書き換え&全ての BonePriority を 99 に変更するだけのスクリプ㌧
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8-dos; mode: python -*- | |
import sys | |
from optparse import OptionParser | |
from pyffi.formats.nif import NifFormat | |
parser = OptionParser(usage="usage: %prog [options] FILE") | |
parser.add_option("-o", dest="outfile", help="output file", default="out.kf", metavar="FILE") | |
parser.add_option("-q", dest="quiet", help="quiet mode", default=False) | |
(opts, args) = parser.parse_args(sys.argv) | |
if len(args) != 2: | |
parser.print_help() | |
exit() | |
istrm = open(args[1], 'rb') | |
data = NifFormat.Data() | |
data.read(istrm) | |
print ('NIF version 0x%x, User version %d' % (data.version, data.user_version)) | |
for root in data.roots: | |
if isinstance(root, NifFormat.NiControllerSequence): | |
root.name = 'SpecialIdle' | |
root.cycle_type = 0 # Set to CYCLE_LOOP | |
for block in root.controlled_blocks: | |
print('%s: priority %d -> %d' % (block.node_name.decode("ascii"), block.priority, 99)) | |
block.priority = 99 | |
ostrm = open(opts.outfile, 'wb') | |
data.write(ostrm) | |
ostrm.close() | |
istrm.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment