mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 22:22:54 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into Case20377
This commit is contained in:
commit
d54fec4476
26 changed files with 531 additions and 604 deletions
|
@ -25,12 +25,12 @@ float ClipboardScriptingInterface::getClipboardContentsLargestDimension() {
|
||||||
return qApp->getEntityClipboard()->getContentsLargestDimension();
|
return qApp->getEntityClipboard()->getContentsLargestDimension();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClipboardScriptingInterface::exportEntities(const QString& filename, const QVector<EntityItemID>& entityIDs) {
|
bool ClipboardScriptingInterface::exportEntities(const QString& filename, const QVector<QUuid>& entityIDs) {
|
||||||
bool retVal;
|
bool retVal;
|
||||||
BLOCKING_INVOKE_METHOD(qApp, "exportEntities",
|
BLOCKING_INVOKE_METHOD(qApp, "exportEntities",
|
||||||
Q_RETURN_ARG(bool, retVal),
|
Q_RETURN_ARG(bool, retVal),
|
||||||
Q_ARG(const QString&, filename),
|
Q_ARG(const QString&, filename),
|
||||||
Q_ARG(const QVector<EntityItemID>&, entityIDs));
|
Q_ARG(const QVector<QUuid>&, entityIDs));
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ public:
|
||||||
* @param {Uuid[]} entityIDs Array of IDs of the entities to export.
|
* @param {Uuid[]} entityIDs Array of IDs of the entities to export.
|
||||||
* @returns {boolean} <code>true</code> if the export was successful, otherwise <code>false</code>.
|
* @returns {boolean} <code>true</code> if the export was successful, otherwise <code>false</code>.
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE bool exportEntities(const QString& filename, const QVector<EntityItemID>& entityIDs);
|
Q_INVOKABLE bool exportEntities(const QString& filename, const QVector<QUuid>& entityIDs);
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Export the entities with centers within a cube to a JSON file.
|
* Export the entities with centers within a cube to a JSON file.
|
||||||
|
|
|
@ -390,7 +390,7 @@ void Avatar::updateAvatarEntities() {
|
||||||
QVariantMap asMap = variantProperties.toMap();
|
QVariantMap asMap = variantProperties.toMap();
|
||||||
QScriptValue scriptProperties = variantMapToScriptValue(asMap, scriptEngine);
|
QScriptValue scriptProperties = variantMapToScriptValue(asMap, scriptEngine);
|
||||||
EntityItemProperties properties;
|
EntityItemProperties properties;
|
||||||
EntityItemPropertiesFromScriptValueHonorReadOnly(scriptProperties, properties);
|
EntityItemPropertiesFromScriptValueIgnoreReadOnly(scriptProperties, properties);
|
||||||
properties.setEntityHostType(entity::HostType::AVATAR);
|
properties.setEntityHostType(entity::HostType::AVATAR);
|
||||||
properties.setOwningAvatarID(getID());
|
properties.setOwningAvatarID(getID());
|
||||||
|
|
||||||
|
|
|
@ -19,66 +19,39 @@
|
||||||
#include <PerfStat.h>
|
#include <PerfStat.h>
|
||||||
#include <shaders/Shaders.h>
|
#include <shaders/Shaders.h>
|
||||||
|
|
||||||
//#define POLYLINE_ENTITY_USE_FADE_EFFECT
|
#include "paintStroke_Shared.slh"
|
||||||
#ifdef POLYLINE_ENTITY_USE_FADE_EFFECT
|
|
||||||
# include <FadeEffect.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace render;
|
using namespace render;
|
||||||
using namespace render::entities;
|
using namespace render::entities;
|
||||||
|
|
||||||
static uint8_t CUSTOM_PIPELINE_NUMBER { 0 };
|
gpu::PipelinePointer PolyLineEntityRenderer::_pipeline = nullptr;
|
||||||
static const int32_t PAINTSTROKE_TEXTURE_SLOT { 0 };
|
|
||||||
static gpu::Stream::FormatPointer polylineFormat;
|
|
||||||
static gpu::PipelinePointer polylinePipeline;
|
|
||||||
#ifdef POLYLINE_ENTITY_USE_FADE_EFFECT
|
|
||||||
static gpu::PipelinePointer polylineFadePipeline;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static render::ShapePipelinePointer shapePipelineFactory(const render::ShapePlumber& plumber, const render::ShapeKey& key, gpu::Batch& batch) {
|
static const QUrl DEFAULT_POLYLINE_TEXTURE = PathUtils::resourcesUrl("images/paintStroke.png");
|
||||||
if (!polylinePipeline) {
|
|
||||||
|
PolyLineEntityRenderer::PolyLineEntityRenderer(const EntityItemPointer& entity) : Parent(entity) {
|
||||||
|
_texture = DependencyManager::get<TextureCache>()->getTexture(DEFAULT_POLYLINE_TEXTURE);
|
||||||
|
|
||||||
|
{ // Initialize our buffers
|
||||||
|
_polylineDataBuffer = std::make_shared<gpu::Buffer>();
|
||||||
|
_polylineDataBuffer->resize(sizeof(PolylineData));
|
||||||
|
PolylineData data { glm::vec2(_faceCamera, _glow), glm::vec2(0.0f) };
|
||||||
|
_polylineDataBuffer->setSubData(0, data);
|
||||||
|
|
||||||
|
_polylineGeometryBuffer = std::make_shared<gpu::Buffer>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PolyLineEntityRenderer::buildPipeline() {
|
||||||
|
// FIXME: opaque pipeline
|
||||||
gpu::ShaderPointer program = gpu::Shader::createProgram(shader::entities_renderer::program::paintStroke);
|
gpu::ShaderPointer program = gpu::Shader::createProgram(shader::entities_renderer::program::paintStroke);
|
||||||
#ifdef POLYLINE_ENTITY_USE_FADE_EFFECT
|
|
||||||
auto fadeVS = gpu::Shader::createVertex(std::string(paintStroke_fade_vert));
|
|
||||||
auto fadePS = gpu::Shader::createPixel(std::string(paintStroke_fade_frag));
|
|
||||||
gpu::ShaderPointer fadeProgram = gpu::Shader::createProgram(fadeVS, fadePS);
|
|
||||||
#endif
|
|
||||||
gpu::StatePointer state = gpu::StatePointer(new gpu::State());
|
gpu::StatePointer state = gpu::StatePointer(new gpu::State());
|
||||||
|
state->setCullMode(gpu::State::CullMode::CULL_NONE);
|
||||||
state->setDepthTest(true, true, gpu::LESS_EQUAL);
|
state->setDepthTest(true, true, gpu::LESS_EQUAL);
|
||||||
PrepareStencil::testMask(*state);
|
PrepareStencil::testMask(*state);
|
||||||
state->setBlendFunction(true,
|
state->setBlendFunction(true,
|
||||||
gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
|
gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
|
||||||
gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
|
gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
|
||||||
polylinePipeline = gpu::Pipeline::create(program, state);
|
_pipeline = gpu::Pipeline::create(program, state);
|
||||||
#ifdef POLYLINE_ENTITY_USE_FADE_EFFECT
|
|
||||||
_fadePipeline = gpu::Pipeline::create(fadeProgram, state);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef POLYLINE_ENTITY_USE_FADE_EFFECT
|
|
||||||
if (key.isFaded()) {
|
|
||||||
auto fadeEffect = DependencyManager::get<FadeEffect>();
|
|
||||||
return std::make_shared<render::ShapePipeline>(_fadePipeline, nullptr, fadeEffect->getBatchSetter(), fadeEffect->getItemUniformSetter());
|
|
||||||
} else {
|
|
||||||
#endif
|
|
||||||
return std::make_shared<render::ShapePipeline>(polylinePipeline, nullptr, nullptr, nullptr);
|
|
||||||
#ifdef POLYLINE_ENTITY_USE_FADE_EFFECT
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
PolyLineEntityRenderer::PolyLineEntityRenderer(const EntityItemPointer& entity) : Parent(entity) {
|
|
||||||
static std::once_flag once;
|
|
||||||
std::call_once(once, [&] {
|
|
||||||
CUSTOM_PIPELINE_NUMBER = render::ShapePipeline::registerCustomShapePipelineFactory(shapePipelineFactory);
|
|
||||||
polylineFormat.reset(new gpu::Stream::Format());
|
|
||||||
polylineFormat->setAttribute(gpu::Stream::POSITION, 0, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ), offsetof(Vertex, position));
|
|
||||||
polylineFormat->setAttribute(gpu::Stream::NORMAL, 0, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ), offsetof(Vertex, normal));
|
|
||||||
polylineFormat->setAttribute(gpu::Stream::TEXCOORD, 0, gpu::Element(gpu::VEC2, gpu::FLOAT, gpu::UV), offsetof(Vertex, uv));
|
|
||||||
polylineFormat->setAttribute(gpu::Stream::COLOR, 0, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::RGB), offsetof(Vertex, color));
|
|
||||||
});
|
|
||||||
|
|
||||||
_verticesBuffer = std::make_shared<gpu::Buffer>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemKey PolyLineEntityRenderer::getKey() {
|
ItemKey PolyLineEntityRenderer::getKey() {
|
||||||
|
@ -86,152 +59,164 @@ ItemKey PolyLineEntityRenderer::getKey() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ShapeKey PolyLineEntityRenderer::getShapeKey() {
|
ShapeKey PolyLineEntityRenderer::getShapeKey() {
|
||||||
return ShapeKey::Builder().withCustom(CUSTOM_PIPELINE_NUMBER).build();
|
return ShapeKey::Builder().withOwnPipeline().withTranslucent().withoutCullFace();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PolyLineEntityRenderer::needsRenderUpdate() const {
|
||||||
|
bool textureLoadedChanged = resultWithReadLock<bool>([&] {
|
||||||
|
return (!_textureLoaded && _texture && _texture->isLoaded());
|
||||||
|
});
|
||||||
|
|
||||||
|
if (textureLoadedChanged) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Parent::needsRenderUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PolyLineEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const {
|
bool PolyLineEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const {
|
||||||
return (
|
return (
|
||||||
entity->pointsChanged() ||
|
entity->pointsChanged() ||
|
||||||
entity->strokeWidthsChanged() ||
|
entity->widthsChanged() ||
|
||||||
entity->normalsChanged() ||
|
entity->normalsChanged() ||
|
||||||
entity->texturesChanged() ||
|
entity->texturesChanged() ||
|
||||||
entity->strokeColorsChanged()
|
entity->colorsChanged() ||
|
||||||
|
_isUVModeStretch != entity->getIsUVModeStretch() ||
|
||||||
|
_glow != entity->getGlow() ||
|
||||||
|
_faceCamera != entity->getFaceCamera()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PolyLineEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) {
|
void PolyLineEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) {
|
||||||
static const QUrl DEFAULT_POLYLINE_TEXTURE = QUrl(PathUtils::resourcesPath() + "images/paintStroke.png");
|
auto pointsChanged = entity->pointsChanged();
|
||||||
QUrl entityTextures = DEFAULT_POLYLINE_TEXTURE;
|
auto widthsChanged = entity->widthsChanged();
|
||||||
|
auto normalsChanged = entity->normalsChanged();
|
||||||
|
auto colorsChanged = entity->colorsChanged();
|
||||||
|
|
||||||
|
bool isUVModeStretch = entity->getIsUVModeStretch();
|
||||||
|
bool glow = entity->getGlow();
|
||||||
|
bool faceCamera = entity->getFaceCamera();
|
||||||
|
|
||||||
|
entity->resetPolyLineChanged();
|
||||||
|
|
||||||
|
// Transform
|
||||||
|
updateModelTransformAndBound();
|
||||||
|
_renderTransform = getModelTransform();
|
||||||
|
|
||||||
|
// Textures
|
||||||
if (entity->texturesChanged()) {
|
if (entity->texturesChanged()) {
|
||||||
entity->resetTexturesChanged();
|
entity->resetTexturesChanged();
|
||||||
|
QUrl entityTextures = DEFAULT_POLYLINE_TEXTURE;
|
||||||
auto textures = entity->getTextures();
|
auto textures = entity->getTextures();
|
||||||
if (!textures.isEmpty()) {
|
if (!textures.isEmpty()) {
|
||||||
entityTextures = QUrl(textures);
|
entityTextures = QUrl(textures);
|
||||||
}
|
}
|
||||||
_texture = DependencyManager::get<TextureCache>()->getTexture(entityTextures);
|
_texture = DependencyManager::get<TextureCache>()->getTexture(entityTextures);
|
||||||
|
_textureAspectRatio = 1.0f;
|
||||||
|
_textureLoaded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool textureChanged = false;
|
||||||
if (!_texture) {
|
if (!_textureLoaded && _texture && _texture->isLoaded()) {
|
||||||
_texture = DependencyManager::get<TextureCache>()->getTexture(entityTextures);
|
textureChanged = true;
|
||||||
|
_textureAspectRatio = (float)_texture->getOriginalHeight() / (float)_texture->getOriginalWidth();
|
||||||
|
_textureLoaded = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void PolyLineEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) {
|
// Data
|
||||||
auto pointsChanged = entity->pointsChanged();
|
if (faceCamera != _faceCamera || glow != _glow) {
|
||||||
auto strokeWidthsChanged = entity->strokeWidthsChanged();
|
_faceCamera = faceCamera;
|
||||||
auto normalsChanged = entity->normalsChanged();
|
_glow = glow;
|
||||||
auto strokeColorsChanged = entity->strokeColorsChanged();
|
updateData();
|
||||||
|
}
|
||||||
|
|
||||||
bool isUVModeStretch = entity->getIsUVModeStretch();
|
|
||||||
entity->resetPolyLineChanged();
|
|
||||||
|
|
||||||
_polylineTransform = Transform();
|
|
||||||
_polylineTransform.setTranslation(entity->getWorldPosition());
|
|
||||||
_polylineTransform.setRotation(entity->getWorldOrientation());
|
|
||||||
|
|
||||||
|
// Geometry
|
||||||
if (pointsChanged) {
|
if (pointsChanged) {
|
||||||
_lastPoints = entity->getLinePoints();
|
_points = entity->getLinePoints();
|
||||||
}
|
}
|
||||||
if (strokeWidthsChanged) {
|
if (widthsChanged) {
|
||||||
_lastStrokeWidths = entity->getStrokeWidths();
|
_widths = entity->getStrokeWidths();
|
||||||
}
|
}
|
||||||
if (normalsChanged) {
|
if (normalsChanged) {
|
||||||
_lastNormals = entity->getNormals();
|
_normals = entity->getNormals();
|
||||||
}
|
}
|
||||||
if (strokeColorsChanged) {
|
if (colorsChanged) {
|
||||||
_lastStrokeColors = entity->getStrokeColors();
|
_colors = entity->getStrokeColors();
|
||||||
_lastStrokeColors = _lastNormals.size() == _lastStrokeColors.size() ? _lastStrokeColors : QVector<glm::vec3>({ toGlm(entity->getColor()) });
|
_color = toGlm(entity->getColor());
|
||||||
}
|
|
||||||
if (pointsChanged || strokeWidthsChanged || normalsChanged || strokeColorsChanged) {
|
|
||||||
_empty = std::min(_lastPoints.size(), std::min(_lastNormals.size(), _lastStrokeWidths.size())) < 2;
|
|
||||||
if (!_empty) {
|
|
||||||
updateGeometry(updateVertices(_lastPoints, _lastNormals, _lastStrokeWidths, _lastStrokeColors, isUVModeStretch, _textureAspectRatio));
|
|
||||||
}
|
}
|
||||||
|
if (_isUVModeStretch != isUVModeStretch || pointsChanged || widthsChanged || normalsChanged || colorsChanged || textureChanged) {
|
||||||
|
_isUVModeStretch = isUVModeStretch;
|
||||||
|
updateGeometry();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PolyLineEntityRenderer::updateGeometry(const std::vector<Vertex>& vertices) {
|
void PolyLineEntityRenderer::updateGeometry() {
|
||||||
_numVertices = (uint32_t)vertices.size();
|
int maxNumVertices = std::min(_points.length(), _normals.length());
|
||||||
auto bufferSize = _numVertices * sizeof(Vertex);
|
|
||||||
if (bufferSize > _verticesBuffer->getSize()) {
|
|
||||||
_verticesBuffer->resize(bufferSize);
|
|
||||||
}
|
|
||||||
_verticesBuffer->setSubData(0, vertices);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<PolyLineEntityRenderer::Vertex> PolyLineEntityRenderer::updateVertices(const QVector<glm::vec3>& points,
|
|
||||||
const QVector<glm::vec3>& normals,
|
|
||||||
const QVector<float>& strokeWidths,
|
|
||||||
const QVector<glm::vec3>& strokeColors,
|
|
||||||
const bool isUVModeStretch,
|
|
||||||
const float textureAspectRatio) {
|
|
||||||
// Calculate the minimum vector size out of normals, points, and stroke widths
|
|
||||||
int size = std::min(points.size(), std::min(normals.size(), strokeWidths.size()));
|
|
||||||
|
|
||||||
std::vector<Vertex> vertices;
|
|
||||||
|
|
||||||
// Guard against an empty polyline
|
|
||||||
if (size <= 0) {
|
|
||||||
return vertices;
|
|
||||||
}
|
|
||||||
|
|
||||||
float uCoordInc = 1.0f / size;
|
|
||||||
float uCoord = 0.0f;
|
|
||||||
int finalIndex = size - 1;
|
|
||||||
glm::vec3 binormal;
|
|
||||||
float accumulatedDistance = 0.0f;
|
|
||||||
float distanceToLastPoint = 0.0f;
|
|
||||||
float accumulatedStrokeWidth = 0.0f;
|
|
||||||
float strokeWidth = 0.0f;
|
|
||||||
bool doesStrokeWidthVary = false;
|
bool doesStrokeWidthVary = false;
|
||||||
|
if (_widths.size() >= 0) {
|
||||||
|
for (int i = 1; i < maxNumVertices; i++) {
|
||||||
for (int i = 1; i < strokeWidths.size(); i++) {
|
float width = PolyLineEntityItem::DEFAULT_LINE_WIDTH;
|
||||||
if (strokeWidths[i] != strokeWidths[i - 1]) {
|
if (i < _widths.length()) {
|
||||||
|
width = _widths[i];
|
||||||
|
}
|
||||||
|
if (width != _widths[i - 1]) {
|
||||||
doesStrokeWidthVary = true;
|
doesStrokeWidthVary = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i <= finalIndex; i++) {
|
float uCoordInc = 1.0f / maxNumVertices;
|
||||||
const float& width = strokeWidths.at(i);
|
float uCoord = 0.0f;
|
||||||
const auto& point = points.at(i);
|
float accumulatedDistance = 0.0f;
|
||||||
const auto& normal = normals.at(i);
|
float accumulatedStrokeWidth = 0.0f;
|
||||||
const auto& color = strokeColors.size() == normals.size() ? strokeColors.at(i) : strokeColors.at(0);
|
glm::vec3 binormal;
|
||||||
int vertexIndex = i * 2;
|
|
||||||
|
|
||||||
|
std::vector<PolylineVertex> vertices;
|
||||||
|
vertices.reserve(maxNumVertices);
|
||||||
|
for (int i = 0; i < maxNumVertices; i++) {
|
||||||
|
// Position
|
||||||
|
glm::vec3 point = _points[i];
|
||||||
|
|
||||||
if (!isUVModeStretch && i >= 1) {
|
// uCoord
|
||||||
distanceToLastPoint = glm::distance(points.at(i), points.at(i - 1));
|
float width = i < _widths.size() ? _widths[i] : PolyLineEntityItem::DEFAULT_LINE_WIDTH;
|
||||||
accumulatedDistance += distanceToLastPoint;
|
if (i > 0) { // First uCoord is 0.0f
|
||||||
strokeWidth = 2 * strokeWidths[i];
|
if (!_isUVModeStretch) {
|
||||||
|
accumulatedDistance += glm::distance(point, _points[i - 1]);
|
||||||
|
|
||||||
if (doesStrokeWidthVary) {
|
if (doesStrokeWidthVary) {
|
||||||
//If the stroke varies along the line the texture will stretch more or less depending on the speed
|
//If the stroke varies along the line the texture will stretch more or less depending on the speed
|
||||||
//because it looks better than using the same method as below
|
//because it looks better than using the same method as below
|
||||||
accumulatedStrokeWidth += strokeWidth;
|
accumulatedStrokeWidth += width;
|
||||||
float increaseValue = 1;
|
float increaseValue = 1;
|
||||||
if (accumulatedStrokeWidth != 0) {
|
if (accumulatedStrokeWidth != 0) {
|
||||||
float newUcoord = glm::ceil(((1.0f / textureAspectRatio) * accumulatedDistance) / (accumulatedStrokeWidth / i));
|
float newUcoord = glm::ceil((_textureAspectRatio * accumulatedDistance) / (accumulatedStrokeWidth / i));
|
||||||
increaseValue = newUcoord - uCoord;
|
increaseValue = newUcoord - uCoord;
|
||||||
}
|
}
|
||||||
|
|
||||||
increaseValue = increaseValue > 0 ? increaseValue : 1;
|
increaseValue = increaseValue > 0 ? increaseValue : 1;
|
||||||
uCoord += increaseValue;
|
uCoord += increaseValue;
|
||||||
} else {
|
} else {
|
||||||
//If the stroke width is constant then the textures should keep the aspect ratio along the line
|
// If the stroke width is constant then the textures should keep the aspect ratio along the line
|
||||||
uCoord = ((1.0f / textureAspectRatio) * accumulatedDistance) / strokeWidth;
|
uCoord = (_textureAspectRatio * accumulatedDistance) / width;
|
||||||
}
|
}
|
||||||
} else if (vertexIndex >= 2) {
|
} else {
|
||||||
uCoord += uCoordInc;
|
uCoord += uCoordInc;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Color
|
||||||
|
glm::vec3 color = i < _colors.length() ? _colors[i] : _color;
|
||||||
|
|
||||||
|
// Normal
|
||||||
|
glm::vec3 normal = _normals[i];
|
||||||
|
|
||||||
|
// Binormal
|
||||||
// For last point we can assume binormals are the same since it represents the last two vertices of quad
|
// For last point we can assume binormals are the same since it represents the last two vertices of quad
|
||||||
if (i < finalIndex) {
|
if (i < maxNumVertices - 1) {
|
||||||
const auto tangent = points.at(i + 1) - point;
|
glm::vec3 tangent = _points[i + 1] - point;
|
||||||
binormal = glm::normalize(glm::cross(tangent, normal)) * width;
|
binormal = glm::normalize(glm::cross(tangent, normal));
|
||||||
|
|
||||||
// Check to make sure binormal is not a NAN. If it is, don't add to vertices vector
|
// Check to make sure binormal is not a NAN. If it is, don't add to vertices vector
|
||||||
if (binormal.x != binormal.x) {
|
if (binormal.x != binormal.x) {
|
||||||
|
@ -239,54 +224,36 @@ std::vector<PolyLineEntityRenderer::Vertex> PolyLineEntityRenderer::updateVertic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto v1 = points.at(i) + binormal;
|
PolylineVertex vertex = { glm::vec4(point, uCoord), glm::vec4(color, 1.0f), glm::vec4(normal, 0.0f), glm::vec4(binormal, 0.5f * width) };
|
||||||
const auto v2 = points.at(i) - binormal;
|
vertices.push_back(vertex);
|
||||||
vertices.emplace_back(v1, normal, vec2(uCoord, 0.0f), color);
|
|
||||||
vertices.emplace_back(v2, normal, vec2(uCoord, 1.0f), color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return vertices;
|
_numVertices = vertices.size();
|
||||||
|
_polylineGeometryBuffer->setData(vertices.size() * sizeof(PolylineVertex), (const gpu::Byte*) vertices.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
scriptable::ScriptableModelBase PolyLineEntityRenderer::getScriptableModel() {
|
void PolyLineEntityRenderer::updateData() {
|
||||||
// TODO: adapt polyline into a triangles mesh...
|
PolylineData data { glm::vec2(_faceCamera, _glow), glm::vec2(0.0f) };
|
||||||
return EntityRenderer::getScriptableModel();
|
_polylineDataBuffer->setSubData(0, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PolyLineEntityRenderer::doRender(RenderArgs* args) {
|
void PolyLineEntityRenderer::doRender(RenderArgs* args) {
|
||||||
if (_empty) {
|
if (_numVertices < 2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PerformanceTimer perfTimer("RenderablePolyLineEntityItem::render");
|
PerformanceTimer perfTimer("RenderablePolyLineEntityItem::render");
|
||||||
Q_ASSERT(args->_batch);
|
Q_ASSERT(args->_batch);
|
||||||
|
|
||||||
gpu::Batch& batch = *args->_batch;
|
gpu::Batch& batch = *args->_batch;
|
||||||
batch.setModelTransform(_polylineTransform);
|
|
||||||
|
|
||||||
if (_texture && _texture->isLoaded()) {
|
if (!_pipeline) {
|
||||||
batch.setResourceTexture(PAINTSTROKE_TEXTURE_SLOT, _texture->getGPUTexture());
|
buildPipeline();
|
||||||
} else {
|
|
||||||
batch.setResourceTexture(PAINTSTROKE_TEXTURE_SLOT, DependencyManager::get<TextureCache>()->getWhiteTexture());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float textureWidth = (float)_texture->getOriginalWidth();
|
batch.setPipeline(_pipeline);
|
||||||
float textureHeight = (float)_texture->getOriginalHeight();
|
batch.setModelTransform(_renderTransform);
|
||||||
if (textureWidth != 0 && textureHeight != 0) {
|
batch.setResourceTexture(0, _textureLoaded ? _texture->getGPUTexture() : DependencyManager::get<TextureCache>()->getWhiteTexture());
|
||||||
_textureAspectRatio = textureWidth / textureHeight;
|
batch.setResourceBuffer(0, _polylineGeometryBuffer);
|
||||||
}
|
batch.setUniformBuffer(0, _polylineDataBuffer);
|
||||||
|
batch.draw(gpu::TRIANGLE_STRIP, (gpu::uint32)(2 * _numVertices), 0);
|
||||||
batch.setInputFormat(polylineFormat);
|
|
||||||
batch.setInputBuffer(0, _verticesBuffer, 0, sizeof(Vertex));
|
|
||||||
|
|
||||||
#ifndef POLYLINE_ENTITY_USE_FADE_EFFECT
|
|
||||||
// glColor4f must be called after setInputFormat if it must be taken into account
|
|
||||||
if (_isFading) {
|
|
||||||
batch._glColor4f(1.0f, 1.0f, 1.0f, Interpolate::calculateFadeRatio(_fadeStartTime));
|
|
||||||
} else {
|
|
||||||
batch._glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
batch.draw(gpu::TRIANGLE_STRIP, _numVertices, 0);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,52 +25,40 @@ class PolyLineEntityRenderer : public TypedEntityRenderer<PolyLineEntityItem> {
|
||||||
public:
|
public:
|
||||||
PolyLineEntityRenderer(const EntityItemPointer& entity);
|
PolyLineEntityRenderer(const EntityItemPointer& entity);
|
||||||
|
|
||||||
virtual scriptable::ScriptableModelBase getScriptableModel() override;
|
// FIXME: shouldn't always be transparent: take into account texture and glow
|
||||||
|
virtual bool isTransparent() const override { return true; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual bool needsRenderUpdate() const override;
|
||||||
virtual bool needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const override;
|
virtual bool needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const override;
|
||||||
virtual void doRenderUpdateSynchronousTyped(const ScenePointer& scene,
|
|
||||||
Transaction& transaction,
|
|
||||||
const TypedEntityPointer& entity) override;
|
|
||||||
virtual void doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) override;
|
virtual void doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) override;
|
||||||
|
|
||||||
virtual ItemKey getKey() override;
|
virtual ItemKey getKey() override;
|
||||||
virtual ShapeKey getShapeKey() override;
|
virtual ShapeKey getShapeKey() override;
|
||||||
virtual void doRender(RenderArgs* args) override;
|
virtual void doRender(RenderArgs* args) override;
|
||||||
|
|
||||||
virtual bool isTransparent() const override { return true; }
|
void buildPipeline();
|
||||||
|
void updateGeometry();
|
||||||
|
void updateData();
|
||||||
|
|
||||||
struct Vertex {
|
QVector<glm::vec3> _points;
|
||||||
Vertex() {}
|
QVector<glm::vec3> _normals;
|
||||||
Vertex(const vec3& position, const vec3& normal, const vec2& uv, const vec3& color) : position(position),
|
QVector<glm::vec3> _colors;
|
||||||
normal(normal),
|
glm::vec3 _color;
|
||||||
uv(uv),
|
QVector<float> _widths;
|
||||||
color(color) {}
|
|
||||||
vec3 position;
|
|
||||||
vec3 normal;
|
|
||||||
vec2 uv;
|
|
||||||
vec3 color;
|
|
||||||
};
|
|
||||||
|
|
||||||
void updateGeometry(const std::vector<Vertex>& vertices);
|
|
||||||
static std::vector<Vertex> updateVertices(const QVector<glm::vec3>& points,
|
|
||||||
const QVector<glm::vec3>& normals,
|
|
||||||
const QVector<float>& strokeWidths,
|
|
||||||
const QVector<glm::vec3>& strokeColors,
|
|
||||||
const bool isUVModeStretch,
|
|
||||||
const float textureAspectRatio);
|
|
||||||
|
|
||||||
Transform _polylineTransform;
|
|
||||||
QVector<glm::vec3> _lastPoints;
|
|
||||||
QVector<glm::vec3> _lastNormals;
|
|
||||||
QVector<glm::vec3> _lastStrokeColors;
|
|
||||||
QVector<float> _lastStrokeWidths;
|
|
||||||
gpu::BufferPointer _verticesBuffer;
|
|
||||||
|
|
||||||
uint32_t _numVertices { 0 };
|
|
||||||
bool _empty{ true };
|
|
||||||
NetworkTexturePointer _texture;
|
NetworkTexturePointer _texture;
|
||||||
float _textureAspectRatio { 1.0f };
|
float _textureAspectRatio { 1.0f };
|
||||||
|
bool _textureLoaded { false };
|
||||||
|
|
||||||
|
bool _isUVModeStretch;
|
||||||
|
bool _faceCamera;
|
||||||
|
bool _glow;
|
||||||
|
|
||||||
|
size_t _numVertices;
|
||||||
|
gpu::BufferPointer _polylineDataBuffer;
|
||||||
|
gpu::BufferPointer _polylineGeometryBuffer;
|
||||||
|
static gpu::PipelinePointer _pipeline;
|
||||||
};
|
};
|
||||||
|
|
||||||
} } // namespace
|
} } // namespace
|
||||||
|
|
|
@ -14,21 +14,27 @@
|
||||||
|
|
||||||
<@include DeferredBufferWrite.slh@>
|
<@include DeferredBufferWrite.slh@>
|
||||||
|
|
||||||
// the albedo texture
|
<@include paintStroke.slh@>
|
||||||
LAYOUT(binding=0) uniform sampler2D originalTexture;
|
<$declarePolyLineBuffers()$>
|
||||||
|
|
||||||
// the interpolated normal
|
LAYOUT(binding=0) uniform sampler2D _texture;
|
||||||
layout(location=0) in vec3 interpolatedNormal;
|
|
||||||
layout(location=1) in vec2 varTexcoord;
|
layout(location=0) in vec3 _normalWS;
|
||||||
layout(location=2) in vec4 varColor;
|
layout(location=1) in vec2 _texCoord;
|
||||||
|
layout(location=2) in vec4 _color;
|
||||||
|
layout(location=3) in float _distanceFromCenter;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
vec4 texel = texture(originalTexture, varTexcoord);
|
vec4 texel = texture(_texture, _texCoord);
|
||||||
int frontCondition = 1 -int(gl_FrontFacing) * 2;
|
int frontCondition = 1 - 2 * int(gl_FrontFacing);
|
||||||
vec3 color = varColor.rgb;
|
vec3 color = _color.rgb * texel.rgb;
|
||||||
|
float alpha = texel.a * _color.a;
|
||||||
|
|
||||||
|
alpha *= mix(1.0, pow(1.0 - abs(_distanceFromCenter), 10.0), _polylineData.faceCameraGlow.y);
|
||||||
|
|
||||||
packDeferredFragmentTranslucent(
|
packDeferredFragmentTranslucent(
|
||||||
float(frontCondition) * interpolatedNormal,
|
float(frontCondition) * _normalWS,
|
||||||
texel.a * varColor.a,
|
alpha,
|
||||||
color * texel.rgb,
|
color,
|
||||||
10.0);
|
DEFAULT_ROUGHNESS);
|
||||||
}
|
}
|
||||||
|
|
48
libraries/entities-renderer/src/paintStroke.slh
Normal file
48
libraries/entities-renderer/src/paintStroke.slh
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
<!
|
||||||
|
// paintStroke.slh
|
||||||
|
//
|
||||||
|
// Created by Sam Gondelman on 12/13/2018
|
||||||
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
!>
|
||||||
|
|
||||||
|
<@if not PAINTSTROKE_SLH@>
|
||||||
|
<@def PAINTSTROKE_SLH@>
|
||||||
|
|
||||||
|
<@include paintStroke_Shared.slh@>
|
||||||
|
<@include gpu/ShaderConstants.h@>
|
||||||
|
|
||||||
|
<@func declarePolyLineBuffers() @>
|
||||||
|
|
||||||
|
// Hack comment to absorb the extra '//' scribe prepends
|
||||||
|
|
||||||
|
#if !defined(GPU_SSBO_TRANSFORM_OBJECT)
|
||||||
|
LAYOUT(binding=GPU_RESOURCE_BUFFER_SLOT0_TEXTURE) uniform samplerBuffer polylineVerticesBuffer;
|
||||||
|
PolylineVertex getPolylineVertex(int i) {
|
||||||
|
int offset = 4 * i;
|
||||||
|
PolylineVertex vertex;
|
||||||
|
vertex.positionAndUCoord = texelFetch(polylineVerticesBuffer, offset);
|
||||||
|
vertex.color = texelFetch(polylineVerticesBuffer, offset + 1);
|
||||||
|
vertex.normal = texelFetch(polylineVerticesBuffer, offset + 2);
|
||||||
|
vertex.binormalAndHalfWidth = texelFetch(polylineVerticesBuffer, offset + 3);
|
||||||
|
return vertex;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
LAYOUT_STD140(binding=GPU_RESOURCE_BUFFER_SLOT0_STORAGE) buffer polylineVerticesBuffer {
|
||||||
|
PolylineVertex _vertices[];
|
||||||
|
};
|
||||||
|
PolylineVertex getPolylineVertex(int i) {
|
||||||
|
PolylineVertex vertex = _vertices[i];
|
||||||
|
return vertex;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
LAYOUT_STD140(binding=0) uniform polylineDataBuffer {
|
||||||
|
PolylineData _polylineData;
|
||||||
|
};
|
||||||
|
|
||||||
|
<@endfunc@>
|
||||||
|
|
||||||
|
<@endif@>
|
|
@ -17,23 +17,45 @@
|
||||||
<@include gpu/Transform.slh@>
|
<@include gpu/Transform.slh@>
|
||||||
<$declareStandardTransform()$>
|
<$declareStandardTransform()$>
|
||||||
|
|
||||||
// the interpolated normal
|
<@include paintStroke.slh@>
|
||||||
layout(location=0) out vec3 interpolatedNormal;
|
<$declarePolyLineBuffers()$>
|
||||||
|
|
||||||
//the diffuse texture
|
layout(location=0) out vec3 _normalWS;
|
||||||
layout(location=1) out vec2 varTexcoord;
|
layout(location=1) out vec2 _texCoord;
|
||||||
|
layout(location=2) out vec4 _color;
|
||||||
layout(location=2) out vec4 varColor;
|
layout(location=3) out float _distanceFromCenter;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
varTexcoord = inTexCoord0.st;
|
PolylineVertex vertex = getPolylineVertex(gl_VertexID / 2);
|
||||||
|
float evenVertex = float(gl_VertexID % 2 == 0);
|
||||||
|
|
||||||
// pass along the diffuse color
|
_texCoord = vec2(vertex.positionAndUCoord.w, mix(1.0, 0.0, evenVertex));
|
||||||
varColor = color_sRGBAToLinear(inColor);
|
_color = color_sRGBAToLinear(vertex.color);
|
||||||
|
|
||||||
// standard transform
|
|
||||||
TransformCamera cam = getTransformCamera();
|
TransformCamera cam = getTransformCamera();
|
||||||
TransformObject obj = getTransformObject();
|
TransformObject obj = getTransformObject();
|
||||||
<$transformModelToClipPos(cam, obj, inPosition, gl_Position)$>
|
_distanceFromCenter = -1.0 + 2.0 * evenVertex;
|
||||||
<$transformModelToEyeDir(cam, obj, inNormal.xyz, interpolatedNormal)$>
|
vec4 position = vec4(vertex.positionAndUCoord.xyz, 1.0);
|
||||||
|
vec3 normal = vertex.normal.xyz;
|
||||||
|
vec3 binormal = vertex.binormalAndHalfWidth.xyz;
|
||||||
|
if (_polylineData.faceCameraGlow.x != 0.0) {
|
||||||
|
vec4 posEye;
|
||||||
|
vec3 normalEye;
|
||||||
|
vec3 binormalEye;
|
||||||
|
<$transformModelToEyePos(cam, obj, position, posEye)$>
|
||||||
|
<$transformModelToEyeDir(cam, obj, normal, normalEye)$>
|
||||||
|
<$transformModelToEyeDir(cam, obj, binormal, binormalEye)$>
|
||||||
|
|
||||||
|
vec3 tangentEye = cross(binormalEye, normalEye);
|
||||||
|
// new normal faces the camera
|
||||||
|
normalEye = normalize(posEye.xyz);
|
||||||
|
binormalEye = normalize(cross(normalEye, tangentEye));
|
||||||
|
posEye.xyz += _distanceFromCenter * vertex.binormalAndHalfWidth.w * binormalEye;
|
||||||
|
<$transformEyeToClipPos(cam, posEye, gl_Position)$>
|
||||||
|
<$transformEyeToWorldDir(cam, normalEye, _normalWS)$>
|
||||||
|
} else {
|
||||||
|
position.xyz += _distanceFromCenter * vertex.binormalAndHalfWidth.w * binormal;
|
||||||
|
<$transformModelToClipPos(cam, obj, position, gl_Position)$>
|
||||||
|
<$transformModelToWorldDir(cam, obj, normal, _normalWS)$>
|
||||||
|
}
|
||||||
}
|
}
|
25
libraries/entities-renderer/src/paintStroke_Shared.slh
Normal file
25
libraries/entities-renderer/src/paintStroke_Shared.slh
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
// glsl / C++ compatible source as interface for FadeEffect
|
||||||
|
#ifdef __cplusplus
|
||||||
|
# define _PL_VEC4 glm::vec4
|
||||||
|
# define _PL_VEC2 glm::vec2
|
||||||
|
#else
|
||||||
|
# define _PL_VEC4 vec4
|
||||||
|
# define _PL_VEC2 vec2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct PolylineVertex {
|
||||||
|
_PL_VEC4 positionAndUCoord;
|
||||||
|
_PL_VEC4 color;
|
||||||
|
_PL_VEC4 normal;
|
||||||
|
_PL_VEC4 binormalAndHalfWidth;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct PolylineData {
|
||||||
|
_PL_VEC2 faceCameraGlow;
|
||||||
|
_PL_VEC2 spare;
|
||||||
|
};
|
||||||
|
|
||||||
|
// <@if 1@>
|
||||||
|
// Trigger Scribe include
|
||||||
|
// <@endif@> <!def that !>
|
||||||
|
//
|
|
@ -1,52 +0,0 @@
|
||||||
<@include gpu/Config.slh@>
|
|
||||||
<$VERSION_HEADER$>
|
|
||||||
// Generated on <$_SCRIBE_DATE$>
|
|
||||||
//
|
|
||||||
// paintStroke_fade.frag
|
|
||||||
// fragment shader
|
|
||||||
//
|
|
||||||
// Created by Olivier Prat on 19/07/17.
|
|
||||||
// Copyright 2017 High Fidelity, Inc.
|
|
||||||
//
|
|
||||||
// Distributed under the Apache License, Version 2.0.
|
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
||||||
//
|
|
||||||
|
|
||||||
<@include DeferredBufferWrite.slh@>
|
|
||||||
|
|
||||||
<@include Fade.slh@>
|
|
||||||
<$declareFadeFragment()$>
|
|
||||||
|
|
||||||
// the albedo texture
|
|
||||||
LAYOUT(binding=0) uniform sampler2D originalTexture;
|
|
||||||
|
|
||||||
// the interpolated normal
|
|
||||||
layout(location=0) in vec3 interpolatedNormal;
|
|
||||||
layout(location=1) in vec2 varTexcoord;
|
|
||||||
layout(location=2) in vec4 varColor;
|
|
||||||
layout(location=3) in vec4 _worldPosition;
|
|
||||||
|
|
||||||
struct PolyLineUniforms {
|
|
||||||
vec3 color;
|
|
||||||
};
|
|
||||||
|
|
||||||
LAYOUT(binding=0) uniform polyLineBuffer {
|
|
||||||
PolyLineUniforms polyline;
|
|
||||||
};
|
|
||||||
|
|
||||||
void main(void) {
|
|
||||||
vec3 fadeEmissive;
|
|
||||||
FadeObjectParams fadeParams;
|
|
||||||
|
|
||||||
<$fetchFadeObjectParams(fadeParams)$>
|
|
||||||
applyFade(fadeParams, _worldPosition.xyz, fadeEmissive);
|
|
||||||
|
|
||||||
vec4 texel = texture(originalTexture, varTexcoord);
|
|
||||||
int frontCondition = 1 -int(gl_FrontFacing) * 2;
|
|
||||||
vec3 color = varColor.rgb;
|
|
||||||
packDeferredFragmentTranslucent(
|
|
||||||
interpolatedNormal * float(frontCondition),
|
|
||||||
texel.a * varColor.a,
|
|
||||||
polyline.color * texel.rgb + fadeEmissive,
|
|
||||||
10.0);
|
|
||||||
}
|
|
|
@ -1,43 +0,0 @@
|
||||||
<@include gpu/Config.slh@>
|
|
||||||
<$VERSION_HEADER$>
|
|
||||||
// Generated on <$_SCRIBE_DATE$>
|
|
||||||
//
|
|
||||||
// paintStroke_fade.vert
|
|
||||||
// vertex shader
|
|
||||||
//
|
|
||||||
// Created by Olivier Prat on 19/07/17.
|
|
||||||
// Copyright 2017 High Fidelity, Inc.
|
|
||||||
//
|
|
||||||
// Distributed under the Apache License, Version 2.0.
|
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
||||||
//
|
|
||||||
|
|
||||||
<@include gpu/Inputs.slh@>
|
|
||||||
<@include gpu/Color.slh@>
|
|
||||||
<@include gpu/Transform.slh@>
|
|
||||||
<$declareStandardTransform()$>
|
|
||||||
|
|
||||||
// the interpolated normal
|
|
||||||
layout(location=0) out vec3 interpolatedNormal;
|
|
||||||
|
|
||||||
//the diffuse texture
|
|
||||||
layout(location=1) out vec2 varTexcoord;
|
|
||||||
|
|
||||||
layout(location=2) out vec4 varColor;
|
|
||||||
layout(location=3) out vec4 _worldPosition;
|
|
||||||
|
|
||||||
void main(void) {
|
|
||||||
|
|
||||||
varTexcoord = inTexCoord0.st;
|
|
||||||
|
|
||||||
// pass along the diffuse color
|
|
||||||
varColor = color_sRGBAToLinear(inColor);
|
|
||||||
|
|
||||||
|
|
||||||
// standard transform
|
|
||||||
TransformCamera cam = getTransformCamera();
|
|
||||||
TransformObject obj = getTransformObject();
|
|
||||||
<$transformModelToClipPos(cam, obj, inPosition, gl_Position)$>
|
|
||||||
<$transformModelToEyeDir(cam, obj, inNormal.xyz, interpolatedNormal)$>
|
|
||||||
<$transformModelToWorldPos(obj, inPosition, _worldPosition)$>
|
|
||||||
}
|
|
|
@ -182,14 +182,29 @@ void AnimationPropertyGroup::listChangedProperties(QList<QString>& out) {
|
||||||
if (urlChanged()) {
|
if (urlChanged()) {
|
||||||
out << "animation-url";
|
out << "animation-url";
|
||||||
}
|
}
|
||||||
|
if (allowTranslationChanged()) {
|
||||||
|
out << "animation-allowTranslation";
|
||||||
|
}
|
||||||
if (fpsChanged()) {
|
if (fpsChanged()) {
|
||||||
out << "animation-fps";
|
out << "animation-fps";
|
||||||
}
|
}
|
||||||
if (currentFrameChanged()) {
|
if (currentFrameChanged()) {
|
||||||
out << "animation-currentFrame";
|
out << "animation-currentFrame";
|
||||||
}
|
}
|
||||||
if (allowTranslationChanged()) {
|
if (runningChanged()) {
|
||||||
out << "animation-allowTranslation";
|
out << "animation-running";
|
||||||
|
}
|
||||||
|
if (loopChanged()) {
|
||||||
|
out << "animation-loop";
|
||||||
|
}
|
||||||
|
if (firstFrameChanged()) {
|
||||||
|
out << "animation-firstFrame";
|
||||||
|
}
|
||||||
|
if (lastFrameChanged()) {
|
||||||
|
out << "animation-lastFrame";
|
||||||
|
}
|
||||||
|
if (holdChanged()) {
|
||||||
|
out << "animation-hold";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,7 +239,6 @@ bool AnimationPropertyGroup::decodeFromEditPacket(EntityPropertyFlags& propertyF
|
||||||
|
|
||||||
READ_ENTITY_PROPERTY(PROP_ANIMATION_URL, QString, setURL);
|
READ_ENTITY_PROPERTY(PROP_ANIMATION_URL, QString, setURL);
|
||||||
READ_ENTITY_PROPERTY(PROP_ANIMATION_ALLOW_TRANSLATION, bool, setAllowTranslation);
|
READ_ENTITY_PROPERTY(PROP_ANIMATION_ALLOW_TRANSLATION, bool, setAllowTranslation);
|
||||||
|
|
||||||
READ_ENTITY_PROPERTY(PROP_ANIMATION_FPS, float, setFPS);
|
READ_ENTITY_PROPERTY(PROP_ANIMATION_FPS, float, setFPS);
|
||||||
READ_ENTITY_PROPERTY(PROP_ANIMATION_FRAME_INDEX, float, setCurrentFrame);
|
READ_ENTITY_PROPERTY(PROP_ANIMATION_FRAME_INDEX, float, setCurrentFrame);
|
||||||
READ_ENTITY_PROPERTY(PROP_ANIMATION_PLAYING, bool, setRunning);
|
READ_ENTITY_PROPERTY(PROP_ANIMATION_PLAYING, bool, setRunning);
|
||||||
|
@ -234,6 +248,7 @@ bool AnimationPropertyGroup::decodeFromEditPacket(EntityPropertyFlags& propertyF
|
||||||
READ_ENTITY_PROPERTY(PROP_ANIMATION_HOLD, bool, setHold);
|
READ_ENTITY_PROPERTY(PROP_ANIMATION_HOLD, bool, setHold);
|
||||||
|
|
||||||
DECODE_GROUP_PROPERTY_HAS_CHANGED(PROP_ANIMATION_URL, URL);
|
DECODE_GROUP_PROPERTY_HAS_CHANGED(PROP_ANIMATION_URL, URL);
|
||||||
|
DECODE_GROUP_PROPERTY_HAS_CHANGED(PROP_ANIMATION_ALLOW_TRANSLATION, AllowTranslation);
|
||||||
DECODE_GROUP_PROPERTY_HAS_CHANGED(PROP_ANIMATION_FPS, FPS);
|
DECODE_GROUP_PROPERTY_HAS_CHANGED(PROP_ANIMATION_FPS, FPS);
|
||||||
DECODE_GROUP_PROPERTY_HAS_CHANGED(PROP_ANIMATION_FRAME_INDEX, CurrentFrame);
|
DECODE_GROUP_PROPERTY_HAS_CHANGED(PROP_ANIMATION_FRAME_INDEX, CurrentFrame);
|
||||||
DECODE_GROUP_PROPERTY_HAS_CHANGED(PROP_ANIMATION_PLAYING, Running);
|
DECODE_GROUP_PROPERTY_HAS_CHANGED(PROP_ANIMATION_PLAYING, Running);
|
||||||
|
@ -241,7 +256,6 @@ bool AnimationPropertyGroup::decodeFromEditPacket(EntityPropertyFlags& propertyF
|
||||||
DECODE_GROUP_PROPERTY_HAS_CHANGED(PROP_ANIMATION_FIRST_FRAME, FirstFrame);
|
DECODE_GROUP_PROPERTY_HAS_CHANGED(PROP_ANIMATION_FIRST_FRAME, FirstFrame);
|
||||||
DECODE_GROUP_PROPERTY_HAS_CHANGED(PROP_ANIMATION_LAST_FRAME, LastFrame);
|
DECODE_GROUP_PROPERTY_HAS_CHANGED(PROP_ANIMATION_LAST_FRAME, LastFrame);
|
||||||
DECODE_GROUP_PROPERTY_HAS_CHANGED(PROP_ANIMATION_HOLD, Hold);
|
DECODE_GROUP_PROPERTY_HAS_CHANGED(PROP_ANIMATION_HOLD, Hold);
|
||||||
DECODE_GROUP_PROPERTY_HAS_CHANGED(PROP_ANIMATION_ALLOW_TRANSLATION, AllowTranslation);
|
|
||||||
|
|
||||||
processedBytes += bytesRead;
|
processedBytes += bytesRead;
|
||||||
|
|
||||||
|
@ -252,6 +266,7 @@ bool AnimationPropertyGroup::decodeFromEditPacket(EntityPropertyFlags& propertyF
|
||||||
|
|
||||||
void AnimationPropertyGroup::markAllChanged() {
|
void AnimationPropertyGroup::markAllChanged() {
|
||||||
_urlChanged = true;
|
_urlChanged = true;
|
||||||
|
_allowTranslationChanged = true;
|
||||||
_fpsChanged = true;
|
_fpsChanged = true;
|
||||||
_currentFrameChanged = true;
|
_currentFrameChanged = true;
|
||||||
_runningChanged = true;
|
_runningChanged = true;
|
||||||
|
@ -259,13 +274,13 @@ void AnimationPropertyGroup::markAllChanged() {
|
||||||
_firstFrameChanged = true;
|
_firstFrameChanged = true;
|
||||||
_lastFrameChanged = true;
|
_lastFrameChanged = true;
|
||||||
_holdChanged = true;
|
_holdChanged = true;
|
||||||
_allowTranslationChanged = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityPropertyFlags AnimationPropertyGroup::getChangedProperties() const {
|
EntityPropertyFlags AnimationPropertyGroup::getChangedProperties() const {
|
||||||
EntityPropertyFlags changedProperties;
|
EntityPropertyFlags changedProperties;
|
||||||
|
|
||||||
CHECK_PROPERTY_CHANGE(PROP_ANIMATION_URL, url);
|
CHECK_PROPERTY_CHANGE(PROP_ANIMATION_URL, url);
|
||||||
|
CHECK_PROPERTY_CHANGE(PROP_ANIMATION_ALLOW_TRANSLATION, allowTranslation);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_ANIMATION_FPS, fps);
|
CHECK_PROPERTY_CHANGE(PROP_ANIMATION_FPS, fps);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_ANIMATION_FRAME_INDEX, currentFrame);
|
CHECK_PROPERTY_CHANGE(PROP_ANIMATION_FRAME_INDEX, currentFrame);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_ANIMATION_PLAYING, running);
|
CHECK_PROPERTY_CHANGE(PROP_ANIMATION_PLAYING, running);
|
||||||
|
@ -273,7 +288,6 @@ EntityPropertyFlags AnimationPropertyGroup::getChangedProperties() const {
|
||||||
CHECK_PROPERTY_CHANGE(PROP_ANIMATION_FIRST_FRAME, firstFrame);
|
CHECK_PROPERTY_CHANGE(PROP_ANIMATION_FIRST_FRAME, firstFrame);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_ANIMATION_LAST_FRAME, lastFrame);
|
CHECK_PROPERTY_CHANGE(PROP_ANIMATION_LAST_FRAME, lastFrame);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_ANIMATION_HOLD, hold);
|
CHECK_PROPERTY_CHANGE(PROP_ANIMATION_HOLD, hold);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_ANIMATION_ALLOW_TRANSLATION, allowTranslation);
|
|
||||||
|
|
||||||
return changedProperties;
|
return changedProperties;
|
||||||
}
|
}
|
||||||
|
@ -309,6 +323,7 @@ EntityPropertyFlags AnimationPropertyGroup::getEntityProperties(EncodeBitstreamP
|
||||||
EntityPropertyFlags requestedProperties;
|
EntityPropertyFlags requestedProperties;
|
||||||
|
|
||||||
requestedProperties += PROP_ANIMATION_URL;
|
requestedProperties += PROP_ANIMATION_URL;
|
||||||
|
requestedProperties += PROP_ANIMATION_ALLOW_TRANSLATION;
|
||||||
requestedProperties += PROP_ANIMATION_FPS;
|
requestedProperties += PROP_ANIMATION_FPS;
|
||||||
requestedProperties += PROP_ANIMATION_FRAME_INDEX;
|
requestedProperties += PROP_ANIMATION_FRAME_INDEX;
|
||||||
requestedProperties += PROP_ANIMATION_PLAYING;
|
requestedProperties += PROP_ANIMATION_PLAYING;
|
||||||
|
@ -316,7 +331,6 @@ EntityPropertyFlags AnimationPropertyGroup::getEntityProperties(EncodeBitstreamP
|
||||||
requestedProperties += PROP_ANIMATION_FIRST_FRAME;
|
requestedProperties += PROP_ANIMATION_FIRST_FRAME;
|
||||||
requestedProperties += PROP_ANIMATION_LAST_FRAME;
|
requestedProperties += PROP_ANIMATION_LAST_FRAME;
|
||||||
requestedProperties += PROP_ANIMATION_HOLD;
|
requestedProperties += PROP_ANIMATION_HOLD;
|
||||||
requestedProperties += PROP_ANIMATION_ALLOW_TRANSLATION;
|
|
||||||
|
|
||||||
return requestedProperties;
|
return requestedProperties;
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,15 +85,15 @@ EntityPropertyFlags EntityItem::getEntityProperties(EncodeBitstreamParams& param
|
||||||
requestedProperties += PROP_DIMENSIONS;
|
requestedProperties += PROP_DIMENSIONS;
|
||||||
requestedProperties += PROP_ROTATION;
|
requestedProperties += PROP_ROTATION;
|
||||||
requestedProperties += PROP_REGISTRATION_POINT;
|
requestedProperties += PROP_REGISTRATION_POINT;
|
||||||
// TODO: handle PROP_CREATED?
|
requestedProperties += PROP_CREATED;
|
||||||
requestedProperties += PROP_LAST_EDITED_BY;
|
requestedProperties += PROP_LAST_EDITED_BY;
|
||||||
requestedProperties += PROP_ENTITY_HOST_TYPE;
|
//requestedProperties += PROP_ENTITY_HOST_TYPE; // not sent over the wire
|
||||||
requestedProperties += PROP_OWNING_AVATAR_ID;
|
//requestedProperties += PROP_OWNING_AVATAR_ID; // not sent over the wire
|
||||||
requestedProperties += PROP_PARENT_ID;
|
requestedProperties += PROP_PARENT_ID;
|
||||||
requestedProperties += PROP_PARENT_JOINT_INDEX;
|
requestedProperties += PROP_PARENT_JOINT_INDEX;
|
||||||
requestedProperties += PROP_QUERY_AA_CUBE;
|
requestedProperties += PROP_QUERY_AA_CUBE;
|
||||||
requestedProperties += PROP_CAN_CAST_SHADOW;
|
requestedProperties += PROP_CAN_CAST_SHADOW;
|
||||||
// requestedProperties += PROP_VISIBLE_IN_SECONDARY_CAMERA; // not sent over wire
|
// requestedProperties += PROP_VISIBLE_IN_SECONDARY_CAMERA; // not sent over the wire
|
||||||
withReadLock([&] {
|
withReadLock([&] {
|
||||||
requestedProperties += _grabProperties.getEntityProperties(params);
|
requestedProperties += _grabProperties.getEntityProperties(params);
|
||||||
});
|
});
|
||||||
|
@ -178,9 +178,6 @@ OctreeElement::AppendState EntityItem::appendEntityData(OctreePacketData* packet
|
||||||
EntityPropertyFlags propertyFlags(PROP_LAST_ITEM);
|
EntityPropertyFlags propertyFlags(PROP_LAST_ITEM);
|
||||||
EntityPropertyFlags requestedProperties = getEntityProperties(params);
|
EntityPropertyFlags requestedProperties = getEntityProperties(params);
|
||||||
|
|
||||||
requestedProperties -= PROP_ENTITY_HOST_TYPE;
|
|
||||||
requestedProperties -= PROP_OWNING_AVATAR_ID;
|
|
||||||
|
|
||||||
// If we are being called for a subsequent pass at appendEntityData() that failed to completely encode this item,
|
// If we are being called for a subsequent pass at appendEntityData() that failed to completely encode this item,
|
||||||
// then our entityTreeElementExtraEncodeData should include data about which properties we need to append.
|
// then our entityTreeElementExtraEncodeData should include data about which properties we need to append.
|
||||||
if (entityTreeElementExtraEncodeData && entityTreeElementExtraEncodeData->entities.contains(getEntityItemID())) {
|
if (entityTreeElementExtraEncodeData && entityTreeElementExtraEncodeData->entities.contains(getEntityItemID())) {
|
||||||
|
@ -263,10 +260,10 @@ OctreeElement::AppendState EntityItem::appendEntityData(OctreePacketData* packet
|
||||||
APPEND_ENTITY_PROPERTY(PROP_DIMENSIONS, getUnscaledDimensions());
|
APPEND_ENTITY_PROPERTY(PROP_DIMENSIONS, getUnscaledDimensions());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_ROTATION, getLocalOrientation());
|
APPEND_ENTITY_PROPERTY(PROP_ROTATION, getLocalOrientation());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_REGISTRATION_POINT, getRegistrationPoint());
|
APPEND_ENTITY_PROPERTY(PROP_REGISTRATION_POINT, getRegistrationPoint());
|
||||||
// TODO: handle created?
|
APPEND_ENTITY_PROPERTY(PROP_CREATED, getCreated());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_LAST_EDITED_BY, getLastEditedBy());
|
APPEND_ENTITY_PROPERTY(PROP_LAST_EDITED_BY, getLastEditedBy());
|
||||||
// APPEND_ENTITY_PROPERTY(PROP_ENTITY_HOST_TYPE, getEntityHostType()); // not sent over wire
|
// APPEND_ENTITY_PROPERTY(PROP_ENTITY_HOST_TYPE, getEntityHostType()); // not sent over the wire
|
||||||
// APPEND_ENTITY_PROPERTY(PROP_OWNING_AVATAR_ID, getOwningAvatarID()); // not sent over wire
|
// APPEND_ENTITY_PROPERTY(PROP_OWNING_AVATAR_ID, getOwningAvatarID()); // not sent over the wire
|
||||||
// convert AVATAR_SELF_ID to actual sessionUUID.
|
// convert AVATAR_SELF_ID to actual sessionUUID.
|
||||||
QUuid actualParentID = getParentID();
|
QUuid actualParentID = getParentID();
|
||||||
if (actualParentID == AVATAR_SELF_ID) {
|
if (actualParentID == AVATAR_SELF_ID) {
|
||||||
|
@ -277,7 +274,7 @@ OctreeElement::AppendState EntityItem::appendEntityData(OctreePacketData* packet
|
||||||
APPEND_ENTITY_PROPERTY(PROP_PARENT_JOINT_INDEX, getParentJointIndex());
|
APPEND_ENTITY_PROPERTY(PROP_PARENT_JOINT_INDEX, getParentJointIndex());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_QUERY_AA_CUBE, getQueryAACube());
|
APPEND_ENTITY_PROPERTY(PROP_QUERY_AA_CUBE, getQueryAACube());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_CAN_CAST_SHADOW, getCanCastShadow());
|
APPEND_ENTITY_PROPERTY(PROP_CAN_CAST_SHADOW, getCanCastShadow());
|
||||||
// APPEND_ENTITY_PROPERTY(PROP_VISIBLE_IN_SECONDARY_CAMERA, getIsVisibleInSecondaryCamera()); // not sent over wire
|
// APPEND_ENTITY_PROPERTY(PROP_VISIBLE_IN_SECONDARY_CAMERA, getIsVisibleInSecondaryCamera()); // not sent over the wire
|
||||||
withReadLock([&] {
|
withReadLock([&] {
|
||||||
_grabProperties.appendSubclassData(packetData, params, entityTreeElementExtraEncodeData, requestedProperties,
|
_grabProperties.appendSubclassData(packetData, params, entityTreeElementExtraEncodeData, requestedProperties,
|
||||||
propertyFlags, propertiesDidntFit, propertyCount, appendState);
|
propertyFlags, propertiesDidntFit, propertyCount, appendState);
|
||||||
|
@ -314,13 +311,13 @@ OctreeElement::AppendState EntityItem::appendEntityData(OctreePacketData* packet
|
||||||
APPEND_ENTITY_PROPERTY(PROP_SERVER_SCRIPTS, getServerScripts());
|
APPEND_ENTITY_PROPERTY(PROP_SERVER_SCRIPTS, getServerScripts());
|
||||||
|
|
||||||
// Certifiable Properties
|
// Certifiable Properties
|
||||||
APPEND_ENTITY_PROPERTY(PROP_MARKETPLACE_ID, getMarketplaceID());
|
|
||||||
APPEND_ENTITY_PROPERTY(PROP_ITEM_NAME, getItemName());
|
APPEND_ENTITY_PROPERTY(PROP_ITEM_NAME, getItemName());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_ITEM_DESCRIPTION, getItemDescription());
|
APPEND_ENTITY_PROPERTY(PROP_ITEM_DESCRIPTION, getItemDescription());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_ITEM_CATEGORIES, getItemCategories());
|
APPEND_ENTITY_PROPERTY(PROP_ITEM_CATEGORIES, getItemCategories());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_ITEM_ARTIST, getItemArtist());
|
APPEND_ENTITY_PROPERTY(PROP_ITEM_ARTIST, getItemArtist());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_ITEM_LICENSE, getItemLicense());
|
APPEND_ENTITY_PROPERTY(PROP_ITEM_LICENSE, getItemLicense());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_LIMITED_RUN, getLimitedRun());
|
APPEND_ENTITY_PROPERTY(PROP_LIMITED_RUN, getLimitedRun());
|
||||||
|
APPEND_ENTITY_PROPERTY(PROP_MARKETPLACE_ID, getMarketplaceID());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_EDITION_NUMBER, getEditionNumber());
|
APPEND_ENTITY_PROPERTY(PROP_EDITION_NUMBER, getEditionNumber());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_ENTITY_INSTANCE_NUMBER, getEntityInstanceNumber());
|
APPEND_ENTITY_PROPERTY(PROP_ENTITY_INSTANCE_NUMBER, getEntityInstanceNumber());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_CERTIFICATE_ID, getCertificateID());
|
APPEND_ENTITY_PROPERTY(PROP_CERTIFICATE_ID, getCertificateID());
|
||||||
|
@ -818,10 +815,10 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
|
||||||
READ_ENTITY_PROPERTY(PROP_ROTATION, glm::quat, customUpdateRotationFromNetwork);
|
READ_ENTITY_PROPERTY(PROP_ROTATION, glm::quat, customUpdateRotationFromNetwork);
|
||||||
}
|
}
|
||||||
READ_ENTITY_PROPERTY(PROP_REGISTRATION_POINT, glm::vec3, setRegistrationPoint);
|
READ_ENTITY_PROPERTY(PROP_REGISTRATION_POINT, glm::vec3, setRegistrationPoint);
|
||||||
// READ_ENTITY_PROPERTY(PROP_CREATED, quint64, setCreated); // not sent over wire
|
READ_ENTITY_PROPERTY(PROP_CREATED, quint64, setCreated);
|
||||||
READ_ENTITY_PROPERTY(PROP_LAST_EDITED_BY, QUuid, setLastEditedBy);
|
READ_ENTITY_PROPERTY(PROP_LAST_EDITED_BY, QUuid, setLastEditedBy);
|
||||||
// READ_ENTITY_PROPERTY(PROP_ENTITY_HOST_TYPE, entity::HostType, setEntityHostType); // not sent over wire
|
// READ_ENTITY_PROPERTY(PROP_ENTITY_HOST_TYPE, entity::HostType, setEntityHostType); // not sent over the wire
|
||||||
// READ_ENTITY_PROPERTY(PROP_OWNING_AVATAR_ID, QUuuid, setOwningAvatarID); // not sent over wire
|
// READ_ENTITY_PROPERTY(PROP_OWNING_AVATAR_ID, QUuuid, setOwningAvatarID); // not sent over the wire
|
||||||
{ // parentID and parentJointIndex are protected by simulation ownership
|
{ // parentID and parentJointIndex are protected by simulation ownership
|
||||||
bool oldOverwrite = overwriteLocalData;
|
bool oldOverwrite = overwriteLocalData;
|
||||||
overwriteLocalData = overwriteLocalData && !weOwnSimulation;
|
overwriteLocalData = overwriteLocalData && !weOwnSimulation;
|
||||||
|
@ -840,7 +837,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
|
||||||
READ_ENTITY_PROPERTY(PROP_QUERY_AA_CUBE, AACube, customUpdateQueryAACubeFromNetwork);
|
READ_ENTITY_PROPERTY(PROP_QUERY_AA_CUBE, AACube, customUpdateQueryAACubeFromNetwork);
|
||||||
}
|
}
|
||||||
READ_ENTITY_PROPERTY(PROP_CAN_CAST_SHADOW, bool, setCanCastShadow);
|
READ_ENTITY_PROPERTY(PROP_CAN_CAST_SHADOW, bool, setCanCastShadow);
|
||||||
// READ_ENTITY_PROPERTY(PROP_VISIBLE_IN_SECONDARY_CAMERA, bool, setIsVisibleInSecondaryCamera); // not sent over wire
|
// READ_ENTITY_PROPERTY(PROP_VISIBLE_IN_SECONDARY_CAMERA, bool, setIsVisibleInSecondaryCamera); // not sent over the wire
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
int bytesFromGrab = _grabProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args,
|
int bytesFromGrab = _grabProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args,
|
||||||
propertyFlags, overwriteLocalData,
|
propertyFlags, overwriteLocalData,
|
||||||
|
@ -904,18 +901,20 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
|
||||||
// from being received by an entity script server running a script that continously updates an entity.
|
// from being received by an entity script server running a script that continously updates an entity.
|
||||||
// Basically, we'll allow recent changes to the server scripts even if there are local changes to other properties
|
// Basically, we'll allow recent changes to the server scripts even if there are local changes to other properties
|
||||||
// that have been made more recently.
|
// that have been made more recently.
|
||||||
bool overwriteLocalData = !ignoreServerPacket || (lastEditedFromBufferAdjusted > _serverScriptsChangedTimestamp);
|
bool oldOverwrite = overwriteLocalData;
|
||||||
|
overwriteLocalData = !ignoreServerPacket || (lastEditedFromBufferAdjusted > _serverScriptsChangedTimestamp);
|
||||||
READ_ENTITY_PROPERTY(PROP_SERVER_SCRIPTS, QString, setServerScripts);
|
READ_ENTITY_PROPERTY(PROP_SERVER_SCRIPTS, QString, setServerScripts);
|
||||||
|
overwriteLocalData = oldOverwrite;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Certifiable props
|
// Certifiable props
|
||||||
READ_ENTITY_PROPERTY(PROP_MARKETPLACE_ID, QString, setMarketplaceID);
|
|
||||||
READ_ENTITY_PROPERTY(PROP_ITEM_NAME, QString, setItemName);
|
READ_ENTITY_PROPERTY(PROP_ITEM_NAME, QString, setItemName);
|
||||||
READ_ENTITY_PROPERTY(PROP_ITEM_DESCRIPTION, QString, setItemDescription);
|
READ_ENTITY_PROPERTY(PROP_ITEM_DESCRIPTION, QString, setItemDescription);
|
||||||
READ_ENTITY_PROPERTY(PROP_ITEM_CATEGORIES, QString, setItemCategories);
|
READ_ENTITY_PROPERTY(PROP_ITEM_CATEGORIES, QString, setItemCategories);
|
||||||
READ_ENTITY_PROPERTY(PROP_ITEM_ARTIST, QString, setItemArtist);
|
READ_ENTITY_PROPERTY(PROP_ITEM_ARTIST, QString, setItemArtist);
|
||||||
READ_ENTITY_PROPERTY(PROP_ITEM_LICENSE, QString, setItemLicense);
|
READ_ENTITY_PROPERTY(PROP_ITEM_LICENSE, QString, setItemLicense);
|
||||||
READ_ENTITY_PROPERTY(PROP_LIMITED_RUN, quint32, setLimitedRun);
|
READ_ENTITY_PROPERTY(PROP_LIMITED_RUN, quint32, setLimitedRun);
|
||||||
|
READ_ENTITY_PROPERTY(PROP_MARKETPLACE_ID, QString, setMarketplaceID);
|
||||||
READ_ENTITY_PROPERTY(PROP_EDITION_NUMBER, quint32, setEditionNumber);
|
READ_ENTITY_PROPERTY(PROP_EDITION_NUMBER, quint32, setEditionNumber);
|
||||||
READ_ENTITY_PROPERTY(PROP_ENTITY_INSTANCE_NUMBER, quint32, setEntityInstanceNumber);
|
READ_ENTITY_PROPERTY(PROP_ENTITY_INSTANCE_NUMBER, quint32, setEntityInstanceNumber);
|
||||||
READ_ENTITY_PROPERTY(PROP_CERTIFICATE_ID, QString, setCertificateID);
|
READ_ENTITY_PROPERTY(PROP_CERTIFICATE_ID, QString, setCertificateID);
|
||||||
|
@ -1309,7 +1308,7 @@ EntityItemProperties EntityItem::getProperties(const EntityPropertyFlags& desire
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(parentJointIndex, getParentJointIndex);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(parentJointIndex, getParentJointIndex);
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(queryAACube, getQueryAACube);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(queryAACube, getQueryAACube);
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(canCastShadow, getCanCastShadow);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(canCastShadow, getCanCastShadow);
|
||||||
// COPY_ENTITY_PROPERTY_TO_PROPERTIES(isVisibleInSecondaryCamera, getIsVisibleInSecondaryCamera); // not sent over wire
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(isVisibleInSecondaryCamera, isVisibleInSecondaryCamera);
|
||||||
withReadLock([&] {
|
withReadLock([&] {
|
||||||
_grabProperties.getProperties(properties);
|
_grabProperties.getProperties(properties);
|
||||||
});
|
});
|
||||||
|
|
|
@ -63,10 +63,6 @@ void EntityItemProperties::calculateNaturalPosition(const vec3& min, const vec3&
|
||||||
_naturalPosition = max - halfDimension;
|
_naturalPosition = max - halfDimension;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityItemProperties::setCreated(QDateTime &v) {
|
|
||||||
_created = v.toMSecsSinceEpoch() * 1000; // usec per msec
|
|
||||||
}
|
|
||||||
|
|
||||||
void EntityItemProperties::debugDump() const {
|
void EntityItemProperties::debugDump() const {
|
||||||
qCDebug(entities) << "EntityItemProperties...";
|
qCDebug(entities) << "EntityItemProperties...";
|
||||||
qCDebug(entities) << " _type=" << EntityTypes::getEntityTypeName(_type);
|
qCDebug(entities) << " _type=" << EntityTypes::getEntityTypeName(_type);
|
||||||
|
@ -358,7 +354,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
|
||||||
CHECK_PROPERTY_CHANGE(PROP_DIMENSIONS, dimensions);
|
CHECK_PROPERTY_CHANGE(PROP_DIMENSIONS, dimensions);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_ROTATION, rotation);
|
CHECK_PROPERTY_CHANGE(PROP_ROTATION, rotation);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_REGISTRATION_POINT, registrationPoint);
|
CHECK_PROPERTY_CHANGE(PROP_REGISTRATION_POINT, registrationPoint);
|
||||||
//CHECK_PROPERTY_CHANGE(PROP_CREATED, created); // can't change
|
CHECK_PROPERTY_CHANGE(PROP_CREATED, created);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_LAST_EDITED_BY, lastEditedBy);
|
CHECK_PROPERTY_CHANGE(PROP_LAST_EDITED_BY, lastEditedBy);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_ENTITY_HOST_TYPE, entityHostType);
|
CHECK_PROPERTY_CHANGE(PROP_ENTITY_HOST_TYPE, entityHostType);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_OWNING_AVATAR_ID, owningAvatarID);
|
CHECK_PROPERTY_CHANGE(PROP_OWNING_AVATAR_ID, owningAvatarID);
|
||||||
|
@ -527,6 +523,8 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
|
||||||
CHECK_PROPERTY_CHANGE(PROP_STROKE_NORMALS, normals);
|
CHECK_PROPERTY_CHANGE(PROP_STROKE_NORMALS, normals);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_STROKE_COLORS, strokeColors);
|
CHECK_PROPERTY_CHANGE(PROP_STROKE_COLORS, strokeColors);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_IS_UV_MODE_STRETCH, isUVModeStretch);
|
CHECK_PROPERTY_CHANGE(PROP_IS_UV_MODE_STRETCH, isUVModeStretch);
|
||||||
|
CHECK_PROPERTY_CHANGE(PROP_LINE_GLOW, glow);
|
||||||
|
CHECK_PROPERTY_CHANGE(PROP_LINE_FACE_CAMERA, faceCamera);
|
||||||
|
|
||||||
// Shape
|
// Shape
|
||||||
CHECK_PROPERTY_CHANGE(PROP_SHAPE, shape);
|
CHECK_PROPERTY_CHANGE(PROP_SHAPE, shape);
|
||||||
|
@ -1051,6 +1049,8 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
|
||||||
* format.
|
* format.
|
||||||
* @property {boolean} isUVModeStretch=true - If <code>true</code>, the texture is stretched to fill the whole line, otherwise
|
* @property {boolean} isUVModeStretch=true - If <code>true</code>, the texture is stretched to fill the whole line, otherwise
|
||||||
* the texture repeats along the line.
|
* the texture repeats along the line.
|
||||||
|
* @property {bool} glow=false - If <code>true</code>, the alpha of the strokes will drop off farther from the center.
|
||||||
|
* @property {bool} faceCamera=false - If <code>true</code>, each line segment will rotate to face the camera.
|
||||||
* @example <caption>Draw a textured "V".</caption>
|
* @example <caption>Draw a textured "V".</caption>
|
||||||
* var entity = Entities.addEntity({
|
* var entity = Entities.addEntity({
|
||||||
* type: "PolyLine",
|
* type: "PolyLine",
|
||||||
|
@ -1367,11 +1367,6 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
|
||||||
if (!psuedoPropertyFlagsActive || psueudoPropertyFlags.test(EntityPsuedoPropertyFlag::Type)) {
|
if (!psuedoPropertyFlagsActive || psueudoPropertyFlags.test(EntityPsuedoPropertyFlag::Type)) {
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER_ALWAYS(type, EntityTypes::getEntityTypeName(_type));
|
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER_ALWAYS(type, EntityTypes::getEntityTypeName(_type));
|
||||||
}
|
}
|
||||||
if (!psuedoPropertyFlagsActive || psueudoPropertyFlags.test(EntityPsuedoPropertyFlag::Created)) {
|
|
||||||
auto created = QDateTime::fromMSecsSinceEpoch(getCreated() / 1000.0f, Qt::UTC); // usec per msec
|
|
||||||
created.setTimeSpec(Qt::OffsetFromUTC);
|
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER_ALWAYS(created, created.toString(Qt::ISODate));
|
|
||||||
}
|
|
||||||
if ((!skipDefaults || _lifetime != defaultEntityProperties._lifetime) && !strictSemantics) {
|
if ((!skipDefaults || _lifetime != defaultEntityProperties._lifetime) && !strictSemantics) {
|
||||||
if (!psuedoPropertyFlagsActive || psueudoPropertyFlags.test(EntityPsuedoPropertyFlag::Age)) {
|
if (!psuedoPropertyFlagsActive || psueudoPropertyFlags.test(EntityPsuedoPropertyFlag::Age)) {
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER_NO_SKIP(age, getAge()); // gettable, but not settable
|
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER_NO_SKIP(age, getAge()); // gettable, but not settable
|
||||||
|
@ -1400,7 +1395,7 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_DIMENSIONS, dimensions);
|
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_DIMENSIONS, dimensions);
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ROTATION, rotation);
|
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ROTATION, rotation);
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_REGISTRATION_POINT, registrationPoint);
|
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_REGISTRATION_POINT, registrationPoint);
|
||||||
//COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CREATED, created); // handled above
|
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CREATED, created);
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LAST_EDITED_BY, lastEditedBy);
|
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LAST_EDITED_BY, lastEditedBy);
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_ENTITY_HOST_TYPE, entityHostType, getEntityHostTypeAsString());
|
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_ENTITY_HOST_TYPE, entityHostType, getEntityHostTypeAsString());
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_OWNING_AVATAR_ID, owningAvatarID);
|
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_OWNING_AVATAR_ID, owningAvatarID);
|
||||||
|
@ -1634,6 +1629,8 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_STROKE_NORMALS, normals);
|
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_STROKE_NORMALS, normals);
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_STROKE_COLORS, strokeColors, qVectorVec3Color);
|
COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(PROP_STROKE_COLORS, strokeColors, qVectorVec3Color);
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_IS_UV_MODE_STRETCH, isUVModeStretch);
|
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_IS_UV_MODE_STRETCH, isUVModeStretch);
|
||||||
|
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LINE_GLOW, glow);
|
||||||
|
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LINE_FACE_CAMERA, faceCamera);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Materials
|
// Materials
|
||||||
|
@ -1762,18 +1759,11 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool
|
||||||
setType(typeScriptValue.toVariant().toString());
|
setType(typeScriptValue.toVariant().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!honorReadOnly) {
|
|
||||||
// this is used by the json reader to set things that we don't want javascript to able to affect.
|
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE_GETTER(created, QDateTime, setCreated, [this]() {
|
|
||||||
auto result = QDateTime::fromMSecsSinceEpoch(_created / 1000, Qt::UTC); // usec per msec
|
|
||||||
return result;
|
|
||||||
});
|
|
||||||
// TODO: expose this to QScriptValue for JSON saves?
|
|
||||||
//COPY_PROPERTY_FROM_QSCRIPTVALUE(simulationOwner, ???, setSimulatorPriority);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Core
|
// Core
|
||||||
// simluationOwner above
|
if (!honorReadOnly) {
|
||||||
|
// not handled yet
|
||||||
|
// COPY_PROPERTY_FROM_QSCRIPTVALUE(simulationOwner, SimulationOwner, setSimulationOwner);
|
||||||
|
}
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(visible, bool, setVisible);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(visible, bool, setVisible);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(name, QString, setName);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(name, QString, setName);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(locked, bool, setLocked);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(locked, bool, setLocked);
|
||||||
|
@ -1784,10 +1774,12 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(dimensions, vec3, setDimensions);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(dimensions, vec3, setDimensions);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(rotation, quat, setRotation);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(rotation, quat, setRotation);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(registrationPoint, vec3, setRegistrationPoint);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(registrationPoint, vec3, setRegistrationPoint);
|
||||||
// created is read only
|
if (!honorReadOnly) {
|
||||||
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(created, quint64, setCreated);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(lastEditedBy, QUuid, setLastEditedBy);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(lastEditedBy, QUuid, setLastEditedBy);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(entityHostType, EntityHostType);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(entityHostType, EntityHostType);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(owningAvatarID, QUuid, setOwningAvatarID);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(owningAvatarID, QUuid, setOwningAvatarID);
|
||||||
|
}
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(parentID, QUuid, setParentID);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(parentID, QUuid, setParentID);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(parentJointIndex, quint16, setParentJointIndex);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(parentJointIndex, quint16, setParentJointIndex);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(queryAACube, AACube, setQueryAACube); // TODO: should scripts be able to set this?
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(queryAACube, AACube, setQueryAACube); // TODO: should scripts be able to set this?
|
||||||
|
@ -1813,7 +1805,9 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE_GETTER(collisionsWillMove, bool, setDynamic, getDynamic); // legacy support
|
COPY_PROPERTY_FROM_QSCRIPTVALUE_GETTER(collisionsWillMove, bool, setDynamic, getDynamic); // legacy support
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(dynamic, bool, setDynamic);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(dynamic, bool, setDynamic);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(collisionSoundURL, QString, setCollisionSoundURL);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(collisionSoundURL, QString, setCollisionSoundURL);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(actionData, QByteArray, setActionData); // TODO: should scripts be able to set this?
|
if (!honorReadOnly) {
|
||||||
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(actionData, QByteArray, setActionData);
|
||||||
|
}
|
||||||
|
|
||||||
// Cloning
|
// Cloning
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(cloneable, bool, setCloneable);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(cloneable, bool, setCloneable);
|
||||||
|
@ -1956,6 +1950,8 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(normals, qVectorVec3, setNormals);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(normals, qVectorVec3, setNormals);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(strokeColors, qVectorVec3, setStrokeColors);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(strokeColors, qVectorVec3, setStrokeColors);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(isUVModeStretch, bool, setIsUVModeStretch);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(isUVModeStretch, bool, setIsUVModeStretch);
|
||||||
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(glow, bool, setGlow);
|
||||||
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(faceCamera, bool, setFaceCamera);
|
||||||
|
|
||||||
// Shape
|
// Shape
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(shape, QString, setShape);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(shape, QString, setShape);
|
||||||
|
@ -2208,6 +2204,8 @@ void EntityItemProperties::merge(const EntityItemProperties& other) {
|
||||||
COPY_PROPERTY_IF_CHANGED(normals);
|
COPY_PROPERTY_IF_CHANGED(normals);
|
||||||
COPY_PROPERTY_IF_CHANGED(strokeColors);
|
COPY_PROPERTY_IF_CHANGED(strokeColors);
|
||||||
COPY_PROPERTY_IF_CHANGED(isUVModeStretch);
|
COPY_PROPERTY_IF_CHANGED(isUVModeStretch);
|
||||||
|
COPY_PROPERTY_IF_CHANGED(glow);
|
||||||
|
COPY_PROPERTY_IF_CHANGED(faceCamera);
|
||||||
|
|
||||||
// Shape
|
// Shape
|
||||||
COPY_PROPERTY_IF_CHANGED(shape);
|
COPY_PROPERTY_IF_CHANGED(shape);
|
||||||
|
@ -2290,13 +2288,13 @@ void EntityItemProperties::entityPropertyFlagsFromScriptValue(const QScriptValue
|
||||||
ADD_PROPERTY_TO_MAP(PROP_DIMENSIONS, Dimensions, dimensions, vec3);
|
ADD_PROPERTY_TO_MAP(PROP_DIMENSIONS, Dimensions, dimensions, vec3);
|
||||||
ADD_PROPERTY_TO_MAP(PROP_ROTATION, Rotation, rotation, quat);
|
ADD_PROPERTY_TO_MAP(PROP_ROTATION, Rotation, rotation, quat);
|
||||||
ADD_PROPERTY_TO_MAP(PROP_REGISTRATION_POINT, RegistrationPoint, registrationPoint, vec3);
|
ADD_PROPERTY_TO_MAP(PROP_REGISTRATION_POINT, RegistrationPoint, registrationPoint, vec3);
|
||||||
//ADD_PROPERTY_TO_MAP(PROP_CREATED, Created, created, quint64); // not yet handled
|
ADD_PROPERTY_TO_MAP(PROP_CREATED, Created, created, quint64);
|
||||||
//ADD_PROPERTY_TO_MAP(PROP_LAST_EDITED_BY, LastEditedBy, lastEditedBy, QUuid); // not yet handled
|
ADD_PROPERTY_TO_MAP(PROP_LAST_EDITED_BY, LastEditedBy, lastEditedBy, QUuid);
|
||||||
ADD_PROPERTY_TO_MAP(PROP_ENTITY_HOST_TYPE, EntityHostType, entityHostType, entity::HostType);
|
ADD_PROPERTY_TO_MAP(PROP_ENTITY_HOST_TYPE, EntityHostType, entityHostType, entity::HostType);
|
||||||
ADD_PROPERTY_TO_MAP(PROP_OWNING_AVATAR_ID, OwningAvatarID, owningAvatarID, QUuid);
|
ADD_PROPERTY_TO_MAP(PROP_OWNING_AVATAR_ID, OwningAvatarID, owningAvatarID, QUuid);
|
||||||
ADD_PROPERTY_TO_MAP(PROP_PARENT_ID, ParentID, parentID, QUuid);
|
ADD_PROPERTY_TO_MAP(PROP_PARENT_ID, ParentID, parentID, QUuid);
|
||||||
ADD_PROPERTY_TO_MAP(PROP_PARENT_JOINT_INDEX, ParentJointIndex, parentJointIndex, uint16_t);
|
ADD_PROPERTY_TO_MAP(PROP_PARENT_JOINT_INDEX, ParentJointIndex, parentJointIndex, uint16_t);
|
||||||
//ADD_PROPERTY_TO_MAP(PROP_QUERY_AA_CUBE, QueryAACube, queryAACube, AACube); // not yet handled
|
ADD_PROPERTY_TO_MAP(PROP_QUERY_AA_CUBE, QueryAACube, queryAACube, AACube);
|
||||||
ADD_PROPERTY_TO_MAP(PROP_CAN_CAST_SHADOW, CanCastShadow, canCastShadow, bool);
|
ADD_PROPERTY_TO_MAP(PROP_CAN_CAST_SHADOW, CanCastShadow, canCastShadow, bool);
|
||||||
ADD_PROPERTY_TO_MAP(PROP_VISIBLE_IN_SECONDARY_CAMERA, IsVisibleInSecondaryCamera, isVisibleInSecondaryCamera, bool);
|
ADD_PROPERTY_TO_MAP(PROP_VISIBLE_IN_SECONDARY_CAMERA, IsVisibleInSecondaryCamera, isVisibleInSecondaryCamera, bool);
|
||||||
{ // Grab
|
{ // Grab
|
||||||
|
@ -2524,6 +2522,8 @@ void EntityItemProperties::entityPropertyFlagsFromScriptValue(const QScriptValue
|
||||||
ADD_PROPERTY_TO_MAP(PROP_STROKE_NORMALS, Normals, normals, QVector<vec3>);
|
ADD_PROPERTY_TO_MAP(PROP_STROKE_NORMALS, Normals, normals, QVector<vec3>);
|
||||||
ADD_PROPERTY_TO_MAP(PROP_STROKE_COLORS, StrokeColors, strokeColors, QVector<vec3>);
|
ADD_PROPERTY_TO_MAP(PROP_STROKE_COLORS, StrokeColors, strokeColors, QVector<vec3>);
|
||||||
ADD_PROPERTY_TO_MAP(PROP_IS_UV_MODE_STRETCH, IsUVModeStretch, isUVModeStretch, QVector<float>);
|
ADD_PROPERTY_TO_MAP(PROP_IS_UV_MODE_STRETCH, IsUVModeStretch, isUVModeStretch, QVector<float>);
|
||||||
|
ADD_PROPERTY_TO_MAP(PROP_LINE_GLOW, Glow, glow, bool);
|
||||||
|
ADD_PROPERTY_TO_MAP(PROP_LINE_FACE_CAMERA, FaceCamera, faceCamera, bool);
|
||||||
|
|
||||||
// Shape
|
// Shape
|
||||||
ADD_PROPERTY_TO_MAP(PROP_SHAPE, Shape, shape, QString);
|
ADD_PROPERTY_TO_MAP(PROP_SHAPE, Shape, shape, QString);
|
||||||
|
@ -2679,16 +2679,15 @@ OctreeElement::AppendState EntityItemProperties::encodeEntityEditPacket(PacketTy
|
||||||
APPEND_ENTITY_PROPERTY(PROP_DIMENSIONS, properties.getDimensions());
|
APPEND_ENTITY_PROPERTY(PROP_DIMENSIONS, properties.getDimensions());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_ROTATION, properties.getRotation());
|
APPEND_ENTITY_PROPERTY(PROP_ROTATION, properties.getRotation());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_REGISTRATION_POINT, properties.getRegistrationPoint());
|
APPEND_ENTITY_PROPERTY(PROP_REGISTRATION_POINT, properties.getRegistrationPoint());
|
||||||
// FIXME: deal with these
|
APPEND_ENTITY_PROPERTY(PROP_CREATED, properties.getCreated());
|
||||||
// APPEND_ENTITY_PROPERTY(PROP_CREATED, properties.getCreated());
|
APPEND_ENTITY_PROPERTY(PROP_LAST_EDITED_BY, properties.getLastEditedBy());
|
||||||
// APPEND_ENTITY_PROPERTY(PROP_LAST_EDITED_BY, properties.getLastEditedBy());
|
// APPEND_ENTITY_PROPERTY(PROP_ENTITY_HOST_TYPE, (uint32_t)properties.getEntityHostType()); // not sent over the wire
|
||||||
// APPEND_ENTITY_PROPERTY(PROP_ENTITY_HOST_TYPE, (uint32_t)properties.getEntityHostType());
|
// APPEND_ENTITY_PROPERTY(PROP_OWNING_AVATAR_ID, properties.getOwningAvatarID()); // not sent over the wire
|
||||||
// APPEND_ENTITY_PROPERTY(PROP_OWNING_AVATAR_ID, properties.getOwningAvatarID());
|
|
||||||
APPEND_ENTITY_PROPERTY(PROP_PARENT_ID, properties.getParentID());
|
APPEND_ENTITY_PROPERTY(PROP_PARENT_ID, properties.getParentID());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_PARENT_JOINT_INDEX, properties.getParentJointIndex());
|
APPEND_ENTITY_PROPERTY(PROP_PARENT_JOINT_INDEX, properties.getParentJointIndex());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_QUERY_AA_CUBE, properties.getQueryAACube());
|
APPEND_ENTITY_PROPERTY(PROP_QUERY_AA_CUBE, properties.getQueryAACube());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_CAN_CAST_SHADOW, properties.getCanCastShadow());
|
APPEND_ENTITY_PROPERTY(PROP_CAN_CAST_SHADOW, properties.getCanCastShadow());
|
||||||
// APPEND_ENTITY_PROPERTY(PROP_VISIBLE_IN_SECONDARY_CAMERA, properties.getIsVisibleInSecondaryCamera()); // Not sent over the wire
|
// APPEND_ENTITY_PROPERTY(PROP_VISIBLE_IN_SECONDARY_CAMERA, properties.getIsVisibleInSecondaryCamera()); // not sent over the wire
|
||||||
_staticGrab.setProperties(properties);
|
_staticGrab.setProperties(properties);
|
||||||
_staticGrab.appendToEditPacket(packetData, requestedProperties, propertyFlags,
|
_staticGrab.appendToEditPacket(packetData, requestedProperties, propertyFlags,
|
||||||
propertiesDidntFit, propertyCount, appendState);
|
propertiesDidntFit, propertyCount, appendState);
|
||||||
|
@ -2888,6 +2887,8 @@ OctreeElement::AppendState EntityItemProperties::encodeEntityEditPacket(PacketTy
|
||||||
APPEND_ENTITY_PROPERTY(PROP_STROKE_NORMALS, properties.getPackedNormals());
|
APPEND_ENTITY_PROPERTY(PROP_STROKE_NORMALS, properties.getPackedNormals());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_STROKE_COLORS, properties.getPackedStrokeColors());
|
APPEND_ENTITY_PROPERTY(PROP_STROKE_COLORS, properties.getPackedStrokeColors());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_IS_UV_MODE_STRETCH, properties.getIsUVModeStretch());
|
APPEND_ENTITY_PROPERTY(PROP_IS_UV_MODE_STRETCH, properties.getIsUVModeStretch());
|
||||||
|
APPEND_ENTITY_PROPERTY(PROP_LINE_GLOW, properties.getGlow());
|
||||||
|
APPEND_ENTITY_PROPERTY(PROP_LINE_FACE_CAMERA, properties.getFaceCamera());
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: Spheres and Boxes are just special cases of Shape, and they need to include their PROP_SHAPE
|
// NOTE: Spheres and Boxes are just special cases of Shape, and they need to include their PROP_SHAPE
|
||||||
|
@ -3070,10 +3071,6 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int
|
||||||
processedBytes += sizeof(lastEdited);
|
processedBytes += sizeof(lastEdited);
|
||||||
properties.setLastEdited(lastEdited);
|
properties.setLastEdited(lastEdited);
|
||||||
|
|
||||||
// NOTE: We intentionally do not send "created" times in edit messages. This is because:
|
|
||||||
// 1) if the edit is to an existing entity, the created time can not be changed
|
|
||||||
// 2) if the edit is to a new entity, the created time is the last edited time
|
|
||||||
|
|
||||||
// encoded id
|
// encoded id
|
||||||
QUuid editID = QUuid::fromRfc4122(QByteArray::fromRawData(reinterpret_cast<const char*>(dataAt), NUM_BYTES_RFC4122_UUID));
|
QUuid editID = QUuid::fromRfc4122(QByteArray::fromRawData(reinterpret_cast<const char*>(dataAt), NUM_BYTES_RFC4122_UUID));
|
||||||
dataAt += NUM_BYTES_RFC4122_UUID;
|
dataAt += NUM_BYTES_RFC4122_UUID;
|
||||||
|
@ -3123,16 +3120,15 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_DIMENSIONS, vec3, setDimensions);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_DIMENSIONS, vec3, setDimensions);
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ROTATION, quat, setRotation);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ROTATION, quat, setRotation);
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_REGISTRATION_POINT, vec3, setRegistrationPoint);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_REGISTRATION_POINT, vec3, setRegistrationPoint);
|
||||||
// FIXME: deal with these
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_CREATED, quint64, setCreated);
|
||||||
// READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_CREATED, quint64, setCreated);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LAST_EDITED_BY, QUuid, setLastEditedBy);
|
||||||
// READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LAST_EDITED_BY, QUuid, setLastEditedBy);
|
// READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ENTITY_HOST_TYPE, entity::HostType, setEntityHostType); // not sent over the wire
|
||||||
// READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ENTITY_HOST_TYPE, entity::HostType, setEntityHostType);
|
// READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_OWNING_AVATAR_ID, QUuid, setOwningAvatarID); // not sent over the wire
|
||||||
// READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_OWNING_AVATAR_ID, QUuid, setOwningAvatarID);
|
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_PARENT_ID, QUuid, setParentID);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_PARENT_ID, QUuid, setParentID);
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_PARENT_JOINT_INDEX, quint16, setParentJointIndex);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_PARENT_JOINT_INDEX, quint16, setParentJointIndex);
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_QUERY_AA_CUBE, AACube, setQueryAACube);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_QUERY_AA_CUBE, AACube, setQueryAACube);
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_CAN_CAST_SHADOW, bool, setCanCastShadow);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_CAN_CAST_SHADOW, bool, setCanCastShadow);
|
||||||
// READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_VISIBLE_IN_SECONDARY_CAMERA, bool, setIsVisibleInSecondaryCamera); // Not sent over the wire
|
// READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_VISIBLE_IN_SECONDARY_CAMERA, bool, setIsVisibleInSecondaryCamera); // not sent over the wire
|
||||||
properties.getGrab().decodeFromEditPacket(propertyFlags, dataAt, processedBytes);
|
properties.getGrab().decodeFromEditPacket(propertyFlags, dataAt, processedBytes);
|
||||||
|
|
||||||
// Physics
|
// Physics
|
||||||
|
@ -3321,6 +3317,8 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_STROKE_NORMALS, QByteArray, setPackedNormals);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_STROKE_NORMALS, QByteArray, setPackedNormals);
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_STROKE_COLORS, QByteArray, setPackedStrokeColors);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_STROKE_COLORS, QByteArray, setPackedStrokeColors);
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_IS_UV_MODE_STRETCH, bool, setIsUVModeStretch);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_IS_UV_MODE_STRETCH, bool, setIsUVModeStretch);
|
||||||
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LINE_GLOW, bool, setGlow);
|
||||||
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LINE_FACE_CAMERA, bool, setFaceCamera);
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: Spheres and Boxes are just special cases of Shape, and they need to include their PROP_SHAPE
|
// NOTE: Spheres and Boxes are just special cases of Shape, and they need to include their PROP_SHAPE
|
||||||
|
@ -3666,6 +3664,8 @@ void EntityItemProperties::markAllChanged() {
|
||||||
_normalsChanged = true;
|
_normalsChanged = true;
|
||||||
_strokeColorsChanged = true;
|
_strokeColorsChanged = true;
|
||||||
_isUVModeStretchChanged = true;
|
_isUVModeStretchChanged = true;
|
||||||
|
_glowChanged = true;
|
||||||
|
_faceCameraChanged = true;
|
||||||
|
|
||||||
// Shape
|
// Shape
|
||||||
_shapeChanged = true;
|
_shapeChanged = true;
|
||||||
|
@ -3856,13 +3856,12 @@ QList<QString> EntityItemProperties::listChangedProperties() {
|
||||||
if (registrationPointChanged()) {
|
if (registrationPointChanged()) {
|
||||||
out += "registrationPoint";
|
out += "registrationPoint";
|
||||||
}
|
}
|
||||||
// FIXME: handle these
|
if (createdChanged()) {
|
||||||
//if (createdChanged()) {
|
out += "created";
|
||||||
// out += "created";
|
}
|
||||||
//}
|
if (lastEditedByChanged()) {
|
||||||
//if (lastEditedByChanged()) {
|
out += "lastEditedBy";
|
||||||
// out += "lastEditedBy";
|
}
|
||||||
//}
|
|
||||||
if (entityHostTypeChanged()) {
|
if (entityHostTypeChanged()) {
|
||||||
out += "entityHostType";
|
out += "entityHostType";
|
||||||
}
|
}
|
||||||
|
@ -4277,6 +4276,12 @@ QList<QString> EntityItemProperties::listChangedProperties() {
|
||||||
if (isUVModeStretchChanged()) {
|
if (isUVModeStretchChanged()) {
|
||||||
out += "isUVModeStretch";
|
out += "isUVModeStretch";
|
||||||
}
|
}
|
||||||
|
if (glowChanged()) {
|
||||||
|
out += "glow";
|
||||||
|
}
|
||||||
|
if (faceCameraChanged()) {
|
||||||
|
out += "faceCamera";
|
||||||
|
}
|
||||||
|
|
||||||
// Shape
|
// Shape
|
||||||
if (shapeChanged()) {
|
if (shapeChanged()) {
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QDateTime>
|
||||||
|
|
||||||
#include <AACube.h>
|
#include <AACube.h>
|
||||||
#include <NumericalConstants.h>
|
#include <NumericalConstants.h>
|
||||||
|
@ -309,6 +310,8 @@ public:
|
||||||
DEFINE_PROPERTY(PROP_STROKE_NORMALS, Normals, normals, QVector<glm::vec3>, ENTITY_ITEM_DEFAULT_EMPTY_VEC3_QVEC);
|
DEFINE_PROPERTY(PROP_STROKE_NORMALS, Normals, normals, QVector<glm::vec3>, ENTITY_ITEM_DEFAULT_EMPTY_VEC3_QVEC);
|
||||||
DEFINE_PROPERTY(PROP_STROKE_COLORS, StrokeColors, strokeColors, QVector<glm::vec3>, ENTITY_ITEM_DEFAULT_EMPTY_VEC3_QVEC);
|
DEFINE_PROPERTY(PROP_STROKE_COLORS, StrokeColors, strokeColors, QVector<glm::vec3>, ENTITY_ITEM_DEFAULT_EMPTY_VEC3_QVEC);
|
||||||
DEFINE_PROPERTY(PROP_IS_UV_MODE_STRETCH, IsUVModeStretch, isUVModeStretch, bool, true);
|
DEFINE_PROPERTY(PROP_IS_UV_MODE_STRETCH, IsUVModeStretch, isUVModeStretch, bool, true);
|
||||||
|
DEFINE_PROPERTY(PROP_LINE_GLOW, Glow, glow, bool, false);
|
||||||
|
DEFINE_PROPERTY(PROP_LINE_FACE_CAMERA, FaceCamera, faceCamera, bool, false);
|
||||||
|
|
||||||
// Shape
|
// Shape
|
||||||
DEFINE_PROPERTY_REF(PROP_SHAPE, Shape, shape, QString, "Sphere");
|
DEFINE_PROPERTY_REF(PROP_SHAPE, Shape, shape, QString, "Sphere");
|
||||||
|
@ -381,8 +384,6 @@ public:
|
||||||
|
|
||||||
void setLocationDirty() { _positionChanged = true; _rotationChanged = true; }
|
void setLocationDirty() { _positionChanged = true; _rotationChanged = true; }
|
||||||
|
|
||||||
void setCreated(QDateTime& v);
|
|
||||||
|
|
||||||
bool hasTransformOrVelocityChanges() const;
|
bool hasTransformOrVelocityChanges() const;
|
||||||
void clearTransformOrVelocityChanges();
|
void clearTransformOrVelocityChanges();
|
||||||
bool hasMiscPhysicsChanges() const;
|
bool hasMiscPhysicsChanges() const;
|
||||||
|
|
|
@ -13,8 +13,6 @@
|
||||||
#ifndef hifi_EntityItemPropertiesMacros_h
|
#ifndef hifi_EntityItemPropertiesMacros_h
|
||||||
#define hifi_EntityItemPropertiesMacros_h
|
#define hifi_EntityItemPropertiesMacros_h
|
||||||
|
|
||||||
#include <QDateTime>
|
|
||||||
|
|
||||||
#include "EntityItemID.h"
|
#include "EntityItemID.h"
|
||||||
#include <RegisteredMetaTypes.h>
|
#include <RegisteredMetaTypes.h>
|
||||||
|
|
||||||
|
@ -234,14 +232,6 @@ inline QString QString_convertFromScriptValue(const QScriptValue& v, bool& isVal
|
||||||
inline QUuid QUuid_convertFromScriptValue(const QScriptValue& v, bool& isValid) { isValid = true; return v.toVariant().toUuid(); }
|
inline QUuid QUuid_convertFromScriptValue(const QScriptValue& v, bool& isValid) { isValid = true; return v.toVariant().toUuid(); }
|
||||||
inline EntityItemID EntityItemID_convertFromScriptValue(const QScriptValue& v, bool& isValid) { isValid = true; return v.toVariant().toUuid(); }
|
inline EntityItemID EntityItemID_convertFromScriptValue(const QScriptValue& v, bool& isValid) { isValid = true; return v.toVariant().toUuid(); }
|
||||||
|
|
||||||
|
|
||||||
inline QDateTime QDateTime_convertFromScriptValue(const QScriptValue& v, bool& isValid) {
|
|
||||||
isValid = true;
|
|
||||||
auto result = QDateTime::fromString(v.toVariant().toString().trimmed(), Qt::ISODate);
|
|
||||||
// result.setTimeSpec(Qt::OffsetFromUTC);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline QByteArray QByteArray_convertFromScriptValue(const QScriptValue& v, bool& isValid) {
|
inline QByteArray QByteArray_convertFromScriptValue(const QScriptValue& v, bool& isValid) {
|
||||||
isValid = true;
|
isValid = true;
|
||||||
QString b64 = v.toVariant().toString().trimmed();
|
QString b64 = v.toVariant().toString().trimmed();
|
||||||
|
|
|
@ -32,13 +32,13 @@ enum EntityPropertyList {
|
||||||
PROP_REGISTRATION_POINT,
|
PROP_REGISTRATION_POINT,
|
||||||
PROP_CREATED,
|
PROP_CREATED,
|
||||||
PROP_LAST_EDITED_BY,
|
PROP_LAST_EDITED_BY,
|
||||||
PROP_ENTITY_HOST_TYPE, // not sent over wire
|
PROP_ENTITY_HOST_TYPE, // not sent over the wire
|
||||||
PROP_OWNING_AVATAR_ID, // not sent over wire
|
PROP_OWNING_AVATAR_ID, // not sent over the wire
|
||||||
PROP_PARENT_ID,
|
PROP_PARENT_ID,
|
||||||
PROP_PARENT_JOINT_INDEX,
|
PROP_PARENT_JOINT_INDEX,
|
||||||
PROP_QUERY_AA_CUBE,
|
PROP_QUERY_AA_CUBE,
|
||||||
PROP_CAN_CAST_SHADOW,
|
PROP_CAN_CAST_SHADOW,
|
||||||
PROP_VISIBLE_IN_SECONDARY_CAMERA, // not sent over wire
|
PROP_VISIBLE_IN_SECONDARY_CAMERA, // not sent over the wire
|
||||||
// Grab
|
// Grab
|
||||||
PROP_GRAB_GRABBABLE,
|
PROP_GRAB_GRABBABLE,
|
||||||
PROP_GRAB_KINEMATIC,
|
PROP_GRAB_KINEMATIC,
|
||||||
|
@ -291,6 +291,8 @@ enum EntityPropertyList {
|
||||||
PROP_STROKE_NORMALS = PROP_DERIVED_2,
|
PROP_STROKE_NORMALS = PROP_DERIVED_2,
|
||||||
PROP_STROKE_COLORS = PROP_DERIVED_3,
|
PROP_STROKE_COLORS = PROP_DERIVED_3,
|
||||||
PROP_IS_UV_MODE_STRETCH = PROP_DERIVED_4,
|
PROP_IS_UV_MODE_STRETCH = PROP_DERIVED_4,
|
||||||
|
PROP_LINE_GLOW = PROP_DERIVED_5,
|
||||||
|
PROP_LINE_FACE_CAMERA = PROP_DERIVED_6,
|
||||||
|
|
||||||
// Shape
|
// Shape
|
||||||
PROP_SHAPE = PROP_DERIVED_0,
|
PROP_SHAPE = PROP_DERIVED_0,
|
||||||
|
|
|
@ -23,7 +23,6 @@ namespace EntityPsuedoPropertyFlag {
|
||||||
FlagsActive,
|
FlagsActive,
|
||||||
ID,
|
ID,
|
||||||
Type,
|
Type,
|
||||||
Created,
|
|
||||||
Age,
|
Age,
|
||||||
AgeAsText,
|
AgeAsText,
|
||||||
LastEdited,
|
LastEdited,
|
||||||
|
@ -31,7 +30,6 @@ namespace EntityPsuedoPropertyFlag {
|
||||||
OriginalTextures,
|
OriginalTextures,
|
||||||
RenderInfo,
|
RenderInfo,
|
||||||
ClientOnly,
|
ClientOnly,
|
||||||
OwningAvatarID,
|
|
||||||
AvatarEntity,
|
AvatarEntity,
|
||||||
LocalEntity,
|
LocalEntity,
|
||||||
FaceCamera,
|
FaceCamera,
|
||||||
|
|
|
@ -492,10 +492,9 @@ QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties
|
||||||
propertiesWithSimID.setCollisionless(true);
|
propertiesWithSimID.setCollisionless(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// the created time will be set in EntityTree::addEntity by recordCreationTime()
|
||||||
propertiesWithSimID.setLastEditedBy(sessionID);
|
propertiesWithSimID.setLastEditedBy(sessionID);
|
||||||
|
|
||||||
propertiesWithSimID.setActionData(QByteArray());
|
|
||||||
|
|
||||||
bool scalesWithParent = propertiesWithSimID.getScalesWithParent();
|
bool scalesWithParent = propertiesWithSimID.getScalesWithParent();
|
||||||
|
|
||||||
propertiesWithSimID = convertPropertiesFromScriptSemantics(propertiesWithSimID, scalesWithParent);
|
propertiesWithSimID = convertPropertiesFromScriptSemantics(propertiesWithSimID, scalesWithParent);
|
||||||
|
@ -676,8 +675,6 @@ QScriptValue EntityScriptingInterface::getMultipleEntityPropertiesInternal(QScri
|
||||||
psuedoPropertyFlags.set(EntityPsuedoPropertyFlag::ID);
|
psuedoPropertyFlags.set(EntityPsuedoPropertyFlag::ID);
|
||||||
} else if (extendedPropertyString == "type") {
|
} else if (extendedPropertyString == "type") {
|
||||||
psuedoPropertyFlags.set(EntityPsuedoPropertyFlag::Type);
|
psuedoPropertyFlags.set(EntityPsuedoPropertyFlag::Type);
|
||||||
} else if (extendedPropertyString == "created") {
|
|
||||||
psuedoPropertyFlags.set(EntityPsuedoPropertyFlag::Created);
|
|
||||||
} else if (extendedPropertyString == "age") {
|
} else if (extendedPropertyString == "age") {
|
||||||
psuedoPropertyFlags.set(EntityPsuedoPropertyFlag::Age);
|
psuedoPropertyFlags.set(EntityPsuedoPropertyFlag::Age);
|
||||||
} else if (extendedPropertyString == "ageAsText") {
|
} else if (extendedPropertyString == "ageAsText") {
|
||||||
|
@ -692,8 +689,6 @@ QScriptValue EntityScriptingInterface::getMultipleEntityPropertiesInternal(QScri
|
||||||
psuedoPropertyFlags.set(EntityPsuedoPropertyFlag::RenderInfo);
|
psuedoPropertyFlags.set(EntityPsuedoPropertyFlag::RenderInfo);
|
||||||
} else if (extendedPropertyString == "clientOnly") {
|
} else if (extendedPropertyString == "clientOnly") {
|
||||||
psuedoPropertyFlags.set(EntityPsuedoPropertyFlag::ClientOnly);
|
psuedoPropertyFlags.set(EntityPsuedoPropertyFlag::ClientOnly);
|
||||||
} else if (extendedPropertyString == "owningAvatarID") {
|
|
||||||
psuedoPropertyFlags.set(EntityPsuedoPropertyFlag::OwningAvatarID);
|
|
||||||
} else if (extendedPropertyString == "avatarEntity") {
|
} else if (extendedPropertyString == "avatarEntity") {
|
||||||
psuedoPropertyFlags.set(EntityPsuedoPropertyFlag::AvatarEntity);
|
psuedoPropertyFlags.set(EntityPsuedoPropertyFlag::AvatarEntity);
|
||||||
} else if (extendedPropertyString == "localEntity") {
|
} else if (extendedPropertyString == "localEntity") {
|
||||||
|
@ -859,8 +854,6 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties&
|
||||||
}
|
}
|
||||||
properties.setOwningAvatarID(entity->getOwningAvatarID());
|
properties.setOwningAvatarID(entity->getOwningAvatarID());
|
||||||
|
|
||||||
properties.setActionData(entity->getDynamicData());
|
|
||||||
|
|
||||||
// make sure the properties has a type, so that the encode can know which properties to include
|
// make sure the properties has a type, so that the encode can know which properties to include
|
||||||
properties.setType(entity->getType());
|
properties.setType(entity->getType());
|
||||||
|
|
||||||
|
|
|
@ -1828,7 +1828,6 @@ int EntityTree::processEditPacketData(ReceivedMessage& message, const unsigned c
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is a new entity... assign a new entityID
|
// this is a new entity... assign a new entityID
|
||||||
properties.setCreated(properties.getLastEdited());
|
|
||||||
properties.setLastEditedBy(senderNode->getUUID());
|
properties.setLastEditedBy(senderNode->getUUID());
|
||||||
startCreate = usecTimestampNow();
|
startCreate = usecTimestampNow();
|
||||||
EntityItemPointer newEntity = addEntity(entityItemID, properties);
|
EntityItemPointer newEntity = addEntity(entityItemID, properties);
|
||||||
|
@ -2831,6 +2830,13 @@ bool EntityTree::readFromMap(QVariantMap& map) {
|
||||||
properties.setColorSpread({0, 0, 0});
|
properties.setColorSpread({0, 0, 0});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (contentVersion < (int)EntityVersion::FixPropertiesFromCleanup) {
|
||||||
|
if (entityMap.contains("created")) {
|
||||||
|
quint64 created = QDateTime::fromString(entityMap["created"].toString().trimmed(), Qt::ISODate).toMSecsSinceEpoch() * 1000;
|
||||||
|
properties.setCreated(created);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EntityItemPointer entity = addEntity(entityItemID, properties);
|
EntityItemPointer entity = addEntity(entityItemID, properties);
|
||||||
if (!entity) {
|
if (!entity) {
|
||||||
qCDebug(entities) << "adding Entity failed:" << entityItemID << properties.getType();
|
qCDebug(entities) << "adding Entity failed:" << entityItemID << properties.getType();
|
||||||
|
|
|
@ -49,6 +49,7 @@ void GrabPropertyGroup::copyFromScriptValue(const QScriptValue& object, bool& _d
|
||||||
COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(grab, grabFollowsController, bool, setGrabFollowsController);
|
COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(grab, grabFollowsController, bool, setGrabFollowsController);
|
||||||
COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(grab, triggerable, bool, setTriggerable);
|
COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(grab, triggerable, bool, setTriggerable);
|
||||||
COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(grab, equippable, bool, setEquippable);
|
COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(grab, equippable, bool, setEquippable);
|
||||||
|
COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(grab, grabDelegateToParent, bool, setGrabDelegateToParent);
|
||||||
COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(grab, equippableLeftPosition, vec3, setEquippableLeftPosition);
|
COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(grab, equippableLeftPosition, vec3, setEquippableLeftPosition);
|
||||||
COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(grab, equippableLeftRotation, quat, setEquippableLeftRotation);
|
COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(grab, equippableLeftRotation, quat, setEquippableLeftRotation);
|
||||||
COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(grab, equippableRightPosition, vec3, setEquippableRightPosition);
|
COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(grab, equippableRightPosition, vec3, setEquippableRightPosition);
|
||||||
|
@ -64,6 +65,7 @@ void GrabPropertyGroup::merge(const GrabPropertyGroup& other) {
|
||||||
COPY_PROPERTY_IF_CHANGED(grabFollowsController);
|
COPY_PROPERTY_IF_CHANGED(grabFollowsController);
|
||||||
COPY_PROPERTY_IF_CHANGED(triggerable);
|
COPY_PROPERTY_IF_CHANGED(triggerable);
|
||||||
COPY_PROPERTY_IF_CHANGED(equippable);
|
COPY_PROPERTY_IF_CHANGED(equippable);
|
||||||
|
COPY_PROPERTY_IF_CHANGED(grabDelegateToParent);
|
||||||
COPY_PROPERTY_IF_CHANGED(equippableLeftPosition);
|
COPY_PROPERTY_IF_CHANGED(equippableLeftPosition);
|
||||||
COPY_PROPERTY_IF_CHANGED(equippableLeftRotation);
|
COPY_PROPERTY_IF_CHANGED(equippableLeftRotation);
|
||||||
COPY_PROPERTY_IF_CHANGED(equippableRightPosition);
|
COPY_PROPERTY_IF_CHANGED(equippableRightPosition);
|
||||||
|
@ -106,6 +108,9 @@ void GrabPropertyGroup::listChangedProperties(QList<QString>& out) {
|
||||||
if (equippableChanged()) {
|
if (equippableChanged()) {
|
||||||
out << "grab-equippable";
|
out << "grab-equippable";
|
||||||
}
|
}
|
||||||
|
if (grabDelegateToParentChanged()) {
|
||||||
|
out << "grab-grabDelegateToParent";
|
||||||
|
}
|
||||||
if (equippableLeftPositionChanged()) {
|
if (equippableLeftPositionChanged()) {
|
||||||
out << "grab-equippableLeftPosition";
|
out << "grab-equippableLeftPosition";
|
||||||
}
|
}
|
||||||
|
@ -203,6 +208,7 @@ void GrabPropertyGroup::markAllChanged() {
|
||||||
_grabFollowsControllerChanged = true;
|
_grabFollowsControllerChanged = true;
|
||||||
_triggerableChanged = true;
|
_triggerableChanged = true;
|
||||||
_equippableChanged = true;
|
_equippableChanged = true;
|
||||||
|
_grabDelegateToParentChanged = true;
|
||||||
_equippableLeftPositionChanged = true;
|
_equippableLeftPositionChanged = true;
|
||||||
_equippableLeftRotationChanged = true;
|
_equippableLeftRotationChanged = true;
|
||||||
_equippableRightPositionChanged = true;
|
_equippableRightPositionChanged = true;
|
||||||
|
@ -238,6 +244,7 @@ void GrabPropertyGroup::getProperties(EntityItemProperties& properties) const {
|
||||||
COPY_ENTITY_GROUP_PROPERTY_TO_PROPERTIES(Grab, GrabFollowsController, getGrabFollowsController);
|
COPY_ENTITY_GROUP_PROPERTY_TO_PROPERTIES(Grab, GrabFollowsController, getGrabFollowsController);
|
||||||
COPY_ENTITY_GROUP_PROPERTY_TO_PROPERTIES(Grab, Triggerable, getTriggerable);
|
COPY_ENTITY_GROUP_PROPERTY_TO_PROPERTIES(Grab, Triggerable, getTriggerable);
|
||||||
COPY_ENTITY_GROUP_PROPERTY_TO_PROPERTIES(Grab, Equippable, getEquippable);
|
COPY_ENTITY_GROUP_PROPERTY_TO_PROPERTIES(Grab, Equippable, getEquippable);
|
||||||
|
COPY_ENTITY_GROUP_PROPERTY_TO_PROPERTIES(Grab, GrabDelegateToParent, getGrabDelegateToParent);
|
||||||
COPY_ENTITY_GROUP_PROPERTY_TO_PROPERTIES(Grab, EquippableLeftPosition, getEquippableLeftPosition);
|
COPY_ENTITY_GROUP_PROPERTY_TO_PROPERTIES(Grab, EquippableLeftPosition, getEquippableLeftPosition);
|
||||||
COPY_ENTITY_GROUP_PROPERTY_TO_PROPERTIES(Grab, EquippableLeftRotation, getEquippableLeftRotation);
|
COPY_ENTITY_GROUP_PROPERTY_TO_PROPERTIES(Grab, EquippableLeftRotation, getEquippableLeftRotation);
|
||||||
COPY_ENTITY_GROUP_PROPERTY_TO_PROPERTIES(Grab, EquippableRightPosition, getEquippableRightPosition);
|
COPY_ENTITY_GROUP_PROPERTY_TO_PROPERTIES(Grab, EquippableRightPosition, getEquippableRightPosition);
|
||||||
|
@ -255,6 +262,7 @@ bool GrabPropertyGroup::setProperties(const EntityItemProperties& properties) {
|
||||||
SET_ENTITY_GROUP_PROPERTY_FROM_PROPERTIES(Grab, GrabFollowsController, grabFollowsController, setGrabFollowsController);
|
SET_ENTITY_GROUP_PROPERTY_FROM_PROPERTIES(Grab, GrabFollowsController, grabFollowsController, setGrabFollowsController);
|
||||||
SET_ENTITY_GROUP_PROPERTY_FROM_PROPERTIES(Grab, Triggerable, triggerable, setTriggerable);
|
SET_ENTITY_GROUP_PROPERTY_FROM_PROPERTIES(Grab, Triggerable, triggerable, setTriggerable);
|
||||||
SET_ENTITY_GROUP_PROPERTY_FROM_PROPERTIES(Grab, Equippable, equippable, setEquippable);
|
SET_ENTITY_GROUP_PROPERTY_FROM_PROPERTIES(Grab, Equippable, equippable, setEquippable);
|
||||||
|
SET_ENTITY_GROUP_PROPERTY_FROM_PROPERTIES(Grab, GrabDelegateToParent, grabDelegateToParent, setGrabDelegateToParent);
|
||||||
SET_ENTITY_GROUP_PROPERTY_FROM_PROPERTIES(Grab, EquippableLeftPosition, equippableLeftPosition, setEquippableLeftPosition);
|
SET_ENTITY_GROUP_PROPERTY_FROM_PROPERTIES(Grab, EquippableLeftPosition, equippableLeftPosition, setEquippableLeftPosition);
|
||||||
SET_ENTITY_GROUP_PROPERTY_FROM_PROPERTIES(Grab, EquippableLeftRotation, equippableLeftRotation, setEquippableLeftRotation);
|
SET_ENTITY_GROUP_PROPERTY_FROM_PROPERTIES(Grab, EquippableLeftRotation, equippableLeftRotation, setEquippableLeftRotation);
|
||||||
SET_ENTITY_GROUP_PROPERTY_FROM_PROPERTIES(Grab, EquippableRightPosition, equippableRightPosition,
|
SET_ENTITY_GROUP_PROPERTY_FROM_PROPERTIES(Grab, EquippableRightPosition, equippableRightPosition,
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
const float PolyLineEntityItem::DEFAULT_LINE_WIDTH = 0.1f;
|
const float PolyLineEntityItem::DEFAULT_LINE_WIDTH = 0.1f;
|
||||||
const int PolyLineEntityItem::MAX_POINTS_PER_LINE = 60;
|
const int PolyLineEntityItem::MAX_POINTS_PER_LINE = 60;
|
||||||
|
|
||||||
|
|
||||||
EntityItemPointer PolyLineEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
EntityItemPointer PolyLineEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
||||||
EntityItemPointer entity(new PolyLineEntityItem(entityID), [](EntityItem* ptr) { ptr->deleteLater(); });
|
EntityItemPointer entity(new PolyLineEntityItem(entityID), [](EntityItem* ptr) { ptr->deleteLater(); });
|
||||||
entity->setProperties(properties);
|
entity->setProperties(properties);
|
||||||
|
@ -37,7 +36,6 @@ PolyLineEntityItem::PolyLineEntityItem(const EntityItemID& entityItemID) : Entit
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityItemProperties PolyLineEntityItem::getProperties(const EntityPropertyFlags& desiredProperties, bool allowEmptyDesiredProperties) const {
|
EntityItemProperties PolyLineEntityItem::getProperties(const EntityPropertyFlags& desiredProperties, bool allowEmptyDesiredProperties) const {
|
||||||
QWriteLocker lock(&_quadReadWriteLock);
|
|
||||||
EntityItemProperties properties = EntityItem::getProperties(desiredProperties, allowEmptyDesiredProperties); // get the properties from our base class
|
EntityItemProperties properties = EntityItem::getProperties(desiredProperties, allowEmptyDesiredProperties); // get the properties from our base class
|
||||||
|
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(color, getColor);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(color, getColor);
|
||||||
|
@ -48,11 +46,13 @@ EntityItemProperties PolyLineEntityItem::getProperties(const EntityPropertyFlags
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(normals, getNormals);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(normals, getNormals);
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(strokeColors, getStrokeColors);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(strokeColors, getStrokeColors);
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(isUVModeStretch, getIsUVModeStretch);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(isUVModeStretch, getIsUVModeStretch);
|
||||||
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(glow, getGlow);
|
||||||
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(faceCamera, getFaceCamera);
|
||||||
|
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PolyLineEntityItem::setProperties(const EntityItemProperties& properties) {
|
bool PolyLineEntityItem::setProperties(const EntityItemProperties& properties) {
|
||||||
QWriteLocker lock(&_quadReadWriteLock);
|
|
||||||
bool somethingChanged = false;
|
bool somethingChanged = false;
|
||||||
somethingChanged = EntityItem::setProperties(properties); // set the properties in our base class
|
somethingChanged = EntityItem::setProperties(properties); // set the properties in our base class
|
||||||
|
|
||||||
|
@ -64,6 +64,8 @@ bool PolyLineEntityItem::setProperties(const EntityItemProperties& properties) {
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(normals, setNormals);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(normals, setNormals);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(strokeColors, setStrokeColors);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(strokeColors, setStrokeColors);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(isUVModeStretch, setIsUVModeStretch);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(isUVModeStretch, setIsUVModeStretch);
|
||||||
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(glow, setGlow);
|
||||||
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(faceCamera, setFaceCamera);
|
||||||
|
|
||||||
if (somethingChanged) {
|
if (somethingChanged) {
|
||||||
bool wantDebug = false;
|
bool wantDebug = false;
|
||||||
|
@ -78,125 +80,59 @@ bool PolyLineEntityItem::setProperties(const EntityItemProperties& properties) {
|
||||||
return somethingChanged;
|
return somethingChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PolyLineEntityItem::setLinePoints(const QVector<glm::vec3>& points) {
|
||||||
bool PolyLineEntityItem::appendPoint(const glm::vec3& point) {
|
|
||||||
if (_points.size() > MAX_POINTS_PER_LINE - 1) {
|
|
||||||
qCDebug(entities) << "MAX POINTS REACHED!";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
_points << point;
|
|
||||||
_pointsChanged = true;
|
|
||||||
|
|
||||||
calculateScaleAndRegistrationPoint();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool PolyLineEntityItem::setStrokeWidths(const QVector<float>& strokeWidths) {
|
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
_strokeWidths = strokeWidths;
|
_points = points;
|
||||||
_strokeWidthsChanged = true;
|
_pointsChanged = true;
|
||||||
});
|
});
|
||||||
return true;
|
computeAndUpdateDimensionsAndPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PolyLineEntityItem::setNormals(const QVector<glm::vec3>& normals) {
|
void PolyLineEntityItem::setStrokeWidths(const QVector<float>& strokeWidths) {
|
||||||
|
withWriteLock([&] {
|
||||||
|
_widths = strokeWidths;
|
||||||
|
_widthsChanged = true;
|
||||||
|
});
|
||||||
|
computeAndUpdateDimensionsAndPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PolyLineEntityItem::setNormals(const QVector<glm::vec3>& normals) {
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
_normals = normals;
|
_normals = normals;
|
||||||
_normalsChanged = true;
|
_normalsChanged = true;
|
||||||
});
|
});
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PolyLineEntityItem::setStrokeColors(const QVector<glm::vec3>& strokeColors) {
|
void PolyLineEntityItem::setStrokeColors(const QVector<glm::vec3>& strokeColors) {
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
_strokeColors = strokeColors;
|
_colors = strokeColors;
|
||||||
_strokeColorsChanged = true;
|
_colorsChanged = true;
|
||||||
});
|
});
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PolyLineEntityItem::computeAndUpdateDimensionsAndPosition() {
|
||||||
|
QVector<glm::vec3> points;
|
||||||
|
QVector<float> widths;
|
||||||
|
|
||||||
bool PolyLineEntityItem::setLinePoints(const QVector<glm::vec3>& points) {
|
|
||||||
if (points.size() > MAX_POINTS_PER_LINE) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
bool result = false;
|
|
||||||
withWriteLock([&] {
|
|
||||||
//Check to see if points actually changed. If they haven't, return before doing anything else
|
|
||||||
if (points.size() != _points.size()) {
|
|
||||||
_pointsChanged = true;
|
|
||||||
} else if (points.size() == _points.size()) {
|
|
||||||
//same number of points, so now compare every point
|
|
||||||
for (int i = 0; i < points.size(); i++) {
|
|
||||||
if (points.at(i) != _points.at(i)) {
|
|
||||||
_pointsChanged = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!_pointsChanged) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_points = points;
|
|
||||||
|
|
||||||
result = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (result) {
|
|
||||||
calculateScaleAndRegistrationPoint();
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PolyLineEntityItem::calculateScaleAndRegistrationPoint() {
|
|
||||||
glm::vec3 high(0.0f, 0.0f, 0.0f);
|
|
||||||
glm::vec3 low(0.0f, 0.0f, 0.0f);
|
|
||||||
int pointCount = 0;
|
|
||||||
glm::vec3 firstPoint;
|
|
||||||
withReadLock([&] {
|
withReadLock([&] {
|
||||||
pointCount = _points.size();
|
points = _points;
|
||||||
if (pointCount > 0) {
|
widths = _widths;
|
||||||
firstPoint = _points.at(0);
|
|
||||||
}
|
|
||||||
for (int i = 0; i < pointCount; i++) {
|
|
||||||
const glm::vec3& point = _points.at(i);
|
|
||||||
high = glm::max(point, high);
|
|
||||||
low = glm::min(point, low);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
float magnitudeSquared = glm::length2(low - high);
|
glm::vec3 maxHalfDim(0.5f * ENTITY_ITEM_DEFAULT_WIDTH);
|
||||||
vec3 newScale { 1 };
|
float maxWidth = 0.0f;
|
||||||
vec3 newRegistrationPoint { 0.5f };
|
for (int i = 0; i < points.length(); i++) {
|
||||||
|
maxHalfDim = glm::max(maxHalfDim, glm::abs(points[i]));
|
||||||
const float EPSILON = 0.0001f;
|
maxWidth = glm::max(maxWidth, i < widths.length() ? widths[i] : DEFAULT_LINE_WIDTH);
|
||||||
const float EPSILON_SQUARED = EPSILON * EPSILON;
|
|
||||||
const float HALF_LINE_WIDTH = 0.075f; // sadly _strokeWidths() don't seem to correspond to reality, so just use a flat assumption of the stroke width
|
|
||||||
const vec3 QUARTER_LINE_WIDTH { HALF_LINE_WIDTH * 0.5f };
|
|
||||||
if (pointCount > 1 && magnitudeSquared > EPSILON_SQUARED) {
|
|
||||||
newScale = glm::abs(high) + glm::abs(low) + vec3(HALF_LINE_WIDTH);
|
|
||||||
// Center the poly line in the bounding box
|
|
||||||
glm::vec3 startPointInScaleSpace = firstPoint - low;
|
|
||||||
startPointInScaleSpace += QUARTER_LINE_WIDTH;
|
|
||||||
newRegistrationPoint = startPointInScaleSpace / newScale;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if Polyline has only one or fewer points, use default dimension settings
|
setScaledDimensions(2.0f * (maxHalfDim + maxWidth));
|
||||||
setScaledDimensions(newScale);
|
|
||||||
EntityItem::setRegistrationPoint(newRegistrationPoint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int PolyLineEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
|
int PolyLineEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
|
||||||
ReadBitstreamToTreeParams& args,
|
ReadBitstreamToTreeParams& args,
|
||||||
EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
|
EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
|
||||||
bool& somethingChanged) {
|
bool& somethingChanged) {
|
||||||
|
|
||||||
QWriteLocker lock(&_quadReadWriteLock);
|
|
||||||
int bytesRead = 0;
|
int bytesRead = 0;
|
||||||
const unsigned char* dataAt = data;
|
const unsigned char* dataAt = data;
|
||||||
|
|
||||||
|
@ -208,6 +144,8 @@ int PolyLineEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* da
|
||||||
READ_ENTITY_PROPERTY(PROP_STROKE_NORMALS, QVector<glm::vec3>, setNormals);
|
READ_ENTITY_PROPERTY(PROP_STROKE_NORMALS, QVector<glm::vec3>, setNormals);
|
||||||
READ_ENTITY_PROPERTY(PROP_STROKE_COLORS, QVector<glm::vec3>, setStrokeColors);
|
READ_ENTITY_PROPERTY(PROP_STROKE_COLORS, QVector<glm::vec3>, setStrokeColors);
|
||||||
READ_ENTITY_PROPERTY(PROP_IS_UV_MODE_STRETCH, bool, setIsUVModeStretch);
|
READ_ENTITY_PROPERTY(PROP_IS_UV_MODE_STRETCH, bool, setIsUVModeStretch);
|
||||||
|
READ_ENTITY_PROPERTY(PROP_LINE_GLOW, bool, setGlow);
|
||||||
|
READ_ENTITY_PROPERTY(PROP_LINE_FACE_CAMERA, bool, setFaceCamera);
|
||||||
|
|
||||||
return bytesRead;
|
return bytesRead;
|
||||||
}
|
}
|
||||||
|
@ -222,6 +160,8 @@ EntityPropertyFlags PolyLineEntityItem::getEntityProperties(EncodeBitstreamParam
|
||||||
requestedProperties += PROP_STROKE_NORMALS;
|
requestedProperties += PROP_STROKE_NORMALS;
|
||||||
requestedProperties += PROP_STROKE_COLORS;
|
requestedProperties += PROP_STROKE_COLORS;
|
||||||
requestedProperties += PROP_IS_UV_MODE_STRETCH;
|
requestedProperties += PROP_IS_UV_MODE_STRETCH;
|
||||||
|
requestedProperties += PROP_LINE_GLOW;
|
||||||
|
requestedProperties += PROP_LINE_FACE_CAMERA;
|
||||||
return requestedProperties;
|
return requestedProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,7 +173,6 @@ void PolyLineEntityItem::appendSubclassData(OctreePacketData* packetData, Encode
|
||||||
int& propertyCount,
|
int& propertyCount,
|
||||||
OctreeElement::AppendState& appendState) const {
|
OctreeElement::AppendState& appendState) const {
|
||||||
|
|
||||||
QWriteLocker lock(&_quadReadWriteLock);
|
|
||||||
bool successPropertyFits = true;
|
bool successPropertyFits = true;
|
||||||
|
|
||||||
APPEND_ENTITY_PROPERTY(PROP_COLOR, getColor());
|
APPEND_ENTITY_PROPERTY(PROP_COLOR, getColor());
|
||||||
|
@ -244,6 +183,8 @@ void PolyLineEntityItem::appendSubclassData(OctreePacketData* packetData, Encode
|
||||||
APPEND_ENTITY_PROPERTY(PROP_STROKE_NORMALS, getNormals());
|
APPEND_ENTITY_PROPERTY(PROP_STROKE_NORMALS, getNormals());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_STROKE_COLORS, getStrokeColors());
|
APPEND_ENTITY_PROPERTY(PROP_STROKE_COLORS, getStrokeColors());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_IS_UV_MODE_STRETCH, getIsUVModeStretch());
|
APPEND_ENTITY_PROPERTY(PROP_IS_UV_MODE_STRETCH, getIsUVModeStretch());
|
||||||
|
APPEND_ENTITY_PROPERTY(PROP_LINE_GLOW, getGlow());
|
||||||
|
APPEND_ENTITY_PROPERTY(PROP_LINE_FACE_CAMERA, getFaceCamera());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PolyLineEntityItem::debugDump() const {
|
void PolyLineEntityItem::debugDump() const {
|
||||||
|
@ -255,61 +196,49 @@ void PolyLineEntityItem::debugDump() const {
|
||||||
qCDebug(entities) << " getLastEdited:" << debugTime(getLastEdited(), now);
|
qCDebug(entities) << " getLastEdited:" << debugTime(getLastEdited(), now);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QVector<glm::vec3> PolyLineEntityItem::getLinePoints() const {
|
QVector<glm::vec3> PolyLineEntityItem::getLinePoints() const {
|
||||||
QVector<glm::vec3> result;
|
return resultWithReadLock<QVector<glm::vec3>>([&] {
|
||||||
withReadLock([&] {
|
return _points;
|
||||||
result = _points;
|
|
||||||
});
|
});
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<glm::vec3> PolyLineEntityItem::getNormals() const {
|
QVector<glm::vec3> PolyLineEntityItem::getNormals() const {
|
||||||
QVector<glm::vec3> result;
|
return resultWithReadLock<QVector<glm::vec3>>([&] {
|
||||||
withReadLock([&] {
|
return _normals;
|
||||||
result = _normals;
|
|
||||||
});
|
});
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<glm::vec3> PolyLineEntityItem::getStrokeColors() const {
|
QVector<glm::vec3> PolyLineEntityItem::getStrokeColors() const {
|
||||||
QVector<glm::vec3> result;
|
return resultWithReadLock<QVector<glm::vec3>>([&] {
|
||||||
withReadLock([&] {
|
return _colors;
|
||||||
result = _strokeColors;
|
|
||||||
});
|
});
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<float> PolyLineEntityItem::getStrokeWidths() const {
|
QVector<float> PolyLineEntityItem::getStrokeWidths() const {
|
||||||
QVector<float> result;
|
return resultWithReadLock<QVector<float>>([&] {
|
||||||
withReadLock([&] {
|
return _widths;
|
||||||
result = _strokeWidths;
|
|
||||||
});
|
});
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString PolyLineEntityItem::getTextures() const {
|
QString PolyLineEntityItem::getTextures() const {
|
||||||
QString result;
|
return resultWithReadLock<QString>([&] {
|
||||||
withReadLock([&] {
|
return _textures;
|
||||||
result = _textures;
|
|
||||||
});
|
});
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PolyLineEntityItem::setTextures(const QString& textures) {
|
void PolyLineEntityItem::setTextures(const QString& textures) {
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
if (_textures != textures) {
|
if (_textures != textures) {
|
||||||
_textures = textures;
|
_textures = textures;
|
||||||
_texturesChangedFlag = true;
|
_texturesChanged = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void PolyLineEntityItem::setColor(const glm::u8vec3& value) {
|
void PolyLineEntityItem::setColor(const glm::u8vec3& value) {
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
_strokeColorsChanged = true;
|
|
||||||
_color = value;
|
_color = value;
|
||||||
|
_colorsChanged = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,35 +44,40 @@ class PolyLineEntityItem : public EntityItem {
|
||||||
glm::u8vec3 getColor() const;
|
glm::u8vec3 getColor() const;
|
||||||
void setColor(const glm::u8vec3& value);
|
void setColor(const glm::u8vec3& value);
|
||||||
|
|
||||||
bool setLinePoints(const QVector<glm::vec3>& points);
|
static const int MAX_POINTS_PER_LINE;
|
||||||
bool appendPoint(const glm::vec3& point);
|
void setLinePoints(const QVector<glm::vec3>& points);
|
||||||
QVector<glm::vec3> getLinePoints() const;
|
QVector<glm::vec3> getLinePoints() const;
|
||||||
|
|
||||||
bool setNormals(const QVector<glm::vec3>& normals);
|
static const float DEFAULT_LINE_WIDTH;
|
||||||
|
void setStrokeWidths(const QVector<float>& strokeWidths);
|
||||||
|
QVector<float> getStrokeWidths() const;
|
||||||
|
|
||||||
|
void setNormals(const QVector<glm::vec3>& normals);
|
||||||
QVector<glm::vec3> getNormals() const;
|
QVector<glm::vec3> getNormals() const;
|
||||||
|
|
||||||
bool setStrokeColors(const QVector<glm::vec3>& strokeColors);
|
void setStrokeColors(const QVector<glm::vec3>& strokeColors);
|
||||||
QVector<glm::vec3> getStrokeColors() const;
|
QVector<glm::vec3> getStrokeColors() const;
|
||||||
|
|
||||||
bool setStrokeWidths(const QVector<float>& strokeWidths);
|
|
||||||
QVector<float> getStrokeWidths() const;
|
|
||||||
|
|
||||||
void setIsUVModeStretch(bool isUVModeStretch){ _isUVModeStretch = isUVModeStretch; }
|
void setIsUVModeStretch(bool isUVModeStretch){ _isUVModeStretch = isUVModeStretch; }
|
||||||
bool getIsUVModeStretch() const{ return _isUVModeStretch; }
|
bool getIsUVModeStretch() const{ return _isUVModeStretch; }
|
||||||
|
|
||||||
QString getTextures() const;
|
QString getTextures() const;
|
||||||
void setTextures(const QString& textures);
|
void setTextures(const QString& textures);
|
||||||
|
|
||||||
virtual ShapeType getShapeType() const override { return SHAPE_TYPE_NONE; }
|
void setGlow(bool glow) { _glow = glow; }
|
||||||
|
bool getGlow() const { return _glow; }
|
||||||
|
|
||||||
|
void setFaceCamera(bool faceCamera) { _faceCamera = faceCamera; }
|
||||||
|
bool getFaceCamera() const { return _faceCamera; }
|
||||||
|
|
||||||
bool pointsChanged() const { return _pointsChanged; }
|
bool pointsChanged() const { return _pointsChanged; }
|
||||||
bool normalsChanged() const { return _normalsChanged; }
|
bool normalsChanged() const { return _normalsChanged; }
|
||||||
bool strokeColorsChanged() const { return _strokeColorsChanged; }
|
bool colorsChanged() const { return _colorsChanged; }
|
||||||
bool strokeWidthsChanged() const { return _strokeWidthsChanged; }
|
bool widthsChanged() const { return _widthsChanged; }
|
||||||
bool texturesChanged() const { return _texturesChangedFlag; }
|
bool texturesChanged() const { return _texturesChanged; }
|
||||||
void resetTexturesChanged() { _texturesChangedFlag = false; }
|
|
||||||
void resetPolyLineChanged() { _strokeColorsChanged = _strokeWidthsChanged = _normalsChanged = _pointsChanged = false; }
|
|
||||||
|
|
||||||
|
void resetTexturesChanged() { _texturesChanged = false; }
|
||||||
|
void resetPolyLineChanged() { _colorsChanged = _widthsChanged = _normalsChanged = _pointsChanged = false; }
|
||||||
|
|
||||||
// never have a ray intersection pick a PolyLineEntityItem.
|
// never have a ray intersection pick a PolyLineEntityItem.
|
||||||
virtual bool supportsDetailedIntersection() const override { return true; }
|
virtual bool supportsDetailedIntersection() const override { return true; }
|
||||||
|
@ -85,29 +90,26 @@ class PolyLineEntityItem : public EntityItem {
|
||||||
BoxFace& face, glm::vec3& surfaceNormal,
|
BoxFace& face, glm::vec3& surfaceNormal,
|
||||||
QVariantMap& extraInfo, bool precisionPicking) const override { return false; }
|
QVariantMap& extraInfo, bool precisionPicking) const override { return false; }
|
||||||
|
|
||||||
// disable these external interfaces as PolyLineEntities caculate their own dimensions based on the points they contain
|
|
||||||
virtual void setRegistrationPoint(const glm::vec3& value) override {}; // FIXME: this is suspicious!
|
|
||||||
|
|
||||||
virtual void debugDump() const override;
|
virtual void debugDump() const override;
|
||||||
static const float DEFAULT_LINE_WIDTH;
|
|
||||||
static const int MAX_POINTS_PER_LINE;
|
|
||||||
private:
|
private:
|
||||||
void calculateScaleAndRegistrationPoint();
|
void computeAndUpdateDimensionsAndPosition();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
glm::u8vec3 _color;
|
glm::u8vec3 _color;
|
||||||
bool _pointsChanged { true };
|
|
||||||
bool _normalsChanged { true };
|
|
||||||
bool _strokeColorsChanged { true };
|
|
||||||
bool _strokeWidthsChanged { true };
|
|
||||||
QVector<glm::vec3> _points;
|
QVector<glm::vec3> _points;
|
||||||
QVector<glm::vec3> _normals;
|
QVector<glm::vec3> _normals;
|
||||||
QVector<glm::vec3> _strokeColors;
|
QVector<glm::vec3> _colors;
|
||||||
QVector<float> _strokeWidths;
|
QVector<float> _widths;
|
||||||
QString _textures;
|
QString _textures;
|
||||||
bool _isUVModeStretch;
|
bool _isUVModeStretch;
|
||||||
bool _texturesChangedFlag { false };
|
bool _glow;
|
||||||
mutable QReadWriteLock _quadReadWriteLock;
|
bool _faceCamera;
|
||||||
|
|
||||||
|
bool _pointsChanged { false };
|
||||||
|
bool _normalsChanged { false };
|
||||||
|
bool _colorsChanged { false };
|
||||||
|
bool _widthsChanged { false };
|
||||||
|
bool _texturesChanged { false };
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_PolyLineEntityItem_h
|
#endif // hifi_PolyLineEntityItem_h
|
||||||
|
|
|
@ -33,7 +33,7 @@ PacketVersion versionForPacketType(PacketType packetType) {
|
||||||
case PacketType::EntityEdit:
|
case PacketType::EntityEdit:
|
||||||
case PacketType::EntityData:
|
case PacketType::EntityData:
|
||||||
case PacketType::EntityPhysics:
|
case PacketType::EntityPhysics:
|
||||||
return static_cast<PacketVersion>(EntityVersion::MorePropertiesCleanup);
|
return static_cast<PacketVersion>(EntityVersion::FixProtocolVersionBumpMismatch);
|
||||||
case PacketType::EntityQuery:
|
case PacketType::EntityQuery:
|
||||||
return static_cast<PacketVersion>(EntityQueryPacketVersion::ConicalFrustums);
|
return static_cast<PacketVersion>(EntityQueryPacketVersion::ConicalFrustums);
|
||||||
case PacketType::AvatarIdentity:
|
case PacketType::AvatarIdentity:
|
||||||
|
|
|
@ -252,7 +252,10 @@ enum class EntityVersion : PacketVersion {
|
||||||
GridEntities,
|
GridEntities,
|
||||||
MissingTextProperties,
|
MissingTextProperties,
|
||||||
GrabTraits,
|
GrabTraits,
|
||||||
MorePropertiesCleanup
|
MorePropertiesCleanup,
|
||||||
|
FixPropertiesFromCleanup,
|
||||||
|
UpdatedPolyLines,
|
||||||
|
FixProtocolVersionBumpMismatch
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class EntityScriptCallMethodVersion : PacketVersion {
|
enum class EntityScriptCallMethodVersion : PacketVersion {
|
||||||
|
|
|
@ -2151,7 +2151,6 @@ function createColorProperty(property, elProperty) {
|
||||||
submit: false, // We don't want to have a submission button
|
submit: false, // We don't want to have a submission button
|
||||||
onShow: function(colpick) {
|
onShow: function(colpick) {
|
||||||
console.log("Showing");
|
console.log("Showing");
|
||||||
$(colorPickerID).attr('active', 'true');
|
|
||||||
// The original color preview within the picker needs to be updated on show because
|
// The original color preview within the picker needs to be updated on show because
|
||||||
// prior to the picker being shown we don't have access to the selections' starting color.
|
// prior to the picker being shown we don't have access to the selections' starting color.
|
||||||
colorPickers[colorPickerID].colpickSetColor({
|
colorPickers[colorPickerID].colpickSetColor({
|
||||||
|
@ -2159,14 +2158,19 @@ function createColorProperty(property, elProperty) {
|
||||||
"g": elNumberG.elInput.value,
|
"g": elNumberG.elInput.value,
|
||||||
"b": elNumberB.elInput.value
|
"b": elNumberB.elInput.value
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Set the color picker active after setting the color, otherwise an update will be sent on open.
|
||||||
|
$(colorPickerID).attr('active', 'true');
|
||||||
},
|
},
|
||||||
onHide: function(colpick) {
|
onHide: function(colpick) {
|
||||||
$(colorPickerID).attr('active', 'false');
|
$(colorPickerID).attr('active', 'false');
|
||||||
},
|
},
|
||||||
onChange: function(hsb, hex, rgb, el) {
|
onChange: function(hsb, hex, rgb, el) {
|
||||||
$(el).css('background-color', '#' + hex);
|
$(el).css('background-color', '#' + hex);
|
||||||
|
if ($(colorPickerID).attr('active') === 'true') {
|
||||||
emitColorPropertyUpdate(propertyName, rgb.r, rgb.g, rgb.b);
|
emitColorPropertyUpdate(propertyName, rgb.r, rgb.g, rgb.b);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let elResult = [];
|
let elResult = [];
|
||||||
|
@ -3351,6 +3355,18 @@ function loaded() {
|
||||||
property.elColorPicker.style.backgroundColor = "rgb(" + propertyValue.red + "," +
|
property.elColorPicker.style.backgroundColor = "rgb(" + propertyValue.red + "," +
|
||||||
propertyValue.green + "," +
|
propertyValue.green + "," +
|
||||||
propertyValue.blue + ")";
|
propertyValue.blue + ")";
|
||||||
|
if ($(property.elColorPicker).attr('active') === 'true') {
|
||||||
|
// Set the color picker inactive before setting the color,
|
||||||
|
// otherwise an update will be sent directly after setting it here.
|
||||||
|
$(property.elColorPicker).attr('active', 'false');
|
||||||
|
colorPickers['#' + property.elementID].colpickSetColor({
|
||||||
|
"r": propertyValue.red,
|
||||||
|
"g": propertyValue.green,
|
||||||
|
"b": propertyValue.blue
|
||||||
|
});
|
||||||
|
$(property.elColorPicker).attr('active', 'true');
|
||||||
|
}
|
||||||
|
|
||||||
property.elNumberR.setValue(propertyValue.red);
|
property.elNumberR.setValue(propertyValue.red);
|
||||||
property.elNumberG.setValue(propertyValue.green);
|
property.elNumberG.setValue(propertyValue.green);
|
||||||
property.elNumberB.setValue(propertyValue.blue);
|
property.elNumberB.setValue(propertyValue.blue);
|
||||||
|
|
Loading…
Reference in a new issue