by date
New and Improved TGB AudioManager
New and Improved TGB AudioManager
| Name: | Joe Rossi | ![]() |
|---|---|---|
| Date Posted: | Jan 21, 2008 | |
| Rating: | 5.0 out of 5 | |
| Public: | YES | |
| Comments: | YES | |
| RSS Feed: | or Subscribe with . | |
| Profile Page: | View profile page for Joe Rossi |
Blog post
I just want to let TGB users know about the updated AudioManager resource on TDN. I've modded Phillip OShea's awesome AudioManager resource and I've found a way to make audioProfiles created with the resource selectable within behaviors! I've had this on my TGB wishlist for awhile now, it's something that I felt should've been in TGB from the start. It only took me a week or two, very part time...starting with Phillips code ;). I've learned a great deal about how behaviors work internally, and as a bonus I stumbled upon the undocumented ColorPicker for behaviors.
Without further ado...Here's how to install it.
Grab the file resource from the new TGB resource page on TDN:tdn.garagegames.com/wiki/TGB/Resources/AudioManager
Unzip it to your resources folder, and (optionally) add the included icon to your tools\levelEditor\gui\images folder.
For the next part you will need a "pro" version of TGB.
Add this code at the bottom of your tools\behaviorEditor\Scripts\fieldTypes.ed.cs editor script
With this in place you can allow selection of audioProfiles created with the AudioManager like so:
I'd love to see this system or something like it become part of stock TGB in the future. It's incredibly useful. Hopefully the Tools and Tech team will take notice. With this out of the way, they can focus on other areas of TGB :)
Many thanks to Phillip OShea for writing the bulk of this code and making it available to the community.
Without further ado...Here's how to install it.
Grab the file resource from the new TGB resource page on TDN:tdn.garagegames.com/wiki/TGB/Resources/AudioManager
Unzip it to your resources folder, and (optionally) add the included icon to your tools\levelEditor\gui\images folder.
For the next part you will need a "pro" version of TGB.
Add this code at the bottom of your tools\behaviorEditor\Scripts\fieldTypes.ed.cs editor script
BehaviorEditor::registerFieldType("audioProfile", "createaudioProfileGui");
function BehaviorFieldStack::createaudioProfileGui(%this, %behavior, %fieldIndex)
{
%fieldInfo = %behavior.template.getBehaviorField(%fieldIndex);
%name = getField( %fieldInfo, 0 );
%description = %behavior.template.getBehaviorFieldDescription(%fieldIndex);
%objectType = %behavior.template.getBehaviorFieldUserData(%fieldIndex);
%scenegraph = ToolManager.getLastWindow().getSceneGraph();
%list = "None";
%count = $managedDatablockSet.getCount();
for( %i = 0; %i < %count; %i++ ){
%object = $managedDatablockSet.getObject( %i );
if( !%object.isMemberOfClass( %objectType ) ) continue;
if( %object.getName() $= "" ) continue;
if( %object.ObjectType !$= "AudioProfile" ) continue;
%list = %list TAB %object.getName();
}
%control = %this.createDropDownList(%name, %name, "", %list, %description, true, true);
%listCtrl = %control.findObjectByInternalName(%name @ "DropDown");
%listCtrl.object = %behavior;
} With this in place you can allow selection of audioProfiles created with the AudioManager like so:
%template.addBehaviorField( mySound, "The sound we want to play", audioProfile, "", ScriptObject );
I'd love to see this system or something like it become part of stock TGB in the future. It's incredibly useful. Hopefully the Tools and Tech team will take notice. With this out of the way, they can focus on other areas of TGB :)
Many thanks to Phillip OShea for writing the bulk of this code and making it available to the community.
Recent Blog Posts
| List: | 01/21/08 - New and Improved TGB AudioManager 08/10/07 - RPG progress and new font tool 02/19/07 - Working towards an RPG in TGB 12/13/06 - Building onto Torque Game Builder 03/18/06 - IUP: Use Lua scripted GUIs with Torque 02/02/06 - Lots of new changes 11/06/05 - Plan for Joe Rossi |
|---|
Submit your own resources!| Phillip OShea (Jan 21, 2008 at 02:01 GMT) |
| Michael Hartlef (Jan 21, 2008 at 11:20 GMT) Resource Rating: 5 |
| Saiko (Jan 21, 2008 at 17:58 GMT) |
| Ken Tylman (Feb 17, 2008 at 02:42 GMT) |
I unzipped the AudioManagerTool directory to "TorqueGameBuilder-1.7.2\tgb\resources\AudioManagerTool". I copied the AudioManagerIcon.png to "TorqueGameBuilder-1.7.2\tgb\tools\levelEditor\gui\images" and the audioManagerInterfact.gui to "TorqueGameBuilder-1.7.2\tgb\tools\levelEditor\gui\images". I then modified the fieldTypes.ed.cs script.
I can add audio profiles to behaviors, but I think I missed something somewhere. The only selection I have under the behavior field drop down is "none" and I can't find anything added to TGB to actually let me add audio files to the project. I'm assuming that since there is a gui and an icon, I should see something added to TGB somewhere, right? Is this resource incompatible with TGB 1.7.2 or did I miss something?
| Brian Carter (Mar 08, 2008 at 03:38 GMT) |
You must be a member and be logged in to either append comments or rate this resource.



5.0 out of 5


