/// <summary> /// Initializes a new instance of the <see cref="AssetEditor" /> class. /// </summary> /// <param name="assetManagerFactory">The asset manager factory.</param> /// <param name="viewFactory">The view factory.</param> /// <param name="drawerFactory">The drawer factory.</param> /// <param name="paletFactory">The palet factory.</param> /// <param name="previewBarFactory">The preview bar factory.</param> /// <param name="fileLocationProvider">The file location provider.</param> public AssetEditor( AssetManagerFactory assetManagerFactory, ViewFactory viewFactory, DrawerFactory drawerFactory, PaletFactory paletFactory, PreviewBarFactory previewBarFactory, FileLocationProvider fileLocationProvider) { this.InitializeComponent(); this.viewFactory = viewFactory; this.drawerFactory = drawerFactory; this.paletFactory = paletFactory; this.previewBarFactory = previewBarFactory; this.fileLocationProvider = fileLocationProvider; this.assetManager = assetManagerFactory.Get(this.fileLocationProvider.AssetFile, false); this.palet = this.paletFactory.Get(this.PaletPanel); this.drawer = this.drawerFactory.Get(this.DrawerPanel); this.previewBar = this.previewBarFactory.Get(this.PreviewBar); this.ButtonSize.Value = Settings.Default.ZoomLevel; // Event handler setup must precede loading assets but happen after the asset manager is created this.SetupEventHandlers(); // Load assets and trigger events. this.assetManager.LoadAssets(); if (this.assetManager.CurrentAsset != null) { this.previewBar.Draw(this.assetManager.CurrentAsset.Shapes); } }
public static void PermissionButton(ControlsLib.ButtonsArray btnControl, PreviewBar _preview) { //if(_preview!=null) //_preview.Visible = _excel; //if (btnControl.ButtonModifyVisible) //btnControl.ButtonModifyVisible = _update; //if (btnControl.ButtonPrintVisible) //btnControl.ButtonPrintVisible = _print; }
private void doInitPreview(int iOption) { int old_wrong_index = this.tabControl1.SelectedTabIndex; int new_right_index = init_preview_index; // new_right_index 是从1 开始的下标。 string strTabIndex = "[" + new_right_index.ToString() + "]"; if (Program.EngineDir.Trim().Length <= 0) { if (!m_bWarning3dEngine) { m_bWarning3dEngine = true; MessageBox.Show("3DEngine 路径为空,不能正常打开预览窗口", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); } return; } string strdir = ""; if (Program.EngineDir.Substring(Program.EngineDir.Length - 1) != "\\") { strdir = Program.EngineDir + "\\"; } else { strdir = Program.EngineDir; } if (m_3DEngie == null) { bool bSuc = Helper.RegComDll("atlax.dll"); m_3DEngie = new Test3DEngine(); if (m_3DEngie == null) { MessageBox.Show("3D Engine 初始化失败!m_3DEngie = null。"); return; } m_3DEngie.Init((int)(preview_panels[new_right_index - 1].Handle), Program.EngineDir, Application.StartupPath); // 传给mainform, 让它关闭时uninit 引擎。 ((MainForm)ParentForm).K3DEngine = m_3DEngie; string content = string.Format(@" RegComDll: {0} m_3DEngie: {1} EngineDir: {2} Engine: {3} Enginenull:{4} ", bSuc, m_3DEngie, strdir, m_3DEngie, m_3DEngie == null?"null":"not null"); FileFolderHelper.StringToFile(content, Application.StartupPath + "/GameDesignerTools.log"); } m_lua["EngineDir"] = strdir; m_lua["Engine"] = m_3DEngie; int count; m_3DEngie.GetEditorSceneCount(ModelName + strTabIndex, out count); if (count > 0) { return; } m_3DEngie.AddScene((int)preview_panels[new_right_index - 1].Handle, ModelName + strTabIndex, iOption); //string DirName = strdir; //string PlayerName = DirName + "\\Data\\public\\PlayerCheckTool\\Male\\Normal\\M2.mdl"; //string AniFileName = DirName + "\\data\\source\\player\\M2\\动作\\M2b04ty空手普通待机.ani"; //m_3DEngie.LoadPlayerModel(PlayerName); //m_3DEngie.LoadAni(AniFileName, 1); this.SetTmrRenderInterval(Program.m_3d_tmrRender); tmrRender.Enabled = true; PreviewBar.Visible = true; PreviewBar.RecalcLayout(); this.ResumeLayout(); }