Download

Using get_editor_property on a DynamicMaterialInstance to get Group of parameter

I need to get the Group name that is set for each property on a Material. I’m able to do this in C++ but liking Python right now for this.

The Group name exist here in Python. I just don’t see what object I should be using get_editor_property off of. I’ve tried a few things on the TO DO line below but not having any luck.



data = {}
mesh = "/Game/....path to mesh"
asset = unreal.load_asset(mesh)

for mat in asset.materials:
  source = mat.material_interface
  dynMat = unreal.MaterialLibrary().create_dynamic_material_instance(asset, source)
  dynMat.copy_material_instance_parameters(source, True)


  for val in dynMat.vector_parameter_values:
    # to get "Group", go from parameterinfo to https://docs.unrealengine.com/en-US/PythonAPI/class/MaterialExpressionVectorParameter.html?highlight=materialexpressionparameter
    # TO DO -> get_editor_property(??????)
    if val.parameter_info.name in data:
      print("Found Dupe for " + str(val.parameter_info.name))
      data[val.parameter_info.name]"count"] += 1
    else:
      data[val.parameter_info.name] = {"value": val.parameter_value, "count": 0}