Skip to content

Commit cf3d3cf

Browse files
author
Roberto De Ioris
authored
Update YourFirstAutomatedPipeline.md
1 parent 8cc4b6b commit cf3d3cf

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

tutorials/YourFirstAutomatedPipeline.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -460,17 +460,16 @@ anim_bp_factory = AnimBlueprintFactory()
460460
anim_bp_factory.TargetSkeleton = slicer_mesh.Skeleton
461461

462462
# ensure no blueprint with the same name exists
463-
# get_asset() returns an exception, maybe it is time to implement a asset_exists() api function ?
464-
try:
465-
bp_exists = ue.get_asset('/Game/Kaiju/Slicer/slicer_AnimBP.slicer_AnimBP')
466-
ue.delete_asset(bp_exists.get_path_name())
467-
except:
468-
pass
463+
# find_asset() returns None if the asset does not exist
464+
anim_bp = ue.find_asset('/Game/Kaiju/Slicer/slicer_AnimBP.slicer_AnimBP')
465+
if anim_bp:
466+
ue.delete_asset(anim_bp.get_path_name())
469467

470468
anim_bp = anim_bp_factory.factory_create_new('/Game/Kaiju/Slicer/slicer_AnimBP')
471469
```
472470

473-
unfortunately, as you can see, we need a hack when creating new blueprints. Generating a Blueprint with the same name of another one will trigger a crash. We are investigating a better api to avoid that tricky exception.
471+
Always take into account that creating a Blueprint (of any kind) with a name of an existing one, will trigger an error.
472+
If ue.find_asset() succeeds, we destroy the already existing asset.
474473

475474
Once the blueprint is created, we need to assign a custom event 'DoAttack' (triggered when the Kaiju is near a Pawn), anpther one called 'Boring' (triggered when the kaiju is stationary/idle for more than 10 seconds), 2 bool variables (Attack, Bored) and a float one (Speed):
476475

@@ -756,12 +755,19 @@ Now it is time to create The Character Blueprint at which we will attach the pre
756755
```python
757756
from unreal_engine.classes import Character
758757

758+
# always check for already existing blueprints
759+
slicer_bp = ue.find_asset('/Game/Kaiju/Slicer/slicer_Blueprint.slicer_Blueprint')
760+
if slicer_bp:
761+
ue.delete_asset(slicer_bp.get_path_name())
762+
759763
slicer_bp = ue.create_blueprint(Character, '/Game/Kaiju/Slicer/slicer_Blueprint')
760764
```
761765

766+
time to assign values:
767+
762768
```python
763769

764-
# configure teh capsule
770+
# configure the capsule
765771
slicer_bp.GeneratedClass.get_cdo().CapsuleComponent.CapsuleHalfHeight = 150
766772
slicer_bp.GeneratedClass.get_cdo().CapsuleComponent.CapsuleRadius = 60
767773

0 commit comments

Comments
 (0)