// You can override methods here to change the plug-in behavior on
        // loading and shut down, add options pages to the Rhino _Option command
        // and mantain plug-in wide options in a document.

        protected override LoadReturnCode OnLoad(ref string errorMessage)
        {
            base.OnLoad(ref errorMessage);

            RenderContent.RegisterContent(this);

            return(LoadReturnCode.Success);
        }
Exemple #2
0
        protected override LoadReturnCode OnLoad(ref string errorMessage)
        {
            RhinoApp.Initialized += RhinoApp_Initialized;
            RcCore.It.InitializeResourceManager();

            // code got moved to separate DLL so use that to register from.
            var rccoreass = typeof(RcCore).Assembly;

            RenderContent.RegisterContent(rccoreass, Id);

            RenderContent.ContentFieldChanged += RenderContentOnContentFieldChanged;

            var path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? "";

            RcCore.It.PluginPath = path;
            var kernelPath = Path.Combine(path, "RhinoCycles");

            RcCore.It.KernelPath = kernelPath;
            var appPath = Path.GetDirectoryName(Assembly.GetCallingAssembly().Location);

            RcCore.It.AppPath            = appPath;
            kernelPath                   = RcCore.GetRelativePath(appPath, kernelPath);
            RcCore.It.KernelPathRelative = kernelPath;

            var dataPath = SettingsDirectory;
            var userPath = Path.Combine(dataPath, "..", "data");

            userPath = RcCore.GetCanonicalizedPath(userPath);

            RcCore.It.DataUserPath = userPath;

            CSycles.path_init(RcCore.It.KernelPath, RcCore.It.DataUserPath);

            if (RhinoApp.RunningOnVMWare())
            {
                CSycles.debug_set_opencl_device_type(0);
            }
            else
            {
                CSycles.debug_set_opencl_device_type(RcCore.It.EngineSettings.OpenClDeviceType);
            }
            CSycles.debug_set_opencl_kernel(RcCore.It.EngineSettings.OpenClKernelType);
            CSycles.debug_set_opencl_single_program(RcCore.It.EngineSettings.OpenClSingleProgram);
            CSycles.debug_set_cpu_kernel(RcCore.It.EngineSettings.CPUSplitKernel);

            RcCore.It.Initialised = false;
            AsyncInitialise();

            m_page = new ViewportPropertiesPage();

            RhinoView.SetActive += RhinoView_SetActive;

            return(LoadReturnCode.Success);
        }
        protected override Rhino.PlugIns.LoadReturnCode OnLoad(ref string errorMessage)
        {
            // Tell Rhino about our custom render content
            RenderContent.RegisterContent(this);
            RealtimeDisplayMode.RegisterDisplayModes(this);
            //Rhino.Render.IOPlugIn.RegisterContentIo(this.Assembly, this.Id);

            // Tell Rhino about our custom mesh provider
            CustomRenderMeshProvider2.RegisterProviders(GetType().Assembly, Id);

            RhinoDoc.NewDocument += g_rhino_doc_new_doc;

            return(Rhino.PlugIns.LoadReturnCode.Success);
        }
        protected override LoadReturnCode OnLoad(ref string errorMessage)
        {
            RenderContent.RegisterContent(this);
            var pluginPath = Assembly.GetExecutingAssembly().Location;

            MitsubaSettings.ApplicationPath = Path.GetDirectoryName(pluginPath);
            MitsubaSettings.MitsubaPath     = Path.Combine(MitsubaSettings.ApplicationPath, "Mitsuba\\mtsgui.exe");

            var docFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            MitsubaSettings.WorkingDirectory = Path.Combine(docFolder, "Mitsuba");

            if (!Directory.Exists(MitsubaSettings.WorkingDirectory))
            {
                Directory.CreateDirectory(MitsubaSettings.WorkingDirectory);
            }

            return(base.OnLoad(ref errorMessage));
        }