-
Notifications
You must be signed in to change notification settings - Fork 756
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Roberto De Ioris
committed
Mar 30, 2018
1 parent
a14a1ae
commit 75a66aa
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import unreal_engine as ue | ||
from unreal_engine.classes import CurveFloatFactory, CurveVectorFactory | ||
from unreal_engine.structs import RichCurve, RichCurveKey | ||
import time | ||
|
||
factory = CurveFloatFactory() | ||
|
||
curve = factory.factory_create_new('/Game/CustomFloatCurve' + str(int(time.time()))) | ||
|
||
keys = [] | ||
|
||
for i in range(0, 100): | ||
keys.append(RichCurveKey(Time=i, Value=i)) | ||
|
||
# use ref() to set struct values on-the-fly | ||
curve.FloatCurve.ref().Keys = keys | ||
|
||
curve.post_edit_change() | ||
|
||
ue.open_editor_for_asset(curve) | ||
|
||
factory = CurveVectorFactory() | ||
|
||
curve = factory.factory_create_new('/Game/CustomVectorCurve' + str(int(time.time()))) | ||
|
||
# one curve list for each axis | ||
keys_x = [] | ||
keys_y = [] | ||
keys_z = [] | ||
|
||
for i in range(0, 100): | ||
keys_x.append(RichCurveKey(Time=i * 0.1, Value=i * 0.1)) | ||
keys_y.append(RichCurveKey(Time=i * 0.1, Value=i * 0.1)) | ||
keys_z.append(RichCurveKey(Time=i * 0.1, Value=i * 0.1)) | ||
|
||
# FloatCurves is a native array, use property index (0=x, 1=y, 2=z) | ||
curve.set_property('FloatCurves', RichCurve(Keys=keys_x), 0) | ||
curve.set_property('FloatCurves', RichCurve(Keys=keys_y), 1) | ||
curve.set_property('FloatCurves', RichCurve(Keys=keys_z), 2) | ||
|
||
curve.post_edit_change() | ||
|
||
ue.open_editor_for_asset(curve) |