diff options
author | Hans Goudey <h.goudey@me.com> | 2021-07-21 16:04:20 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-07-21 16:04:20 +0300 |
commit | a26494e1969d701ccca30a60f61fa204216bba9b (patch) | |
tree | 0a46f592b6ee019e1b725e76806cf369a093aacb | |
parent | b95d647fb125c2b54b96debb9800f8c62a8bf065 (diff) | |
parent | 3cfd6439c6bffced2bf3cf51d79b4a41cde5a61f (diff) |
Merge branch 'master' into curve-nodes-modifier
49 files changed, 205 insertions, 162 deletions
diff --git a/build_files/cmake/cmake_netbeans_project.py b/build_files/cmake/cmake_netbeans_project.py index cfc3ff6b6fa..a16fc42c9b7 100755 --- a/build_files/cmake/cmake_netbeans_project.py +++ b/build_files/cmake/cmake_netbeans_project.py @@ -82,7 +82,7 @@ def create_nb_project_main(): make_exe = cmake_cache_var("CMAKE_MAKE_PROGRAM") make_exe_basename = os.path.basename(make_exe) - # --------------- NB specific + # --------------- NetBeans specific. defines = [("%s=%s" % cdef) if cdef[1] else cdef[0] for cdef in defines] defines += [cdef.replace("#define", "").strip() for cdef in cmake_compiler_defines()] diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index 4be27e0f0e8..d6c1d7b51b8 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -1047,6 +1047,7 @@ context_type_map = { "annotation_data": ("GreasePencil", False), "annotation_data_owner": ("ID", False), "armature": ("Armature", False), + "asset_library": ("AssetLibraryReference", False), "bone": ("Bone", False), "brush": ("Brush", False), "camera": ("Camera", False), @@ -1113,6 +1114,7 @@ context_type_map = { "texture_slot": ("MaterialTextureSlot", False), "texture_user": ("ID", False), "texture_user_property": ("Property", False), + "ui_list": ("UIList", False), "vertex_paint_object": ("Object", False), "view_layer": ("ViewLayer", False), "visible_bones": ("EditBone", True), diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 30892cdbbc0..058528aeff5 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -1136,7 +1136,7 @@ class CYCLES_PT_context_material(CyclesButtonsPanel, Panel): col = row.column(align=True) col.operator("object.material_slot_add", icon='ADD', text="") col.operator("object.material_slot_remove", icon='REMOVE', text="") - + col.separator() col.menu("MATERIAL_MT_context_menu", icon='DOWNARROW_HLT', text="") if is_sortable: @@ -1151,16 +1151,15 @@ class CYCLES_PT_context_material(CyclesButtonsPanel, Panel): row.operator("object.material_slot_select", text="Select") row.operator("object.material_slot_deselect", text="Deselect") - split = layout.split(factor=0.65) + row = layout.row() if ob: - split.template_ID(ob, "active_material", new="material.new") - row = split.row() + row.template_ID(ob, "active_material", new="material.new") if slot: - row.prop(slot, "link", text="") - else: - row.label() + icon_link = 'MESH_DATA' if slot.link == 'DATA' else 'OBJECT_DATA' + row.prop(slot, "link", text="", icon=icon_link, icon_only=True) + elif mat: split.template_ID(space, "pin_id") split.separator() diff --git a/intern/cycles/render/osl.cpp b/intern/cycles/render/osl.cpp index 9bd6e3a5e2d..7dc79f48145 100644 --- a/intern/cycles/render/osl.cpp +++ b/intern/cycles/render/osl.cpp @@ -993,7 +993,7 @@ void OSLCompiler::parameter_array(const char *name, const float f[], int arrayle void OSLCompiler::parameter_color_array(const char *name, const array<float3> &f) { - /* NB: cycles float3 type is actually 4 floats! need to use an explicit array */ + /* NOTE: cycles float3 type is actually 4 floats! need to use an explicit array. */ array<float[3]> table(f.size()); for (int i = 0; i < f.size(); ++i) { diff --git a/intern/ghost/intern/GHOST_NDOFManager.h b/intern/ghost/intern/GHOST_NDOFManager.h index 9c2824e57fb..31b11a352db 100644 --- a/intern/ghost/intern/GHOST_NDOFManager.h +++ b/intern/ghost/intern/GHOST_NDOFManager.h @@ -114,7 +114,7 @@ class GHOST_NDOFManager { virtual bool available() = 0; /** - * Rach platform's device detection should call this + * Each platform's device detection should call this * use standard USB/HID identifiers. */ bool setDevice(unsigned short vendor_id, unsigned short product_id); diff --git a/intern/memutil/MEM_Allocator.h b/intern/memutil/MEM_Allocator.h index 50a3e978197..1dbb2d5a9f7 100644 --- a/intern/memutil/MEM_Allocator.h +++ b/intern/memutil/MEM_Allocator.h @@ -62,8 +62,8 @@ template<typename _Tp> struct MEM_Allocator { return &__x; } - // NB: __n is permitted to be 0. The C++ standard says nothing - // about what the return value is when __n == 0. + /* NOTE: `__n` is permitted to be 0. + * The C++ standard says nothing about what the return value is when `__n == 0`. */ _Tp *allocate(size_type __n, const void * = 0) { _Tp *__ret = NULL; diff --git a/release/scripts/modules/bl_i18n_utils/utils_cli.py b/release/scripts/modules/bl_i18n_utils/utils_cli.py index e18491fa042..ea74ba832d9 100644 --- a/release/scripts/modules/bl_i18n_utils/utils_cli.py +++ b/release/scripts/modules/bl_i18n_utils/utils_cli.py @@ -71,7 +71,7 @@ def rtl_process_po(args, settings): po.write(kind="PO", dest=args.dst) -def language_menu(_args, settings): +def language_menu(args, settings): # 'DEFAULT' and en_US are always valid, fully-translated "languages"! stats = {"DEFAULT": 1.0, "en_US": 1.0} diff --git a/release/scripts/modules/nodeitems_utils.py b/release/scripts/modules/nodeitems_utils.py index a50997fab5f..a5c18cee463 100644 --- a/release/scripts/modules/nodeitems_utils.py +++ b/release/scripts/modules/nodeitems_utils.py @@ -77,7 +77,7 @@ class NodeItem: else: return bpy.app.translations.contexts.default - # NB: is a staticmethod because called with an explicit self argument + # NOTE: is a staticmethod because called with an explicit self argument # NodeItemCustom sets this as a variable attribute in __init__ @staticmethod def draw(self, layout, _context): diff --git a/release/scripts/templates_py/custom_nodes.py b/release/scripts/templates_py/custom_nodes.py index ca9534e7cd3..fba94e23d0d 100644 --- a/release/scripts/templates_py/custom_nodes.py +++ b/release/scripts/templates_py/custom_nodes.py @@ -147,7 +147,7 @@ node_categories = [ MyNodeCategory('OTHERNODES', "Other Nodes", items=[ # the node item can have additional settings, # which are applied to new nodes - # NB: settings values are stored as string expressions, + # NOTE: settings values are stored as string expressions, # for this reason they should be converted to strings using repr() NodeItem("CustomNodeType", label="Node A", settings={ "my_string_prop": repr("Lorem ipsum dolor sit amet"), diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index 3d5973b1d5e..4e44699b371 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -1212,10 +1212,12 @@ static void update_typeinfo(Main *bmain, FOREACH_NODETREE_END; } -/* Try to initialize all typeinfo in a node tree. - * NB: In general undefined typeinfo is a perfectly valid case, +/** + * Try to initialize all type-info in a node tree. + * + * \note In general undefined type-info is a perfectly valid case, * the type may just be registered later. - * In that case the update_typeinfo function will set typeinfo on registration + * In that case the update_typeinfo function will set type-info on registration * and do necessary updates. */ void ntreeSetTypes(const struct bContext *C, bNodeTree *ntree) diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c index d9f02ce4c75..4581d410444 100644 --- a/source/blender/blenkernel/intern/unit.c +++ b/source/blender/blenkernel/intern/unit.c @@ -1303,7 +1303,7 @@ const char *BKE_unit_identifier_get(const void *usys_pt, int index) { const bUnitDef *unit = ((const bUnitCollection *)usys_pt)->units + index; if (unit->identifier == NULL) { - BLI_assert(false && "identifier for this unit is not specified yet"); + BLI_assert_msg(0, "identifier for this unit is not specified yet"); } return unit->identifier; } diff --git a/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc b/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc index cd2d48eac4d..f158a5bbae9 100644 --- a/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc +++ b/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc @@ -1874,7 +1874,7 @@ void text_test( vec2<T> start_co = b_vert[arc_origin_vert]; vec2<T> end_co = b_vert[arc_terminal_vert]; vec2<T> center_co = 0.5 * (start_co + end_co); - BLI_assert(start_co[0] == end_co[2]); + BLI_assert(start_co[0] == end_co[0]); double radius = abs(math_to_double<T>(end_co[1] - center_co[1])); double angle_delta = M_PI / (num_arc_points + 1); int start_vert = b_before_arcs_in.vert.size() + arc * num_arc_points; diff --git a/source/blender/blenloader/intern/versioning_260.c b/source/blender/blenloader/intern/versioning_260.c index 5bf4d3b68b5..858f5d85a90 100644 --- a/source/blender/blenloader/intern/versioning_260.c +++ b/source/blender/blenloader/intern/versioning_260.c @@ -2149,7 +2149,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) } for (scene = bmain->scenes.first; scene; scene = scene->id.next) { - /* NB: scene->nodetree is a local ID block, has been direct_link'ed */ + /* NOTE: `scene->nodetree` is a local ID block, has been direct_link'ed. */ if (scene->nodetree) { scene->nodetree->active_viewer_key = active_viewer_key; } diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc index a4c48828f17..3804e6ec646 100644 --- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc +++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc @@ -148,8 +148,8 @@ void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, } /* See "Recursive Gabor Filtering" by Young/VanVliet - * all factors here in double.prec. - * Required, because for single.prec it seems to blow up if sigma > ~200 */ + * all factors here in double-precision. + * Required, because for single-precision floating point seems to blow up if `sigma > ~200`. */ if (sigma >= 3.556f) { q = 0.9804f * (sigma - 3.556f) + 2.5091f; } @@ -158,7 +158,7 @@ void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, } q2 = q * q; sc = (1.1668 + q) * (3.203729649 + (2.21566 + q) * q); - /* No gabor filtering here, so no complex multiplies, just the regular coefs. + /* No gabor filtering here, so no complex multiplies, just the regular coefficients. * all negated here, so as not to have to recalc Triggs/Sdika matrix. */ cf[1] = q * (5.788961737 + (6.76492 + 3.0 * q) * q) / sc; cf[2] = -q2 * (3.38246 + 3.0 * q) / sc; @@ -168,7 +168,7 @@ void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, /* Triggs/Sdika border corrections, * it seems to work, not entirely sure if it is actually totally correct, - * Besides J.M.Geusebroek's anigauss.c (see http://www.science.uva.nl/~mark), + * Besides J.M.Geusebroek's `anigauss.c` (see http://www.science.uva.nl/~mark), * found one other implementation by Cristoph Lampert, * but neither seem to be quite the same, result seems to be ok so far anyway. * Extra scale factor here to not have to do it in filter, diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc b/source/blender/depsgraph/intern/eval/deg_eval.cc index 915b9fedcec..ad88cf656ad 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval.cc @@ -103,7 +103,7 @@ void evaluate_node(const DepsgraphEvalState *state, OperationNode *operation_nod ::Depsgraph *depsgraph = reinterpret_cast<::Depsgraph *>(state->graph); /* Sanity checks. */ - BLI_assert(!operation_node->is_noop() && "NOOP nodes should not actually be scheduled"); + BLI_assert_msg(!operation_node->is_noop(), "NOOP nodes should not actually be scheduled"); /* Perform operation. */ if (state->do_stats) { const double start_time = PIL_check_seconds_timer(); diff --git a/source/blender/draw/engines/eevee/eevee_subsurface.c b/source/blender/draw/engines/eevee/eevee_subsurface.c index b7bcd127859..48c24d138e6 100644 --- a/source/blender/draw/engines/eevee/eevee_subsurface.c +++ b/source/blender/draw/engines/eevee/eevee_subsurface.c @@ -192,7 +192,7 @@ void EEVEE_subsurface_add_pass(EEVEE_ViewLayerData *sldata, gpumat, stl->effects->sss_sample_count, &sss_tex_profile); if (!sss_profile) { - BLI_assert(0 && "SSS pass requested but no SSS data was found"); + BLI_assert_msg(0, "SSS pass requested but no SSS data was found"); return; } diff --git a/source/blender/draw/engines/overlay/overlay_outline.c b/source/blender/draw/engines/overlay/overlay_outline.c index e3f01d968ae..b50dc08bb97 100644 --- a/source/blender/draw/engines/overlay/overlay_outline.c +++ b/source/blender/draw/engines/overlay/overlay_outline.c @@ -340,7 +340,7 @@ void OVERLAY_outline_cache_populate(OVERLAY_Data *vedata, if (shgroup && geom) { if (ob->type == OB_POINTCLOUD) { - /* Draw range to avoid drawcall batching messing up the instance attrib. */ + /* Draw range to avoid drawcall batching messing up the instance attribute. */ DRW_shgroup_call_instance_range(shgroup, ob, geom, 0, 0); } else { diff --git a/source/blender/draw/engines/workbench/workbench_engine.c b/source/blender/draw/engines/workbench/workbench_engine.c index e9d6763fbe9..f09c019ef8d 100644 --- a/source/blender/draw/engines/workbench/workbench_engine.c +++ b/source/blender/draw/engines/workbench/workbench_engine.c @@ -128,7 +128,7 @@ static void workbench_cache_sculpt_populate(WORKBENCH_PrivateData *wpd, BLI_INLINE void workbench_object_drawcall(DRWShadingGroup *grp, struct GPUBatch *geom, Object *ob) { if (ob->type == OB_POINTCLOUD) { - /* Draw range to avoid drawcall batching messing up the instance attrib. */ + /* Draw range to avoid drawcall batching messing up the instance attribute. */ DRW_shgroup_call_instance_range(grp, ob, geom, 0, 0); } else { diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c index e61b11ab16a..bd8e4a0d63c 100644 --- a/source/blender/draw/intern/draw_cache.c +++ b/source/blender/draw/intern/draw_cache.c @@ -770,9 +770,9 @@ GPUBatch *DRW_cache_normal_arrow_get(void) } /* -------------------------------------------------------------------- */ -/** \name Dummy vbos +/** \name Dummy VBO's * - * We need a dummy vbo containing the vertex count to draw instances ranges. + * We need a dummy VBO containing the vertex count to draw instances ranges. * * \{ */ diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 6f5e041fa79..28af1fbf79a 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -2253,7 +2253,7 @@ static void draw_select_framebuffer_depth_only_setup(const int size[2]) /* Must run after all instance datas have been added. */ void DRW_render_instance_buffer_finish(void) { - BLI_assert(!DST.buffer_finish_called && "DRW_render_instance_buffer_finish called twice!"); + BLI_assert_msg(!DST.buffer_finish_called, "DRW_render_instance_buffer_finish called twice!"); DST.buffer_finish_called = true; DRW_instance_buffer_finish(DST.idatalist); drw_resource_buffer_finish(DST.vmempool); diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c index 0a0e1ba9ac3..b001c5bbf8f 100644 --- a/source/blender/draw/intern/draw_manager_data.c +++ b/source/blender/draw/intern/draw_manager_data.c @@ -74,7 +74,7 @@ static void draw_call_sort(DRWCommand *array, DRWCommand *array_tmp, int array_l return; } } - /* Cumulate batch indices */ + /* Accumulate batch indices */ for (int i = 1; i < ARRAY_SIZE(idx); i++) { idx[i] += idx[i - 1]; } @@ -453,7 +453,7 @@ void DRW_shgroup_vertex_buffer(DRWShadingGroup *shgroup, { int location = GPU_shader_get_ssbo(shgroup->shader, name); if (location == -1) { - BLI_assert(false && "Unable to locate binding of shader storage buffer objects."); + BLI_assert_msg(0, "Unable to locate binding of shader storage buffer objects."); return; } drw_shgroup_uniform_create_ex( diff --git a/source/blender/draw/intern/draw_manager_text.c b/source/blender/draw/intern/draw_manager_text.c index 6c63838201e..265fdba66fd 100644 --- a/source/blender/draw/intern/draw_manager_text.c +++ b/source/blender/draw/intern/draw_manager_text.c @@ -266,7 +266,7 @@ void DRW_text_edit_mesh_measure_stats(ARegion *region, } const short edge_tex_sep = (short)((edge_tex_count - 1) * 5.0f * U.dpi_fac); - /* make the precision of the display value proportionate to the gridsize */ + /* Make the precision of the display value proportionate to the grid-size. */ if (grid <= 0.01f) { conv_float = "%.6g"; diff --git a/source/blender/editors/armature/pose_lib_2.c b/source/blender/editors/armature/pose_lib_2.c index 84e49a6f42b..e146799a23c 100644 --- a/source/blender/editors/armature/pose_lib_2.c +++ b/source/blender/editors/armature/pose_lib_2.c @@ -422,7 +422,7 @@ static void poselib_blend_cleanup(bContext *C, wmOperator *op) case POSE_BLEND_BLENDING: case POSE_BLEND_ORIGINAL: /* Cleanup should not be called directly from these states. */ - BLI_assert(!"poselib_blend_cleanup: unexpected pose blend state"); + BLI_assert_msg(0, "poselib_blend_cleanup: unexpected pose blend state"); BKE_report(op->reports, RPT_ERROR, "Internal pose library error, cancelling operator"); ATTR_FALLTHROUGH; case POSE_BLEND_CANCEL: diff --git a/source/blender/editors/include/ED_render.h b/source/blender/editors/include/ED_render.h index 0fb06639dbf..5cdcbbab42a 100644 --- a/source/blender/editors/include/ED_render.h +++ b/source/blender/editors/include/ED_render.h @@ -72,13 +72,12 @@ struct Scene *ED_render_job_get_current_scene(const struct bContext *C); * - PR_NODE_RENDER: preview is rendered for node editor * - PR_ICON_DEFERRED: No render, we just ensure deferred icon data gets generated. */ - -enum { +typedef enum ePreviewRenderMethod { PR_BUTS_RENDER = 0, PR_ICON_RENDER = 1, PR_NODE_RENDER = 2, PR_ICON_DEFERRED = 3, -}; +} ePreviewRenderMethod; void ED_preview_ensure_dbase(void); void ED_preview_free_dbase(void); diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 376a41ff9bb..3ab49b8773b 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -675,7 +675,7 @@ static int override_remove_button_exec(bContext *C, wmOperator *op) PropertyRNA *src_prop; RNA_id_pointer_create(id->override_library->reference, &id_refptr); if (!RNA_path_resolve_property(&id_refptr, oprop->rna_path, &src, &src_prop)) { - BLI_assert(0 && "Failed to create matching source (linked data) RNA pointer"); + BLI_assert_msg(0, "Failed to create matching source (linked data) RNA pointer"); } } diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 5aa63ac56d8..702c8d052c5 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -234,7 +234,7 @@ static Scene *preview_get_scene(Main *pr_main) return pr_main->scenes.first; } -static const char *preview_collection_name(const char pr_type) +static const char *preview_collection_name(const ePreviewType pr_type) { switch (pr_type) { case MA_FLAT: @@ -265,10 +265,7 @@ static const char *preview_collection_name(const char pr_type) } } -static void set_preview_visibility(Scene *scene, - ViewLayer *view_layer, - char pr_type, - int pr_method) +static void switch_preview_collection_visibilty(ViewLayer *view_layer, const ePreviewType pr_type) { /* Set appropriate layer as visible. */ LayerCollection *lc = view_layer->layer_collections.first; @@ -282,7 +279,11 @@ static void set_preview_visibility(Scene *scene, lc->collection->flag |= COLLECTION_RESTRICT_RENDER; } } +} +static void switch_preview_floor_visibility(ViewLayer *view_layer, + const ePreviewRenderMethod pr_method) +{ /* Hide floor for icon renders. */ LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { if (STREQ(base->object->id.name + 2, "Floor")) { @@ -294,7 +295,15 @@ static void set_preview_visibility(Scene *scene, } } } +} +static void set_preview_visibility(Scene *scene, + ViewLayer *view_layer, + const ePreviewType pr_type, + const ePreviewRenderMethod pr_method) +{ + switch_preview_collection_visibilty(view_layer, pr_type); + switch_preview_floor_visibility(view_layer, pr_method); BKE_layer_collection_sync(scene, view_layer); } @@ -348,6 +357,38 @@ static ID *duplicate_ids(ID *id, const bool allow_failure) } } +static World *preview_get_world(Main *pr_main) +{ + World *result = NULL; + const char *world_name = "World"; + result = BLI_findstring(&pr_main->worlds, world_name, offsetof(ID, name) + 2); + + /* No world found return first world. */ + if (result == NULL) { + result = pr_main->worlds.first; + } + + BLI_assert_msg(result, "Preview file has no world."); + return result; +} + +static void preview_sync_exposure(World *dst, const World *src) +{ + BLI_assert(dst); + BLI_assert(src); + dst->exp = src->exp; + dst->range = src->range; +} + +static World *preview_prepare_world(Main *pr_main, const World *world) +{ + World *result = preview_get_world(pr_main); + if (world) { + preview_sync_exposure(result, world); + } + return result; +} + /* call this with a pointer to initialize preview scene */ /* call this with NULL to restore assigned ID pointers in preview scene */ static Scene *preview_prepare_scene( @@ -368,13 +409,7 @@ static Scene *preview_prepare_scene( /* this flag tells render to not execute depsgraph or ipos etc */ sce->r.scemode |= R_BUTS_PREVIEW; - /* set world always back, is used now */ - sce->world = pr_main->worlds.first; - /* now: exposure copy */ - if (scene->world) { - sce->world->exp = scene->world->exp; - sce->world->range = scene->world->range; - } + BLI_strncpy(sce->r.engine, scene->r.engine, sizeof(sce->r.engine)); sce->r.color_mgt_flag = scene->r.color_mgt_flag; BKE_color_managed_display_settings_copy(&sce->display_settings, &scene->display_settings); @@ -400,13 +435,13 @@ static Scene *preview_prepare_scene( sce->r.cfra = scene->r.cfra; + /* Setup the world. */ + sce->world = preview_prepare_world(pr_main, scene->world); + if (id_type == ID_TE) { /* Texture is not actually rendered with engine, just set dummy value. */ BLI_strncpy(sce->r.engine, RE_engine_id_BLENDER_EEVEE, sizeof(sce->r.engine)); } - else { - BLI_strncpy(sce->r.engine, scene->r.engine, sizeof(sce->r.engine)); - } if (id_type == ID_MA) { Material *mat = NULL, *origmat = (Material *)id; @@ -432,14 +467,12 @@ static Scene *preview_prepare_scene( sce->world->horb = 0.05f; } - if (sp->pr_method == PR_ICON_RENDER && sp->pr_main == G_pr_main_grease_pencil) { - /* For grease pencil, always use sphere for icon renders. */ - set_preview_visibility(sce, view_layer, MA_SPHERE_A, sp->pr_method); - } - else { - /* Use specified preview shape for both preview panel and icon previews. */ - set_preview_visibility(sce, view_layer, mat->pr_type, sp->pr_method); - } + /* For grease pencil, always use sphere for icon renders. */ + const ePreviewType preview_type = (sp->pr_method == PR_ICON_RENDER && + sp->pr_main == G_pr_main_grease_pencil) ? + MA_SPHERE_A : + mat->pr_type; + set_preview_visibility(sce, view_layer, preview_type, sp->pr_method); if (sp->pr_method != PR_ICON_RENDER) { if (mat->nodetree && sp->pr_method == PR_NODE_RENDER) { @@ -691,8 +724,8 @@ void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, r struct ObjectPreviewData { /* The main for the preview, not of the current file. */ Main *pr_main; - /* Copy of the object to create the preview for. The copy is for thread safety (and to insert it - * into an own main). */ + /* Copy of the object to create the preview for. The copy is for thread safety (and to insert + * it into an own main). */ Object *object; int sizex; int sizey; @@ -1551,8 +1584,8 @@ static void icon_preview_startjob_all_sizes(void *customdata, /* check_engine_supports_preview() checks whether the engine supports "preview mode" (think: * Material Preview). This check is only relevant when the render function called below is - * going to use such a mode. Object and Action render functions use Solid mode, though, so they - * can skip this test. */ + * going to use such a mode. Object and Action render functions use Solid mode, though, so + * they can skip this test. */ /* TODO: Decouple the ID-type-specific render functions from this function, so that it's not * necessary to know here what happens inside lower-level functions. */ const bool use_solid_render_mode = (ip->id != NULL) && ELEM(GS(ip->id->name), ID_OB, ID_AC); diff --git a/source/blender/editors/space_node/node_edit.cc b/source/blender/editors/space_node/node_edit.cc index af9c888cbf7..cbf03f553f6 100644 --- a/source/blender/editors/space_node/node_edit.cc +++ b/source/blender/editors/space_node/node_edit.cc @@ -613,9 +613,8 @@ void snode_set_context(const bContext *C) /* check the tree type */ if (!treetype || (treetype->poll && !treetype->poll(C, treetype))) { /* invalid tree type, skip - * NB: not resetting the node path here, invalid bNodeTreeType - * may still be registered at a later point. - */ + * NOTE: not resetting the node path here, invalid #bNodeTreeType + * may still be registered at a later point. */ return; } @@ -1303,9 +1302,8 @@ static int node_duplicate_exec(bContext *C, wmOperator *op) } } - /* copy links between selected nodes - * NB: this depends on correct node->new_node and sock->new_sock pointers from above copy! - */ + /* Copy links between selected nodes. + * NOTE: this depends on correct node->new_node and sock->new_sock pointers from above copy! */ bNodeLink *lastlink = (bNodeLink *)ntree->links.last; LISTBASE_FOREACH (bNodeLink *, link, &ntree->links) { /* This creates new links between copied nodes. @@ -2163,9 +2161,9 @@ static int node_clipboard_copy_exec(bContext *C, wmOperator *UNUSED(op)) } } - /* copy links between selected nodes - * NB: this depends on correct node->new_node and sock->new_sock pointers from above copy! - */ + /* Copy links between selected nodes. + * NOTE: this depends on correct node->new_node and sock->new_sock pointers from above copy! */ + LISTBASE_FOREACH (bNodeLink *, link, &ntree->links) { /* This creates new links between copied nodes. */ if (link->tonode && (link->tonode->flag & NODE_SELECT) && link->fromnode && diff --git a/source/blender/freestyle/intern/winged_edge/Curvature.cpp b/source/blender/freestyle/intern/winged_edge/Curvature.cpp index 478e48de66c..f052f1af104 100644 --- a/source/blender/freestyle/intern/winged_edge/Curvature.cpp +++ b/source/blender/freestyle/intern/winged_edge/Curvature.cpp @@ -371,29 +371,29 @@ void gts_vertex_principal_directions(WVertex *v, Vec3r Kh, real Kg, Vec3r &e1, V } e = *itE; - /* since this vertex passed the tests in gts_vertex_mean_curvature_normal(), this should be - * true. */ + /* Since this vertex passed the tests in gts_vertex_mean_curvature_normal(), + this should be true. */ // g_assert(gts_edge_face_number (e, s) == 2); - /* identify the two triangles bordering e in s */ + /* Identify the two triangles bordering e in s. */ f1 = e->GetaFace(); f2 = e->GetbFace(); /* We are solving for the values of the curvature tensor - * B = [ a b ; b c ]. - * The computations here are from section 5 of [Meyer et al 2002]. + * `B = [ a b ; b c ]`. + * The computations here are from section 5 of [Meyer et al 2002]. * - * The first step is to calculate the linear equations governing the values of (a,b,c). These + * The first step is to calculate the linear equations governing the values of (a,b,c). These * can be computed by setting the derivatives of the error E to zero (section 5.3). * - * Since a + c = norm(Kh), we only compute the linear equations for dE/da and dE/db. (NB: - * [Meyer et al 2002] has the equation a + b = norm(Kh), but I'm almost positive this is - * incorrect). + * Since a + c = norm(Kh), we only compute the linear equations for `dE/da` and `dE/db`. + * (NOTE: [Meyer et al 2002] has the equation `a + b = norm(Kh)`, + * but I'm almost positive this is incorrect). * - * Note that the w_ij (defined in section 5.2) are all scaled by (1/8*A_mixed). We drop this + * Note that the w_ij (defined in section 5.2) are all scaled by `(1/8*A_mixed)`. We drop this * uniform scale factor because the solution of the linear equations doesn't rely on it. * - * The terms of the linear equations are xterm_dy with x in {a,b,c} and y in {a,b}. There are + * The terms of the linear equations are xterm_dy with x in {a,b,c} and y in {a,b}. There are * also const_dy terms that are the constant factors in the equations. */ diff --git a/source/blender/gpu/GPU_vertex_format.h b/source/blender/gpu/GPU_vertex_format.h index e3a566e5f21..0d5388c6b82 100644 --- a/source/blender/gpu/GPU_vertex_format.h +++ b/source/blender/gpu/GPU_vertex_format.h @@ -127,7 +127,7 @@ BLI_INLINE const char *GPU_vertformat_attr_name_get(const GPUVertFormat *format, } /* WARNING: Can only rename using a string with same character count. - * WARNING: This removes all other aliases of this attrib */ + * WARNING: This removes all other aliases of this attribute. */ void GPU_vertformat_attr_rename(GPUVertFormat *format, int attr, const char *new_name); void GPU_vertformat_safe_attr_name(const char *attr_name, char *r_safe_name, uint max_len); diff --git a/source/blender/gpu/intern/gpu_batch.cc b/source/blender/gpu/intern/gpu_batch.cc index 9dc24c59e22..677777132e6 100644 --- a/source/blender/gpu/intern/gpu_batch.cc +++ b/source/blender/gpu/intern/gpu_batch.cc @@ -184,7 +184,7 @@ int GPU_batch_instbuf_add_ex(GPUBatch *batch, GPUVertBuf *insts, bool own_vbo) } } /* we only make it this far if there is no room for another GPUVertBuf */ - BLI_assert(0 && "Not enough Instance VBO slot in batch"); + BLI_assert_msg(0, "Not enough Instance VBO slot in batch"); return -1; } @@ -207,7 +207,7 @@ int GPU_batch_vertbuf_add_ex(GPUBatch *batch, GPUVertBuf *verts, bool own_vbo) } } /* we only make it this far if there is no room for another GPUVertBuf */ - BLI_assert(0 && "Not enough VBO slot in batch"); + BLI_assert_msg(0, "Not enough VBO slot in batch"); return -1; } diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index d12cecd129e..bb1ebc0e85d 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -657,7 +657,7 @@ static const char *attr_prefix_get(CustomDataType type) case CD_AUTO_FROM_NAME: return "a"; default: - BLI_assert(false && "GPUVertAttr Prefix type not found : This should not happen!"); + BLI_assert_msg(0, "GPUVertAttr Prefix type not found : This should not happen!"); return ""; } } diff --git a/source/blender/gpu/intern/gpu_texture_private.hh b/source/blender/gpu/intern/gpu_texture_private.hh index 2b8a5a5cc12..26be6f57312 100644 --- a/source/blender/gpu/intern/gpu_texture_private.hh +++ b/source/blender/gpu/intern/gpu_texture_private.hh @@ -316,7 +316,7 @@ inline size_t to_bytesize(eGPUTextureFormat format) case GPU_RGBA8_DXT5: return 1; /* Incorrect but actual size is fractional. */ default: - BLI_assert(!"Texture format incorrect or unsupported\n"); + BLI_assert_msg(0, "Texture format incorrect or unsupported"); return 0; } } @@ -333,7 +333,7 @@ inline size_t to_block_size(eGPUTextureFormat data_type) case GPU_RGBA8_DXT5: return 16; default: - BLI_assert(!"Texture format is not a compressed format\n"); + BLI_assert_msg(0, "Texture format is not a compressed format"); return 0; } } @@ -407,7 +407,7 @@ inline size_t to_bytesize(eGPUDataFormat data_format) case GPU_DATA_2_10_10_10_REV: return 4; default: - BLI_assert(!"Data format incorrect or unsupported\n"); + BLI_assert_msg(0, "Data format incorrect or unsupported"); return 0; } } @@ -503,7 +503,7 @@ inline eGPUFrameBufferBits to_framebuffer_bits(eGPUTextureFormat tex_format) static inline eGPUTextureFormat to_texture_format(const GPUVertFormat *format) { if (format->attr_len > 1 || format->attr_len == 0) { - BLI_assert(!"Incorrect vertex format for buffer texture"); + BLI_assert_msg(0, "Incorrect vertex format for buffer texture"); return GPU_DEPTH_COMPONENT24; } switch (format->attrs[0].comp_len) { @@ -584,7 +584,7 @@ static inline eGPUTextureFormat to_texture_format(const GPUVertFormat *format) default: break; } - BLI_assert(!"Unsupported vertex format for buffer texture"); + BLI_assert_msg(0, "Unsupported vertex format for buffer texture"); return GPU_DEPTH_COMPONENT24; } diff --git a/source/blender/gpu/opengl/gl_shader_interface.cc b/source/blender/gpu/opengl/gl_shader_interface.cc index 9cf072b2e8a..9900a4e0766 100644 --- a/source/blender/gpu/opengl/gl_shader_interface.cc +++ b/source/blender/gpu/opengl/gl_shader_interface.cc @@ -170,7 +170,7 @@ GLShaderInterface::GLShaderInterface(GLuint program) program, GL_SHADER_STORAGE_BLOCK, GL_MAX_NAME_LENGTH, &max_ssbo_name_len); } - BLI_assert(ubo_len <= 16 && "enabled_ubo_mask_ is uint16_t"); + BLI_assert_msg(ubo_len <= 16, "enabled_ubo_mask_ is uint16_t"); /* Work around driver bug with Intel HD 4600 on Windows 7/8, where * GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH does not work. */ diff --git a/source/blender/gpu/opengl/gl_texture.hh b/source/blender/gpu/opengl/gl_texture.hh index dc048ea05c0..2a480e71017 100644 --- a/source/blender/gpu/opengl/gl_texture.hh +++ b/source/blender/gpu/opengl/gl_texture.hh @@ -192,7 +192,7 @@ inline GLenum to_gl_internal_format(eGPUTextureFormat format) case GPU_DEPTH_COMPONENT16: return GL_DEPTH_COMPONENT16; default: - BLI_assert(!"Texture format incorrect or unsupported\n"); + BLI_assert_msg(0, "Texture format incorrect or unsupported"); return 0; } } @@ -287,7 +287,7 @@ inline GLenum to_gl(eGPUDataFormat format) case GPU_DATA_10_11_11_REV: return GL_UNSIGNED_INT_10F_11F_11F_REV; default: - BLI_assert(!"Unhandled data format"); + BLI_assert_msg(0, "Unhandled data format"); return GL_FLOAT; } } @@ -359,7 +359,7 @@ inline GLenum to_gl_data_format(eGPUTextureFormat format) case GPU_RGBA8_DXT5: return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; default: - BLI_assert(!"Texture format incorrect or unsupported\n"); + BLI_assert_msg(0, "Texture format incorrect or unsupported\n"); return 0; } } @@ -377,7 +377,7 @@ inline GLenum channel_len_to_gl(int channel_len) case 4: return GL_RGBA; default: - BLI_assert(!"Wrong number of texture channels"); + BLI_assert_msg(0, "Wrong number of texture channels"); return GL_RED; } } diff --git a/source/blender/gpu/opengl/gl_vertex_array.cc b/source/blender/gpu/opengl/gl_vertex_array.cc index ea2770f099d..e324916b934 100644 --- a/source/blender/gpu/opengl/gl_vertex_array.cc +++ b/source/blender/gpu/opengl/gl_vertex_array.cc @@ -108,7 +108,7 @@ static uint16_t vbo_bind(const ShaderInterface *interface, return enabled_attrib; } -/* Update the Attrib Binding of the currently bound VAO. */ +/* Update the Attribute Binding of the currently bound VAO. */ void GLVertArray::update_bindings(const GLuint vao, const GPUBatch *batch_, /* Should be GLBatch. */ const ShaderInterface *interface, diff --git a/source/blender/io/collada/AnimationImporter.cpp b/source/blender/io/collada/AnimationImporter.cpp index 626e4258239..e52bdca0d87 100644 --- a/source/blender/io/collada/AnimationImporter.cpp +++ b/source/blender/io/collada/AnimationImporter.cpp @@ -1090,7 +1090,7 @@ void AnimationImporter::translate_Animations( apply_matrix_curves(ob, animcurves, root, node, transform); } else { - /* calculate rnapaths and array index of fcurves according to transformation and + /* Calculate RNA-paths and array index of F-curves according to transformation and * animation class */ Assign_transform_animations(transform, &bindings[j], &animcurves, is_joint, joint_path); diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h index f9974f14ab0..67cd68afb8a 100644 --- a/source/blender/makesdna/DNA_material_types.h +++ b/source/blender/makesdna/DNA_material_types.h @@ -298,18 +298,20 @@ typedef struct Material { #define MAP_ALPHA (1 << 7) /* pr_type */ -#define MA_FLAT 0 -#define MA_SPHERE 1 -#define MA_CUBE 2 -#define MA_SHADERBALL 3 -#define MA_SPHERE_A 4 /* Used for icon renders only. */ -#define MA_TEXTURE 5 -#define MA_LAMP 6 -#define MA_SKY 7 -#define MA_HAIR 10 -#define MA_ATMOS 11 -#define MA_CLOTH 12 -#define MA_FLUID 13 +typedef enum ePreviewType { + MA_FLAT = 0, + MA_SPHERE = 1, + MA_CUBE = 2, + MA_SHADERBALL = 3, + MA_SPHERE_A = 4, /* Used for icon renders only. */ + MA_TEXTURE = 5, + MA_LAMP = 6, + MA_SKY = 7, + MA_HAIR = 10, + MA_ATMOS = 11, + MA_CLOTH = 12, + MA_FLUID = 13, +} ePreviewType; /* pr_flag */ #define MA_PREVIEW_WORLD (1 << 0) diff --git a/source/blender/makesrna/intern/rna_collection.c b/source/blender/makesrna/intern/rna_collection.c index 752c9495e50..608a8e51b09 100644 --- a/source/blender/makesrna/intern/rna_collection.c +++ b/source/blender/makesrna/intern/rna_collection.c @@ -170,7 +170,7 @@ static bool rna_Collection_objects_override_apply(Main *bmain, Collection *coll_dst = (Collection *)ptr_dst->owner_id; if (ptr_item_dst->type == NULL || ptr_item_src->type == NULL) { - // BLI_assert(0 && "invalid source or destination object."); + // BLI_assert_msg(0, "invalid source or destination object."); return false; } @@ -185,7 +185,7 @@ static bool rna_Collection_objects_override_apply(Main *bmain, &coll_dst->gobject, ob_dst, offsetof(CollectionObject, ob)); if (cob_dst == NULL) { - BLI_assert(0 && "Could not find destination object in destination collection!"); + BLI_assert_msg(0, "Could not find destination object in destination collection!"); return false; } @@ -288,7 +288,7 @@ static bool rna_Collection_children_override_apply(Main *bmain, &coll_dst->children, subcoll_dst, offsetof(CollectionChild, collection)); if (collchild_dst == NULL) { - BLI_assert(0 && "Could not find destination sub-collection in destination collection!"); + BLI_assert_msg(0, "Could not find destination sub-collection in destination collection!"); return false; } diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 6998a7d0afe..a534c85681b 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -6622,10 +6622,9 @@ static void def_cmp_image(StructRNA *srna) "Put node output buffer to straight alpha instead of premultiplied"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); - /* NB: image user properties used in the UI are redefined in def_node_image_user, + /* NOTE: Image user properties used in the UI are redefined in def_node_image_user, * to trigger correct updates of the node editor. RNA design problem that prevents - * updates from nested structs ... - */ + * updates from nested structs. */ RNA_def_struct_sdna_from(srna, "ImageUser", "storage"); def_node_image_user(srna); } @@ -6722,9 +6721,8 @@ static void rna_def_cmp_output_file_slots_api(BlenderRNA *brna, parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "New socket"); RNA_def_function_return(func, parm); - /* NB: methods below can use the standard node socket API functions, - * included here for completeness. - */ + /* NOTE: methods below can use the standard node socket API functions, + * included here for completeness. */ func = RNA_def_function(srna, "remove", "rna_Node_socket_remove"); RNA_def_function_ui_description(func, "Remove a file slot from this node"); @@ -10301,11 +10299,11 @@ static void rna_def_node_socket(BlenderRNA *brna) RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON); RNA_def_property_ui_text(prop, "Node", "Node owning this socket"); - /* NB: the type property is used by standard sockets. + /* NOTE: The type property is used by standard sockets. * Ideally should be defined only for the registered subclass, * but to use the existing DNA is added in the base type here. - * Future socket types can ignore or override this if needed. - */ + * Future socket types can ignore or override this if needed. */ + prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, node_socket_type_items); diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 6008ef40b60..42bdc7442f4 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -2089,7 +2089,7 @@ bool rna_property_override_store_default(Main *UNUSED(bmain), switch (RNA_property_type(prop_local)) { case PROP_BOOLEAN: /* TODO: support boolean ops? Really doubt this would ever be useful though. */ - BLI_assert(0 && "Boolean properties support no override diff operation"); + BLI_assert_msg(0, "Boolean properties support no override diff operation"); break; case PROP_INT: { int prop_min, prop_max; @@ -2143,7 +2143,7 @@ bool rna_property_override_store_default(Main *UNUSED(bmain), break; } default: - BLI_assert(0 && "Unsupported RNA override diff operation on integer"); + BLI_assert_msg(0, "Unsupported RNA override diff operation on integer"); break; } @@ -2175,7 +2175,7 @@ bool rna_property_override_store_default(Main *UNUSED(bmain), break; } default: - BLI_assert(0 && "Unsupported RNA override diff operation on integer"); + BLI_assert_msg(0, "Unsupported RNA override diff operation on integer"); break; } } @@ -2256,7 +2256,7 @@ bool rna_property_override_store_default(Main *UNUSED(bmain), break; } default: - BLI_assert(0 && "Unsupported RNA override diff operation on float"); + BLI_assert_msg(0, "Unsupported RNA override diff operation on float"); break; } @@ -2299,7 +2299,7 @@ bool rna_property_override_store_default(Main *UNUSED(bmain), break; } default: - BLI_assert(0 && "Unsupported RNA override diff operation on float"); + BLI_assert_msg(0, "Unsupported RNA override diff operation on float"); break; } } @@ -2307,17 +2307,17 @@ bool rna_property_override_store_default(Main *UNUSED(bmain), } case PROP_ENUM: /* TODO: support add/sub, for bitflags? */ - BLI_assert(0 && "Enum properties support no override diff operation"); + BLI_assert_msg(0, "Enum properties support no override diff operation"); break; case PROP_POINTER: - BLI_assert(0 && "Pointer properties support no override diff operation"); + BLI_assert_msg(0, "Pointer properties support no override diff operation"); break; case PROP_STRING: - BLI_assert(0 && "String properties support no override diff operation"); + BLI_assert_msg(0, "String properties support no override diff operation"); break; case PROP_COLLECTION: /* XXX TODO: support this of course... */ - BLI_assert(0 && "Collection properties support no override diff operation"); + BLI_assert_msg(0, "Collection properties support no override diff operation"); break; default: break; @@ -2364,7 +2364,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain), RNA_property_boolean_set_array(ptr_dst, prop_dst, array_a); break; default: - BLI_assert(0 && "Unsupported RNA override operation on boolean"); + BLI_assert_msg(0, "Unsupported RNA override operation on boolean"); return false; } @@ -2380,7 +2380,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain), RNA_PROPERTY_SET_SINGLE(boolean, ptr_dst, prop_dst, index, value); break; default: - BLI_assert(0 && "Unsupported RNA override operation on boolean"); + BLI_assert_msg(0, "Unsupported RNA override operation on boolean"); return false; } } @@ -2421,7 +2421,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain), } break; default: - BLI_assert(0 && "Unsupported RNA override operation on integer"); + BLI_assert_msg(0, "Unsupported RNA override operation on integer"); return false; } @@ -2459,7 +2459,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain), storage_value); break; default: - BLI_assert(0 && "Unsupported RNA override operation on integer"); + BLI_assert_msg(0, "Unsupported RNA override operation on integer"); return false; } } @@ -2506,7 +2506,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain), } break; default: - BLI_assert(0 && "Unsupported RNA override operation on float"); + BLI_assert_msg(0, "Unsupported RNA override operation on float"); return false; } @@ -2552,7 +2552,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain), storage_value); break; default: - BLI_assert(0 && "Unsupported RNA override operation on float"); + BLI_assert_msg(0, "Unsupported RNA override operation on float"); return false; } } @@ -2566,7 +2566,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain), break; /* TODO: support add/sub, for bitflags? */ default: - BLI_assert(0 && "Unsupported RNA override operation on enum"); + BLI_assert_msg(0, "Unsupported RNA override operation on enum"); return false; } return true; @@ -2579,7 +2579,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain), RNA_property_pointer_set(ptr_dst, prop_dst, value, NULL); break; default: - BLI_assert(0 && "Unsupported RNA override operation on pointer"); + BLI_assert_msg(0, "Unsupported RNA override operation on pointer"); return false; } return true; @@ -2593,7 +2593,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain), RNA_property_string_set(ptr_dst, prop_dst, value); break; default: - BLI_assert(0 && "Unsupported RNA override operation on string"); + BLI_assert_msg(0, "Unsupported RNA override operation on string"); return false; } @@ -2609,7 +2609,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain), const bool is_dst_idprop = (prop_dst->magic != RNA_MAGIC) || (prop_dst->flag & PROP_IDPROPERTY) != 0; if (!(is_src_idprop && is_dst_idprop)) { - BLI_assert(0 && "You need to define a specific override apply callback for collections"); + BLI_assert_msg(0, "You need to define a specific override apply callback for collections"); return false; } @@ -2668,7 +2668,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain), return RNA_property_collection_move(ptr_dst, prop_dst, item_index_added, item_index_dst); } default: - BLI_assert(0 && "Unsupported RNA override operation on collection"); + BLI_assert_msg(0, "Unsupported RNA override operation on collection"); return false; } } diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c index ef70f3fe6f4..71fc7f3e424 100644 --- a/source/blender/modifiers/intern/MOD_particlesystem.c +++ b/source/blender/modifiers/intern/MOD_particlesystem.c @@ -282,13 +282,13 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel) if (!(ob->mode & OB_MODE_PARTICLE_EDIT)) { if (ELEM(psys->part->ren_as, PART_DRAW_GR, PART_DRAW_OB)) { uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Convert"), + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Make Instances Real"), ICON_NONE, "OBJECT_OT_duplicates_make_real"); } else if (psys->part->ren_as == PART_DRAW_PATH) { uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Convert"), + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Convert to Mesh"), ICON_NONE, "OBJECT_OT_modifier_convert"); } diff --git a/source/blender/nodes/NOD_static_types.h b/source/blender/nodes/NOD_static_types.h index 42a0454d3e6..2a3dcf7c169 100644 --- a/source/blender/nodes/NOD_static_types.h +++ b/source/blender/nodes/NOD_static_types.h @@ -156,7 +156,7 @@ DefNode(CompositorNode, CMP_NODE_HUE_SAT, 0, "HUE_SA DefNode(CompositorNode, CMP_NODE_IMAGE, def_cmp_image, "IMAGE", Image, "Image", "" ) DefNode(CompositorNode, CMP_NODE_R_LAYERS, def_cmp_render_layers, "R_LAYERS", RLayers, "Render Layers", "" ) DefNode(CompositorNode, CMP_NODE_COMPOSITE, def_cmp_composite, "COMPOSITE", Composite, "Composite", "" ) -/* NB: OutputFile node has special rna setup function called in rna_nodetree.c */ +/* NOTE: #OutputFile node has special RNA setup function called in rna_nodetree.c */ DefNode(CompositorNode, CMP_NODE_OUTPUT_FILE, 0, "OUTPUT_FILE", OutputFile, "File Output", "" ) DefNode(CompositorNode, CMP_NODE_TEXTURE, def_texture, "TEXTURE", Texture, "Texture", "" ) DefNode(CompositorNode, CMP_NODE_TRANSLATE, def_cmp_translate, "TRANSLATE", Translate, "Translate", "" ) diff --git a/source/blender/nodes/composite/nodes/node_composite_common.c b/source/blender/nodes/composite/nodes/node_composite_common.c index f5eaaef8a31..61abc80fe93 100644 --- a/source/blender/nodes/composite/nodes/node_composite_common.c +++ b/source/blender/nodes/composite/nodes/node_composite_common.c @@ -36,9 +36,8 @@ void register_node_type_cmp_group(void) { static bNodeType ntype; - /* NB: cannot use sh_node_type_base for node group, because it would map the node type - * to the shared NODE_GROUP integer type id. - */ + /* NOTE: Cannot use sh_node_type_base for node group, because it would map the node type + * to the shared NODE_GROUP integer type id. */ node_type_base_custom( &ntype, "CompositorNodeGroup", "Group", NODE_CLASS_GROUP, NODE_CONST_OUTPUT); ntype.type = NODE_GROUP; diff --git a/source/blender/nodes/intern/derived_node_tree.cc b/source/blender/nodes/intern/derived_node_tree.cc index 3d5557d4049..f7279cf7524 100644 --- a/source/blender/nodes/intern/derived_node_tree.cc +++ b/source/blender/nodes/intern/derived_node_tree.cc @@ -73,7 +73,9 @@ void DerivedNodeTree::destruct_context_recursively(DTreeContext *context) context->~DTreeContext(); } -/* Returns true if there are any cycles in the node tree. */ +/** + * \return True when there is a link cycle. Unavailable sockets are ignored. + */ bool DerivedNodeTree::has_link_cycles() const { for (const NodeTreeRef *tree_ref : used_node_tree_refs_) { diff --git a/source/blender/nodes/intern/node_tree_ref.cc b/source/blender/nodes/intern/node_tree_ref.cc index 9ce9d6fc273..641d02af902 100644 --- a/source/blender/nodes/intern/node_tree_ref.cc +++ b/source/blender/nodes/intern/node_tree_ref.cc @@ -423,7 +423,13 @@ static bool has_link_cycles_recursive(const NodeRef &node, is_in_stack[node_id] = true; for (const OutputSocketRef *from_socket : node.outputs()) { + if (!from_socket->is_available()) { + continue; + } for (const InputSocketRef *to_socket : from_socket->directly_linked_sockets()) { + if (!to_socket->is_available()) { + continue; + } const NodeRef &to_node = to_socket->node(); if (has_link_cycles_recursive(to_node, visited, is_in_stack)) { return true; @@ -435,6 +441,9 @@ static bool has_link_cycles_recursive(const NodeRef &node, return false; } +/** + * \return True when there is a link cycle. Unavailable sockets are ignored. + */ bool NodeTreeRef::has_link_cycles() const { const int node_amount = nodes_by_id_.size(); diff --git a/source/blender/nodes/shader/nodes/node_shader_common.c b/source/blender/nodes/shader/nodes/node_shader_common.c index a864bef60d9..4df5add7151 100644 --- a/source/blender/nodes/shader/nodes/node_shader_common.c +++ b/source/blender/nodes/shader/nodes/node_shader_common.c @@ -229,9 +229,9 @@ void register_node_type_sh_group(void) { static bNodeType ntype; - /* NB: cannot use sh_node_type_base for node group, because it would map the node type - * to the shared NODE_GROUP integer type id. - */ + /* NOTE: cannot use #sh_node_type_base for node group, because it would map the node type + * to the shared #NODE_GROUP integer type id. */ + node_type_base_custom(&ntype, "ShaderNodeGroup", "Group", NODE_CLASS_GROUP, NODE_CONST_OUTPUT); ntype.type = NODE_GROUP; ntype.poll = sh_node_poll_default; diff --git a/source/blender/nodes/texture/nodes/node_texture_common.c b/source/blender/nodes/texture/nodes/node_texture_common.c index b87720be5b0..2de64779ea6 100644 --- a/source/blender/nodes/texture/nodes/node_texture_common.c +++ b/source/blender/nodes/texture/nodes/node_texture_common.c @@ -158,9 +158,9 @@ void register_node_type_tex_group(void) { static bNodeType ntype; - /* NB: cannot use sh_node_type_base for node group, because it would map the node type - * to the shared NODE_GROUP integer type id. - */ + /* NOTE: Cannot use #sh_node_type_base for node group, because it would map the node type + * to the shared #NODE_GROUP integer type id. */ + node_type_base_custom(&ntype, "TextureNodeGroup", "Group", NODE_CLASS_GROUP, NODE_CONST_OUTPUT); ntype.type = NODE_GROUP; ntype.poll = tex_node_poll_default; diff --git a/source/blender/simulation/intern/implicit_blender.c b/source/blender/simulation/intern/implicit_blender.c index 8aa3774a3f2..64ee8d7d389 100644 --- a/source/blender/simulation/intern/implicit_blender.c +++ b/source/blender/simulation/intern/implicit_blender.c @@ -1439,7 +1439,7 @@ void SIM_mass_spring_force_drag(Implicit_Data *data, float drag) for (i = 0; i < numverts; i++) { float tmp[3][3]; - /* NB: uses root space velocity, no need to transform */ + /* NOTE: Uses root space velocity, no need to transform. */ madd_v3_v3fl(data->F[i], data->V[i], -drag); copy_m3_m3(tmp, I); diff --git a/source/blender/simulation/intern/implicit_eigen.cpp b/source/blender/simulation/intern/implicit_eigen.cpp index aa9d5d1d34d..e34d51fb227 100644 --- a/source/blender/simulation/intern/implicit_eigen.cpp +++ b/source/blender/simulation/intern/implicit_eigen.cpp @@ -797,7 +797,7 @@ void SIM_mass_spring_force_drag(Implicit_Data *data, float drag) for (int i = 0; i < numverts; i++) { float tmp[3][3]; - /* NB: uses root space velocity, no need to transform */ + /* NOTE: Uses root space velocity, no need to transform. */ madd_v3_v3fl(data->F.v3(i), data->V.v3(i), -drag); copy_m3_m3(tmp, I); |