mirror of
https://github.com/overte-org/overte.git
synced 2025-04-18 18:17:08 +02:00
Merge pull request #15371 from huffman/fix/edit-out-of-range-on-numerical-types
Case 22167: Fix lack of ranges on numerical types in Create
This commit is contained in:
commit
feeb057fef
4 changed files with 22 additions and 6 deletions
|
@ -2630,11 +2630,11 @@ bool EntityItemProperties::getPropertyInfo(const QString& propertyName, EntityPr
|
|||
ENTITY_ITEM_MIN_FRICTION, ENTITY_ITEM_MAX_FRICTION);
|
||||
ADD_PROPERTY_TO_MAP(PROP_LIFETIME, Lifetime, lifetime, float);
|
||||
ADD_PROPERTY_TO_MAP(PROP_COLLISIONLESS, Collisionless, collisionless, bool);
|
||||
ADD_PROPERTY_TO_MAP(PROP_COLLISIONLESS, unused, ignoreForCollisions, unused); // legacy support
|
||||
ADD_PROPERTY_TO_MAP(PROP_COLLISION_MASK, unused, collisionMask, unused);
|
||||
ADD_PROPERTY_TO_MAP(PROP_COLLISION_MASK, unused, collidesWith, unused);
|
||||
ADD_PROPERTY_TO_MAP(PROP_DYNAMIC, unused, collisionsWillMove, unused); // legacy support
|
||||
ADD_PROPERTY_TO_MAP(PROP_DYNAMIC, unused, dynamic, unused);
|
||||
ADD_PROPERTY_TO_MAP(PROP_COLLISIONLESS, unused, ignoreForCollisions, bool); // legacy support
|
||||
ADD_PROPERTY_TO_MAP(PROP_COLLISION_MASK, unused, collisionMask, uint16_t);
|
||||
ADD_PROPERTY_TO_MAP(PROP_COLLISION_MASK, unused, collidesWith, uint16_t);
|
||||
ADD_PROPERTY_TO_MAP(PROP_DYNAMIC, unused, collisionsWillMove, bool); // legacy support
|
||||
ADD_PROPERTY_TO_MAP(PROP_DYNAMIC, unused, dynamic, bool);
|
||||
ADD_PROPERTY_TO_MAP(PROP_COLLISION_SOUND_URL, CollisionSoundURL, collisionSoundURL, QString);
|
||||
ADD_PROPERTY_TO_MAP(PROP_ACTION_DATA, ActionData, actionData, QByteArray);
|
||||
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <limits>
|
||||
#include <type_traits>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtx/component_wise.hpp>
|
||||
|
||||
|
@ -85,6 +88,16 @@ struct EntityPropertyInfo {
|
|||
QVariant maximum;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
EntityPropertyInfo makePropertyInfo(EntityPropertyList p, typename std::enable_if<!std::is_integral<T>::value>::type* = 0) {
|
||||
return EntityPropertyInfo(p);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
EntityPropertyInfo makePropertyInfo(EntityPropertyList p, typename std::enable_if<std::is_integral<T>::value>::type* = 0) {
|
||||
return EntityPropertyInfo(p, std::numeric_limits<T>::min(), std::numeric_limits<T>::max());
|
||||
}
|
||||
|
||||
/// A collection of properties of an entity item used in the scripting API. Translates between the actual properties of an
|
||||
/// entity and a JavaScript style hash/QScriptValue storing a set of properties. Used in scripting to set/get the complete
|
||||
/// set of entity item properties via JavaScript hashes/QScriptValues
|
||||
|
|
|
@ -416,9 +416,10 @@ inline QRect QRect_convertFromScriptValue(const QScriptValue& v, bool& isValid)
|
|||
T _##n; \
|
||||
static T _static##N;
|
||||
|
||||
|
||||
#define ADD_PROPERTY_TO_MAP(P, N, n, T) \
|
||||
{ \
|
||||
EntityPropertyInfo propertyInfo = EntityPropertyInfo(P); \
|
||||
EntityPropertyInfo propertyInfo { makePropertyInfo<T>(P) }; \
|
||||
_propertyInfos[#n] = propertyInfo; \
|
||||
_enumsToPropertyStrings[P] = #n; \
|
||||
}
|
||||
|
|
|
@ -616,6 +616,8 @@ const GROUPS = [
|
|||
decimals: 3,
|
||||
propertyID: "webAlpha",
|
||||
propertyName: "alpha",
|
||||
min: 0,
|
||||
max: 1,
|
||||
},
|
||||
{
|
||||
label: "Max FPS",
|
||||
|
|
Loading…
Reference in a new issue