CopyPastePlugin


CopyPaste is a plugin for Weland which allows you to copy most of the elements from one map onto another. It is intended as a replacement for Chisel's Merge function, but as I've never seen, much less used Chisel, it could be something completely different. In any case, it is intended to allow map makers to build and share libraries of reusable components.


Installation: Make sure you have the latest version of Weland (currently 1.4.1). Put the 'CopyPastePlugin.dll' file into the Weland Plugins directory. Launch Weland. In the Plugins menu, you should now see 'Copy & Paste' (in addition to any other plugins you have installed).


Usage notes:

1) CopyPaste first presents you with an Open File dialog to select the source map file. Once you have selected a source file, you are presented with a Copy Parameters dialog. Here you can select which elements you want to copy and configure any geometric transformations you wish to apply. The results are pasted into the map currently open in Weland.

2) CopyPaste will let you select a merged map from which to copy, but currently always copies from the first level in that map. An option to select which level to copy may be available in a future version. In the meantime, if you want to copy another level from a merged map, it's easy enough to save an unmerged copy in Weland by opening the merged map in Weland, selecting the level and then saving to a new file.

3) When copying Items and Monsters, only the Initial, Minimum, and Maximum counts are added to the destination map. None of the random placement information is copied. This is because it's not at all clear (to me) what the correct behavior should be if the source and destination maps have conflicting random placement parameters.

4) There are three choices for copying Lights - None, Custom, All. The Custom option will skip the 21 Lights Forge and Weland automatically create (numbered 0-20). Do NOT select Custom if the parameters for any of the first 21 Lights in the source or destination maps are different. On the other hand, if both the source and destination maps have the same parameters for the first 21 Lights, default or otherwise, the Custom option will prevent unncessary duplication.

5) Transformations are carried out in the following order: Flip, Scale, Rotate, Translate (offset).

   5a. Scale parameters are specified in real numbers greater than 0.0; less than 1.0 shrinks, greater than 1.0 enlarges. Do NOT specify negative numbers for scaling, as that is functionally equivalent to flipping.

   5b. Translation is specified in "internal units", i.e., 1/1024 World Unit. Positive X values shift to the right, positive Y values shift downwards, and positve Z values shift floor and ceiling heights up.

   5c. Scaling along the Z axis can cause unexpected results. Scaling and translating along the Z axis is done with the floor as the reference point, and the ceiling determined from that. For example, if you specify a -2.0 Z translation and a 1.5 Z scale, when applied to a polygon with a floor height of 0.0 and ceiling height of 2.0, the result will be a polygon with a floor height of -2.0 and a ceiling height of 1.0. That is all fine until it's applied to many adjacent polygons with slightly different floor and ceiling heights. The results might not be what you're expecting.

   5d. Rotations are specified in degrees (real numbers), with positive values producing a counter-clockwise rotation. Unfortunately, rotating the source map can cause some polygons to become concave and thus invalid. So far, I haven't seen this happen when rotating in 90 degree increments, but presumably it could happen then too. It happens when a polygon has two or more consecutive parallel lines and is due to rounding errors when converting from real numbers to integers. In the diagram below, lines A, B, and C are consecutive parallel lines. When rotating this geometry, however, rounding error can cause the endpoints of those three lines to be no longer collinear (i.e., no longer lying on the same geometric line). Usually, just one (but potentially more) of the points will be off by 1 unit (1/1024 WU). This can be fixed by determining which point(s) is(are) out of alignment and editing the X,Y coordinates of the point(s) (double click the point in Weland).

                 A        B        C
             *--------*--------*--------*
            /                            \
           /                              \
          *                                \
           \                                \
            *--------------------------------*

    5e. Transformations which would move points off the edge of the map are wrapped around to the other side, basically ruining your map. The easiest way to avoid this is to recenter the source map and/or not try to copy too much at once.

6) Textures, Items, Scenery, etc. are copied using the destination map's Shapes file. Ditto for Sounds.

7) CopyPaste cannot connect lines in the source map to those in the destination map. Keep this in mind when setting the transformation parameters and make sure you leave enough room to add connecting polygons.

8) CopyPaste remaps tag numbers in the source map to unused tag numbers in the destination map to avoid conflicts. You can use the "Enumerate Tags" plugin included with Weland to determine the new tag numbers.

9) If you have any questions, suggestions or bug reports, the best place for them is in the the Editors subforum at the Pfhorums(http://pfhorums.com/viewforum.php?f=24).

