From 2aca1d85e6c5f360f9faf8b2e95d9c2c1b1390db Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Fri, 16 Sep 2016 17:03:44 +0200 Subject: Improve description of move operator direction properties These may be exposed in UI (keymap editor & redo panel), so better avoid using identifiers like "UP" "DOWN". They are redundant anyway (already displayed). --- source/blender/editors/armature/pose_group.c | 3 ++- source/blender/editors/armature/pose_lib.c | 3 ++- source/blender/editors/object/object_vgroup.c | 3 ++- source/blender/editors/render/render_shading.c | 12 ++++++++---- source/blender/editors/space_file/file_ops.c | 3 ++- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/source/blender/editors/armature/pose_group.c b/source/blender/editors/armature/pose_group.c index 4d9df06f33f..85bee023cef 100644 --- a/source/blender/editors/armature/pose_group.c +++ b/source/blender/editors/armature/pose_group.c @@ -365,7 +365,8 @@ void POSE_OT_group_move(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - RNA_def_enum(ot->srna, "direction", group_slot_move, 0, "Direction", "Direction to move, UP or DOWN"); + RNA_def_enum(ot->srna, "direction", group_slot_move, 0, "Direction", + "Direction to move the active Bone Group towards"); } /* bone group sort element */ diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c index 2012237ed4e..f860614231e 100644 --- a/source/blender/editors/armature/pose_lib.c +++ b/source/blender/editors/armature/pose_lib.c @@ -824,7 +824,8 @@ void POSELIB_OT_pose_move(wmOperatorType *ot) RNA_def_property_flag(prop, PROP_ENUM_NO_TRANSLATE); ot->prop = prop; - RNA_def_enum(ot->srna, "direction", pose_lib_pose_move, 0, "Direction", "Direction to move, UP or DOWN"); + RNA_def_enum(ot->srna, "direction", pose_lib_pose_move, 0, "Direction", + "Direction to move the chosen pose towards"); } diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index ad41fb23a69..3b7f518d36f 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -3687,7 +3687,8 @@ void OBJECT_OT_vertex_group_move(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - RNA_def_enum(ot->srna, "direction", vgroup_slot_move, 0, "Direction", "Direction to move, UP or DOWN"); + RNA_def_enum(ot->srna, "direction", vgroup_slot_move, 0, "Direction", + "Direction to move the active vertex group towards"); } static void vgroup_copy_active_to_sel_single(Object *ob, const int def_nr) diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 5a0c250c777..4796024646c 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -449,7 +449,8 @@ void OBJECT_OT_material_slot_move(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - RNA_def_enum(ot->srna, "direction", material_slot_move, 0, "Direction", "Direction to move, UP or DOWN"); + RNA_def_enum(ot->srna, "direction", material_slot_move, 0, "Direction", + "Direction to move the active material towards"); } /********************** new material operator *********************/ @@ -861,7 +862,8 @@ void SCENE_OT_freestyle_module_move(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; /* props */ - RNA_def_enum(ot->srna, "direction", direction_items, 0, "Direction", "Direction to move, UP or DOWN"); + RNA_def_enum(ot->srna, "direction", direction_items, 0, "Direction", + "Direction to move the chosen style module towards"); } static int freestyle_lineset_add_exec(bContext *C, wmOperator *UNUSED(op)) @@ -1024,7 +1026,8 @@ void SCENE_OT_freestyle_lineset_move(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; /* props */ - RNA_def_enum(ot->srna, "direction", direction_items, 0, "Direction", "Direction to move, UP or DOWN"); + RNA_def_enum(ot->srna, "direction", direction_items, 0, "Direction", + "Direction to move the active line set towards"); } static int freestyle_linestyle_new_exec(bContext *C, wmOperator *op) @@ -1396,7 +1399,8 @@ void SCENE_OT_freestyle_modifier_move(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; /* props */ - RNA_def_enum(ot->srna, "direction", direction_items, 0, "Direction", "Direction to move, UP or DOWN"); + RNA_def_enum(ot->srna, "direction", direction_items, 0, "Direction", + "Direction to move the chosen modifier towards"); } static int freestyle_stroke_material_create_exec(bContext *C, wmOperator *op) diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 9f5e98d2431..b7228f634bf 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -1061,7 +1061,8 @@ void FILE_OT_bookmark_move(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER; /* No undo! */ - RNA_def_enum(ot->srna, "direction", slot_move, 0, "Direction", "Direction to move, UP or DOWN"); + RNA_def_enum(ot->srna, "direction", slot_move, 0, "Direction", + "Direction to move the active bookmark towards"); } static int reset_recent_exec(bContext *C, wmOperator *UNUSED(op)) -- cgit v1.2.3 From 716e712a8342fb9b27810ea01385aca65f7d7cd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 16 Sep 2016 17:32:46 +0200 Subject: Pose library sorting: return OPERATOR_CANCELLED when no-op A no-op happens when trying to move the top pose further up, or the bottom pose further down. --- source/blender/editors/armature/pose_lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c index f860614231e..b200aa2401b 100644 --- a/source/blender/editors/armature/pose_lib.c +++ b/source/blender/editors/armature/pose_lib.c @@ -770,7 +770,7 @@ static int poselib_move_exec(bContext *C, wmOperator *op) void *prev = marker->prev; if (prev == NULL) - return OPERATOR_FINISHED; + return OPERATOR_CANCELLED; BLI_remlink(&act->markers, marker); BLI_insertlinkbefore(&act->markers, prev, marker); @@ -779,7 +779,7 @@ static int poselib_move_exec(bContext *C, wmOperator *op) void *next = marker->next; if (next == NULL) - return OPERATOR_FINISHED; + return OPERATOR_CANCELLED; BLI_remlink(&act->markers, marker); BLI_insertlinkafter(&act->markers, next, marker); -- cgit v1.2.3 From 634508ca3f3197785100b49070486d02f36df1ee Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 16 Sep 2016 17:49:56 +0200 Subject: Buildbot: Disable QuickTime for the time being Buildbot machine was updated to the new SDK which seems to have QTKit removed. For until we've installed older SDK or ported our code to a new AVFramework disabling QuickTime. --- build_files/buildbot/slave_compile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/build_files/buildbot/slave_compile.py b/build_files/buildbot/slave_compile.py index d763ddfb3e0..b7feae1ed8c 100644 --- a/build_files/buildbot/slave_compile.py +++ b/build_files/buildbot/slave_compile.py @@ -74,6 +74,7 @@ if 'cmake' in builder: cmake_extra_options.append('-DCMAKE_OSX_ARCHITECTURES:STRING=x86_64') cmake_extra_options.append('-DCUDA_NVCC_EXECUTABLE=/usr/local/cuda-hack/bin/nvcc') cmake_extra_options.append('-DCUDA_NVCC8_EXECUTABLE=/usr/local/cuda8-hack/bin/nvcc') + cmake_extra_options.append('-DWITH_CODEC_QUICKTIME=OFF') elif builder.startswith('win'): if builder.endswith('_vc2015'): -- cgit v1.2.3 From c9c933ac812e0f8b780f1876f36a440af195327b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 16 Sep 2016 18:21:20 +0200 Subject: Pose Library pose list: Default to 5 rows to match the new up/down buttons The buttons now nicely align with the pose list itself. --- release/scripts/startup/bl_ui/properties_data_armature.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/scripts/startup/bl_ui/properties_data_armature.py b/release/scripts/startup/bl_ui/properties_data_armature.py index 54942afdb54..8261f0c7770 100644 --- a/release/scripts/startup/bl_ui/properties_data_armature.py +++ b/release/scripts/startup/bl_ui/properties_data_armature.py @@ -181,7 +181,7 @@ class DATA_PT_pose_library(ArmatureButtonsPanel, Panel): # list of poses in pose library row = layout.row() row.template_list("UI_UL_list", "pose_markers", poselib, "pose_markers", - poselib.pose_markers, "active_index", rows=3) + poselib.pose_markers, "active_index", rows=5) # column of operators for active pose # - goes beside list -- cgit v1.2.3 From cade262c472374dc397311dabd900c8763598c70 Mon Sep 17 00:00:00 2001 From: Thomas Beck Date: Sat, 17 Sep 2016 00:21:34 +0200 Subject: OpenGL render: Bugfix (unreported) after rB6f92604e539b2114763150fb1ace60d28e59a889 Crashes occured immediately when clicking on "OpenGL render image" because there was only a task pool created previously when it was an animation. Solved it by introducing a variable is_animation to the openglrender and omitting the task_pool call when it's no animation. @sergey: Please check my changes, moved the pool_ok and the lock into the is_animation clause. --- source/blender/editors/render/render_opengl.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index ee2772ce31a..a154791f8f7 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -133,6 +133,7 @@ typedef struct OGLRender { TaskPool *task_pool; bool pool_ok; + bool is_animation; SpinLock reports_lock; #ifdef DEBUG_TIME @@ -636,6 +637,7 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op) oglrender->cfrao = scene->r.cfra; oglrender->write_still = is_write_still && !is_animation; + oglrender->is_animation = is_animation; oglrender->views_len = BKE_scene_multiview_num_views_get(&scene->r); @@ -701,12 +703,12 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op) oglrender->task_pool = BLI_task_pool_create(task_scheduler, oglrender); } + oglrender->pool_ok = true; + BLI_spin_init(&oglrender->reports_lock); } else { oglrender->task_pool = NULL; } - oglrender->pool_ok = true; - BLI_spin_init(&oglrender->reports_lock); #ifdef DEBUG_TIME oglrender->time_start = PIL_check_seconds_timer(); @@ -721,9 +723,11 @@ static void screen_opengl_render_end(bContext *C, OGLRender *oglrender) Scene *scene = oglrender->scene; int i; - BLI_task_pool_work_and_wait(oglrender->task_pool); - BLI_task_pool_free(oglrender->task_pool); - BLI_spin_end(&oglrender->reports_lock); + if (oglrender->is_animation) { + BLI_task_pool_work_and_wait(oglrender->task_pool); + BLI_task_pool_free(oglrender->task_pool); + BLI_spin_end(&oglrender->reports_lock); + } #ifdef DEBUG_TIME printf("Total render time: %f\n", PIL_check_seconds_timer() - oglrender->time_start); -- cgit v1.2.3 From 09925d52f5867dbe91dc867e404e248c9a92295a Mon Sep 17 00:00:00 2001 From: Antonioya Date: Sat, 17 Sep 2016 09:01:09 +0200 Subject: Fix T49383: Color pickers are available if the color is locked If the color is locked, the row is disabled, but the picker is still available. This error was present in older versions for layer color. --- release/scripts/startup/bl_ui/properties_grease_pencil_common.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py index feff5d4f829..04931b70ff1 100644 --- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py +++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py @@ -491,6 +491,7 @@ class GPENCIL_PIE_settings_palette(Menu): # W - Stroke draw settings col = pie.column(align=True) if palcolor is not None: + col.enabled = not palcolor.lock col.label(text="Stroke") col.prop(palcolor, "color", text="") col.prop(palcolor, "alpha", text="", slider=True) @@ -498,6 +499,7 @@ class GPENCIL_PIE_settings_palette(Menu): # E - Fill draw settings col = pie.column(align=True) if palcolor is not None: + col.enabled = not palcolor.lock col.label(text="Fill") col.prop(palcolor, "fill_color", text="") col.prop(palcolor, "fill_alpha", text="", slider=True) @@ -700,6 +702,7 @@ class GPENCIL_UL_palettecolor(UIList): split = layout.split(percentage=0.25) row = split.row(align=True) + row.enabled = not palcolor.lock row.prop(palcolor, "color", text="", emboss=palcolor.is_stroke_visible) row.prop(palcolor, "fill_color", text="", emboss=palcolor.is_fill_visible) split.prop(palcolor, "name", text="", emboss=False) @@ -888,6 +891,7 @@ class GreasePencilDataPanel: col = split.column() subcol = col.column(align=True) subcol.label("Tint") + subcol.enabled = not gpl.lock subcol.prop(gpl, "tint_color", text="") subcol.prop(gpl, "tint_factor", text="Factor", slider=True) @@ -1025,14 +1029,14 @@ class GreasePencilPaletteColorPanel: # Column 1 - Stroke col = split.column(align=True) - col.active = not pcolor.lock + col.enabled = not pcolor.lock col.label(text="Stroke:") col.prop(pcolor, "color", text="") col.prop(pcolor, "alpha", slider=True) # Column 2 - Fill col = split.column(align=True) - col.active = not pcolor.lock + col.enabled = not pcolor.lock col.label(text="Fill:") col.prop(pcolor, "fill_color", text="") col.prop(pcolor, "fill_alpha", text="Opacity", slider=True) -- cgit v1.2.3 From 40247ee491fbe7517a4de3920c3616c9329cde6d Mon Sep 17 00:00:00 2001 From: lazydodo Date: Sat, 17 Sep 2016 09:19:54 -0600 Subject: [Windows/make.bat] Clean only after all parameters have been processed so the full path is known, and require a convenience target to be set. Also added a helpful error message if any of the required data is not available. --- make.bat | 85 ++++++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 51 insertions(+), 34 deletions(-) diff --git a/make.bat b/make.bat index 99c1e7fe6e1..4f911c3582f 100644 --- a/make.bat +++ b/make.bat @@ -13,30 +13,7 @@ if NOT "%1" == "" ( REM Help Message if "%1" == "help" ( - echo. - echo Convenience targets - echo - release - echo - debug - echo - full - echo - lite - echo - headless - echo - cycles - echo - bpy - echo. - echo Utilities ^(not associated with building^) - echo - clean - echo - update - echo - nobuild ^(only generate project files^) - echo - showhash ^(Show git hashes of source tree^) - echo. - echo Configuration options - echo - packagename [newname] ^(override default cpack package name^) - echo - x86 ^(override host autodetect and build 32 bit code^) - echo - x64 ^(override host autodetect and build 64 bit code^) - echo - 2013 ^(build with visual studio 2013^) - echo - 2015 ^(build with visual studio 2015^) [EXPERIMENTAL] - echo. - goto EOF + goto HELP ) REM Build Types @@ -46,26 +23,32 @@ if NOT "%1" == "" ( REM Build Configurations ) else if "%1" == "full" ( + set TARGET_SET=1 set BUILD_DIR=%BUILD_DIR%_full set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^ -C"%BLENDER_DIR%\build_files\cmake\config\blender_full.cmake" ) else if "%1" == "lite" ( + set TARGET_SET=1 set BUILD_DIR=%BUILD_DIR%_lite set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^ -C"%BLENDER_DIR%\build_files\cmake\config\blender_lite.cmake" ) else if "%1" == "cycles" ( + set TARGET_SET=1 set BUILD_DIR=%BUILD_DIR%_cycles set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^ -C"%BLENDER_DIR%\build_files\cmake\config\cycles_standalone.cmake" ) else if "%1" == "headless" ( + set TARGET_SET=1 set BUILD_DIR=%BUILD_DIR%_headless set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^ -C"%BLENDER_DIR%\build_files\cmake\config\blender_headless.cmake" ) else if "%1" == "bpy" ( + set TARGET_SET=1 set BUILD_DIR=%BUILD_DIR%_bpy set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^ -C"%BLENDER_DIR%\build_files\cmake\config\bpy_module.cmake" ) else if "%1" == "release" ( + set TARGET_SET=1 if "%CUDA_PATH_V7_5%"=="" ( echo Cuda 7.5 Not found, aborting! goto EOF @@ -110,15 +93,7 @@ if NOT "%1" == "" ( git submodule foreach git pull --rebase origin master goto EOF ) else if "%1" == "clean" ( - msbuild ^ - %BUILD_DIR%\Blender.sln ^ - /target:clean ^ - /property:Configuration=%BUILD_TYPE% ^ - /verbosity:minimal - if %ERRORLEVEL% NEQ 0 ( - echo Cleaned "%BUILD_DIR%" - ) - goto EOF + set MUST_CLEAN=1 ) else ( echo Command "%1" unknown, aborting! goto EOF @@ -181,12 +156,29 @@ if NOT EXIST %BLENDER_DIR%..\lib\nul ( echo This is needed for building, aborting! goto EOF ) +if NOT "%TARGET_SET%"=="1" ( + echo Error: Convenience target not set + echo This is required for building, aborting! + echo . + goto HELP +) set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -G "Visual Studio %BUILD_VS_VER% %BUILD_VS_YEAR%%WINDOWS_ARCH%" if NOT EXIST %BUILD_DIR%\nul ( mkdir %BUILD_DIR% ) - +if "%MUST_CLEAN%"=="1" ( + echo Cleaning %BUILD_DIR% + msbuild ^ + %BUILD_DIR%\Blender.sln ^ + /target:clean ^ + /property:Configuration=%BUILD_TYPE% ^ + /verbosity:minimal + if %ERRORLEVEL% NEQ 0 ( + echo Cleaned "%BUILD_DIR%" + ) + goto EOF +) REM Only configure on first run or when called with nobuild if NOT EXIST %BUILD_DIR%\Blender.sln set MUST_CONFIGURE=1 if "%NOBUILD%"=="1" set MUST_CONFIGURE=1 @@ -228,6 +220,31 @@ echo "%BUILD_DIR%\CMakeCache.txt", then run "make" again to build with the chang echo. echo Blender successfully built, run from: "%BUILD_DIR%\bin\%BUILD_TYPE%" echo. +goto EOF +:HELP + echo. + echo Convenience targets + echo - release + echo - debug + echo - full + echo - lite + echo - headless + echo - cycles + echo - bpy + echo. + echo Utilities ^(not associated with building^) + echo - clean ^(Target must be set^) + echo - update + echo - nobuild ^(only generate project files^) + echo - showhash ^(Show git hashes of source tree^) + echo. + echo Configuration options + echo - packagename [newname] ^(override default cpack package name^) + echo - x86 ^(override host autodetect and build 32 bit code^) + echo - x64 ^(override host autodetect and build 64 bit code^) + echo - 2013 ^(build with visual studio 2013^) + echo - 2015 ^(build with visual studio 2015^) [EXPERIMENTAL] + echo. :EOF -- cgit v1.2.3 From 0552d5820b70d2bc60a703af23cdea6828317ab4 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 18 Sep 2016 13:06:15 +0200 Subject: Fix T49384: crash in tangent space calculation with NaN mesh vertices. --- intern/mikktspace/mikktspace.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/intern/mikktspace/mikktspace.c b/intern/mikktspace/mikktspace.c index 7e5861ea9ed..8d51816b132 100644 --- a/intern/mikktspace/mikktspace.c +++ b/intern/mikktspace/mikktspace.c @@ -579,11 +579,10 @@ static void MergeVertsFast(int piTriList_in_and_out[], STmpVert pTmpVert[], cons { // make bbox int c=0, l=0, channel=0; - float fvMin[3], fvMax[3]; + float fvMin[3] = {INFINITY, INFINITY, INFINITY}; + float fvMax[3] = {-INFINITY, -INFINITY, -INFINITY}; float dx=0, dy=0, dz=0, fSep=0; - for (c=0; c<3; c++) - { fvMin[c]=pTmpVert[iL_in].vert[c]; fvMax[c]=fvMin[c]; } - for (l=(iL_in+1); l<=iR_in; l++) + for (l=iL_in; l<=iR_in; l++) for (c=0; c<3; c++) if (fvMin[c]>pTmpVert[l].vert[c]) fvMin[c]=pTmpVert[l].vert[c]; else if (fvMax[c]=fvMax[channel] || fSep<=fvMin[channel]) -- cgit v1.2.3 From 63b90851ce0f9e8dd863a0b2fad7e1ee2558c9a7 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Sun, 18 Sep 2016 17:25:12 +0200 Subject: GPencil: Fix memory leak using stroke arrange OP --- source/blender/editors/gpencil/gpencil_data.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c index 9560ab188a4..01d388be658 100644 --- a/source/blender/editors/gpencil/gpencil_data.c +++ b/source/blender/editors/gpencil/gpencil_data.c @@ -815,6 +815,8 @@ static int gp_stroke_arrange_exec(bContext *C, wmOperator *op) BLI_assert(0); break; } + BLI_freelistN(&selected); + /* notifiers */ WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL); -- cgit v1.2.3 From 8f28441487d5c8f960838cbd15068c0713d080ec Mon Sep 17 00:00:00 2001 From: Mai Lavelle Date: Fri, 16 Sep 2016 18:07:24 -0400 Subject: Cycles: Adaptive isolation Idea here is to select the lowest isolation level that wont compromise quality. By using the lowest level we save memory and processing time. This will also help avoid precision issues that have been showing up from using the highest level (T49179, T49257). This is a pretty simple heuristic that gives ok results. There's more we could do here, such as filtering for vertices/edges adjacent geometric features that need isolation instead of checking them all, but the logic there could get a bit involved. There's potential for slight popping of edges during animation if the dice rate is low, but I don't think this should be a problem since low dice rates really shouldn't be used in animation anyways. Reviewed By: brecht, sergey Differential Revision: https://developer.blender.org/D2240 --- intern/cycles/render/mesh_subdivision.cpp | 40 ++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/intern/cycles/render/mesh_subdivision.cpp b/intern/cycles/render/mesh_subdivision.cpp index 3b4841f5b20..0ae5ff742c2 100644 --- a/intern/cycles/render/mesh_subdivision.cpp +++ b/intern/cycles/render/mesh_subdivision.cpp @@ -16,12 +16,14 @@ #include "mesh.h" #include "attribute.h" +#include "camera.h" #include "subd_split.h" #include "subd_patch.h" #include "subd_patch_table.h" #include "util_foreach.h" +#include "util_algorithm.h" CCL_NAMESPACE_BEGIN @@ -177,7 +179,7 @@ public: Far::TopologyRefinerFactory::Options(type, options)); /* adaptive refinement */ - int max_isolation = 10; + int max_isolation = calculate_max_isolation(); refiner->RefineAdaptive(Far::TopologyRefiner::AdaptiveOptions(max_isolation)); /* create patch table */ @@ -248,6 +250,42 @@ public: } } + int calculate_max_isolation() + { + /* loop over all edges to find longest in screen space */ + const Far::TopologyLevel& level = refiner->GetLevel(0); + Transform objecttoworld = mesh->subd_params->objecttoworld; + Camera* cam = mesh->subd_params->camera; + + float longest_edge = 0.0f; + + for(size_t i = 0; i < level.GetNumEdges(); i++) { + Far::ConstIndexArray verts = level.GetEdgeVertices(i); + + float3 a = mesh->verts[verts[0]]; + float3 b = mesh->verts[verts[1]]; + + float edge_len; + + if(cam) { + a = transform_point(&objecttoworld, a); + b = transform_point(&objecttoworld, b); + + edge_len = len(a - b) / cam->world_to_raster_size((a + b) * 0.5f); + } + else { + edge_len = len(a - b); + } + + longest_edge = max(longest_edge, edge_len); + } + + /* calculate isolation level */ + int isolation = (int)(log2f(max(longest_edge / mesh->subd_params->dicing_rate, 1.0f)) + 1.0f); + + return min(isolation, 10); + } + friend struct OsdPatch; friend class Mesh; }; -- cgit v1.2.3 From 799454821e490d8024468ba623b2e10e67736a55 Mon Sep 17 00:00:00 2001 From: Mai Lavelle Date: Sat, 17 Sep 2016 20:45:00 -0400 Subject: Cycles: Soft minimum for dice rates Use 0.5 as a soft minimum for dice rates to help from setting them too low. Lower values can still be set by typing in the value. --- intern/cycles/blender/addon/properties.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index 82a18b3f6a9..977d7f75bb7 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -367,14 +367,14 @@ class CyclesRenderSettings(bpy.types.PropertyGroup): cls.dicing_rate = FloatProperty( name="Dicing Rate", description="Size of a micropolygon in pixels", - min=0.1, max=1000.0, + min=0.1, max=1000.0, soft_min=0.5, default=1.0, subtype="PIXEL" ) cls.preview_dicing_rate = FloatProperty( name="Preview Dicing Rate", description="Size of a micropolygon in pixels during preview render", - min=0.1, max=1000.0, + min=0.1, max=1000.0, soft_min=0.5, default=8.0, subtype="PIXEL" ) @@ -1011,7 +1011,7 @@ class CyclesObjectSettings(bpy.types.PropertyGroup): cls.dicing_rate = FloatProperty( name="Dicing Scale", description="Multiplier for scene dicing rate (located in the Geometry Panel)", - min=0.1, max=1000.0, + min=0.1, max=1000.0, soft_min=0.5, default=1.0, ) -- cgit v1.2.3 From 940f360479f2d160e63d91dd7c64d4a91471fa73 Mon Sep 17 00:00:00 2001 From: Mai Lavelle Date: Sun, 18 Sep 2016 12:04:12 -0400 Subject: Cycles: Fix update of subdivision meshes when global dice rates change When subdivision settings were moved from meshes to objects this was missed, should work fine now. --- intern/cycles/blender/blender_mesh.cpp | 20 +------------ intern/cycles/blender/blender_sync.cpp | 53 +++++++++++++++------------------- intern/cycles/blender/blender_util.h | 25 ++++++++++++++++ 3 files changed, 50 insertions(+), 48 deletions(-) diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp index c33bc4c263f..7c382fa0399 100644 --- a/intern/cycles/blender/blender_mesh.cpp +++ b/intern/cycles/blender/blender_mesh.cpp @@ -959,25 +959,7 @@ Mesh *BlenderSync::sync_mesh(BL::Object& b_ob, bool need_undeformed = mesh->need_attribute(scene, ATTR_STD_GENERATED); - mesh->subdivision_type = Mesh::SUBDIVISION_NONE; - - PointerRNA cobj = RNA_pointer_get(&b_ob.ptr, "cycles"); - - if(cobj.data && b_ob.modifiers.length() > 0 && experimental) { - BL::Modifier mod = b_ob.modifiers[b_ob.modifiers.length()-1]; - bool enabled = preview ? mod.show_viewport() : mod.show_render(); - - if(enabled && mod.type() == BL::Modifier::type_SUBSURF && RNA_boolean_get(&cobj, "use_adaptive_subdivision")) { - BL::SubsurfModifier subsurf(mod); - - if(subsurf.subdivision_type() == BL::SubsurfModifier::subdivision_type_CATMULL_CLARK) { - mesh->subdivision_type = Mesh::SUBDIVISION_CATMULL_CLARK; - } - else { - mesh->subdivision_type = Mesh::SUBDIVISION_LINEAR; - } - } - } + mesh->subdivision_type = object_subdivision_type(b_ob, preview, experimental); BL::Mesh b_mesh = object_to_mesh(b_data, b_ob, b_scene, true, !preview, need_undeformed, mesh->subdivision_type); diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp index e7e57b2be36..4ca202ac40d 100644 --- a/intern/cycles/blender/blender_sync.cpp +++ b/intern/cycles/blender/blender_sync.cpp @@ -103,6 +103,27 @@ bool BlenderSync::sync_recalc() if(b_lamp->is_updated() || (b_lamp->node_tree() && b_lamp->node_tree().is_updated())) shader_map.set_recalc(*b_lamp); + bool dicing_prop_changed = false; + + if(experimental) { + PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles"); + + float updated_dicing_rate = preview ? RNA_float_get(&cscene, "preview_dicing_rate") + : RNA_float_get(&cscene, "dicing_rate"); + + if(dicing_rate != updated_dicing_rate) { + dicing_rate = updated_dicing_rate; + dicing_prop_changed = true; + } + + int updated_max_subdivisions = RNA_int_get(&cscene, "max_subdivisions"); + + if(max_subdivisions != updated_max_subdivisions) { + max_subdivisions = updated_max_subdivisions; + dicing_prop_changed = true; + } + } + BL::BlendData::objects_iterator b_ob; for(b_data.objects.begin(b_ob); b_ob != b_data.objects.end(); ++b_ob) { @@ -112,7 +133,9 @@ bool BlenderSync::sync_recalc() } if(object_is_mesh(*b_ob)) { - if(b_ob->is_updated_data() || b_ob->data().is_updated()) { + if(b_ob->is_updated_data() || b_ob->data().is_updated() || + (dicing_prop_changed && object_subdivision_type(*b_ob, preview, experimental) != Mesh::SUBDIVISION_NONE)) + { BL::ID key = BKE_object_is_modified(*b_ob)? *b_ob: b_ob->data(); mesh_map.set_recalc(key); } @@ -129,42 +152,14 @@ bool BlenderSync::sync_recalc() } } - bool dicing_prop_changed = false; - - if(experimental) { - PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles"); - - float updated_dicing_rate = preview ? RNA_float_get(&cscene, "preview_dicing_rate") - : RNA_float_get(&cscene, "dicing_rate"); - - if(dicing_rate != updated_dicing_rate) { - dicing_rate = updated_dicing_rate; - dicing_prop_changed = true; - } - - int updated_max_subdivisions = RNA_int_get(&cscene, "max_subdivisions"); - - if(max_subdivisions != updated_max_subdivisions) { - max_subdivisions = updated_max_subdivisions; - dicing_prop_changed = true; - } - } - BL::BlendData::meshes_iterator b_mesh; for(b_data.meshes.begin(b_mesh); b_mesh != b_data.meshes.end(); ++b_mesh) { if(b_mesh->is_updated()) { mesh_map.set_recalc(*b_mesh); } - else if(dicing_prop_changed) { - PointerRNA cmesh = RNA_pointer_get(&b_mesh->ptr, "cycles"); - - if(RNA_enum_get(&cmesh, "subdivision_type")) - mesh_map.set_recalc(*b_mesh); - } } - BL::BlendData::worlds_iterator b_world; for(b_data.worlds.begin(b_world); b_world != b_data.worlds.end(); ++b_world) { diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h index e79f2bbb27d..e606696fb7b 100644 --- a/intern/cycles/blender/blender_util.h +++ b/intern/cycles/blender/blender_util.h @@ -17,6 +17,8 @@ #ifndef __BLENDER_UTIL_H__ #define __BLENDER_UTIL_H__ +#include "mesh.h" + #include "util_map.h" #include "util_path.h" #include "util_set.h" @@ -561,6 +563,29 @@ static inline BL::DomainFluidSettings object_fluid_domain_find(BL::Object b_ob) return BL::DomainFluidSettings(PointerRNA_NULL); } +static inline Mesh::SubdivisionType object_subdivision_type(BL::Object& b_ob, bool preview, bool experimental) +{ + PointerRNA cobj = RNA_pointer_get(&b_ob.ptr, "cycles"); + + if(cobj.data && b_ob.modifiers.length() > 0 && experimental) { + BL::Modifier mod = b_ob.modifiers[b_ob.modifiers.length()-1]; + bool enabled = preview ? mod.show_viewport() : mod.show_render(); + + if(enabled && mod.type() == BL::Modifier::type_SUBSURF && RNA_boolean_get(&cobj, "use_adaptive_subdivision")) { + BL::SubsurfModifier subsurf(mod); + + if(subsurf.subdivision_type() == BL::SubsurfModifier::subdivision_type_CATMULL_CLARK) { + return Mesh::SUBDIVISION_CATMULL_CLARK; + } + else { + return Mesh::SUBDIVISION_LINEAR; + } + } + } + + return Mesh::SUBDIVISION_NONE; +} + /* ID Map * * Utility class to keep in sync with blender data. -- cgit v1.2.3 From c0aabeede8775c790be489e7e28f34f87b7271f3 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Sun, 18 Sep 2016 18:46:22 +0200 Subject: GPencil: Don't show error popup when strokes can't be reordered further Was spawning error popup each time user tried to move a stroke higher or lower than the list allowed. We don't do that anywhere else and it's not really useful info for the user. So rather not bother her. --- source/blender/editors/gpencil/gpencil_data.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c index 01d388be658..ce1e397e91c 100644 --- a/source/blender/editors/gpencil/gpencil_data.c +++ b/source/blender/editors/gpencil/gpencil_data.c @@ -761,14 +761,12 @@ static int gp_stroke_arrange_exec(bContext *C, wmOperator *op) /* some stroke is already at front*/ if ((direction == GP_STROKE_MOVE_TOP) || (direction == GP_STROKE_MOVE_UP)) { if (gps == gpf->strokes.last) { - BKE_report(op->reports, RPT_ERROR, "Some selected stroke is already on top"); return OPERATOR_CANCELLED; } } /* some stroke is already at botom */ if ((direction == GP_STROKE_MOVE_BOTTOM) || (direction == GP_STROKE_MOVE_DOWN)) { if (gps == gpf->strokes.first) { - BKE_report(op->reports, RPT_ERROR, "Some selected stroke is already on bottom"); return OPERATOR_CANCELLED; } } -- cgit v1.2.3 From 6c28d3bac26b22049768824bef6ae9d0e82bb71f Mon Sep 17 00:00:00 2001 From: Mai Lavelle Date: Sun, 18 Sep 2016 13:21:29 -0400 Subject: Fix T49245: Adaptive Subdivision with Auto Smooth causes weird mesh appearance --- intern/cycles/blender/blender_mesh.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp index 7c382fa0399..ff1d49ffd12 100644 --- a/intern/cycles/blender/blender_mesh.cpp +++ b/intern/cycles/blender/blender_mesh.cpp @@ -606,7 +606,7 @@ static void create_mesh(Scene *scene, int numtris = 0; int numcorners = 0; int numngons = 0; - bool use_loop_normals = b_mesh.use_auto_smooth(); + bool use_loop_normals = b_mesh.use_auto_smooth() && (mesh->subdivision_type != Mesh::SUBDIVISION_CATMULL_CLARK); BL::Mesh::vertices_iterator v; BL::Mesh::tessfaces_iterator f; -- cgit v1.2.3 From 572bc1364ca9d978edf5aee991849dd4f8e56a52 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Sun, 18 Sep 2016 21:36:34 +0200 Subject: BLI_listbase: Add/use utility to move link (BLI_listbase_link_move) We were calling BLI_remlink and then BLI_insertlinkbefore/after quite often. BLI_listbase_link_move simplifies code a bit and makes it easier to follow. It also returns if link position has changed which can be used to avoid unnecessary updates. Added it to a number of list reorder operators for now and made use of return value. Behavior shouldn't be changed. Also some minor cleanup. --- source/blender/blenkernel/BKE_freestyle.h | 3 +- source/blender/blenkernel/BKE_linestyle.h | 8 ++-- source/blender/blenkernel/intern/freestyle.c | 22 +++------- source/blender/blenkernel/intern/linestyle.c | 32 +++++--------- source/blender/blenlib/BLI_listbase.h | 1 + source/blender/blenlib/intern/listbase.c | 38 ++++++++++++++++ source/blender/editors/armature/pose_group.c | 51 +++++++--------------- source/blender/editors/armature/pose_lib.c | 34 +++++---------- source/blender/editors/gpencil/gpencil_data.c | 28 ++++-------- source/blender/editors/object/object_vgroup.c | 30 +++++-------- source/blender/editors/render/render_shading.c | 48 ++++++++++---------- source/blender/freestyle/FRS_freestyle.h | 3 +- .../intern/blender_interface/FRS_freestyle.cpp | 22 +++------- source/blender/makesrna/RNA_access.h | 2 +- 14 files changed, 137 insertions(+), 185 deletions(-) diff --git a/source/blender/blenkernel/BKE_freestyle.h b/source/blender/blenkernel/BKE_freestyle.h index e10594634f0..50407f3bdfc 100644 --- a/source/blender/blenkernel/BKE_freestyle.h +++ b/source/blender/blenkernel/BKE_freestyle.h @@ -55,8 +55,7 @@ void BKE_freestyle_config_copy(FreestyleConfig *new_config, FreestyleConfig *con /* FreestyleConfig.modules */ FreestyleModuleConfig *BKE_freestyle_module_add(FreestyleConfig *config); bool BKE_freestyle_module_delete(FreestyleConfig *config, FreestyleModuleConfig *module_conf); -bool BKE_freestyle_module_move_up(FreestyleConfig *config, FreestyleModuleConfig *module_conf); -bool BKE_freestyle_module_move_down(FreestyleConfig *config, FreestyleModuleConfig *module_conf); +bool BKE_freestyle_module_move(FreestyleConfig *config, FreestyleModuleConfig *module_conf, int direction); /* FreestyleConfig.linesets */ FreestyleLineSet *BKE_freestyle_lineset_add(struct Main *bmain, FreestyleConfig *config, const char *name); diff --git a/source/blender/blenkernel/BKE_linestyle.h b/source/blender/blenkernel/BKE_linestyle.h index e96ef4e7be3..af9bf58ce77 100644 --- a/source/blender/blenkernel/BKE_linestyle.h +++ b/source/blender/blenkernel/BKE_linestyle.h @@ -73,10 +73,10 @@ int BKE_linestyle_alpha_modifier_remove(FreestyleLineStyle *linestyle, LineStyle int BKE_linestyle_thickness_modifier_remove(FreestyleLineStyle *linestyle, LineStyleModifier *modifier); int BKE_linestyle_geometry_modifier_remove(FreestyleLineStyle *linestyle, LineStyleModifier *modifier); -void BKE_linestyle_color_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction); -void BKE_linestyle_alpha_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction); -void BKE_linestyle_thickness_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction); -void BKE_linestyle_geometry_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction); +bool BKE_linestyle_color_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction); +bool BKE_linestyle_alpha_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction); +bool BKE_linestyle_thickness_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction); +bool BKE_linestyle_geometry_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction); void BKE_linestyle_modifier_list_color_ramps(FreestyleLineStyle *linestyle, ListBase *listbase); char *BKE_linestyle_path_to_color_ramp(FreestyleLineStyle *linestyle, struct ColorBand *color_ramp); diff --git a/source/blender/blenkernel/intern/freestyle.c b/source/blender/blenkernel/intern/freestyle.c index 3a15be5a09d..21fc1674dc5 100644 --- a/source/blender/blenkernel/intern/freestyle.c +++ b/source/blender/blenkernel/intern/freestyle.c @@ -151,22 +151,14 @@ bool BKE_freestyle_module_delete(FreestyleConfig *config, FreestyleModuleConfig return true; } -bool BKE_freestyle_module_move_up(FreestyleConfig *config, FreestyleModuleConfig *module_conf) -{ - if (BLI_findindex(&config->modules, module_conf) == -1) - return false; - BLI_remlink(&config->modules, module_conf); - BLI_insertlinkbefore(&config->modules, module_conf->prev, module_conf); - return true; -} - -bool BKE_freestyle_module_move_down(FreestyleConfig *config, FreestyleModuleConfig *module_conf) +/** + * Reinsert \a module_conf offset by \a direction from current position. + * \return if position of \a module_conf changed. + */ +bool BKE_freestyle_module_move(FreestyleConfig *config, FreestyleModuleConfig *module_conf, int direction) { - if (BLI_findindex(&config->modules, module_conf) == -1) - return false; - BLI_remlink(&config->modules, module_conf); - BLI_insertlinkafter(&config->modules, module_conf->next, module_conf); - return true; + return ((BLI_findindex(&config->modules, module_conf) > -1) && + (BLI_listbase_link_move(&config->modules, module_conf, direction) == true)); } void BKE_freestyle_lineset_unique_name(FreestyleConfig *config, FreestyleLineSet *lineset) diff --git a/source/blender/blenkernel/intern/linestyle.c b/source/blender/blenkernel/intern/linestyle.c index 430935a5fad..bd21215f91e 100644 --- a/source/blender/blenkernel/intern/linestyle.c +++ b/source/blender/blenkernel/intern/linestyle.c @@ -1343,33 +1343,25 @@ int BKE_linestyle_geometry_modifier_remove(FreestyleLineStyle *linestyle, LineSt return 0; } -static void move_modifier(ListBase *lb, LineStyleModifier *modifier, int direction) +/** + * Reinsert \a modifier in modifier list with an offset of \a direction. + * \return if position of \a modifier has changed. + */ +bool BKE_linestyle_color_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction) { - BLI_remlink(lb, modifier); - if (direction > 0) - BLI_insertlinkbefore(lb, modifier->prev, modifier); - else - BLI_insertlinkafter(lb, modifier->next, modifier); + return BLI_listbase_link_move(&linestyle->color_modifiers, modifier, direction); } - -void BKE_linestyle_color_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction) +bool BKE_linestyle_alpha_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction) { - move_modifier(&linestyle->color_modifiers, modifier, direction); + return BLI_listbase_link_move(&linestyle->alpha_modifiers, modifier, direction); } - -void BKE_linestyle_alpha_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction) +bool BKE_linestyle_thickness_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction) { - move_modifier(&linestyle->alpha_modifiers, modifier, direction); + return BLI_listbase_link_move(&linestyle->thickness_modifiers, modifier, direction); } - -void BKE_linestyle_thickness_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction) -{ - move_modifier(&linestyle->thickness_modifiers, modifier, direction); -} - -void BKE_linestyle_geometry_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction) +bool BKE_linestyle_geometry_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction) { - move_modifier(&linestyle->geometry_modifiers, modifier, direction); + return BLI_listbase_link_move(&linestyle->geometry_modifiers, modifier, direction); } void BKE_linestyle_modifier_list_color_ramps(FreestyleLineStyle *linestyle, ListBase *listbase) diff --git a/source/blender/blenlib/BLI_listbase.h b/source/blender/blenlib/BLI_listbase.h index 9dfa80006de..96349a7b066 100644 --- a/source/blender/blenlib/BLI_listbase.h +++ b/source/blender/blenlib/BLI_listbase.h @@ -69,6 +69,7 @@ void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnew void BLI_insertlinkafter(struct ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1); void BLI_listbase_sort(struct ListBase *listbase, int (*cmp)(const void *, const void *)) ATTR_NONNULL(1, 2); void BLI_listbase_sort_r(ListBase *listbase, int (*cmp)(void *, const void *, const void *), void *thunk) ATTR_NONNULL(1, 2); +bool BLI_listbase_link_move(ListBase *listbase, void *vlink, int step) ATTR_NONNULL(); void BLI_freelist(struct ListBase *listbase) ATTR_NONNULL(1); int BLI_listbase_count_ex(const struct ListBase *listbase, const int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c index ebee2c7941c..e72eff57ad9 100644 --- a/source/blender/blenlib/intern/listbase.c +++ b/source/blender/blenlib/intern/listbase.c @@ -342,6 +342,44 @@ void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink) } } +/** + * Reinsert \a link relative to its current position but offset by \a step. Doesn't move + * item if new position would exceed list (could optionally move to head/tail). + * + * \param step: Absolute value defines step size, sign defines direction. E.g pass -1 + * to move \a link before previous, or 1 to move behind next. + * \return If position of \a link has changed. + */ +bool BLI_listbase_link_move(ListBase *listbase, void *vlink, int step) +{ + Link *link = vlink; + Link *hook = link; + const bool is_up = step < 0; + + if (step == 0 || vlink == NULL) { + return false; + } + BLI_assert(BLI_findindex(listbase, link) != -1); + + /* find link to insert before/after */ + for (int i = 0; i < ABS(step); i++) { + hook = is_up ? hook->prev : hook->next; + if (!hook) { + return false; + } + } + + /* reinsert link */ + BLI_remlink(listbase, vlink); + if (is_up) { + BLI_insertlinkbefore(listbase, hook, vlink); + } + else { + BLI_insertlinkafter(listbase, hook, vlink); + } + return true; +} + /** * Removes and disposes of the entire contents of listbase using direct free(3). diff --git a/source/blender/editors/armature/pose_group.c b/source/blender/editors/armature/pose_group.c index 85bee023cef..85cff2e4df5 100644 --- a/source/blender/editors/armature/pose_group.c +++ b/source/blender/editors/armature/pose_group.c @@ -306,50 +306,31 @@ static int group_move_exec(bContext *C, wmOperator *op) /* move bone group */ grpIndexA = pose->active_group; - if (dir == 1) { /* up */ - void *prev = grp->prev; - - if (prev == NULL) - return OPERATOR_FINISHED; - - BLI_remlink(&pose->agroups, grp); - BLI_insertlinkbefore(&pose->agroups, prev, grp); - - grpIndexB = grpIndexA - 1; - pose->active_group--; - } - else { /* down */ - void *next = grp->next; - - if (next == NULL) - return OPERATOR_FINISHED; - - BLI_remlink(&pose->agroups, grp); - BLI_insertlinkafter(&pose->agroups, next, grp); - - grpIndexB = grpIndexA + 1; - pose->active_group++; - } + if (BLI_listbase_link_move(&pose->agroups, grp, dir)) { + grpIndexB = grpIndexA + dir; + pose->active_group += dir; + /* fix changed bone group indices in bones (swap grpIndexA with grpIndexB) */ + for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { + if (pchan->agrp_index == grpIndexB) { + pchan->agrp_index = grpIndexA; + } + else if (pchan->agrp_index == grpIndexA) { + pchan->agrp_index = grpIndexB; + } + } - /* fix changed bone group indices in bones (swap grpIndexA with grpIndexB) */ - for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { - if (pchan->agrp_index == grpIndexB) - pchan->agrp_index = grpIndexA; - else if (pchan->agrp_index == grpIndexA) - pchan->agrp_index = grpIndexB; + /* notifiers for updates */ + WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); } - /* notifiers for updates */ - WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); - return OPERATOR_FINISHED; } void POSE_OT_group_move(wmOperatorType *ot) { static EnumPropertyItem group_slot_move[] = { - {1, "UP", 0, "Up", ""}, - {-1, "DOWN", 0, "Down", ""}, + {-1, "UP", 0, "Up", ""}, + {1, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL} }; diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c index b200aa2401b..4af7f3f8727 100644 --- a/source/blender/editors/armature/pose_lib.c +++ b/source/blender/editors/armature/pose_lib.c @@ -766,32 +766,18 @@ static int poselib_move_exec(bContext *C, wmOperator *op) dir = RNA_enum_get(op->ptr, "direction"); /* move pose */ - if (dir == 1) { /* up */ - void *prev = marker->prev; + if (BLI_listbase_link_move(&act->markers, marker, dir)) { + act->active_marker = marker_index + dir + 1; - if (prev == NULL) - return OPERATOR_CANCELLED; - - BLI_remlink(&act->markers, marker); - BLI_insertlinkbefore(&act->markers, prev, marker); + /* send notifiers for this - using keyframe editing notifiers, since action + * may be being shown in anim editors as active action + */ + WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); } - else { /* down */ - void *next = marker->next; - - if (next == NULL) - return OPERATOR_CANCELLED; - - BLI_remlink(&act->markers, marker); - BLI_insertlinkafter(&act->markers, next, marker); + else { + return OPERATOR_CANCELLED; } - act->active_marker = marker_index - dir + 1; - - /* send notifiers for this - using keyframe editing notifiers, since action - * may be being shown in anim editors as active action - */ - WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); - /* done */ return OPERATOR_FINISHED; } @@ -800,8 +786,8 @@ void POSELIB_OT_pose_move(wmOperatorType *ot) { PropertyRNA *prop; static EnumPropertyItem pose_lib_pose_move[] = { - {1, "UP", 0, "Up", ""}, - {-1, "DOWN", 0, "Down", ""}, + {-1, "UP", 0, "Up", ""}, + {1, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL} }; diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c index ce1e397e91c..9a786755484 100644 --- a/source/blender/editors/gpencil/gpencil_data.c +++ b/source/blender/editors/gpencil/gpencil_data.c @@ -272,21 +272,11 @@ static int gp_layer_move_exec(bContext *C, wmOperator *op) if (ELEM(NULL, gpd, gpl)) return OPERATOR_CANCELLED; - /* up or down? */ - if (direction == GP_LAYER_MOVE_UP) { - /* up */ - BLI_remlink(&gpd->layers, gpl); - BLI_insertlinkbefore(&gpd->layers, gpl->prev, gpl); - } - else { - /* down */ - BLI_remlink(&gpd->layers, gpl); - BLI_insertlinkafter(&gpd->layers, gpl->next, gpl); + BLI_assert(ELEM(direction, -1, 0, 1)); /* we use value below */ + if (BLI_listbase_link_move(&gpd->layers, gpl, direction)) { + WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL); } - /* notifiers */ - WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL); - return OPERATOR_FINISHED; } @@ -782,23 +772,21 @@ static int gp_stroke_arrange_exec(bContext *C, wmOperator *op) for (LinkData *link = selected.first; link; link = link->next) { gps = link->data; BLI_remlink(&gpf->strokes, gps); - BLI_insertlinkafter(&gpf->strokes, gpf->strokes.last, gps); + BLI_addtail(&gpf->strokes, gps); } break; /* Bring Forward */ case GP_STROKE_MOVE_UP: for (LinkData *link = selected.last; link; link = link->prev) { gps = link->data; - BLI_remlink(&gpf->strokes, gps); - BLI_insertlinkafter(&gpf->strokes, gps->next, gps); + BLI_listbase_link_move(&gpf->strokes, gps, 1); } break; - /* Send Backward */ + /* Send Backward */ case GP_STROKE_MOVE_DOWN: for (LinkData *link = selected.first; link; link = link->next) { gps = link->data; - BLI_remlink(&gpf->strokes, gps); - BLI_insertlinkbefore(&gpf->strokes, gps->prev, gps); + BLI_listbase_link_move(&gpf->strokes, gps, -1); } break; /* Send to Back */ @@ -806,7 +794,7 @@ static int gp_stroke_arrange_exec(bContext *C, wmOperator *op) for (LinkData *link = selected.last; link; link = link->prev) { gps = link->data; BLI_remlink(&gpf->strokes, gps); - BLI_insertlinkbefore(&gpf->strokes, gpf->strokes.first, gps); + BLI_addhead(&gpf->strokes, gps); } break; default: diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 3b7f518d36f..bd016b7fcfb 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -3633,7 +3633,8 @@ static int vgroup_move_exec(bContext *C, wmOperator *op) Object *ob = ED_object_context(C); bDeformGroup *def; char *name_array; - int dir = RNA_enum_get(op->ptr, "direction"), ret; + int dir = RNA_enum_get(op->ptr, "direction"); + int ret = OPERATOR_FINISHED; def = BLI_findlink(&ob->defbase, ob->actdef - 1); if (!def) { @@ -3642,36 +3643,25 @@ static int vgroup_move_exec(bContext *C, wmOperator *op) name_array = vgroup_init_remap(ob); - if (dir == 1) { /*up*/ - void *prev = def->prev; + if (BLI_listbase_link_move(&ob->defbase, def, dir)) { + ret = vgroup_do_remap(ob, name_array, op); - BLI_remlink(&ob->defbase, def); - BLI_insertlinkbefore(&ob->defbase, prev, def); - } - else { /*down*/ - void *next = def->next; - - BLI_remlink(&ob->defbase, def); - BLI_insertlinkafter(&ob->defbase, next, def); + if (ret != OPERATOR_CANCELLED) { + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, ob); + } } - ret = vgroup_do_remap(ob, name_array, op); - if (name_array) MEM_freeN(name_array); - if (ret != OPERATOR_CANCELLED) { - DAG_id_tag_update(&ob->id, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, ob); - } - return ret; } void OBJECT_OT_vertex_group_move(wmOperatorType *ot) { static EnumPropertyItem vgroup_slot_move[] = { - {1, "UP", 0, "Up", ""}, - {-1, "DOWN", 0, "Down", ""}, + {-1, "UP", 0, "Up", ""}, + {1, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL} }; diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 4796024646c..837573ad175 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -829,14 +829,10 @@ static int freestyle_module_move_exec(bContext *C, wmOperator *op) FreestyleModuleConfig *module = ptr.data; int dir = RNA_enum_get(op->ptr, "direction"); - if (dir == 1) { - BKE_freestyle_module_move_up(&srl->freestyleConfig, module); + if (BKE_freestyle_module_move(&srl->freestyleConfig, module, dir)) { + DAG_id_tag_update(&scene->id, 0); + WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); } - else { - BKE_freestyle_module_move_down(&srl->freestyleConfig, module); - } - DAG_id_tag_update(&scene->id, 0); - WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); return OPERATOR_FINISHED; } @@ -844,8 +840,8 @@ static int freestyle_module_move_exec(bContext *C, wmOperator *op) void SCENE_OT_freestyle_module_move(wmOperatorType *ot) { static EnumPropertyItem direction_items[] = { - {1, "UP", 0, "Up", ""}, - {-1, "DOWN", 0, "Down", ""}, + {-1, "UP", 0, "Up", ""}, + {1, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL} }; @@ -993,14 +989,10 @@ static int freestyle_lineset_move_exec(bContext *C, wmOperator *op) SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); int dir = RNA_enum_get(op->ptr, "direction"); - if (dir == 1) { - FRS_move_active_lineset_up(&srl->freestyleConfig); - } - else { - FRS_move_active_lineset_down(&srl->freestyleConfig); + if (FRS_move_active_lineset(&srl->freestyleConfig, dir)) { + DAG_id_tag_update(&scene->id, 0); + WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); } - DAG_id_tag_update(&scene->id, 0); - WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); return OPERATOR_FINISHED; } @@ -1008,8 +1000,8 @@ static int freestyle_lineset_move_exec(bContext *C, wmOperator *op) void SCENE_OT_freestyle_lineset_move(wmOperatorType *ot) { static EnumPropertyItem direction_items[] = { - {1, "UP", 0, "Up", ""}, - {-1, "DOWN", 0, "Down", ""}, + {-1, "UP", 0, "Up", ""}, + {1, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL} }; @@ -1350,6 +1342,7 @@ static int freestyle_modifier_move_exec(bContext *C, wmOperator *op) PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_LineStyleModifier); LineStyleModifier *modifier = ptr.data; int dir = RNA_enum_get(op->ptr, "direction"); + bool changed = false; if (!freestyle_linestyle_check_report(lineset, op->reports)) { return OPERATOR_CANCELLED; @@ -1357,23 +1350,26 @@ static int freestyle_modifier_move_exec(bContext *C, wmOperator *op) switch (freestyle_get_modifier_type(&ptr)) { case LS_MODIFIER_TYPE_COLOR: - BKE_linestyle_color_modifier_move(lineset->linestyle, modifier, dir); + changed = BKE_linestyle_color_modifier_move(lineset->linestyle, modifier, dir); break; case LS_MODIFIER_TYPE_ALPHA: - BKE_linestyle_alpha_modifier_move(lineset->linestyle, modifier, dir); + changed = BKE_linestyle_alpha_modifier_move(lineset->linestyle, modifier, dir); break; case LS_MODIFIER_TYPE_THICKNESS: - BKE_linestyle_thickness_modifier_move(lineset->linestyle, modifier, dir); + changed = BKE_linestyle_thickness_modifier_move(lineset->linestyle, modifier, dir); break; case LS_MODIFIER_TYPE_GEOMETRY: - BKE_linestyle_geometry_modifier_move(lineset->linestyle, modifier, dir); + changed = BKE_linestyle_geometry_modifier_move(lineset->linestyle, modifier, dir); break; default: BKE_report(op->reports, RPT_ERROR, "The object the data pointer refers to is not a valid modifier"); return OPERATOR_CANCELLED; } - DAG_id_tag_update(&lineset->linestyle->id, 0); - WM_event_add_notifier(C, NC_LINESTYLE, lineset->linestyle); + + if (changed) { + DAG_id_tag_update(&lineset->linestyle->id, 0); + WM_event_add_notifier(C, NC_LINESTYLE, lineset->linestyle); + } return OPERATOR_FINISHED; } @@ -1381,8 +1377,8 @@ static int freestyle_modifier_move_exec(bContext *C, wmOperator *op) void SCENE_OT_freestyle_modifier_move(wmOperatorType *ot) { static EnumPropertyItem direction_items[] = { - {1, "UP", 0, "Up", ""}, - {-1, "DOWN", 0, "Down", ""}, + {-1, "UP", 0, "Up", ""}, + {1, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL} }; diff --git a/source/blender/freestyle/FRS_freestyle.h b/source/blender/freestyle/FRS_freestyle.h index 039a75a2f0f..a6382010ca7 100644 --- a/source/blender/freestyle/FRS_freestyle.h +++ b/source/blender/freestyle/FRS_freestyle.h @@ -63,8 +63,7 @@ void FRS_exit(void); void FRS_copy_active_lineset(struct FreestyleConfig *config); void FRS_paste_active_lineset(struct FreestyleConfig *config); void FRS_delete_active_lineset(struct FreestyleConfig *config); -void FRS_move_active_lineset_up(struct FreestyleConfig *config); -void FRS_move_active_lineset_down(struct FreestyleConfig *config); +bool FRS_move_active_lineset(struct FreestyleConfig *config, int direction); /* Testing */ struct Material *FRS_create_stroke_material(struct Main *bmain, struct FreestyleLineStyle *linestyle); diff --git a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp index 4d8c6a66d42..2af4447e4dc 100644 --- a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp +++ b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp @@ -730,24 +730,14 @@ void FRS_delete_active_lineset(FreestyleConfig *config) } } -void FRS_move_active_lineset_up(FreestyleConfig *config) -{ - FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(config); - - if (lineset) { - BLI_remlink(&config->linesets, lineset); - BLI_insertlinkbefore(&config->linesets, lineset->prev, lineset); - } -} - -void FRS_move_active_lineset_down(FreestyleConfig *config) +/** + * Reinsert the active lineset at an offset \a direction from current position. + * \return if position of active lineset has changed. + */ +bool FRS_move_active_lineset(FreestyleConfig *config, int direction) { FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(config); - - if (lineset) { - BLI_remlink(&config->linesets, lineset); - BLI_insertlinkafter(&config->linesets, lineset->next, lineset); - } + return (lineset != NULL) && BLI_listbase_link_move(&config->linesets, lineset, direction); } // Testing diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 820465ee7d1..2893fabd145 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -916,7 +916,7 @@ int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop); void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value); int RNA_property_enum_get_default(PointerRNA *ptr, PropertyRNA *prop); void *RNA_property_enum_py_data_get(PropertyRNA *prop); -int RNA_property_enum_step(const struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, int from_value, int direction); +int RNA_property_enum_step(const struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, int from_value, int step); PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop); void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr_value); -- cgit v1.2.3 From 404a427dfdee0f5300b7c4f375cd7ff4a0b8bc8e Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Sun, 18 Sep 2016 21:54:24 +0200 Subject: Minor corrections for previous commit Was using wrong argument name in doxygen comment. Also reduced scope of vars. Sorry for the noise :/ --- source/blender/blenlib/intern/listbase.c | 6 +++--- source/blender/editors/armature/pose_group.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c index e72eff57ad9..d6c0219ea23 100644 --- a/source/blender/blenlib/intern/listbase.c +++ b/source/blender/blenlib/intern/listbase.c @@ -343,12 +343,12 @@ void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink) } /** - * Reinsert \a link relative to its current position but offset by \a step. Doesn't move + * Reinsert \a vlink relative to its current position but offset by \a step. Doesn't move * item if new position would exceed list (could optionally move to head/tail). * * \param step: Absolute value defines step size, sign defines direction. E.g pass -1 - * to move \a link before previous, or 1 to move behind next. - * \return If position of \a link has changed. + * to move \a vlink before previous, or 1 to move behind next. + * \return If position of \a vlink has changed. */ bool BLI_listbase_link_move(ListBase *listbase, void *vlink, int step) { diff --git a/source/blender/editors/armature/pose_group.c b/source/blender/editors/armature/pose_group.c index 85cff2e4df5..c492772b282 100644 --- a/source/blender/editors/armature/pose_group.c +++ b/source/blender/editors/armature/pose_group.c @@ -292,7 +292,6 @@ static int group_move_exec(bContext *C, wmOperator *op) bPoseChannel *pchan; bActionGroup *grp; int dir = RNA_enum_get(op->ptr, "direction"); - int grpIndexA, grpIndexB; if (ELEM(NULL, ob, pose)) return OPERATOR_CANCELLED; @@ -305,9 +304,10 @@ static int group_move_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; /* move bone group */ - grpIndexA = pose->active_group; if (BLI_listbase_link_move(&pose->agroups, grp, dir)) { - grpIndexB = grpIndexA + dir; + int grpIndexA = pose->active_group; + int grpIndexB = grpIndexA + dir; + pose->active_group += dir; /* fix changed bone group indices in bones (swap grpIndexA with grpIndexB) */ for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { -- cgit v1.2.3 From 976e591e93dd97de2c8f5be639a78c22e6505bae Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Mon, 19 Sep 2016 01:49:17 +0200 Subject: Cleanup: Completely replace/remove uiBut.lock Old leftover from pre 2.5 days. Now handled through UI_BUT_DISABLED button flag. --- source/blender/editors/interface/interface.c | 10 ++-------- source/blender/editors/interface/interface_handlers.c | 5 ++--- source/blender/editors/interface/interface_intern.h | 1 - source/blender/editors/interface/interface_layout.c | 1 - source/blender/editors/interface/interface_regions.c | 2 +- 5 files changed, 5 insertions(+), 14 deletions(-) diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index cbe8654ceb6..6d4c8f0ab98 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1247,7 +1247,6 @@ void UI_block_end_ex(const bContext *C, uiBlock *block, const int xy[2]) if (ot == NULL || WM_operator_poll_context((bContext *)C, ot, but->opcontext) == 0) { but->flag |= UI_BUT_DISABLED; - but->lock = true; } if (but->context) @@ -3122,7 +3121,6 @@ static uiBut *ui_def_but( but->a2 = a2; but->tip = tip; - but->lock = block->lock; but->lockstr = block->lockstr; but->dt = block->dt; but->pie_dir = UI_RADIAL_NONE; @@ -3171,10 +3169,8 @@ static uiBut *ui_def_but( but->drawflag |= (block->flag & UI_BUT_ALIGN); - if (but->lock == true) { - if (but->lockstr) { - but->flag |= UI_BUT_DISABLED; - } + if (block->lock == true) { + but->flag |= UI_BUT_DISABLED; } /* keep track of UI_interface.h */ @@ -3222,7 +3218,6 @@ void ui_def_but_icon(uiBut *but, const int icon, const int flag) static void ui_def_but_rna__disable(uiBut *but) { but->flag |= UI_BUT_DISABLED; - but->lock = true; but->lockstr = ""; } @@ -3548,7 +3543,6 @@ static uiBut *ui_def_but_operator_ptr(uiBlock *block, int type, wmOperatorType * if (!ot) { but->flag |= UI_BUT_DISABLED; - but->lock = true; but->lockstr = ""; } diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 4972e16bf2e..5e9fc53de16 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -2248,7 +2248,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, bool buf_paste_alloc = false; bool show_report = false; /* use to display errors parsing paste input */ - if (mode == 'v' && but->lock == true) { + if (mode == 'v' && (but->flag & UI_BUT_DISABLED)) { return; } @@ -7100,8 +7100,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * /* verify if we can edit this button */ if (ELEM(event->type, LEFTMOUSE, RETKEY)) { - /* this should become disabled button .. */ - if (but->lock == true) { + if (but->flag & UI_BUT_DISABLED) { if (but->lockstr) { WM_report(RPT_INFO, but->lockstr); button_activate_state(C, but, BUTTON_STATE_EXIT); diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 8336efa381b..c274210e52a 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -274,7 +274,6 @@ struct uiBut { const char *lockstr; BIFIconID icon; - bool lock; char dt; /* drawtype: UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied from the block */ signed char pie_dir; /* direction in a pie menu, used for collision detection (RadialDirection) */ char changed; /* could be made into a single flag */ diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index e802cf82b8e..672bd74745d 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -745,7 +745,6 @@ static void ui_item_disabled(uiLayout *layout, const char *name) but = uiDefBut(block, UI_BTYPE_LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); but->flag |= UI_BUT_DISABLED; - but->lock = true; but->lockstr = ""; } diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 7a506c5c451..8073fb3552f 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -456,7 +456,7 @@ static uiTooltipData *ui_tooltip_data_from_button(bContext *C, uiBut *but) } /* button is disabled, we may be able to tell user why */ - if ((but->flag & UI_BUT_DISABLED) || but->lock) { + if (but->flag & UI_BUT_DISABLED) { const char *disabled_msg = NULL; /* if operator poll check failed, it can give pretty precise info why */ -- cgit v1.2.3 From c2d7d4764e86d8a133168ff8ea9aedbd78b5cd72 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Mon, 19 Sep 2016 02:25:59 +0200 Subject: Various cleanups related to button locking * Rename uiBut.lockstr to disabled_info * Remove unreachable code * Replace duplicated check with assert * Replace overly ambitious check with assert * Add comments --- source/blender/editors/include/UI_interface.h | 4 ++-- source/blender/editors/interface/interface.c | 6 +++--- .../blender/editors/interface/interface_handlers.c | 24 ++++------------------ .../blender/editors/interface/interface_intern.h | 3 ++- .../blender/editors/interface/interface_layout.c | 2 +- .../blender/editors/interface/interface_regions.c | 4 ++-- 6 files changed, 14 insertions(+), 29 deletions(-) diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 26a6fdd7d1f..ad4066fb31c 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -161,13 +161,13 @@ enum { UI_BUT_NODE_LINK = (1 << 8), UI_BUT_NODE_ACTIVE = (1 << 9), UI_BUT_DRAG_LOCK = (1 << 10), - UI_BUT_DISABLED = (1 << 11), + UI_BUT_DISABLED = (1 << 11), /* grayed out and uneditable */ UI_BUT_COLOR_LOCK = (1 << 12), UI_BUT_ANIMATED = (1 << 13), UI_BUT_ANIMATED_KEY = (1 << 14), UI_BUT_DRIVEN = (1 << 15), UI_BUT_REDALERT = (1 << 16), - UI_BUT_INACTIVE = (1 << 17), + UI_BUT_INACTIVE = (1 << 17), /* grayed out but still editable */ UI_BUT_LAST_ACTIVE = (1 << 18), UI_BUT_UNDO = (1 << 19), UI_BUT_IMMEDIATE = (1 << 20), diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 6d4c8f0ab98..aca107013ac 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -3121,7 +3121,7 @@ static uiBut *ui_def_but( but->a2 = a2; but->tip = tip; - but->lockstr = block->lockstr; + but->disabled_info = block->lockstr; but->dt = block->dt; but->pie_dir = UI_RADIAL_NONE; @@ -3218,7 +3218,7 @@ void ui_def_but_icon(uiBut *but, const int icon, const int flag) static void ui_def_but_rna__disable(uiBut *but) { but->flag |= UI_BUT_DISABLED; - but->lockstr = ""; + but->disabled_info = ""; } static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *but_p) @@ -3543,7 +3543,7 @@ static uiBut *ui_def_but_operator_ptr(uiBlock *block, int type, wmOperatorType * if (!ot) { but->flag |= UI_BUT_DISABLED; - but->lockstr = ""; + but->disabled_info = ""; } return but; diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 5e9fc53de16..933beaf6afb 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -2248,9 +2248,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, bool buf_paste_alloc = false; bool show_report = false; /* use to display errors parsing paste input */ - if (mode == 'v' && (but->flag & UI_BUT_DISABLED)) { - return; - } + BLI_assert((but->flag & UI_BUT_DISABLED) == 0); /* caller should check */ if (mode == 'c') { /* disallow copying from any passwords */ @@ -6974,6 +6972,9 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * if (but->flag & UI_BUT_DISABLED) return WM_UI_HANDLER_CONTINUE; + /* if but->pointype is set, but->poin should be too */ + BLI_assert(!but->pointype || but->poin); + if ((data->state == BUTTON_STATE_HIGHLIGHT) || (event->type == EVT_DROP)) { /* handle copy-paste */ if (ELEM(event->type, CKEY, VKEY) && event->val == KM_PRESS && @@ -7098,23 +7099,6 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * } } - /* verify if we can edit this button */ - if (ELEM(event->type, LEFTMOUSE, RETKEY)) { - if (but->flag & UI_BUT_DISABLED) { - if (but->lockstr) { - WM_report(RPT_INFO, but->lockstr); - button_activate_state(C, but, BUTTON_STATE_EXIT); - return WM_UI_HANDLER_BREAK; - } - } - else if (but->pointype && but->poin == NULL) { - /* there's a pointer needed */ - BKE_reportf(NULL, RPT_WARNING, "DoButton pointer error: %s", but->str); - button_activate_state(C, but, BUTTON_STATE_EXIT); - return WM_UI_HANDLER_BREAK; - } - } - switch (but->type) { case UI_BTYPE_BUT: retval = ui_do_but_BUT(C, but, data, event); diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index c274210e52a..418d98e8e4a 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -271,7 +271,8 @@ struct uiBut { uiButToolTipFunc tip_func; void *tip_argN; - const char *lockstr; + /* info on why button is disabled, displayed in tooltip */ + const char *disabled_info; BIFIconID icon; char dt; /* drawtype: UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied from the block */ diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 672bd74745d..976b5ed1193 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -745,7 +745,7 @@ static void ui_item_disabled(uiLayout *layout, const char *name) but = uiDefBut(block, UI_BTYPE_LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); but->flag |= UI_BUT_DISABLED; - but->lockstr = ""; + but->disabled_info = ""; } /* operator items */ diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 8073fb3552f..b7f921624d9 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -466,8 +466,8 @@ static uiTooltipData *ui_tooltip_data_from_button(bContext *C, uiBut *but) disabled_msg = CTX_wm_operator_poll_msg_get(C); } /* alternatively, buttons can store some reasoning too */ - else if (but->lockstr) { - disabled_msg = but->lockstr; + else if (but->disabled_info) { + disabled_msg = but->disabled_info; } if (disabled_msg && disabled_msg[0]) { -- cgit v1.2.3 From 772dab9df1fb208bfe2486b7ca6760da051f42f6 Mon Sep 17 00:00:00 2001 From: Mai Lavelle Date: Sun, 18 Sep 2016 22:11:07 -0400 Subject: Cycles: Fix typo that would sometimes result in subsurf modifier being disabled --- intern/cycles/blender/blender_util.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h index e606696fb7b..f17a61f0ac8 100644 --- a/intern/cycles/blender/blender_util.h +++ b/intern/cycles/blender/blender_util.h @@ -57,11 +57,10 @@ static inline BL::Mesh object_to_mesh(BL::BlendData& data, BL::Modifier subsurf_mod = object.modifiers[object.modifiers.length()-1]; subsurf_mod_show_render = subsurf_mod.show_render(); - subsurf_mod_show_viewport = subsurf_mod.show_render(); + subsurf_mod_show_viewport = subsurf_mod.show_viewport(); subsurf_mod.show_render(false); subsurf_mod.show_viewport(false); - } BL::Mesh me = data.meshes.new_from_object(scene, object, apply_modifiers, (render)? 2: 1, false, calc_undeformed); -- cgit v1.2.3 From 722226b61063a798fd3775e1cc4234045c3e1dbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dietrich?= Date: Mon, 19 Sep 2016 09:02:31 +0200 Subject: CacheFile: make sure SpinLock is destroyed when exiting Blender. Missed in rB62b1cdd6. --- source/blender/blenkernel/BKE_cachefile.h | 1 + source/blender/blenkernel/intern/blender.c | 2 ++ source/blender/blenkernel/intern/cachefile.c | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/source/blender/blenkernel/BKE_cachefile.h b/source/blender/blenkernel/BKE_cachefile.h index 7a9744ef9d6..b30143cbaec 100644 --- a/source/blender/blenkernel/BKE_cachefile.h +++ b/source/blender/blenkernel/BKE_cachefile.h @@ -39,6 +39,7 @@ struct Main; struct Scene; void BKE_cachefiles_init(void); +void BKE_cachefiles_exit(void); void *BKE_cachefile_add(struct Main *bmain, const char *name); diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 0805335da66..a8670395fc4 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -49,6 +49,7 @@ #include "BKE_blender_version.h" /* own include */ #include "BKE_blendfile.h" #include "BKE_brush.h" +#include "BKE_cachefile.h" #include "BKE_context.h" #include "BKE_depsgraph.h" #include "BKE_global.h" @@ -84,6 +85,7 @@ void BKE_blender_free(void) BKE_spacetypes_free(); /* after free main, it uses space callbacks */ IMB_exit(); + BKE_cachefiles_exit(); BKE_images_exit(); DAG_exit(); diff --git a/source/blender/blenkernel/intern/cachefile.c b/source/blender/blenkernel/intern/cachefile.c index 502f1d53ab2..e62e652b4a6 100644 --- a/source/blender/blenkernel/intern/cachefile.c +++ b/source/blender/blenkernel/intern/cachefile.c @@ -56,6 +56,11 @@ void BKE_cachefiles_init(void) BLI_spin_init(&spin); } +void BKE_cachefiles_exit(void) +{ + BLI_spin_end(&spin); +} + void *BKE_cachefile_add(Main *bmain, const char *name) { CacheFile *cache_file = BKE_libblock_alloc(bmain, ID_CF, name); -- cgit v1.2.3 From b19c6f8f432590aa60cf49ddb2bf95e087856b0e Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 19 Sep 2016 10:18:10 +0200 Subject: Remove null-check of argument which is attributed as non-null This was logically incorrect and was causing warning and compilation errors with strict compiler flags. --- source/blender/blenlib/intern/listbase.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c index d6c0219ea23..c9bf4976ae8 100644 --- a/source/blender/blenlib/intern/listbase.c +++ b/source/blender/blenlib/intern/listbase.c @@ -356,7 +356,7 @@ bool BLI_listbase_link_move(ListBase *listbase, void *vlink, int step) Link *hook = link; const bool is_up = step < 0; - if (step == 0 || vlink == NULL) { + if (step == 0) { return false; } BLI_assert(BLI_findindex(listbase, link) != -1); -- cgit v1.2.3 From 2980c6ebaed467470679e0c7ac0022ebaff01268 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 19 Sep 2016 13:00:41 +0200 Subject: Cycles: Move BVH constants to an own files, so they are easily re-usable --- intern/cycles/kernel/CMakeLists.txt | 1 + intern/cycles/kernel/bvh/bvh.h | 49 +----------------------- intern/cycles/kernel/bvh/bvh_types.h | 73 ++++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 48 deletions(-) create mode 100644 intern/cycles/kernel/bvh/bvh_types.h diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt index 3c37bc0b045..06089b4014a 100644 --- a/intern/cycles/kernel/CMakeLists.txt +++ b/intern/cycles/kernel/CMakeLists.txt @@ -34,6 +34,7 @@ set(SRC_BVH_HEADERS bvh/bvh_shadow_all.h bvh/bvh_subsurface.h bvh/bvh_traversal.h + bvh/bvh_types.h bvh/bvh_volume.h bvh/bvh_volume_all.h bvh/qbvh_nodes.h diff --git a/intern/cycles/kernel/bvh/bvh.h b/intern/cycles/kernel/bvh/bvh.h index 59881738195..512b049978a 100644 --- a/intern/cycles/kernel/bvh/bvh.h +++ b/intern/cycles/kernel/bvh/bvh.h @@ -28,54 +28,7 @@ CCL_NAMESPACE_BEGIN -/* Don't inline intersect functions on GPU, this is faster */ -#ifdef __KERNEL_GPU__ -# define ccl_device_intersect ccl_device_noinline -#else -# define ccl_device_intersect ccl_device_inline -#endif - -/* bottom-most stack entry, indicating the end of traversal */ -#define ENTRYPOINT_SENTINEL 0x76543210 - -/* 64 object BVH + 64 mesh BVH + 64 object node splitting */ -#define BVH_STACK_SIZE 192 -#define BVH_QSTACK_SIZE 384 - -/* BVH intersection function variations */ - -#define BVH_INSTANCING 1 -#define BVH_MOTION 2 -#define BVH_HAIR 4 -#define BVH_HAIR_MINIMUM_WIDTH 8 - -#define BVH_NAME_JOIN(x,y) x ## _ ## y -#define BVH_NAME_EVAL(x,y) BVH_NAME_JOIN(x,y) -#define BVH_FUNCTION_FULL_NAME(prefix) BVH_NAME_EVAL(prefix, BVH_FUNCTION_NAME) - -#define BVH_FEATURE(f) (((BVH_FUNCTION_FEATURES) & (f)) != 0) - -/* Debugging heleprs */ -#ifdef __KERNEL_DEBUG__ -# define BVH_DEBUG_INIT() \ - do { \ - isect->num_traversal_steps = 0; \ - isect->num_traversed_instances = 0; \ - } while(0) -# define BVH_DEBUG_NEXT_STEP() \ - do { \ - ++isect->num_traversal_steps; \ - } while(0) -# define BVH_DEBUG_NEXT_INSTANCE() \ - do { \ - ++isect->num_traversed_instances; \ - } while(0) -#else /* __KERNEL_DEBUG__ */ -# define BVH_DEBUG_INIT() -# define BVH_DEBUG_NEXT_STEP() -# define BVH_DEBUG_NEXT_INSTANCE() -#endif /* __KERNEL_DEBUG__ */ - +#include "bvh_types.h" /* Common QBVH functions. */ #ifdef __QBVH__ diff --git a/intern/cycles/kernel/bvh/bvh_types.h b/intern/cycles/kernel/bvh/bvh_types.h new file mode 100644 index 00000000000..bcba6e65fe5 --- /dev/null +++ b/intern/cycles/kernel/bvh/bvh_types.h @@ -0,0 +1,73 @@ +/* + * Adapted from code Copyright 2009-2010 NVIDIA Corporation + * Modifications Copyright 2011, Blender Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __BVH_TYPES__ +#define __BVH_TYPES__ + +CCL_NAMESPACE_BEGIN + +/* Don't inline intersect functions on GPU, this is faster */ +#ifdef __KERNEL_GPU__ +# define ccl_device_intersect ccl_device_noinline +#else +# define ccl_device_intersect ccl_device_inline +#endif + +/* bottom-most stack entry, indicating the end of traversal */ +#define ENTRYPOINT_SENTINEL 0x76543210 + +/* 64 object BVH + 64 mesh BVH + 64 object node splitting */ +#define BVH_STACK_SIZE 192 +#define BVH_QSTACK_SIZE 384 + +/* BVH intersection function variations */ + +#define BVH_INSTANCING 1 +#define BVH_MOTION 2 +#define BVH_HAIR 4 +#define BVH_HAIR_MINIMUM_WIDTH 8 + +#define BVH_NAME_JOIN(x,y) x ## _ ## y +#define BVH_NAME_EVAL(x,y) BVH_NAME_JOIN(x,y) +#define BVH_FUNCTION_FULL_NAME(prefix) BVH_NAME_EVAL(prefix, BVH_FUNCTION_NAME) + +#define BVH_FEATURE(f) (((BVH_FUNCTION_FEATURES) & (f)) != 0) + +/* Debugging heleprs */ +#ifdef __KERNEL_DEBUG__ +# define BVH_DEBUG_INIT() \ + do { \ + isect->num_traversal_steps = 0; \ + isect->num_traversed_instances = 0; \ + } while(0) +# define BVH_DEBUG_NEXT_STEP() \ + do { \ + ++isect->num_traversal_steps; \ + } while(0) +# define BVH_DEBUG_NEXT_INSTANCE() \ + do { \ + ++isect->num_traversed_instances; \ + } while(0) +#else /* __KERNEL_DEBUG__ */ +# define BVH_DEBUG_INIT() +# define BVH_DEBUG_NEXT_STEP() +# define BVH_DEBUG_NEXT_INSTANCE() +#endif /* __KERNEL_DEBUG__ */ + +CCL_NAMESPACE_END + +#endif /* __BVH_TYPES__ */ -- cgit v1.2.3 From 25ee0942266b698363a2fb9f092ca68f58044064 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 19 Sep 2016 14:17:05 +0200 Subject: Fix T49385: Copy buffer is not from pose mode. Report Error Quick fix for now, need to unlock studio here as well. Proper fix would be to modify API a bit and pass flags which will prevent expand called on bmain perhaps. But this we should discuss a bit, --- source/blender/editors/armature/pose_transform.c | 30 ++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/armature/pose_transform.c b/source/blender/editors/armature/pose_transform.c index fa7850bc2f4..b645f1fb2f3 100644 --- a/source/blender/editors/armature/pose_transform.c +++ b/source/blender/editors/armature/pose_transform.c @@ -414,7 +414,6 @@ static bPoseChannel *pose_bone_do_paste(Object *ob, bPoseChannel *chan, const bo static int pose_copy_exec(bContext *C, wmOperator *op) { - Main *bmain = CTX_data_main(C); Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); char str[FILE_MAX]; /* Sanity checking. */ @@ -424,13 +423,36 @@ static int pose_copy_exec(bContext *C, wmOperator *op) } /* Sets chan->flag to POSE_KEY if bone selected. */ set_pose_keys(ob); + /* Construct a local bmain and only put object and it's data into it, + * o this way we don't expand any other objects into the copy buffer + * file. + * + * TODO(sergey): Find an easier way to tell copy buffer to only store + * data we are actually interested in. Maybe pass it a flag to skip + * any datablock expansion? + */ + Main *temp_bmain = BKE_main_new(); + Object ob_copy = *ob; + bArmature arm_copy = *((bArmature *)ob->data); + ob_copy.data = &arm_copy; + BLI_addtail(&temp_bmain->object, &ob_copy); + BLI_addtail(&temp_bmain->armature, &arm_copy); + /* begin copy buffer on a temp bmain. */ + BKE_copybuffer_begin(temp_bmain); /* Store the whole object to the copy buffer because pose can't be * existing on it's own. */ - BKE_copybuffer_begin(bmain); - BKE_copybuffer_tag_ID(&ob->id); + BKE_copybuffer_tag_ID(&ob_copy.id); BLI_make_file_string("/", str, BKE_tempdir_base(), "copybuffer_pose.blend"); - BKE_copybuffer_save(bmain, str, op->reports); + BKE_copybuffer_save(temp_bmain, str, op->reports); + /* We clear the lists so no datablocks gets freed, + * This is required because objects in temp bmain shares same pointers + * as the real ones. + */ + BLI_listbase_clear(&temp_bmain->object); + BLI_listbase_clear(&temp_bmain->armature); + BKE_main_free(temp_bmain); + /* We are all done! */ BKE_report(op->reports, RPT_INFO, "Copied pose to buffer"); return OPERATOR_FINISHED; } -- cgit v1.2.3 From cc9d0eff818db57362d6de3769999c86cd4c99ef Mon Sep 17 00:00:00 2001 From: Martijn Berger Date: Mon, 19 Sep 2016 14:20:37 +0200 Subject: Lowercase includes for psapi.h and dbghelp.h windows includes. This makes cross compilation a little less painful --- intern/ghost/intern/GHOST_SystemWin32.cpp | 2 +- source/blender/blenlib/intern/system.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index f884b0fadb1..60e7815ccbb 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include "utfconv.h" diff --git a/source/blender/blenlib/intern/system.c b/source/blender/blenlib/intern/system.c index 898075e651e..863622f2546 100644 --- a/source/blender/blenlib/intern/system.c +++ b/source/blender/blenlib/intern/system.c @@ -35,7 +35,7 @@ # include #elif defined(WIN32) # include -# include +# include #endif int BLI_cpu_support_sse2(void) -- cgit v1.2.3 From 85f48216ed04c51bdc931153517fdc228507e78f Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 19 Sep 2016 14:59:24 +0200 Subject: Cycles: Cleanup, always use parenthesis Makes it simpler to compare different traversal algorithms. --- intern/cycles/kernel/bvh/bvh_shadow_all.h | 3 ++- intern/cycles/kernel/bvh/qbvh_shadow_all.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/intern/cycles/kernel/bvh/bvh_shadow_all.h b/intern/cycles/kernel/bvh/bvh_shadow_all.h index f9da2a3caaa..0c0a877cdff 100644 --- a/intern/cycles/kernel/bvh/bvh_shadow_all.h +++ b/intern/cycles/kernel/bvh/bvh_shadow_all.h @@ -355,8 +355,9 @@ bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, triangle_intersect_precalc(dir, &isect_precalc); /* scale isect->t to adjust for instancing */ - for(int i = 0; i < num_hits_in_instance; i++) + for(int i = 0; i < num_hits_in_instance; i++) { (isect_array-i-1)->t *= t_fac; + } } else { float ignore_t = FLT_MAX; diff --git a/intern/cycles/kernel/bvh/qbvh_shadow_all.h b/intern/cycles/kernel/bvh/qbvh_shadow_all.h index 5043965c979..73dd18ad2bd 100644 --- a/intern/cycles/kernel/bvh/qbvh_shadow_all.h +++ b/intern/cycles/kernel/bvh/qbvh_shadow_all.h @@ -437,8 +437,9 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, # endif /* scale isect->t to adjust for instancing */ - for(int i = 0; i < num_hits_in_instance; i++) + for(int i = 0; i < num_hits_in_instance; i++) { (isect_array-i-1)->t *= t_fac; + } } else { float ignore_t = FLT_MAX; -- cgit v1.2.3 From 6ba59660fbb3d98d78c8166525d33bb85ddd70f8 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 19 Sep 2016 15:01:30 +0200 Subject: Cycles: Cleanup, sync some comments across different traversal --- intern/cycles/kernel/bvh/bvh_shadow_all.h | 1 + intern/cycles/kernel/bvh/bvh_volume_all.h | 1 + intern/cycles/kernel/bvh/qbvh_shadow_all.h | 1 + 3 files changed, 3 insertions(+) diff --git a/intern/cycles/kernel/bvh/bvh_shadow_all.h b/intern/cycles/kernel/bvh/bvh_shadow_all.h index 0c0a877cdff..f3dc5cf195f 100644 --- a/intern/cycles/kernel/bvh/bvh_shadow_all.h +++ b/intern/cycles/kernel/bvh/bvh_shadow_all.h @@ -343,6 +343,7 @@ bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, if(stack_ptr >= 0) { kernel_assert(object != OBJECT_NONE); + /* Instance pop. */ if(num_hits_in_instance) { float t_fac; diff --git a/intern/cycles/kernel/bvh/bvh_volume_all.h b/intern/cycles/kernel/bvh/bvh_volume_all.h index 1f6515c9862..67b25625cc4 100644 --- a/intern/cycles/kernel/bvh/bvh_volume_all.h +++ b/intern/cycles/kernel/bvh/bvh_volume_all.h @@ -334,6 +334,7 @@ uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, if(stack_ptr >= 0) { kernel_assert(object != OBJECT_NONE); + /* Instance pop. */ if(num_hits_in_instance) { float t_fac; # if BVH_FEATURE(BVH_MOTION) diff --git a/intern/cycles/kernel/bvh/qbvh_shadow_all.h b/intern/cycles/kernel/bvh/qbvh_shadow_all.h index 73dd18ad2bd..03c678bd986 100644 --- a/intern/cycles/kernel/bvh/qbvh_shadow_all.h +++ b/intern/cycles/kernel/bvh/qbvh_shadow_all.h @@ -427,6 +427,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, if(stack_ptr >= 0) { kernel_assert(object != OBJECT_NONE); + /* Instance pop. */ if(num_hits_in_instance) { float t_fac; -- cgit v1.2.3 From 7901f62a9d3305d664bcbf03bf30195c9690a0a2 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 19 Sep 2016 15:14:21 +0200 Subject: Cycles: Avoid redundant intersection pre-calculation --- intern/cycles/kernel/bvh/qbvh_volume_all.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/intern/cycles/kernel/bvh/qbvh_volume_all.h b/intern/cycles/kernel/bvh/qbvh_volume_all.h index ab4b70085e8..0fe4454b01e 100644 --- a/intern/cycles/kernel/bvh/qbvh_volume_all.h +++ b/intern/cycles/kernel/bvh/qbvh_volume_all.h @@ -405,7 +405,6 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, # else bvh_instance_pop_factor(kg, object, ray, &P, &dir, &idir, &t_fac); # endif - triangle_intersect_precalc(dir, &isect_precalc); /* Scale isect->t to adjust for instancing. */ for(int i = 0; i < num_hits_in_instance; i++) { (isect_array-i-1)->t *= t_fac; @@ -418,7 +417,6 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, # else bvh_instance_pop(kg, object, ray, &P, &dir, &idir, &ignore_t); # endif - triangle_intersect_precalc(dir, &isect_precalc); } if(idir.x >= 0.0f) { near_x = 0; far_x = 1; } else { near_x = 1; far_x = 0; } -- cgit v1.2.3 From 5c6a14f4e520e2eca73ff3a2c4b6186ee4dab40a Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 19 Sep 2016 15:29:37 +0200 Subject: Cycles: More tweaks to make specialized BVH traversal matching --- intern/cycles/kernel/bvh/qbvh_shadow_all.h | 18 ++++++++---------- intern/cycles/kernel/bvh/qbvh_volume.h | 3 ++- intern/cycles/kernel/bvh/qbvh_volume_all.h | 8 +++++--- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/intern/cycles/kernel/bvh/qbvh_shadow_all.h b/intern/cycles/kernel/bvh/qbvh_shadow_all.h index 03c678bd986..3136c495b38 100644 --- a/intern/cycles/kernel/bvh/qbvh_shadow_all.h +++ b/intern/cycles/kernel/bvh/qbvh_shadow_all.h @@ -40,6 +40,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, uint *num_hits) { /* TODO(sergey): + * - Test if pushing distance on the stack helps. * - Likely and unlikely for if() statements. * - Test restrict attribute for pointers. */ @@ -77,7 +78,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, int num_hits_in_instance = 0; #endif - ssef tnear(0.0f), tfar(tmax); + ssef tnear(0.0f), tfar(isect_t); #if BVH_FEATURE(BVH_HAIR) sse3f dir4(ssef(dir.x), ssef(dir.y), ssef(dir.z)); #endif @@ -125,12 +126,12 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, #ifdef __KERNEL_AVX2__ P_idir4, #endif -# if BVH_FEATURE(BVH_HAIR) || !defined(__KERNEL_AVX2__) +#if BVH_FEATURE(BVH_HAIR) || !defined(__KERNEL_AVX2__) org4, -# endif -# if BVH_FEATURE(BVH_HAIR) +#endif +#if BVH_FEATURE(BVH_HAIR) dir4, -# endif +#endif idir4, near_x, near_y, near_z, far_x, far_y, far_z, @@ -430,21 +431,18 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, /* Instance pop. */ if(num_hits_in_instance) { float t_fac; - # if BVH_FEATURE(BVH_MOTION) bvh_instance_motion_pop_factor(kg, object, ray, &P, &dir, &idir, &t_fac, &ob_itfm); # else bvh_instance_pop_factor(kg, object, ray, &P, &dir, &idir, &t_fac); # endif - - /* scale isect->t to adjust for instancing */ + /* Scale isect->t to adjust for instancing. */ for(int i = 0; i < num_hits_in_instance; i++) { (isect_array-i-1)->t *= t_fac; } } else { float ignore_t = FLT_MAX; - # if BVH_FEATURE(BVH_MOTION) bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &ignore_t, &ob_itfm); # else @@ -458,7 +456,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, if(idir.x >= 0.0f) { near_x = 0; far_x = 1; } else { near_x = 1; far_x = 0; } if(idir.y >= 0.0f) { near_y = 2; far_y = 3; } else { near_y = 3; far_y = 2; } if(idir.z >= 0.0f) { near_z = 4; far_z = 5; } else { near_z = 5; far_z = 4; } - tfar = ssef(tmax); + tfar = ssef(isect_t); # if BVH_FEATURE(BVH_HAIR) dir4 = sse3f(ssef(dir.x), ssef(dir.y), ssef(dir.z)); # endif diff --git a/intern/cycles/kernel/bvh/qbvh_volume.h b/intern/cycles/kernel/bvh/qbvh_volume.h index 847a11d8ad4..aff9f559ab8 100644 --- a/intern/cycles/kernel/bvh/qbvh_volume.h +++ b/intern/cycles/kernel/bvh/qbvh_volume.h @@ -103,8 +103,9 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, do { /* Traverse internal nodes. */ while(node_addr >= 0 && node_addr != ENTRYPOINT_SENTINEL) { -#ifdef __VISIBILITY_FLAG__ float4 inodes = kernel_tex_fetch(__bvh_nodes, node_addr+0); + +#ifdef __VISIBILITY_FLAG__ if((__float_as_uint(inodes.x) & visibility) == 0) { /* Pop. */ node_addr = traversal_stack[stack_ptr].addr; diff --git a/intern/cycles/kernel/bvh/qbvh_volume_all.h b/intern/cycles/kernel/bvh/qbvh_volume_all.h index 0fe4454b01e..26da0145020 100644 --- a/intern/cycles/kernel/bvh/qbvh_volume_all.h +++ b/intern/cycles/kernel/bvh/qbvh_volume_all.h @@ -107,8 +107,9 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, do { /* Traverse internal nodes. */ while(node_addr >= 0 && node_addr != ENTRYPOINT_SENTINEL) { -#ifdef __VISIBILITY_FLAG__ float4 inodes = kernel_tex_fetch(__bvh_nodes, node_addr+0); + +#ifdef __VISIBILITY_FLAG__ if((__float_as_uint(inodes.x) & visibility) == 0) { /* Pop. */ node_addr = traversal_stack[stack_ptr].addr; @@ -419,6 +420,9 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, # endif } + isect_t = tmax; + isect_array->t = isect_t; + if(idir.x >= 0.0f) { near_x = 0; far_x = 1; } else { near_x = 1; far_x = 0; } if(idir.y >= 0.0f) { near_y = 2; far_y = 3; } else { near_y = 3; far_y = 2; } if(idir.z >= 0.0f) { near_z = 4; far_z = 5; } else { near_z = 5; far_z = 4; } @@ -436,8 +440,6 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, # endif triangle_intersect_precalc(dir, &isect_precalc); - isect_t = tmax; - isect_array->t = isect_t; object = OBJECT_NONE; node_addr = traversal_stack[stack_ptr].addr; -- cgit v1.2.3 From 1f5cd85976df79a5db1fceaf67226621d66e2a94 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 19 Sep 2016 15:49:43 +0200 Subject: Fix T49375: align rotation with snap target isn't toggleable in edit mode. Based on D2237, but fixed patch always hiding 'snap on self' button... Should be safe for 2.78. --- release/scripts/startup/bl_ui/space_view3d.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 1748d1d3738..fad52143ae5 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -106,10 +106,10 @@ class VIEW3D_HT_header(Header): else: row.prop(toolsettings, "snap_target", text="") if obj: - if mode in {'OBJECT', 'POSE'} and snap_element != 'VOLUME': - row.prop(toolsettings, "use_snap_align_rotation", text="") - elif mode == 'EDIT': + if mode == 'EDIT': row.prop(toolsettings, "use_snap_self", text="") + if mode in {'OBJECT', 'POSE', 'EDIT'} and snap_element != 'VOLUME': + row.prop(toolsettings, "use_snap_align_rotation", text="") if snap_element == 'VOLUME': row.prop(toolsettings, "use_snap_peel_object", text="") -- cgit v1.2.3 From 100b2ad7754daaaa670ab2d84889539b2c850dda Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 19 Sep 2016 16:04:45 +0200 Subject: Cycles: Cleanup code style in split kernel --- intern/cycles/kernel/split/kernel_background_buffer_update.h | 3 ++- intern/cycles/kernel/split/kernel_data_init.h | 3 ++- .../kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h | 3 ++- intern/cycles/kernel/split/kernel_next_iteration_setup.h | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/intern/cycles/kernel/split/kernel_background_buffer_update.h b/intern/cycles/kernel/split/kernel_background_buffer_update.h index f42d0a985bb..9bfa71c75ef 100644 --- a/intern/cycles/kernel/split/kernel_background_buffer_update.h +++ b/intern/cycles/kernel/split/kernel_background_buffer_update.h @@ -232,7 +232,8 @@ ccl_device char kernel_background_buffer_update( #endif ASSIGN_RAY_STATE(ray_state, ray_index, RAY_REGENERATED); enqueue_flag = 1; - } else { + } + else { /* These rays do not participate in path-iteration. */ float4 L_rad = make_float4(0.0f, 0.0f, 0.0f, 0.0f); /* Accumulate result in output buffer. */ diff --git a/intern/cycles/kernel/split/kernel_data_init.h b/intern/cycles/kernel/split/kernel_data_init.h index e3dbc43757e..6e158d53d23 100644 --- a/intern/cycles/kernel/split/kernel_data_init.h +++ b/intern/cycles/kernel/split/kernel_data_init.h @@ -215,7 +215,8 @@ ccl_device void kernel_data_init( #ifdef __KERNEL_DEBUG__ debug_data_init(&debugdata_coop[ray_index]); #endif - } else { + } + else { /* These rays do not participate in path-iteration. */ float4 L_rad = make_float4(0.0f, 0.0f, 0.0f, 0.0f); /* Accumulate result in output buffer. */ diff --git a/intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h b/intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h index 78dada82d89..435d1171d5c 100644 --- a/intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h +++ b/intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h @@ -212,7 +212,8 @@ ccl_device void kernel_holdout_emission_blurring_pathtermination_ao( if(terminate >= probability) { ASSIGN_RAY_STATE(ray_state, ray_index, RAY_UPDATE_BUFFER); *enqueue_flag = 1; - } else { + } + else { throughput_coop[ray_index] = throughput/probability; } } diff --git a/intern/cycles/kernel/split/kernel_next_iteration_setup.h b/intern/cycles/kernel/split/kernel_next_iteration_setup.h index 74da80b52cc..816f3a6fbff 100644 --- a/intern/cycles/kernel/split/kernel_next_iteration_setup.h +++ b/intern/cycles/kernel/split/kernel_next_iteration_setup.h @@ -126,7 +126,7 @@ ccl_device char kernel_next_iteration_setup( if(IS_STATE(ray_state, ray_index, RAY_ACTIVE)) { ccl_global float3 *throughput = &throughput_coop[ray_index]; ccl_global Ray *ray = &Ray_coop[ray_index]; - ccl_global RNG* rng = &rng_coop[ray_index]; + ccl_global RNG *rng = &rng_coop[ray_index]; state = &PathState_coop[ray_index]; L = &PathRadiance_coop[ray_index]; -- cgit v1.2.3 From 838e0a09c7bc4b7c46d9f7b7b7ebcea3a8249378 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 19 Sep 2016 16:11:19 +0200 Subject: Buildbot: Attempt to use proper Clang for CUDA binaries --- build_files/buildbot/slave_compile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build_files/buildbot/slave_compile.py b/build_files/buildbot/slave_compile.py index b7feae1ed8c..d62dded7067 100644 --- a/build_files/buildbot/slave_compile.py +++ b/build_files/buildbot/slave_compile.py @@ -75,6 +75,8 @@ if 'cmake' in builder: cmake_extra_options.append('-DCUDA_NVCC_EXECUTABLE=/usr/local/cuda-hack/bin/nvcc') cmake_extra_options.append('-DCUDA_NVCC8_EXECUTABLE=/usr/local/cuda8-hack/bin/nvcc') cmake_extra_options.append('-DWITH_CODEC_QUICKTIME=OFF') + cmake_extra_options.append('-DCUDA_HOST_COMPILER=/usr/local/cuda-hack/bin/clang') + elif builder.startswith('win'): if builder.endswith('_vc2015'): -- cgit v1.2.3 From 12680d36f539a6006308a2b27282f0cb3acc5836 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 19 Sep 2016 16:24:55 +0200 Subject: Buildbot: Temporary disable CUBIN compilation --- build_files/buildbot/slave_compile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_files/buildbot/slave_compile.py b/build_files/buildbot/slave_compile.py index d62dded7067..119c9b8eed9 100644 --- a/build_files/buildbot/slave_compile.py +++ b/build_files/buildbot/slave_compile.py @@ -75,7 +75,7 @@ if 'cmake' in builder: cmake_extra_options.append('-DCUDA_NVCC_EXECUTABLE=/usr/local/cuda-hack/bin/nvcc') cmake_extra_options.append('-DCUDA_NVCC8_EXECUTABLE=/usr/local/cuda8-hack/bin/nvcc') cmake_extra_options.append('-DWITH_CODEC_QUICKTIME=OFF') - cmake_extra_options.append('-DCUDA_HOST_COMPILER=/usr/local/cuda-hack/bin/clang') + build_cubins = False elif builder.startswith('win'): -- cgit v1.2.3 From 7d63ea4a1c0eceb2eee04a7829419180cf9cbdc5 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 19 Sep 2016 16:45:08 +0200 Subject: Buildbot: Another attempt to have OSX builder fixed --- build_files/buildbot/slave_compile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/build_files/buildbot/slave_compile.py b/build_files/buildbot/slave_compile.py index 119c9b8eed9..b156e4be327 100644 --- a/build_files/buildbot/slave_compile.py +++ b/build_files/buildbot/slave_compile.py @@ -75,6 +75,7 @@ if 'cmake' in builder: cmake_extra_options.append('-DCUDA_NVCC_EXECUTABLE=/usr/local/cuda-hack/bin/nvcc') cmake_extra_options.append('-DCUDA_NVCC8_EXECUTABLE=/usr/local/cuda8-hack/bin/nvcc') cmake_extra_options.append('-DWITH_CODEC_QUICKTIME=OFF') + cmake_extra_options.append('-DCMAKE_OSX_DEPLOYMENT_TARGET=10.6') build_cubins = False -- cgit v1.2.3 From 16ed49b26ec3b181fd72b37bcbce0f96551bc939 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Mon, 19 Sep 2016 16:46:20 +0200 Subject: UI Messages: Consistent spelling of term "data-block" Was using a bunch of different spellings, mostly "data-block" though, so went with that one (would have been my #1 choice anyway ;) ) --- source/blender/blenloader/intern/writefile.c | 2 +- .../editors/animation/anim_channels_defines.c | 2 +- .../blender/editors/animation/anim_channels_edit.c | 2 +- source/blender/editors/curve/editfont.c | 2 +- source/blender/editors/gpencil/gpencil_data.c | 12 ++-- source/blender/editors/interface/interface_anim.c | 2 +- .../editors/interface/interface_eyedropper.c | 4 +- .../editors/interface/interface_templates.c | 6 +- source/blender/editors/object/object_relations.c | 4 +- .../editors/sculpt_paint/paint_image_proj.c | 2 +- source/blender/editors/sound/sound_ops.c | 2 +- source/blender/editors/space_action/action_data.c | 4 +- .../editors/space_buttons/buttons_context.c | 2 +- source/blender/editors/space_image/image_ops.c | 4 +- source/blender/editors/space_nla/nla_channels.c | 2 +- source/blender/editors/space_nla/nla_edit.c | 4 +- source/blender/editors/space_node/node_add.c | 4 +- .../blender/editors/space_outliner/outliner_draw.c | 8 +-- .../blender/editors/space_outliner/outliner_edit.c | 10 ++-- .../editors/space_outliner/outliner_tools.c | 12 ++-- source/blender/editors/space_text/text_ops.c | 12 ++-- source/blender/makesrna/intern/rna_ID.c | 14 ++--- source/blender/makesrna/intern/rna_action.c | 8 +-- source/blender/makesrna/intern/rna_animation.c | 2 +- source/blender/makesrna/intern/rna_key.c | 2 +- source/blender/makesrna/intern/rna_main.c | 68 +++++++++++----------- source/blender/makesrna/intern/rna_mask.c | 4 +- source/blender/makesrna/intern/rna_nodetree.c | 4 +- source/blender/makesrna/intern/rna_scene.c | 6 +- source/blender/makesrna/intern/rna_space.c | 6 +- source/blender/makesrna/intern/rna_userdef.c | 6 +- source/blender/nodes/intern/node_common.c | 2 +- .../blender/windowmanager/intern/wm_files_link.c | 4 +- source/blender/windowmanager/intern/wm_operators.c | 10 ++-- source/gameengine/GamePlayer/ghost/GPG_ghost.cpp | 2 +- 35 files changed, 120 insertions(+), 120 deletions(-) diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index dbc67d30b35..49e5255eccc 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -3949,7 +3949,7 @@ static void write_libraries(WriteData *wd, Main *main) for (id = lbarray[a]->first; id; id = id->next) { if (id->us > 0 && (id->tag & LIB_TAG_EXTERN)) { if (!BKE_idcode_is_linkable(GS(id->name))) { - printf("ERROR: write file: datablock '%s' from lib '%s' is not linkable " + printf("ERROR: write file: data-block '%s' from lib '%s' is not linkable " "but is flagged as directly linked", id->name, main->curlib->filepath); BLI_assert(0); } diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index e60cb3fbedf..93a602b463d 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -4155,7 +4155,7 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, const bAni case ACHANNEL_SETTING_SOLO: /* NLA Tracks only */ //icon = ((enabled) ? ICON_SOLO_OFF : ICON_SOLO_ON); icon = ICON_SOLO_OFF; - tooltip = TIP_("NLA Track is the only one evaluated in this Animation Data block, with all others muted"); + tooltip = TIP_("NLA Track is the only one evaluated in this animation data-block, with all others muted"); break; /* --- */ diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 4cbdf77b11a..5f6ba6c413a 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -2145,7 +2145,7 @@ static void ANIM_OT_channels_clean_empty(wmOperatorType *ot) /* identifiers */ ot->name = "Remove Empty Animation Data"; ot->idname = "ANIM_OT_channels_clean_empty"; - ot->description = "Delete all empty animation data containers from visible datablocks"; + ot->description = "Delete all empty animation data containers from visible data-blocks"; /* api callbacks */ ot->exec = animchannels_clean_empty_exec; diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index b40b51e337f..57e731874b4 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -1788,7 +1788,7 @@ void FONT_OT_unlink(wmOperatorType *ot) /* identifiers */ ot->name = "Unlink"; ot->idname = "FONT_OT_unlink"; - ot->description = "Unlink active font data block"; + ot->description = "Unlink active font data-block"; /* api callbacks */ ot->exec = font_unlink_exec; diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c index 9a786755484..7dcbe2cc24c 100644 --- a/source/blender/editors/gpencil/gpencil_data.c +++ b/source/blender/editors/gpencil/gpencil_data.c @@ -108,7 +108,7 @@ void GPENCIL_OT_data_add(wmOperatorType *ot) /* identifiers */ ot->name = "Grease Pencil Add New"; ot->idname = "GPENCIL_OT_data_add"; - ot->description = "Add new Grease Pencil datablock"; + ot->description = "Add new Grease Pencil data-block"; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* callbacks */ @@ -156,7 +156,7 @@ void GPENCIL_OT_data_unlink(wmOperatorType *ot) /* identifiers */ ot->name = "Grease Pencil Unlink"; ot->idname = "GPENCIL_OT_data_unlink"; - ot->description = "Unlink active Grease Pencil datablock"; + ot->description = "Unlink active Grease Pencil data-block"; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* callbacks */ @@ -197,7 +197,7 @@ void GPENCIL_OT_layer_add(wmOperatorType *ot) /* identifiers */ ot->name = "Add New Layer"; ot->idname = "GPENCIL_OT_layer_add"; - ot->description = "Add new Grease Pencil layer for the active Grease Pencil datablock"; + ot->description = "Add new Grease Pencil layer for the active Grease Pencil data-block"; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -979,7 +979,7 @@ void GPENCIL_OT_brush_add(wmOperatorType *ot) /* identifiers */ ot->name = "Add Brush"; ot->idname = "GPENCIL_OT_brush_add"; - ot->description = "Add new Grease Pencil drawing brush for the active Grease Pencil datablock"; + ot->description = "Add new Grease Pencil drawing brush for the active Grease Pencil data-block"; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1337,7 +1337,7 @@ void GPENCIL_OT_palette_add(wmOperatorType *ot) /* identifiers */ ot->name = "Add Palette"; ot->idname = "GPENCIL_OT_palette_add"; - ot->description = "Add new Grease Pencil palette for the active Grease Pencil datablock"; + ot->description = "Add new Grease Pencil palette for the active Grease Pencil data-block"; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1554,7 +1554,7 @@ void GPENCIL_OT_palettecolor_add(wmOperatorType *ot) /* identifiers */ ot->name = "Add Palette Color"; ot->idname = "GPENCIL_OT_palettecolor_add"; - ot->description = "Add new Grease Pencil palette color for the active Grease Pencil datablock"; + ot->description = "Add new Grease Pencil palette color for the active Grease Pencil data-block"; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index 88924495ae5..c88b03ceaa0 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -179,7 +179,7 @@ bool ui_but_anim_expression_create(uiBut *but, const char *str) id = (ID *)but->rnapoin.id.data; if ((id == NULL) || (GS(id->name) == ID_MA) || (GS(id->name) == ID_TE)) { if (G.debug & G_DEBUG) - printf("ERROR: create expression failed - invalid id-datablock for adding drivers (%p)\n", id); + printf("ERROR: create expression failed - invalid data-block for adding drivers (%p)\n", id); return false; } diff --git a/source/blender/editors/interface/interface_eyedropper.c b/source/blender/editors/interface/interface_eyedropper.c index ac7b6428217..f10b3e6f157 100644 --- a/source/blender/editors/interface/interface_eyedropper.c +++ b/source/blender/editors/interface/interface_eyedropper.c @@ -734,9 +734,9 @@ static int datadropper_poll(bContext *C) void UI_OT_eyedropper_id(wmOperatorType *ot) { /* identifiers */ - ot->name = "Eyedropper Datablock"; + ot->name = "Eyedropper Data-Block"; ot->idname = "UI_OT_eyedropper_id"; - ot->description = "Sample a datablock from the 3D View to store in a property"; + ot->description = "Sample a data-block from the 3D View to store in a property"; /* api callbacks */ ot->invoke = datadropper_invoke; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 50dd219b53c..36f65065fa1 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -453,12 +453,12 @@ static void template_ID( if (id->lib) { if (id->tag & LIB_TAG_INDIRECT) { but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_INDIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y, - NULL, 0, 0, 0, 0, TIP_("Indirect library datablock, cannot change")); + NULL, 0, 0, 0, 0, TIP_("Indirect library data-block, cannot change")); UI_but_flag_enable(but, UI_BUT_DISABLED); } else { but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_DIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y, - NULL, 0, 0, 0, 0, TIP_("Direct linked library datablock, click to make local")); + NULL, 0, 0, 0, 0, TIP_("Direct linked library data-block, click to make local")); if (!id_make_local(CTX_data_main(C), id, true /* test */, false) || (idfrom && idfrom->lib)) UI_but_flag_enable(but, UI_BUT_DISABLED); } @@ -585,7 +585,7 @@ static void template_ID( else { if ((RNA_property_flag(template->prop) & PROP_NEVER_UNLINK) == 0) { but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, - TIP_("Unlink datablock " + TIP_("Unlink data-block " "(Shift + Click to set users to zero, data will then not be saved)")); UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_DELETE)); diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 82c6a14eb7f..79544f80e95 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -2346,7 +2346,7 @@ void OBJECT_OT_make_local(wmOperatorType *ot) /* identifiers */ ot->name = "Make Local"; - ot->description = "Make library linked datablocks local to this file"; + ot->description = "Make library linked data-blocks local to this file"; ot->idname = "OBJECT_OT_make_local"; /* api callbacks */ @@ -2441,7 +2441,7 @@ void OBJECT_OT_make_single_user(wmOperatorType *ot) RNA_def_boolean(ot->srna, "object", 0, "Object", "Make single user objects"); RNA_def_boolean(ot->srna, "obdata", 0, "Object Data", "Make single user object data"); - RNA_def_boolean(ot->srna, "material", 0, "Materials", "Make materials local to each datablock"); + RNA_def_boolean(ot->srna, "material", 0, "Materials", "Make materials local to each data-block"); RNA_def_boolean(ot->srna, "texture", 0, "Textures", "Make textures local to each material (needs 'Materials' to be set too)"); RNA_def_boolean(ot->srna, "animation", 0, "Object Animation", "Make animation data local to each object"); diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index d60c8e8dbd9..83fde4554b3 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -5783,7 +5783,7 @@ void PAINT_OT_add_texture_paint_slot(wmOperatorType *ot) /* properties */ prop = RNA_def_enum(ot->srna, "type", layer_type_items, 0, "Type", "Merge method to use"); RNA_def_property_flag(prop, PROP_HIDDEN); - RNA_def_string(ot->srna, "name", IMA_DEF_NAME, MAX_ID_NAME - 2, "Name", "Image datablock name"); + RNA_def_string(ot->srna, "name", IMA_DEF_NAME, MAX_ID_NAME - 2, "Name", "Image data-block name"); prop = RNA_def_int(ot->srna, "width", 1024, 1, INT_MAX, "Width", "Image width", 1, 16384); RNA_def_property_subtype(prop, PROP_PIXEL); prop = RNA_def_int(ot->srna, "height", 1024, 1, INT_MAX, "Height", "Image height", 1, 16384); diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index 52c39e5c7a1..432918f0e37 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -813,7 +813,7 @@ static void SOUND_OT_unpack(wmOperatorType *ot) /* properties */ RNA_def_enum(ot->srna, "method", rna_enum_unpack_method_items, PF_USE_LOCAL, "Method", "How to unpack"); - RNA_def_string(ot->srna, "id", NULL, MAX_ID_NAME - 2, "Sound Name", "Sound datablock name to unpack"); /* XXX, weark!, will fail with library, name collisions */ + RNA_def_string(ot->srna, "id", NULL, MAX_ID_NAME - 2, "Sound Name", "Sound data-block name to unpack"); /* XXX, weark!, will fail with library, name collisions */ } /* ******************************************************* */ diff --git a/source/blender/editors/space_action/action_data.c b/source/blender/editors/space_action/action_data.c index 6755a6316cc..fdf2dfe8371 100644 --- a/source/blender/editors/space_action/action_data.c +++ b/source/blender/editors/space_action/action_data.c @@ -669,8 +669,8 @@ void ACTION_OT_unlink(wmOperatorType *ot) ot->poll = action_unlink_poll; /* properties */ - prop = RNA_def_boolean(ot->srna, "force_delete", false, "Force Delete", - "Clear Fake User and remove copy stashed in this datablock's NLA stack"); + prop = RNA_def_boolean(ot->srna, "force_delete", false, "Force Delete", "Clear Fake User and remove " + "copy stashed in this data-block's NLA stack"); RNA_def_property_flag(prop, PROP_SKIP_SAVE); } diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 5b03bdd7761..da3364d872d 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -1106,7 +1106,7 @@ void buttons_context_draw(const bContext *C, uiLayout *layout) block = uiLayoutGetBlock(row); UI_block_emboss_set(block, UI_EMBOSS_NONE); but = uiDefIconButBitC(block, UI_BTYPE_ICON_TOGGLE, SB_PIN_CONTEXT, 0, ICON_UNPINNED, 0, 0, UI_UNIT_X, UI_UNIT_Y, &sbuts->flag, - 0, 0, 0, 0, TIP_("Follow context or keep fixed datablock displayed")); + 0, 0, 0, 0, TIP_("Follow context or keep fixed data-block displayed")); UI_but_flag_disable(but, UI_BUT_UNDO); /* skip undo on screen buttons */ UI_but_func_set(but, pin_cb, NULL, NULL); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index a89d3494af0..b4dd5c4a87f 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -2546,7 +2546,7 @@ void IMAGE_OT_new(wmOperatorType *ot) ot->flag = OPTYPE_UNDO; /* properties */ - RNA_def_string(ot->srna, "name", IMA_DEF_NAME, MAX_ID_NAME - 2, "Name", "Image datablock name"); + RNA_def_string(ot->srna, "name", IMA_DEF_NAME, MAX_ID_NAME - 2, "Name", "Image data-block name"); prop = RNA_def_int(ot->srna, "width", 1024, 1, INT_MAX, "Width", "Image width", 1, 16384); RNA_def_property_subtype(prop, PROP_PIXEL); prop = RNA_def_int(ot->srna, "height", 1024, 1, INT_MAX, "Height", "Image height", 1, 16384); @@ -2847,7 +2847,7 @@ void IMAGE_OT_unpack(wmOperatorType *ot) /* properties */ RNA_def_enum(ot->srna, "method", rna_enum_unpack_method_items, PF_USE_LOCAL, "Method", "How to unpack"); - RNA_def_string(ot->srna, "id", NULL, MAX_ID_NAME - 2, "Image Name", "Image datablock name to unpack"); /* XXX, weark!, will fail with library, name collisions */ + RNA_def_string(ot->srna, "id", NULL, MAX_ID_NAME - 2, "Image Name", "Image data-block name to unpack"); /* XXX, weark!, will fail with library, name collisions */ } /******************** sample image operator ********************/ diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index 4f30c049d9d..e9c46e9d04b 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -425,7 +425,7 @@ static int nlachannels_pushdown_exec(bContext *C, wmOperator *op) /* active animdata block */ if (nla_panel_context(C, &adt_ptr, NULL, NULL) == 0 || (adt_ptr.data == NULL)) { BKE_report(op->reports, RPT_ERROR, "No active AnimData block to use " - "(select a datablock expander first or set the appropriate flags on an AnimData block)"); + "(select a data-block expander first or set the appropriate flags on an AnimData block)"); return OPERATOR_CANCELLED; } else { diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index 3e7e8ccc3f4..1f298373a80 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -605,8 +605,8 @@ static int nlaedit_add_actionclip_exec(bContext *C, wmOperator *op) else if (act->idroot == 0) { /* hopefully in this case (i.e. library of userless actions), the user knows what they're doing... */ BKE_reportf(op->reports, RPT_WARNING, - "Action '%s' does not specify what datablocks it can be used on " - "(try setting the 'ID Root Type' setting from the Datablocks Editor " + "Action '%s' does not specify what data-blocks it can be used on " + "(try setting the 'ID Root Type' setting from the data-blocks editor " "for this action to avoid future problems)", act->id.name + 2); } diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c index b50df02beae..d49df2afbd4 100644 --- a/source/blender/editors/space_node/node_add.c +++ b/source/blender/editors/space_node/node_add.c @@ -382,7 +382,7 @@ void NODE_OT_add_file(wmOperatorType *ot) WM_operator_properties_filesel( ot, FILE_TYPE_FOLDER | FILE_TYPE_IMAGE | FILE_TYPE_MOVIE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA); - RNA_def_string(ot->srna, "name", "Image", MAX_ID_NAME - 2, "Name", "Datablock name to assign"); + RNA_def_string(ot->srna, "name", "Image", MAX_ID_NAME - 2, "Name", "Data-block name to assign"); } /* ****************** Add Mask Node Operator ******************* */ @@ -441,7 +441,7 @@ void NODE_OT_add_mask(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; - RNA_def_string(ot->srna, "name", "Mask", MAX_ID_NAME - 2, "Name", "Datablock name to assign"); + RNA_def_string(ot->srna, "name", "Mask", MAX_ID_NAME - 2, "Name", "Data-block name to assign"); } /********************** New node tree operator *********************/ diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index d4553b650c5..bc2e9c80b40 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -835,11 +835,11 @@ static void outliner_draw_userbuts(uiBlock *block, ARegion *ar, SpaceOops *soops if (id->flag & LIB_FAKEUSER) { icon = ICON_FILE_TICK; - tip = TIP_("Datablock will be retained using a fake user"); + tip = TIP_("Data-block will be retained using a fake user"); } else { icon = ICON_X; - tip = TIP_("Datablock has no users and will be deleted"); + tip = TIP_("Data-block has no users and will be deleted"); } bt = uiDefIconButBitS(block, UI_BTYPE_TOGGLE, LIB_FAKEUSER, 1, icon, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, @@ -852,14 +852,14 @@ static void outliner_draw_userbuts(uiBlock *block, ARegion *ar, SpaceOops *soops bt = uiDefBut(block, UI_BTYPE_BUT, 1, buf, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, - TIP_("Number of users of this datablock")); + TIP_("Number of users of this data-block")); UI_but_flag_enable(bt, but_flag); bt = uiDefButBitS(block, UI_BTYPE_TOGGLE, LIB_FAKEUSER, 1, (id->flag & LIB_FAKEUSER) ? "F" : " ", (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), te->ys, UI_UNIT_X, UI_UNIT_Y, &id->flag, 0, 0, 0, 0, - TIP_("Datablock has a 'fake' user which will keep it in the file " + TIP_("Data-block has a 'fake' user which will keep it in the file " "even if nothing else uses it")); UI_but_func_set(bt, restrictbutton_id_user_toggle, id, NULL); UI_but_flag_enable(bt, but_flag); diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 65608c8c15a..8eb53d0d7b9 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -320,7 +320,7 @@ static void id_delete(bContext *C, ReportList *reports, TreeElement *te, TreeSto } else if (BKE_library_ID_is_indirectly_used(bmain, id) && ID_REAL_USERS(id) <= 1) { BKE_reportf(reports, RPT_WARNING, - "Cannot delete id '%s', indirectly used datablocks need at least one user", + "Cannot delete id '%s', indirectly used data-blocks need at least one user", id->name); return; } @@ -389,7 +389,7 @@ static int outliner_id_delete_invoke(bContext *C, wmOperator *op, const wmEvent void OUTLINER_OT_id_delete(wmOperatorType *ot) { - ot->name = "Delete Datablock"; + ot->name = "Delete Data-Block"; ot->idname = "OUTLINER_OT_id_delete"; ot->description = "Delete the ID under cursor"; @@ -422,7 +422,7 @@ static int outliner_id_remap_exec(bContext *C, wmOperator *op) if (ID_IS_LINKED_DATABLOCK(old_id)) { BKE_reportf(op->reports, RPT_WARNING, - "Old ID '%s' is linked from a library, indirect usages of this datablock will not be remapped", + "Old ID '%s' is linked from a library, indirect usages of this data-block will not be remapped", old_id->name); } @@ -1942,7 +1942,7 @@ static int outliner_orphans_purge_invoke(bContext *C, wmOperator *op, const wmEv { /* present a prompt to informing users that this change is irreversible */ return WM_operator_confirm_message(C, op, - "Purging unused datablocks cannot be undone. " + "Purging unused data-blocks cannot be undone. " "Click here to proceed..."); } @@ -1964,7 +1964,7 @@ void OUTLINER_OT_orphans_purge(wmOperatorType *ot) /* identifiers */ ot->idname = "OUTLINER_OT_orphans_purge"; ot->name = "Purge All"; - ot->description = "Clear all orphaned datablocks without any users from the file (cannot be undone)"; + ot->description = "Clear all orphaned data-blocks without any users from the file (cannot be undone)"; /* callbacks */ ot->invoke = outliner_orphans_purge_invoke; diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index e38886abeac..ecb4949350f 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -900,7 +900,7 @@ static EnumPropertyItem prop_object_op_types[] = { {OL_OP_DELETE, "DELETE", 0, "Delete", ""}, {OL_OP_DELETE_HIERARCHY, "DELETE_HIERARCHY", 0, "Delete Hierarchy", ""}, {OL_OP_REMAP, "REMAP", 0, "Remap Users", - "Make all users of selected datablocks to use instead a new chosen one"}, + "Make all users of selected data-blocks to use instead a new chosen one"}, {OL_OP_TOGVIS, "TOGVIS", 0, "Toggle Visible", ""}, {OL_OP_TOGSEL, "TOGSEL", 0, "Toggle Selectable", ""}, {OL_OP_TOGREN, "TOGREN", 0, "Toggle Renderable", ""}, @@ -1046,7 +1046,7 @@ static EnumPropertyItem prop_group_op_types[] = { {OL_GROUPOP_LINK, "LINK", 0, "Link Group Objects to Scene", ""}, {OL_GROUPOP_DELETE, "DELETE", 0, "Delete Group", "WARNING: no undo"}, {OL_GROUPOP_REMAP, "REMAP", 0, "Remap Users", - "Make all users of selected datablocks to use instead current (clicked) one"}, + "Make all users of selected data-blocks to use instead current (clicked) one"}, {OL_GROUPOP_INSTANCE, "INSTANCE", 0, "Instance Groups in Scene", ""}, {OL_GROUPOP_TOGVIS, "TOGVIS", 0, "Toggle Visible Group", ""}, {OL_GROUPOP_TOGSEL, "TOGSEL", 0, "Toggle Selectable", ""}, @@ -1153,9 +1153,9 @@ static EnumPropertyItem prop_id_op_types[] = { {OUTLINER_IDOP_SINGLE, "SINGLE", 0, "Make Single User", ""}, {OUTLINER_IDOP_DELETE, "DELETE", 0, "Delete", "WARNING: no undo"}, {OUTLINER_IDOP_REMAP, "REMAP", 0, "Remap Users", - "Make all users of selected datablocks to use instead current (clicked) one"}, + "Make all users of selected data-blocks to use instead current (clicked) one"}, {OUTLINER_IDOP_FAKE_ADD, "ADD_FAKE", 0, "Add Fake User", - "Ensure datablock gets saved even if it isn't in use (e.g. for motion and material libraries)"}, + "Ensure data-block gets saved even if it isn't in use (e.g. for motion and material libraries)"}, {OUTLINER_IDOP_FAKE_CLEAR, "CLEAR_FAKE", 0, "Clear Fake User", ""}, {OUTLINER_IDOP_RENAME, "RENAME", 0, "Rename", ""}, {OUTLINER_IDOP_SELECT_LINKED, "SELECT_LINKED", 0, "Select Linked", ""}, @@ -1476,8 +1476,8 @@ static int outliner_action_set_exec(bContext *C, wmOperator *op) else if (act->idroot == 0) { /* hopefully in this case (i.e. library of userless actions), the user knows what they're doing... */ BKE_reportf(op->reports, RPT_WARNING, - "Action '%s' does not specify what datablocks it can be used on " - "(try setting the 'ID Root Type' setting from the Datablocks Editor " + "Action '%s' does not specify what data-blocks it can be used on " + "(try setting the 'ID Root Type' setting from the data-blocks editor " "for this action to avoid future problems)", act->id.name + 2); } diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index e7428fd79d9..83012eac39e 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -197,7 +197,7 @@ void TEXT_OT_new(wmOperatorType *ot) /* identifiers */ ot->name = "Create Text Block"; ot->idname = "TEXT_OT_new"; - ot->description = "Create a new text data block"; + ot->description = "Create a new text data-block"; /* api callbacks */ ot->exec = text_new_exec; @@ -288,7 +288,7 @@ void TEXT_OT_open(wmOperatorType *ot) /* identifiers */ ot->name = "Open Text Block"; ot->idname = "TEXT_OT_open"; - ot->description = "Open a new text data block"; + ot->description = "Open a new text data-block"; /* api callbacks */ ot->exec = text_open_exec; @@ -348,7 +348,7 @@ void TEXT_OT_reload(wmOperatorType *ot) /* identifiers */ ot->name = "Reload"; ot->idname = "TEXT_OT_reload"; - ot->description = "Reload active text data block from its file"; + ot->description = "Reload active text data-block from its file"; /* api callbacks */ ot->exec = text_reload_exec; @@ -397,7 +397,7 @@ void TEXT_OT_unlink(wmOperatorType *ot) /* identifiers */ ot->name = "Unlink"; ot->idname = "TEXT_OT_unlink"; - ot->description = "Unlink active text data block"; + ot->description = "Unlink active text data-block"; /* api callbacks */ ot->exec = text_unlink_exec; @@ -512,7 +512,7 @@ void TEXT_OT_save(wmOperatorType *ot) /* identifiers */ ot->name = "Save"; ot->idname = "TEXT_OT_save"; - ot->description = "Save active text data block"; + ot->description = "Save active text data-block"; /* api callbacks */ ot->exec = text_save_exec; @@ -3187,7 +3187,7 @@ void TEXT_OT_to_3d_object(wmOperatorType *ot) /* identifiers */ ot->name = "To 3D Object"; ot->idname = "TEXT_OT_to_3d_object"; - ot->description = "Create 3D text object from active text data block"; + ot->description = "Create 3D text object from active text data-block"; /* api callbacks */ ot->exec = text_to_3d_object_exec; diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index eb9320b3fd6..7e6bdf970f6 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -821,20 +821,20 @@ static void rna_def_ID_materials(BlenderRNA *brna) func = RNA_def_function(srna, "append", "rna_IDMaterials_append_id"); RNA_def_function_flag(func, FUNC_USE_MAIN); - RNA_def_function_ui_description(func, "Add a new material to the data block"); + RNA_def_function_ui_description(func, "Add a new material to the data-block"); parm = RNA_def_pointer(func, "material", "Material", "", "Material to add"); RNA_def_property_flag(parm, PROP_REQUIRED); func = RNA_def_function(srna, "pop", "rna_IDMaterials_pop_id"); RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_MAIN); - RNA_def_function_ui_description(func, "Remove a material from the data block"); + RNA_def_function_ui_description(func, "Remove a material from the data-block"); parm = RNA_def_int(func, "index", -1, -MAXMAT, MAXMAT, "", "Index of material to remove", 0, MAXMAT); RNA_def_boolean(func, "update_data", 0, "", "Update data by re-adjusting the material slots assigned"); parm = RNA_def_pointer(func, "material", "Material", "", "Material to remove"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "clear", "rna_IDMaterials_clear_id"); - RNA_def_function_ui_description(func, "Remove all materials from the data block"); + RNA_def_function_ui_description(func, "Remove all materials from the data-block"); RNA_def_boolean(func, "update_data", 0, "", "Update data by re-adjusting the material slots assigned"); } @@ -960,12 +960,12 @@ static void rna_def_ID(BlenderRNA *brna) prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_ID_RECALC); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Is Updated", "Datablock is tagged for recalculation"); + RNA_def_property_ui_text(prop, "Is Updated", "Data-block is tagged for recalculation"); prop = RNA_def_property(srna, "is_updated_data", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_ID_RECALC_DATA); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Is Updated Data", "Datablock data is tagged for recalculation"); + RNA_def_property_ui_text(prop, "Is Updated Data", "Data-block data is tagged for recalculation"); prop = RNA_def_property(srna, "is_library_indirect", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_INDIRECT); @@ -1004,7 +1004,7 @@ static void rna_def_ID(BlenderRNA *brna) parm = RNA_def_pointer(func, "id", "ID", "", "ID to count usages"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); parm = RNA_def_int(func, "count", 0, 0, INT_MAX, - "", "Number of usages/references of given id by current datablock", 0, INT_MAX); + "", "Number of usages/references of given id by current data-block", 0, INT_MAX); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "animation_data_create", "rna_ID_animation_data_create"); @@ -1050,7 +1050,7 @@ static void rna_def_library(BlenderRNA *brna) func = RNA_def_function(srna, "reload", "WM_lib_reload"); RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_CONTEXT); - RNA_def_function_ui_description(func, "Reload this library and all its linked datablocks"); + RNA_def_function_ui_description(func, "Reload this library and all its linked data-blocks"); } void RNA_def_ID(BlenderRNA *brna) { diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index 8d7e47e8402..3f2c0f3d434 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -310,8 +310,8 @@ static void rna_def_dopesheet(BlenderRNA *brna) prop = RNA_def_property(srna, "use_datablock_sort", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ADS_FLAG_NO_DB_SORT); - RNA_def_property_ui_text(prop, "Sort Datablocks", - "Alphabetically sorts datablocks - mainly objects in the scene " + RNA_def_property_ui_text(prop, "Sort Data-Blocks", + "Alphabetically sorts data-blocks - mainly objects in the scene " "(disable to increase viewport speed)"); RNA_def_property_ui_icon(prop, ICON_SORTALPHA, 0); RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); @@ -377,7 +377,7 @@ static void rna_def_dopesheet(BlenderRNA *brna) prop = RNA_def_property(srna, "show_missing_nla", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NLA_NOACT); RNA_def_property_ui_text(prop, "Include Missing NLA", - "Include animation data blocks with no NLA data (NLA editor only)"); + "Include animation data-blocks with no NLA data (NLA editor only)"); RNA_def_property_ui_icon(prop, ICON_ACTION, 0); RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); @@ -516,7 +516,7 @@ static void rna_def_dopesheet(BlenderRNA *brna) prop = RNA_def_property(srna, "show_gpencil_3d_only", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_GP_3DONLY); RNA_def_property_ui_text(prop, "Active Scene Only", - "Only show Grease Pencil datablocks used as part of the active scene"); + "Only show Grease Pencil data-blocks used as part of the active scene"); RNA_def_property_ui_icon(prop, ICON_SCENE_DATA, 0); RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); } diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index 7a1954036e3..e37affcf5a3 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -806,7 +806,7 @@ static void rna_def_keyingset_paths(BlenderRNA *brna, PropertyRNA *cprop) parm = RNA_def_pointer(func, "ksp", "KeyingSetPath", "New Path", "Path created and added to the Keying Set"); RNA_def_function_return(func, parm); /* ID-block for target */ - parm = RNA_def_pointer(func, "target_id", "ID", "Target ID", "ID-Datablock for the destination"); + parm = RNA_def_pointer(func, "target_id", "ID", "Target ID", "ID data-block for the destination"); RNA_def_property_flag(parm, PROP_REQUIRED); /* rna-path */ /* XXX hopefully this is long enough */ diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c index 502e22e2c07..f20e8fb8ed4 100644 --- a/source/blender/makesrna/intern/rna_key.c +++ b/source/blender/makesrna/intern/rna_key.c @@ -797,7 +797,7 @@ static void rna_def_key(BlenderRNA *brna) prop = RNA_def_property(srna, "user", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "from"); - RNA_def_property_ui_text(prop, "User", "Datablock using these shape keys"); + RNA_def_property_ui_text(prop, "User", "Data-block using these shape keys"); prop = RNA_def_property(srna, "use_relative", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "type", KEY_RELATIVE); diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c index bf016191c61..d432f086dba 100644 --- a/source/blender/makesrna/intern/rna_main.c +++ b/source/blender/makesrna/intern/rna_main.c @@ -335,39 +335,39 @@ void RNA_def_main(BlenderRNA *brna) /* plural must match idtypes in readblenentry.c */ MainCollectionDef lists[] = { - {"cameras", "Camera", "rna_Main_camera_begin", "Cameras", "Camera datablocks", RNA_def_main_cameras}, - {"scenes", "Scene", "rna_Main_scene_begin", "Scenes", "Scene datablocks", RNA_def_main_scenes}, - {"objects", "Object", "rna_Main_object_begin", "Objects", "Object datablocks", RNA_def_main_objects}, - {"materials", "Material", "rna_Main_mat_begin", "Materials", "Material datablocks", RNA_def_main_materials}, - {"node_groups", "NodeTree", "rna_Main_nodetree_begin", "Node Groups", "Node group datablocks", RNA_def_main_node_groups}, - {"meshes", "Mesh", "rna_Main_mesh_begin", "Meshes", "Mesh datablocks", RNA_def_main_meshes}, - {"lamps", "Lamp", "rna_Main_lamp_begin", "Lamps", "Lamp datablocks", RNA_def_main_lamps}, - {"libraries", "Library", "rna_Main_library_begin", "Libraries", "Library datablocks", RNA_def_main_libraries}, - {"screens", "Screen", "rna_Main_screen_begin", "Screens", "Screen datablocks", RNA_def_main_screens}, - {"window_managers", "WindowManager", "rna_Main_wm_begin", "Window Managers", "Window manager datablocks", RNA_def_main_window_managers}, - {"images", "Image", "rna_Main_image_begin", "Images", "Image datablocks", RNA_def_main_images}, - {"lattices", "Lattice", "rna_Main_latt_begin", "Lattices", "Lattice datablocks", RNA_def_main_lattices}, - {"curves", "Curve", "rna_Main_curve_begin", "Curves", "Curve datablocks", RNA_def_main_curves}, - {"metaballs", "MetaBall", "rna_Main_mball_begin", "Metaballs", "Metaball datablocks", RNA_def_main_metaballs}, - {"fonts", "VectorFont", "rna_Main_font_begin", "Vector Fonts", "Vector font datablocks", RNA_def_main_fonts}, - {"textures", "Texture", "rna_Main_tex_begin", "Textures", "Texture datablocks", RNA_def_main_textures}, - {"brushes", "Brush", "rna_Main_brush_begin", "Brushes", "Brush datablocks", RNA_def_main_brushes}, - {"worlds", "World", "rna_Main_world_begin", "Worlds", "World datablocks", RNA_def_main_worlds}, - {"groups", "Group", "rna_Main_group_begin", "Groups", "Group datablocks", RNA_def_main_groups}, - {"shape_keys", "Key", "rna_Main_key_begin", "Shape Keys", "Shape Key datablocks", NULL}, - {"texts", "Text", "rna_Main_text_begin", "Texts", "Text datablocks", RNA_def_main_texts}, - {"speakers", "Speaker", "rna_Main_speaker_begin", "Speakers", "Speaker datablocks", RNA_def_main_speakers}, - {"sounds", "Sound", "rna_Main_sound_begin", "Sounds", "Sound datablocks", RNA_def_main_sounds}, - {"armatures", "Armature", "rna_Main_armature_begin", "Armatures", "Armature datablocks", RNA_def_main_armatures}, - {"actions", "Action", "rna_Main_action_begin", "Actions", "Action datablocks", RNA_def_main_actions}, - {"particles", "ParticleSettings", "rna_Main_particle_begin", "Particles", "Particle datablocks", RNA_def_main_particles}, - {"palettes", "Palette", "rna_Main_palettes_begin", "Palettes", "Palette datablocks", RNA_def_main_palettes}, - {"grease_pencil", "GreasePencil", "rna_Main_gpencil_begin", "Grease Pencil", "Grease Pencil datablocks", RNA_def_main_gpencil}, - {"movieclips", "MovieClip", "rna_Main_movieclips_begin", "Movie Clips", "Movie Clip datablocks", RNA_def_main_movieclips}, - {"masks", "Mask", "rna_Main_masks_begin", "Masks", "Masks datablocks", RNA_def_main_masks}, - {"linestyles", "FreestyleLineStyle", "rna_Main_linestyle_begin", "Line Styles", "Line Style datablocks", RNA_def_main_linestyles}, - {"cache_files", "CacheFile", "rna_Main_cachefiles_begin", "Cache Files", "Cache Files datablocks", RNA_def_main_cachefiles}, - {"paint_curves", "PaintCurve", "rna_Main_paintcurves_begin", "Paint Curves", "Paint Curves datablocks", RNA_def_main_paintcurves}, + {"cameras", "Camera", "rna_Main_camera_begin", "Cameras", "Camera data-blocks", RNA_def_main_cameras}, + {"scenes", "Scene", "rna_Main_scene_begin", "Scenes", "Scene data-blocks", RNA_def_main_scenes}, + {"objects", "Object", "rna_Main_object_begin", "Objects", "Object data-blocks", RNA_def_main_objects}, + {"materials", "Material", "rna_Main_mat_begin", "Materials", "Material data-blocks", RNA_def_main_materials}, + {"node_groups", "NodeTree", "rna_Main_nodetree_begin", "Node Groups", "Node group data-blocks", RNA_def_main_node_groups}, + {"meshes", "Mesh", "rna_Main_mesh_begin", "Meshes", "Mesh data-blocks", RNA_def_main_meshes}, + {"lamps", "Lamp", "rna_Main_lamp_begin", "Lamps", "Lamp data-blocks", RNA_def_main_lamps}, + {"libraries", "Library", "rna_Main_library_begin", "Libraries", "Library data-blocks", RNA_def_main_libraries}, + {"screens", "Screen", "rna_Main_screen_begin", "Screens", "Screen data-blocks", RNA_def_main_screens}, + {"window_managers", "WindowManager", "rna_Main_wm_begin", "Window Managers", "Window manager data-blocks", RNA_def_main_window_managers}, + {"images", "Image", "rna_Main_image_begin", "Images", "Image data-blocks", RNA_def_main_images}, + {"lattices", "Lattice", "rna_Main_latt_begin", "Lattices", "Lattice data-blocks", RNA_def_main_lattices}, + {"curves", "Curve", "rna_Main_curve_begin", "Curves", "Curve data-blocks", RNA_def_main_curves}, + {"metaballs", "MetaBall", "rna_Main_mball_begin", "Metaballs", "Metaball data-blocks", RNA_def_main_metaballs}, + {"fonts", "VectorFont", "rna_Main_font_begin", "Vector Fonts", "Vector font data-blocks", RNA_def_main_fonts}, + {"textures", "Texture", "rna_Main_tex_begin", "Textures", "Texture data-blocks", RNA_def_main_textures}, + {"brushes", "Brush", "rna_Main_brush_begin", "Brushes", "Brush data-blocks", RNA_def_main_brushes}, + {"worlds", "World", "rna_Main_world_begin", "Worlds", "World data-blocks", RNA_def_main_worlds}, + {"groups", "Group", "rna_Main_group_begin", "Groups", "Group data-blocks", RNA_def_main_groups}, + {"shape_keys", "Key", "rna_Main_key_begin", "Shape Keys", "Shape Key data-blocks", NULL}, + {"texts", "Text", "rna_Main_text_begin", "Texts", "Text data-blocks", RNA_def_main_texts}, + {"speakers", "Speaker", "rna_Main_speaker_begin", "Speakers", "Speaker data-blocks", RNA_def_main_speakers}, + {"sounds", "Sound", "rna_Main_sound_begin", "Sounds", "Sound data-blocks", RNA_def_main_sounds}, + {"armatures", "Armature", "rna_Main_armature_begin", "Armatures", "Armature data-blocks", RNA_def_main_armatures}, + {"actions", "Action", "rna_Main_action_begin", "Actions", "Action data-blocks", RNA_def_main_actions}, + {"particles", "ParticleSettings", "rna_Main_particle_begin", "Particles", "Particle data-blocks", RNA_def_main_particles}, + {"palettes", "Palette", "rna_Main_palettes_begin", "Palettes", "Palette data-blocks", RNA_def_main_palettes}, + {"grease_pencil", "GreasePencil", "rna_Main_gpencil_begin", "Grease Pencil", "Grease Pencil data-blocks", RNA_def_main_gpencil}, + {"movieclips", "MovieClip", "rna_Main_movieclips_begin", "Movie Clips", "Movie Clip data-blocks", RNA_def_main_movieclips}, + {"masks", "Mask", "rna_Main_masks_begin", "Masks", "Masks data-blocks", RNA_def_main_masks}, + {"linestyles", "FreestyleLineStyle", "rna_Main_linestyle_begin", "Line Styles", "Line Style data-blocks", RNA_def_main_linestyles}, + {"cache_files", "CacheFile", "rna_Main_cachefiles_begin", "Cache Files", "Cache Files data-blocks", RNA_def_main_cachefiles}, + {"paint_curves", "PaintCurve", "rna_Main_paintcurves_begin", "Paint Curves", "Paint Curves data-blocks", RNA_def_main_paintcurves}, {NULL, NULL, NULL, NULL, NULL, NULL} }; @@ -375,7 +375,7 @@ void RNA_def_main(BlenderRNA *brna) srna = RNA_def_struct(brna, "BlendData", NULL); RNA_def_struct_ui_text(srna, "Blendfile Data", - "Main data structure representing a .blend file and all its datablocks"); + "Main data structure representing a .blend file and all its data-blocks"); RNA_def_struct_ui_icon(srna, ICON_BLENDER); prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); diff --git a/source/blender/makesrna/intern/rna_mask.c b/source/blender/makesrna/intern/rna_mask.c index a23d4444861..faf36d28ff9 100644 --- a/source/blender/makesrna/intern/rna_mask.c +++ b/source/blender/makesrna/intern/rna_mask.c @@ -632,13 +632,13 @@ static void rna_def_maskParent(BlenderRNA *brna) /* parent */ prop = RNA_def_property(srna, "parent", PROP_STRING, PROP_NONE); - RNA_def_property_ui_text(prop, "Parent", "Name of parent object in specified data block to which parenting happens"); + RNA_def_property_ui_text(prop, "Parent", "Name of parent object in specified data-block to which parenting happens"); RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2); RNA_def_property_update(prop, 0, "rna_Mask_update_parent"); /* sub_parent */ prop = RNA_def_property(srna, "sub_parent", PROP_STRING, PROP_NONE); - RNA_def_property_ui_text(prop, "Sub Parent", "Name of parent sub-object in specified data block to which parenting happens"); + RNA_def_property_ui_text(prop, "Sub Parent", "Name of parent sub-object in specified data-block to which parenting happens"); RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2); RNA_def_property_update(prop, 0, "rna_Mask_update_parent"); } diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index a37fe049e72..47e9d989dbf 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -8217,9 +8217,9 @@ static void rna_def_nodetree(BlenderRNA *brna) RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); parm = RNA_def_pointer(func, "result_1", "NodeTree", "Node Tree", "Active node tree from context"); RNA_def_function_output(func, parm); - parm = RNA_def_pointer(func, "result_2", "ID", "Owner ID", "ID data block that owns the node tree"); + parm = RNA_def_pointer(func, "result_2", "ID", "Owner ID", "ID data-block that owns the node tree"); RNA_def_function_output(func, parm); - parm = RNA_def_pointer(func, "result_3", "ID", "From ID", "Original ID data block selected from the context"); + parm = RNA_def_pointer(func, "result_3", "ID", "From ID", "Original ID data-block selected from the context"); RNA_def_function_output(func, parm); } diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index f2a1e0a50ab..6a5978ef0d4 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -2624,7 +2624,7 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_src"); RNA_def_property_enum_items(prop, gpencil_source_3d_items); RNA_def_property_ui_text(prop, "Grease Pencil Source", - "Datablock where active Grease Pencil data is found from"); + "Data-block where active Grease Pencil data is found from"); RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL); prop = RNA_def_property(srna, "gpencil_sculpt", PROP_POINTER, PROP_NONE); @@ -6776,8 +6776,8 @@ void RNA_def_scene(BlenderRNA *brna) /* Struct definition */ srna = RNA_def_struct(brna, "Scene", "ID"); - RNA_def_struct_ui_text(srna, "Scene", - "Scene data block, consisting in objects and defining time and render related settings"); + RNA_def_struct_ui_text(srna, "Scene", "Scene data-block, consisting in objects and " + "defining time and render related settings"); RNA_def_struct_ui_icon(srna, ICON_SCENE_DATA); RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 1c8d4a4c818..a7dab0f56f8 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -4303,17 +4303,17 @@ static void rna_def_space_node(BlenderRNA *brna) prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "ID", "Datablock whose nodes are being edited"); + RNA_def_property_ui_text(prop, "ID", "Data-block whose nodes are being edited"); prop = RNA_def_property(srna, "id_from", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "from"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "ID From", "Datablock from which the edited data-block is linked"); + RNA_def_property_ui_text(prop, "ID From", "Data-block from which the edited data-block is linked"); prop = RNA_def_property(srna, "path", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "treepath", NULL); RNA_def_property_struct_type(prop, "NodeTreePath"); - RNA_def_property_ui_text(prop, "Node Tree Path", "Path from the data block to the currently edited node tree"); + RNA_def_property_ui_text(prop, "Node Tree Path", "Path from the data-block to the currently edited node tree"); rna_def_space_node_path_api(brna, prop); prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 29c0e948a4c..655c265cad0 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2835,13 +2835,13 @@ static void rna_def_userdef_theme_space_nla(BlenderRNA *brna) prop = RNA_def_property(srna, "active_action", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, NULL, "anim_active"); RNA_def_property_array(prop, 4); - RNA_def_property_ui_text(prop, "Active Action", "Animation data block has active action"); + RNA_def_property_ui_text(prop, "Active Action", "Animation data-block has active action"); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop = RNA_def_property(srna, "active_action_unset", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, NULL, "anim_non_active"); RNA_def_property_array(prop, 4); - RNA_def_property_ui_text(prop, "No Active Action", "Animation data block doesn't have active action"); + RNA_def_property_ui_text(prop, "No Active Action", "Animation data-block doesn't have active action"); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop = RNA_def_property(srna, "strips", PROP_FLOAT, PROP_COLOR_GAMMA); @@ -4576,7 +4576,7 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna) prop = RNA_def_property(srna, "show_hidden_files_datablocks", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_HIDE_DOT); - RNA_def_property_ui_text(prop, "Hide Dot Files/Datablocks", "Hide files/data-blocks that start with a dot (.*)"); + RNA_def_property_ui_text(prop, "Hide Dot Files/Data-Blocks", "Hide files/data-blocks that start with a dot (.*)"); prop = RNA_def_property(srna, "use_filter_files", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_FILTERFILEEXTS); diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c index 12cd93e418b..fbc036435f0 100644 --- a/source/blender/nodes/intern/node_common.c +++ b/source/blender/nodes/intern/node_common.c @@ -78,7 +78,7 @@ bNodeSocket *node_group_find_output_socket(bNode *groupnode, const char *identif /* groups display their internal tree name as label */ void node_group_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen) { - BLI_strncpy(label, (node->id) ? node->id->name + 2 : IFACE_("Missing Datablock"), maxlen); + BLI_strncpy(label, (node->id) ? node->id->name + 2 : IFACE_("Missing Data-Block"), maxlen); } int node_group_poll_instance(bNode *node, bNodeTree *nodetree) diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c index 3405537a09c..e872ec1a524 100644 --- a/source/blender/windowmanager/intern/wm_files_link.c +++ b/source/blender/windowmanager/intern/wm_files_link.c @@ -466,7 +466,7 @@ static void wm_link_append_properties_common(wmOperatorType *ot, bool is_link) /* better not save _any_ settings for this operator */ /* properties */ prop = RNA_def_boolean(ot->srna, "link", is_link, - "Link", "Link the objects or datablocks rather than appending"); + "Link", "Link the objects or data-blocks rather than appending"); RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN); prop = RNA_def_boolean(ot->srna, "autoselect", true, "Select", "Select new objects"); @@ -675,7 +675,7 @@ static void lib_relocate_do( id_sort_by_name(which_libbase(bmain, GS(old_id->name)), old_id); BKE_reportf(reports, RPT_WARNING, - "Lib Reload: Replacing all references to old datablock '%s' by reloaded one failed, " + "Lib Reload: Replacing all references to old data-block '%s' by reloaded one failed, " "old one (%d remaining users) had to be kept and was renamed to '%s'", new_id->name, old_id->us, old_id->name); } diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 7177244611e..87ef0596e52 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -3963,9 +3963,9 @@ static int previews_ensure_exec(bContext *C, wmOperator *UNUSED(op)) static void WM_OT_previews_ensure(wmOperatorType *ot) { - ot->name = "Refresh DataBlock Previews"; + ot->name = "Refresh Data-Block Previews"; ot->idname = "WM_OT_previews_ensure"; - ot->description = "Ensure datablock previews are available and up-to-date " + ot->description = "Ensure data-block previews are available and up-to-date " "(to be saved in .blend file, only for some types like materials, textures, etc.)"; ot->exec = previews_ensure_exec; @@ -4022,9 +4022,9 @@ static int previews_clear_exec(bContext *C, wmOperator *op) static void WM_OT_previews_clear(wmOperatorType *ot) { - ot->name = "Clear DataBlock Previews"; + ot->name = "Clear Data-Block Previews"; ot->idname = "WM_OT_previews_clear"; - ot->description = "Clear datablock previews (only for some types like objects, materials, textures, etc.)"; + ot->description = "Clear data-block previews (only for some types like objects, materials, textures, etc.)"; ot->exec = previews_clear_exec; ot->invoke = WM_menu_invoke; @@ -4032,7 +4032,7 @@ static void WM_OT_previews_clear(wmOperatorType *ot) ot->prop = RNA_def_enum_flag(ot->srna, "id_type", preview_id_type_items, FILTER_ID_SCE | FILTER_ID_OB | FILTER_ID_GR | FILTER_ID_MA | FILTER_ID_LA | FILTER_ID_WO | FILTER_ID_TE | FILTER_ID_IM, - "DataBlock Type", "Which datablock previews to clear"); + "Data-Block Type", "Which data-block previews to clear"); } /* *************************** Doc from UI ************* */ diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index edbbf93bf7a..dd93a6ff424 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -1148,7 +1148,7 @@ int main( MEM_freeN(python_code); } else { - fprintf(stderr, "ERROR: cannot yield control to Python: no Python text data block named '%s'\n", python_main); + fprintf(stderr, "ERROR: cannot yield control to Python: no Python text data-block named '%s'\n", python_main); } } else { -- cgit v1.2.3 From e12f5b699d5a2eea045b584ebc7264bddcfb994d Mon Sep 17 00:00:00 2001 From: Mike Erwin Date: Mon, 19 Sep 2016 20:26:55 +0200 Subject: OpenGL: software renderer for old Mac GPUs We raised the minimum to GL 2.1 in Blender 2.77, and dropped support for older GPUs (pre-2012 Intel mostly). On Windows you get a popup message, but on Mac we simply crashed. Every Mac has a builtin software renderer for GL 2.1 so let's use that when the GPU is not capable! Run blender --debug-gpu to see version detection & software fallback. --- intern/ghost/intern/GHOST_ContextCGL.h | 2 + intern/ghost/intern/GHOST_ContextCGL.mm | 87 +++++++++++++++++++++++--------- intern/ghost/intern/GHOST_SystemCocoa.mm | 2 +- intern/ghost/intern/GHOST_WindowCocoa.h | 4 +- intern/ghost/intern/GHOST_WindowCocoa.mm | 7 +-- 5 files changed, 74 insertions(+), 28 deletions(-) diff --git a/intern/ghost/intern/GHOST_ContextCGL.h b/intern/ghost/intern/GHOST_ContextCGL.h index 953235669a8..dd49b81b561 100644 --- a/intern/ghost/intern/GHOST_ContextCGL.h +++ b/intern/ghost/intern/GHOST_ContextCGL.h @@ -136,6 +136,8 @@ private: //static CGLEWContext *s_cglewContext; + const bool m_debug; + /** The first created OpenGL context (for sharing display lists) */ static NSOpenGLContext *s_sharedOpenGLContext; static int s_sharedCount; diff --git a/intern/ghost/intern/GHOST_ContextCGL.mm b/intern/ghost/intern/GHOST_ContextCGL.mm index e09de4be143..03c45f9945b 100644 --- a/intern/ghost/intern/GHOST_ContextCGL.mm +++ b/intern/ghost/intern/GHOST_ContextCGL.mm @@ -59,7 +59,8 @@ GHOST_ContextCGL::GHOST_ContextCGL( int contextResetNotificationStrategy) : GHOST_Context(stereoVisual, numOfAASamples), m_openGLView(openGLView), - m_openGLContext(nil) + m_openGLContext(nil), + m_debug(contextFlags) { assert(openGLView != nil); } @@ -172,20 +173,21 @@ static void makeAttribList( bool stereoVisual, int numOfAASamples, bool needAlpha, - bool needStencil) + bool needStencil, + bool softwareGL) { + attribs.clear(); + // Pixel Format Attributes for the windowed NSOpenGLContext attribs.push_back(NSOpenGLPFADoubleBuffer); - // Force software OpenGL, for debugging - /* XXX jwilkins: fixed this to work on Intel macs? useful feature for Windows and Linux too? - * Maybe a command line flag is better... */ - if (getenv("BLENDER_SOFTWAREGL")) { + if (softwareGL) { attribs.push_back(NSOpenGLPFARendererID); attribs.push_back(kCGLRendererGenericFloatID); } else { attribs.push_back(NSOpenGLPFAAccelerated); + attribs.push_back(NSOpenGLPFANoRecovery); } /* Removed to allow 10.4 builds, and 2 GPUs rendering is not used anyway */ @@ -219,13 +221,21 @@ static void makeAttribList( attribs.push_back(NSOpenGLPFASamples); attribs.push_back((NSOpenGLPixelFormatAttribute) numOfAASamples); - - attribs.push_back(NSOpenGLPFANoRecovery); } attribs.push_back((NSOpenGLPixelFormatAttribute) 0); } +// TODO(merwin): make this available to all platforms +static void getVersion(int *major, int *minor) +{ +#if 1 // legacy GL + sscanf((const char*)glGetString(GL_VERSION), "%d.%d", major, minor); +#else // 3.0+ + glGetIntegerv(GL_MAJOR_VERSION, major); + glGetIntegerv(GL_MINOR_VERSION, minor); +#endif +} GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext() { @@ -248,9 +258,12 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext() static const bool needStencil = false; #endif - makeAttribList(attribs, m_stereoVisual, m_numOfAASamples, needAlpha, needStencil); - + static bool softwareGL = getenv("BLENDER_SOFTWAREGL"); // command-line argument would be better + GLint major = 0, minor = 0; NSOpenGLPixelFormat *pixelFormat; + // TODO: keep pixel format for subsequent windows/contexts instead of recreating each time + + makeAttribList(attribs, m_stereoVisual, m_numOfAASamples, needAlpha, needStencil, softwareGL); pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:&attribs[0]]; @@ -261,7 +274,7 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext() // (Now that I think about it, does WGL really require the code that it has for finding a lesser match?) attribs.clear(); - makeAttribList(attribs, m_stereoVisual, 0, needAlpha, needStencil); + makeAttribList(attribs, m_stereoVisual, 0, needAlpha, needStencil, softwareGL); pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:&attribs[0]]; } @@ -282,25 +295,47 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext() } } - [m_openGLView setPixelFormat:pixelFormat]; + m_openGLContext = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:s_sharedOpenGLContext]; + [pixelFormat release]; - m_openGLContext = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:s_sharedOpenGLContext]; // +1 refCount to pixelFormat + [m_openGLContext makeCurrentContext]; - if (m_openGLContext == nil) - goto error; + getVersion(&major, &minor); + if (m_debug) { + fprintf(stderr, "OpenGL version %d.%d%s\n", major, minor, softwareGL ? " (software)" : ""); + fprintf(stderr, "Renderer: %s\n", glGetString(GL_RENDERER)); + } - if (s_sharedCount == 0) - s_sharedOpenGLContext = m_openGLContext; - - [pixelFormat release]; // -1 refCount to pixelFormat - - s_sharedCount++; + if (major < 2 || (major == 2 && minor < 1)) { + // fall back to software renderer if GL < 2.1 + fprintf(stderr, "OpenGL 2.1 is not supported on your hardware, falling back to software"); + softwareGL = true; + + // discard hardware GL context + [NSOpenGLContext clearCurrentContext]; + [m_openGLContext release]; + + // create software GL context + makeAttribList(attribs, m_stereoVisual, m_numOfAASamples, needAlpha, needStencil, softwareGL); + pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:&attribs[0]]; + m_openGLContext = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:s_sharedOpenGLContext]; + [pixelFormat release]; + + [m_openGLContext makeCurrentContext]; + + getVersion(&major, &minor); + if (m_debug) { + fprintf(stderr, "OpenGL version %d.%d%s\n", major, minor, softwareGL ? " (software)" : ""); + fprintf(stderr, "Renderer: %s\n", glGetString(GL_RENDERER)); + } + } #ifdef GHOST_MULTITHREADED_OPENGL //Switch openGL to multhreaded mode CGLContextObj cglCtx = (CGLContextObj)[tmpOpenGLContext CGLContextObj]; if (CGLEnable(cglCtx, kCGLCEMPEngine) == kCGLNoError) - printf("\nSwitched openGL to multithreaded mode\n"); + if (m_debug) + fprintf(stderr, "\nSwitched OpenGL to multithreaded mode\n"); #endif #ifdef GHOST_WAIT_FOR_VSYNC @@ -311,10 +346,16 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext() } #endif + initContextGLEW(); + [m_openGLView setOpenGLContext:m_openGLContext]; [m_openGLContext setView:m_openGLView]; - initContextGLEW(); + if (s_sharedCount == 0) + s_sharedOpenGLContext = m_openGLContext; + + s_sharedCount++; + initClearGL(); [m_openGLContext flushBuffer]; diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index b0d5ab31ce3..f31cba498e5 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -562,7 +562,7 @@ GHOST_IWindow* GHOST_SystemCocoa::createWindow( // Add contentRect.origin.y to respect docksize bottom = bottom > contentRect.origin.y ? bottom + contentRect.origin.y : contentRect.origin.y; - window = new GHOST_WindowCocoa (this, title, left, bottom, width, height, state, type, ((glSettings.flags & GHOST_glStereoVisual) != 0), glSettings.numOfAASamples); + window = new GHOST_WindowCocoa(this, title, left, bottom, width, height, state, type, glSettings.flags & GHOST_glStereoVisual, glSettings.numOfAASamples, glSettings.flags & GHOST_glDebugContext); if (window->getValid()) { // Store the pointer to the window diff --git a/intern/ghost/intern/GHOST_WindowCocoa.h b/intern/ghost/intern/GHOST_WindowCocoa.h index 3ed88086184..b234291396b 100644 --- a/intern/ghost/intern/GHOST_WindowCocoa.h +++ b/intern/ghost/intern/GHOST_WindowCocoa.h @@ -74,7 +74,8 @@ public: GHOST_TWindowState state, GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone, const bool stereoVisual = false, - const GHOST_TUns16 numOfAASamples = 0 + const GHOST_TUns16 numOfAASamples = 0, + bool is_debug = false ); /** @@ -305,6 +306,7 @@ protected: bool m_lionStyleFullScreen; bool m_immediateDraw; + bool m_debug_context; // for debug messages during context setup }; #endif // __GHOST_WINDOWCOCOA_H__ diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm index e23cf9ccd37..97615dcea96 100644 --- a/intern/ghost/intern/GHOST_WindowCocoa.mm +++ b/intern/ghost/intern/GHOST_WindowCocoa.mm @@ -528,10 +528,11 @@ GHOST_WindowCocoa::GHOST_WindowCocoa( GHOST_TUns32 height, GHOST_TWindowState state, GHOST_TDrawingContextType type, - const bool stereoVisual, const GHOST_TUns16 numOfAASamples + const bool stereoVisual, const GHOST_TUns16 numOfAASamples, bool is_debug ) : GHOST_Window(width, height, state, stereoVisual, false, numOfAASamples), - m_customCursor(0) + m_customCursor(0), + m_debug_context(is_debug) { m_systemCocoa = systemCocoa; m_fullScreen = false; @@ -1115,7 +1116,7 @@ GHOST_Context *GHOST_WindowCocoa::newDrawingContext(GHOST_TDrawingContextType ty m_openGLView, 0, // profile bit 0, 0, - GHOST_OPENGL_CGL_CONTEXT_FLAGS, + m_debug_context, GHOST_OPENGL_CGL_RESET_NOTIFICATION_STRATEGY); #else # error -- cgit v1.2.3 From f2da63cb12a9cbc3e5b21f5839dc7f9a9704f354 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 20 Sep 2016 10:48:25 +0200 Subject: Fix T49386: Blender crashes when told to load an OCIO LUT that does not exist --- source/blender/imbuf/intern/colormanagement.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c index 41812872f11..01348549bc4 100644 --- a/source/blender/imbuf/intern/colormanagement.c +++ b/source/blender/imbuf/intern/colormanagement.c @@ -3268,6 +3268,13 @@ bool IMB_colormanagement_setup_glsl_draw_from_space(const ColorManagedViewSettin update_glsl_display_processor(applied_view_settings, display_settings, from_colorspace ? from_colorspace->name : global_role_scene_linear); + if (global_glsl_state.processor == NULL) { + /* Happens when requesting non-existing color space or LUT in the + * configuration file does not exist. + */ + return false; + } + return OCIO_setupGLSLDraw(&global_glsl_state.ocio_glsl_state, global_glsl_state.processor, global_glsl_state.use_curve_mapping ? &global_glsl_state.curve_mapping_settings : NULL, dither, predivide); @@ -3304,5 +3311,7 @@ bool IMB_colormanagement_setup_glsl_draw_ctx(const bContext *C, float dither, bo /* Finish GLSL-based display space conversion */ void IMB_colormanagement_finish_glsl_draw(void) { - OCIO_finishGLSLDraw(global_glsl_state.ocio_glsl_state); + if (global_glsl_state.ocio_glsl_state != NULL) { + OCIO_finishGLSLDraw(global_glsl_state.ocio_glsl_state); + } } -- cgit v1.2.3 From 78c0bc52de7888f5deba7761b506157bf4d97a98 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 20 Sep 2016 11:56:37 +0200 Subject: Fix T49408: OpenGL light widget breaks viewport shading --- source/blender/editors/interface/interface_draw.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 9ce863dc8f7..01ea1e953fa 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1255,6 +1255,9 @@ void ui_draw_but_UNITVEC(uiBut *but, uiWidgetColors *wcol, const rcti *rect) /* matrix after circle */ glPopMatrix(); + + /* We disabled all blender lights above, so restore them here. */ + GPU_default_lights(); } static void ui_draw_but_curve_grid(const rcti *rect, float zoomx, float zoomy, float offsx, float offsy, float step) -- cgit v1.2.3 From f64aa4e0afc71ccadc3fb0faea090a1f42cd7b35 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Tue, 20 Sep 2016 12:13:40 +0200 Subject: Fix T49343: ImageFormatSettings were not setting their rna struct path correctly Reviewers: brecht, mont29 Reviewed By: brecht, mont29 Subscribers: brecht, sergey Differential Revision: https://developer.blender.org/D2228 --- source/blender/makesrna/intern/rna_scene.c | 49 +++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 6a5978ef0d4..bd6674f899c 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -922,6 +922,53 @@ static char *rna_RenderSettings_path(PointerRNA *UNUSED(ptr)) return BLI_sprintfN("render"); } +static char *rna_ImageFormatSettings_path(PointerRNA *ptr) +{ + ImageFormatData *imf = (ImageFormatData *)ptr->data; + ID *id = ptr->id.data; + + switch (GS(id->name)) { + case ID_SCE: + { + Scene *scene = (Scene *)id; + + if (&scene->r.im_format == imf) { + return BLI_sprintfN("render.image_settings"); + } + else if (&scene->r.bake.im_format == imf) { + return BLI_sprintfN("render.bake.image_settings"); + } + return BLI_sprintfN(".."); + } + case ID_NT: + { + bNodeTree *ntree = (bNodeTree *)id; + bNode *node; + + for (node = ntree->nodes.first; node; node = node->next) { + if (node->type == CMP_NODE_OUTPUT_FILE) { + if (&((NodeImageMultiFile *)node->storage)->format == imf) { + return BLI_sprintfN("nodes['%s'].format", node->name); + } + else { + bNodeSocket *sock; + + for (sock = node->inputs.first; sock; sock = sock->next) { + NodeImageMultiFileSocket *sockdata = sock->storage; + if (&sockdata->format == imf) { + return BLI_sprintfN("nodes['%s'].file_slots['%s'].format", node->name, sockdata->path); + } + } + } + } + } + return BLI_sprintfN(".."); + } + default: + return BLI_sprintfN(".."); + } +} + static int rna_RenderSettings_threads_get(PointerRNA *ptr) { RenderData *rd = (RenderData *)ptr->data; @@ -5116,7 +5163,7 @@ static void rna_def_scene_image_format_data(BlenderRNA *brna) srna = RNA_def_struct(brna, "ImageFormatSettings", NULL); RNA_def_struct_sdna(srna, "ImageFormatData"); RNA_def_struct_nested(brna, srna, "Scene"); - /* RNA_def_struct_path_func(srna, "rna_RenderSettings_path"); *//* no need for the path, its not animated! */ + RNA_def_struct_path_func(srna, "rna_ImageFormatSettings_path"); RNA_def_struct_ui_text(srna, "Image Format", "Settings for image formats"); prop = RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE); -- cgit v1.2.3 From 075a2175d5e706025473f7416d3bb89b91cc796c Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 20 Sep 2016 12:21:28 +0200 Subject: Fix T49391: Texture paint is not aware of disabled color management There might be some extra missing points here, but it's all rather a TODO than a real bug and can be tweaked further once issues are actually discovered. --- .../editors/sculpt_paint/paint_image_proj.c | 41 ++++++++++++++++++---- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 83fde4554b3..f5d115442c6 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -371,6 +371,8 @@ typedef struct ProjPaintState { */ const MLoopUV **dm_mloopuv; const MLoopUV **dm_mloopuv_clone; /* other UV map, use for cloning between layers */ + + bool use_colormanagement; } ProjPaintState; typedef union pixelPointer { @@ -1623,7 +1625,12 @@ static ProjPixel *project_paint_uvpixel_init( unsigned char rgba_ub[4]; float rgba[4]; project_face_pixel(lt_other_tri_uv, ibuf_other, w, rgba_ub, NULL); - srgb_to_linearrgb_uchar4(rgba, rgba_ub); + if (ps->use_colormanagement) { + srgb_to_linearrgb_uchar4(rgba, rgba_ub); + } + else { + rgba_uchar_to_float(rgba, rgba_ub); + } straight_to_premul_v4_v4(((ProjPixelClone *)projPixel)->clonepx.f, rgba); } } @@ -1632,7 +1639,12 @@ static ProjPixel *project_paint_uvpixel_init( float rgba[4]; project_face_pixel(lt_other_tri_uv, ibuf_other, w, NULL, rgba); premul_to_straight_v4(rgba); - linearrgb_to_srgb_uchar3(((ProjPixelClone *)projPixel)->clonepx.ch, rgba); + if (ps->use_colormanagement) { + linearrgb_to_srgb_uchar3(((ProjPixelClone *)projPixel)->clonepx.ch, rgba); + } + else { + rgb_float_to_uchar(((ProjPixelClone *)projPixel)->clonepx.ch, rgba); + } ((ProjPixelClone *)projPixel)->clonepx.ch[3] = rgba[3] * 255; } else { /* char to char */ @@ -4359,7 +4371,12 @@ static void do_projectpaint_draw( if (ps->is_texbrush) { mul_v3_v3v3(rgb, texrgb, ps->paint_color_linear); /* TODO(sergey): Support texture paint color space. */ - linearrgb_to_srgb_v3_v3(rgb, rgb); + if (ps->use_colormanagement) { + linearrgb_to_srgb_v3_v3(rgb, rgb); + } + else { + copy_v3_v3(rgb, rgb); + } } else { copy_v3_v3(rgb, ps->paint_color); @@ -4957,11 +4974,21 @@ static void paint_proj_stroke_ps( /* handle gradient and inverted stroke color here */ if (ps->tool == PAINT_TOOL_DRAW) { paint_brush_color_get(scene, brush, false, ps->mode == BRUSH_STROKE_INVERT, distance, pressure, ps->paint_color, NULL); - srgb_to_linearrgb_v3_v3(ps->paint_color_linear, ps->paint_color); + if (ps->use_colormanagement) { + srgb_to_linearrgb_v3_v3(ps->paint_color_linear, ps->paint_color); + } + else { + copy_v3_v3(ps->paint_color_linear, ps->paint_color); + } } else if (ps->tool == PAINT_TOOL_FILL) { copy_v3_v3(ps->paint_color, BKE_brush_color_get(scene, brush)); - srgb_to_linearrgb_v3_v3(ps->paint_color_linear, ps->paint_color); + if (ps->use_colormanagement) { + srgb_to_linearrgb_v3_v3(ps->paint_color_linear, ps->paint_color); + } + else { + copy_v3_v3(ps->paint_color_linear, ps->paint_color); + } } else if (ps->tool == PAINT_TOOL_MASK) { ps->stencil_value = brush->weight; @@ -5112,7 +5139,9 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps, int ps->normal_angle_inner__cos = cosf(ps->normal_angle_inner); ps->dither = settings->imapaint.dither; - + + ps->use_colormanagement = BKE_scene_check_color_management_enabled(CTX_data_scene(C)); + return; } -- cgit v1.2.3 From 87c08fa681f5c9f310abf928b7032992ac2a20b4 Mon Sep 17 00:00:00 2001 From: Dmitry Dygalo Date: Tue, 20 Sep 2016 12:38:54 +0200 Subject: Small speedup for blend_render_info.py Do not close and re-open the file in case it's compressed, gzip module can now directly take a file object as parameter. Differential Revision: https://developer.blender.org/D2235 --- release/scripts/modules/blend_render_info.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release/scripts/modules/blend_render_info.py b/release/scripts/modules/blend_render_info.py index 5e4ee0ee4b1..30c3ed2388b 100755 --- a/release/scripts/modules/blend_render_info.py +++ b/release/scripts/modules/blend_render_info.py @@ -42,8 +42,8 @@ def read_blend_rend_chunk(path): if head[0:2] == b'\x1f\x8b': # gzip magic import gzip - blendfile.close() - blendfile = gzip.open(path, "rb") + blendfile.seek(0) + blendfile = gzip.open(blendfile, "rb") head = blendfile.read(7) if head != b'BLENDER': -- cgit v1.2.3 From 386da0cc77cbd16a8b5a196dd1b44e517198dbda Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 20 Sep 2016 13:00:16 +0200 Subject: Cycles: Avoid conversion from bool to uint --- intern/cycles/kernel/bvh/qbvh_volume_all.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intern/cycles/kernel/bvh/qbvh_volume_all.h b/intern/cycles/kernel/bvh/qbvh_volume_all.h index 26da0145020..5d9b2edb4ba 100644 --- a/intern/cycles/kernel/bvh/qbvh_volume_all.h +++ b/intern/cycles/kernel/bvh/qbvh_volume_all.h @@ -69,7 +69,7 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, #ifndef __KERNEL_SSE41__ if(!isfinite(P.x)) { - return false; + return 0; } #endif -- cgit v1.2.3 From f3b94a54bc9dc2c93c350e67f4cf1bb048d32afa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dietrich?= Date: Tue, 20 Sep 2016 14:15:02 +0200 Subject: Alembic: add support to interpolate transform matrices in-between frames. --- source/blender/alembic/intern/abc_mesh.cc | 40 ++++------------- source/blender/alembic/intern/abc_object.cc | 62 ++++++++++++++++++++++++--- source/blender/alembic/intern/abc_object.h | 2 + source/blender/alembic/intern/abc_util.cc | 45 +++++++++++++++---- source/blender/alembic/intern/abc_util.h | 11 +++-- source/blender/alembic/intern/alembic_capi.cc | 5 +-- 6 files changed, 113 insertions(+), 52 deletions(-) diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc index 18b5dd9d1e0..5a6058771c2 100644 --- a/source/blender/alembic/intern/abc_mesh.cc +++ b/source/blender/alembic/intern/abc_mesh.cc @@ -1104,44 +1104,20 @@ void AbcMeshReader::readFaceSetsSample(Main *bmain, Mesh *mesh, size_t poly_star utils::assign_materials(bmain, m_object, mat_map); } -typedef std::pair index_time_pair_t; - static void get_weight_and_index(CDStreamConfig &config, Alembic::AbcCoreAbstract::TimeSamplingPtr time_sampling, size_t samples_number) { - if (samples_number == 0) { - samples_number = 1; - } - - index_time_pair_t floor_index = time_sampling->getFloorIndex(config.time, samples_number); - - config.index = floor_index.first; - config.ceil_index = config.index; - - if (fabs(config.time - floor_index.second) < 0.0001f) { - config.weight = 0.0f; - return; - } + Alembic::AbcGeom::index_t i0, i1; - index_time_pair_t ceil_index = time_sampling->getCeilIndex(config.time, samples_number); - - if (config.index == ceil_index.first) { - config.weight = 0.0f; - return; - } - - config.ceil_index = ceil_index.first; - - float alpha = (config.time - floor_index.second) / (ceil_index.second - floor_index.second); - - /* Since we so closely match the ceiling, we'll just use it. */ - if (fabs(1.0f - alpha) < 0.0001f) { - config.index = config.ceil_index; - alpha = 0.0f; - } + config.weight = get_weight_and_index(config.time, + time_sampling, + samples_number, + i0, + i1); - config.weight = alpha; + config.index = i0; + config.ceil_index = i1; } void read_mesh_sample(ImportSettings *settings, diff --git a/source/blender/alembic/intern/abc_object.cc b/source/blender/alembic/intern/abc_object.cc index 5b7b85f10ea..32468fdaded 100644 --- a/source/blender/alembic/intern/abc_object.cc +++ b/source/blender/alembic/intern/abc_object.cc @@ -153,6 +153,61 @@ Object *AbcObjectReader::object() const return m_object; } +static Imath::M44d blend_matrices(const Imath::M44d &m0, const Imath::M44d &m1, const float weight) +{ + float mat0[4][4], mat1[4][4], ret[4][4]; + + /* Cannot use Imath::M44d::getValue() since this returns a pointer to + * doubles and interp_m4_m4m4 expects pointers to floats. So need to convert + * the matrices manually. + */ + + for (int i = 0; i < 4; ++i) { + for (int j = 0; j < 4; ++j) { + mat0[i][j] = m0[i][j]; + } + } + + for (int i = 0; i < 4; ++i) { + for (int j = 0; j < 4; ++j) { + mat1[i][j] = m1[i][j]; + } + } + + interp_m4_m4m4(ret, mat0, mat1, weight); + + Imath::M44d m; + + for (int i = 0; i < 4; ++i) { + for (int j = 0; j < 4; ++j) { + m[i][j] = ret[i][j]; + } + } + + return m; +} + +Imath::M44d get_matrix(const IXformSchema &schema, const float time) +{ + Alembic::AbcGeom::index_t i0, i1; + Alembic::AbcGeom::XformSample s0, s1; + + const float weight = get_weight_and_index(time, + schema.getTimeSampling(), + schema.getNumSamples(), + i0, + i1); + + schema.get(s0, Alembic::AbcGeom::ISampleSelector(i0)); + + if (i0 != i1) { + schema.get(s1, Alembic::AbcGeom::ISampleSelector(i1)); + return blend_matrices(s0.getMatrix(), s1.getMatrix(), weight); + } + + return s0.getMatrix(); +} + void AbcObjectReader::readObjectMatrix(const float time) { IXform ixform; @@ -194,11 +249,8 @@ void AbcObjectReader::readObjectMatrix(const float time) return; } - Alembic::AbcGeom::ISampleSelector sample_sel(time); - Alembic::AbcGeom::XformSample xs; - schema.get(xs, sample_sel); - - create_input_transform(sample_sel, ixform, m_object, m_object->obmat, m_settings->scale, has_alembic_parent); + const Imath::M44d matrix = get_matrix(schema, time); + convert_matrix(matrix, m_object, m_object->obmat, m_settings->scale, has_alembic_parent); invert_m4_m4(m_object->imat, m_object->obmat); diff --git a/source/blender/alembic/intern/abc_object.h b/source/blender/alembic/intern/abc_object.h index 2e885f296b1..a35faa37565 100644 --- a/source/blender/alembic/intern/abc_object.h +++ b/source/blender/alembic/intern/abc_object.h @@ -166,4 +166,6 @@ public: chrono_t maxTime() const; }; +Imath::M44d get_matrix(const Alembic::AbcGeom::IXformSchema &schema, const float time); + #endif /* __ABC_OBJECT_H__ */ diff --git a/source/blender/alembic/intern/abc_util.cc b/source/blender/alembic/intern/abc_util.cc index fbab0bcdf34..60c66bca1c8 100644 --- a/source/blender/alembic/intern/abc_util.cc +++ b/source/blender/alembic/intern/abc_util.cc @@ -201,16 +201,9 @@ void create_transform_matrix(float r_mat[4][4]) copy_m4_m4(r_mat, transform_mat); } -void create_input_transform(const Alembic::AbcGeom::ISampleSelector &sample_sel, - const Alembic::AbcGeom::IXform &ixform, Object *ob, - float r_mat[4][4], float scale, bool has_alembic_parent) +void convert_matrix(const Imath::M44d &xform, Object *ob, + float r_mat[4][4], float scale, bool has_alembic_parent) { - - const Alembic::AbcGeom::IXformSchema &ixform_schema = ixform.getSchema(); - Alembic::AbcGeom::XformSample xs; - ixform_schema.get(xs, sample_sel); - const Imath::M44d &xform = xs.getMatrix(); - for (int i = 0; i < 4; ++i) { for (int j = 0; j < 4; ++j) { r_mat[i][j] = xform[i][j]; @@ -435,3 +428,37 @@ bool has_property(const Alembic::Abc::ICompoundProperty &prop, const std::string return prop.getPropertyHeader(name) != NULL; } + +typedef std::pair index_time_pair_t; + +float get_weight_and_index(float time, + const Alembic::AbcCoreAbstract::TimeSamplingPtr &time_sampling, + int samples_number, + Alembic::AbcGeom::index_t &i0, + Alembic::AbcGeom::index_t &i1) +{ + samples_number = std::max(samples_number, 1); + + index_time_pair_t t0 = time_sampling->getFloorIndex(time, samples_number); + i0 = i1 = t0.first; + + if (samples_number == 1 || (fabs(time - t0.second) < 0.0001f)) { + return 0.0f; + } + + index_time_pair_t t1 = time_sampling->getCeilIndex(time, samples_number); + i1 = t1.first; + + if (i0 == i1) { + return 0.0f; + } + + const float bias = (time - t0.second) / (t1.second - t0.second); + + if (fabs(1.0f - bias) < 0.0001f) { + i0 = i1; + return 0.0f; + } + + return bias; +} diff --git a/source/blender/alembic/intern/abc_util.h b/source/blender/alembic/intern/abc_util.h index 648570f5f27..9e9f0c397ba 100644 --- a/source/blender/alembic/intern/abc_util.h +++ b/source/blender/alembic/intern/abc_util.h @@ -59,9 +59,8 @@ bool begins_with(const TContainer &input, const TContainer &match) && std::equal(match.begin(), match.end(), input.begin()); } -void create_input_transform(const Alembic::AbcGeom::ISampleSelector &sample_sel, - const Alembic::AbcGeom::IXform &ixform, Object *ob, - float r_mat[4][4], float scale, bool has_alembic_parent = false); +void convert_matrix(const Imath::M44d &xform, Object *ob, + float r_mat[4][4], float scale, bool has_alembic_parent = false); template void get_min_max_time_ex(const Schema &schema, chrono_t &min, chrono_t &max) @@ -95,6 +94,12 @@ void get_min_max_time(const Alembic::AbcGeom::IObject &object, const Schema &sch bool has_property(const Alembic::Abc::ICompoundProperty &prop, const std::string &name); +float get_weight_and_index(float time, + const Alembic::AbcCoreAbstract::TimeSamplingPtr &time_sampling, + int samples_number, + Alembic::AbcGeom::index_t &i0, + Alembic::AbcGeom::index_t &i1); + /* ************************** */ /* TODO(kevin): for now keeping these transformations hardcoded to make sure diff --git a/source/blender/alembic/intern/alembic_capi.cc b/source/blender/alembic/intern/alembic_capi.cc index 3cc549350ea..c6988351db8 100644 --- a/source/blender/alembic/intern/alembic_capi.cc +++ b/source/blender/alembic/intern/alembic_capi.cc @@ -799,9 +799,8 @@ void ABC_get_transform(AbcArchiveHandle *handle, Object *ob, const char *object_ return; } - ISampleSelector sample_sel(time); - - create_input_transform(sample_sel, ixform, ob, r_mat, scale); + const Imath::M44d matrix = get_matrix(schema, time); + convert_matrix(matrix, ob, r_mat, scale); } /* ***************************************** */ -- cgit v1.2.3 From a6db95cd4215dfe20038617ddb81f9ec300ec06b Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 20 Sep 2016 13:21:47 +0200 Subject: Cycles: Re-group ifdef so we check for particular feature only once --- intern/cycles/kernel/bvh/bvh.h | 108 ++++++++++++++++++++--------------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/intern/cycles/kernel/bvh/bvh.h b/intern/cycles/kernel/bvh/bvh.h index 512b049978a..85bfd931e6e 100644 --- a/intern/cycles/kernel/bvh/bvh.h +++ b/intern/cycles/kernel/bvh/bvh.h @@ -73,13 +73,13 @@ CCL_NAMESPACE_BEGIN # define BVH_FUNCTION_NAME bvh_intersect_subsurface # define BVH_FUNCTION_FEATURES BVH_HAIR # include "bvh_subsurface.h" -#endif -#if defined(__SUBSURFACE__) && defined(__OBJECT_MOTION__) -# define BVH_FUNCTION_NAME bvh_intersect_subsurface_motion -# define BVH_FUNCTION_FEATURES BVH_MOTION|BVH_HAIR -# include "bvh_subsurface.h" -#endif +# if defined(__OBJECT_MOTION__) +# define BVH_FUNCTION_NAME bvh_intersect_subsurface_motion +# define BVH_FUNCTION_FEATURES BVH_MOTION|BVH_HAIR +# include "bvh_subsurface.h" +# endif +#endif /* __SUBSURFACE__ */ /* Volume BVH traversal */ @@ -87,19 +87,19 @@ CCL_NAMESPACE_BEGIN # define BVH_FUNCTION_NAME bvh_intersect_volume # define BVH_FUNCTION_FEATURES BVH_HAIR # include "bvh_volume.h" -#endif - -#if defined(__VOLUME__) && defined(__INSTANCING__) -# define BVH_FUNCTION_NAME bvh_intersect_volume_instancing -# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR -# include "bvh_volume.h" -#endif -#if defined(__VOLUME__) && defined(__OBJECT_MOTION__) -# define BVH_FUNCTION_NAME bvh_intersect_volume_motion -# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_MOTION|BVH_HAIR -# include "bvh_volume.h" -#endif +# if defined(__INSTANCING__) +# define BVH_FUNCTION_NAME bvh_intersect_volume_instancing +# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR +# include "bvh_volume.h" +# endif + +# if defined(__OBJECT_MOTION__) +# define BVH_FUNCTION_NAME bvh_intersect_volume_motion +# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_MOTION|BVH_HAIR +# include "bvh_volume.h" +# endif +#endif /* __VOLUME__ */ /* Record all intersections - Shadow BVH traversal */ @@ -107,31 +107,31 @@ CCL_NAMESPACE_BEGIN # define BVH_FUNCTION_NAME bvh_intersect_shadow_all # define BVH_FUNCTION_FEATURES 0 # include "bvh_shadow_all.h" -#endif - -#if defined(__SHADOW_RECORD_ALL__) && defined(__INSTANCING__) -# define BVH_FUNCTION_NAME bvh_intersect_shadow_all_instancing -# define BVH_FUNCTION_FEATURES BVH_INSTANCING -# include "bvh_shadow_all.h" -#endif - -#if defined(__SHADOW_RECORD_ALL__) && defined(__HAIR__) -# define BVH_FUNCTION_NAME bvh_intersect_shadow_all_hair -# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR -# include "bvh_shadow_all.h" -#endif - -#if defined(__SHADOW_RECORD_ALL__) && defined(__OBJECT_MOTION__) -# define BVH_FUNCTION_NAME bvh_intersect_shadow_all_motion -# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_MOTION -# include "bvh_shadow_all.h" -#endif -#if defined(__SHADOW_RECORD_ALL__) && defined(__HAIR__) && defined(__OBJECT_MOTION__) -# define BVH_FUNCTION_NAME bvh_intersect_shadow_all_hair_motion -# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR|BVH_MOTION -# include "bvh_shadow_all.h" -#endif +# if defined(__INSTANCING__) +# define BVH_FUNCTION_NAME bvh_intersect_shadow_all_instancing +# define BVH_FUNCTION_FEATURES BVH_INSTANCING +# include "bvh_shadow_all.h" +# endif + +# if defined(__HAIR__) +# define BVH_FUNCTION_NAME bvh_intersect_shadow_all_hair +# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR +# include "bvh_shadow_all.h" +# endif + +# if defined(__OBJECT_MOTION__) +# define BVH_FUNCTION_NAME bvh_intersect_shadow_all_motion +# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_MOTION +# include "bvh_shadow_all.h" +# endif + +# if defined(__HAIR__) && defined(__OBJECT_MOTION__) +# define BVH_FUNCTION_NAME bvh_intersect_shadow_all_hair_motion +# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR|BVH_MOTION +# include "bvh_shadow_all.h" +# endif +#endif /* __SHADOW_RECORD_ALL__ */ /* Record all intersections - Volume BVH traversal */ @@ -139,19 +139,19 @@ CCL_NAMESPACE_BEGIN # define BVH_FUNCTION_NAME bvh_intersect_volume_all # define BVH_FUNCTION_FEATURES BVH_HAIR # include "bvh_volume_all.h" -#endif - -#if defined(__VOLUME_RECORD_ALL__) && defined(__INSTANCING__) -# define BVH_FUNCTION_NAME bvh_intersect_volume_all_instancing -# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR -# include "bvh_volume_all.h" -#endif -#if defined(__VOLUME_RECORD_ALL__) && defined(__OBJECT_MOTION__) -# define BVH_FUNCTION_NAME bvh_intersect_volume_all_motion -# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_MOTION|BVH_HAIR -# include "bvh_volume_all.h" -#endif +# if defined(__INSTANCING__) +# define BVH_FUNCTION_NAME bvh_intersect_volume_all_instancing +# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR +# include "bvh_volume_all.h" +# endif + +# if defined(__OBJECT_MOTION__) +# define BVH_FUNCTION_NAME bvh_intersect_volume_all_motion +# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_MOTION|BVH_HAIR +# include "bvh_volume_all.h" +# endif +#endif /* __VOLUME_RECORD_ALL__ */ #undef BVH_FEATURE #undef BVH_NAME_JOIN -- cgit v1.2.3 From a5f14ad1a232debf108d1093d6d285c835754b90 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 20 Sep 2016 13:29:07 +0200 Subject: Cycles: Make regular bvh traversal functions close to each other --- intern/cycles/kernel/bvh/bvh_shadow_all.h | 12 ++++++------ intern/cycles/kernel/bvh/bvh_volume_all.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/intern/cycles/kernel/bvh/bvh_shadow_all.h b/intern/cycles/kernel/bvh/bvh_shadow_all.h index f3dc5cf195f..294362ea995 100644 --- a/intern/cycles/kernel/bvh/bvh_shadow_all.h +++ b/intern/cycles/kernel/bvh/bvh_shadow_all.h @@ -108,7 +108,7 @@ bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, do { /* traverse internal nodes */ while(node_addr >= 0 && node_addr != ENTRYPOINT_SENTINEL) { - int node_addr_ahild1, traverse_mask; + int node_addr_child1, traverse_mask; float dist[2]; float4 cnodes = kernel_tex_fetch(__bvh_nodes, node_addr+0); @@ -141,25 +141,25 @@ bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, #endif // __KERNEL_SSE2__ node_addr = __float_as_int(cnodes.z); - node_addr_ahild1 = __float_as_int(cnodes.w); + node_addr_child1 = __float_as_int(cnodes.w); if(traverse_mask == 3) { /* Both children were intersected, push the farther one. */ bool is_closest_child1 = (dist[1] < dist[0]); if(is_closest_child1) { int tmp = node_addr; - node_addr = node_addr_ahild1; - node_addr_ahild1 = tmp; + node_addr = node_addr_child1; + node_addr_child1 = tmp; } ++stack_ptr; kernel_assert(stack_ptr < BVH_STACK_SIZE); - traversal_stack[stack_ptr] = node_addr_ahild1; + traversal_stack[stack_ptr] = node_addr_child1; } else { /* One child was intersected. */ if(traverse_mask == 2) { - node_addr = node_addr_ahild1; + node_addr = node_addr_child1; } else if(traverse_mask == 0) { /* Neither child was intersected. */ diff --git a/intern/cycles/kernel/bvh/bvh_volume_all.h b/intern/cycles/kernel/bvh/bvh_volume_all.h index 67b25625cc4..529848ebe7b 100644 --- a/intern/cycles/kernel/bvh/bvh_volume_all.h +++ b/intern/cycles/kernel/bvh/bvh_volume_all.h @@ -99,7 +99,7 @@ uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, ssef tsplat(0.0f, 0.0f, -isect_t, -isect_t); gen_idirsplat_swap(pn, shuf_identity, shuf_swap, idir, idirsplat, shufflexyz); -#endif +#endif /* __KERNEL_SSE2__ */ IsectPrecalc isect_precalc; triangle_intersect_precalc(dir, &isect_precalc); @@ -378,7 +378,7 @@ uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, node_addr = traversal_stack[stack_ptr]; --stack_ptr; } -#endif /* FEATURE(BVH_MOTION) */ +#endif /* FEATURE(BVH_INSTANCING) */ } while(node_addr != ENTRYPOINT_SENTINEL); return num_hits; -- cgit v1.2.3 From 2382d1c401d1c271fa47122a36b77f9b6f06a32f Mon Sep 17 00:00:00 2001 From: Gaia Clary Date: Tue, 20 Sep 2016 17:32:44 +0200 Subject: regression fix for 1346482d23f167fa57049128384246397fda8d27: The length of leaf bones should always be set to the length of the smallest bone. since the mentioned commit the importer did only recalculate the leaf bone length when the 'fix leaf bones' option was also enabled. --- source/blender/collada/ArmatureImporter.cpp | 19 ++++++------------- source/blender/collada/ArmatureImporter.h | 2 +- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index 1bc2bff74e3..d97fb55af9c 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -221,7 +221,7 @@ int ArmatureImporter::create_bone(SkinInfo *skin, COLLADAFW::Node *node, EditBon * tail locations for the affected bones (nodes which don't have any connected child) * Hint: The extended_bones set gets populated in ArmatureImporter::create_bone **/ -void ArmatureImporter::fix_leaf_bones(bArmature *armature, Bone *bone) +void ArmatureImporter::fix_leaf_bones(bArmature *armature, Bone *bone, bool fix_orientation) { if (bone == NULL) return; @@ -237,7 +237,7 @@ void ArmatureImporter::fix_leaf_bones(bArmature *armature, Bone *bone) EditBone *ebone = bc_get_edit_bone(armature, bone->name); float vec[3]; - if (ebone->parent != NULL) { + if (ebone->parent != NULL && fix_orientation) { EditBone *parent = ebone->parent; sub_v3_v3v3(vec, ebone->head, parent->head); if (len_squared_v3(vec) < MINIMUM_BONE_LENGTH) @@ -257,7 +257,7 @@ void ArmatureImporter::fix_leaf_bones(bArmature *armature, Bone *bone) } for (Bone *child = (Bone *)bone->childbase.first; child; child = child->next) { - fix_leaf_bones(armature, child); + fix_leaf_bones(armature, child, fix_orientation); } } @@ -756,17 +756,10 @@ void ArmatureImporter::make_armatures(bContext *C, std::vector &object /* and step back to edit mode to fix the leaf nodes */ ED_armature_to_edit(armature); - if (this->import_settings->fix_orientation || this->import_settings->find_chains) { + if (this->import_settings->find_chains) + connect_bone_chains(armature, (Bone *)armature->bonebase.first, UNLIMITED_CHAIN_MAX); - if (this->import_settings->find_chains) - connect_bone_chains(armature, (Bone *)armature->bonebase.first, UNLIMITED_CHAIN_MAX); - - if (this->import_settings->fix_orientation) - fix_leaf_bones(armature, (Bone *)armature->bonebase.first); - - // exit armature edit mode - - } + fix_leaf_bones(armature, (Bone *)armature->bonebase.first, this->import_settings->fix_orientation); fix_parent_connect(armature, (Bone *)armature->bonebase.first); diff --git a/source/blender/collada/ArmatureImporter.h b/source/blender/collada/ArmatureImporter.h index e006ccbc94a..524c524c9c9 100644 --- a/source/blender/collada/ArmatureImporter.h +++ b/source/blender/collada/ArmatureImporter.h @@ -111,7 +111,7 @@ private: BoneExtended &add_bone_extended(EditBone *bone, COLLADAFW::Node * node, int sibcount, std::vector &layer_labels); void clear_extended_boneset(); - void fix_leaf_bones(bArmature *armature, Bone *bone); + void fix_leaf_bones(bArmature *armature, Bone *bone, bool fix_orientation); void fix_parent_connect(bArmature *armature, Bone *bone); void connect_bone_chains(bArmature *armature, Bone *bone, const int max_chain_length); -- cgit v1.2.3 From c5326958a5f3d5ed07b0a69822bb049ca21f5aac Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Wed, 21 Sep 2016 00:29:28 +0200 Subject: UI: Fix crash using drag-toggle over window bounds with button callback Steps to reproduce: * Go to modifier context in properties editor * Add modifier, collapse it * Press down LMB over collapse button of modifier, hold it * Drag over pin-icon in properties editor (to keep fixed data-block displayed) * Drag outside of window bounds (should crash) Also could've solved by getting space data from callback arguments instead of context, but this fix is much nicer (though not totally un-risky). --- source/blender/editors/interface/interface_handlers.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 933beaf6afb..3d3e9f96332 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1266,6 +1266,10 @@ static bool ui_drag_toggle_set_xy_xy( } } } + if (changed) { + /* apply now, not on release (or if handlers are cancelled for whatever reason) */ + ui_apply_but_funcs_after(C); + } return changed; } -- cgit v1.2.3 From 0b9cfbf6a8d1102aa00d926d649f5866fcb4c91f Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Wed, 21 Sep 2016 15:06:39 +1200 Subject: GPencil D+W Pie: Don't show editing operators when not in editmode These operators only operate on the selected strokes, but when not in editmode, stroke vertices are not shown. Safe for 2.78 --- .../bl_ui/properties_grease_pencil_common.py | 55 ++++++++++++---------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py index 04931b70ff1..84442f9b2d9 100644 --- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py +++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py @@ -483,11 +483,13 @@ class GPENCIL_PIE_settings_palette(Menu): layout = self.layout pie = layout.menu_pie() - # gpd = context.gpencil_data + gpd = context.gpencil_data gpl = context.active_gpencil_layer palcolor = context.active_gpencil_palettecolor brush = context.active_gpencil_brush + is_editmode = bool(gpd and gpd.use_stroke_edit_mode and context.editable_gpencil_strokes) + # W - Stroke draw settings col = pie.column(align=True) if palcolor is not None: @@ -522,32 +524,33 @@ class GPENCIL_PIE_settings_palette(Menu): row.prop(gpl, "hide") col.prop(gpl, "use_onion_skinning") - # NW - Move stroke Down - col = pie.column(align=True) - col.label("Arrange Strokes") - col.operator("gpencil.stroke_arrange", text="Send to Back").direction = 'BOTTOM' - col.operator("gpencil.stroke_arrange", text="Send Backward").direction = 'DOWN' - - # NE - Move stroke Up - col = pie.column(align=True) - col.label("Arrange Strokes") - col.operator("gpencil.stroke_arrange", text="Bring to Front").direction = 'TOP' - col.operator("gpencil.stroke_arrange", text="Bring Forward").direction = 'UP' - - # SW - Move stroke to color - col = pie.column(align=True) - col.operator("gpencil.stroke_change_color", text="Move to Color") + # NW/NE/SW/SE - These operators are only available in editmode + # as they require strokes to be selected to work + if is_editmode: + # NW - Move stroke Down + col = pie.column(align=True) + col.label("Arrange Strokes") + col.operator("gpencil.stroke_arrange", text="Send to Back").direction = 'BOTTOM' + col.operator("gpencil.stroke_arrange", text="Send Backward").direction = 'DOWN' + + # NE - Move stroke Up + col = pie.column(align=True) + col.label("Arrange Strokes") + col.operator("gpencil.stroke_arrange", text="Bring to Front").direction = 'TOP' + col.operator("gpencil.stroke_arrange", text="Bring Forward").direction = 'UP' + + # SW - Move stroke to color + col = pie.column(align=True) + col.operator("gpencil.stroke_change_color", text="Move to Color") + + # SE - Join strokes + col = pie.column(align=True) + col.label("Join Strokes") + row = col.row() + row.operator("gpencil.stroke_join", text="Join").type = 'JOIN' + row.operator("gpencil.stroke_join", text="Join & Copy").type = 'JOINCOPY' + col.operator("gpencil.stroke_flip", text="Flip direction") - # SE - Join strokes - col = pie.column(align=True) - col.label("Join Strokes") - row = col.row() - row.operator("gpencil.stroke_join", text="Join").type = 'JOIN' - row.operator("gpencil.stroke_join", text="Join & Copy").type = 'JOINCOPY' - col.operator("gpencil.stroke_flip", text="Flip direction") - - gpd = context.gpencil_data - if gpd: col.prop(gpd, "show_stroke_direction", text="Show drawing direction") -- cgit v1.2.3 From 586c58902d9b1b1edc417728aa3e357c1e66d3a8 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Wed, 21 Sep 2016 17:02:17 +1200 Subject: Fix: Grease Pencil sculpting crashes when sculpting on layers without any strokes Reported by @loochmunz. I've also gone through checking for and fixing other places where this was also occurring. To be included in 2.78 --- source/blender/editors/gpencil/gpencil_brush.c | 10 ++++++---- source/blender/editors/gpencil/gpencil_edit.c | 6 ++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c index fcb2ce02bde..8576cbca239 100644 --- a/source/blender/editors/gpencil/gpencil_brush.c +++ b/source/blender/editors/gpencil/gpencil_brush.c @@ -1350,6 +1350,10 @@ static bool gpsculpt_brush_apply_standard(bContext *C, tGP_BrushEditData *gso) CTX_DATA_BEGIN(C, bGPDlayer *, gpl, editable_gpencil_layers) { + bGPDframe *gpf = gpl->actframe; + if (gpf == NULL) + continue; + /* calculate difference matrix if parent object */ if (gpl->parent != NULL) { ED_gpencil_parent_location(gpl, diff_mat); @@ -1358,10 +1362,8 @@ static bool gpsculpt_brush_apply_standard(bContext *C, tGP_BrushEditData *gso) else { parented = false; } - - bGPDframe *gpf = gpl->actframe; - bGPDstroke *gps; - for (gps = gpf->strokes.first; gps; gps = gps->next) { + + for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) { /* skip strokes that are invalid for current view */ if (ED_gpencil_stroke_can_use(C, gps) == false) continue; diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 7175ec3e83d..12d837dfb29 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -1504,6 +1504,9 @@ static int gp_stroke_cyclical_set_exec(bContext *C, wmOperator *op) /* loop all selected strokes */ CTX_DATA_BEGIN(C, bGPDlayer *, gpl, editable_gpencil_layers) { + if (gpl->actframe == NULL) + continue; + for (bGPDstroke *gps = gpl->actframe->strokes.last; gps; gps = gps->prev) { bGPDpalettecolor *palcolor = gps->palcolor; @@ -1724,6 +1727,9 @@ static int gp_stroke_join_exec(bContext *C, wmOperator *op) CTX_DATA_BEGIN(C, bGPDlayer *, gpl, editable_gpencil_layers) { bGPDframe *gpf = gpl->actframe; + if (gpf == NULL) + continue; + for (gps = gpf->strokes.first; gps; gps = gpsn) { gpsn = gps->next; if (gps->flag & GP_STROKE_SELECT) { -- cgit v1.2.3 From e4f7bf6ccb61c6dc9e83beba1b8b5414fdba0e04 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 21 Sep 2016 11:48:36 +0200 Subject: Cycles: Remove out of date comment --- intern/cycles/kernel/kernel_shadow.h | 1 - 1 file changed, 1 deletion(-) diff --git a/intern/cycles/kernel/kernel_shadow.h b/intern/cycles/kernel/kernel_shadow.h index db2fc84834a..3de3aff5601 100644 --- a/intern/cycles/kernel/kernel_shadow.h +++ b/intern/cycles/kernel/kernel_shadow.h @@ -125,7 +125,6 @@ ccl_device_inline bool shadow_blocked(KernelGlobals *kg, ShaderData *shadow_sd, /* stop if all light is blocked */ if(is_zero(throughput)) { - /* free dynamic storage */ return true; } -- cgit v1.2.3 From 166286e6de36afa318b7fd80266dc88a47726308 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 21 Sep 2016 11:50:11 +0200 Subject: Cycles: Make code more uniform across two versions of shadow_blocked() Just to make it easier to research ways of possible code de-duplication. --- intern/cycles/kernel/kernel_shadow.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/intern/cycles/kernel/kernel_shadow.h b/intern/cycles/kernel/kernel_shadow.h index 3de3aff5601..95b57404a77 100644 --- a/intern/cycles/kernel/kernel_shadow.h +++ b/intern/cycles/kernel/kernel_shadow.h @@ -130,8 +130,9 @@ ccl_device_inline bool shadow_blocked(KernelGlobals *kg, ShaderData *shadow_sd, /* move ray forward */ ray->P = shadow_sd->P; - if(ray->t != FLT_MAX) + if(ray->t != FLT_MAX) { ray->D = normalize_len(Pend - ray->P, &ray->t); + } #ifdef __VOLUME__ /* exit/enter volume */ @@ -233,8 +234,9 @@ ccl_device_noinline bool shadow_blocked(KernelGlobals *kg, return false; } - if(!shader_transparent_shadow(kg, isect)) + if(!shader_transparent_shadow(kg, isect)) { return true; + } #ifdef __VOLUME__ /* attenuation between last surface and next surface */ @@ -257,13 +259,16 @@ ccl_device_noinline bool shadow_blocked(KernelGlobals *kg, throughput *= shader_bsdf_transparency(kg, shadow_sd); } - if(is_zero(throughput)) + /* stop if all light is blocked */ + if(is_zero(throughput)) { return true; + } /* move ray forward */ ray->P = ray_offset(ccl_fetch(shadow_sd, P), -ccl_fetch(shadow_sd, Ng)); - if(ray->t != FLT_MAX) + if(ray->t != FLT_MAX) { ray->D = normalize_len(Pend - ray->P, &ray->t); + } #ifdef __VOLUME__ /* exit/enter volume */ -- cgit v1.2.3 From 8ced4417f97ecdafefe8a64104a131cc924633f3 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Tue, 20 Sep 2016 23:26:59 +0000 Subject: Fix T49393: Baking ignores backfaces For some reason (which I can't recall), backing was doing backface culling. Since Cycles itself doesn't ignore them (nor does Blender Internal), they should be visible. --- source/blender/render/intern/source/bake_api.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/source/blender/render/intern/source/bake_api.c b/source/blender/render/intern/source/bake_api.c index 1a0ef4e64d4..73424a4e846 100644 --- a/source/blender/render/intern/source/bake_api.c +++ b/source/blender/render/intern/source/bake_api.c @@ -298,20 +298,16 @@ static bool cast_ray_highpoly( } if (hits[i].index != -1) { - /* cull backface */ - const float dot = dot_v3v3(dir_high, hits[i].no); - if (dot < 0.0f) { - float distance; - float hit_world[3]; - - /* distance comparison in world space */ - mul_v3_m4v3(hit_world, highpoly[i].obmat, hits[i].co); - distance = len_squared_v3v3(hit_world, co); - - if (distance < hit_distance) { - hit_mesh = i; - hit_distance = distance; - } + float distance; + float hit_world[3]; + + /* distance comparison in world space */ + mul_v3_m4v3(hit_world, highpoly[i].obmat, hits[i].co); + distance = len_squared_v3v3(hit_world, co); + + if (distance < hit_distance) { + hit_mesh = i; + hit_distance = distance; } } } -- cgit v1.2.3 From 622c9ced6ca33ce2944b6795e6175a3f8c9e9365 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 21 Sep 2016 14:41:33 +0200 Subject: Cycles: Cleanup, whitespace --- intern/cycles/kernel/kernel_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index 548bc1c1ccc..734b4462a91 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -829,7 +829,7 @@ typedef ccl_addr_space struct ShaderData { ccl_soa_member(differential3, ray_dP); #ifdef __OSL__ - struct KernelGlobals * osl_globals; + struct KernelGlobals *osl_globals; struct PathState *osl_path_state; #endif } ShaderData; -- cgit v1.2.3 From d10f54ee753d3211f7b9b3c925545cd7525d571f Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Wed, 21 Sep 2016 14:35:02 +0200 Subject: UI: Support UI operators with configurable shortcuts After all a super simple solution that allows us to get rid of hardcoded keymap items. --- source/blender/editors/interface/interface_ops.c | 2 -- source/blender/editors/screen/area.c | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index cb539bb1c5d..43b48dbb953 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -1185,8 +1185,6 @@ void ED_operatortypes_ui(void) /** * \brief User Interface Keymap - * - * For now only modal maps here, since UI uses special ui-handlers instead of operators. */ void ED_keymap_ui(wmKeyConfig *keyconf) { diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 8d058ed2081..e6bb604d387 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1367,9 +1367,12 @@ static void region_subwindow(wmWindow *win, ARegion *ar, bool activate) static void ed_default_handlers(wmWindowManager *wm, ScrArea *sa, ListBase *handlers, int flag) { /* note, add-handler checks if it already exists */ - + /* XXX it would be good to have boundbox checks for some of these... */ if (flag & ED_KEYMAP_UI) { + wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "User Interface", 0, 0); + WM_event_add_keymap_handler(handlers, keymap); + /* user interface widgets */ UI_region_handlers_add(handlers); } -- cgit v1.2.3 From bb6af17799d9a7807e48d880fd49af52896d3502 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Wed, 21 Sep 2016 14:43:11 +0200 Subject: Make space context cycling a proper screen-level OP This is really more of a screen level operation, UI-level is more like button handling etc. --- source/blender/editors/include/UI_interface.h | 6 -- source/blender/editors/interface/interface_ops.c | 74 --------------------- source/blender/editors/screen/screen_ops.c | 85 +++++++++++++++++++++++- 3 files changed, 82 insertions(+), 83 deletions(-) diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index ad4066fb31c..a7dfa4b77b4 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -1021,12 +1021,6 @@ void ED_keymap_ui(struct wmKeyConfig *keyconf); void UI_drop_color_copy(struct wmDrag *drag, struct wmDropBox *drop); int UI_drop_color_poll(struct bContext *C, struct wmDrag *drag, const struct wmEvent *event); -/* UI_OT_space_context_cycle direction */ -enum { - SPACE_CONTEXT_CYCLE_PREV, - SPACE_CONTEXT_CYCLE_NEXT, -}; - bool UI_context_copy_to_selected_list( struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, struct ListBase *r_lb, bool *r_use_path_from_id, char **r_path); diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 43b48dbb953..fe4104697b0 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -1082,79 +1082,6 @@ static void UI_OT_drop_color(wmOperatorType *ot) RNA_def_boolean(ot->srna, "gamma", 0, "Gamma Corrected", "The source color is gamma corrected "); } -/* ------------------------------------------------------------------------- */ - -static EnumPropertyItem space_context_cycle_direction[] = { - {SPACE_CONTEXT_CYCLE_PREV, "PREV", 0, "Previous", ""}, - {SPACE_CONTEXT_CYCLE_NEXT, "NEXT", 0, "Next", ""}, - {0, NULL, 0, NULL, NULL} -}; - -static int space_context_cycle_poll(bContext *C) -{ - ScrArea *sa = CTX_wm_area(C); - return ELEM(sa->spacetype, SPACE_BUTS, SPACE_USERPREF); -} - -/** - * Helper to get the correct RNA pointer/property pair for changing - * the display context of active space type in \sa. - */ -static void context_cycle_prop_get( - bScreen *screen, const ScrArea *sa, - PointerRNA *r_ptr, PropertyRNA **r_prop) -{ - const char *propname; - - switch (sa->spacetype) { - case SPACE_BUTS: - RNA_pointer_create(&screen->id, &RNA_SpaceProperties, sa->spacedata.first, r_ptr); - propname = "context"; - break; - case SPACE_USERPREF: - RNA_pointer_create(NULL, &RNA_UserPreferences, &U, r_ptr); - propname = "active_section"; - break; - } - - *r_prop = RNA_struct_find_property(r_ptr, propname); -} - -static int space_context_cycle_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) -{ - const int direction = RNA_enum_get(op->ptr, "direction"); - - PointerRNA ptr; - PropertyRNA *prop; - context_cycle_prop_get(CTX_wm_screen(C), CTX_wm_area(C), &ptr, &prop); - - const int old_context = RNA_property_enum_get(&ptr, prop); - const int new_context = RNA_property_enum_step( - C, &ptr, prop, old_context, - direction == SPACE_CONTEXT_CYCLE_PREV ? -1 : 1); - RNA_property_enum_set(&ptr, prop, new_context); - RNA_property_update(C, &ptr, prop); - - return OPERATOR_FINISHED; -} - -static void UI_OT_space_context_cycle(wmOperatorType *ot) -{ - /* identifiers */ - ot->name = "Cycle Space Context"; - ot->description = "Cycle through the editor context by activating the next/previous one"; - ot->idname = "UI_OT_space_context_cycle"; - - /* api callbacks */ - ot->invoke = space_context_cycle_invoke; - ot->poll = space_context_cycle_poll; - - ot->flag = 0; - - RNA_def_enum(ot->srna, "direction", space_context_cycle_direction, SPACE_CONTEXT_CYCLE_NEXT, "Direction", - "Direction to cycle through"); -} - /* ********************************************************* */ /* Registration */ @@ -1174,7 +1101,6 @@ void ED_operatortypes_ui(void) WM_operatortype_append(UI_OT_edittranslation_init); #endif WM_operatortype_append(UI_OT_reloadtranslation); - WM_operatortype_append(UI_OT_space_context_cycle); /* external */ WM_operatortype_append(UI_OT_eyedropper_color); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index e446194a1da..7612dbc7f10 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -4174,6 +4174,85 @@ static void SCREEN_OT_region_blend(wmOperatorType *ot) /* properties */ } +/* ******************** space context cycling operator ******************** */ + +/* SCREEN_OT_space_context_cycle direction */ +enum { + SPACE_CONTEXT_CYCLE_PREV, + SPACE_CONTEXT_CYCLE_NEXT, +}; + +static EnumPropertyItem space_context_cycle_direction[] = { + {SPACE_CONTEXT_CYCLE_PREV, "PREV", 0, "Previous", ""}, + {SPACE_CONTEXT_CYCLE_NEXT, "NEXT", 0, "Next", ""}, + {0, NULL, 0, NULL, NULL} +}; + +static int space_context_cycle_poll(bContext *C) +{ + ScrArea *sa = CTX_wm_area(C); + return ELEM(sa->spacetype, SPACE_BUTS, SPACE_USERPREF); +} + +/** + * Helper to get the correct RNA pointer/property pair for changing + * the display context of active space type in \sa. + */ +static void context_cycle_prop_get( + bScreen *screen, const ScrArea *sa, + PointerRNA *r_ptr, PropertyRNA **r_prop) +{ + const char *propname; + + switch (sa->spacetype) { + case SPACE_BUTS: + RNA_pointer_create(&screen->id, &RNA_SpaceProperties, sa->spacedata.first, r_ptr); + propname = "context"; + break; + case SPACE_USERPREF: + RNA_pointer_create(NULL, &RNA_UserPreferences, &U, r_ptr); + propname = "active_section"; + break; + } + + *r_prop = RNA_struct_find_property(r_ptr, propname); +} + +static int space_context_cycle_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) +{ + const int direction = RNA_enum_get(op->ptr, "direction"); + + PointerRNA ptr; + PropertyRNA *prop; + context_cycle_prop_get(CTX_wm_screen(C), CTX_wm_area(C), &ptr, &prop); + + const int old_context = RNA_property_enum_get(&ptr, prop); + const int new_context = RNA_property_enum_step( + C, &ptr, prop, old_context, + direction == SPACE_CONTEXT_CYCLE_PREV ? -1 : 1); + RNA_property_enum_set(&ptr, prop, new_context); + RNA_property_update(C, &ptr, prop); + + return OPERATOR_FINISHED; +} + +static void SCREEN_OT_space_context_cycle(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Cycle Space Context"; + ot->description = "Cycle through the editor context by activating the next/previous one"; + ot->idname = "SCREEN_OT_space_context_cycle"; + + /* api callbacks */ + ot->invoke = space_context_cycle_invoke; + ot->poll = space_context_cycle_poll; + + ot->flag = 0; + + RNA_def_enum(ot->srna, "direction", space_context_cycle_direction, SPACE_CONTEXT_CYCLE_NEXT, "Direction", + "Direction to cycle through"); +} + /* **************** Assigning operatortypes to global list, adding handlers **************** */ @@ -4209,6 +4288,7 @@ void ED_operatortypes_screen(void) WM_operatortype_append(SCREEN_OT_screencast); WM_operatortype_append(SCREEN_OT_userpref_show); WM_operatortype_append(SCREEN_OT_region_blend); + WM_operatortype_append(SCREEN_OT_space_context_cycle); /*frame changes*/ WM_operatortype_append(SCREEN_OT_frame_offset); @@ -4332,10 +4412,9 @@ void ED_keymap_screen(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "SCREEN_OT_screenshot", F3KEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "SCREEN_OT_screencast", F3KEY, KM_PRESS, KM_ALT, 0); - /* UI */ - kmi = WM_keymap_add_item(keymap, "UI_OT_space_context_cycle", TABKEY, KM_PRESS, KM_CTRL, 0); + kmi = WM_keymap_add_item(keymap, "SCREEN_OT_space_context_cycle", TABKEY, KM_PRESS, KM_CTRL, 0); RNA_enum_set(kmi->ptr, "direction", SPACE_CONTEXT_CYCLE_NEXT); - kmi = WM_keymap_add_item(keymap, "UI_OT_space_context_cycle", TABKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0); + kmi = WM_keymap_add_item(keymap, "SCREEN_OT_space_context_cycle", TABKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0); RNA_enum_set(kmi->ptr, "direction", SPACE_CONTEXT_CYCLE_PREV); /* tests */ -- cgit v1.2.3 From 2476faebd751fe7a250d7a496a1f56338b83d4e9 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Wed, 21 Sep 2016 14:47:40 +0200 Subject: Fix crash in space context cycling when leaving window bounds --- source/blender/editors/screen/screen_ops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 7612dbc7f10..a6b6ccd5a66 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -4191,7 +4191,8 @@ static EnumPropertyItem space_context_cycle_direction[] = { static int space_context_cycle_poll(bContext *C) { ScrArea *sa = CTX_wm_area(C); - return ELEM(sa->spacetype, SPACE_BUTS, SPACE_USERPREF); + /* sa might be NULL if called out of window bounds */ + return (sa && ELEM(sa->spacetype, SPACE_BUTS, SPACE_USERPREF)); } /** -- cgit v1.2.3 From a7e74791221e2ef9b44ee1b3eb9ece37785aa62a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Wed, 21 Sep 2016 15:01:51 +0200 Subject: FFmpeg interface improvements This patch changes a couple of things in the video output encoding. {F362527} - Clearer separation between container and codec. No more "format", as this is too ambiguous. As a result, codecs were removed from the container list. - Added FFmpeg speed presets, so the user can choosen from the range "Very slow" to "Ultra fast". By default no preset is used. - Added Constant Rate Factor (CRF) mode, which allows changing the bit-rate depending on the desired quality and the input. This generally produces the best quality videos, at the expense of not knowing the exact bit-rate and file size. - Added optional maximum of non-B-frames between B-frames (`max_b_frames`). - Presets were adjusted for these changes, and new presets added. One of the new presets is [recommended](https://trac.ffmpeg.org/wiki/Encode/VFX#H.264) for reviewing videos, as it allows players to scrub through it easily. Might be nice in weeklies. This preset also requires control over the `max_b_frames` setting. GUI-only changes: - Renamed "MPEG" in the output file format menu with "FFmpeg", as this is more accurate. After all, FFmpeg is used when this option is chosen, which can also output non-MPEG files. - Certain parts of the GUI are disabled when not in use: - bit rate options are not used when a constant rate factor is given. - audio bitrate & volume are not used when no audio is exported. Note that I did not touch `BKE_ffmpeg_preset_set()`. There are currently two preset systems for FFmpeg (`BKE_ffmpeg_preset_set()` and the Python preset system). Before we do more work on `BKE_ffmpeg_preset_set()`, I think it's a good idea to determine whether we want to keep it at all. After this patch has been accepted, I'd be happy to go through the code and remove any then-obsolete bits, such as the handling of "XVID" as a container format. Reviewers: sergey, mont29, brecht Subscribers: mpan3, Blendify, brecht, fsiddi Tags: #bf_blender Differential Revision: https://developer.blender.org/D2242 --- release/scripts/presets/ffmpeg/DV.py | 14 ---- ...(note_colon_ this changes render resolution).py | 24 +++++++ release/scripts/presets/ffmpeg/DVD.py | 24 ------- release/scripts/presets/ffmpeg/SVCD.py | 24 ------- release/scripts/presets/ffmpeg/VCD.py | 24 ------- release/scripts/presets/ffmpeg/h264 in MP4.py | 18 +++++ .../ffmpeg/h264 in Matroska for scrubbing.py | 14 ++++ release/scripts/presets/ffmpeg/h264 in Matroska.py | 17 +++++ release/scripts/presets/ffmpeg/h264.py | 17 ----- release/scripts/presets/ffmpeg/ogg_theora.py | 18 +++++ release/scripts/presets/ffmpeg/theora.py | 17 ----- release/scripts/presets/ffmpeg/xvid.py | 4 +- release/scripts/startup/bl_ui/properties_render.py | 40 +++++++---- source/blender/blenkernel/intern/image.c | 2 +- source/blender/blenkernel/intern/writeffmpeg.c | 76 ++++++++++++++------ source/blender/blenloader/intern/versioning_270.c | 14 ++++ source/blender/makesdna/DNA_scene_types.h | 37 ++++++++++ source/blender/makesrna/intern/rna_scene.c | 81 +++++++++++++++++++--- 18 files changed, 297 insertions(+), 168 deletions(-) delete mode 100644 release/scripts/presets/ffmpeg/DV.py create mode 100644 release/scripts/presets/ffmpeg/DVD (note_colon_ this changes render resolution).py delete mode 100644 release/scripts/presets/ffmpeg/DVD.py delete mode 100644 release/scripts/presets/ffmpeg/SVCD.py delete mode 100644 release/scripts/presets/ffmpeg/VCD.py create mode 100644 release/scripts/presets/ffmpeg/h264 in MP4.py create mode 100644 release/scripts/presets/ffmpeg/h264 in Matroska for scrubbing.py create mode 100644 release/scripts/presets/ffmpeg/h264 in Matroska.py delete mode 100644 release/scripts/presets/ffmpeg/h264.py create mode 100644 release/scripts/presets/ffmpeg/ogg_theora.py delete mode 100644 release/scripts/presets/ffmpeg/theora.py diff --git a/release/scripts/presets/ffmpeg/DV.py b/release/scripts/presets/ffmpeg/DV.py deleted file mode 100644 index a95d861111a..00000000000 --- a/release/scripts/presets/ffmpeg/DV.py +++ /dev/null @@ -1,14 +0,0 @@ -import bpy -is_ntsc = (bpy.context.scene.render.fps != 25) - -bpy.context.scene.render.ffmpeg.format = "DV" -bpy.context.scene.render.resolution_x = 720 - -if is_ntsc: - bpy.context.scene.render.resolution_y = 480 -else: - bpy.context.scene.render.resolution_y = 576 - -bpy.context.scene.render.ffmpeg.audio_mixrate = 48000 -bpy.context.scene.render.ffmpeg.audio_codec = "PCM" -bpy.context.scene.render.ffmpeg.audio_channels = "STEREO" diff --git a/release/scripts/presets/ffmpeg/DVD (note_colon_ this changes render resolution).py b/release/scripts/presets/ffmpeg/DVD (note_colon_ this changes render resolution).py new file mode 100644 index 00000000000..d858bd70836 --- /dev/null +++ b/release/scripts/presets/ffmpeg/DVD (note_colon_ this changes render resolution).py @@ -0,0 +1,24 @@ +import bpy +is_ntsc = (bpy.context.scene.render.fps != 25) + +bpy.context.scene.render.ffmpeg.format = "MPEG2" +bpy.context.scene.render.resolution_x = 720 + +if is_ntsc: + bpy.context.scene.render.resolution_y = 480 + bpy.context.scene.render.ffmpeg.gopsize = 18 +else: + bpy.context.scene.render.resolution_y = 576 + bpy.context.scene.render.ffmpeg.gopsize = 15 + +bpy.context.scene.render.ffmpeg.video_bitrate = 6000 +bpy.context.scene.render.ffmpeg.maxrate = 9000 +bpy.context.scene.render.ffmpeg.minrate = 0 +bpy.context.scene.render.ffmpeg.buffersize = 224 * 8 +bpy.context.scene.render.ffmpeg.packetsize = 2048 +bpy.context.scene.render.ffmpeg.muxrate = 10080000 + +bpy.context.scene.render.ffmpeg.audio_codec = "AC3" +bpy.context.scene.render.ffmpeg.audio_bitrate = 448 +bpy.context.scene.render.ffmpeg.audio_mixrate = 48000 +bpy.context.scene.render.ffmpeg.audio_channels = "SURROUND51" diff --git a/release/scripts/presets/ffmpeg/DVD.py b/release/scripts/presets/ffmpeg/DVD.py deleted file mode 100644 index d858bd70836..00000000000 --- a/release/scripts/presets/ffmpeg/DVD.py +++ /dev/null @@ -1,24 +0,0 @@ -import bpy -is_ntsc = (bpy.context.scene.render.fps != 25) - -bpy.context.scene.render.ffmpeg.format = "MPEG2" -bpy.context.scene.render.resolution_x = 720 - -if is_ntsc: - bpy.context.scene.render.resolution_y = 480 - bpy.context.scene.render.ffmpeg.gopsize = 18 -else: - bpy.context.scene.render.resolution_y = 576 - bpy.context.scene.render.ffmpeg.gopsize = 15 - -bpy.context.scene.render.ffmpeg.video_bitrate = 6000 -bpy.context.scene.render.ffmpeg.maxrate = 9000 -bpy.context.scene.render.ffmpeg.minrate = 0 -bpy.context.scene.render.ffmpeg.buffersize = 224 * 8 -bpy.context.scene.render.ffmpeg.packetsize = 2048 -bpy.context.scene.render.ffmpeg.muxrate = 10080000 - -bpy.context.scene.render.ffmpeg.audio_codec = "AC3" -bpy.context.scene.render.ffmpeg.audio_bitrate = 448 -bpy.context.scene.render.ffmpeg.audio_mixrate = 48000 -bpy.context.scene.render.ffmpeg.audio_channels = "SURROUND51" diff --git a/release/scripts/presets/ffmpeg/SVCD.py b/release/scripts/presets/ffmpeg/SVCD.py deleted file mode 100644 index deaf9697045..00000000000 --- a/release/scripts/presets/ffmpeg/SVCD.py +++ /dev/null @@ -1,24 +0,0 @@ -import bpy -is_ntsc = (bpy.context.scene.render.fps != 25) - -bpy.context.scene.render.ffmpeg.format = "MPEG2" -bpy.context.scene.render.resolution_x = 480 - -if is_ntsc: - bpy.context.scene.render.resolution_y = 480 - bpy.context.scene.render.ffmpeg.gopsize = 18 -else: - bpy.context.scene.render.resolution_y = 576 - bpy.context.scene.render.ffmpeg.gopsize = 15 - -bpy.context.scene.render.ffmpeg.video_bitrate = 2040 -bpy.context.scene.render.ffmpeg.maxrate = 2516 -bpy.context.scene.render.ffmpeg.minrate = 0 -bpy.context.scene.render.ffmpeg.buffersize = 224 * 8 -bpy.context.scene.render.ffmpeg.packetsize = 2324 -bpy.context.scene.render.ffmpeg.muxrate = 0 - -bpy.context.scene.render.ffmpeg.audio_bitrate = 224 -bpy.context.scene.render.ffmpeg.audio_mixrate = 44100 -bpy.context.scene.render.ffmpeg.audio_codec = "MP2" -bpy.context.scene.render.ffmpeg.audio_channels = "STEREO" diff --git a/release/scripts/presets/ffmpeg/VCD.py b/release/scripts/presets/ffmpeg/VCD.py deleted file mode 100644 index 3e57be720fb..00000000000 --- a/release/scripts/presets/ffmpeg/VCD.py +++ /dev/null @@ -1,24 +0,0 @@ -import bpy -is_ntsc = (bpy.context.scene.render.fps != 25) - -bpy.context.scene.render.ffmpeg.format = "MPEG1" -bpy.context.scene.render.resolution_x = 352 - -if is_ntsc: - bpy.context.scene.render.resolution_y = 240 - bpy.context.scene.render.ffmpeg.gopsize = 18 -else: - bpy.context.scene.render.resolution_y = 288 - bpy.context.scene.render.ffmpeg.gopsize = 15 - -bpy.context.scene.render.ffmpeg.video_bitrate = 1150 -bpy.context.scene.render.ffmpeg.maxrate = 1150 -bpy.context.scene.render.ffmpeg.minrate = 1150 -bpy.context.scene.render.ffmpeg.buffersize = 40 * 8 -bpy.context.scene.render.ffmpeg.packetsize = 2324 -bpy.context.scene.render.ffmpeg.muxrate = 2352 * 75 * 8 - -bpy.context.scene.render.ffmpeg.audio_bitrate = 224 -bpy.context.scene.render.ffmpeg.audio_mixrate = 44100 -bpy.context.scene.render.ffmpeg.audio_codec = "MP2" -bpy.context.scene.render.ffmpeg.audio_channels = "STEREO" diff --git a/release/scripts/presets/ffmpeg/h264 in MP4.py b/release/scripts/presets/ffmpeg/h264 in MP4.py new file mode 100644 index 00000000000..0e9c32c4878 --- /dev/null +++ b/release/scripts/presets/ffmpeg/h264 in MP4.py @@ -0,0 +1,18 @@ +import bpy +is_ntsc = (bpy.context.scene.render.fps != 25) + +bpy.context.scene.render.ffmpeg.format = "MPEG4" +bpy.context.scene.render.ffmpeg.codec = "H264" + +if is_ntsc: + bpy.context.scene.render.ffmpeg.gopsize = 18 +else: + bpy.context.scene.render.ffmpeg.gopsize = 15 +bpy.context.scene.render.ffmpeg.use_max_b_frames = False + +bpy.context.scene.render.ffmpeg.video_bitrate = 6000 +bpy.context.scene.render.ffmpeg.maxrate = 9000 +bpy.context.scene.render.ffmpeg.minrate = 0 +bpy.context.scene.render.ffmpeg.buffersize = 224 * 8 +bpy.context.scene.render.ffmpeg.packetsize = 2048 +bpy.context.scene.render.ffmpeg.muxrate = 10080000 diff --git a/release/scripts/presets/ffmpeg/h264 in Matroska for scrubbing.py b/release/scripts/presets/ffmpeg/h264 in Matroska for scrubbing.py new file mode 100644 index 00000000000..eb1889d272f --- /dev/null +++ b/release/scripts/presets/ffmpeg/h264 in Matroska for scrubbing.py @@ -0,0 +1,14 @@ +"""Sets up FFmpeg to output files that can easily be scrubbed through. + +Information was taken from https://trac.ffmpeg.org/wiki/Encode/VFX#H.264 +""" + +import bpy + +bpy.context.scene.render.ffmpeg.format = "MKV" +bpy.context.scene.render.ffmpeg.codec = "H264" + +bpy.context.scene.render.ffmpeg.gopsize = 1 +bpy.context.scene.render.ffmpeg.constant_rate_factor = 'PERC_LOSSLESS' +bpy.context.scene.render.ffmpeg.use_max_b_frames = True +bpy.context.scene.render.ffmpeg.max_b_frames = 0 diff --git a/release/scripts/presets/ffmpeg/h264 in Matroska.py b/release/scripts/presets/ffmpeg/h264 in Matroska.py new file mode 100644 index 00000000000..1fe066dc4bf --- /dev/null +++ b/release/scripts/presets/ffmpeg/h264 in Matroska.py @@ -0,0 +1,17 @@ +import bpy +is_ntsc = (bpy.context.scene.render.fps != 25) + +bpy.context.scene.render.ffmpeg.format = "MKV" +bpy.context.scene.render.ffmpeg.codec = "H264" + +if is_ntsc: + bpy.context.scene.render.ffmpeg.gopsize = 18 +else: + bpy.context.scene.render.ffmpeg.gopsize = 15 + +bpy.context.scene.render.ffmpeg.video_bitrate = 6000 +bpy.context.scene.render.ffmpeg.maxrate = 9000 +bpy.context.scene.render.ffmpeg.minrate = 0 +bpy.context.scene.render.ffmpeg.buffersize = 224 * 8 +bpy.context.scene.render.ffmpeg.packetsize = 2048 +bpy.context.scene.render.ffmpeg.muxrate = 10080000 diff --git a/release/scripts/presets/ffmpeg/h264.py b/release/scripts/presets/ffmpeg/h264.py deleted file mode 100644 index e1dbdc1d8b9..00000000000 --- a/release/scripts/presets/ffmpeg/h264.py +++ /dev/null @@ -1,17 +0,0 @@ -import bpy -is_ntsc = (bpy.context.scene.render.fps != 25) - -bpy.context.scene.render.ffmpeg.format = "H264" -bpy.context.scene.render.ffmpeg.codec = "H264" - -if is_ntsc: - bpy.context.scene.render.ffmpeg.gopsize = 18 -else: - bpy.context.scene.render.ffmpeg.gopsize = 15 - -bpy.context.scene.render.ffmpeg.video_bitrate = 6000 -bpy.context.scene.render.ffmpeg.maxrate = 9000 -bpy.context.scene.render.ffmpeg.minrate = 0 -bpy.context.scene.render.ffmpeg.buffersize = 224 * 8 -bpy.context.scene.render.ffmpeg.packetsize = 2048 -bpy.context.scene.render.ffmpeg.muxrate = 10080000 diff --git a/release/scripts/presets/ffmpeg/ogg_theora.py b/release/scripts/presets/ffmpeg/ogg_theora.py new file mode 100644 index 00000000000..b450b67fd98 --- /dev/null +++ b/release/scripts/presets/ffmpeg/ogg_theora.py @@ -0,0 +1,18 @@ +import bpy +is_ntsc = (bpy.context.scene.render.fps != 25) + +bpy.context.scene.render.ffmpeg.format = "OGG" +bpy.context.scene.render.ffmpeg.codec = "THEORA" + +if is_ntsc: + bpy.context.scene.render.ffmpeg.gopsize = 18 +else: + bpy.context.scene.render.ffmpeg.gopsize = 15 +bpy.context.scene.render.ffmpeg.use_max_b_frames = False + +bpy.context.scene.render.ffmpeg.video_bitrate = 6000 +bpy.context.scene.render.ffmpeg.maxrate = 9000 +bpy.context.scene.render.ffmpeg.minrate = 0 +bpy.context.scene.render.ffmpeg.buffersize = 224 * 8 +bpy.context.scene.render.ffmpeg.packetsize = 2048 +bpy.context.scene.render.ffmpeg.muxrate = 10080000 diff --git a/release/scripts/presets/ffmpeg/theora.py b/release/scripts/presets/ffmpeg/theora.py deleted file mode 100644 index 88f1ac9bbae..00000000000 --- a/release/scripts/presets/ffmpeg/theora.py +++ /dev/null @@ -1,17 +0,0 @@ -import bpy -is_ntsc = (bpy.context.scene.render.fps != 25) - -bpy.context.scene.render.ffmpeg.format = "OGG" -bpy.context.scene.render.ffmpeg.codec = "THEORA" - -if is_ntsc: - bpy.context.scene.render.ffmpeg.gopsize = 18 -else: - bpy.context.scene.render.ffmpeg.gopsize = 15 - -bpy.context.scene.render.ffmpeg.video_bitrate = 6000 -bpy.context.scene.render.ffmpeg.maxrate = 9000 -bpy.context.scene.render.ffmpeg.minrate = 0 -bpy.context.scene.render.ffmpeg.buffersize = 224 * 8 -bpy.context.scene.render.ffmpeg.packetsize = 2048 -bpy.context.scene.render.ffmpeg.muxrate = 10080000 diff --git a/release/scripts/presets/ffmpeg/xvid.py b/release/scripts/presets/ffmpeg/xvid.py index e69ab663dc8..dba0f71c279 100644 --- a/release/scripts/presets/ffmpeg/xvid.py +++ b/release/scripts/presets/ffmpeg/xvid.py @@ -1,12 +1,14 @@ import bpy is_ntsc = (bpy.context.scene.render.fps != 25) -bpy.context.scene.render.ffmpeg.format = "XVID" +bpy.context.scene.render.ffmpeg.format = "AVI" +bpy.context.scene.render.ffmpeg.codec = "MPEG4" if is_ntsc: bpy.context.scene.render.ffmpeg.gopsize = 18 else: bpy.context.scene.render.ffmpeg.gopsize = 15 +bpy.context.scene.render.ffmpeg.use_max_b_frames = False bpy.context.scene.render.ffmpeg.video_bitrate = 6000 bpy.context.scene.render.ffmpeg.maxrate = 9000 diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py index 152d4e96d5d..850606eb80b 100644 --- a/release/scripts/startup/bl_ui/properties_render.py +++ b/release/scripts/startup/bl_ui/properties_render.py @@ -461,31 +461,42 @@ class RENDER_PT_encoding(RenderButtonsPanel, Panel): split = layout.split() split.prop(rd.ffmpeg, "format") - if ffmpeg.format in {'AVI', 'QUICKTIME', 'MKV', 'OGG', 'MPEG4'}: - split.prop(ffmpeg, "codec") - if ffmpeg.codec == 'H264': - row = layout.row() - row.label() - row.prop(ffmpeg, "use_lossless_output") - elif rd.ffmpeg.format == 'H264': - split.prop(ffmpeg, "use_lossless_output") - else: - split.label() + split.prop(ffmpeg, "use_autosplit") + + layout.separator() + + needs_codec = ffmpeg.format in {'AVI', 'QUICKTIME', 'MKV', 'OGG', 'MPEG4'} + if needs_codec: + layout.prop(ffmpeg, "codec") + if ffmpeg.codec in {'DNXHD'}: + layout.prop(ffmpeg, "use_lossless_output") + + # Output quality + if needs_codec and ffmpeg.codec in {'H264', 'MPEG4'}: + layout.prop(ffmpeg, "constant_rate_factor") + + # Encoding speed + layout.prop(ffmpeg, "ffmpeg_preset") + # I-frames + layout.prop(ffmpeg, "gopsize") + # B-Frames row = layout.row() - row.prop(ffmpeg, "video_bitrate") - row.prop(ffmpeg, "gopsize") + row.prop(ffmpeg, "use_max_b_frames", text='Max B-frames') + pbox = row.split() + pbox.prop(ffmpeg, "max_b_frames", text='') + pbox.enabled = ffmpeg.use_max_b_frames split = layout.split() - + split.enabled = ffmpeg.constant_rate_factor == 'NONE' col = split.column() col.label(text="Rate:") + col.prop(ffmpeg, "video_bitrate") col.prop(ffmpeg, "minrate", text="Minimum") col.prop(ffmpeg, "maxrate", text="Maximum") col.prop(ffmpeg, "buffersize", text="Buffer") col = split.column() - col.prop(ffmpeg, "use_autosplit") col.label(text="Mux:") col.prop(ffmpeg, "muxrate", text="Rate") col.prop(ffmpeg, "packetsize", text="Packet Size") @@ -497,6 +508,7 @@ class RENDER_PT_encoding(RenderButtonsPanel, Panel): layout.prop(ffmpeg, "audio_codec", text="Audio Codec") row = layout.row() + row.enabled = ffmpeg.audio_codec != 'NONE' row.prop(ffmpeg, "audio_bitrate") row.prop(ffmpeg, "audio_volume", slider=True) diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 8a9cb73c8c9..a4eef2f9230 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1325,7 +1325,7 @@ char BKE_imtype_from_arg(const char *imtype_arg) else if (STREQ(imtype_arg, "EXR")) return R_IMF_IMTYPE_OPENEXR; else if (STREQ(imtype_arg, "MULTILAYER")) return R_IMF_IMTYPE_MULTILAYER; #endif - else if (STREQ(imtype_arg, "MPEG")) return R_IMF_IMTYPE_FFMPEG; + else if (STREQ(imtype_arg, "FFMPEG")) return R_IMF_IMTYPE_FFMPEG; else if (STREQ(imtype_arg, "FRAMESERVER")) return R_IMF_IMTYPE_FRAMESERVER; #ifdef WITH_CINEON else if (STREQ(imtype_arg, "CINEON")) return R_IMF_IMTYPE_CINEON; diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index de55a1977bf..b0ab6f707fa 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -69,10 +69,14 @@ typedef struct FFMpegContext { int ffmpeg_video_bitrate; int ffmpeg_audio_bitrate; int ffmpeg_gop_size; + int ffmpeg_max_b_frames; int ffmpeg_autosplit; int ffmpeg_autosplit_count; bool ffmpeg_preview; + int ffmpeg_crf; /* set to 0 to not use CRF mode; we have another flag for lossless anyway. */ + int ffmpeg_preset; /* see FFMpegPreset */ + AVFormatContext *outfile; AVStream *video_stream; AVStream *audio_stream; @@ -560,10 +564,37 @@ static AVStream *alloc_video_stream(FFMpegContext *context, RenderData *rd, int } c->gop_size = context->ffmpeg_gop_size; - c->bit_rate = context->ffmpeg_video_bitrate * 1000; - c->rc_max_rate = rd->ffcodecdata.rc_max_rate * 1000; - c->rc_min_rate = rd->ffcodecdata.rc_min_rate * 1000; - c->rc_buffer_size = rd->ffcodecdata.rc_buffer_size * 1024; + c->max_b_frames = context->ffmpeg_max_b_frames; + + if (context->ffmpeg_crf >= 0) { + ffmpeg_dict_set_int(&opts, "crf", context->ffmpeg_crf); + } else { + c->bit_rate = context->ffmpeg_video_bitrate * 1000; + c->rc_max_rate = rd->ffcodecdata.rc_max_rate * 1000; + c->rc_min_rate = rd->ffcodecdata.rc_min_rate * 1000; + c->rc_buffer_size = rd->ffcodecdata.rc_buffer_size * 1024; + } + + if (context->ffmpeg_preset) { + char const * preset_name; + switch(context->ffmpeg_preset) { + case FFM_PRESET_ULTRAFAST: preset_name = "ultrafast"; break; + case FFM_PRESET_SUPERFAST: preset_name = "superfast"; break; + case FFM_PRESET_VERYFAST: preset_name = "veryfast"; break; + case FFM_PRESET_FASTER: preset_name = "faster"; break; + case FFM_PRESET_FAST: preset_name = "fast"; break; + case FFM_PRESET_MEDIUM: preset_name = "medium"; break; + case FFM_PRESET_SLOW: preset_name = "slow"; break; + case FFM_PRESET_SLOWER: preset_name = "slower"; break; + case FFM_PRESET_VERYSLOW: preset_name = "veryslow"; break; + default: + printf("Unknown preset number %i, ignoring.\n", context->ffmpeg_preset); + preset_name = NULL; + } + if (preset_name != NULL) { + av_dict_set(&opts, "preset", preset_name, 0); + } + } #if 0 /* this options are not set in ffmpeg.c and leads to artifacts with MPEG-4 @@ -819,6 +850,12 @@ static int start_ffmpeg_impl(FFMpegContext *context, struct RenderData *rd, int context->ffmpeg_audio_bitrate = rd->ffcodecdata.audio_bitrate; context->ffmpeg_gop_size = rd->ffcodecdata.gop_size; context->ffmpeg_autosplit = rd->ffcodecdata.flags & FFMPEG_AUTOSPLIT_OUTPUT; + context->ffmpeg_crf = rd->ffcodecdata.constant_rate_factor; + context->ffmpeg_preset = rd->ffcodecdata.ffmpeg_preset; + + if ((rd->ffcodecdata.flags & FFMPEG_USE_MAX_B_FRAMES) != 0) { + context->ffmpeg_max_b_frames = rd->ffcodecdata.max_b_frames; + } /* Determine the correct filename */ ffmpeg_filepath_get(context, name, rd, context->ffmpeg_preview, suffix); @@ -852,12 +889,16 @@ static int start_ffmpeg_impl(FFMpegContext *context, struct RenderData *rd, int /* Returns after this must 'goto fail;' */ of->oformat = fmt; - of->packet_size = rd->ffcodecdata.mux_packet_size; - if (context->ffmpeg_audio_codec != AV_CODEC_ID_NONE) { - ffmpeg_dict_set_int(&opts, "muxrate", rd->ffcodecdata.mux_rate); - } - else { - av_dict_set(&opts, "muxrate", "0", 0); + + /* Only bother with setting packet size & mux rate when CRF is not used. */ + if (context->ffmpeg_crf == 0) { + of->packet_size = rd->ffcodecdata.mux_packet_size; + if (context->ffmpeg_audio_codec != AV_CODEC_ID_NONE) { + ffmpeg_dict_set_int(&opts, "muxrate", rd->ffcodecdata.mux_rate); + } + else { + av_dict_set(&opts, "muxrate", "0", 0); + } } ffmpeg_dict_set_int(&opts, "preload", (int)(0.5 * AV_TIME_BASE)); @@ -1503,14 +1544,6 @@ static void ffmpeg_set_expert_options(RenderData *rd) BKE_ffmpeg_property_add_string(rd, "video", "fast-pskip:1"); BKE_ffmpeg_property_add_string(rd, "video", "wpredp:2"); #endif - - if (rd->ffcodecdata.flags & FFMPEG_LOSSLESS_OUTPUT) { -#ifdef FFMPEG_HAVE_DEPRECATED_FLAGS2 - BKE_ffmpeg_property_add_string(rd, "video", "cqp:0"); -#else - BKE_ffmpeg_property_add_string(rd, "video", "qp:0"); -#endif - } } else if (codec_id == AV_CODEC_ID_DNXHD) { if (rd->ffcodecdata.flags & FFMPEG_LOSSLESS_OUTPUT) @@ -1622,9 +1655,10 @@ void BKE_ffmpeg_image_type_verify(RenderData *rd, ImageFormatData *imf) rd->ffcodecdata.audio_codec <= 0 || rd->ffcodecdata.video_bitrate <= 1) { - rd->ffcodecdata.codec = AV_CODEC_ID_MPEG2VIDEO; - - BKE_ffmpeg_preset_set(rd, FFMPEG_PRESET_DVD); + BKE_ffmpeg_preset_set(rd, FFMPEG_PRESET_H264); + rd->ffcodecdata.constant_rate_factor = FFM_CRF_MEDIUM; + rd->ffcodecdata.ffmpeg_preset = FFM_PRESET_MEDIUM; + rd->ffcodecdata.type = FFMPEG_MKV; } if (rd->ffcodecdata.type == FFMPEG_OGG) { rd->ffcodecdata.type = FFMPEG_MPEG2; diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index dfaa59c4e3f..aa5ef1c98cf 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -1392,4 +1392,18 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main) } } } + if (!MAIN_VERSION_ATLEAST(main, 279, 0)) { + if (!DNA_struct_elem_find(fd->filesdna, "FFMpegCodecData", "int", "ffmpeg_preset")) { + for (Scene *scene = main->scene.first; scene; scene = scene->id.next) { + /* "medium" is the preset FFmpeg uses when no presets are given. */ + scene->r.ffcodecdata.ffmpeg_preset = FFM_PRESET_MEDIUM; + } + } + if (!DNA_struct_elem_find(fd->filesdna, "FFMpegCodecData", "int", "constant_rate_factor")) { + for (Scene *scene = main->scene.first; scene; scene = scene->id.next) { + /* fall back to behaviour from before we introduced CRF for old files */ + scene->r.ffcodecdata.constant_rate_factor = FFM_CRF_NONE; + } + } + } } diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 5c5264afcba..94f23197293 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -135,6 +135,37 @@ typedef struct QuicktimeCodecSettings { int pad1; } QuicktimeCodecSettings; +typedef enum FFMpegPreset { + FFM_PRESET_NONE, + FFM_PRESET_ULTRAFAST, + FFM_PRESET_SUPERFAST, + FFM_PRESET_VERYFAST, + FFM_PRESET_FASTER, + FFM_PRESET_FAST, + FFM_PRESET_MEDIUM, + FFM_PRESET_SLOW, + FFM_PRESET_SLOWER, + FFM_PRESET_VERYSLOW, +} FFMpegPreset; + + +/* Mapping from easily-understandable descriptions to CRF values. + * Assumes we output 8-bit video. Needs to be remapped if 10-bit + * is output. + * We use a slightly wider than "subjectively sane range" according + * to https://trac.ffmpeg.org/wiki/Encode/H.264#a1.ChooseaCRFvalue + */ +typedef enum FFMpegCrf { + FFM_CRF_NONE = -1, + FFM_CRF_LOSSLESS = 0, + FFM_CRF_PERC_LOSSLESS = 17, + FFM_CRF_HIGH = 20, + FFM_CRF_MEDIUM = 23, + FFM_CRF_LOW = 26, + FFM_CRF_VERYLOW = 29, + FFM_CRF_LOWEST = 32, +} FFMpegCrf; + typedef struct FFMpegCodecData { int type; int codec; @@ -146,13 +177,18 @@ typedef struct FFMpegCodecData { int audio_pad; float audio_volume; int gop_size; + int max_b_frames; /* only used if FFMPEG_USE_MAX_B_FRAMES flag is set. */ int flags; + int constant_rate_factor; + int ffmpeg_preset; /* see FFMpegPreset */ int rc_min_rate; int rc_max_rate; int rc_buffer_size; int mux_packet_size; int mux_rate; + int pad1; + IDProperty *properties; } FFMpegCodecData; @@ -1982,6 +2018,7 @@ enum { #endif FFMPEG_AUTOSPLIT_OUTPUT = 2, FFMPEG_LOSSLESS_OUTPUT = 4, + FFMPEG_USE_MAX_B_FRAMES = (1 << 3), }; /* Paint.flags */ diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index bd6674f899c..c63d4e775f8 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -282,15 +282,10 @@ EnumPropertyItem rna_enum_image_type_items[] = { {R_IMF_IMTYPE_FRAMESERVER, "FRAMESERVER", ICON_FILE_SCRIPT, "Frame Server", "Output image to a frameserver"}, #endif #ifdef WITH_FFMPEG - {R_IMF_IMTYPE_H264, "H264", ICON_FILE_MOVIE, "H.264", "Output video in H.264 format"}, - {R_IMF_IMTYPE_FFMPEG, "FFMPEG", ICON_FILE_MOVIE, "MPEG", "Output video in MPEG format"}, - {R_IMF_IMTYPE_THEORA, "THEORA", ICON_FILE_MOVIE, "Ogg Theora", "Output video in Ogg format"}, + {R_IMF_IMTYPE_FFMPEG, "FFMPEG", ICON_FILE_MOVIE, "FFmpeg video", "The most versatile way to output video files"}, #endif #ifdef WITH_QUICKTIME {R_IMF_IMTYPE_QUICKTIME, "QUICKTIME", ICON_FILE_MOVIE, "QuickTime", "Output video in Quicktime format"}, -#endif -#ifdef WITH_FFMPEG - {R_IMF_IMTYPE_XVID, "XVID", ICON_FILE_MOVIE, "Xvid", "Output video in Xvid format"}, #endif {0, NULL, 0, NULL, NULL} }; @@ -5320,6 +5315,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna) PropertyRNA *prop; #ifdef WITH_FFMPEG + /* Container types */ static EnumPropertyItem ffmpeg_format_items[] = { {FFMPEG_MPEG1, "MPEG1", 0, "MPEG-1", ""}, {FFMPEG_MPEG2, "MPEG2", 0, "MPEG-2", ""}, @@ -5327,8 +5323,8 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna) {FFMPEG_AVI, "AVI", 0, "AVI", ""}, {FFMPEG_MOV, "QUICKTIME", 0, "Quicktime", ""}, {FFMPEG_DV, "DV", 0, "DV", ""}, - {FFMPEG_H264, "H264", 0, "H.264", ""}, - {FFMPEG_XVID, "XVID", 0, "Xvid", ""}, +// {FFMPEG_H264, "H264", 0, "H.264", ""}, not a container +// {FFMPEG_XVID, "XVID", 0, "Xvid", ""}, not a container {FFMPEG_OGG, "OGG", 0, "Ogg", ""}, {FFMPEG_MKV, "MKV", 0, "Matroska", ""}, {FFMPEG_FLV, "FLASH", 0, "Flash", ""}, @@ -5352,6 +5348,32 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; + static EnumPropertyItem ffmpeg_preset_items[] = { + {FFM_PRESET_ULTRAFAST, "ULTRAFAST", 0, "Ultra fast; biggest file", ""}, + {FFM_PRESET_SUPERFAST, "SUPERFAST", 0, "Super fast", ""}, + {FFM_PRESET_VERYFAST, "VERYFAST", 0, "Very fast", ""}, + {FFM_PRESET_FASTER, "FASTER", 0, "Faster", ""}, + {FFM_PRESET_FAST, "FAST", 0, "Fast", ""}, + {FFM_PRESET_MEDIUM, "MEDIUM", 0, "Medium speed", ""}, + {FFM_PRESET_SLOW, "SLOW", 0, "Slow", ""}, + {FFM_PRESET_SLOWER, "SLOWER", 0, "Slower", ""}, + {FFM_PRESET_VERYSLOW, "VERYSLOW", 0, "Very slow; smallest file", ""}, + {0, NULL, 0, NULL, NULL} + }; + + static EnumPropertyItem ffmpeg_crf_items[] = { + {FFM_CRF_NONE, "NONE", 0, "None; use constant bit-rate", + "Use constant bit rate, rather than constant output quality"}, + {FFM_CRF_LOSSLESS, "LOSSLESS", 0, "Lossless", ""}, + {FFM_CRF_PERC_LOSSLESS, "PERC_LOSSLESS", 0, "Perceptually lossless", ""}, + {FFM_CRF_HIGH, "HIGH", 0, "High quality", ""}, + {FFM_CRF_MEDIUM, "MEDIUM", 0, "Medium quality", ""}, + {FFM_CRF_LOW, "LOW", 0, "Low quality", ""}, + {FFM_CRF_VERYLOW, "VERYLOW", 0, "Very low quality", ""}, + {FFM_CRF_LOWEST, "LOWEST", 0, "Lowest quality", ""}, + {0, NULL, 0, NULL, NULL} + }; + static EnumPropertyItem ffmpeg_audio_codec_items[] = { {AV_CODEC_ID_NONE, "NONE", 0, "None", ""}, {AV_CODEC_ID_MP2, "MP2", 0, "MP2", ""}, @@ -5383,13 +5405,15 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna) RNA_def_property_enum_bitflag_sdna(prop, NULL, "type"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_enum_items(prop, ffmpeg_format_items); - RNA_def_property_ui_text(prop, "Format", "Output file format"); + RNA_def_property_enum_default(prop, FFMPEG_MKV); + RNA_def_property_ui_text(prop, "Container", "Output file container"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_FFmpegSettings_codec_settings_update"); prop = RNA_def_property(srna, "codec", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "codec"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_enum_items(prop, ffmpeg_codec_items); + RNA_def_property_enum_default(prop, AV_CODEC_ID_H264); RNA_def_property_ui_text(prop, "Codec", "FFmpeg codec to use"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_FFmpegSettings_codec_settings_update"); @@ -5421,8 +5445,25 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "gopsize", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "gop_size"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_range(prop, 0, 100); - RNA_def_property_ui_text(prop, "GOP Size", "Distance between key frames"); + RNA_def_property_range(prop, 0, 500); + RNA_def_property_int_default(prop, 25); + RNA_def_property_ui_text(prop, "Keyframe interval", + "Distance between key frames, also known as GOP size; " + "influences file size and seekability"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + + prop = RNA_def_property(srna, "max_b_frames", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "max_b_frames"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_range(prop, 0, 16); + RNA_def_property_ui_text(prop, "Max B-frames", + "Maximum number of B-frames between non-B-frames; influences file size and seekability"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + + prop = RNA_def_property(srna, "use_max_b_frames", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", FFMPEG_USE_MAX_B_FRAMES); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Use max B-frames", "Set a maximum number of B-frames"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "buffersize", PROP_INT, PROP_NONE); @@ -5439,6 +5480,24 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Mux Packet Size", "Mux packet size (byte)"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + prop = RNA_def_property(srna, "constant_rate_factor", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "constant_rate_factor"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_enum_items(prop, ffmpeg_crf_items); + RNA_def_property_enum_default(prop, FFM_CRF_MEDIUM); + RNA_def_property_ui_text(prop, "Output quality", + "Constant Rate Factor (CRF); tradeoff between video quality and file size"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + + prop = RNA_def_property(srna, "ffmpeg_preset", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "ffmpeg_preset"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_enum_items(prop, ffmpeg_preset_items); + RNA_def_property_enum_default(prop, FFM_PRESET_MEDIUM); + RNA_def_property_ui_text(prop, "Encoding speed", + "Tradeoff between encoding speed and compression ratio"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + prop = RNA_def_property(srna, "use_autosplit", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", FFMPEG_AUTOSPLIT_OUTPUT); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); -- cgit v1.2.3 From e8d953000afb462ee05140c9c4ec18bf60140687 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Wed, 21 Sep 2016 15:13:43 +0200 Subject: UI: Configurable shortcuts for keyframe operators Adds support for editing the shortcuts for inserting (I), deleting (Alt+I) and clearing (Alt+Shift+I) button keyframes. --- source/blender/editors/animation/keyframing.c | 16 ++++++++--- source/blender/editors/include/UI_interface.h | 2 +- source/blender/editors/interface/interface_anim.c | 18 ------------ .../blender/editors/interface/interface_handlers.c | 32 ++++++---------------- source/blender/editors/interface/interface_ops.c | 7 ++++- 5 files changed, 28 insertions(+), 47 deletions(-) diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 98be77b491f..f2a35bb1553 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -1771,8 +1771,10 @@ static int insert_key_button_exec(bContext *C, wmOperator *op) flag = ANIM_get_keyframing_flags(scene, 1); /* try to insert keyframe using property retrieved from UI */ - but = UI_context_active_but_get(C); - UI_context_active_but_prop_get(C, &ptr, &prop, &index); + if (!(but = UI_context_active_but_prop_get(C, &ptr, &prop, &index))) { + /* pass event on if no active button found */ + return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH); + } if ((ptr.id.data && ptr.data && prop) && RNA_property_animateable(&ptr, prop)) { if (ptr.type == &RNA_NlaStrip) { @@ -1873,7 +1875,10 @@ static int delete_key_button_exec(bContext *C, wmOperator *op) const bool all = RNA_boolean_get(op->ptr, "all"); /* try to insert keyframe using property retrieved from UI */ - UI_context_active_but_prop_get(C, &ptr, &prop, &index); + if (!UI_context_active_but_prop_get(C, &ptr, &prop, &index)) { + /* pass event on if no active button found */ + return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH); + } if (ptr.id.data && ptr.data && prop) { if (ptr.type == &RNA_NlaStrip) { @@ -1973,7 +1978,10 @@ static int clear_key_button_exec(bContext *C, wmOperator *op) const bool all = RNA_boolean_get(op->ptr, "all"); /* try to insert keyframe using property retrieved from UI */ - UI_context_active_but_prop_get(C, &ptr, &prop, &index); + if (!UI_context_active_but_prop_get(C, &ptr, &prop, &index)) { + /* pass event on if no active button found */ + return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH); + } if (ptr.id.data && ptr.data && prop) { path = RNA_path_from_ID_to_property(&ptr, prop); diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index a7dfa4b77b4..fd5351394c3 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -1027,7 +1027,7 @@ bool UI_context_copy_to_selected_list( /* Helpers for Operators */ uiBut *UI_context_active_but_get(const struct bContext *C); -void UI_context_active_but_prop_get( +uiBut *UI_context_active_but_prop_get( const struct bContext *C, struct PointerRNA *r_ptr, struct PropertyRNA **r_prop, int *r_index); void UI_context_active_but_prop_handle(struct bContext *C); diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index c88b03ceaa0..5c4560bb0ec 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -272,24 +272,6 @@ void ui_but_anim_autokey(bContext *C, uiBut *but, Scene *scene, float cfra) } } -void ui_but_anim_insert_keyframe(bContext *C) -{ - /* this operator calls UI_context_active_but_prop_get */ - WM_operator_name_call(C, "ANIM_OT_keyframe_insert_button", WM_OP_INVOKE_DEFAULT, NULL); -} - -void ui_but_anim_delete_keyframe(bContext *C) -{ - /* this operator calls UI_context_active_but_prop_get */ - WM_operator_name_call(C, "ANIM_OT_keyframe_delete_button", WM_OP_INVOKE_DEFAULT, NULL); -} - -void ui_but_anim_clear_keyframe(bContext *C) -{ - /* this operator calls UI_context_active_but_prop_get */ - WM_operator_name_call(C, "ANIM_OT_keyframe_clear_button", WM_OP_INVOKE_DEFAULT, NULL); -} - void ui_but_anim_add_driver(bContext *C) { /* this operator calls UI_context_active_but_prop_get */ diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 3d3e9f96332..29c9c03baf9 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -7040,27 +7040,6 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * } } } - /* handle keyframing */ - else if ((event->type == IKEY) && - !IS_EVENT_MOD(event, ctrl, oskey) && - (event->val == KM_PRESS)) - { - if (event->alt) { - if (event->shift) { - ui_but_anim_clear_keyframe(C); - } - else { - ui_but_anim_delete_keyframe(C); - } - } - else { - ui_but_anim_insert_keyframe(C); - } - - ED_region_tag_redraw(data->region); - - return WM_UI_HANDLER_BREAK; - } /* handle drivers */ else if ((event->type == DKEY) && !IS_EVENT_MOD(event, shift, oskey) && @@ -8082,8 +8061,13 @@ uiBut *UI_context_active_but_get(const struct bContext *C) return ui_context_button_active(C, NULL); } -/* helper function for insert keyframe, reset to default, etc operators */ -void UI_context_active_but_prop_get( +/** + * Version of #UI_context_active_but_get that also returns RNA property info. + * Helper function for insert keyframe, reset to default, etc operators. + * + * \return active button, NULL if none found or if it doesn't contain valid RNA data. + */ +uiBut *UI_context_active_but_prop_get( const bContext *C, struct PointerRNA *r_ptr, struct PropertyRNA **r_prop, int *r_index) { @@ -8099,6 +8083,8 @@ void UI_context_active_but_prop_get( *r_prop = NULL; *r_index = 0; } + + return activebut; } void UI_context_active_but_prop_handle(bContext *C) diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index fe4104697b0..ce23588f821 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -1114,7 +1114,12 @@ void ED_operatortypes_ui(void) */ void ED_keymap_ui(wmKeyConfig *keyconf) { - WM_keymap_find(keyconf, "User Interface", 0, 0); + wmKeyMap *keymap = WM_keymap_find(keyconf, "User Interface", 0, 0); + + /* keyframes */ + WM_keymap_add_item(keymap, "ANIM_OT_keyframe_insert_button", IKEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "ANIM_OT_keyframe_delete_button", IKEY, KM_PRESS, KM_ALT, 0); + WM_keymap_add_item(keymap, "ANIM_OT_keyframe_clear_button", IKEY, KM_PRESS, KM_SHIFT | KM_ALT, 0); eyedropper_modal_keymap(keyconf); } -- cgit v1.2.3 From a3d258bfb49c4560bdb91fbedbfa8536641e2133 Mon Sep 17 00:00:00 2001 From: Mike Erwin Date: Wed, 21 Sep 2016 17:41:34 +0200 Subject: fix for potential pitfall with glMatrixMode close D696 by @jwilkins The matrix mode should always be left in modelview mode, since a lot of code assumes it is before setting a matrix. --- source/blender/gpu/intern/gpu_framebuffer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c index c0400cdb04c..f62ef677434 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.c +++ b/source/blender/gpu/intern/gpu_framebuffer.c @@ -401,13 +401,13 @@ void GPU_framebuffer_blur( GPU_shader_uniform_texture(blur_shader, texture_source_uniform, tex); glViewport(0, 0, GPU_texture_width(blurtex), GPU_texture_height(blurtex)); - /* Peparing to draw quad */ - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); + /* Preparing to draw quad */ glMatrixMode(GL_TEXTURE); glLoadIdentity(); glMatrixMode(GL_PROJECTION); glLoadIdentity(); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); glDisable(GL_DEPTH_TEST); -- cgit v1.2.3 From f6c09eadf06161d185835757afbf40c6512cc7cc Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Wed, 21 Sep 2016 20:05:49 +0200 Subject: UI: Make button driver and keying set shortcuts configurable --- source/blender/editors/animation/keyingsets.c | 18 ++++++++----- source/blender/editors/interface/interface_anim.c | 24 ----------------- .../blender/editors/interface/interface_handlers.c | 30 ---------------------- .../blender/editors/interface/interface_intern.h | 7 ----- source/blender/editors/interface/interface_ops.c | 8 ++++++ 5 files changed, 20 insertions(+), 67 deletions(-) diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index b907ad150aa..4408ec26b3f 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -296,6 +296,12 @@ static int add_keyingset_button_exec(bContext *C, wmOperator *op) int index = 0, pflag = 0; const bool all = RNA_boolean_get(op->ptr, "all"); + /* try to add to keyingset using property retrieved from UI */ + if (!UI_context_active_but_prop_get(C, &ptr, &prop, &index)) { + /* pass event on if no active button found */ + return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH); + } + /* verify the Keying Set to use: * - use the active one for now (more control over this can be added later) * - add a new one if it doesn't exist @@ -326,9 +332,6 @@ static int add_keyingset_button_exec(bContext *C, wmOperator *op) ks = BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1); } - /* try to add to keyingset using property retrieved from UI */ - UI_context_active_but_prop_get(C, &ptr, &prop, &index); - /* check if property is able to be added */ if (ptr.id.data && ptr.data && prop && RNA_property_animateable(&ptr, prop)) { path = RNA_path_from_ID_to_property(&ptr, prop); @@ -396,6 +399,12 @@ static int remove_keyingset_button_exec(bContext *C, wmOperator *op) short success = 0; int index = 0; + /* try to add to keyingset using property retrieved from UI */ + if (UI_context_active_but_prop_get(C, &ptr, &prop, &index)) { + /* pass event on if no active button found */ + return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH); + } + /* verify the Keying Set to use: * - use the active one for now (more control over this can be added later) * - return error if it doesn't exist @@ -412,9 +421,6 @@ static int remove_keyingset_button_exec(bContext *C, wmOperator *op) ks = BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1); } - /* try to add to keyingset using property retrieved from UI */ - UI_context_active_but_prop_get(C, &ptr, &prop, &index); - if (ptr.id.data && ptr.data && prop) { path = RNA_path_from_ID_to_property(&ptr, prop); diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index 5c4560bb0ec..991cd54fecf 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -272,18 +272,6 @@ void ui_but_anim_autokey(bContext *C, uiBut *but, Scene *scene, float cfra) } } -void ui_but_anim_add_driver(bContext *C) -{ - /* this operator calls UI_context_active_but_prop_get */ - WM_operator_name_call(C, "ANIM_OT_driver_button_add", WM_OP_INVOKE_DEFAULT, NULL); -} - -void ui_but_anim_remove_driver(bContext *C) -{ - /* this operator calls UI_context_active_but_prop_get */ - WM_operator_name_call(C, "ANIM_OT_driver_button_remove", WM_OP_INVOKE_DEFAULT, NULL); -} - void ui_but_anim_copy_driver(bContext *C) { /* this operator calls UI_context_active_but_prop_get */ @@ -295,15 +283,3 @@ void ui_but_anim_paste_driver(bContext *C) /* this operator calls UI_context_active_but_prop_get */ WM_operator_name_call(C, "ANIM_OT_paste_driver_button", WM_OP_INVOKE_DEFAULT, NULL); } - -void ui_but_anim_add_keyingset(bContext *C) -{ - /* this operator calls UI_context_active_but_prop_get */ - WM_operator_name_call(C, "ANIM_OT_keyingset_button_add", WM_OP_INVOKE_DEFAULT, NULL); -} - -void ui_but_anim_remove_keyingset(bContext *C) -{ - /* this operator calls UI_context_active_but_prop_get */ - WM_operator_name_call(C, "ANIM_OT_keyingset_button_remove", WM_OP_INVOKE_DEFAULT, NULL); -} diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 29c9c03baf9..c40260a8454 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -7040,36 +7040,6 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * } } } - /* handle drivers */ - else if ((event->type == DKEY) && - !IS_EVENT_MOD(event, shift, oskey) && - (event->val == KM_PRESS)) - { - /* quick check to prevent this opening within the popup menu its self */ - if (!ELEM(NULL, but->rnapoin.data, but->rnaprop)) { - if (event->alt) - ui_but_anim_remove_driver(C); - else if (event->ctrl) - ui_but_anim_add_driver(C); - - ED_region_tag_redraw(data->region); - } - return WM_UI_HANDLER_BREAK; - } - /* handle keyingsets */ - else if ((event->type == KKEY) && - !IS_EVENT_MOD(event, shift, ctrl, oskey) && - (event->val == KM_PRESS)) - { - if (event->alt) - ui_but_anim_remove_keyingset(C); - else - ui_but_anim_add_keyingset(C); - - ED_region_tag_redraw(data->region); - - return WM_UI_HANDLER_BREAK; - } /* handle menu */ else if ((event->type == RIGHTMOUSE) && !IS_EVENT_MOD(event, shift, ctrl, alt, oskey) && diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 418d98e8e4a..fcf827bdbe6 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -729,15 +729,8 @@ void ui_block_align_calc(uiBlock *block); /* interface_anim.c */ void ui_but_anim_flag(uiBut *but, float cfra); -void ui_but_anim_insert_keyframe(struct bContext *C); -void ui_but_anim_delete_keyframe(struct bContext *C); -void ui_but_anim_clear_keyframe(struct bContext *C); -void ui_but_anim_add_driver(struct bContext *C); -void ui_but_anim_remove_driver(struct bContext *C); void ui_but_anim_copy_driver(struct bContext *C); void ui_but_anim_paste_driver(struct bContext *C); -void ui_but_anim_add_keyingset(struct bContext *C); -void ui_but_anim_remove_keyingset(struct bContext *C); bool ui_but_anim_expression_get(uiBut *but, char *str, size_t maxlen); bool ui_but_anim_expression_set(uiBut *but, const char *str); bool ui_but_anim_expression_create(uiBut *but, const char *str); diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index ce23588f821..77b5367c3e9 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -1121,5 +1121,13 @@ void ED_keymap_ui(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "ANIM_OT_keyframe_delete_button", IKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "ANIM_OT_keyframe_clear_button", IKEY, KM_PRESS, KM_SHIFT | KM_ALT, 0); + /* drivers */ + WM_keymap_add_item(keymap, "ANIM_OT_driver_button_add", DKEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "ANIM_OT_driver_button_remove", DKEY, KM_PRESS, KM_CTRL | KM_ALT, 0); + + /* keyingsets */ + WM_keymap_add_item(keymap, "ANIM_OT_keyingset_button_add", KKEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "ANIM_OT_keyingset_button_remove", KKEY, KM_PRESS, KM_ALT, 0); + eyedropper_modal_keymap(keyconf); } -- cgit v1.2.3 From e9bcdcdbbd91d93b1c00e05226818448d9f9b60f Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Wed, 21 Sep 2016 22:20:24 +0200 Subject: UI: Make eyedropper shortcut configurable It's now possible to change the shortcut for invoking the eyedropper while hovering a button (E by default). Also removed the keymap editor entry for the modal eyedropper keymap, it's now automatically appended to the eyedropper shortcut. --- .../scripts/modules/bpy_extras/keyconfig_utils.py | 4 +- .../editors/interface/interface_eyedropper.c | 70 ++++++++++++++++++---- .../blender/editors/interface/interface_handlers.c | 37 +----------- source/blender/editors/interface/interface_ops.c | 6 ++ 4 files changed, 69 insertions(+), 48 deletions(-) diff --git a/release/scripts/modules/bpy_extras/keyconfig_utils.py b/release/scripts/modules/bpy_extras/keyconfig_utils.py index ee0638e254d..a80b9dfe317 100644 --- a/release/scripts/modules/bpy_extras/keyconfig_utils.py +++ b/release/scripts/modules/bpy_extras/keyconfig_utils.py @@ -33,9 +33,7 @@ KM_HIERARCHY = [ ('View2D', 'EMPTY', 'WINDOW', []), # view 2d navigation (per region) ('View2D Buttons List', 'EMPTY', 'WINDOW', []), # view 2d with buttons navigation - ('User Interface', 'EMPTY', 'WINDOW', [ - ('Eyedropper Modal Map', 'EMPTY', 'WINDOW', []), - ]), + ('User Interface', 'EMPTY', 'WINDOW', []), ('3D View', 'VIEW_3D', 'WINDOW', [ # view 3d navigation and generic stuff (select, transform) ('Object Mode', 'EMPTY', 'WINDOW', []), diff --git a/source/blender/editors/interface/interface_eyedropper.c b/source/blender/editors/interface/interface_eyedropper.c index f10b3e6f157..31598a44b09 100644 --- a/source/blender/editors/interface/interface_eyedropper.c +++ b/source/blender/editors/interface/interface_eyedropper.c @@ -448,8 +448,20 @@ static int eyedropper_exec(bContext *C, wmOperator *op) static int eyedropper_poll(bContext *C) { - if (!CTX_wm_window(C)) return 0; - else return 1; + PointerRNA ptr; + PropertyRNA *prop; + int index_dummy; + uiBut *but; + + /* Only color buttons */ + if ((CTX_wm_window(C) != NULL) && + (but = UI_context_active_but_prop_get(C, &ptr, &prop, &index_dummy)) && + (but->type == UI_BTYPE_COLOR)) + { + return 1; + } + + return 0; } void UI_OT_eyedropper_color(wmOperatorType *ot) @@ -727,8 +739,27 @@ static int datadropper_exec(bContext *C, wmOperator *op) static int datadropper_poll(bContext *C) { - if (!CTX_wm_window(C)) return 0; - else return 1; + PointerRNA ptr; + PropertyRNA *prop; + int index_dummy; + uiBut *but; + + /* data dropper only supports object data */ + if ((CTX_wm_window(C) != NULL) && + (but = UI_context_active_but_prop_get(C, &ptr, &prop, &index_dummy)) && + (but->type == UI_BTYPE_SEARCH_MENU) && + (but->flag & UI_BUT_SEARCH_UNLINK)) + { + if (prop && RNA_property_type(prop) == PROP_POINTER) { + StructRNA *type = RNA_property_pointer_type(&ptr, prop); + const short idcode = RNA_type_to_ID_code(type); + if ((idcode == ID_OB) || OB_DATA_SUPPORT_ID(idcode)) { + return 1; + } + } + } + + return 0; } void UI_OT_eyedropper_id(wmOperatorType *ot) @@ -1034,8 +1065,26 @@ static int depthdropper_exec(bContext *C, wmOperator *op) static int depthdropper_poll(bContext *C) { - if (!CTX_wm_window(C)) return 0; - else return 1; + PointerRNA ptr; + PropertyRNA *prop; + int index_dummy; + uiBut *but; + + /* check if there's an active button taking depth value */ + if ((CTX_wm_window(C) != NULL) && + (but = UI_context_active_but_prop_get(C, &ptr, &prop, &index_dummy)) && + (but->type == UI_BTYPE_NUM) && + (prop != NULL)) + { + if ((RNA_property_type(prop) == PROP_FLOAT) && + (RNA_property_subtype(prop) & PROP_UNIT_LENGTH) && + (RNA_property_array_check(prop) == false)) + { + return 1; + } + } + + return 0; } void UI_OT_eyedropper_depth(wmOperatorType *ot) @@ -1084,12 +1133,11 @@ static bool driverdropper_init(bContext *C, wmOperator *op) { DriverDropper *ddr; uiBut *but; - + op->customdata = ddr = MEM_callocN(sizeof(DriverDropper), "DriverDropper"); - - UI_context_active_but_prop_get(C, &ddr->ptr, &ddr->prop, &ddr->index); - but = UI_context_active_but_get(C); - + + but = UI_context_active_but_prop_get(C, &ddr->ptr, &ddr->prop, &ddr->index); + if ((ddr->ptr.data == NULL) || (ddr->prop == NULL) || (RNA_property_editable(&ddr->ptr, ddr->prop) == false) || diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index c40260a8454..369eba66f32 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -6979,6 +6979,9 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * /* if but->pointype is set, but->poin should be too */ BLI_assert(!but->pointype || but->poin); + /* Only hard-coded stuff here, button interactions with configurable + * keymaps are handled using operators (see #ED_keymap_ui). */ + if ((data->state == BUTTON_STATE_HIGHLIGHT) || (event->type == EVT_DROP)) { /* handle copy-paste */ if (ELEM(event->type, CKEY, VKEY) && event->val == KM_PRESS && @@ -7006,40 +7009,6 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * else if (event->type == EVT_DROP) { ui_but_drop(C, event, but, data); } - /* handle eyedropper */ - else if ((event->type == EKEY) && (event->val == KM_PRESS)) { - if (IS_EVENT_MOD(event, shift, ctrl, alt, oskey)) { - /* pass */ - } - else { - if (but->type == UI_BTYPE_COLOR) { - WM_operator_name_call(C, "UI_OT_eyedropper_color", WM_OP_INVOKE_DEFAULT, NULL); - return WM_UI_HANDLER_BREAK; - } - else if ((but->type == UI_BTYPE_SEARCH_MENU) && - (but->flag & UI_BUT_SEARCH_UNLINK)) - { - if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_POINTER) { - StructRNA *type = RNA_property_pointer_type(&but->rnapoin, but->rnaprop); - const short idcode = RNA_type_to_ID_code(type); - if ((idcode == ID_OB) || OB_DATA_SUPPORT_ID(idcode)) { - WM_operator_name_call(C, "UI_OT_eyedropper_id", WM_OP_INVOKE_DEFAULT, NULL); - return WM_UI_HANDLER_BREAK; - } - } - } - else if (but->type == UI_BTYPE_NUM) { - if (but->rnaprop && - (RNA_property_type(but->rnaprop) == PROP_FLOAT) && - (RNA_property_subtype(but->rnaprop) & PROP_UNIT_LENGTH) && - (RNA_property_array_check(but->rnaprop) == false)) - { - WM_operator_name_call(C, "UI_OT_eyedropper_depth", WM_OP_INVOKE_DEFAULT, NULL); - return WM_UI_HANDLER_BREAK; - } - } - } - } /* handle menu */ else if ((event->type == RIGHTMOUSE) && !IS_EVENT_MOD(event, shift, ctrl, alt, oskey) && diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 77b5367c3e9..7e516474bfd 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -1116,6 +1116,12 @@ void ED_keymap_ui(wmKeyConfig *keyconf) { wmKeyMap *keymap = WM_keymap_find(keyconf, "User Interface", 0, 0); + /* eyedroppers - notice they all have the same shortcut, but pass the event + * through until a suitable eyedropper for the active button is found */ + WM_keymap_add_item(keymap, "UI_OT_eyedropper_color", EKEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "UI_OT_eyedropper_id", EKEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "UI_OT_eyedropper_depth", EKEY, KM_PRESS, 0, 0); + /* keyframes */ WM_keymap_add_item(keymap, "ANIM_OT_keyframe_insert_button", IKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "ANIM_OT_keyframe_delete_button", IKEY, KM_PRESS, KM_ALT, 0); -- cgit v1.2.3 From 9493e3b2d6da63bad3f8f4ac876a38072517111a Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Wed, 21 Sep 2016 23:04:26 +0200 Subject: UI: Theme options for vertex/edge bevel weight colors Drawing used colors for select (TH_EDGE_SELECT/TH_VERTEX_SELECT) which was inconsistent with crease, seam, sharp, .. (which all had their own them color -- also was a bit hard to read). NOTE: UI team usually doesn't allow adding more theme options, this is an exception. Differential Revision: https://developer.blender.org/D2234 --- source/blender/blenkernel/BKE_blender_version.h | 2 +- source/blender/editors/include/UI_resources.h | 5 ++++- source/blender/editors/interface/resources.c | 14 ++++++++++++++ source/blender/editors/space_view3d/drawobject.c | 4 ++-- source/blender/makesdna/DNA_userdef_types.h | 4 ++-- source/blender/makesrna/intern/rna_userdef.c | 10 ++++++++++ 6 files changed, 33 insertions(+), 6 deletions(-) diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index 3ae01d8148a..55142510f9e 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -28,7 +28,7 @@ * and keep comment above the defines. * Use STRINGIFY() rather than defining with quotes */ #define BLENDER_VERSION 278 -#define BLENDER_SUBVERSION 0 +#define BLENDER_SUBVERSION 1 /* Several breakages with 270, e.g. constraint deg vs rad */ #define BLENDER_MINVERSION 270 #define BLENDER_MINSUBVERSION 6 diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h index a81221ed54b..f8a5f30a596 100644 --- a/source/blender/editors/include/UI_resources.h +++ b/source/blender/editors/include/UI_resources.h @@ -298,7 +298,10 @@ enum { TH_V3D_CLIPPING_BORDER, TH_METADATA_BG, - TH_METADATA_TEXT + TH_METADATA_TEXT, + + TH_EDGE_BEVEL, + TH_VERTEX_BEVEL }; /* XXX WARNING: previous is saved in file, so do not change order! */ diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index c8ff335f2a0..6b7867c845f 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -305,6 +305,8 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo cp = ts->vertex; break; case TH_VERTEX_SELECT: cp = ts->vertex_select; break; + case TH_VERTEX_BEVEL: + cp = ts->vertex_bevel; break; case TH_VERTEX_UNREFERENCED: cp = ts->vertex_unreferenced; break; case TH_VERTEX_SIZE: @@ -321,6 +323,8 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo cp = ts->edge_sharp; break; case TH_EDGE_CREASE: cp = ts->edge_crease; break; + case TH_EDGE_BEVEL: + cp = ts->edge_bevel; break; case TH_EDITMESH_ACTIVE: cp = ts->editmesh_active; break; case TH_EDGE_FACESEL: @@ -898,12 +902,14 @@ void ui_theme_init_default(void) rgba_char_args_set(btheme->tv3d.transform, 0xff, 0xff, 0xff, 255); rgba_char_args_set(btheme->tv3d.vertex, 0, 0, 0, 255); rgba_char_args_set(btheme->tv3d.vertex_select, 255, 133, 0, 255); + rgba_char_args_set(btheme->tv3d.vertex_bevel, 0, 165, 255, 255); rgba_char_args_set(btheme->tv3d.vertex_unreferenced, 0, 0, 0, 255); btheme->tv3d.vertex_size = 3; btheme->tv3d.outline_width = 1; rgba_char_args_set(btheme->tv3d.edge, 0x0, 0x0, 0x0, 255); rgba_char_args_set(btheme->tv3d.edge_select, 255, 160, 0, 255); rgba_char_args_set(btheme->tv3d.edge_seam, 219, 37, 18, 255); + rgba_char_args_set(btheme->tv3d.edge_bevel, 0, 165, 255, 255); rgba_char_args_set(btheme->tv3d.edge_facesel, 75, 75, 75, 255); rgba_char_args_set(btheme->tv3d.face, 0, 0, 0, 18); rgba_char_args_set(btheme->tv3d.face_select, 255, 133, 0, 60); @@ -2734,6 +2740,14 @@ void init_userdef_do_versions(void) } } + if (!USER_VERSION_ATLEAST(278, 1)) { + bTheme *btheme; + for (btheme = U.themes.first; btheme; btheme = btheme->next) { + rgba_char_args_set(btheme->tv3d.vertex_bevel, 0, 165, 255, 255); + rgba_char_args_set(btheme->tv3d.edge_bevel, 0, 165, 255, 255); + } + } + /** * Include next version bump. * diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 4af84589eb8..a74c0f0f467 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -3079,7 +3079,7 @@ static DMDrawOption draw_dm_bweights__setDrawOptions(void *userData, int index) if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) { const float bweight = BM_ELEM_CD_GET_FLOAT(eed, data->cd_layer_offset); if (bweight != 0.0f) { - UI_ThemeColorBlend(TH_WIRE_EDIT, TH_EDGE_SELECT, bweight); + UI_ThemeColorBlend(TH_WIRE_EDIT, TH_EDGE_BEVEL, bweight); return DM_DRAW_OPTION_NORMAL; } } @@ -3095,7 +3095,7 @@ static void draw_dm_bweights__mapFunc(void *userData, int index, const float co[ if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) { const float bweight = BM_ELEM_CD_GET_FLOAT(eve, data->cd_layer_offset); if (bweight != 0.0f) { - UI_ThemeColorBlend(TH_VERTEX, TH_VERTEX_SELECT, bweight); + UI_ThemeColorBlend(TH_VERTEX, TH_VERTEX_BEVEL, bweight); glVertex3fv(co); } } diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 02a0b414bb3..e018b66dd60 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -240,9 +240,9 @@ typedef struct ThemeSpace { char wire[4], wire_edit[4], select[4]; char lamp[4], speaker[4], empty[4], camera[4]; char active[4], group[4], group_active[4], transform[4]; - char vertex[4], vertex_select[4], vertex_unreferenced[4]; + char vertex[4], vertex_select[4], vertex_bevel[4], vertex_unreferenced[4]; char edge[4], edge_select[4]; - char edge_seam[4], edge_sharp[4], edge_facesel[4], edge_crease[4]; + char edge_seam[4], edge_sharp[4], edge_facesel[4], edge_crease[4], edge_bevel[4]; char face[4], face_select[4]; /* solid faces */ char face_dot[4]; /* selected color */ char extra_edge_len[4], extra_edge_angle[4], extra_face_angle[4], extra_face_area[4]; diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 655c265cad0..0cd1acd63f5 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -1365,6 +1365,11 @@ static void rna_def_userdef_theme_spaces_vertex(StructRNA *srna) RNA_def_property_ui_text(prop, "Vertex Size", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); + prop = RNA_def_property(srna, "vertex_bevel", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Vertex Bevel", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + prop = RNA_def_property(srna, "vertex_unreferenced", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Vertex Group Unreferenced", ""); @@ -1395,6 +1400,11 @@ static void rna_def_userdef_theme_spaces_edge(StructRNA *srna) RNA_def_property_ui_text(prop, "Edge Crease", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); + prop = RNA_def_property(srna, "edge_bevel", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Edge Bevel", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + prop = RNA_def_property(srna, "edge_facesel", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Edge UV Face Select", ""); -- cgit v1.2.3 From 6f806045093419a55b16c596dd8690ea0bbae138 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Thu, 22 Sep 2016 00:10:53 +0200 Subject: RNA/UI: Allow displaying in tooltip why RNA property isn't editable This commit allows RNA properties to return additional info on their editable state which may then be displayed in tooltips. To show how it works, it also adds some info for the editable check of proxies. For generally un-editable properties or properties of a linked data-block, RNA returns default strings. | {F362785} | {F362786} | {F362787} | Reviewed by brecht, thanks! Differential Revision: https://developer.blender.org/D2243 --- source/blender/editors/interface/interface.c | 11 ++--- .../blender/editors/interface/interface_regions.c | 2 +- source/blender/makesrna/RNA_access.h | 1 + source/blender/makesrna/intern/rna_ID.c | 2 +- source/blender/makesrna/intern/rna_access.c | 48 +++++++++++++++++++--- source/blender/makesrna/intern/rna_animation.c | 6 +-- source/blender/makesrna/intern/rna_curve.c | 2 +- source/blender/makesrna/intern/rna_fcurve.c | 4 +- source/blender/makesrna/intern/rna_gpencil.c | 2 +- .../blender/makesrna/intern/rna_internal_types.h | 6 ++- source/blender/makesrna/intern/rna_lattice.c | 2 +- source/blender/makesrna/intern/rna_material.c | 2 +- source/blender/makesrna/intern/rna_mesh.c | 2 +- source/blender/makesrna/intern/rna_meta.c | 2 +- source/blender/makesrna/intern/rna_nla.c | 2 +- source/blender/makesrna/intern/rna_object.c | 2 +- source/blender/makesrna/intern/rna_pose.c | 9 +++- source/blender/makesrna/intern/rna_sequencer.c | 2 +- source/blender/makesrna/intern/rna_space.c | 2 +- source/blender/makesrna/intern/rna_vfont.c | 2 +- 20 files changed, 79 insertions(+), 32 deletions(-) diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index aca107013ac..6bba35e821f 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -3215,10 +3215,10 @@ void ui_def_but_icon(uiBut *but, const int icon, const int flag) } } -static void ui_def_but_rna__disable(uiBut *but) +static void ui_def_but_rna__disable(uiBut *but, const char *info) { but->flag |= UI_BUT_DISABLED; - but->disabled_info = ""; + but->disabled_info = info; } static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *but_p) @@ -3483,8 +3483,9 @@ static uiBut *ui_def_but_rna( but->flag |= UI_BUT_ICON_SUBMENU; } - if (!RNA_property_editable(&but->rnapoin, prop)) { - ui_def_but_rna__disable(but); + const char *info; + if (!RNA_property_editable_info(&but->rnapoin, prop, &info)) { + ui_def_but_rna__disable(but, info); } if (but->flag & UI_BUT_UNDO && (ui_but_is_rna_undo(but) == false)) { @@ -3515,7 +3516,7 @@ static uiBut *ui_def_but_rna_propname(uiBlock *block, int type, int retval, cons else { but = ui_def_but(block, type, retval, propname, x, y, width, height, NULL, min, max, a1, a2, tip); - ui_def_but_rna__disable(but); + ui_def_but_rna__disable(but, "Unknown Property."); } return but; diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index b7f921624d9..5602e2b9c6d 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -467,7 +467,7 @@ static uiTooltipData *ui_tooltip_data_from_button(bContext *C, uiBut *but) } /* alternatively, buttons can store some reasoning too */ else if (but->disabled_info) { - disabled_msg = but->disabled_info; + disabled_msg = TIP_(but->disabled_info); } if (disabled_msg && disabled_msg[0]) { diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 2893fabd145..44d1a6bfaaf 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -856,6 +856,7 @@ StructRNA *RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop); int RNA_property_pointer_poll(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *value); bool RNA_property_editable(PointerRNA *ptr, PropertyRNA *prop); +bool RNA_property_editable_info(PointerRNA *ptr, PropertyRNA *prop, const char **r_info); bool RNA_property_editable_index(PointerRNA *ptr, PropertyRNA *prop, int index); bool RNA_property_editable_flag(PointerRNA *ptr, PropertyRNA *prop); /* without lib check, only checks the flag */ bool RNA_property_animateable(PointerRNA *ptr, PropertyRNA *prop); diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 7e6bdf970f6..280ad4aa9b1 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -122,7 +122,7 @@ void rna_ID_name_set(PointerRNA *ptr, const char *value) BLI_libblock_ensure_unique_name(G.main, id->name); } -static int rna_ID_name_editable(PointerRNA *ptr) +static int rna_ID_name_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { ID *id = (ID *)ptr->data; diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 6879a0534e9..6f054e586ec 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -1619,20 +1619,56 @@ bool RNA_property_editable(PointerRNA *ptr, PropertyRNA *prop) { ID *id = ptr->id.data; int flag; + const char *dummy_info; prop = rna_ensure_property(prop); - flag = prop->editable ? prop->editable(ptr) : prop->flag; + flag = prop->editable ? prop->editable(ptr, &dummy_info) : prop->flag; + return ((flag & PROP_EDITABLE) && (flag & PROP_REGISTER) == 0 && (!id || !ID_IS_LINKED_DATABLOCK(id) || (prop->flag & PROP_LIB_EXCEPTION))); } +/** + * Version of #RNA_property_editable that tries to return additional info in \a r_info that can be exposed in UI. + */ +bool RNA_property_editable_info(PointerRNA *ptr, PropertyRNA *prop, const char **r_info) +{ + ID *id = ptr->id.data; + int flag; + + prop = rna_ensure_property(prop); + *r_info = ""; + + /* get flag */ + if (prop->editable) { + flag = prop->editable(ptr, r_info); + } + else { + flag = prop->flag; + if ((flag & PROP_EDITABLE) == 0 || (flag & PROP_REGISTER)) { + *r_info = "This property is for internal use only and can't be edited."; + } + } + + /* property from linked data-block */ + if (id && ID_IS_LINKED_DATABLOCK(id) && (prop->flag & PROP_LIB_EXCEPTION) == 0) { + if (!(*r_info)[0]) { + *r_info = "Can't edit this property from a linked data-block."; + } + return false; + } + + return ((flag & PROP_EDITABLE) && (flag & PROP_REGISTER) == 0); +} + bool RNA_property_editable_flag(PointerRNA *ptr, PropertyRNA *prop) { int flag; + const char *dummy_info; prop = rna_ensure_property(prop); - flag = prop->editable ? prop->editable(ptr) : prop->flag; + flag = prop->editable ? prop->editable(ptr, &dummy_info) : prop->flag; return (flag & PROP_EDITABLE) != 0; } @@ -1647,9 +1683,11 @@ bool RNA_property_editable_index(PointerRNA *ptr, PropertyRNA *prop, int index) prop = rna_ensure_property(prop); flag = prop->flag; - - if (prop->editable) - flag &= prop->editable(ptr); + + if (prop->editable) { + const char *dummy_info; + flag &= prop->editable(ptr, &dummy_info); + } if (prop->itemeditable) flag &= prop->itemeditable(ptr, index); diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index e37affcf5a3..cdbf7582fa7 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -89,7 +89,7 @@ static void rna_AnimData_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Point DAG_id_tag_update(id, OB_RECALC_OB | OB_RECALC_DATA); } -static int rna_AnimData_action_editable(PointerRNA *ptr) +static int rna_AnimData_action_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { AnimData *adt = (AnimData *)ptr->data; @@ -305,7 +305,7 @@ static StructRNA *rna_ksPath_id_typef(PointerRNA *ptr) return ID_code_to_RNA_type(ksp->idtype); } -static int rna_ksPath_id_editable(PointerRNA *ptr) +static int rna_ksPath_id_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { KS_Path *ksp = (KS_Path *)ptr->data; return (ksp->idtype) ? PROP_EDITABLE : 0; @@ -393,7 +393,7 @@ static void rna_KeyingSet_name_set(PointerRNA *ptr, const char *value) } -static int rna_KeyingSet_active_ksPath_editable(PointerRNA *ptr) +static int rna_KeyingSet_active_ksPath_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { KeyingSet *ks = (KeyingSet *)ptr->data; diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index f4fb30e0793..22e45964742 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -221,7 +221,7 @@ static void rna_Curve_texspace_set(Main *UNUSED(bmain), Scene *UNUSED(scene), Po BKE_curve_texspace_calc(cu); } -static int rna_Curve_texspace_editable(PointerRNA *ptr) +static int rna_Curve_texspace_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { Curve *cu = (Curve *)ptr->data; return (cu->texflag & CU_AUTOSPACE) ? 0 : PROP_EDITABLE; diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index c521e93d33e..1d3b65bb7ba 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -199,13 +199,13 @@ static StructRNA *rna_DriverTarget_id_typef(PointerRNA *ptr) return ID_code_to_RNA_type(dtar->idtype); } -static int rna_DriverTarget_id_editable(PointerRNA *ptr) +static int rna_DriverTarget_id_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { DriverTarget *dtar = (DriverTarget *)ptr->data; return (dtar->idtype) ? PROP_EDITABLE : 0; } -static int rna_DriverTarget_id_type_editable(PointerRNA *ptr) +static int rna_DriverTarget_id_type_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { DriverTarget *dtar = (DriverTarget *)ptr->data; diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index 7eaf8b65902..9b881c13347 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -120,7 +120,7 @@ static char *rna_GPencilLayer_path(PointerRNA *ptr) return BLI_sprintfN("layers[\"%s\"]", name_esc); } -static int rna_GPencilLayer_active_frame_editable(PointerRNA *ptr) +static int rna_GPencilLayer_active_frame_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { bGPDlayer *gpl = (bGPDlayer *)ptr->data; diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h index ba0705b5caa..04b85b8997e 100644 --- a/source/blender/makesrna/intern/rna_internal_types.h +++ b/source/blender/makesrna/intern/rna_internal_types.h @@ -62,7 +62,7 @@ struct Scene; typedef void (*UpdateFunc)(struct Main *main, struct Scene *scene, struct PointerRNA *ptr); typedef void (*ContextPropUpdateFunc)(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop); typedef void (*ContextUpdateFunc)(struct bContext *C, struct PointerRNA *ptr); -typedef int (*EditableFunc)(struct PointerRNA *ptr); +typedef int (*EditableFunc)(struct PointerRNA *ptr, const char **r_info); typedef int (*ItemEditableFunc)(struct PointerRNA *ptr, int index); typedef struct IDProperty *(*IDPropertiesFunc)(struct PointerRNA *ptr, bool create); typedef struct StructRNA *(*StructRefineFunc)(struct PointerRNA *ptr); @@ -188,7 +188,9 @@ struct PropertyRNA { UpdateFunc update; int noteflag; - /* callback for testing if editable */ + /* Callback for testing if editable. Its r_info parameter can be used to + * return info on editable state that might be shown to user. E.g. tooltips + * of disabled buttons can show reason why button is disabled using this. */ EditableFunc editable; /* callback for testing if array-item editable (if applicable) */ ItemEditableFunc itemeditable; diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c index 6bc9cc38a7d..9424ddf7d0e 100644 --- a/source/blender/makesrna/intern/rna_lattice.c +++ b/source/blender/makesrna/intern/rna_lattice.c @@ -171,7 +171,7 @@ static void rna_Lattice_use_outside_set(PointerRNA *ptr, int value) } } -static int rna_Lattice_size_editable(PointerRNA *ptr) +static int rna_Lattice_size_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { Lattice *lt = (Lattice *)ptr->data; diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 2a8cc073e22..752f406264a 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -233,7 +233,7 @@ static void rna_Material_active_texture_set(PointerRNA *ptr, PointerRNA value) set_current_material_texture(ma, value.data); } -static int rna_Material_active_texture_editable(PointerRNA *ptr) +static int rna_Material_active_texture_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { Material *ma = (Material *)ptr->id.data; diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 1d734864833..df034ed85d8 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -662,7 +662,7 @@ static void rna_MeshLoopColor_color_set(PointerRNA *ptr, const float *values) (&mcol->r)[2] = (char)(CLAMPIS(values[2] * 255.0f, 0, 255)); } -static int rna_Mesh_texspace_editable(PointerRNA *ptr) +static int rna_Mesh_texspace_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { Mesh *me = (Mesh *)ptr->data; return (me->texflag & ME_AUTOSPACE) ? 0 : PROP_EDITABLE; diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c index d3b66e4c3b4..9d13bc90e72 100644 --- a/source/blender/makesrna/intern/rna_meta.c +++ b/source/blender/makesrna/intern/rna_meta.c @@ -53,7 +53,7 @@ #include "WM_types.h" #include "WM_api.h" -static int rna_Meta_texspace_editable(PointerRNA *ptr) +static int rna_Meta_texspace_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { MetaBall *mb = (MetaBall *)ptr->data; return (mb->texflag & MB_AUTOSPACE) ? 0 : PROP_EDITABLE; diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c index eb87eafe16c..55bc40f573c 100644 --- a/source/blender/makesrna/intern/rna_nla.c +++ b/source/blender/makesrna/intern/rna_nla.c @@ -282,7 +282,7 @@ static void rna_NlaStrip_use_auto_blend_set(PointerRNA *ptr, int value) } } -static int rna_NlaStrip_action_editable(PointerRNA *ptr) +static int rna_NlaStrip_action_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { NlaStrip *strip = (NlaStrip *)ptr->data; diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 2cbf23973c2..0e735350e05 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -712,7 +712,7 @@ static void rna_Object_active_material_set(PointerRNA *ptr, PointerRNA value) assign_material(ob, value.data, ob->actcol, BKE_MAT_ASSIGN_EXISTING); } -static int rna_Object_active_material_editable(PointerRNA *ptr) +static int rna_Object_active_material_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { Object *ob = (Object *)ptr->id.data; bool is_editable; diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 1f34d8f23d4..0591e877634 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -556,13 +556,18 @@ static void rna_PoseChannel_constraints_remove(ID *id, bPoseChannel *pchan, Repo } } -static int rna_PoseChannel_proxy_editable(PointerRNA *ptr) +static int rna_PoseChannel_proxy_editable(PointerRNA *ptr, const char **r_info) { Object *ob = (Object *)ptr->id.data; bArmature *arm = ob->data; bPoseChannel *pchan = (bPoseChannel *)ptr->data; - return (ob->proxy && pchan->bone && (pchan->bone->layer & arm->layer_protected)) ? 0 : PROP_EDITABLE; + if (ob->proxy && pchan->bone && (pchan->bone->layer & arm->layer_protected)) { + *r_info = "Can't edit property of a proxy on a protected layer"; + return 0; + } + + return PROP_EDITABLE; } static int rna_PoseChannel_location_editable(PointerRNA *ptr, int index) diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index c3a66058888..bb9c2a6c2fd 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -292,7 +292,7 @@ static int rna_Sequence_frame_length_get(PointerRNA *ptr) return BKE_sequence_tx_get_final_right(seq, false) - BKE_sequence_tx_get_final_left(seq, false); } -static int rna_Sequence_frame_editable(PointerRNA *ptr) +static int rna_Sequence_frame_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { Sequence *seq = (Sequence *)ptr->data; /* Effect sequences' start frame and length must be readonly! */ diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index a7dab0f56f8..375d370097e 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -1645,7 +1645,7 @@ static void rna_FileBrowser_FSMenuEntry_name_set(PointerRNA *ptr, const char *va ED_fsmenu_entry_set_name(fsm, value); } -static int rna_FileBrowser_FSMenuEntry_name_get_editable(PointerRNA *ptr) +static int rna_FileBrowser_FSMenuEntry_name_get_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { FSMenuEntry *fsm = ptr->data; diff --git a/source/blender/makesrna/intern/rna_vfont.c b/source/blender/makesrna/intern/rna_vfont.c index e9ba0c78439..c743751649c 100644 --- a/source/blender/makesrna/intern/rna_vfont.c +++ b/source/blender/makesrna/intern/rna_vfont.c @@ -44,7 +44,7 @@ #include "WM_api.h" /* matching fnction in rna_ID.c */ -static int rna_VectorFont_filepath_editable(PointerRNA *ptr) +static int rna_VectorFont_filepath_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { VFont *vfont = ptr->id.data; if (BKE_vfont_is_builtin(vfont)) { -- cgit v1.2.3 From ca1c7a0cf7a27d513e7f44b8f0e9a967a9dba2d2 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 22 Sep 2016 09:42:09 +0200 Subject: Fix T49422: Metadata not showing in OpenGL renders Own regression since recent optimization. --- source/blender/editors/render/render_opengl.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index a154791f8f7..db0ffb90344 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -373,12 +373,10 @@ static void screen_opengl_render_doit(OGLRender *oglrender, RenderResult *rr) } if (ibuf_result != NULL) { - - RE_render_result_rect_from_ibuf(rr, &scene->r, ibuf_result, oglrender->view_id); - - if ((scene->r.stamp & R_STAMP_ALL) && (scene->r.stamp & R_STAMP_DRAW)) + if ((scene->r.stamp & R_STAMP_ALL) && (scene->r.stamp & R_STAMP_DRAW)) { BKE_image_stamp_buf(scene, camera, NULL, rect, NULL, rr->rectx, rr->recty, 4); - + } + RE_render_result_rect_from_ibuf(rr, &scene->r, ibuf_result, oglrender->view_id); IMB_freeImBuf(ibuf_result); } } -- cgit v1.2.3 From c77da24116991e1c6c5911e5bc99aa66178e0e7c Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 22 Sep 2016 10:04:51 +0200 Subject: Fix non-finite normalization factor in certain cases --- source/blender/editors/animation/anim_draw.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index dbc9c8b4f23..f8b98ebb8b7 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -343,12 +343,13 @@ static float normalization_factor_get(Scene *scene, FCurve *fcu, short flag, flo } } - range = max_coord - min_coord; - - if (range > FLT_EPSILON) { - factor = 2.0f / range; + if (max_coord > min_coord) { + range = max_coord - min_coord; + if (range > FLT_EPSILON) { + factor = 2.0f / range; + } + offset = -min_coord - range / 2.0f; } - offset = -min_coord - range / 2.0f; } BLI_assert(factor != 0.0f); if (r_offset) { -- cgit v1.2.3 From f915ee8e76aded1cfd790f04743e7b04ee48b8b6 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 22 Sep 2016 11:01:37 +0200 Subject: CMake: Fix copy-paste error --- build_files/cmake/config/blender_release.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_files/cmake/config/blender_release.cmake b/build_files/cmake/config/blender_release.cmake index 8d87a921217..050db91e75e 100644 --- a/build_files/cmake/config/blender_release.cmake +++ b/build_files/cmake/config/blender_release.cmake @@ -1,7 +1,7 @@ # Turn everything ON thats expected for an official release builds. # # Example usage: -# cmake -C../blender/build_files/cmake/config/blender_full.cmake ../blender +# cmake -C../blender/build_files/cmake/config/blender_release.cmake ../blender # set(WITH_ALEMBIC ON CACHE BOOL "" FORCE) -- cgit v1.2.3 From ab09a80d33ece770f0b722e8f4c329f558cc9896 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 22 Sep 2016 14:57:16 +0200 Subject: Fix T49425: Freestyle in viewport keeps updating over and over. Regression caused by rBb27ba26, we would always tag datablocks to update in G.main, ignoring given bmain, now always use this one instead. To be backported to 2.78. --- source/blender/blenkernel/intern/library_remap.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c index 442c407de28..f4563649302 100644 --- a/source/blender/blenkernel/intern/library_remap.c +++ b/source/blender/blenkernel/intern/library_remap.c @@ -133,6 +133,7 @@ void BKE_library_callback_remap_editor_id_reference_set(BKE_library_remap_editor } typedef struct IDRemap { + Main *bmain; /* Only used to trigger depsgraph updates in the right bmain. */ ID *old_id; ID *new_id; ID *id; /* The ID in which we are replacing old_id by new_id usages. */ @@ -212,7 +213,7 @@ static int foreach_libblock_remap_callback(void *user_data, ID *id_self, ID **id else { if (!is_never_null) { *id_p = new_id; - DAG_id_tag_update(id_self, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); + DAG_id_tag_update_ex(id_remap_data->bmain, id_self, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); } if (cb_flag & IDWALK_USER) { id_us_min(old_id); @@ -386,15 +387,15 @@ static void libblock_remap_data_postprocess_obdata_relink(Main *UNUSED(bmain), O * - \a id is non-NULL: * + If \a old_id is NULL, \a new_id must also be NULL, and all ID pointers from \a id are cleared (i.e. \a id * does not references any other datablock anymore). - * + If \a old_id is non-NULL, behavior is as with a NULL \a id, but only for given \a id. + * + If \a old_id is non-NULL, behavior is as with a NULL \a id, but only within given \a id. * - * \param bmain: the Main data storage to operate on (can be NULL if \a id is non-NULL). - * \param id: the datablock to operate on (can be NULL if \a bmain is non-NULL). + * \param bmain: the Main data storage to operate on (must never be NULL). + * \param id: the datablock to operate on (can be NULL, in which case we operate over all IDs from given bmain). * \param old_id: the datablock to dereference (may be NULL if \a id is non-NULL). * \param new_id: the new datablock to replace \a old_id references with (may be NULL). * \param r_id_remap_data: if non-NULL, the IDRemap struct to use (uselful to retrieve info about remapping process). */ -static void libblock_remap_data( +ATTR_NONNULL(1) static void libblock_remap_data( Main *bmain, ID *id, ID *old_id, ID *new_id, const short remap_flags, IDRemap *r_id_remap_data) { IDRemap id_remap_data; @@ -404,6 +405,7 @@ static void libblock_remap_data( if (r_id_remap_data == NULL) { r_id_remap_data = &id_remap_data; } + r_id_remap_data->bmain = bmain; r_id_remap_data->old_id = old_id; r_id_remap_data->new_id = new_id; r_id_remap_data->id = NULL; @@ -611,7 +613,7 @@ void BKE_libblock_relink_ex( BLI_assert(new_id == NULL); } - libblock_remap_data(NULL, id, old_id, new_id, remap_flags, NULL); + libblock_remap_data(bmain, id, old_id, new_id, remap_flags, NULL); /* Some after-process updates. * This is a bit ugly, but cannot see a way to avoid it. Maybe we should do a per-ID callback for this instead? -- cgit v1.2.3 From 9937f2887742e22b0bca33d6f8cdeaa4333e8fb1 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 22 Sep 2016 15:00:23 +0200 Subject: Buildinfo: Improve behavior with detached HEAD Try real hard to detect which branch we've detached from. --- build_files/cmake/buildinfo.cmake | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/build_files/cmake/buildinfo.cmake b/build_files/cmake/buildinfo.cmake index af0ccd250e8..1f0a283ba0e 100644 --- a/build_files/cmake/buildinfo.cmake +++ b/build_files/cmake/buildinfo.cmake @@ -27,13 +27,12 @@ if(EXISTS ${SOURCE_DIR}/.git) OUTPUT_VARIABLE MY_WC_HASH OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND git branch --list master --contains ${MY_WC_HASH} + execute_process(COMMAND git branch --list master blender-v* --contains ${MY_WC_HASH} WORKING_DIRECTORY ${SOURCE_DIR} OUTPUT_VARIABLE _git_contains_check OUTPUT_STRIP_TRAILING_WHITESPACE) - STRING(REGEX REPLACE "^[ \t]+" "" _git_contains_check "${_git_contains_check}") - if(_git_contains_check STREQUAL "master") + if(NOT _git_contains_check STREQUAL "") set(MY_WC_BRANCH "master") else() execute_process(COMMAND git show-ref --tags -d @@ -48,6 +47,22 @@ if(EXISTS ${SOURCE_DIR}/.git) if(_git_tag_hashes MATCHES "${_git_head_hash}") set(MY_WC_BRANCH "master") + else() + execute_process(COMMAND git branch --contains ${MY_WC_HASH} + WORKING_DIRECTORY ${SOURCE_DIR} + OUTPUT_VARIABLE _git_contains_branches + OUTPUT_STRIP_TRAILING_WHITESPACE) + string(REGEX REPLACE "^\\*[ \t]+" "" _git_contains_branches "${_git_contains_branches}") + string(REGEX REPLACE "[\r\n]+" ";" _git_contains_branches "${_git_contains_branches}") + string(REGEX REPLACE ";[ \t]+" ";" _git_contains_branches "${_git_contains_branches}") + foreach(_branch ${_git_contains_branches}) + if (NOT "${_branch}" MATCHES "\\(HEAD.*") + set(MY_WC_BRANCH "${_branch}") + break() + endif() + endforeach() + unset(_branch) + unset(_git_contains_branches) endif() unset(_git_tag_hashes) -- cgit v1.2.3 From 4e031073df3658f3bf9c807bfdfd70cdeca73102 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 22 Sep 2016 16:11:16 +0200 Subject: Fix T49427: Drivers of Shapekeys break when Append a group. Optimization attempt with BKE_library_idtype_can_use_idtype() was not taking into account the fact that drivers may link virtually against any datablock... Has to be rethinked, but for after 2.78 release, this commit is safe to backport. --- source/blender/blenkernel/intern/library_query.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c index cb864334208..392ac68150e 100644 --- a/source/blender/blenkernel/intern/library_query.c +++ b/source/blender/blenkernel/intern/library_query.c @@ -897,10 +897,12 @@ void BKE_library_update_ID_link_user(ID *id_dst, ID *id_src, const int cd_flag) * This is a 'simplified' abstract version of #BKE_library_foreach_ID_link() above, quite useful to reduce * useless iterations in some cases. */ +/* XXX This has to be fully rethink, basing check on ID type is not really working anymore (and even worth once + * IDProps will support ID pointers), we'll have to do some quick checks on IDs themselves... */ bool BKE_library_idtype_can_use_idtype(const short id_type_owner, const short id_type_used) { - if (id_type_used == ID_AC) { - return id_type_can_have_animdata(id_type_owner); + if (id_type_can_have_animdata(id_type_owner)) { + return true; /* AnimationData can use virtually any kind of datablocks, through drivers especially. */ } switch ((ID_Type)id_type_owner) { @@ -999,10 +1001,10 @@ static int foreach_libblock_id_users_callback(void *user_data, ID *self_id, ID * IDUsersIter *iter = user_data; /* XXX This is actually some kind of hack... - * Issue is, only ID pointer from shapekeys is the 'from' one, which is not actually ID usage. + * Issue is, shapekeys' 'from' ID pointer is not actually ID usage. * Maybe we should even nuke it from BKE_library_foreach_ID_link, not 100% sure yet... */ - if (GS(self_id->name) == ID_KE) { + if ((GS(self_id->name) == ID_KE) && (((Key *)self_id)->from == *id_p)) { return IDWALK_RET_NOP; } -- cgit v1.2.3 From d84c55f0fa4775f68af4ae7beba3fbeec4a98593 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 22 Sep 2016 17:30:31 +0200 Subject: Fix T49417: Cycles crash - can't use 5 Gigabyte Tile EXR texture file Was an integer overflow issue when calculating offsets. --- intern/cycles/render/image.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp index b387c2c2f98..7e24664b3fe 100644 --- a/intern/cycles/render/image.cpp +++ b/intern/cycles/render/image.cpp @@ -587,8 +587,7 @@ bool ImageManager::file_load_float_image(Image *img, ImageDataType type, device_ } if(depth <= 1) { - int scanlinesize = width*components*sizeof(float); - + size_t scanlinesize = ((size_t)width)*components*sizeof(float); in->read_image(TypeDesc::FLOAT, (uchar*)readpixels + (height-1)*scanlinesize, AutoStride, @@ -696,8 +695,7 @@ bool ImageManager::file_load_half_image(Image *img, ImageDataType type, device_v } if(depth <= 1) { - int scanlinesize = width*components*sizeof(half); - + size_t scanlinesize = ((size_t)width)*components*sizeof(half); in->read_image(TypeDesc::HALF, (uchar*)readpixels + (height-1)*scanlinesize, AutoStride, -- cgit v1.2.3 From 56498757ce971af60d27e619ca84249675413f17 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Thu, 22 Sep 2016 22:49:01 +0200 Subject: Clip Editor: Enable Continuous Grab for view panning --- source/blender/editors/space_clip/clip_ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index 6778a0b1805..de8d7609509 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -476,7 +476,7 @@ void CLIP_OT_view_pan(wmOperatorType *ot) ot->poll = ED_space_clip_view_clip_poll; /* flags */ - ot->flag = OPTYPE_BLOCKING; + ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_CURSOR; /* properties */ RNA_def_float_vector(ot->srna, "offset", 2, NULL, -FLT_MAX, FLT_MAX, -- cgit v1.2.3 From 1b2b7cfa2007172e07d78324bb941d0160b59c42 Mon Sep 17 00:00:00 2001 From: Mai Lavelle Date: Thu, 22 Sep 2016 17:34:14 -0400 Subject: Cycles: Fix overflow caused by wrong size calculation in Mesh::add_undisplaced --- intern/cycles/render/mesh.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp index 2d297c33446..3eff35bae9e 100644 --- a/intern/cycles/render/mesh.cpp +++ b/intern/cycles/render/mesh.cpp @@ -601,6 +601,12 @@ void Mesh::add_undisplaced() /* copy verts */ size_t size = attr->buffer_size(this, (subdivision_type == SUBDIVISION_NONE) ? ATTR_PRIM_TRIANGLE : ATTR_PRIM_SUBD); + + /* Center points for ngons aren't stored in Mesh::verts but are included in size since they will be + * calculated later, we subtract them from size here so we don't have an overflow while copying. + */ + size -= num_ngons * attr->data_sizeof(); + if(size) { memcpy(data, verts.data(), size); } -- cgit v1.2.3