-
Notifications
You must be signed in to change notification settings - Fork 324
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 #3124 from t3du/SpeakerNodes
SpeakerNodes: setSound and setVolume
- Loading branch information
Showing
5 changed files
with
85 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package armory.logicnode; | ||
|
||
import iron.object.SpeakerObject; | ||
|
||
class SetSoundNode extends LogicNode { | ||
|
||
public function new(tree: LogicTree) { | ||
super(tree); | ||
} | ||
|
||
override function run(from: Int) { | ||
var object: SpeakerObject = cast(inputs[1].get(), SpeakerObject); | ||
var sound: String = inputs[2].get(); | ||
if (object == null || sound == null) return; | ||
object.setSound(sound); | ||
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,17 @@ | ||
package armory.logicnode; | ||
|
||
import iron.object.SpeakerObject; | ||
|
||
class SetVolumeSoundNode extends LogicNode { | ||
|
||
public function new(tree: LogicTree) { | ||
super(tree); | ||
} | ||
|
||
override function run(from: Int) { | ||
var object: SpeakerObject = cast(inputs[1].get(), SpeakerObject); | ||
if (object == null) return; | ||
object.setVolume(inputs[2].get()); | ||
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
18 changes: 18 additions & 0 deletions
18
armory/blender/arm/logicnode/sound/LN_set_sound_speaker.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,18 @@ | ||
from arm.logicnode.arm_nodes import * | ||
|
||
class SetSoundSpeakerNode(ArmLogicTreeNode): | ||
"""sets sound name of the given speaker object. | ||
@seeNode Play Speaker | ||
@seeNode Stop Speaker | ||
""" | ||
bl_idname = 'LNSetSoundNode' | ||
bl_label = 'Set Sound Speaker' | ||
arm_version = 1 | ||
|
||
def arm_init(self, context): | ||
self.add_input('ArmNodeSocketAction', 'In') | ||
self.add_input('ArmNodeSocketObject', 'Speaker') | ||
self.add_input('ArmStringSocket', 'Sound Name') | ||
|
||
self.add_output('ArmNodeSocketAction', 'Out') |
18 changes: 18 additions & 0 deletions
18
armory/blender/arm/logicnode/sound/LN_set_volume_speaker.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,18 @@ | ||
from arm.logicnode.arm_nodes import * | ||
|
||
class SetVolumeSoundNode(ArmLogicTreeNode): | ||
"""sets volume of the given speaker object. | ||
@seeNode Play Speaker | ||
@seeNode Stop Speaker | ||
""" | ||
bl_idname = 'LNSetVolumeSoundNode' | ||
bl_label = 'Set Volume Speaker' | ||
arm_version = 1 | ||
|
||
def arm_init(self, context): | ||
self.add_input('ArmNodeSocketAction', 'In') | ||
self.add_input('ArmNodeSocketObject', 'Speaker') | ||
self.add_input('ArmFloatSocket', 'Volume') | ||
|
||
self.add_output('ArmNodeSocketAction', 'Out') |