浏览代码

Merge branch 'kgdev' into 'master'

make sure texture/rendertexture/material has hideflags as HideAndDontSave.

See merge request upm-packages/ui-widgets/com.unity.uiwidgets!7
/main
Fan Zhang 6 年前
当前提交
13375925
共有 8 个文件被更改,包括 50 次插入16 次删除
  1. 8
      Runtime/debugger/inspector_treeview.cs
  2. 18
      Runtime/editor/surface.cs
  3. 1
      Runtime/flow/raster_cache.cs
  4. 32
      Runtime/ui/painting/canvas_impl.cs
  5. 1
      Runtime/ui/painting/codec.cs
  6. 1
      Runtime/ui/painting/codec_gif.cs
  7. 1
      Tests/Editor/CanvasAndLayers.cs
  8. 4
      Tests/Editor/Widgets.cs

8
Runtime/debugger/inspector_treeview.cs


public static int GetIntProperty(Dictionary<string, object> properties, string name)
{
object val;
properties.TryGetValue(name, out val);
object val = null;
if (properties != null) {
properties.TryGetValue(name, out val);
}
if (val == null)
{
return -1;

18
Runtime/editor/surface.cs


}
_guiTextureMat = new Material(guiTextureShader);
_guiTextureMat.hideFlags = HideFlags.HideAndDontSave;
return _guiTextureMat;
}

void _createOrUpdateRenderTexture(Size size, double devicePixelRatio) {
if (this._surface != null
&& this._surface.size == size
&& this._surface.devicePixelRatio == devicePixelRatio) {
&& this._surface.devicePixelRatio == devicePixelRatio
&& this._surface.getRenderTexture() != null) {
return;
}

}
this._renderTexture = new RenderTexture(desc);
this._renderTexture.hideFlags = HideFlags.HideAndDontSave;
D.assert(this._renderTexture);
this._renderTexture = ObjectUtils.SafeDestroy(this._renderTexture);
D.assert(this._canvas != null);
this._canvas = null;
if (this._renderTexture) {
this._renderTexture = ObjectUtils.SafeDestroy(this._renderTexture);
}
if (this._canvas != null) {
this._canvas.reset();
this._canvas = null;
}
}
}
}

1
Runtime/flow/raster_cache.cs


};
var renderTexture = new RenderTexture(desc);
renderTexture.hideFlags = HideFlags.HideAndDontSave;
var canvas = new CommandBufferCanvas(renderTexture, devicePixelRatio);
canvas.translate((float) -bounds.left, (float) -bounds.top);

32
Runtime/ui/painting/canvas_impl.cs


}
mat = new Material(canvasShader);
mat.hideFlags = HideFlags.HideAndDontSave;
_materials[op] = mat;
if (op == BlendMode.srcOver) {

}
public void reset() {
foreach (var layer in this._layers) {
this._clearLayer(layer);
}
var bounds = Rect.fromLTWH(0, 0,
this._renderTexture.width / this._devicePixelRatio,
this._renderTexture.height / this._devicePixelRatio);
this._layers.Clear();
this._layers.Add(
new RenderLayer {
RenderLayer firstLayer;
if (this._layers.Count == 0) {
var bounds = Rect.fromLTWH(0, 0,
this._renderTexture.width / this._devicePixelRatio,
this._renderTexture.height / this._devicePixelRatio);
firstLayer = new RenderLayer {
}
);
};
} else {
D.assert(this._layers.Count > 0);
firstLayer = this._layers[0];
firstLayer = new RenderLayer {
width = firstLayer.width,
height = firstLayer.height,
layerBounds = firstLayer.layerBounds,
};
}
this._layers.Clear();
this._layers.Add(firstLayer);
}
void _drawLayer(RenderLayer layer, CommandBuffer cmdBuf) {

1
Runtime/ui/painting/codec.cs


}
var texture = new Texture2D(2, 2);
texture.hideFlags = HideFlags.HideAndDontSave;
texture.LoadImage(bytes);
return Promise<Codec>.Resolved(new ImageCodec(new Image(texture)));
}

1
Runtime/ui/painting/codec_gif.cs


}
var tex = new Texture2D(this._width, this._height, TextureFormat.BGRA32, false);
tex.hideFlags = HideFlags.HideAndDontSave;
tex.LoadRawTextureData(frameData.gifFrame.bytes);
tex.Apply();

1
Tests/Editor/CanvasAndLayers.cs


}
_guiTextureMat = new Material(guiTextureShader);
_guiTextureMat.hideFlags = HideFlags.HideAndDontSave;
return _guiTextureMat;
}

4
Tests/Editor/Widgets.cs


var rootWidget = this.loadAsset();
this.windowAdapter.attachRootWidget(rootWidget);
}
if (GUILayout.Button("UnloadUnusedAssets")) {
Resources.UnloadUnusedAssets();
}
}
else if (selected != this._selected || !this.hasInvoked) {
this._selected = selected;

正在加载...
取消
保存