44 lines
994 B
C++
44 lines
994 B
C++
#ifndef GUIShaderNodeTexture_h__
|
|||
|
|
#define GUIShaderNodeTexture_h__
|
||
|
|
|
||
|
|
#include "GUIShaderNode.h"
|
||
|
|
#include <ResourceManager.h>
|
||
|
|
#include "Property.h"
|
||
|
|
|
||
|
|
class GUIShaderNodeTexture : public GUIShaderNode
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
GUIShaderNodeTexture(IShaderGraphNode* src)
|
||
|
|
:GUIShaderNode(src)
|
||
|
|
{
|
||
|
|
tex = 0;
|
||
|
|
|
||
|
|
if(src->GetPropertyByAttribute("Name", "FilePath", &file_prop))
|
||
|
|
{
|
||
|
|
|
||
|
|
file_prop->Event_ValueChanged += NewDelegate(this, &GUIShaderNodeTexture::OnTexturePathChanged);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
String GetFilename()
|
||
|
|
{
|
||
|
|
return file_prop->ToString();
|
||
|
|
}
|
||
|
|
private:
|
||
|
|
Core::IProperty* file_prop;
|
||
|
|
void OnTexturePathChanged()
|
||
|
|
{
|
||
|
|
//if(tex.ptr())
|
||
|
|
//delete tex.ptr();
|
||
|
|
printf("Try get texture\n");
|
||
|
|
if(file_prop->ToString() != STR("")){
|
||
|
|
tex = ResourceManager::me()->GetTexture(file_prop->ToString());
|
||
|
|
printf("End try get texture\n");
|
||
|
|
SetDisplayImage(tex);
|
||
|
|
printf("End set display image\n");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
texture_ptr tex;
|
||
|
|
};
|
||
|
|
#endif // GUIShaderNodeTexture_h__
|