Jump to content
Sign in to follow this  
xjoker_

Problem SetObjectTexture + slider

Recommended Posts

Hello guys, 

 

As you can see on this video : 

 

I'm changing the vehicle's color by editing the R-G-B values and calling setObjectTexture with it.

When I change the Green value, it works fine, the change is smooth. 

But when I change the Red et Blue values, we can see an unexpected transition between the old color and the new. 

The final color is good, the script works, but it s not nice to watch. 

 

Have you any idea on why it's doing this ? Do you think I can do something about it whereas i'm not doing anything special but using setObjectTexture ?

_part = lbCurSel (_disp displayCtrl 1704);
_R = sliderPosition (_disp displayCtrl 1705);
_G = sliderPosition (_disp displayCtrl 1706);
_B = sliderPosition (_disp displayCtrl 1707);
target setObjectTexture [_part,format["#(argb,8,8,3)color(%1,%2,%3,1)",_R,_G,_B]];

 

Share this post


Link to post
Share on other sites

Have you tried adding a delay between each setObjectTexture command? Perhaps a 0.01 second sleep would resolve this issue.

Share this post


Link to post
Share on other sites
On 10/08/2017 at 6:16 PM, MrCopyright said:

Have you tried adding a delay between each setObjectTexture command? Perhaps a 0.01 second sleep would resolve this issue.

 

I added a small delay, the problem still happens 

Share this post


Link to post
Share on other sites

You could test ctrlCommit:

 

_part = lbCurSel (_disp displayCtrl 1704);

_R = sliderPosition (_disp displayCtrl 1705);

_G = sliderPosition (_disp displayCtrl 1706);

_B = sliderPosition (_disp displayCtrl 1707);

(_disp displayCtrl 1704) ctrlCommit 0;

target setObjectTexture [_part,format["#(argb,8,8,3)color(%1,%2,%3,1)",_R,_G,_B]];

Share this post


Link to post
Share on other sites
10 hours ago, pierremgi said:

You could test ctrlCommit:

 

_part = lbCurSel (_disp displayCtrl 1704);

_R = sliderPosition (_disp displayCtrl 1705);

_G = sliderPosition (_disp displayCtrl 1706);

_B = sliderPosition (_disp displayCtrl 1707);

(_disp displayCtrl 1704) ctrlCommit 0;

target setObjectTexture [_part,format["#(argb,8,8,3)color(%1,%2,%3,1)",_R,_G,_B]];

Doesn't need ctrlCommit for lb commands. At least most and not this one.

@xjoker_ - I just watched the video again, it looks to me like it is a speed thing? When you quickly do it, the issue sometimes happens. You could try using:

https://community.bistudio.com/wiki/sliderSetSpeed

Share this post


Link to post
Share on other sites
7 minutes ago, HazJ said:

Doesn't need ctrlCommit for lb commands. At least most and not this one.

That doesn't cost to try it. If all were clear, this kind of problem didn't occur. We are not discussing about bad script but finding any way to make it work smoothly.

Share this post


Link to post
Share on other sites

Okay but, it is pointless imo. Not sure if you saw after I edited my post or not but I shall repeat:

Quote

@xjoker_ - I just watched the video again, it looks to me like it is a speed thing? When you quickly do it, the issue sometimes happens. You could try using:

https://community.bistudio.com/wiki/sliderSetSpeed

 

Share this post


Link to post
Share on other sites

Thank you guys for your help.

I'll test more this evening but I think I found the problem.

In my event OnSliderChange, i was "spawning" the script instead of "calling" it

Share this post


Link to post
Share on other sites

Yeah, that could be an issue. Unless you clear/terminate the previous slider pos change, then it won't wait for that one to complete. I had a similar issue with ctrlMapAnimAdd in which I solved simply with ctrlMapAnimClear command.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×