DICE PACKS BUNDLE
Page 5 of 5 First ... 345
  1. #41

  2. #42
    To those who may care I have worked through a programmatic solution to the issues I raised. I have been able to create FGU only modules using the new FGU imaging XML format. Additionally I have been able to create a way to generate the FGU modules directly from the input information available in a FGC mod. This was a painstaking process and it is multi-step which I will list here.

    The solution revolves around being able to generate the matrix elements for the various different types of layers. The first type of layer is a base image itself. The base image layer placement turns out to simply be related to the dimensions of the base image. Once the image dimensions are found the following Java function can build the needed matrix string.

    public buildMatrixForModule(Dimension iDimension) {
    Double width = iDimension.getWidth() / 2;
    Double height = iDimension.getHeight() / 2;
    return "1,0,0,0,0,1,0,0,0,0,1,0,"+width.toString()+",-"+height.toString()+",0,1";
    }

    By setting the base image matrix correctly all map token placement already available in an FGC mod will directly apply to the FGU mod. Pins are also very straightforward. Simply using the existing x and y coordinates can build the proper matrix string. The Java function below provides an example of how.

    private String buildMatrixForPin(String xPin, String yPin) {
    return "1,0,0,0,0,1,0,0,0,0,1,0,"+xPin+",-"+yPin+",0,1";
    }

    Token scaling, orientation and placement were the hardest nut to crack. I have created the Java function below for creating matrix components based on the FGC parameters available. This function has been successful in creating matrix strings that work form both FGU token and image layers. I have found that when a image is to be interacted with by player such as a vehicle, puzzle piece, or other object the characters should be able to move it is best to make a token layer. One thing I could not solve when using token layers was how to ensure the tokens appeared below any tokens added by inserting encounters to the combat tracker. The token layers always seemed on top. Image layers seem best for things which DMs should move like hidden door coverings, trap covers, environmental pieces, etc. Vehicles are a prime candidate which it would be nice to make tokens that the characters could move but end up being images so they are not always on top of character tokens. Any ideas in these areas are appreciated. Below is the Java function which can take the FGC input and build the needed FGU matrix. Part of the most interesting debugging resulting in the scale parameters interactions with the 45 degree orientations. All in all the function is meeting all my use cases without warping the image. I am still learning on how the matrix object can be used to warp the object.

    private String buildMatrixForToken(String scalelock, String scale, String orientation, String tokenx, String tokeny) {
    Double tmpScale = 1.0;
    Double one = 0.0;
    Double two = 0.0;
    Double three = 0.0;
    Double four = 0.0;
    if ((scalelock != null) && (!scalelock.isEmpty())) {
    tmpScale = tmpScale / Double.valueOf(scalelock);
    }
    if ((scale != null) && (!scale.isEmpty())) {
    tmpScale = tmpScale * Double.valueOf(scale);
    }
    if ((orientation == null) || (orientation.isEmpty())) {
    one = tmpScale * 1.0;
    two = tmpScale * 0.0;
    three = tmpScale * 0.0;
    four = tmpScale * 1.0;
    } else if (orientation.equals("1")) {
    one = tmpScale * 0.7;
    two = tmpScale * -0.7;
    three = tmpScale * 0.7;
    four = tmpScale * 0.7;
    } else if (orientation.equals("2")) {
    one = tmpScale * 0.0;
    two = tmpScale * -1.0;
    three = tmpScale * 1.0;
    four = tmpScale * 0.0;
    } else if (orientation.equals("3")) {
    one = tmpScale * -0.7;
    two = tmpScale * -0.7;
    three = tmpScale * 0.7;
    four = tmpScale * -0.7;
    } else if (orientation.equals("4")) {
    one = tmpScale * -1.0;
    two = tmpScale * 0.0;
    three = tmpScale * 0.0;
    four = tmpScale * -1.0;
    } else if (orientation.equals("5")) {
    one = tmpScale * -0.7;
    two = tmpScale * 0.7;
    three = tmpScale * -0.7;
    four = tmpScale * -0.7;
    } else if (orientation.equals("6")) {
    one = tmpScale * 0.0;
    two = tmpScale * 1.0;
    three = tmpScale * -1.0;
    four = tmpScale * 0.0;
    } else if (orientation.equals("7")) {
    one = tmpScale * 0.7;
    two = tmpScale * 0.7;
    three = tmpScale * -0.7;
    four = tmpScale * 0.7;
    }
    return one.toString()+","+two.toString()+",0,0,"+three.to String()+","+four.toString()+",0,0,0,0,1,0,"+token x+",-"+tokeny+",0,1";
    }

    End result I could not make a single module to support FGC and FGU. I can, however, from the same input data generate both FGC and FGU modules. This is a big win for me. I am hoping maybe this helps someone else.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
5E Character Create Playlist

Log in

Log in