# Retrieve a spline shape and reapply it to another spline

**URL:** <https://forums.unrealengine.com/t/retrieve-a-spline-shape-and-reapply-it-to-another-spline/1914529>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, question\
**Created:** [June 24, 2024, 8:33am UTC](https://forums.unrealengine.com/t/retrieve-a-spline-shape-and-reapply-it-to-another-spline/1914529 "2024-06-24T08:33:13Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![someonelsee1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/someonelsee1/32/566470_2.png) [@someonelsee1](https://forums.unrealengine.com/u/someonelsee1)\
**Post date:** [June 24, 2024, 8:33am UTC](https://forums.unrealengine.com/t/retrieve-a-spline-shape-and-reapply-it-to-another-spline/1914529/1 "2024-06-24T08:33:13Z")

</div>

I have a level with a bunch of splines (200+), I’d need to retrieve the “shape” of each spline and reapply it to another spline, the goal being replacing all existing splines with others without re doing all by hand.  
Any advice ?

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [June 24, 2024, 8:45am UTC](https://forums.unrealengine.com/t/retrieve-a-spline-shape-and-reapply-it-to-another-spline/1914529/2 "2024-06-24T08:45:50Z")

</div>

You can write a blueprint that will take two actors with spline components as input. It can loop down one spline and apply the transforms to the other spline?

---

<div class="post-metadata">

**Author:** ![RecourseDesign](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/recoursedesign/32/1194503_2.png) [@RecourseDesign](https://forums.unrealengine.com/u/RecourseDesign)\
**Post date:** [June 24, 2024, 8:46am UTC](https://forums.unrealengine.com/t/retrieve-a-spline-shape-and-reapply-it-to-another-spline/1914529/3 "2024-06-24T08:46:11Z")

</div>

Hi,

I made a tool to copy/paste the spline data to/from the clipboard for things like that.

rdSplineTools on the marketplace.

---

<div class="post-metadata">

**Author:** ![someonelsee1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/someonelsee1/32/566470_2.png) [@someonelsee1](https://forums.unrealengine.com/u/someonelsee1)\
**Post date:** [June 24, 2024, 9:03am UTC](https://forums.unrealengine.com/t/retrieve-a-spline-shape-and-reapply-it-to-another-spline/1914529/4 "2024-06-24T09:03:00Z")

</div>

Seems like a good way to do it yes. Could you help a bit more on how to proceed ?

---

<div class="post-metadata">

**Author:** ![someonelsee1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/someonelsee1/32/566470_2.png) [@someonelsee1](https://forums.unrealengine.com/u/someonelsee1)\
**Post date:** [June 24, 2024, 9:05am UTC](https://forums.unrealengine.com/t/retrieve-a-spline-shape-and-reapply-it-to-another-spline/1914529/5 "2024-06-24T09:05:12Z")

</div>

Hi RD,  
I already own RdInst & RdBPTools, I can’t spend another 20€ on a plugin, especially for a spline plugin, I don’t use spline that often, except in PCG.  
Thanks anyway for suggesting it!

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [June 24, 2024, 9:22am UTC](https://forums.unrealengine.com/t/retrieve-a-spline-shape-and-reapply-it-to-another-spline/1914529/6 "2024-06-24T09:22:46Z")

</div>

Yes, but can’t actually paste any code until much later, as I’m not a machine rn.

I’m assuming you know the typical nodes for processing a spline?

‘number of spline points’  
‘get transform at spline point’

etc…

And you just walk done spline A, applying what you find to spline B.

Do you just have blueprints with spline components in the map?

---

<div class="post-metadata">

**Author:** ![someonelsee1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/someonelsee1/32/566470_2.png) [@someonelsee1](https://forums.unrealengine.com/u/someonelsee1)\
**Post date:** [June 24, 2024, 9:39am UTC](https://forums.unrealengine.com/t/retrieve-a-spline-shape-and-reapply-it-to-another-spline/1914529/7 "2024-06-24T09:39:09Z")

</div>

I think I know the big steps yes.  
Do splines need to have the same points number ?

> [@ClockworkOcean](#):
>
> Do you just have blueprints with spline components in the map?

Yes? It’s a vineyard, and each vine row is a BP with a spline component.

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [June 24, 2024, 11:50am UTC](https://forums.unrealengine.com/t/retrieve-a-spline-shape-and-reapply-it-to-another-spline/1914529/8 "2024-06-24T11:50:01Z")

</div>

[SplineTool.zip](https://forums.unrealengine.com/uploads/short-url/eCjlR9QgYJcTuTzYowOrPPdgiA3.zip) (68.9 KB)

Made a editor tool to copy spline component information.

It copies splines directly source to target in local space.

Tools in 5.4

Edit: updated spline display names to encompass the parent object name  
Ok still need the asset to save on update…

---

<div class="post-metadata">

**Author:** ![someonelsee1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/someonelsee1/32/566470_2.png) [@someonelsee1](https://forums.unrealengine.com/u/someonelsee1)\
**Post date:** [June 24, 2024, 12:05pm UTC](https://forums.unrealengine.com/t/retrieve-a-spline-shape-and-reapply-it-to-another-spline/1914529/9 "2024-06-24T12:05:34Z")

</div>

Thank you so much! It’s perfect for the use I need. Merci!

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [June 24, 2024, 12:06pm UTC](https://forums.unrealengine.com/t/retrieve-a-spline-shape-and-reapply-it-to-another-spline/1914529/10 "2024-06-24T12:06:18Z")

</div>

Edit final update  
[SplineTool.zip](https://forums.unrealengine.com/uploads/short-url/dLgPcttTibYqPQRqneCrDLp8oKU.zip) (58.8 KB)

Will save asset, added in an option to automatically save the level (checkbox).  
Final edits only work when the level itself is saved with the assets (so set it to true as default).

 ![target](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/f/d/1fd3aa8d283f448f4e870c61bf8b86ed570ff27e.png)

Should it try to recreate the amount of points on the target spline or just cut it off to where they mismatch?

---

<div class="post-metadata">

**Author:** ![someonelsee1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/someonelsee1/32/566470_2.png) [@someonelsee1](https://forums.unrealengine.com/u/someonelsee1)\
**Post date:** [June 24, 2024, 2:34pm UTC](https://forums.unrealengine.com/t/retrieve-a-spline-shape-and-reapply-it-to-another-spline/1914529/11 "2024-06-24T14:34:31Z")

</div>

If it could try to recreate the missing amount of points it’d be a m a z i n g!

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [June 24, 2024, 2:43pm UTC](https://forums.unrealengine.com/t/retrieve-a-spline-shape-and-reapply-it-to-another-spline/1914529/12 "2024-06-24T14:43:08Z")

</div>

@someonelsee1 Updated:  
[SplineToolsTangentsOK.zip](https://forums.unrealengine.com/uploads/short-url/hCbUTKvp1O5OLCYFgK6lct5taJY.zip) (72.9 KB)

Edit: fixed up the curve type copy (it needed an extra override in the target spline component)

 ![copypoints](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/f/e/3fe47f7ea10b4af9d128e725ebe6385f8e84d113.png)

---

<div class="post-metadata">

**Author:** ![someonelsee1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/someonelsee1/32/566470_2.png) [@someonelsee1](https://forums.unrealengine.com/u/someonelsee1)\
**Post date:** [June 24, 2024, 3:09pm UTC](https://forums.unrealengine.com/t/retrieve-a-spline-shape-and-reapply-it-to-another-spline/1914529/13 "2024-06-24T15:09:02Z")

</div>

~~mmmh still doesn’t work for me, I mean yeah it works, but as soon as I move the spline, it resets to its default  
I can fix that by ticking “Override Construction Script” in the target spline before moving it!~~  
edit: it doesn’t work with the BP spline I was using, but I tried with a newly created BP with a spline and it works as intended.  
Anywayyy thank you x100 for your time!

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [June 24, 2024, 3:33pm UTC](https://forums.unrealengine.com/t/retrieve-a-spline-shape-and-reapply-it-to-another-spline/1914529/14 "2024-06-24T15:33:54Z")

</div>

seems it needs to set bSplineHasBeenEdited = true to trigger the override construction script. Unfortunately there is no direct access via blueprint.  
It would be done if I switched to c++.

---

<div class="post-metadata">

**Author:** ![someonelsee1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/someonelsee1/32/566470_2.png) [@someonelsee1](https://forums.unrealengine.com/u/someonelsee1)\
**Post date:** [June 24, 2024, 3:43pm UTC](https://forums.unrealengine.com/t/retrieve-a-spline-shape-and-reapply-it-to-another-spline/1914529/15 "2024-06-24T15:43:30Z")

</div>

oookay nice to know! I’ll dig into C++ one day. thanks!

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [June 24, 2024, 4:28pm UTC](https://forums.unrealengine.com/t/retrieve-a-spline-shape-and-reapply-it-to-another-spline/1914529/16 "2024-06-24T16:28:14Z")

</div>

Update to the c++ part. Just needs 1 blueprint function library entry

header

```auto
class USplineComponent;

UCLASS()
class YOURGAME_API USplineFunctionLibrary : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()

public:
	UFUNCTION(BlueprintCallable)
	static void UpdateOverrideComponent(UPARAM(ref) USplineComponent* spline);

};

```

cpp

```auto
#include "SplineFunctionLibrary.h"
#include "Components/SplineComponent.h"

void USplineFunctionLibrary::UpdateOverrideComponent(UPARAM(ref) USplineComponent* spline)
{
	if (spline != nullptr) {
		spline->bModifiedByConstructionScript = true;	
		spline->bSplineHasBeenEdited = true;		
		spline->bInputSplinePointsToConstructionScript = true;
		spline->MarkPackageDirty();
		spline->MarkRenderStateDirty();
		spline->UpdateSpline();
	}
}

```

Updated editor widget with static call  
[SplineTool\_StaticLib.zip](https://forums.unrealengine.com/uploads/short-url/lHi2IthYUuE0RIT4mWEA1Q0EoZg.zip) (75.1 KB)

---

<div class="post-metadata">

**Author:** ![someonelsee1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/someonelsee1/32/566470_2.png) [@someonelsee1](https://forums.unrealengine.com/u/someonelsee1)\
**Post date:** [June 25, 2024, 8:44am UTC](https://forums.unrealengine.com/t/retrieve-a-spline-shape-and-reapply-it-to-another-spline/1914529/17 "2024-06-25T08:44:23Z")

</div>

omg you really went all the way, thank you 🤩  
I wish everyone is this forum was helpful as you are!

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [July 25, 2024, 8:45am UTC](https://forums.unrealengine.com/t/retrieve-a-spline-shape-and-reapply-it-to-another-spline/1914529/18 "2024-07-25T08:45:14Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
