Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2983 from MoritzBrueckner/debug-console-hover
Add DebugConsole.isDebugConsoleHovered (+ node integration)
- Loading branch information
Showing
7 changed files
with
141 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,36 @@ | ||
from arm.logicnode.arm_nodes import * | ||
|
||
|
||
class GetMouseStartedNode(ArmLogicTreeNode): | ||
""".""" | ||
bl_idname = 'LNGetMouseStartedNode' | ||
bl_label = 'Get Mouse Started' | ||
arm_version = 1 | ||
arm_version = 2 | ||
|
||
property0: HaxeBoolProperty( | ||
'property0', | ||
name='Include Debug Console', | ||
description=( | ||
'If disabled, this node does not react to mouse press events' | ||
' over the debug console area. Enable this option to catch those events' | ||
) | ||
) | ||
|
||
def arm_init(self, context): | ||
self.add_input('ArmNodeSocketAction', 'In') | ||
|
||
self.add_output('ArmNodeSocketAction', 'Out') | ||
self.add_output('ArmStringSocket', 'Button') | ||
|
||
def draw_buttons(self, context, layout): | ||
layout.prop(self, 'property0') | ||
|
||
def get_replacement_node(self, node_tree: bpy.types.NodeTree): | ||
if self.arm_version not in (0, 1): | ||
raise LookupError() | ||
|
||
return NodeReplacement( | ||
'LNGetMouseStartedNode', self.arm_version, 'LNGetMouseStartedNode', 2, | ||
in_socket_mapping={0: 0}, out_socket_mapping={0: 0, 1: 1}, | ||
property_defaults={'property0': True} | ||
) |
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
30 changes: 27 additions & 3 deletions
30
blender/arm/logicnode/miscellaneous/LN_get_debug_console_settings.py
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,12 +1,36 @@ | ||
from arm.logicnode.arm_nodes import * | ||
|
||
|
||
class GetDebugConsoleSettings(ArmLogicTreeNode): | ||
"""Returns the debug console settings.""" | ||
"""Return properties of the debug console. | ||
@output Enabled: Whether the debug console is enabled. | ||
@output Visible: Whether the debug console is visible, | ||
or `false` if the debug console is disabled. | ||
@output Hovered: Whether the debug console is hovered by the mouse cursor, | ||
or `false` if the debug console is disabled. | ||
@output UI Scale: The scaling factor of the debug console user interface, | ||
or `1.0` if the debug console is disabled. | ||
@output Position: The initial position of the debug console. | ||
Possible values if the debug console is enabled: `"Left"`, `"Center"`, `"Right"`. | ||
If the debug console is disabled, the returned value is an empty string `""`. | ||
""" | ||
bl_idname = 'LNGetDebugConsoleSettings' | ||
bl_label = 'Get Debug Console Settings' | ||
arm_version = 1 | ||
arm_version = 2 | ||
|
||
def arm_init(self, context): | ||
self.add_output('ArmBoolSocket', 'Enabled') | ||
self.add_output('ArmBoolSocket', 'Visible') | ||
self.add_output('ArmFloatSocket', 'Scale') | ||
self.add_output('ArmBoolSocket', 'Hovered') | ||
self.add_output('ArmFloatSocket', 'UI Scale') | ||
self.add_output('ArmStringSocket', 'Position') | ||
|
||
def get_replacement_node(self, node_tree: bpy.types.NodeTree): | ||
if self.arm_version not in (0, 1): | ||
raise LookupError() | ||
|
||
return NodeReplacement( | ||
'LNGetDebugConsoleSettings', self.arm_version, 'LNGetDebugConsoleSettings', 2, | ||
in_socket_mapping={}, out_socket_mapping={0: 1, 1: 3, 2: 4} | ||
) |