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 #2943 from QuantumCoderQC/tilesheet-improvements
Tilesheet improvements
- Loading branch information
Showing
14 changed files
with
120 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package armory.logicnode; | ||
|
||
import iron.Scene; | ||
import iron.object.MeshObject; | ||
|
||
class SetActiveTilesheetNode extends LogicNode { | ||
|
||
public function new(tree: LogicTree) { | ||
super(tree); | ||
} | ||
|
||
override function run(from: Int) { | ||
var object: MeshObject = inputs[1].get(); | ||
var tilesheet: String = inputs[2].get(); | ||
var action: String = inputs[3].get(); | ||
|
||
if (object == null) return; | ||
|
||
object.setActiveTilesheet(Scene.active.raw.name, tilesheet, action); | ||
|
||
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package armory.logicnode; | ||
|
||
import iron.object.MeshObject; | ||
|
||
class SetTilesheetFrameNode extends LogicNode { | ||
|
||
public function new(tree: LogicTree) { | ||
super(tree); | ||
} | ||
|
||
override function run(from: Int) { | ||
var object: MeshObject = inputs[1].get(); | ||
var frame: Int = inputs[2].get(); | ||
|
||
if (object == null) return; | ||
|
||
object.activeTilesheet.setFrameOffset(frame); | ||
|
||
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
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,15 +1,37 @@ | ||
from arm.logicnode.arm_nodes import * | ||
|
||
class GetTilesheetStateNode(ArmLogicTreeNode): | ||
"""Returns the information about the current tilesheet of the given object.""" | ||
"""Returns the information about the current tilesheet of the given object. | ||
@output Active Tilesheet: Current active tilesheet. | ||
@output Active Action: Current action in the tilesheet. | ||
@output Frame: Frame offset with 0 as the first frame of the active action. | ||
@output Absolute Frame: Absolute frame index in this tilesheet. | ||
@output Is Paused: Tilesheet action paused. | ||
""" | ||
bl_idname = 'LNGetTilesheetStateNode' | ||
bl_label = 'Get Tilesheet State' | ||
arm_version = 1 | ||
arm_version = 2 | ||
arm_section = 'tilesheet' | ||
|
||
def arm_init(self, context): | ||
self.add_input('ArmNodeSocketObject', 'Object') | ||
|
||
self.add_output('ArmStringSocket', 'Name') | ||
self.add_output('ArmStringSocket', 'Active Tilesheet') | ||
self.add_output('ArmStringSocket', 'Active Action') | ||
self.add_output('ArmIntSocket', 'Frame') | ||
self.add_output('ArmIntSocket', 'Absolute Frame') | ||
self.add_output('ArmBoolSocket', 'Is Paused') | ||
|
||
def get_replacement_node(self, node_tree: bpy.types.NodeTree): | ||
if self.arm_version not in (0, 1): | ||
raise LookupError() | ||
|
||
return NodeReplacement( | ||
'LNGetTilesheetStateNode', self.arm_version, 'LNGetTilesheetStateNode', 2, | ||
in_socket_mapping={}, out_socket_mapping={0:1, 1:3, 2:4} | ||
) |
16 changes: 16 additions & 0 deletions
16
blender/arm/logicnode/animation/LN_set_active_tilesheet.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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from arm.logicnode.arm_nodes import * | ||
|
||
class SetActiveTilesheetNode(ArmLogicTreeNode): | ||
"""Set the active tilesheet.""" | ||
bl_idname = 'LNSetActiveTilesheetNode' | ||
bl_label = 'Set Active Tilesheet' | ||
arm_version = 1 | ||
arm_section = 'tilesheet' | ||
|
||
def arm_init(self, context): | ||
self.add_input('ArmNodeSocketAction', 'In') | ||
self.add_input('ArmNodeSocketObject', 'Object') | ||
self.add_input('ArmStringSocket', 'Tilesheet') | ||
self.add_input('ArmStringSocket', 'Action') | ||
|
||
self.add_output('ArmNodeSocketAction', 'Out') |
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,17 @@ | ||
from arm.logicnode.arm_nodes import * | ||
|
||
class SetTilesheetFrame(ArmLogicTreeNode): | ||
"""Set the frame of the current tilesheet action. | ||
@input Frame: Frame offset to set with 0 as the first frame of the active action. | ||
""" | ||
bl_idname = 'LNSetTilesheetFrameNode' | ||
bl_label = 'Set Tilesheet Frame' | ||
arm_version = 1 | ||
arm_section = 'tilesheet' | ||
|
||
def arm_init(self, context): | ||
self.add_input('ArmNodeSocketAction', 'In') | ||
self.add_input('ArmNodeSocketObject', 'Object') | ||
self.add_input('ArmIntSocket', 'Frame') | ||
|
||
self.add_output('ArmNodeSocketAction', 'Out') |
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
Binary file not shown.