PDA

View Full Version : registerExportNode options, include library links for reference?



celestian
July 2nd, 2018, 16:16
Is it possible to set a <recordname>?????</recordname> when setting registerExportNode?

I've been experimenting with /export trying to see how close I could get the Story entries -> Reference manual like author and I've been able to export the reference portion but it's of no use if I can't insert an entry into the <library> links.

Something like this.


<id-00001>
<librarylink type="windowreference">
<class>reference_manual</class>
<recordname>reference.refmanualindex</recordname>
</librarylink>
<name type="string">REF Manual</name>
</id-00001>



I'm hoping I'm just missing some variable option. It does create <library> entries for every other item exported (npc, items, spells/etc)

I've tried:


ExportManager.registerExportNode({ name = "_authorRefmanual", class = "reference_manual", label = "Reference Manual", export="reference"});


And that does export the node in the db.xml file but it doesn't create a class link in the <library> section called "Reference Manual" so you can actually read it.

I've played with export="" and was able to rename "_authorRefManual" to "reference" but I can't seem to figure out what exportref actually does.

Please please tell me that I can do this if not PLEASE add this feature. Having an Export.addOnExport(function) that runs before the export would great also.

celestian
July 2nd, 2018, 23:11
Also, I should have mentioned... I am using 3.3.6 for this. It only adds the records to the mod->db.xml, not a <library> link entry.

Ikael
July 2nd, 2018, 23:40
I don't think that is possible or that it should be built-in exporters task to provide such feature. If you are doing something not-out-of-the-box you could implement own export feature that does exactly what you are looking for.

celestian
July 3rd, 2018, 00:18
I don't think that is possible or that it should be built-in exporters task to provide such feature. If you are doing something not-out-of-the-box you could implement own export feature that does exactly what you are looking for.

No, you can't. You can't export images, or create a .mod compressed file with all the contents. The code already does what I am asking except for allowing 'reference_manual' class and writing the library link. 3.3.6 broke something, in 3.3.5 here is what happens.

3.3.5:


<entries>
<_authorRefmanual>
<librarylink type="windowreference">
<class>reference_list</class>
<recordname>..</recordname>
</librarylink>
<name type="string">Reference Manual</name>
<recordtype type="string">_authorRefmanual</recordtype>
</_authorRefmanual>
<battle>
....
<reference>
<refmanualindex>
......
</refmanualindex>
</reference>



3.3.6: (note the now missing <entries> for <_authorRefmanual>


<entries>

<battle>
<librarylink type="windowreference">
<class>reference_list</class>
<recordname>..</recordname>
</librarylink>
<name type="string">Encounters</name>
<recordtype type="string">battle</recordtype>
</battle>
....
<reference>
<refmanualindex>
......
</refmanualindex>
</reference>

damned
July 3rd, 2018, 00:33
I was about to chime in here with a request on pregencharselect... but its already in 3.3.6 - Huzzah!

damned
July 3rd, 2018, 00:42
Also - Author is a great tool - if the above support can be added back in... it would be much appreciated!

Ikael
July 3rd, 2018, 08:00
You can implement own export functionality that uses Module.export function that does everything, includes all content and images as mod file. The built-in export feature uses the same function so there is no special limitation if you would implement your own version. SWEL was created with this feature in mind. Currently it is able to export complete production/store ready library mods that includes everything.

damned
July 3rd, 2018, 08:02
You can implement own export functionality that uses Module.export function that does everything, includes all content and images as mod file. The built-in export feature uses the same function so there is no special limitation if you would implement your own version. SWEL was created with this feature in mind. Currently it is able to export complete production/store ready library mods that includes everything.

Hi Aki does SWEL still work on 3.3.6?
3.3.6 doesnt export in the same format that 3.3.5 does.

Ikael
July 3rd, 2018, 08:09
Hi Aki does SWEL still work on 3.3.6?
3.3.6 doesnt export in the same format that 3.3.5 does.

It does. I haven't released the latest version yet but have already used it to re-produce several existing store products. SWEL does not rely on built-in /export feature. Instead it exports everything on ots own using FG API, this is what I recommend for celestian because it allows full control how you export compared to rely on feature that focuses on exporting record based content

damned
July 3rd, 2018, 08:12
It does. I haven't released the latest version yet but have already used it to re-produce several existing store products. SWEL does not rely on built-in /export feature. Instead it exports everything on ots own using FG API, this is what I recommend for celestian because it allows full control how you export compared to rely on feature that focuses on exporting record based content

Great - thanks Ikael.

celestian
July 3rd, 2018, 15:08
You can implement own export functionality that uses Module.export function that does everything, includes all content and images as mod file. The built-in export feature uses the same function so there is no special limitation if you would implement your own version.


I wasn't aware of "Module.export" but will look into it. Thanks for the suggestion.

Edit:
Found it here: https://www.fantasygrounds.com/refdoc/Module.xcp

Looks to do much of what I need tho I'm still not sure how to manipulate <library> entries with it for links yet but I'll play about with it to see if it can be done.

Ikael
July 3rd, 2018, 19:09
DB package (https://www.fantasygrounds.com/refdoc/DB.xcp) is your friend when building these values. You can build the entire library structure using it and export it with Module.export.


I wasn't aware of "Module.export" but will look into it. Thanks for the suggestion.

Edit:
Found it here: https://www.fantasygrounds.com/refdoc/Module.xcp

Looks to do much of what I need tho I'm still not sure how to manipulate <library> entries with it for links yet but I'll play about with it to see if it can be done.

celestian
July 3rd, 2018, 20:40
DB package (https://www.fantasygrounds.com/refdoc/DB.xcp) is your friend when building these values. You can build the entire library structure using it and export it with Module.export.

So I make it myself. Makes sense. That's what I've got with Author already so should just be a bit of node shuffling to make this work. I'll give it a spin tonight and see what I can come up with.

celestian
July 4th, 2018, 06:13
Okay, figured this out. I still think the amount of generic code that Moon could throw at this to make it a trivial issue for anyone else would be a better idea. Having to have your own local copy of export.lua for this seems a bit overkill. All it really needs is a setCustomExportFunction() and bit of variable handoff (I kludged around it using ExportManager.aExport) and really that's it. All the other parts already existed ... specifically registerExportNode().

This is the crux of the code I used for Author.



function onInit()
if User.isHost() then
Comm.registerSlashHandler("author", authorRefmanual);
ExportManager.registerExportNode({ name = "_refmanualindex", label = "Reference Manual", export="reference.refmanualindex", sLibraryEntry="reference_manual"});

-- setup custom export process for the _refmanualindex node build
setCustomExportProcess(performRefIndexBuild);
end
end


The custom function(s) are run right before the actual export (after the "Export" button is pressed, at the top of performExport()).

Other than the code in performRefIndexBuild that would be all anyone would need to do the same thing for any other bits tho perhaps it far to of a niche need ;)

Anyway, this was fun to figure out. Works great and no more having to manually copy/paste/etc. All in one /export -> *.mod file with everything a /export would do.

If you want to see the code it's here in the Author extension. (https://www.fantasygrounds.com/forums/showthread.php?41833-Project-Author)

Bidmaron
July 4th, 2018, 12:50
Celestian/Ikael, if I read the new 3.3.6 properly, the new ability to directly set image file names now breaks the previous dependency that ALL images had to be in the image window in order for users to build content. If that is correct, I'd recommend you build this into Author, as folks could then cut and paste file names for images. Or have you already figured out a way around this limitation?

celestian
July 4th, 2018, 19:14
Celestian/Ikael, if I read the new 3.3.6 properly, the new ability to directly set image file names now breaks the previous dependency that ALL images had to be in the image window in order for users to build content. If that is correct, I'd recommend you build this into Author, as folks could then cut and paste file names for images. Or have you already figured out a way around this limitation?

I haven't even gotten to that part of 3.36 if you can give me an example of what it looks like previously and now maybe I can implement it.

Bidmaron
July 5th, 2018, 00:06
MW hasn’t documented it yet, so not sure what to tell you. I presume if you setValue on an image node the parameter is a string file name.