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.
4 changed files with 22 additions and 13 deletions
Showing only changes of commit d1914ba99d - Show all commits

View File

@ -1589,6 +1589,7 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations)
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_STRICT_PROTOTYPES -Wno-strict-prototypes)
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_BITWISE_INSTEAD_OF_LOGICAL -Wno-bitwise-instead-of-logical)
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_IMPLICIT_CONST_INT_FLOAT_CONVERSION -Wno-implicit-const-int-float-conversion)
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_PRIVATE_FIELD -Wno-unused-private-field)
@ -1603,6 +1604,7 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_INSTANTIATION_AFTER_SPECIALIZATION -Wno-instantiation-after-specialization)
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_MISLEADING_INDENTATION -Wno-misleading-indentation)
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_BITWISE_INSTEAD_OF_LOGICAL -Wno-bitwise-instead-of-logical)
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_IMPLICIT_CONST_INT_FLOAT_CONVERSION -Wno-implicit-const-int-float-conversion)
elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")

View File

@ -820,6 +820,8 @@ static bool vfont_to_curve(Object *ob,
char32_t ascii;
bool ok = false;
const float font_size = cu->fsize * iter_data->scale_to_fit;
/* Shift down vertically to be 25% below & 75% above baseline (before font scale is applied). */
const float font_select_y_offset = 0.25;
const bool word_wrap = iter_data->word_wrap;
const float xof_scale = safe_divide(cu->xof, font_size);
const float yof_scale = safe_divide(cu->yof, font_size);
@ -1122,7 +1124,7 @@ static bool vfont_to_curve(Object *ob,
if (selboxes && (i >= selstart) && (i <= selend)) {
sb = &selboxes[i - selstart];
sb->y = yof * font_size - linedist * font_size * 0.1f;
sb->y = (yof - font_select_y_offset) * font_size - linedist * font_size * 0.1f;
sb->h = linedist * font_size;
sb->w = xof * font_size;
}
@ -1454,8 +1456,15 @@ static bool vfont_to_curve(Object *ob,
ct = chartransdata;
for (i = 0; i <= selend; i++, ct++) {
if (i >= selstart) {
selboxes[i - selstart].x = ct->xof * font_size;
selboxes[i - selstart].y = (ct->yof - 0.25f) * font_size;
EditFontSelBox *sb = &selboxes[i - selstart];
sb->x = ct->xof;
sb->y = ct->yof;
if (ct->rot != 0.0f) {
sb->x -= sinf(ct->rot) * font_select_y_offset;
sb->y -= cosf(ct->rot) * font_select_y_offset;
}
sb->x *= font_size;
sb->y *= font_size;
selboxes[i - selstart].h = font_size;
}
}
@ -1551,7 +1560,7 @@ static bool vfont_to_curve(Object *ob,
if (ef->selend >= ef->selstart) {
/* Cursor at right edge of a text selection. Match rotation to the character at the
* end of selection. Cursor is further right to show the selected characters better. */
rotation = chartransdata[ef->selend - 1].rot;
rotation = chartransdata[max_ii(0, ef->selend - 1)].rot;
cursor_left = 0.0f;
}
else {
@ -1570,24 +1579,23 @@ static bool vfont_to_curve(Object *ob,
/* Bottom left. */
ef->textcurs[0][0] = cursor_left;
ef->textcurs[0][1] = 0.0f;
ef->textcurs[0][1] = 0.0f - font_select_y_offset;
/* Bottom right. */
ef->textcurs[1][0] = cursor_left + cursor_width;
ef->textcurs[1][1] = 0.0f;
ef->textcurs[1][1] = 0.0f - font_select_y_offset;
/* Top left. */
ef->textcurs[3][0] = cursor_left;
ef->textcurs[3][1] = 1.0f;
ef->textcurs[3][1] = 1.0f - font_select_y_offset;
/* Top right. */
ef->textcurs[2][0] = cursor_left + cursor_width;
ef->textcurs[2][1] = 1.0f;
ef->textcurs[2][1] = 1.0f - font_select_y_offset;
for (int vert = 0; vert < 4; vert++) {
float temp_fl[2];
/* Rotate around the cursor's bottom-left corner. */
rotate_v2_v2fl(temp_fl, &ef->textcurs[vert][0], -rotation);
ef->textcurs[vert][0] = font_size * (xoffset + temp_fl[0]);
/* Shift down vertically so we are 25% below and 75% above baseline. */
ef->textcurs[vert][1] = font_size * (yoffset + temp_fl[1] - 0.25f);
ef->textcurs[vert][1] = font_size * (yoffset + temp_fl[1]);
}
}

View File

@ -315,6 +315,6 @@ class JsonFormatter : public Formatter {
};
void write_json_file(StringRef path, const Value &value);
[[nodiscard]] std::shared_ptr<Value> read_json_file(StringRef path);
std::shared_ptr<Value> read_json_file(StringRef path);
} // namespace blender::io::serialize

View File

@ -657,8 +657,7 @@ struct AssetIndex {
AssetIndex(const FileIndexerEntries &indexer_entries)
{
std::unique_ptr<DictionaryValue> root = std::make_unique<DictionaryValue>();
DictionaryValue::Items &root_attributes = root->elements();
root_attributes.append_as(std::pair(ATTRIBUTE_VERSION, new IntValue(CURRENT_VERSION)));
root->append_int(ATTRIBUTE_VERSION, CURRENT_VERSION);
init_value_from_file_indexer_entries(*root, indexer_entries);
contents = std::move(root);