mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Nodes - Added math expression node
Node - Fix visual script cable present event unregister
This commit is contained in:
1 parent
ecdca26cd3
commit
e356d59daa
14 files changed
+290
-22
No files matched your search
@@ -0,0 +1,56 @@
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Extensions.ObjectPool;
|
||||
using Ninject.Modules;
|
||||
using NoStringEvaluating;
|
||||
using NoStringEvaluating.Contract;
|
||||
using NoStringEvaluating.Models.Values;
|
||||
using NoStringEvaluating.Services.Cache;
|
||||
using NoStringEvaluating.Services.Checking;
|
||||
using NoStringEvaluating.Services.Parsing;
|
||||
using NoStringEvaluating.Services.Parsing.NodeReaders;
|
||||
|
||||
namespace Artemis.VisualScripting.Ninject
|
||||
{
|
||||
public class NoStringNinjectModule : NinjectModule
|
||||
{
|
||||
public override void Load()
|
||||
{
|
||||
// Pooling
|
||||
Bind<ObjectPool<Stack<InternalEvaluatorValue>>>()
|
||||
.ToConstant(ObjectPool.Create<Stack<InternalEvaluatorValue>>())
|
||||
.InSingletonScope();
|
||||
|
||||
Bind<ObjectPool<List<InternalEvaluatorValue>>>()
|
||||
.ToConstant(ObjectPool.Create<List<InternalEvaluatorValue>>())
|
||||
.InSingletonScope();
|
||||
|
||||
Bind<ObjectPool<ExtraTypeIdContainer>>()
|
||||
.ToConstant(ObjectPool.Create<ExtraTypeIdContainer>())
|
||||
.InSingletonScope();
|
||||
|
||||
// Parser
|
||||
Bind<IFormulaCache>().To<FormulaCache>().InSingletonScope();
|
||||
Bind<IFunctionReader>().To<FunctionReader>().InSingletonScope();
|
||||
Bind<IFormulaParser>().To<FormulaParser>().InSingletonScope();
|
||||
|
||||
// Checker
|
||||
Bind<IFormulaChecker>().To<FormulaChecker>().InSingletonScope();
|
||||
|
||||
// Evaluator
|
||||
Bind<INoStringEvaluator>().To<NoStringEvaluator>().InSingletonScope();
|
||||
|
||||
// Options
|
||||
NoStringEvaluatorOptions opt = new NoStringEvaluatorOptions().SetWordQuotationMark("!");
|
||||
opt.UpdateConstants();
|
||||
|
||||
// If needed
|
||||
InjectUserDefinedFunctions();
|
||||
}
|
||||
|
||||
private void InjectUserDefinedFunctions()
|
||||
{
|
||||
IFunctionReader functionReader = (IFunctionReader) Kernel!.GetService(typeof(IFunctionReader));
|
||||
NoStringFunctionsInitializer.InitializeFunctions(functionReader, typeof(NoStringNinjectModule));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user