Scripting-related cleanup

This commit is contained in:
ksuprynowicz 2023-05-14 23:49:47 +02:00
parent ba0e705b5a
commit fe9babf02d
7 changed files with 4 additions and 1388 deletions

View file

@ -118,7 +118,7 @@ private:
mutable int _activeRefreshRate { 20 };
RefreshRateProfile _refreshRateProfile { RefreshRateProfile::INTERACTIVE};
RefreshRateRegime _refreshRateRegime { RefreshRateRegime::STARTUP };
UXMode _uxMode { UXMode::UX_NUM };
UXMode _uxMode { UXMode::DESKTOP };
mutable ReadWriteLockable _refreshRateProfileSettingLock;
Setting::Handle<int> _refreshRateProfileSetting { "refreshRateProfile", RefreshRateProfile::INTERACTIVE };

View file

@ -249,18 +249,7 @@ std::shared_ptr<StartEndRenderState> ParabolaPointer::buildRenderState(const QVa
bool isVisibleInSecondaryCamera = RenderState::ParabolaRenderItem::DEFAULT_PARABOLA_ISVISIBLEINSECONDARYCAMERA;
bool drawInFront = RenderState::ParabolaRenderItem::DEFAULT_PARABOLA_DRAWINFRONT;
bool enabled = false;
/*if (propMap["pathPropertyIndex"].isValid()) {
int pathPropertyIndex = propMap["pathPropertyIndex"].toInt();
if (pathPropertyIndex >= 0 && pathPropertyIndex < entityProperties.length()) {
const EntityItemProperties &pathProperties(entityProperties[pathPropertyIndex]);
enabled = true;
color = pathProperties.getColor();
alpha = pathProperties.getAlpha();
//V8TODO I'm not sure how to do this one
//width = pathProperties.getWidth;
drawInFront = (pathProperties.getRenderLayer() == RenderLayer::FRONT);
}
}*/
if (propMap["path"].isValid()) {
enabled = true;
QVariantMap pathMap = propMap["path"].toMap();

View file

@ -85,13 +85,9 @@ QUuid StylusPointer::buildStylus(const QVariantMap& properties) {
entityProperties.setType(EntityTypes::Model);
entityProperties.setName("stylus");
entityProperties.setModelURL(modelURL);
// V8TODO: I can't find equivalent for entities
//propertiesMap["loadPriority"] = 10.0f;
entityProperties.setPrimitiveMode(PrimitiveMode::SOLID);
entityProperties.setVisible(true);
entityProperties.setIgnorePickIntersection(true);
// V8TODO: I can't find equivalent for entities but shouldn't be necessary
//propertiesMap["drawInFront"] = false;
return DependencyManager::get<EntityScriptingInterface>()->addEntityInternal(entityProperties, entity::HostType::LOCAL);
}

File diff suppressed because it is too large Load diff

View file

@ -77,8 +77,6 @@ public:
* <p><strong>Note:</strong> 3D overlays are local {@link Entities}, internally, so many of the methods also work with
* entities.</p>
*
* <p class="important">3D overlays are deprecated: Use local {@link Entities} for these instead.</p>
*
* @namespace Overlays
*
* @hifi-interface
@ -311,75 +309,7 @@ public slots:
* });
*/
QUuid getOverlayAtPoint(const glm::vec2& point);
/*@jsdoc
* Gets a specified property value of a 3D overlay (or entity).
* <p><strong>Note:</strong> 2D overlays' property values cannot be retrieved.</p>
* @function Overlays.getProperty
* @param {Uuid} id - The ID of the 3D overlay (or entity).
* @param {string} property - The name of the property to get the value of.
* @returns {object} The value of the property if the 3D overlay and property can be found, otherwise
* <code>undefined</code>.
* @example <caption>Create an overlay in front of your avatar then report its alpha property value.</caption>
* var overlay = Overlays.addOverlay("cube", {
* position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -3 })),
* rotation: MyAvatar.orientation,
* dimensions: { x: 0.3, y: 0.3, z: 0.3 },
* solid: true
* });
* var alpha = Overlays.getProperty(overlay, "alpha");
* print("Overlay alpha: " + alpha);
*/
QVariant getProperty(const QUuid& id, const QString& property);
/*@jsdoc
* Gets specified property values of a 3D overlay (or entity).
* <p><strong>Note:</strong> 2D overlays' property values cannot be retrieved.</p>
* @function Overlays.getProperties
* @param {Uuid} id - The ID of the overlay (or entity).
* @param {Array.<string>} properties - The names of the properties to get the values of.
* @returns {Overlays.OverlayProperties} The values of valid properties if the overlay can be found, otherwise an empty
* object.
* @example <caption>Create an overlay in front of your avatar then report some of its properties.</caption>
* var overlay = Overlays.addOverlay("cube", {
* position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -3 })),
* rotation: MyAvatar.orientation,
* dimensions: { x: 0.3, y: 0.3, z: 0.3 },
* solid: true
* });
* var properties = Overlays.getProperties(overlay, ["color", "alpha", "grabbable"]);
* print("Overlay properties: " + JSON.stringify(properties));
*/
QVariantMap getProperties(const QUuid& id, const QStringList& properties);
/*@jsdoc
* Gets the values of multiple overlays' (or entities') properties.
* @function Overlays.getOverlaysProperties
* @param propertiesById {object.<Uuid, Array.<string>>} - An object with overlay (or entity) IDs as keys and arrays of the
* names of properties to get for each as values.
* @returns {object.<Uuid, Overlays.OverlayProperties>} An object with overlay (or entity) IDs as keys and
* {@link Overlays.OverlayProperties|OverlayProperties} as values.
* @example <caption>Create two cube overlays in front of your avatar then get some of their properties.</caption>
* var overlayA = Overlays.addOverlay("cube", {
* position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: -0.3, y: 0, z: -3 })),
* rotation: MyAvatar.orientation,
* dimensions: { x: 0.3, y: 0.3, z: 0.3 },
* solid: true
* });
* var overlayB = Overlays.addOverlay("cube", {
* position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0.3, y: 0, z: -3 })),
* rotation: MyAvatar.orientation,
* dimensions: { x: 0.3, y: 0.3, z: 0.3 },
* solid: true
* });
* var propertiesToGet = {};
* propertiesToGet[overlayA] = ["color", "alpha"];
* propertiesToGet[overlayB] = ["dimensions"];
* var properties = Overlays.getOverlaysProperties(propertiesToGet);
* print("Overlays properties: " + JSON.stringify(properties));
*/
QVariantMap getOverlaysProperties(const QVariant& overlaysProperties);
/*@jsdoc
* Finds the closest 3D overlay (or local entity) intersected by a {@link PickRay}.
* @function Overlays.findRayIntersection

View file

@ -232,19 +232,8 @@ static bool hasCorrectSyntax(const ScriptProgramPointer& program) {
}
static bool hadUncaughtExceptions(ScriptEngine& engine, const QString& fileName) {
if (engine.hasUncaughtException()) {
//const auto backtrace = engine.uncaughtException().backtrace;
//const auto exception = engine.uncaughtException().toString();
//const auto line = QString::number(engine.uncaughtExceptionLineNumber());
qCritical() << engine.uncaughtException();
engine.clearExceptions();
//static const QString SCRIPT_EXCEPTION_FORMAT = "[UncaughtException] %1 in %2:%3";
//auto message = QString(SCRIPT_EXCEPTION_FORMAT).arg(exception, fileName, line);
//if (!backtrace.empty()) {
// static const auto lineSeparator = "\n ";
// message += QString("\n[Backtrace]%1%2").arg(lineSeparator, backtrace.join(lineSeparator));
//}
//qCritical() << qPrintable(message);
return true;
}
return false;

View file

@ -2059,6 +2059,7 @@ void ScriptManager::entityScriptContentAvailable(const EntityItemID& entityID, c
exception = testConstructor;
}
} else {
// V8TODO: re-enable entity script whitelist
// ENTITY SCRIPT WHITELIST STARTS HERE
auto nodeList = DependencyManager::get<NodeList>();
bool passList = false; // assume unsafe