Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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

Product Version: Game Mod
more ▼

asked Oct 08 '15 at 10:16 PM in C++ Programming

avatar image

Spectral Ink
224 10 15 23

avatar image Stane Oct 09 '15 at 04:13 AM

Which version are you using?

avatar image Spectral Ink Oct 09 '15 at 04:40 AM

unreal engine 4.9.2 if that's what you mean.

avatar image Spectral Ink Dec 18 '15 at 06:04 AM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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;
more ▼

answered Oct 09 '15 at 05:58 AM

avatar image

58 3 8 7

avatar image Spectral Ink Oct 09 '15 at 06:19 AM

I'll give that a shot and let you know! Thanks! :-)

avatar image Spectral Ink Oct 10 '15 at 09:00 PM

That seems to work! I think it's enough for me to move forward! Thanks a lot! :-)

avatar image Spectral Ink Dec 18 '15 at 11:14 PM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question