Page MenuHomeFeedback Tracker

[Scripting] Using ImageWidget.SetUV() - Need Assistance / Broken?
Closed, ResolvedPublic

Description

Greetings.

I am creating a mod that will have a horizontal compass on the top center of the screen. I have an ImageWidget successfully loaded and I am trying to use ImageWidget.SetUV() to provide the UV Mapping for the image to serve as a texture on the widget as suggested by these BI code comments:

enum WidgetFlags
{
<...>
   CUSTOMUV,	//< ignores STRETCH/FLIPU/FLIPV and take custom UV set by SetWidgetUV()
<...>
}

class ImageWidget extends Widget
{
 <...>
/*!
	When WF_CUSTOMUV is set, we can supply our own UV coords instead of computed ones.
	\param uv
	Pointer to array of at least 8 floats (4 corners * 2 floats for u/v)
	*/
	proto native void SetUV(float uv[4][2]);
}

My code is as follows..

ImageWidget m_CompassImage = ImageWidget.Cast(m_Root.FindAnyWidget("CompassImage"));

float uv[4][2];

uv[0] = { 0.0, 0.0 };  // xMin, yMin				
uv[1] = { 0.0, 1.0 };  // xMin, yMax					
uv[2] = { 1.0, 1.0 };  // xMax, yMax
uv[3] = { 1.0, 0.0 };  // xMax, yMin

m_CompassImage.SetFlags(WidgetFlags.CUSTOMUV);
m_CompassImage.SetUV(uv);

With the supplied UV map above, I am trying to mirror the texture on the image widget. However, I don't get anything.

Three questions for you:

  1. Can you help me understand how to use SetUV() the proper way?
  2. Could you provide a code snippet that might illuminate it's usage?
  3. Or can you confirm that it is broken or not functional?

Any help is very much appreciated.

Thanks,
Zap - PvPEngine
(Click for YouTube Channel of Mod progress)

Details

Severity
Major
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
Modding
Steps To Reproduce

See code reference above.

Event Timeline

Apparently, it's not broken: ImageWidget.SetUV(float[8])

This can be closed. Thanks.

Geez closed this task as Resolved.Mar 27 2019, 11:51 AM
Geez claimed this task.