Category | Scripting |
Created | 25.07.2018 14:57 |
Brian Bolger (briano74) | 25.07.2018 14:57 |
---|---|
Hello Can you help. I am trying to create a GE script to move a transform group to the exact position of another using getTranslation and setTranslation with GE Could you please help with the script as I cannot get it working I.e. Find the tranlation of node 229 for example and move node 300 to the location of 229 Regards |
Bilbo Beutlin (BBeutlin) | 25.07.2018 15:11 |
---|---|
See Documentation -> LUADOC -> Engine -> Scenegraph You'll need at least good knowledge of general LUA scripting and basic experience in FS LUA programming. |
Brian Bolger (briano74) | 25.07.2018 15:39 |
---|---|
Hello Before a member of the Giants team wrote it - took a few minutes as I remember it was 6 - 8 lines of code |
Brian Bolger (briano74) | 26.07.2018 22:30 |
---|---|
Any more help on this - to align to transform nodes in the exact same position in GE? |
Gtx | Andy (GtX_Andy) | 27.07.2018 09:10 |
---|---|
Hey Brain, I saw this on my phone today so I thought I would make the script for you. ;-) With this script you can duplicate the Translation, Rotation, Scale and Clip Distance of the first selected node and apply it to all other selected nodes. Just change the true / false lines at the top as required and then select the nodes and execute the script. Keep in mind that any changes made in GE using a script 'CAN NOT' be undone using the undo/redo feature so make sure to save often. Cheers, GtX https://github.com/GtX-Andy ------------------------------------------------- GE SCRIPT STARTS BELOW: -------------------------------------------------- -- Author:GtX | Andy -- Name:Duplicate Attribute Data -- Description:Copy the translation, rotation, or scale of the first select node and apply to all other selected nodes. -- Icon: -- Hide: no -- -- -- -- -- Set to 'true' to copy first selected nodes translation. local copyTranslation = true; -- -- Set to 'true' to copy first selected nodes rotation. local copyRotation = false; -- -- Set to 'true' to copy first selected nodes scale. local copyScale = false; -- -- Set to 'true' to copy first selected nodes Clip Distance. local copyClipDistance = false; -- -- -- Code starts here. No changes needed. local selectedCount = getNumSelected(); function duplicateData() local firstTransform = getSelection(0); local x, y, z = getTranslation(firstTransform); local rX, rY, rZ = getRotation(firstTransform); local sX, sY, sZ = getScale(firstTransform); local clipDistance = getClipDistance(firstTransform); for child = 1, selectedCount-1 do local object = getSelection(child); if copyTranslation then setTranslation(object, x, y, z); end if copyRotation then setRotation(object, rX, rY, rZ); end; if copyScale then setScale(object, sX, sY, sZ); end; if copyClipDistance then setClipDistance(object, clipDistance); end; end; end; if selectedCount > 1 then duplicateData(); else print("[Duplicate Attribute Data] No nodes selected. Please first select the node you wish to duplicate the Attribute data from followed by the nodes you wish to move."); print("This can be done by holding down the 'ctrl' key as you click on each node."); return; end; |
Brian Bolger (briano74) | 27.07.2018 14:21 |
---|---|
Wow - awesome job - I wrote a script before but I lost it when I changed to a new PC - Thank you so much |
Gtx | Andy (GtX_Andy) | 28.07.2018 02:33 |
---|---|
No problem at all. Have fun ;-) |
Note: Log in to post. Create a new account here.