Fix trial version in Unity 2017

This commit is contained in:
2018-01-03 02:17:07 +07:00
parent 937e1807bc
commit fbe1fc811e
2 changed files with 35 additions and 10 deletions

View File

@@ -1,3 +1,7 @@
###### Version 1.3.11
* Fix trial version in Unity 2017
* Fix warnings in Unity 2017
###### Version 1.3.10 ###### Version 1.3.10
* Fix (conversion error: 'Error: scaleSelection: Argument number 1 is invalid.') * Fix (conversion error: 'Error: scaleSelection: Argument number 1 is invalid.')
* Fix (Parsing swf error: Failed to read past end of stream) * Fix (Parsing swf error: Failed to read past end of stream)

View File

@@ -111,6 +111,24 @@ namespace FTEditor.Editors {
-10.0f); -10.0f);
} }
static Camera GetCameraFromPreviewUtils(PreviewRenderUtility previewUtils) {
var cameraField = previewUtils.GetType().GetField("m_Camera");
var cameraFieldValue = cameraField != null
? cameraField.GetValue(previewUtils) as Camera
: null;
if ( cameraFieldValue ) {
return cameraFieldValue;
}
var cameraProperty = previewUtils.GetType().GetProperty("camera");
var cameraPropertyValue = cameraProperty != null
? cameraProperty.GetValue(previewUtils, null) as Camera
: null;
if ( cameraPropertyValue ) {
return cameraPropertyValue;
}
return null;
}
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
// //
// Functions // Functions
@@ -184,17 +202,20 @@ namespace FTEditor.Editors {
_matPropBlock.SetTexture("_AlphaTex", Texture2D.whiteTexture); _matPropBlock.SetTexture("_AlphaTex", Texture2D.whiteTexture);
_matPropBlock.SetFloat("_ExternalAlpha", 0.0f); _matPropBlock.SetFloat("_ExternalAlpha", 0.0f);
} }
ConfigureCameraForSequence(_previewUtils.m_Camera, targetSequence); var camera = GetCameraFromPreviewUtils(_previewUtils);
var frame = targetFrame; if ( camera ) {
for ( var i = 0; i < frame.Materials.Length; ++i ) { ConfigureCameraForSequence(camera, targetSequence);
_previewUtils.DrawMesh( var frame = targetFrame;
frame.CachedMesh, for ( var i = 0; i < frame.Materials.Length; ++i ) {
Matrix4x4.identity, _previewUtils.DrawMesh(
frame.Materials[i], frame.CachedMesh,
i, Matrix4x4.identity,
_matPropBlock); frame.Materials[i],
i,
_matPropBlock);
}
camera.Render();
} }
_previewUtils.m_Camera.Render();
} }
_previewUtils.EndAndDrawPreview(r); _previewUtils.EndAndDrawPreview(r);
} }