Skip to content

Commit

Permalink
Get Scene Node
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo committed Mar 4, 2021
1 parent 0c45dec commit 64f5f85
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
16 changes: 16 additions & 0 deletions basicnodes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3251,6 +3251,22 @@ def get_input_sockets_field_names(self):
_nodes.append(NLParameterGetAttribute)


class NLGetScene(bpy.types.Node, NLParameterNode):
bl_idname = "NLGetScene"
bl_label = "Get Scene"
nl_category = "Scene"

def init(self, context):
NLParameterNode.init(self, context)
self.outputs.new(NLPythonSocket.bl_idname, "Scene")

def get_netlogic_class_name(self):
return "bgelogic.GetScene"


_nodes.append(NLGetScene)


class NLParameterGetTimeScale(bpy.types.Node, NLParameterNode):
bl_idname = "NLParameterGetTimeScale"
bl_label = "Get Timescale"
Expand Down
9 changes: 9 additions & 0 deletions game/bgelogic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3390,6 +3390,15 @@ def evaluate(self):
self._set_value(getattr(instance, attr))


class GetScene(ParameterCell):
def __init__(self):
ParameterCell.__init__(self)

def evaluate(self):
self._set_ready()
self._set_value(logic.getCurrentScene())


class GetTimeScale(ParameterCell):
def __init__(self):
ParameterCell.__init__(self)
Expand Down
2 changes: 1 addition & 1 deletion templates/prefabs/4keymovement.json
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@
"values": [
{
"index": 0,
"value": 0.5
"value": 5
}
]
}, {
Expand Down

0 comments on commit 64f5f85

Please sign in to comment.