private void TerrainSplattingLayerForm_Load(object sender, EventArgs e) { m_layer = new NETerrainTextureLayerProp(); m_layerIndex = 0; this.propertyGridLayer.SelectedObject = m_layer; }
void layerDialog_Update(object sender, EventArgs e) { NTerrainEditor trnEd = NLevelEditorEngine.Instance.TerrainEd; if (trnEd.Empty()) { NexusEditor.Program.ShowError("当前地形编辑器没有绑定对象."); return; } EditorMain.TerrainSplattingLayerForm dlg = sender as EditorMain.TerrainSplattingLayerForm; EditorMain.NETerrainTextureLayerProp ld = dlg.Data; if (!ld.TextureRes.IsValid()) { NexusEditor.Program.ShowError("更新图层失败:图层贴图路径为空."); return; } try { NTerrainMtlSetup mtl = trnEd.GetMaterial(); mtl.SetLayerData(dlg.LayerIndex, ld.data); this.BuildTargetList(); } catch (System.Exception ex) { NexusEditor.Program.ShowException(ex, "地形材质图层更新失败!"); } }