Download

BP - slide bar change materials on static mesh

I agree about everything Charlie said. It’s like he took the words out of my mouth.

Thank you for your reply.

i think it will be better to choose material in the widget, because we can easily apply that script for more painting in the future. For each painting could be their own widget with different material. We think about the specific need for material as u asked for, we plan that material will always contain one “base” texture - empty old paper texture, and second painting progress we can create material with two texture and param - alpha to cover each layer, we already create that material for each phase of painting, so in final u will have Bp contain two widget (slider - switch between years - every year different texture, slider - opacity of material - 2 texture with alpha channel) and model (model is same for every year, didnt change. We dont need any transitions between material change just normal swap. Every year is just one texture to change, not more, so every year has his own one texture(material).

Thank you so much for helping me with this.

Best.
C.

Not sure if I got it right, but it seems to be somewhat similar to the thing in the other thread:

In short:

  • actor with a widget component
  • the widget creates a Material Instance Dynamic and sets it on the owning actor’s static mesh via a single dispatcher call
  • slider updates the texture in the material

Image from Gyazo

Hope that’s close enough. Do tell if there’s anything confusing here or I completely missed the mark! I can zip the project and push it your way if that’s of any help all.

How you achieve the frame is probably better left to an artist, though:

Good luck!

Its look like it perfect fits for my project, amazing work, thank you so much for your help. , i will try to test it today. First question is about yearRange in code it looks like that you use float range for this? how is it possible that u use in blueprint as green year range x and y?

Thank you so much for your reply

It’s IntPoint, 2 integers in a little cute :broken_heart: struct:

image

Useful when you deal with pixels or coordinates in a board game.

You can just use 2 ints normally.

thanks you, i think i understand this tool now and purpose of it, but i cant connect it to + in BP. Last questions is about second slidebar with oppacity level with ''base" texture - i cant connect it together in one blueprint because its similar casts, i think i need to code funcionality of this slider in widget not in BP am i right? I found this slider to change alpha channel also in your topic.

There should be no need to cast whatsoever, not for this.

Since it’s the slider that changes the opacity, it makes more sense to send this value to the material there, the material is created in the widget after all. At least in the example I sent.

Not sure what you’re up to here. It seems you’re continuing working on something you started previously, so those 2 approaches will most likely clash a bit here and there.

Make a choice and stick with it:

  • create the material in the actor and receive notification from the widget (what you’re doing now)
  • or do everything in the widget, does the actor really needs to know it all? In this instance the actor’s job is to hold on to the static mesh displaying a material, while the controls are in the widget.

I followed the logic you requested:

i think it will be better to choose material in the widget, because we can easily apply that script for more painting in the future.

yes, the first choice is more suitable for us i think, can you describe me please process how to connect year range to BP as year range x and y?

And help me with the integration of second slider in this BP? This will be a last thing what i need to solve.

I am really glad that you help me with that, you helped me a lot with this part of my project.

thank you again for your time what u spent on this topic.

best
C.

can you describe me please process how to connect year range to BP as year range x and y?

  • the slider spits out values between 0-3 (4 elements in the array - this is set up onConstruct)

image

  • years are as requested:

to our gallery from 3 (1987-1990) years

The Year Range is 4 years, not 3 - 1987, 1988, 1989 & 1990. We add the first Year Range X and the slider value together. This is then sent to the text block.


The script in your post looks fine:

Ensure the param names are matching. If one slider works (we can’t see how you hooked it up) but the other one does not, you’ll need to provide more details regarding the setup.

Choose 1 method and stick with it. Either do it all in the widget or all in the actor. No need to split that script.

is it possible to share your project? Maybe i will understand more funkcionality after i will look in. I will try today set all things up and hope i understand it well, thank you for your time and your patience.

No problem:

it work great now thank you one time, so now i have last question about second slider, it is possible and if how i can integrate second (opacity) slider to this one what i already have, i could have in one widget everything right thats what you said that i need to choose how i want to do it in widget or in BP.

I already create second slider but have no idea if i need to use same param for material as in first case.

Thank you

Thank you

There’s nothing to integrate. Both sliders are in the same widget, just use it to send a scalar to the material:

This will need to be a different param, of course. It will look closer to this:

Am i right with the process when i add alpha param to my created material

and after that combine it with onValueChange and set - create new material. It will work like the material created in previous proces i can control with second opacity slider to get main base texture always no matter what year i have appered?

.

Depends on how it’s supposed to work. Closer to this, probably:

Not sure what you want to achieve, though. If you want to fade Emissive, your stuff looks ok.

This makes no sense. You already have the material… just use it. Now the slider is creating something like 60 materials per second.

This:

Both sliders send stuff to the same MID. There’s no need to bind anything if you decided to go with the second solution where all the controls are in the slider.

its work now when i add lerp to material is it right and clean like this?

but its working

1 Like

Thank you so so much for your help, i think its completly working now. Learn me a lot. Thank you for your time ones more.

1 Like