-
July 31st, 2020, 21:45 #1
- Join Date
- Jun 2020
- Posts
- 534
Generating Images/Maps (FGU Scripting)
Hey everyone,
I'm trying to create an extension for Fantasy Grounds Unity that will generate basic outdoor maps from a set of backgrounds and other decorative images.
I have never written a FG extension before, and I am running into some issues, hopefully someone can help.
So far, I have created an additional button in the Images window that creates a new image under a new category with a random name. I am trying to figure out how to add a layer to it (using an asset that is already loaded) and not having any luck. Is there an API call to do this? What I have been trying is just using "createChild" and "setValue" on the image node I created, but it is not adding entries in the "<layers />" node.
Any ideas?
Here's an example of the XML I am generating... (I can't get anything to go under the layers element!)
<category name="Maps - Generated">
<Plains-b67bd10c-1aef-4f99-b63c-b77298014775>
<image type="image">
<allowplayerdrawing>on</allowplayerdrawing>
<gridsnap>on</gridsnap>
<layers />
</image>
<locked type="number">0</locked>
<name type="string">Plains - Fri Jul 31 16:52:44 2020</name>
</Plains-b67bd10c-1aef-4f99-b63c-b77298014775>
</category>Last edited by seansps; July 31st, 2020 at 21:53.
-
July 31st, 2020, 22:01 #2
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,559
There is no way to interact with the image data at this point that will allow you to interact with layers. The only thing you can do currently is use a DB.setValue call on the node to reset all layers, and set a single layer in place using a string variable. We won't be looking at fleshing out the image API until sometime after we get to release; since there are a lot of moving parts in the image area still.
Regards,
JPG
-
July 31st, 2020, 22:10 #3
- Join Date
- Jun 2020
- Posts
- 534
Thanks, that's too bad, this would be a great feature, but I look forward to being able to have more control here!
As far as what you said about "set a single layer in place using a string variable". Is it possible to do this to add layers using existing JPG assets? (Each as a layer?)
-
July 31st, 2020, 22:18 #4
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,559
No, it was simply a way to create a simple single layer image to support existing ruleset functionality. The DB.setValue call to an image data node with a string clears all layers, and inserts the one in the string as the only layer.
Regards,
JPG
-
July 31st, 2020, 22:21 #5
- Join Date
- Jun 2020
- Posts
- 534
Got it. Thanks for the info!
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks