Jump to content

Recommended Posts

Posted

This is an updated version of the old spline placement script and uses a popup panel to input some permissions/values for the script to use its various functions.

It combines the old splinePlacementTransform/splinePlacement/splinePlacement Delete scripts into one panel.

Installation

Download the Spline Placement Panel.zip (available at the end of this tutorial) , unzip and copy/paste the Spline Placement Panel.lua into the following directory,

C:/Users/******/AppData/Local/GIANTS Editor 64bit 9.0.6/scripts

or

C:/Users/******/AppData/Local/GIANTS Editor 64bit 10.0.3/scripts

Replacing ***** with your computer name.

Using the script

To activate in GE - Select Script -Spline Placement Panel a popup panel will appear on your screen, and a new transform group added to the Scenegraph also some User Attributes will be created in the

User Attribute panel in GE, 9.0.6 the image below shows the first set up (1), second the User Attributes (2) finally the transform group with a spline created and placed in the correct position.

fp7Qbg9.png

In Giants Editor 10.0.3 the User Attributes panel is now in a separate tab in the Attributes Panel

Panel

All numerical inputs to the panel can be inputted either by slider or manually.

To ensure correct values entered and avoid problems manual input is suggested.

Values can be entered as a Float (e.g. 1.3)

The objects will be placed at terrain height along the spline (using their individual point of origin location) from the 'S' cv to the ‘E’ cv and aligned to the to the spline along their "Z" axis (unless random location selected).

For example a default primitive cube will be placed 0.5m below the terrain (point of origin in the centre of the 1m cube)

e.g.  if you have a hedge that is 4m long and 1m wide ensure the longest section (4m)is  aligned to the 'Z' axis otherwise  rotate it in GE until is aligned along the 'Z' axis and freeze transform rotation also ensure that the point of origin (where the gizmo shows when object is selected) is at the correct point

 

The splinePlacement transform group must be selected in the Scenegraph for the script to work

 

The panel image below gives basic information on the various settings followed by a more detailed explanation after.

combined panel.png

 

Object Distance

                             This value is the fixed distance you want between the individual objects in the objectsToPlace transform group.

                             Default is 1 but can be any positive value between 0 and 255 (inc Float values).

                            It is also used as the first seed in the Random Distance (second seed being the Random Distance value) when Random Distance selected.

Distance Table

                            Unfortunately due to lack of UIString inputs in GE (only UIChoice/UIFloat/UIInt recognized) I have had to create User Attributes so that this function can be used.

                            The Set Distance Table inputs for this option can be found in the User Attribute panel of GE when the splinePlacement transform group is selected

      Use Distance Table,

                           ‘Selected’ uses the values in the Set Distance Table to set the object distance      

                           ‘Deselected’ uses distance value in Set Object Distance.

      Set Distance Table

                            Sets a fixed distance between the objects in the objectsToPlace  transform  when  Use Distance Table  selected, number of settings must match number of items in the objectsToPlace transform and be separated by a comma.

                           The first object in the objectsToPlace transform will always be put at the start of the spline (distance  ‘0’), the entries in the Set Distance Table refer to the distance to the next object from the preceding one.

                           So in the following example;

                                                                 A total of 3 objects in the objectsToPlace  transform  1,2 and 3

                                                                Set Distance Table = 4,8,20   -- value in metres 

                                                                object    ‘1’  placed at ‘0’ by default so no reference in distanceTable

                                                                object    ‘2 ‘  placed 4m from object ‘1’

                                                               object   ‘3’  placed 8m from object ‘2’

                                                               object    ‘1’   placed 20m from object ‘3’

                                                               object    ‘2 ‘  placed 4m from previous object (‘1’ )

                                                              and so on until the end of the spline.

                                           A distance of ‘0’ will mean that two objects will be placed at the same location on the spline (e.g lamp post ,hedge )

                                          Value entered can be a Float.

                                         Any incorrect entries in the Set Distance Table will result in a DISTANCE TABLE ERROR in the Console log.

                                         Random Scale/Random ‘Y’ Rotation/Random Spline Order/Random Placement can all be used in conjunction with the Use Distance Table.

                                         Note: if Random Spline Order used the set distances between objects will change according to the placement of the objects.

            Fixed Distance

                           Selected places all objects a Fixed Distance away from the spline, Deselected objects placed along/around the spline

            Distance to Fix

                        Value entered determines the the fixed distance away from the spline (can be + or -)

 

            StayUpright   

                             ‘Selected’ all objects placed upright

                            ‘Deselected’ all objects aligned to  original 'X,Y,Z' rotation

           Random Scale

                             ‘Selected’ allows random object scale between the parameters set by the Scale Low, Scale High values.

                                            If an item is already scaled then it has to be freeze transformed (Scale) for this to work correctly,

                             ‘Deselected'  retains original size.

            Scale Low/ Scale High

                              Value of the minimum and maximum Random Scale parameter, the value set applies to all scale axis (x, y, z) at the same time.  

                            Note: If Random Scale selected and Scale Low and Scale High values left at '0' zero you will get exactly that  --  nothing !!

           Select Random ‘Y’ Rotation

                                  ‘Selected' objects randomly rotated on the 'Y'axis

                                 ‘Deselected'  'Y’ axis rotation follows the spline curvature ('X' axis)

          Select Random Spline Order

                                 ‘Selected’ allows a random order of objects in the objectsToPlace transform group along the spline.

                                  ‘Deselected’ retains the order set in the objectsToPlace transform group.

          Select Random Distance

                                    ‘Selected’ allows all the objects in the objectsToPlace TG to be placed at random distances along the spline.

                                    Random Distance seed set by Object Distance values.

          Select Random Placement

                                   ‘Selected’ the objects will be placed randomly around the spline depending on the values in the Random Placement Distance (Min) and Random Distance (Max).

                                   ‘Deselected ‘ objects in the objectsToPlace TG placed in order along the spline and at a distance set by ObjectDistance or Set Distance Table values.

                   Random Placement Distance (Max)

                            Objects will  placed randomly either side of the spline to the max value entered.

            Place Objects

                                    Executes the script and places objects according to settings.

            Delete Placed Objects

                                    ‘Selected’   Enables the Delete Placed Objects section of the script

                                     To avoid inadvertently deleting wanted objects this selection must be Deselected/Reselected before being used again.

              Delete Placed Objects

                                    Executes the Delete Placed Objects section of the script  'Warning' this will delete ALL objects in the placedObjects transform 

             

                                   The image below gives examples of some the basic settings

                                                                                             PAExbE6.png

 

The settings can be used in conjunction with each other for example Object Distance can be combined with Stay Upright/Random Scale/Random ‘Y’ Rotation/Random Spline Order/Random Distance/Random Placement.

However when using the Use Distance Table only Random Scale/Random ‘Y’ Rotation/Random Spline Order/Random Placement can be used in conjunction with the Set Distance Table selection.

Note: if Random Spline Order selected the set distances between objects will change according to the placement of the objects.

 

When satisfied with the placement create a new suitably named transform group and copy/paste the complete placedObjects transform group into it, the objects in the original placedObjects transform can then be deleted using the Delete Placed Objects button or delete the complete splineObjects transform group if no longer needed.

A new splineObjects transform group will be created each time the script is activated in GE - Scriptshowever the splineObjects transform group once created can be used with different splines/objects/settings.

To familiarise yourself with the new script, Open in a blank map and experiment with the settings and objects.

 

If creating fences or power poles then the Fence/Power Placement script might be more flexible and suitable.

https://farmerboysmodding.com/index.php?/topic/2452-fence-power-placement-script/

 

       1500z  20/1/2024 Script  updated to cure DistanceTable Error when Use Distance Table deselected.

 

 

splinePacementPanelCombined_25.zip

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now