public async System.Threading.Tasks.Task SetObjectToEdit(ResourceEditorContext context)
        {
            await mPreviewSceneControl.Initialize(EngineNS.RName.GetRName("MaterialInstanceEditorViewport"));

            mViewPortInited = false;
            ProGrid_PreviewScene.Instance = mPreviewSceneControl;
            await InitViewPort(mPreviewSceneControl.ViewPort);

            mCurrentContext = context;
            var rc = EngineNS.CEngine.Instance.RenderContext;

            mCurrentMaterialInstance = await EngineNS.CEngine.Instance.MaterialInstanceManager.GetMaterialInstanceAsync(rc, mCurrentContext.ResInfo.ResourceName);

            mPreviewMaterialInstance = EngineNS.CEngine.Instance.MaterialInstanceManager.NewMaterialInstance(rc, mCurrentMaterialInstance.Material);
            mCurrentMaterialInstance.SetDataToMaterialInstance(mPreviewMaterialInstance);
            if (mMeshComponent != null)
            {
                for (int i = 0; i < mMeshComponent.MaterialNumber; i++)
                {
                    await mMeshComponent.SetMaterialInstanceAsync(rc, (uint)i, mPreviewMaterialInstance, null);
                }
            }

            var showValue = new ResourceInfos.MaterialInstanceResourceInfo.MaterialInstanceEditProperty(this);

            showValue.SetMaterialInstance(mPreviewMaterialInstance);
            var matInsResInfo = mCurrentContext.ResInfo as ResourceInfos.MaterialInstanceResourceInfo;

            if (matInsResInfo != null)
            {
                matInsResInfo.ReferenceRNameList.Remove(matInsResInfo.ParentMaterialRName);
                matInsResInfo.ParentMaterialRName = showValue.MaterialSourceName;
                matInsResInfo.ReferenceRNameList.Add(matInsResInfo.ParentMaterialRName);
            }

            SetBinding(TitleProperty, new Binding("ResourceName")
            {
                Source = context.ResInfo, Converter = new EditorCommon.Converter.RNameConverter_PureName()
            });
            IconBrush        = context.ResInfo.ResourceTypeBrush;
            ProGrid.Instance = showValue;
            UpdateUndoRedoKey();

            InitBlendStateDesc(true);

            //await EngineNS.CEngine.Instance.EventPoster.YieldTo(EngineNS.Thread.EAsyncContinueType.YieldSync);
            mCurrentContext.ResInfo.IsDirty = false;
        }
        public async System.Threading.Tasks.Task OnResetPreviewMaterialParentMaterial(ResourceInfos.MaterialInstanceResourceInfo.MaterialInstanceEditProperty miep, EngineNS.RName newValue)
        {
            var rc  = EngineNS.CEngine.Instance.RenderContext;
            var mat = await EngineNS.CEngine.Instance.MaterialManager.GetMaterialAsync(rc, newValue);

            mPreviewMaterialInstance.NewMaterialInstance(rc, mat, mPreviewMaterialInstance.Name);
            mPreviewMaterialInstance.ResetValuesFromMaterial(mat);
            miep.SetMaterialInstance(mPreviewMaterialInstance);

            ProGrid.Instance = null;
            ProGrid.Instance = miep;
            if (mMeshComponent != null)
            {
                for (int i = 0; i < mMeshComponent.MaterialNumber; i++)
                {
                    await mMeshComponent.SetMaterialInstanceAsync(rc, (uint)i, mPreviewMaterialInstance, null);
                }
            }
        }