FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
UnrealEnginePython/examples/graphs_creator.py at develop · ghostfevil/UnrealEnginePython · GitHub
ghostfevil
UnrealEnginePython
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
UnrealEnginePython
/
examples
/
graphs_creator.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
55 lines (40 loc) · 1.96 KB
Breadcrumbs
UnrealEnginePython
/
examples
/
graphs_creator.py
Copy path
File metadata and controls
55 lines (40 loc) · 1.96 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import
unreal_engine
as
ue
from
unreal_engine
.
classes
import
K2Node_InputKey
,
K2Node_SpawnActorFromClass
,
Actor
,
Character
,
KismetMathLibrary
from
unreal_engine
.
structs
import
Key
# create a new blueprint
new_blueprint
=
ue
.
create_blueprint
(
Actor
,
'/Game/StrangeBlueprint'
)
# add a member float variable
ue
.
blueprint_add_member_variable
(
new_blueprint
,
'Speed'
,
'float'
)
# get a reference to the first graph page
uber_page
=
new_blueprint
.
UberGraphPages
[
0
]
# get good coordinates for a new node
x
,
y
=
uber_page
.
graph_get_good_place_for_new_node
()
# add the Speed variable to the graph
uber_page
.
graph_add_node_variable_get
(
'Speed'
,
None
,
x
,
y
)
x
,
y
=
uber_page
.
graph_get_good_place_for_new_node
()
# add a custom event to the graph
hello_world
=
uber_page
.
graph_add_node_custom_event
(
'Hello World'
,
x
,
y
)
# get a reference to the 'then' pin
hello_world_then
=
hello_world
.
node_find_pin
(
'then'
)
x
,
y
=
uber_page
.
graph_get_good_place_for_new_node
()
# add a 'Spawn Actor From Class' node
spawn_actor_node
=
uber_page
.
graph_add_node
(
K2Node_SpawnActorFromClass
,
x
,
y
)
# set its Class pin
pin_class
=
spawn_actor_node
.
node_find_pin
(
'Class'
)
pin_class
.
default_object
=
Character
# get a reference to its 'exec' pin
spawn_actor_node_exec
=
spawn_actor_node
.
node_find_pin
(
'execute'
)
# link the hello world event to the spawn actor node
hello_world_then
.
make_link_to
(
spawn_actor_node_exec
)
x
,
y
=
uber_page
.
graph_get_good_place_for_new_node
()
# create a 'make transform' node
make_transform
=
uber_page
.
graph_add_node_call_function
(
KismetMathLibrary
.
MakeTransform
,
x
,
y
)
# link the return value of 'make transform' to the 'SpawnTransform' pin of the spawn actor node
make_transform
.
node_find_pin
(
'ReturnValue'
).
make_link_to
(
spawn_actor_node
.
node_find_pin
(
'SpawnTransform'
))
input_key
=
K2Node_InputKey
()
input_key
.
InputKey
=
Key
(
KeyName
=
'SpaceBar'
)
input_key_node
=
uber_page
.
graph_add_node
(
input_key
,
400
,
400
)
# compile the blueprint
ue
.
compile_blueprint
(
new_blueprint
)
# save it
ue
.
editor_save_all
()
Back
|
FazBrowse Home
|
New Git URL