Jump to content
The Dark Mod Forums

Understanding the Code


Recommended Posts

  • Replies 234
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

StiFu: another small glitch while you're looking at this code:

 

The editor does not retrieve the xdata name from the entity if it exists. For example, I create a readable, give it a name, an inventory name, and an xdata name (no need to I know at this point if I'm going to use the editor.) I've not actually created any xdata manually. I now open the editor and choose a gui and type some text but when I go to save it says I must give the xdata a name so I have to type it in again.

 

It must retrieve that name the second time I open it in the editor so the function must already be there but it's just when creating a new one it doesn't.

Link to comment
Share on other sites

Alright, I think I fixed the issues now (Issue #2584). The guiSelector had two issues with the notebook. One of the fixes is a rather dirty one since I simply delete the notebook object to prevent it from switching pages when destroying the window. Is this practice ok, Greebo? I added the issue to target version 1.5.0, ok?

 

@Fidcal: That is more of a featurerequest, but it should be easy to do. I'll have a look.

Link to comment
Share on other sites

Here is the thing. Currently the importer does not differ between "import failed due to faulty xdata definition" and "import failed due to definition not found" and only in the latter case, it would be ok to use the predefined xdata name. So implementing the requested feature would require a major code rearrangement, which I am not willing to do, seeing that it's such a minor tweak.

 

However, I could just make it keep the xdata name generally regardless of the cause of import failure. This would mean that upon failing to import a definition, a definition with the same name would be created, but the user wouldn't be notified about this duplicate, because (again) the importer failed to import the first definition. :) The xdata import summary in the tools menu does show that there were multiple definitions. Maybe I can do something, so that the user is at least warned about this, but I am out of time for today.

Link to comment
Share on other sites

Alright, I think I fixed the issues now (Issue #2584). The guiSelector had two issues with the notebook. One of the fixes is a rather dirty one since I simply delete the notebook object to prevent it from switching pages when destroying the window. Is this practice ok, Greebo? I added the issue to target version 1.5.0, ok?

I haven't looked at the changes yet - do I assume correctly that there is a callback/signal fired on window destruction? If such a signal handler is the problem, the solution would be to disconnect the handler in the _preDestroy() event of the dialog.

 

Not that your solution is particularly bad or something, whatever works it's most probably fine, unless you've got the feeling that your solution will break sooner than later.

 

Thanks for looking into it in any case.

Link to comment
Share on other sites

No problem. It felt good to finally do something on DR again. And bugfixing is not such a huge task compared to rearranging the whole importer and the gui, as it used to be my plan. Is there actually need for that plan to be realized? Rewriting the importer code to support all possible xdata definitions won't be hard, but adapting the Readable Editor Gui to it while maintaining a good comforting user-workflow will be a messy task.

 

Anyway, your assumption is correct and your proposal would probably be the most elegant solution, but seeing that the notebook will never be accessed after the window was destroyed, I guess we're good with the current approach.

Link to comment
Share on other sites

Ok, I committed my work on Fidcal's feature request. A predefined "xdata_contents" property now sticks when launching the editor. As I pointed out earlier, this can result in a problem if there was a definition with the same name that failed to import. Here is a scenario that shows how the editor behaves in that case:

  • Define xdata_contents on an entity before launching the editor. A faulty definition with that name is already defined in a file.
  • Launch the Readable Editor
  • Readable Editor shows an error message, saying that the importer failed, but the suggested xdata name is still used for the new xdata definition.
  • Upon saving a duplicated definition will be created.
  • When launching the Readable Editor the next time, the importer will successfully import the newly created xdata definition, but will show a warning saying that there were problems during import and the user is asked whether the xdata import summary should be displayed.

 

Is this behavior ok? I had to make showXdImportSummary() for this to work. If this implementation is acceptable, should it be included in 1.5.0? If this implementation is not acceptable, we should just revert the commit, as a proper solution will require a pretty deep rearrangement of some of the class-methods, which again would require a lot of testing etc. and I am not willing to do that for such a small tweak.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recent Status Updates

    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
×
×
  • Create New...