tools/toolnote/ortoolnote_tool.cxx

tools/toolnote/ortoolnote_tool.cxx
/***************************************************************************************
Autodesk(R) Open Reality(R) Samples
(C) 2009 Autodesk, Inc. and/or its licensors
All rights reserved.
AUTODESK SOFTWARE LICENSE AGREEMENT
Autodesk, Inc. licenses this Software to you only upon the condition that
you accept all of the terms contained in the Software License Agreement ("Agreement")
that is embedded in or that is delivered with this Software. By selecting
the "I ACCEPT" button at the end of the Agreement or by copying, installing,
uploading, accessing or using all or any portion of the Software you agree
to enter into the Agreement. A contract is then formed between Autodesk and
either you personally, if you acquire the Software for yourself, or the company
or other legal entity for which you are acquiring the software.
AUTODESK, INC., MAKES NO WARRANTY, EITHER EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
PURPOSE REGARDING THESE MATERIALS, AND MAKES SUCH MATERIALS AVAILABLE SOLELY ON AN
"AS-IS" BASIS.
IN NO EVENT SHALL AUTODESK, INC., BE LIABLE TO ANYONE FOR SPECIAL, COLLATERAL,
INCIDENTAL, OR CONSEQUENTIAL DAMAGES IN CONNECTION WITH OR ARISING OUT OF PURCHASE
OR USE OF THESE MATERIALS. THE SOLE AND EXCLUSIVE LIABILITY TO AUTODESK, INC.,
REGARDLESS OF THE FORM OF ACTION, SHALL NOT EXCEED THE PURCHASE PRICE OF THE
MATERIALS DESCRIBED HEREIN.
Autodesk, Inc., reserves the right to revise and improve its products as it sees fit.
Autodesk and Open Reality are registered trademarks or trademarks of Autodesk, Inc.,
in the U.S.A. and/or other countries. All other brand names, product names, or
trademarks belong to their respective holders.
GOVERNMENT USE
Use, duplication, or disclosure by the U.S. Government is subject to restrictions as
set forth in FAR 12.212 (Commercial Computer Software-Restricted Rights) and
DFAR 227.7202 (Rights in Technical Data and Computer Software), as applicable.
Manufacturer is Autodesk, Inc., 10 Duke Street, Montreal, Quebec, Canada, H3C 2L7.
***************************************************************************************/
//--- Class declaration
#include "ortoolnote_tool.h"
//--- Registration defines
#define ORTOOLNOTE__CLASS ORTOOLNOTE__CLASSNAME
#define ORTOOLNOTE__LABEL "Note"
#define ORTOOLNOTE__DESC "OR - Note Description"
//--- FiLMBOX implementation and registration
FBToolImplementation( ORTOOLNOTE__CLASS );
FBRegisterTool ( ORTOOLNOTE__CLASS,
ORTOOLNOTE__LABEL,
ORTOOLNOTE__DESC,
FB_DEFAULT_SDK_ICON ); // Icon filename (default=Open Reality icon)
/************************************************
* Tool creation function.
************************************************/
bool ORToolNote::FBCreate()
{
StartSize[0] = 600;
StartSize[1] = 300;
// Create/reset/manage UI
UICreate ();
UIConfigure ();
// Add callbacks
((FBScene*)mSystem.Scene)->OnChange.Add( this, (FBCallback) &ORToolNote::EventSceneChange );
OnIdle.Add( this, (FBCallback) &ORToolNote::EventToolIdle );
return true;
}
/************************************************
* Tool destruction function.
************************************************/
void ORToolNote::FBDestroy()
{
// Remove callbacks
((FBScene*)mSystem.Scene)->OnChange.Remove( this, (FBCallback) &ORToolNote::EventSceneChange );
OnIdle.Remove( this, (FBCallback) &ORToolNote::EventToolIdle );
}
/************************************************
* Create the UI (Assign regions & controls).
************************************************/
void ORToolNote::UICreate()
{
int lS = 4;
// Create regions.
AddRegion("TabPanel","TabPanel",
lS, kFBAttachLeft, "", 1.0,
lS, kFBAttachTop, "", 1.0,
-lS, kFBAttachRight, "", 1.0,
25, kFBAttachNone, "", 1.0 );
AddRegion("Layout", "Layout",
0, kFBAttachLeft, "TabPanel", 1.0,
0, kFBAttachBottom, "TabPanel", 1.0,
0, kFBAttachRight, "TabPanel", 1.0,
-lS, kFBAttachBottom, "", 1.0 );
// Assign regions
SetControl( "TabPanel", mTabPanel );
SetControl( "Layout", mLayoutNote );
// Create sub-layouts
UICreateLayoutNote();
UICreateLayoutNoteProperties();
}
void ORToolNote::UICreateLayoutNote()
{
int lH = 22;
int lS = 4;
// Create regions.
mLayoutNote.AddRegion( "LabelNotes", "LabelNotes",
10, kFBAttachLeft, "", 1.0,
10, kFBAttachTop, "", 1.0,
150, kFBAttachNone, "", 1.0,
20, kFBAttachNone, "", 1.0 );
mLayoutNote.AddRegion( "ListNotes", "ListNotes",
0, kFBAttachLeft, "LabelNotes", 1.0,
lS, kFBAttachBottom, "LabelNotes", 1.0,
0, kFBAttachWidth, "LabelNotes", 1.0,
-10, kFBAttachBottom, "", 1.0 );
mLayoutNote.AddRegion( "LabelDescription", "LabelDescription",
30, kFBAttachRight, "LabelNotes", 1.0,
95, kFBAttachTop, "", 1.0,
150, kFBAttachNone, "", 1.0,
lH, kFBAttachNone, "", 1.0 );
mLayoutNote.AddRegion( "ContainerNote", "ContainerNote",
0, kFBAttachLeft, "LabelDescription", 1.0,
lS , kFBAttachBottom, "LabelDescription", 1.0,
0, kFBAttachWidth, "LabelDescription", 1.0,
lH, kFBAttachNone, "", 1.0 );
mLayoutNote.AddRegion( "ButtonCreate", "ButtonCreate",
30, kFBAttachRight, "ContainerNote", 1.0,
75, kFBAttachTop, "", 1.0,
200, kFBAttachNone, "", 1.0,
lH, kFBAttachNone, "", 1.0 );
mLayoutNote.AddRegion( "ButtonAttach", "ButtonAttach",
0, kFBAttachLeft, "ButtonCreate", 1.0,
lS, kFBAttachBottom, "ButtonCreate", 1.0,
0, kFBAttachWidth, "ButtonCreate", 1.0,
0, kFBAttachHeight, "ButtonCreate", 1.0 );
mLayoutNote.AddRegion( "ButtonDetach", "ButtonDetach",
0, kFBAttachLeft, "ButtonCreate", 1.0,
lS, kFBAttachBottom, "ButtonAttach", 1.0,
0, kFBAttachWidth, "ButtonCreate", 1.0,
0, kFBAttachHeight, "ButtonCreate", 1.0 );
mLayoutNote.AddRegion( "ButtonDestroy", "ButtonDestroy",
0, kFBAttachLeft, "ButtonCreate", 1.0,
lS, kFBAttachBottom, "ButtonDetach", 1.0,
0, kFBAttachWidth, "ButtonCreate", 1.0,
0, kFBAttachHeight, "ButtonCreate", 1.0 );
// Assign regions
mLayoutNote.SetControl( "LabelNotes", mLabelNotes );
mLayoutNote.SetControl( "ListNotes", mListNotes );
mLayoutNote.SetControl( "LabelDescription", mLabelDescription );
mLayoutNote.SetControl( "ContainerNote", mContainerNote );
mLayoutNote.SetControl( "ButtonCreate", mButtonCreateNote );
mLayoutNote.SetControl( "ButtonAttach", mButtonAttachNote );
mLayoutNote.SetControl( "ButtonDetach", mButtonDetachNote );
mLayoutNote.SetControl( "ButtonDestroy", mButtonDestroyNote );
}
void ORToolNote::UICreateLayoutNoteProperties()
{
// Create regions.
mLayoutNoteProperties.AddRegion( "ButtonAdd", "ButtonAdd",
0, kFBAttachLeft, "", 1.0,
0, kFBAttachTop, "", 1.0,
200, kFBAttachNone, "", 1.0,
20, kFBAttachNone, "", 1.0 );
mLayoutNoteProperties.AddRegion( "ButtonRemove", "ButtonRemove",
0, kFBAttachLeft, "", 1.0,
5, kFBAttachBottom, "ButtonAdd", 1.0,
0, kFBAttachWidth, "ButtonAdd", 1.0,
0, kFBAttachHeight, "ButtonAdd", 1.0 );
mLayoutNoteProperties.AddRegion( "ButtonList", "ButtonList",
0, kFBAttachLeft, "", 1.0,
5, kFBAttachBottom, "ButtonRemove", 1.0,
0, kFBAttachWidth, "ButtonRemove", 1.0,
0, kFBAttachHeight, "ButtonRemove", 1.0 );
mLayoutNoteProperties.AddRegion( "ListProperties", "ListProperties",
0, kFBAttachLeft, "", 1.0,
10, kFBAttachBottom, "ButtonList", 1.0,
0, kFBAttachWidth, "ButtonList", 1.0,
0, kFBAttachHeight, "", 1.0);
// Assign regions
mLayoutNoteProperties.SetControl( "ButtonAdd", mButtonAddProperty );
mLayoutNoteProperties.SetControl( "ButtonRemove", mButtonRemoveProperty );
mLayoutNoteProperties.SetControl( "ButtonList", mButtonListKeys );
mLayoutNoteProperties.SetControl( "ListProperties", mListProperties );
}
void ORToolNote::UIConfigure()
{
mTabPanel.Items.SetString("Note~Note Custom Properties");
mTabPanel.OnChange.Add( this, (FBCallback) &ORToolNote::EventTabPanelChange );
UIConfigureLayoutNote();
UIConfigureLayoutNoteProperties();
SetCurrentNote( NULL );
}
void ORToolNote::UIConfigureLayoutNote()
{
mLabelDescription.Caption = "Current note (drag)";
mLabelNotes.Caption = "Notes in the scene";
mListNotes.Style = kFBVerticalList;
mButtonCreateNote. Caption = FBString( BUTTON_CAPTIONS[kOpCreateNote] );
mButtonAttachNote. Caption = FBString( BUTTON_CAPTIONS[kOpAttachNote] );
mButtonDetachNote. Caption = FBString( BUTTON_CAPTIONS[kOpDetachNote] );
mButtonDestroyNote.Caption = FBString( BUTTON_CAPTIONS[kOpDestroyNote] );
mButtonCreateNote. OnClick.Add( this, (FBCallback) &ORToolNote::EventCreateNote );
mButtonAttachNote. OnClick.Add( this, (FBCallback) &ORToolNote::EventAttachNote );
mButtonDetachNote. OnClick.Add( this, (FBCallback) &ORToolNote::EventDetachNote );
mButtonDestroyNote.OnClick.Add( this, (FBCallback) &ORToolNote::EventDestroyNote );
mContainerNote.IconPosition = kFBIconLeft;
mContainerNote.OnDragAndDrop.Add( this, (FBCallback) &ORToolNote::EventNoteDragAndDrop );
mContainerNote.OnDblClick.Add ( this, (FBCallback) &ORToolNote::EventContainerNoteDblClick );
mNotesCount = 0;
}
void ORToolNote::UIConfigureLayoutNoteProperties()
{
mButtonAddProperty.Caption = "Add Property...";
mButtonRemoveProperty.Caption = "Remove Property";
mButtonListKeys.Caption = "List Keys";
mListProperties.Style = kFBVerticalList;
mButtonAddProperty.OnClick.Add( this, (FBCallback) &ORToolNote::EventAddProperty );
mButtonRemoveProperty.OnClick.Add( this, (FBCallback) &ORToolNote::EventRemoveProperty );
mButtonListKeys.OnClick.Add( this, (FBCallback) &ORToolNote::EventListKeys );
}
void ORToolNote::UIEnable()
{
bool lEnable = mHdlCurrentNote.Ok();
mButtonAttachNote.Enabled = lEnable;
mButtonDetachNote.Enabled = lEnable;
mButtonDestroyNote.Enabled = lEnable;
mButtonAddProperty.Enabled = lEnable;
mButtonRemoveProperty.Enabled = lEnable;
mButtonListKeys.Enabled = lEnable;
if( !lEnable )
{
// Clear the property list control.
mListProperties.Items.Clear();
}
}
void ORToolNote::SetCurrentNote( FBNote* pNote )
{
mHdlCurrentNote = pNote;
mContainerNote.Items.Clear();
mListProperties.Items.Clear();
if( mHdlCurrentNote.Ok() )
{
mContainerNote.Items.Add( mHdlCurrentNote->Name, (kReference)mHdlCurrentNote.GetPlug() );
UpdatePropertyList();
}
UIEnable();
}
/************************************************
* Events
************************************************/
void ORToolNote::EventSceneChange( HISender pSender, HKEvent pEvent )
{
FBEventSceneChange lEvent( pEvent );
switch( lEvent.Type )
{
{
FBComponent* lChildComp = (FBComponent*)lEvent.ChildComponent;
FBNote* lNote = (lChildComp && lChildComp->Is( FBNote::TypeInfo )) ? (FBNote*)lChildComp : NULL;
if( lNote && mHdlCurrentNote() == lNote )
SetCurrentNote( NULL );
}
break;
}
}
void ORToolNote::EventToolIdle( HIRegister /*pSender*/, HKEvent /*pEvent*/ )
{
UpdateNoteList();
}
void ORToolNote::EventTabPanelChange( HISender /*pSender*/, HKEvent /*pEvent*/ )
{
switch( mTabPanel.ItemIndex )
{
case 0: SetControl( "Layout", mLayoutNote ); break;
case 1: SetControl( "Layout", mLayoutNoteProperties ); UpdatePropertyList(); break;
}
}
// Popup class used to add new properties to a note.
class FBPropertyAddDlg : public FBPopup
{
public:
FBPropertyAddDlg()
{
int lS = 10;
Region.X = 300;
Region.Y = 300;
Region.Width = 250;
Region.Height = 100;
AddRegion( "LabelName", "LabelName", lS, kFBAttachLeft, "", 1.0, lS, kFBAttachTop, "", 1.0, 40, kFBAttachNone, "", 1.0, 20, kFBAttachNone, "", 1.0 );
AddRegion( "EditName", "EditName", lS, kFBAttachRight, "LabelName", 1.0, 0, kFBAttachTop, "LabelName", 1.0, -lS,kFBAttachRight, "", 1.0, 20, kFBAttachNone, "", 1.0 );
AddRegion( "LabelType", "LabelType", 0, kFBAttachLeft, "LabelName", 1.0, lS, kFBAttachBottom, "LabelName", 1.0, 0, kFBAttachWidth, "LabelName", 1.0, 0, kFBAttachHeight, "LabelName", 1.0 );
AddRegion( "ListType", "ListType", lS, kFBAttachRight, "LabelType", 1.0, 0, kFBAttachTop, "LabelType", 1.0, -lS,kFBAttachRight, "", 1.0, 20, kFBAttachNone, "", 1.0 );
AddRegion( "ButtonOk", "ButtonOk", lS, kFBAttachLeft, "", 1.0, lS, kFBAttachBottom, "LabelType", 1.0, 100,kFBAttachNone, "", 1.0, 20, kFBAttachNone, "", 1.0 );
AddRegion( "ButtonCancel", "ButtonCancel", -100-lS, kFBAttachRight, "", 1.0, lS, kFBAttachBottom, "LabelType", 1.0, 100, kFBAttachNone, "", 1.0, 20, kFBAttachNone, "", 1.0 );
SetControl( "LabelName", mLabelName );
SetControl( "LabelType", mLabelType );
SetControl( "EditName", mEditName );
SetControl( "ListType", mListType );
SetControl( "ButtonOk", mButtonOk );
SetControl( "ButtonCancel", mButtonCancel );
Caption = "Add Note Property";
Modal = true;
mLabelName.Caption = "Name";
mLabelType.Caption = "Type";
mListType.Style = kFBDropDownList;
mButtonOk.Caption = "Ok";
mButtonCancel.Caption = "Cancel";
mListType.Items.Add(ANIMATIONNODE_TYPE_BOOL);
mListType.Items.Add(ANIMATIONNODE_TYPE_COLOR);
mListType.Items.Add(ANIMATIONNODE_TYPE_COLOR_RGBA);
mListType.Items.Add(ANIMATIONNODE_TYPE_INTEGER);
mListType.Items.Add(ANIMATIONNODE_TYPE_NUMBER);
mListType.Items.Add(ANIMATIONNODE_TYPE_VECTOR);
mListType.Items.Add(ANIMATIONNODE_TYPE_ACTION);
// mListType.Items.Add(ANIMATIONNODE_TYPE_ENUM);
mButtonOk.OnClick.Add( this, (FBCallback) &FBPropertyAddDlg::EventButtonOkClick );
mButtonCancel.OnClick.Add( this, (FBCallback) &FBPropertyAddDlg::EventButtonCancelClick );
}
protected:
void EventButtonOkClick( HISender /*pSender*/, HKEvent /*pEvent*/ )
{
mPropertyType = mListType.Items[ mListType.ItemIndex ];
mPropertyName = mEditName.Text;
Close(true);
}
void EventButtonCancelClick( HISender /*pSender*/, HKEvent /*pEvent*/ )
{
Close();
}
public:
FBString mPropertyType;
FBString mPropertyName;
private:
FBLabel mLabelName;
FBLabel mLabelType;
FBEdit mEditName;
FBList mListType;
FBButton mButtonOk;
FBButton mButtonCancel;
};
void ORToolNote::EventAddProperty( HISender /*pSender*/, HKEvent /*pEvent*/ )
{
FBPropertyAddDlg lAddDlg;
if( lAddDlg.Show() )
{
mHdlCurrentNote->AnimationNodeInCreate( 0, lAddDlg.mPropertyName, lAddDlg.mPropertyType, true, NULL, NULL, true );
UpdatePropertyList();
}
}
void ORToolNote::EventRemoveProperty( HISender /*pSender*/, HKEvent /*pEvent*/ )
{
if( mListProperties.ItemIndex != -1 ) {
FBAnimationNode* lNode = (FBAnimationNode*)mListProperties.Items.GetReferenceAt( mListProperties.ItemIndex );
mHdlCurrentNote->AnimationNodeDestroy( lNode );
UpdatePropertyList();
}
}
void ORToolNote::EventListKeys( HISender /*pSender*/, HKEvent /*pEvent*/ )
{
if( mListProperties.ItemIndex != -1 ) {
FBAnimationNode* lNode = (FBAnimationNode*)mListProperties.Items.GetReferenceAt( mListProperties.ItemIndex );
if( lNode ) {
static char lTmp[1024];
FBString lMessage( "Keys:" );
FBFCurve* lFCurve = lNode->FCurve;
int lIdx = 0;
for( ; lIdx < lFCurve->Keys.GetCount(); ++lIdx ) {
FBTime lTime( lFCurve->Keys[lIdx].Time );
sprintf( lTmp, "\n %ld: %f", lTime.GetFrame(), (double)lFCurve->Keys[lIdx].Value );
lMessage += lTmp;
}
FBMessageBox( "List Keys", lMessage, "OK", 0, 0 );
}
else {
FBMessageBox( "List Keys", "The selected property does not possess any keys.", "OK", 0, 0 );
}
}
else {
FBMessageBox( "List Keys", "No property selected.", "OK", 0, 0 );
}
}
void ORToolNote::EventNoteDragAndDrop( HISender /*pSender*/, HKEvent pEvent )
{
FBEventDragAndDrop lDragAndDrop( pEvent );
switch( lDragAndDrop.State )
{
{
lDragAndDrop.Accept();
}
break;
{
FBComponent* lComponent = lDragAndDrop.Get(0);
if( lComponent && lComponent->Is( FBNote::TypeInfo ) )
SetCurrentNote( (FBNote*)lComponent );
}
break;
}
}
void ORToolNote::EventContainerNoteDblClick( HISender /*pSender*/, HKEvent /*pEvent*/ )
{
SetCurrentNote( NULL );
}
void ORToolNote::EventCreateNote( HISender /*pSender*/, HKEvent /*pEvent*/ )
{
FBNote* lNote = new FBNote( "My Note" );
lNote->FBCreate();
// Attach the note to the scene
lNote->Attach();
SetCurrentNote( lNote );
}
void ORToolNote::EventAttachNote( HISender /*pSender*/, HKEvent /*pEvent*/ )
{
if( !mHdlCurrentNote.Ok() )
return;
FBScene* lScene = mSystem.Scene;
int i;
int lCnt = lScene->Components.GetCount();
for( i=0; i<lCnt; i++ )
{
AddNoteToSelected( lScene->Components[i] );
}
AddNoteToSelected( mSystem.Renderer );
lCnt = mSystem.Manipulators.GetCount();
for( i=0; i<lCnt; i++ )
{
AddNoteToSelected( mSystem.Manipulators[i] );
}
lCnt = FBGetComponentArray().GetCount();
for( i=0; i<lCnt; i++ )
{
FBComponent* lComp = FBGetComponentArray().operator[](i);
// Make sure it isn't another note.
if( !lComp->Is(FBNote::TypeInfo) )
{
AddNoteToSelected( lComp );
}
}
}
void ORToolNote::AddNoteToSelected( FBComponent* pComp )
{
if( !pComp || !mHdlCurrentNote.Ok() || pComp->Is(FBNote::TypeInfo) )
return;
if( pComp->Selected )
mHdlCurrentNote->Attach( pComp );
// Add children
int i;
int lCnt = pComp->Components.GetCount();
for( i=0; i<lCnt; i++ )
{
FBComponent* lComp = pComp->Components[i];
AddNoteToSelected( lComp );
}
}
void ORToolNote::EventDetachNote( HISender /*pSender*/, HKEvent /*pEvent*/ )
{
if( !mHdlCurrentNote.Ok() )
return;
FBScene* lScene = mSystem.Scene;
int i;
int lCnt = lScene->Components.GetCount();
for( i=0; i<lCnt; i++ )
{
DetachNoteFromSelected( lScene->Components[i] );
}
lCnt = 1;
for( i=0; i < lCnt; i++ )
{
DetachNoteFromSelected( mSystem.Renderer );
}
lCnt = mSystem.Manipulators.GetCount();
for( i=0; i<lCnt; i++ )
{
DetachNoteFromSelected( mSystem.Manipulators[i] );
}
lCnt = FBGetComponentArray().GetCount();
for( i=0; i<lCnt; i++ )
{
FBComponent* lComp = FBGetComponentArray().operator[](i);
// Make sure it isn't another note.
if( !lComp->Is(FBNote::TypeInfo) )
{
DetachNoteFromSelected( lComp );
}
}
}
void ORToolNote::DetachNoteFromSelected( FBComponent* pComp )
{
if( !pComp || !mHdlCurrentNote.Ok() )
return;
if( pComp->Selected )
mHdlCurrentNote->Detach( pComp );
// Detach from childrens
int i;
int lCnt = pComp->Components.GetCount();
for( i=0; i<lCnt; i++ )
{
FBComponent* lComp = pComp->Components[i];
DetachNoteFromSelected( lComp );
}
}
void ORToolNote::EventDestroyNote( HISender /*pSender*/, HKEvent /*pEvent*/ )
{
if( mHdlCurrentNote.Ok() )
{
mHdlCurrentNote->Selected = false;
mHdlCurrentNote->FBDelete();
SetCurrentNote( NULL );
}
}
void WalkNodes( FBAnimationNode* pNode, int lIndent = 0 )
{
if( pNode )
{
char lMsg[128];
FBFCurve* lCurve = pNode->FCurve;
sprintf( lMsg, "%*sNode: '%s': %d/%d keys\n", lIndent, " ", (const char*)pNode->Name, (int)pNode->KeyCount, lCurve ? lCurve->Keys.GetCount() : -1 );
int pIdx;
for( pIdx = 0; pIdx < pNode->Nodes.GetCount(); ++pIdx )
{
WalkNodes( pNode->Nodes[pIdx], lIndent + 2 );
}
}
}
void ORToolNote::UpdatePropertyList()
{
if( mHdlCurrentNote.Ok() )
{
mListProperties.Items.Clear();
int lCount = mHdlCurrentNote->PropertyList.GetCount();
int lIdx = 0;
for( ; lIdx < lCount; ++lIdx )
{
FBProperty* lProperty = mHdlCurrentNote->PropertyList[lIdx];
// We only show animatable properties.
if (lProperty->IsAnimatable())
{
FBPropertyAnimatable* lAnimatableProperty = (FBPropertyAnimatable*)lProperty;
lAnimatableProperty->SetAnimated( true );
FBAnimationNode* lNode = lAnimatableProperty->GetAnimationNode();
FBString lPropName( lProperty->GetName() );
mListProperties.Items.Add( lPropName, (kReference)lNode );
}
}
}
}
void ORToolNote::UpdateNoteList()
{
FBScene* lScene = (FBScene*)mSystem.Scene;
int lCount = lScene->Notes.GetCount();
for( int i = 0; i < lCount; i++ )
{
// Reuse existing row or add a new one if needed.
if( i >= mNotesCount )
{
mListNotes.Items.Add( lScene->Notes[i]->Name );
mNotesCount++;
}
else
{
if( strcmp( mListNotes.Items[i], lScene->Notes[i]->Name ) != 0 )
mListNotes.Items.SetAt( i, lScene->Notes[i]->Name );
}
}
// Remove unused row.
while( mNotesCount != lCount )
{
mListNotes.Items.RemoveAt( --mNotesCount );
}
}