forked from armory3d/armory
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
124 additions
and
29 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
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
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,28 @@ | ||
package armory.logicnode; | ||
|
||
import iron.Scene; | ||
import armory.trait.internal.CanvasScript; | ||
|
||
class CanvasGetTextNode extends LogicNode { | ||
|
||
var canvas: CanvasScript; | ||
|
||
public function new(tree: LogicTree) { | ||
super(tree); | ||
} | ||
|
||
#if arm_ui | ||
override function get(from: Int) { | ||
if (canvas == null) canvas = Scene.active.getTrait(CanvasScript); | ||
if (canvas == null) canvas = Scene.active.camera.getTrait(CanvasScript); | ||
if (canvas == null || !canvas.ready) return null; | ||
|
||
// This Try/Catch hacks around an issue where the handles are | ||
// not created yet, even though canvas.ready is true. | ||
try { | ||
return canvas.getElement(inputs[0].get()).text; | ||
} | ||
catch (e: Dynamic) { return null; } | ||
} | ||
#end | ||
} |
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,12 @@ | ||
from arm.logicnode.arm_nodes import * | ||
|
||
class CanvasGetTextNode(ArmLogicTreeNode): | ||
"""Sets the text of the given UI element.""" | ||
bl_idname = 'LNCanvasGetTextNode' | ||
bl_label = 'Get Canvas Text' | ||
arm_version = 1 | ||
|
||
def arm_init(self, context): | ||
self.add_input('ArmStringSocket', 'Element') | ||
|
||
self.add_output('ArmStringSocket', 'String') |
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
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