x

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"

Can't get valid IPropertyHandle for Child Uproperty

I have a Details Customization that uses a Custom Slated widget to render inline a selected item in one of it's arrays. The Slate widget takes the DetailLayout as a parameter. I'm able to get the property handle for the selected item in the array however when I try to use GetChildHandle on the handle it fails to return the property on the selected object.

Stepping through the code it seems there are no child nodes thous it ends up returning null.

Here Code I'm using


  TSharedPtr ObjectiveHandle = DetailLayout.GetProperty(GET_MEMBER_NAME_CHECKED(UQuest, Objectives))->AsArray();
  if(!ObjectiveHandle.IsValid())
  {
    return;
  }
  AmountHandle = ObjectiveHandle->GetElement(ObjectiveIndex);
  if(!AmountHandle.IsValid() || !AmountHandle->IsValidHandle())
  {
    return;
  }
  //now we can grab the amount handle.
  AmountHandle = AmountHandle->GetChildHandle(TEXT("Amount"));
    
When i just use the Objective Object I get and generate it's widget instead I get like an instance browser fro it.

I'm not sure if this is the way to go or could I possible use the Normal UObject based Objective Class to get a property handle to the amount UProperty I haven't been find code that does this.

Product Version: UE 4.8
Tags:
more ▼

asked Jul 20 '15 at 04:05 PM in C++ Programming

avatar image

dormlock
78 6 8 11

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

1 answer: sort voted first

I'm not sure if this is the same problem, but sometimes IPropertyHandle::GetChildHandle does not work for me either. There are two solutions which I have come across:

 // 1. Use DetailLayout instead of the original property handle
 DetailLayout.GetProperty(FName("PropertyName"), UBaseClass::StaticClass());
 
 // 2. Iterate through properties instead of name lookup
 uint32 NumElements;
 ItemHandle->GetNumChildren(NumElements);
 for (uint32 ElemIndex = 0; ElemIndex < NumElements; ElemIndex++)
 {
 auto ElemHandle = ItemHandle->GetChildHandle(ElemIndex);
 if (ElemHandle->GetProperty()->GetFName() == GET_MEMBER_NAME_CHECKED(UBaseClass, PropertyName))
     { /* do stuff */ }
 }

Source for solution #1

more ▼

answered Jul 30 '15 at 07:36 AM

avatar image

fed0r
623 21 27 163

(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