Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions Extensions/3D/JsExtension.js
Original file line number Diff line number Diff line change
Expand Up @@ -851,16 +851,41 @@ module.exports = {
objectContent[propertyName] = parseFloat(newValue);
return true;
}
if (propertyName === 'facesOrientation') {
const normalizedValue = newValue.toUpperCase();
if (normalizedValue === 'Y' || normalizedValue === 'Z') {
objectContent.facesOrientation = normalizedValue;
return true;
}
return false;
}
if (propertyName === 'backFaceUpThroughWhichAxisRotation') {
const normalizedValue = newValue.toUpperCase();
if (normalizedValue === 'X' || normalizedValue === 'Y') {
objectContent.backFaceUpThroughWhichAxisRotation = normalizedValue;
return true;
}
return false;
}
if (propertyName === 'materialType') {
const normalizedValue = newValue.toLowerCase();
if (normalizedValue === 'basic') {
objectContent.materialType = 'Basic';
return true;
}
if (normalizedValue === 'standardwithoutmetalness') {
objectContent.materialType = 'StandardWithoutMetalness';
return true;
}
return false;
}
if (
propertyName === 'frontFaceResourceName' ||
propertyName === 'backFaceResourceName' ||
propertyName === 'leftFaceResourceName' ||
propertyName === 'rightFaceResourceName' ||
propertyName === 'topFaceResourceName' ||
propertyName === 'bottomFaceResourceName' ||
propertyName === 'backFaceUpThroughWhichAxisRotation' ||
propertyName === 'facesOrientation' ||
propertyName === 'materialType' ||
propertyName === 'tint'
) {
objectContent[propertyName] = newValue;
Expand Down
36 changes: 33 additions & 3 deletions Extensions/3D/Model3DObjectConfiguration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,45 @@ bool Model3DObjectConfiguration::UpdateProperty(const gd::String &propertyName,
return true;
}
if (propertyName == "materialType") {
materialType = newValue;
auto normalizedValue = newValue.LowerCase();
if (normalizedValue == "basic")
materialType = "Basic";
else if (normalizedValue == "standardwithoutmetalness")
materialType = "StandardWithoutMetalness";
else if (normalizedValue == "keeporiginal")
materialType = "KeepOriginal";
else
return false;
return true;
}
if (propertyName == "originLocation") {
originLocation = newValue;
auto normalizedValue = newValue.LowerCase();
if (normalizedValue == "modelorigin")
originLocation = "ModelOrigin";
else if (normalizedValue == "topleft")
originLocation = "TopLeft";
else if (normalizedValue == "objectcenter")
originLocation = "ObjectCenter";
else if (normalizedValue == "bottomcenterz")
originLocation = "BottomCenterZ";
else if (normalizedValue == "bottomcentery")
originLocation = "BottomCenterY";
else
return false;
return true;
}
if (propertyName == "centerLocation") {
centerLocation = newValue;
auto normalizedValue = newValue.LowerCase();
if (normalizedValue == "modelorigin")
centerLocation = "ModelOrigin";
else if (normalizedValue == "objectcenter")
centerLocation = "ObjectCenter";
else if (normalizedValue == "bottomcenterz")
centerLocation = "BottomCenterZ";
else if (normalizedValue == "bottomcentery")
centerLocation = "BottomCenterY";
else
return false;
return true;
}
if (propertyName == "keepAspectRatio") {
Expand Down
24 changes: 24 additions & 0 deletions Extensions/BBText/JsExtension.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,30 @@ module.exports = {
var objectBBText = new gd.ObjectJsImplementation();
objectBBText.updateProperty = function (propertyName, newValue) {
const objectContent = this.content;
if (propertyName === 'align') {
const normalizedValue = newValue.toLowerCase();
if (
normalizedValue === 'left' ||
normalizedValue === 'center' ||
normalizedValue === 'right'
) {
objectContent.align = normalizedValue;
return true;
}
return false;
}
if (propertyName === 'verticalTextAlignment') {
const normalizedValue = newValue.toLowerCase();
if (
normalizedValue === 'top' ||
normalizedValue === 'center' ||
normalizedValue === 'bottom'
) {
objectContent.verticalTextAlignment = normalizedValue;
return true;
}
return false;
}
if (propertyName in objectContent) {
if (typeof objectContent[propertyName] === 'boolean')
objectContent[propertyName] = newValue === '1';
Expand Down
24 changes: 24 additions & 0 deletions Extensions/BitmapText/JsExtension.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,30 @@ module.exports = {
const bitmapTextObject = new gd.ObjectJsImplementation();
bitmapTextObject.updateProperty = function (propertyName, newValue) {
const objectContent = this.content;
if (propertyName === 'align') {
const normalizedValue = newValue.toLowerCase();
if (
normalizedValue === 'left' ||
normalizedValue === 'center' ||
normalizedValue === 'right'
) {
objectContent.align = normalizedValue;
return true;
}
return false;
}
if (propertyName === 'verticalTextAlignment') {
const normalizedValue = newValue.toLowerCase();
if (
normalizedValue === 'top' ||
normalizedValue === 'center' ||
normalizedValue === 'bottom'
) {
objectContent.verticalTextAlignment = normalizedValue;
return true;
}
return false;
}
if (propertyName in objectContent) {
if (typeof objectContent[propertyName] === 'boolean')
objectContent[propertyName] = newValue === '1';
Expand Down
14 changes: 11 additions & 3 deletions Extensions/ParticleSystem/ParticleEmitterObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,17 @@ bool ParticleEmitterObject::UpdateProperty(const gd::String& propertyName,
return true;
}
if (propertyName == "rendererType") {
auto newRendererType = newValue == "Circle" ? Point
: newValue == "Line" ? Line
: Quad;
auto normalizedValue = newValue.LowerCase();
auto newRendererType = Point;
if (normalizedValue == "circle") {
newRendererType = Point;
} else if (normalizedValue == "line") {
newRendererType = Line;
} else if (normalizedValue == "image") {
newRendererType = Quad;
} else {
return false;
}
SetRendererType(newRendererType);
if (newRendererType != Quad) {
SetParticleTexture("");
Expand Down
28 changes: 25 additions & 3 deletions Extensions/Physics2Behavior/JsExtension.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,14 @@ module.exports = {
newValue
) {
if (propertyName === 'bodyType') {
behaviorContent.getChild('bodyType').setStringValue(newValue);
const normalizedValue = newValue.toLowerCase();
let bodyTypeValue = '';
if (normalizedValue === 'static') bodyTypeValue = 'Static';
else if (normalizedValue === 'dynamic') bodyTypeValue = 'Dynamic';
else if (normalizedValue === 'kinematic') bodyTypeValue = 'Kinematic';
else return false;

behaviorContent.getChild('bodyType').setStringValue(bodyTypeValue);
return true;
}

Expand All @@ -65,7 +72,15 @@ module.exports = {
}

if (propertyName === 'shape') {
behaviorContent.getChild('shape').setStringValue(newValue);
const normalizedValue = newValue.toLowerCase();
let shapeValue = '';
if (normalizedValue === 'box') shapeValue = 'Box';
else if (normalizedValue === 'circle') shapeValue = 'Circle';
else if (normalizedValue === 'edge') shapeValue = 'Edge';
else if (normalizedValue === 'polygon') shapeValue = 'Polygon';
else return false;

behaviorContent.getChild('shape').setStringValue(shapeValue);
return true;
}

Expand Down Expand Up @@ -106,7 +121,14 @@ module.exports = {
}

if (propertyName === 'polygonOrigin') {
behaviorContent.addChild('polygonOrigin').setStringValue(newValue);
const normalizedValue = newValue.toLowerCase();
let originValue = '';
if (normalizedValue === 'center') originValue = 'Center';
else if (normalizedValue === 'origin') originValue = 'Origin';
else if (normalizedValue === 'topleft') originValue = 'TopLeft';
else return false;

behaviorContent.addChild('polygonOrigin').setStringValue(originValue);
return true;
}

Expand Down
38 changes: 32 additions & 6 deletions Extensions/Physics3DBehavior/JsExtension.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,18 @@ module.exports = {
}

if (propertyName === 'bodyType') {
behaviorContent.getChild('bodyType').setStringValue(newValue);
const normalizedValue = newValue.toLowerCase();
let bodyTypeValue = '';
if (normalizedValue === 'static') bodyTypeValue = 'Static';
else if (normalizedValue === 'dynamic') bodyTypeValue = 'Dynamic';
else if (normalizedValue === 'kinematic') bodyTypeValue = 'Kinematic';
else return false;

behaviorContent.getChild('bodyType').setStringValue(bodyTypeValue);
if (
newValue !== 'Static' &&
behaviorContent.getChild('shape').getStringValue() === 'Mesh'
bodyTypeValue !== 'Static' &&
behaviorContent.getChild('shape').getStringValue().toLowerCase() ===
'mesh'
) {
behaviorContent.getChild('shape').setStringValue('Box');
}
Expand All @@ -71,8 +79,17 @@ module.exports = {
}

if (propertyName === 'shape') {
behaviorContent.getChild('shape').setStringValue(newValue);
if (newValue === 'Mesh') {
const normalizedValue = newValue.toLowerCase();
let shapeValue = '';
if (normalizedValue === 'box') shapeValue = 'Box';
else if (normalizedValue === 'capsule') shapeValue = 'Capsule';
else if (normalizedValue === 'sphere') shapeValue = 'Sphere';
else if (normalizedValue === 'cylinder') shapeValue = 'Cylinder';
else if (normalizedValue === 'mesh') shapeValue = 'Mesh';
else return false;

behaviorContent.getChild('shape').setStringValue(shapeValue);
if (shapeValue === 'Mesh') {
behaviorContent.getChild('bodyType').setStringValue('Static');
}
return true;
Expand All @@ -86,7 +103,16 @@ module.exports = {
}

if (propertyName === 'shapeOrientation') {
behaviorContent.getChild('shapeOrientation').setStringValue(newValue);
const normalizedValue = newValue.toLowerCase();
let orientationValue = '';
if (normalizedValue === 'x') orientationValue = 'X';
else if (normalizedValue === 'y') orientationValue = 'Y';
else if (normalizedValue === 'z') orientationValue = 'Z';
else return false;

behaviorContent
.getChild('shapeOrientation')
.setStringValue(orientationValue);
return true;
}

Expand Down
9 changes: 7 additions & 2 deletions Extensions/PrimitiveDrawing/ShapePainterObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,13 @@ bool ShapePainterObject::UpdateProperty(const gd::String& propertyName,
}

if (propertyName == "antialiasing") {
SetAntialiasing(newValue);
return true;
auto normalizedValue = newValue.LowerCase();
if (normalizedValue == "none" || normalizedValue == "low" ||
normalizedValue == "medium" || normalizedValue == "high") {
SetAntialiasing(normalizedValue);
return true;
}
return false;
}

return false;
Expand Down
18 changes: 14 additions & 4 deletions Extensions/SaveState/JsExtension.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,10 +407,20 @@ module.exports = {
newValue
) {
if (propertyName === 'defaultProfilePersistence') {
behaviorContent
.getChild('defaultProfilePersistence')
.setStringValue(newValue);
return true;
const normalizedValue = newValue.toLowerCase();
if (normalizedValue === 'persisted') {
behaviorContent
.getChild('defaultProfilePersistence')
.setStringValue('Persisted');
return true;
}
if (normalizedValue === 'donotsave') {
behaviorContent
.getChild('defaultProfilePersistence')
.setStringValue('DoNotSave');
return true;
}
return false;
}
if (propertyName === 'persistedInProfiles') {
behaviorContent
Expand Down
29 changes: 25 additions & 4 deletions Extensions/TextInput/JsExtension.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,21 @@ module.exports = {
objectContent.fontSize = Math.max(1, parseFloat(newValue));
return true;
} else if (propertyName === 'inputType') {
objectContent.inputType = newValue;
return true;
const normalizedValue = newValue.toLowerCase();
if (
normalizedValue === 'text' ||
normalizedValue === 'text area' ||
normalizedValue === 'email' ||
normalizedValue === 'password' ||
normalizedValue === 'number' ||
normalizedValue === 'telephone number' ||
normalizedValue === 'url' ||
normalizedValue === 'search'
) {
objectContent.inputType = normalizedValue;
return true;
}
return false;
} else if (propertyName === 'textColor') {
objectContent.textColor = newValue;
return true;
Expand Down Expand Up @@ -91,8 +104,16 @@ module.exports = {
objectContent.paddingY = Math.max(0, parseFloat(newValue));
return true;
} else if (propertyName === 'textAlign') {
objectContent.textAlign = newValue;
return true;
const normalizedValue = newValue.toLowerCase();
if (
normalizedValue === 'left' ||
normalizedValue === 'center' ||
normalizedValue === 'right'
) {
objectContent.textAlign = normalizedValue;
return true;
}
return false;
}

return false;
Expand Down
12 changes: 10 additions & 2 deletions Extensions/TileMap/JsExtension.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,16 @@ const defineTileMap = function (extension, _, gd) {
return true;
}
if (propertyName === 'displayMode') {
objectContent.displayMode = newValue;
return true;
const normalizedValue = newValue.toLowerCase();
if (
normalizedValue === 'visible' ||
normalizedValue === 'all' ||
normalizedValue === 'index'
) {
objectContent.displayMode = normalizedValue;
return true;
}
return false;
}
if (propertyName === 'layerIndex') {
objectContent.layerIndex = parseFloat(newValue);
Expand Down