static bool OnSave(int serial_number, IntPtr filename, IntPtr content_ptr, IntPtr scene_server_ptr) { try { IOPlugIn io = IOPlugIn.FromSerialNumber(serial_number) as IOPlugIn; RenderContent content = RenderContent.FromPointer(content_ptr); CreatePreviewEventArgs pc = null; if (scene_server_ptr != IntPtr.Zero) { pc = new CreatePreviewEventArgs(scene_server_ptr, new System.Drawing.Size(100, 100), PreviewSceneQuality.RefineThirdPass); } if (io != null && content != null) { string _filename = Marshal.PtrToStringUni(filename); return(io.Save(_filename, content, pc)); } } catch { } return(false); }
static void OnDeleteThis(int serial_number) { try { IOPlugIn io = IOPlugIn.FromSerialNumber(serial_number) as IOPlugIn; if (io != null) { io.Destroy(); } } catch { } }
static void OnGetRenderContentIoString(int serial_number, bool local, IntPtr pON_wString) { try { IOPlugIn io = IOPlugIn.FromSerialNumber(serial_number) as IOPlugIn; if (io != null) { string str = local ? io.LocalDescription : io.EnglishDescription; if (!string.IsNullOrEmpty(str)) { UnsafeNativeMethods.ON_wString_Set(pON_wString, str); } } } catch (Exception ex) { Rhino.Runtime.HostUtils.ExceptionReport(ex); } }
static int OnLoad(int serial_number, IntPtr filename) { try { IOPlugIn io = IOPlugIn.FromSerialNumber(serial_number) as IOPlugIn; if (io != null) { string _filename = Marshal.PtrToStringUni(filename); RenderContent content = io.Load(_filename); if (content != null) { return(content.m_runtime_serial_number); } } } catch { } return(0); }