//----------------------------------------------------------------- //! \brief Display animation properties (recurse) //----------------------------------------------------------------- void NPropertiesCtrl::_DisplayAnimationObjectProperties(NObject* _pobj, udword _dwDepth) { //Get First Object var bloc NVarsBloc* pbloc = _pobj->GetFirstVarsBloc(); while (pbloc) { //NVarsBlocDesc* pblocdesc = pbloc->GetBlocDesc(); //Parse Vars for this bloc for (udword i=0; i<pbloc->Count(); i++) { //Animation for this variable? NObject* pctrlObj = pbloc->GetValueControler(i); if (pctrlObj!=null) { NString str; str.Format("Animation %s", pbloc->GetValueDesc(i)->pszName ); pctrlObj->SetName(str.Buffer()); //##TOFIX### variable bloc name //Display properties for this controler _DisplayObjectProperties(pctrlObj, _dwDepth); } } //pblocdesc=pblocdesc-> //###TOFIX### Next Bloc pbloc=null; //###TOFIX#### } }
void NStringProp::OnValueChanged(NObject* _psender) { //Change field value NString str = m_edit.GetText(); m_pvarBloc->SetValue(m_dwvarIdx, 0.0f, str.Buffer()); // Send Event NEditorGUI::GetInstance()->EmitPropertiesChanged((NOperatorFx*)m_pvarBloc->GetOwner()); }
void NUbyteComboProp::Init() { ubyte byVal; m_pvarBloc->GetValue(m_dwvarIdx, 0.0f, byVal); //Make menu items NVarsBlocDesc* pbd = m_pvarBloc->GetValueDesc(m_dwvarIdx); NString str; str = pbd->pszDefValue; NString word; udword i=3; do { i = str.ExtractToken(i, word, ",]"); if (i!=-1) { m_carrayStringsList.AddItem(word); i+=word.Length()+1; } } while (i!=-1); //Create menu button ubyte val = byVal; word = "?"; if (val<(ubyte)m_carrayStringsList.Count()) word = m_carrayStringsList[val].Buffer(); m_button.Create(word.Buffer(), NRect(0,0,0,0), m_pParent, 0); m_button.OnChanged = FDelegate(this, (TDelegate)&NUbyteComboProp::OnValueChanged); //Add items to menu for (udword i=0; i<m_carrayStringsList.Count(); i++) { m_button.GetMenu()->AddItem(m_carrayStringsList[i].Buffer(), i+1, 0); } }
void WriteTGA(NBitmap* _bmp, NString _path, NString _suffix) { TGAHeader header; header.idlength=0; header.colourmaptype=0; header.datatypecode=2; header.colourmaporigin=0; header.colourmaplength=0; header.colourmapdepth=0; header.x_origin=0; header.y_origin=0; header.width = (short)_bmp->GetWidth(); header.height = (short)_bmp->GetHeight(); header.bitsperpixel= 32; header.imagedescriptor=0; udword length = _path.Length(); if (length>=4 && _path.Buffer()[length-4] == '.' && _path.Buffer()[length-3] == 't' && _path.Buffer()[length-2] == 'g' && _path.Buffer()[length-1] == 'a') { _path.SetLength(length-4); } if (_suffix.Length() > 0) { _path += "_"; _path += _suffix.Buffer(); } _path += ".tga"; FILE* tgaf = fopen(_path.Buffer(),"wb"); fwrite(&header.idlength, 1, 1, tgaf); fwrite(&header.colourmaptype, 1, 1, tgaf); fwrite(&header.datatypecode, 1, 1, tgaf); fwrite(&header.colourmaporigin, 2, 1, tgaf); fwrite(&header.colourmaplength, 2, 1, tgaf); fwrite(&header.colourmapdepth, 1, 1, tgaf); fwrite(&header.x_origin, 2, 1, tgaf); fwrite(&header.y_origin, 2, 1, tgaf); fwrite(&header.width, 2, 1, tgaf); fwrite(&header.height, 2, 1, tgaf); fwrite(&header.bitsperpixel, 1, 1, tgaf); fwrite(&header.imagedescriptor, 1, 1, tgaf); NRGBA* pixels = _bmp->GetPixels(); char* offset=0; for(int y=header.height-1;y>=0;y--) { offset = (char*) pixels + y*header.width*4; for(int x=0;x<header.width;x++) { fwrite(offset+2, 1, 1, tgaf); fwrite(offset+1, 1, 1, tgaf); fwrite(offset, 1, 1, tgaf); fwrite(offset+3, 1, 1, tgaf); offset += 4; } } fclose(tgaf); }