diff options
Diffstat (limited to 'source/blender')
144 files changed, 1156 insertions, 848 deletions
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index e4cf7d44f05..766ca78dc50 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -41,6 +41,8 @@ struct ModifierData; struct Object; struct Scene; struct bArmature; +struct BlendWriter; +struct BlendDataReader; typedef enum { /* Should not be used, only for None modifier type */ @@ -355,6 +357,21 @@ typedef struct ModifierTypeInfo { /* Register the panel types for the modifier's UI. */ void (*panelRegister)(struct ARegionType *region_type); + + /* Is called when the modifier is written to a file. The modifier data struct itself is written + * already. + * + * This method should write any additional arrays and referenced structs that should be + * stored in the file. + */ + void (*blendWrite)(struct BlendWriter *writer, const struct ModifierData *md); + + /* Is called when the modifier is read from a file. + * + * It can be used to update pointers to arrays and other structs. Furthermore, fields that have + * not been written (e.g. runtime data) can be reset. + */ + void (*blendRead)(struct BlendDataReader *reader, struct ModifierData *md); } ModifierTypeInfo; /* Used to find a modifier's panel type. */ diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index 144e091d971..6e4f2efeeb8 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -24,7 +24,6 @@ * \ingroup bke */ -#include "BLI_ghash.h" #include "BLI_utildefines.h" #include "DNA_object_enums.h" @@ -39,6 +38,7 @@ struct CurveMapping; struct Depsgraph; struct EnumPropertyItem; struct GHash; +struct GSet; struct GridPaintMask; struct ImagePool; struct MLoop; @@ -269,7 +269,7 @@ typedef struct SculptClothLengthConstraint { typedef struct SculptClothSimulation { SculptClothLengthConstraint *length_constraints; int tot_length_constraints; - GSet *created_length_constraints; + struct GSet *created_length_constraints; int capacity_length_constraints; float *length_constraint_tweak; diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c index 5ec4c84c013..7c0e4064cdb 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -54,7 +54,9 @@ #include "MEM_guardedalloc.h" -/****************************** Camera Datablock *****************************/ +/* -------------------------------------------------------------------- */ +/** \name Camera Data-Block + * \{ */ static void camera_init_data(ID *id) { @@ -128,7 +130,11 @@ IDTypeInfo IDType_ID_CA = { .foreach_id = camera_foreach_id, }; -/******************************** Camera Usage *******************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Camera Usage + * \{ */ void *BKE_camera_add(Main *bmain, const char *name) { @@ -188,7 +194,11 @@ int BKE_camera_sensor_fit(int sensor_fit, float sizex, float sizey) return sensor_fit; } -/******************************** Camera Params *******************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Camera Parameter Access + * \{ */ void BKE_camera_params_init(CameraParams *params) { @@ -380,7 +390,11 @@ void BKE_camera_params_compute_matrix(CameraParams *params) } } -/***************************** Camera View Frame *****************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Camera View Frame + * \{ */ void BKE_camera_view_frame_ex(const Scene *scene, const Camera *camera, @@ -482,6 +496,12 @@ void BKE_camera_view_frame(const Scene *scene, const Camera *camera, float r_vec scene, camera, 1.0, false, dummy_scale, dummy_asp, dummy_shift, &dummy_drawsize, r_vec); } +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Camera View Frame Fit to Points + * \{ */ + #define CAMERA_VIEWFRAME_NUM_PLANES 4 typedef struct CameraViewFrameData { @@ -723,7 +743,11 @@ bool BKE_camera_view_frame_fit_to_coords(const Depsgraph *depsgraph, return camera_frame_fit_calc_from_data(¶ms, &data_cb, r_co, r_scale); } -/******************* multiview matrix functions ***********************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Camera Multi-View Matrix + * \{ */ static void camera_model_matrix(const Object *camera, float r_modelmat[4][4]) { @@ -1038,6 +1062,12 @@ void BKE_camera_multiview_params(const RenderData *rd, } } +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Camera Background Image + * \{ */ + CameraBGImage *BKE_camera_background_image_new(Camera *cam) { CameraBGImage *bgpic = MEM_callocN(sizeof(CameraBGImage), "Background Image"); @@ -1072,3 +1102,5 @@ void BKE_camera_background_image_clear(Camera *cam) bgpic = next_bgpic; } } + +/** \} */ diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index a9d3c7c1b65..6f63da18a22 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -53,7 +53,9 @@ #include "MEM_guardedalloc.h" -/******************************** Prototypes ********************************/ +/* -------------------------------------------------------------------- */ +/** \name Prototypes + * \{ */ static bool collection_child_add(Collection *parent, Collection *collection, @@ -72,7 +74,11 @@ static CollectionParent *collection_find_parent(Collection *child, Collection *c static bool collection_find_child_recursive(Collection *parent, Collection *collection); -/****************************** Collection Datablock ************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Collection Data-Block + * \{ */ /** * Only copy internal data of Collection ID from source @@ -168,7 +174,11 @@ IDTypeInfo IDType_ID_GR = { .foreach_id = collection_foreach_id, }; -/***************************** Add Collection *******************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Add Collection + * \{ */ /* Add new collection, without view layer syncing. */ static Collection *collection_add(Main *bmain, @@ -238,7 +248,11 @@ void BKE_collection_add_from_object(Main *bmain, BKE_main_collection_sync(bmain); } -/*********************** Free and Delete Collection ****************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Free and Delete Collection + * \{ */ /** Free (or release) any data used by this collection (does not free the collection itself). */ void BKE_collection_free(Collection *collection) @@ -303,7 +317,12 @@ bool BKE_collection_delete(Main *bmain, Collection *collection, bool hierarchy) return true; } -/***************************** Collection Copy *******************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Collection Copy + * \{ */ + static Collection *collection_duplicate_recursive(Main *bmain, Collection *parent, Collection *collection_old, @@ -456,7 +475,11 @@ Collection *BKE_collection_duplicate(Main *bmain, return collection_new; } -/********************************* Naming *******************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Collection Naming + * \{ */ /** * The automatic/fallback name of a new collection. @@ -496,7 +519,11 @@ const char *BKE_collection_ui_name_get(struct Collection *collection) } } -/* **************** Object List Cache *******************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Object List Cache + * \{ */ static void collection_object_cache_fill(ListBase *lb, Collection *collection, int parent_restrict) { @@ -569,7 +596,11 @@ Base *BKE_collection_or_layer_objects(const ViewLayer *view_layer, Collection *c } } -/*********************** Scene Master Collection ***************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Scene Master Collection + * \{ */ Collection *BKE_collection_master_add() { @@ -594,7 +625,11 @@ Scene *BKE_collection_master_scene_search(const Main *bmain, const Collection *m return NULL; } -/*********************** Cyclic Checks ************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Cyclic Checks + * \{ */ static bool collection_object_cyclic_check_internal(Object *object, Collection *collection) { @@ -634,7 +669,11 @@ bool BKE_collection_object_cyclic_check(Main *bmain, Object *object, Collection return collection_object_cyclic_check_internal(object, collection); } -/******************* Collection Object Membership *******************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Collection Object Membership + * \{ */ bool BKE_collection_has_object(Collection *collection, const Object *ob) { @@ -695,7 +734,11 @@ bool BKE_collection_is_empty(Collection *collection) BLI_listbase_is_empty(&collection->children); } -/********************** Collection Objects *********************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Collection Objects + * \{ */ static void collection_tag_update_parent_recursive(Main *bmain, Collection *collection, @@ -1043,7 +1086,11 @@ void BKE_collection_object_move( } } -/***************** Collection Scene Membership ****************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Collection Scene Membership + * \{ */ bool BKE_collection_is_in_scene(Collection *collection) { @@ -1068,7 +1115,31 @@ void BKE_collections_after_lib_link(Main *bmain) BKE_main_collection_sync(bmain); } -/********************** Collection Children *******************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Collection Children + * \{ */ + +static bool collection_find_instance_recursive(Collection *collection, + Collection *instance_collection) +{ + LISTBASE_FOREACH (CollectionObject *, collection_object, &collection->gobject) { + if (collection_object->ob != NULL && + /* Object from a given collection should never instanciate that collection either. */ + ELEM(collection_object->ob->instance_collection, instance_collection, collection)) { + return true; + } + } + + LISTBASE_FOREACH (CollectionChild *, collection_child, &collection->children) { + if (collection_find_instance_recursive(collection_child->collection, instance_collection)) { + return true; + } + } + + return false; +} bool BKE_collection_find_cycle(Collection *new_ancestor, Collection *collection) { @@ -1082,7 +1153,9 @@ bool BKE_collection_find_cycle(Collection *new_ancestor, Collection *collection) } } - return false; + /* Find possible objects in collection or its children, that would instanciate the given ancestor + * collection (that would also make a fully invalid cycle of dependencies) .*/ + return collection_find_instance_recursive(collection, new_ancestor); } static CollectionChild *collection_find_child(Collection *parent, Collection *collection) @@ -1239,7 +1312,11 @@ void BKE_main_collections_parent_relations_rebuild(Main *bmain) /* Scene's master collections will be 'root' parent of most of our collections, so start with * them. */ for (Scene *scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) { - collection_parents_rebuild_recursive(scene->master_collection); + /* This function can be called from readfile.c, when this pointer is not guaranteed to be NULL. + */ + if (scene->master_collection != NULL) { + collection_parents_rebuild_recursive(scene->master_collection); + } } /* We may have parent chains outside of scene's master_collection context? At least, readfile's @@ -1255,7 +1332,11 @@ void BKE_main_collections_parent_relations_rebuild(Main *bmain) } } -/********************** Collection index *********************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Collection Index + * \{ */ static Collection *collection_from_index_recursive(Collection *collection, const int index, @@ -1341,7 +1422,11 @@ bool BKE_collection_objects_select(ViewLayer *view_layer, Collection *collection } } -/***************** Collection move (outliner drag & drop) *********************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Collection move (outliner drag & drop) + * \{ */ bool BKE_collection_move(Main *bmain, Collection *to_parent, @@ -1434,7 +1519,11 @@ bool BKE_collection_move(Main *bmain, return true; } -/**************************** Iterators ******************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Iterators + * \{ */ /* scene collection iteractor */ @@ -1620,3 +1709,5 @@ void BKE_scene_objects_iterator_end(BLI_Iterator *iter) MEM_freeN(data); } } + +/** \} */ diff --git a/source/blender/blenkernel/intern/lib_id.c b/source/blender/blenkernel/intern/lib_id.c index ca23ec90c97..ab9b11f436a 100644 --- a/source/blender/blenkernel/intern/lib_id.c +++ b/source/blender/blenkernel/intern/lib_id.c @@ -123,6 +123,16 @@ static void lib_id_library_local_paths(Main *bmain, Library *lib, ID *id) (void *)bpath_user_data); } +static int lib_id_clear_library_data_users_update_cb(LibraryIDLinkCallbackData *cb_data) +{ + ID *id = cb_data->user_data; + if (*cb_data->id_pointer == id) { + DEG_id_tag_update_ex(cb_data->bmain, cb_data->id_owner, ID_RECALC_TAG_FOR_UNDO); + return IDWALK_RET_STOP_ITER; + } + return IDWALK_RET_NOP; +} + /** * Pull an ID out of a library (make it local). Only call this for IDs that * don't have other library users. @@ -145,6 +155,21 @@ static void lib_id_clear_library_data_ex(Main *bmain, ID *id) } } + /* Conceptually, an ID made local is not the same as the linked one anymore. Reflect that by + * regenerating its session UUID. */ + BKE_lib_libblock_session_uuid_renew(id); + + /* We need to tag this IDs and all of its users, conceptually new local ID and original linked + * ones are two completely different data-blocks that were virtually remaped, even though in + * reality they remain the same data. For undo this info is critical now. */ + DEG_id_tag_update_ex(bmain, id, ID_RECALC_COPY_ON_WRITE); + ID *id_iter; + FOREACH_MAIN_ID_BEGIN (bmain, id_iter) { + BKE_library_foreach_ID_link( + bmain, id_iter, lib_id_clear_library_data_users_update_cb, id, IDWALK_READONLY); + } + FOREACH_MAIN_ID_END; + /* Internal shape key blocks inside data-blocks also stores id->lib, * make sure this stays in sync (note that we do not need any explicit handling for real EMBEDDED * IDs here, this is down automatically in `lib_id_expand_local_cb()`. */ @@ -1047,8 +1072,10 @@ void BKE_lib_libblock_session_uuid_ensure(ID *id) /** * Re-generate a new session-wise uuid for the given \a id. * - * \warning This has a very specific use-case (to handle UI-related data-blocks that are kept - * across new file reading, when we do keep existing UI). No other usage is expected currently. + * \warning This has a few very specific use-cases, no other usage is expected currently: + * - To handle UI-related data-blocks that are kept across new file reading, when we do keep + * existing UI. + * - For IDs that are made local without needing any copying. */ void BKE_lib_libblock_session_uuid_renew(ID *id) { diff --git a/source/blender/blenkernel/intern/seqmodifier.c b/source/blender/blenkernel/intern/seqmodifier.c index 80ad8561333..75f7ed82165 100644 --- a/source/blender/blenkernel/intern/seqmodifier.c +++ b/source/blender/blenkernel/intern/seqmodifier.c @@ -48,7 +48,9 @@ static SequenceModifierTypeInfo *modifiersTypes[NUM_SEQUENCE_MODIFIER_TYPES]; static bool modifierTypesInit = false; -/*********************** Modifiers *************************/ +/* -------------------------------------------------------------------- */ +/** \name Modifier Multi-Threading Utilities + * \{ */ typedef void (*modifier_apply_threaded_cb)(int width, int height, @@ -163,7 +165,11 @@ static void modifier_apply_threaded(ImBuf *ibuf, ibuf->y, sizeof(ModifierThread), &init_data, modifier_init_handle, modifier_do_thread); } -/* **** Color Balance Modifier **** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Color Balance Modifier + * \{ */ static void colorBalance_init_data(SequenceModifierData *smd) { @@ -196,7 +202,11 @@ static SequenceModifierTypeInfo seqModifier_ColorBalance = { colorBalance_apply, /* apply */ }; -/* **** White Balance Modifier **** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name White Balance Modifier + * \{ */ static void whiteBalance_init_data(SequenceModifierData *smd) { @@ -288,7 +298,11 @@ static SequenceModifierTypeInfo seqModifier_WhiteBalance = { whiteBalance_apply, /* apply */ }; -/* **** Curves Modifier **** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Curves Modifier + * \{ */ static void curves_init_data(SequenceModifierData *smd) { @@ -402,7 +416,11 @@ static SequenceModifierTypeInfo seqModifier_Curves = { curves_apply, /* apply */ }; -/* **** Hue Correct Modifier **** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Hue Correct Modifier + * \{ */ static void hue_correct_init_data(SequenceModifierData *smd) { @@ -522,7 +540,11 @@ static SequenceModifierTypeInfo seqModifier_HueCorrect = { hue_correct_apply, /* apply */ }; -/* **** Bright/Contrast Modifier **** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Bright/Contrast Modifier + * \{ */ typedef struct BrightContrastThreadData { float bright; @@ -625,7 +647,11 @@ static SequenceModifierTypeInfo seqModifier_BrightContrast = { brightcontrast_apply, /* apply */ }; -/* **** Mask Modifier **** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Mask Modifier + * \{ */ static void maskmodifier_apply_threaded(int width, int height, @@ -694,7 +720,11 @@ static SequenceModifierTypeInfo seqModifier_Mask = { maskmodifier_apply, /* apply */ }; -/* **** Tonemap Modifier **** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Tonemap Modifier + * \{ */ typedef struct AvgLogLum { SequencerTonemapModifierData *tmmd; @@ -906,7 +936,11 @@ static SequenceModifierTypeInfo seqModifier_Tonemap = { tonemapmodifier_apply, /* apply */ }; -/*********************** Modifier functions *************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Public Modifier Functions + * \{ */ static void sequence_modifier_type_info_init(void) { diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c index c59042bc045..29f4c7dc6c1 100644 --- a/source/blender/blenkernel/intern/shrinkwrap.c +++ b/source/blender/blenkernel/intern/shrinkwrap.c @@ -51,6 +51,7 @@ #include "BKE_editmesh.h" #include "BKE_mesh.h" /* for OMP limits. */ #include "BKE_mesh_runtime.h" +#include "BKE_mesh_wrapper.h" #include "BKE_subsurf.h" #include "DEG_depsgraph_query.h" @@ -115,7 +116,16 @@ bool BKE_shrinkwrap_init_tree( { memset(data, 0, sizeof(*data)); - if (!mesh || mesh->totvert <= 0) { + if (mesh == NULL) { + return false; + } + + /* We could create a BVH tree from the edit mesh, + * however accessing normals from the face/loop normals gets more involved. + * Convert mesh data since this isn't typically used in edit-mode. */ + BKE_mesh_wrapper_ensure_mdata(mesh); + + if (mesh->totvert <= 0) { return false; } diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 527b54a1aa2..bce2266f3e9 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -87,9 +87,9 @@ * be popped ... other st's retain their own top location. */ -/***/ - -/****************************** Prototypes ************************/ +/* -------------------------------------------------------------------- */ +/** \name Prototypes + * \{ */ static void txt_pop_first(Text *text); static void txt_pop_last(Text *text); @@ -97,7 +97,11 @@ static void txt_delete_line(Text *text, TextLine *line); static void txt_delete_sel(Text *text); static void txt_make_dirty(Text *text); -/****************************** Text Datablock ************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Text Data-Block + * \{ */ static void text_init_data(ID *id) { @@ -209,7 +213,11 @@ IDTypeInfo IDType_ID_TXT = { .foreach_id = NULL, }; -/***/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Text Add, Free, Validation + * \{ */ /** * \note caller must handle `compiled` member. @@ -549,9 +557,11 @@ void BKE_text_file_modified_ignore(Text *text) text->mtime = st.st_mtime; } -/*****************************/ -/* Editing utility functions */ -/*****************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Editing Utility Functions + * \{ */ static void make_new_line(TextLine *line, char *newline) { @@ -696,9 +706,11 @@ static void txt_make_dirty(Text *text) #endif } -/****************************/ -/* Cursor utility functions */ -/****************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Cursor Utility Functions + * \{ */ static void txt_curs_cur(Text *text, TextLine ***linep, int **charp) { @@ -722,9 +734,11 @@ bool txt_cursor_is_line_end(Text *text) return (text->selc == text->sell->len); } -/*****************************/ -/* Cursor movement functions */ -/*****************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Cursor Movement Functions + * \{ */ void txt_move_up(Text *text, const bool sel) { @@ -1095,9 +1109,11 @@ void txt_move_to(Text *text, unsigned int line, unsigned int ch, const bool sel) } } -/****************************/ -/* Text selection functions */ -/****************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Text Selection Functions + * \{ */ static void txt_curs_swap(Text *text) { @@ -1393,9 +1409,9 @@ void txt_from_buf_for_undo(Text *text, const char *buf, int buf_len) /** \} */ -/***************************/ -/* Cut and paste functions */ -/***************************/ +/* -------------------------------------------------------------------- */ +/** \name Cut and Paste Functions + * \{ */ char *txt_to_buf(Text *text, int *r_buf_strlen) { @@ -1474,59 +1490,6 @@ char *txt_to_buf(Text *text, int *r_buf_strlen) return buf; } -int txt_find_string(Text *text, const char *findstr, int wrap, int match_case) -{ - TextLine *tl, *startl; - const char *s = NULL; - - if (!text->curl || !text->sell) { - return 0; - } - - txt_order_cursors(text, false); - - tl = startl = text->sell; - - if (match_case) { - s = strstr(&tl->line[text->selc], findstr); - } - else { - s = BLI_strcasestr(&tl->line[text->selc], findstr); - } - while (!s) { - tl = tl->next; - if (!tl) { - if (wrap) { - tl = text->lines.first; - } - else { - break; - } - } - - if (match_case) { - s = strstr(tl->line, findstr); - } - else { - s = BLI_strcasestr(tl->line, findstr); - } - if (tl == startl) { - break; - } - } - - if (s) { - int newl = txt_get_span(text->lines.first, tl); - int newc = (int)(s - tl->line); - txt_move_to(text, newl, newc, 0); - txt_move_to(text, newl, newc + strlen(findstr), 1); - return 1; - } - else { - return 0; - } -} - char *txt_sel_to_buf(Text *text, int *r_buf_strlen) { char *buf; @@ -1670,9 +1633,70 @@ void txt_insert_buf(Text *text, const char *in_buffer) MEM_freeN(buffer); } -/**************************/ -/* Line editing functions */ -/**************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Find String in Text + * \{ */ + +int txt_find_string(Text *text, const char *findstr, int wrap, int match_case) +{ + TextLine *tl, *startl; + const char *s = NULL; + + if (!text->curl || !text->sell) { + return 0; + } + + txt_order_cursors(text, false); + + tl = startl = text->sell; + + if (match_case) { + s = strstr(&tl->line[text->selc], findstr); + } + else { + s = BLI_strcasestr(&tl->line[text->selc], findstr); + } + while (!s) { + tl = tl->next; + if (!tl) { + if (wrap) { + tl = text->lines.first; + } + else { + break; + } + } + + if (match_case) { + s = strstr(tl->line, findstr); + } + else { + s = BLI_strcasestr(tl->line, findstr); + } + if (tl == startl) { + break; + } + } + + if (s) { + int newl = txt_get_span(text->lines.first, tl); + int newc = (int)(s - tl->line); + txt_move_to(text, newl, newc, 0); + txt_move_to(text, newl, newc + strlen(findstr), 1); + return 1; + } + else { + return 0; + } +} + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Line Editing Functions + * \{ */ void txt_split_curline(Text *text) { @@ -2294,9 +2318,11 @@ int txt_setcurr_tab_spaces(Text *text, int space) return i; } -/*******************************/ -/* Character utility functions */ -/*******************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Character Queries + * \{ */ int text_check_bracket(const char ch) { @@ -2418,3 +2444,5 @@ int text_find_identifier_start(const char *str, int i) i++; return i; } + +/** \} */ diff --git a/source/blender/blenlib/BLI_vector.hh b/source/blender/blenlib/BLI_vector.hh index f61a3d4282b..25e3d2f969b 100644 --- a/source/blender/blenlib/BLI_vector.hh +++ b/source/blender/blenlib/BLI_vector.hh @@ -778,8 +778,6 @@ class Vector { if (UNLIKELY(m_end >= m_capacity_end)) { this->realloc_to_at_least(this->size() + 1); } - std::vector<int> a; - a.push_back(4); } BLI_NOINLINE void realloc_to_at_least(uint min_capacity) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 2bf4921f8df..d7c8dbabcea 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -5588,8 +5588,11 @@ static void direct_link_modifiers(BlendDataReader *reader, ListBase *lb, Object md = modifier_replace_with_fluid(reader->fd, ob, lb, md); is_allocated = true; } + + const ModifierTypeInfo *mti = BKE_modifier_get_info(md->type); + /* if modifiers disappear, or for upward compatibility */ - if (NULL == BKE_modifier_get_info(md->type)) { + if (mti == NULL) { md->type = eModifierType_None; } @@ -5837,12 +5840,6 @@ static void direct_link_modifiers(BlendDataReader *reader, ListBase *lb, Object direct_link_curvemapping(reader, wmd->cmap_curve); } } - else if (md->type == eModifierType_LaplacianDeform) { - LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)md; - - BLO_read_float3_array(reader, lmd->total_verts, &lmd->vertexco); - lmd->cache_system = NULL; - } else if (md->type == eModifierType_CorrectiveSmooth) { CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)md; @@ -5893,6 +5890,10 @@ static void direct_link_modifiers(BlendDataReader *reader, ListBase *lb, Object direct_link_curveprofile(reader, bmd->custom_profile); } } + + if (mti->blendRead != NULL) { + mti->blendRead(reader, md); + } } } @@ -6375,8 +6376,6 @@ static void lib_link_collection_data(FileData *fd, Library *lib, Collection *col for (CollectionChild *child = collection->children.first; child != NULL; child = child->next) { child->collection = newlibadr(fd, lib, child->collection); } - - BKE_collection_parent_relations_rebuild(collection); } static void lib_link_collection(FileData *fd, Main *UNUSED(bmain), Collection *collection) @@ -10132,18 +10131,9 @@ static void lib_link_all(FileData *fd, Main *bmain) * so simpler to just use it directly in this single call. */ BLO_main_validate_shapekeys(bmain, NULL); - if (fd->memfile != NULL) { - /* When doing redo, we perform a tremendous amount of esoteric magic tricks to avoid having to - * re-read all library data-blocks. - * Unfortunately, that means that we do not clear Collections' parents lists, which then get - * improperly extended in some cases by lib_link_scene() and lib_link_collection() calls above - * (when one local collection is parent of linked ones). - * I do not really see a way to address that issue, besides brute force call below which - * invalidates and re-creates all parenting relationships between collections. Yet another - * example of why it is such a bad idea to keep that kind of double-linked relationships info - * 'permanently' in our data structures... */ - BKE_main_collections_parent_relations_rebuild(bmain); - } + /* We have to rebuild that runtime information *after* all data-blocks have been properly linked. + */ + BKE_main_collections_parent_relations_rebuild(bmain); #ifndef NDEBUG /* Double check we do not have any 'need link' tag remaining, this should never be the case once diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index c6257738cf7..e24ce5f3a77 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -1797,11 +1797,6 @@ static void write_modifiers(BlendWriter *writer, ListBase *modbase) write_curvemapping(writer, wmd->cmap_curve); } } - else if (md->type == eModifierType_LaplacianDeform) { - LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)md; - - BLO_write_float3_array(writer, lmd->total_verts, lmd->vertexco); - } else if (md->type == eModifierType_CorrectiveSmooth) { CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)md; @@ -1842,6 +1837,10 @@ static void write_modifiers(BlendWriter *writer, ListBase *modbase) write_CurveProfile(writer, bmd->custom_profile); } } + + if (mti->blendWrite != NULL) { + mti->blendWrite(writer, md); + } } } diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc index 0ee86088e43..b757a4fc477 100644 --- a/source/blender/depsgraph/intern/depsgraph_tag.cc +++ b/source/blender/depsgraph/intern/depsgraph_tag.cc @@ -237,6 +237,8 @@ void depsgraph_tag_to_component_opcode(const ID *id, case ID_RECALC_PSYS_ALL: BLI_assert(!"Should not happen"); break; + case ID_RECALC_TAG_FOR_UNDO: + break; /* Must be ignored by depsgraph. */ } } @@ -737,6 +739,8 @@ const char *DEG_update_tag_as_string(IDRecalcFlag flag) return "SOURCE"; case ID_RECALC_ALL: return "ALL"; + case ID_RECALC_TAG_FOR_UNDO: + return "TAG_FOR_UNDO"; } return nullptr; } diff --git a/source/blender/draw/engines/overlay/overlay_armature.c b/source/blender/draw/engines/overlay/overlay_armature.c index 95fd918f8c1..481dec340ba 100644 --- a/source/blender/draw/engines/overlay/overlay_armature.c +++ b/source/blender/draw/engines/overlay/overlay_armature.c @@ -510,7 +510,7 @@ static void drw_shgroup_bone_envelope(ArmatureDrawContext *ctx, /* Custom (geometry) */ extern void drw_batch_cache_validate(Object *custom); -extern void drw_batch_cache_generate_requested(Object *custom); +extern void drw_batch_cache_generate_requested_delayed(Object *custom); BLI_INLINE DRWCallBuffer *custom_bone_instance_shgroup(ArmatureDrawContext *ctx, DRWShadingGroup *grp, @@ -567,7 +567,7 @@ static void drw_shgroup_bone_custom_solid(ArmatureDrawContext *ctx, } /* TODO(fclem) needs to be moved elsewhere. */ - drw_batch_cache_generate_requested(custom); + drw_batch_cache_generate_requested_delayed(custom); } static void drw_shgroup_bone_custom_wire(ArmatureDrawContext *ctx, @@ -591,7 +591,7 @@ static void drw_shgroup_bone_custom_wire(ArmatureDrawContext *ctx, } /* TODO(fclem) needs to be moved elsewhere. */ - drw_batch_cache_generate_requested(custom); + drw_batch_cache_generate_requested_delayed(custom); } static void drw_shgroup_bone_custom_empty(ArmatureDrawContext *ctx, diff --git a/source/blender/draw/engines/overlay/shaders/edit_curve_handle_geom.glsl b/source/blender/draw/engines/overlay/shaders/edit_curve_handle_geom.glsl index 306fbb473ee..a400aadb052 100644 --- a/source/blender/draw/engines/overlay/shaders/edit_curve_handle_geom.glsl +++ b/source/blender/draw/engines/overlay/shaders/edit_curve_handle_geom.glsl @@ -52,7 +52,7 @@ void main() bool edge_selected = (((vertFlag[1] | vertFlag[0]) & VERT_SELECTED) != 0); bool handle_selected = (showCurveHandles && - (((vertFlag[1] | vertFlag[0]) & HANDLE_SELECTED) != 0)); + (((vertFlag[1] | vertFlag[0]) & VERT_SELECTED_BEZT_HANDLE) != 0)); /* If handle type is only selected and the edge is not selected, don't show. */ if ((curveHandleDisplay != CURVE_HANDLE_ALL) && (!handle_selected)) { diff --git a/source/blender/draw/engines/overlay/shaders/edit_curve_point_vert.glsl b/source/blender/draw/engines/overlay/shaders/edit_curve_point_vert.glsl index b1e1c0879a5..a811fcca0d4 100644 --- a/source/blender/draw/engines/overlay/shaders/edit_curve_point_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/edit_curve_point_vert.glsl @@ -37,7 +37,7 @@ void main() #endif bool show_handle = showCurveHandles; - if ((curveHandleDisplay == CURVE_HANDLE_SELECTED) && ((data & HANDLE_SELECTED) == 0)) { + if ((curveHandleDisplay == CURVE_HANDLE_SELECTED) && ((data & VERT_SELECTED_BEZT_HANDLE) == 0)) { show_handle = false; } diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c index c23ea3d7c82..af5b9cd05dd 100644 --- a/source/blender/draw/intern/draw_cache.c +++ b/source/blender/draw/intern/draw_cache.c @@ -3552,6 +3552,11 @@ void drw_batch_cache_generate_requested(Object *ob) } } +void drw_batch_cache_generate_requested_delayed(Object *ob) +{ + BLI_gset_add(DST.delayed_extraction, ob); +} + void DRW_batch_cache_free_old(Object *ob, int ctime) { struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); diff --git a/source/blender/draw/intern/draw_cache_extract_mesh.c b/source/blender/draw/intern/draw_cache_extract_mesh.c index 06462d5b9c5..f3dc8f0fd2a 100644 --- a/source/blender/draw/intern/draw_cache_extract_mesh.c +++ b/source/blender/draw/intern/draw_cache_extract_mesh.c @@ -134,6 +134,183 @@ typedef struct MeshRenderData { float (*poly_normals)[3]; int *lverts, *ledges; } MeshRenderData; + +static void mesh_render_data_update_loose_geom(MeshRenderData *mr, + const eMRIterType iter_type, + const eMRDataType UNUSED(data_flag)) +{ + if (mr->extract_type != MR_EXTRACT_BMESH) { + /* Mesh */ + if (iter_type & (MR_ITER_LEDGE | MR_ITER_LVERT)) { + mr->vert_loose_len = 0; + mr->edge_loose_len = 0; + + BLI_bitmap *lvert_map = BLI_BITMAP_NEW(mr->vert_len, "lvert map"); + + mr->ledges = MEM_mallocN(mr->edge_len * sizeof(int), __func__); + const MEdge *medge = mr->medge; + for (int e = 0; e < mr->edge_len; e++, medge++) { + if (medge->flag & ME_LOOSEEDGE) { + mr->ledges[mr->edge_loose_len++] = e; + } + /* Tag verts as not loose. */ + BLI_BITMAP_ENABLE(lvert_map, medge->v1); + BLI_BITMAP_ENABLE(lvert_map, medge->v2); + } + if (mr->edge_loose_len < mr->edge_len) { + mr->ledges = MEM_reallocN(mr->ledges, mr->edge_loose_len * sizeof(*mr->ledges)); + } + + mr->lverts = MEM_mallocN(mr->vert_len * sizeof(*mr->lverts), __func__); + for (int v = 0; v < mr->vert_len; v++) { + if (!BLI_BITMAP_TEST(lvert_map, v)) { + mr->lverts[mr->vert_loose_len++] = v; + } + } + if (mr->vert_loose_len < mr->vert_len) { + mr->lverts = MEM_reallocN(mr->lverts, mr->vert_loose_len * sizeof(*mr->lverts)); + } + + MEM_freeN(lvert_map); + + mr->loop_loose_len = mr->vert_loose_len + mr->edge_loose_len * 2; + } + } + else { + /* BMesh */ + BMesh *bm = mr->bm; + if (iter_type & (MR_ITER_LEDGE | MR_ITER_LVERT)) { + int elem_id; + BMIter iter; + BMVert *eve; + BMEdge *ede; + mr->vert_loose_len = 0; + mr->edge_loose_len = 0; + + mr->lverts = MEM_mallocN(mr->vert_len * sizeof(*mr->lverts), __func__); + BM_ITER_MESH_INDEX (eve, &iter, bm, BM_VERTS_OF_MESH, elem_id) { + if (eve->e == NULL) { + mr->lverts[mr->vert_loose_len++] = elem_id; + } + } + if (mr->vert_loose_len < mr->vert_len) { + mr->lverts = MEM_reallocN(mr->lverts, mr->vert_loose_len * sizeof(*mr->lverts)); + } + + mr->ledges = MEM_mallocN(mr->edge_len * sizeof(*mr->ledges), __func__); + BM_ITER_MESH_INDEX (ede, &iter, bm, BM_EDGES_OF_MESH, elem_id) { + if (ede->l == NULL) { + mr->ledges[mr->edge_loose_len++] = elem_id; + } + } + if (mr->edge_loose_len < mr->edge_len) { + mr->ledges = MEM_reallocN(mr->ledges, mr->edge_loose_len * sizeof(*mr->ledges)); + } + + mr->loop_loose_len = mr->vert_loose_len + mr->edge_loose_len * 2; + } + } +} + +/* Part of the creation of the MeshRenderData that happens in a thread. */ +static void mesh_render_data_update_looptris(MeshRenderData *mr, + const eMRIterType iter_type, + const eMRDataType data_flag) +{ + Mesh *me = mr->me; + if (mr->extract_type != MR_EXTRACT_BMESH) { + /* Mesh */ + if ((iter_type & MR_ITER_LOOPTRI) || (data_flag & MR_DATA_LOOPTRI)) { + mr->mlooptri = MEM_mallocN(sizeof(*mr->mlooptri) * mr->tri_len, "MR_DATATYPE_LOOPTRI"); + BKE_mesh_recalc_looptri( + me->mloop, me->mpoly, me->mvert, me->totloop, me->totpoly, mr->mlooptri); + } + } + else { + /* BMesh */ + if ((iter_type & MR_ITER_LOOPTRI) || (data_flag & MR_DATA_LOOPTRI)) { + /* Edit mode ensures this is valid, no need to calculate. */ + BLI_assert((mr->bm->totloop == 0) || (mr->edit_bmesh->looptris != NULL)); + } + } +} + +static void mesh_render_data_update_normals(MeshRenderData *mr, + const eMRIterType UNUSED(iter_type), + const eMRDataType data_flag) +{ + Mesh *me = mr->me; + const bool is_auto_smooth = (me->flag & ME_AUTOSMOOTH) != 0; + const float split_angle = is_auto_smooth ? me->smoothresh : (float)M_PI; + + if (mr->extract_type != MR_EXTRACT_BMESH) { + /* Mesh */ + if (data_flag & (MR_DATA_POLY_NOR | MR_DATA_LOOP_NOR | MR_DATA_TAN_LOOP_NOR)) { + mr->poly_normals = MEM_mallocN(sizeof(*mr->poly_normals) * mr->poly_len, __func__); + BKE_mesh_calc_normals_poly((MVert *)mr->mvert, + NULL, + mr->vert_len, + mr->mloop, + mr->mpoly, + mr->loop_len, + mr->poly_len, + mr->poly_normals, + true); + } + if (((data_flag & MR_DATA_LOOP_NOR) && is_auto_smooth) || (data_flag & MR_DATA_TAN_LOOP_NOR)) { + mr->loop_normals = MEM_mallocN(sizeof(*mr->loop_normals) * mr->loop_len, __func__); + short(*clnors)[2] = CustomData_get_layer(&mr->me->ldata, CD_CUSTOMLOOPNORMAL); + BKE_mesh_normals_loop_split(mr->me->mvert, + mr->vert_len, + mr->me->medge, + mr->edge_len, + mr->me->mloop, + mr->loop_normals, + mr->loop_len, + mr->me->mpoly, + mr->poly_normals, + mr->poly_len, + is_auto_smooth, + split_angle, + NULL, + clnors, + NULL); + } + } + else { + /* BMesh */ + if (data_flag & MR_DATA_POLY_NOR) { + /* Use bmface->no instead. */ + } + if (((data_flag & MR_DATA_LOOP_NOR) && is_auto_smooth) || (data_flag & MR_DATA_TAN_LOOP_NOR)) { + + const float(*vert_coords)[3] = NULL; + const float(*vert_normals)[3] = NULL; + const float(*poly_normals)[3] = NULL; + + if (mr->edit_data && mr->edit_data->vertexCos) { + vert_coords = mr->bm_vert_coords; + vert_normals = mr->bm_vert_normals; + poly_normals = mr->bm_poly_normals; + } + + mr->loop_normals = MEM_mallocN(sizeof(*mr->loop_normals) * mr->loop_len, __func__); + int clnors_offset = CustomData_get_offset(&mr->bm->ldata, CD_CUSTOMLOOPNORMAL); + BM_loops_calc_normal_vcos(mr->bm, + vert_coords, + vert_normals, + poly_normals, + is_auto_smooth, + split_angle, + mr->loop_normals, + NULL, + NULL, + clnors_offset, + false); + } + } +} + static MeshRenderData *mesh_render_data_create(Mesh *me, const bool is_editmode, const bool is_paint_mode, @@ -141,7 +318,9 @@ static MeshRenderData *mesh_render_data_create(Mesh *me, const bool do_final, const bool do_uvedit, const DRW_MeshCDMask *UNUSED(cd_used), - const ToolSettings *ts) + const ToolSettings *ts, + const eMRIterType iter_type, + const eMRDataType data_flag) { MeshRenderData *mr = MEM_callocN(sizeof(*mr), __func__); mr->toolsettings = ts; @@ -249,165 +428,11 @@ static MeshRenderData *mesh_render_data_create(Mesh *me, mr->poly_len = bm->totface; mr->tri_len = poly_to_tri_count(mr->poly_len, mr->loop_len); } + mesh_render_data_update_loose_geom(mr, iter_type, data_flag); return mr; } -/* Part of the creation of the MeshRenderData that happens in a thread. */ -static void mesh_render_data_update(MeshRenderData *mr, - const eMRIterType iter_type, - const eMRDataType data_flag) -{ - Mesh *me = mr->me; - const bool is_auto_smooth = (me->flag & ME_AUTOSMOOTH) != 0; - const float split_angle = is_auto_smooth ? me->smoothresh : (float)M_PI; - - if (mr->extract_type != MR_EXTRACT_BMESH) { - /* Mesh */ - if (data_flag & (MR_DATA_POLY_NOR | MR_DATA_LOOP_NOR | MR_DATA_TAN_LOOP_NOR)) { - mr->poly_normals = MEM_mallocN(sizeof(*mr->poly_normals) * mr->poly_len, __func__); - BKE_mesh_calc_normals_poly((MVert *)mr->mvert, - NULL, - mr->vert_len, - mr->mloop, - mr->mpoly, - mr->loop_len, - mr->poly_len, - mr->poly_normals, - true); - } - if (((data_flag & MR_DATA_LOOP_NOR) && is_auto_smooth) || (data_flag & MR_DATA_TAN_LOOP_NOR)) { - mr->loop_normals = MEM_mallocN(sizeof(*mr->loop_normals) * mr->loop_len, __func__); - short(*clnors)[2] = CustomData_get_layer(&mr->me->ldata, CD_CUSTOMLOOPNORMAL); - BKE_mesh_normals_loop_split(mr->me->mvert, - mr->vert_len, - mr->me->medge, - mr->edge_len, - mr->me->mloop, - mr->loop_normals, - mr->loop_len, - mr->me->mpoly, - mr->poly_normals, - mr->poly_len, - is_auto_smooth, - split_angle, - NULL, - clnors, - NULL); - } - if ((iter_type & MR_ITER_LOOPTRI) || (data_flag & MR_DATA_LOOPTRI)) { - mr->mlooptri = MEM_mallocN(sizeof(*mr->mlooptri) * mr->tri_len, "MR_DATATYPE_LOOPTRI"); - BKE_mesh_recalc_looptri(mr->me->mloop, - mr->me->mpoly, - mr->me->mvert, - mr->me->totloop, - mr->me->totpoly, - mr->mlooptri); - } - if (iter_type & (MR_ITER_LEDGE | MR_ITER_LVERT)) { - mr->vert_loose_len = 0; - mr->edge_loose_len = 0; - - BLI_bitmap *lvert_map = BLI_BITMAP_NEW(mr->vert_len, "lvert map"); - - mr->ledges = MEM_mallocN(mr->edge_len * sizeof(int), __func__); - const MEdge *medge = mr->medge; - for (int e = 0; e < mr->edge_len; e++, medge++) { - if (medge->flag & ME_LOOSEEDGE) { - mr->ledges[mr->edge_loose_len++] = e; - } - /* Tag verts as not loose. */ - BLI_BITMAP_ENABLE(lvert_map, medge->v1); - BLI_BITMAP_ENABLE(lvert_map, medge->v2); - } - if (mr->edge_loose_len < mr->edge_len) { - mr->ledges = MEM_reallocN(mr->ledges, mr->edge_loose_len * sizeof(*mr->ledges)); - } - - mr->lverts = MEM_mallocN(mr->vert_len * sizeof(*mr->lverts), __func__); - for (int v = 0; v < mr->vert_len; v++) { - if (!BLI_BITMAP_TEST(lvert_map, v)) { - mr->lverts[mr->vert_loose_len++] = v; - } - } - if (mr->vert_loose_len < mr->vert_len) { - mr->lverts = MEM_reallocN(mr->lverts, mr->vert_loose_len * sizeof(*mr->lverts)); - } - - MEM_freeN(lvert_map); - - mr->loop_loose_len = mr->vert_loose_len + mr->edge_loose_len * 2; - } - } - else { - /* BMesh */ - BMesh *bm = mr->bm; - if (data_flag & MR_DATA_POLY_NOR) { - /* Use bmface->no instead. */ - } - if (((data_flag & MR_DATA_LOOP_NOR) && is_auto_smooth) || (data_flag & MR_DATA_TAN_LOOP_NOR)) { - - const float(*vert_coords)[3] = NULL; - const float(*vert_normals)[3] = NULL; - const float(*poly_normals)[3] = NULL; - - if (mr->edit_data && mr->edit_data->vertexCos) { - vert_coords = mr->bm_vert_coords; - vert_normals = mr->bm_vert_normals; - poly_normals = mr->bm_poly_normals; - } - - mr->loop_normals = MEM_mallocN(sizeof(*mr->loop_normals) * mr->loop_len, __func__); - int clnors_offset = CustomData_get_offset(&mr->bm->ldata, CD_CUSTOMLOOPNORMAL); - BM_loops_calc_normal_vcos(mr->bm, - vert_coords, - vert_normals, - poly_normals, - is_auto_smooth, - split_angle, - mr->loop_normals, - NULL, - NULL, - clnors_offset, - false); - } - if ((iter_type & MR_ITER_LOOPTRI) || (data_flag & MR_DATA_LOOPTRI)) { - /* Edit mode ensures this is valid, no need to calculate. */ - BLI_assert((bm->totloop == 0) || (mr->edit_bmesh->looptris != NULL)); - } - if (iter_type & (MR_ITER_LEDGE | MR_ITER_LVERT)) { - int elem_id; - BMIter iter; - BMVert *eve; - BMEdge *ede; - mr->vert_loose_len = 0; - mr->edge_loose_len = 0; - - mr->lverts = MEM_mallocN(mr->vert_len * sizeof(*mr->lverts), __func__); - BM_ITER_MESH_INDEX (eve, &iter, bm, BM_VERTS_OF_MESH, elem_id) { - if (eve->e == NULL) { - mr->lverts[mr->vert_loose_len++] = elem_id; - } - } - if (mr->vert_loose_len < mr->vert_len) { - mr->lverts = MEM_reallocN(mr->lverts, mr->vert_loose_len * sizeof(*mr->lverts)); - } - - mr->ledges = MEM_mallocN(mr->edge_len * sizeof(*mr->ledges), __func__); - BM_ITER_MESH_INDEX (ede, &iter, bm, BM_EDGES_OF_MESH, elem_id) { - if (ede->l == NULL) { - mr->ledges[mr->edge_loose_len++] = elem_id; - } - } - if (mr->edge_loose_len < mr->edge_len) { - mr->ledges = MEM_reallocN(mr->ledges, mr->edge_loose_len * sizeof(*mr->ledges)); - } - - mr->loop_loose_len = mr->vert_loose_len + mr->edge_loose_len * 2; - } - } -} - static void mesh_render_data_free(MeshRenderData *mr) { MEM_SAFE_FREE(mr->mlooptri); @@ -4533,10 +4558,16 @@ typedef struct ExtractUserData { void *user_data; } ExtractUserData; +typedef enum ExtractTaskDataType { + EXTRACT_MESH_EXTRACT, + EXTRACT_LINES_LOOSE, +} ExtractTaskDataType; + typedef struct ExtractTaskData { void *next, *prev; const MeshRenderData *mr; const MeshExtract *extract; + ExtractTaskDataType tasktype; eMRIterType iter_type; int start, end; /** Decremented each time a task is finished. */ @@ -4545,6 +4576,41 @@ typedef struct ExtractTaskData { ExtractUserData *user_data; } ExtractTaskData; +static ExtractTaskData *extract_task_data_create_mesh_extract(const MeshRenderData *mr, + const MeshExtract *extract, + void *buf, + int32_t *task_counter) +{ + ExtractTaskData *taskdata = MEM_mallocN(sizeof(*taskdata), __func__); + taskdata->next = NULL; + taskdata->prev = NULL; + taskdata->tasktype = EXTRACT_MESH_EXTRACT; + taskdata->mr = mr; + taskdata->extract = extract; + taskdata->buf = buf; + + /* ExtractUserData is shared between the iterations as it holds counters to detect if the + * extraction is finished. To make sure the duplication of the userdata does not create a new + * instance of the counters we allocate the userdata in its own container. + * + * This structure makes sure that when extract_init is called, that the user data of all + * iterations are updated. */ + taskdata->user_data = MEM_callocN(sizeof(ExtractUserData), __func__); + taskdata->iter_type = mesh_extract_iter_type(extract); + taskdata->task_counter = task_counter; + taskdata->start = 0; + taskdata->end = INT_MAX; + return taskdata; +} + +static ExtractTaskData *extract_task_data_create_lines_loose(const MeshRenderData *mr) +{ + ExtractTaskData *taskdata = MEM_callocN(sizeof(*taskdata), __func__); + taskdata->tasktype = EXTRACT_LINES_LOOSE; + taskdata->mr = mr; + return taskdata; +} + static void extract_task_data_free(void *data) { ExtractTaskData *task_data = data; @@ -4630,23 +4696,30 @@ BLI_INLINE void mesh_extract_iter(const MeshRenderData *mr, static void extract_init(ExtractTaskData *data) { - data->user_data->user_data = data->extract->init(data->mr, data->buf); + if (data->tasktype == EXTRACT_MESH_EXTRACT) { + data->user_data->user_data = data->extract->init(data->mr, data->buf); + } } static void extract_run(void *__restrict taskdata) { ExtractTaskData *data = (ExtractTaskData *)taskdata; - mesh_extract_iter(data->mr, - data->iter_type, - data->start, - data->end, - data->extract, - data->user_data->user_data); - - /* If this is the last task, we do the finish function. */ - int remainin_tasks = atomic_sub_and_fetch_int32(data->task_counter, 1); - if (remainin_tasks == 0 && data->extract->finish != NULL) { - data->extract->finish(data->mr, data->buf, data->user_data->user_data); + if (data->tasktype == EXTRACT_MESH_EXTRACT) { + mesh_extract_iter(data->mr, + data->iter_type, + data->start, + data->end, + data->extract, + data->user_data->user_data); + + /* If this is the last task, we do the finish function. */ + int remainin_tasks = atomic_sub_and_fetch_int32(data->task_counter, 1); + if (remainin_tasks == 0 && data->extract->finish != NULL) { + data->extract->finish(data->mr, data->buf, data->user_data->user_data); + } + } + else if (data->tasktype == EXTRACT_LINES_LOOSE) { + extract_lines_loose_subbuffer(data->mr); } } @@ -4670,15 +4743,20 @@ typedef struct MeshRenderDataUpdateTaskData { static void mesh_render_data_update_task_data_free(MeshRenderDataUpdateTaskData *taskdata) { BLI_assert(taskdata); - mesh_render_data_free(taskdata->mr); + MeshRenderData *mr = taskdata->mr; + mesh_render_data_free(mr); MEM_freeN(taskdata); } static void mesh_extract_render_data_node_exec(void *__restrict task_data) { MeshRenderDataUpdateTaskData *update_task_data = task_data; - mesh_render_data_update( - update_task_data->mr, update_task_data->iter_type, update_task_data->data_flag); + MeshRenderData *mr = update_task_data->mr; + const eMRIterType iter_type = update_task_data->iter_type; + const eMRDataType data_flag = update_task_data->data_flag; + + mesh_render_data_update_normals(mr, iter_type, data_flag); + mesh_render_data_update_looptris(mr, iter_type, data_flag); } static struct TaskNode *mesh_extract_render_data_node_create(struct TaskGraph *task_graph, @@ -4822,24 +4900,8 @@ static void extract_task_create(struct TaskGraph *task_graph, } /* Divide extraction of the VBO/IBO into sensible chunks of works. */ - ExtractTaskData *taskdata = MEM_mallocN(sizeof(*taskdata), "ExtractTaskData"); - taskdata->next = NULL; - taskdata->prev = NULL; - taskdata->mr = mr; - taskdata->extract = extract; - taskdata->buf = buf; - - /* ExtractUserData is shared between the iterations as it holds counters to detect if the - * extraction is finished. To make sure the duplication of the userdata does not create a new - * instance of the counters we allocate the userdata in its own container. - * - * This structure makes sure that when extract_init is called, that the user data of all - * iterations are updated. */ - taskdata->user_data = MEM_callocN(sizeof(ExtractUserData), __func__); - taskdata->iter_type = mesh_extract_iter_type(extract); - taskdata->task_counter = task_counter; - taskdata->start = 0; - taskdata->end = INT_MAX; + ExtractTaskData *taskdata = extract_task_data_create_mesh_extract( + mr, extract, buf, task_counter); /* Simple heuristic. */ const int chunk_size = 8192; @@ -4980,14 +5042,26 @@ void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph, TEST_ASSIGN(IBO, ibo, edituv_points); TEST_ASSIGN(IBO, ibo, edituv_fdots); + if (do_lines_loose_subbuffer) { + iter_flag |= MR_ITER_LEDGE; + } + #undef TEST_ASSIGN #ifdef DEBUG_TIME double rdata_start = PIL_check_seconds_timer(); #endif - MeshRenderData *mr = mesh_render_data_create( - me, is_editmode, is_paint_mode, obmat, do_final, do_uvedit, cd_layer_used, ts); + MeshRenderData *mr = mesh_render_data_create(me, + is_editmode, + is_paint_mode, + obmat, + do_final, + do_uvedit, + cd_layer_used, + ts, + iter_flag, + data_flag); mr->cache = cache; /* HACK */ mr->use_hide = use_hide; mr->use_subsurf_fdots = use_subsurf_fdots; @@ -5069,12 +5143,8 @@ void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph, } else { if (do_lines_loose_subbuffer) { - /* When `lines_loose` is requested without `lines` we can create the sub-buffer on the fly as - * the `lines` buffer should then already be up-to-date. - * (see `DRW_batch_requested(cache->batch.loose_edges, GPU_PRIM_LINES)` in - * `DRW_mesh_batch_cache_create_requested`). - */ - extract_lines_loose_subbuffer(mr); + ExtractTaskData *taskdata = extract_task_data_create_lines_loose(mr); + BLI_addtail(&single_threaded_task_data->task_datas, taskdata); } } EXTRACT(ibo, points); diff --git a/source/blender/draw/intern/draw_cache_impl.h b/source/blender/draw/intern/draw_cache_impl.h index 80649143537..191d75342d0 100644 --- a/source/blender/draw/intern/draw_cache_impl.h +++ b/source/blender/draw/intern/draw_cache_impl.h @@ -201,18 +201,19 @@ struct GPUBatch *DRW_mesh_batch_cache_get_edit_mesh_analysis(struct Mesh *me); int DRW_mesh_material_count_get(struct Mesh *me); +/* See 'common_globals_lib.glsl' for duplicate defines. */ + /* Edit mesh bitflags (is this the right place?) */ enum { VFLAG_VERT_ACTIVE = 1 << 0, VFLAG_VERT_SELECTED = 1 << 1, - VFLAG_EDGE_ACTIVE = 1 << 2, - VFLAG_EDGE_SELECTED = 1 << 3, - VFLAG_EDGE_SEAM = 1 << 4, - VFLAG_EDGE_SHARP = 1 << 5, - VFLAG_EDGE_FREESTYLE = 1 << 6, - VFLAG_HANDLE_SELECTED = 1 << 7, - /* Beware to not go over 1 << 7 (it's a byte flag) - * (see gpu_shader_edit_mesh_overlay_geom.glsl) */ + VFLAG_VERT_SELECTED_BEZT_HANDLE = 1 << 2, + VFLAG_EDGE_ACTIVE = 1 << 3, + VFLAG_EDGE_SELECTED = 1 << 4, + VFLAG_EDGE_SEAM = 1 << 5, + VFLAG_EDGE_SHARP = 1 << 6, + VFLAG_EDGE_FREESTYLE = 1 << 7, + /* Beware to not go over 1 << 7 (it's a byte flag). */ }; enum { @@ -224,8 +225,7 @@ enum { VFLAG_EDGE_UV_SELECT = 1 << 5, VFLAG_FACE_UV_ACTIVE = 1 << 6, VFLAG_FACE_UV_SELECT = 1 << 7, - /* Beware to not go over 1 << 7 (it's a byte flag) - * (see gpu_shader_edit_mesh_overlay_geom.glsl) */ + /* Beware to not go over 1 << 7 (it's a byte flag). */ }; /* Particles */ diff --git a/source/blender/draw/intern/draw_cache_impl_curve.c b/source/blender/draw/intern/draw_cache_impl_curve.c index c6112994b65..8798549a416 100644 --- a/source/blender/draw/intern/draw_cache_impl_curve.c +++ b/source/blender/draw/intern/draw_cache_impl_curve.c @@ -47,6 +47,7 @@ #include "draw_cache_impl.h" /* own include */ +/* See: edit_curve_point_vert.glsl for duplicate includes. */ #define SELECT 1 #define ACTIVE_NURB 1 << 2 #define BEZIER_HANDLE 1 << 3 @@ -698,7 +699,9 @@ static char beztriple_vflag_get(CurveRenderData *rdata, SET_FLAG_FROM_TEST(vflag, (v_idx == rdata->actvert && nu_id == rdata->actnu), VFLAG_VERT_ACTIVE); SET_FLAG_FROM_TEST(vflag, (nu_id == rdata->actnu), ACTIVE_NURB); SET_FLAG_FROM_TEST(vflag, handle_point, BEZIER_HANDLE); - SET_FLAG_FROM_TEST(vflag, handle_selected, VFLAG_HANDLE_SELECTED); + SET_FLAG_FROM_TEST(vflag, handle_selected, VFLAG_VERT_SELECTED_BEZT_HANDLE); + /* Setting flags that overlap with will cause the color id not to work properly. */ + BLI_assert((vflag >> COLOR_SHIFT) == 0); /* handle color id */ vflag |= col_id << COLOR_SHIFT; return vflag; @@ -711,6 +714,8 @@ static char bpoint_vflag_get(CurveRenderData *rdata, char flag, int v_idx, int n SET_FLAG_FROM_TEST(vflag, (v_idx == rdata->actvert && nu_id == rdata->actnu), VFLAG_VERT_ACTIVE); SET_FLAG_FROM_TEST(vflag, (nu_id == rdata->actnu), ACTIVE_NURB); SET_FLAG_FROM_TEST(vflag, ((u % 2) == 0), EVEN_U_BIT); + /* Setting flags that overlap with will cause the color id not to work properly. */ + BLI_assert((vflag >> COLOR_SHIFT) == 0); vflag |= COLOR_NURB_ULINE_ID << COLOR_SHIFT; return vflag; } diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 2ba766f4729..10ef8d9c4c8 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -132,11 +132,17 @@ static void drw_task_graph_init(void) { BLI_assert(DST.task_graph == NULL); DST.task_graph = BLI_task_graph_create(); + DST.delayed_extraction = BLI_gset_ptr_new(__func__); } static void drw_task_graph_deinit(void) { BLI_task_graph_work_and_wait(DST.task_graph); + + BLI_gset_free(DST.delayed_extraction, (void (*)(void *key))drw_batch_cache_generate_requested); + DST.delayed_extraction = NULL; + BLI_task_graph_work_and_wait(DST.task_graph); + BLI_task_graph_free(DST.task_graph); DST.task_graph = NULL; } @@ -1486,6 +1492,7 @@ void DRW_draw_render_loop_ex(struct Depsgraph *depsgraph, drw_duplidata_free(); drw_engines_cache_finish(); + drw_task_graph_deinit(); DRW_render_instance_buffer_finish(); #ifdef USE_PROFILE @@ -1494,7 +1501,6 @@ void DRW_draw_render_loop_ex(struct Depsgraph *depsgraph, #endif } - drw_task_graph_deinit(); DRW_stats_begin(); GPU_framebuffer_bind(DST.default_framebuffer); @@ -2292,9 +2298,9 @@ static void drw_draw_depth_loop_imp(struct Depsgraph *depsgraph, drw_duplidata_free(); drw_engines_cache_finish(); + drw_task_graph_deinit(); DRW_render_instance_buffer_finish(); } - drw_task_graph_deinit(); /* Start Drawing */ DRW_state_reset(); @@ -2411,6 +2417,7 @@ void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *region, View3D *v3d, cons drw_engines_cache_finish(); + drw_task_graph_deinit(); #if 0 /* This is a workaround to a nasty bug that seems to be a nasty driver bug. (See T69377) */ DRW_render_instance_buffer_finish(); #else @@ -2419,7 +2426,6 @@ void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *region, View3D *v3d, cons drw_resource_buffer_finish(DST.vmempool); #endif } - drw_task_graph_deinit(); /* Start Drawing */ DRW_state_reset(); diff --git a/source/blender/draw/intern/draw_manager.h b/source/blender/draw/intern/draw_manager.h index 6cae2a4f9f6..31a2dd7f0fe 100644 --- a/source/blender/draw/intern/draw_manager.h +++ b/source/blender/draw/intern/draw_manager.h @@ -548,6 +548,8 @@ typedef struct DRWManager { #endif struct TaskGraph *task_graph; + /* Contains list of objects that needs to be extracted from other objects. */ + struct GSet *delayed_extraction; /* ---------- Nothing after this point is cleared after use ----------- */ @@ -585,6 +587,7 @@ eDRWCommandType command_type_get(uint64_t *command_type_bits, int index); void drw_batch_cache_validate(Object *ob); void drw_batch_cache_generate_requested(struct Object *ob); +void drw_batch_cache_generate_requested_delayed(Object *ob); void drw_resource_buffer_finish(ViewportMemoryPool *vmempool); diff --git a/source/blender/draw/intern/shaders/common_globals_lib.glsl b/source/blender/draw/intern/shaders/common_globals_lib.glsl index a479a87e14b..40a527a6ba4 100644 --- a/source/blender/draw/intern/shaders/common_globals_lib.glsl +++ b/source/blender/draw/intern/shaders/common_globals_lib.glsl @@ -123,6 +123,8 @@ layout(std140) uniform globalsBlock #define sizeViewportInv (sizeViewport.zw) +/* See: 'draw_cache_impl.h' for matching includes. */ + /* data[0] (1st byte flags) */ #define FACE_ACTIVE (1 << 0) #define FACE_SELECTED (1 << 1) @@ -135,9 +137,9 @@ layout(std140) uniform globalsBlock /* data[1] (2st byte flags) */ #define VERT_ACTIVE (1 << 0) #define VERT_SELECTED (1 << 1) -#define EDGE_ACTIVE (1 << 2) -#define EDGE_SELECTED (1 << 3) -#define EDGE_SEAM (1 << 4) -#define EDGE_SHARP (1 << 5) -#define EDGE_FREESTYLE (1 << 6) -#define HANDLE_SELECTED (1 << 7) +#define VERT_SELECTED_BEZT_HANDLE (1 << 2) +#define EDGE_ACTIVE (1 << 3) +#define EDGE_SELECTED (1 << 4) +#define EDGE_SEAM (1 << 5) +#define EDGE_SHARP (1 << 6) +#define EDGE_FREESTYLE (1 << 7) diff --git a/source/blender/editors/animation/time_scrub_ui.c b/source/blender/editors/animation/time_scrub_ui.c index 7679995d9a4..863f433c778 100644 --- a/source/blender/editors/animation/time_scrub_ui.c +++ b/source/blender/editors/animation/time_scrub_ui.c @@ -95,7 +95,6 @@ static void draw_current_frame(const Scene *scene, int current_frame) { const uiFontStyle *fstyle = UI_FSTYLE_WIDGET; - const uchar color[] = {255, 255, 255, 255}; int frame_x = UI_view2d_view_to_region_x(v2d, current_frame); char frame_str[64]; @@ -127,11 +126,13 @@ static void draw_current_frame(const Scene *scene, 4 * UI_DPI_FAC, bg_color); + uchar text_color[4]; + UI_GetThemeColor4ubv(TH_HEADER_TEXT_HI, text_color); UI_fontstyle_draw_simple(fstyle, frame_x - text_width / 2 + U.pixelsize / 2, get_centered_text_y(scrub_region_rect), frame_str, - color); + text_color); } void ED_time_scrub_draw(const ARegion *region, diff --git a/source/blender/editors/armature/armature_utils.c b/source/blender/editors/armature/armature_utils.c index cf7f6699e5e..34f2b4f12be 100644 --- a/source/blender/editors/armature/armature_utils.c +++ b/source/blender/editors/armature/armature_utils.c @@ -392,7 +392,7 @@ void armature_tag_unselect(bArmature *arm) void ED_armature_ebone_transform_mirror_update(bArmature *arm, EditBone *ebo, bool check_select) { /* TODO When this function is called by property updates, - * cancelling the value change will not restore mirrored bone correctly. */ + * canceling the value change will not restore mirrored bone correctly. */ /* Currently check_select==true when this function is called from a transform operator, * eg. from 3d viewport. */ diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c index 723c7d214e3..5c5adb32a97 100644 --- a/source/blender/editors/gpencil/annotate_paint.c +++ b/source/blender/editors/gpencil/annotate_paint.c @@ -2850,7 +2850,7 @@ void GPENCIL_OT_annotate(wmOperatorType *ot) 0, 200, "Stabilizer Stroke Radius", - "Minimun distance from last point before stroke continues", + "Minimum distance from last point before stroke continues", 1, 100); RNA_def_property_subtype(prop, PROP_PIXEL); diff --git a/source/blender/editors/gpencil/gpencil_sculpt_paint.c b/source/blender/editors/gpencil/gpencil_sculpt_paint.c index f7f3b128351..6bd945160a6 100644 --- a/source/blender/editors/gpencil/gpencil_sculpt_paint.c +++ b/source/blender/editors/gpencil/gpencil_sculpt_paint.c @@ -1506,6 +1506,11 @@ static bool gpsculpt_brush_do_stroke(tGP_BrushEditData *gso, continue; } pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt; + /* If masked and the point is not selected, skip it. */ + if ((GPENCIL_ANY_SCULPT_MASK(gso->mask)) && + ((pt_active->flag & GP_SPOINT_SELECT) == 0)) { + continue; + } index = (pt->runtime.pt_orig) ? pt->runtime.idx_orig : i; if ((pt_active != NULL) && (index < gps_active->totpoints)) { rot_eval = gpsculpt_rotation_eval_get(gso, gps, pt, i); diff --git a/source/blender/editors/gpencil/gpencil_vertex_paint.c b/source/blender/editors/gpencil/gpencil_vertex_paint.c index 581a5d977c2..fe3f0871fdc 100644 --- a/source/blender/editors/gpencil/gpencil_vertex_paint.c +++ b/source/blender/editors/gpencil/gpencil_vertex_paint.c @@ -880,7 +880,7 @@ static void gp_vertexpaint_select_stroke(tGP_BrushVertexpaintData *gso, /* Skip if neither one is selected * (and we are only allowed to edit/consider selected points) */ - if ((GPENCIL_ANY_VERTEX_MASK(gso->mask)) && (GPENCIL_VERTEX_MODE(gso->gpd))) { + if (GPENCIL_ANY_VERTEX_MASK(gso->mask)) { if (!(pt1->flag & GP_SPOINT_SELECT) && !(pt2->flag & GP_SPOINT_SELECT)) { include_last = false; continue; @@ -908,6 +908,11 @@ static void gp_vertexpaint_select_stroke(tGP_BrushVertexpaintData *gso, pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt; index = (pt->runtime.pt_orig) ? pt->runtime.idx_orig : i; if (pt_active != NULL) { + /* If masked and the point is not selected, skip it. */ + if ((GPENCIL_ANY_VERTEX_MASK(gso->mask)) && + ((pt_active->flag & GP_SPOINT_SELECT) == 0)) { + continue; + } hit = true; gp_save_selected_point(gso, gps_active, index, pc1); } diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 336f942ad8c..42feda0e1bc 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -10892,7 +10892,7 @@ static void ui_popup_handler_remove(bContext *C, void *userdata) /* More correct would be to expect UI_RETURN_CANCEL here, but not wanting to * cancel when removing handlers because of file exit is a rare exception. * So instead of setting cancel flag for all menus before removing handlers, - * just explicitly flag menu with UI_RETURN_OK to avoid cancelling it. */ + * just explicitly flag menu with UI_RETURN_OK to avoid canceling it. */ if ((menu->menuretval & UI_RETURN_OK) == 0 && menu->cancel_func) { menu->cancel_func(C, menu->popup_arg); } diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 5f56a93c5eb..55657d7297a 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -354,13 +354,19 @@ static void panel_delete(ARegion *region, ListBase *panels, Panel *panel) MEM_freeN(panel); } +/** + * Remove instanced panels from the region's panel list. + * + * \note Can be called with NULL \a C, but it should be avoided because + * handlers might not be removed. + */ void UI_panels_free_instanced(bContext *C, ARegion *region) { /* Delete panels with the instanced flag. */ LISTBASE_FOREACH_MUTABLE (Panel *, panel, ®ion->panels) { if ((panel->type != NULL) && (panel->type->flag & PNL_INSTANCED)) { /* Make sure the panel's handler is removed before deleting it. */ - if (panel->activedata != NULL) { + if (C != NULL && panel->activedata != NULL) { panel_activate_state(C, panel, PANEL_STATE_EXIT); } panel_delete(region, ®ion->panels, panel); @@ -586,9 +592,8 @@ static void panels_collapse_all(const bContext *C, const char *category = has_category_tabs ? UI_panel_category_active_get(region, false) : NULL; const int flag = ((panel_aligned(area, region) == BUT_HORIZONTAL) ? PNL_CLOSEDX : PNL_CLOSEDY); const PanelType *from_pt = from_panel->type; - Panel *panel; - for (panel = region->panels.first; panel; panel = panel->next) { + LISTBASE_FOREACH (Panel *, panel, ®ion->panels) { PanelType *pt = panel->type; /* close panels with headers in the same context */ @@ -615,10 +620,9 @@ static bool panel_type_context_poll(PanelType *panel_type, const char *context) Panel *UI_panel_find_by_type(ListBase *lb, PanelType *pt) { - Panel *panel; const char *idname = pt->idname; - for (panel = lb->first; panel; panel = panel->next) { + LISTBASE_FOREACH (Panel *, panel, lb) { if (STREQLEN(panel->panelname, idname, sizeof(panel->panelname))) { return panel; } @@ -637,7 +641,7 @@ Panel *UI_panel_begin(ScrArea *area, Panel *panel, bool *r_open) { - Panel *panel_last, *panel_next; + Panel *panel_last; const char *drawname = CTX_IFACE_(pt->translation_context, pt->label); const char *idname = pt->idname; const bool newpanel = (panel == NULL); @@ -698,7 +702,7 @@ Panel *UI_panel_begin(ScrArea *area, if (newpanel) { panel->sortorder = (panel_last) ? panel_last->sortorder + 1 : 0; - for (panel_next = lb->first; panel_next; panel_next = panel_next->next) { + LISTBASE_FOREACH (Panel *, panel_next, lb) { if (panel_next != panel && panel_next->sortorder >= panel->sortorder) { panel_next->sortorder++; } @@ -1393,14 +1397,13 @@ static void align_sub_panels(Panel *panel) /* returns 1 when it did something */ static bool uiAlignPanelStep(ScrArea *area, ARegion *region, const float fac, const bool drag) { - Panel *panel; PanelSort *ps, *panelsort, *psnext; int a, tot = 0; bool done; int align = panel_aligned(area, region); /* count active, not tabbed panels */ - for (panel = region->panels.first; panel; panel = panel->next) { + LISTBASE_FOREACH (Panel *, panel, ®ion->panels) { if (panel->runtime_flag & PNL_ACTIVE) { tot++; } @@ -1411,7 +1414,7 @@ static bool uiAlignPanelStep(ScrArea *area, ARegion *region, const float fac, co } /* extra; change close direction? */ - for (panel = region->panels.first; panel; panel = panel->next) { + LISTBASE_FOREACH (Panel *, panel, ®ion->panels) { if (panel->runtime_flag & PNL_ACTIVE) { if ((panel->flag & PNL_CLOSEDX) && (align == BUT_VERTICAL)) { panel->flag ^= PNL_CLOSED; @@ -1426,7 +1429,7 @@ static bool uiAlignPanelStep(ScrArea *area, ARegion *region, const float fac, co panelsort = MEM_callocN(tot * sizeof(PanelSort), "panelsort"); ps = panelsort; - for (panel = region->panels.first; panel; panel = panel->next) { + LISTBASE_FOREACH (Panel *, panel, ®ion->panels) { if (panel->runtime_flag & PNL_ACTIVE) { ps->panel = MEM_dupallocN(panel); ps->orig = panel; @@ -1506,7 +1509,7 @@ static bool uiAlignPanelStep(ScrArea *area, ARegion *region, const float fac, co } /* set locations for tabbed and sub panels */ - for (panel = region->panels.first; panel; panel = panel->next) { + LISTBASE_FOREACH (Panel *, panel, ®ion->panels) { if (panel->runtime_flag & PNL_ACTIVE) { if (panel->children.first) { align_sub_panels(panel); @@ -1525,13 +1528,12 @@ static bool uiAlignPanelStep(ScrArea *area, ARegion *region, const float fac, co static void ui_panels_size(ScrArea *area, ARegion *region, int *r_x, int *r_y) { - Panel *panel; int align = panel_aligned(area, region); int sizex = 0; int sizey = 0; /* compute size taken up by panels, for setting in view2d */ - for (panel = region->panels.first; panel; panel = panel->next) { + LISTBASE_FOREACH (Panel *, panel, ®ion->panels) { if (panel->runtime_flag & PNL_ACTIVE) { int pa_sizex, pa_sizey; @@ -1617,11 +1619,10 @@ void UI_panels_begin(const bContext *UNUSED(C), ARegion *region) void UI_panels_end(const bContext *C, ARegion *region, int *r_x, int *r_y) { ScrArea *area = CTX_wm_area(C); - uiBlock *block; Panel *panel, *panel_first; /* offset contents */ - for (block = region->uiblocks.first; block; block = block->next) { + LISTBASE_FOREACH (uiBlock *, block, ®ion->uiblocks) { if (block->active && block->panel) { ui_offset_panel_block(block); } @@ -1639,7 +1640,7 @@ void UI_panels_end(const bContext *C, ARegion *region, int *r_x, int *r_y) /* tag first panel */ panel_first = NULL; - for (block = region->uiblocks.first; block; block = block->next) { + LISTBASE_FOREACH (uiBlock *, block, ®ion->uiblocks) { if (block->active && block->panel) { if (!panel_first || block->panel->sortorder < panel_first->sortorder) { panel_first = block->panel; @@ -1657,8 +1658,6 @@ void UI_panels_end(const bContext *C, ARegion *region, int *r_x, int *r_y) void UI_panels_draw(const bContext *C, ARegion *region) { - uiBlock *block; - if (region->alignment != RGN_ALIGN_FLOAT) { UI_ThemeClearColor(TH_BACK); } @@ -1666,13 +1665,13 @@ void UI_panels_draw(const bContext *C, ARegion *region) /* Draw panels, selected on top. Also in reverse order, because * UI blocks are added in reverse order and we need child panels * to draw on top. */ - for (block = region->uiblocks.last; block; block = block->prev) { + LISTBASE_FOREACH_BACKWARD (uiBlock *, block, ®ion->uiblocks) { if (block->active && block->panel && !(block->panel->flag & PNL_SELECT)) { UI_block_draw(C, block); } } - for (block = region->uiblocks.last; block; block = block->prev) { + LISTBASE_FOREACH_BACKWARD (uiBlock *, block, ®ion->uiblocks) { if (block->active && block->panel && (block->panel->flag & PNL_SELECT)) { UI_block_draw(C, block); } @@ -1681,15 +1680,12 @@ void UI_panels_draw(const bContext *C, ARegion *region) void UI_panels_scale(ARegion *region, float new_width) { - uiBlock *block; - uiBut *but; - - for (block = region->uiblocks.first; block; block = block->next) { + LISTBASE_FOREACH (uiBlock *, block, ®ion->uiblocks) { if (block->panel) { float fac = new_width / (float)block->panel->sizex; block->panel->sizex = new_width; - for (but = block->buttons.first; but; but = but->next) { + LISTBASE_FOREACH (uiBut *, but, &block->buttons) { but->rect.xmin *= fac; but->rect.xmax *= fac; } @@ -1845,10 +1841,9 @@ static void ui_panel_drag_collapse(bContext *C, { ScrArea *area = CTX_wm_area(C); ARegion *region = CTX_wm_region(C); - uiBlock *block; Panel *panel; - for (block = region->uiblocks.first; block; block = block->next) { + LISTBASE_FOREACH (uiBlock *, block, ®ion->uiblocks) { float xy_a_block[2] = {UNPACK2(dragcol_data->xy_init)}; float xy_b_block[2] = {UNPACK2(xy_dst)}; rctf rect = block->rect; @@ -2160,9 +2155,7 @@ void UI_panel_category_active_set_default(ARegion *region, const char *idname) const char *UI_panel_category_active_get(ARegion *region, bool set_fallback) { - PanelCategoryStack *pc_act; - - for (pc_act = region->panels_category_active.first; pc_act; pc_act = pc_act->next) { + LISTBASE_FOREACH (PanelCategoryStack *, pc_act, ®ion->panels_category_active) { if (UI_panel_category_find(region, pc_act->idname)) { return pc_act->idname; } @@ -2181,9 +2174,7 @@ const char *UI_panel_category_active_get(ARegion *region, bool set_fallback) PanelCategoryDyn *UI_panel_category_find_mouse_over_ex(ARegion *region, const int x, const int y) { - PanelCategoryDyn *ptd; - - for (ptd = region->panels_category.first; ptd; ptd = ptd->next) { + LISTBASE_FOREACH (PanelCategoryDyn *, ptd, ®ion->panels_category) { if (BLI_rcti_isect_pt(&ptd->rect, x, y)) { return ptd; } @@ -2351,7 +2342,6 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active) const uiFontStyle *fstyle = &style->widget; const int fontid = fstyle->uifont_id; short fstyle_points = fstyle->points; - PanelCategoryDyn *pc_dyn; const float aspect = ((uiBlock *)region->uiblocks.first)->aspect; const float zoom = 1.0f / aspect; const int px = max_ii(1, round_fl_to_int(U.pixelsize)); @@ -2428,7 +2418,8 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active) } /* calculate tab rect's and check if we need to scale down */ - for (pc_dyn = region->panels_category.first; pc_dyn; pc_dyn = pc_dyn->next) { + LISTBASE_FOREACH (PanelCategoryDyn *, pc_dyn, ®ion->panels_category) { + rcti *rct = &pc_dyn->rect; const char *category_id = pc_dyn->idname; const char *category_id_draw = IFACE_(category_id); @@ -2446,7 +2437,7 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active) if (y_ofs > BLI_rcti_size_y(&v2d->mask)) { scaletabs = (float)BLI_rcti_size_y(&v2d->mask) / (float)y_ofs; - for (pc_dyn = region->panels_category.first; pc_dyn; pc_dyn = pc_dyn->next) { + LISTBASE_FOREACH (PanelCategoryDyn *, pc_dyn, ®ion->panels_category) { rcti *rct = &pc_dyn->rect; rct->ymin = ((rct->ymin - v2d->mask.ymax) * scaletabs) + v2d->mask.ymax; rct->ymax = ((rct->ymax - v2d->mask.ymax) * scaletabs) + v2d->mask.ymax; @@ -2491,7 +2482,7 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active) const int divider_xmax = is_left ? (v2d->mask.xmin + category_tabs_width) : (v2d->mask.xmax - (category_tabs_width + px)) + px; - for (pc_dyn = region->panels_category.first; pc_dyn; pc_dyn = pc_dyn->next) { + LISTBASE_FOREACH (PanelCategoryDyn *, pc_dyn, ®ion->panels_category) { const rcti *rct = &pc_dyn->rect; const char *category_id = pc_dyn->idname; const char *category_id_draw = IFACE_(category_id); @@ -2687,7 +2678,6 @@ int ui_handler_panel_region(bContext *C, ARegion *region, const uiBut *active_but) { - uiBlock *block; Panel *panel; int retval, mx, my; bool has_category_tabs = UI_panel_category_is_visible(region); @@ -2726,7 +2716,7 @@ int ui_handler_panel_region(bContext *C, return retval; } - for (block = region->uiblocks.last; block; block = block->prev) { + LISTBASE_FOREACH (uiBlock *, block, ®ion->uiblocks) { uiPanelMouseState mouse_state; mx = event->x; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 7d856a51720..1ce1e2950d5 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -364,8 +364,10 @@ static bool id_search_add(const bContext *C, BKE_id_full_name_ui_prefix_get(name_ui, id, UI_SEP_CHAR); int iconid = ui_id_icon_get(C, id, template_ui->preview); + bool has_sep_char = (id->lib != NULL); - if (!UI_search_item_add(items, name_ui, id, iconid, UI_BUT_HAS_SEP_CHAR)) { + if (!UI_search_item_add( + items, name_ui, id, iconid, has_sep_char ? UI_BUT_HAS_SEP_CHAR : 0)) { return false; } } diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index 15db947bff6..3737b607305 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -384,6 +384,7 @@ typedef struct CollItemSearch { char *name; int index; int iconid; + uint has_sep_char : 1; } CollItemSearch; static int sort_search_items_list(const void *a, const void *b) @@ -405,7 +406,8 @@ void ui_rna_collection_search_update_fn(const struct bContext *C, uiSearchItems *items) { uiRNACollectionSearch *data = arg; - int i = 0, iconid = 0, flag = RNA_property_flag(data->target_prop); + const int flag = RNA_property_flag(data->target_prop); + int i = 0; ListBase *items_list = MEM_callocN(sizeof(ListBase), "items_list"); CollItemSearch *cis; const bool is_ptr_target = (RNA_property_type(data->target_prop) == PROP_POINTER); @@ -433,7 +435,9 @@ void ui_rna_collection_search_update_fn(const struct bContext *C, } } - iconid = 0; + int iconid = ICON_NONE; + bool has_sep_char = false; + if (itemptr.type && RNA_struct_is_ID(itemptr.type)) { iconid = ui_id_icon_get(C, itemptr.data, false); @@ -441,10 +445,12 @@ void ui_rna_collection_search_update_fn(const struct bContext *C, name = RNA_struct_name_get_alloc(&itemptr, name_buf, sizeof(name_buf), NULL); } else { - BKE_id_full_name_ui_prefix_get(name_buf, itemptr.data, UI_SEP_CHAR); + const ID *id = itemptr.data; + BKE_id_full_name_ui_prefix_get(name_buf, id, UI_SEP_CHAR); BLI_STATIC_ASSERT(sizeof(name_buf) >= MAX_ID_FULL_NAME_UI, "Name string buffer should be big enough to hold full UI ID name"); name = name_buf; + has_sep_char = (id->lib != NULL); } } else { @@ -458,6 +464,7 @@ void ui_rna_collection_search_update_fn(const struct bContext *C, cis->name = BLI_strdup(name); cis->index = i; cis->iconid = iconid; + cis->has_sep_char = has_sep_char; BLI_addtail(items_list, cis); } if (name != name_buf) { @@ -473,7 +480,11 @@ void ui_rna_collection_search_update_fn(const struct bContext *C, /* add search items from temporary list */ for (cis = items_list->first; cis; cis = cis->next) { - if (!UI_search_item_add(items, cis->name, cis->data, cis->iconid, UI_BUT_HAS_SEP_CHAR)) { + if (!UI_search_item_add(items, + cis->name, + cis->data, + cis->iconid, + cis->has_sep_char ? UI_BUT_HAS_SEP_CHAR : 0)) { break; } } diff --git a/source/blender/editors/io/CMakeLists.txt b/source/blender/editors/io/CMakeLists.txt index 39548449a86..e7effd05d34 100644 --- a/source/blender/editors/io/CMakeLists.txt +++ b/source/blender/editors/io/CMakeLists.txt @@ -66,10 +66,6 @@ if(WITH_ALEMBIC) bf_alembic ) add_definitions(-DWITH_ALEMBIC) - - if(WITH_ALEMBIC_HDF5) - add_definitions(-DWITH_ALEMBIC_HDF5) - endif() endif() if(WITH_USD) diff --git a/source/blender/editors/io/io_alembic.c b/source/blender/editors/io/io_alembic.c index dc8ad858a9f..fc2c55ffeda 100644 --- a/source/blender/editors/io/io_alembic.c +++ b/source/blender/editors/io/io_alembic.c @@ -133,7 +133,6 @@ static int wm_alembic_export_exec(bContext *C, wmOperator *op) .use_subdiv_schema = RNA_boolean_get(op->ptr, "subdiv_schema"), .export_hair = RNA_boolean_get(op->ptr, "export_hair"), .export_particles = RNA_boolean_get(op->ptr, "export_particles"), - .compression_type = RNA_enum_get(op->ptr, "compression_type"), .packuv = RNA_boolean_get(op->ptr, "packuv"), .triangulate = RNA_boolean_get(op->ptr, "triangulate"), .quad_method = RNA_enum_get(op->ptr, "quad_method"), @@ -163,15 +162,6 @@ static void ui_alembic_export_settings(uiLayout *layout, PointerRNA *imfptr) uiLayout *row; uiLayout *col; -# ifdef WITH_ALEMBIC_HDF5 - box = uiLayoutBox(layout); - row = uiLayoutRow(box, false); - uiItemL(row, IFACE_("Archive Options:"), ICON_NONE); - - row = uiLayoutRow(box, false); - uiItemR(row, imfptr, "compression_type", 0, NULL, ICON_NONE); -# endif - box = uiLayoutBox(layout); row = uiLayoutRow(box, false); uiItemL(row, IFACE_("Manual Transform:"), ICON_NONE); @@ -421,7 +411,7 @@ void WM_OT_alembic_export(wmOperatorType *ot) "Export meshes using Alembic's subdivision schema"); RNA_def_boolean( - ot->srna, "apply_subdiv", 0, "Apply Subsurf", "Export subdivision surfaces as meshes"); + ot->srna, "apply_subdiv", 0, "Apply Subdivision Surface", "Export subdivision surfaces as meshes"); RNA_def_boolean(ot->srna, "curves_as_mesh", @@ -429,13 +419,6 @@ void WM_OT_alembic_export(wmOperatorType *ot) "Curves as Mesh", "Export curves and NURBS surfaces as meshes"); - RNA_def_enum(ot->srna, - "compression_type", - rna_enum_abc_compression_items, - ABC_ARCHIVE_OGAWA, - "Compression", - ""); - RNA_def_float( ot->srna, "global_scale", diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 69497d019b8..a0a3d24e49a 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -7241,7 +7241,7 @@ void MESH_OT_wireframe(wmOperatorType *ot) RNA_def_property_ui_range(prop, 0.0, 1.0, 0.01, 4); RNA_def_float_distance(ot->srna, "offset", 0.01f, 0.0f, 1e4f, "Offset", "", 0.0f, 10.0f); RNA_def_boolean( - ot->srna, "use_crease", false, "Crease", "Crease hub edges for improved subsurf"); + ot->srna, "use_crease", false, "Crease", "Crease hub edges for an improved subdivision surface"); prop = RNA_def_float( ot->srna, "crease_weight", 0.01f, 0.0f, 1e3f, "Crease weight", "", 0.0f, 1.0f); RNA_def_property_ui_range(prop, 0.0, 1.0, 0.1, 2); diff --git a/source/blender/editors/object/object_collection.c b/source/blender/editors/object/object_collection.c index 7a83d582299..24f6d8c79f9 100644 --- a/source/blender/editors/object/object_collection.c +++ b/source/blender/editors/object/object_collection.c @@ -483,13 +483,13 @@ static int collection_link_exec(bContext *C, wmOperator *op) /* Currently this should not be allowed (might be supported in the future though...). */ if (ID_IS_OVERRIDE_LIBRARY(&collection->id)) { - BKE_report(op->reports, RPT_ERROR, "Could not add the collection because it is overridden."); + BKE_report(op->reports, RPT_ERROR, "Could not add the collection because it is overridden"); return OPERATOR_CANCELLED; } /* Linked collections are already checked for by using RNA_collection_local_itemf * but operator can be called without invoke */ if (ID_IS_LINKED(&collection->id)) { - BKE_report(op->reports, RPT_ERROR, "Could not add the collection because it is linked."); + BKE_report(op->reports, RPT_ERROR, "Could not add the collection because it is linked"); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/object/object_data_transfer.c b/source/blender/editors/object/object_data_transfer.c index 1e2b7702dc5..274cd31406c 100644 --- a/source/blender/editors/object/object_data_transfer.c +++ b/source/blender/editors/object/object_data_transfer.c @@ -76,7 +76,7 @@ static const EnumPropertyItem DT_layer_items[] = { {0, "", 0, "Edge Data", ""}, {DT_TYPE_SHARP_EDGE, "SHARP_EDGE", 0, "Sharp", "Transfer sharp mark"}, {DT_TYPE_SEAM, "SEAM", 0, "UV Seam", "Transfer UV seam mark"}, - {DT_TYPE_CREASE, "CREASE", 0, "Subsurf Crease", "Transfer crease values"}, + {DT_TYPE_CREASE, "CREASE", 0, "Subdivision Crease", "Transfer crease values"}, {DT_TYPE_BWEIGHT_EDGE, "BEVEL_WEIGHT_EDGE", 0, "Bevel Weight", "Transfer bevel weights"}, {DT_TYPE_FREESTYLE_EDGE, "FREESTYLE_EDGE", diff --git a/source/blender/editors/sculpt_paint/sculpt_transform.c b/source/blender/editors/sculpt_paint/sculpt_transform.c index 2eb1191b950..59a4695ce18 100644 --- a/source/blender/editors/sculpt_paint/sculpt_transform.c +++ b/source/blender/editors/sculpt_paint/sculpt_transform.c @@ -199,7 +199,7 @@ void ED_sculpt_end_transform(struct bContext *C) } /* Force undo push to happen even inside transform operator, since the sculpt * undo system works separate from regular undo and this is require to properly - * finish an undo step also when cancelling. */ + * finish an undo step also when canceling. */ const bool use_nested_undo = true; SCULPT_undo_push_end_ex(use_nested_undo); SCULPT_flush_update_done(C, ob, SCULPT_UPDATE_COORDS); diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index aa2d5b2ae7d..9311cbed265 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -224,11 +224,11 @@ static void seq_proxy_build_job(const bContext *C, ReportList *reports) selected = true; if (!(seq->flag & SEQ_USE_PROXY)) { - BKE_reportf(reports, RPT_WARNING, "Proxy is not enabled for %s, skipping.", seq->name); + BKE_reportf(reports, RPT_WARNING, "Proxy is not enabled for %s, skipping", seq->name); continue; } else if (seq->strip->proxy->build_size_flags == 0) { - BKE_reportf(reports, RPT_WARNING, "Resolution is not selected for %s, skipping.", seq->name); + BKE_reportf(reports, RPT_WARNING, "Resolution is not selected for %s, skipping", seq->name); continue; } @@ -236,13 +236,13 @@ static void seq_proxy_build_job(const bContext *C, ReportList *reports) pj->main, pj->depsgraph, pj->scene, seq, file_list, &pj->queue); if (!success && (seq->strip->proxy->build_flags & SEQ_PROXY_SKIP_EXISTING) != 0) { - BKE_reportf(reports, RPT_WARNING, "Overwrite is not checked for %s, skipping.", seq->name); + BKE_reportf(reports, RPT_WARNING, "Overwrite is not checked for %s, skipping", seq->name); } } SEQ_END; if (!selected) { - BKE_reportf(reports, RPT_WARNING, "Select movie or image strips."); + BKE_reportf(reports, RPT_WARNING, "Select movie or image strips"); return; } diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index d8503a28774..b02b1814c67 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1917,6 +1917,27 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve return 0; } + /* When proportional editing is enabled, data_len_all can be non zero when + * nothing is selected, if this is the case we can end the transform early. + * + * By definition transform-data has selected items in beginning, + * so only the first item in each container needs to be checked + * when looking for the presence of selected data. */ + if (t->flag & T_PROP_EDIT) { + bool has_selected_any = false; + FOREACH_TRANS_DATA_CONTAINER (t, tc) { + if (tc->data->flag & TD_SELECTED) { + has_selected_any = true; + break; + } + } + + if (!has_selected_any) { + postTrans(C, t); + return 0; + } + } + if (event) { /* keymap for shortcut header prints */ t->keymap = WM_keymap_active(CTX_wm_manager(C), op->type->modalkeymap); @@ -2088,14 +2109,6 @@ int transformEnd(bContext *C, TransInfo *t) if (t->state != TRANS_STARTING && t->state != TRANS_RUNNING) { /* handle restoring objects */ if (t->state == TRANS_CANCEL) { - /* exception, edge slide transformed UVs too */ - if (t->mode == TFM_EDGE_SLIDE) { - doEdgeSlide(t, 0.0f); - } - else if (t->mode == TFM_VERT_SLIDE) { - doVertSlide(t, 0.0f); - } - exit_code = OPERATOR_CANCELLED; restoreTransObjects(t); // calls recalcData() } diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 0347522b8e8..838c1880881 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -42,7 +42,6 @@ #include "BLI_utildefines.h" #include "BKE_context.h" -#include "BKE_scene.h" #include "ED_view3d.h" diff --git a/source/blender/editors/transform/transform_convert.c b/source/blender/editors/transform/transform_convert.c index 8496642185d..064057990e0 100644 --- a/source/blender/editors/transform/transform_convert.c +++ b/source/blender/editors/transform/transform_convert.c @@ -55,7 +55,6 @@ #include "DEG_depsgraph_build.h" #include "transform.h" -#include "transform_mode.h" #include "transform_snap.h" /* Own include. */ @@ -70,41 +69,21 @@ bool transform_mode_use_local_origins(const TransInfo *t) * Transforming around ourselves is no use, fallback to individual origins, * useful for curve/armatures. */ -void transform_around_single_fallback(TransInfo *t) +void transform_around_single_fallback_ex(TransInfo *t, int data_len_all) { if ((ELEM(t->around, V3D_AROUND_CENTER_BOUNDS, V3D_AROUND_CENTER_MEDIAN, V3D_AROUND_ACTIVE)) && transform_mode_use_local_origins(t)) { - - bool is_data_single = false; - if (t->data_len_all == 1) { - is_data_single = true; - } - else if (t->data_len_all == 3) { - if (t->obedit_type == OB_CURVE) { - /* Special case check for curve, if we have a single curve bezier triple selected - * treat */ - FOREACH_TRANS_DATA_CONTAINER (t, tc) { - if (!tc->data_len) { - continue; - } - if (tc->data_len == 3) { - const TransData *td = tc->data; - if ((td[0].flag | td[1].flag | td[2].flag) & TD_BEZTRIPLE) { - if ((td[0].loc == td[1].loc) && (td[1].loc == td[2].loc)) { - is_data_single = true; - } - } - } - break; - } - } - } - if (is_data_single) { + if (data_len_all == 1) { t->around = V3D_AROUND_LOCAL_ORIGINS; } } } +void transform_around_single_fallback(TransInfo *t) +{ + transform_around_single_fallback_ex(t, t->data_len_all); +} + /* -------------------------------------------------------------------- */ /** \name Proportional Editing * \{ */ diff --git a/source/blender/editors/transform/transform_convert.h b/source/blender/editors/transform/transform_convert.h index fdb6767a267..a94bd609d94 100644 --- a/source/blender/editors/transform/transform_convert.h +++ b/source/blender/editors/transform/transform_convert.h @@ -47,8 +47,7 @@ bool clipUVTransform(TransInfo *t, float vec[2], const bool resize); void clipUVData(TransInfo *t); /* transform_convert_mesh.c */ -void trans_mesh_customdata_correction_init(TransInfo *t); -void trans_mesh_customdata_correction_apply(struct TransDataContainer *tc, bool is_final); +void trans_mesh_customdata_correction_init(TransInfo *t, struct TransDataContainer *tc); /* transform_convert_sequencer.c */ int transform_convert_sequencer_get_snap_bound(TransInfo *t); @@ -84,6 +83,7 @@ typedef enum eTransConvertType { /* transform_convert.c */ bool transform_mode_use_local_origins(const TransInfo *t); +void transform_around_single_fallback_ex(TransInfo *t, int data_len_all); void transform_around_single_fallback(TransInfo *t); void posttrans_fcurve_clean(struct FCurve *fcu, const int sel_flag, const bool use_handle); bool constraints_list_needinv(TransInfo *t, ListBase *list); diff --git a/source/blender/editors/transform/transform_convert_action.c b/source/blender/editors/transform/transform_convert_action.c index 267acd5cb04..b9292aa151c 100644 --- a/source/blender/editors/transform/transform_convert_action.c +++ b/source/blender/editors/transform/transform_convert_action.c @@ -36,7 +36,6 @@ #include "BKE_key.h" #include "BKE_mask.h" #include "BKE_nla.h" -#include "BKE_report.h" #include "ED_anim_api.h" #include "ED_keyframes_edit.h" diff --git a/source/blender/editors/transform/transform_convert_curve.c b/source/blender/editors/transform/transform_convert_curve.c index c5e1e59b9e6..6c03f86f883 100644 --- a/source/blender/editors/transform/transform_convert_curve.c +++ b/source/blender/editors/transform/transform_convert_curve.c @@ -64,7 +64,7 @@ static int bezt_select_to_transform_triple_flag(const BezTriple *bezt, const boo * When a center point is being moved without the handles, * leaving the handles stationary makes no sense and only causes strange behavior, * where one handle is arbitrarily anchored, the other one is aligned and lengthened - * based on where the center point is moved. Also a bug when cancelling, see: T52007. + * based on where the center point is moved. Also a bug when canceling, see: T52007. * * A more 'correct' solution could be to store handle locations in 'TransDataCurveHandleFlags'. * However that doesn't resolve odd behavior, so best transform the handles in this case. @@ -87,6 +87,10 @@ void createTransCurveVerts(TransInfo *t) t->data_len_all = 0; + /* Count control points (one per bez-triple) if any number of handles are selected. + * Needed for #transform_around_single_fallback_ex. */ + int data_len_all_pt = 0; + FOREACH_TRANS_DATA_CONTAINER (t, tc) { Curve *cu = tc->obedit->data; BLI_assert(cu->editnurb != NULL); @@ -94,7 +98,9 @@ void createTransCurveVerts(TransInfo *t) BPoint *bp; int a; int count = 0, countsel = 0; + int count_pt = 0, countsel_pt = 0; const bool is_prop_edit = (t->flag & T_PROP_EDIT) != 0; + const bool is_prop_connected = (t->flag & T_PROP_CONNECTED) != 0; View3D *v3d = t->view; short hide_handles = (v3d != NULL) ? (v3d->overlay.handle_display == CURVE_HANDLE_NONE) : false; @@ -106,17 +112,21 @@ void createTransCurveVerts(TransInfo *t) for (a = 0, bezt = nu->bezt; a < nu->pntsu; a++, bezt++) { if (bezt->hide == 0) { const int bezt_tx = bezt_select_to_transform_triple_flag(bezt, hide_handles); - if (bezt_tx & SEL_F1) { - countsel++; - } - if (bezt_tx & SEL_F2) { - countsel++; - } - if (bezt_tx & SEL_F3) { - countsel++; + if (bezt_tx & (SEL_F1 | SEL_F2 | SEL_F3)) { + if (bezt_tx & SEL_F1) { + countsel++; + } + if (bezt_tx & SEL_F2) { + countsel++; + } + if (bezt_tx & SEL_F3) { + countsel++; + } + countsel_pt++; } if (is_prop_edit) { count += 3; + count_pt++; } } } @@ -124,34 +134,42 @@ void createTransCurveVerts(TransInfo *t) else { for (a = nu->pntsu * nu->pntsv, bp = nu->bp; a > 0; a--, bp++) { if (bp->hide == 0) { - if (is_prop_edit) { - count++; - } if (bp->f1 & SELECT) { countsel++; + countsel_pt++; + } + if (is_prop_edit) { + count++; + count_pt++; } } } } } - /* note: in prop mode we need at least 1 selected */ - if (countsel == 0) { + + /* Support other objects using PET to adjust these, unless connected is enabled. */ + if (((is_prop_edit && !is_prop_connected) ? count : countsel) == 0) { tc->data_len = 0; continue; } + int data_len_pt = 0; + if (is_prop_edit) { tc->data_len = count; + data_len_pt = count_pt; } else { tc->data_len = countsel; + data_len_pt = countsel_pt; } tc->data = MEM_callocN(tc->data_len * sizeof(TransData), "TransObData(Curve EditMode)"); t->data_len_all += tc->data_len; + data_len_all_pt += data_len_pt; } - transform_around_single_fallback(t); + transform_around_single_fallback_ex(t, data_len_all_pt); t->data_len_all = -1; FOREACH_TRANS_DATA_CONTAINER (t, tc) { diff --git a/source/blender/editors/transform/transform_convert_lattice.c b/source/blender/editors/transform/transform_convert_lattice.c index b73a4c1ab2d..e564733266b 100644 --- a/source/blender/editors/transform/transform_convert_lattice.c +++ b/source/blender/editors/transform/transform_convert_lattice.c @@ -53,6 +53,7 @@ void createTransLatticeVerts(TransInfo *t) int a; int count = 0, countsel = 0; const bool is_prop_edit = (t->flag & T_PROP_EDIT) != 0; + const bool is_prop_connected = (t->flag & T_PROP_CONNECTED) != 0; bp = latt->def; a = latt->pntsu * latt->pntsv * latt->pntsw; @@ -68,9 +69,10 @@ void createTransLatticeVerts(TransInfo *t) bp++; } - /* note: in prop mode we need at least 1 selected */ - if (countsel == 0) { - return; + /* Support other objects using PET to adjust these, unless connected is enabled. */ + if (((is_prop_edit && !is_prop_connected) ? count : countsel) == 0) { + tc->data_len = 0; + continue; } if (is_prop_edit) { diff --git a/source/blender/editors/transform/transform_convert_mask.c b/source/blender/editors/transform/transform_convert_mask.c index 7be0d43d854..66c27bca207 100644 --- a/source/blender/editors/transform/transform_convert_mask.c +++ b/source/blender/editors/transform/transform_convert_mask.c @@ -30,7 +30,6 @@ #include "BKE_context.h" #include "BKE_mask.h" -#include "BKE_report.h" #include "ED_clip.h" #include "ED_image.h" diff --git a/source/blender/editors/transform/transform_convert_mball.c b/source/blender/editors/transform/transform_convert_mball.c index 447733357d6..ce5e4dade5a 100644 --- a/source/blender/editors/transform/transform_convert_mball.c +++ b/source/blender/editors/transform/transform_convert_mball.c @@ -47,6 +47,7 @@ void createTransMBallVerts(TransInfo *t) float mtx[3][3], smtx[3][3]; int count = 0, countsel = 0; const bool is_prop_edit = (t->flag & T_PROP_EDIT) != 0; + const bool is_prop_connected = (t->flag & T_PROP_CONNECTED) != 0; /* count totals */ for (ml = mb->editelems->first; ml; ml = ml->next) { @@ -58,8 +59,9 @@ void createTransMBallVerts(TransInfo *t) } } - /* note: in prop mode we need at least 1 selected */ - if (countsel == 0) { + /* Support other objects using PET to adjust these, unless connected is enabled. */ + if (((is_prop_edit && !is_prop_connected) ? count : countsel) == 0) { + tc->data_len = 0; continue; } diff --git a/source/blender/editors/transform/transform_convert_mesh.c b/source/blender/editors/transform/transform_convert_mesh.c index 598604eac0d..27ddad262f7 100644 --- a/source/blender/editors/transform/transform_convert_mesh.c +++ b/source/blender/editors/transform/transform_convert_mesh.c @@ -707,9 +707,10 @@ void createTransEditVerts(TransInfo *t) * * \note ignore modes here, even in edge/face modes, * transform data is created by selected vertices. - * \note in prop mode we need at least 1 selected. */ - if (bm->totvertsel == 0) { + + /* Support other objects using PET to adjust these, unless connected is enabled. */ + if ((!prop_mode || (prop_mode & T_PROP_CONNECTED)) && (bm->totvertsel == 0)) { goto cleanup; } @@ -734,6 +735,10 @@ void createTransEditVerts(TransInfo *t) } } + if (data_len == 0) { + goto cleanup; + } + /* allocating scratch arrays */ if (prop_mode & T_PROP_CONNECTED) { dists = MEM_mallocN(em->bm->totvert * sizeof(float), __func__); @@ -1070,105 +1075,99 @@ static void create_trans_vert_customdata_layer(BMVert *v, BLI_ghash_insert(tcld->origverts, v, r_tcld_vert); } -void trans_mesh_customdata_correction_init(TransInfo *t) +void trans_mesh_customdata_correction_init(TransInfo *t, TransDataContainer *tc) { - FOREACH_TRANS_DATA_CONTAINER (t, tc) { - if (tc->custom.type.data) { - if (tc->custom.type.free_cb == trans_mesh_customdata_free_cb) { - /* Custom data correction has initiated before. */ - continue; - } - else { - BLI_assert(false); - } - } - int i; + if (tc->custom.type.data) { + /* Custom data correction has initiated before. */ + BLI_assert(tc->custom.type.free_cb == trans_mesh_customdata_free_cb); + return; + } + int i; - BMEditMesh *em = BKE_editmesh_from_object(tc->obedit); - BMesh *bm = em->bm; + BMEditMesh *em = BKE_editmesh_from_object(tc->obedit); + BMesh *bm = em->bm; - bool use_origfaces; - int cd_loop_mdisp_offset; - { - const bool has_layer_math = CustomData_has_math(&bm->ldata); - cd_loop_mdisp_offset = CustomData_get_offset(&bm->ldata, CD_MDISPS); - if ((t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) && - /* don't do this at all for non-basis shape keys, too easy to - * accidentally break uv maps or vertex colors then */ - (bm->shapenr <= 1) && (has_layer_math || (cd_loop_mdisp_offset != -1))) { - use_origfaces = true; - } - else { - use_origfaces = false; - cd_loop_mdisp_offset = -1; - } + bool use_origfaces; + int cd_loop_mdisp_offset; + { + const bool has_layer_math = CustomData_has_math(&bm->ldata); + cd_loop_mdisp_offset = CustomData_get_offset(&bm->ldata, CD_MDISPS); + if ((t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) && + /* don't do this at all for non-basis shape keys, too easy to + * accidentally break uv maps or vertex colors then */ + (bm->shapenr <= 1) && (has_layer_math || (cd_loop_mdisp_offset != -1))) { + use_origfaces = true; + } + else { + use_origfaces = false; + cd_loop_mdisp_offset = -1; } + } - if (use_origfaces) { - /* create copies of faces for customdata projection */ - bmesh_edit_begin(bm, BMO_OPTYPE_FLAG_UNTAN_MULTIRES); + if (use_origfaces) { + /* create copies of faces for customdata projection */ + bmesh_edit_begin(bm, BMO_OPTYPE_FLAG_UNTAN_MULTIRES); - struct GHash *origfaces = BLI_ghash_ptr_new(__func__); - struct BMesh *bm_origfaces = BM_mesh_create(&bm_mesh_allocsize_default, - &((struct BMeshCreateParams){ - .use_toolflags = false, - })); + struct GHash *origfaces = BLI_ghash_ptr_new(__func__); + struct BMesh *bm_origfaces = BM_mesh_create(&bm_mesh_allocsize_default, + &((struct BMeshCreateParams){ + .use_toolflags = false, + })); - /* we need to have matching customdata */ - BM_mesh_copy_init_customdata(bm_origfaces, bm, NULL); + /* we need to have matching customdata */ + BM_mesh_copy_init_customdata(bm_origfaces, bm, NULL); - int *layer_math_map = NULL; - int layer_index_dst = 0; - { - /* TODO: We don't need `sod->layer_math_map` when there are no loops linked - * to one of the sliding vertices. */ - if (CustomData_has_math(&bm->ldata)) { - /* over alloc, only 'math' layers are indexed */ - layer_math_map = MEM_mallocN(bm->ldata.totlayer * sizeof(int), __func__); - for (i = 0; i < bm->ldata.totlayer; i++) { - if (CustomData_layer_has_math(&bm->ldata, i)) { - layer_math_map[layer_index_dst++] = i; - } + int *layer_math_map = NULL; + int layer_index_dst = 0; + { + /* TODO: We don't need `sod->layer_math_map` when there are no loops linked + * to one of the sliding vertices. */ + if (CustomData_has_math(&bm->ldata)) { + /* over alloc, only 'math' layers are indexed */ + layer_math_map = MEM_mallocN(bm->ldata.totlayer * sizeof(int), __func__); + for (i = 0; i < bm->ldata.totlayer; i++) { + if (CustomData_layer_has_math(&bm->ldata, i)) { + layer_math_map[layer_index_dst++] = i; } - BLI_assert(layer_index_dst != 0); } + BLI_assert(layer_index_dst != 0); } + } - struct TransCustomDataLayer *tcld; - tc->custom.type.data = tcld = MEM_mallocN(sizeof(*tcld), __func__); - tc->custom.type.free_cb = trans_mesh_customdata_free_cb; - - tcld->bm = bm; - tcld->origfaces = origfaces; - tcld->bm_origfaces = bm_origfaces; - tcld->cd_loop_mdisp_offset = cd_loop_mdisp_offset; - tcld->layer_math_map = layer_math_map; - tcld->layer_math_map_num = layer_index_dst; - tcld->arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__); - - int data_len = tc->data_len + tc->data_mirror_len; - struct GHash *origverts = BLI_ghash_ptr_new_ex(__func__, data_len); - tcld->origverts = origverts; - - struct TransCustomDataLayerVert *tcld_vert, *tcld_vert_iter; - tcld_vert = BLI_memarena_alloc(tcld->arena, data_len * sizeof(*tcld_vert)); - tcld_vert_iter = &tcld_vert[0]; - - TransData *tob; - for (i = tc->data_len, tob = tc->data; i--; tob++, tcld_vert_iter++) { - BMVert *v = tob->extra; - create_trans_vert_customdata_layer(v, tcld, tcld_vert_iter); - } - - TransDataMirror *td_mirror = tc->data_mirror; - for (i = tc->data_mirror_len; i--; td_mirror++, tcld_vert_iter++) { - BMVert *v = td_mirror->extra; - create_trans_vert_customdata_layer(v, tcld, tcld_vert_iter); - } + struct TransCustomDataLayer *tcld; + tc->custom.type.data = tcld = MEM_mallocN(sizeof(*tcld), __func__); + tc->custom.type.free_cb = trans_mesh_customdata_free_cb; + + tcld->bm = bm; + tcld->origfaces = origfaces; + tcld->bm_origfaces = bm_origfaces; + tcld->cd_loop_mdisp_offset = cd_loop_mdisp_offset; + tcld->layer_math_map = layer_math_map; + tcld->layer_math_map_num = layer_index_dst; + tcld->arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__); + + int data_len = tc->data_len + tc->data_mirror_len; + struct GHash *origverts = BLI_ghash_ptr_new_ex(__func__, data_len); + tcld->origverts = origverts; + + struct TransCustomDataLayerVert *tcld_vert, *tcld_vert_iter; + tcld_vert = BLI_memarena_alloc(tcld->arena, data_len * sizeof(*tcld_vert)); + tcld_vert_iter = &tcld_vert[0]; + + TransData *tob; + for (i = tc->data_len, tob = tc->data; i--; tob++, tcld_vert_iter++) { + BMVert *v = tob->extra; + create_trans_vert_customdata_layer(v, tcld, tcld_vert_iter); + } - tcld->data = tcld_vert; - tcld->data_len = data_len; + TransDataMirror *td_mirror = tc->data_mirror; + for (i = tc->data_mirror_len; i--; td_mirror++, tcld_vert_iter++) { + BMVert *v = td_mirror->extra; + create_trans_vert_customdata_layer(v, tcld, tcld_vert_iter); } + + tcld->data = tcld_vert; + tcld->data_len = data_len; } } @@ -1313,7 +1312,7 @@ static void trans_mesh_customdata_correction_apply_vert(struct TransCustomDataLa } } -void trans_mesh_customdata_correction_apply(struct TransDataContainer *tc, bool is_final) +static void trans_mesh_customdata_correction_apply(struct TransDataContainer *tc, bool is_final) { struct TransCustomDataLayer *tcld = tc->custom.type.data; if (!tcld) { @@ -1387,11 +1386,10 @@ void recalcData_mesh(TransInfo *t) } } - if (t->mode == TFM_EDGE_SLIDE) { - projectEdgeSlideData(t, false); - } - else if (t->mode == TFM_VERT_SLIDE) { - projectVertSlideData(t, false); + if (ELEM(t->mode, TFM_EDGE_SLIDE, TFM_VERT_SLIDE)) { + FOREACH_TRANS_DATA_CONTAINER (t, tc) { + trans_mesh_customdata_correction_apply(tc, false); + } } FOREACH_TRANS_DATA_CONTAINER (t, tc) { @@ -1410,15 +1408,24 @@ void recalcData_mesh(TransInfo *t) void special_aftertrans_update__mesh(bContext *UNUSED(C), TransInfo *t) { const bool canceled = (t->state == TRANS_CANCEL); - if (t->mode == TFM_EDGE_SLIDE) { - /* handle multires re-projection, done - * on transform completion since it's - * really slow -joeedh */ - projectEdgeSlideData(t, !canceled); + + if (canceled) { + /* Exception, edge slide transformed UVs too. */ + if (t->mode == TFM_EDGE_SLIDE) { + doEdgeSlide(t, 0.0f); + } + else if (t->mode == TFM_VERT_SLIDE) { + doVertSlide(t, 0.0f); + } } - else if (t->mode == TFM_VERT_SLIDE) { - /* as above */ - projectVertSlideData(t, !canceled); + + if (ELEM(t->mode, TFM_EDGE_SLIDE, TFM_VERT_SLIDE)) { + /* Handle multires re-projection, done + * on transform completion since it's + * really slow -joeedh. */ + FOREACH_TRANS_DATA_CONTAINER (t, tc) { + trans_mesh_customdata_correction_apply(tc, !canceled); + } } bool use_automerge = !canceled && (t->flag & (T_AUTOMERGE | T_AUTOSPLIT)) != 0; diff --git a/source/blender/editors/transform/transform_convert_mesh_edge.c b/source/blender/editors/transform/transform_convert_mesh_edge.c index de90c515042..febfa4cd367 100644 --- a/source/blender/editors/transform/transform_convert_mesh_edge.c +++ b/source/blender/editors/transform/transform_convert_mesh_edge.c @@ -50,6 +50,7 @@ void createTransEdge(TransInfo *t) float mtx[3][3], smtx[3][3]; int count = 0, countsel = 0; const bool is_prop_edit = (t->flag & T_PROP_EDIT) != 0; + const bool is_prop_connected = (t->flag & T_PROP_CONNECTED) != 0; int cd_edge_float_offset; BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) { @@ -63,7 +64,7 @@ void createTransEdge(TransInfo *t) } } - if (countsel == 0) { + if (((is_prop_edit && !is_prop_connected) ? count : countsel) == 0) { tc->data_len = 0; continue; } diff --git a/source/blender/editors/transform/transform_convert_mesh_uv.c b/source/blender/editors/transform/transform_convert_mesh_uv.c index 337f7a83f9e..41c09cd8ea2 100644 --- a/source/blender/editors/transform/transform_convert_mesh_uv.c +++ b/source/blender/editors/transform/transform_convert_mesh_uv.c @@ -171,8 +171,8 @@ void createTransUVs(bContext *C, TransInfo *t) } } - /* note: in prop mode we need at least 1 selected */ - if (countsel == 0) { + /* Support other objects using PET to adjust these, unless connected is enabled. */ + if (((is_prop_edit && !is_prop_connected) ? count : countsel) == 0) { goto finally; } diff --git a/source/blender/editors/transform/transform_convert_nla.c b/source/blender/editors/transform/transform_convert_nla.c index 03da979bbd3..241e65f3251 100644 --- a/source/blender/editors/transform/transform_convert_nla.c +++ b/source/blender/editors/transform/transform_convert_nla.c @@ -31,7 +31,6 @@ #include "BKE_context.h" #include "BKE_nla.h" -#include "BKE_report.h" #include "ED_anim_api.h" #include "ED_markers.h" diff --git a/source/blender/editors/transform/transform_convert_tracking.c b/source/blender/editors/transform/transform_convert_tracking.c index 36c6116b575..c3f48adca68 100644 --- a/source/blender/editors/transform/transform_convert_tracking.c +++ b/source/blender/editors/transform/transform_convert_tracking.c @@ -31,7 +31,6 @@ #include "BKE_context.h" #include "BKE_movieclip.h" #include "BKE_node.h" -#include "BKE_report.h" #include "BKE_tracking.h" #include "ED_clip.h" diff --git a/source/blender/editors/transform/transform_gizmo_2d.c b/source/blender/editors/transform/transform_gizmo_2d.c index c63e90ac2b7..dacdb72806c 100644 --- a/source/blender/editors/transform/transform_gizmo_2d.c +++ b/source/blender/editors/transform/transform_gizmo_2d.c @@ -26,14 +26,12 @@ #include "BLI_math.h" -#include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_screen_types.h" #include "DNA_space_types.h" #include "DNA_view3d_types.h" #include "BKE_context.h" -#include "BKE_editmesh.h" #include "BKE_layer.h" #include "RNA_access.h" @@ -44,7 +42,6 @@ #include "WM_api.h" #include "WM_message.h" #include "WM_types.h" -#include "wm.h" /* XXX */ #include "ED_gizmo_library.h" #include "ED_gizmo_utils.h" diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c index 4c561037986..3878103fa4e 100644 --- a/source/blender/editors/transform/transform_gizmo_3d.c +++ b/source/blender/editors/transform/transform_gizmo_3d.c @@ -39,7 +39,6 @@ #include "BLI_array_utils.h" #include "BLI_listbase.h" #include "BLI_math.h" -#include "BLI_string.h" #include "BLI_utildefines.h" #include "BKE_action.h" @@ -48,25 +47,20 @@ #include "BKE_editmesh.h" #include "BKE_global.h" #include "BKE_gpencil.h" -#include "BKE_lattice.h" #include "BKE_layer.h" #include "BKE_object.h" #include "BKE_paint.h" -#include "BKE_particle.h" #include "BKE_pointcache.h" #include "BKE_scene.h" -#include "BKE_workspace.h" #include "DEG_depsgraph.h" #include "WM_api.h" #include "WM_message.h" -#include "WM_toolsystem.h" #include "WM_types.h" #include "wm.h" #include "ED_armature.h" -#include "ED_curve.h" #include "ED_gizmo_library.h" #include "ED_gizmo_utils.h" #include "ED_gpencil.h" @@ -90,8 +84,6 @@ #include "GPU_state.h" -#include "DEG_depsgraph_query.h" - /* return codes for select, and drawing flags */ #define MAN_TRANS_X (1 << 0) diff --git a/source/blender/editors/transform/transform_gizmo_extrude_3d.c b/source/blender/editors/transform/transform_gizmo_extrude_3d.c index e6e74668c2c..7f6f3e53bc3 100644 --- a/source/blender/editors/transform/transform_gizmo_extrude_3d.c +++ b/source/blender/editors/transform/transform_gizmo_extrude_3d.c @@ -38,7 +38,6 @@ #include "ED_gizmo_utils.h" #include "ED_screen.h" #include "ED_transform.h" -#include "ED_view3d.h" #include "UI_resources.h" diff --git a/source/blender/editors/transform/transform_mode.c b/source/blender/editors/transform/transform_mode.c index e1fd22f06be..f028044809f 100644 --- a/source/blender/editors/transform/transform_mode.c +++ b/source/blender/editors/transform/transform_mode.c @@ -39,8 +39,6 @@ #include "RNA_access.h" -#include "ED_screen.h" - #include "UI_interface.h" #include "BLT_translation.h" diff --git a/source/blender/editors/transform/transform_mode.h b/source/blender/editors/transform/transform_mode.h index 074e89390c2..464deff983b 100644 --- a/source/blender/editors/transform/transform_mode.h +++ b/source/blender/editors/transform/transform_mode.h @@ -94,7 +94,6 @@ void initNormalRotation(TransInfo *t); void initSeqSlide(TransInfo *t); /* transform_mode_edge_slide.c */ -void projectEdgeSlideData(TransInfo *t, bool is_final); void drawEdgeSlide(TransInfo *t); void doEdgeSlide(TransInfo *t, float perc); void initEdgeSlide_ex( @@ -153,7 +152,6 @@ void initTrackball(TransInfo *t); void initTranslation(TransInfo *t); /* transform_mode_vert_slide.c */ -void projectVertSlideData(TransInfo *t, bool is_final); void drawVertSlide(TransInfo *t); void doVertSlide(TransInfo *t, float perc); void initVertSlide_ex(TransInfo *t, bool use_even, bool flipped, bool use_clamp); diff --git a/source/blender/editors/transform/transform_mode_edge_slide.c b/source/blender/editors/transform/transform_mode_edge_slide.c index 9f9e5742ffe..42f75f041b9 100644 --- a/source/blender/editors/transform/transform_mode_edge_slide.c +++ b/source/blender/editors/transform/transform_mode_edge_slide.c @@ -519,7 +519,7 @@ static void calcEdgeSlide_even(TransInfo *t, } } -static bool createEdgeSlideVerts_double_side(TransInfo *t, TransDataContainer *tc) +static EdgeSlideData *createEdgeSlideVerts_double_side(TransInfo *t, TransDataContainer *tc) { BMEditMesh *em = BKE_editmesh_from_object(tc->obedit); BMesh *bm = em->bm; @@ -554,8 +554,9 @@ static bool createEdgeSlideVerts_double_side(TransInfo *t, TransDataContainer *t } if (numsel == 0 || numsel > 2) { + /* Invalid edge selection. */ MEM_freeN(sld); - return false; /* invalid edge selection */ + return NULL; } } } @@ -566,7 +567,7 @@ static bool createEdgeSlideVerts_double_side(TransInfo *t, TransDataContainer *t if (!BM_edge_is_manifold(e) && !BM_edge_is_boundary(e)) { /* can edges with at least once face user */ MEM_freeN(sld); - return false; + return NULL; } } } @@ -595,7 +596,7 @@ static bool createEdgeSlideVerts_double_side(TransInfo *t, TransDataContainer *t if (!j) { MEM_freeN(sld); MEM_freeN(sv_table); - return false; + return NULL; } sv_tot = j; } @@ -870,18 +871,16 @@ static bool createEdgeSlideVerts_double_side(TransInfo *t, TransDataContainer *t calcEdgeSlide_even(t, tc, sld, mval); } - tc->custom.mode.data = sld; - MEM_freeN(sv_table); - return true; + return sld; } /** * A simple version of #createEdgeSlideVerts_double_side * Which assumes the longest unselected. */ -static bool createEdgeSlideVerts_single_side(TransInfo *t, TransDataContainer *tc) +static EdgeSlideData *createEdgeSlideVerts_single_side(TransInfo *t, TransDataContainer *tc) { BMEditMesh *em = BKE_editmesh_from_object(tc->obedit); BMesh *bm = em->bm; @@ -933,7 +932,7 @@ static bool createEdgeSlideVerts_single_side(TransInfo *t, TransDataContainer *t if (!j) { MEM_freeN(sld); - return false; + return NULL; } sv_tot = j; @@ -1055,24 +1054,9 @@ static bool createEdgeSlideVerts_single_side(TransInfo *t, TransDataContainer *t calcEdgeSlide_even(t, tc, sld, mval); } - tc->custom.mode.data = sld; - MEM_freeN(sv_table); - return true; -} - -void projectEdgeSlideData(TransInfo *t, bool is_final) -{ - FOREACH_TRANS_DATA_CONTAINER (t, tc) { - EdgeSlideData *sld = tc->custom.mode.data; - - if (sld == NULL) { - continue; - } - - trans_mesh_customdata_correction_apply(tc, is_final); - } + return sld; } static void freeEdgeSlideVerts(TransInfo *UNUSED(t), @@ -1450,12 +1434,14 @@ void initEdgeSlide_ex( if (use_double_side) { FOREACH_TRANS_DATA_CONTAINER (t, tc) { - ok |= createEdgeSlideVerts_double_side(t, tc); - } - } - else { - FOREACH_TRANS_DATA_CONTAINER (t, tc) { - ok |= createEdgeSlideVerts_single_side(t, tc); + sld = use_double_side ? createEdgeSlideVerts_double_side(t, tc) : + createEdgeSlideVerts_single_side(t, tc); + if (sld) { + tc->custom.mode.data = sld; + tc->custom.mode.free_cb = freeEdgeSlideVerts; + trans_mesh_customdata_correction_init(t, tc); + ok = true; + } } } @@ -1464,16 +1450,6 @@ void initEdgeSlide_ex( return; } - FOREACH_TRANS_DATA_CONTAINER (t, tc) { - sld = tc->custom.mode.data; - if (!sld) { - continue; - } - tc->custom.mode.free_cb = freeEdgeSlideVerts; - } - - trans_mesh_customdata_correction_init(t); - /* set custom point first if you want value to be initialized by init */ calcEdgeSlideCustomPoints(t); initMouseInputMode(t, &t->mouse, INPUT_CUSTOM_RATIO_FLIP); diff --git a/source/blender/editors/transform/transform_mode_timetranslate.c b/source/blender/editors/transform/transform_mode_timetranslate.c index c514df497bc..28eaff8c136 100644 --- a/source/blender/editors/transform/transform_mode_timetranslate.c +++ b/source/blender/editors/transform/transform_mode_timetranslate.c @@ -29,7 +29,6 @@ #include "BLI_string.h" #include "BKE_context.h" -#include "BKE_nla.h" #include "BKE_unit.h" #include "ED_screen.h" diff --git a/source/blender/editors/transform/transform_mode_vert_slide.c b/source/blender/editors/transform/transform_mode_vert_slide.c index 7bee48337f9..62415b1ddc6 100644 --- a/source/blender/editors/transform/transform_mode_vert_slide.c +++ b/source/blender/editors/transform/transform_mode_vert_slide.c @@ -197,7 +197,7 @@ static void calcVertSlideMouseActiveEdges(struct TransInfo *t, const int mval[2] } } -static bool createVertSlideVerts(TransInfo *t, TransDataContainer *tc) +static VertSlideData *createVertSlideVerts(TransInfo *t, const TransDataContainer *tc) { BMEditMesh *em = BKE_editmesh_from_object(tc->obedit); BMesh *bm = em->bm; @@ -234,7 +234,7 @@ static bool createVertSlideVerts(TransInfo *t, TransDataContainer *tc) if (!j) { MEM_freeN(sld); - return false; + return NULL; } sv_array = MEM_callocN(sizeof(TransDataVertSlideVert) * j, "sv_array"); @@ -272,8 +272,6 @@ static bool createVertSlideVerts(TransInfo *t, TransDataContainer *tc) sld->sv = sv_array; sld->totsv = j; - tc->custom.mode.data = sld; - /* most likely will be set below */ unit_m4(sld->proj_mat); @@ -288,13 +286,7 @@ static bool createVertSlideVerts(TransInfo *t, TransDataContainer *tc) } } - /* XXX, calc vert slide across all objects */ - if (tc == t->data_container) { - calcVertSlideMouseActiveVert(t, t->mval); - calcVertSlideMouseActiveEdges(t, t->mval); - } - - return true; + return sld; } static void freeVertSlideVerts(TransInfo *UNUSED(t), @@ -381,13 +373,6 @@ static eRedrawFlag handleEventVertSlide(struct TransInfo *t, const struct wmEven return TREDRAW_NOTHING; } -void projectVertSlideData(TransInfo *t, bool is_final) -{ - FOREACH_TRANS_DATA_CONTAINER (t, tc) { - trans_mesh_customdata_correction_apply(tc, is_final); - } -} - void drawVertSlide(TransInfo *t) { if ((t->mode == TFM_VERT_SLIDE) && TRANS_DATA_CONTAINER_FIRST_OK(t)->custom.mode.data) { @@ -628,10 +613,12 @@ void initVertSlide_ex(TransInfo *t, bool use_even, bool flipped, bool use_clamp) bool ok = false; FOREACH_TRANS_DATA_CONTAINER (t, tc) { - ok |= createVertSlideVerts(t, tc); - VertSlideData *sld = tc->custom.mode.data; + VertSlideData *sld = createVertSlideVerts(t, tc); if (sld) { + tc->custom.mode.data = sld; tc->custom.mode.free_cb = freeVertSlideVerts; + trans_mesh_customdata_correction_init(t, tc); + ok = true; } } @@ -640,7 +627,8 @@ void initVertSlide_ex(TransInfo *t, bool use_even, bool flipped, bool use_clamp) return; } - trans_mesh_customdata_correction_init(t); + calcVertSlideMouseActiveVert(t, t->mval); + calcVertSlideMouseActiveEdges(t, t->mval); /* set custom point first if you want value to be initialized by init */ calcVertSlideCustomPoints(t); diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index d643244e6ca..95249f4d17b 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -20,7 +20,6 @@ #include "MEM_guardedalloc.h" -#include "DNA_mesh_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" @@ -32,7 +31,6 @@ #include "BKE_context.h" #include "BKE_editmesh.h" #include "BKE_global.h" -#include "BKE_layer.h" #include "BKE_report.h" #include "BKE_scene.h" diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index cd170b144d8..493b52495db 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -32,7 +32,6 @@ #include "DNA_screen_types.h" #include "DNA_space_types.h" #include "DNA_view3d_types.h" -#include "DNA_workspace_types.h" #include "BLI_listbase.h" #include "BLI_math.h" @@ -47,7 +46,6 @@ #include "BKE_layer.h" #include "BKE_report.h" #include "BKE_scene.h" -#include "BKE_workspace.h" #include "BLT_translation.h" diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 4f942221f79..b508507cd4e 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -28,7 +28,6 @@ #include "PIL_time.h" -#include "DNA_meshdata_types.h" /* Temporary, for snapping to other unselected meshes */ #include "DNA_node_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" @@ -45,10 +44,8 @@ #include "GPU_state.h" #include "BKE_context.h" -#include "BKE_duplilist.h" #include "BKE_editmesh.h" #include "BKE_layer.h" -#include "BKE_main.h" #include "BKE_object.h" #include "BKE_sequencer.h" @@ -57,15 +54,12 @@ #include "WM_types.h" #include "ED_gizmo_library.h" -#include "ED_image.h" #include "ED_markers.h" #include "ED_node.h" #include "ED_transform_snap_object_context.h" #include "ED_uvedit.h" #include "ED_view3d.h" -#include "DEG_depsgraph.h" - #include "UI_resources.h" #include "UI_view2d.h" diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c index c30b8d59dc0..08ef5109a74 100644 --- a/source/blender/editors/transform/transform_snap_object.c +++ b/source/blender/editors/transform/transform_snap_object.c @@ -44,7 +44,6 @@ #include "BKE_duplilist.h" #include "BKE_editmesh.h" #include "BKE_layer.h" -#include "BKE_main.h" #include "BKE_mesh.h" #include "BKE_mesh_runtime.h" #include "BKE_object.h" @@ -56,8 +55,6 @@ #include "ED_transform_snap_object_context.h" #include "ED_view3d.h" -#include "ED_transform.h" - /* -------------------------------------------------------------------- */ /** \name Internal Data Types * \{ */ diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index c4dcaaaa8b2..3227a9557e6 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -1824,7 +1824,7 @@ void UV_OT_unwrap(wmOperatorType *ot) ot->srna, "use_subsurf_data", 0, - "Use Subsurf Modifier", + "Use Subdivision Surface", "Map UVs taking vertex position after Subdivision Surface modifier has been applied"); RNA_def_float_factor( ot->srna, "margin", 0.001f, 0.0f, 1.0f, "Margin", "Space between islands", 0.0f, 1.0f); diff --git a/source/blender/io/alembic/ABC_alembic.h b/source/blender/io/alembic/ABC_alembic.h index ccc53c589fb..ba430752b29 100644 --- a/source/blender/io/alembic/ABC_alembic.h +++ b/source/blender/io/alembic/ABC_alembic.h @@ -35,11 +35,6 @@ struct bContext; typedef struct AbcArchiveHandle AbcArchiveHandle; -enum { - ABC_ARCHIVE_OGAWA = 0, - ABC_ARCHIVE_HDF5 = 1, -}; - int ABC_get_version(void); struct AlembicExportParams { @@ -68,8 +63,6 @@ struct AlembicExportParams { bool export_hair; bool export_particles; - unsigned int compression_type : 1; - /* See MOD_TRIANGULATE_NGON_xxx and MOD_TRIANGULATE_QUAD_xxx * in DNA_modifier_types.h */ int quad_method; diff --git a/source/blender/io/alembic/CMakeLists.txt b/source/blender/io/alembic/CMakeLists.txt index 6de7d327d4e..16f2d944876 100644 --- a/source/blender/io/alembic/CMakeLists.txt +++ b/source/blender/io/alembic/CMakeLists.txt @@ -36,7 +36,6 @@ set(INC set(INC_SYS ${ALEMBIC_INCLUDE_DIRS} ${BOOST_INCLUDE_DIR} - ${HDF5_INCLUDE_DIRS} ${OPENEXR_INCLUDE_DIRS} ) @@ -98,13 +97,6 @@ set(LIB ${OPENEXR_LIBRARIES} ) -if(WITH_ALEMBIC_HDF5) - add_definitions(-DWITH_ALEMBIC_HDF5) - list(APPEND LIB - ${HDF5_LIBRARIES} - ) -endif() - list(APPEND LIB ${BOOST_LIBRARIES} ) diff --git a/source/blender/io/alembic/intern/abc_exporter.cc b/source/blender/io/alembic/intern/abc_exporter.cc index dbf24452b78..8dad8dff199 100644 --- a/source/blender/io/alembic/intern/abc_exporter.cc +++ b/source/blender/io/alembic/intern/abc_exporter.cc @@ -93,7 +93,6 @@ ExportSettings::ExportSettings() apply_subdiv(false), use_subdiv_schema(false), export_child_hairs(true), - export_ogawa(true), pack_uv(false), triangulate(false), quad_method(0), @@ -276,8 +275,7 @@ void AbcExporter::operator()(short *do_update, float *progress, bool *was_cancel abc_scene_name = "untitled"; } - m_writer = new ArchiveWriter( - m_filename, abc_scene_name, m_settings.scene, m_settings.export_ogawa); + m_writer = new ArchiveWriter(m_filename, abc_scene_name, m_settings.scene); /* Create time samplings for transforms and shapes. */ diff --git a/source/blender/io/alembic/intern/abc_exporter.h b/source/blender/io/alembic/intern/abc_exporter.h index 398004d2ec5..049ccb291bd 100644 --- a/source/blender/io/alembic/intern/abc_exporter.h +++ b/source/blender/io/alembic/intern/abc_exporter.h @@ -73,7 +73,6 @@ struct ExportSettings { bool curves_as_mesh; bool use_subdiv_schema; bool export_child_hairs; - bool export_ogawa; bool pack_uv; bool triangulate; diff --git a/source/blender/io/alembic/intern/abc_reader_archive.cc b/source/blender/io/alembic/intern/abc_reader_archive.cc index 563466d81bc..d55736f732a 100644 --- a/source/blender/io/alembic/intern/abc_reader_archive.cc +++ b/source/blender/io/alembic/intern/abc_reader_archive.cc @@ -40,11 +40,8 @@ using Alembic::Abc::IArchive; using Alembic::Abc::kWrapExisting; static IArchive open_archive(const std::string &filename, - const std::vector<std::istream *> &input_streams, - bool &is_hdf5) + const std::vector<std::istream *> &input_streams) { - is_hdf5 = false; - try { Alembic::AbcCoreOgawa::ReadArchive archive_reader(input_streams); @@ -53,22 +50,7 @@ static IArchive open_archive(const std::string &filename, catch (const Exception &e) { std::cerr << e.what() << '\n'; -#ifdef WITH_ALEMBIC_HDF5 - try { - is_hdf5 = true; - Alembic::AbcCoreAbstract::ReadArraySampleCachePtr cache_ptr; - - return IArchive(Alembic::AbcCoreHDF5::ReadArchive(), - filename.c_str(), - ErrorHandler::kThrowPolicy, - cache_ptr); - } - catch (const Exception &) { - std::cerr << e.what() << '\n'; - return IArchive(); - } -#else - /* Inspect the file to see whether it's really a HDF5 file. */ + /* Inspect the file to see whether it's actually a HDF5 file. */ char header[4]; /* char(0x89) + "HDF" */ std::ifstream the_file(filename.c_str(), std::ios::in | std::ios::binary); if (!the_file) { @@ -81,16 +63,12 @@ static IArchive open_archive(const std::string &filename, std::cerr << filename << " has an unknown file format, unable to read." << std::endl; } else { - is_hdf5 = true; std::cerr << filename << " is in the obsolete HDF5 format, unable to read." << std::endl; } if (the_file.is_open()) { the_file.close(); } - - return IArchive(); -#endif } return IArchive(); @@ -113,18 +91,7 @@ ArchiveReader::ArchiveReader(struct Main *bmain, const char *filename) m_streams.push_back(&m_infile); - m_archive = open_archive(abs_filename, m_streams, m_is_hdf5); - - /* We can't open an HDF5 file from a stream, so close it. */ - if (m_is_hdf5) { - m_infile.close(); - m_streams.clear(); - } -} - -bool ArchiveReader::is_hdf5() const -{ - return m_is_hdf5; + m_archive = open_archive(abs_filename, m_streams); } bool ArchiveReader::valid() const diff --git a/source/blender/io/alembic/intern/abc_reader_archive.h b/source/blender/io/alembic/intern/abc_reader_archive.h index 35273e10108..304c876adce 100644 --- a/source/blender/io/alembic/intern/abc_reader_archive.h +++ b/source/blender/io/alembic/intern/abc_reader_archive.h @@ -25,11 +25,6 @@ #define __ABC_READER_ARCHIVE_H__ #include <Alembic/Abc/All.h> - -#ifdef WITH_ALEMBIC_HDF5 -# include <Alembic/AbcCoreHDF5/All.h> -#endif - #include <Alembic/AbcCoreOgawa/All.h> #include <fstream> @@ -46,21 +41,12 @@ class ArchiveReader { Alembic::Abc::IArchive m_archive; std::ifstream m_infile; std::vector<std::istream *> m_streams; - bool m_is_hdf5; public: ArchiveReader(struct Main *bmain, const char *filename); bool valid() const; - /** - * Returns true when either Blender is compiled with HDF5 support and - * the archive was successfully opened (valid() will also return true), - * or when Blender was built without HDF5 support but a HDF5 file was - * detected (valid() will return false). - */ - bool is_hdf5() const; - Alembic::Abc::IObject getTop(); }; diff --git a/source/blender/io/alembic/intern/abc_writer_archive.cc b/source/blender/io/alembic/intern/abc_writer_archive.cc index e7dee536cb9..40926532f85 100644 --- a/source/blender/io/alembic/intern/abc_writer_archive.cc +++ b/source/blender/io/alembic/intern/abc_writer_archive.cc @@ -43,10 +43,8 @@ using Alembic::Abc::OArchive; /* This kinda duplicates CreateArchiveWithInfo, but Alembic does not seem to * have a version supporting streams. */ static OArchive create_archive(std::ostream *ostream, - const std::string &filename, const std::string &scene_name, - double scene_fps, - bool ogawa) + double scene_fps) { Alembic::Abc::MetaData abc_metadata; @@ -73,38 +71,25 @@ static OArchive create_archive(std::ostream *ostream, abc_metadata.set(Alembic::Abc::kDateWrittenKey, buffer); ErrorHandler::Policy policy = ErrorHandler::kThrowPolicy; - -#ifdef WITH_ALEMBIC_HDF5 - if (!ogawa) { - return OArchive(Alembic::AbcCoreHDF5::WriteArchive(), filename, abc_metadata, policy); - } -#else - static_cast<void>(filename); - static_cast<void>(ogawa); -#endif - Alembic::AbcCoreOgawa::WriteArchive archive_writer; return OArchive(archive_writer(ostream, abc_metadata), kWrapExisting, policy); } ArchiveWriter::ArchiveWriter(const char *filename, const std::string &abc_scene_name, - const Scene *scene, - bool do_ogawa) + const Scene *scene) { /* Use stream to support unicode character paths on Windows. */ - if (do_ogawa) { #ifdef WIN32 - UTF16_ENCODE(filename); - std::wstring wstr(filename_16); - m_outfile.open(wstr.c_str(), std::ios::out | std::ios::binary); - UTF16_UN_ENCODE(filename); + UTF16_ENCODE(filename); + std::wstring wstr(filename_16); + m_outfile.open(wstr.c_str(), std::ios::out | std::ios::binary); + UTF16_UN_ENCODE(filename); #else - m_outfile.open(filename, std::ios::out | std::ios::binary); + m_outfile.open(filename, std::ios::out | std::ios::binary); #endif - } - m_archive = create_archive(&m_outfile, filename, abc_scene_name, FPS, do_ogawa); + m_archive = create_archive(&m_outfile, abc_scene_name, FPS); } OArchive &ArchiveWriter::archive() diff --git a/source/blender/io/alembic/intern/abc_writer_archive.h b/source/blender/io/alembic/intern/abc_writer_archive.h index 82b0e98b376..737717c1710 100644 --- a/source/blender/io/alembic/intern/abc_writer_archive.h +++ b/source/blender/io/alembic/intern/abc_writer_archive.h @@ -25,11 +25,6 @@ #define __ABC_WRITER_ARCHIVE_H__ #include <Alembic/Abc/All.h> - -#ifdef WITH_ALEMBIC_HDF5 -# include <Alembic/AbcCoreHDF5/All.h> -#endif - #include <Alembic/AbcCoreOgawa/All.h> #include <fstream> @@ -47,10 +42,7 @@ class ArchiveWriter { Alembic::Abc::OArchive m_archive; public: - ArchiveWriter(const char *filename, - const std::string &abc_scene_name, - const Scene *scene, - bool do_ogawa); + ArchiveWriter(const char *filename, const std::string &abc_scene_name, const Scene *scene); Alembic::Abc::OArchive &archive(); }; diff --git a/source/blender/io/alembic/intern/alembic_capi.cc b/source/blender/io/alembic/intern/alembic_capi.cc index 6ca9e82a26c..a30b15fee5f 100644 --- a/source/blender/io/alembic/intern/alembic_capi.cc +++ b/source/blender/io/alembic/intern/alembic_capi.cc @@ -373,7 +373,6 @@ bool ABC_export(Scene *scene, job->settings.renderable_only = params->renderable_only; job->settings.use_subdiv_schema = params->use_subdiv_schema; - job->settings.export_ogawa = (params->compression_type == ABC_ARCHIVE_OGAWA); job->settings.pack_uv = params->packuv; job->settings.global_scale = params->global_scale; job->settings.triangulate = params->triangulate; @@ -620,7 +619,6 @@ static std::pair<bool, AbcObjectReader *> visit_object( enum { ABC_NO_ERROR = 0, ABC_ARCHIVE_FAIL, - ABC_UNSUPPORTED_HDF5, }; struct ImportJobData { @@ -659,11 +657,7 @@ static void import_startjob(void *user_data, short *stop, short *do_update, floa ArchiveReader *archive = new ArchiveReader(data->bmain, data->filename); if (!archive->valid()) { -#ifndef WITH_ALEMBIC_HDF5 - data->error_code = archive->is_hdf5() ? ABC_UNSUPPORTED_HDF5 : ABC_ARCHIVE_FAIL; -#else data->error_code = ABC_ARCHIVE_FAIL; -#endif delete archive; return; } @@ -850,9 +844,6 @@ static void import_endjob(void *user_data) case ABC_ARCHIVE_FAIL: WM_report(RPT_ERROR, "Could not open Alembic archive for reading! See console for detail."); break; - case ABC_UNSUPPORTED_HDF5: - WM_report(RPT_ERROR, "Alembic archive in obsolete HDF5 format is not supported."); - break; } WM_main_add_notifier(NC_SCENE | ND_FRAME, data->scene); diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index eb02352f49b..f40fba27958 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -729,6 +729,15 @@ typedef enum IDRecalcFlag { * input file or for color space changes. */ ID_RECALC_SOURCE = (1 << 23), + /* Virtual recalc tag/marker required for undo in some cases, where actual data does not change + * and hence do not require an update, but conceptually we are dealing with something new. + * + * Current known case: linked IDs made local without requiring any copy. While their users do not + * require any update, they have actually been 'virtually' remapped from the linked ID to the + * local one. + */ + ID_RECALC_TAG_FOR_UNDO = (1 << 24), + /*************************************************************************** * Pseudonyms, to have more semantic meaning in the actual code without * using too much low-level and implementation specific tags. */ diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h index b6bae805636..0c462ba6766 100644 --- a/source/blender/makesrna/RNA_enum_types.h +++ b/source/blender/makesrna/RNA_enum_types.h @@ -225,7 +225,6 @@ extern const EnumPropertyItem rna_enum_dt_mix_mode_items[]; extern const EnumPropertyItem rna_enum_dt_layers_select_src_items[]; extern const EnumPropertyItem rna_enum_dt_layers_select_dst_items[]; -extern const EnumPropertyItem rna_enum_abc_compression_items[]; extern const EnumPropertyItem rna_enum_context_mode_items[]; extern const EnumPropertyItem rna_enum_curveprofile_preset_items[]; diff --git a/source/blender/makesrna/intern/rna_collection.c b/source/blender/makesrna/intern/rna_collection.c index fbc2b871026..9c6c95f2819 100644 --- a/source/blender/makesrna/intern/rna_collection.c +++ b/source/blender/makesrna/intern/rna_collection.c @@ -86,7 +86,7 @@ static void rna_Collection_objects_link(Collection *collection, if (ID_IS_OVERRIDE_LIBRARY(&collection->id)) { BKE_reportf(reports, RPT_ERROR, - "Could not link the object '%s' because the collection '%s' is overridden.", + "Could not link the object '%s' because the collection '%s' is overridden", object->id.name + 2, collection->id.name + 2); return; @@ -94,7 +94,7 @@ static void rna_Collection_objects_link(Collection *collection, if (ID_IS_LINKED(&collection->id)) { BKE_reportf(reports, RPT_ERROR, - "Could not link the object '%s' because the collection '%s' is linked.", + "Could not link the object '%s' because the collection '%s' is linked", object->id.name + 2, collection->id.name + 2); return; diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index a7faef520bf..ffd9bb772cc 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -1742,7 +1742,7 @@ static void rna_def_modifier_subsurf(BlenderRNA *brna) PropertyRNA *prop; srna = RNA_def_struct(brna, "SubsurfModifier", "Modifier"); - RNA_def_struct_ui_text(srna, "Subsurf Modifier", "Subdivision surface modifier"); + RNA_def_struct_ui_text(srna, "Subdivision Surface Modifier", "Subdivision surface modifier"); RNA_def_struct_sdna(srna, "SubsurfModifierData"); RNA_def_struct_ui_icon(srna, ICON_MOD_SUBSURF); @@ -6158,7 +6158,8 @@ static void rna_def_modifier_wireframe(BlenderRNA *brna) prop = RNA_def_property(srna, "use_crease", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WIREFRAME_CREASE); - RNA_def_property_ui_text(prop, "Offset Relative", "Crease hub edges for improved subsurf"); + RNA_def_property_ui_text( + prop, "Offset Relative", "Crease hub edges for improved subdivision surface"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop = RNA_def_property(srna, "crease_weight", PROP_FLOAT, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 73b3515030e..88bc9843bc0 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -3360,7 +3360,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop, "Use Modifier Stack", "Emit particles from mesh with modifiers applied " - "(must use same subsurf level for viewport and render for correct results)"); + "(must use same subdivision surface level for viewport and render for correct results)"); RNA_def_property_update(prop, 0, "rna_Particle_change_type"); /* draw objects & collections */ diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 7e9753b090a..edbf4c90524 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -7236,7 +7236,7 @@ static void rna_def_scene_gpencil(BlenderRNA *brna) RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3); RNA_def_property_ui_text(prop, "Anti-Aliasing Threshold", - "Threshold for edge detection algorithm (higher values might overblur " + "Threshold for edge detection algorithm (higher values might over-blur " "some part of the image)"); RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index 1d03b16d5bb..e9c59fc5011 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -41,13 +41,6 @@ # include "ABC_alembic.h" #endif -const EnumPropertyItem rna_enum_abc_compression_items[] = { -#ifdef WITH_ALEMBIC - {ABC_ARCHIVE_OGAWA, "OGAWA", 0, "Ogawa", ""}, - {ABC_ARCHIVE_HDF5, "HDF5", 0, "HDF5", ""}, -#endif - {0, NULL, 0, NULL, NULL}}; - #ifdef RNA_RUNTIME # include "BKE_editmesh.h" @@ -222,7 +215,6 @@ static void rna_Scene_alembic_export(Scene *scene, bool use_subdiv_schema, bool export_hair, bool export_particles, - int compression_type, bool packuv, float scale, bool triangulate, @@ -257,7 +249,6 @@ static void rna_Scene_alembic_export(Scene *scene, .use_subdiv_schema = use_subdiv_schema, .export_hair = export_hair, .export_particles = export_particles, - .compression_type = compression_type, .packuv = packuv, .triangulate = triangulate, .quad_method = quad_method, @@ -410,7 +401,6 @@ void RNA_api_scene(StructRNA *srna) func, "export_hair", 1, "Export Hair", "Exports hair particle systems as animated curves"); RNA_def_boolean( func, "export_particles", 1, "Export Particles", "Exports non-hair particle systems"); - RNA_def_enum(func, "compression_type", rna_enum_abc_compression_items, 0, "Compression", ""); RNA_def_boolean( func, "packuv", 0, "Export with packed UV islands", "Export with packed UV islands"); RNA_def_float( diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 1449c410d18..5228f00d0de 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -227,6 +227,9 @@ static void rna_Panel_unregister(Main *bmain, StructRNA *type) } } } + /* The unregistered panel might have had a template that added instanced panels, + * so remove them just in case. They can be re-added on redraw anyway. */ + UI_panels_free_instanced(NULL, region); } } } @@ -1290,7 +1293,7 @@ static void rna_def_panel(BlenderRNA *brna) 0, "Instanced Panel", "Multiple panels with this type can be used as part of a list depending on data external " - "to the UI. Used to create panels for the modifiers and other stacks."}, + "to the UI. Used to create panels for the modifiers and other stacks"}, {PNL_LAYOUT_HEADER_EXPAND, "HEADER_LAYOUT_EXPAND", 0, diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index 78db7de2ac2..460f697a0a9 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -25,6 +25,7 @@ set(INC ../blenkernel ../blentranslation ../blenlib + ../blenloader ../bmesh ../depsgraph ../editors/include @@ -34,6 +35,9 @@ set(INC ../windowmanager ../../../intern/eigen ../../../intern/guardedalloc + + # dna_type_offsets.h in BLO_read_write.h + ${CMAKE_BINARY_DIR}/source/blender/makesdna/intern ) set(INC_SYS diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c index 0cc0680804e..9cc1f4596a9 100644 --- a/source/blender/modifiers/intern/MOD_armature.c +++ b/source/blender/modifiers/intern/MOD_armature.c @@ -292,4 +292,6 @@ ModifierTypeInfo modifierType_Armature = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index 68e12a8bbef..e1f271e83c3 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -1038,4 +1038,6 @@ ModifierTypeInfo modifierType_Array = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 76b8985975e..35e3bb97fc3 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -446,4 +446,6 @@ ModifierTypeInfo modifierType_Bevel = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* uiPanel */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c index c2412b295ff..8a04e288f10 100644 --- a/source/blender/modifiers/intern/MOD_boolean.c +++ b/source/blender/modifiers/intern/MOD_boolean.c @@ -413,4 +413,6 @@ ModifierTypeInfo modifierType_Boolean = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c index 93f97c7c5b8..be0ca6af032 100644 --- a/source/blender/modifiers/intern/MOD_build.c +++ b/source/blender/modifiers/intern/MOD_build.c @@ -360,4 +360,6 @@ ModifierTypeInfo modifierType_Build = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c index e2653701970..9f588a4d345 100644 --- a/source/blender/modifiers/intern/MOD_cast.c +++ b/source/blender/modifiers/intern/MOD_cast.c @@ -607,4 +607,6 @@ ModifierTypeInfo modifierType_Cast = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c index c7551b1be00..f3ee14e0206 100644 --- a/source/blender/modifiers/intern/MOD_cloth.c +++ b/source/blender/modifiers/intern/MOD_cloth.c @@ -312,4 +312,6 @@ ModifierTypeInfo modifierType_Cloth = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index c58ba3b62dc..7a338b59e98 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -299,4 +299,6 @@ ModifierTypeInfo modifierType_Collision = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_correctivesmooth.c b/source/blender/modifiers/intern/MOD_correctivesmooth.c index f277e8bc12c..ba343854d41 100644 --- a/source/blender/modifiers/intern/MOD_correctivesmooth.c +++ b/source/blender/modifiers/intern/MOD_correctivesmooth.c @@ -847,4 +847,6 @@ ModifierTypeInfo modifierType_CorrectiveSmooth = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c index a13bb07f678..760e4717b6d 100644 --- a/source/blender/modifiers/intern/MOD_curve.c +++ b/source/blender/modifiers/intern/MOD_curve.c @@ -241,4 +241,6 @@ ModifierTypeInfo modifierType_Curve = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_datatransfer.c b/source/blender/modifiers/intern/MOD_datatransfer.c index e9436147649..0b205ec4fc5 100644 --- a/source/blender/modifiers/intern/MOD_datatransfer.c +++ b/source/blender/modifiers/intern/MOD_datatransfer.c @@ -506,4 +506,6 @@ ModifierTypeInfo modifierType_DataTransfer = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c index 5b494baea1a..4fa7bf4cd63 100644 --- a/source/blender/modifiers/intern/MOD_decimate.c +++ b/source/blender/modifiers/intern/MOD_decimate.c @@ -307,4 +307,6 @@ ModifierTypeInfo modifierType_Decimate = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index 7c119f4b128..32e36fbd09e 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -528,4 +528,6 @@ ModifierTypeInfo modifierType_Displace = { /* foreachTexLink */ foreachTexLink, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_dynamicpaint.c b/source/blender/modifiers/intern/MOD_dynamicpaint.c index f8a100f1f0a..0706d4259bd 100644 --- a/source/blender/modifiers/intern/MOD_dynamicpaint.c +++ b/source/blender/modifiers/intern/MOD_dynamicpaint.c @@ -232,4 +232,6 @@ ModifierTypeInfo modifierType_DynamicPaint = { /* foreachTexLink */ foreachTexLink, /* freeRuntimeData */ freeRuntimeData, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c index 0134b5c9d64..b166a140ddc 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -196,4 +196,6 @@ ModifierTypeInfo modifierType_EdgeSplit = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index f2e476f85aa..00e39a7ea6c 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -1257,4 +1257,6 @@ ModifierTypeInfo modifierType_Explode = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_fluid.c b/source/blender/modifiers/intern/MOD_fluid.c index 0ef062d72d5..3cc5280100a 100644 --- a/source/blender/modifiers/intern/MOD_fluid.c +++ b/source/blender/modifiers/intern/MOD_fluid.c @@ -252,4 +252,6 @@ ModifierTypeInfo modifierType_Fluid = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index 2eff026c040..4305c32071d 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -498,4 +498,6 @@ ModifierTypeInfo modifierType_Hook = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_laplaciandeform.c b/source/blender/modifiers/intern/MOD_laplaciandeform.c index c6b36212857..e2646e77af9 100644 --- a/source/blender/modifiers/intern/MOD_laplaciandeform.c +++ b/source/blender/modifiers/intern/MOD_laplaciandeform.c @@ -49,6 +49,8 @@ #include "UI_interface.h" #include "UI_resources.h" +#include "BLO_read_write.h" + #include "RNA_access.h" #include "MOD_ui_common.h" @@ -855,6 +857,21 @@ static void panelRegister(ARegionType *region_type) modifier_panel_register(region_type, eModifierType_LaplacianDeform, panel_draw); } +static void blendWrite(BlendWriter *writer, const ModifierData *md) +{ + LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)md; + + BLO_write_float3_array(writer, lmd->total_verts, lmd->vertexco); +} + +static void blendRead(BlendDataReader *reader, ModifierData *md) +{ + LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)md; + + BLO_read_float3_array(reader, lmd->total_verts, &lmd->vertexco); + lmd->cache_system = NULL; +} + ModifierTypeInfo modifierType_LaplacianDeform = { /* name */ "LaplacianDeform", /* structName */ "LaplacianDeformModifierData", @@ -884,4 +901,6 @@ ModifierTypeInfo modifierType_LaplacianDeform = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ blendWrite, + /* blendRead */ blendRead, }; diff --git a/source/blender/modifiers/intern/MOD_laplaciansmooth.c b/source/blender/modifiers/intern/MOD_laplaciansmooth.c index bcbc21c557b..a7c74664cd9 100644 --- a/source/blender/modifiers/intern/MOD_laplaciansmooth.c +++ b/source/blender/modifiers/intern/MOD_laplaciansmooth.c @@ -649,4 +649,6 @@ ModifierTypeInfo modifierType_LaplacianSmooth = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c index 574ea969be4..b1a9258ec51 100644 --- a/source/blender/modifiers/intern/MOD_lattice.c +++ b/source/blender/modifiers/intern/MOD_lattice.c @@ -197,4 +197,6 @@ ModifierTypeInfo modifierType_Lattice = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_mask.cc b/source/blender/modifiers/intern/MOD_mask.cc index 46b88142223..93fb7749392 100644 --- a/source/blender/modifiers/intern/MOD_mask.cc +++ b/source/blender/modifiers/intern/MOD_mask.cc @@ -471,4 +471,6 @@ ModifierTypeInfo modifierType_Mask = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_meshcache.c b/source/blender/modifiers/intern/MOD_meshcache.c index 2d104e1e0c2..2041b7a25db 100644 --- a/source/blender/modifiers/intern/MOD_meshcache.c +++ b/source/blender/modifiers/intern/MOD_meshcache.c @@ -410,4 +410,6 @@ ModifierTypeInfo modifierType_MeshCache = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index 0d4ee8633c1..f324a6f92b9 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -638,4 +638,6 @@ ModifierTypeInfo modifierType_MeshDeform = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_meshsequencecache.c b/source/blender/modifiers/intern/MOD_meshsequencecache.c index 801badc382c..b4269513f8e 100644 --- a/source/blender/modifiers/intern/MOD_meshsequencecache.c +++ b/source/blender/modifiers/intern/MOD_meshsequencecache.c @@ -259,4 +259,6 @@ ModifierTypeInfo modifierType_MeshSequenceCache = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c index 949b115a25f..6abea36df35 100644 --- a/source/blender/modifiers/intern/MOD_mirror.c +++ b/source/blender/modifiers/intern/MOD_mirror.c @@ -245,4 +245,6 @@ ModifierTypeInfo modifierType_Mirror = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c index f1cba313583..e56ff991b6f 100644 --- a/source/blender/modifiers/intern/MOD_multires.c +++ b/source/blender/modifiers/intern/MOD_multires.c @@ -449,4 +449,6 @@ ModifierTypeInfo modifierType_Multires = { /* foreachTexLink */ NULL, /* freeRuntimeData */ freeRuntimeData, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_none.c b/source/blender/modifiers/intern/MOD_none.c index 84c9fc1d726..a84a10f4b6c 100644 --- a/source/blender/modifiers/intern/MOD_none.c +++ b/source/blender/modifiers/intern/MOD_none.c @@ -67,4 +67,7 @@ ModifierTypeInfo modifierType_None = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ NULL, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_normal_edit.c b/source/blender/modifiers/intern/MOD_normal_edit.c index c1901a97cda..dc454b59e8c 100644 --- a/source/blender/modifiers/intern/MOD_normal_edit.c +++ b/source/blender/modifiers/intern/MOD_normal_edit.c @@ -809,4 +809,6 @@ ModifierTypeInfo modifierType_NormalEdit = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c index e16a23f54c6..1cdba84bb27 100644 --- a/source/blender/modifiers/intern/MOD_ocean.c +++ b/source/blender/modifiers/intern/MOD_ocean.c @@ -705,4 +705,6 @@ ModifierTypeInfo modifierType_Ocean = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c index 62b28f22c17..3a9a60cf2e9 100644 --- a/source/blender/modifiers/intern/MOD_particleinstance.c +++ b/source/blender/modifiers/intern/MOD_particleinstance.c @@ -711,4 +711,6 @@ ModifierTypeInfo modifierType_ParticleInstance = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c index b63fb18de69..8c25c3eb4ba 100644 --- a/source/blender/modifiers/intern/MOD_particlesystem.c +++ b/source/blender/modifiers/intern/MOD_particlesystem.c @@ -329,4 +329,6 @@ ModifierTypeInfo modifierType_ParticleSystem = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_remesh.c b/source/blender/modifiers/intern/MOD_remesh.c index a76b3acb783..b1e6e12b4b3 100644 --- a/source/blender/modifiers/intern/MOD_remesh.c +++ b/source/blender/modifiers/intern/MOD_remesh.c @@ -316,4 +316,6 @@ ModifierTypeInfo modifierType_Remesh = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index b1c49ba2fec..b9bb7add811 100644 --- a/source/blender/modifiers/intern/MOD_screw.c +++ b/source/blender/modifiers/intern/MOD_screw.c @@ -1277,4 +1277,6 @@ ModifierTypeInfo modifierType_Screw = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_shapekey.c b/source/blender/modifiers/intern/MOD_shapekey.c index bd3301b543c..801995d6dbc 100644 --- a/source/blender/modifiers/intern/MOD_shapekey.c +++ b/source/blender/modifiers/intern/MOD_shapekey.c @@ -148,4 +148,6 @@ ModifierTypeInfo modifierType_ShapeKey = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ NULL, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c index 765773c9e2b..131a0f3ed26 100644 --- a/source/blender/modifiers/intern/MOD_shrinkwrap.c +++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c @@ -306,4 +306,6 @@ ModifierTypeInfo modifierType_Shrinkwrap = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index 668b83db41e..811524fc474 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -571,4 +571,6 @@ ModifierTypeInfo modifierType_SimpleDeform = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_simulation.cc b/source/blender/modifiers/intern/MOD_simulation.cc index d55900dc7a9..85eb66cd826 100644 --- a/source/blender/modifiers/intern/MOD_simulation.cc +++ b/source/blender/modifiers/intern/MOD_simulation.cc @@ -176,4 +176,6 @@ ModifierTypeInfo modifierType_Simulation = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c index 38d7b31a335..683ae023271 100644 --- a/source/blender/modifiers/intern/MOD_skin.c +++ b/source/blender/modifiers/intern/MOD_skin.c @@ -2035,4 +2035,6 @@ ModifierTypeInfo modifierType_Skin = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c index f25bb52f2c7..b03b949c946 100644 --- a/source/blender/modifiers/intern/MOD_smooth.c +++ b/source/blender/modifiers/intern/MOD_smooth.c @@ -300,4 +300,6 @@ ModifierTypeInfo modifierType_Smooth = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_softbody.c b/source/blender/modifiers/intern/MOD_softbody.c index 515303b7271..965d270829e 100644 --- a/source/blender/modifiers/intern/MOD_softbody.c +++ b/source/blender/modifiers/intern/MOD_softbody.c @@ -133,4 +133,6 @@ ModifierTypeInfo modifierType_Softbody = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index 1471d088af9..f8d372f4d2b 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -124,6 +124,9 @@ static void panel_draw(const bContext *C, Panel *panel) if (solidify_mode == MOD_SOLIDIFY_MODE_NONMANIFOLD) { uiItemR(layout, &ptr, "nonmanifold_merge_threshold", 0, NULL, ICON_NONE); } + else { + uiItemR(layout, &ptr, "use_even_offset", 0, NULL, ICON_NONE); + } col = uiLayoutColumnWithHeading(layout, false, "Rim"); uiItemR(col, &ptr, "use_rim", 0, IFACE_("Fill"), ICON_NONE); @@ -162,7 +165,6 @@ static void normals_panel_draw(const bContext *C, Panel *panel) uiItemR(layout, &ptr, "use_flip_normals", 0, NULL, ICON_NONE); if (solidify_mode == MOD_SOLIDIFY_MODE_EXTRUDE) { uiItemR(layout, &ptr, "use_quality_normals", 0, IFACE_("High Quality"), ICON_NONE); - uiItemR(layout, &ptr, "use_even_offset", 0, NULL, ICON_NONE); } } @@ -288,4 +290,6 @@ ModifierTypeInfo modifierType_Solidify = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c index 2b2f6893a2e..aca4cad95b8 100644 --- a/source/blender/modifiers/intern/MOD_subsurf.c +++ b/source/blender/modifiers/intern/MOD_subsurf.c @@ -457,4 +457,6 @@ ModifierTypeInfo modifierType_Subsurf = { /* foreachTexLink */ NULL, /* freeRuntimeData */ freeRuntimeData, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_surface.c b/source/blender/modifiers/intern/MOD_surface.c index 252022a5439..32b342b1471 100644 --- a/source/blender/modifiers/intern/MOD_surface.c +++ b/source/blender/modifiers/intern/MOD_surface.c @@ -241,4 +241,6 @@ ModifierTypeInfo modifierType_Surface = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_surfacedeform.c b/source/blender/modifiers/intern/MOD_surfacedeform.c index fbd8d7d27ec..e1bc6305b0a 100644 --- a/source/blender/modifiers/intern/MOD_surfacedeform.c +++ b/source/blender/modifiers/intern/MOD_surfacedeform.c @@ -1468,4 +1468,6 @@ ModifierTypeInfo modifierType_SurfaceDeform = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_triangulate.c b/source/blender/modifiers/intern/MOD_triangulate.c index 351a1016a35..65c972b5fb4 100644 --- a/source/blender/modifiers/intern/MOD_triangulate.c +++ b/source/blender/modifiers/intern/MOD_triangulate.c @@ -181,4 +181,6 @@ ModifierTypeInfo modifierType_Triangulate = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index 07a57806f87..6f261f9f67a 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -392,4 +392,6 @@ ModifierTypeInfo modifierType_UVProject = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_uvwarp.c b/source/blender/modifiers/intern/MOD_uvwarp.c index a8321cdc26a..4aca3c28ed8 100644 --- a/source/blender/modifiers/intern/MOD_uvwarp.c +++ b/source/blender/modifiers/intern/MOD_uvwarp.c @@ -351,4 +351,6 @@ ModifierTypeInfo modifierType_UVWarp = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c index 339566354db..b32efa3fb8f 100644 --- a/source/blender/modifiers/intern/MOD_warp.c +++ b/source/blender/modifiers/intern/MOD_warp.c @@ -540,4 +540,6 @@ ModifierTypeInfo modifierType_Warp = { /* foreachTexLink */ foreachTexLink, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index 6a818629979..c1fe8e1f009 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -524,4 +524,6 @@ ModifierTypeInfo modifierType_Wave = { /* foreachTexLink */ foreachTexLink, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_weighted_normal.c b/source/blender/modifiers/intern/MOD_weighted_normal.c index 1ed892f5464..42022369279 100644 --- a/source/blender/modifiers/intern/MOD_weighted_normal.c +++ b/source/blender/modifiers/intern/MOD_weighted_normal.c @@ -770,4 +770,6 @@ ModifierTypeInfo modifierType_WeightedNormal = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c index 9a9ab55a835..9dfc2f653cd 100644 --- a/source/blender/modifiers/intern/MOD_weightvgedit.c +++ b/source/blender/modifiers/intern/MOD_weightvgedit.c @@ -430,4 +430,6 @@ ModifierTypeInfo modifierType_WeightVGEdit = { /* foreachTexLink */ foreachTexLink, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c index e089720b3e3..d1c618df68b 100644 --- a/source/blender/modifiers/intern/MOD_weightvgmix.c +++ b/source/blender/modifiers/intern/MOD_weightvgmix.c @@ -539,4 +539,6 @@ ModifierTypeInfo modifierType_WeightVGMix = { /* foreachTexLink */ foreachTexLink, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index d8bf8b7bf03..0668a7a086f 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -741,4 +741,6 @@ ModifierTypeInfo modifierType_WeightVGProximity = { /* foreachTexLink */ foreachTexLink, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_weld.c b/source/blender/modifiers/intern/MOD_weld.c index 76ca85163d9..cf92da1b0e6 100644 --- a/source/blender/modifiers/intern/MOD_weld.c +++ b/source/blender/modifiers/intern/MOD_weld.c @@ -2004,6 +2004,8 @@ ModifierTypeInfo modifierType_Weld = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; /** \} */ diff --git a/source/blender/modifiers/intern/MOD_wireframe.c b/source/blender/modifiers/intern/MOD_wireframe.c index 66a03ee5d71..ef3d16c1b32 100644 --- a/source/blender/modifiers/intern/MOD_wireframe.c +++ b/source/blender/modifiers/intern/MOD_wireframe.c @@ -208,4 +208,6 @@ ModifierTypeInfo modifierType_Wireframe = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, + /* blendWrite */ NULL, + /* blendRead */ NULL, }; diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c b/source/blender/python/bmesh/bmesh_py_types_customdata.c index 652b6ecf894..340286191b8 100644 --- a/source/blender/python/bmesh/bmesh_py_types_customdata.c +++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c @@ -98,7 +98,7 @@ PyDoc_STRVAR( PyDoc_STRVAR(bpy_bmlayeraccess_collection__bevel_weight_doc, "Bevel weight float in [0 - 1].\n\n:type: :class:`BMLayerCollection`"); PyDoc_STRVAR(bpy_bmlayeraccess_collection__crease_doc, - "Edge crease for subsurf - float in [0 - 1].\n\n:type: :class:`BMLayerCollection`"); + "Edge crease for subdivision surface - float in [0 - 1].\n\n:type: :class:`BMLayerCollection`"); PyDoc_STRVAR( bpy_bmlayeraccess_collection__uv_doc, "Accessor for :class:`BMLoopUV` UV (as a 2D Vector).\n\ntype: :class:`BMLayerCollection`"); diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index 7a3a92d8a10..7896b939d77 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -1527,7 +1527,7 @@ PyDoc_STRVAR( " (instead of raising a :exc:`ValueError` exception).\n" " :type fallback: :class:`Matrix`\n" "\n" - " .. seealso:: `Inverse matrix <https://en.wikipedia.org/wiki/Inverse_matrix>` on " + " .. seealso:: `Inverse matrix <https://en.wikipedia.org/wiki/Inverse_matrix>`__ on " "Wikipedia.\n"); static PyObject *Matrix_invert(MatrixObject *self, PyObject *args) { @@ -1642,7 +1642,7 @@ PyDoc_STRVAR(Matrix_invert_safe_doc, "to get an invertible one.\n" " If tweaked matrix is still degenerated, set to the identity matrix instead.\n" "\n" - " .. seealso:: `Inverse Matrix <https://en.wikipedia.org/wiki/Inverse_matrix>` on " + " .. seealso:: `Inverse Matrix <https://en.wikipedia.org/wiki/Inverse_matrix>`__ on " "Wikipedia.\n"); static PyObject *Matrix_invert_safe(MatrixObject *self) { @@ -1696,7 +1696,7 @@ PyDoc_STRVAR( "\n" " .. note:: When the matrix cannot be adjugated a :exc:`ValueError` exception is raised.\n" "\n" - " .. seealso:: `Adjugate matrix <https://en.wikipedia.org/wiki/Adjugate_matrix>` on " + " .. seealso:: `Adjugate matrix <https://en.wikipedia.org/wiki/Adjugate_matrix>`__ on " "Wikipedia.\n"); static PyObject *Matrix_adjugate(MatrixObject *self) { @@ -1883,7 +1883,7 @@ PyDoc_STRVAR( " :return: Return the determinant of a matrix.\n" " :rtype: float\n" "\n" - " .. seealso:: `Determinant <https://en.wikipedia.org/wiki/Determinant>` on Wikipedia.\n"); + " .. seealso:: `Determinant <https://en.wikipedia.org/wiki/Determinant>`__ on Wikipedia.\n"); static PyObject *Matrix_determinant(MatrixObject *self) { if (BaseMath_ReadCallback(self) == -1) { @@ -1906,7 +1906,7 @@ PyDoc_STRVAR( "\n" " Set the matrix to its transpose.\n" "\n" - " .. seealso:: `Transpose <https://en.wikipedia.org/wiki/Transpose>` on Wikipedia.\n"); + " .. seealso:: `Transpose <https://en.wikipedia.org/wiki/Transpose>`__ on Wikipedia.\n"); static PyObject *Matrix_transpose(MatrixObject *self) { if (BaseMath_ReadCallback_ForWrite(self) == -1) { @@ -2039,7 +2039,7 @@ PyDoc_STRVAR(Matrix_identity_doc, " .. note:: An object with a location and rotation of zero, and a scale of one\n" " will have an identity matrix.\n" "\n" - " .. seealso:: `Identity matrix <https://en.wikipedia.org/wiki/Identity_matrix>` " + " .. seealso:: `Identity matrix <https://en.wikipedia.org/wiki/Identity_matrix>`__ " "on Wikipedia.\n"); static PyObject *Matrix_identity(MatrixObject *self) { diff --git a/source/blender/windowmanager/gizmo/WM_gizmo_types.h b/source/blender/windowmanager/gizmo/WM_gizmo_types.h index 346ed131c59..3863e3bd797 100644 --- a/source/blender/windowmanager/gizmo/WM_gizmo_types.h +++ b/source/blender/windowmanager/gizmo/WM_gizmo_types.h @@ -371,7 +371,7 @@ typedef struct wmGizmoType { /** Activate a gizmo state when the user clicks on it. */ wmGizmoFnInvoke invoke; - /** Called when gizmo tweaking is done - used to free data and reset property when cancelling. */ + /** Called when gizmo tweaking is done - used to free data and reset property when canceling. */ wmGizmoFnExit exit; wmGizmoFnCursorGet cursor_get; diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c index da4e4160724..3ffd6c4a334 100644 --- a/source/blender/windowmanager/intern/wm_files_link.c +++ b/source/blender/windowmanager/intern/wm_files_link.c @@ -759,6 +759,10 @@ static void lib_relocate_do(Main *bmain, BLI_addtail(which_libbase(bmain, GS(old_id->name)), old_id); } + /* Since our (old) reloaded IDs were removed from main, the user count done for them in linking + * code is wrong, we need to redo it here after adding them back to main. */ + BKE_main_id_refcount_recompute(bmain, false); + /* Note that in reload case, we also want to replace indirect usages. */ const short remap_flags = ID_REMAP_SKIP_NEVER_NULL_USAGE | ID_REMAP_NO_INDIRECT_PROXY_DATA_USAGE | diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index f99f47bc3ad..6fb1e3e251d 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -2730,7 +2730,7 @@ static int radial_control_invoke(bContext *C, wmOperator *op, const wmEvent *eve rc->num_input.idx_max = 0; rc->num_input.val_flag[0] |= NUM_NO_NEGATIVE; rc->num_input.unit_sys = USER_UNIT_NONE; - rc->num_input.unit_type[0] = B_UNIT_LENGTH; + rc->num_input.unit_type[0] = RNA_SUBTYPE_UNIT_VALUE(RNA_property_unit(rc->prop)); /* get subtype of property */ rc->subtype = RNA_property_subtype(rc->prop); @@ -2829,7 +2829,6 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even applyNumInput(&rc->num_input, &numValue); if (rc->subtype == PROP_ANGLE) { - numValue = DEG2RADF(numValue); numValue = fmod(numValue, 2.0f * (float)M_PI); if (numValue < 0.0f) { numValue += 2.0f * (float)M_PI; @@ -2994,7 +2993,6 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even applyNumInput(&rc->num_input, &numValue); if (rc->subtype == PROP_ANGLE) { - numValue = DEG2RADF(numValue); numValue = fmod(numValue, 2.0f * (float)M_PI); if (numValue < 0.0f) { numValue += 2.0f * (float)M_PI; |