[Bf-blender-cvs] [b1af6820015] master: Outliner Visibility Update

2019-05-10 Thread Dalai Felinto
Commit: b1af682001596fb2943dca3e39a256be71637906
Author: Dalai Felinto
Date:   Sat May 4 14:14:37 2019 -0300
Branches: master
https://developer.blender.org/rBb1af682001596fb2943dca3e39a256be71637906

Outliner Visibility Update

See T61578 for discussions and mockups.

Visibility Options
==
We are adding more granular control over restriction columns in the outliner,
exposing "indirect only" and "holdout" as options, and change the way
users enable/disable collections in a viewlayer.

We also rename the object viewport restriction to hide instance.

So the options we have are:

Collection
--
* Render Visibility
* Instance Visibility
* Selectable

(View) Layer Collection
---
* Enable
* Holdout
* Indirect Only
* Viewport

Shortcuts
=
Isolate Collection
--
* Ctr + click isolates the collection.
It turns all its parents and children "visible", and all the other
collections "invisible".

If ALL the collections were already properly set, we re-set the
collections to their default value.

Set Collection Inside Collections and Objects
-
* Shift + click: Set/unset inside collections and objects.

We only set objects values as well when we are in View Layer mode and
(obviously) when the objects have a matching property.

Icons
=
Little reminder that we will need better icons for holdout, indirect only, and
probably instanced (nothing wrong with the current, but it differs from
the proposal when it is turned off).

Also, we need to decide where do we want the modifier/bones/... icons to
be (in which column) and ideally make sure their icons match the ones we
use for collections/objects.

At the moment those are using the screen icon, which is not being used
by collections.

Reviewers: brecht, billrey
Subscribers: pablovazquez
Differential Revision: https://developer.blender.org/D4823

===

M   release/scripts/startup/bl_ui/space_outliner.py
M   source/blender/alembic/intern/abc_transform.cc
M   source/blender/blenkernel/BKE_blender_version.h
M   source/blender/blenkernel/BKE_collection.h
M   source/blender/blenkernel/intern/collection.c
M   source/blender/blenkernel/intern/layer.c
M   source/blender/blenkernel/intern/object_dupli.c
M   source/blender/blenloader/intern/versioning_280.c
M   source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
M   source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc
M   
source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc
M   source/blender/editors/animation/anim_filter.c
M   source/blender/editors/include/UI_interface.h
M   source/blender/editors/interface/interface.c
M   source/blender/editors/mask/mask_ops.c
M   source/blender/editors/object/object_add.c
M   source/blender/editors/object/object_edit.c
M   source/blender/editors/screen/screen_ops.c
M   source/blender/editors/space_outliner/outliner_collections.c
M   source/blender/editors/space_outliner/outliner_draw.c
M   source/blender/editors/space_outliner/outliner_edit.c
M   source/blender/editors/space_outliner/outliner_intern.h
M   source/blender/editors/space_outliner/outliner_select.c
M   source/blender/editors/space_outliner/outliner_tree.c
M   source/blender/editors/space_outliner/outliner_utils.c
M   source/blender/editors/space_outliner/space_outliner.c
M   source/blender/makesdna/DNA_collection_types.h
M   source/blender/makesdna/DNA_object_types.h
M   source/blender/makesdna/DNA_space_types.h
M   source/blender/makesrna/intern/rna_collection.c
M   source/blender/makesrna/intern/rna_layer.c
M   source/blender/makesrna/intern/rna_object.c
M   source/blender/makesrna/intern/rna_space.c

===

diff --git a/release/scripts/startup/bl_ui/space_outliner.py 
b/release/scripts/startup/bl_ui/space_outliner.py
index d64dfbfdfdf..f0f6776805d 100644
--- a/release/scripts/startup/bl_ui/space_outliner.py
+++ b/release/scripts/startup/bl_ui/space_outliner.py
@@ -47,7 +47,7 @@ class OUTLINER_HT_header(Header):
 layout.separator_spacer()
 
 row = layout.row(align=True)
-if display_mode in {'VIEW_LAYER'}:
+if display_mode in {'SCENES', 'VIEW_LAYER'}:
 row.popover(
 panel="OUTLINER_PT_filter",
 text="",
@@ -303,10 +303,29 @@ class OUTLINER_PT_filter(Panel):
 space = context.space_data
 display_mode = space.display_mode
 
+if display_mode == 'VIEW_LAYER':
+layout.label(text="Restriction Toggles:")
+row = layout.row(align=True)
+row.prop(space, "show_restrict_column_enable", text="")
+row.prop(space, "show_restrict_column_selectable", text="")
+row.prop(space, 

[Bf-blender-cvs] [de9d846353b] master: Fix T64137 Empty Images flickering graphics when "Auto Depth" is enabled

2019-05-10 Thread Clément Foucault
Commit: de9d846353bdc48a2d3388e79309342df7d003df
Author: Clément Foucault
Date:   Sat May 11 00:21:27 2019 +0200
Branches: master
https://developer.blender.org/rBde9d846353bdc48a2d3388e79309342df7d003df

Fix T64137 Empty Images flickering graphics when "Auto Depth" is enabled

Also fix T64373 Grid intensity increases in Ortographic when use Circle
Select in GPencil Edit mode

===

M   source/blender/draw/intern/DRW_render.h
M   source/blender/draw/intern/draw_manager.c

===

diff --git a/source/blender/draw/intern/DRW_render.h 
b/source/blender/draw/intern/DRW_render.h
index db5bab3abaa..38458dd48f0 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -105,7 +105,7 @@ typedef char DRWViewportEmptyList;
 /* Use of multisample framebuffers. */
 #define MULTISAMPLE_SYNC_ENABLE(dfbl, dtxl) \
   { \
-if (dfbl->multisample_fb != NULL) { \
+if (dfbl->multisample_fb != NULL && DRW_state_is_fbo()) { \
   DRW_stats_query_start("Multisample Blit"); \
   GPU_framebuffer_bind(dfbl->multisample_fb); \
   /* TODO clear only depth but need to do alpha to coverage for 
transparencies. */ \
@@ -117,7 +117,7 @@ typedef char DRWViewportEmptyList;
 
 #define MULTISAMPLE_SYNC_DISABLE(dfbl, dtxl) \
   { \
-if (dfbl->multisample_fb != NULL) { \
+if (dfbl->multisample_fb != NULL && DRW_state_is_fbo()) { \
   DRW_stats_query_start("Multisample Resolve"); \
   GPU_framebuffer_bind(dfbl->default_fb); \
   DRW_multisamples_resolve(dtxl->multisample_depth, 
dtxl->multisample_color, true); \
@@ -128,7 +128,7 @@ typedef char DRWViewportEmptyList;
 
 #define MULTISAMPLE_SYNC_DISABLE_NO_DEPTH(dfbl, dtxl) \
   { \
-if (dfbl->multisample_fb != NULL) { \
+if (dfbl->multisample_fb != NULL && DRW_state_is_fbo()) { \
   DRW_stats_query_start("Multisample Resolve"); \
   GPU_framebuffer_bind(dfbl->default_fb); \
   DRW_multisamples_resolve(dtxl->multisample_depth, 
dtxl->multisample_color, false); \
diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index 0b8740ea982..4010d922c84 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -2760,7 +2760,8 @@ void DRW_state_dfdy_factors_get(float dfdyfac[2])
  */
 bool DRW_state_is_fbo(void)
 {
-  return ((DST.default_framebuffer != NULL) || DST.options.is_image_render);
+  return ((DST.default_framebuffer != NULL) || DST.options.is_image_render) &&
+ !DRW_state_is_depth() && !DRW_state_is_select();
 }
 
 /**

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [79b9596c667] master: Tests: fix eevee and workbench using Cycles in a few tests

2019-05-10 Thread Brecht Van Lommel
Commit: 79b9596c667934a97e6f7050fd325d03d653bb60
Author: Brecht Van Lommel
Date:   Fri May 10 23:20:32 2019 +0200
Branches: master
https://developer.blender.org/rB79b9596c667934a97e6f7050fd325d03d653bb60

Tests: fix eevee and workbench using Cycles in a few tests

===

M   tests/python/eevee_render_tests.py
M   tests/python/workbench_render_tests.py

===

diff --git a/tests/python/eevee_render_tests.py 
b/tests/python/eevee_render_tests.py
index 61eff8299ab..c0536e05164 100755
--- a/tests/python/eevee_render_tests.py
+++ b/tests/python/eevee_render_tests.py
@@ -12,6 +12,9 @@ import sys
 def setup():
 import bpy
 
+for scene in bpy.data.scenes:
+scene.render.engine = 'BLENDER_EEVEE'
+
 # Enable Eevee features
 scene = bpy.context.scene
 eevee = scene.eevee
diff --git a/tests/python/workbench_render_tests.py 
b/tests/python/workbench_render_tests.py
index 5b759214140..1a0d639bccd 100755
--- a/tests/python/workbench_render_tests.py
+++ b/tests/python/workbench_render_tests.py
@@ -12,6 +12,9 @@ import sys
 def setup():
 import bpy
 
+for scene in bpy.data.scenes:
+scene.render.engine = 'BLENDER_WORKBENCH'
+
 scene = bpy.context.scene
 scene.display.shading.color_type = 'TEXTURE'

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [30887fc387e] master: Cycles: add function to clear resumable chunk

2019-05-10 Thread Brecht Van Lommel
Commit: 30887fc387e8b86fa97fbd64141993950124f0a7
Author: Brecht Van Lommel
Date:   Fri May 10 23:32:58 2019 +0200
Branches: master
https://developer.blender.org/rB30887fc387e8b86fa97fbd64141993950124f0a7

Cycles: add function to clear resumable chunk

===

M   intern/cycles/blender/blender_python.cpp

===

diff --git a/intern/cycles/blender/blender_python.cpp 
b/intern/cycles/blender/blender_python.cpp
index ffd1c70a4e4..3ab8c8bd6d9 100644
--- a/intern/cycles/blender/blender_python.cpp
+++ b/intern/cycles/blender/blender_python.cpp
@@ -937,6 +937,15 @@ static PyObject *set_resumable_chunk_range_func(PyObject * 
/*self*/, PyObject *a
   Py_RETURN_NONE;
 }
 
+static PyObject *clear_resumable_chunk_func(PyObject * /*self*/, PyObject * 
/*value*/)
+{
+  VLOG(1) << "Clear resumable render";
+  BlenderSession::num_resumable_chunks = 0;
+  BlenderSession::current_resumable_chunk = 0;
+
+  Py_RETURN_NONE;
+}
+
 static PyObject *enable_print_stats_func(PyObject * /*self*/, PyObject * 
/*args*/)
 {
   BlenderSession::print_render_stats = true;
@@ -992,6 +1001,7 @@ static PyMethodDef methods[] = {
 /* Resumable render */
 {"set_resumable_chunk", set_resumable_chunk_func, METH_VARARGS, ""},
 {"set_resumable_chunk_range", set_resumable_chunk_range_func, 
METH_VARARGS, ""},
+{"clear_resumable_chunk", clear_resumable_chunk_func, METH_NOARGS, ""},
 
 /* Compute Device selection */
 {"get_device_types", get_device_types_func, METH_VARARGS, ""},

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [93901e7f0a0] master: Tests: speed up render tests by running multiple in the same process

2019-05-10 Thread Brecht Van Lommel
Commit: 93901e7f0a05ba471f3b4c0201500d9dfcd68c2c
Author: Brecht Van Lommel
Date:   Fri May 10 23:00:35 2019 +0200
Branches: master
https://developer.blender.org/rB93901e7f0a05ba471f3b4c0201500d9dfcd68c2c

Tests: speed up render tests by running multiple in the same process

Blender startup time and shader compilation is a big factor when running
hundreds of tests, so now all renders in the same ctest run in the same
process. If a test crashes, the remaining tests in the same category will
be marked as skipped.

Benchmarked on a quad core with ctest -j8.

cycles: 118.1s -> 94.3s
eevee: 66.2s -> 29.2s
workbench: 31.7s -> 8.6s

===

M   tests/python/cycles_render_tests.py
M   tests/python/eevee_render_tests.py
M   tests/python/modules/render_report.py
M   tests/python/opengl_draw_tests.py
M   tests/python/workbench_render_tests.py

===

diff --git a/tests/python/cycles_render_tests.py 
b/tests/python/cycles_render_tests.py
index 36f5459c2f7..a66409d85c3 100755
--- a/tests/python/cycles_render_tests.py
+++ b/tests/python/cycles_render_tests.py
@@ -9,77 +9,76 @@ import subprocess
 import sys
 
 
-def render_file(filepath, output_filepath):
-dirname = os.path.dirname(filepath)
-basedir = os.path.dirname(dirname)
-subject = os.path.basename(dirname)
-
-frame_filepath = output_filepath + '0001.png'
-
-common_args = [
-"-noaudio",
-"--factory-startup",
-"--enable-autoexec",
-filepath,
-"-E", "CYCLES",
-"-o", output_filepath,
-"-F", "PNG"]
+def render_files(filepaths, output_filepaths):
+command = [BLENDER, "--background"]
 
 # OSL and GPU examples
 # custom_args += ["--python-expr", "import bpy; 
bpy.context.scene.cycles.shading_system = True"]
 # custom_args += ["--python-expr", "import bpy; 
bpy.context.scene.cycles.device = 'GPU'"]
 custom_args = os.getenv('CYCLESTEST_ARGS')
 custom_args = shlex.split(custom_args) if custom_args else []
-common_args += custom_args
-
-if subject == 'opengl':
-command = [BLENDER, "--window-geometry", "0", "0", "1", "1"]
-command += common_args
-command += ['--python', os.path.join(basedir, "util", 
"render_opengl.py")]
-elif subject == 'bake':
-command = [BLENDER, "--background"]
-command += common_args
-command += ['--python', os.path.join(basedir, "util", 
"render_bake.py")]
-elif subject == 'denoise_animation':
-command = [BLENDER, "--background"]
-command += common_args
-command += ['--python', os.path.join(basedir, "util", 
"render_denoise.py")]
-else:
-command = [BLENDER, "--background"]
-command += common_args
-command += ["-f", "1"]
 
+for filepath, output_filepath in zip(filepaths, output_filepaths):
+dirname = os.path.dirname(filepath)
+basedir = os.path.dirname(dirname)
+subject = os.path.basename(dirname)
+
+frame_filepath = output_filepath + '0001.png'
+
+common_args = [
+"-noaudio",
+"--factory-startup",
+"--enable-autoexec",
+filepath,
+"-E", "CYCLES",
+"-o", output_filepath,
+"-F", "PNG"]
+
+common_args += custom_args
+
+if subject == 'bake':
+command.extend(common_args)
+command.extend(['--python', os.path.join(basedir, "util", 
"render_bake.py")])
+elif subject == 'denoise_animation':
+command.extend(common_args)
+command.extend(['--python', os.path.join(basedir, "util", 
"render_denoise.py")])
+else:
+command.extend(common_args)
+command.extend(["-f", "1"])
+
+error = None
 try:
 # Success
 output = subprocess.check_output(command)
-if os.path.exists(frame_filepath):
-shutil.copy(frame_filepath, output_filepath)
-os.remove(frame_filepath)
 if VERBOSE:
 print(" ".join(command))
 print(output.decode("utf-8"))
-return None
 except subprocess.CalledProcessError as e:
 # Error
-if os.path.exists(frame_filepath):
-os.remove(frame_filepath)
 if VERBOSE:
 print(" ".join(command))
 print(e.output.decode("utf-8"))
-if b"Error: engine not found" in e.output:
-return "NO_ENGINE"
-elif b"blender probably wont start" in e.output:
-return "NO_START"
-return "CRASH"
+error = "CRASH"
 except BaseException as e:
 # Crash
-if os.path.exists(frame_filepath):
-os.remove(frame_filepath)
 if VERBOSE:
 print(" ".join(command))
-print(e)
-return "CRASH"
+print(e.decode("utf-8"))
+error = "CRASH"
+
+ 

[Bf-blender-cvs] [8096f36796a] master: Audaspace: porting changes from upstream.

2019-05-10 Thread Jörg Müller
Commit: 8096f36796ae07a1a76e99abbaf216ab29260b74
Author: Jörg Müller
Date:   Fri May 10 23:01:04 2019 +0200
Branches: master
https://developer.blender.org/rB8096f36796ae07a1a76e99abbaf216ab29260b74

Audaspace: porting changes from upstream.

- Silence now has an optional sample rate parameter.
- Fix: wrong length reported by modulator and superpose.
- Minor formatting, include and documentation fixes.

===

M   extern/audaspace/bindings/C/AUD_Sound.cpp
M   extern/audaspace/bindings/C/AUD_Sound.h
M   extern/audaspace/bindings/C/AUD_Special.cpp
M   extern/audaspace/bindings/python/PySequence.cpp
M   extern/audaspace/bindings/python/PySound.cpp
M   extern/audaspace/include/generator/Silence.h
M   extern/audaspace/include/generator/SilenceReader.h
M   extern/audaspace/include/generator/Sine.h
M   extern/audaspace/src/fx/DynamicMusic.cpp
M   extern/audaspace/src/fx/ModulatorReader.cpp
M   extern/audaspace/src/generator/Silence.cpp
M   extern/audaspace/src/generator/SilenceReader.cpp
M   extern/audaspace/src/sequence/SuperposeReader.cpp

===

diff --git a/extern/audaspace/bindings/C/AUD_Sound.cpp 
b/extern/audaspace/bindings/C/AUD_Sound.cpp
index 00a59f4c67f..8c99ce2341f 100644
--- a/extern/audaspace/bindings/C/AUD_Sound.cpp
+++ b/extern/audaspace/bindings/C/AUD_Sound.cpp
@@ -277,9 +277,9 @@ AUD_API AUD_Sound* AUD_Sound_sawtooth(float frequency, 
AUD_SampleRate rate)
return new AUD_Sound(new Sawtooth(frequency, rate));
 }
 
-AUD_API AUD_Sound*AUD_Sound_silence()
+AUD_API AUD_Sound* AUD_Sound_silence(AUD_SampleRate rate)
 {
-   return new AUD_Sound(new Silence());
+   return new AUD_Sound(new Silence(rate));
 }
 
 AUD_API AUD_Sound* AUD_Sound_sine(float frequency, AUD_SampleRate rate)
diff --git a/extern/audaspace/bindings/C/AUD_Sound.h 
b/extern/audaspace/bindings/C/AUD_Sound.h
index 66d6c53cc37..53172616781 100644
--- a/extern/audaspace/bindings/C/AUD_Sound.h
+++ b/extern/audaspace/bindings/C/AUD_Sound.h
@@ -113,9 +113,10 @@ extern AUD_API AUD_Sound* AUD_Sound_sawtooth(float 
frequency, AUD_SampleRate rat
 
 /**
  * Creates a quiet sound.
+ * \param rate The sample rate of the silence sound.
  * \return A handle of the sound.
  */
-extern AUD_API AUD_Sound* AUD_Sound_silence();
+extern AUD_API AUD_Sound* AUD_Sound_silence(AUD_SampleRate rate);
 
 /**
  * Creates a sine sound.
diff --git a/extern/audaspace/bindings/C/AUD_Special.cpp 
b/extern/audaspace/bindings/C/AUD_Special.cpp
index f8f46651231..30148fa1487 100644
--- a/extern/audaspace/bindings/C/AUD_Special.cpp
+++ b/extern/audaspace/bindings/C/AUD_Special.cpp
@@ -177,11 +177,11 @@ static void pauseSound(AUD_Handle* handle)
 
 AUD_API AUD_Handle* AUD_pauseAfter(AUD_Handle* handle, float seconds)
 {
-   std::shared_ptr silence = std::shared_ptr(new Silence);
-   std::shared_ptr limiter = std::shared_ptr(new 
Limiter(silence, 0, seconds));
-
auto device = DeviceManager::getDevice();
 
+   std::shared_ptr silence = std::shared_ptr(new 
Silence(device->getSpecs().rate));
+   std::shared_ptr limiter = std::shared_ptr(new 
Limiter(silence, 0, seconds));
+
std::lock_guard lock(*device);
 
try
diff --git a/extern/audaspace/bindings/python/PySequence.cpp 
b/extern/audaspace/bindings/python/PySequence.cpp
index d4773c743ee..e574d76bea1 100644
--- a/extern/audaspace/bindings/python/PySequence.cpp
+++ b/extern/audaspace/bindings/python/PySequence.cpp
@@ -100,7 +100,7 @@ Sequence_new(PyTypeObject* type, PyObject* args, PyObject* 
kwds)
 
 PyDoc_STRVAR(M_aud_Sequence_add_doc,
 "add()\n\n"
-"Adds a new entry to the scene.\n"
+"Adds a new entry to the sequence.\n\n"
 ":arg sound: The sound this entry should play.\n"
 ":type sound: :class:`Sound`\n"
 ":arg begin: The start time.\n"
@@ -151,8 +151,8 @@ Sequence_add(Sequence* self, PyObject* args, PyObject* kwds)
 }
 
 PyDoc_STRVAR(M_aud_Sequence_remove_doc,
-"reomve()\n\n"
-"Adds a new entry to the scene.\n"
+"remove()\n\n"
+"Removes an entry from the sequence.\n\n"
 ":arg entry: The entry to remove.\n"
 ":type entry: :class:`SequenceEntry`\n");
 
@@ -579,7 +579,7 @@ static PyGetSetDef Sequence_properties[] = {
 };
 
 PyDoc_STRVAR(M_aud_Sequence_doc,
-"This sound represents sequenced entries to play a 
sound scene.");
+"This sound represents sequenced entries to play a 
sound sequence.");
 
 extern PyTypeObject SoundType;
 
diff --git a/extern/audaspace/bindings/python/PySound.cpp 
b/extern/audaspace/bindings/python/PySound.cpp
index 17fcdbeb938..c589e7110cb 

[Bf-blender-cvs] [243fbf1c4ba] master: Tests: Be more explicit about the required location of the tests folder.

2019-05-10 Thread Ray Molenkamp
Commit: 243fbf1c4bacf82dd30dc9068ac634343d5b6ad6
Author: Ray Molenkamp
Date:   Fri May 10 14:19:29 2019 -0600
Branches: master
https://developer.blender.org/rB243fbf1c4bacf82dd30dc9068ac634343d5b6ad6

Tests: Be more explicit about the required location of the tests folder.

===

M   tests/python/CMakeLists.txt

===

diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt
index b7f04a65dcd..d3cafe10f97 100644
--- a/tests/python/CMakeLists.txt
+++ b/tests/python/CMakeLists.txt
@@ -578,7 +578,7 @@ if(OPENIMAGEIO_IDIFF AND EXISTS 
"${TEST_SRC_DIR}/render/shader")
   add_cycles_render_test(sss)
   add_cycles_render_test(volume)
 elseif(WITH_CYCLES)
-  MESSAGE(STATUS "Disabling Cycles tests because tests folder does not exist")
+  MESSAGE(STATUS "Disabling Cycles tests because tests folder does not exist 
at ${TEST_SRC_DIR}")
 endif()
 
 if(WITH_OPENGL_DRAW_TESTS)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [d06aedc2451] fluid-mantaflow: Mantaflow: Fix for smoke emission from particles

2019-05-10 Thread Sebastián Barschkis
Commit: d06aedc2451ff2c4adfd12cf38cf30f61e469f38
Author: Sebastián Barschkis
Date:   Fri May 10 19:59:32 2019 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rBd06aedc2451ff2c4adfd12cf38cf30f61e469f38

Mantaflow: Fix for smoke emission from particles

===

M   intern/mantaflow/extern/manta_fluid_API.h
M   intern/mantaflow/intern/FLUID.cpp
M   intern/mantaflow/intern/FLUID.h
M   intern/mantaflow/intern/manta_develop/preprocessed/omp/gitinfo.h
M   
intern/mantaflow/intern/manta_develop/preprocessed/omp/plugin/initplugins.cpp
M   intern/mantaflow/intern/manta_develop/preprocessed/tbb/gitinfo.h
M   
intern/mantaflow/intern/manta_develop/preprocessed/tbb/plugin/initplugins.cpp
M   intern/mantaflow/intern/manta_fluid_API.cpp
M   intern/mantaflow/intern/strings/liquid_script.h
M   intern/mantaflow/intern/strings/smoke_script.h
M   source/blender/blenkernel/intern/smoke.c

===

diff --git a/intern/mantaflow/extern/manta_fluid_API.h 
b/intern/mantaflow/extern/manta_fluid_API.h
index af352765e8e..dab80f3d7f1 100644
--- a/intern/mantaflow/extern/manta_fluid_API.h
+++ b/intern/mantaflow/extern/manta_fluid_API.h
@@ -160,6 +160,7 @@ float *smoke_get_color_g_in(struct FLUID *smoke);
 float *smoke_get_color_b_in(struct FLUID *smoke);
 float *smoke_get_fuel_in(struct FLUID *smoke);
 float *smoke_get_react_in(struct FLUID *smoke);
+float *smoke_get_emission_in(struct FLUID *smoke);
 int smoke_has_heat(struct FLUID *smoke);
 int smoke_has_fuel(struct FLUID *smoke);
 int smoke_has_colors(struct FLUID *smoke);
diff --git a/intern/mantaflow/intern/FLUID.cpp 
b/intern/mantaflow/intern/FLUID.cpp
index 25b175a3cdc..fc3f1045c08 100644
--- a/intern/mantaflow/intern/FLUID.cpp
+++ b/intern/mantaflow/intern/FLUID.cpp
@@ -112,6 +112,7 @@ FLUID::FLUID(int *res, SmokeModifierData *smd) : 
mCurrentID(++solverID)
   mColorBIn = NULL;
   mFuelIn = NULL;
   mReactIn = NULL;
+  mEmissionIn = NULL;
 
   // Smoke high res grids
   mDensityHigh = NULL;
@@ -2339,6 +2340,8 @@ void FLUID::updatePointers()
 pyObjectToString(callPythonFunction("densityIn" + solver_ext, func)));
 mShadow = (float *)stringToPointer(
 pyObjectToString(callPythonFunction("shadow" + solver_ext, func)));
+mEmissionIn = (float *)stringToPointer(
+pyObjectToString(callPythonFunction("emissionIn" + solver_ext, func)));
 
 if (mUsingHeat) {
   mHeat = (float *)stringToPointer(
diff --git a/intern/mantaflow/intern/FLUID.h b/intern/mantaflow/intern/FLUID.h
index 1b0ad95ed01..bb9330b43a6 100644
--- a/intern/mantaflow/intern/FLUID.h
+++ b/intern/mantaflow/intern/FLUID.h
@@ -315,6 +315,10 @@ struct FLUID {
   {
 return mReactIn;
   }
+  inline float *getEmissionIn()
+  {
+return mEmissionIn;
+  }
 
   inline float *getDensityHigh()
   {
@@ -706,6 +710,7 @@ struct FLUID {
   float *mHeatIn;
   float *mFuelIn;
   float *mReactIn;
+  float *mEmissionIn;
   float *mColorRIn;
   float *mColorGIn;
   float *mColorBIn;
diff --git a/intern/mantaflow/intern/manta_develop/preprocessed/omp/gitinfo.h 
b/intern/mantaflow/intern/manta_develop/preprocessed/omp/gitinfo.h
index 909d5d4705c..36fec6f4536 100644
--- a/intern/mantaflow/intern/manta_develop/preprocessed/omp/gitinfo.h
+++ b/intern/mantaflow/intern/manta_develop/preprocessed/omp/gitinfo.h
@@ -1,4 +1,4 @@
 
 
-#define MANTA_GIT_VERSION "commit 502e822aabe6f7aec7cc84525fb42b778b452704" 
+#define MANTA_GIT_VERSION "commit 992e0d22b10e7a67da0941e0892dbf27863a5048" 
 
diff --git 
a/intern/mantaflow/intern/manta_develop/preprocessed/omp/plugin/initplugins.cpp 
b/intern/mantaflow/intern/manta_develop/preprocessed/omp/plugin/initplugins.cpp
index 895bc2d8596..1678c1c90c9 100644
--- 
a/intern/mantaflow/intern/manta_develop/preprocessed/omp/plugin/initplugins.cpp
+++ 
b/intern/mantaflow/intern/manta_develop/preprocessed/omp/plugin/initplugins.cpp
@@ -324,13 +324,14 @@ extern "C" {
 
 
  struct KnApplyEmission : public KernelBase {
- KnApplyEmission(const FlagGrid& flags, Grid& target, const Grid& 
source, bool isAbsolute, int type) :  KernelBase(,0) 
,flags(flags),target(target),source(source),isAbsolute(isAbsolute),type(type)   
{
+ KnApplyEmission(const FlagGrid& flags, Grid& target, const Grid& 
source, const Grid* emissionTexture, bool isAbsolute, int type) :  
KernelBase(,0) 
,flags(flags),target(target),source(source),emissionTexture(emissionTexture),isAbsolute(isAbsolute),type(type)
   {
  runMessage(); run(); }
-  inline void op(int i, int j, int k, const FlagGrid& flags, Grid& 
target, const Grid& source, bool isAbsolute, int type )  {
-   // if type is given, ony check apply emission when celltype matches 
type from flaggrid
+  inline void op(int i, int j, int k, const FlagGrid& flags, Grid& 
target, const Grid& source, const Grid* emissionTexture, bool 
isAbsolute, int type )  {
+   // if type is 

[Bf-blender-cvs] [df429946527] master: Cleanup: Remove unused functions

2019-05-10 Thread Sergey Sharybin
Commit: df4299465279a84448c8cdc15a29a29b81b7b536
Author: Sergey Sharybin
Date:   Fri May 10 17:26:16 2019 +0200
Branches: master
https://developer.blender.org/rBdf4299465279a84448c8cdc15a29a29b81b7b536

Cleanup: Remove unused functions

===

M   source/blender/blenkernel/BKE_curve.h
M   source/blender/blenkernel/BKE_displist.h
M   source/blender/blenkernel/intern/curve.c
M   source/blender/blenkernel/intern/displist.c

===

diff --git a/source/blender/blenkernel/BKE_curve.h 
b/source/blender/blenkernel/BKE_curve.h
index 4eaa0fbe057..b6b9d74b95e 100644
--- a/source/blender/blenkernel/BKE_curve.h
+++ b/source/blender/blenkernel/BKE_curve.h
@@ -134,10 +134,6 @@ void BKE_curve_editNurb_keyIndex_free(struct GHash 
**keyindex);
 void BKE_curve_editNurb_free(struct Curve *cu);
 struct ListBase *BKE_curve_editNurbs_get(struct Curve *cu);
 
-float *BKE_curve_make_orco(struct Depsgraph *depsgraph,
-   struct Scene *scene,
-   struct Object *ob,
-   int *r_numVerts);
 float *BKE_curve_surf_make_orco(struct Object *ob);
 
 void BKE_curve_bevelList_free(struct ListBase *bev);
diff --git a/source/blender/blenkernel/BKE_displist.h 
b/source/blender/blenkernel/BKE_displist.h
index 9bf5a2f9971..91033fc61d5 100644
--- a/source/blender/blenkernel/BKE_displist.h
+++ b/source/blender/blenkernel/BKE_displist.h
@@ -101,11 +101,6 @@ void BKE_displist_make_curveTypes_forRender(struct 
Depsgraph *depsgraph,
 const bool for_orco,
 const bool use_render_resolution,
 struct LinkNode *ob_cyclic_list);
-void BKE_displist_make_curveTypes_forOrco(struct Depsgraph *depsgraph,
-  struct Scene *scene,
-  struct Object *ob,
-  struct ListBase *dispbase,
-  struct LinkNode *ob_cyclic_list);
 void BKE_displist_make_mball(struct Depsgraph *depsgraph, struct Scene *scene, 
struct Object *ob);
 void BKE_displist_make_mball_forRender(struct Depsgraph *depsgraph,
struct Scene *scene,
diff --git a/source/blender/blenkernel/intern/curve.c 
b/source/blender/blenkernel/intern/curve.c
index dc677449a4c..388a2d3a926 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -1737,232 +1737,6 @@ static void forward_diff_bezier_cotangent(const float 
p0[3],
   }
 }
 
-/* ~~ */
-
-float *BKE_curve_surf_make_orco(Object *ob)
-{
-  /* Note: this function is used in convertblender only atm, so
-   * suppose nonzero curve's render resolution should always be used */
-  Curve *cu = ob->data;
-  Nurb *nu;
-  int a, b, tot = 0;
-  int sizeu, sizev;
-  int resolu, resolv;
-  float *fp, *coord_array;
-
-  /* first calculate the size of the datablock */
-  nu = cu->nurb.first;
-  while (nu) {
-/* as we want to avoid the seam in a cyclic nurbs
- * texture wrapping, reserve extra orco data space to save these extra 
needed
- * vertex based UV coordinates for the meridian vertices.
- * Vertices on the 0/2pi boundary are not duplicated inside the displist 
but later in
- * the renderface/vert construction.
- *
- * See also convertblender.c: init_render_surf()
- */
-
-resolu = cu->resolu_ren ? cu->resolu_ren : nu->resolu;
-resolv = cu->resolv_ren ? cu->resolv_ren : nu->resolv;
-
-sizeu = nu->pntsu * resolu;
-sizev = nu->pntsv * resolv;
-if (nu->flagu & CU_NURB_CYCLIC) {
-  sizeu++;
-}
-if (nu->flagv & CU_NURB_CYCLIC) {
-  sizev++;
-}
-if (nu->pntsv > 1) {
-  tot += sizeu * sizev;
-}
-
-nu = nu->next;
-  }
-  /* makeNurbfaces wants zeros */
-  fp = coord_array = MEM_calloc_arrayN(tot, 3 * sizeof(float), "make_orco");
-
-  nu = cu->nurb.first;
-  while (nu) {
-resolu = cu->resolu_ren ? cu->resolu_ren : nu->resolu;
-resolv = cu->resolv_ren ? cu->resolv_ren : nu->resolv;
-
-if (nu->pntsv > 1) {
-  sizeu = nu->pntsu * resolu;
-  sizev = nu->pntsv * resolv;
-
-  if (nu->flagu & CU_NURB_CYCLIC) {
-sizeu++;
-  }
-  if (nu->flagv & CU_NURB_CYCLIC) {
-sizev++;
-  }
-
-  if (cu->flag & CU_UV_ORCO) {
-for (b = 0; b < sizeu; b++) {
-  for (a = 0; a < sizev; a++) {
-
-if (sizev < 2) {
-  fp[0] = 0.0f;
-}
-else {
-  fp[0] = -1.0f + 2.0f * ((float)a) / (sizev - 1);
-}
-
-if (sizeu < 2) {
-  fp[1] = 0.0f;
-}
-else {
-  fp[1] = -1.0f + 2.0f * ((float)b) / (sizeu - 1);
-}
-
- 

[Bf-blender-cvs] [414ed446dae] master: Cleanup: Use const qualifier for curve utilities

2019-05-10 Thread Sergey Sharybin
Commit: 414ed446daec16af74b801d60bf99f976b53a59b
Author: Sergey Sharybin
Date:   Fri May 10 17:12:33 2019 +0200
Branches: master
https://developer.blender.org/rB414ed446daec16af74b801d60bf99f976b53a59b

Cleanup: Use const qualifier for curve utilities

===

M   source/blender/blenkernel/BKE_curve.h
M   source/blender/blenkernel/intern/curve.c

===

diff --git a/source/blender/blenkernel/BKE_curve.h 
b/source/blender/blenkernel/BKE_curve.h
index b6b9d74b95e..66c03550df9 100644
--- a/source/blender/blenkernel/BKE_curve.h
+++ b/source/blender/blenkernel/BKE_curve.h
@@ -208,9 +208,9 @@ void BKE_nurb_knot_calc_u(struct Nurb *nu);
 void BKE_nurb_knot_calc_v(struct Nurb *nu);
 
 /* nurb checks if they can be drawn, also clamp order func */
-bool BKE_nurb_check_valid_u(struct Nurb *nu);
-bool BKE_nurb_check_valid_v(struct Nurb *nu);
-bool BKE_nurb_check_valid_uv(struct Nurb *nu);
+bool BKE_nurb_check_valid_u(const struct Nurb *nu);
+bool BKE_nurb_check_valid_v(const struct Nurb *nu);
+bool BKE_nurb_check_valid_uv(const struct Nurb *nu);
 
 bool BKE_nurb_order_clamp_u(struct Nurb *nu);
 bool BKE_nurb_order_clamp_v(struct Nurb *nu);
diff --git a/source/blender/blenkernel/intern/curve.c 
b/source/blender/blenkernel/intern/curve.c
index 388a2d3a926..e15e645694c 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -4754,7 +4754,7 @@ void BKE_curve_nurbs_keyVertexTilts_apply(ListBase *lb, 
float *key)
   }
 }
 
-bool BKE_nurb_check_valid_u(struct Nurb *nu)
+bool BKE_nurb_check_valid_u(const Nurb *nu)
 {
   if (nu->pntsu <= 1) {
 return false;
@@ -4781,7 +4781,7 @@ bool BKE_nurb_check_valid_u(struct Nurb *nu)
   }
   return true;
 }
-bool BKE_nurb_check_valid_v(struct Nurb *nu)
+bool BKE_nurb_check_valid_v(const Nurb *nu)
 {
   if (nu->pntsv <= 1) {
 return false;
@@ -4809,7 +4809,7 @@ bool BKE_nurb_check_valid_v(struct Nurb *nu)
   return true;
 }
 
-bool BKE_nurb_check_valid_uv(struct Nurb *nu)
+bool BKE_nurb_check_valid_uv(const Nurb *nu)
 {
   if (!BKE_nurb_check_valid_u(nu)) {
 return false;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [93aecd2b810] master: Cleanup: Remove old deprecated DerivedMesh functions

2019-05-10 Thread Sergey Sharybin
Commit: 93aecd2b8107709e117975ebd504cb6b170b79dc
Author: Sergey Sharybin
Date:   Fri May 10 17:28:21 2019 +0200
Branches: master
https://developer.blender.org/rB93aecd2b8107709e117975ebd504cb6b170b79dc

Cleanup: Remove old deprecated DerivedMesh functions

Were ifdef-ed for a long time.

===

M   source/blender/blenkernel/intern/displist.c

===

diff --git a/source/blender/blenkernel/intern/displist.c 
b/source/blender/blenkernel/intern/displist.c
index c228595b6e8..e9ffe25bfb5 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -1199,136 +1199,6 @@ static void displist_surf_indices(DispList *dl)
   }
 }
 
-/* XXX2.8(Sybren): unused function; impossible to test after porting to Mesh */
-#ifdef WITH_DERIVEDMESH_DEPRECATED_FUNCS
-static DerivedMesh *create_orco_dm(Depsgraph *depsgraph, Scene *scene, Object 
*ob)
-{
-  DerivedMesh *dm;
-  ListBase disp = {NULL, NULL};
-
-  /* OrcoDM should be created from underformed disp lists */
-  BKE_displist_make_curveTypes_forOrco(depsgraph, scene, ob, );
-  dm = CDDM_from_curve_displist(ob, );
-
-  BKE_displist_free();
-
-  return dm;
-}
-
-static void add_orco_dm(Object *ob, DerivedMesh *dm, DerivedMesh *orcodm)
-{
-  float(*orco)[3], (*layerorco)[3];
-  int totvert, a;
-  Curve *cu = ob->data;
-
-  totvert = dm->getNumVerts(dm);
-
-  orco = MEM_callocN(sizeof(float) * 3 * totvert, "dm orco");
-
-  if (orcodm->getNumVerts(orcodm) == totvert) {
-orcodm->getVertCos(orcodm, orco);
-  }
-  else {
-dm->getVertCos(dm, orco);
-  }
-
-  for (a = 0; a < totvert; a++) {
-float *co = orco[a];
-co[0] = (co[0] - cu->loc[0]) / cu->size[0];
-co[1] = (co[1] - cu->loc[1]) / cu->size[1];
-co[2] = (co[2] - cu->loc[2]) / cu->size[2];
-  }
-
-  if ((layerorco = DM_get_vert_data_layer(dm, CD_ORCO))) {
-memcpy(layerorco, orco, sizeof(float) * totvert);
-MEM_freeN(orco);
-  }
-  else {
-DM_add_vert_layer(dm, CD_ORCO, CD_ASSIGN, orco);
-  }
-}
-#endif
-
-/* XXX2.8(Sybren): unused function; impossible to test after porting to Mesh */
-#ifdef WITH_DERIVEDMESH_DEPRECATED_FUNCS
-static void curve_calc_orcodm(Depsgraph *depsgraph,
-  Scene *scene,
-  Object *ob,
-  DerivedMesh *dm_final,
-  const bool for_render,
-  const bool use_render_resolution)
-{
-  /* this function represents logic of mesh's orcodm calculation
-   * for displist-based objects
-   */
-  VirtualModifierData virtualModifierData;
-  ModifierData *md = modifiers_getVirtualModifierList(ob, 
);
-  ModifierData *pretessellatePoint;
-  Curve *cu = ob->data;
-  int required_mode;
-  const bool editmode = (!for_render && (cu->editnurb || cu->editfont));
-  DerivedMesh *ndm, *orcodm = NULL;
-  ModifierApplyFlag app_flag = MOD_APPLY_ORCO;
-
-  if (use_render_resolution) {
-app_flag |= MOD_APPLY_RENDER;
-required_mode = eModifierMode_Render;
-  }
-  else {
-required_mode = eModifierMode_Realtime;
-  }
-
-  const ModifierEvalContext mectx = {depsgraph, ob, app_flag};
-
-  pretessellatePoint = curve_get_tessellate_point(scene, ob, 
use_render_resolution, editmode);
-
-  if (editmode) {
-required_mode |= eModifierMode_Editmode;
-  }
-
-  if (pretessellatePoint) {
-md = pretessellatePoint->next;
-  }
-
-  /* If modifiers are disabled, we wouldn't be here because
-   * this function is only called if there're enabled constructive
-   * modifiers applied on the curve.
-   *
-   * This means we can create ORCO DM in advance and assume it's
-   * never NULL.
-   */
-  orcodm = create_orco_dm(depsgraph, scene, ob);
-
-  for (; md; md = md->next) {
-const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
-
-md->scene = scene;
-
-if (!modifier_isEnabled(scene, md, required_mode)) {
-  continue;
-}
-if (mti->type != eModifierTypeType_Constructive) {
-  continue;
-}
-
-ndm = modwrap_applyModifier(md, , orcodm);
-
-if (ndm) {
-  /* if the modifier returned a new dm, release the old one */
-  if (orcodm && orcodm != ndm) {
-orcodm->release(orcodm);
-  }
-  orcodm = ndm;
-}
-  }
-
-  /* add an orco layer if needed */
-  add_orco_dm(ob, dm_final, orcodm);
-
-  orcodm->release(orcodm);
-}
-#endif
-
 void BKE_displist_make_surf(Depsgraph *depsgraph,
 Scene *scene,
 Object *ob,

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [e7e14934f85] master: UI: allow to cancel editing of vector widgets with escape and RMB

2019-05-10 Thread Alessio Monti di Sopra
Commit: e7e14934f850e60c007b64b6bf469e09503d0886
Author: Alessio Monti di Sopra
Date:   Fri May 10 17:21:24 2019 +0200
Branches: master
https://developer.blender.org/rBe7e14934f850e60c007b64b6bf469e09503d0886

UI: allow to cancel editing of vector widgets with escape and RMB

Differential Revision: https://developer.blender.org/D4838

===

M   source/blender/editors/interface/interface_handlers.c

===

diff --git a/source/blender/editors/interface/interface_handlers.c 
b/source/blender/editors/interface/interface_handlers.c
index fe70509d4c2..3cc478c99f2 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -5622,6 +5622,13 @@ static int ui_do_but_UNITVEC(
 }
   }
 }
+else if (event->type == ESCKEY || event->type == RIGHTMOUSE) {
+  if (event->val == KM_PRESS) {
+data->cancel = true;
+data->escapecancel = true;
+button_activate_state(C, but, BUTTON_STATE_EXIT);
+  }
+}
 else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) {
   button_activate_state(C, but, BUTTON_STATE_EXIT);
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [7bf1eca4953] master: Fix T64338: make snap menu in 2.7x keymap use regular instead of pie menu

2019-05-10 Thread Carlo Andreacchio
Commit: 7bf1eca4953509db231912a5a516ec87514fdd75
Author: Carlo Andreacchio
Date:   Fri May 10 17:22:26 2019 +0200
Branches: master
https://developer.blender.org/rB7bf1eca4953509db231912a5a516ec87514fdd75

Fix T64338: make snap menu in 2.7x keymap use regular instead of pie menu

Differential Revision: https://developer.blender.org/D4835

===

M   release/scripts/presets/keyconfig/keymap_data/blender_default.py

===

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py 
b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 881d388e3d0..66304fb8e03 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -1048,8 +1048,6 @@ def km_view3d(params):
 # Copy/paste.
 ("view3d.copybuffer", {"type": 'C', "value": 'PRESS', "ctrl": True}, 
None),
 ("view3d.pastebuffer", {"type": 'V', "value": 'PRESS', "ctrl": True}, 
None),
-# Menus.
-op_menu_pie("VIEW3D_MT_snap_pie", {"type": 'S', "value": 'PRESS', 
"shift": True}),
 # Transform.
 ("transform.translate", {"type": 'G', "value": 'PRESS'}, None),
 ("transform.translate", {"type": params.select_tweak, "value": 'ANY'}, 
None),
@@ -1069,6 +1067,7 @@ def km_view3d(params):
 if not params.legacy:
 # New pie menus.
 items.extend([
+op_menu_pie("VIEW3D_MT_snap_pie", {"type": 'S', "value": 'PRESS', 
"shift": True}),
 ("wm.context_toggle", {"type": 'ACCENT_GRAVE', "value": 'PRESS', 
"ctrl": True},
  {"properties": [("data_path", 'space_data.show_gizmo_context')]}),
 op_menu_pie("VIEW3D_MT_pivot_pie", {"type": 'PERIOD', "value": 
'PRESS'}),
@@ -1089,6 +1088,7 @@ def km_view3d(params):
 else:
 items.extend([
 # Old navigation.
+op_menu("VIEW3D_MT_snap", {"type": 'S', "value": 'PRESS', "shift": 
True}),
 ("view3d.view_lock_to_active", {"type": 'NUMPAD_PERIOD', "value": 
'PRESS', "shift": True}, None),
 ("view3d.view_lock_clear", {"type": 'NUMPAD_PERIOD', "value": 
'PRESS', "alt": True}, None),
 ("view3d.navigate", {"type": 'F', "value": 'PRESS', "shift": 
True}, None),

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [1813b26bbc5] master: Fix T64434: error with save system info after recent changes

2019-05-10 Thread George Vogiatzis
Commit: 1813b26bbc5d0714ad32a1e8e9de91c76dda80da
Author: George Vogiatzis
Date:   Fri May 10 17:15:05 2019 +0200
Branches: master
https://developer.blender.org/rB1813b26bbc5d0714ad32a1e8e9de91c76dda80da

Fix T64434: error with save system info after recent changes

Differential Revision: https://developer.blender.org/D4839

===

M   release/scripts/startup/bl_operators/wm.py

===

diff --git a/release/scripts/startup/bl_operators/wm.py 
b/release/scripts/startup/bl_operators/wm.py
index 9a139c83d65..85f4f89d01e 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -1404,7 +1404,7 @@ class WM_OT_sysinfo(Operator):
 sys_info.write_sysinfo(self.filepath)
 return {'FINISHED'}
 
-def invoke(self, _context, _event):
+def invoke(self, context, _event):
 import os
 
 if not self.filepath:

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [7a3833ed235] master: Fix T64399 Crash when trying to enter edit mode on instanced objects

2019-05-10 Thread Clément Foucault
Commit: 7a3833ed235afbf79d3b11043fbdeb5282574fc0
Author: Clément Foucault
Date:   Fri May 10 16:51:19 2019 +0200
Branches: master
https://developer.blender.org/rB7a3833ed235afbf79d3b11043fbdeb5282574fc0

Fix T64399 Crash when trying to enter edit mode on instanced objects

===

M   source/blender/draw/intern/draw_cache_impl_mesh.c

===

diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c 
b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 92e24e72954..51edac10bb7 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -2078,17 +2078,6 @@ static bool mesh_batch_cache_valid(Mesh *me)
 return false;
   }
 
-  if (cache->is_editmode) {
-return false;
-  }
-  else if ((cache->vert_len != mesh_render_verts_len_get(me)) ||
-   (cache->edge_len != mesh_render_edges_len_get(me)) ||
-   (cache->tri_len != mesh_render_looptri_len_get(me)) ||
-   (cache->poly_len != mesh_render_polys_len_get(me)) ||
-   (cache->mat_len != mesh_render_mat_len_get(me))) {
-return false;
-  }
-
   return true;
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [cd82e3fcd4c] greasepencil-object: Merge branch 'master' into greasepencil-object

2019-05-10 Thread Antonioya
Commit: cd82e3fcd4c2799084787f371e44247b86b17dd9
Author: Antonioya
Date:   Fri May 10 15:32:58 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBcd82e3fcd4c2799084787f371e44247b86b17dd9

Merge branch 'master' into greasepencil-object

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [614c15140fb] temp-prefs-read: Initial support for reading only preferences

2019-05-10 Thread Campbell Barton
Commit: 614c15140fb16a3a577e9f685861306e90ec9a53
Author: Campbell Barton
Date:   Fri May 10 23:14:12 2019 +1000
Branches: temp-prefs-read
https://developer.blender.org/rB614c15140fb16a3a577e9f685861306e90ec9a53

Initial support for reading only preferences

===

M   release/scripts/startup/bl_ui/space_userpref.py
M   source/blender/blenloader/intern/readfile.c
M   source/blender/windowmanager/intern/wm_files.c
M   source/blender/windowmanager/intern/wm_init_exit.c
M   source/blender/windowmanager/intern/wm_operators.c
M   source/blender/windowmanager/wm_files.h

===

diff --git a/release/scripts/startup/bl_ui/space_userpref.py 
b/release/scripts/startup/bl_ui/space_userpref.py
index 46cd4bfa904..5c703a3ffbc 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -81,7 +81,13 @@ class USERPREF_PT_save_preferences(Panel):
 layout.scale_x = 1.3
 layout.scale_y = 1.3
 
-layout.operator("wm.save_userpref")
+col = layout.column(align=True)
+col.operator("wm.save_userpref")
+col.operator("wm.read_userpref")
+col.operator(
+"wm.read_userpref",
+text="Load Factory Preferences",
+).use_factory_settings = True
 
 
 # Panel mix-in.
diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index 227aa6a2ec6..288fa92da38 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -9629,14 +9629,17 @@ BlendFileData *blo_read_file_internal(FileData *fd, 
const char *filepath)
   ListBase mainlist = {NULL, NULL};
 
   bfd = MEM_callocN(sizeof(BlendFileData), "blendfiledata");
-  bfd->main = BKE_main_new();
-  BLI_addtail(, bfd->main);
-  fd->mainlist = 
 
+  bfd->main = BKE_main_new();
   bfd->main->versionfile = fd->fileversion;
 
   bfd->type = BLENFILETYPE_BLEND;
-  BLI_strncpy(bfd->main->name, filepath, sizeof(bfd->main->name));
+
+  if ((fd->skip_flags & BLO_READ_SKIP_DATA) == 0) {
+BLI_addtail(, bfd->main);
+fd->mainlist = 
+BLI_strncpy(bfd->main->name, filepath, sizeof(bfd->main->name));
+  }
 
   if (G.background) {
 /* We only read & store .blend thumbnail in background mode
@@ -9714,45 +9717,52 @@ BlendFileData *blo_read_file_internal(FileData *fd, 
const char *filepath)
 
   /* do before read_libraries, but skip undo case */
   if (fd->memfile == NULL) {
-do_versions(fd, NULL, bfd->main);
-do_versions_userdef(fd, bfd);
+if ((fd->skip_flags & BLO_READ_SKIP_DATA) == 0) {
+  do_versions(fd, NULL, bfd->main);
+}
+
+if ((fd->skip_flags & BLO_READ_SKIP_USERDEF) == 0) {
+  do_versions_userdef(fd, bfd);
+}
   }
 
-  read_libraries(fd, );
+  if ((fd->skip_flags & BLO_READ_SKIP_DATA) == 0) {
+read_libraries(fd, );
 
-  blo_join_main();
+blo_join_main();
 
-  lib_link_all(fd, bfd->main);
+lib_link_all(fd, bfd->main);
 
-  /* Skip in undo case. */
-  if (fd->memfile == NULL) {
-/* Yep, second splitting... but this is a very cheap operation, so no big 
deal. */
-blo_split_main(, bfd->main);
-for (Main *mainvar = mainlist.first; mainvar; mainvar = mainvar->next) {
-  BLI_assert(mainvar->versionfile != 0);
-  do_versions_after_linking(mainvar);
-}
-blo_join_main();
+/* Skip in undo case. */
+if (fd->memfile == NULL) {
+  /* Yep, second splitting... but this is a very cheap operation, so no 
big deal. */
+  blo_split_main(, bfd->main);
+  for (Main *mainvar = mainlist.first; mainvar; mainvar = mainvar->next) {
+BLI_assert(mainvar->versionfile != 0);
+do_versions_after_linking(mainvar);
+  }
+  blo_join_main();
 
-/* After all data has been read and versioned, uses LIB_TAG_NEW. */
-ntreeUpdateAllNew(bfd->main);
-  }
+  /* After all data has been read and versioned, uses LIB_TAG_NEW. */
+  ntreeUpdateAllNew(bfd->main);
+}
 
-  BKE_main_id_tag_all(bfd->main, LIB_TAG_NEW, false);
+BKE_main_id_tag_all(bfd->main, LIB_TAG_NEW, false);
 
-  /* Now that all our data-blocks are loaded,
-   * we can re-generate overrides from their references. */
-  if (fd->memfile == NULL) {
-/* Do not apply in undo case! */
-BKE_main_override_static_update(bfd->main);
-  }
+/* Now that all our data-blocks are loaded,
+ * we can re-generate overrides from their references. */
+if (fd->memfile == NULL) {
+  /* Do not apply in undo case! */
+  BKE_main_override_static_update(bfd->main);
+}
 
-  BKE_collections_after_lib_link(bfd->main);
+BKE_collections_after_lib_link(bfd->main);
 
-  fix_relpaths_library(fd->relabase,
-   bfd->main); /* make all relative paths, relative to the 
open blend file */
+/* Make all relative paths, relative to the open blend 

[Bf-blender-cvs] [1456b413067] master: Fix T64420 Weight Paint colours not visible

2019-05-10 Thread Clément Foucault
Commit: 1456b4130676b709a07e82f40a18ed46c445fe2d
Author: Clément Foucault
Date:   Fri May 10 15:03:18 2019 +0200
Branches: master
https://developer.blender.org/rB1456b4130676b709a07e82f40a18ed46c445fe2d

Fix T64420 Weight Paint colours not visible

===

M   source/blender/draw/intern/draw_cache_impl_mesh.c

===

diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c 
b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 0ccd53fe39e..92e24e72954 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -4296,7 +4296,7 @@ GPUBatch *DRW_mesh_batch_cache_get_loose_edges(Mesh *me)
 GPUBatch *DRW_mesh_batch_cache_get_surface_weights(Mesh *me)
 {
   MeshBatchCache *cache = mesh_batch_cache_get(me);
-  mesh_batch_cache_add_request(cache, MBC_LOOSE_EDGES);
+  mesh_batch_cache_add_request(cache, MBC_SURFACE_WEIGHTS);
   return DRW_batch_request(>batch.surface_weights);
 }
 
@@ -4912,7 +4912,7 @@ void DRW_mesh_batch_cache_create_requested(
 
   if (cache->batch_requested & MBC_SURFACE_WEIGHTS) {
 /* Check vertex weights. */
-if ((cache->batch.surface_weights != 0) && (ts != NULL)) {
+if ((cache->batch.surface_weights != NULL) && (ts != NULL)) {
   struct DRW_MeshWeightState wstate;
   BLI_assert(ob->type == OB_MESH);
   drw_mesh_weight_state_extract(ob, me, ts, is_paint_mode, );

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [c0b8d071a75] master: Fix T64284 Mirrored Instances have flipped normals/face orientation

2019-05-10 Thread Clément Foucault
Commit: c0b8d071a75403c9dcb020420db074e7bb17e887
Author: Clément Foucault
Date:   Fri May 10 14:46:01 2019 +0200
Branches: master
https://developer.blender.org/rBc0b8d071a75403c9dcb020420db074e7bb17e887

Fix T64284 Mirrored Instances have flipped normals/face orientation

It was a missing invert matrix update and also setting the OB_NEG_SCALE.

This defeats the purpose of not computing it in the draw manager but this
is more local and is have not a dramatic impact on performance.

===

M   source/blender/depsgraph/intern/depsgraph_query_iter.cc

===

diff --git a/source/blender/depsgraph/intern/depsgraph_query_iter.cc 
b/source/blender/depsgraph/intern/depsgraph_query_iter.cc
index a9fe7c6d5e7..4bc2ab557ec 100644
--- a/source/blender/depsgraph/intern/depsgraph_query_iter.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query_iter.cc
@@ -158,7 +158,13 @@ bool deg_objects_dupli_iterator_next(BLI_Iterator *iter)
   continue;
 }
 
+/* This could be avoided by refactoring make_dupli() in order to track all 
negative scaling
+ * recursively. */
+bool is_neg_scale = is_negative_m4(dob->mat);
+SET_FLAG_FROM_TEST(data->temp_dupli_object.transflag, is_neg_scale, 
OB_NEG_SCALE);
+
 copy_m4_m4(data->temp_dupli_object.obmat, dob->mat);
+invert_m4_m4(data->temp_dupli_object.imat, data->temp_dupli_object.obmat);
 iter->current = >temp_dupli_object;
 
BLI_assert(DEG::deg_validate_copy_on_write_datablock(>temp_dupli_object.id));
 return true;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [259ebdd0172] master: Fix failing tests when Cycles is enabled

2019-05-10 Thread Brecht Van Lommel
Commit: 259ebdd017255c6ab8bd456d7f654d589b13872b
Author: Brecht Van Lommel
Date:   Fri May 10 13:29:43 2019 +0200
Branches: master
https://developer.blender.org/rB259ebdd017255c6ab8bd456d7f654d589b13872b

Fix failing tests when Cycles is enabled

The --env-system-scripts hack does not work with it, it can't find the cycles
Python module then when importing add-ons.

===

M   tests/python/CMakeLists.txt

===

diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt
index 076b0d958f1..b7f04a65dcd 100644
--- a/tests/python/CMakeLists.txt
+++ b/tests/python/CMakeLists.txt
@@ -15,8 +15,6 @@
 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 # * END GPL LICENSE BLOCK *
 
-# --env-system-scripts allows to run without the install target.
-
 # Use '--write-blend=/tmp/test.blend' to view output
 
 # Some tests are interesting but take too long to run
@@ -35,12 +33,10 @@ execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory 
${TEST_OUT_DIR})
 #~  endif()
 
 # all calls to blender use this
-if(APPLE)
-  if(${CMAKE_GENERATOR} MATCHES "Xcode")
-set(TEST_BLENDER_EXE_PARAMS --background -noaudio --factory-startup)
-  else()
-set(TEST_BLENDER_EXE_PARAMS --background -noaudio --factory-startup 
--env-system-scripts ${CMAKE_SOURCE_DIR}/release/scripts)
-  endif()
+# --env-system-scripts allows to run without the install target, but does
+# not work for all configurations.
+if(WITH_CYCLES OR (APPLE AND (${CMAKE_GENERATOR} MATCHES "Xcode")))
+  set(TEST_BLENDER_EXE_PARAMS --background -noaudio --factory-startup)
 else()
   set(TEST_BLENDER_EXE_PARAMS --background -noaudio --factory-startup 
--env-system-scripts ${CMAKE_SOURCE_DIR}/release/scripts)
 endif()

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [6006f86e07c] master: Workbench: Use common_view_lib.glsl

2019-05-10 Thread Clément Foucault
Commit: 6006f86e07c5732f72015d500ce3e066464e2baa
Author: Clément Foucault
Date:   Fri May 10 00:18:52 2019 +0200
Branches: master
https://developer.blender.org/rB6006f86e07c5732f72015d500ce3e066464e2baa

Workbench: Use common_view_lib.glsl

This removes ModelViewProjectionMatrix usage

===

M   
source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl
M   source/blender/draw/engines/workbench/shaders/workbench_shadow_vert.glsl
M   source/blender/draw/engines/workbench/workbench_deferred.c

===

diff --git 
a/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl 
b/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl
index bb4c4fe4177..2955bcb9cca 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl
@@ -1,8 +1,6 @@
 uniform mat4 ModelMatrix;
 uniform mat4 ModelMatrixInverse;
 
-uniform mat4 ModelViewProjectionMatrix;
-
 #ifndef HAIR_SHADER
 in vec3 pos;
 in vec3 nor;
@@ -47,6 +45,18 @@ vec3 srgb_to_linear_attr(vec3 c)
 }
 #endif
 
+vec3 workbench_hair_hair_normal(vec3 tan, vec3 binor, float rand)
+{
+  /* To "simulate" anisotropic shading, randomize hair normal per strand. */
+  tan = normalize(tan);
+  vec3 nor = normalize(cross(binor, tan));
+  // nor = normalize(mix(nor, -tan, rand * 0.1));
+  // float cos_theta = (rand * 2.0 - 1.0) * 0.2;
+  // float sin_theta = sqrt(max(0.0, 1.0 - cos_theta * cos_theta));
+  // nor = nor * sin_theta + binor * cos_theta;
+  return nor;
+}
+
 void main()
 {
 #ifdef HAIR_SHADER
@@ -54,29 +64,25 @@ void main()
   vec2 uv = hair_get_customdata_vec2(u);
 #  endif
   float time, thick_time, thickness;
-  vec3 pos, tan, binor;
+  vec3 world_pos, tan, binor;
   hair_get_pos_tan_binor_time((ProjectionMatrix[3][3] == 0.0),
   ModelMatrixInverse,
   ViewMatrixInverse[3].xyz,
   ViewMatrixInverse[2].xyz,
-  pos,
+  world_pos,
   tan,
   binor,
   time,
   thickness,
   thick_time);
-  /* To "simulate" anisotropic shading, randomize hair normal per strand. */
+
   hair_rand = integer_noise(hair_get_strand_id());
-  tan = normalize(tan);
-  vec3 nor = normalize(cross(binor, tan));
-  nor = normalize(mix(nor, -tan, hair_rand * 0.10));
-  float cos_theta = (hair_rand * 2.0 - 1.0) * 0.20;
-  float sin_theta = sqrt(max(0.0, 1.0f - cos_theta * cos_theta));
-  nor = nor * sin_theta + binor * cos_theta;
-  gl_Position = ViewProjectionMatrix * vec4(pos, 1.0);
+  vec3 nor = workbench_hair_hair_normal(tan, binor, hair_rand);
 #else
-  gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
+  vec3 world_pos = point_object_to_world(pos);
 #endif
+  gl_Position = point_world_to_ndc(world_pos);
+
 #ifdef V3D_SHADING_TEXTURE_COLOR
   uv_interp = uv;
 #endif
@@ -95,6 +101,6 @@ void main()
 #endif
 
 #ifdef USE_WORLD_CLIP_PLANES
-  world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
+  world_clip_planes_calc_clip_distance(world_pos);
 #endif
 }
diff --git 
a/source/blender/draw/engines/workbench/shaders/workbench_shadow_vert.glsl 
b/source/blender/draw/engines/workbench/shaders/workbench_shadow_vert.glsl
index afd704a7d3a..85145a2dcdc 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_shadow_vert.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_shadow_vert.glsl
@@ -1,6 +1,6 @@
 #define INFINITE 1000.0
 
-uniform mat4 ModelViewProjectionMatrix;
+uniform mat4 ModelMatrix;
 
 uniform vec3 lightDirection = vec3(0.57, 0.57, -0.57);
 uniform float lightDistance = 1e4;
@@ -18,6 +18,6 @@ vData;
 void main()
 {
   vData.pos = pos;
-  vData.frontPosition = ModelViewProjectionMatrix * vec4(pos, 1.0);
-  vData.backPosition = ModelViewProjectionMatrix * vec4(pos + lightDirection * 
lightDistance, 1.0);
+  vData.frontPosition = point_object_to_ndc(pos);
+  vData.backPosition = point_object_to_ndc(pos + lightDirection * 
lightDistance);
 }
diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c 
b/source/blender/draw/engines/workbench/workbench_deferred.c
index e0bf8da438b..bcce507da24 100644
--- a/source/blender/draw/engines/workbench/workbench_deferred.c
+++ b/source/blender/draw/engines/workbench/workbench_deferred.c
@@ -385,33 +385,60 @@ void workbench_deferred_engine_init(WORKBENCH_Data 
*vedata)
 const char *shadow_frag = datatoc_gpu_shader_depth_only_frag_glsl;
 #endif
 /* TODO only compile on demand */
-e_data.shadow_pass_sh = 
DRW_shader_create(datatoc_workbench_shadow_vert_glsl,
-  

[Bf-blender-cvs] [fdddea676d4] master: Cleanup: DRW: Renaming of glsl utility macros

2019-05-10 Thread Clément Foucault
Commit: fdddea676d4fa40668ca82f8ccc5106437d113f2
Author: Clément Foucault
Date:   Thu May 9 15:31:54 2019 +0200
Branches: master
https://developer.blender.org/rBfdddea676d4fa40668ca82f8ccc5106437d113f2

Cleanup: DRW: Renaming of glsl utility macros

===

M   source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl
M   source/blender/draw/engines/eevee/shaders/shadow_vert.glsl
M   
source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl
M   source/blender/draw/modes/shaders/armature_shape_outline_vert.glsl
M   source/blender/draw/modes/shaders/armature_shape_solid_vert.glsl
M   source/blender/draw/modes/shaders/common_view_lib.glsl
M   source/blender/draw/modes/shaders/edit_mesh_overlay_vert.glsl
M   source/blender/draw/modes/shaders/edit_normals_vert.glsl
M   source/blender/draw/modes/shaders/overlay_face_wireframe_vert.glsl
M   source/blender/gpu/shaders/gpu_shader_material.glsl
M   source/blender/nodes/shader/nodes/node_shader_tex_image.c

===

diff --git a/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl 
b/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl
index cddc8e87a1e..68e11f7414c 100644
--- a/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl
+++ b/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl
@@ -63,12 +63,12 @@ void main()
   viewNormal = mat3(ViewMatrix) * worldNormal;
 #else
   gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
-  viewPosition = (ModelViewMatrix * vec4(pos, 1.0)).xyz;
-  worldPosition = (ModelMatrix * vec4(pos, 1.0)).xyz;
+  worldPosition = point_object_to_world(pos);
+  viewPosition = point_world_to_view(worldPosition);
 
-  worldNormal = normalize(transform_normal_object_to_world(nor));
+  worldNormal = normalize(normal_object_to_world(nor));
   /* No need to normalize since this is just a rotation. */
-  viewNormal = transform_normal_world_to_view(worldNormal);
+  viewNormal = normal_world_to_view(worldNormal);
 #endif
 
   /* Used for planar reflections */
diff --git a/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl 
b/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl
index f8850300dc4..baaa43d84b8 100644
--- a/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl
+++ b/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl
@@ -24,9 +24,9 @@ void main()
   viewPosition = (ModelViewMatrix * vec4(pos, 1.0)).xyz;
   worldPosition = (ModelMatrix * vec4(pos, 1.0)).xyz;
 
-  worldNormal = normalize(transform_normal_object_to_world(nor));
+  worldNormal = normalize(normal_object_to_world(nor));
   /* No need to normalize since this is just a rotation. */
-  viewNormal = transform_normal_world_to_view(worldNormal);
+  viewNormal = normal_world_to_view(worldNormal);
 #  ifdef USE_ATTR
   pass_attr(pos);
 #  endif
diff --git 
a/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl 
b/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl
index 1de6121bb5c..bb4c4fe4177 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl
@@ -88,7 +88,7 @@ void main()
 #endif
 
 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
-  normal_viewport = transform_normal_object_to_view(nor);
+  normal_viewport = normal_object_to_view(nor);
 #  ifndef HAIR_SHADER
   normal_viewport = normalize(normal_viewport);
 #  endif
diff --git a/source/blender/draw/modes/shaders/armature_shape_outline_vert.glsl 
b/source/blender/draw/modes/shaders/armature_shape_outline_vert.glsl
index 365f2004e37..fb2735c196c 100644
--- a/source/blender/draw/modes/shaders/armature_shape_outline_vert.glsl
+++ b/source/blender/draw/modes/shaders/armature_shape_outline_vert.glsl
@@ -35,7 +35,7 @@ void main()
   /* TODO FIX: there is still a problem with this vector
* when the bone is scaled or in persp mode. But it's
* barelly visible at the outline corners. */
-  ssNor = normalize(transform_normal_world_to_view(normal_mat * snor).xy);
+  ssNor = normalize(normal_world_to_view(normal_mat * snor).xy);
 
   ssPos = proj(pPos);
 
diff --git a/source/blender/draw/modes/shaders/armature_shape_solid_vert.glsl 
b/source/blender/draw/modes/shaders/armature_shape_solid_vert.glsl
index 4107aab03ff..df6a9ce2d76 100644
--- a/source/blender/draw/modes/shaders/armature_shape_solid_vert.glsl
+++ b/source/blender/draw/modes/shaders/armature_shape_solid_vert.glsl
@@ -15,7 +15,7 @@ void main()
   /* This is slow and run per vertex, but it's still faster than
* doing it per instance on CPU and sending it on via instance attribute. */
   mat3 normal_mat = transpose(inverse(mat3(InstanceModelMatrix)));
-  vec3 normal = normalize(transform_normal_world_to_view(normal_mat * nor));
+  vec3 normal = 

[Bf-blender-cvs] [7f87e6e18f5] master: GPencil: Use common_view_lib.glsl

2019-05-10 Thread Clément Foucault
Commit: 7f87e6e18f5164db82e636c6b5b449d39cc4300c
Author: Clément Foucault
Date:   Thu May 9 22:27:44 2019 +0200
Branches: master
https://developer.blender.org/rB7f87e6e18f5164db82e636c6b5b449d39cc4300c

GPencil: Use common_view_lib.glsl

===

M   source/blender/draw/engines/gpencil/gpencil_engine.c
M   source/blender/draw/engines/gpencil/shaders/gpencil_edit_point_geom.glsl
M   source/blender/draw/engines/gpencil/shaders/gpencil_edit_point_vert.glsl
M   source/blender/draw/engines/gpencil/shaders/gpencil_fill_vert.glsl
M   source/blender/draw/engines/gpencil/shaders/gpencil_point_geom.glsl
M   source/blender/draw/engines/gpencil/shaders/gpencil_point_vert.glsl
M   source/blender/draw/engines/gpencil/shaders/gpencil_stroke_geom.glsl
M   source/blender/draw/engines/gpencil/shaders/gpencil_stroke_vert.glsl

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index ea578187765..33f682b7f63 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -61,6 +61,8 @@ extern char datatoc_gpencil_edit_point_geom_glsl[];
 extern char datatoc_gpencil_edit_point_frag_glsl[];
 extern char datatoc_gpencil_blend_frag_glsl[];
 
+extern char datatoc_common_view_lib_glsl[];
+
 /* *** STATIC *** */
 static GPENCIL_e_data e_data = {NULL}; /* Engine data */
 
@@ -167,31 +169,37 @@ static void GPENCIL_create_shaders(void)
 {
   /* normal fill shader */
   if (!e_data.gpencil_fill_sh) {
-e_data.gpencil_fill_sh = DRW_shader_create(
-datatoc_gpencil_fill_vert_glsl, NULL, datatoc_gpencil_fill_frag_glsl, 
NULL);
+e_data.gpencil_fill_sh = 
DRW_shader_create_with_lib(datatoc_gpencil_fill_vert_glsl,
+NULL,
+
datatoc_gpencil_fill_frag_glsl,
+
datatoc_common_view_lib_glsl,
+NULL);
   }
 
   /* normal stroke shader using geometry to display lines (line mode) */
   if (!e_data.gpencil_stroke_sh) {
-e_data.gpencil_stroke_sh = 
DRW_shader_create(datatoc_gpencil_stroke_vert_glsl,
- 
datatoc_gpencil_stroke_geom_glsl,
- 
datatoc_gpencil_stroke_frag_glsl,
- NULL);
+e_data.gpencil_stroke_sh = 
DRW_shader_create_with_lib(datatoc_gpencil_stroke_vert_glsl,
+  
datatoc_gpencil_stroke_geom_glsl,
+  
datatoc_gpencil_stroke_frag_glsl,
+  
datatoc_common_view_lib_glsl,
+  NULL);
   }
 
   /* dot/rectangle mode for normal strokes using geometry */
   if (!e_data.gpencil_point_sh) {
-e_data.gpencil_point_sh = 
DRW_shader_create(datatoc_gpencil_point_vert_glsl,
-
datatoc_gpencil_point_geom_glsl,
-
datatoc_gpencil_point_frag_glsl,
-NULL);
+e_data.gpencil_point_sh = 
DRW_shader_create_with_lib(datatoc_gpencil_point_vert_glsl,
+ 
datatoc_gpencil_point_geom_glsl,
+ 
datatoc_gpencil_point_frag_glsl,
+ 
datatoc_common_view_lib_glsl,
+ NULL);
   }
   /* used for edit points or strokes with one point only */
   if (!e_data.gpencil_edit_point_sh) {
-e_data.gpencil_edit_point_sh = 
DRW_shader_create(datatoc_gpencil_edit_point_vert_glsl,
- 
datatoc_gpencil_edit_point_geom_glsl,
- 
datatoc_gpencil_edit_point_frag_glsl,
- NULL);
+e_data.gpencil_edit_point_sh = 
DRW_shader_create_with_lib(datatoc_gpencil_edit_point_vert_glsl,
+  
datatoc_gpencil_edit_point_geom_glsl,
+  
datatoc_gpencil_edit_point_frag_glsl,
+  
datatoc_common_view_lib_glsl,
+  NULL);
   }
 
   /* used for edit lines for edit modes */
diff --git 
a/source/blender/draw/engines/gpencil/shaders/gpencil_edit_point_geom.glsl 

[Bf-blender-cvs] [632e0725d27] master: Overlays: Use common_view_lib.glsl

2019-05-10 Thread Clément Foucault
Commit: 632e0725d27271f95073f668a24bcf06f603f001
Author: Clément Foucault
Date:   Fri May 10 01:57:42 2019 +0200
Branches: master
https://developer.blender.org/rB632e0725d27271f95073f668a24bcf06f603f001

Overlays: Use common_view_lib.glsl

This removes ModelViewProjectionMatrix usage

===

M   source/blender/draw/intern/draw_common.c
M   source/blender/draw/modes/edit_curve_mode.c
M   source/blender/draw/modes/edit_lattice_mode.c
M   source/blender/draw/modes/edit_mesh_mode.c
M   source/blender/draw/modes/object_mode.c
M   source/blender/draw/modes/overlay_mode.c
M   source/blender/draw/modes/paint_texture_mode.c
M   source/blender/draw/modes/paint_vertex_mode.c
M   source/blender/draw/modes/particle_mode.c
M   source/blender/draw/modes/sculpt_mode.c
M   source/blender/draw/modes/shaders/edit_curve_overlay_handle_vert.glsl
M   source/blender/draw/modes/shaders/edit_curve_overlay_loosevert_vert.glsl
M   source/blender/draw/modes/shaders/edit_curve_overlay_normals_vert.glsl
M   
source/blender/draw/modes/shaders/edit_lattice_overlay_loosevert_vert.glsl
M   source/blender/draw/modes/shaders/edit_mesh_overlay_facefill_vert.glsl
M   
source/blender/draw/modes/shaders/edit_mesh_overlay_mesh_analysis_vert.glsl
M   source/blender/draw/modes/shaders/edit_normals_vert.glsl
M   source/blender/draw/modes/shaders/object_empty_image_vert.glsl
M   source/blender/draw/modes/shaders/object_outline_prepass_vert.glsl
M   source/blender/draw/modes/shaders/overlay_face_orientation_vert.glsl
M   source/blender/draw/modes/shaders/paint_face_vert.glsl
M   source/blender/draw/modes/shaders/paint_texture_vert.glsl
M   source/blender/draw/modes/shaders/paint_vertex_vert.glsl
M   source/blender/draw/modes/shaders/paint_weight_vert.glsl
M   source/blender/draw/modes/shaders/paint_wire_vert.glsl
M   source/blender/draw/modes/shaders/particle_strand_frag.glsl
M   source/blender/draw/modes/shaders/particle_strand_vert.glsl
M   source/blender/draw/modes/shaders/sculpt_mask_vert.glsl
M   source/blender/draw/modes/shaders/volume_velocity_vert.glsl

===

diff --git a/source/blender/draw/intern/draw_common.c 
b/source/blender/draw/intern/draw_common.c
index 76fca6fc72d..9abc7ec6c6e 100644
--- a/source/blender/draw/intern/draw_common.c
+++ b/source/blender/draw/intern/draw_common.c
@@ -1038,18 +1038,23 @@ struct GPUShader *volume_velocity_shader_get(bool 
use_needle)
   COMMON_Shaders *sh_data = _shaders[GPU_SHADER_CFG_DEFAULT];
   if (use_needle) {
 if (sh_data->volume_velocity_needle_sh == NULL) {
-  sh_data->volume_velocity_needle_sh = DRW_shader_create(
+  sh_data->volume_velocity_needle_sh = DRW_shader_create_with_lib(
   datatoc_volume_velocity_vert_glsl,
   NULL,
   datatoc_gpu_shader_flat_color_frag_glsl,
+  datatoc_common_view_lib_glsl,
   "#define USE_NEEDLE");
 }
 return sh_data->volume_velocity_needle_sh;
   }
   else {
 if (sh_data->volume_velocity_sh == NULL) {
-  sh_data->volume_velocity_sh = DRW_shader_create(
-  datatoc_volume_velocity_vert_glsl, NULL, 
datatoc_gpu_shader_flat_color_frag_glsl, NULL);
+  sh_data->volume_velocity_sh = DRW_shader_create_with_lib(
+  datatoc_volume_velocity_vert_glsl,
+  NULL,
+  datatoc_gpu_shader_flat_color_frag_glsl,
+  datatoc_common_view_lib_glsl,
+  NULL);
 }
 return sh_data->volume_velocity_sh;
   }
diff --git a/source/blender/draw/modes/edit_curve_mode.c 
b/source/blender/draw/modes/edit_curve_mode.c
index e47393c88c4..f1aa4d20a7e 100644
--- a/source/blender/draw/modes/edit_curve_mode.c
+++ b/source/blender/draw/modes/edit_curve_mode.c
@@ -39,6 +39,7 @@
  * Not needed for constant color. */
 
 extern char datatoc_common_globals_lib_glsl[];
+extern char datatoc_common_view_lib_glsl[];
 extern char datatoc_edit_curve_overlay_loosevert_vert_glsl[];
 extern char datatoc_edit_curve_overlay_normals_vert_glsl[];
 extern char datatoc_edit_curve_overlay_handle_vert_glsl[];
@@ -124,8 +125,10 @@ static void EDIT_CURVE_engine_init(void *UNUSED(vedata))
 
   if (!sh_data->wire_normals_sh) {
 sh_data->wire_normals_sh = GPU_shader_create_from_arrays({
-.vert =
-(const char *[]){sh_cfg_data->lib, 
datatoc_edit_curve_overlay_normals_vert_glsl, NULL},
+.vert = (const char *[]){sh_cfg_data->lib,
+ datatoc_common_view_lib_glsl,
+ datatoc_edit_curve_overlay_normals_vert_glsl,
+ NULL},
 .frag = (const char *[]){datatoc_gpu_shader_uniform_color_frag_glsl, 
NULL},
 .defs = (const char *[]){sh_cfg_data->def, NULL},
 });
@@ -133,8 +136,10 @@ static void EDIT_CURVE_engine_init(void *UNUSED(vedata))
 
   

[Bf-blender-cvs] [a298dde5d79] master: Eevee: Update matrices operations to not use combined matrices

2019-05-10 Thread Clément Foucault
Commit: a298dde5d799bd41dd571cda9c91b62a6b78562a
Author: Clément Foucault
Date:   Thu May 9 16:16:12 2019 +0200
Branches: master
https://developer.blender.org/rBa298dde5d799bd41dd571cda9c91b62a6b78562a

Eevee: Update matrices operations to not use combined matrices

===

M   source/blender/draw/engines/eevee/eevee_lights.c
M   source/blender/draw/engines/eevee/eevee_materials.c
M   source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl
M   source/blender/draw/engines/eevee/shaders/prepass_vert.glsl
M   source/blender/draw/engines/eevee/shaders/shadow_vert.glsl

===

diff --git a/source/blender/draw/engines/eevee/eevee_lights.c 
b/source/blender/draw/engines/eevee/eevee_lights.c
index 270defb039b..6e6c23205fe 100644
--- a/source/blender/draw/engines/eevee/eevee_lights.c
+++ b/source/blender/draw/engines/eevee/eevee_lights.c
@@ -53,6 +53,8 @@ extern char datatoc_shadow_store_frag_glsl[];
 extern char datatoc_shadow_copy_frag_glsl[];
 extern char datatoc_concentric_samples_lib_glsl[];
 
+extern char datatoc_common_view_lib_glsl[];
+
 /* Prototypes */
 static void eevee_light_setup(Object *ob, EEVEE_Light *evli);
 static float light_attenuation_radius_get(Light *la, float light_threshold);
@@ -111,8 +113,11 @@ void EEVEE_lights_init(EEVEE_ViewLayerData *sldata)
   const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph);
 
   if (!e_data.shadow_sh) {
-e_data.shadow_sh = DRW_shader_create(
-datatoc_shadow_vert_glsl, NULL, datatoc_shadow_frag_glsl, NULL);
+e_data.shadow_sh = DRW_shader_create_with_lib(datatoc_shadow_vert_glsl,
+  NULL,
+  datatoc_shadow_frag_glsl,
+  datatoc_common_view_lib_glsl,
+  NULL);
   }
 
   if (!sldata->lights) {
diff --git a/source/blender/draw/engines/eevee/eevee_materials.c 
b/source/blender/draw/engines/eevee/eevee_materials.c
index c195732aaf8..35e1ff8a9c1 100644
--- a/source/blender/draw/engines/eevee/eevee_materials.c
+++ b/source/blender/draw/engines/eevee/eevee_materials.c
@@ -48,6 +48,7 @@
 static struct {
   char *frag_shader_lib;
   char *vert_shader_str;
+  char *vert_shadow_shader_str;
   char *volume_shader_lib;
 
   struct GPUShader *default_prepass_sh;
@@ -609,18 +610,20 @@ void EEVEE_materials_init(EEVEE_ViewLayerData *sldata,
 e_data.vert_shader_str = BLI_string_joinN(
 datatoc_common_view_lib_glsl, datatoc_common_hair_lib_glsl, 
datatoc_lit_surface_vert_glsl);
 
+e_data.vert_shadow_shader_str = BLI_string_joinN(
+datatoc_common_view_lib_glsl, datatoc_common_hair_lib_glsl, 
datatoc_shadow_vert_glsl);
+
 e_data.default_background = DRW_shader_create(
 datatoc_background_vert_glsl, NULL, datatoc_default_world_frag_glsl, 
NULL);
 
-e_data.default_prepass_sh = DRW_shader_create(
-datatoc_prepass_vert_glsl, NULL, datatoc_prepass_frag_glsl, NULL);
-
-e_data.default_prepass_clip_sh = DRW_shader_create(
-datatoc_prepass_vert_glsl, NULL, datatoc_prepass_frag_glsl, "#define 
CLIP_PLANES\n");
-
 char *vert_str = BLI_string_joinN(
 datatoc_common_view_lib_glsl, datatoc_common_hair_lib_glsl, 
datatoc_prepass_vert_glsl);
 
+e_data.default_prepass_sh = DRW_shader_create(vert_str, NULL, 
datatoc_prepass_frag_glsl, NULL);
+
+e_data.default_prepass_clip_sh = DRW_shader_create(
+vert_str, NULL, datatoc_prepass_frag_glsl, "#define CLIP_PLANES\n");
+
 e_data.default_hair_prepass_sh = DRW_shader_create(
 vert_str, NULL, datatoc_prepass_frag_glsl, "#define HAIR_SHADER\n");
 
@@ -853,7 +856,7 @@ struct GPUMaterial *EEVEE_material_mesh_depth_get(struct 
Scene *scene,
 ma,
 engine,
 options,
-(is_shadow) ? datatoc_shadow_vert_glsl 
:
+(is_shadow) ? 
e_data.vert_shadow_shader_str :
   e_data.vert_shader_str,
 NULL,
 frag_str,
@@ -1896,6 +1899,7 @@ void EEVEE_materials_free(void)
   }
   MEM_SAFE_FREE(e_data.frag_shader_lib);
   MEM_SAFE_FREE(e_data.vert_shader_str);
+  MEM_SAFE_FREE(e_data.vert_shadow_shader_str);
   MEM_SAFE_FREE(e_data.volume_shader_lib);
   DRW_SHADER_FREE_SAFE(e_data.default_hair_prepass_sh);
   DRW_SHADER_FREE_SAFE(e_data.default_hair_prepass_clip_sh);
diff --git a/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl 
b/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl
index 68e11f7414c..4243d0ef870 100644
--- 

[Bf-blender-cvs] [0d8ab0eac60] master: DRW: Remove ModelViewMatrix Usage

2019-05-10 Thread Clément Foucault
Commit: 0d8ab0eac6045c0e4e3d175d0f7fc70d80072a71
Author: Clément Foucault
Date:   Thu May 9 22:10:38 2019 +0200
Branches: master
https://developer.blender.org/rB0d8ab0eac6045c0e4e3d175d0f7fc70d80072a71

DRW: Remove ModelViewMatrix Usage

===

M   source/blender/draw/engines/eevee/shaders/prepass_vert.glsl
M   source/blender/draw/engines/workbench/shaders/workbench_volume_frag.glsl
M   source/blender/draw/engines/workbench/shaders/workbench_volume_vert.glsl
M   source/blender/draw/engines/workbench/workbench_volume.c
M   source/blender/draw/intern/draw_manager_data.c
M   source/blender/draw/modes/object_mode.c
M   source/blender/draw/modes/shaders/common_view_lib.glsl
M   source/blender/draw/modes/shaders/edit_mesh_overlay_vert.glsl
M   source/blender/draw/modes/shaders/object_outline_prepass_geom.glsl
M   source/blender/draw/modes/shaders/object_outline_prepass_vert.glsl
M   source/blender/draw/modes/shaders/object_particle_dot_vert.glsl
M   source/blender/draw/modes/shaders/object_particle_prim_vert.glsl

===

diff --git a/source/blender/draw/engines/eevee/shaders/prepass_vert.glsl 
b/source/blender/draw/engines/eevee/shaders/prepass_vert.glsl
index 883862855f3..7f154c9130a 100644
--- a/source/blender/draw/engines/eevee/shaders/prepass_vert.glsl
+++ b/source/blender/draw/engines/eevee/shaders/prepass_vert.glsl
@@ -1,5 +1,4 @@
 
-uniform mat4 ModelViewProjectionMatrix;
 uniform mat4 ModelMatrix;
 uniform mat4 ModelMatrixInverse;
 
diff --git 
a/source/blender/draw/engines/workbench/shaders/workbench_volume_frag.glsl 
b/source/blender/draw/engines/workbench/shaders/workbench_volume_frag.glsl
index a1c269d5a65..cef405d12d3 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_volume_frag.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_volume_frag.glsl
@@ -1,8 +1,7 @@
 
-uniform mat4 ProjectionMatrix;
-uniform mat4 ModelMatrixInverse;
-uniform mat4 ModelViewMatrixInverse;
 uniform mat4 ModelMatrix;
+uniform mat4 ModelMatrixInverse;
+
 uniform vec3 OrcoTexCoFactors[2];
 
 uniform sampler2D depthBuffer;
@@ -219,9 +218,11 @@ void main()
   vec3 vs_ray_dir = (is_persp) ? (vs_ray_end - vs_ray_ori) : vec3(0.0, 0.0, 
-1.0);
   vs_ray_dir /= abs(vs_ray_dir.z);
 
-  vec3 ls_ray_dir = mat3(ModelViewMatrixInverse) * vs_ray_dir * 
OrcoTexCoFactors[1] * 2.0;
-  vec3 ls_ray_ori = (ModelViewMatrixInverse * vec4(vs_ray_ori, 1.0)).xyz;
-  vec3 ls_ray_end = (ModelViewMatrixInverse * vec4(vs_ray_end, 1.0)).xyz;
+  /* TODO(fclem) Precompute the matrix/ */
+  vec3 ls_ray_dir = vs_ray_dir * OrcoTexCoFactors[1] * 2.0;
+  ls_ray_dir = mat3(ModelMatrixInverse) * (mat3(ViewMatrixInverse) * 
ls_ray_dir);
+  vec3 ls_ray_ori = point_view_to_object(vs_ray_ori);
+  vec3 ls_ray_end = point_view_to_object(vs_ray_end);
 
   ls_ray_ori = (OrcoTexCoFactors[0] + ls_ray_ori * OrcoTexCoFactors[1]) * 2.0 
- 1.0;
   ls_ray_end = (OrcoTexCoFactors[0] + ls_ray_end * OrcoTexCoFactors[1]) * 2.0 
- 1.0;
diff --git 
a/source/blender/draw/engines/workbench/shaders/workbench_volume_vert.glsl 
b/source/blender/draw/engines/workbench/shaders/workbench_volume_vert.glsl
index 7a418243fd3..1834173fee9 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_volume_vert.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_volume_vert.glsl
@@ -1,5 +1,6 @@
 
-uniform mat4 ModelViewProjectionMatrix;
+uniform mat4 ModelMatrix;
+
 uniform vec3 OrcoTexCoFactors[2];
 uniform float slicePosition;
 uniform int sliceAxis; /* -1 is no slice, 0 is X, 1 is Y, 2 is Z. */
@@ -29,5 +30,5 @@ void main()
   vec3 final_pos = pos;
 #endif
   final_pos = ((final_pos * 0.5 + 0.5) - OrcoTexCoFactors[0]) / 
OrcoTexCoFactors[1];
-  gl_Position = ModelViewProjectionMatrix * vec4(final_pos, 1.0);
+  gl_Position = point_object_to_ndc(final_pos);
 }
diff --git a/source/blender/draw/engines/workbench/workbench_volume.c 
b/source/blender/draw/engines/workbench/workbench_volume.c
index accc7e91576..d2f19f57dcf 100644
--- a/source/blender/draw/engines/workbench/workbench_volume.c
+++ b/source/blender/draw/engines/workbench/workbench_volume.c
@@ -53,6 +53,7 @@ static struct {
 
 extern char datatoc_workbench_volume_vert_glsl[];
 extern char datatoc_workbench_volume_frag_glsl[];
+extern char datatoc_common_view_lib_glsl[];
 
 static GPUShader *volume_shader_get(bool slice, bool coba, bool cubic)
 {
@@ -77,8 +78,11 @@ static GPUShader *volume_shader_get(bool slice, bool coba, 
bool cubic)
 char *defines = BLI_dynstr_get_cstring(ds);
 BLI_dynstr_free(ds);
 
-e_data.volume_sh[id] = DRW_shader_create(
-datatoc_workbench_volume_vert_glsl, NULL, 
datatoc_workbench_volume_frag_glsl, defines);
+e_data.volume_sh[id] = 
DRW_shader_create_with_lib(datatoc_workbench_volume_vert_glsl,
+  NULL,
+ 

[Bf-blender-cvs] [09a3217c96f] fluid-mantaflow: Mantaflow: Updated manta pp files and added update script

2019-05-10 Thread Sebastián Barschkis
Commit: 09a3217c96f5fed8fe9916a9cbf644149702a21d
Author: Sebastián Barschkis
Date:   Fri May 10 11:56:56 2019 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB09a3217c96f5fed8fe9916a9cbf644149702a21d

Mantaflow: Updated manta pp files and added update script

===

M   CMakeLists.txt
M   intern/mantaflow/CMakeLists.txt
A   intern/mantaflow/intern/manta_develop/dependencies/cnpy/LICENSE
A   intern/mantaflow/intern/manta_develop/dependencies/cnpy/cnpy.cpp
A   intern/mantaflow/intern/manta_develop/dependencies/cnpy/cnpy.h
A   intern/mantaflow/intern/manta_develop/dependencies/cnpy/example1.cpp
R084intern/mantaflow/intern/manta_pp/tbb/pwrapper/manta.h   
intern/mantaflow/intern/manta_develop/helper/pwrapper/manta.h
A   intern/mantaflow/intern/manta_develop/helper/pwrapper/numpyWrap.cpp
A   intern/mantaflow/intern/manta_develop/helper/pwrapper/numpyWrap.h
A   intern/mantaflow/intern/manta_develop/helper/pwrapper/pclass.cpp
A   intern/mantaflow/intern/manta_develop/helper/pwrapper/pclass.h
A   intern/mantaflow/intern/manta_develop/helper/pwrapper/pconvert.cpp
A   intern/mantaflow/intern/manta_develop/helper/pwrapper/pconvert.h
A   intern/mantaflow/intern/manta_develop/helper/pwrapper/pvec3.cpp
A   intern/mantaflow/intern/manta_develop/helper/pwrapper/pymain.cpp
A   intern/mantaflow/intern/manta_develop/helper/pwrapper/pythonInclude.h
A   intern/mantaflow/intern/manta_develop/helper/pwrapper/registry.cpp
A   intern/mantaflow/intern/manta_develop/helper/pwrapper/registry.h
A   intern/mantaflow/intern/manta_develop/helper/util/integrator.h
A   intern/mantaflow/intern/manta_develop/helper/util/interpol.h
A   intern/mantaflow/intern/manta_develop/helper/util/interpolHigh.h
A   intern/mantaflow/intern/manta_develop/helper/util/matrixbase.h
R087intern/mantaflow/intern/manta_pp/tbb/util/mcubes.h  
intern/mantaflow/intern/manta_develop/helper/util/mcubes.h
A   intern/mantaflow/intern/manta_develop/helper/util/quaternion.h
A   intern/mantaflow/intern/manta_develop/helper/util/randomstream.h
A   intern/mantaflow/intern/manta_develop/helper/util/rcmatrix.h
A   intern/mantaflow/intern/manta_develop/helper/util/simpleimage.cpp
A   intern/mantaflow/intern/manta_develop/helper/util/simpleimage.h
A   intern/mantaflow/intern/manta_develop/helper/util/solvana.h
A   intern/mantaflow/intern/manta_develop/helper/util/vector4d.cpp
A   intern/mantaflow/intern/manta_develop/helper/util/vector4d.h
A   intern/mantaflow/intern/manta_develop/helper/util/vectorbase.cpp
A   intern/mantaflow/intern/manta_develop/helper/util/vectorbase.h
A   intern/mantaflow/intern/manta_develop/preprocessed/omp/commonkernels.h
R100intern/mantaflow/intern/manta_pp/omp/commonkernels.h.reg
intern/mantaflow/intern/manta_develop/preprocessed/omp/commonkernels.h.reg
R088intern/mantaflow/intern/manta_pp/tbb/commonkernels.h.reg.cpp
intern/mantaflow/intern/manta_develop/preprocessed/omp/commonkernels.h.reg.cpp
A   intern/mantaflow/intern/manta_develop/preprocessed/omp/conjugategrad.cpp
A   intern/mantaflow/intern/manta_develop/preprocessed/omp/conjugategrad.h
R100intern/mantaflow/intern/manta_pp/omp/conjugategrad.h.reg
intern/mantaflow/intern/manta_develop/preprocessed/omp/conjugategrad.h.reg
R088intern/mantaflow/intern/manta_pp/tbb/conjugategrad.h.reg.cpp
intern/mantaflow/intern/manta_develop/preprocessed/omp/conjugategrad.h.reg.cpp
A   intern/mantaflow/intern/manta_develop/preprocessed/omp/edgecollapse.cpp
R054intern/mantaflow/intern/manta_pp/omp/edgecollapse.h 
intern/mantaflow/intern/manta_develop/preprocessed/omp/edgecollapse.h
R100intern/mantaflow/intern/manta_pp/omp/edgecollapse.h.reg 
intern/mantaflow/intern/manta_develop/preprocessed/omp/edgecollapse.h.reg
R088intern/mantaflow/intern/manta_pp/omp/edgecollapse.h.reg.cpp 
intern/mantaflow/intern/manta_develop/preprocessed/omp/edgecollapse.h.reg.cpp
A   intern/mantaflow/intern/manta_develop/preprocessed/omp/fastmarch.cpp
A   intern/mantaflow/intern/manta_develop/preprocessed/omp/fastmarch.h
R100intern/mantaflow/intern/manta_pp/omp/fastmarch.h.reg
intern/mantaflow/intern/manta_develop/preprocessed/omp/fastmarch.h.reg
R088intern/mantaflow/intern/manta_pp/tbb/fastmarch.h.reg.cpp
intern/mantaflow/intern/manta_develop/preprocessed/omp/fastmarch.h.reg.cpp
A   
intern/mantaflow/intern/manta_develop/preprocessed/omp/fileio/iogrids.cpp
A   
intern/mantaflow/intern/manta_develop/preprocessed/omp/fileio/iomeshes.cpp
A   
intern/mantaflow/intern/manta_develop/preprocessed/omp/fileio/ioparticles.cpp
A   intern/mantaflow/intern/manta_develop/preprocessed/omp/fileio/mantaio.h
R100intern/mantaflow/intern/manta_pp/omp/fileio/mantaio.h.reg   

[Bf-blender-cvs] [196dbc0f314] master: Add ability to create a keyboard shortcut for more mode settings.

2019-05-10 Thread Sebastian Parborg
Commit: 196dbc0f314e466d1a1a1d9ac93238553fdfe66e
Author: Sebastian Parborg
Date:   Fri May 10 11:55:52 2019 +0200
Branches: master
https://developer.blender.org/rB196dbc0f314e466d1a1a1d9ac93238553fdfe66e

Add ability to create a keyboard shortcut for more mode settings.

This adds the ability to assign shortcuts to boolean settings and enums
via the right click menu.

Reviewed By: Brecht

Differential Revision: http://developer.blender.org/D4808

===

M   source/blender/editors/interface/interface_context_menu.c

===

diff --git a/source/blender/editors/interface/interface_context_menu.c 
b/source/blender/editors/interface/interface_context_menu.c
index 748d6e6c183..d22cfeca664 100644
--- a/source/blender/editors/interface/interface_context_menu.c
+++ b/source/blender/editors/interface/interface_context_menu.c
@@ -58,30 +58,90 @@
 /** \name Button Context Menu
  * \{ */
 
-static void but_shortcut_name_func(bContext *C, void *arg1, int UNUSED(event))
+static IDProperty *shortcut_property_from_rna(bContext *C, uiBut *but)
 {
-  uiBut *but = (uiBut *)arg1;
+  /* Compute data path from context to property. */
+  const char *member_id = WM_context_member_from_ptr(C, >rnapoin);
+  const char *data_path = RNA_path_from_ID_to_struct(>rnapoin);
+  const char *member_id_data_path = member_id;
+
+  if (data_path) {
+member_id_data_path = BLI_sprintfN("%s.%s", member_id, data_path);
+MEM_freeN((void *)data_path);
+  }
 
-  if (but->optype) {
-char shortcut_str[128];
+  const char *prop_id = RNA_property_identifier(but->rnaprop);
+  const char *final_data_path = BLI_sprintfN("%s.%s", member_id_data_path, 
prop_id);
 
-IDProperty *prop = (but->opptr) ? but->opptr->data : NULL;
+  if (member_id != member_id_data_path) {
+MEM_freeN((void *)member_id_data_path);
+  }
 
-/* complex code to change name of button */
-if (WM_key_event_operator_string(C,
- but->optype->idname,
- but->opcontext,
- prop,
- true,
- shortcut_str,
- sizeof(shortcut_str))) {
-  ui_but_add_shortcut(but, shortcut_str, true);
+  /* Create ID property of data path, to pass to the operator. */
+  IDProperty *prop;
+  IDPropertyTemplate val = {0};
+  prop = IDP_New(IDP_GROUP, , __func__);
+  IDP_AddToGroup(prop, IDP_NewString(final_data_path, "data_path", 
strlen(final_data_path) + 1));
+
+  MEM_freeN((void *)final_data_path);
+
+  return prop;
+}
+
+static const char *shortcut_get_operator_property(bContext *C, uiBut *but, 
IDProperty **prop)
+{
+  if (but->optype) {
+/* Operator */
+*prop = (but->opptr) ? IDP_CopyProperty(but->opptr->data) : NULL;
+return but->optype->idname;
+  }
+  else if (but->rnaprop) {
+if (RNA_property_type(but->rnaprop) == PROP_BOOLEAN) {
+  /* Boolean */
+  *prop = shortcut_property_from_rna(C, but);
+  return "WM_OT_context_toggle";
 }
-else {
-  /* simply strip the shortcut */
-  ui_but_add_shortcut(but, NULL, true);
+else if (RNA_property_type(but->rnaprop) == PROP_ENUM) {
+  /* Enum */
+  *prop = shortcut_property_from_rna(C, but);
+  return "WM_OT_context_menu_enum";
 }
   }
+
+  *prop = NULL;
+  return NULL;
+}
+
+static void shortcut_free_operator_property(IDProperty *prop)
+{
+  if (prop) {
+IDP_FreeProperty(prop);
+MEM_freeN(prop);
+  }
+}
+
+static void but_shortcut_name_func(bContext *C, void *arg1, int UNUSED(event))
+{
+  uiBut *but = (uiBut *)arg1;
+  char shortcut_str[128];
+
+  IDProperty *prop;
+  const char *idname = shortcut_get_operator_property(C, but, );
+  if (idname == NULL) {
+return;
+  }
+
+  /* complex code to change name of button */
+  if (WM_key_event_operator_string(
+  C, idname, but->opcontext, prop, true, shortcut_str, 
sizeof(shortcut_str))) {
+ui_but_add_shortcut(but, shortcut_str, true);
+  }
+  else {
+/* simply strip the shortcut */
+ui_but_add_shortcut(but, NULL, true);
+  }
+
+  shortcut_free_operator_property(prop);
 }
 
 static uiBlock *menu_change_shortcut(bContext *C, ARegion *ar, void *arg)
@@ -94,10 +154,11 @@ static uiBlock *menu_change_shortcut(bContext *C, ARegion 
*ar, void *arg)
   PointerRNA ptr;
   uiLayout *layout;
   uiStyle *style = UI_style_get_dpi();
-  IDProperty *prop = (but->opptr) ? but->opptr->data : NULL;
+  IDProperty *prop;
+  const char *idname = shortcut_get_operator_property(C, but, );
 
   kmi = WM_key_event_operator(C,
-  but->optype->idname,
+  idname,
   but->opcontext,
   prop,
   EVT_TYPE_MASK_HOTKEY_INCLUDE,
@@ -118,6 +179,8 @@ static uiBlock 

[Bf-blender-cvs] [4d6919bdda7] master: Cleanup: split setup_app_data into two functions

2019-05-10 Thread Campbell Barton
Commit: 4d6919bdda7e50f6ab8598480d4d2ba5094af4d7
Author: Campbell Barton
Date:   Fri May 10 18:46:13 2019 +1000
Branches: master
https://developer.blender.org/rB4d6919bdda7e50f6ab8598480d4d2ba5094af4d7

Cleanup: split setup_app_data into two functions

Allows for skipping either preferences or data-blocks.
Previously setup_app_data was used for both.

===

M   source/blender/blenkernel/intern/blendfile.c

===

diff --git a/source/blender/blenkernel/intern/blendfile.c 
b/source/blender/blenkernel/intern/blendfile.c
index fdf535ba1ab..160ac36fb61 100644
--- a/source/blender/blenkernel/intern/blendfile.c
+++ b/source/blender/blenkernel/intern/blendfile.c
@@ -98,6 +98,25 @@ static bool wm_scene_is_visible(wmWindowManager *wm, Scene 
*scene)
   return false;
 }
 
+static void setup_app_userdef(BlendFileData *bfd)
+{
+  if (bfd->user) {
+/* only here free userdef themes... */
+BKE_blender_userdef_data_set_and_free(bfd->user);
+bfd->user = NULL;
+
+/* Security issue: any blend file could include a USER block.
+ *
+ * Currently we load prefs from BLENDER_STARTUP_FILE and later on load 
BLENDER_USERPREF_FILE,
+ * to load the preferences defined in the users home dir.
+ *
+ * This means we will never accidentally (or maliciously)
+ * enable scripts auto-execution by loading a '.blend' file.
+ */
+U.flag |= USER_SCRIPT_AUTOEXEC_DISABLE;
+  }
+}
+
 /**
  * Context matching, handle no-ui case
  *
@@ -235,26 +254,10 @@ static void setup_app_data(bContext *C,
   RNA_property_update_cache_free();
 
   bmain = G_MAIN = bfd->main;
+  bfd->main = NULL;
 
   CTX_data_main_set(C, bmain);
 
-  if (bfd->user) {
-
-/* only here free userdef themes... */
-BKE_blender_userdef_data_set_and_free(bfd->user);
-bfd->user = NULL;
-
-/* Security issue: any blend file could include a USER block.
- *
- * Currently we load prefs from BLENDER_STARTUP_FILE and later on load 
BLENDER_USERPREF_FILE,
- * to load the preferences defined in the users home dir.
- *
- * This means we will never accidentally (or maliciously)
- * enable scripts auto-execution by loading a '.blend' file.
- */
-U.flag |= USER_SCRIPT_AUTOEXEC_DISABLE;
-  }
-
   /* case G_FILE_NO_UI or no screens in file */
   if (mode != LOAD_UI) {
 /* leave entire context further unaltered? */
@@ -356,8 +359,20 @@ static void setup_app_data(bContext *C,
 /* TODO(sergey): Can this be also move above? */
 RE_FreeAllPersistentData();
   }
+}
 
-  MEM_freeN(bfd);
+static void setup_app_blend_file_data(bContext *C,
+  BlendFileData *bfd,
+  const char *filepath,
+  const struct BlendFileReadParams *params,
+  ReportList *reports)
+{
+  if ((params->skip_flags & BLO_READ_SKIP_USERDEF) == 0) {
+setup_app_userdef(bfd);
+  }
+  if ((params->skip_flags & BLO_READ_SKIP_DATA) == 0) {
+setup_app_data(C, bfd, filepath, params->is_startup, reports);
+  }
 }
 
 static int handle_subversion_warning(Main *main, ReportList *reports)
@@ -400,7 +415,8 @@ int BKE_blendfile_read(bContext *C,
   retval = BKE_BLENDFILE_READ_FAIL;
 }
 else {
-  setup_app_data(C, bfd, filepath, params->is_startup, reports);
+  setup_app_blend_file_data(C, bfd, filepath, params, reports);
+  BLO_blendfiledata_free(bfd);
 }
   }
   else {
@@ -424,7 +440,9 @@ bool BKE_blendfile_read_from_memory(bContext *C,
 if (update_defaults) {
   BLO_update_defaults_startup_blend(bfd->main, NULL);
 }
-setup_app_data(C, bfd, "", params->is_startup, reports);
+
+setup_app_blend_file_data(C, bfd, "", params, reports);
+BLO_blendfiledata_free(bfd);
   }
   else {
 BKE_reports_prepend(reports, "Loading failed: ");
@@ -453,7 +471,8 @@ bool BKE_blendfile_read_from_memfile(bContext *C,
   BKE_id_free(bfd->main, bfd->main->screens.first);
 }
 
-setup_app_data(C, bfd, "", params->is_startup, reports);
+setup_app_blend_file_data(C, bfd, "", params, reports);
+BLO_blendfiledata_free(bfd);
   }
   else {
 BKE_reports_prepend(reports, "Loading failed: ");

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [688e3fed4c2] master: Preferences: write preferences on exit

2019-05-10 Thread Campbell Barton
Commit: 688e3fed4c255ddcfe98f08d1004dc2c0abd51ef
Author: Campbell Barton
Date:   Fri May 10 18:29:58 2019 +1000
Branches: master
https://developer.blender.org/rB688e3fed4c255ddcfe98f08d1004dc2c0abd51ef

Preferences: write preferences on exit

This avoids the issue where user added shortcuts or quick favourites
are lost on exit.

===

M   source/blender/windowmanager/intern/wm_init_exit.c

===

diff --git a/source/blender/windowmanager/intern/wm_init_exit.c 
b/source/blender/windowmanager/intern/wm_init_exit.c
index 97ba9190351..d486daf8039 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -52,6 +52,7 @@
 #include "BLO_writefile.h"
 #include "BLO_undofile.h"
 
+#include "BKE_blendfile.h"
 #include "BKE_blender.h"
 #include "BKE_blender_undo.h"
 #include "BKE_context.h"
@@ -469,6 +470,10 @@ void WM_exit_ext(bContext *C, const bool do_python)
   WM_event_remove_handlers(C, >modalhandlers);
   ED_screen_exit(C, win, WM_window_get_active_screen(win));
 }
+
+if (U.runtime.is_dirty) {
+  BKE_blendfile_userdef_write_all(NULL);
+}
   }
 
   BLI_timer_free();

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b95b6b79669] master: Preferences: add is_dirty member

2019-05-10 Thread Campbell Barton
Commit: b95b6b796695a8b82cda9898561de9e89021596f
Author: Campbell Barton
Date:   Fri May 10 15:57:23 2019 +1000
Branches: master
https://developer.blender.org/rBb95b6b796695a8b82cda9898561de9e89021596f

Preferences: add is_dirty member

Tag preferences as dirty when changed (prepare for adding auto-save).

===

M   source/blender/blenkernel/intern/blendfile.c
M   source/blender/editors/interface/interface_handlers.c
M   source/blender/makesdna/DNA_userdef_types.h
M   source/blender/makesrna/intern/rna_userdef.c

===

diff --git a/source/blender/blenkernel/intern/blendfile.c 
b/source/blender/blenkernel/intern/blendfile.c
index f54d938c0ca..fdf535ba1ab 100644
--- a/source/blender/blenkernel/intern/blendfile.c
+++ b/source/blender/blenkernel/intern/blendfile.c
@@ -617,6 +617,9 @@ bool BKE_blendfile_userdef_write_all(ReportList *reports)
 }
   }
 
+  if (ok) {
+U.runtime.is_dirty = false;
+  }
   return ok;
 }
 
diff --git a/source/blender/editors/interface/interface_handlers.c 
b/source/blender/editors/interface/interface_handlers.c
index 111dfe01319..fe70509d4c2 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -7566,6 +7566,11 @@ static void button_activate_exit(
 if (block->flag & UI_BLOCK_POPUP_MEMORY) {
   ui_popup_menu_memory_set(block, but);
 }
+
+/* Not very elegant, but ensures preference changes force re-save. */
+if (but->rnaprop && (but->rnapoin.data == )) {
+  U.runtime.is_dirty = true;
+}
   }
 
   /* disable tooltips until mousemove + last active flag */
diff --git a/source/blender/makesdna/DNA_userdef_types.h 
b/source/blender/makesdna/DNA_userdef_types.h
index 3ceba714c37..3d0bdee0cab 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -537,6 +537,11 @@ typedef struct WalkNavigation {
   char _pad0[6];
 } WalkNavigation;
 
+typedef struct UserDef_Runtime {
+  char is_dirty;
+  char _pad0[7];
+} UserDef_Runtime;
+
 typedef struct UserDef {
   /* UserDef has separate do-version handling, and can be read from other 
files */
   int versionfile, subversionfile;
@@ -767,6 +772,9 @@ typedef struct UserDef {
   char viewport_aa;
 
   char _pad5[2];
+
+  /** Runtime data (keep last). */
+  UserDef_Runtime runtime;
 } UserDef;
 
 /* from blenkernel blender.c */
diff --git a/source/blender/makesrna/intern/rna_userdef.c 
b/source/blender/makesrna/intern/rna_userdef.c
index c36c10fd4b3..ccfeb8441bd 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -184,8 +184,11 @@ static void rna_userdef_version_get(PointerRNA *ptr, int 
*value)
   value[2] = userdef->subversionfile;
 }
 
-static void rna_userdef_update(Main *UNUSED(bmain), Scene *UNUSED(scene), 
PointerRNA *UNUSED(ptr))
+static void rna_userdef_update(Main *UNUSED(bmain), Scene *UNUSED(scene), 
PointerRNA *ptr)
 {
+  UserDef *userdef = (UserDef *)ptr->data;
+  userdef->runtime.is_dirty = true;
+
   WM_main_add_notifier(NC_WINDOW, NULL);
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b607d162925] master: Cleanup: move preference saving logic into blendfile.c

2019-05-10 Thread Campbell Barton
Commit: b607d1629251dcf1f1964cfddbc9d121863d5ca1
Author: Campbell Barton
Date:   Fri May 10 15:46:31 2019 +1000
Branches: master
https://developer.blender.org/rBb607d1629251dcf1f1964cfddbc9d121863d5ca1

Cleanup: move preference saving logic into blendfile.c

===

M   source/blender/blenkernel/BKE_appdir.h
M   source/blender/blenkernel/BKE_blendfile.h
M   source/blender/blenkernel/intern/appdir.c
M   source/blender/blenkernel/intern/blendfile.c
M   source/blender/windowmanager/intern/wm_files.c

===

diff --git a/source/blender/blenkernel/BKE_appdir.h 
b/source/blender/blenkernel/BKE_appdir.h
index 7ff8514f675..e956aeb769a 100644
--- a/source/blender/blenkernel/BKE_appdir.h
+++ b/source/blender/blenkernel/BKE_appdir.h
@@ -36,6 +36,7 @@ const char *BKE_appdir_folder_id_version(const int folder_id, 
const int ver, con
 bool BKE_appdir_app_is_portable_install(void);
 bool BKE_appdir_app_template_any(void);
 bool BKE_appdir_app_template_id_search(const char *app_template, char *path, 
size_t path_len);
+bool BKE_appdir_app_template_has_userpref(const char *app_template);
 void BKE_appdir_app_templates(struct ListBase *templates);
 
 /* Initialize path to program executable */
diff --git a/source/blender/blenkernel/BKE_blendfile.h 
b/source/blender/blenkernel/BKE_blendfile.h
index 216bef0d1e3..76c05b0411a 100644
--- a/source/blender/blenkernel/BKE_blendfile.h
+++ b/source/blender/blenkernel/BKE_blendfile.h
@@ -62,6 +62,8 @@ struct UserDef *BKE_blendfile_userdef_read_from_memory(const 
void *filebuf,
 bool BKE_blendfile_userdef_write(const char *filepath, struct ReportList 
*reports);
 bool BKE_blendfile_userdef_write_app_template(const char *filepath, struct 
ReportList *reports);
 
+bool BKE_blendfile_userdef_write_all(struct ReportList *reports);
+
 struct WorkspaceConfigFileData *BKE_blendfile_workspace_config_read(const char 
*filepath,
 const void 
*filebuf,
 int 
filelength,
diff --git a/source/blender/blenkernel/intern/appdir.c 
b/source/blender/blenkernel/intern/appdir.c
index 2b4123c74e2..c1ea57c5fcc 100644
--- a/source/blender/blenkernel/intern/appdir.c
+++ b/source/blender/blenkernel/intern/appdir.c
@@ -838,6 +838,26 @@ bool BKE_appdir_app_template_id_search(const char 
*app_template, char *path, siz
   return false;
 }
 
+bool BKE_appdir_app_template_has_userpref(const char *app_template)
+{
+  /* Test if app template provides a userpref.blend.
+   * If not, we will share user preferences with the rest of Blender. */
+  if (!app_template && app_template[0]) {
+return false;
+  }
+
+  char app_template_path[FILE_MAX];
+  if (!BKE_appdir_app_template_id_search(
+  app_template, app_template_path, sizeof(app_template_path))) {
+return false;
+  }
+
+  char userpref_path[FILE_MAX];
+  BLI_path_join(
+  userpref_path, sizeof(userpref_path), app_template_path, 
BLENDER_USERPREF_FILE, NULL);
+  return BLI_exists(userpref_path);
+}
+
 void BKE_appdir_app_templates(ListBase *templates)
 {
   BLI_listbase_clear(templates);
diff --git a/source/blender/blenkernel/intern/blendfile.c 
b/source/blender/blenkernel/intern/blendfile.c
index d1a3045a829..f54d938c0ca 100644
--- a/source/blender/blenkernel/intern/blendfile.c
+++ b/source/blender/blenkernel/intern/blendfile.c
@@ -566,6 +566,60 @@ bool BKE_blendfile_userdef_write_app_template(const char 
*filepath, ReportList *
   return ok;
 }
 
+bool BKE_blendfile_userdef_write_all(ReportList *reports)
+{
+  char filepath[FILE_MAX];
+  const char *cfgdir;
+  bool ok = true;
+  const bool use_template_userpref = 
BKE_appdir_app_template_has_userpref(U.app_template);
+
+  if ((cfgdir = BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL))) {
+bool ok_write;
+BLI_path_join(filepath, sizeof(filepath), cfgdir, BLENDER_USERPREF_FILE, 
NULL);
+
+printf("Writing userprefs: '%s' ", filepath);
+if (use_template_userpref) {
+  ok_write = BKE_blendfile_userdef_write_app_template(filepath, reports);
+}
+else {
+  ok_write = BKE_blendfile_userdef_write(filepath, reports);
+}
+
+if (ok_write) {
+  printf("ok\n");
+}
+else {
+  printf("fail\n");
+  ok = false;
+}
+  }
+  else {
+BKE_report(reports, RPT_ERROR, "Unable to create userpref path");
+  }
+
+  if (use_template_userpref) {
+if ((cfgdir = BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, 
U.app_template))) {
+  /* Also save app-template prefs */
+  BLI_path_join(filepath, sizeof(filepath), cfgdir, BLENDER_USERPREF_FILE, 
NULL);
+
+  printf("Writing userprefs app-template: '%s' ", filepath);
+  if (BKE_blendfile_userdef_write(filepath, reports) != 0) {
+printf("ok\n");
+  }
+  else {
+printf("fail\n");
+ok = 

[Bf-blender-cvs] [44ecea1ccbc] master: Fix T64304: Objects in appended scene from 2.79 file disappear after saving.

2019-05-10 Thread Bastien Montagne
Commit: 44ecea1ccbc06680cfc12a89799badbf0cc43ac9
Author: Bastien Montagne
Date:   Fri May 10 10:09:23 2019 +0200
Branches: master
https://developer.blender.org/rB44ecea1ccbc06680cfc12a89799badbf0cc43ac9

Fix T64304: Objects in appended scene from 2.79 file disappear after saving.

Versionning code generating collections from old 2.79 scene layers was
setting new collections' library from scene, but it also needs to
properly set the `LIB_TAG_INDIRECT` tag, otherwise localizing code does
not know what to do, and most of append process fails.

===

M   source/blender/blenkernel/intern/library.c
M   source/blender/blenloader/intern/versioning_280.c

===

diff --git a/source/blender/blenkernel/intern/library.c 
b/source/blender/blenkernel/intern/library.c
index ad0c405ab28..3e6f93d1323 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -1860,7 +1860,7 @@ static void library_make_local_copying_check(ID *id,
  * (except group and objects ones).
  */
 /* Note: Old (2.77) version was simply making (tagging) data-blocks as local,
- * without actually making any check whether * they were also indirectly used 
or not...
+ * without actually making any check whether they were also indirectly used or 
not...
  *
  * Current version uses regular id_make_local callback, with advanced 
pre-processing step to detect
  * all cases of IDs currently indirectly used, but which will be used by local 
data only once this
diff --git a/source/blender/blenloader/intern/versioning_280.c 
b/source/blender/blenloader/intern/versioning_280.c
index f1c92dedd33..b958d7532bf 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -421,6 +421,9 @@ static void do_version_layers_to_collections(Main *bmain, 
Scene *scene)
 
   Collection *collection = BKE_collection_add(bmain, 
collection_master, name);
   collection->id.lib = scene->id.lib;
+  if (collection->id.lib != NULL) {
+collection->id.tag |= LIB_TAG_INDIRECT;
+  }
   collections[layer] = collection;
 
   if (!(scene->lay & (1 << layer))) {

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [c6acb31f703] greasepencil-object: Merge branch 'master' into greasepencil-object

2019-05-10 Thread Antonioya
Commit: c6acb31f7035b2afc63761565b45f8138b3dfbf2
Author: Antonioya
Date:   Fri May 10 08:29:53 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBc6acb31f7035b2afc63761565b45f8138b3dfbf2

Merge branch 'master' into greasepencil-object

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs