-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
160 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,88 @@ | ||
/* | ||
============================================================================== | ||
GlobalEffectManager.cpp | ||
Created: 30 Sep 2020 12:38:46pm | ||
Author: bkupe | ||
============================================================================== | ||
*/ | ||
|
||
#include "Effect/EffectIncludes.h" | ||
|
||
juce_ImplementSingleton(GlobalEffectManager) | ||
|
||
GlobalEffectManager::GlobalEffectManager() : | ||
BaseManager("Global Effects") | ||
{ | ||
itemDataType = EffectGroup::getTypeStringStatic(); | ||
} | ||
|
||
GlobalEffectManager::~GlobalEffectManager() | ||
{ | ||
|
||
} | ||
|
||
Array<ChainVizTarget*> GlobalEffectManager::getChainVizTargetsForObjectAndComponent(Object* o, ComponentType c) | ||
{ | ||
Array<ChainVizTarget*> result; | ||
for (auto& g : items) result.addArray(g->effectManager.getChainVizTargetsForObjectAndComponent(o, c)); | ||
return result; | ||
} | ||
|
||
void GlobalEffectManager::processComponent(Object* o, ObjectComponent* c, HashMap<Parameter*, var>& values) | ||
{ | ||
for (auto& i : items) | ||
{ | ||
if (!i->enabled->boolValue()) continue; | ||
i->effectManager.processComponent(o, c, values); | ||
} | ||
} | ||
|
||
var GlobalEffectManager::getSceneData() | ||
{ | ||
var data(new DynamicObject()); | ||
for (auto& i : items) data.getDynamicObject()->setProperty(i->shortName, i->getSceneData()); | ||
return data; | ||
} | ||
|
||
void GlobalEffectManager::updateSceneData(var& sceneData) | ||
{ | ||
} | ||
|
||
void GlobalEffectManager::lerpFromSceneData(var startData, var endData, float weight) | ||
{ | ||
for (auto& i : items) i->lerpFromSceneData(startData.getProperty(i->shortName, var()), endData.getProperty(i->shortName, var()), weight); | ||
} | ||
|
||
EffectGroup::EffectGroup() : | ||
BaseItem("Effect Group") | ||
{ | ||
saveAndLoadRecursiveData = true; | ||
addChildControllableContainer(&effectManager); | ||
|
||
excludeFromScenes = addBoolParameter("Exclude From Scenes", "If checked, this effect won't be saved in scenes", false); | ||
} | ||
|
||
EffectGroup::~EffectGroup() | ||
{ | ||
} | ||
|
||
var EffectGroup::getSceneData() | ||
{ | ||
var data(new DynamicObject()); | ||
if (excludeFromScenes->boolValue()) return data; | ||
data.getDynamicObject()->setProperty(effectManager.shortName, effectManager.getSceneData()); | ||
return data; | ||
} | ||
|
||
void EffectGroup::updateSceneData(var& sceneData) | ||
{ | ||
} | ||
|
||
void EffectGroup::lerpFromSceneData(var startData, var endData, float weight) | ||
{ | ||
if (excludeFromScenes->boolValue()) return; | ||
effectManager.lerpFromSceneData(startData.getProperty(effectManager.shortName, var()), endData.getProperty(effectManager.shortName, var()), weight); | ||
} | ||
/* | ||
============================================================================== | ||
GlobalEffectManager.cpp | ||
Created: 30 Sep 2020 12:38:46pm | ||
Author: bkupe | ||
============================================================================== | ||
*/ | ||
|
||
#include "Effect/EffectIncludes.h" | ||
|
||
juce_ImplementSingleton(GlobalEffectManager) | ||
|
||
GlobalEffectManager::GlobalEffectManager() : | ||
BaseManager("Global Effects") | ||
{ | ||
itemDataType = EffectGroup::getTypeStringStatic(); | ||
} | ||
|
||
GlobalEffectManager::~GlobalEffectManager() | ||
{ | ||
|
||
} | ||
|
||
Array<ChainVizTarget*> GlobalEffectManager::getChainVizTargetsForObjectAndComponent(Object* o, ComponentType c) | ||
{ | ||
Array<ChainVizTarget*> result; | ||
for (auto& g : items) result.addArray(g->effectManager.getChainVizTargetsForObjectAndComponent(o, c)); | ||
return result; | ||
} | ||
|
||
void GlobalEffectManager::processComponent(Object* o, ObjectComponent* c, HashMap<Parameter*, var>& values) | ||
{ | ||
for (auto& i : items) | ||
{ | ||
if (!i->enabled->boolValue()) continue; | ||
i->effectManager.processComponent(o, c, values); | ||
} | ||
} | ||
|
||
var GlobalEffectManager::getSceneData() | ||
{ | ||
var data(new DynamicObject()); | ||
for (auto& i : items) data.getDynamicObject()->setProperty(i->shortName, i->getSceneData()); | ||
return data; | ||
} | ||
|
||
void GlobalEffectManager::updateSceneData(var& sceneData) | ||
{ | ||
} | ||
|
||
void GlobalEffectManager::lerpFromSceneData(var startData, var endData, float weight) | ||
{ | ||
for (auto& i : items) i->lerpFromSceneData(startData.getProperty(i->shortName, var()), endData.getProperty(i->shortName, var()), weight); | ||
} | ||
|
||
EffectGroup::EffectGroup() : | ||
BaseItem("Effect Group") | ||
{ | ||
setHasCustomColor(true); | ||
saveAndLoadRecursiveData = true; | ||
addChildControllableContainer(&effectManager); | ||
|
||
excludeFromScenes = addBoolParameter("Exclude From Scenes", "If checked, this effect won't be saved in scenes", false); | ||
} | ||
|
||
EffectGroup::~EffectGroup() | ||
{ | ||
} | ||
|
||
var EffectGroup::getSceneData() | ||
{ | ||
var data(new DynamicObject()); | ||
if (excludeFromScenes->boolValue()) return data; | ||
data.getDynamicObject()->setProperty(effectManager.shortName, effectManager.getSceneData()); | ||
return data; | ||
} | ||
|
||
void EffectGroup::updateSceneData(var& sceneData) | ||
{ | ||
} | ||
|
||
void EffectGroup::lerpFromSceneData(var startData, var endData, float weight) | ||
{ | ||
if (excludeFromScenes->boolValue()) return; | ||
effectManager.lerpFromSceneData(startData.getProperty(effectManager.shortName, var()), endData.getProperty(effectManager.shortName, var()), weight); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,71 @@ | ||
/* | ||
============================================================================== | ||
Group.cpp | ||
Created: 29 Sep 2020 9:46:51pm | ||
Author: bkupe | ||
============================================================================== | ||
*/ | ||
|
||
|
||
#include <algorithm> | ||
|
||
Group::Group(String name) : | ||
BaseItem(name) | ||
{ | ||
saveAndLoadRecursiveData = true; | ||
|
||
effectManager.reset(new EffectManager(this)); | ||
addChildControllableContainer(effectManager.get()); | ||
} | ||
|
||
Group::~Group() | ||
{ | ||
|
||
} | ||
|
||
void Group::generateRandomIDs() | ||
{ | ||
randomIDs.resize(getNumObjects()); | ||
for (int i = 0; i < randomIDs.size(); i++) randomIDs.set(i, i); | ||
|
||
shuffle(randomIDs.begin(), randomIDs.end(), std::default_random_engine(Time::currentTimeMillis())); | ||
} | ||
|
||
bool Group::containsObject(Object* o) | ||
{ | ||
return false; | ||
} | ||
|
||
int Group::getLocalIDForObject(Object* o) | ||
{ | ||
return -1; | ||
} | ||
|
||
int Group::getRandomIDForObject(Object* o) | ||
{ | ||
return -1; | ||
} | ||
|
||
void Group::processComponent(Object* o, ObjectComponent* c, HashMap<Parameter*, var>& values) | ||
{ | ||
effectManager->processComponent(o, c, values, 1, getLocalIDForObject(o)); | ||
} | ||
|
||
var Group::getSceneData() | ||
{ | ||
var data(new DynamicObject()); | ||
data.getDynamicObject()->setProperty(effectManager->shortName,effectManager->getSceneData()); | ||
return data; | ||
} | ||
|
||
void Group::updateSceneData(var& sceneData) | ||
{ | ||
} | ||
|
||
void Group::lerpFromSceneData(var startData, var endData, float weight) | ||
{ | ||
effectManager->lerpFromSceneData(startData.getProperty(effectManager->shortName, var()), endData.getProperty(effectManager->shortName, var()), weight); | ||
} | ||
/* | ||
============================================================================== | ||
Group.cpp | ||
Created: 29 Sep 2020 9:46:51pm | ||
Author: bkupe | ||
============================================================================== | ||
*/ | ||
|
||
|
||
#include <algorithm> | ||
|
||
Group::Group(String name) : | ||
BaseItem(name) | ||
{ | ||
saveAndLoadRecursiveData = true; | ||
setHasCustomColor(true); | ||
|
||
effectManager.reset(new EffectManager(this)); | ||
addChildControllableContainer(effectManager.get()); | ||
} | ||
|
||
Group::~Group() | ||
{ | ||
|
||
} | ||
|
||
void Group::generateRandomIDs() | ||
{ | ||
randomIDs.resize(getNumObjects()); | ||
for (int i = 0; i < randomIDs.size(); i++) randomIDs.set(i, i); | ||
|
||
shuffle(randomIDs.begin(), randomIDs.end(), std::default_random_engine(Time::currentTimeMillis())); | ||
} | ||
|
||
bool Group::containsObject(Object* o) | ||
{ | ||
return false; | ||
} | ||
|
||
int Group::getLocalIDForObject(Object* o) | ||
{ | ||
return -1; | ||
} | ||
|
||
int Group::getRandomIDForObject(Object* o) | ||
{ | ||
return -1; | ||
} | ||
|
||
void Group::processComponent(Object* o, ObjectComponent* c, HashMap<Parameter*, var>& values) | ||
{ | ||
effectManager->processComponent(o, c, values, 1, getLocalIDForObject(o)); | ||
} | ||
|
||
var Group::getSceneData() | ||
{ | ||
var data(new DynamicObject()); | ||
data.getDynamicObject()->setProperty(effectManager->shortName,effectManager->getSceneData()); | ||
return data; | ||
} | ||
|
||
void Group::updateSceneData(var& sceneData) | ||
{ | ||
} | ||
|
||
void Group::lerpFromSceneData(var startData, var endData, float weight) | ||
{ | ||
effectManager->lerpFromSceneData(startData.getProperty(effectManager->shortName, var()), endData.getProperty(effectManager->shortName, var()), weight); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters