Cleaned up some node attr size handling

This commit is contained in:
Eric Froemling 2020-11-08 15:16:49 -08:00
parent 62e473e7bc
commit 012f2b31cf
19 changed files with 133 additions and 78 deletions

View File

@ -3932,24 +3932,24 @@
"assets/build/windows/Win32/ucrtbased.dll": "https://files.ballistica.net/cache/ba1/b5/85/f8b6d0558ddb87267f34254b1450",
"assets/build/windows/Win32/vc_redist.x86.exe": "https://files.ballistica.net/cache/ba1/1c/e1/4a1a2eddda2f4aebd5f8b64ab08e",
"assets/build/windows/Win32/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/50/8d/bc2600ac9491f1b14d659709451f",
"build/prefab/full/linux_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/69/ba/e8830d9b8f8f168b74839e350218",
"build/prefab/full/linux_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/11/8c/8a2b2d5d50fa3a89680178639889",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/1e/f8/e9812a6c731eb2be3693ab2f5bb6",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/88/31/e41a319be49560b4bfe3610c79ce",
"build/prefab/full/mac_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/93/42/7fe40fcab72bfea7502c8e692c1e",
"build/prefab/full/mac_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/99/2c/03ee94c2b0b9cfb1b8c095ba007b",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/aa/c0/891963ac51cdcdeae54c24eb3760",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/2e/6e/62e68b315e13789dde712f7569e6",
"build/prefab/full/windows_x86/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/f4/f2/4f3bfa11a24a15de1ea2813f4e6b",
"build/prefab/full/windows_x86/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/b7/9f/a807ab1bc579bd9f4d0e21e1aa5d",
"build/prefab/full/windows_x86_server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/d8/2f/1e308b812e485215f88e2f27d22c",
"build/prefab/full/windows_x86_server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/27/66/91b54de2a3c9a00bc4b045a59fa4",
"build/prefab/lib/linux_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c3/d7/627d518a92951cf7fe9fc0b9b3a0",
"build/prefab/lib/linux_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/de/49/2cfc34ac856737d903954db5571b",
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e8/9a/67cf9ece361ca2f5d338009bdbfc",
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/86/de/7d9c9a2b7bba34c630130ed759c9",
"build/prefab/lib/mac_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d1/c3/1556852cab467d5d57c471960caf",
"build/prefab/lib/mac_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/68/32/7123695e4ee44aed16bd6adcb677",
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/cf/cd/577e1083c8076af177d660114bb6",
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/46/e2/f299370b002e227228d2df75fc73"
"build/prefab/full/linux_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/90/fd/b5f0e7d614b0a98ee5306ae59ab0",
"build/prefab/full/linux_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/a0/9f/e406bba60a2d282eec1988c080fd",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/2d/96/f49e8beb66fc9faf680dbeba99dc",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/78/30/f6e16a3e3556d511f8baeb1beaeb",
"build/prefab/full/mac_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/5d/19/ae4ba8cbf3612676eb535ac3a1a1",
"build/prefab/full/mac_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/75/01/315c088cc4a04b36e0c002c705b3",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/2a/af/3eae8477077f4bba23224717f124",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/a2/e6/b8c9e6ab705fff5ce5d92b2b078f",
"build/prefab/full/windows_x86/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/2f/6d/76ccb3cdf80f26d7ce20175a6541",
"build/prefab/full/windows_x86/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/9c/8f/86044e101e9b3ba824b1639fe334",
"build/prefab/full/windows_x86_server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/66/6e/3783556079cf004a6134d7a10740",
"build/prefab/full/windows_x86_server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/38/6d/760902ffcb589aad58119db0dbff",
"build/prefab/lib/linux_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/64/4c/12a9c3e845cf29efd6a2740a9f67",
"build/prefab/lib/linux_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/2d/f9/12757cb5cb19288d2948f196d48f",
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ce/b3/389a58e74c47318de2bc26269cbb",
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/91/e3/2a6988e1e5fc37365bb8bd4fb67b",
"build/prefab/lib/mac_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/3f/03/aa9a70c57e964a09abd8f3260f39",
"build/prefab/lib/mac_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7c/3c/e9d97cd4f1b2670df60062623142",
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/8d/e6/33b920293924a438bfc5f15d708c",
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/a5/ba/594adf54f09fd9aae86fae0d7aaf"
}

View File

@ -1,6 +1,6 @@
### 1.5.28 (20239)
- Simplified ba.enum_by_value()
- Updated Google Play version to hopefully show friend high scores again on score screens.
- Updated Google Play version to hopefully show friend high scores again on score screens (at least for levels that have an associated Google Play leaderboard).
- Public-party-list now properly shows an error instead of 'loading...' when not signed in.
### 1.5.27 (20238)

View File

@ -1,5 +1,5 @@
<!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND -->
<h4><em>last updated on 2020-11-08 for Ballistica version 1.5.28 build 20244</em></h4>
<h4><em>last updated on 2020-11-08 for Ballistica version 1.5.28 build 20245</em></h4>
<p>This page documents the Python classes and functions in the 'ba' module,
which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please <a href="mailto:support@froemling.net">let me know</a>. Happy modding!</p>
<hr>

View File

@ -21,7 +21,7 @@
namespace ballistica {
// These are set automatically via script; don't change here.
const int kAppBuildNumber = 20244;
const int kAppBuildNumber = 20245;
const char* kAppVersion = "1.5.28";
// Our standalone globals.

View File

@ -62,20 +62,26 @@ void ExplosionNode::set_big(bool val) {
}
void ExplosionNode::set_position(const std::vector<float>& vals) {
if (vals.size() != 3)
throw Exception("Expected float array of size 3 for position");
if (vals.size() != 3) {
throw Exception("Expected float array of size 3 for position",
PyExcType::kValue);
}
position_ = vals;
}
void ExplosionNode::set_velocity(const std::vector<float>& vals) {
if (vals.size() != 3)
throw Exception("Expected float array of size 3 for velocity");
if (vals.size() != 3) {
throw Exception("Expected float array of size 3 for velocity",
PyExcType::kValue);
}
velocity_ = vals;
}
void ExplosionNode::set_color(const std::vector<float>& vals) {
if (vals.size() != 3)
throw Exception("Expected float array of size 3 for color");
if (vals.size() != 3) {
throw Exception("Expected float array of size 3 for color",
PyExcType::kValue);
}
color_ = vals;
}

View File

@ -147,7 +147,8 @@ auto FlagNode::getPosition() const -> std::vector<float> {
void FlagNode::SetColor(const std::vector<float>& vals) {
if (vals.size() != 3) {
throw Exception("Expected float array of length 3 for color");
throw Exception("Expected float array of length 3 for color",
PyExcType::kValue);
}
color_ = vals;
}
@ -159,7 +160,8 @@ void FlagNode::SetLightWeight(bool val) {
void FlagNode::SetPosition(const std::vector<float>& vals) {
if (vals.size() != 3) {
throw Exception("Expected float array of length 3 for position");
throw Exception("Expected float array of length 3 for position",
PyExcType::kValue);
}
dQuaternion iq;
dQFromAxisAndAngle(iq, 1, 0, 0, -90 * (kPi / 180.0f));

View File

@ -39,7 +39,8 @@ FlashNode::~FlashNode() = default;
void FlashNode::SetPosition(const std::vector<float>& vals) {
if (vals.size() != 3) {
throw Exception("Expected float array of size 3 for position");
throw Exception("Expected float array of size 3 for position",
PyExcType::kValue);
}
position_ = vals;
}

View File

@ -233,7 +233,8 @@ void GlobalsNode::SetHappyThoughtsMode(bool val) {
void GlobalsNode::SetShadowScale(const std::vector<float>& vals) {
if (vals.size() != 2) {
throw Exception("Expected float array of length 2 for shadow_scale");
throw Exception("Expected float array of length 2 for shadow_scale",
PyExcType::kValue);
}
shadow_scale_ = vals;
if (IsCurrentGlobals()) {
@ -244,7 +245,8 @@ void GlobalsNode::SetShadowScale(const std::vector<float>& vals) {
void GlobalsNode::set_area_of_interest_bounds(const std::vector<float>& vals) {
if (vals.size() != 6) {
throw Exception(
"Expected float array of length 6 for area_of_interest_bounds");
"Expected float array of length 6 for area_of_interest_bounds",
PyExcType::kValue);
}
area_of_interest_bounds_ = vals;
@ -259,7 +261,8 @@ void GlobalsNode::set_area_of_interest_bounds(const std::vector<float>& vals) {
void GlobalsNode::SetShadowRange(const std::vector<float>& vals) {
if (vals.size() != 4) {
throw Exception("Expected float array of length 4 for shadow_range");
throw Exception("Expected float array of length 4 for shadow_range",
PyExcType::kValue);
}
shadow_range_ = vals;
if (IsCurrentGlobals()) {
@ -270,7 +273,8 @@ void GlobalsNode::SetShadowRange(const std::vector<float>& vals) {
void GlobalsNode::SetShadowOffset(const std::vector<float>& vals) {
if (vals.size() != 3) {
throw Exception("Expected float array of length 3 for shadow_offset");
throw Exception("Expected float array of length 3 for shadow_offset",
PyExcType::kValue);
}
shadow_offset_ = vals;
if (IsCurrentGlobals()) {
@ -280,7 +284,8 @@ void GlobalsNode::SetShadowOffset(const std::vector<float>& vals) {
void GlobalsNode::SetVRCameraOffset(const std::vector<float>& vals) {
if (vals.size() != 3) {
throw Exception("Expected float array of length 3 for vr_camera_offset");
throw Exception("Expected float array of length 3 for vr_camera_offset",
PyExcType::kValue);
}
vr_camera_offset_ = vals;
if (IsCurrentGlobals()) {
@ -297,7 +302,8 @@ void GlobalsNode::SetShadowOrtho(bool val) {
void GlobalsNode::SetTint(const std::vector<float>& vals) {
if (vals.size() != 3) {
throw Exception("Expected float array of length 3 for tint");
throw Exception("Expected float array of length 3 for tint",
PyExcType::kValue);
}
tint_ = vals;
if (IsCurrentGlobals()) {
@ -307,7 +313,8 @@ void GlobalsNode::SetTint(const std::vector<float>& vals) {
void GlobalsNode::SetVROverlayCenter(const std::vector<float>& vals) {
if (vals.size() != 3) {
throw Exception("Expected float array of length 3 for vr_overlay_center");
throw Exception("Expected float array of length 3 for vr_overlay_center",
PyExcType::kValue);
}
vr_overlay_center_ = vals;
#if BA_VR_BUILD
@ -329,7 +336,8 @@ void GlobalsNode::SetVROverlayCenterEnabled(bool val) {
void GlobalsNode::SetAmbientColor(const std::vector<float>& vals) {
if (vals.size() != 3) {
throw Exception("Expected float array of length 3 for ambient_color");
throw Exception("Expected float array of length 3 for ambient_color",
PyExcType::kValue);
}
ambient_color_ = vals;
if (IsCurrentGlobals()) {
@ -339,7 +347,8 @@ void GlobalsNode::SetAmbientColor(const std::vector<float>& vals) {
void GlobalsNode::SetVignetteOuter(const std::vector<float>& vals) {
if (vals.size() != 3) {
throw Exception("Expected float array of length 3 for vignette_outer");
throw Exception("Expected float array of length 3 for vignette_outer",
PyExcType::kValue);
}
vignette_outer_ = vals;
if (IsCurrentGlobals()) {
@ -349,7 +358,8 @@ void GlobalsNode::SetVignetteOuter(const std::vector<float>& vals) {
void GlobalsNode::SetVignetteInner(const std::vector<float>& vals) {
if (vals.size() != 3) {
throw Exception("Expected float array of length 3 for vignette_inner");
throw Exception("Expected float array of length 3 for vignette_inner",
PyExcType::kValue);
}
vignette_inner_ = vals;
if (IsCurrentGlobals()) {

View File

@ -132,7 +132,8 @@ void ImageNode::SetAttach(const std::string& val) {
void ImageNode::SetTint2Color(const std::vector<float>& vals) {
if (vals.size() != 3) {
throw Exception("Expected float array of size 3 for tint2_color");
throw Exception("Expected float array of size 3 for tint2_color",
PyExcType::kValue);
}
tint2_color_ = vals;
tint2_red_ = tint2_color_[0];
@ -142,7 +143,8 @@ void ImageNode::SetTint2Color(const std::vector<float>& vals) {
void ImageNode::SetTintColor(const std::vector<float>& vals) {
if (vals.size() != 3) {
throw Exception("Expected float array of size 3 for tint_color");
throw Exception("Expected float array of size 3 for tint_color",
PyExcType::kValue);
}
tint_color_ = vals;
tint_red_ = tint_color_[0];
@ -168,7 +170,8 @@ void ImageNode::SetColor(const std::vector<float>& vals) {
void ImageNode::SetScale(const std::vector<float>& vals) {
if (vals.size() != 1 && vals.size() != 2) {
throw Exception("Expected float array of length 1 or 2 for scale");
throw Exception("Expected float array of length 1 or 2 for scale",
PyExcType::kValue);
}
dirty_ = true;
scale_ = vals;
@ -176,7 +179,8 @@ void ImageNode::SetScale(const std::vector<float>& vals) {
void ImageNode::SetPosition(const std::vector<float>& vals) {
if (vals.size() != 2) {
throw Exception("Expected float array of length 2 for position");
throw Exception("Expected float array of length 2 for position",
PyExcType::kValue);
}
dirty_ = true;
position_ = vals;

View File

@ -76,20 +76,25 @@ void LocatorNode::SetShape(const std::string& val) {
void LocatorNode::SetColor(const std::vector<float>& vals) {
if (vals.size() != 3) {
throw Exception("Expected float array of size 3 for color");
throw Exception("Expected float array of size 3 for color",
PyExcType::kValue);
}
color_ = vals;
}
void LocatorNode::SetPosition(const std::vector<float>& vals) {
if (vals.size() != 3)
throw Exception("Expected float array of size 3 for position");
if (vals.size() != 3) {
throw Exception("Expected float array of size 3 for position",
PyExcType::kValue);
}
position_ = vals;
}
void LocatorNode::SetSize(const std::vector<float>& vals) {
if (vals.size() != 1 && vals.size() != 3)
throw Exception("Expected float array of size 1 or 3 for size");
if (vals.size() != 1 && vals.size() != 3) {
throw Exception("Expected float array of size 1 or 3 for size",
PyExcType::kValue);
}
size_ = vals;
if (size_.size() == 1) {
size_.push_back(size_[0]);

View File

@ -34,7 +34,8 @@ PlayerNode::~PlayerNode() = default;
void PlayerNode::SetPosition(const std::vector<float>& vals) {
if (vals.size() != 3) {
throw Exception("Expected float array of size 3 for position");
throw Exception("Expected float array of size 3 for position",
PyExcType::kValue);
}
position_ = vals;
}

View File

@ -334,7 +334,8 @@ void PropNode::SetReflectionScale(const std::vector<float>& vals) {
if (vals.size() != 1 && vals.size() != 3) {
throw Exception(
"Expected float array of length"
" 1 or 3 for reflection_scale");
" 1 or 3 for reflection_scale",
PyExcType::kValue);
}
reflection_scale_ = vals;
if (reflection_scale_.size() == 1) {
@ -381,7 +382,8 @@ auto PropNode::GetVelocity() const -> std::vector<float> {
void PropNode::SetVelocity(const std::vector<float>& vals) {
if (vals.size() != 3) {
throw Exception("Expected float array of size 3 for velocity");
throw Exception("Expected float array of size 3 for velocity",
PyExcType::kValue);
}
// if we've got a body, apply the velocity to that
if (body_.exists()) {
@ -412,7 +414,8 @@ auto PropNode::GetPosition() const -> std::vector<float> {
void PropNode::SetPosition(const std::vector<float>& vals) {
if (vals.size() != 3) {
throw Exception("Expected float array of size 3 for position (got "
+ std::to_string(vals.size()) + ")");
+ std::to_string(vals.size()) + ")",
PyExcType::kValue);
}
// if we've got a body, apply the position to that
if (body_.exists()) {

View File

@ -65,7 +65,8 @@ void RegionNode::SetMaterials(const std::vector<Material*>& vals) {
void RegionNode::SetPosition(const std::vector<float>& vals) {
if (vals.size() != 3) {
throw Exception("Expected float array of length 3 for position");
throw Exception("Expected float array of length 3 for position",
PyExcType::kValue);
}
position_ = vals;
size_or_pos_dirty_ = true;
@ -73,7 +74,8 @@ void RegionNode::SetPosition(const std::vector<float>& vals) {
void RegionNode::SetScale(const std::vector<float>& vals) {
if (vals.size() != 3) {
throw Exception("Expected float array of length 3 for scale");
throw Exception("Expected float array of length 3 for scale",
PyExcType::kValue);
}
scale_ = vals;
size_or_pos_dirty_ = true;

View File

@ -47,14 +47,18 @@ ScorchNode::ScorchNode(Scene* scene) : Node(scene, node_type) {
ScorchNode::~ScorchNode() = default;
void ScorchNode::SetColor(const std::vector<float>& vals) {
if (vals.size() != 3)
throw Exception("Expected float array of length 3 for color");
if (vals.size() != 3) {
throw Exception("Expected float array of length 3 for color",
PyExcType::kValue);
}
color_ = vals;
}
void ScorchNode::SetPosition(const std::vector<float>& vals) {
if (vals.size() != 3)
throw Exception("Expected float array of length 3 for position");
if (vals.size() != 3) {
throw Exception("Expected float array of length 3 for position",
PyExcType::kValue);
}
position_ = vals;
}

View File

@ -60,14 +60,16 @@ ShieldNode::~ShieldNode() = default;
void ShieldNode::SetColor(const std::vector<float>& vals) {
if (vals.size() != 3) {
throw Exception("Expected float array of length 3 for color");
throw Exception("Expected float array of length 3 for color",
PyExcType::kValue);
}
color_ = vals;
}
void ShieldNode::SetPosition(const std::vector<float>& vals) {
if (vals.size() != 3) {
throw Exception("Expected float array of length 3 for position");
throw Exception("Expected float array of length 3 for position",
PyExcType::kValue);
}
position_ = vals;
}

View File

@ -49,8 +49,10 @@ SoundNode::~SoundNode() {
}
void SoundNode::SetPosition(const std::vector<float>& vals) {
if (vals.size() != 3)
throw Exception("Expected float array of size 3 for position");
if (vals.size() != 3) {
throw Exception("Expected float array of size 3 for position",
PyExcType::kValue);
}
position_ = vals;
// We don't actually update here; we just mark our position as dirty

View File

@ -6072,20 +6072,26 @@ void SpazNode::SetMaterials(const std::vector<Material*>& vals) {
}
void SpazNode::SetNameColor(const std::vector<float>& vals) {
if (vals.size() != 3)
throw Exception("Expected float array of length 3 for name_color");
if (vals.size() != 3) {
throw Exception("Expected float array of length 3 for name_color",
PyExcType::kValue);
}
name_color_ = vals;
}
void SpazNode::set_highlight(const std::vector<float>& vals) {
if (vals.size() != 3)
throw Exception("Expected float array of length 3 for highlight");
if (vals.size() != 3) {
throw Exception("Expected float array of length 3 for highlight",
PyExcType::kValue);
}
highlight_ = vals;
}
void SpazNode::SetColor(const std::vector<float>& vals) {
if (vals.size() != 3)
throw Exception("Expected float array of length 3 for color");
if (vals.size() != 3) {
throw Exception("Expected float array of length 3 for color",
PyExcType::kValue);
}
color_ = vals;
// If this gets changed, make sure to change shadow-color in the constructor

View File

@ -146,8 +146,10 @@ void TerrainNode::SetCollideModel(CollideModel* val) {
void TerrainNode::SetColorTexture(Texture* val) { color_texture_ = val; }
void TerrainNode::SetReflectionScale(const std::vector<float>& vals) {
if (vals.size() != 1 && vals.size() != 3)
throw Exception("Expected float array of size 1 or 3 for reflection_scale");
if (vals.size() != 1 && vals.size() != 3) {
throw Exception("Expected float array of size 1 or 3 for reflection_scale",
PyExcType::kValue);
}
reflection_scale_ = vals;
if (reflection_scale_.size() == 1) {
reflection_scale_r_ = reflection_scale_g_ = reflection_scale_b_ =
@ -160,8 +162,10 @@ void TerrainNode::SetReflectionScale(const std::vector<float>& vals) {
}
void TerrainNode::SetColor(const std::vector<float>& vals) {
if (vals.size() != 1 && vals.size() != 3)
throw Exception("Expected float array of size 1 or 3 for color");
if (vals.size() != 1 && vals.size() != 3) {
throw Exception("Expected float array of size 1 or 3 for color",
PyExcType::kValue);
}
color_ = vals;
if (color_.size() == 1) {
color_r_ = color_g_ = color_b_ = color_[0];

View File

@ -251,7 +251,8 @@ void TextNode::SetVAttach(const std::string& val) {
void TextNode::SetColor(const std::vector<float>& vals) {
if (vals.size() != 3 && vals.size() != 4) {
throw Exception("Expected float array of size 3 or 4 for color");
throw Exception("Expected float array of size 3 or 4 for color",
PyExcType::kValue);
}
color_ = vals;
if (color_.size() == 3) {
@ -261,7 +262,8 @@ void TextNode::SetColor(const std::vector<float>& vals) {
void TextNode::SetTrailColor(const std::vector<float>& vals) {
if (vals.size() != 3) {
throw Exception("Expected float array of size 3 for trailcolor");
throw Exception("Expected float array of size 3 for trailcolor",
PyExcType::kValue);
}
trail_color_ = vals;
}
@ -269,7 +271,8 @@ void TextNode::SetTrailColor(const std::vector<float>& vals) {
void TextNode::SetPosition(const std::vector<float>& val) {
if (val.size() != 2 && val.size() != 3) {
throw Exception("Expected float array of length 2 or 3 for position; got "
+ std::to_string(val.size()));
+ std::to_string(val.size()),
PyExcType::kValue);
}
position_ = val;
position_final_dirty_ = true;