[Bf-blender-cvs] [c751d40e070] master: Cleanup hardcoded render percentage to factor conversion
Commit: c751d40e070c6df907a526d7e3e17fc10611191e Author: Monique Dewanchand Date: Mon Nov 30 07:55:30 2020 +0100 Branches: master https://developer.blender.org/rBc751d40e070c6df907a526d7e3e17fc10611191e Cleanup hardcoded render percentage to factor conversion During revision of {D8952} one of the comments was to make a function that converts the render percentage to a factor. This to avoid code duplication. However the duplicated code was already all over the compositor code. So in order to avoid this code duplication for {D8952} I propose to first cleanup the duplicated code and build patch {D8952} based on this clean up. The method that converts the render percentage to a factor is put in the CompositorContext. Why? The CompositorContext keeps DNA information like the renderdata. DNA, and thus the CompositorContext, keeps the size of the render resolution in percentage (user oriented). The compositor needs the size of the render resolution as a factor. So the CompositorContext seems like the obvious place to have this conversion method. Why not in de NodeBase? The method could've been added to the nodebase, but I wanted to keep the nodebase as clean as possible and not put simple "conversion" methods into this base class. Also I didn't really like the call flow: you'd always have to get the renderdata size from the context and then convert. Putting it in the CompositorContext avoids this extra invoke of a call. Why not in the Converter? See nodebase. And the Converter seems more like a class for "structural" and complex node tree conversions. Not the simple conversions. Reviewed By: Sergey Sharybin Differential Revision: https://developer.blender.org/D9566 === M release/datafiles/locale M release/scripts/addons M source/blender/compositor/intern/COM_CompositorContext.h M source/blender/compositor/nodes/COM_BoxMaskNode.cpp M source/blender/compositor/nodes/COM_EllipseMaskNode.cpp M source/blender/compositor/nodes/COM_MaskNode.cpp M source/blender/compositor/nodes/COM_ScaleNode.cpp M source/blender/compositor/nodes/COM_TranslateNode.cpp M source/tools === diff --git a/release/datafiles/locale b/release/datafiles/locale index 848613f1edf..ae7e6c215c9 16 --- a/release/datafiles/locale +++ b/release/datafiles/locale @@ -1 +1 @@ -Subproject commit 848613f1edf09495bb764144461730662ac0b061 +Subproject commit ae7e6c215c9fc715cdedbc1c1e33e946fc90b496 diff --git a/release/scripts/addons b/release/scripts/addons index 35c23b4db49..866dcad5aa6 16 --- a/release/scripts/addons +++ b/release/scripts/addons @@ -1 +1 @@ -Subproject commit 35c23b4db494e58538a677c4fb0ec9ec1e8ffaa8 +Subproject commit 866dcad5aa6e45737f0634b835adcbc0871201e5 diff --git a/source/blender/compositor/intern/COM_CompositorContext.h b/source/blender/compositor/intern/COM_CompositorContext.h index e29a8f67187..46cf65bbb79 100644 --- a/source/blender/compositor/intern/COM_CompositorContext.h +++ b/source/blender/compositor/intern/COM_CompositorContext.h @@ -267,4 +267,13 @@ class CompositorContext { { return (this->getbNodeTree()->flag & NTREE_COM_GROUPNODE_BUFFER) != 0; } + + /** + * \brief Get the render percentage as a factor. + * The compositor uses a factor i.o. a percentage. + */ + float getRenderPercentageAsFactor() const + { +return m_rd->size * 0.01f; + } }; diff --git a/source/blender/compositor/nodes/COM_BoxMaskNode.cpp b/source/blender/compositor/nodes/COM_BoxMaskNode.cpp index ef62536595c..fe59bd32939 100644 --- a/source/blender/compositor/nodes/COM_BoxMaskNode.cpp +++ b/source/blender/compositor/nodes/COM_BoxMaskNode.cpp @@ -52,13 +52,14 @@ void BoxMaskNode::convertToOperations(NodeConverter &converter, /* Scale that image up to render resolution */ const RenderData *rd = context.getRenderData(); +const float render_size_factor = context.getRenderPercentageAsFactor(); ScaleFixedSizeOperation *scaleOperation = new ScaleFixedSizeOperation(); scaleOperation->setIsAspect(false); scaleOperation->setIsCrop(false); scaleOperation->setOffset(0.0f, 0.0f); -scaleOperation->setNewWidth(rd->xsch * rd->size / 100.0f); -scaleOperation->setNewHeight(rd->ysch * rd->size / 100.0f); +scaleOperation->setNewWidth(rd->xsch * render_size_factor); +scaleOperation->setNewHeight(rd->ysch * render_size_factor); scaleOperation->getInputSocket(0)->setResizeMode(COM_SC_NO_RESIZE); converter.addOperation(scaleOperation); diff --git a/source/blender/compositor/nodes/COM_EllipseMaskNode.cpp b/source/blender/compositor/nodes/COM_EllipseMaskNode.cpp index 30d00252b76..1ae855c0f1d 100644 --- a/source/blender/compositor/nodes/COM_EllipseMaskNode.cpp +++ b/source/blender/compositor/nodes/COM_EllipseMaskNode.cpp @@ -52,12 +52,14 @@ void EllipseMaskNode::convertToOpe
[Bf-blender-cvs] [f38cd7e1885] master: RNA Manual Reference: Update
Commit: f38cd7e1885e1a255728f42c660223c5285f9685 Author: Aaron Carlisle Date: Sun Nov 29 22:01:23 2020 -0500 Branches: master https://developer.blender.org/rBf38cd7e1885e1a255728f42c660223c5285f9685 RNA Manual Reference: Update === M release/scripts/modules/rna_manual_reference.py === diff --git a/release/scripts/modules/rna_manual_reference.py b/release/scripts/modules/rna_manual_reference.py index 00a77ff54c0..b14530fa633 100644 --- a/release/scripts/modules/rna_manual_reference.py +++ b/release/scripts/modules/rna_manual_reference.py @@ -59,7 +59,7 @@ url_manual_mapping = ( ("bpy.types.fluiddomainsettings.use_collision_border_back*", "physics/fluid/type/domain/settings.html#bpy-types-fluiddomainsettings-use-collision-border-back"), ("bpy.types.fluiddomainsettings.use_collision_border_left*", "physics/fluid/type/domain/settings.html#bpy-types-fluiddomainsettings-use-collision-border-left"), ("bpy.types.rendersettings_simplify_gpencil_view_modifier*", "render/cycles/render_settings/simplify.html#bpy-types-rendersettings-simplify-gpencil-view-modifier"), - ("bpy.types.brushgpencilsettings.use_settings_stabilizer*", "grease_pencil/modes/draw/tool_settings/brushes/draw_brush.html#bpy-types-brushgpencilsettings-use-settings-stabilizer"), + ("bpy.types.brushgpencilsettings.use_settings_stabilizer*", "grease_pencil/modes/draw/tools/draw.html#bpy-types-brushgpencilsettings-use-settings-stabilizer"), ("bpy.types.fluiddomainsettings.use_collision_border_top*", "physics/fluid/type/domain/settings.html#bpy-types-fluiddomainsettings-use-collision-border-top"), ("bpy.types.gpencilsculptsettings.use_multiframe_falloff*", "grease_pencil/multiframe.html#bpy-types-gpencilsculptsettings-use-multiframe-falloff"), ("bpy.types.rendersettings.simplify_gpencil_antialiasing*", "render/cycles/render_settings/simplify.html#bpy-types-rendersettings-simplify-gpencil-antialiasing"), @@ -73,6 +73,7 @@ url_manual_mapping = ( ("bpy.types.fluiddomainsettings.use_adaptive_timesteps*", "physics/fluid/type/domain/settings.html#bpy-types-fluiddomainsettings-use-adaptive-timesteps"), ("bpy.types.fluiddomainsettings.use_dissolve_smoke_log*", "physics/fluid/type/domain/settings.html#bpy-types-fluiddomainsettings-use-dissolve-smoke-log"), ("bpy.types.linestylegeometrymodifier_polygonalization*", "render/freestyle/parameter_editor/line_style/modifiers/geometry/polygonization.html#bpy-types-linestylegeometrymodifier-polygonalization"), + ("bpy.types.toolsettings.use_proportional_edit_objects*", "editors/3dview/controls/proportional_editing.html#bpy-types-toolsettings-use-proportional-edit-objects"), ("bpy.ops.view3d.edit_mesh_extrude_move_shrink_fatten*", "modeling/meshes/editing/face/extrude_faces_normal.html#bpy-ops-view3d-edit-mesh-extrude-move-shrink-fatten"), ("bpy.types.cyclesrendersettings.distance_cull_margin*", "render/cycles/render_settings/simplify.html#bpy-types-cyclesrendersettings-distance-cull-margin"), ("bpy.types.fluiddomainsettings.display_interpolation*", "physics/fluid/type/domain/gas/viewport_display.html#bpy-types-fluiddomainsettings-display-interpolation"), @@ -86,9 +87,9 @@ url_manual_mapping = ( ("bpy.types.rendersettings_simplify_gpencil_view_fill*", "render/cycles/render_settings/simplify.html#bpy-types-rendersettings-simplify-gpencil-view-fill"), ("bpy.types.brush.cloth_constraint_softbody_strength*", "sculpt_paint/sculpting/tools/cloth.html#bpy-types-brush-cloth-constraint-softbody-strength"), ("bpy.types.brush.elastic_deform_volume_preservation*", "sculpt_paint/sculpting/tools/elastic_deform.html#bpy-types-brush-elastic-deform-volume-preservation"), - ("bpy.types.brushgpencilsettings.fill_simplify_level*", "grease_pencil/modes/draw/tool_settings/brushes/fill_brush.html#bpy-types-brushgpencilsettings-fill-simplify-level"), - ("bpy.types.brushgpencilsettings.use_jitter_pressure*", "grease_pencil/modes/draw/tool_settings/brushes/draw_brush.html#bpy-types-brushgpencilsettings-use-jitter-pressure"), - ("bpy.types.brushgpencilsettings.use_settings_random*", "grease_pencil/modes/draw/tool_settings/brushes/draw_brush.html#bpy-types-brushgpencilsettings-use-settings-random"), + ("bpy.types.brushgpencilsettings.fill_simplify_level*", "grease_pencil/modes/draw/tools/fill.html#bpy-types-brushgpencilsettings-fill-simplify-level"), + ("bpy.types.brushgpencilsettings.use_jitter_pressure*", "grease_pencil/modes/draw/tools/draw.html#bpy-types-brushgpencilsettings-use-jitter-pressure"), + ("bpy.types.brushgpencilsettings.use_settings_random*", "grease_pencil/modes/draw/tools/draw.html#bpy-types-brushgpencilsettings-use-settings-random"), ("bpy.types.fluiddomainsettings.mesh_particle_radius*",
[Bf-blender-cvs] [dc40bea003b] master: Cleanup: Use LISTBASE_FOREACH macro in screen.c
Commit: dc40bea003b9814c59027a29ac0651fbedd468ab Author: Hans Goudey Date: Sun Nov 29 20:30:11 2020 -0500 Branches: master https://developer.blender.org/rBdc40bea003b9814c59027a29ac0651fbedd468ab Cleanup: Use LISTBASE_FOREACH macro in screen.c This commit replaces while loops and for loops with the equivalent macro. This results in much more readable code in some places, and it's now more apparent when the situation is more complicated than just iterating through a linked list. === M source/blender/blenkernel/intern/screen.c === diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index f43bf3182c5..97bef99944a 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -67,11 +67,10 @@ static void screen_free_data(ID *id) { bScreen *screen = (bScreen *)id; - ARegion *region; /* No animdata here. */ - for (region = screen->regionbase.first; region; region = region->next) { + LISTBASE_FOREACH (ARegion *, region, &screen->regionbase) { BKE_area_region_free(NULL, region); } @@ -325,14 +324,10 @@ static ListBase spacetypes = {NULL, NULL}; /* not SpaceType itself */ static void spacetype_free(SpaceType *st) { - ARegionType *art; - PanelType *pt; - HeaderType *ht; - - for (art = st->regiontypes.first; art; art = art->next) { + LISTBASE_FOREACH (ARegionType *, art, &st->regiontypes) { BLI_freelistN(&art->drawcalls); -for (pt = art->paneltypes.first; pt; pt = pt->next) { +LISTBASE_FOREACH (PanelType *, pt, &art->paneltypes) { if (pt->rna_ext.free) { pt->rna_ext.free(pt->rna_ext.data); } @@ -340,7 +335,7 @@ static void spacetype_free(SpaceType *st) BLI_freelistN(&pt->children); } -for (ht = art->headertypes.first; ht; ht = ht->next) { +LISTBASE_FOREACH (HeaderType *, ht, &art->headertypes) { if (ht->rna_ext.free) { ht->rna_ext.free(ht->rna_ext.data); } @@ -355,9 +350,7 @@ static void spacetype_free(SpaceType *st) void BKE_spacetypes_free(void) { - SpaceType *st; - - for (st = spacetypes.first; st; st = st->next) { + LISTBASE_FOREACH (SpaceType *, st, &spacetypes) { spacetype_free(st); } @@ -366,9 +359,7 @@ void BKE_spacetypes_free(void) SpaceType *BKE_spacetype_from_id(int spaceid) { - SpaceType *st; - - for (st = spacetypes.first; st; st = st->next) { + LISTBASE_FOREACH (SpaceType *, st, &spacetypes) { if (st->spaceid == spaceid) { return st; } @@ -378,9 +369,7 @@ SpaceType *BKE_spacetype_from_id(int spaceid) ARegionType *BKE_regiontype_from_id_or_first(const SpaceType *st, int regionid) { - ARegionType *art; - - for (art = st->regiontypes.first; art; art = art->next) { + LISTBASE_FOREACH (ARegionType *, art, &st->regiontypes) { if (art->regionid == regionid) { return art; } @@ -393,9 +382,7 @@ ARegionType *BKE_regiontype_from_id_or_first(const SpaceType *st, int regionid) ARegionType *BKE_regiontype_from_id(const SpaceType *st, int regionid) { - ARegionType *art; - - for (art = st->regiontypes.first; art; art = art->next) { + LISTBASE_FOREACH (ARegionType *, art, &st->regiontypes) { if (art->regionid == regionid) { return art; } @@ -410,10 +397,8 @@ const ListBase *BKE_spacetypes_list(void) void BKE_spacetype_register(SpaceType *st) { - SpaceType *stype; - /* sanity check */ - stype = BKE_spacetype_from_id(st->spaceid); + SpaceType *stype = BKE_spacetype_from_id(st->spaceid); if (stype) { printf("error: redefinition of spacetype %s\n", stype->name); spacetype_free(stype); @@ -432,14 +417,11 @@ bool BKE_spacetype_exists(int spaceid) void BKE_spacedata_freelist(ListBase *lb) { - SpaceLink *sl; - ARegion *region; - - for (sl = lb->first; sl; sl = sl->next) { + LISTBASE_FOREACH (SpaceLink *, sl, lb) { SpaceType *st = BKE_spacetype_from_id(sl->spacetype); /* free regions for pushed spaces */ -for (region = sl->regionbase.first; region; region = region->next) { +LISTBASE_FOREACH (ARegion *, region, &sl->regionbase) { BKE_area_region_free(st, region); } @@ -510,12 +492,10 @@ ARegion *BKE_area_region_copy(const SpaceType *st, const ARegion *region) /* from lb2 to lb1, lb1 is supposed to be freed */ static void region_copylist(SpaceType *st, ListBase *lb1, ListBase *lb2) { - ARegion *region; - /* to be sure */ BLI_listbase_clear(lb1); - for (region = lb2->first; region; region = region->next) { + LISTBASE_FOREACH (ARegion *, region, lb2) { ARegion *region_new = BKE_area_region_copy(st, region); BLI_addtail(lb1, region_new); } @@ -524,11 +504,9 @@ static void region_copylist(SpaceType *st, ListBase *lb1, ListBase *lb2) /* lb1 should be empty */ void BKE_spacedata_copylist(ListBase *lb1, ListBase
[Bf-blender-cvs] [24e22d80bd1] asset-browser: Merge branch 'master' into asset-browser
Commit: 24e22d80bd1d7b3723195b12c58b17c203ca3a4f Author: Julian Eisel Date: Mon Nov 30 00:41:52 2020 +0100 Branches: asset-browser https://developer.blender.org/rB24e22d80bd1d7b3723195b12c58b17c203ca3a4f Merge branch 'master' into asset-browser === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [56d7b11c3fc] asset-browser: Turn file previews into icons to allow access from BPY
Commit: 56d7b11c3fce87467db1df6a2900a20b86220c3e Author: Julian Eisel Date: Mon Nov 30 00:26:08 2020 +0100 Branches: asset-browser https://developer.blender.org/rB56d7b11c3fce87467db1df6a2900a20b86220c3e Turn file previews into icons to allow access from BPY That way we can expose an icon-id that scripts can use to reference the icon. The Python API for file entries has the icon-id exposed. To get this to work I had to make parts of the icon system thread safe. I added a bunch of spin locks, but as a whole it's rather weak. Part of T82977. === M source/blender/blenkernel/BKE_icons.h M source/blender/blenkernel/intern/icons.c M source/blender/editors/interface/interface_icons.c M source/blender/editors/space_file/file_draw.c M source/blender/editors/space_file/filelist.c M source/blender/editors/space_file/filelist.h M source/blender/makesdna/DNA_space_types.h M source/blender/makesrna/intern/rna_space.c === diff --git a/source/blender/blenkernel/BKE_icons.h b/source/blender/blenkernel/BKE_icons.h index 67e7901cd86..820de84a4aa 100644 --- a/source/blender/blenkernel/BKE_icons.h +++ b/source/blender/blenkernel/BKE_icons.h @@ -23,17 +23,26 @@ * \ingroup bke * * Resizable Icons for Blender + * + * There is some thread safety for this API but it is rather weak. Registering or unregistering + * icons is thread safe, changing data of icons from multiple threads is not. Practically this + * should be fine since only the main thread modifies icons. Should that change, more locks or a + * different design need to be introduced. */ #ifdef __cplusplus extern "C" { #endif +#include "BLI_compiler_attrs.h" + typedef void (*DrawInfoFreeFP)(void *drawinfo); enum { /** ID preview: obj is #ID. */ ICON_DATA_ID = 0, + /** Arbitrary Image buffer: obj is #ImBuf */ + ICON_DATA_IMBUF, /** Preview: obj is #PreviewImage */ ICON_DATA_PREVIEW, /** 2D triangles: obj is #Icon_Geom */ @@ -44,6 +53,9 @@ enum { ICON_DATA_GPLAYER, }; +/** + * \note See comment at the top regarding thread safety. + */ struct Icon { void *drawinfo; /** @@ -93,6 +105,9 @@ int BKE_icon_gplayer_color_ensure(struct bGPDlayer *gpl); int BKE_icon_preview_ensure(struct ID *id, struct PreviewImage *preview); +int BKE_icon_imbuf_create(struct ImBuf *ibuf) ATTR_WARN_UNUSED_RESULT; +struct ImBuf *BKE_icon_imbuf_get_buffer(int icon_id) ATTR_WARN_UNUSED_RESULT; + /* retrieve icon for id */ struct Icon *BKE_icon_get(const int icon_id); diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c index 6fcfa025511..27c05630a0a 100644 --- a/source/blender/blenkernel/intern/icons.c +++ b/source/blender/blenkernel/intern/icons.c @@ -81,6 +81,9 @@ static int gNextIconId = 1; static int gFirstIconId = 1; +SpinLock gIconMutex; + +/* Not mutex-protected! */ static GHash *gCachedPreviews = NULL; /* Queue of icons for deferred deletion. */ @@ -88,6 +91,7 @@ typedef struct DeferredIconDeleteNode { struct DeferredIconDeleteNode *next; int icon_id; } DeferredIconDeleteNode; +/* Also protected with gIconMutex. */ static LockfreeLinkList g_icon_delete_queue; static void icon_free(void *val) @@ -123,6 +127,12 @@ static void icon_free_data(int icon_id, Icon *icon) if (icon->obj_type == ICON_DATA_ID) { ((ID *)(icon->obj))->icon_id = 0; } + else if (icon->obj_type == ICON_DATA_IMBUF) { +ImBuf *imbuf = icon->obj; +if (imbuf) { + IMB_freeImBuf(imbuf); +} + } else if (icon->obj_type == ICON_DATA_PREVIEW) { ((PreviewImage *)(icon->obj))->icon_id = 0; } @@ -143,27 +153,40 @@ static void icon_free_data(int icon_id, Icon *icon) } } +static Icon *icon_ghash_lookup(int icon_id) +{ + Icon *icon; + BLI_spin_lock(&gIconMutex); + icon = BLI_ghash_lookup(gIcons, POINTER_FROM_INT(icon_id)); + BLI_spin_unlock(&gIconMutex); + return icon; +} + /* create an id for a new icon and make sure that ids from deleted icons get reused * after the integer number range is used up */ static int get_next_free_id(void) { - BLI_assert(BLI_thread_is_main()); + BLI_spin_lock(&gIconMutex); int startId = gFirstIconId; /* if we haven't used up the int number range, we just return the next int */ if (gNextIconId >= gFirstIconId) { -return gNextIconId++; +int next_id = gNextIconId++; +BLI_spin_unlock(&gIconMutex); +return next_id; } /* now we try to find the smallest icon id not stored in the gIcons hash */ - while (BLI_ghash_lookup(gIcons, POINTER_FROM_INT(startId)) && startId >= gFirstIconId) { + while (icon_ghash_lookup(startId) && startId >= gFirstIconId) { startId++; } /* if we found a suitable one that isn't used yet, return it */ if (startId >= gFirstIconId) { +BLI_spin_unlock(&gIconMutex); return start
[Bf-blender-cvs] [ccc45bab05b] asset-browser: Show asset preview in Asset Browser sidebar
Commit: ccc45bab05bf0e6ea8fe330e17d550e8e2444c50 Author: Julian Eisel Date: Mon Nov 30 00:39:33 2020 +0100 Branches: asset-browser https://developer.blender.org/rBccc45bab05bf0e6ea8fe330e17d550e8e2444c50 Show asset preview in Asset Browser sidebar Addresses T82977. === M release/scripts/startup/bl_ui/space_filebrowser.py === diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py b/release/scripts/startup/bl_ui/space_filebrowser.py index 5cd9f9b3587..d9fdd014fcb 100644 --- a/release/scripts/startup/bl_ui/space_filebrowser.py +++ b/release/scripts/startup/bl_ui/space_filebrowser.py @@ -17,6 +17,9 @@ # # END GPL LICENSE BLOCK # # + +import bpy + from bpy.types import Header, Panel, Menu, UIList from bpy_extras import ( @@ -580,8 +583,11 @@ class ASSETBROWSER_PT_metadata(asset_utils.AssetBrowserPanel, Panel): layout.label(text="No asset selected.") return +box = layout.box() +box.template_icon(icon_value=active_file.preview_icon_id, scale=5.0) +if bpy.ops.ed.lib_id_load_custom_preview.poll(): +box.operator("ed.lib_id_load_custom_preview", icon='FILEBROWSER', text="Load Custom") layout.prop(active_file, "name") -layout.operator("ed.lib_id_load_custom_preview", icon='FILEBROWSER') class ASSETBROWSER_PT_metadata_details(asset_utils.AssetBrowserPanel, Panel): ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [1fc2764aaf0] geometry-nodes-distribute-points: Add debug timer prints to possion for fututer performance discussions
Commit: 1fc2764aaf039866807d796b69d0a26fb251d52c Author: Sebastian Parborg Date: Mon Nov 30 00:28:36 2020 +0100 Branches: geometry-nodes-distribute-points https://developer.blender.org/rB1fc2764aaf039866807d796b69d0a26fb251d52c Add debug timer prints to possion for fututer performance discussions === M source/blender/nodes/geometry/nodes/cySampleElim.hh M source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc === diff --git a/source/blender/nodes/geometry/nodes/cySampleElim.hh b/source/blender/nodes/geometry/nodes/cySampleElim.hh index 4703aed34d6..84cce8a9198 100644 --- a/source/blender/nodes/geometry/nodes/cySampleElim.hh +++ b/source/blender/nodes/geometry/nodes/cySampleElim.hh @@ -60,10 +60,13 @@ //--- #include "MEM_guardedalloc.h" + #include #include #include #include +#include + #include #include #include @@ -870,8 +873,11 @@ class WeightedSampleElimination { } }); }; -for (SIZE_TYPE i = 0; i < inputSize; i++) { - AddWeights(i, inputPoints[i]); +{ + SCOPED_TIMER("poisson KDtree weight assignmet"); + for (SIZE_TYPE i = 0; i < inputSize; i++) { +AddWeights(i, inputPoints[i]); + } } // Build a heap for the samples using their weights @@ -895,16 +901,20 @@ class WeightedSampleElimination { }); }; SIZE_TYPE sampleSize = inputSize; -// Stop when the top heap item has a weight of zero. -// We have to return at least one point otherwise the heap triggers a ASAN error -while (heap.GetTopItem() > (0.5f * 1e-5f) && heap.NumItemsInHeap() > 1) { - // Pull the top sample from heap - SIZE_TYPE i = heap.GetTopItemID(); - heap.Pop(); - // For each sample around it, remove its weight contribution and update - // the heap - RemoveWeights(i, inputPoints[i]); - sampleSize--; + +{ + SCOPED_TIMER("poisson Heap weight elimination"); + // Stop when the top heap item has a weight of zero. + // We have to return at least one point otherwise the heap triggers a ASAN error + while (heap.GetTopItem() > (0.5f * 1e-5f) && heap.NumItemsInHeap() > 1) { +// Pull the top sample from heap +SIZE_TYPE i = heap.GetTopItemID(); +heap.Pop(); +// For each sample around it, remove its weight contribution and update +// the heap +RemoveWeights(i, inputPoints[i]); +sampleSize--; + } } // Copy the samples to the output array diff --git a/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc b/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc index 23c0c6af6fd..4755eb27bea 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc @@ -19,6 +19,7 @@ #include "BLI_math_vector.h" #include "BLI_rand.hh" #include "BLI_span.hh" +#include "BLI_timeit.hh" #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" @@ -123,74 +124,88 @@ static Vector poisson_scatter_points_from_mesh(const Mesh *mesh, int quality = 5; Vector remove_point; - for (const int looptri_index : IndexRange(looptris_len)) { -const MLoopTri &looptri = looptris[looptri_index]; -const int v0_index = mesh->mloop[looptri.tri[0]].v; -const int v1_index = mesh->mloop[looptri.tri[1]].v; -const int v2_index = mesh->mloop[looptri.tri[2]].v; -const float3 v0_pos = mesh->mvert[v0_index].co; -const float3 v1_pos = mesh->mvert[v1_index].co; -const float3 v2_pos = mesh->mvert[v2_index].co; -const float area = area_tri_v3(v0_pos, v1_pos, v2_pos); -const float v0_density_factor = std::max(0.0f, density_factors[v0_index]); -const float v1_density_factor = std::max(0.0f, density_factors[v1_index]); -const float v2_density_factor = std::max(0.0f, density_factors[v2_index]); - -const int looptri_seed = BLI_hash_int(looptri_index + seed); -RandomNumberGenerator looptri_rng(looptri_seed); - -const float points_amount_fl = quality * area / (2.0f * sqrtf(3.0f) * min_dist * min_dist); -const float add_point_probability = fractf(points_amount_fl); -const bool add_point = add_point_probability > looptri_rng.get_float(); -const int point_amount = (int)points_amount_fl + (int)add_point; - -for (int i = 0; i < point_amount; i++) { - const float3 bary_coords = looptri_rng.get_barycentric_coordinates(); - float3 point_pos; - interp_v3_v3v3v3(point_pos, v0_pos, v1_pos, v2_pos, bary_coords); - points.append(point_pos); - - const float weight = bary_coords[0] * v0_density_factor + - bary_coords[1] * v1_density_factor + bary_coords[2] * v
[Bf-blender-cvs] [748f468fdc7] master: Cleanup: Use "region" for ARegion variable names
Commit: 748f468fdc7b80b7e84a854c63443050fcacad9c Author: Hans Goudey Date: Sun Nov 29 18:10:47 2020 -0500 Branches: master https://developer.blender.org/rB748f468fdc7b80b7e84a854c63443050fcacad9c Cleanup: Use "region" for ARegion variable names As proposed in T74432 and already implemented in several commits, "region" is the preferred name for `ARegion` variables, rather than any variant of "ar". This commit changes a few "ar" variables that have popped up over time and also adjusted names of variants like "arnew". === M source/blender/blenkernel/intern/screen.c M source/blender/blenloader/intern/versioning_270.c M source/blender/draw/intern/draw_manager.c M source/blender/editors/interface/interface_handlers.c M source/blender/editors/object/object_modes.c M source/blender/editors/object/object_remesh.c M source/blender/editors/screen/area.c M source/blender/editors/screen/screen_edit.c M source/blender/editors/sculpt_paint/sculpt.c M source/blender/editors/space_view3d/view3d_utils.c M source/blender/editors/uvedit/uvedit_rip.c M source/blender/windowmanager/intern/wm_event_system.c === diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index 8662fce3dcc..f43bf3182c5 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -516,8 +516,8 @@ static void region_copylist(SpaceType *st, ListBase *lb1, ListBase *lb2) BLI_listbase_clear(lb1); for (region = lb2->first; region; region = region->next) { -ARegion *arnew = BKE_area_region_copy(st, region); -BLI_addtail(lb1, arnew); +ARegion *region_new = BKE_area_region_copy(st, region); +BLI_addtail(lb1, region_new); } } diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index 41e46f8f0a0..adc2b55b350 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -245,13 +245,13 @@ static void do_version_action_editor_properties_region(ListBase *regionbase) } if (region->regiontype == RGN_TYPE_WINDOW) { /* add new region here */ - ARegion *arnew = MEM_callocN(sizeof(ARegion), "buttons for action"); + ARegion *region_new = MEM_callocN(sizeof(ARegion), "buttons for action"); - BLI_insertlinkbefore(regionbase, region, arnew); + BLI_insertlinkbefore(regionbase, region, region_new); - arnew->regiontype = RGN_TYPE_UI; - arnew->alignment = RGN_ALIGN_RIGHT; - arnew->flag = RGN_FLAG_HIDDEN; + region_new->regiontype = RGN_TYPE_UI; + region_new->alignment = RGN_ALIGN_RIGHT; + region_new->flag = RGN_FLAG_HIDDEN; return; } diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 99f102680e5..988975bd399 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -1512,10 +1512,10 @@ void DRW_draw_view(const bContext *C) } else { Depsgraph *depsgraph = CTX_data_expect_evaluated_depsgraph(C); -ARegion *ar = CTX_wm_region(C); -GPUViewport *viewport = WM_draw_region_get_bound_viewport(ar); +ARegion *region = CTX_wm_region(C); +GPUViewport *viewport = WM_draw_region_get_bound_viewport(region); drw_state_prepare_clean_for_draw(&DST); -DRW_draw_render_loop_2d_ex(depsgraph, ar, viewport, C); +DRW_draw_render_loop_2d_ex(depsgraph, region, viewport, C); } } diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 4fe4bbaf189..3c028977a36 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -8363,8 +8363,8 @@ uiBut *UI_context_active_but_get(const bContext *C) */ uiBut *UI_context_active_but_get_respect_menu(const bContext *C) { - ARegion *ar_menu = CTX_wm_menu(C); - return ui_context_button_active(ar_menu ? ar_menu : CTX_wm_region(C), NULL); + ARegion *region_menu = CTX_wm_menu(C); + return ui_context_button_active(region_menu ? region_menu : CTX_wm_region(C), NULL); } uiBut *UI_region_active_but_get(ARegion *region) diff --git a/source/blender/editors/object/object_modes.c b/source/blender/editors/object/object_modes.c index 9eaa8f3d31b..5a6fa2b8e3e 100644 --- a/source/blender/editors/object/object_modes.c +++ b/source/blender/editors/object/object_modes.c @@ -423,7 +423,7 @@ static bool object_switch_object_poll(bContext *C) static int object_switch_object_invoke(bContext *C, wmOperator *op, const wmEvent *event) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); Scene *scene = CTX_data_scene(C); ViewLayer *view_la
[Bf-blender-cvs] [dca9aa0053f] master: Deps: PugiXML 1.10
Commit: dca9aa0053f7d711c1b42a4f2042827a1e286bea Author: Ray Molenkamp Date: Sun Nov 29 14:01:33 2020 -0700 Branches: master https://developer.blender.org/rBdca9aa0053f7d711c1b42a4f2042827a1e286bea Deps: PugiXML 1.10 This separates out PugiXML that was previously bundled by OIIO. As this linux/mac libs are not available this commit only contains the builder and windows changes, and the option to enable pugixml is guarded by a platform if, this can be removed once all platforms have committed the svn libs. For details see D8628 === M CMakeLists.txt M build_files/build_environment/CMakeLists.txt M build_files/build_environment/cmake/harvest.cmake M build_files/build_environment/cmake/openimageio.cmake M build_files/build_environment/cmake/osl.cmake M build_files/build_environment/cmake/pugixml.cmake M build_files/cmake/platform/platform_win32.cmake M intern/cycles/kernel/osl/CMakeLists.txt === diff --git a/CMakeLists.txt b/CMakeLists.txt index f2af75f2745..90f9e432878 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -178,6 +178,9 @@ mark_as_advanced(BUILDINFO_OVERRIDE_TIME) option(WITH_IK_ITASC "Enable ITASC IK solver (only disable for development & for incompatible C++ compilers)" ON) option(WITH_IK_SOLVER "Enable Legacy IK solver (only disable for development)" ON) option(WITH_FFTW3 "Enable FFTW3 support (Used for smoke, ocean sim, and audio effects)" ON) +if(WIN32) + option(WITH_PUGIXML "Enable PugiXML support (Used for OpenImageIO, Grease Pencil SVG export)" ON) +endif() option(WITH_BULLET"Enable Bullet (Physics Engine)" ON) option(WITH_SYSTEM_BULLET "Use the systems bullet library (currently unsupported due to missing features in upstream!)" ) mark_as_advanced(WITH_SYSTEM_BULLET) @@ -697,6 +700,10 @@ set_and_warn_dependency(WITH_BOOST WITH_OPENCOLORIOOFF) set_and_warn_dependency(WITH_BOOST WITH_QUADRIFLOW OFF) set_and_warn_dependency(WITH_BOOST WITH_USDOFF) set_and_warn_dependency(WITH_BOOST WITH_ALEMBICOFF) +if(WIN32) + set_and_warn_dependency(WITH_PUGIXML WITH_CYCLES_OSL OFF) + set_and_warn_dependency(WITH_PUGIXML WITH_OPENIMAGEIO OFF) +endif() if(WITH_BOOST AND NOT (WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_INTERNATIONAL OR WITH_OPENVDB OR WITH_OPENCOLORIO OR WITH_USD OR WITH_ALEMBIC)) diff --git a/build_files/build_environment/CMakeLists.txt b/build_files/build_environment/CMakeLists.txt index 0bc85f20c16..dfbb0e824a0 100644 --- a/build_files/build_environment/CMakeLists.txt +++ b/build_files/build_environment/CMakeLists.txt @@ -94,11 +94,7 @@ include(cmake/usd.cmake) include(cmake/potrace.cmake) # Boost needs to be included after python.cmake due to the PYTHON_BINARY variable being needed. include(cmake/boost.cmake) -if(UNIX) - # Rely on PugiXML compiled with OpenImageIO -else() - include(cmake/pugixml.cmake) -endif() +include(cmake/pugixml.cmake) if((NOT APPLE) OR ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64")) include(cmake/ispc.cmake) include(cmake/openimagedenoise.cmake) diff --git a/build_files/build_environment/cmake/harvest.cmake b/build_files/build_environment/cmake/harvest.cmake index 1c5354aeb42..0f9b67a3d44 100644 --- a/build_files/build_environment/cmake/harvest.cmake +++ b/build_files/build_environment/cmake/harvest.cmake @@ -156,6 +156,8 @@ harvest(osl/lib osl/lib "*.a") harvest(osl/shaders osl/shaders "*.h") harvest(png/include png/include "*.h") harvest(png/lib png/lib "*.a") +harvest(pugixml/include pugixml/include "*.hpp") +harvest(pugixml/lib pugixml/lib "*.a") harvest(python/bin python/bin "python${PYTHON_SHORT_VERSION}m") harvest(python/include python/include "*h") harvest(python/lib python/lib "*") diff --git a/build_files/build_environment/cmake/openimageio.cmake b/build_files/build_environment/cmake/openimageio.cmake index 4254d923de1..50fd67eca8e 100644 --- a/build_files/build_environment/cmake/openimageio.cmake +++ b/build_files/build_environment/cmake/openimageio.cmake @@ -112,6 +112,9 @@ set(OPENIMAGEIO_EXTRA_ARGS -DOPENEXR_IEX_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}Iex${OPENEXR_VERSION_POSTFIX}${LIBEXT} -DOPENEXR_ILMIMF_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf${OPENEXR_VERSION_POSTFIX}${LIBEXT} -DSTOP_ON_WARNING=OFF + -DUSE_EXTERNAL_PUGIXML=ON + -DPUGIXML_LIBRARY=${LIBDIR}/pugixml/lib/${LIBPREFIX}pugixml${LIBEXT} + -DPUGIXML_INCLUDE_DIR=${LIBDIR}/pugixml/include/ ${WEBP_FLAGS} ${OIIO_SIMD_FLAGS} ) @@ -134,6 +137,7 @@ add_dependencies( external_jpeg external_boost external_tiff + external_pugixml external_openjpeg${OPENJPEG_POSTFIX} ${WEBP_DEP} ) diff --git a/build_files/build_environment/cmake/osl.cmake b/build_files/build_environment/cmake/osl.cmake index db70b2937b8..118657461fe 100644 --- a/build_files/build_environment/cmake/
[Bf-blender-cvs] [176324aa5cf] master: QuadriFlow: Fix std::allocator deprecation warnings
Commit: 176324aa5cfcf0703dfae296028bc3aef1ff5f14 Author: Ankit Meel Date: Sun Nov 29 16:12:34 2020 +0530 Branches: master https://developer.blender.org/rB176324aa5cfcf0703dfae296028bc3aef1ff5f14 QuadriFlow: Fix std::allocator deprecation warnings https://en.cppreference.com/w/cpp/memory/allocator/construct "(deprecated in C++17) (removed in C++20)" Same for `destroy`. Reviewed By: zeddb Differential Revision: https://developer.blender.org/D9657 === M extern/quadriflow/3rd/lemon-1.3.1/lemon/bits/array_map.h M extern/quadriflow/patches/blender.patch === diff --git a/extern/quadriflow/3rd/lemon-1.3.1/lemon/bits/array_map.h b/extern/quadriflow/3rd/lemon-1.3.1/lemon/bits/array_map.h index 355ee008246..a770bbee60c 100644 --- a/extern/quadriflow/3rd/lemon-1.3.1/lemon/bits/array_map.h +++ b/extern/quadriflow/3rd/lemon-1.3.1/lemon/bits/array_map.h @@ -88,7 +88,7 @@ namespace lemon { Item it; for (nf->first(it); it != INVALID; nf->next(it)) { int id = nf->id(it);; -allocator.construct(&(values[id]), Value()); +std::allocator_traits::construct(allocator, &(values[id]), Value()); } } @@ -218,15 +218,15 @@ namespace lemon { for (nf->first(it); it != INVALID; nf->next(it)) { int jd = nf->id(it);; if (id != jd) { -allocator.construct(&(new_values[jd]), values[jd]); -allocator.destroy(&(values[jd])); +std::allocator_traits::construct(allocator, &(new_values[jd]), values[jd]); +std::allocator_traits::destroy(allocator, &(values[jd])); } } if (capacity != 0) allocator.deallocate(values, capacity); values = new_values; capacity = new_capacity; } - allocator.construct(&(values[id]), Value()); + std::allocator_traits::construct(allocator, &(values[id]), Value()); } // \brief Adds more new keys to the map. @@ -260,8 +260,8 @@ namespace lemon { } } if (found) continue; - allocator.construct(&(new_values[id]), values[id]); - allocator.destroy(&(values[id])); + std::allocator_traits::construct(allocator, &(new_values[id]), values[id]); + std::allocator_traits::destroy(allocator, &(values[id])); } if (capacity != 0) allocator.deallocate(values, capacity); values = new_values; @@ -269,7 +269,7 @@ namespace lemon { } for (int i = 0; i < int(keys.size()); ++i) { int id = nf->id(keys[i]); -allocator.construct(&(values[id]), Value()); +std::allocator_traits::construct(allocator, &(values[id]), Value()); } } @@ -279,7 +279,7 @@ namespace lemon { // and it overrides the erase() member function of the observer base. virtual void erase(const Key& key) { int id = Parent::notifier()->id(key); - allocator.destroy(&(values[id])); + std::allocator_traits::destroy(allocator, &(values[id])); } // \brief Erase more keys from the map. @@ -289,7 +289,7 @@ namespace lemon { virtual void erase(const std::vector& keys) { for (int i = 0; i < int(keys.size()); ++i) { int id = Parent::notifier()->id(keys[i]); -allocator.destroy(&(values[id])); +std::allocator_traits::destroy(allocator, &(values[id])); } } @@ -303,7 +303,7 @@ namespace lemon { Item it; for (nf->first(it); it != INVALID; nf->next(it)) { int id = nf->id(it);; -allocator.construct(&(values[id]), Value()); +std::allocator_traits::construct(allocator, &(values[id]), Value()); } } @@ -317,7 +317,7 @@ namespace lemon { Item it; for (nf->first(it); it != INVALID; nf->next(it)) { int id = nf->id(it); - allocator.destroy(&(values[id])); + std::allocator_traits::destroy(allocator, &(values[id])); } allocator.deallocate(values, capacity); capacity = 0; diff --git a/extern/quadriflow/patches/blender.patch b/extern/quadriflow/patches/blender.patch index 6405a47e262..9e694a2d616 100644 --- a/extern/quadriflow/patches/blender.patch +++ b/extern/quadriflow/patches/blender.patch @@ -143,3 +143,91 @@ index 8de74ede8a9..f9861f39169 100644 num = length - shift; while (num--) { +diff --git a/extern/quadriflow/3rd/lemon-1.3.1/lemon/bits/array_map.h b/extern/quadriflow/3rd/lemon-1.3.1/lemon/bits/array_map.h +index 355ee008246..a770bbee60c 100644 +--- a/extern/quadriflow/3rd/lemon-1.3.1/lemon/bits/array_map.h b/extern/quadriflow/3rd/lemon-1.3.1/lemon/bits/array_map.h +@@ -88,7 +88,7 @@ namespace lemon { + Item it; + for (nf->first(it); it != INVALID; nf->next(it)) { + int id = nf->id(it);; +-allocator.construct(&(values[id]), Value()); ++
[Bf-blender-cvs] [11f0169e887] master: Run clang-format to fix line length after D8915.
Commit: 11f0169e887e241b4f638cfbea18e2ddb1bfad9b Author: Alexander Gavrilov Date: Sun Nov 29 17:26:33 2020 +0300 Branches: master https://developer.blender.org/rB11f0169e887e241b4f638cfbea18e2ddb1bfad9b Run clang-format to fix line length after D8915. === M source/blender/blenkernel/intern/constraint.c === diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index bc918df84ed..5497065bb34 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -1834,9 +1834,9 @@ static void rotlike_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar mat4_to_eulO(obeul, rot_order, cob->matrix); /* We must get compatible eulers from the beginning because * some of them can be modified below (see bug T21875). - * Additionally, since this constraint is based on euler rotation math, it doesn't work well with shear. - * The Y axis is chosen as the main axis when we orthoganalize the matrix because constraints are - * used most commonly on bones. */ + * Additionally, since this constraint is based on euler rotation math, it doesn't work well + * with shear. The Y axis is chosen as the main axis when we orthoganalize the matrix because + * constraints are used most commonly on bones. */ float mat[4][4]; copy_m4_m4(mat, ct->matrix); orthogonalize_m4_stable(mat, 1, true); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [13c820d87b6] master: CMake/macOS: Use custom LIBDIR if set on CLI
Commit: 13c820d87b62ea55c262bfb2805bd19ae65ddc07 Author: Rebecca Dengate Date: Sun Nov 29 13:21:54 2020 +0530 Branches: master https://developer.blender.org/rB13c820d87b62ea55c262bfb2805bd19ae65ddc07 CMake/macOS: Use custom LIBDIR if set on CLI Reviewed By: ankitm Maniphest Tasks: T83174 Differential Revision: https://developer.blender.org/D9664 === M build_files/cmake/platform/platform_apple.cmake === diff --git a/build_files/cmake/platform/platform_apple.cmake b/build_files/cmake/platform/platform_apple.cmake index d9772093235..586c72c9c7e 100644 --- a/build_files/cmake/platform/platform_apple.cmake +++ b/build_files/cmake/platform/platform_apple.cmake @@ -73,9 +73,6 @@ endif() if(NOT DEFINED LIBDIR) set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin) - # Prefer lib directory paths - file(GLOB LIB_SUBDIRS ${LIBDIR}/*) - set(CMAKE_PREFIX_PATH ${LIB_SUBDIRS}) else() message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}") endif() @@ -83,6 +80,10 @@ if(NOT EXISTS "${LIBDIR}/") message(FATAL_ERROR "Mac OSX requires pre-compiled libs at: '${LIBDIR}'") endif() +# Prefer lib directory paths +file(GLOB LIB_SUBDIRS ${LIBDIR}/*) +set(CMAKE_PREFIX_PATH ${LIB_SUBDIRS}) + # - # Find precompiled libraries, and avoid system or user-installed ones. ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs