creating new image entity opens image property options

This commit is contained in:
Elisa Lupin-Jimenez 2018-01-23 14:50:41 -08:00
parent 308e481e63
commit 42151b8fd4
5 changed files with 136 additions and 9 deletions

View file

@ -592,8 +592,10 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_SKYBOX_MODE, skyboxMode, getSkyboxModeAsString());
}
// Image only
/*if (_type == EntityTypes::Image) {
/*// Image only
if (_type == EntityTypes::Image) {
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_IMAGE_URL, imageURL);
}*/
@ -787,7 +789,7 @@ 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(imageURL, QString, setImageURL);
COPY_PROPERTY_FROM_QSCRIPTVALUE(sourceUrl, QString, setSourceUrl);
COPY_PROPERTY_FROM_QSCRIPTVALUE(voxelVolumeSize, glmVec3, setVoxelVolumeSize);
@ -949,7 +951,7 @@ 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(imageURL);
COPY_PROPERTY_IF_CHANGED(sourceUrl);
COPY_PROPERTY_IF_CHANGED(voxelVolumeSize);
@ -2067,7 +2069,7 @@ void EntityItemProperties::markAllChanged() {
_skybox.markAllChanged();
_haze.markAllChanged();
_imageURLChanged = true;
//_imageURLChanged = true;
_sourceUrlChanged = true;
_voxelVolumeSizeChanged = true;

View file

@ -195,7 +195,7 @@ 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_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, "");

View file

@ -35,7 +35,7 @@ EntityItemPointer ImageEntityItem::factory(const EntityItemID& entityID, const E
}
ImageEntityItem::ImageEntityItem(const EntityItemID& entityItemID) : EntityItem(entityItemID) {
_type = EntityTypes::Image;
//_type = EntityTypes::Image;
}
EntityItemProperties ImageEntityItem::getProperties(EntityPropertyFlags desiredProperties) const {

View file

@ -253,6 +253,8 @@ var toolBar = (function () {
// 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) {
// Adjust position of entity per bounding box prior to creating it.
@ -539,6 +541,7 @@ var toolBar = (function () {
});
});
// for image button
addButton("newImageButton", "web-01.svg", function () {
createNewEntity({
type: "Model",
@ -548,8 +551,7 @@ var toolBar = (function () {
y: 0.02,
z: 2.58
},
modelURL: "http://hifi-content.s3.amazonaws.com/alan/dev/Test/snapshot.fbx",
imageURL: "https://hifi-content.s3.amazonaws.com/elisalj/image_entity/dog.jpg",
modelURL: "https://hifi-content.s3.amazonaws.com/elisalj/image_entity/snapshot.fbx",
// will this work?
/*get textures() {
return JSON.stringify({ "tex.picture": this.imageURL });

View file

@ -511,6 +511,10 @@ function loaded() {
var elPropertiesList = document.getElementById("properties-list");
var elID = document.getElementById("property-id");
var elType = document.getElementById("property-type");
<<<<<<< HEAD
=======
debugPrint("the type is: " + JSON.stringify(elType));
>>>>>>> creating new image entity opens image property options
var elTypeIcon = document.getElementById("type-icon");
var elName = document.getElementById("property-name");
var elLocked = document.getElementById("property-locked");
@ -661,16 +665,28 @@ function loaded() {
var elZoneKeyLightDirectionY = document.getElementById("property-zone-key-light-direction-y");
// Skybox
<<<<<<< HEAD
var elZoneSkyboxModeInherit = document.getElementById("property-zone-skybox-mode-inherit");
var elZoneSkyboxModeDisabled = document.getElementById("property-zone-skybox-mode-disabled");
var elZoneSkyboxModeEnabled = document.getElementById("property-zone-skybox-mode-enabled");
=======
var elZoneSkyboxModeInherit = document.getElementById("property-zone-skybox-mode-inherit");
var elZoneSkyboxModeDisabled = document.getElementById("property-zone-skybox-mode-disabled");
var elZoneSkyboxModeEnabled = document.getElementById("property-zone-skybox-mode-enabled");
>>>>>>> creating new image entity opens image property options
// Ambient light
var elCopySkyboxURLToAmbientURL = document.getElementById("copy-skybox-url-to-ambient-url");
<<<<<<< HEAD
var elZoneAmbientLightModeInherit = document.getElementById("property-zone-ambient-light-mode-inherit");
var elZoneAmbientLightModeDisabled = document.getElementById("property-zone-ambient-light-mode-disabled");
var elZoneAmbientLightModeEnabled = document.getElementById("property-zone-ambient-light-mode-enabled");
=======
var elZoneAmbientLightModeInherit = document.getElementById("property-zone-ambient-light-mode-inherit");
var elZoneAmbientLightModeDisabled = document.getElementById("property-zone-ambient-light-mode-disabled");
var elZoneAmbientLightModeEnabled = document.getElementById("property-zone-ambient-light-mode-enabled");
>>>>>>> creating new image entity opens image property options
var elZoneAmbientLightIntensity = document.getElementById("property-zone-key-ambient-intensity");
var elZoneAmbientLightURL = document.getElementById("property-zone-key-ambient-url");
@ -787,7 +803,11 @@ function loaded() {
} else {
properties = data.selections[0].properties;
<<<<<<< HEAD
=======
debugPrint("props: " + JSON.stringify(properties));
>>>>>>> creating new image entity opens image property options
if (lastEntityID !== '"' + properties.id + '"' && lastEntityID !== null && editor !== null) {
saveJSONUserData(true);
}
@ -796,6 +816,14 @@ function loaded() {
lastEntityID = '"' + properties.id + '"';
elID.value = properties.id;
<<<<<<< HEAD
=======
// image is not yet a separate entity type
if (properties.type === "Model" && properties.modelURL === "https://hifi-content.s3.amazonaws.com/elisalj/image_entity/snapshot.fbx") {
properties.type = "Image";
}
>>>>>>> creating new image entity opens image property options
// Create class name for css ruleset filtering
elPropertiesList.className = properties.type + 'Menu';
@ -1024,9 +1052,15 @@ function loaded() {
} else if (properties.type === "Zone") {
// Key light
<<<<<<< HEAD
elZoneKeyLightModeInherit.checked = (properties.keyLightMode === 'inherit');
elZoneKeyLightModeDisabled.checked = (properties.keyLightMode === 'disabled');
elZoneKeyLightModeEnabled.checked = (properties.keyLightMode === 'enabled');
=======
elZoneKeyLightModeInherit.checked = (properties.keyLightMode === 'inherit');
elZoneKeyLightModeDisabled.checked = (properties.keyLightMode === 'disabled');
elZoneKeyLightModeEnabled.checked = (properties.keyLightMode === 'enabled');
>>>>>>> creating new image entity opens image property options
elZoneKeyLightColor.style.backgroundColor = "rgb(" + properties.keyLight.color.red + "," +
properties.keyLight.color.green + "," + properties.keyLight.color.blue + ")";
@ -1038,6 +1072,7 @@ function loaded() {
elZoneKeyLightDirectionY.value = properties.keyLight.direction.y.toFixed(2);
// Skybox
<<<<<<< HEAD
elZoneSkyboxModeInherit.checked = (properties.skyboxMode === 'inherit');
elZoneSkyboxModeDisabled.checked = (properties.skyboxMode === 'disabled');
elZoneSkyboxModeEnabled.checked = (properties.skyboxMode === 'enabled');
@ -1046,14 +1081,30 @@ function loaded() {
elZoneAmbientLightModeInherit.checked = (properties.ambientLightMode === 'inherit');
elZoneAmbientLightModeDisabled.checked = (properties.ambientLightMode === 'disabled');
elZoneAmbientLightModeEnabled.checked = (properties.ambientLightMode === 'enabled');
=======
elZoneSkyboxModeInherit.checked = (properties.skyboxMode === 'inherit');
elZoneSkyboxModeDisabled.checked = (properties.skyboxMode === 'disabled');
elZoneSkyboxModeEnabled.checked = (properties.skyboxMode === 'enabled');
// Ambient light
elZoneAmbientLightModeInherit.checked = (properties.ambientLightMode === 'inherit');
elZoneAmbientLightModeDisabled.checked = (properties.ambientLightMode === 'disabled');
elZoneAmbientLightModeEnabled.checked = (properties.ambientLightMode === 'enabled');
>>>>>>> creating new image entity opens image property options
elZoneAmbientLightIntensity.value = properties.ambientLight.ambientIntensity.toFixed(2);
elZoneAmbientLightURL.value = properties.ambientLight.ambientURL;
// Haze
<<<<<<< HEAD
elZoneHazeModeInherit.checked = (properties.hazeMode === 'inherit');
elZoneHazeModeDisabled.checked = (properties.hazeMode === 'disabled');
elZoneHazeModeEnabled.checked = (properties.hazeMode === 'enabled');
=======
elZoneHazeModeInherit.checked = (properties.hazeMode === 'inherit');
elZoneHazeModeDisabled.checked = (properties.hazeMode === 'disabled');
elZoneHazeModeEnabled.checked = (properties.hazeMode === 'enabled');
>>>>>>> creating new image entity opens image property options
elZoneHazeRange.value = properties.haze.hazeRange.toFixed(0);
elZoneHazeColor.style.backgroundColor = "rgb(" +
@ -1319,15 +1370,24 @@ function loaded() {
colorScheme: 'dark',
layout: 'hex',
color: '000000',
<<<<<<< HEAD
submit: false, // We don't want to have a submission button
=======
>>>>>>> creating new image entity opens image property options
onShow: function(colpick) {
$('#property-color-control2').attr('active', 'true');
},
onHide: function(colpick) {
$('#property-color-control2').attr('active', 'false');
},
<<<<<<< HEAD
onChange: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex);
=======
onSubmit: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex);
$(el).colpickHide();
>>>>>>> creating new image entity opens image property options
emitColorPropertyUpdate('color', rgb.r, rgb.g, rgb.b);
}
}));
@ -1343,15 +1403,24 @@ function loaded() {
colorScheme: 'dark',
layout: 'hex',
color: '000000',
<<<<<<< HEAD
submit: false, // We don't want to have a submission button
=======
>>>>>>> creating new image entity opens image property options
onShow: function(colpick) {
$('#property-light-color').attr('active', 'true');
},
onHide: function(colpick) {
$('#property-light-color').attr('active', 'false');
},
<<<<<<< HEAD
onChange: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex);
=======
onSubmit: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex);
$(el).colpickHide();
>>>>>>> creating new image entity opens image property options
emitColorPropertyUpdate('color', rgb.r, rgb.g, rgb.b);
}
}));
@ -1400,15 +1469,24 @@ function loaded() {
colorScheme: 'dark',
layout: 'hex',
color: '000000',
<<<<<<< HEAD
submit: false, // We don't want to have a submission button
=======
>>>>>>> creating new image entity opens image property options
onShow: function(colpick) {
$('#property-text-text-color').attr('active', 'true');
},
onHide: function(colpick) {
$('#property-text-text-color').attr('active', 'false');
},
<<<<<<< HEAD
onChange: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex);
=======
onSubmit: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex);
$(el).colpickHide();
>>>>>>> creating new image entity opens image property options
$(el).attr('active', 'false');
emitColorPropertyUpdate('textColor', rgb.r, rgb.g, rgb.b);
}
@ -1424,15 +1502,24 @@ function loaded() {
colorScheme: 'dark',
layout: 'hex',
color: '000000',
<<<<<<< HEAD
submit: false, // We don't want to have a submission button
=======
>>>>>>> creating new image entity opens image property options
onShow: function(colpick) {
$('#property-text-background-color').attr('active', 'true');
},
onHide: function(colpick) {
$('#property-text-background-color').attr('active', 'false');
},
<<<<<<< HEAD
onChange: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex);
=======
onSubmit: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex);
$(el).colpickHide();
>>>>>>> creating new image entity opens image property options
emitColorPropertyUpdate('backgroundColor', rgb.r, rgb.g, rgb.b);
}
}));
@ -1449,15 +1536,24 @@ function loaded() {
colorScheme: 'dark',
layout: 'hex',
color: '000000',
<<<<<<< HEAD
submit: false, // We don't want to have a submission button
=======
>>>>>>> creating new image entity opens image property options
onShow: function(colpick) {
$('#property-zone-key-light-color').attr('active', 'true');
},
onHide: function(colpick) {
$('#property-zone-key-light-color').attr('active', 'false');
},
<<<<<<< HEAD
onChange: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex);
=======
onSubmit: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex);
$(el).colpickHide();
>>>>>>> creating new image entity opens image property options
emitColorPropertyUpdate('color', rgb.r, rgb.g, rgb.b, 'keyLight');
}
}));
@ -1518,15 +1614,24 @@ function loaded() {
colorScheme: 'dark',
layout: 'hex',
color: '000000',
<<<<<<< HEAD
submit: false, // We don't want to have a submission button
=======
>>>>>>> creating new image entity opens image property options
onShow: function(colpick) {
$('#property-zone-haze-color').attr('active', 'true');
},
onHide: function(colpick) {
$('#property-zone-haze-color').attr('active', 'false');
},
<<<<<<< HEAD
onChange: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex);
=======
onSubmit: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex);
$(el).colpickHide();
>>>>>>> creating new image entity opens image property options
emitColorPropertyUpdate('hazeColor', rgb.r, rgb.g, rgb.b, 'haze');
}
}));
@ -1543,15 +1648,24 @@ function loaded() {
colorScheme: 'dark',
layout: 'hex',
color: '000000',
<<<<<<< HEAD
submit: false, // We don't want to have a submission button
=======
>>>>>>> creating new image entity opens image property options
onShow: function(colpick) {
$('#property-zone-haze-glare-color').attr('active', 'true');
},
onHide: function(colpick) {
$('#property-zone-haze-glare-color').attr('active', 'false');
},
<<<<<<< HEAD
onChange: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex);
=======
onSubmit: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex);
$(el).colpickHide();
>>>>>>> creating new image entity opens image property options
emitColorPropertyUpdate('hazeGlareColor', rgb.r, rgb.g, rgb.b, 'haze');
}
}));
@ -1585,15 +1699,24 @@ function loaded() {
colorScheme: 'dark',
layout: 'hex',
color: '000000',
<<<<<<< HEAD
submit: false, // We don't want to have a submission button
=======
>>>>>>> creating new image entity opens image property options
onShow: function(colpick) {
$('#property-zone-skybox-color').attr('active', 'true');
},
onHide: function(colpick) {
$('#property-zone-skybox-color').attr('active', 'false');
},
<<<<<<< HEAD
onChange: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex);
=======
onSubmit: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex);
$(el).colpickHide();
>>>>>>> creating new image entity opens image property options
emitColorPropertyUpdate('color', rgb.r, rgb.g, rgb.b, 'skybox');
}
}));