Пример #1
0
moDirectorStatus
moEffectLayerTimelineCtrl::ValueUpdated( moValueDescriptor p_ValueDesc ) {

    switch(p_ValueDesc.GetParamDescriptor().GetParamDefinition().GetType() ) {
        case MO_PARAM_TEXTURE:
            //LOAD IMAGE....
            //Log("loading background");
            if ( p_ValueDesc.GetParamDescriptor().GetParamDefinition().GetType()==MO_PARAM_TEXTURE
             && p_ValueDesc.GetValue().GetSubValueCount()>=1 ) {

                moText tname = p_ValueDesc.GetValue().GetSubValue(0).Text();

                if(tname!=m_BackgroundName) {

                    m_BackgroundName = tname;

                    moTextureDescriptor pTextDescriptor( GetResourceDescriptor( moTextureDescriptor( tname ) ) );

                    //m_BackgroundImage.LoadFile( moText2Wx( pTextDescriptor.GetResourceDefinition().GetFileName() ) );

                    Refresh();
                }
            }
            break;
        default:
            break;
    }

    return MO_DIRECTOR_STATUS_OK;

}
Пример #2
0
void	CResourceManager::GetRecursiveDependencies( CResourceDescriptor* pDescriptor, std::vector< CResourceDescriptor* >& dependencies )
{
	for( const String& dependencyPath : pDescriptor->GetDependencies() )
	{
		CResourceDescriptor* pDependency = GetResourceDescriptor( dependencyPath );
		if ( pDependency == nullptr )
		{
			continue;
		}
		dependencies.push_back( pDependency );
		GetRecursiveDependencies( pDependency, dependencies );
	}
}
Пример #3
0
moDirectorStatus
moLayerEffectCtrl::ValueUpdated( moValueDescriptor p_ValueDesc ) {

    float r,g,b,a;
    float ang = 0;///EffectState.tempo.ang

    moText tname;
    moTextureDescriptor pTextureDescriptor;

    ///actualizamos el valor correspondiente al color y a la textura

    ///ATENCION ESTO NO FUNCIONA SI HAY MAS DE UN COLOR O TEXTURA!!!!
    ///que textura o que color son los supervisados por este control se debería definir
    ///en algun lado ( acive=1 o principal=1 o algo por el estilo... o simplemente que sea el primero... )
    ///bueno, y que definitivamente se llame COLOR y el otro se llame TEXTURE...???

    switch( p_ValueDesc.GetParamDescriptor().GetParamDefinition().GetType() ) {

      case MO_PARAM_COLOR:

          if ( p_ValueDesc.GetParamDescriptor().GetParamDefinition().GetName()==moText("color") ) {

              r = 255.0 * p_ValueDesc.GetValue().GetSubValue(MO_RED).Eval( ang );
              g = 255.0 * p_ValueDesc.GetValue().GetSubValue(MO_GREEN).Eval( ang );
              b = 255.0 * p_ValueDesc.GetValue().GetSubValue(MO_BLUE).Eval( ang );
              a = 255.0 * p_ValueDesc.GetValue().GetSubValue(MO_ALPHA).Eval( ang );

              if (ColourPanelFinal)
                ColourPanelFinal->SetColourValue( wxColour( r,g, b, a ) );
          }

          break;

      case MO_PARAM_TEXTURE:

          if ( p_ValueDesc.GetParamDescriptor().GetParamDefinition().GetName()==moText("texture") ) {

            tname = p_ValueDesc.GetValue().GetSubValue(0).Text();

            pTextureDescriptor = GetResourceDescriptor( moTextureDescriptor( tname ) );

            ///en caso de no tener aun textura asignada, o en caso de ser distinta... aplicamos...
            if ( !m_TextureDescriptor.IsValid() ||
                  (moText)m_TextureDescriptor.GetResourceDefinition().GetName() != (moText)pTextureDescriptor.GetResourceDefinition().GetName()
            ) {

                ///guardamos el descriptor de esta textura... para proximas referencias...
                ///para no volver a pisar...
                m_TextureDescriptor = pTextureDescriptor;
                m_TexValueDescriptor = p_ValueDesc;

                void* ptr = p_ValueDesc.GetValue().GetSubValue(0).Pointer();

                moTexture *pTex = reinterpret_cast<moTexture*>( ptr );

                if  (pTex ) {

                  //Log( pTex->GetName() );

                  MOuchar *bits;

                  bits = new MOuchar[ pTex->GetWidth() * pTex->GetHeight() * 4 ];
                  pTex->GetBuffer( bits );

                  wxImage* thumbImg =  new wxImage( pTex->GetWidth(), pTex->GetHeight(), false );
                  if (thumbImg) {
                    thumbImg->InitAlpha();

                    for(int j=0; j< thumbImg->GetHeight(); j++) {
                      for(int i=0; i< thumbImg->GetWidth(); i++) {
                          thumbImg->SetRGB( i, j,
                                            bits[ (i + j*thumbImg->GetWidth() )*4 ],
                                            bits[ (i + j*thumbImg->GetWidth() )*4 + 1 ],
                                            bits[ (i + j*thumbImg->GetWidth() )*4 + 2 ] );
                          thumbImg->SetAlpha( i, j, bits[ (i + j*thumbImg->GetWidth() )*4 + 3 ] );

                      }
                    }


                    if (thumbImg->IsOk()) {
                      ColourPanelFinal->SetBitmap( wxBitmap(*thumbImg) );

                    }

                    if (thumbImg)
                      delete thumbImg;

                    ///el primero que encontramos que pudimos aplicar es suficiente.....
                    break;
                  }
                  if (bits)
                     delete [] bits;
                }


              }
          }
          break;

      default:
          ///nothing to do
          break;

    }

    return MO_DIRECTOR_STATUS_OK;

}