reach present values of viewport objects from Widget Blueprint

Hey,

is it possible to reach mesh data in viewport from a Widget Blueprint script? I’ll give you a simple example to explain my problem: I have three cubes (static mesh actors) in the viewport and through a User Interface (another widget) I choose color on them. Now I want to save the information from the operations in an array and I only want the present value of each cube (if I choose color 3 times on cube 1 I only want to save the last color choice). It’s kind of a text based print screen operation I wanna do, just take the present value of all meshes in the viewport. So, the biggest problem is to reach these kind of values (in this case the mesh colors), does anyone have an idea?

Thanks in advance!

If you get a reference to each Cube you can access all of it Properties.

Either that or just save the last chosen color that was selected through the Widget, you wouldnt even need to query the Cube, though this method wouldnt account for any other external changes made.

Just create a variable for the colour of them, when you are changing the colour, set that variable.

Thanks for your answers! Sounds like possible solutions, but the main problem is to actually reach the color reference/variable. It sets in Level BP, but i wanna control it in my Widget BP. I assume the Cast Function could be useful, but so far I haven’t figured out how that function work in this case.

@DevilsD, which function do I use to get all properties for the mesh? I can reach its material, but not the color vector.

Your Material you use needs to expose a Vector Parameter, which for example can be accessed and changed during runtime with a Dynamic Material Instance.

Accessing all properties is just a figure of speech when talking about having a reference to an Object. You gain the ability to query any publicly accessible information about that Object.

The operation i want to do is to get the parameter values in the red square (R,G,B,A). I have a lot of meshes, and each mesh has a material instance with a color vector and that vector I’m trying to reach. The screenshot is taken during game mode and when I press Stop the value of the vector will be set back to zero, so I assume that I need to cast to viewport or something but i’m kind of out of ideas.

Right now I loop through all meshes visible in viewport, get the material of each mesh and my goal is also to get the color vector value for each mesh, but that’s what I have problem with (marked with a circle in the picture below). Everything executes when I press a button in game mode. In this script I cast to another widget (where the actual Dynamic Material Instance is created) and I’ve tried to get the color vector values from there, but without success…

Use some print string nodes to debug your code. Although it seems rather messy and over complicated it should be working.

Make sure that you have set your Parameter Names correctly, they are case sensitive, double check that the Params in your Material/s are correct as well.