Is there a good example on how to use ITextureEditorToolkit::GetTexture();

I’m pretty new to Unreal API programming and my C++ is very rusty. I’m trying to get texture info from the texture editor via a plug-in. Looks like ITextureEditorToolkit::GetTexture() is the best route, but it’s giving me errors when I try to use it. Obviously I’m not using it right. Is there a good example on using this function call?

UTexture *texture = ITextureEditorToolkit::GetTexture(); //doesn't work

I also cannot create an object of class ITextureEditorToolkit because they are abstract classes.

To clarify, what I am trying to do is:
Get the active Texture Editor window
Get the Texture
Get the Texture’s values

unreal engine 4.9.2 if that’s what you mean.

Which version are you using?

I’ll give that a shot and let you know! Thanks! :slight_smile:

You dont really need to access the TextureEditorToolkit to get the Texture.
You can do as follows

When your module is initialized set this delegate to get the TextureEditor

FAssetEditorManager::Get().OnAssetEditorOpened().AddRaw(this, &FMyModule::HandleAssetEditorOpened);

Check if this the asset is a Texture, cast and modifie it as you like

void FMyModule::HandleAssetEditorOpened(UObject* AssetObject)
	if (AssetObject->GetClass()->IsChildOf(UTexture2D::StaticClass()))
		if (AssetObject != NULL)
			UTexture2D* Texture = Cast<UTexture2D>(AssetObject);
			Texture->AdjustBrightness = 0;

That seems to work! I think it’s enough for me to move forward! Thanks a lot! :slight_smile:

okay, this seams to have stopped working.

	if (Str.Contains(TEXT("brightness"), ESearchCase::CaseSensitive, ESearchDir::FromEnd))
		float testFloat = FCString::Atof(*value);
		UE_LOG(ModuleLog, Warning, TEXT("Setting to %f"), testFloat);
		texture->AdjustBrightness = FCString::Atof(*value);

from the output log it looks like its reading in correctly, but the value remains unchanged

The log says:
ModuleLog:Warning: Setting to 0.250000

In the editor, it’s still set to 1 when it should be .25

However, my compression settings do update, so I’m not erroring out and I appear to have the correct texture

This no longer works. pinging again to see if I cannot get a responce