Geometry Nodes: add simulation support #104924

Closed
Hans Goudey wants to merge 211 commits from geometry-nodes-simulation into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
3 changed files with 12 additions and 8 deletions
Showing only changes of commit 2d4c449e5c - Show all commits

View File

@ -235,6 +235,7 @@ class ContainerValue : public Value {
class ArrayValue : public ContainerValue<Vector<std::shared_ptr<Value>>, eValueType::Array> {
public:
void append(std::shared_ptr<Value> value);
void append_bool(bool value);
void append_int(int value);
void append_double(double value);
void append_str(std::string value);

View File

@ -203,6 +203,11 @@ void ArrayValue::append(std::shared_ptr<Value> value)
this->elements().append(std::move(value));
}
void ArrayValue::append_bool(const bool value)
{
this->append(std::make_shared<BooleanValue>(value));
}
void ArrayValue::append_int(const int value)
{
this->append(std::make_shared<IntValue>(value));

View File

@ -78,12 +78,11 @@ TEST(serialize, array_to_json)
JsonFormatter json;
std::stringstream out;
ArrayValue value_array;
ArrayValue::Items &array = value_array.elements();
array.append_as(new IntValue(42));
array.append_as(new StringValue("Hello JSON"));
array.append_as(new NullValue);
array.append_as(new BooleanValue(false));
array.append_as(new BooleanValue(true));
value_array.append_int(42);
value_array.append_str("Hello JSON");
value_array.append_null();
value_array.append_bool(false);
value_array.append_bool(true);
json.serialize(out, value_array);
EXPECT_EQ(out.str(), "[42,\"Hello JSON\",null,false,true]");
@ -94,8 +93,7 @@ TEST(serialize, object_to_json)
JsonFormatter json;
std::stringstream out;
DictionaryValue value_object;
DictionaryValue::Items &attributes = value_object.elements();
attributes.append_as(std::pair(std::string("best_number"), new IntValue(42)));
value_object.append_int("best_number", 42);
json.serialize(out, value_object);
EXPECT_EQ(out.str(), "{\"best_number\":42}");