-
-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UPBGE: Add component scritp generation.
To ease the definition of a component a button named "Create Component" is added. This button ask for a path module.Class and generates a script named module.py with a component class Class inside. This template class contains a start and update function commented and a definition block before the class for global game engine variable. If the file already exists an error is raised. The previous button named Add Component is now renamed Register Component.
- Loading branch information
1 parent
2c93233
commit fba7bd3
Showing
5 changed files
with
155 additions
and
14 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
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,24 @@ | ||
import bge | ||
from collections import OrderedDict | ||
|
||
if not hasattr(bge, "__component__"): | ||
# Put shared definitions here executed only in game engine. | ||
# e.g: | ||
# scene = bge.logic.getCurrentScene() | ||
pass | ||
|
||
class %Name%(bge.types.KX_PythonComponent): | ||
# Put your arguments here of the format ("key", default_value). | ||
# These values are exposed to the UI. | ||
args = OrderedDict([ | ||
]) | ||
|
||
def start(self, args): | ||
# Put your initialization code here, args stores the values from the UI. | ||
# self.object is the owner object of this component. | ||
pass | ||
|
||
def update(self): | ||
# Put your code executed every logic step here. | ||
# self.object is the owner object of this component. | ||
pass |
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
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
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