Skip to content

Commit

Permalink
txtp: favor bnk hashname over filename
Browse files Browse the repository at this point in the history
  • Loading branch information
bnnm committed Oct 4, 2021
1 parent 70cc110 commit 4997cc3
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions wwiser/wtxtp.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,21 +333,21 @@ def _get_name(self, printer, is_new=True):
name = guidname
else:
#get usable name
name = None

nroot = node.get_root()
bankname = os.path.basename(nroot.get_filename()) #[:-4] #
bankname = os.path.splitext(bankname)[0]

name = None
if bankname.isnumeric(): #try using hashname from bankname
nbnk = nroot.find1(name='BankHeader')
nbid = nbnk.find(name='dwSoundBankID')
battrs = nbid.get_attrs()

hashname = battrs.get('hashname')
if hashname:
name = hashname
#maybe could add language name?
# use bank's hashname if available
nbnk = nroot.find1(name='BankHeader')
nbid = nbnk.find(name='dwSoundBankID')
battrs = nbid.get_attrs()
hashname = battrs.get('hashname')
if hashname:
name = hashname

# otherwise use bank's name
if not name:
name = bankname

Expand Down

0 comments on commit 4997cc3

Please sign in to comment.