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"

Get material parameter parent group

I would like to at runtime in blueprints to get the name of any given material parameter(s) parent group, is that possible?

Example below, I would like the string "Variant" from the parameter "Blackwash Color". I already know how to get/set material parameters and that works great, I want to make some UI based off of the group.

alt text

Product Version: UE 4.21
Tags:
capture.png (16.1 kB)
more ▼

asked Nov 12 '18 at 06:00 PM in Blueprint Scripting

avatar image

Nogbit
31 18 13 18

avatar image Nogbit Nov 15 '18 at 01:54 PM
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I'll answer my own question. Below is the custom C++ needed to expose this data in a crude way back to blueprints, it works, but there is nothing native in blueprints right now to get a parameter group.

.cpp

 FString UFullMaterialProperties::GetMaterialInstanceProperties(UMaterialInstanceDynamic * Material)
 {
     FString result;
     for (FVectorParameterValue param : Material->VectorParameterValues)
     {                
         FName group;
         Material->GetGroupName(param.ParameterInfo, group);
         result.Append(param.ParameterInfo.Name.ToString());
         result.Append(":");
         result.Append(group.ToString());
     }
     return result;
 }


.h

 UCLASS()
 class UFullMaterialProperties : public UBlueprintFunctionLibrary
 {
     GENERATED_BODY()
 
     UFUNCTION(BlueprintCallable, Category = "AAAMatProps")
     static FString GetMaterialInstanceProperties(UMaterialInstanceDynamic* Material);
 };


Then use this in your blueprint. You create a dynamic material instance and copy all the properties, if you dont copy the properties then it wont pick up the groups.

alt text

capture.png (147.1 kB)
more ▼

answered Nov 18 '18 at 04:40 PM

avatar image

Nogbit
31 18 13 18

(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