mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 18:55:01 +02:00
removed extraneous commenting and image class
This commit is contained in:
parent
fe3bc00baa
commit
d390e20139
10 changed files with 1 additions and 252 deletions
|
@ -101,7 +101,6 @@ TabView {
|
|||
}
|
||||
}
|
||||
|
||||
// for image
|
||||
NewEntityButton {
|
||||
icon: "icons/create-icons/25-web-1-01.svg"
|
||||
text: "IMAGE"
|
||||
|
|
|
@ -350,8 +350,6 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
|
|||
CHECK_PROPERTY_CHANGE(PROP_AMBIENT_LIGHT_MODE, ambientLightMode);
|
||||
CHECK_PROPERTY_CHANGE(PROP_SKYBOX_MODE, skyboxMode);
|
||||
|
||||
//CHECK_PROPERTY_CHANGE(PROP_IMAGE_URL, imageURL);
|
||||
|
||||
CHECK_PROPERTY_CHANGE(PROP_SOURCE_URL, sourceUrl);
|
||||
CHECK_PROPERTY_CHANGE(PROP_VOXEL_VOLUME_SIZE, voxelVolumeSize);
|
||||
CHECK_PROPERTY_CHANGE(PROP_VOXEL_DATA, voxelData);
|
||||
|
@ -592,13 +590,6 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
|
|||
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_SKYBOX_MODE, skyboxMode, getSkyboxModeAsString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*// Image only
|
||||
if (_type == EntityTypes::Image) {
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_IMAGE_URL, imageURL);
|
||||
}*/
|
||||
|
||||
// Web only
|
||||
if (_type == EntityTypes::Web) {
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_SOURCE_URL, sourceUrl);
|
||||
|
@ -789,8 +780,6 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool
|
|||
COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(ambientLightMode, AmbientLightMode);
|
||||
COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(skyboxMode, SkyboxMode);
|
||||
|
||||
//COPY_PROPERTY_FROM_QSCRIPTVALUE(imageURL, QString, setImageURL);
|
||||
|
||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(sourceUrl, QString, setSourceUrl);
|
||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(voxelVolumeSize, glmVec3, setVoxelVolumeSize);
|
||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(voxelData, QByteArray, setVoxelData);
|
||||
|
@ -951,8 +940,6 @@ void EntityItemProperties::merge(const EntityItemProperties& other) {
|
|||
COPY_PROPERTY_IF_CHANGED(ambientLightMode);
|
||||
COPY_PROPERTY_IF_CHANGED(skyboxMode);
|
||||
|
||||
//COPY_PROPERTY_IF_CHANGED(imageURL);
|
||||
|
||||
COPY_PROPERTY_IF_CHANGED(sourceUrl);
|
||||
COPY_PROPERTY_IF_CHANGED(voxelVolumeSize);
|
||||
COPY_PROPERTY_IF_CHANGED(voxelData);
|
||||
|
@ -1146,7 +1133,6 @@ void EntityItemProperties::entityPropertyFlagsFromScriptValue(const QScriptValue
|
|||
ADD_PROPERTY_TO_MAP(PROP_VOXEL_SURFACE_STYLE, VoxelSurfaceStyle, voxelSurfaceStyle, uint16_t);
|
||||
ADD_PROPERTY_TO_MAP(PROP_NAME, Name, name, QString);
|
||||
ADD_PROPERTY_TO_MAP(PROP_SOURCE_URL, SourceUrl, sourceUrl, QString);
|
||||
//ADD_PROPERTY_TO_MAP(PROP_IMAGE_URL, ImageURL, imageURL, QString);
|
||||
ADD_PROPERTY_TO_MAP(PROP_LINE_WIDTH, LineWidth, lineWidth, float);
|
||||
ADD_PROPERTY_TO_MAP(PROP_LINE_POINTS, LinePoints, linePoints, QVector<glm::vec3>);
|
||||
ADD_PROPERTY_TO_MAP(PROP_HREF, Href, href, QString);
|
||||
|
@ -1383,10 +1369,6 @@ OctreeElement::AppendState EntityItemProperties::encodeEntityEditPacket(PacketTy
|
|||
APPEND_ENTITY_PROPERTY(PROP_DPI, properties.getDPI());
|
||||
}
|
||||
|
||||
/*if (properties.getType() == EntityTypes::Image) {
|
||||
APPEND_ENTITY_PROPERTY(PROP_IMAGE_URL, properties.getImageURL());
|
||||
}*/
|
||||
|
||||
if (properties.getType() == EntityTypes::Text) {
|
||||
APPEND_ENTITY_PROPERTY(PROP_TEXT, properties.getText());
|
||||
APPEND_ENTITY_PROPERTY(PROP_LINE_HEIGHT, properties.getLineHeight());
|
||||
|
@ -1748,10 +1730,6 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int
|
|||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_DPI, uint16_t, setDPI);
|
||||
}
|
||||
|
||||
/*if (properties.getType() == EntityTypes::Image) {
|
||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_IMAGE_URL, QString, setImageURL);
|
||||
}*/
|
||||
|
||||
if (properties.getType() == EntityTypes::Text) {
|
||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_TEXT, QString, setText);
|
||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LINE_HEIGHT, float, setLineHeight);
|
||||
|
@ -2069,8 +2047,6 @@ void EntityItemProperties::markAllChanged() {
|
|||
_skybox.markAllChanged();
|
||||
_haze.markAllChanged();
|
||||
|
||||
//_imageURLChanged = true;
|
||||
|
||||
_sourceUrlChanged = true;
|
||||
_voxelVolumeSizeChanged = true;
|
||||
_voxelDataChanged = true;
|
||||
|
|
|
@ -67,7 +67,6 @@ class EntityItemProperties {
|
|||
friend class ParticleEffectEntityItem; // TODO: consider removing this friend relationship and use public methods
|
||||
friend class ZoneEntityItem; // TODO: consider removing this friend relationship and use public methods
|
||||
friend class WebEntityItem; // TODO: consider removing this friend relationship and use public methods
|
||||
//friend class ImageEntityItem;
|
||||
friend class LineEntityItem; // TODO: consider removing this friend relationship and use public methods
|
||||
friend class PolyVoxEntityItem; // TODO: consider removing this friend relationship and use public methods
|
||||
friend class PolyLineEntityItem; // TODO: consider removing this friend relationship and use public methods
|
||||
|
@ -195,7 +194,6 @@ public:
|
|||
DEFINE_PROPERTY_GROUP(Haze, haze, HazePropertyGroup);
|
||||
DEFINE_PROPERTY_GROUP(Animation, animation, AnimationPropertyGroup);
|
||||
DEFINE_PROPERTY_REF(PROP_SOURCE_URL, SourceUrl, sourceUrl, QString, "");
|
||||
//DEFINE_PROPERTY_REF(PROP_IMAGE_URL, ImageURL, imageURL, QString, "");
|
||||
DEFINE_PROPERTY(PROP_LINE_WIDTH, LineWidth, lineWidth, float, LineEntityItem::DEFAULT_LINE_WIDTH);
|
||||
DEFINE_PROPERTY_REF(LINE_POINTS, LinePoints, linePoints, QVector<glm::vec3>, QVector<glm::vec3>());
|
||||
DEFINE_PROPERTY_REF(PROP_HREF, Href, href, QString, "");
|
||||
|
|
|
@ -42,9 +42,6 @@ enum EntityPropertyList {
|
|||
PROP_ANIMATION_ALLOW_TRANSLATION,
|
||||
PROP_RELAY_PARENT_JOINTS,
|
||||
|
||||
/*// for image
|
||||
PROP_IMAGE_URL,*/
|
||||
|
||||
// these properties are supported by the EntityItem base class
|
||||
PROP_REGISTRATION_POINT,
|
||||
PROP_ANGULAR_VELOCITY,
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "LineEntityItem.h"
|
||||
#include "PolyVoxEntityItem.h"
|
||||
#include "PolyLineEntityItem.h"
|
||||
//#include "ImageEntityItem.h"
|
||||
#include "ShapeEntityItem.h"
|
||||
|
||||
QMap<EntityTypes::EntityType, QString> EntityTypes::_typeToNameMap;
|
||||
|
@ -48,7 +47,6 @@ REGISTER_ENTITY_TYPE(Zone)
|
|||
REGISTER_ENTITY_TYPE(Line)
|
||||
REGISTER_ENTITY_TYPE(PolyVox)
|
||||
REGISTER_ENTITY_TYPE(PolyLine)
|
||||
//REGISTER_ENTITY_TYPE(Image)
|
||||
REGISTER_ENTITY_TYPE(Shape)
|
||||
REGISTER_ENTITY_TYPE_WITH_FACTORY(Box, ShapeEntityItem::boxFactory)
|
||||
REGISTER_ENTITY_TYPE_WITH_FACTORY(Sphere, ShapeEntityItem::sphereFactory)
|
||||
|
|
|
@ -48,7 +48,6 @@ public:
|
|||
Line,
|
||||
PolyVox,
|
||||
PolyLine,
|
||||
//Image,
|
||||
Shape,
|
||||
LAST = Shape
|
||||
} EntityType;
|
||||
|
|
|
@ -1,144 +0,0 @@
|
|||
//
|
||||
// ImageEntityItem.cpp
|
||||
// libraries/entities/src
|
||||
//
|
||||
// Created by Elisa Lupin-Jimenez on 1/3/18.
|
||||
// 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
|
||||
//
|
||||
|
||||
/* NOT IN USE
|
||||
|
||||
#include <QtCore/QJsonDocument>
|
||||
|
||||
#include <ByteCountCoding.h>
|
||||
#include <GLMHelpers.h>
|
||||
#include <glm/gtx/transform.hpp>
|
||||
#include <GeometryUtil.h>
|
||||
|
||||
#include "EntitiesLogging.h"
|
||||
#include "EntityItemProperties.h"
|
||||
#include "EntityTree.h"
|
||||
#include "EntityTreeElement.h"
|
||||
#include "ResourceCache.h"
|
||||
#include "ShapeEntityItem.h"
|
||||
#include "ImageEntityItem.h"
|
||||
|
||||
const QString ImageEntityItem::DEFAULT_IMAGE_URL("");
|
||||
|
||||
EntityItemPointer ImageEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
||||
EntityItemPointer entity(new ImageEntityItem(entityID), [](EntityItem* ptr) { ptr->deleteLater(); });
|
||||
entity->setProperties(properties);
|
||||
return entity;
|
||||
}
|
||||
|
||||
ImageEntityItem::ImageEntityItem(const EntityItemID& entityItemID) : EntityItem(entityItemID) {
|
||||
//_type = EntityTypes::Image;
|
||||
}
|
||||
|
||||
EntityItemProperties ImageEntityItem::getProperties(EntityPropertyFlags desiredProperties) const {
|
||||
EntityItemProperties properties = EntityItem::getProperties(desiredProperties); // get the properties from our base class
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(imageURL, getImageURL);
|
||||
// Using "Quad" shape as defined in ShapeEntityItem.cpp
|
||||
properties.setShape("Quad");
|
||||
return properties;
|
||||
}
|
||||
|
||||
bool ImageEntityItem::setProperties(const EntityItemProperties& properties) {
|
||||
bool somethingChanged = EntityItem::setProperties(properties); // set the properties in our base class
|
||||
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(imageURL, setImageURL);
|
||||
|
||||
if (somethingChanged) {
|
||||
bool wantDebug = false;
|
||||
if (wantDebug) {
|
||||
uint64_t now = usecTimestampNow();
|
||||
int elapsed = now - getLastEdited();
|
||||
qCDebug(entities) << "ImageEntityItem::setProperties() AFTER update... edited AGO=" << elapsed <<
|
||||
"now=" << now << " getLastEdited()=" << getLastEdited();
|
||||
}
|
||||
setLastEdited(properties.getLastEdited());
|
||||
}
|
||||
return somethingChanged;
|
||||
}
|
||||
|
||||
// TODO: eventually only include properties changed since the params.nodeData->getLastTimeBagEmpty() time
|
||||
EntityPropertyFlags ImageEntityItem::getEntityProperties(EncodeBitstreamParams& params) const {
|
||||
EntityPropertyFlags requestedProperties = EntityItem::getEntityProperties(params);
|
||||
requestedProperties += PROP_IMAGE_URL;
|
||||
return requestedProperties;
|
||||
}
|
||||
|
||||
void ImageEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBitstreamParams& params,
|
||||
EntityTreeElementExtraEncodeDataPointer modelTreeElementExtraEncodeData,
|
||||
EntityPropertyFlags& requestedProperties,
|
||||
EntityPropertyFlags& propertyFlags,
|
||||
EntityPropertyFlags& propertiesDidntFit,
|
||||
int& propertyCount,
|
||||
OctreeElement::AppendState& appendState) const {
|
||||
|
||||
bool successPropertyFits = true;
|
||||
// Using "Quad" shape as defined in ShapeEntityItem.cpp
|
||||
APPEND_ENTITY_PROPERTY(PROP_IMAGE_URL, _imageURL);
|
||||
}
|
||||
|
||||
int ImageEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
|
||||
ReadBitstreamToTreeParams& args,
|
||||
EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
|
||||
bool& somethingChanged) {
|
||||
|
||||
int bytesRead = 0;
|
||||
const unsigned char* dataAt = data;
|
||||
|
||||
READ_ENTITY_PROPERTY(PROP_IMAGE_URL, QString, setImageURL);
|
||||
|
||||
return bytesRead;
|
||||
}
|
||||
|
||||
void ImageEntityItem::setUnscaledDimensions(const glm::vec3& value) {
|
||||
const float MAX_FLAT_DIMENSION = 0.0001f;
|
||||
if (value.y > MAX_FLAT_DIMENSION) {
|
||||
// enforce flatness in Y
|
||||
glm::vec3 newDimensions = value;
|
||||
newDimensions.y = MAX_FLAT_DIMENSION;
|
||||
EntityItem::setUnscaledDimensions(newDimensions);
|
||||
} else {
|
||||
EntityItem::setUnscaledDimensions(value);
|
||||
}
|
||||
}
|
||||
|
||||
void ImageEntityItem::setImageURL(const QString& value) {
|
||||
withWriteLock([&] {
|
||||
if (_imageURL != value) {
|
||||
auto newURL = QUrl::fromUserInput(value);
|
||||
|
||||
if (newURL.isValid()) {
|
||||
_imageURL = newURL.toDisplayString();
|
||||
} else {
|
||||
qCDebug(entities) << "Clearing image entity source URL since" << value << "cannot be parsed to a valid URL.";
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
QString ImageEntityItem::getImageURL() const {
|
||||
return resultWithReadLock<QString>([&] {
|
||||
return _imageURL;
|
||||
});
|
||||
}
|
||||
|
||||
void ImageEntityItem::computeShapeInfo(ShapeInfo& info) {
|
||||
// This will be called whenever DIRTY_SHAPE flag (set by dimension change, etc)
|
||||
// is set.
|
||||
|
||||
EntityItem::computeShapeInfo(info);
|
||||
}
|
||||
|
||||
// This value specifies how the shape should be treated by physics calculations.
|
||||
ShapeType ImageEntityItem::getShapeType() const {
|
||||
return _collisionShapeType;
|
||||
}
|
||||
|
||||
*/
|
|
@ -1,66 +0,0 @@
|
|||
//
|
||||
// ImageEntityItem.h
|
||||
// libraries/entities/src
|
||||
//
|
||||
// Created by Elisa Lupin-Jimenez on 1/3/18.
|
||||
// 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
|
||||
//
|
||||
|
||||
/* NOT IN USE
|
||||
|
||||
#ifndef hifi_ImageEntityItem_h
|
||||
#define hifi_ImageEntityItem_h
|
||||
|
||||
#include "EntityItem.h"
|
||||
#include "ShapeEntityItem.h"
|
||||
|
||||
class ImageEntityItem : public EntityItem {
|
||||
public:
|
||||
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
|
||||
|
||||
ImageEntityItem(const EntityItemID& entityItemID);
|
||||
|
||||
ALLOW_INSTANTIATION // This class can be instantiated
|
||||
|
||||
// methods for getting/setting all properties of an entity
|
||||
virtual EntityItemProperties getProperties(EntityPropertyFlags desiredProperties = EntityPropertyFlags()) const override;
|
||||
virtual bool setProperties(const EntityItemProperties& properties) override;
|
||||
|
||||
EntityPropertyFlags getEntityProperties(EncodeBitstreamParams& params) const override;
|
||||
|
||||
virtual void appendSubclassData(OctreePacketData* packetData, EncodeBitstreamParams& params,
|
||||
EntityTreeElementExtraEncodeDataPointer entityTreeElementExtraEncodeData,
|
||||
EntityPropertyFlags& requestedProperties,
|
||||
EntityPropertyFlags& propertyFlags,
|
||||
EntityPropertyFlags& propertiesDidntFit,
|
||||
int& propertyCount,
|
||||
OctreeElement::AppendState& appendState) const override;
|
||||
|
||||
int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
|
||||
ReadBitstreamToTreeParams& args,
|
||||
EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
|
||||
bool& somethingChanged) override;
|
||||
|
||||
void setUnscaledDimensions(const glm::vec3& value) override;
|
||||
|
||||
static const QString DEFAULT_IMAGE_URL;
|
||||
virtual void setImageURL(const QString& value);
|
||||
QString getImageURL() const;
|
||||
|
||||
//virtual void computeShapeInfo(ShapeInfo& info) override;
|
||||
virtual ShapeType getShapeType() const override;
|
||||
|
||||
protected:
|
||||
QString _imageURL;
|
||||
|
||||
entity::Shape _shape{ entity::Shape::Quad };
|
||||
ShapeType _collisionShapeType{ ShapeType::SHAPE_TYPE_BOX };
|
||||
|
||||
};
|
||||
|
||||
#endif // hifi_ImageEntityItem_h
|
||||
|
||||
*/
|
|
@ -251,9 +251,7 @@ var toolBar = (function () {
|
|||
// Align entity with Avatar orientation.
|
||||
properties.rotation = MyAvatar.orientation;
|
||||
|
||||
// added image here
|
||||
var PRE_ADJUST_ENTITY_TYPES = ["Box", "Sphere", "Shape", "Text", "Web"];
|
||||
//var PRE_ADJUST_ENTITY_TYPES = ["Box", "Sphere", "Shape", "Text", "Image", "Web"];
|
||||
|
||||
if (PRE_ADJUST_ENTITY_TYPES.indexOf(properties.type) !== -1) {
|
||||
|
||||
|
@ -541,21 +539,16 @@ var toolBar = (function () {
|
|||
});
|
||||
});
|
||||
|
||||
// for image button
|
||||
addButton("newImageButton", "web-01.svg", function () {
|
||||
createNewEntity({
|
||||
type: "Model",
|
||||
// make constant for this later
|
||||
dimensions: {
|
||||
x: 4.16,
|
||||
y: 0.02,
|
||||
z: 2.58
|
||||
},
|
||||
modelURL: "https://hifi-content.s3.amazonaws.com/elisalj/image_entity/snapshot.fbx",
|
||||
// will this work?
|
||||
/*get textures() {
|
||||
return JSON.stringify({ "tex.picture": this.imageURL });
|
||||
}*/
|
||||
// change to another default image
|
||||
textures: JSON.stringify({ "tex.picture": "https://hifi-content.s3.amazonaws.com/elisalj/image_entity/dog.jpg" })
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1000,7 +1000,6 @@ function loaded() {
|
|||
elWebDPI.value = properties.dpi;
|
||||
} else if (properties.type === "Image") {
|
||||
var imageLink = JSON.parse(properties.textures)["tex.picture"];
|
||||
debugPrint("image url is: " + imageLink);
|
||||
elImageURL.value = imageLink;
|
||||
} else if (properties.type === "Text") {
|
||||
elTextText.value = properties.text;
|
||||
|
|
Loading…
Reference in a new issue