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"

How to access UProperty (meta) from an UObject class?

I've tried to search, read source, but can't wrap my head around.

 class SomeClassA : public UObject
 UPROPERTY(config, meta = (UIMin = "1", UIMax = "8", ClampMin = "1", ClampMax = "8"))
 int32 VariableA;

 class SomeClassB : public UObject
 GetMutableDefault<SomeClassA>()->VariableA = VariableB;

Now, I want to make sure that VaribleA still in the range, how to reference the ClampMin/ClampMax values?

I've found


And it seems does what I want, but have no clue how to access it from my class.

I should say that I'm not looking for:

Product Version: Not Selected
more ▼

asked Jul 25 '17 at 02:30 PM in C++ Programming

avatar image

1.3k 27 22 40

avatar image kamrann Jul 28 '17 at 12:10 PM

If you're not looking for the metadata, what do you want? An existing function that will clamp a value based on that, without having to rewrite it yourself?

It would be useful to know in what context you are assigning the new value. Presumably it's part of an editor module? What triggers it?

avatar image S-ed Jul 29 '17 at 08:09 AM

Yep. An existing function that would clip it. The value is a part of editor module. It is triggered by a function that called on Tick (may be triggered, in some particular case). It is working as part of the main editor viewport loop.

Probably, title with "FPropertyHandleInt" would make more sense, but I'm not sure if FPropertyHandleInt is what I'm looking for.

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

From what I can see there is no such reusable function available. The clamping metadata is apparently intended just for the UI input stage (there is no metadata in a packaged build after all).

The only two places I could see in the engine code that used it to clamp were when setting up a a widget for the property (not applicable to your case) and in the property handle implementation. Property handles are also used specifically within the details panel/property editor code. I've looked into creating one myself before as they have some useful functionality, but I gave up; they're just buried very deep in non-exposed code and it's pretty clear they're not intended to be created outside of that area of the engine code.

If you want to use those values, I think you'll need to extract them yourself with the function you mentioned, convert (see TTypeToString< int32 >::FromString) and then clamp.

more ▼

answered Jul 29 '17 at 10:11 AM

avatar image

2k 81 26 117

(comments are locked)
10|2000 characters needed characters left
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