Yata - 2da editor

https://neverwintervault.org/project/nwn2/other/tool/yata

c# .NET 3.5

6 Likes

oh this looks good, since there is no release binary I will ask:

is this able to copy columns/rows?
is this able to finish incomplete collums/rows? (ie. I add a new column name into 2da, open it, what happens? - i expect editor to automaticall fill **** on all rows for this new column)
is this able to re-number rows? (ie. I copypaste hundrets of rows but won’t manually renumber them, I would like 2da editor to do that automatically when opened - judging your editor has column ID editable this is not happening as of yet, please consider it)

editing within the editor is only by cells or by rows – colheads need to be handled by an external (text) editor.

yep. in fact it will open a 2da that has only a version header, then a blank line, then the colheads – when colheads extend beyond the quantity of fields it fills them w/ “****”

note however that fields that extend beyond colheads are deleted silently, though. EDIT: with a simple warning during load

yes, but it does it with a command under “2da Ops” on the menu. Editing the cell that contains the ID is not allowed from within the editor. When inserting or deleting rows, IDs are assigned automatically but this throws the other IDs off … that’s intended to allow a visual inspection of what happened … before using either “order row ids” or “test row order”. But note that the far left col – the rowheads – are static and should always show an accurate row-id.

yata_2daOps_menu

There’s a bunch of goodies that aren’t shown in the screenshot; browse the ReadMe.txt if you like:

One thing that’s sort of odd/awkward and that could take a bit of getting used to, is that single-row editing is handled by the right-click contextmenu

yata_contextmenu

(those are for single-row editing only) Multi-row inserting and deleting is handled under the Edit menu

yata_editmenu

(simple insertion and deletion of a single row can also be handled on the Edit menu, but anything more complicated requires using the context menu)

It’s still beta due to lack of testing … but i’ll take the plunge and link to a build sooner or later,

1 Like

very nice!

clarification for my first question, I would like to copy for example values in column A from 3 rows and copy them into next 3 rows, or all values in row 1 into row 2, that is what I meant. If your editor can do this, we have a winner here!

no, column/vertical editing doesn’t happen … at present it doesn’t allow multi-cell copy/paste (apart from entire rows). It’s strongly based on rows, or just single cells. I’ve thought about it but then am not sure i can deal with arrays of selected cells (that aren’t the width of an entire row) plus the error-checking (of ensuring that Mr/Ms. user isn’t trying to do something silly like paste cells off the right edge or bottom of the table…)

/maybe, but i can’t say i’d have a use for “copy values in column A from 3 rows and paste them into next 3 rows”

all values? yes

you’d have to make a case for the former  ;)

@Shadooow et al.

Is there any difference between Nwn1 2das and Nwn2 2das, technically?

The version header in II is “2DA V2.0” on the first line
followed by a so-called valuetype on the second (which as far as i’m aware is always left as a blank line, ie. is never used)
then on the third line comes the actual column labels (preceeded by a space (or spaces), or less accurately a tab-char – from what little I’ve read, 2das aren’t really supposed to have tab-chars… /shrug)

but mostly am wondering if the version header is the same between Nwn1 and 2 (if not i can put an option in Settings.Cfg, easily)

 
ps. Note that Settings.Cfg is not automated; it’s strictly for the user to configure in a text-editor. (read: I don’t want to deal with Windows’ security ‘features’ been there  :|

Sounds like they’re the same. Here is a small working custom NwN 2da I made recently -

2DA V2.0

    X       Y       Z       Face
0   60.00   24.62   0.0     65.0
1   51.09   26.92   0.0     65.0
2   52.06   29.21   0.0     65.0
3   53.01   31.50   0.0     65.0
4   53.98   33.82   0.0     65.0
5   54.70   36.99   0.20    90.0
6   54.93   39.53   0.20    90.0

TR

looks good Tr, thanks a bunch

You’re welcome. Little hint though. In the UK “thanks a bunch” is the same as “thanks for nothing” :sunglasses:

TR

it does in Canada too, but it depends on the tone of voice …

it sorta means “Thanks gotta go busy” (hehe)

Example w/ TR’s 2da

step 1: copy header and labels into a new 2da file
tr_test01

step 2: open in Yata
tr_test02

step 3: copy row-data to clipboard within Yata
tr_test03

step 4: import clipboard contents and paste it
tr_test04

step 5: delete blank 1st row and recolor rows
tr_test05

step 6: save and view output
tr_test06

2 Likes

Looks great for multi row editing.

tbh that really was a test, to see if it did  :)

Looking good so far. One thing to be aware of if you’re making this so it works with both NwN and NwN2 is that in my experience NwN does like tabs. It will throw the oddest error messages at you. I now use
Edit/Blank Operations/Tab to Space in notepad++ whenever I save a 2da just to be on the safe side.

I see that you are writing this in C#. Had it been VB I might (if I could find the time) have offered to help. I’ve never touched that particular language. I also see that you are specifying .net framework 3.5. That puts it as VS 2008 if I’m not mistaken. You are aware that MS now do a community edition of the latest version of VS, aren’t you? That is what I currently use as I couldn’t justify the cost of actually buying the pro version for the little use I make of it these days and there are a few things that work better in the latest version on win 10.

TR

Loads just fine, without any need to do an import old code routine, into VS 2017. Launched with no problems using the Debug/Debug Now. First impressions good. Just a thought. You might like to consider the “Input Font” for this application (Menus etc.). That is the font I used to illustrate code in my TR’s Basics tutorials.

TR

Lots of 2das have tabs, so it handles tabs on input but does not output tab-chars. Ironically, at least in my opinion, plenty of stock 2das in Nwn2 start with:

2DA	V2.0

(i mean, come on guys.) I was sure scratching my head when error-checking for

2DA V2.0

shot back an error at me, since they look the same with 4-space tabs.

And many second lines will have a ~dozen tabs on it … (ie. whitespace only)

Eventually i put in a user-option for “strict” (default false) to simply bypass such irregularities. But, y, it handles tabs, it just doesn’t output them.

Additionally, from “Bioware_Aurora_2DA_Format.pdf”

and

So I’m going with spaces on output. And they ain’t gonna be aligned either, since I’ve seen ~2mb 2das become ~8mb 2das when aligned.

 
I went with .NET 3.5 because Nwn2 toolset uses .NET 2.0 and 3.5 is a compatible upgrade to 2.0 – so all modders in Nwn2 will likely already have 3.5 installed. Plus it’s more likely to be compatible with older Windows’ OSs.

and in case anyone’s wondering, I don’t like .NET. I use it because it’s convenient and handy … until it isn’t

 

lol, you’re the third person who doesn’t like Consolas. I changed it to … Verdana! But it can be customized in the user-settings file. Set it and forget it.

WARNING: If I get anymore font comments i’m just going to set everything to Arial. /jk (or not…) In any case i’ll stick with fonts that ship with Windows (or a version of). I actually like Comic Sans … anyway, like anything the fonts are subject to change i guess.

 
Ps. i don’t use Visual Studio

am still fiddling with little things like this

 
but hope to upload a build to the Vault later today,

should be here there

https://neverwintervault.org/project/nwn2/other/tool/yata

1 Like

As you are not writing this in visual studio you may not realise just how easy it is to add the common controls at run time. For example to let the user choose the font they want to use in your program -

    FontDialog fontDlg = new FontDialog();
    fontDlg.ShowColor = true;
    fontDlg.ShowApply = false;
    fontDlg.ShowEffects = false;
    fontDlg.ShowHelp = false;
    fontDlg.MaxSize = 40;
    fontDlg.MinSize = 22;
    if(fontDlg.ShowDialog(); != DialogResult.Cancel)
    {
        //put code here
    }

To see what those various properties are here is the MS page on the font common control object.

TR

.NET (class)FontDialog is bugged.* It lists invalid TrueType fonts (ie, fonts that the font-creator, the person who made the font, didn’t implement as TrueType properly). If such a font is selected it will crash the whole program – the exception cannot even be trapped.

So the font-dialog (ie, FontPicker) that Yata invokes is custom. It exploits the fact that iterating over FontFamilies on the user’s system will bypass those invalid TrueTypes.

 
ps. The IDE I’m using – SharpDevelop – is entirely capable of simply clicking in a .NET Control object … but i’m comfortable instantiating objects in c# either way, Tr.

 
*edit : It can be argued that it’s not a bug in FontDialog itself. If all TrueType fonts were implemented properly, FontDialog would not bug out. but they aren’t and it does

edit2: iirc it’s not FontDialog itself that bugs – it obediently passes the font to the app, which then crashes.

1 Like