-
Notifications
You must be signed in to change notification settings - Fork 316
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Multiple HideActiveCanvasNode improvements
- Fixed compilation if Zui is disabled - Fixed deprecation warning for setCanvasVisibility() - Fixed Haxe whitespace (spaces -> tabs) and curly braces code style - #2946 (comment) - Added proper docstring - Made the node more intuitive by using a "visibility" input instead of a "hide" input that still worked like a "visibility" input
- Loading branch information
1 parent
7986c27
commit 77c458a
Showing
2 changed files
with
22 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,19 @@ | ||
package armory.logicnode; | ||
|
||
import armory.trait.internal.CanvasScript; | ||
|
||
class HideActiveCanvas extends LogicNode | ||
{ | ||
class HideActiveCanvas extends LogicNode { | ||
|
||
public function new(tree:LogicTree) | ||
{ | ||
super(tree); | ||
} | ||
public function new(tree:LogicTree) { | ||
super(tree); | ||
} | ||
|
||
override function run(from: Int) | ||
{ | ||
//get bool from socket | ||
var value = inputs[1].get(); | ||
CanvasScript.getActiveCanvas().setCanvasVisibility(value); | ||
override function run(from: Int) { | ||
#if arm_ui | ||
var value: Bool = inputs[1].get(); | ||
CanvasScript.getActiveCanvas().setCanvasVisible(value); | ||
#end | ||
|
||
// Execute next action linked to this node, this activates the output socket at position/index 0 | ||
runOutput(0); | ||
} | ||
} | ||
runOutput(0); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,13 +1,18 @@ | ||
from arm.logicnode.arm_nodes import * | ||
|
||
|
||
class HideActiveCanvas(ArmLogicTreeNode): | ||
"""HideActiveCanvas""" | ||
"""Set whether the active canvas is visible. | ||
Note that elements of invisible canvases are not rendered and computed, | ||
so it is not possible to interact with those elements on the screen | ||
""" | ||
bl_idname = 'LNHideActiveCanvas' | ||
bl_label = 'Hide Active Canvas' | ||
bl_description = 'This node Hides and shows the whole Active Canvas' | ||
bl_label = 'Set Global Canvas Visibility' | ||
bl_width_default = 200 | ||
arm_version = 1 | ||
|
||
def arm_init(self, context): | ||
self.add_input('ArmNodeSocketAction', 'In') | ||
self.add_output('ArmNodeSocketAction', 'Out') | ||
self.inputs.new('ArmBoolSocket', 'HideCanvas') | ||
self.add_input('ArmBoolSocket', 'Canvas Visible', default_value=True) |