Skip to content

Commit 21d9e59

Browse files
author
Roberto De Ioris
committed
2 parents 9541842 + 240b5c0 commit 21d9e59

File tree

2 files changed

+32
-4
lines changed

2 files changed

+32
-4
lines changed

README.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ class Spline:
510510
Blueprints integration
511511
----------------------
512512

513-
You can call blueprints functions (or custom events) via the .call() method:
513+
You can call blueprints functions (or custom events) via the .call() and .call_function() methods:
514514

515515
```py
516516
your_funny_blueprint_object.call('AFunctionOrACustomEvent with_a_arg')
@@ -524,6 +524,23 @@ the_other_object = self.uobject.get_property('target')
524524
the_other_object.set_actor_location(0, 0, 0)
525525
```
526526

527+
.call_function() is more advanced, as it allows for return values and python args:
528+
529+
```py
530+
# an example of moving an object z with curves:
531+
class Curver:
532+
def begin_play(self):
533+
self.curve = self.uobject.get_owner().get_property('curve')
534+
self.accumulator = 0.0
535+
def tick(self, delta_time):
536+
x, y, z = self.uobject.get_actor_location()
537+
z = self.curve.call_function('GetFloatValue', self.accumulator) * 100
538+
self.uobject.set_actor_location(x, y, z)
539+
self.accumulator += delta_time
540+
541+
```
542+
543+
527544
Events
528545
------
529546

@@ -598,7 +615,7 @@ The project could be considered in beta state.
598615
599616
Code should be organized way better as currently all of the uobject api is in a single huge file.
600617
601-
The property system is incomplete.
618+
The property system still lacks Struct support
602619
603620
We would like to find a way to define and manage custom events directly from python
604621

uobject_API.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ value = uobject.get_property('name')
6969

7070
get the property value of a uobject
7171

72-
NOTE: currently only floats and objects values are supported
72+
NOTE: currently structs are not supported
7373

7474

7575
---
@@ -79,7 +79,7 @@ uobject.set_property('name', value)
7979

8080
set the property of a uobject
8181

82-
NOTE: currently only floats and strings values are supported
82+
NOTE: currently structs are not supported
8383

8484
---
8585
```py
@@ -109,6 +109,15 @@ This methods allows you to interface with basically every engine features, but i
109109

110110
Use it for calling blueprint functions, or while waiting for the addition of new specific-methods in the uobject api ;)
111111

112+
---
113+
```py
114+
ret = uobject.call_function('function', arg0, arg1, argN....')
115+
```
116+
117+
the advanced companion of 'call'. This is a more advanced way for calling UFUNCTION's and for getting their return value.
118+
119+
Note: structs are not supported
120+
112121
---
113122
```py
114123
actor = uobject.get_owner()
@@ -190,6 +199,8 @@ return True if the actor has a component of the specified type
190199
---
191200
```py
192201
yesno = uobject.get_actor_component_by_type(uclass)
202+
# alias
203+
yesno = uobject.get_component_by_type(uclass)
193204
```
194205

195206
return the first component (of an actor) of the specified type

0 commit comments

Comments
 (0)