示例#1
0
        aepAPI.aepModule LoadModule()
        {
            foreach (var p in m_searchPaths)
            {
                aepAPI.aepAddSearchPath(p);
            }
            var mod = aepAPI.aepLoadModule(m_pluginPath.GetPath());

            return(mod);
        }
示例#2
0
        void UpdateParamList()
        {
            if (m_pluginPath == null)
            {
                return;
            }
            var mod = otpAPI.otpLoadModule(m_pluginPath.GetPath());

            if (!mod)
            {
                Debug.LogWarning("OpenToonzFx: failed to load plugin. possibly could not find dependent dlls: " + m_pluginPath.GetPath());
                ReleaseInstance();
                return;
            }

            int nplugins = otpAPI.otpGetNumPlugins(mod);

            m_pluginIndex = m_pluginIndex < nplugins ? m_pluginIndex : nplugins - 1;
            otpAPI.otpGetPluginInfo(mod, m_pluginIndex, ref m_plugin_info);

            int pi   = m_pluginIndex;
            var inst = otpAPI.otpCreateInstance(mod, pi);

            // update port list
            {
                int nports = otpAPI.otpGetNumPorts(inst);
                if (m_ports == null || m_ports.Length != nports)
                {
                    m_ports = new ToonzPort[nports];
                }

                var pinfo = default(otpAPI.otpPortInfo);
                for (int i = 0; i < nports; ++i)
                {
                    var portptr = otpAPI.otpGetPort(inst, i);
                    otpAPI.otpGetPortInfo(portptr, ref pinfo);
                    if (m_ports[i] == null || m_ports[i].name != pinfo.name)
                    {
                        m_ports[i] = new ToonzPort {
                            name = pinfo.name,
                        };
                    }
                }
            }

            // update param list
            {
                int nparams = otpAPI.otpGetNumParams(inst);
                if (m_params == null || m_params.Length != nparams)
                {
                    m_params = new ToonzParam[nparams];
                }

                var pinfo = default(otpAPI.otpParamInfo);
                for (int i = 0; i < nparams; ++i)
                {
                    var paramptr = otpAPI.otpGetParam(inst, i);
                    otpAPI.otpGetParamInfo(paramptr, ref pinfo);
                    if (m_params[i] == null || m_params[i].name != pinfo.name || m_params[i].type != pinfo.type)
                    {
                        m_params[i] = otpAPI.CreateToonzParam(paramptr);
                    }
                }
            }

            otpAPI.otpDestroyInstance(inst);
        }