TryConvertShortPackagePathToLongInObjectPath() generate wrong path.

When I use experimental class “SRichTextBlock”, I found that “span font” key don’t work.
I think that the reason Is below.

My Input Key is Text</>, so
In FPackageName::TryConvertShortPackagePathToLongInObjectPath(const FString& ObjectPath, FString& ConvertedObjectPath) function, ObjectPath parameter is “MyFontName”.

Since DotPosition is INDEX_NONE, PackagePath is “MyFontName” and LongPackagePath is “/Game/UI/Font”(My Path).

Problem Is that ObjectName is NULL, so ConvertedObjectPath is “/Game/UI/Font/MyFontName.”.

I think that Right result is “/Game/UI/Font/MyFontName.MyFontName”, so I think This function is something wrong.
(I think In “else” state, ObjectName local variable should set to some value)

Below is Engine function code and My EngineVersion Is 4.14.3

Thanks

bool FPackageName::TryConvertShortPackagePathToLongInObjectPath(const FString& ObjectPath, FString& ConvertedObjectPath)
{
 FString PackagePath;
 FString ObjectName;

 int32 DotPosition = ObjectPaht.Find(TEXT9"."), ESearchCase::CaseSensitive);
 if(DotPosition != INDEX_NONE)
 {
  PackagePath = ObjectPath.Mid(0, DotPosition);
  ObjectName = ObjectPath.Mid(DotPosition + 1);
 }
 else
 {
  PackagePath = ObjectPath;
 }

 FString LongPackagePath;
 if(!SearchForPackageOnDisk(PackagePath, &LongPackagePath))
 {
  return false;
 }
 
 ConvertedObjectPath = FString::Printf(TEXT("%s.%s"), *LongPackagePath, *ObjectName);
 return true;
}

Hey inkey-

How are you using this function in your project? Can you provide reproduction steps to help me see the behavior you’re seeing? Additionally, where are you getting the “MyFontName” from? Looking at the code, what it’s doing is it’s finding the reference path to the object first. For example, the ThirdPerson Character blueprint in the Third Person template has a path of Blueprint'/Game/ThirdPersonCPP/Blueprints/ThirdPersonCharacter.ThirdPersonCharacter'. Line 6 above, where DotPosition is set, is looking for the “.” between ThirdPersonCharacter.ThirdPersonCharacter and then ObjectName gets set to whatever follows the period. If the period isn’t found then ObjectName is not set. This is what the code appears to be doing, however if you can explain how you’re using this code yourself, I can test further to see if this is indeed what is happening/intended.

First, Thank you for your reply.
As I Mentioned, I just use RichtextBlockWidget, Not using that function directely.
In RichTextBlock, I write [span font="MyFontName"]MyText[/] (You Must change “[]” to “<>”)

And I can find in FDefaultRichTextDecorator::ExplodeRunInfo(), Font.TryLoad() can’t load font object since “FStringAssetReference Font(**FontFamilyString)” makes wrong path.
( approximate step is below

FDefaultRichTextDecorator::ExplodeRunInfo() →

FStringAssetReference::SetPath(FString Path) →

FPackageName::GetNormalizedObjectPath() →

FPackageName::TryConvertShortPackagePathToLongInObjectPath() )

I already know that if I just type [span font=MyFontName.MyFontName]MyText[/](You Must change “[]” to “<>”), I can change font perfectely.

But I just want to ask returning wrong path in FPackageName::TryConvertShortPackagePathToLongInObjectPath() is right when it’s “ObjectPath” parameter is short path (like just “MyFontName”)

You can simply follow the code. When ObjectPath parameter is “MyFontName”,
the ConvertedObjectPath Necessarily return wrong path “[somepath]/MyFontName.” (I think right path is “[somepath]/MyFontName.MyFontName”)

(Ah, On the consumption, I consider “short package name” is “MyFontName”, is that right?)

I’m still not sure I understand exactly what you’re doing. In trying to reproduce your issue I first created a new Widget Blueprint, however the Text / Text Box widgets do not have a Rich Text field nor is there a Rich Text Block widget option in the Palette list. If you are setting up a blueprint, can you list the setup steps so that my blueprint will match yours? Or if you’re using code, please provide the code setup including the types of classes you’re creating (UserWidget, RichTextBlock, etc).

Hey inkey-

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will follow up.

Cheers

Sorry for late reply.
I can’t reply back since last week is our country’s hollyday.

I think before you reproduce my issue, you need to unlock engine feature.

In “RichTextBlock.h” line 14, you can find “UCLASS(Experimental)”.
(whole path is Engine/Source/Runtime/UMG/Public/Components/RichTextBlock.h)

To use this feature, you must remove or change this line
(In my case, change it to "UCLASS(meta = (DisplayName = “RichText”)) )

And then, you can find “RichText” In Palette of UMG blueprint.

In know that Experimental feature is not official feature, but I report this issue since TryConvertShortPackagePathToLongInObjectPath() is not just Experimental feature.

Thank you

Inkey

Since you are reporting an issue with TryConvertShortPackagePathToLongInObjectPath(), are you able to reproduce it using a widget other than RichTextBlock? If so, please let me know what widget you’re using and how you’re setting it up. If you’re changing source code then it is possible that these changes are having an affect on the outcome you’re seeing. This is why it’s important that we can reproduce the issue with a non-edited engine.

I don’t know another reproduce method, But I found that that function is used by other functions.

And I think I’m not “changing” engine source, just “using” experimental engine feature. (change engine source only to use already exist RichTextBlock)

If you think that problem is not important since I change engine source, that’s ok. As I mentioned, I can use it just typing font asset name like “FontName.FontName”.

Thank you

Inkey

To test this behavior further, I made the change to URichTextBlock’s UCLASS() macro as you suggested and added an instance of Rich Text to a widget blueprint. From here I added text to the Content->Text section of the details panel. Can you explain what your next steps is after this point? How are you setting up the RichText widget? When you say that you’re ‘using RichtextBlockWidget’ can you explain exactly what you’re doing?

  1. Just type [span font=“MyFontName”]MyText[/] (You Must change “[]” to “<>”) In Content->Text variable.
  2. Make break point in FPackageName::TryConvertShortPackagePathToLongInObjectPath()
  3. Press “Compile” Button in your widget blueprint.
  4. And then you can find “ConvertedObjectPath” variable is “MyFontName.” (our expected result is “MyFontName.MyFontName”)

Hey inkey-

Sorry for the delayed response. I still have not been able to reproduce the behavior you describe. Would it be possible for you to provide a small sample project showing your issue to help me see exactly what’s happening locally and/or use as a reference for a bug report?

this is an example of RichTextBlock simillar to my project.

(All font name of this example is “Roboto” because unreal only provide “Roboto” font)

Issued part I told is last line of this example.

Is it helpful?

Inkey.

Hey inkey-

Sorry for replying late. I have been investigating this and am still unable to find Rich Text to add to a widget locally. The only reference I found to Rich Text was as an option when creating a new class. Is this an option for you in a new project when creating a widget? If not, please indicate how you are gaining access to Rich Text inside your widget. Additionally, if you have a small project that shows the behavior you’re experiencing, please provide that as well to help test the issue on my end.

I miss one thing,

this is the way how to use RichTextBlock I told before

I think before you reproduce my issue, you need to unlock engine feature.

In “RichTextBlock.h” line 14, you can find “UCLASS(Experimental)”. (whole path is Engine/Source/Runtime/UMG/Public/Components/RichTextBlock.h)

To use this feature, you must remove or change this line (In my case, change it to "UCLASS(meta = (DisplayName = “RichText”)) )

In addition, you need to include “RichTextBlock.h” header in “UMG.h”
(Engine/Source/Runtime/UMG/Public/UMG.h)

And then, you can find “RichText” In Palette of UMG blueprint.

I can’t provide you some project since our company’s security policy, Sorry for that.

Hey inkey-

After speaking with other developers I learned that the RichTextBlock code is not supported (thus being experimental). While the code can be used (by editing the source code as you mentioned), doing so is at at your own risk.

Cheers

Hello

I already mentions RichTextBlock is experimental feature at january 31 hh…

I just worried that function is not only used by RichTextblock but also another features.

But, I can’t exactely tell you another usage of this function, so I think it is time to finish talk about that.

Thank you

Inkey