-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathScriptManager.cpp
54 lines (44 loc) · 1.15 KB
/
ScriptManager.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
==============================================================================
ScriptManager.cpp
Created: 20 Feb 2017 5:00:57pm
Author: Ben
==============================================================================
*/
ScriptManager::ScriptManager(ScriptTarget * _parentTarget):
BaseManager("Scripts"),
parentTarget(_parentTarget),
scriptTemplate("generic")
{
selectItemWhenCreated = false;
}
ScriptManager::~ScriptManager()
{
}
Script * ScriptManager::createItem()
{
Script * s = new Script(parentTarget);
s->scriptTemplate = &scriptTemplate;
return s;
}
InspectableEditor * ScriptManager::getEditorInternal(bool isRoot, Array<Inspectable*> inspectables)
{
return new ScriptManagerEditor(this, isRoot);
}
bool ScriptManager::callFunctionOnAllItems(const Identifier & function, var a)
{
Array<var> args;
args.add(a);
return callFunctionOnAllItems(function, args);
}
bool ScriptManager::callFunctionOnAllItems(const Identifier & function, Array<var> args)
{
bool result = true;
for (auto &i : items)
{
Result r = Result::ok();
i->callFunction(function, args, &r);
if (r != Result::ok()) result = false;
}
return result;
}