public World(ShotTypeProvider typeProvider, PythonExecutor executor, int startframe, int endframe) { ShotTypeProvider = typeProvider; Executor = executor; StartFrame = startframe; EndFrame = endframe; ShotModelProvider = new ShotModelDataProvider(); PmxModel = new CurtainFireModel(this); VmdSequence = new CurtainFireSequence(this); foreach (var type in ShotTypeProvider.ShotTypeDict.Values) { type.InitWorld(this); } if (0 < StartFrame) { VmdSequence.AddPropertyKeyFrame(new VmdPropertyFrameData(0, false)); VmdSequence.AddPropertyKeyFrame(new VmdPropertyFrameData(StartFrame, true)); } ExportEvent += (sender, e) => { PmxModel.Export(e.Script, e.PmxExportPath, ExportFileName, "by CurtainFireMakerPlugin"); VmdSequence.Export(e.Script, e.VmdExportPath, ExportFileName); }; }
public void InitScriptEngine() { using (var writer = new StreamWriter(LogPath, false, Encoding.UTF8)) { SetOut(writer); try { Executor.Init(); ScriptDynamic = Executor.Engine.ExecuteFile(SettingPythonFilePath, Executor.RootScope); ShotTypeProvider.RegisterShotType(ScriptDynamic.init_shottype()); } catch (Exception e) { using (var error_writer = new StreamWriter(ErrorLogPath, false, Encoding.UTF8)) { try { error_writer.WriteLine(Executor.FormatException(e)); } catch { } error_writer.WriteLine(e); } MessageBox.Show(File.ReadAllText(ErrorLogPath), "CurtainFireMakerPlugin", MessageBoxButtons.OK, MessageBoxIcon.Error); } Console.Out.Flush(); SetOut(new StreamWriter(Console.OpenStandardOutput())); } }