Skip to content

Commit

Permalink
Multiple HideActiveCanvasNode improvements
Browse files Browse the repository at this point in the history
- 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
MoritzBrueckner committed Oct 14, 2023
1 parent 7986c27 commit 77c458a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
28 changes: 13 additions & 15 deletions Sources/armory/logicnode/HideActiveCanvas.hx
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);
}
}
13 changes: 9 additions & 4 deletions blender/arm/logicnode/canvas/LN_HideActiveCanvas.py
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)

0 comments on commit 77c458a

Please sign in to comment.