mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 13:19:54 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into applications_diet_cpp11
This commit is contained in:
commit
fcb8bf6425
5 changed files with 65 additions and 33 deletions
|
@ -76,6 +76,33 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "scripts",
|
||||||
|
"label": "Scripts",
|
||||||
|
"settings": [
|
||||||
|
{
|
||||||
|
"name": "persistent_scripts",
|
||||||
|
"type": "table",
|
||||||
|
"label": "Persistent Scripts",
|
||||||
|
"help": "Add the URLs for scripts that you would like to ensure are always running in your domain.",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"name": "url",
|
||||||
|
"label": "Script URL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "num_instances",
|
||||||
|
"label": "# instances",
|
||||||
|
"default": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "pool",
|
||||||
|
"label": "Pool"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "audio_env",
|
"name": "audio_env",
|
||||||
"label": "Audio Environment",
|
"label": "Audio Environment",
|
||||||
|
|
|
@ -363,7 +363,8 @@ function makeTableInputs(setting) {
|
||||||
|
|
||||||
_.each(setting.columns, function(col) {
|
_.each(setting.columns, function(col) {
|
||||||
html += "<td class='" + Settings.DATA_COL_CLASS + "'name='" + col.name + "'>\
|
html += "<td class='" + Settings.DATA_COL_CLASS + "'name='" + col.name + "'>\
|
||||||
<input type='text' class='form-control' placeholder='" + (col.placeholder ? col.placeholder : "") + "' value=''>\
|
<input type='text' class='form-control' placeholder='" + (col.placeholder ? col.placeholder : "") + "'\
|
||||||
|
value='" + (col.default ? col.default : "") + "'>\
|
||||||
</td>"
|
</td>"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -389,8 +390,9 @@ function badgeSidebarForDifferences(changedElement) {
|
||||||
|
|
||||||
// badge for any settings we have that are not the same or are not present in initialValues
|
// badge for any settings we have that are not the same or are not present in initialValues
|
||||||
for (var setting in panelJSON) {
|
for (var setting in panelJSON) {
|
||||||
if (!_.isEqual(panelJSON[setting], initialPanelJSON[setting])
|
if ((!_.has(initialPanelJSON, setting) && panelJSON[setting] !== "") ||
|
||||||
&& (panelJSON[setting] !== "" || _.has(initialPanelJSON, setting))) {
|
(!_.isEqual(panelJSON[setting], initialPanelJSON[setting])
|
||||||
|
&& (panelJSON[setting] !== "" || _.has(initialPanelJSON, setting)))) {
|
||||||
badgeValue += 1
|
badgeValue += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -233,6 +233,9 @@ void DomainServer::setupNodeListAndAssignments(const QUuid& sessionUUID) {
|
||||||
parseAssignmentConfigs(parsedTypes);
|
parseAssignmentConfigs(parsedTypes);
|
||||||
|
|
||||||
populateDefaultStaticAssignmentsExcludingTypes(parsedTypes);
|
populateDefaultStaticAssignmentsExcludingTypes(parsedTypes);
|
||||||
|
|
||||||
|
// check for scripts the user wants to persist from their domain-server config
|
||||||
|
populateStaticScriptedAssignmentsFromSettings();
|
||||||
|
|
||||||
LimitedNodeList* nodeList = LimitedNodeList::createInstance(domainServerPort, domainServerDTLSPort);
|
LimitedNodeList* nodeList = LimitedNodeList::createInstance(domainServerPort, domainServerDTLSPort);
|
||||||
|
|
||||||
|
@ -451,8 +454,6 @@ void DomainServer::parseAssignmentConfigs(QSet<Assignment::Type>& excludedTypes)
|
||||||
|
|
||||||
if (assignmentType != Assignment::AgentType) {
|
if (assignmentType != Assignment::AgentType) {
|
||||||
createStaticAssignmentsForType(assignmentType, assignmentList);
|
createStaticAssignmentsForType(assignmentType, assignmentList);
|
||||||
} else {
|
|
||||||
createScriptedAssignmentsFromList(assignmentList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
excludedTypes.insert(assignmentType);
|
excludedTypes.insert(assignmentType);
|
||||||
|
@ -468,35 +469,37 @@ void DomainServer::addStaticAssignmentToAssignmentHash(Assignment* newAssignment
|
||||||
_allAssignments.insert(newAssignment->getUUID(), SharedAssignmentPointer(newAssignment));
|
_allAssignments.insert(newAssignment->getUUID(), SharedAssignmentPointer(newAssignment));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DomainServer::createScriptedAssignmentsFromList(const QVariantList &configList) {
|
void DomainServer::populateStaticScriptedAssignmentsFromSettings() {
|
||||||
foreach(const QVariant& configVariant, configList) {
|
const QString PERSISTENT_SCRIPTS_KEY_PATH = "scripts.persistent_scripts";
|
||||||
if (configVariant.canConvert(QMetaType::QVariantMap)) {
|
const QVariant* persistentScriptsVariant = valueForKeyPath(_settingsManager.getSettingsMap(), PERSISTENT_SCRIPTS_KEY_PATH);
|
||||||
QVariantMap configMap = configVariant.toMap();
|
|
||||||
|
if (persistentScriptsVariant) {
|
||||||
// make sure we were passed a URL, otherwise this is an invalid scripted assignment
|
QVariantList persistentScriptsList = persistentScriptsVariant->toList();
|
||||||
const QString ASSIGNMENT_URL_KEY = "url";
|
foreach(const QVariant& persistentScriptVariant, persistentScriptsList) {
|
||||||
QString assignmentURL = configMap[ASSIGNMENT_URL_KEY].toString();
|
QVariantMap persistentScript = persistentScriptVariant.toMap();
|
||||||
|
|
||||||
if (!assignmentURL.isEmpty()) {
|
const QString PERSISTENT_SCRIPT_URL_KEY = "url";
|
||||||
// check the json for a pool
|
const QString PERSISTENT_SCRIPT_NUM_INSTANCES_KEY = "num_instances";
|
||||||
const QString ASSIGNMENT_POOL_KEY = "pool";
|
const QString PERSISTENT_SCRIPT_POOL_KEY = "pool";
|
||||||
QString assignmentPool = configMap[ASSIGNMENT_POOL_KEY].toString();
|
|
||||||
|
if (persistentScript.contains(PERSISTENT_SCRIPT_URL_KEY)) {
|
||||||
// check for a number of instances, if not passed then default is 1
|
// check how many instances of this script to add
|
||||||
const QString ASSIGNMENT_INSTANCES_KEY = "instances";
|
|
||||||
int numInstances = configMap[ASSIGNMENT_INSTANCES_KEY].toInt();
|
int numInstances = persistentScript[PERSISTENT_SCRIPT_NUM_INSTANCES_KEY].toInt();
|
||||||
numInstances = (numInstances == 0 ? 1 : numInstances);
|
QString scriptURL = persistentScript[PERSISTENT_SCRIPT_URL_KEY].toString();
|
||||||
|
|
||||||
qDebug() << "Adding a static scripted assignment from" << assignmentURL;
|
QString scriptPool = persistentScript.value(PERSISTENT_SCRIPT_POOL_KEY).toString();
|
||||||
|
|
||||||
for (int i = 0; i < numInstances; i++) {
|
qDebug() << "Adding" << numInstances << "of persistent script at URL" << scriptURL << "- pool" << scriptPool;
|
||||||
|
|
||||||
|
for (int i = 0; i < numInstances; ++i) {
|
||||||
// add a scripted assignment to the queue for this instance
|
// add a scripted assignment to the queue for this instance
|
||||||
Assignment* scriptAssignment = new Assignment(Assignment::CreateCommand,
|
Assignment* scriptAssignment = new Assignment(Assignment::CreateCommand,
|
||||||
Assignment::AgentType,
|
Assignment::AgentType,
|
||||||
assignmentPool);
|
scriptPool);
|
||||||
scriptAssignment->setPayload(assignmentURL.toUtf8());
|
scriptAssignment->setPayload(scriptURL.toUtf8());
|
||||||
|
|
||||||
// scripts passed on CL or via JSON are static - so they are added back to the queue if the node dies
|
// add it to static hash so we know we have to keep giving it back out
|
||||||
addStaticAssignmentToAssignmentHash(scriptAssignment);
|
addStaticAssignmentToAssignmentHash(scriptAssignment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,9 +100,9 @@ private:
|
||||||
|
|
||||||
void parseAssignmentConfigs(QSet<Assignment::Type>& excludedTypes);
|
void parseAssignmentConfigs(QSet<Assignment::Type>& excludedTypes);
|
||||||
void addStaticAssignmentToAssignmentHash(Assignment* newAssignment);
|
void addStaticAssignmentToAssignmentHash(Assignment* newAssignment);
|
||||||
void createScriptedAssignmentsFromList(const QVariantList& configList);
|
|
||||||
void createStaticAssignmentsForType(Assignment::Type type, const QVariantList& configList);
|
void createStaticAssignmentsForType(Assignment::Type type, const QVariantList& configList);
|
||||||
void populateDefaultStaticAssignmentsExcludingTypes(const QSet<Assignment::Type>& excludedTypes);
|
void populateDefaultStaticAssignmentsExcludingTypes(const QSet<Assignment::Type>& excludedTypes);
|
||||||
|
void populateStaticScriptedAssignmentsFromSettings();
|
||||||
|
|
||||||
SharedAssignmentPointer matchingQueuedAssignmentForCheckIn(const QUuid& checkInUUID, NodeType_t nodeType);
|
SharedAssignmentPointer matchingQueuedAssignmentForCheckIn(const QUuid& checkInUUID, NodeType_t nodeType);
|
||||||
SharedAssignmentPointer deployableAssignmentForRequest(const Assignment& requestAssignment);
|
SharedAssignmentPointer deployableAssignmentForRequest(const Assignment& requestAssignment);
|
||||||
|
|
|
@ -195,7 +195,7 @@ Grid = function(opts) {
|
||||||
Overlays.editOverlay(gridOverlay, {
|
Overlays.editOverlay(gridOverlay, {
|
||||||
position: { x: origin.y, y: origin.y, z: -origin.y },
|
position: { x: origin.y, y: origin.y, z: -origin.y },
|
||||||
visible: that.visible && that.enabled,
|
visible: that.visible && that.enabled,
|
||||||
minorGridSpacing: minorGridSpacing,
|
minorGridWidth: minorGridSpacing,
|
||||||
majorGridEvery: majorGridEvery,
|
majorGridEvery: majorGridEvery,
|
||||||
color: gridColor,
|
color: gridColor,
|
||||||
alpha: gridAlpha,
|
alpha: gridAlpha,
|
||||||
|
|
Loading…
Reference in a new issue