[Bf-blender-cvs] [5dcabc4d579] master: Fix T65770: File Browser missing "Sidebar" in View menu

2019-06-19 Thread Campbell Barton
Commit: 5dcabc4d5795522c145da5116d8aeac2db7ac8a6
Author: Campbell Barton
Date:   Thu Jun 20 14:49:55 2019 +1000
Branches: master
https://developer.blender.org/rB5dcabc4d5795522c145da5116d8aeac2db7ac8a6

Fix T65770: File Browser missing "Sidebar" in View menu

===

M   release/scripts/startup/bl_ui/space_filebrowser.py
M   source/blender/makesrna/intern/rna_space.c

===

diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py 
b/release/scripts/startup/bl_ui/space_filebrowser.py
index eb9964bb180..b939586ff81 100644
--- a/release/scripts/startup/bl_ui/space_filebrowser.py
+++ b/release/scripts/startup/bl_ui/space_filebrowser.py
@@ -250,6 +250,11 @@ class FILEBROWSER_MT_view(Menu):
 st = context.space_data
 params = st.params
 
+layout.prop(st, "show_region_toolbar")
+layout.prop(st, "show_region_ui", text="File Path")
+
+layout.separator()
+
 layout.prop_menu_enum(params, "display_size")
 layout.prop_menu_enum(params, "recursion_level")
 
diff --git a/source/blender/makesrna/intern/rna_space.c 
b/source/blender/makesrna/intern/rna_space.c
index 561cbb2ec3a..0c7797326db 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -5489,6 +5489,8 @@ static void rna_def_space_filebrowser(BlenderRNA *brna)
   RNA_def_struct_sdna(srna, "SpaceFile");
   RNA_def_struct_ui_text(srna, "Space File Browser", "File browser space 
data");
 
+  rna_def_space_generic_show_region_toggles(srna, (1 << RGN_TYPE_TOOLS) | (1 
<< RGN_TYPE_UI));
+
   prop = RNA_def_property(srna, "params", PROP_POINTER, PROP_NONE);
   RNA_def_property_pointer_sdna(prop, NULL, "params");
   RNA_def_property_ui_text(

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


[Bf-blender-cvs] [79bd5174e47] master: Fix T65922: Custom property error

2019-06-19 Thread Campbell Barton
Commit: 79bd5174e47d75e19564da921867958eaad25243
Author: Campbell Barton
Date:   Thu Jun 20 14:34:20 2019 +1000
Branches: master
https://developer.blender.org/rB79bd5174e47d75e19564da921867958eaad25243

Fix T65922: Custom property error

===

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 c7e2b78d872..3920ff95a9e 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -1320,7 +1320,7 @@ class WM_OT_properties_edit(Operator):
 
 row = layout.row()
 row.prop(self, "use_soft_limits")
-if bpy.app.use_library_override:
+if bpy.app.use_override_library:
 row.prop(self, "is_overridable_library")
 
 row = layout.row(align=True)

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


[Bf-blender-cvs] [fb646752094] soc-2019-openxr: Fix invalid delete operator use

2019-06-19 Thread Julian Eisel
Commit: fb64675209445363a004736b77b0ffe90943d299
Author: Julian Eisel
Date:   Wed Jun 19 19:09:40 2019 +0200
Branches: soc-2019-openxr
https://developer.blender.org/rBfb64675209445363a004736b77b0ffe90943d299

Fix invalid delete operator use

Again a thing MSVC should warn about but didn't...

===

M   intern/ghost/intern/GHOST_XRSession.cpp
M   intern/ghost/intern/GHOST_XR_intern.h
M   release/scripts/addons

===

diff --git a/intern/ghost/intern/GHOST_XRSession.cpp 
b/intern/ghost/intern/GHOST_XRSession.cpp
index 9255450e604..f0c621e6307 100644
--- a/intern/ghost/intern/GHOST_XRSession.cpp
+++ b/intern/ghost/intern/GHOST_XRSession.cpp
@@ -67,51 +67,40 @@ static void GHOST_XR_system_init(OpenXRData *oxr)
   xrGetSystem(oxr->instance, _info, >system_id);
 }
 
-class GHOST_XRGraphicsBinding {
- public:
-  union {
-#if defined(WITH_X11)
-XrGraphicsBindingOpenGLXlibKHR glx;
-#elif defined(WIN32)
-XrGraphicsBindingOpenGLWin32KHR wgl;
-XrGraphicsBindingD3D11KHR d3d11;
-#endif
-  } oxr_binding;
-
-  void initFromGhostContext(GHOST_TGraphicsBinding type, GHOST_Context 
*ghost_ctx)
-  {
-switch (type) {
-  case GHOST_kXRGraphicsOpenGL: {
+void GHOST_XRGraphicsBinding::initFromGhostContext(GHOST_TGraphicsBinding type,
+   GHOST_Context *ghost_ctx)
+{
+  switch (type) {
+case GHOST_kXRGraphicsOpenGL: {
 #if defined(WITH_X11)
-GHOST_ContextGLX *ctx_glx = static_cast(ghost_ctx);
+  GHOST_ContextGLX *ctx_glx = static_cast(ghost_ctx);
 
-oxr_binding.glx.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_XLIB_KHR;
-oxr_binding.glx.xDisplay = ctx_glx->m_display;
+  oxr_binding.glx.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_XLIB_KHR;
+  oxr_binding.glx.xDisplay = ctx_glx->m_display;
 #elif defined(WIN32)
-GHOST_ContextWGL *ctx_wgl = static_cast(ghost_ctx);
+  GHOST_ContextWGL *ctx_wgl = static_cast(ghost_ctx);
 
-oxr_binding.wgl.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_WIN32_KHR;
-oxr_binding.wgl.hDC = ctx_wgl->m_hDC;
-oxr_binding.wgl.hGLRC = ctx_wgl->m_hGLRC;
+  oxr_binding.wgl.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_WIN32_KHR;
+  oxr_binding.wgl.hDC = ctx_wgl->m_hDC;
+  oxr_binding.wgl.hGLRC = ctx_wgl->m_hGLRC;
 #endif
 
-break;
-  }
+  break;
+}
 #ifdef WIN32
-  case GHOST_kXRGraphicsD3D11: {
-GHOST_ContextD3D *ctx_d3d = static_cast(ghost_ctx);
+case GHOST_kXRGraphicsD3D11: {
+  GHOST_ContextD3D *ctx_d3d = static_cast(ghost_ctx);
 
-oxr_binding.d3d11.type = XR_TYPE_GRAPHICS_BINDING_D3D11_KHR;
-oxr_binding.d3d11.device = ctx_d3d->m_device.Get();
+  oxr_binding.d3d11.type = XR_TYPE_GRAPHICS_BINDING_D3D11_KHR;
+  oxr_binding.d3d11.device = ctx_d3d->m_device.Get();
 
-break;
-  }
-#endif
-  default:
-assert(false);
+  break;
 }
+#endif
+default:
+  assert(false);
   }
-};
+}
 
 void GHOST_XR_session_start(GHOST_XRContext *xr_context)
 {
diff --git a/intern/ghost/intern/GHOST_XR_intern.h 
b/intern/ghost/intern/GHOST_XR_intern.h
index 12162d59939..da0cad54712 100644
--- a/intern/ghost/intern/GHOST_XR_intern.h
+++ b/intern/ghost/intern/GHOST_XR_intern.h
@@ -36,6 +36,20 @@ typedef struct OpenXRData {
   XrSessionState session_state;
 } OpenXRData;
 
+class GHOST_XRGraphicsBinding {
+ public:
+  union {
+#if defined(WITH_X11)
+XrGraphicsBindingOpenGLXlibKHR glx;
+#elif defined(WIN32)
+XrGraphicsBindingOpenGLWin32KHR wgl;
+XrGraphicsBindingD3D11KHR d3d11;
+#endif
+  } oxr_binding;
+
+  void initFromGhostContext(GHOST_TGraphicsBinding type, class GHOST_Context 
*ghost_ctx);
+};
+
 typedef struct GHOST_XRContext {
   OpenXRData oxr;
 
diff --git a/release/scripts/addons b/release/scripts/addons
index a5a236df5f6..b154bd63c0f 16
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit a5a236df5f6630ea17958e3006070ef609c6a4b8
+Subproject commit b154bd63c0fd87bbb4679c2635f3fc5701f86ae0

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


[Bf-blender-cvs] [2ee9c60c205] soc-2019-openxr: Finish OpenXR GLX binding initialization

2019-06-19 Thread Julian Eisel
Commit: 2ee9c60c2058dba3d963983b7e427ffe9d2f2aac
Author: Julian Eisel
Date:   Wed Jun 19 21:11:21 2019 +0200
Branches: soc-2019-openxr
https://developer.blender.org/rB2ee9c60c2058dba3d963983b7e427ffe9d2f2aac

Finish OpenXR GLX binding initialization

Monado now opens a window here when asking it to start a session. That
seems to be the case because it doesn't detect the HMD as direct mode
capable yet. But that shouldn't be an issue from our side.

===

M   intern/ghost/intern/GHOST_ContextGLX.cpp
M   intern/ghost/intern/GHOST_XRSession.cpp

===

diff --git a/intern/ghost/intern/GHOST_ContextGLX.cpp 
b/intern/ghost/intern/GHOST_ContextGLX.cpp
index 4203a32f150..8bde9f69b02 100644
--- a/intern/ghost/intern/GHOST_ContextGLX.cpp
+++ b/intern/ghost/intern/GHOST_ContextGLX.cpp
@@ -273,6 +273,7 @@ GHOST_TSuccess GHOST_ContextGLX::initializeDrawingContext()
   m_window = (Window)glXCreatePbuffer(m_display, 
framebuffer_config[0], pbuffer_attribs);
 }
 
+m_fbconfig = framebuffer_config[0];
 XFree(framebuffer_config);
   }
 }
diff --git a/intern/ghost/intern/GHOST_XRSession.cpp 
b/intern/ghost/intern/GHOST_XRSession.cpp
index f0c621e6307..f7f2095cc3c 100644
--- a/intern/ghost/intern/GHOST_XRSession.cpp
+++ b/intern/ghost/intern/GHOST_XRSession.cpp
@@ -74,9 +74,14 @@ void 
GHOST_XRGraphicsBinding::initFromGhostContext(GHOST_TGraphicsBinding type,
 case GHOST_kXRGraphicsOpenGL: {
 #if defined(WITH_X11)
   GHOST_ContextGLX *ctx_glx = static_cast(ghost_ctx);
+  XVisualInfo *visual_info = glXGetVisualFromFBConfig(ctx_glx->m_display, 
ctx_glx->m_fbconfig);
 
   oxr_binding.glx.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_XLIB_KHR;
   oxr_binding.glx.xDisplay = ctx_glx->m_display;
+  oxr_binding.glx.glxFBConfig = ctx_glx->m_fbconfig;
+  oxr_binding.glx.glxDrawable = ctx_glx->m_window;
+  oxr_binding.glx.glxContext = ctx_glx->m_context;
+  oxr_binding.glx.visualid = visual_info->visualid;
 #elif defined(WIN32)
   GHOST_ContextWGL *ctx_wgl = static_cast(ghost_ctx);

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


[Bf-blender-cvs] [d30f72dfd8a] master: Fix sculpt not updating on undo with EEVEE enabled

2019-06-19 Thread Pablo Dobarro
Commit: d30f72dfd8acdac26e7888dbb2f4628f6baac707
Author: Pablo Dobarro
Date:   Wed Jun 19 20:29:25 2019 +0200
Branches: master
https://developer.blender.org/rBd30f72dfd8acdac26e7888dbb2f4628f6baac707

Fix sculpt not updating on undo with EEVEE enabled

===

M   source/blender/editors/sculpt_paint/sculpt_undo.c

===

diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c 
b/source/blender/editors/sculpt_paint/sculpt_undo.c
index 75a2af4526f..8c8d4487ada 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -459,6 +459,7 @@ static void sculpt_undo_restore_list(bContext *C, ListBase 
*lb)
 {
   Scene *scene = CTX_data_scene(C);
   ViewLayer *view_layer = CTX_data_view_layer(C);
+  View3D *v3d = CTX_wm_view3d(C);
   Object *ob = OBACT(view_layer);
   Depsgraph *depsgraph = CTX_data_depsgraph(C);
   SculptSession *ss = ob->sculpt;
@@ -560,7 +561,7 @@ static void sculpt_undo_restore_list(bContext *C, ListBase 
*lb)
   }
 }
 
-tag_update |= ((Mesh *)ob->data)->id.us > 1;
+tag_update |= ((Mesh *)ob->data)->id.us > 1 || 
!BKE_sculptsession_use_pbvh_draw(ob, v3d);
 
 if (ss->kb || ss->modifiers_active) {
   Mesh *mesh = ob->data;

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


[Bf-blender-cvs] [f47c9ad96fd] master: VSE: Draw pre-animated (volume) sound strip waveforms.

2019-06-19 Thread Richard Antalik
Commit: f47c9ad96fdd84d71d3d43a43621b358cf1273de
Author: Richard Antalik
Date:   Wed Jun 19 10:36:45 2019 -0700
Branches: master
https://developer.blender.org/rBf47c9ad96fdd84d71d3d43a43621b358cf1273de

VSE: Draw pre-animated (volume) sound strip waveforms.

===

M   source/blender/editors/space_sequencer/sequencer_draw.c

===

diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index f1ee606a06b..e53a3cb02a7 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -38,12 +38,14 @@
 #include "DNA_space_types.h"
 #include "DNA_userdef_types.h"
 #include "DNA_sound_types.h"
+#include "DNA_anim_types.h"
 
 #include "BKE_context.h"
 #include "BKE_global.h"
 #include "BKE_sequencer.h"
 #include "BKE_sound.h"
 #include "BKE_scene.h"
+#include "BKE_fcurve.h"
 
 #include "IMB_colormanagement.h"
 #include "IMB_imbuf.h"
@@ -251,8 +253,10 @@ static void drawseqwave(View2D *v2d,
 float yscale = (y2 - y1) / 2.0f;
 float samplestep;
 float startsample, endsample;
+float volume = seq->volume;
 float value1, value2;
 bSound *sound = seq->sound;
+FCurve *fcu = id_data_find_fcurve(>id, seq, _Sequence, 
"volume", 0, NULL);
 
 SoundWaveform *waveform;
 
@@ -329,8 +333,12 @@ static void drawseqwave(View2D *v2d,
 value2 = (1.0f - f) * value2 + f * waveform->data[p * 3 + 4];
   }
 
-  value1 *= seq->volume;
-  value2 *= seq->volume;
+  if (fcu) {
+float evaltime = x1_offset + (i * stepsize);
+volume = evaluate_fcurve(fcu, evaltime);
+  }
+  value1 *= volume;
+  value2 *= volume;
 
   if (value2 > 1 || value1 < -1) {
 immAttr4f(col, 1.0f, 0.0f, 0.0f, 0.5f);

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


[Bf-blender-cvs] [da83f70754b] master: Fix T65398 - Fix frame rate base use in Python SMPTE functions

2019-06-19 Thread Richard Antalik
Commit: da83f70754b6e5eb6d96b94b0d1d554bdb9120fd
Author: Richard Antalik
Date:   Wed Jun 19 10:49:37 2019 -0700
Branches: master
https://developer.blender.org/rBda83f70754b6e5eb6d96b94b0d1d554bdb9120fd

Fix T65398 - Fix frame rate base use in Python SMPTE functions

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

Reviewed By: brecht

===

M   release/scripts/modules/bpy/utils/__init__.py

===

diff --git a/release/scripts/modules/bpy/utils/__init__.py 
b/release/scripts/modules/bpy/utils/__init__.py
index c96b0b88c6b..e6424de0742 100644
--- a/release/scripts/modules/bpy/utils/__init__.py
+++ b/release/scripts/modules/bpy/utils/__init__.py
@@ -450,12 +450,12 @@ def preset_paths(subdir):
 return dirs
 
 
-def smpte_from_seconds(time, fps=None):
+def smpte_from_seconds(time, fps=None, fps_base=None):
 """
 Returns an SMPTE formatted string from the *time*:
 ``HH:MM:SS:FF``.
 
-If the *fps* is not given the current scene is used.
+If *fps* and *fps_base* are not given the current scene is used.
 
 :arg time: time in seconds.
 :type time: int, float or ``datetime.timedelta``.
@@ -463,7 +463,11 @@ def smpte_from_seconds(time, fps=None):
 :rtype: string
 """
 
-return smpte_from_frame(time_to_frame(time, fps=fps), fps)
+return smpte_from_frame(
+time_to_frame(time, fps=fps, fps_base=fps_base),
+fps=fps,
+fps_base=fps_base
+)
 
 
 def smpte_from_frame(frame, fps=None, fps_base=None):
@@ -485,8 +489,9 @@ def smpte_from_frame(frame, fps=None, fps_base=None):
 if fps_base is None:
 fps_base = _bpy.context.scene.render.fps_base
 
+fps = fps / fps_base
 sign = "-" if frame < 0 else ""
-frame = abs(frame * fps_base)
+frame = abs(frame)
 
 return (
 "%s%02d:%02d:%02d:%02d" % (
@@ -516,9 +521,11 @@ def time_from_frame(frame, fps=None, fps_base=None):
 if fps_base is None:
 fps_base = _bpy.context.scene.render.fps_base
 
+fps = fps / fps_base
+
 from datetime import timedelta
 
-return timedelta(0, (frame * fps_base) / fps)
+return timedelta(0, frame / fps)
 
 
 def time_to_frame(time, fps=None, fps_base=None):
@@ -540,12 +547,14 @@ def time_to_frame(time, fps=None, fps_base=None):
 if fps_base is None:
 fps_base = _bpy.context.scene.render.fps_base
 
+fps = fps / fps_base
+
 from datetime import timedelta
 
 if isinstance(time, timedelta):
 time = time.total_seconds()
 
-return (time / fps_base) * fps
+return time * fps
 
 
 def preset_find(name, preset_path, display_name=False, ext=".py"):

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


[Bf-blender-cvs] [76385139cfb] soc-2019-openxr: Use friend class to access graphics data on Windows too

2019-06-19 Thread Julian Eisel
Commit: 76385139cfbb9c0a5ea1d04836870a0a8dc45a4e
Author: Julian Eisel
Date:   Wed Jun 19 18:30:19 2019 +0200
Branches: soc-2019-openxr
https://developer.blender.org/rB76385139cfbb9c0a5ea1d04836870a0a8dc45a4e

Use friend class to access graphics data on Windows too

Also fix memory leak.

===

M   intern/ghost/intern/GHOST_ContextD3D.cpp
M   intern/ghost/intern/GHOST_ContextD3D.h
M   intern/ghost/intern/GHOST_ContextWGL.cpp
M   intern/ghost/intern/GHOST_ContextWGL.h
M   intern/ghost/intern/GHOST_XR.cpp
M   intern/ghost/intern/GHOST_XRSession.cpp
M   release/scripts/addons

===

diff --git a/intern/ghost/intern/GHOST_ContextD3D.cpp 
b/intern/ghost/intern/GHOST_ContextD3D.cpp
index 2c4a5860ed9..2f3e28a28b2 100644
--- a/intern/ghost/intern/GHOST_ContextD3D.cpp
+++ b/intern/ghost/intern/GHOST_ContextD3D.cpp
@@ -383,8 +383,3 @@ static void drawTestTriangle(ID3D11Device *m_device,
   m_device_ctx->Draw(std::size(vertices), 0);
 }
 #endif
-
-ID3D11Device *GHOST_ContextD3D::getDevice()
-{
-  return m_device.Get();
-}
diff --git a/intern/ghost/intern/GHOST_ContextD3D.h 
b/intern/ghost/intern/GHOST_ContextD3D.h
index 2a28d03c9b5..c187dba757a 100644
--- a/intern/ghost/intern/GHOST_ContextD3D.h
+++ b/intern/ghost/intern/GHOST_ContextD3D.h
@@ -31,6 +31,9 @@
 #include "GHOST_Context.h"
 
 class GHOST_ContextD3D : public GHOST_Context {
+  /* XR code needs low level graphics data to send to OpenXR. */
+  friend class GHOST_XRGraphicsBinding;
+
  public:
   GHOST_ContextD3D(bool stereoVisual, HWND hWnd);
   ~GHOST_ContextD3D();
@@ -113,8 +116,6 @@ class GHOST_ContextD3D : public GHOST_Context {
 return true;
   }
 
-  ID3D11Device *getDevice();
-
  private:
   friend class SharedOpenGLContext;
 
diff --git a/intern/ghost/intern/GHOST_ContextWGL.cpp 
b/intern/ghost/intern/GHOST_ContextWGL.cpp
index 62e17359d71..a3d5d6f7edf 100644
--- a/intern/ghost/intern/GHOST_ContextWGL.cpp
+++ b/intern/ghost/intern/GHOST_ContextWGL.cpp
@@ -730,8 +730,3 @@ GHOST_TSuccess GHOST_ContextWGL::releaseNativeHandles()
 
   return success;
 }
-
-GHOST_ContextWGL::Info GHOST_ContextWGL::getInfo()
-{
-  return Info{m_hDC, m_hGLRC};
-}
diff --git a/intern/ghost/intern/GHOST_ContextWGL.h 
b/intern/ghost/intern/GHOST_ContextWGL.h
index ed230591912..e1b43d36d4c 100644
--- a/intern/ghost/intern/GHOST_ContextWGL.h
+++ b/intern/ghost/intern/GHOST_ContextWGL.h
@@ -35,6 +35,9 @@
 #endif
 
 class GHOST_ContextWGL : public GHOST_Context {
+  /* XR code needs low level graphics data to send to OpenXR. */
+  friend class GHOST_XRGraphicsBinding;
+
  public:
   /**
* Constructor.
@@ -101,15 +104,6 @@ class GHOST_ContextWGL : public GHOST_Context {
 
   GHOST_TSuccess setDefaultFramebufferSize(GHOST_TUns32 width, GHOST_TUns32 
height);
 
-  /**
-   * Helper to get low level system specific info out of the context.
-   */
-  struct Info {
-HDC hDC;
-HGLRC hGLRC;
-  };
-  Info getInfo();
-
  private:
   int choose_pixel_format(bool stereoVisual, bool needAlpha);
   int choose_pixel_format_arb(bool stereoVisual, bool needAlpha);
diff --git a/intern/ghost/intern/GHOST_XR.cpp b/intern/ghost/intern/GHOST_XR.cpp
index 0561df3809d..c769ebac280 100644
--- a/intern/ghost/intern/GHOST_XR.cpp
+++ b/intern/ghost/intern/GHOST_XR.cpp
@@ -255,6 +255,7 @@ void GHOST_XR_context_destroy(GHOST_XRContext *xr_context)
 
   /* Unbinding may involve destruction, so call here too */
   GHOST_XR_graphics_context_unbind(*xr_context);
+  delete xr_context->gpu_binding;
 
   if (oxr->session != XR_NULL_HANDLE) {
 xrDestroySession(oxr->session);
diff --git a/intern/ghost/intern/GHOST_XRSession.cpp 
b/intern/ghost/intern/GHOST_XRSession.cpp
index d975bc1874f..9255450e604 100644
--- a/intern/ghost/intern/GHOST_XRSession.cpp
+++ b/intern/ghost/intern/GHOST_XRSession.cpp
@@ -89,11 +89,10 @@ class GHOST_XRGraphicsBinding {
 oxr_binding.glx.xDisplay = ctx_glx->m_display;
 #elif defined(WIN32)
 GHOST_ContextWGL *ctx_wgl = static_cast(ghost_ctx);
-GHOST_ContextWGL::Info info = ctx_wgl->getInfo();
 
 oxr_binding.wgl.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_WIN32_KHR;
-oxr_binding.wgl.hDC = info.hDC;
-oxr_binding.wgl.hGLRC = info.hGLRC;
+oxr_binding.wgl.hDC = ctx_wgl->m_hDC;
+oxr_binding.wgl.hGLRC = ctx_wgl->m_hGLRC;
 #endif
 
 break;
@@ -103,7 +102,7 @@ class GHOST_XRGraphicsBinding {
 GHOST_ContextD3D *ctx_d3d = static_cast(ghost_ctx);
 
 oxr_binding.d3d11.type = XR_TYPE_GRAPHICS_BINDING_D3D11_KHR;
-oxr_binding.d3d11.device = ctx_d3d->getDevice();
+oxr_binding.d3d11.device = ctx_d3d->m_device.Get();
 
 break;
   }
@@ -154,6 +153,7 @@ void GHOST_XR_session_end(GHOST_XRContext *xr_context)
 {
   xrEndSession(xr_context->oxr.session);
   GHOST_XR_graphics_context_unbind(*xr_context);
+  delete xr_context->gpu_binding;

[Bf-blender-cvs] [d08fbfacb21] soc-2019-fast-io: [Fast import/export] Removed the boost::iterator_facade dependency for iterators

2019-06-19 Thread Hugo Sales
Commit: d08fbfacb211848729a8db18a8520dddee15a4e6
Author: Hugo Sales
Date:   Wed Jun 19 17:19:36 2019 +0100
Branches: soc-2019-fast-io
https://developer.blender.org/rBd08fbfacb211848729a8db18a8520dddee15a4e6

[Fast import/export] Removed the boost::iterator_facade dependency for iterators

===

M   source/blender/editors/io/intern/common.cpp
M   source/blender/editors/io/intern/iterators.hpp
M   source/blender/editors/io/intern/obj.cpp
M   source/blender/editors/io/intern/stl.cpp

===

diff --git a/source/blender/editors/io/intern/common.cpp 
b/source/blender/editors/io/intern/common.cpp
index 3f29341071a..a5085a303f2 100644
--- a/source/blender/editors/io/intern/common.cpp
+++ b/source/blender/editors/io/intern/common.cpp
@@ -231,6 +231,7 @@ bool export_end(bContext *UNUSED(C), ExportSettings *const 
settings)
   return true;
 }
 
+/* clang-format off */
 bool time_export(bContext *C,
  ExportSettings *const settings,
  void (*start)(bContext *C, ExportSettings *const settings),
@@ -239,9 +240,12 @@ bool time_export(bContext *C,
   auto f = std::chrono::steady_clock::now();
   start(C, settings);
   auto ret = end(C, settings);
-  std::cout << "Took " << (std::chrono::steady_clock::now() - f).count() << 
"ns\n";
+  std::cout << "Took "
+<< std::chrono::duration_cast
+   (std::chrono::steady_clock::now() - f).count() << "ms\n";
   return ret;
 }
+/* clang-format on */
 
 const std::array calculate_normal(const Mesh *const mesh, const 
MPoly )
 {
diff --git a/source/blender/editors/io/intern/iterators.hpp 
b/source/blender/editors/io/intern/iterators.hpp
index 4d41bc7bf8d..cbd825d37f4 100644
--- a/source/blender/editors/io/intern/iterators.hpp
+++ b/source/blender/editors/io/intern/iterators.hpp
@@ -29,408 +29,179 @@ extern "C" {
 
 namespace common {
 
-// /* clang-format off */
-// template
-// struct pointer_iterator {
-//   using difference_type = ptrdiff_t;
-//   using value_type = T;
-//   using pointer= T *;
-//   using reference  = T &;
-//   using iterator_category = std::random_access_iterator_tag;
-//   pointer_iterator() : first(nullptr), curr(nullptr), size(0) {}
-//   pointer_iterator(T *p) : curr(p), first(p), size(0) {}
-//   pointer_iterator(T *p, size_t size) : it(p), first(p), size(size) {}
-//   operator T *() const { return curr; }
-//   pointer_iterator =(const pointer_iterator 
)
-//   {
-// // Placement new: construct a new object in the position of `this`
-// // Doesn't actually allocate memory
-// new (this) pointer_iterator(p);
-// return *this;
-//   }
-//   pointer_iterator begin() const { return {first, size}; }
-//   pointer_iterator end()   const { return {first + size, size}; }
-//   pointer_iterator ++() { ++curr; }
-//   pointer_iterator () { --curr; }
-//   pointer_iterator +(ptrdiff_t n) { curr += n; return *this; }
-//   ptrdiff_t operator-(const pointer_iterator ) const { return 
other.curr - curr; }
-//   bool operator==(const pointer_iterator ) const { return curr == 
other.curr; }
-//   const T & operator*() const { return *curr; }
-//   T *first;
-//   T *curr;
-//   size_t size;
-// };
-// /* clang-format on */
-
+/* clang-format off */
 // Adapt a pointer-size pair as a random access iterator
 // This makes use of `boost::iterator_facade` and makes it possible to use
 // for each style loops, as well as cleanly hiding how the underlying Blender
 // data structures are accessed
-template
-struct pointer_iterator
-: public boost::iterator_facade, SourceT &, 
Tag> {
-  pointer_iterator() : first(nullptr)
-  {
-  }
-  pointer_iterator(const pointer_iterator &) = default;
-  pointer_iterator(pointer_iterator &&) = default;
-  explicit pointer_iterator(SourceT *p) : it(p), first(p), size(0)
-  {
-  }
-  explicit pointer_iterator(SourceT *p, size_t size) : it(p), first(p), 
size(size)
-  {
-  }
-  operator SourceT *() const
-  {
-return it;
-  }
-  pointer_iterator =(const pointer_iterator )
-  {
+template
+struct pointer_iterator_base {
+  using difference_type = ptrdiff_t;
+  using value_type = T;
+  using pointer= T *;
+  using reference  = T &;
+  using iterator_category = Tag;
+  pointer_iterator_base(pointer p, size_t size) : first(p), curr(p), 
size(size) {}
+  pointer_iterator_base(const pointer_iterator_base ) : first(pib.first), 
curr(pib.curr), size(pib.size) {}
+  operator pointer() const { return curr; }
+  pointer_iterator_base =(const pointer_iterator_base ) {
 // Placement new: construct a new object in the position of `this`
 // Doesn't actually allocate memory
-new (this) pointer_iterator(p);
+new (this) pointer_iterator_base(p);
 return *this;
   }
-  // pointer_iterator & operator=(pointer_iterator &) = 
default;//  {
-  //   return pointer_iterator(p);
-  // }
-  pointer_iterator begin() const
-  {
-   

[Bf-blender-cvs] [d52aaa596f8] sybren-usd-experiments: Reorganising USD code in a breaking way

2019-06-19 Thread Sybren A. Stüvel
Commit: d52aaa596f83ced89c9aa44aa18cfa3f26865808
Author: Sybren A. Stüvel
Date:   Fri Jun 14 12:09:04 2019 +0200
Branches: sybren-usd-experiments
https://developer.blender.org/rBd52aaa596f83ced89c9aa44aa18cfa3f26865808

Reorganising USD code in a breaking way

===

M   source/blender/usd/intern/usd_exporter.cc
M   source/blender/usd/intern/usd_exporter.h
A   source/blender/usd/intern/usd_exporter_context.h
M   source/blender/usd/intern/usd_writer_abstract.cc
M   source/blender/usd/intern/usd_writer_abstract.h
M   source/blender/usd/intern/usd_writer_mesh.cc
M   source/blender/usd/intern/usd_writer_mesh.h
M   source/blender/usd/intern/usd_writer_transform.cc
M   source/blender/usd/intern/usd_writer_transform.h

===

diff --git a/source/blender/usd/intern/usd_exporter.cc 
b/source/blender/usd/intern/usd_exporter.cc
index 3feccbe3472..f5c54e2a850 100644
--- a/source/blender/usd/intern/usd_exporter.cc
+++ b/source/blender/usd/intern/usd_exporter.cc
@@ -26,10 +26,13 @@
 #include 
 
 extern "C" {
+#include "BKE_anim.h"
 #include "BKE_mesh_runtime.h"
 #include "BKE_scene.h"
 
 #include "BLI_iterator.h"
+
+#include "DNA_layer_types.h"
 }
 
 USDExporter::USDExporter(const char *filename, ExportSettings )
@@ -43,6 +46,7 @@ USDExporter::~USDExporter()
 
 void USDExporter::operator()(float _progress, bool _was_canceled)
 {
+  static const pxr::SdfPath root("/");
   Timer timer_("Writing to USD");
 
   r_progress = 0.0;
@@ -52,79 +56,181 @@ void USDExporter::operator()(float _progress, bool 
_was_canceled)
   m_stage = pxr::UsdStage::CreateNew(m_filename);
   m_stage->SetMetadata(pxr::UsdGeomTokens->upAxis, 
pxr::VtValue(pxr::UsdGeomTokens->z));
 
-  // Approach copied from draw manager.
-  DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN (m_settings.depsgraph, ob_eval) {
-if (export_object(ob_eval, data_)) {
-  // printf("Breaking out of USD export loop after first object\n");
-  // break;
+  for (Base *base = static_cast(m_settings.view_layer->object_bases.first); base;
+   base = base->next) {
+Object *ob = base->object;
+Object *ob_eval = DEG_get_evaluated_object(m_settings.depsgraph, ob);
+
+export_or_queue(ob_eval, NULL, root);
+  }
+
+  // DEG_OBJECT_ITER_BEGIN (m_settings.depsgraph,
+  //ob_eval,
+  //DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY |
+  //DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET | 
DEG_ITER_OBJECT_FLAG_VISIBLE
+  //| DEG_ITER_OBJECT_FLAG_DUPLI) {
+  //   export_or_queue(ob_eval, data_.dupli_parent);
+  // }
+  // DEG_OBJECT_ITER_END;
+
+  printf("== Dealing with deferred exports\n");
+  // for (DeferredExportSet::iterator it : deferred_exports) {
+
+  // }
+
+  printf("Impossible exports: %lu \n", deferred_exports.size());
+
+  while (!deferred_exports.empty()) {
+DeferredExportSet::iterator it = deferred_exports.begin();
+
+Object *missing_ob = it->first;
+Object *missing_ob_eval = DEG_get_evaluated_object(m_settings.depsgraph, 
missing_ob);
+
+printf("   - %s  referred by %lu objects\n", missing_ob->id.name, 
it->second.size());
+printf(
+" type = %d  addr = %p   orig = %p   eval = %p  orig->parent = %p 
(%s at path %s)\n",
+missing_ob->type,
+missing_ob,
+DEG_get_original_object(missing_ob),
+missing_ob_eval,
+missing_ob->parent,
+missing_ob->parent ? missing_ob->parent->id.name : "-null-",
+usd_object_paths[missing_ob->parent].GetString().c_str());
+
+for (const auto _ctx : it->second) {
+  printf(" - %s (%p) instanced by %s (%p)\n",
+ deferred_ctx.ob_eval->id.name,
+ deferred_ctx.ob_eval,
+ deferred_ctx.instanced_by ? deferred_ctx.instanced_by->id.name : 
"-none-",
+ deferred_ctx.instanced_by);
 }
+
+deferred_exports.erase(it);
+
+// export_or_queue(missing_ob_eval, NULL);
   }
-  DEG_OBJECT_ITER_FOR_RENDER_ENGINE_END;
 
   m_stage->GetRootLayer()->Save();
 
   r_progress = 1.0;
 }
 
-bool USDExporter::export_object(Object *ob_eval, const DEGObjectIterData 
_data)
+void USDExporter::export_or_queue(Object *ob_eval,
+  Object *instanced_by,
+  const pxr::SdfPath )
 {
-  pxr::SdfPath parent_path = parent_usd_path(ob_eval, degiter_data);
+  Object *missing_ob = NULL;
+
+  pxr::SdfPath parent_path = parent_usd_path(ob_eval, instanced_by, anchor, 
_ob);
+  USDExporterContext ctx = {m_stage, parent_path, ob_eval, instanced_by};
+
   if (parent_path.IsEmpty()) {
-return false;
+// Object path couldn't be found, so queue this object until it is ok.
+Object *missing_orig = DEG_get_original_object(missing_ob);
+deferred_exports[missing_orig].push_back(ctx);
+printf("Deferred, %lu exports 

[Bf-blender-cvs] [e7d1d6b4a58] sybren-usd-experiments: NULL -> nullptr

2019-06-19 Thread Sybren A. Stüvel
Commit: e7d1d6b4a5879454825172881a3caf63b0f84d92
Author: Sybren A. Stüvel
Date:   Fri Jun 14 18:06:39 2019 +0200
Branches: sybren-usd-experiments
https://developer.blender.org/rBe7d1d6b4a5879454825172881a3caf63b0f84d92

NULL -> nullptr

===

M   source/blender/usd/intern/abstract_hierarchy_iterator.cc
M   source/blender/usd/intern/abstract_hierarchy_iterator.h
M   source/blender/usd/intern/usd_hierarchy_iterator.cc

===

diff --git a/source/blender/usd/intern/abstract_hierarchy_iterator.cc 
b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
index 61d43a86b60..b108f38accc 100644
--- a/source/blender/usd/intern/abstract_hierarchy_iterator.cc
+++ b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
@@ -36,13 +36,13 @@ void AbstractHierarchyIterator::iterate()
   ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph);
   for (Base *base = static_cast(view_layer->object_bases.first); base; 
base = base->next) {
 Object *ob = base->object;
-visit_object(base, ob, ob->parent, NULL);
+visit_object(base, ob, ob->parent, nullptr);
   }
 }
 
 std::string AbstractHierarchyIterator::get_object_name(const Object *const 
object) const
 {
-  if (object == NULL) {
+  if (object == nullptr) {
 return "";
   }
 
@@ -51,7 +51,7 @@ std::string AbstractHierarchyIterator::get_object_name(const 
Object *const objec
 
 std::string AbstractHierarchyIterator::get_id_name(const ID *const id) const
 {
-  if (id == NULL) {
+  if (id == nullptr) {
 return "";
   }
 
@@ -61,7 +61,7 @@ std::string AbstractHierarchyIterator::get_id_name(const ID 
*const id) const
 /**
  * \brief get_object_dag_path_name returns the name under which the object
  *  will be exported in the Alembic file. It is of the form
- *  "[../grandparent/]parent/object" if dupli_parent is NULL, or
+ *  "[../grandparent/]parent/object" if dupli_parent is nullptr, or
  *  "dupli_parent/[../grandparent/]parent/object" otherwise.
  * \param ob:
  * \param dupli_parent:
@@ -103,7 +103,7 @@ void AbstractHierarchyIterator::visit_object(Base *base,
 {
   /* If an object isn't exported itself, its duplilist shouldn't be
* exported either. */
-  if (!should_visit_object(base, dupliObParent != NULL)) {
+  if (!should_visit_object(base, dupliObParent != nullptr)) {
 return;
   }
 
@@ -114,8 +114,8 @@ void AbstractHierarchyIterator::visit_object(Base *base,
 
   if (lb) {
 DupliObject *link = static_cast(lb->first);
-Object *dupli_ob = NULL;
-Object *dupli_parent = NULL;
+Object *dupli_ob = nullptr;
+Object *dupli_parent = nullptr;
 
 for (; link; link = link->next) {
   if (!should_visit_duplilink(link)) {
@@ -139,12 +139,11 @@ TEMP_WRITER_TYPE 
*AbstractHierarchyIterator::export_object_and_parents(Object *o
   BLI_assert(ob != parent);
   BLI_assert(ob != dupliObParent);
 
-  std::string name;
-  name = get_object_dag_path_name(ob, dupliObParent);
+  std::string name = get_object_dag_path_name(ob, dupliObParent);
 
   /* check if we have already created a transform writer for this object */
   TEMP_WRITER_TYPE *xform_writer = get_writer(name);
-  if (xform_writer != NULL) {
+  if (xform_writer != nullptr) {
 return xform_writer;
   }
 
@@ -156,15 +155,15 @@ TEMP_WRITER_TYPE 
*AbstractHierarchyIterator::export_object_and_parents(Object *o
  * return the parent's writer pointer. */
 if (parent->parent) {
   if (parent == dupliObParent) {
-parent_writer = export_object_and_parents(parent, parent->parent, 
NULL);
+parent_writer = export_object_and_parents(parent, parent->parent, 
nullptr);
   }
   else {
 parent_writer = export_object_and_parents(parent, parent->parent, 
dupliObParent);
   }
 }
 else if (parent == dupliObParent) {
-  if (dupliObParent->parent == NULL) {
-parent_writer = export_object_and_parents(parent, NULL, NULL);
+  if (dupliObParent->parent == nullptr) {
+parent_writer = export_object_and_parents(parent, nullptr, nullptr);
   }
   else {
 parent_writer = export_object_and_parents(
@@ -179,13 +178,13 @@ TEMP_WRITER_TYPE 
*AbstractHierarchyIterator::export_object_and_parents(Object *o
   }
 
   xform_writer = create_xform_writer(name, ob, parent_writer);
-  if (xform_writer != NULL) {
+  if (xform_writer != nullptr) {
 writers[name] = xform_writer;
   }
 
-  if (ob->data != NULL) {
+  if (ob->data != nullptr) {
 TEMP_WRITER_TYPE *data_writer = create_data_writer(name, ob, xform_writer);
-if (data_writer != NULL) {
+if (data_writer != nullptr) {
   writers[name] = data_writer;
 }
   }
@@ -198,7 +197,7 @@ TEMP_WRITER_TYPE 
*AbstractHierarchyIterator::get_writer(const std::string )
   WriterMap::iterator it = writers.find(name);
 
   if (it == writers.end()) {
-return NULL;
+return nullptr;
   }
   return it->second;
 }
diff 

[Bf-blender-cvs] [7d813598a7e] sybren-usd-experiments: Abstracted hierarchy walking of Alembic exporter

2019-06-19 Thread Sybren A. Stüvel
Commit: 7d813598a7e7b687994c008125194889b5ecdc0a
Author: Sybren A. Stüvel
Date:   Fri Jun 14 16:41:40 2019 +0200
Branches: sybren-usd-experiments
https://developer.blender.org/rB7d813598a7e7b687994c008125194889b5ecdc0a

Abstracted hierarchy walking of Alembic exporter

===

M   source/blender/usd/CMakeLists.txt
A   source/blender/usd/intern/abstract_hierarchy_iterator.cc
A   source/blender/usd/intern/abstract_hierarchy_iterator.h
M   source/blender/usd/intern/usd_exporter.cc
M   source/blender/usd/intern/usd_exporter.h
M   source/blender/usd/intern/usd_exporter_context.h
M   source/blender/usd/intern/usd_hierarchy_iterator.cc
M   source/blender/usd/intern/usd_hierarchy_iterator.h
M   source/blender/usd/intern/usd_writer_abstract.cc
M   source/blender/usd/intern/usd_writer_abstract.h
M   source/blender/usd/intern/usd_writer_mesh.cc
M   source/blender/usd/intern/usd_writer_mesh.h
M   source/blender/usd/intern/usd_writer_transform.cc

===

diff --git a/source/blender/usd/CMakeLists.txt 
b/source/blender/usd/CMakeLists.txt
index a77d20366ed..fafe03aa2ce 100644
--- a/source/blender/usd/CMakeLists.txt
+++ b/source/blender/usd/CMakeLists.txt
@@ -47,14 +47,18 @@ set(INC_SYS
 )
 
 set(SRC
+  intern/abstract_hierarchy_iterator.cc
   intern/usd_capi.cc
   intern/usd_exporter.cc
+  intern/usd_hierarchy_iterator.cc
   intern/usd_writer_abstract.cc
   intern/usd_writer_mesh.cc
   intern/usd_writer_transform.cc
 
   usd.h
+  intern/abstract_hierarchy_iterator.h
   intern/usd_exporter.h
+  intern/usd_hierarchy_iterator.h
   intern/usd_writer_abstract.h
   intern/usd_writer_mesh.h
   intern/usd_writer_transform.h
diff --git a/source/blender/usd/intern/usd_hierarchy_iterator.cc 
b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
similarity index 63%
copy from source/blender/usd/intern/usd_hierarchy_iterator.cc
copy to source/blender/usd/intern/abstract_hierarchy_iterator.cc
index 2f3da814f85..513d31960cc 100644
--- a/source/blender/usd/intern/usd_hierarchy_iterator.cc
+++ b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
@@ -1,12 +1,12 @@
-#include "usd_hierarchy_iterator.h"
+#include "abstract_hierarchy_iterator.h"
 
 #include 
 
-#include 
-
 extern "C" {
 #include "BKE_anim.h"
+
 #include "BLI_assert.h"
+#include "BLI_utildefines.h"
 
 #include "DEG_depsgraph_query.h"
 
@@ -15,22 +15,48 @@ extern "C" {
 #include "DNA_object_types.h"
 }
 
-static std::string get_id_name(const Object *const ob)
+AbstractHierarchyIterator::AbstractHierarchyIterator(Depsgraph *depsgraph)
+: depsgraph(depsgraph), writers()
+{
+}
+
+AbstractHierarchyIterator::~AbstractHierarchyIterator()
+{
+}
+
+void AbstractHierarchyIterator::release()
+{
+  for (WriterMap::value_type it : writers) {
+delete_object_writer(it.second);
+  }
+  writers.clear();
+}
+
+void AbstractHierarchyIterator::iterate()
+{
+  ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph);
+  for (Base *base = static_cast(view_layer->object_bases.first); base; 
base = base->next) {
+Object *ob = base->object;
+visit_object(base, ob, ob->parent, NULL);
+  }
+}
+
+std::string AbstractHierarchyIterator::get_object_name(const Object *const 
object) const
 {
-  if (!ob) {
+  if (object == NULL) {
 return "";
   }
 
-  return get_id_name(>id);
+  return get_id_name(>id);
 }
 
-static std::string get_id_name(const ID *const id)
+std::string AbstractHierarchyIterator::get_id_name(const ID *const id) const
 {
-  if (!id)
+  if (id == NULL) {
 return "";
+  }
 
-  std::string name(id->name + 2);
-  return pxr::TfMakeValidIdentifier(name);
+  return std::string(id->name + 2);
 }
 
 /**
@@ -42,31 +68,33 @@ static std::string get_id_name(const ID *const id)
  * \param dupli_parent:
  * \return
  */
-static std::string get_object_dag_path_name(const Object *const ob, Object 
*dupli_parent)
+std::string AbstractHierarchyIterator::get_object_dag_path_name(
+const Object *const ob, const Object *const dupli_parent) const
 {
-  std::string name = get_id_name(ob);
-
-  Object *p = ob->parent;
+  std::string name = get_object_name(ob);
 
-  while (p) {
-name = get_id_name(p) + "/" + name;
-p = p->parent;
+  for (Object *parent = ob->parent; parent; parent = parent->parent) {
+name = get_object_name(parent) + "/" + name;
   }
 
   if (dupli_parent && (ob != dupli_parent)) {
-name = get_id_name(dupli_parent) + "/" + name;
+// TODO(Sybren): shouldn't this call get_object_dag_path_name()?
+name = get_object_name(dupli_parent) + "/" + name;
   }
 
   return name;
 }
 
-void AbstractHierarchyIterator::iterate()
+bool AbstractHierarchyIterator::should_visit_object(const Base *const 
UNUSED(base),
+bool 
UNUSED(is_duplicated)) const
 {
-  ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph);
-  for 

[Bf-blender-cvs] [ee392718633] sybren-usd-experiments: Working on a smarter way to construct the USD object hierarchy

2019-06-19 Thread Sybren A. Stüvel
Commit: ee392718633525a0b884f28cc6456fec43b4c543
Author: Sybren A. Stüvel
Date:   Tue Jun 18 14:31:12 2019 +0200
Branches: sybren-usd-experiments
https://developer.blender.org/rBee392718633525a0b884f28cc6456fec43b4c543

Working on a smarter way to construct the USD object hierarchy

This includes delayed writing to USD, which breaks things for now.

===

M   source/blender/usd/intern/abstract_hierarchy_iterator.cc
M   source/blender/usd/intern/abstract_hierarchy_iterator.h
M   source/blender/usd/intern/usd_exporter.cc
M   source/blender/usd/intern/usd_exporter_context.h
M   source/blender/usd/intern/usd_hierarchy_iterator.cc
M   source/blender/usd/intern/usd_writer_abstract.cc
M   source/blender/usd/intern/usd_writer_abstract.h
M   source/blender/usd/intern/usd_writer_mesh.cc
M   source/blender/usd/intern/usd_writer_transform.cc

===

diff --git a/source/blender/usd/intern/abstract_hierarchy_iterator.cc 
b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
index b108f38accc..4f2c1f7246b 100644
--- a/source/blender/usd/intern/abstract_hierarchy_iterator.cc
+++ b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
@@ -23,6 +23,11 @@ AbstractHierarchyIterator::~AbstractHierarchyIterator()
 {
 }
 
+const AbstractHierarchyIterator::WriterMap 
::writer_map() const
+{
+  return writers;
+}
+
 void AbstractHierarchyIterator::release_writers()
 {
   for (WriterMap::value_type it : writers) {
@@ -34,9 +39,85 @@ void AbstractHierarchyIterator::release_writers()
 void AbstractHierarchyIterator::iterate()
 {
   ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph);
+
+  printf("== Visiting objects:\n");
+  Scene *scene = DEG_get_input_scene(depsgraph);
   for (Base *base = static_cast(view_layer->object_bases.first); base; 
base = base->next) {
-Object *ob = base->object;
-visit_object(base, ob, ob->parent, nullptr);
+if (base->flag & BASE_HOLDOUT) {
+  continue;
+}
+
+// Non-instanced objects always have their object-parent as export-parent.
+visit_object(base, base->object, base->object->parent, false);
+
+// Object *evaluated_ob = DEG_get_evaluated_object(depsgraph, object);
+// export_object_and_parents(ob, parent, dupliObParent);
+
+ListBase *lb = object_duplilist(depsgraph, scene, base->object);
+if (lb) {
+  DupliObject *link = nullptr;
+
+  std::set dupli_set;
+  for (link = static_cast(lb->first); link; link = 
link->next) {
+if (!should_visit_duplilink(link)) {
+  continue;
+}
+dupli_set.insert(link->ob);
+  }
+
+  Object *export_parent = nullptr;
+  for (link = static_cast(lb->first); link; link = 
link->next) {
+if (!should_visit_duplilink(link)) {
+  continue;
+}
+// If the dupli-object's scene parent is also instanced by this 
object, use that as the
+// export parent. Otherwise use the dupli-parent as export parent.
+if (link->ob->parent != nullptr && dupli_set.find(link->ob->parent) != 
dupli_set.end()) {
+  export_parent = link->ob->parent;
+}
+else {
+  export_parent = base->object;
+}
+visit_object(base, link->ob, export_parent, false);
+  }
+}
+
+free_object_duplilist(lb);
+  }
+
+  printf("== adding xform-onlies:\n");
+  while (!xform_onlies.empty()) {
+std::set::iterator first = xform_onlies.begin();
+
+Object *xform_only = *first;
+visit_object(nullptr, xform_only, xform_only->parent, true);
+
+xform_onlies.erase(xform_only);
+  }
+
+  printf("== Export graph:\n");
+  for (auto it : export_graph) {
+printf("OB %s:\n", it.first == nullptr ? "/" : (it.first->id.name + 
2));
+for (auto child_it : it.second) {
+  printf("   - %s (xform_only=%s)\n",
+ child_it.object->id.name + 2,
+ child_it.xform_only ? "true" : "false");
+}
+  }
+
+  printf("== Export paths:\n");
+  make_paths(nullptr, "");
+}
+
+void AbstractHierarchyIterator::make_paths(Object *for_object, const 
std::string _path)
+{
+  for (auto it : export_graph[for_object]) {
+std::string usd_path = at_path + "/" + get_object_name(it.object);
+
+const char *colour = it.xform_only ? "31;1" : "30";
+printf("%s \033[%sm%s\033[0m\n", usd_path.c_str(), colour, it.xform_only ? 
"true" : "false");
+
+make_paths(it.object, usd_path);
   }
 }
 
@@ -98,37 +179,56 @@ bool 
AbstractHierarchyIterator::should_visit_duplilink(const DupliObject *const
 
 void AbstractHierarchyIterator::visit_object(Base *base,
  Object *object,
- Object *parent,
- Object *dupliObParent)
+ Object *export_parent,
+   

[Bf-blender-cvs] [afd24b76b42] sybren-usd-experiments: Removing some unused code

2019-06-19 Thread Sybren A. Stüvel
Commit: afd24b76b42ed24abc27a4339fa7b651718204c2
Author: Sybren A. Stüvel
Date:   Fri Jun 14 17:35:15 2019 +0200
Branches: sybren-usd-experiments
https://developer.blender.org/rBafd24b76b42ed24abc27a4339fa7b651718204c2

Removing some unused code

===

M   source/blender/usd/intern/abstract_hierarchy_iterator.cc
M   source/blender/usd/intern/abstract_hierarchy_iterator.h

===

diff --git a/source/blender/usd/intern/abstract_hierarchy_iterator.cc 
b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
index 513d31960cc..61d43a86b60 100644
--- a/source/blender/usd/intern/abstract_hierarchy_iterator.cc
+++ b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
@@ -6,7 +6,6 @@ extern "C" {
 #include "BKE_anim.h"
 
 #include "BLI_assert.h"
-#include "BLI_utildefines.h"
 
 #include "DEG_depsgraph_query.h"
 
@@ -24,7 +23,7 @@ AbstractHierarchyIterator::~AbstractHierarchyIterator()
 {
 }
 
-void AbstractHierarchyIterator::release()
+void AbstractHierarchyIterator::release_writers()
 {
   for (WriterMap::value_type it : writers) {
 delete_object_writer(it.second);
@@ -85,8 +84,8 @@ std::string 
AbstractHierarchyIterator::get_object_dag_path_name(
   return name;
 }
 
-bool AbstractHierarchyIterator::should_visit_object(const Base *const 
UNUSED(base),
-bool 
UNUSED(is_duplicated)) const
+bool AbstractHierarchyIterator::should_visit_object(const Base * /*base*/,
+bool /*is_duplicated*/) 
const
 {
   return true;
 }
@@ -141,12 +140,7 @@ TEMP_WRITER_TYPE 
*AbstractHierarchyIterator::export_object_and_parents(Object *o
   BLI_assert(ob != dupliObParent);
 
   std::string name;
-  //   if (m_settings.flatten_hierarchy) {
-  // name = get_id_name(ob);
-  //   }
-  //   else {
   name = get_object_dag_path_name(ob, dupliObParent);
-  //   }
 
   /* check if we have already created a transform writer for this object */
   TEMP_WRITER_TYPE *xform_writer = get_writer(name);
@@ -154,11 +148,8 @@ TEMP_WRITER_TYPE 
*AbstractHierarchyIterator::export_object_and_parents(Object *o
 return xform_writer;
   }
 
-  TEMP_WRITER_TYPE *parent_writer = NULL;
-
-  if (/* m_settings.flatten_hierarchy || */ parent == NULL) {
-  }
-  else {
+  TEMP_WRITER_TYPE *parent_writer = nullptr;
+  if (parent != nullptr) {
 /* Since there are so many different ways to find parents (as evident
  * in the number of conditions below), we can't really look up the
  * parent by name. We'll just call export_object_and_parents(), which will
@@ -188,10 +179,6 @@ TEMP_WRITER_TYPE 
*AbstractHierarchyIterator::export_object_and_parents(Object *o
   }
 
   xform_writer = create_xform_writer(name, ob, parent_writer);
-  //   /* When flattening, the matrix of the dupliobject has to be added. */
-  //   if (m_settings.flatten_hierarchy && dupliObParent) {
-  // xform_writer->m_proxy_from = dupliObParent;
-  //   }
   if (xform_writer != NULL) {
 writers[name] = xform_writer;
   }
diff --git a/source/blender/usd/intern/abstract_hierarchy_iterator.h 
b/source/blender/usd/intern/abstract_hierarchy_iterator.h
index a4756df..0b305af4f9c 100644
--- a/source/blender/usd/intern/abstract_hierarchy_iterator.h
+++ b/source/blender/usd/intern/abstract_hierarchy_iterator.h
@@ -25,10 +25,10 @@ class AbstractHierarchyIterator {
   virtual ~AbstractHierarchyIterator();
 
   void iterate();
+  const WriterMap _map() const;
+  void release_writers();
 
  private:
-  void release();
-
   void visit_object(Base *base, Object *object, Object *parent, Object 
*dupliObParent);
 
   std::string get_object_name(const Object *const object) const;

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


[Bf-blender-cvs] [8f33276294b] sybren-usd-experiments: Abstracted some code for moving towards collection instances

2019-06-19 Thread Sybren A. Stüvel
Commit: 8f33276294bbd226ff6f6266d14b2c8b8c59c833
Author: Sybren A. Stüvel
Date:   Thu Jun 13 10:40:33 2019 +0200
Branches: sybren-usd-experiments
https://developer.blender.org/rB8f33276294bbd226ff6f6266d14b2c8b8c59c833

Abstracted some code for moving towards collection instances

===

M   source/blender/usd/intern/usd_exporter.cc
M   source/blender/usd/intern/usd_writer_abstract.cc
M   source/blender/usd/intern/usd_writer_abstract.h
M   source/blender/usd/intern/usd_writer_mesh.cc
M   source/blender/usd/intern/usd_writer_mesh.h
M   source/blender/usd/intern/usd_writer_transform.cc
M   source/blender/usd/intern/usd_writer_transform.h

===

diff --git a/source/blender/usd/intern/usd_exporter.cc 
b/source/blender/usd/intern/usd_exporter.cc
index 5bd38363f0e..36f690e603e 100644
--- a/source/blender/usd/intern/usd_exporter.cc
+++ b/source/blender/usd/intern/usd_exporter.cc
@@ -26,13 +26,10 @@
 #include 
 
 extern "C" {
-#include "BKE_anim.h"
 #include "BKE_mesh_runtime.h"
 #include "BKE_scene.h"
 
 #include "BLI_iterator.h"
-
-#include "DEG_depsgraph_query.h"
 }
 
 USDExporter::USDExporter(const char *filename, ExportSettings )
@@ -69,28 +66,10 @@ void USDExporter::operator()(float _progress, bool 
_was_canceled)
   r_progress = 1.0;
 }
 
-bool USDExporter::export_object(Object *ob_eval, const DEGObjectIterData 
_)
+bool USDExporter::export_object(Object *ob_eval, const DEGObjectIterData 
_data)
 {
   const pxr::SdfPath root("/");
-  Mesh *mesh = ob_eval->runtime.mesh_eval;
   pxr::SdfPath parent_path;
-  USDAbstractWriter *parent_writer = NULL;
-
-  if (mesh == NULL) {
-printf("USD-\033[34mSKIPPING\033[0m object %s  type=%d mesh = %p\n",
-   ob_eval->id.name,
-   ob_eval->type,
-   mesh);
-return false;
-  }
-  if (data_.dupli_object_current != NULL) {
-printf("USD-\033[34mSKIPPING\033[0m object %s  instance of %s  type=%d 
mesh = %p\n",
-   ob_eval->id.name,
-   data_.dupli_object_current->ob->id.name,
-   ob_eval->type,
-   mesh);
-return false;
-  }
 
   // Compute the parent's SdfPath.
   if (ob_eval->parent == NULL) {
@@ -105,21 +84,40 @@ bool USDExporter::export_object(Object *ob_eval, const 
DEGObjectIterData _)
   return false;
 }
 parent_path = path_it->second;
-parent_writer = usd_writers[parent_path];
   }
 
-  USDAbstractWriter *xformWriter = new USDTransformWriter(
-  m_stage, parent_path, ob_eval, data_, parent_writer);
-
-  USDAbstractWriter *meshWriter = new USDMeshWriter(
-  m_stage, parent_path, ob_eval, data_, parent_writer);
-
-  usd_object_paths[ob_eval] = xformWriter->usd_path();
-  usd_writers[xformWriter->usd_path()] = xformWriter;
-  usd_writers[meshWriter->usd_path()] = meshWriter;
+  // Write the transform. This is always done, even when we don't write the 
data, as it makes it
+  // possible to reference collection-instantiating empties.
+  USDAbstractWriter *xform_writer = new USDTransformWriter(
+  m_stage, parent_path, ob_eval, degiter_data);
+  const pxr::SdfPath _usd_path = xform_writer->usd_path();
+  usd_object_paths[ob_eval] = xform_usd_path;
+  usd_writers[xform_usd_path] = xform_writer;
+  xform_writer->write();
+
+  // Write the object data, if we know how.
+  // TODO: let the writer determine whether the data is actually supported.
+  USDAbstractWriter *data_writer = NULL;
+  switch (ob_eval->type) {
+case OB_MESH:
+  data_writer = new USDMeshWriter(m_stage, xform_usd_path, ob_eval, 
degiter_data);
+  break;
+default:
+  printf("USD-\033[34mXFORM-ONLY\033[0m object %s  type=%d (no data 
writer)\n",
+ ob_eval->id.name,
+ ob_eval->type);
+  return false;
+  }
 
-  xformWriter->write();
-  meshWriter->write();
+  if (!data_writer->is_supported()) {
+printf("USD-\033[34mXFORM-ONLY\033[0m object %s  type=%d (data writer 
rejects the data)\n",
+   ob_eval->id.name,
+   ob_eval->type);
+  }
+  else {
+usd_writers[data_writer->usd_path()] = data_writer;
+data_writer->write();
+  }
 
   return true;
 }
diff --git a/source/blender/usd/intern/usd_writer_abstract.cc 
b/source/blender/usd/intern/usd_writer_abstract.cc
index 02906d649ca..9b1729072f9 100644
--- a/source/blender/usd/intern/usd_writer_abstract.cc
+++ b/source/blender/usd/intern/usd_writer_abstract.cc
@@ -5,16 +5,11 @@
 USDAbstractWriter::USDAbstractWriter(pxr::UsdStageRefPtr stage,
  const pxr::SdfPath _path,
  Object *ob_eval,
- const DEGObjectIterData _data,
- USDAbstractWriter *parent)
+ const DEGObjectIterData _data)
 : m_stage(stage), m_parent_path(parent_path), m_object(ob_eval), 

[Bf-blender-cvs] [e0f6435e6f6] sybren-usd-experiments: Hooked new iteration into existing writer creation

2019-06-19 Thread Sybren A. Stüvel
Commit: e0f6435e6f6694a5c1030d8f52faa0360b5917d5
Author: Sybren A. Stüvel
Date:   Wed Jun 19 17:52:07 2019 +0200
Branches: sybren-usd-experiments
https://developer.blender.org/rBe0f6435e6f6694a5c1030d8f52faa0360b5917d5

Hooked new iteration into existing writer creation

The writers still write the wrong data; calling them should be done
differently, and more should be done based on evaluated rather than
original data.

===

M   source/blender/usd/intern/abstract_hierarchy_iterator.cc
M   source/blender/usd/intern/abstract_hierarchy_iterator.h
M   source/blender/usd/intern/usd_exporter.cc
M   source/blender/usd/intern/usd_hierarchy_iterator.cc

===

diff --git a/source/blender/usd/intern/abstract_hierarchy_iterator.cc 
b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
index 4f2c1f7246b..71bea1d200f 100644
--- a/source/blender/usd/intern/abstract_hierarchy_iterator.cc
+++ b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
@@ -50,13 +50,13 @@ void AbstractHierarchyIterator::iterate()
 // Non-instanced objects always have their object-parent as export-parent.
 visit_object(base, base->object, base->object->parent, false);
 
-// Object *evaluated_ob = DEG_get_evaluated_object(depsgraph, object);
-// export_object_and_parents(ob, parent, dupliObParent);
-
+// Export the duplicated objects instanced by this object.
 ListBase *lb = object_duplilist(depsgraph, scene, base->object);
 if (lb) {
   DupliObject *link = nullptr;
 
+  // Construct the set of duplicated objects, so that later we can 
determine whether a parent
+  // is also duplicated itself.
   std::set dupli_set;
   for (link = static_cast(lb->first); link; link = 
link->next) {
 if (!should_visit_duplilink(link)) {
@@ -70,6 +70,7 @@ void AbstractHierarchyIterator::iterate()
 if (!should_visit_duplilink(link)) {
   continue;
 }
+
 // If the dupli-object's scene parent is also instanced by this 
object, use that as the
 // export parent. Otherwise use the dupli-parent as export parent.
 if (link->ob->parent != nullptr && dupli_set.find(link->ob->parent) != 
dupli_set.end()) {
@@ -78,6 +79,7 @@ void AbstractHierarchyIterator::iterate()
 else {
   export_parent = base->object;
 }
+
 visit_object(base, link->ob, export_parent, false);
   }
 }
@@ -85,6 +87,8 @@ void AbstractHierarchyIterator::iterate()
 free_object_duplilist(lb);
   }
 
+  // Add the parent objects that weren't included in this view layer as 
transform-only objects.
+  // This ensures that the object hierarchy in Blender is reflected in the 
exported file.
   printf("== adding xform-onlies:\n");
   while (!xform_onlies.empty()) {
 std::set::iterator first = xform_onlies.begin();
@@ -95,6 +99,7 @@ void AbstractHierarchyIterator::iterate()
 xform_onlies.erase(xform_only);
   }
 
+  // For debug: print the export graph.
   printf("== Export graph:\n");
   for (auto it : export_graph) {
 printf("OB %s:\n", it.first == nullptr ? "/" : (it.first->id.name + 
2));
@@ -105,19 +110,41 @@ void AbstractHierarchyIterator::iterate()
 }
   }
 
+  // For debug: print the export paths.
   printf("== Export paths:\n");
-  make_paths(nullptr, "");
+  make_writers(nullptr, "", nullptr);
 }
 
-void AbstractHierarchyIterator::make_paths(Object *for_object, const 
std::string _path)
+void AbstractHierarchyIterator::make_writers(Object *parent_object,
+ const std::string _path,
+ TEMP_WRITER_TYPE *parent_writer)
 {
-  for (auto it : export_graph[for_object]) {
-std::string usd_path = at_path + "/" + get_object_name(it.object);
+  TEMP_WRITER_TYPE *xform_writer = nullptr;
+  TEMP_WRITER_TYPE *data_writer = nullptr;
+
+  for (const ExportInfo _info : export_graph[parent_object]) {
+// TODO(Sybren): make the separator overridable in a subclass.
+std::string usd_path = parent_path + "/" + 
get_object_name(export_info.object);
+
+const char *colour = export_info.xform_only ? "31;1" : "30";
+printf("%s \033[%sm%s\033[0m\n",
+   usd_path.c_str(),
+   colour,
+   export_info.xform_only ? "true" : "false");
+
+xform_writer = create_xform_writer(usd_path, export_info.object, 
parent_writer);
+if (xform_writer != nullptr) {
+  writers[usd_path] = xform_writer;
+}
 
-const char *colour = it.xform_only ? "31;1" : "30";
-printf("%s \033[%sm%s\033[0m\n", usd_path.c_str(), colour, it.xform_only ? 
"true" : "false");
+if (!export_info.xform_only && export_info.object->data != nullptr) {
+  data_writer = create_data_writer(usd_path, export_info.object, 
xform_writer);
+  if (data_writer != nullptr) {
+writers[usd_path] = 

[Bf-blender-cvs] [2455339da02] sybren-usd-experiments: Support instanced collections

2019-06-19 Thread Sybren A. Stüvel
Commit: 2455339da0297fd82ee37cc50b96387cef8b70f6
Author: Sybren A. Stüvel
Date:   Thu Jun 13 11:13:00 2019 +0200
Branches: sybren-usd-experiments
https://developer.blender.org/rB2455339da0297fd82ee37cc50b96387cef8b70f6

Support instanced collections

===

M   source/blender/usd/CMakeLists.txt
M   source/blender/usd/intern/usd_exporter.cc
M   source/blender/usd/intern/usd_exporter.h
M   source/blender/usd/intern/usd_writer_mesh.cc
M   source/blender/usd/intern/usd_writer_transform.cc

===

diff --git a/source/blender/usd/CMakeLists.txt 
b/source/blender/usd/CMakeLists.txt
index d96b8cd3953..a77d20366ed 100644
--- a/source/blender/usd/CMakeLists.txt
+++ b/source/blender/usd/CMakeLists.txt
@@ -20,6 +20,12 @@
 
 include(/opt/usd/pxrConfig.cmake)
 
+# This suppresses the warning "This file includes at least one deprecated or 
antiquated header which
+# may be removed without further notice at a future date", which is caused by 
the USD library
+# including . Nothing we can do about that until they change what
+# they include, so this just suppresses it.
+add_definitions(-D_GLIBCXX_PERMIT_BACKWARD_HASH)
+
 set(INC
   .
   ../blenkernel
diff --git a/source/blender/usd/intern/usd_exporter.cc 
b/source/blender/usd/intern/usd_exporter.cc
index 36f690e603e..3feccbe3472 100644
--- a/source/blender/usd/intern/usd_exporter.cc
+++ b/source/blender/usd/intern/usd_exporter.cc
@@ -68,56 +68,97 @@ void USDExporter::operator()(float _progress, bool 
_was_canceled)
 
 bool USDExporter::export_object(Object *ob_eval, const DEGObjectIterData 
_data)
 {
-  const pxr::SdfPath root("/");
-  pxr::SdfPath parent_path;
-
-  // Compute the parent's SdfPath.
-  if (ob_eval->parent == NULL) {
-parent_path = root;
+  pxr::SdfPath parent_path = parent_usd_path(ob_eval, degiter_data);
+  if (parent_path.IsEmpty()) {
+return false;
   }
-  else {
-USDPathMap::iterator path_it = usd_object_paths.find(ob_eval->parent);
+
+  USDAbstractWriter *xform_writer, *data_writer;
+  xform_writer = export_object_xform(parent_path, ob_eval, degiter_data);
+  data_writer = export_object_data(xform_writer->usd_path(), ob_eval, 
degiter_data);
+
+  return data_writer != NULL;
+}
+
+pxr::SdfPath USDExporter::parent_usd_path(Object *ob_eval, const 
DEGObjectIterData _data)
+{
+  static const pxr::SdfPath root("/");
+  pxr::SdfPath parent_path(root);
+
+  // Prepend any dupli-parent USD path.
+  if (degiter_data.dupli_parent != NULL && degiter_data.dupli_parent != 
ob_eval) {
+USDPathMap::iterator path_it = 
usd_object_paths.find(degiter_data.dupli_parent);
 if (path_it == usd_object_paths.end()) {
-  printf("USD-\033[31mSKIPPING\033[0m object %s because parent %s hasn't 
been seen yet\n",
- ob_eval->id.name,
- ob_eval->parent->id.name);
-  return false;
+  printf(
+  "USD-\033[31mSKIPPING\033[0m object %s because dupli-parent %s 
hasn't been seen yet\n",
+  ob_eval->id.name,
+  degiter_data.dupli_parent->id.name);
+  return pxr::SdfPath();
 }
 parent_path = path_it->second;
   }
 
-  // Write the transform. This is always done, even when we don't write the 
data, as it makes it
-  // possible to reference collection-instantiating empties.
+  if (ob_eval->parent == NULL) {
+return parent_path;
+  }
+
+  // Append the parent object's USD path.
+  USDPathMap::iterator path_it = usd_object_paths.find(ob_eval->parent);
+  if (path_it == usd_object_paths.end()) {
+printf("USD-\033[31mSKIPPING\033[0m object %s because parent %s hasn't 
been seen yet\n",
+   ob_eval->id.name,
+   ob_eval->parent->id.name);
+return pxr::SdfPath();
+  }
+
+  return parent_path.AppendPath(path_it->second.MakeRelativePath(root));
+}
+
+/* Write the transform. This is always done, even when we don't write the 
data, as it makes it
+ * possible to reference collection-instantiating empties. */
+USDAbstractWriter *USDExporter::export_object_xform(const pxr::SdfPath 
_path,
+Object *ob_eval,
+const DEGObjectIterData 
_data)
+{
   USDAbstractWriter *xform_writer = new USDTransformWriter(
   m_stage, parent_path, ob_eval, degiter_data);
+
   const pxr::SdfPath _usd_path = xform_writer->usd_path();
   usd_object_paths[ob_eval] = xform_usd_path;
   usd_writers[xform_usd_path] = xform_writer;
   xform_writer->write();
 
-  // Write the object data, if we know how.
-  // TODO: let the writer determine whether the data is actually supported.
+  return xform_writer;
+}
+
+/* Write the object data, if we know how. */
+USDAbstractWriter *USDExporter::export_object_data(const pxr::SdfPath 
_path,
+   Object *ob_eval,
+   const 

[Bf-blender-cvs] [218d81a99b3] sybren-usd-experiments: Start of abstract hierarchy iterator for exporters

2019-06-19 Thread Sybren A. Stüvel
Commit: 218d81a99b3808a79a740a53421592080c5562fd
Author: Sybren A. Stüvel
Date:   Fri Jun 14 14:24:35 2019 +0200
Branches: sybren-usd-experiments
https://developer.blender.org/rB218d81a99b3808a79a740a53421592080c5562fd

Start of abstract hierarchy iterator for exporters

===

A   source/blender/usd/intern/usd_hierarchy_iterator.cc
A   source/blender/usd/intern/usd_hierarchy_iterator.h

===

diff --git a/source/blender/usd/intern/usd_hierarchy_iterator.cc 
b/source/blender/usd/intern/usd_hierarchy_iterator.cc
new file mode 100644
index 000..2f3da814f85
--- /dev/null
+++ b/source/blender/usd/intern/usd_hierarchy_iterator.cc
@@ -0,0 +1,185 @@
+#include "usd_hierarchy_iterator.h"
+
+#include 
+
+#include 
+
+extern "C" {
+#include "BKE_anim.h"
+#include "BLI_assert.h"
+
+#include "DEG_depsgraph_query.h"
+
+#include "DNA_ID.h"
+#include "DNA_layer_types.h"
+#include "DNA_object_types.h"
+}
+
+static std::string get_id_name(const Object *const ob)
+{
+  if (!ob) {
+return "";
+  }
+
+  return get_id_name(>id);
+}
+
+static std::string get_id_name(const ID *const id)
+{
+  if (!id)
+return "";
+
+  std::string name(id->name + 2);
+  return pxr::TfMakeValidIdentifier(name);
+}
+
+/**
+ * \brief get_object_dag_path_name returns the name under which the object
+ *  will be exported in the Alembic file. It is of the form
+ *  "[../grandparent/]parent/object" if dupli_parent is NULL, or
+ *  "dupli_parent/[../grandparent/]parent/object" otherwise.
+ * \param ob:
+ * \param dupli_parent:
+ * \return
+ */
+static std::string get_object_dag_path_name(const Object *const ob, Object 
*dupli_parent)
+{
+  std::string name = get_id_name(ob);
+
+  Object *p = ob->parent;
+
+  while (p) {
+name = get_id_name(p) + "/" + name;
+p = p->parent;
+  }
+
+  if (dupli_parent && (ob != dupli_parent)) {
+name = get_id_name(dupli_parent) + "/" + name;
+  }
+
+  return name;
+}
+
+void AbstractHierarchyIterator::iterate()
+{
+  ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph);
+  for (Base *base = static_cast(view_layer->object_bases.first); base; 
base = base->next) {
+Object *ob = base->object;
+visit_object(base, ob, ob->parent, NULL);
+  }
+}
+
+void AbstractHierarchyIterator::visit_object(Base *base,
+ Object *object,
+ Object *parent,
+ Object *dupliObParent)
+{
+  /* If an object isn't exported itself, its duplilist shouldn't be
+   * exported either. */
+  if (!should_visit_object(base, dupliObParent != NULL)) {
+return;
+  }
+
+  Object *ob = DEG_get_evaluated_object(depsgraph, object);
+  export_object_and_parents(ob, parent, dupliObParent);
+
+  ListBase *lb = object_duplilist(depsgraph, DEG_get_input_scene(depsgraph), 
ob);
+
+  if (lb) {
+DupliObject *link = static_cast(lb->first);
+Object *dupli_ob = NULL;
+Object *dupli_parent = NULL;
+
+for (; link; link = link->next) {
+  //   /* This skips things like custom bone shapes. */
+  //   if (m_settings.renderable_only && link->no_draw) {
+  // continue;
+  //   }
+
+  if (link->type == OB_DUPLICOLLECTION) {
+dupli_ob = link->ob;
+dupli_parent = (dupli_ob->parent) ? dupli_ob->parent : ob;
+
+visit_object(base, dupli_ob, dupli_parent, ob);
+  }
+}
+
+free_object_duplilist(lb);
+  }
+}
+
+TEMP_WRITER_TYPE *AbstractHierarchyIterator::export_object_and_parents(Object 
*ob,
+   Object 
*parent,
+   Object 
*dupliObParent)
+{
+  /* An object should not be its own parent, or we'll get infinite loops. */
+  BLI_assert(ob != parent);
+  BLI_assert(ob != dupliObParent);
+
+  std::string name;
+  //   if (m_settings.flatten_hierarchy) {
+  // name = get_id_name(ob);
+  //   }
+  //   else {
+  name = get_object_dag_path_name(ob, dupliObParent);
+  //   }
+
+  /* check if we have already created a transform writer for this object */
+  TEMP_WRITER_TYPE *my_writer = get_writer(name);
+  if (my_writer != NULL) {
+return my_writer;
+  }
+
+  TEMP_WRITER_TYPE *parent_writer = NULL;
+
+  if (/* m_settings.flatten_hierarchy || */ parent == NULL) {
+  }
+  else {
+/* Since there are so many different ways to find parents (as evident
+ * in the number of conditions below), we can't really look up the
+ * parent by name. We'll just call export_object_and_parents(), which will
+ * return the parent's writer pointer. */
+if (parent->parent) {
+  if (parent == dupliObParent) {
+parent_writer = export_object_and_parents(parent, parent->parent, 
NULL);
+  }
+  else {
+parent_writer = export_object_and_parents(parent, 

[Bf-blender-cvs] [f7431e44cc0] sybren-usd-experiments: Reorganising the USD exporter to be more like the Alembic one

2019-06-19 Thread Sybren A. Stüvel
Commit: f7431e44cc0296916946a89f6c885012d939295b
Author: Sybren A. Stüvel
Date:   Wed Jun 12 17:10:06 2019 +0200
Branches: sybren-usd-experiments
https://developer.blender.org/rBf7431e44cc0296916946a89f6c885012d939295b

Reorganising the USD exporter to be more like the Alembic one

===

M   source/blender/usd/CMakeLists.txt
M   source/blender/usd/intern/usd_exporter.cc
M   source/blender/usd/intern/usd_exporter.h
A   source/blender/usd/intern/usd_writer_abstract.cc
A   source/blender/usd/intern/usd_writer_abstract.h
A   source/blender/usd/intern/usd_writer_mesh.cc
A   source/blender/usd/intern/usd_writer_mesh.h
A   source/blender/usd/intern/usd_writer_transform.cc
A   source/blender/usd/intern/usd_writer_transform.h

===

diff --git a/source/blender/usd/CMakeLists.txt 
b/source/blender/usd/CMakeLists.txt
index 8ba8ceff587..d96b8cd3953 100644
--- a/source/blender/usd/CMakeLists.txt
+++ b/source/blender/usd/CMakeLists.txt
@@ -43,9 +43,15 @@ set(INC_SYS
 set(SRC
   intern/usd_capi.cc
   intern/usd_exporter.cc
+  intern/usd_writer_abstract.cc
+  intern/usd_writer_mesh.cc
+  intern/usd_writer_transform.cc
 
   usd.h
   intern/usd_exporter.h
+  intern/usd_writer_abstract.h
+  intern/usd_writer_mesh.h
+  intern/usd_writer_transform.h
 )
 
 set(LIB
diff --git a/source/blender/usd/intern/usd_exporter.cc 
b/source/blender/usd/intern/usd_exporter.cc
index 55e242c63a6..cffe76fabd0 100644
--- a/source/blender/usd/intern/usd_exporter.cc
+++ b/source/blender/usd/intern/usd_exporter.cc
@@ -19,6 +19,8 @@
  */
 
 #include "usd_exporter.h"
+#include "usd_writer_mesh.h"
+#include "usd_writer_transform.h"
 
 #include 
 #include 
@@ -31,6 +33,7 @@
 #include 
 
 extern "C" {
+#include "BKE_anim.h"
 #include "BKE_mesh_runtime.h"
 #include "BKE_scene.h"
 
@@ -83,21 +86,27 @@ bool USDExporter::export_object(Object *ob_eval, const 
DEGObjectIterData _)
   const pxr::SdfPath root("/");
   Mesh *mesh = ob_eval->runtime.mesh_eval;
   pxr::SdfPath parent_path;
-  float parent_relative_matrix[4][4];
+  USDAbstractWriter *parent_writer = NULL;
 
-  if (mesh == NULL || data_.dupli_object_current != NULL) {
-printf("USD-\033[34mSKIPPING\033[0m object %s  isinstance=%d type=%d mesh 
= %p\n",
+  if (mesh == NULL) {
+printf("USD-\033[34mSKIPPING\033[0m object %s  type=%d mesh = %p\n",
ob_eval->id.name,
-   data_.dupli_object_current != NULL,
+   ob_eval->type,
+   mesh);
+return false;
+  }
+  if (data_.dupli_object_current != NULL) {
+printf("USD-\033[34mSKIPPING\033[0m object %s  instance of %s  type=%d 
mesh = %p\n",
+   ob_eval->id.name,
+   data_.dupli_object_current->ob->id.name,
ob_eval->type,
mesh);
 return false;
   }
 
-  // Compute the parent's SdfPath and get the object matrix relative to the 
parent.
+  // Compute the parent's SdfPath.
   if (ob_eval->parent == NULL) {
 parent_path = root;
-copy_m4_m4(parent_relative_matrix, ob_eval->obmat);
   }
   else {
 USDPathMap::iterator path_it = usd_object_paths.find(ob_eval->parent);
@@ -108,59 +117,21 @@ bool USDExporter::export_object(Object *ob_eval, const 
DEGObjectIterData _)
   return false;
 }
 parent_path = path_it->second;
-
-invert_m4_m4(ob_eval->imat, ob_eval->obmat);
-mul_m4_m4m4(parent_relative_matrix, ob_eval->parent->imat, ob_eval->obmat);
+parent_writer = usd_writers[parent_path];
   }
 
-  std::string xform_name = pxr::TfMakeValidIdentifier(ob_eval->id.name + 2);
-  pxr::SdfPath xform_path = parent_path.AppendPath(pxr::SdfPath(xform_name));
-  usd_object_paths[ob_eval] = xform_path;
-
-  printf("USD-\033[32mexporting\033[0m object %s → %s   isinstance=%d type=%d 
mesh = %p\n",
- ob_eval->id.name,
- xform_path.GetString().c_str(),
- data_.dupli_object_current != NULL,
- ob_eval->type,
- mesh);
-
-  // Write the transform relative to the parent.
-  pxr::UsdGeomXform xform = pxr::UsdGeomXform::Define(m_stage, xform_path);
-  xform.AddTransformOp().Set(pxr::GfMatrix4d(parent_relative_matrix));
-
-  // Write the mesh.
-  std::string mesh_name = pxr::TfMakeValidIdentifier(mesh->id.name + 2);
-  pxr::SdfPath mesh_path(xform_path.AppendPath(pxr::SdfPath(mesh_name)));
-  pxr::UsdGeomMesh usd_mesh = pxr::UsdGeomMesh::Define(m_stage, mesh_path);
-
-  const MVert *verts = mesh->mvert;
-
-  // TODO(Sybren): there is probably a more C++-y way to do this, which avoids 
copying the entire
-  // mesh to a different structure. I haven't seen the approach below in the 
USD exporters for
-  // Maya/Houdini, but it's simple and it works for now.
-  pxr::VtArray usd_points;
-  usd_points.reserve(mesh->totvert);
-  for (int i = 0; i < mesh->totvert; ++i) {
-usd_points.push_back(pxr::GfVec3f(verts[i].co));
-  }
-  usd_mesh.CreatePointsAttr().Set(usd_points);
+ 

[Bf-blender-cvs] [24eec468fd7] sybren-usd-experiments: Add some more timing & more useful temp logging

2019-06-19 Thread Sybren A. Stüvel
Commit: 24eec468fd7c6af18a4b76a728ca342666af935a
Author: Sybren A. Stüvel
Date:   Wed Jun 12 12:24:36 2019 +0200
Branches: sybren-usd-experiments
https://developer.blender.org/rB24eec468fd7c6af18a4b76a728ca342666af935a

Add some more timing & more useful temp logging

===

M   source/blender/usd/intern/usd_capi.cc
M   source/blender/usd/intern/usd_exporter.cc
M   source/blender/usd/intern/usd_exporter.h

===

diff --git a/source/blender/usd/intern/usd_capi.cc 
b/source/blender/usd/intern/usd_capi.cc
index 1193467b181..63016825089 100644
--- a/source/blender/usd/intern/usd_capi.cc
+++ b/source/blender/usd/intern/usd_capi.cc
@@ -59,6 +59,7 @@ struct ExportJobData {
 
 static void export_startjob(void *customdata, short *stop, short *do_update, 
float *progress)
 {
+  Timer timer_("Export to USD");
   ExportJobData *data = static_cast(customdata);
 
   data->stop = stop;
diff --git a/source/blender/usd/intern/usd_exporter.cc 
b/source/blender/usd/intern/usd_exporter.cc
index 63bd22d737f..55e242c63a6 100644
--- a/source/blender/usd/intern/usd_exporter.cc
+++ b/source/blender/usd/intern/usd_exporter.cc
@@ -22,6 +22,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -54,8 +55,7 @@ USDExporter::~USDExporter()
 
 void USDExporter::operator()(float _progress, bool _was_canceled)
 {
-  timespec ts_begin;
-  clock_gettime(CLOCK_MONOTONIC, _begin);
+  Timer timer_("Writing to USD");
 
   r_progress = 0.0;
   r_was_canceled = false;
@@ -75,12 +75,6 @@ void USDExporter::operator()(float _progress, bool 
_was_canceled)
 
   m_stage->GetRootLayer()->Save();
 
-  timespec ts_end;
-  clock_gettime(CLOCK_MONOTONIC, _end);
-  double duration = double(ts_end.tv_sec - ts_begin.tv_sec) +
-double(ts_end.tv_nsec - ts_begin.tv_nsec) / 1e9;
-  printf("Export to USD took %.3f sec wallclock time\n", duration);
-
   r_progress = 1.0;
 }
 
@@ -99,11 +93,6 @@ bool USDExporter::export_object(Object *ob_eval, const 
DEGObjectIterData _)
mesh);
 return false;
   }
-  printf("USD-\033[32mexporting\033[0m object %s  isinstance=%d type=%d mesh = 
%p\n",
- ob_eval->id.name,
- data_.dupli_object_current != NULL,
- ob_eval->type,
- mesh);
 
   // Compute the parent's SdfPath and get the object matrix relative to the 
parent.
   if (ob_eval->parent == NULL) {
@@ -123,15 +112,25 @@ bool USDExporter::export_object(Object *ob_eval, const 
DEGObjectIterData _)
 invert_m4_m4(ob_eval->imat, ob_eval->obmat);
 mul_m4_m4m4(parent_relative_matrix, ob_eval->parent->imat, ob_eval->obmat);
   }
-  pxr::SdfPath xform_path = 
parent_path.AppendPath(pxr::SdfPath(ob_eval->id.name + 2));
+
+  std::string xform_name = pxr::TfMakeValidIdentifier(ob_eval->id.name + 2);
+  pxr::SdfPath xform_path = parent_path.AppendPath(pxr::SdfPath(xform_name));
   usd_object_paths[ob_eval] = xform_path;
 
+  printf("USD-\033[32mexporting\033[0m object %s → %s   isinstance=%d type=%d 
mesh = %p\n",
+ ob_eval->id.name,
+ xform_path.GetString().c_str(),
+ data_.dupli_object_current != NULL,
+ ob_eval->type,
+ mesh);
+
   // Write the transform relative to the parent.
   pxr::UsdGeomXform xform = pxr::UsdGeomXform::Define(m_stage, xform_path);
   xform.AddTransformOp().Set(pxr::GfMatrix4d(parent_relative_matrix));
 
   // Write the mesh.
-  pxr::SdfPath 
mesh_path(xform_path.AppendPath(pxr::SdfPath(std::string(mesh->id.name;
+  std::string mesh_name = pxr::TfMakeValidIdentifier(mesh->id.name + 2);
+  pxr::SdfPath mesh_path(xform_path.AppendPath(pxr::SdfPath(mesh_name)));
   pxr::UsdGeomMesh usd_mesh = pxr::UsdGeomMesh::Define(m_stage, mesh_path);
 
   const MVert *verts = mesh->mvert;
diff --git a/source/blender/usd/intern/usd_exporter.h 
b/source/blender/usd/intern/usd_exporter.h
index 03ed66a52b3..2e77ac2cad5 100644
--- a/source/blender/usd/intern/usd_exporter.h
+++ b/source/blender/usd/intern/usd_exporter.h
@@ -43,6 +43,27 @@ struct ExportSettings {
   USDExportParams params;
 };
 
+// Temporary class for timing stuff.
+#include 
+class Timer {
+  timespec ts_begin;
+  std::string label;
+
+ public:
+  explicit Timer(std::string label) : label(label)
+  {
+clock_gettime(CLOCK_MONOTONIC, _begin);
+  }
+  ~Timer()
+  {
+timespec ts_end;
+clock_gettime(CLOCK_MONOTONIC, _end);
+double duration = double(ts_end.tv_sec - ts_begin.tv_sec) +
+  double(ts_end.tv_nsec - ts_begin.tv_nsec) / 1e9;
+printf("%s took %.3f sec wallclock time\n", label.c_str(), duration);
+  }
+};
+
 class USDExporter {
   ExportSettings _settings;
   const char *m_filename;

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


[Bf-blender-cvs] [f8d2e791504] sybren-usd-experiments: Removed unused includes

2019-06-19 Thread Sybren A. Stüvel
Commit: f8d2e791504c823ab71904e7ca229f5010881560
Author: Sybren A. Stüvel
Date:   Wed Jun 12 17:15:18 2019 +0200
Branches: sybren-usd-experiments
https://developer.blender.org/rBf8d2e791504c823ab71904e7ca229f5010881560

Removed unused includes

===

M   source/blender/usd/intern/usd_exporter.cc

===

diff --git a/source/blender/usd/intern/usd_exporter.cc 
b/source/blender/usd/intern/usd_exporter.cc
index cffe76fabd0..5bd38363f0e 100644
--- a/source/blender/usd/intern/usd_exporter.cc
+++ b/source/blender/usd/intern/usd_exporter.cc
@@ -22,15 +22,8 @@
 #include "usd_writer_mesh.h"
 #include "usd_writer_transform.h"
 
-#include 
-#include 
-#include 
 #include 
-#include 
-#include 
-
-#include 
-#include 
+#include 
 
 extern "C" {
 #include "BKE_anim.h"
@@ -38,13 +31,8 @@ extern "C" {
 #include "BKE_scene.h"
 
 #include "BLI_iterator.h"
-#include "BLI_math_matrix.h"
 
 #include "DEG_depsgraph_query.h"
-
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
 }
 
 USDExporter::USDExporter(const char *filename, ExportSettings )

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


[Bf-blender-cvs] [2e99973566d] sybren-usd-experiments: Just a quick hack getting USD support in there to export a mesh

2019-06-19 Thread Sybren A. Stüvel
Commit: 2e99973566d2d7a2d3fe7c287d569fb15121f4da
Author: Sybren A. Stüvel
Date:   Tue Jun 11 11:47:40 2019 +0200
Branches: sybren-usd-experiments
https://developer.blender.org/rB2e99973566d2d7a2d3fe7c287d569fb15121f4da

Just a quick hack getting USD support in there to export a mesh

===

M   CMakeLists.txt
A   build_files/cmake/Modules/FindUSD.cmake
M   source/blender/CMakeLists.txt
M   source/blender/editors/io/CMakeLists.txt
M   source/blender/editors/io/io_ops.c
A   source/blender/editors/io/io_usd.c
A   source/blender/editors/io/io_usd.h
M   source/blender/editors/space_file/filelist.c
M   source/blender/makesdna/DNA_space_types.h
A   source/blender/usd/CMakeLists.txt
A   source/blender/usd/intern/usd_capi.cc
A   source/blender/usd/intern/usd_exporter.cc
A   source/blender/usd/intern/usd_exporter.h
A   source/blender/usd/usd.h

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4dd165b0185..31ba7874fdb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -323,6 +323,9 @@ option(WITH_CODEC_SNDFILE   "Enable libsndfile Support 
(http://www.mega-nerd
 option(WITH_ALEMBIC "Enable Alembic Support" OFF)
 option(WITH_ALEMBIC_HDF5"Enable Legacy Alembic Support (not officially 
supported)" OFF)
 
+# Universal Scene Description support
+option(WITH_USD "Enable Universal Scene Description (USD) 
Support" OFF)
+
 # 3D format support
 # Disable opencollada when we don't have precompiled libs
 option(WITH_OPENCOLLADA   "Enable OpenCollada Support 
(http://www.opencollada.org)" ${_init_OPENCOLLADA})
@@ -1762,6 +1765,7 @@ if(FIRST_RUN)
   info_cfg_option(WITH_OPENCOLORIO)
   info_cfg_option(WITH_OPENVDB)
   info_cfg_option(WITH_ALEMBIC)
+  info_cfg_option(WITH_USD)
 
   info_cfg_text("Compiler Options:")
   info_cfg_option(WITH_BUILDINFO)
diff --git a/build_files/cmake/Modules/FindUSD.cmake 
b/build_files/cmake/Modules/FindUSD.cmake
new file mode 100644
index 000..65716e97c66
--- /dev/null
+++ b/build_files/cmake/Modules/FindUSD.cmake
@@ -0,0 +1,70 @@
+# - Find Universal Scene Description (USD) library
+# Find the native USD includes and libraries
+# This module defines
+#  USD_INCLUDE_DIRS, where to find USD headers, Set when
+#USD_INCLUDE_DIR is found.
+#  USD_LIBRARIES, libraries to link against to use USD.
+#  USD_ROOT_DIR, The base directory to search for USD.
+#This can also be an environment variable.
+#  USD_FOUND, If false, do not try to use USD.
+#
+
+#=
+# Copyright 2019 Blender Foundation.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=
+
+# If USD_ROOT_DIR was defined in the environment, use it.
+IF(NOT USD_ROOT_DIR AND NOT $ENV{USD_ROOT_DIR} STREQUAL "")
+  SET(USD_ROOT_DIR $ENV{USD_ROOT_DIR})
+ENDIF()
+
+SET(_usd_SEARCH_DIRS
+  ${USD_ROOT_DIR}
+  /usr/local
+  /sw # Fink
+  /opt/local # DarwinPorts
+  /opt/lib/usd
+  /opt/usd
+)
+
+FIND_PATH(USD_INCLUDE_DIR
+  NAMES
+pxr/usd/usd/api.h
+  HINTS
+${_usd_SEARCH_DIRS}
+  PATH_SUFFIXES
+include
+)
+
+FIND_LIBRARY(USD_LIBRARY
+  NAMES
+  usd
+  HINTS
+${_usd_SEARCH_DIRS}
+  PATH_SUFFIXES
+lib64 lib lib/static
+)
+
+# handle the QUIETLY and REQUIRED arguments and set USD_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(USD DEFAULT_MSG USD_LIBRARY USD_INCLUDE_DIR)
+
+IF(USD_FOUND)
+  SET(USD_LIBRARIES ${USD_LIBRARY})
+  SET(USD_INCLUDE_DIRS ${USD_INCLUDE_DIR})
+ENDIF(USD_FOUND)
+
+MARK_AS_ADVANCED(
+  USD_INCLUDE_DIR
+  USD_LIBRARY
+)
+
+UNSET(_usd_SEARCH_DIRS)
diff --git a/source/blender/CMakeLists.txt b/source/blender/CMakeLists.txt
index 76442048594..2f00cce25b3 100644
--- a/source/blender/CMakeLists.txt
+++ b/source/blender/CMakeLists.txt
@@ -153,3 +153,6 @@ endif()
 if(WITH_ALEMBIC)
   add_subdirectory(alembic)
 endif()
+if(WITH_USD)
+  add_subdirectory(usd)
+endif()
diff --git a/source/blender/editors/io/CMakeLists.txt 
b/source/blender/editors/io/CMakeLists.txt
index 5a35b251d0c..5afe348158f 100644
--- a/source/blender/editors/io/CMakeLists.txt
+++ b/source/blender/editors/io/CMakeLists.txt
@@ -26,6 +26,7 @@ set(INC
   ../../depsgraph
   ../../makesdna
   ../../makesrna
+  ../../usd
   ../../windowmanager
   ../../../../intern/guardedalloc
 )
@@ -39,11 +40,13 @@ set(SRC
   io_cache.c
   io_collada.c
   io_ops.c
+  io_usd.c
 
   io_alembic.h
   io_cache.h
   io_collada.h
 

[Bf-blender-cvs] [86257fb0e56] sybren-usd-experiments: Hooked new iteration into existing writer creation

2019-06-19 Thread Sybren A. Stüvel
Commit: 86257fb0e562608c27bbce593a3f05765c9d90e3
Author: Sybren A. Stüvel
Date:   Wed Jun 19 17:52:07 2019 +0200
Branches: sybren-usd-experiments
https://developer.blender.org/rB86257fb0e562608c27bbce593a3f05765c9d90e3

Hooked new iteration into existing writer creation

The writers still write the wrong data; calling them should be done
differently, and more should be done based on evaluated rather than
original data.

===

M   source/blender/usd/intern/abstract_hierarchy_iterator.cc
M   source/blender/usd/intern/abstract_hierarchy_iterator.h
M   source/blender/usd/intern/usd_exporter.cc
M   source/blender/usd/intern/usd_hierarchy_iterator.cc

===

diff --git a/source/blender/usd/intern/abstract_hierarchy_iterator.cc 
b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
index 4f2c1f7246b..71bea1d200f 100644
--- a/source/blender/usd/intern/abstract_hierarchy_iterator.cc
+++ b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
@@ -50,13 +50,13 @@ void AbstractHierarchyIterator::iterate()
 // Non-instanced objects always have their object-parent as export-parent.
 visit_object(base, base->object, base->object->parent, false);
 
-// Object *evaluated_ob = DEG_get_evaluated_object(depsgraph, object);
-// export_object_and_parents(ob, parent, dupliObParent);
-
+// Export the duplicated objects instanced by this object.
 ListBase *lb = object_duplilist(depsgraph, scene, base->object);
 if (lb) {
   DupliObject *link = nullptr;
 
+  // Construct the set of duplicated objects, so that later we can 
determine whether a parent
+  // is also duplicated itself.
   std::set dupli_set;
   for (link = static_cast(lb->first); link; link = 
link->next) {
 if (!should_visit_duplilink(link)) {
@@ -70,6 +70,7 @@ void AbstractHierarchyIterator::iterate()
 if (!should_visit_duplilink(link)) {
   continue;
 }
+
 // If the dupli-object's scene parent is also instanced by this 
object, use that as the
 // export parent. Otherwise use the dupli-parent as export parent.
 if (link->ob->parent != nullptr && dupli_set.find(link->ob->parent) != 
dupli_set.end()) {
@@ -78,6 +79,7 @@ void AbstractHierarchyIterator::iterate()
 else {
   export_parent = base->object;
 }
+
 visit_object(base, link->ob, export_parent, false);
   }
 }
@@ -85,6 +87,8 @@ void AbstractHierarchyIterator::iterate()
 free_object_duplilist(lb);
   }
 
+  // Add the parent objects that weren't included in this view layer as 
transform-only objects.
+  // This ensures that the object hierarchy in Blender is reflected in the 
exported file.
   printf("== adding xform-onlies:\n");
   while (!xform_onlies.empty()) {
 std::set::iterator first = xform_onlies.begin();
@@ -95,6 +99,7 @@ void AbstractHierarchyIterator::iterate()
 xform_onlies.erase(xform_only);
   }
 
+  // For debug: print the export graph.
   printf("== Export graph:\n");
   for (auto it : export_graph) {
 printf("OB %s:\n", it.first == nullptr ? "/" : (it.first->id.name + 
2));
@@ -105,19 +110,41 @@ void AbstractHierarchyIterator::iterate()
 }
   }
 
+  // For debug: print the export paths.
   printf("== Export paths:\n");
-  make_paths(nullptr, "");
+  make_writers(nullptr, "", nullptr);
 }
 
-void AbstractHierarchyIterator::make_paths(Object *for_object, const 
std::string _path)
+void AbstractHierarchyIterator::make_writers(Object *parent_object,
+ const std::string _path,
+ TEMP_WRITER_TYPE *parent_writer)
 {
-  for (auto it : export_graph[for_object]) {
-std::string usd_path = at_path + "/" + get_object_name(it.object);
+  TEMP_WRITER_TYPE *xform_writer = nullptr;
+  TEMP_WRITER_TYPE *data_writer = nullptr;
+
+  for (const ExportInfo _info : export_graph[parent_object]) {
+// TODO(Sybren): make the separator overridable in a subclass.
+std::string usd_path = parent_path + "/" + 
get_object_name(export_info.object);
+
+const char *colour = export_info.xform_only ? "31;1" : "30";
+printf("%s \033[%sm%s\033[0m\n",
+   usd_path.c_str(),
+   colour,
+   export_info.xform_only ? "true" : "false");
+
+xform_writer = create_xform_writer(usd_path, export_info.object, 
parent_writer);
+if (xform_writer != nullptr) {
+  writers[usd_path] = xform_writer;
+}
 
-const char *colour = it.xform_only ? "31;1" : "30";
-printf("%s \033[%sm%s\033[0m\n", usd_path.c_str(), colour, it.xform_only ? 
"true" : "false");
+if (!export_info.xform_only && export_info.object->data != nullptr) {
+  data_writer = create_data_writer(usd_path, export_info.object, 
xform_writer);
+  if (data_writer != nullptr) {
+writers[usd_path] = 

[Bf-blender-cvs] [9f38b7f951d] sybren-usd-experiments: Working on a smarter way to construct the USD object hierarchy

2019-06-19 Thread Sybren A. Stüvel
Commit: 9f38b7f951dcff96d999c2ae0ffd05eb05158455
Author: Sybren A. Stüvel
Date:   Wed Jun 19 17:32:08 2019 +0200
Branches: sybren-usd-experiments
https://developer.blender.org/rB9f38b7f951dcff96d999c2ae0ffd05eb05158455

Working on a smarter way to construct the USD object hierarchy

===

M   source/blender/usd/intern/abstract_hierarchy_iterator.cc
M   source/blender/usd/intern/abstract_hierarchy_iterator.h
M   source/blender/usd/intern/usd_exporter.cc

===

diff --git a/source/blender/usd/intern/abstract_hierarchy_iterator.cc 
b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
index 525408639aa..4f2c1f7246b 100644
--- a/source/blender/usd/intern/abstract_hierarchy_iterator.cc
+++ b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
@@ -39,9 +39,85 @@ void AbstractHierarchyIterator::release_writers()
 void AbstractHierarchyIterator::iterate()
 {
   ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph);
+
+  printf("== Visiting objects:\n");
+  Scene *scene = DEG_get_input_scene(depsgraph);
   for (Base *base = static_cast(view_layer->object_bases.first); base; 
base = base->next) {
-Object *ob = base->object;
-visit_object(base, ob, ob->parent, nullptr);
+if (base->flag & BASE_HOLDOUT) {
+  continue;
+}
+
+// Non-instanced objects always have their object-parent as export-parent.
+visit_object(base, base->object, base->object->parent, false);
+
+// Object *evaluated_ob = DEG_get_evaluated_object(depsgraph, object);
+// export_object_and_parents(ob, parent, dupliObParent);
+
+ListBase *lb = object_duplilist(depsgraph, scene, base->object);
+if (lb) {
+  DupliObject *link = nullptr;
+
+  std::set dupli_set;
+  for (link = static_cast(lb->first); link; link = 
link->next) {
+if (!should_visit_duplilink(link)) {
+  continue;
+}
+dupli_set.insert(link->ob);
+  }
+
+  Object *export_parent = nullptr;
+  for (link = static_cast(lb->first); link; link = 
link->next) {
+if (!should_visit_duplilink(link)) {
+  continue;
+}
+// If the dupli-object's scene parent is also instanced by this 
object, use that as the
+// export parent. Otherwise use the dupli-parent as export parent.
+if (link->ob->parent != nullptr && dupli_set.find(link->ob->parent) != 
dupli_set.end()) {
+  export_parent = link->ob->parent;
+}
+else {
+  export_parent = base->object;
+}
+visit_object(base, link->ob, export_parent, false);
+  }
+}
+
+free_object_duplilist(lb);
+  }
+
+  printf("== adding xform-onlies:\n");
+  while (!xform_onlies.empty()) {
+std::set::iterator first = xform_onlies.begin();
+
+Object *xform_only = *first;
+visit_object(nullptr, xform_only, xform_only->parent, true);
+
+xform_onlies.erase(xform_only);
+  }
+
+  printf("== Export graph:\n");
+  for (auto it : export_graph) {
+printf("OB %s:\n", it.first == nullptr ? "/" : (it.first->id.name + 
2));
+for (auto child_it : it.second) {
+  printf("   - %s (xform_only=%s)\n",
+ child_it.object->id.name + 2,
+ child_it.xform_only ? "true" : "false");
+}
+  }
+
+  printf("== Export paths:\n");
+  make_paths(nullptr, "");
+}
+
+void AbstractHierarchyIterator::make_paths(Object *for_object, const 
std::string _path)
+{
+  for (auto it : export_graph[for_object]) {
+std::string usd_path = at_path + "/" + get_object_name(it.object);
+
+const char *colour = it.xform_only ? "31;1" : "30";
+printf("%s \033[%sm%s\033[0m\n", usd_path.c_str(), colour, it.xform_only ? 
"true" : "false");
+
+make_paths(it.object, usd_path);
   }
 }
 
@@ -103,37 +179,56 @@ bool 
AbstractHierarchyIterator::should_visit_duplilink(const DupliObject *const
 
 void AbstractHierarchyIterator::visit_object(Base *base,
  Object *object,
- Object *parent,
- Object *dupliObParent)
+ Object *export_parent,
+ bool xform_only)
 {
   /* If an object isn't exported itself, its duplilist shouldn't be
* exported either. */
-  if (!should_visit_object(base, dupliObParent != nullptr)) {
+  if (!should_visit_object(base, false)) {
 return;
   }
 
-  Object *ob = DEG_get_evaluated_object(depsgraph, object);
-  export_object_and_parents(ob, parent, dupliObParent);
-
-  ListBase *lb = object_duplilist(depsgraph, DEG_get_input_scene(depsgraph), 
ob);
-
-  if (lb) {
-DupliObject *link = static_cast(lb->first);
-Object *dupli_ob = nullptr;
-Object *dupli_parent = nullptr;
-
-for (; link; link = link->next) {
-  if 

[Bf-blender-cvs] [ccf06c1ff21] master: Fix T65780: unnecessary GPU image texture reloads after recent changes

2019-06-19 Thread Brecht Van Lommel
Commit: ccf06c1ff218971d6844b7a8e6ad021cdc90ea3d
Author: Brecht Van Lommel
Date:   Wed Jun 19 17:49:39 2019 +0200
Branches: master
https://developer.blender.org/rBccf06c1ff218971d6844b7a8e6ad021cdc90ea3d

Fix T65780: unnecessary GPU image texture reloads after recent changes

===

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

===

diff --git a/source/blender/blenkernel/intern/image.c 
b/source/blender/blenkernel/intern/image.c
index b90cd9f15f8..5c23987a8d9 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -4812,7 +4812,7 @@ void BKE_image_user_frame_calc(Image *ima, ImageUser 
*iuser, int cfra)
 
 iuser->framenr = framenr;
 
-if (ima && ima->gpuframenr != framenr) {
+if (ima && BKE_image_is_animated(ima) && ima->gpuframenr != framenr) {
   /* Note: a single texture and refresh doesn't really work when
* multiple image users may use different frames, this is to
* be improved with perhaps a GPU texture cache. */

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


[Bf-blender-cvs] [2925288b3a0] sybren-usd-experiments: NO PUSH delayed write

2019-06-19 Thread Sybren A. Stüvel
Commit: 2925288b3a05760f8b17de231d15b70416ecd30c
Author: Sybren A. Stüvel
Date:   Tue Jun 18 14:31:12 2019 +0200
Branches: sybren-usd-experiments
https://developer.blender.org/rB2925288b3a05760f8b17de231d15b70416ecd30c

NO PUSH delayed write

===

M   source/blender/usd/intern/abstract_hierarchy_iterator.cc
M   source/blender/usd/intern/usd_exporter.cc
M   source/blender/usd/intern/usd_exporter_context.h
M   source/blender/usd/intern/usd_hierarchy_iterator.cc
M   source/blender/usd/intern/usd_writer_abstract.cc
M   source/blender/usd/intern/usd_writer_abstract.h
M   source/blender/usd/intern/usd_writer_mesh.cc
M   source/blender/usd/intern/usd_writer_transform.cc

===

diff --git a/source/blender/usd/intern/abstract_hierarchy_iterator.cc 
b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
index b108f38accc..525408639aa 100644
--- a/source/blender/usd/intern/abstract_hierarchy_iterator.cc
+++ b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
@@ -23,6 +23,11 @@ AbstractHierarchyIterator::~AbstractHierarchyIterator()
 {
 }
 
+const AbstractHierarchyIterator::WriterMap 
::writer_map() const
+{
+  return writers;
+}
+
 void AbstractHierarchyIterator::release_writers()
 {
   for (WriterMap::value_type it : writers) {
diff --git a/source/blender/usd/intern/usd_exporter.cc 
b/source/blender/usd/intern/usd_exporter.cc
index 2908f5a892b..6b15e4672ba 100644
--- a/source/blender/usd/intern/usd_exporter.cc
+++ b/source/blender/usd/intern/usd_exporter.cc
@@ -60,6 +60,13 @@ void USDExporter::operator()(float _progress, bool 
_was_canceled)
   USDHierarchyIterator iter(m_settings.depsgraph, m_stage);
   iter.iterate();
 
+  for (AbstractHierarchyIterator::WriterMap::value_type it : 
iter.writer_map()) {
+USDAbstractWriter *writer = static_cast(it.second);
+printf("  ==> %s\n", it.first.c_str());
+writer->write();
+  }
+  iter.release_writers();
+
   m_stage->GetRootLayer()->Save();
   r_progress = 1.0;
 }
diff --git a/source/blender/usd/intern/usd_exporter_context.h 
b/source/blender/usd/intern/usd_exporter_context.h
index 9c738cd8433..b8b0a746028 100644
--- a/source/blender/usd/intern/usd_exporter_context.h
+++ b/source/blender/usd/intern/usd_exporter_context.h
@@ -4,9 +4,11 @@
 #include 
 #include 
 
+struct Depsgraph;
 struct Object;
 
 struct USDExporterContext {
+  Depsgraph *depsgraph;
   pxr::UsdStageRefPtr stage;
   pxr::SdfPath usd_path;
   Object *ob_eval;
diff --git a/source/blender/usd/intern/usd_hierarchy_iterator.cc 
b/source/blender/usd/intern/usd_hierarchy_iterator.cc
index 5c64f42f939..d8a0a9c35f2 100644
--- a/source/blender/usd/intern/usd_hierarchy_iterator.cc
+++ b/source/blender/usd/intern/usd_hierarchy_iterator.cc
@@ -44,10 +44,8 @@ TEMP_WRITER_TYPE 
*USDHierarchyIterator::create_xform_writer(const std::string 
   printf("\033[32;1mCREATE\033[0m %s at %s\n", object->id.name, name.c_str());
   pxr::SdfPath usd_path("/" + name);
 
-  USDExporterContext ctx = {stage, usd_path, object, NULL};
-  USDAbstractWriter *xform_writer = new USDTransformWriter(ctx);
-  xform_writer->write();
-  return xform_writer;
+  USDExporterContext ctx = {depsgraph, stage, usd_path, object, nullptr};
+  return new USDTransformWriter(ctx);
 }
 
 TEMP_WRITER_TYPE *USDHierarchyIterator::create_data_writer(const std::string 
,
@@ -57,8 +55,9 @@ TEMP_WRITER_TYPE 
*USDHierarchyIterator::create_data_writer(const std::string 
   pxr::SdfPath usd_path("/" + name);
   std::string data_name(get_id_name((ID *)object->data));
 
-  USDExporterContext ctx = {stage, 
usd_path.AppendPath(pxr::SdfPath(data_name)), object, NULL};
-  USDAbstractWriter *data_writer = NULL;
+  USDExporterContext ctx = {
+  depsgraph, stage, usd_path.AppendPath(pxr::SdfPath(data_name)), object, 
nullptr};
+  USDAbstractWriter *data_writer = nullptr;
 
   switch (ctx.ob_eval->type) {
 case OB_MESH:
@@ -79,7 +78,5 @@ TEMP_WRITER_TYPE 
*USDHierarchyIterator::create_data_writer(const std::string 
 return nullptr;
   }
 
-  data_writer->write();
-
   return data_writer;
 }
diff --git a/source/blender/usd/intern/usd_writer_abstract.cc 
b/source/blender/usd/intern/usd_writer_abstract.cc
index b5c296a4830..b7677ff6446 100644
--- a/source/blender/usd/intern/usd_writer_abstract.cc
+++ b/source/blender/usd/intern/usd_writer_abstract.cc
@@ -3,7 +3,7 @@
 #include 
 
 USDAbstractWriter::USDAbstractWriter(const USDExporterContext )
-: stage(ctx.stage), usd_path_(ctx.usd_path), object(ctx.ob_eval)
+: depsgraph(ctx.depsgraph), stage(ctx.stage), usd_path_(ctx.usd_path), 
object(ctx.ob_eval)
 {
 }
 
diff --git a/source/blender/usd/intern/usd_writer_abstract.h 
b/source/blender/usd/intern/usd_writer_abstract.h
index a082e37dd34..063fd196941 100644
--- a/source/blender/usd/intern/usd_writer_abstract.h
+++ b/source/blender/usd/intern/usd_writer_abstract.h
@@ -15,6 +15,7 @@ struct 

[Bf-blender-cvs] [b5648b587ae] sybren-usd-experiments: Merge remote-tracking branch 'origin/master' into sybren-usd-experiments

2019-06-19 Thread Sybren A. Stüvel
Commit: b5648b587aedd59dce08bb4e8e56afba97c4c668
Author: Sybren A. Stüvel
Date:   Wed Jun 19 16:00:50 2019 +0200
Branches: sybren-usd-experiments
https://developer.blender.org/rBb5648b587aedd59dce08bb4e8e56afba97c4c668

Merge remote-tracking branch 'origin/master' into sybren-usd-experiments

===



===



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


[Bf-blender-cvs] [b18f5a6a814] soc-2019-openxr: Pass graphics context data to OpenXR graphics bindings on Linux too

2019-06-19 Thread Julian Eisel
Commit: b18f5a6a814263d1dd497926059fa4003263cdf0
Author: Julian Eisel
Date:   Wed Jun 19 17:23:41 2019 +0200
Branches: soc-2019-openxr
https://developer.blender.org/rBb18f5a6a814263d1dd497926059fa4003263cdf0

Pass graphics context data to OpenXR graphics bindings on Linux too

Refactors function into a class, and make this class a friend of
GHOST_ContextGLX. That seems like a better way to access low level
graphics data for this specific case, rather than giving anyone access
via a getter.

===

M   intern/ghost/intern/GHOST_ContextGLX.h
M   intern/ghost/intern/GHOST_XR.cpp
M   intern/ghost/intern/GHOST_XRSession.cpp
M   intern/ghost/intern/GHOST_XR_intern.h
M   release/scripts/addons

===

diff --git a/intern/ghost/intern/GHOST_ContextGLX.h 
b/intern/ghost/intern/GHOST_ContextGLX.h
index ba8df7dac1b..69a7246a238 100644
--- a/intern/ghost/intern/GHOST_ContextGLX.h
+++ b/intern/ghost/intern/GHOST_ContextGLX.h
@@ -38,6 +38,9 @@
 #endif
 
 class GHOST_ContextGLX : public GHOST_Context {
+  /* XR code needs low level graphics data to send to OpenXR. */
+  friend class GHOST_XRGraphicsBinding;
+
  public:
   /**
* Constructor.
diff --git a/intern/ghost/intern/GHOST_XR.cpp b/intern/ghost/intern/GHOST_XR.cpp
index d5376892ee7..0561df3809d 100644
--- a/intern/ghost/intern/GHOST_XR.cpp
+++ b/intern/ghost/intern/GHOST_XR.cpp
@@ -168,9 +168,9 @@ static void openxr_extensions_to_enable_get(const 
GHOST_XRContext *context,
 const OpenXRData *oxr,
 std::vector 
_ext_names)
 {
-  assert(context->gpu_binding != GHOST_kXRGraphicsUnknown);
+  assert(context->gpu_binding_type != GHOST_kXRGraphicsUnknown);
 
-  const char *gpu_binding = 
openxr_ext_name_from_wm_gpu_binding(context->gpu_binding);
+  const char *gpu_binding = 
openxr_ext_name_from_wm_gpu_binding(context->gpu_binding_type);
   const static std::vector try_ext; /* None yet */
 
   assert(gpu_binding);
@@ -238,7 +238,7 @@ GHOST_XRContext *GHOST_XR_context_create(const 
GHOST_XRContextCreateInfo *create
   puts("Done printing OpenXR layers/extensions.");
 #endif
 
-  xr_context->gpu_binding = openxr_graphics_extension_to_enable_get(oxr, 
create_info);
+  xr_context->gpu_binding_type = openxr_graphics_extension_to_enable_get(oxr, 
create_info);
 
   assert(xr_context->oxr.instance == XR_NULL_HANDLE);
   openxr_instance_create(xr_context);
@@ -287,13 +287,13 @@ void GHOST_XR_graphics_context_bind(GHOST_XRContext 
_context)
 {
   assert(xr_context.gpu_ctx_bind_fn);
   xr_context.gpu_ctx = static_cast(
-  xr_context.gpu_ctx_bind_fn(xr_context.gpu_binding));
+  xr_context.gpu_ctx_bind_fn(xr_context.gpu_binding_type));
 }
 
 void GHOST_XR_graphics_context_unbind(GHOST_XRContext _context)
 {
   if (xr_context.gpu_ctx_unbind_fn) {
-xr_context.gpu_ctx_unbind_fn(xr_context.gpu_binding, xr_context.gpu_ctx);
+xr_context.gpu_ctx_unbind_fn(xr_context.gpu_binding_type, 
xr_context.gpu_ctx);
   }
   xr_context.gpu_ctx = nullptr;
 }
diff --git a/intern/ghost/intern/GHOST_XRSession.cpp 
b/intern/ghost/intern/GHOST_XRSession.cpp
index f66214ed1c1..d975bc1874f 100644
--- a/intern/ghost/intern/GHOST_XRSession.cpp
+++ b/intern/ghost/intern/GHOST_XRSession.cpp
@@ -67,51 +67,52 @@ static void GHOST_XR_system_init(OpenXRData *oxr)
   xrGetSystem(oxr->instance, _info, >system_id);
 }
 
-static void *openxr_graphics_binding_create(const GHOST_XRContext *xr_context,
-GHOST_Context *ghost_ctx)
-{
-  static union {
+class GHOST_XRGraphicsBinding {
+ public:
+  union {
 #if defined(WITH_X11)
 XrGraphicsBindingOpenGLXlibKHR glx;
 #elif defined(WIN32)
 XrGraphicsBindingOpenGLWin32KHR wgl;
 XrGraphicsBindingD3D11KHR d3d11;
 #endif
-  } binding;
-
-  memset(, 0, sizeof(binding));
+  } oxr_binding;
 
-  switch (xr_context->gpu_binding) {
-case GHOST_kXRGraphicsOpenGL: {
+  void initFromGhostContext(GHOST_TGraphicsBinding type, GHOST_Context 
*ghost_ctx)
+  {
+switch (type) {
+  case GHOST_kXRGraphicsOpenGL: {
 #if defined(WITH_X11)
-  binding.glx.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_XLIB_KHR;
+GHOST_ContextGLX *ctx_glx = static_cast(ghost_ctx);
+
+oxr_binding.glx.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_XLIB_KHR;
+oxr_binding.glx.xDisplay = ctx_glx->m_display;
 #elif defined(WIN32)
-  GHOST_ContextWGL *ctx_wgl = static_cast(ghost_ctx);
-  GHOST_ContextWGL::Info info = ctx_wgl->getInfo();
+GHOST_ContextWGL *ctx_wgl = static_cast(ghost_ctx);
+GHOST_ContextWGL::Info info = ctx_wgl->getInfo();
 
-  binding.wgl.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_WIN32_KHR;
-  binding.wgl.hDC = info.hDC;
-  binding.wgl.hGLRC = info.hGLRC;
+oxr_binding.wgl.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_WIN32_KHR;
+

[Bf-blender-cvs] [da68f316303] master: GPencil: Remove unreported duplicated Reproject operator in menu

2019-06-19 Thread Antonioya
Commit: da68f3163030a1858f530e25561f60bdfd7deaf1
Author: Antonioya
Date:   Wed Jun 19 17:19:22 2019 +0200
Branches: master
https://developer.blender.org/rBda68f3163030a1858f530e25561f60bdfd7deaf1

GPencil: Remove unreported duplicated Reproject operator in menu

The reproject option was duplicated. Detected writing the manual.

===

M   release/scripts/startup/bl_ui/space_view3d.py

===

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index 5829ca70056..e7f233cd196 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -4617,10 +4617,6 @@ class VIEW3D_MT_edit_gpencil_transform(Menu):
 layout.operator("transform.tosphere", text="To Sphere")
 layout.operator("transform.transform", text="Shrink Fatten").mode = 
'GPENCIL_SHRINKFATTEN'
 
-layout.separator()
-
-layout.operator("gpencil.reproject")
-
 
 class VIEW3D_MT_edit_gpencil_interpolate(Menu):
 bl_label = "Interpolate"

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


[Bf-blender-cvs] [c2b72102bda] fluid-mantaflow: Mantaflow: Removed old liquid code completely

2019-06-19 Thread Sebastián Barschkis
Commit: c2b72102bda5e5fbd7b48fd1708f054cc11db5fa
Author: Sebastián Barschkis
Date:   Wed Jun 19 17:05:39 2019 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rBc2b72102bda5e5fbd7b48fd1708f054cc11db5fa

Mantaflow: Removed old liquid code completely

rip

===

M   CMakeLists.txt
M   build_files/cmake/config/blender_full.cmake
M   build_files/cmake/config/blender_lite.cmake
M   build_files/cmake/config/blender_release.cmake
M   doc/doxygen/doxygen.intern.h
M   intern/CMakeLists.txt
M   intern/cycles/blender/blender_mesh.cpp
M   intern/cycles/blender/blender_util.h
D   intern/elbeem/CMakeLists.txt
D   intern/elbeem/COPYING
D   intern/elbeem/COPYING_trimesh2
D   intern/elbeem/extern/LBM_fluidsim.h
D   intern/elbeem/extern/elbeem.h
D   intern/elbeem/intern/attributes.cpp
D   intern/elbeem/intern/attributes.h
D   intern/elbeem/intern/controlparticles.cpp
D   intern/elbeem/intern/controlparticles.h
D   intern/elbeem/intern/elbeem.cpp
D   intern/elbeem/intern/elbeem_control.cpp
D   intern/elbeem/intern/elbeem_control.h
D   intern/elbeem/intern/globals.h
D   intern/elbeem/intern/isosurface.cpp
D   intern/elbeem/intern/isosurface.h
D   intern/elbeem/intern/loop_tools.h
D   intern/elbeem/intern/mcubes_tables.h
D   intern/elbeem/intern/mvmcoords.cpp
D   intern/elbeem/intern/mvmcoords.h
D   intern/elbeem/intern/ntl_blenderdumper.cpp
D   intern/elbeem/intern/ntl_blenderdumper.h
D   intern/elbeem/intern/ntl_bsptree.cpp
D   intern/elbeem/intern/ntl_bsptree.h
D   intern/elbeem/intern/ntl_geometryclass.h
D   intern/elbeem/intern/ntl_geometrymodel.cpp
D   intern/elbeem/intern/ntl_geometrymodel.h
D   intern/elbeem/intern/ntl_geometryobject.cpp
D   intern/elbeem/intern/ntl_geometryobject.h
D   intern/elbeem/intern/ntl_geometryshader.h
D   intern/elbeem/intern/ntl_lighting.cpp
D   intern/elbeem/intern/ntl_lighting.h
D   intern/elbeem/intern/ntl_matrices.h
D   intern/elbeem/intern/ntl_ray.cpp
D   intern/elbeem/intern/ntl_ray.h
D   intern/elbeem/intern/ntl_vector3dim.h
D   intern/elbeem/intern/ntl_world.cpp
D   intern/elbeem/intern/ntl_world.h
D   intern/elbeem/intern/paraloopend.h
D   intern/elbeem/intern/parametrizer.cpp
D   intern/elbeem/intern/parametrizer.h
D   intern/elbeem/intern/particletracer.cpp
D   intern/elbeem/intern/particletracer.h
D   intern/elbeem/intern/simulation_object.cpp
D   intern/elbeem/intern/simulation_object.h
D   intern/elbeem/intern/solver_adap.cpp
D   intern/elbeem/intern/solver_class.h
D   intern/elbeem/intern/solver_control.cpp
D   intern/elbeem/intern/solver_control.h
D   intern/elbeem/intern/solver_init.cpp
D   intern/elbeem/intern/solver_interface.cpp
D   intern/elbeem/intern/solver_interface.h
D   intern/elbeem/intern/solver_main.cpp
D   intern/elbeem/intern/solver_relax.h
D   intern/elbeem/intern/solver_util.cpp
D   intern/elbeem/intern/utilities.cpp
D   intern/elbeem/intern/utilities.h
M   release/scripts/addons
M   release/scripts/addons_contrib
D   release/scripts/presets/fluid/honey.py
D   release/scripts/presets/fluid/oil.py
D   release/scripts/presets/fluid/water.py
M   release/scripts/startup/bl_ui/__init__.py
D   release/scripts/startup/bl_ui/properties_physics_fluid.py
R100release/scripts/startup/bl_ui/properties_physics_smoke.py   
release/scripts/startup/bl_ui/properties_physics_manta.py
D   source/blender/blenkernel/BKE_fluidsim.h
M   source/blender/blenkernel/CMakeLists.txt
M   source/blender/blenkernel/intern/bpath.c
M   source/blender/blenkernel/intern/effect.c
D   source/blender/blenkernel/intern/fluidsim.c
M   source/blender/blenkernel/intern/object.c
M   source/blender/blenkernel/intern/particle_system.c
M   source/blender/editors/datafiles/CMakeLists.txt
M   source/blender/editors/interface/interface_templates.c
M   source/blender/editors/physics/CMakeLists.txt
D   source/blender/editors/physics/physics_fluid.c
M   source/blender/editors/physics/physics_intern.h
M   source/blender/editors/physics/physics_ops.c
M   source/blender/editors/space_buttons/buttons_context.c
M   source/blender/gpencil_modifiers/CMakeLists.txt
M   source/blender/makesdna/DNA_modifier_types.h
M   source/blender/makesdna/DNA_object_types.h
M   source/blender/makesdna/DNA_particle_types.h
M   source/blender/makesrna/RNA_access.h
M   source/blender/makesrna/intern/CMakeLists.txt
M   source/blender/makesrna/intern/makesrna.c
D   source/blender/makesrna/intern/rna_fluidsim.c
M   source/blender/makesrna/intern/rna_internal.h
M   source/blender/makesrna/intern/rna_modifier.c
M   source/blender/makesrna/intern/rna_particle.c
M   

[Bf-blender-cvs] [aa1e9f2e532] fluid-mantaflow: Mantaflow: Removed old smoke code completely

2019-06-19 Thread Sebastián Barschkis
Commit: aa1e9f2e532c5cdb5eebac8e4cb491ee0cbfa252
Author: Sebastián Barschkis
Date:   Tue Jun 18 16:36:24 2019 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rBaa1e9f2e532c5cdb5eebac8e4cb491ee0cbfa252

Mantaflow: Removed old smoke code completely

rip

===

D   intern/smoke/CMakeLists.txt
D   intern/smoke/extern/smoke_API.h
D   intern/smoke/intern/EIGENVALUE_HELPER.cpp
D   intern/smoke/intern/EIGENVALUE_HELPER.h
D   intern/smoke/intern/FFT_NOISE.h
D   intern/smoke/intern/FLUID_3D.cpp
D   intern/smoke/intern/FLUID_3D.h
D   intern/smoke/intern/FLUID_3D_SOLVERS.cpp
D   intern/smoke/intern/FLUID_3D_STATIC.cpp
D   intern/smoke/intern/IMAGE.h
D   intern/smoke/intern/INTERPOLATE.h
D   intern/smoke/intern/LICENSE.txt
D   intern/smoke/intern/LU_HELPER.cpp
D   intern/smoke/intern/LU_HELPER.h
D   intern/smoke/intern/MERSENNETWISTER.h
D   intern/smoke/intern/Makefile.FFT
D   intern/smoke/intern/Makefile.cygwin
D   intern/smoke/intern/Makefile.linux
D   intern/smoke/intern/Makefile.mac
D   intern/smoke/intern/OBSTACLE.h
D   intern/smoke/intern/SPHERE.cpp
D   intern/smoke/intern/SPHERE.h
D   intern/smoke/intern/VEC3.h
D   intern/smoke/intern/WAVELET_NOISE.h
D   intern/smoke/intern/WTURBULENCE.cpp
D   intern/smoke/intern/WTURBULENCE.h
D   intern/smoke/intern/smoke_API.cpp
D   intern/smoke/intern/tnt/jama_eig.h
D   intern/smoke/intern/tnt/jama_lu.h
D   intern/smoke/intern/tnt/tnt.h
D   intern/smoke/intern/tnt/tnt_array1d.h
D   intern/smoke/intern/tnt/tnt_array1d_utils.h
D   intern/smoke/intern/tnt/tnt_array2d.h
D   intern/smoke/intern/tnt/tnt_array2d_utils.h
D   intern/smoke/intern/tnt/tnt_array3d.h
D   intern/smoke/intern/tnt/tnt_array3d_utils.h
D   intern/smoke/intern/tnt/tnt_cmat.h
D   intern/smoke/intern/tnt/tnt_fortran_array1d.h
D   intern/smoke/intern/tnt/tnt_fortran_array1d_utils.h
D   intern/smoke/intern/tnt/tnt_fortran_array2d.h
D   intern/smoke/intern/tnt/tnt_fortran_array2d_utils.h
D   intern/smoke/intern/tnt/tnt_fortran_array3d.h
D   intern/smoke/intern/tnt/tnt_fortran_array3d_utils.h
D   intern/smoke/intern/tnt/tnt_i_refvec.h
D   intern/smoke/intern/tnt/tnt_math_utils.h
D   intern/smoke/intern/tnt/tnt_sparse_matrix_csr.h
D   intern/smoke/intern/tnt/tnt_stopwatch.h
D   intern/smoke/intern/tnt/tnt_subscript.h
D   intern/smoke/intern/tnt/tnt_vec.h
D   intern/smoke/intern/tnt/tnt_version.h
M   source/blender/editors/space_view3d/CMakeLists.txt
M   source/blender/gpu/CMakeLists.txt
M   source/blender/makesrna/intern/CMakeLists.txt
M   source/blender/render/CMakeLists.txt
M   source/tools

===

diff --git a/intern/smoke/CMakeLists.txt b/intern/smoke/CMakeLists.txt
deleted file mode 100644
index f59eebb86a8..000
--- a/intern/smoke/CMakeLists.txt
+++ /dev/null
@@ -1,100 +0,0 @@
-# * BEGIN GPL LICENSE BLOCK *
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# The Original Code is Copyright (C) 2006, Blender Foundation
-# All rights reserved.
-# * END GPL LICENSE BLOCK *
-
-set(INC
-  intern
-  ../memutil
-)
-
-set(INC_SYS
-  ${BULLET_INCLUDE_DIRS}
-  ${PNG_INCLUDE_DIRS}
-  ${ZLIB_INCLUDE_DIRS}
-)
-
-set(SRC
-  intern/EIGENVALUE_HELPER.cpp
-  intern/FLUID_3D.cpp
-  intern/FLUID_3D_SOLVERS.cpp
-  intern/FLUID_3D_STATIC.cpp
-  intern/LU_HELPER.cpp
-  intern/SPHERE.cpp
-  intern/WTURBULENCE.cpp
-  intern/smoke_API.cpp
-
-  extern/smoke_API.h
-  intern/EIGENVALUE_HELPER.h
-  intern/FFT_NOISE.h
-  intern/FLUID_3D.h
-  intern/IMAGE.h
-  intern/INTERPOLATE.h
-  intern/LU_HELPER.h
-  intern/MERSENNETWISTER.h
-  intern/OBSTACLE.h
-  intern/SPHERE.h
-  intern/VEC3.h
-  intern/WAVELET_NOISE.h
-  intern/WTURBULENCE.h
-  intern/tnt/jama_eig.h
-  intern/tnt/jama_lu.h
-  intern/tnt/tnt.h
-  intern/tnt/tnt_array1d.h
-  intern/tnt/tnt_array1d_utils.h
-  intern/tnt/tnt_array2d.h
-  intern/tnt/tnt_array2d_utils.h
-  intern/tnt/tnt_array3d.h
-  intern/tnt/tnt_array3d_utils.h
-  intern/tnt/tnt_cmat.h
-  intern/tnt/tnt_fortran_array1d.h
-  intern/tnt/tnt_fortran_array1d_utils.h
-  

[Bf-blender-cvs] [41a0e7a5de0] fluid-mantaflow: Mantaflow: Applied Nils big rename patches

2019-06-19 Thread Sebastián Barschkis
Commit: 41a0e7a5de0681c53a2d6032f1b0054498d8203e
Author: Sebastián Barschkis
Date:   Tue Jun 18 16:20:24 2019 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB41a0e7a5de0681c53a2d6032f1b0054498d8203e

Mantaflow: Applied Nils big rename patches

Replaces occurences of smoke with manta

===

M   CMakeLists.txt
M   intern/cycles/blender/blender_mesh.cpp
M   intern/cycles/blender/blender_session.cpp
M   intern/cycles/blender/blender_util.h
M   intern/mantaflow/CMakeLists.txt
M   intern/mantaflow/extern/manta_fluid_API.h
R076intern/mantaflow/intern/FLUID.cpp   
intern/mantaflow/intern/MANTA_main.cpp
R086intern/mantaflow/intern/FLUID.h intern/mantaflow/intern/MANTA_main.h
M   intern/mantaflow/intern/manta_fluid_API.cpp
R100release/datafiles/blender_icons16/icon16_mod_smoke.dat  
release/datafiles/blender_icons16/icon16_mod_manta.dat
R100release/datafiles/blender_icons32/icon32_mod_smoke.dat  
release/datafiles/blender_icons32/icon32_mod_manta.dat
M   release/datafiles/locale
M   release/scripts/startup/bl_operators/object_quick_effects.py
M   release/scripts/startup/bl_ui/properties_physics_common.py
M   release/scripts/startup/bl_ui/properties_physics_smoke.py
M   source/blender/CMakeLists.txt
M   source/blender/alembic/intern/abc_exporter.cc
R065source/blender/blenkernel/BKE_smoke.h   
source/blender/blenkernel/BKE_manta.h
M   source/blender/blenkernel/BKE_pointcache.h
M   source/blender/blenkernel/CMakeLists.txt
M   source/blender/blenkernel/intern/bpath.c
M   source/blender/blenkernel/intern/effect.c
R068source/blender/blenkernel/intern/smoke.c
source/blender/blenkernel/intern/manta.c
M   source/blender/blenkernel/intern/object.c
M   source/blender/blenkernel/intern/particle.c
M   source/blender/blenkernel/intern/particle_system.c
M   source/blender/blenkernel/intern/pointcache.c
M   source/blender/blenloader/intern/readfile.c
M   source/blender/blenloader/intern/versioning_250.c
M   source/blender/blenloader/intern/versioning_260.c
M   source/blender/blenloader/intern/versioning_270.c
M   source/blender/blenloader/intern/writefile.c
M   source/blender/depsgraph/intern/depsgraph_physics.cc
M   source/blender/draw/engines/eevee/eevee_volumes.c
M   source/blender/draw/engines/workbench/workbench_deferred.c
M   source/blender/draw/engines/workbench/workbench_forward.c
M   source/blender/draw/engines/workbench/workbench_volume.c
M   source/blender/draw/modes/object_mode.c
M   source/blender/editors/datafiles/CMakeLists.txt
M   source/blender/editors/include/UI_icons.h
M   source/blender/editors/interface/interface_templates.c
M   source/blender/editors/physics/particle_object.c
M   source/blender/editors/physics/physics_manta.c
M   source/blender/editors/space_buttons/buttons_context.c
M   source/blender/editors/space_outliner/outliner_draw.c
M   source/blender/editors/space_view3d/view3d_intern.h
M   source/blender/gpu/GPU_draw.h
M   source/blender/gpu/intern/gpu_draw.c
R096source/blender/makesdna/DNA_smoke_types.h   
source/blender/makesdna/DNA_manta_types.h
M   source/blender/makesdna/DNA_modifier_types.h
M   source/blender/makesdna/intern/makesdna.c
M   source/blender/makesrna/RNA_access.h
M   source/blender/makesrna/intern/CMakeLists.txt
M   source/blender/makesrna/intern/makesrna.c
M   source/blender/makesrna/intern/rna_gpencil_modifier.c
M   source/blender/makesrna/intern/rna_internal.h
R071source/blender/makesrna/intern/rna_smoke.c  
source/blender/makesrna/intern/rna_manta.c
M   source/blender/makesrna/intern/rna_modifier.c
M   source/blender/makesrna/intern/rna_object_force.c
M   source/blender/modifiers/CMakeLists.txt
M   source/blender/modifiers/MOD_modifiertypes.h
R060source/blender/modifiers/intern/MOD_smoke.c 
source/blender/modifiers/intern/MOD_manta.c
M   source/blender/modifiers/intern/MOD_util.c

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0423a785dff..e2d5ab88cbf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -229,7 +229,7 @@ mark_as_advanced(BUILDINFO_OVERRIDE_TIME)
 
 option(WITH_IK_ITASC  "Enable ITASC IK solver (only disable for 
development & for incompatible C++ compilers)" ON)
 option(WITH_IK_SOLVER "Enable Legacy IK solver (only disable for 
development)" ON)
-option(WITH_FFTW3 "Enable FFTW3 support (Used for smoke, ocean sim, 
and audio effects)" ${_init_FFTW3})
+option(WITH_FFTW3 "Enable FFTW3 support (Used for ocean sim and audio 
effects)" ${_init_FFTW3})
 option(WITH_BULLET"Enable Bullet (Physics Engine)" ON)
 option(WITH_SYSTEM_BULLET "Use the systems bullet library (currently 
unsupported due to missing features in 

[Bf-blender-cvs] [1699de17bdd] master: Fix order of modifications for Set Origin.

2019-06-19 Thread Sergey Sharybin
Commit: 1699de17bddb9f04f58af59f7651420287f27d52
Author: Sergey Sharybin
Date:   Wed Jun 19 14:36:07 2019 +0200
Branches: master
https://developer.blender.org/rB1699de17bddb9f04f58af59f7651420287f27d52

Fix order of modifications for Set Origin.

The logic of parent update is very similar to Apply Transform, so made it
so parents are handled before children.

===

M   source/blender/editors/object/object_transform.c

===

diff --git a/source/blender/editors/object/object_transform.c 
b/source/blender/editors/object/object_transform.c
index 8d7a421cad1..394fea2cf27 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -971,10 +971,6 @@ static int object_origin_set_exec(bContext *C, wmOperator 
*op)
   const float *cursor = scene->cursor.location;
   int centermode = RNA_enum_get(op->ptr, "type");
 
-  ListBase ctx_data_list;
-  CollectionPointerLink *ctx_ob;
-  CollectionPointerLink *ctx_ob_act = NULL;
-
   /* keep track of what is changed */
   int tot_change = 0, tot_lib_error = 0, tot_multiuser_arm_error = 0;
 
@@ -1043,23 +1039,24 @@ static int object_origin_set_exec(bContext *C, 
wmOperator *op)
 }
   }
 
-  CTX_data_selected_editable_objects(C, _data_list);
+  int num_objects;
+  Object **objects = sorted_selected_editable_objects(C, _objects);
+  if (objects == NULL) {
+return OPERATOR_CANCELLED;
+  }
 
   /* reset flags */
-  for (ctx_ob = ctx_data_list.first; ctx_ob; ctx_ob = ctx_ob->next) {
-Object *ob = ctx_ob->ptr.data;
+  for (int object_index = 0; object_index < num_objects; ++object_index) {
+Object *ob = objects[object_index];
 ob->flag &= ~OB_DONE;
 
 /* move active first */
 if (ob == obact) {
-  ctx_ob_act = ctx_ob;
+  memmove([1], objects, object_index);
+  objects[0] = ob;
 }
   }
 
-  if (ctx_ob_act) {
-BLI_listbase_rotate_first(_data_list, (LinkData *)ctx_ob_act);
-  }
-
   for (tob = bmain->objects.first; tob; tob = tob->id.next) {
 if (tob->data) {
   ((ID *)tob->data)->tag &= ~LIB_TAG_DOIT;
@@ -1069,8 +1066,8 @@ static int object_origin_set_exec(bContext *C, wmOperator 
*op)
 }
   }
 
-  for (ctx_ob = ctx_data_list.first; ctx_ob; ctx_ob = ctx_ob->next) {
-Object *ob = ctx_ob->ptr.data;
+  for (int object_index = 0; object_index < num_objects; ++object_index) {
+Object *ob = objects[object_index];
 
 if ((ob->flag & OB_DONE) == 0) {
   bool do_inverse_offset = false;
@@ -1345,7 +1342,6 @@ static int object_origin_set_exec(bContext *C, wmOperator 
*op)
 
   /* offset other selected objects */
   if (do_inverse_offset && (centermode != GEOMETRY_TO_ORIGIN)) {
-CollectionPointerLink *ctx_link_other;
 float obmat[4][4];
 
 /* was the object data modified
@@ -1369,9 +1365,8 @@ static int object_origin_set_exec(bContext *C, wmOperator 
*op)
 //{
 
 /* use existing context looper */
-for (ctx_link_other = ctx_data_list.first; ctx_link_other;
- ctx_link_other = ctx_link_other->next) {
-  Object *ob_other = ctx_link_other->ptr.data;
+for (int other_object_index = 0; other_object_index < num_objects; 
++other_object_index) {
+  Object *ob_other = objects[other_object_index];
 
   if ((ob_other->flag & OB_DONE) == 0 &&
   ((ob->data && (ob->data == ob_other->data)) ||
@@ -1395,7 +1390,7 @@ static int object_origin_set_exec(bContext *C, wmOperator 
*op)
   }
 }
   }
-  BLI_freelistN(_data_list);
+  MEM_freeN(objects);
 
   for (tob = bmain->objects.first; tob; tob = tob->id.next) {
 if (tob->data && (((ID *)tob->data)->tag & LIB_TAG_DOIT)) {

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


[Bf-blender-cvs] [1fb54539166] master: Fix T65900: Apply Scale doesn't work correct with parenting

2019-06-19 Thread Sergey Sharybin
Commit: 1fb545391665bcdf8b02545f846112a258e9b749
Author: Sergey Sharybin
Date:   Wed Jun 19 14:12:34 2019 +0200
Branches: master
https://developer.blender.org/rB1fb545391665bcdf8b02545f846112a258e9b749

Fix T65900: Apply Scale doesn't work correct with parenting

Parents are to be handled prior to their children.

===

M   source/blender/editors/object/object_transform.c

===

diff --git a/source/blender/editors/object/object_transform.c 
b/source/blender/editors/object/object_transform.c
index 841a3bbed7d..8d7a421cad1 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -53,6 +53,7 @@
 #include "BKE_multires.h"
 #include "BKE_armature.h"
 #include "BKE_lattice.h"
+#include "BKE_library.h"
 #include "BKE_tracking.h"
 #include "BKE_gpencil.h"
 
@@ -478,6 +479,55 @@ static void ignore_parent_tx(Main *bmain, Depsgraph 
*depsgraph, Scene *scene, Ob
   }
 }
 
+static void append_sorted_object_parent_hierarchy(Object *root_object,
+  Object *object,
+  Object **sorted_objects,
+  int *object_index)
+{
+  if (object->parent != NULL && object->parent != root_object) {
+append_sorted_object_parent_hierarchy(
+root_object, object->parent, sorted_objects, object_index);
+  }
+  if (object->id.tag & LIB_TAG_DOIT) {
+sorted_objects[*object_index] = object;
+(*object_index)++;
+object->id.tag &= ~LIB_TAG_DOIT;
+  }
+}
+
+static Object **sorted_selected_editable_objects(bContext *C, int 
*r_num_objects)
+{
+  Main *bmain = CTX_data_main(C);
+
+  /* Count all objects, but also tag all the selected ones. */
+  BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false);
+  int num_objects = 0;
+  CTX_DATA_BEGIN (C, Object *, object, selected_editable_objects) {
+object->id.tag |= LIB_TAG_DOIT;
+num_objects++;
+  }
+  CTX_DATA_END;
+  if (num_objects == 0) {
+*r_num_objects = 0;
+return NULL;
+  }
+
+  /* Append all the objects. */
+  Object **sorted_objects = MEM_malloc_arrayN(num_objects, sizeof(Object *), 
"sorted objects");
+  int object_index = 0;
+  CTX_DATA_BEGIN (C, Object *, object, selected_editable_objects) {
+if ((object->id.tag & LIB_TAG_DOIT) == 0) {
+  continue;
+}
+append_sorted_object_parent_hierarchy(object, object, sorted_objects, 
_index);
+  }
+  CTX_DATA_END;
+
+  *r_num_objects = num_objects;
+
+  return sorted_objects;
+}
+
 static int apply_objects_internal(bContext *C,
   ReportList *reports,
   bool apply_loc,
@@ -621,7 +671,14 @@ static int apply_objects_internal(bContext *C,
   changed = false;
 
   /* now execute */
-  CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
+  int num_objects;
+  Object **objects = sorted_selected_editable_objects(C, _objects);
+  if (objects == NULL) {
+return OPERATOR_CANCELLED;
+  }
+
+  for (int object_index = 0; object_index < num_objects; ++object_index) {
+Object *ob = objects[object_index];
 
 /* calculate rotation/scale matrix */
 if (apply_scale && apply_rot) {
@@ -798,7 +855,8 @@ static int apply_objects_internal(bContext *C,
 
 changed = true;
   }
-  CTX_DATA_END;
+
+  MEM_freeN(objects);
 
   if (!changed) {
 BKE_report(reports, RPT_WARNING, "Objects have no data to transform");

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


[Bf-blender-cvs] [dd89bcc832a] master: Fix T65614: Sequencer render single layer only

2019-06-19 Thread Sergey Sharybin
Commit: dd89bcc832a091b245828092eccbcc36f40b7d52
Author: Sergey Sharybin
Date:   Wed Jun 19 16:00:38 2019 +0200
Branches: master
https://developer.blender.org/rBdd89bcc832a091b245828092eccbcc36f40b7d52

Fix T65614: Sequencer render single layer only

Was noticeable when sequencer uses scene with a compositor.

The way it was using render API was forcing a single render layer.

Reviewers: brecht

Reviewed By: brecht

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

===

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

===

diff --git a/source/blender/blenkernel/intern/sequencer.c 
b/source/blender/blenkernel/intern/sequencer.c
index 2514bad5709..971ca77ff3d 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -3578,7 +3578,8 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData 
*context,
 re = RE_NewSceneRender(scene);
   }
 
-  RE_RenderFrame(re, context->bmain, scene, view_layer, camera, frame, 
false);
+  RE_RenderFrame(
+  re, context->bmain, scene, have_comp ? NULL : view_layer, camera, 
frame, false);
 
   /* restore previous state after it was toggled on & off by 
RE_RenderFrame */
   G.is_rendering = is_rendering;

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


[Bf-blender-cvs] [ed00bc16a70] greasepencil-object: GPencil: Fix problem with several objects

2019-06-19 Thread Antonioya
Commit: ed00bc16a7014b91711032e939c665448b4c6ea3
Author: Antonioya
Date:   Wed Jun 19 16:41:22 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBed00bc16a7014b91711032e939c665448b4c6ea3

GPencil: Fix problem with several objects

The loop was not checking the end group of the object

===

M   source/blender/draw/engines/gpencil/gpencil_engine.c

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 7e320cc8055..6b53ff83b88 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -804,14 +804,14 @@ static void 
gpencil_draw_pass_range(GPENCIL_FramebufferList *fbl,
   DRWShadingGroup *from_shgrp = init_shgrp;
   DRWShadingGroup *to_shgrp = init_shgrp;
   int stencil_tot = 0;
-  bool do_last = false;
+  bool do_last = true;
 
   if (do_antialiasing) {
 MULTISAMPLE_GP_SYNC_ENABLE(stl->storage->multisamples, fbl);
   }
 
   /* Loop all shading groups to separate by stencil groups. */
-  while (shgrp) {
+  while ((shgrp) && (shgrp != end_shgrp)) {
 do_last = true;
 /* Count number of groups using stencil. */
 if (DRW_shgroup_stencil_mask_get(shgrp) != 0) {
@@ -841,16 +841,22 @@ static void 
gpencil_draw_pass_range(GPENCIL_FramebufferList *fbl,
 
   shgrp = DRW_shgroup_get_next(shgrp);
   if (shgrp) {
-from_shgrp = shgrp;
-to_shgrp = shgrp;
+from_shgrp = to_shgrp = shgrp;
 stencil_tot = 0;
-continue;
+if (shgrp != end_shgrp) {
+  continue;
+}
+else {
+  do_last = true;
+  break;
+}
   }
   else {
 /* No more groups. */
 break;
   }
 }
+
 /* Still below stencil group limit. */
 shgrp = DRW_shgroup_get_next(shgrp);
 if (shgrp) {

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


[Bf-blender-cvs] [ab60fe2a12a] master: Fix T65914: Workbench Transparency Film

2019-06-19 Thread Jeroen Bakker
Commit: ab60fe2a12ae5d6a53abf754855be6d63bf1a08c
Author: Jeroen Bakker
Date:   Wed Jun 19 16:20:02 2019 +0200
Branches: master
https://developer.blender.org/rBab60fe2a12ae5d6a53abf754855be6d63bf1a08c

Fix T65914: Workbench Transparency Film

When performing F12 render on a transparent film all solid objects where
a bit transparent. Single Pass AA and no AA passes were not visible at
all.

Issue was that the first frame was not handled correctly making these
artifacts. This commit changes the order of `GPU_state_init` and
`DRW_state_reset` so the state is correct during the first pass.

===

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

===

diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index 70fe13eeaa2..87366289bf7 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -2001,10 +2001,10 @@ void DRW_render_to_image(RenderEngine *engine, struct 
Depsgraph *depsgraph)
 BLI_rcti_init(_rect, 0, size[0], 0, size[1]);
   }
 
-  /* Reset state before drawing */
-  DRW_state_reset();
   /* Set the default Blender draw state */
   GPU_state_init();
+  /* Reset state before drawing */
+  DRW_state_reset();
 
   /* Init render result. */
   RenderResult *render_result = RE_engine_begin_result(engine,

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


[Bf-blender-cvs] [68d764f93c9] soc-2019-embree-gpu: Add GUI option to use all options

2019-06-19 Thread MATILLAT Quentin
Commit: 68d764f93c9edbd9fb1d8889bafcba3081e42a0c
Author: MATILLAT Quentin
Date:   Wed Jun 19 15:36:59 2019 +0200
Branches: soc-2019-embree-gpu
https://developer.blender.org/rB68d764f93c9edbd9fb1d8889bafcba3081e42a0c

Add GUI option to use all options

Current options are :
- bvh_builder: Ask embree to build the BVH tree from bounding boxes
- Raw embree: Use all of embree features (cannot be used on GPU)
- bvh_access: Give all the object to Embree, then use introspection to
  extract the tree

===

M   intern/cycles/blender/addon/properties.py
M   intern/cycles/blender/addon/ui.py
M   intern/cycles/blender/blender_sync.cpp
M   intern/cycles/bvh/bvh.cpp
M   intern/cycles/bvh/bvh_embree.cpp
M   intern/cycles/bvh/bvh_embree.h
M   intern/cycles/device/device_cpu.cpp
M   intern/cycles/kernel/kernel_types.h
M   intern/cycles/render/mesh.cpp

===

diff --git a/intern/cycles/blender/addon/properties.py 
b/intern/cycles/blender/addon/properties.py
index ba0339cf3d0..2670c300d14 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -527,6 +527,11 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
 description="Use Embree as ray accelerator",
 default=False,
 )
+use_bvh_embree_converter: BoolProperty(
+name="Convert Embree to Internal BVH",
+description="Use Embree as ray accelerator",
+default=False,
+)
 use_bvh_embree_gpu: BoolProperty(
 name="Use Embree on GPU (experimental)",
 description="Use Embree as ray accelerator",
diff --git a/intern/cycles/blender/addon/ui.py 
b/intern/cycles/blender/addon/ui.py
index 463cf78b6e6..b970de02fde 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -650,6 +650,9 @@ class 
CYCLES_RENDER_PT_performance_acceleration_structure(CyclesButtonsPanel, Pa
 row = col.row()
 row.active = use_cpu(context)
 row.prop(cscene, "use_bvh_embree")
+row2 = col.row()
+row2.active = cscene.use_bvh_embree
+row2.prop(cscene, "use_bvh_embree_converter")
 if _cycles.with_embree:
 row = col.row()
 row.active = use_cuda(context)
diff --git a/intern/cycles/blender/blender_sync.cpp 
b/intern/cycles/blender/blender_sync.cpp
index 6ab5294427c..a39b7f053ff 100644
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@ -697,6 +697,8 @@ SceneParams BlenderSync::get_scene_params(BL::Scene 
_scene, bool background)
 #ifdef WITH_EMBREE
   params.bvh_layout = RNA_boolean_get(, "use_bvh_embree") ? 
BVH_LAYOUT_EMBREE :

params.bvh_layout;
+  params.bvh_layout = RNA_boolean_get(, "use_bvh_embree_converter") ? 
BVH_LAYOUT_EMBREE_CONVERTED :
+ 
params.bvh_layout;
   params.bvh_layout = RNA_boolean_get(, "use_bvh_embree_gpu") ? 
BVH_LAYOUT_EMBREE_GPU :

params.bvh_layout;
 #endif
diff --git a/intern/cycles/bvh/bvh.cpp b/intern/cycles/bvh/bvh.cpp
index f4f8a274fee..17687ff6e74 100644
--- a/intern/cycles/bvh/bvh.cpp
+++ b/intern/cycles/bvh/bvh.cpp
@@ -108,6 +108,7 @@ BVH *BVH::create(const BVHParams , const 
vector )
 case BVH_LAYOUT_BVH8:
   return new BVH8(params, objects);
 case BVH_LAYOUT_EMBREE:
+case BVH_LAYOUT_EMBREE_CONVERTED:
 #ifdef WITH_EMBREE
   return new BVHEmbree(params, objects);
 #endif
diff --git a/intern/cycles/bvh/bvh_embree.cpp b/intern/cycles/bvh/bvh_embree.cpp
index 712d55adaca..b2fd464b16d 100644
--- a/intern/cycles/bvh/bvh_embree.cpp
+++ b/intern/cycles/bvh/bvh_embree.cpp
@@ -60,6 +60,7 @@
 
 #define TASKING_INTERNAL
 #define RTC_NAMESPACE_BEGIN
+#define RTC_NAMESPACE_OPEN
 #define RTC_NAMESPACE_END
 
 #include "embree/kernels/common/scene.h"
@@ -427,7 +428,8 @@ int BVHEmbree::rtc_shared_users = 0;
 thread_mutex BVHEmbree::rtc_shared_mutex;
 
 BVHEmbree::BVHEmbree(const BVHParams _, const vector 
_)
-: BVH4(params_, objects_),
+: bvh_layout(params_.bvh_layout),
+  BVH4(params_, objects_),
   scene(NULL),
   mem_used(0),
   top_level(NULL),
@@ -633,11 +635,14 @@ void BVHEmbree::build(Progress , Stats *stats_)
   }
 
   progress.set_substatus("Packing geometry");
-  BVHNode *root = print_bvhInfo(scene);
-  root->print();
-  pack_nodes(root);
-  std::cout << "SAH " << root->computeSubtreeSAHCost(this->params) << 
std::endl;
-  // pack_nodes(NULL);
+  if(this->bvh_layout == BVH_LAYOUT_EMBREE_CONVERTED) {
+BVHNode *root = print_bvhInfo(scene);
+root->print();
+pack_nodes(root);
+std::cout << "SAH " << root->computeSubtreeSAHCost(this->params) << 
std::endl;
+ 

[Bf-blender-cvs] [72690bbeca8] master: Bring mask tools back to Masking Tool Area and update Context Menu

2019-06-19 Thread Sebastian Koenig
Commit: 72690bbeca854423355f5cc4507726aecd9898c3
Author: Sebastian Koenig
Date:   Wed Jun 19 15:05:25 2019 +0200
Branches: master
https://developer.blender.org/rB72690bbeca854423355f5cc4507726aecd9898c3

Bring mask tools back to Masking Tool Area and update Context Menu

The mask tools in the Tool Area of Clip Editor where never brought back,
after decision was made to postpone proper masking tools to 2.81.

This brings back the Mask Tool Panel in the Mask tab of Masking Tool Area.

This Diff also adds a better Context Menu, which respects whether you're
in Masking or Tracking mode. I have added the most important operators
there, with a focus on those that are otherwise harder to access.

Reviewers: sergey, billreynish

Subscribers: sebastian, brecht, hype

Tags: #motion_tracking

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

===

M   release/scripts/startup/bl_ui/properties_mask_common.py
M   release/scripts/startup/bl_ui/space_clip.py

===

diff --git a/release/scripts/startup/bl_ui/properties_mask_common.py 
b/release/scripts/startup/bl_ui/properties_mask_common.py
index 872b51d51ff..fd8ca542f9f 100644
--- a/release/scripts/startup/bl_ui/properties_mask_common.py
+++ b/release/scripts/startup/bl_ui/properties_mask_common.py
@@ -239,7 +239,6 @@ class MASK_PT_transforms:
 # ~ bl_region_type = 'TOOLS'
 bl_label = "Transforms"
 bl_category = "Mask"
-bl_options = {'DEFAULT_CLOSED'}
 
 @classmethod
 def poll(cls, context):
@@ -257,6 +256,40 @@ class MASK_PT_transforms:
 col.operator("transform.transform", text="Scale Feather").mode = 
'MASK_SHRINKFATTEN'
 
 
+class MASK_PT_tools:
+bl_label = "Mask Tools"
+bl_category = "Mask"
+
+@classmethod
+def poll(cls, context):
+space_data = context.space_data
+return space_data.mask and space_data.mode == 'MASK'
+
+def draw(self, _context):
+layout = self.layout
+
+col = layout.column(align=True)
+col.label(text="Spline:")
+col.operator("mask.delete")
+col.operator("mask.cyclic_toggle")
+col.operator("mask.switch_direction")
+col.operator("mask.handle_type_set").type = 'VECTOR'
+col.operator("mask.feather_weight_clear")
+
+col = layout.column(align=True)
+col.label(text="Parenting:")
+row = col.row(align=True)
+row.operator("mask.parent_set", text="Parent")
+row.operator("mask.parent_clear", text="Clear")
+
+col = layout.column(align=True)
+col.label(text="Animation:")
+row = col.row(align=True)
+row.operator("mask.shape_key_insert", text="Insert Key")
+row.operator("mask.shape_key_clear", text="Clear Key")
+col.operator("mask.shape_key_feather_reset", text="Reset Feather 
Animation")
+col.operator("mask.shape_key_rekey", text="Re-Key Shape Points")
+
 class MASK_MT_add(Menu):
 bl_label = "Add"
 
diff --git a/release/scripts/startup/bl_ui/space_clip.py 
b/release/scripts/startup/bl_ui/space_clip.py
index d138615e9be..f653f8f738f 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -465,17 +465,17 @@ class CLIP_PT_tools_tracking(CLIP_PT_tracking_panel, 
Panel):
 row = layout.row(align=True)
 row.label(text="Track:")
 
-props = row.operator("clip.track_markers", text="", icon='FRAME_PREV')
+props = row.operator("clip.track_markers", text="", 
icon='TRACKING_BACKWARDS_SINGLE')
 props.backwards = True
 props.sequence = False
 props = row.operator("clip.track_markers", text="",
- icon='PLAY_REVERSE')
+ icon='TRACKING_BACKWARDS')
 props.backwards = True
 props.sequence = True
-props = row.operator("clip.track_markers", text="", icon='PLAY')
+props = row.operator("clip.track_markers", text="", 
icon='TRACKING_FORWARDS')
 props.backwards = False
 props.sequence = True
-props = row.operator("clip.track_markers", text="", icon='FRAME_NEXT')
+props = row.operator("clip.track_markers", text="", 
icon='TRACKING_FORWARDS_SINGLE')
 props.backwards = False
 props.sequence = False
 
@@ -484,10 +484,10 @@ class CLIP_PT_tools_tracking(CLIP_PT_tracking_panel, 
Panel):
 row.label(text="Clear:")
 row.scale_x = 2.0
 
-props = row.operator("clip.clear_track_path", text="", icon='BACK')
+props = row.operator("clip.clear_track_path", text="", 
icon='TRACKING_CLEAR_BACKWARDS')
 props.action = 'UPTO'
 
-props = row.operator("clip.clear_track_path", text="", icon='FORWARD')
+props = row.operator("clip.clear_track_path", text="", 
icon='TRACKING_CLEAR_FORWARDS')
 props.action = 'REMAINED'
 
 col = 

[Bf-blender-cvs] [11c9702dd40] master: Fix T65902: save all modified images should not try to save .psd files

2019-06-19 Thread Brecht Van Lommel
Commit: 11c9702dd40f1461ee2d2c1136909a867d4f06f9
Author: Brecht Van Lommel
Date:   Wed Jun 19 14:28:54 2019 +0200
Branches: master
https://developer.blender.org/rB11c9702dd40f1461ee2d2c1136909a867d4f06f9

Fix T65902: save all modified images should not try to save .psd files

We can't save these without data loss, so don't try to do this.

===

M   source/blender/blenkernel/BKE_image.h
M   source/blender/blenkernel/intern/image.c
M   source/blender/editors/space_image/image_ops.c
M   source/blender/windowmanager/intern/wm_files.c

===

diff --git a/source/blender/blenkernel/BKE_image.h 
b/source/blender/blenkernel/BKE_image.h
index 00fd291d7cb..d6683509729 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -320,6 +320,8 @@ float *BKE_image_get_float_pixels_for_frame(struct Image 
*image, int frame);
 /* Image modifications */
 bool BKE_image_is_dirty(struct Image *image);
 void BKE_image_mark_dirty(struct Image *image, struct ImBuf *ibuf);
+bool BKE_image_buffer_format_writable(struct ImBuf *ibuf);
+bool BKE_image_is_dirty_writable(struct Image *image, bool 
*is_format_writable);
 
 /* Guess offset for the first frame in the sequence */
 int BKE_image_sequence_guess_offset(struct Image *image);
diff --git a/source/blender/blenkernel/intern/image.c 
b/source/blender/blenkernel/intern/image.c
index f3ef48cafa8..b90cd9f15f8 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -5075,9 +5075,10 @@ bool BKE_image_is_animated(Image *image)
 }
 
 /* Image modifications */
-bool BKE_image_is_dirty(Image *image)
+bool BKE_image_is_dirty_writable(Image *image, bool *r_is_writable)
 {
   bool is_dirty = false;
+  bool is_writable = false;
 
   BLI_spin_lock(_spin);
   if (image->cache != NULL) {
@@ -5086,6 +5087,7 @@ bool BKE_image_is_dirty(Image *image)
 while (!IMB_moviecacheIter_done(iter)) {
   ImBuf *ibuf = IMB_moviecacheIter_getImBuf(iter);
   if (ibuf->userflags & IB_BITMAPDIRTY) {
+is_writable = BKE_image_buffer_format_writable(ibuf);
 is_dirty = true;
 break;
   }
@@ -5095,14 +5097,31 @@ bool BKE_image_is_dirty(Image *image)
   }
   BLI_spin_unlock(_spin);
 
+  if (r_is_writable) {
+*r_is_writable = is_writable;
+  }
+
   return is_dirty;
 }
 
+bool BKE_image_is_dirty(Image *image)
+{
+  return BKE_image_is_dirty_writable(image, NULL);
+}
+
 void BKE_image_mark_dirty(Image *UNUSED(image), ImBuf *ibuf)
 {
   ibuf->userflags |= IB_BITMAPDIRTY;
 }
 
+bool BKE_image_buffer_format_writable(ImBuf *ibuf)
+{
+  ImageFormatData im_format;
+  ImbFormatOptions options_dummy;
+  BKE_imbuf_to_image_format(_format, ibuf);
+  return (BKE_image_imtype_to_ftype(im_format.imtype, _dummy) == 
ibuf->ftype);
+}
+
 void BKE_image_file_format_set(Image *image, int ftype, const ImbFormatOptions 
*options)
 {
   BLI_spin_lock(_spin);
diff --git a/source/blender/editors/space_image/image_ops.c 
b/source/blender/editors/space_image/image_ops.c
index bdc6c394609..9eda7ffdc34 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -234,14 +234,6 @@ static bool image_not_packed_poll(bContext *C)
   return (ima && BLI_listbase_is_empty(>packedfiles));
 }
 
-static bool imbuf_format_writeable(const ImBuf *ibuf)
-{
-  ImageFormatData im_format;
-  ImbFormatOptions options_dummy;
-  BKE_imbuf_to_image_format(_format, ibuf);
-  return (BKE_image_imtype_to_ftype(im_format.imtype, _dummy) == 
ibuf->ftype);
-}
-
 bool space_image_main_region_poll(bContext *C)
 {
   SpaceImage *sima = CTX_wm_space_image(C);
@@ -2060,7 +2052,7 @@ static bool image_file_path_saveable(bContext *C, Image 
*ima, ImageUser *iuser)
 else if (!BLI_file_is_writable(name)) {
   CTX_wm_operator_poll_msg_set(C, "image path can't be written to");
 }
-else if (!imbuf_format_writeable(ibuf)) {
+else if (!BKE_image_buffer_format_writable(ibuf)) {
   CTX_wm_operator_poll_msg_set(C, "image format is read-only");
 }
 else {
@@ -2254,9 +2246,9 @@ static bool image_should_be_saved_when_modified(Image 
*ima)
   return !ELEM(ima->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE);
 }
 
-static bool image_should_be_saved(Image *ima)
+static bool image_should_be_saved(Image *ima, bool *is_format_writable)
 {
-  if (BKE_image_is_dirty(ima) &&
+  if (BKE_image_is_dirty_writable(ima, is_format_writable) &&
   (ima->source == IMA_SRC_FILE || ima->source == IMA_SRC_GENERATED)) {
 return image_should_be_saved_when_modified(ima);
   }
@@ -2272,7 +2264,15 @@ static bool image_has_valid_path(Image *ima)
 
 bool ED_image_should_save_modified(const bContext *C)
 {
-  return ED_image_save_all_modified_info(C, NULL) > 0;
+  ReportList reports;
+  BKE_reports_init(, RPT_STORE);
+
+  uint modified_images_count = 

[Bf-blender-cvs] [54e6b262a14] master: Cleanup: Pass explicit dependency graph

2019-06-19 Thread Sergey Sharybin
Commit: 54e6b262a14b23160fdecfec68f3e22dcf70bb3e
Author: Sergey Sharybin
Date:   Wed Jun 19 12:15:10 2019 +0200
Branches: master
https://developer.blender.org/rB54e6b262a14b23160fdecfec68f3e22dcf70bb3e

Cleanup: Pass explicit dependency graph

Avoids hash lookup on per-object basis when applying transform.

===

M   source/blender/editors/object/object_transform.c

===

diff --git a/source/blender/editors/object/object_transform.c 
b/source/blender/editors/object/object_transform.c
index 86144937844..841a3bbed7d 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -460,11 +460,10 @@ void OBJECT_OT_origin_clear(wmOperatorType *ot)
 
 /* use this when the loc/size/rot of the parent has changed but the children
  * should stay in the same place, e.g. for apply-size-rot or object center */
-static void ignore_parent_tx(const bContext *C, Main *bmain, Scene *scene, 
Object *ob)
+static void ignore_parent_tx(Main *bmain, Depsgraph *depsgraph, Scene *scene, 
Object *ob)
 {
   Object workob;
   Object *ob_child;
-  Depsgraph *depsgraph = CTX_data_depsgraph(C);
 
   /* a change was made, adjust the children to compensate */
   for (ob_child = bmain->objects.first; ob_child; ob_child = 
ob_child->id.next) {
@@ -793,7 +792,7 @@ static int apply_objects_internal(bContext *C,
   BKE_pose_where_is(depsgraph, scene, ob_eval);
 }
 
-ignore_parent_tx(C, bmain, scene, ob);
+ignore_parent_tx(bmain, depsgraph, scene, ob);
 
 DEG_id_tag_update(>id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
 
@@ -1166,7 +1165,7 @@ static int object_origin_set_exec(bContext *C, wmOperator 
*op)
   BKE_object_where_is_calc(depsgraph, scene, ob);
   BKE_pose_where_is(depsgraph, scene, ob); /* needed for bone parents 
*/
 
-  ignore_parent_tx(C, bmain, scene, ob);
+  ignore_parent_tx(bmain, depsgraph, scene, ob);
 
   if (obedit) {
 break;
@@ -1305,7 +1304,7 @@ static int object_origin_set_exec(bContext *C, wmOperator 
*op)
   BKE_pose_where_is(depsgraph, scene, ob); /* needed for bone parents 
*/
 }
 
-ignore_parent_tx(C, bmain, scene, ob);
+ignore_parent_tx(bmain, depsgraph, scene, ob);
 
 /* other users? */
 // CTX_DATA_BEGIN (C, Object *, ob_other, selected_editable_objects)
@@ -1331,7 +1330,7 @@ static int object_origin_set_exec(bContext *C, wmOperator 
*op)
   /* needed for bone parents */
   BKE_pose_where_is(depsgraph, scene, ob_other);
 }
-ignore_parent_tx(C, bmain, scene, ob_other);
+ignore_parent_tx(bmain, depsgraph, scene, ob_other);
   }
 }
 // CTX_DATA_END;

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


[Bf-blender-cvs] [4dc71367c70] master: Fix T65918 DRW: Crash when add a any modifier to a curve

2019-06-19 Thread Clément Foucault
Commit: 4dc71367c7001a6d5395780e5493076d5d700300
Author: Clément Foucault
Date:   Wed Jun 19 12:20:55 2019 +0200
Branches: master
https://developer.blender.org/rB4dc71367c7001a6d5395780e5493076d5d700300

Fix T65918 DRW: Crash when add a any modifier to a curve

===

M   source/blender/draw/modes/object_mode.c

===

diff --git a/source/blender/draw/modes/object_mode.c 
b/source/blender/draw/modes/object_mode.c
index bbf364960c9..e8c600ee545 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -3221,10 +3221,12 @@ static void OBJECT_cache_populate(void *vedata, Object 
*ob)
 break;
   }
   geom = DRW_cache_lattice_wire_get(ob, false);
+  if (geom == NULL) {
+break;
+  }
   if (theme_id == TH_UNDEFINED) {
 theme_id = DRW_object_wire_theme_get(ob, view_layer, NULL);
   }
-
   shgroup = shgroup_theme_id_to_wire(sgl, theme_id, ob->base_flag);
   DRW_shgroup_call(shgroup, geom, ob);
 }
@@ -3236,6 +3238,9 @@ static void OBJECT_cache_populate(void *vedata, Object 
*ob)
 break;
   }
   geom = DRW_cache_curve_edge_wire_get(ob);
+  if (geom == NULL) {
+break;
+  }
   if (theme_id == TH_UNDEFINED) {
 theme_id = DRW_object_wire_theme_get(ob, view_layer, NULL);
   }

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


[Bf-blender-cvs] [08f6566dbfc] soc-2019-npr: LANPR: Default values now in versioning_280.c

2019-06-19 Thread YimingWu
Commit: 08f6566dbfc190803ddb93783e12218e4c6df7e0
Author: YimingWu
Date:   Wed Jun 19 18:17:20 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB08f6566dbfc190803ddb93783e12218e4c6df7e0

LANPR: Default values now in versioning_280.c

===

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

===

diff --git a/source/blender/blenloader/intern/versioning_280.c 
b/source/blender/blenloader/intern/versioning_280.c
index 65ab20af831..93f17a0eb02 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -3519,6 +3519,31 @@ void blo_do_versions_280(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
 do_versions_seq_alloc_transform_and_crop(>ed->seqbase);
   }
 }
+for (Scene *sce = bmain->scenes.first; sce; sce = sce->id.next) {
+sce->lanpr.crease_threshold = 0.7;
+
+sce->lanpr.line_thickness = 1.5;
+sce->lanpr.depth_clamp = 0.001;
+sce->lanpr.depth_strength = 800;
+sce->lanpr.normal_clamp = 2;
+sce->lanpr.normal_strength = 10;
+
+sce->lanpr.enable_intersections = 1;
+
+sce->lanpr.background_color[0] = 0;
+sce->lanpr.background_color[1] = 0;
+sce->lanpr.background_color[2] = 0;
+sce->lanpr.background_color[3] = 1;
+
+sce->lanpr.line_color[0] = 1;
+sce->lanpr.line_color[1] = 1;
+sce->lanpr.line_color[2] = 1;
+sce->lanpr.line_color[3] = 1;
+
+sce->lanpr.enable_intersections = 1;
+sce->lanpr.enable_chaining = 1;
+sce->lanpr.chaining_threshold = 0.01;
+}
   }
 
   {

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


[Bf-blender-cvs] [3138c7c5d79] functions: rename files

2019-06-19 Thread Jacques Lucke
Commit: 3138c7c5d7912c4b90b13e78263886873e964826
Author: Jacques Lucke
Date:   Wed Jun 19 10:39:02 2019 +0200
Branches: functions
https://developer.blender.org/rB3138c7c5d7912c4b90b13e78263886873e964826

rename files

===

M   source/blender/simulations/CMakeLists.txt
M   source/blender/simulations/bparticles/c_wrapper.cpp
R098source/blender/simulations/bparticles/emitter.cpp   
source/blender/simulations/bparticles/emitters.cpp
R100source/blender/simulations/bparticles/emitter.hpp   
source/blender/simulations/bparticles/emitters.hpp

===

diff --git a/source/blender/simulations/CMakeLists.txt 
b/source/blender/simulations/CMakeLists.txt
index ba0bbf23d0e..3ef9df3a6ba 100644
--- a/source/blender/simulations/CMakeLists.txt
+++ b/source/blender/simulations/CMakeLists.txt
@@ -21,8 +21,8 @@ set(SRC
   bparticles/particles_container.cpp
   bparticles/playground_solver.hpp
   bparticles/playground_solver.cpp
-  bparticles/emitter.hpp
-  bparticles/emitter.cpp
+  bparticles/emitters.hpp
+  bparticles/emitters.cpp
   bparticles/attributes.hpp
   bparticles/attributes.cpp
   bparticles/c_wrapper.cpp
diff --git a/source/blender/simulations/bparticles/c_wrapper.cpp 
b/source/blender/simulations/bparticles/c_wrapper.cpp
index 7315705683d..635e7d51c74 100644
--- a/source/blender/simulations/bparticles/c_wrapper.cpp
+++ b/source/blender/simulations/bparticles/c_wrapper.cpp
@@ -2,7 +2,7 @@
 #include "core.hpp"
 #include "particles_container.hpp"
 #include "playground_solver.hpp"
-#include "emitter.hpp"
+#include "emitters.hpp"
 #include "BLI_noise.h"
 #include "BLI_timeit.hpp"
 
diff --git a/source/blender/simulations/bparticles/emitter.cpp 
b/source/blender/simulations/bparticles/emitters.cpp
similarity index 98%
rename from source/blender/simulations/bparticles/emitter.cpp
rename to source/blender/simulations/bparticles/emitters.cpp
index cfae437f943..27905ee27e3 100644
--- a/source/blender/simulations/bparticles/emitter.cpp
+++ b/source/blender/simulations/bparticles/emitters.cpp
@@ -1,4 +1,4 @@
-#include "emitter.hpp"
+#include "emitters.hpp"
 #include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "BKE_mesh_runtime.h"
diff --git a/source/blender/simulations/bparticles/emitter.hpp 
b/source/blender/simulations/bparticles/emitters.hpp
similarity index 100%
rename from source/blender/simulations/bparticles/emitter.hpp
rename to source/blender/simulations/bparticles/emitters.hpp

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


[Bf-blender-cvs] [0a7715e3086] functions: move forces into separate file

2019-06-19 Thread Jacques Lucke
Commit: 0a7715e30862345c8ed4eb681898a178b68bf4fb
Author: Jacques Lucke
Date:   Wed Jun 19 11:06:23 2019 +0200
Branches: functions
https://developer.blender.org/rB0a7715e30862345c8ed4eb681898a178b68bf4fb

move forces into separate file

===

M   source/blender/simulations/CMakeLists.txt
M   source/blender/simulations/bparticles/c_wrapper.cpp
M   source/blender/simulations/bparticles/emitters.cpp
M   source/blender/simulations/bparticles/emitters.hpp
A   source/blender/simulations/bparticles/forces.cpp
A   source/blender/simulations/bparticles/forces.hpp

===

diff --git a/source/blender/simulations/CMakeLists.txt 
b/source/blender/simulations/CMakeLists.txt
index 3ef9df3a6ba..08770db1712 100644
--- a/source/blender/simulations/CMakeLists.txt
+++ b/source/blender/simulations/CMakeLists.txt
@@ -23,6 +23,8 @@ set(SRC
   bparticles/playground_solver.cpp
   bparticles/emitters.hpp
   bparticles/emitters.cpp
+  bparticles/forces.hpp
+  bparticles/forces.cpp
   bparticles/attributes.hpp
   bparticles/attributes.cpp
   bparticles/c_wrapper.cpp
diff --git a/source/blender/simulations/bparticles/c_wrapper.cpp 
b/source/blender/simulations/bparticles/c_wrapper.cpp
index 635e7d51c74..9009f2b05e2 100644
--- a/source/blender/simulations/bparticles/c_wrapper.cpp
+++ b/source/blender/simulations/bparticles/c_wrapper.cpp
@@ -3,7 +3,8 @@
 #include "particles_container.hpp"
 #include "playground_solver.hpp"
 #include "emitters.hpp"
-#include "BLI_noise.h"
+#include "forces.hpp"
+
 #include "BLI_timeit.hpp"
 
 #define WRAPPERS(T1, T2) \
@@ -36,81 +37,17 @@ WRAPPERS(BParticles::Description *, BParticlesDescription);
 WRAPPERS(BParticles::Solver *, BParticlesSolver);
 WRAPPERS(BParticles::WrappedState *, BParticlesState);
 
-class TestForce : public BParticles::Force {
- private:
-  float m_strength;
-
- public:
-  TestForce(float strength) : m_strength(strength)
-  {
-  }
-
-  void add_force(AttributeArrays UNUSED(attributes),
- ArrayRef indices_mask,
- ArrayRef dst) override
-  {
-for (uint i = 0; i < indices_mask.size(); i++) {
-  dst[i].z += m_strength;
-}
-  };
-};
-
-class TurbulenceForce : public BParticles::Force {
- private:
-  float m_strength;
-
- public:
-  TurbulenceForce(float strength) : m_strength(strength)
-  {
-  }
-
-  void add_force(AttributeArrays attributes,
- ArrayRef indices_mask,
- ArrayRef dst) override
-  {
-auto positions = attributes.get_float3("Position");
-for (uint i = 0; i < indices_mask.size(); i++) {
-  uint pindex = indices_mask[i];
-
-  float3 pos = positions[pindex];
-  float value = BLI_hnoise(0.5f, pos.x, pos.y, pos.z);
-  dst[i].z += value * m_strength;
-}
-  }
-};
-
-class TestEmitter : public BParticles::Emitter {
- public:
-  void info(EmitterInfoBuilder ) const override
-  {
-builder.inits_attribute("Position", AttributeType::Float3);
-builder.inits_attribute("Velocity", AttributeType::Float3);
-  }
-
-  void emit(EmitterHelper helper) override
-  {
-EmitterTarget  = helper.request_raw();
-
-auto positions = dst.attributes().get_float3("Position");
-auto velocities = dst.attributes().get_float3("Velocity");
-
-for (uint i = 0; i < dst.size(); i++) {
-  positions[i] = {(float)(rand() % 1) / 3000.0f, 0, 1};
-  velocities[i] = {0, 1, 1};
-}
-dst.set_initialized(dst.size());
-  }
-};
-
 BParticlesDescription BParticles_playground_description(float control1,
 float control2,
 float 
*emitter_position,
 struct Mesh *mesh)
 {
-  auto emitter1 = BParticles::new_point_emitter(emitter_position);
-  auto emitter2 = BParticles::new_surface_emitter(mesh);
+  auto force = BParticles::FORCE_directional({0.0, 0.0, control1});
+
+  auto emitter1 = BParticles::EMITTER_point(emitter_position);
+  auto emitter2 = BParticles::EMITTER_mesh_surface(mesh, control2);
 
-  Description *description = new Description({new TestForce(control1)},
+  Description *description = new Description({force.release()},
  {emitter1.release(), 
emitter2.release()});
   return wrap(description);
 }
diff --git a/source/blender/simulations/bparticles/emitters.cpp 
b/source/blender/simulations/bparticles/emitters.cpp
index 27905ee27e3..6b7292ccbaf 100644
--- a/source/blender/simulations/bparticles/emitters.cpp
+++ b/source/blender/simulations/bparticles/emitters.cpp
@@ -36,9 +36,11 @@ class PointEmitter : public Emitter {
 class SurfaceEmitter : public Emitter {
  private:
   Mesh *m_mesh;
+  float m_normal_velocity;
 
  public:
-  SurfaceEmitter(Mesh *mesh) : m_mesh(mesh)
+  SurfaceEmitter(Mesh *mesh, float normal_velocity)
+ 

[Bf-blender-cvs] [05969e5418f] functions: initial curve emitter

2019-06-19 Thread Jacques Lucke
Commit: 05969e5418f7723215e3be20e38808b31bcb42c0
Author: Jacques Lucke
Date:   Wed Jun 19 12:24:20 2019 +0200
Branches: functions
https://developer.blender.org/rB05969e5418f7723215e3be20e38808b31bcb42c0

initial curve emitter

===

M   source/blender/blenlib/BLI_math.hpp
M   source/blender/modifiers/intern/MOD_nodeparticles.c
M   source/blender/simulations/BParticles.h
M   source/blender/simulations/bparticles/c_wrapper.cpp
M   source/blender/simulations/bparticles/core.hpp
M   source/blender/simulations/bparticles/emitters.cpp
M   source/blender/simulations/bparticles/emitters.hpp

===

diff --git a/source/blender/blenlib/BLI_math.hpp 
b/source/blender/blenlib/BLI_math.hpp
index 7cbd353c4c2..42a4b84a587 100644
--- a/source/blender/blenlib/BLI_math.hpp
+++ b/source/blender/blenlib/BLI_math.hpp
@@ -1,5 +1,7 @@
 #pragma once
 
+#include "BLI_math_matrix.h"
+
 namespace BLI {
 
 struct float3 {
@@ -54,4 +56,28 @@ struct float3 {
   }
 };
 
+struct float4x4 {
+  float v[4][4];
+
+  float4x4(float *matrix)
+  {
+memcpy(v, matrix, sizeof(float) * 16);
+  }
+
+  float4x4(float matrix[4][4]) : float4x4((float *)matrix)
+  {
+  }
+
+  operator float *()
+  {
+return (float *)this;
+  }
+
+  float3 transform_position(float3 position)
+  {
+mul_m4_v3((float(*)[4])this, position);
+return position;
+  }
+};
+
 }  // namespace BLI
diff --git a/source/blender/modifiers/intern/MOD_nodeparticles.c 
b/source/blender/modifiers/intern/MOD_nodeparticles.c
index 1d50bbb903c..0589297b140 100644
--- a/source/blender/modifiers/intern/MOD_nodeparticles.c
+++ b/source/blender/modifiers/intern/MOD_nodeparticles.c
@@ -62,18 +62,11 @@ static RuntimeData 
*get_runtime_data(NodeParticlesModifierData *npmd)
   return data;
 }
 
-static BParticlesDescription create_current_description(Object *self,
+static BParticlesDescription create_current_description(Object *UNUSED(self),
 
NodeParticlesModifierData *npmd,
-Depsgraph *depsgraph)
+Depsgraph 
*UNUSED(depsgraph))
 {
-  float position[3] = {0, 0, 0};
-  if (npmd->emitter_object != NULL) {
-Object *emitter_eval = DEG_get_evaluated_object(depsgraph, 
npmd->emitter_object);
-copy_v3_v3(position, emitter_eval->loc);
-  }
-  mul_m4_v3(self->imat, position);
-  return BParticles_playground_description(
-  npmd->control1, npmd->control2, position, (Mesh *)self->data);
+  return BParticles_playground_description(npmd->control1, npmd->control2, 
npmd->emitter_object);
 }
 
 static void ensure_runtime_data(Object *self,
@@ -193,7 +186,7 @@ static void updateDepsgraph(ModifierData *md, const 
ModifierUpdateDepsgraphConte
   NodeParticlesModifierData *npmd = (NodeParticlesModifierData *)md;
   if (npmd->emitter_object) {
 DEG_add_object_relation(
-ctx->node, npmd->emitter_object, DEG_OB_COMP_TRANSFORM, "Node 
Particles Modifier");
+ctx->node, npmd->emitter_object, DEG_OB_COMP_GEOMETRY, "Node Particles 
Modifier");
   }
 }
 
diff --git a/source/blender/simulations/BParticles.h 
b/source/blender/simulations/BParticles.h
index 0212990a6b5..5fdc78a4b52 100644
--- a/source/blender/simulations/BParticles.h
+++ b/source/blender/simulations/BParticles.h
@@ -8,7 +8,7 @@
 extern "C" {
 #endif
 
-struct Mesh;
+struct Object;
 
 typedef struct OpaqueBParticlesDescription *BParticlesDescription;
 typedef struct OpaqueBParticlesSolver *BParticlesSolver;
@@ -16,8 +16,7 @@ typedef struct OpaqueBParticlesState *BParticlesState;
 
 BParticlesDescription BParticles_playground_description(float control1,
 float control2,
-float 
*emitter_position,
-struct Mesh *mesh);
+struct Object *object);
 void BParticles_description_free(BParticlesDescription description);
 
 BParticlesSolver BParticles_solver_build(BParticlesDescription description);
diff --git a/source/blender/simulations/bparticles/c_wrapper.cpp 
b/source/blender/simulations/bparticles/c_wrapper.cpp
index 9009f2b05e2..1df8dd8c89b 100644
--- a/source/blender/simulations/bparticles/c_wrapper.cpp
+++ b/source/blender/simulations/bparticles/c_wrapper.cpp
@@ -6,6 +6,12 @@
 #include "forces.hpp"
 
 #include "BLI_timeit.hpp"
+#include "BLI_listbase.h"
+
+#include "BKE_curve.h"
+
+#include "DNA_object_types.h"
+#include "DNA_curve_types.h"
 
 #define WRAPPERS(T1, T2) \
   inline T1 unwrap(T2 value) \
@@ -20,6 +26,7 @@
 using BParticles::AttributeArrays;
 using BParticles::AttributeType;
 using BParticles::Description;
+using BParticles::Emitter;
 using BParticles::EmitterHelper;
 

[Bf-blender-cvs] [9d29373b06e] soc-2019-openxr: Init OpenXR graphics bindings with valid graphics context (Win only)

2019-06-19 Thread Julian Eisel
Commit: 9d29373b06e8312bdcbc93232a1d18e6d90d65a1
Author: Julian Eisel
Date:   Wed Jun 19 12:18:35 2019 +0200
Branches: soc-2019-openxr
https://developer.blender.org/rB9d29373b06e8312bdcbc93232a1d18e6d90d65a1

Init OpenXR graphics bindings with valid graphics context (Win only)

Will do this for Linux in a separate commit.

Also fixes a stupid mistake from previous commit on lazy-creation of XR
context.

===

M   intern/ghost/intern/GHOST_ContextD3D.cpp
M   intern/ghost/intern/GHOST_ContextD3D.h
M   intern/ghost/intern/GHOST_ContextWGL.cpp
M   intern/ghost/intern/GHOST_ContextWGL.h
M   intern/ghost/intern/GHOST_XRSession.cpp
M   release/scripts/addons
M   source/blender/windowmanager/intern/wm_operators.c

===

diff --git a/intern/ghost/intern/GHOST_ContextD3D.cpp 
b/intern/ghost/intern/GHOST_ContextD3D.cpp
index 2f3e28a28b2..2c4a5860ed9 100644
--- a/intern/ghost/intern/GHOST_ContextD3D.cpp
+++ b/intern/ghost/intern/GHOST_ContextD3D.cpp
@@ -383,3 +383,8 @@ static void drawTestTriangle(ID3D11Device *m_device,
   m_device_ctx->Draw(std::size(vertices), 0);
 }
 #endif
+
+ID3D11Device *GHOST_ContextD3D::getDevice()
+{
+  return m_device.Get();
+}
diff --git a/intern/ghost/intern/GHOST_ContextD3D.h 
b/intern/ghost/intern/GHOST_ContextD3D.h
index 9f067fa23ce..2a28d03c9b5 100644
--- a/intern/ghost/intern/GHOST_ContextD3D.h
+++ b/intern/ghost/intern/GHOST_ContextD3D.h
@@ -113,6 +113,8 @@ class GHOST_ContextD3D : public GHOST_Context {
 return true;
   }
 
+  ID3D11Device *getDevice();
+
  private:
   friend class SharedOpenGLContext;
 
diff --git a/intern/ghost/intern/GHOST_ContextWGL.cpp 
b/intern/ghost/intern/GHOST_ContextWGL.cpp
index a3d5d6f7edf..62e17359d71 100644
--- a/intern/ghost/intern/GHOST_ContextWGL.cpp
+++ b/intern/ghost/intern/GHOST_ContextWGL.cpp
@@ -730,3 +730,8 @@ GHOST_TSuccess GHOST_ContextWGL::releaseNativeHandles()
 
   return success;
 }
+
+GHOST_ContextWGL::Info GHOST_ContextWGL::getInfo()
+{
+  return Info{m_hDC, m_hGLRC};
+}
diff --git a/intern/ghost/intern/GHOST_ContextWGL.h 
b/intern/ghost/intern/GHOST_ContextWGL.h
index af7619e3806..ed230591912 100644
--- a/intern/ghost/intern/GHOST_ContextWGL.h
+++ b/intern/ghost/intern/GHOST_ContextWGL.h
@@ -101,6 +101,15 @@ class GHOST_ContextWGL : public GHOST_Context {
 
   GHOST_TSuccess setDefaultFramebufferSize(GHOST_TUns32 width, GHOST_TUns32 
height);
 
+  /**
+   * Helper to get low level system specific info out of the context.
+   */
+  struct Info {
+HDC hDC;
+HGLRC hGLRC;
+  };
+  Info getInfo();
+
  private:
   int choose_pixel_format(bool stereoVisual, bool needAlpha);
   int choose_pixel_format_arb(bool stereoVisual, bool needAlpha);
diff --git a/intern/ghost/intern/GHOST_XRSession.cpp 
b/intern/ghost/intern/GHOST_XRSession.cpp
index bf36732aa89..f66214ed1c1 100644
--- a/intern/ghost/intern/GHOST_XRSession.cpp
+++ b/intern/ghost/intern/GHOST_XRSession.cpp
@@ -23,6 +23,12 @@
 #include 
 
 #include "GHOST_C-api.h"
+#if defined(WITH_X11)
+#  include "GHOST_ContextGLX.h"
+#elif defined(WIN32)
+#  include "GHOST_ContextWGL.h"
+#  include "GHOST_ContextD3D.h"
+#endif
 
 #include "GHOST_XR_intern.h"
 
@@ -62,7 +68,7 @@ static void GHOST_XR_system_init(OpenXRData *oxr)
 }
 
 static void *openxr_graphics_binding_create(const GHOST_XRContext *xr_context,
-GHOST_ContextHandle 
/*ghost_context*/)
+GHOST_Context *ghost_ctx)
 {
   static union {
 #if defined(WITH_X11)
@@ -80,14 +86,22 @@ static void *openxr_graphics_binding_create(const 
GHOST_XRContext *xr_context,
 #if defined(WITH_X11)
   binding.glx.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_XLIB_KHR;
 #elif defined(WIN32)
+  GHOST_ContextWGL *ctx_wgl = static_cast(ghost_ctx);
+  GHOST_ContextWGL::Info info = ctx_wgl->getInfo();
+
   binding.wgl.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_WIN32_KHR;
+  binding.wgl.hDC = info.hDC;
+  binding.wgl.hGLRC = info.hGLRC;
 #endif
 
   break;
 }
 #ifdef WIN32
 case GHOST_kXRGraphicsD3D11: {
+  GHOST_ContextD3D *ctx_d3d = static_cast(ghost_ctx);
+
   binding.d3d11.type = XR_TYPE_GRAPHICS_BINDING_D3D11_KHR;
+  binding.d3d11.device = ctx_d3d->getDevice();
 
   break;
 }
@@ -128,8 +142,7 @@ void GHOST_XR_session_start(GHOST_XRContext *xr_context)
   XrSessionCreateInfo create_info{};
   create_info.type = XR_TYPE_SESSION_CREATE_INFO;
   create_info.systemId = oxr->system_id;
-  create_info.next = openxr_graphics_binding_create(xr_context,
-
(GHOST_ContextHandle)xr_context->gpu_ctx);
+  create_info.next = openxr_graphics_binding_create(xr_context, 
xr_context->gpu_ctx);
 
   xrCreateSession(oxr->instance, _info, >session);
 }
diff --git a/release/scripts/addons b/release/scripts/addons
index 

[Bf-blender-cvs] [15afcb6dd91] greasepencil-object: DRW: New functions for getting stencil_mask id

2019-06-19 Thread Antonioya
Commit: 15afcb6dd91030af2a61b4bc8a6a72fde9974efa
Author: Antonioya
Date:   Wed Jun 19 09:28:34 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB15afcb6dd91030af2a61b4bc8a6a72fde9974efa

DRW: New functions for getting stencil_mask id

Workaround functions waiting for the clearing operation to be available inside 
the shgroups.

Required to check if the stencil was activated in the shading group to 
calculate batches of 255 stencil masks and reduce number of stencil clearing.

===

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

===

diff --git a/source/blender/draw/intern/DRW_render.h 
b/source/blender/draw/intern/DRW_render.h
index aae1ad42860..392362e73c5 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -531,7 +531,11 @@ void DRW_shgroup_uniform_float_copy(DRWShadingGroup 
*shgroup, const char *name,
 void DRW_shgroup_uniform_vec2_copy(DRWShadingGroup *shgroup, const char *name, 
const float *value);
 
 bool DRW_shgroup_is_empty(DRWShadingGroup *shgroup);
+
+/* TODO: workaround functions waiting for the clearing operation to be 
available inside the
+ * shgroups. */
 DRWShadingGroup *DRW_shgroup_get_next(DRWShadingGroup *shgroup);
+uint DRW_shgroup_stencil_mask_get(DRWShadingGroup *shgroup);
 
 /* Passes */
 DRWPass *DRW_pass_create(const char *name, DRWState state);
diff --git a/source/blender/draw/intern/draw_manager_data.c 
b/source/blender/draw/intern/draw_manager_data.c
index 10d16021b27..99ab25645d2 100644
--- a/source/blender/draw/intern/draw_manager_data.c
+++ b/source/blender/draw/intern/draw_manager_data.c
@@ -1003,6 +1003,13 @@ DRWShadingGroup *DRW_shgroup_get_next(DRWShadingGroup 
*shgroup)
   return shgroup->next;
 }
 
+/* This is a workaround function waiting for the clearing operation to be 
available inside the
+ * shgroups. */
+uint DRW_shgroup_stencil_mask_get(DRWShadingGroup *shgroup)
+{
+  return shgroup->stencil_mask;
+}
+
 DRWShadingGroup *DRW_shgroup_create_sub(DRWShadingGroup *shgroup)
 {
   DRWShadingGroup *shgroup_new = BLI_memblock_alloc(DST.vmempool->shgroups);

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


[Bf-blender-cvs] [16279cbbba3] greasepencil-object: GPencil: Remove parameter and use Stencil for lines solid only

2019-06-19 Thread Antonioya
Commit: 16279cbbba380efb9f6acfca9b81eba3da119b38
Author: Antonioya
Date:   Tue Jun 18 20:44:40 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB16279cbbba380efb9f6acfca9b81eba3da119b38

GPencil: Remove parameter and use Stencil for lines solid only

Also removed the parameter from UI

===

M   release/scripts/startup/bl_ui/properties_material_gpencil.py
M   source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M   source/blender/makesdna/DNA_material_types.h
M   source/blender/makesrna/intern/rna_material.c

===

diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py 
b/release/scripts/startup/bl_ui/properties_material_gpencil.py
index 2215fa40c27..7cd68f34e9e 100644
--- a/release/scripts/startup/bl_ui/properties_material_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py
@@ -144,7 +144,6 @@ class 
MATERIAL_PT_gpencil_strokecolor(GPMaterialButtonsPanel, Panel):
 col.template_ID(gpcolor, "stroke_image", open="image.open")
 if gpcolor.mode == 'LINE':
 col.prop(gpcolor, "pixel_size", text="UV Factor")
-col.prop(gpcolor, "use_stencil_clipping")
 
 col.prop(gpcolor, "use_stroke_pattern", text="Use As Pattern")
 if gpcolor.use_stroke_pattern is False:
@@ -161,8 +160,6 @@ class 
MATERIAL_PT_gpencil_strokecolor(GPMaterialButtonsPanel, Panel):
 
 if gpcolor.mode in {'DOTS', 'BOX'}:
 col.prop(gpcolor, "alignment_mode")
-if gpcolor.mode == 'LINE':
-col.prop(gpcolor, "use_stencil_clipping")
 
 
 class MATERIAL_PT_gpencil_fillcolor(GPMaterialButtonsPanel, Panel):
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c 
b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 6918f65897e..07d45a20962 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -1398,6 +1398,12 @@ void DRW_gpencil_triangulate_stroke_fill(Object *ob, 
bGPDstroke *gps)
   MEM_SAFE_FREE(uv);
 }
 
+/* Check if stencil is required */
+static bool gpencil_is_stencil_required(MaterialGPencilStyle *gp_style)
+{
+  return (bool)(gp_style->stroke_style == GP_STYLE_STROKE_STYLE_SOLID);
+}
+
 /* draw stroke in drawing buffer */
 void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data,
  void *vedata,
@@ -1462,7 +1468,7 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data 
*e_data,
   1.0f,
   (const int *)stl->storage->shade_render);
 
-  if (gp_style->flag & GP_STYLE_DISABLE_STENCIL) {
+  if (!gpencil_is_stencil_required(gp_style)) {
 /* Disable stencil for this type */
 DRW_shgroup_state_disable(stl->g_data->shgrps_drawing_stroke,
   DRW_STATE_WRITE_STENCIL | 
DRW_STATE_STENCIL_NEQUAL);
@@ -1693,16 +1699,16 @@ static void DRW_gpencil_shgroups_create(GPENCIL_e_data 
*e_data,
 start_stroke = elm->vertex_idx;
 
 /* set stencil mask id */
-if (gp_style->flag & GP_STYLE_DISABLE_STENCIL) {
+if (gpencil_is_stencil_required(gp_style)) {
+  DRW_shgroup_stencil_mask(shgrp, stencil_id);
+  stencil_id++;
+}
+else {
   /* Disable stencil for this type */
   DRW_shgroup_state_disable(shgrp, DRW_STATE_WRITE_STENCIL | 
DRW_STATE_STENCIL_NEQUAL);
   /* set stencil mask id as not used */
   DRW_shgroup_stencil_mask(shgrp, 0x00f);
 }
-else {
-  DRW_shgroup_stencil_mask(shgrp, stencil_id);
-  stencil_id++;
-}
 break;
   }
   case eGpencilBatchGroupType_Point: {
diff --git a/source/blender/makesdna/DNA_material_types.h 
b/source/blender/makesdna/DNA_material_types.h
index 480e7cd397f..d65a4896758 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -128,8 +128,6 @@ typedef enum eMaterialGPencilStyle_Flag {
   GP_STYLE_FILL_SHOW = (1 << 9),
   /* mix stroke texture */
   GP_STYLE_STROKE_TEX_MIX = (1 << 11),
-  /* disable stencil clipping */
-  GP_STYLE_DISABLE_STENCIL = (1 << 12),
 } eMaterialGPencilStyle_Flag;
 
 typedef enum eMaterialGPencilStyle_Mode {
diff --git a/source/blender/makesrna/intern/rna_material.c 
b/source/blender/makesrna/intern/rna_material.c
index bc8d040587d..3ff2e884d92 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -620,12 +620,6 @@ static void rna_def_material_greasepencil(BlenderRNA *brna)
   RNA_def_property_ui_text(prop, "Pattern", "Use Fill Texture as a pattern to 
apply color");
   RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, 

[Bf-blender-cvs] [0ac8ef1131d] greasepencil-object: GPencil: Separate Stencils in groups of 255

2019-06-19 Thread Antonioya
Commit: 0ac8ef1131dfcf4327e07fd98173ecb53a1f2bc4
Author: Antonioya
Date:   Wed Jun 19 12:25:15 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB0ac8ef1131dfcf4327e07fd98173ecb53a1f2bc4

GPencil: Separate Stencils in groups of 255

Also some more changes to improve drawing.

===

M   source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M   source/blender/draw/engines/gpencil/gpencil_engine.c
M   source/blender/draw/engines/gpencil/gpencil_engine.h

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c 
b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 07d45a20962..0677e026423 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -1468,7 +1468,10 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data 
*e_data,
   1.0f,
   (const int *)stl->storage->shade_render);
 
-  if (!gpencil_is_stencil_required(gp_style)) {
+  if (gpencil_is_stencil_required(gp_style)) {
+DRW_shgroup_stencil_mask(stl->g_data->shgrps_drawing_stroke, 0x01);
+  }
+  else {
 /* Disable stencil for this type */
 DRW_shgroup_state_disable(stl->g_data->shgrps_drawing_stroke,
   DRW_STATE_WRITE_STENCIL | 
DRW_STATE_STENCIL_NEQUAL);
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 2025ecc404a..7e320cc8055 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -749,7 +749,7 @@ static void 
gpencil_prepare_fast_drawing(GPENCIL_StorageList *stl,
 GPU_framebuffer_bind(fbl->background_fb);
 /* clean only in first loop cycle */
 if (stl->g_data->session_flag & GP_DRW_PAINT_IDLE) {
-  GPU_framebuffer_clear_color_depth_stencil(fbl->background_fb, clearcol, 
1.0f, 0x00f);
+  GPU_framebuffer_clear_color_depth_stencil(fbl->background_fb, clearcol, 
1.0f, 0x0);
   stl->g_data->session_flag = GP_DRW_PAINT_FILLING;
 }
 /* repeat pass to fill temp texture */
@@ -798,16 +798,74 @@ static void 
gpencil_draw_pass_range(GPENCIL_FramebufferList *fbl,
 return;
   }
 
-  /* previews don't use AA */
-  if ((!stl->storage->is_mat_preview) && (multi)) {
+  const bool do_antialiasing = ((!stl->storage->is_mat_preview) && (multi));
+
+  DRWShadingGroup *shgrp = init_shgrp;
+  DRWShadingGroup *from_shgrp = init_shgrp;
+  DRWShadingGroup *to_shgrp = init_shgrp;
+  int stencil_tot = 0;
+  bool do_last = false;
+
+  if (do_antialiasing) {
 MULTISAMPLE_GP_SYNC_ENABLE(stl->storage->multisamples, fbl);
   }
 
-  DRW_draw_pass_subset(GPENCIL_3D_DRAWMODE(ob, gpd) ? psl->stroke_pass_3d : 
psl->stroke_pass_2d,
-   init_shgrp,
-   end_shgrp);
+  /* Loop all shading groups to separate by stencil groups. */
+  while (shgrp) {
+do_last = true;
+/* Count number of groups using stencil. */
+if (DRW_shgroup_stencil_mask_get(shgrp) != 0) {
+  stencil_tot++;
+}
+
+/* Draw stencil group and clear stencil bit. This is required because the 
number of
+ * shading groups can be greater than the limit of 255 stencil values.
+ * Only count as stencil if the shading group has an stencil value 
assigned. This reduces
+ * the number of clears because Dots, Fills and some Line strokes don't 
need stencil.
+ */
+if (stencil_tot == 255) {
+  DRW_draw_pass_subset(GPENCIL_3D_DRAWMODE(ob, gpd) ? psl->stroke_pass_3d :
+  psl->stroke_pass_2d,
+   from_shgrp,
+   to_shgrp);
+  /* Clear Stencil and prepare for next group. */
+  if (do_antialiasing) {
+GPU_framebuffer_clear_stencil(fbl->multisample_fb, 0x0);
+  }
+  else {
+GPU_framebuffer_clear_stencil(fb, 0x0);
+  }
+
+  /* Set new init group and reset. */
+  do_last = false;
+
+  shgrp = DRW_shgroup_get_next(shgrp);
+  if (shgrp) {
+from_shgrp = shgrp;
+to_shgrp = shgrp;
+stencil_tot = 0;
+continue;
+  }
+  else {
+/* No more groups. */
+break;
+  }
+}
+/* Still below stencil group limit. */
+shgrp = DRW_shgroup_get_next(shgrp);
+if (shgrp) {
+  to_shgrp = shgrp;
+}
+  }
+
+  /* Draw last pending groups. */
+  if (do_last) {
+DRW_draw_pass_subset(GPENCIL_3D_DRAWMODE(ob, gpd) ? psl->stroke_pass_3d : 
psl->stroke_pass_2d,
+ from_shgrp,
+ to_shgrp);
+  }
 
-  if ((!stl->storage->is_mat_preview) && (multi)) {
+  if (do_antialiasing) {
 

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

2019-06-19 Thread Antonioya
Commit: caa7c9a36fcddc5cd24a66761c538a574665039e
Author: Antonioya
Date:   Wed Jun 19 12:56:55 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBcaa7c9a36fcddc5cd24a66761c538a574665039e

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] [dbb151c02b3] soc-2019-npr: LANPR: modified default UI for more logical display.

2019-06-19 Thread YimingWu
Commit: dbb151c02b386edaca9fbd0ef8f8361a69394b6a
Author: YimingWu
Date:   Wed Jun 19 15:09:04 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rBdbb151c02b386edaca9fbd0ef8f8361a69394b6a

LANPR: modified default UI for more logical display.

===

M   release/scripts/startup/bl_ui/properties_render.py
M   source/blender/makesdna/DNA_lanpr_types.h
M   source/blender/makesrna/intern/rna_lanpr.c

===

diff --git a/release/scripts/startup/bl_ui/properties_render.py 
b/release/scripts/startup/bl_ui/properties_render.py
index ad8b4b0743b..1ce3101cf83 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -693,8 +693,13 @@ class LANPR_linesets(UIList):
 def draw_item(self, context, layout, data, item, icon, active_data, 
active_propname, index):
 lineset = item
 if self.layout_type in {'DEFAULT', 'COMPACT'}:
-split = layout.split(factor=0.6)
-split.label(text="Layer")
+split = layout.split(factor=0.4)
+t=''
+if not lineset.use_multiple_levels:
+t='Level %d'%lineset.qi_begin
+else:
+t='Level %d - %d'%(lineset.qi_begin,lineset.qi_end)
+split.label(text=t)
 row = split.row(align=True)
 row.prop(lineset, "color", text="", icon_value=icon)
 row.prop(lineset, "thickness", text="", icon_value=icon)
@@ -762,26 +767,15 @@ class RENDER_PT_lanpr(RenderButtonsPanel, Panel):
 
col.operator("scene.lanpr_rebuild_all_commands",icon="FILE_REFRESH", text='')
 else:
 col.operator("scene.lanpr_add_line_layer", icon="ADD", 
text='')
-
-if active_layer:
-layout.label(text= "Normal controlled line weight:")
-layout.prop(active_layer,"normal_mode", expand = True)
-if active_layer.normal_mode != "DISABLED":
-layout.prop(active_layer,"normal_control_object")
-layout.prop(active_layer,"normal_effect_inverse", toggle = 
True)
-layout.prop(active_layer,"normal_ramp_begin")
-layout.prop(active_layer,"normal_ramp_end")
-layout.prop(active_layer,"normal_thickness_begin", 
slider=True)
-layout.prop(active_layer,"normal_thickness_end", 
slider=True)
-
 else:
 layout.label(text="Vectorization:")
 layout.prop(lanpr, "enable_vector_trace", expand = True)
 
 
 class RENDER_PT_lanpr_line_types(RenderButtonsPanel, Panel):
-bl_label = "Styles"
+bl_label = "Layer Settings"
 bl_parent_id = "RENDER_PT_lanpr"
+bl_options = {'DEFAULT_CLOSED'}
 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_LANPR', 'BLENDER_OPENGL', 
'BLENDER_EEVEE'}
 
 @classmethod
@@ -798,6 +792,13 @@ class RENDER_PT_lanpr_line_types(RenderButtonsPanel, 
Panel):
 active_layer = lanpr.layers.active_layer
 if active_layer and lanpr.master_mode == "DPIX":
 active_layer = lanpr.layers[0]
+
+if lanpr.master_mode == "SOFTWARE":
+row = layout.row(align=True)
+row.prop(active_layer, "use_multiple_levels", 
icon='GP_MULTIFRAME_EDITING', icon_only=True)
+row.prop(active_layer, "qi_begin", text='Level')
+if active_layer.use_multiple_levels:
+row.prop(active_layer, "qi_end", text='To')
 
 row = layout.row(align=True)
 row.prop(active_layer,"use_same_style")
@@ -851,14 +852,10 @@ class RENDER_PT_lanpr_line_types(RenderButtonsPanel, 
Panel):
 if lanpr.enable_intersections:
 row.operator("scene.lanpr_calculate", text= "Recalculate")
 
-if lanpr.master_mode == "SOFTWARE":
-row = layout.row(align=True)
-row.prop(active_layer, "qi_begin")
-row.prop(active_layer, "qi_end")
-
 class RENDER_PT_lanpr_line_components(RenderButtonsPanel, Panel):
 bl_label = "Including"
 bl_parent_id = "RENDER_PT_lanpr"
+bl_options = {'DEFAULT_CLOSED'}
 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_LANPR', 'BLENDER_OPENGL', 
'BLENDER_EEVEE'}
 
 @classmethod
@@ -898,33 +895,48 @@ class RENDER_PT_lanpr_line_components(RenderButtonsPanel, 
Panel):
 class RENDER_PT_lanpr_line_effects(RenderButtonsPanel, Panel):
 bl_label = "Effects"
 bl_parent_id = "RENDER_PT_lanpr"
+bl_options = {'DEFAULT_CLOSED'}
 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_LANPR', 'BLENDER_OPENGL', 
'BLENDER_EEVEE'}
 
 @classmethod
 def poll(cls, context):
 scene = context.scene
 lanpr = scene.lanpr
-return lanpr.master_mode == "DPIX"
+return lanpr.master_mode == "DPIX" or lanpr.master_mode == "SOFTWARE"

[Bf-blender-cvs] [ca0c24c9df0] soc-2019-npr: LANPR: Manual stroke update functions. (Not working yet)

2019-06-19 Thread YimingWu
Commit: ca0c24c9df0a542856c97d26b802ff494e007c96
Author: YimingWu
Date:   Wed Jun 19 17:41:02 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rBca0c24c9df0a542856c97d26b802ff494e007c96

LANPR: Manual stroke update functions. (Not working yet)

===

M   release/scripts/startup/bl_ui/properties_data_modifier.py
M   source/blender/draw/engines/lanpr/lanpr_access.c
M   source/blender/draw/engines/lanpr/lanpr_access.h
M   source/blender/draw/engines/lanpr/lanpr_engine.c
M   source/blender/draw/engines/lanpr/lanpr_ops.c
M   source/blender/editors/render/render_intern.h
M   source/blender/editors/render/render_ops.c

===

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py 
b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 4f37cf04265..e2416de1410 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1669,7 +1669,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
 col.prop(md, "face_influence")
 
 def FEATURE_LINE(self, layout, ob, md):
-layout.label(text='Not operational yet')
+layout.operator("scene.lanpr_update_gp_strokes", icon='RENDER_STILL', 
text='Manual Update')
 layout.label(text='Usage:')
 row = layout.row()
 row.prop(md,'usage',expand=True)
@@ -1684,7 +1684,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
 row.prop(md,'enable_modifier_mark',toggle=True)
 layout.label(text='Result GP:')
 layout.prop(md,'target')
-layout.prop(md,'replace')
+layout.prop(md,'replace', text='Replace existing frames')
 
 row = layout.row()
 row.prop(md,'layer')
diff --git a/source/blender/draw/engines/lanpr/lanpr_access.c 
b/source/blender/draw/engines/lanpr/lanpr_access.c
index 50abf53bbd2..95cfe3dd2e7 100644
--- a/source/blender/draw/engines/lanpr/lanpr_access.c
+++ b/source/blender/draw/engines/lanpr/lanpr_access.c
@@ -292,7 +292,7 @@ void lanpr_update_data_for_external(Depsgraph *depsgraph)
 return;
   if (!lanpr_share.render_buffer_shared ||
   lanpr_share.render_buffer_shared->cached_for_frame != scene->r.cfra) {
-lanpr_compute_feature_lines_internal(depsgraph, lanpr, scene);
+lanpr_compute_feature_lines_internal(depsgraph);
   }
 }
 
diff --git a/source/blender/draw/engines/lanpr/lanpr_access.h 
b/source/blender/draw/engines/lanpr/lanpr_access.h
index 0e3903c9f37..5703cc2e52e 100644
--- a/source/blender/draw/engines/lanpr/lanpr_access.h
+++ b/source/blender/draw/engines/lanpr/lanpr_access.h
@@ -20,7 +20,7 @@ void lanpr_update_data_for_external(Depsgraph *depsgraph);
 
 int lanpr_count_chain(LANPR_RenderLineChain *rlc);
 
-int lanpr_compute_feature_lines_internal(Depsgraph *depsgraph, SceneLANPR 
*lanpr, Scene *scene);
+int lanpr_compute_feature_lines_internal(Depsgraph *depsgraph);
 
 void lanpr_destroy_render_data(struct LANPR_RenderBuffer *rb);
 
diff --git a/source/blender/draw/engines/lanpr/lanpr_engine.c 
b/source/blender/draw/engines/lanpr/lanpr_engine.c
index 2294af796b1..f588e87a0b3 100644
--- a/source/blender/draw/engines/lanpr/lanpr_engine.c
+++ b/source/blender/draw/engines/lanpr/lanpr_engine.c
@@ -587,8 +587,8 @@ static void lanpr_render_matrices_init(RenderEngine 
*engine, Depsgraph *depsgrap
   DRW_view_set_active(view);
 }
 
-int lanpr_compute_feature_lines_internal(Depsgraph *depsgraph, SceneLANPR 
*lanpr, Scene *scene);
-LANPR_RenderBuffer *lanpr_create_render_buffer(SceneLANPR *lanpr);
+int lanpr_compute_feature_lines_internal(Depsgraph *depsgraph);
+LANPR_RenderBuffer *lanpr_create_render_buffer();
 
 extern DrawEngineType draw_engine_lanpr_type;
 
@@ -628,10 +628,10 @@ static void lanpr_render_to_image(LANPR_Data *vedata,
   if (lanpr->master_mode == LANPR_MASTER_MODE_SOFTWARE ||
   (lanpr->master_mode == LANPR_MASTER_MODE_DPIX && 
lanpr->enable_intersections)) {
 if (!lanpr_share.render_buffer_shared)
-  lanpr_create_render_buffer(lanpr);
+  lanpr_create_render_buffer();
 if (lanpr_share.render_buffer_shared->cached_for_frame != scene->r.cfra ||
 LANPR_GLOBAL_update_tag) {
-  lanpr_compute_feature_lines_internal(draw_ctx->depsgraph, lanpr, scene);
+  lanpr_compute_feature_lines_internal(draw_ctx->depsgraph);
 }
   }
 
diff --git a/source/blender/draw/engines/lanpr/lanpr_ops.c 
b/source/blender/draw/engines/lanpr/lanpr_ops.c
index 2324f50d83d..90e60ebfd53 100644
--- a/source/blender/draw/engines/lanpr/lanpr_ops.c
+++ b/source/blender/draw/engines/lanpr/lanpr_ops.c
@@ -40,6 +40,11 @@
 #include "RNA_access.h"
 #include "RNA_define.h"
 
+#include "BKE_modifier.h"
+#include "BKE_gpencil.h"
+#include "BKE_gpencil_modifier.h"
+#include "lanpr_access.h"
+
 extern LANPR_SharedResource lanpr_share;
 struct Object;

[Bf-blender-cvs] [4be8461b883] soc-2019-npr: LANPR: make format

2019-06-19 Thread YimingWu
Commit: 4be8461b88342d60dac788996656226e4ba7a3f6
Author: YimingWu
Date:   Wed Jun 19 17:42:31 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB4be8461b88342d60dac788996656226e4ba7a3f6

LANPR: make format

===

M   intern/cycles/util/util_windows.cpp
M   source/blender/draw/engines/lanpr/lanpr_ops.c
M   source/blender/makesdna/DNA_collection_types.h
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/intern/rna_collection.c
M   source/blender/makesrna/intern/rna_gpencil_modifier.c
M   source/blender/makesrna/intern/rna_lanpr.c
M   source/blender/makesrna/intern/rna_modifier.c
M   source/blender/makesrna/intern/rna_scene.c
M   source/blender/modifiers/intern/MOD_mybmesh.c

===

diff --git a/intern/cycles/util/util_windows.cpp 
b/intern/cycles/util/util_windows.cpp
index b8de9c418fe..807a5adc84a 100644
--- a/intern/cycles/util/util_windows.cpp
+++ b/intern/cycles/util/util_windows.cpp
@@ -15,7 +15,7 @@
  */
 
 #ifdef _WIN32
-#include 
+#  include 
 #endif
 
 #include "util_windows.h"
diff --git a/source/blender/draw/engines/lanpr/lanpr_ops.c 
b/source/blender/draw/engines/lanpr/lanpr_ops.c
index 90e60ebfd53..756f6832eff 100644
--- a/source/blender/draw/engines/lanpr/lanpr_ops.c
+++ b/source/blender/draw/engines/lanpr/lanpr_ops.c
@@ -3841,18 +3841,38 @@ void lanpr_software_draw_scene(void *vedata, 
GPUFrameBuffer *dfb, int is_render)
 lanpr_calculate_normal_object_vector(ll, normal_object_direction);
 
 DRW_shgroup_uniform_vec4(rb->ChainShgrp, "color", ll->color, 1);
-DRW_shgroup_uniform_vec4(rb->ChainShgrp, "crease_color", 
ll->use_same_style?ll->color:ll->crease_color, 1);
-DRW_shgroup_uniform_vec4(rb->ChainShgrp, "material_color", 
ll->use_same_style?ll->color:ll->material_color, 1);
-DRW_shgroup_uniform_vec4(rb->ChainShgrp, "edge_mark_color", 
ll->use_same_style?ll->color:ll->edge_mark_color, 1);
-DRW_shgroup_uniform_vec4(rb->ChainShgrp, "intersection_color", 
ll->use_same_style?ll->color:ll->intersection_color, 1);
+DRW_shgroup_uniform_vec4(
+rb->ChainShgrp, "crease_color", ll->use_same_style ? ll->color : 
ll->crease_color, 1);
+DRW_shgroup_uniform_vec4(rb->ChainShgrp,
+ "material_color",
+ ll->use_same_style ? ll->color : 
ll->material_color,
+ 1);
+DRW_shgroup_uniform_vec4(rb->ChainShgrp,
+ "edge_mark_color",
+ ll->use_same_style ? ll->color : 
ll->edge_mark_color,
+ 1);
+DRW_shgroup_uniform_vec4(rb->ChainShgrp,
+ "intersection_color",
+ ll->use_same_style ? ll->color : 
ll->intersection_color,
+ 1);
 DRW_shgroup_uniform_float(rb->ChainShgrp, "thickness", >thickness, 
1);
-DRW_shgroup_uniform_float(rb->ChainShgrp, "thickness_crease", 
ll->use_same_style?>thickness:>thickness_crease, 1);
-DRW_shgroup_uniform_float(
-rb->ChainShgrp, "thickness_material", 
ll->use_same_style?>thickness:>thickness_material, 1);
-DRW_shgroup_uniform_float(
-rb->ChainShgrp, "thickness_edge_mark", 
ll->use_same_style?>thickness:>thickness_edge_mark, 1);
-DRW_shgroup_uniform_float(
-rb->ChainShgrp, "thickness_intersection", 
ll->use_same_style?>thickness:>thickness_intersection, 1);
+DRW_shgroup_uniform_float(rb->ChainShgrp,
+  "thickness_crease",
+  ll->use_same_style ? >thickness : 
>thickness_crease,
+  1);
+DRW_shgroup_uniform_float(rb->ChainShgrp,
+  "thickness_material",
+  ll->use_same_style ? >thickness : 
>thickness_material,
+  1);
+DRW_shgroup_uniform_float(rb->ChainShgrp,
+  "thickness_edge_mark",
+  ll->use_same_style ? >thickness : 
>thickness_edge_mark,
+  1);
+DRW_shgroup_uniform_float(rb->ChainShgrp,
+  "thickness_intersection",
+  ll->use_same_style ? >thickness :
+   
>thickness_intersection,
+  1);
 DRW_shgroup_uniform_int(rb->ChainShgrp, "enable_contour", 
>enable_contour, 1);
 DRW_shgroup_uniform_int(rb->ChainShgrp, "enable_crease", 
>enable_crease, 1);
 DRW_shgroup_uniform_int(
@@ -3909,16 +3929,36 @@ void lanpr_software_draw_scene(void *vedata, 
GPUFrameBuffer *dfb, int 

[Bf-blender-cvs] [b5ea252ac33] soc-2019-npr: LANPR: Chaining threshold parameter. Disabled LANPR composition operators.

2019-06-19 Thread YimingWu
Commit: b5ea252ac33a59ebd264e03452f403866609aa2e
Author: YimingWu
Date:   Wed Jun 19 16:47:32 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rBb5ea252ac33a59ebd264e03452f403866609aa2e

LANPR: Chaining threshold parameter. Disabled LANPR composition operators.

===

M   release/scripts/startup/bl_operators/lanpr.py
M   release/scripts/startup/bl_ui/properties_render.py
M   source/blender/blenkernel/intern/scene.c
M   source/blender/draw/engines/lanpr/lanpr_chain.c
M   source/blender/draw/engines/lanpr/lanpr_ops.c
M   source/blender/gpencil_modifiers/intern/MOD_gpencilstroke.c
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/intern/rna_scene.c

===

diff --git a/release/scripts/startup/bl_operators/lanpr.py 
b/release/scripts/startup/bl_operators/lanpr.py
index 3c5b484855e..0cef8d5e904 100644
--- a/release/scripts/startup/bl_operators/lanpr.py
+++ b/release/scripts/startup/bl_operators/lanpr.py
@@ -234,9 +234,9 @@ class LANPR_render_composited(bpy.types.Operator):
 return {'FINISHED'}
 
 classes=(
-LANPR_make_composition_scene,
-LANPR_remove_composition_scene,
-LANPR_goto_original_scene,
-LANPR_goto_composition_scene,
-LANPR_render_composited,
+#LANPR_make_composition_scene,
+#LANPR_remove_composition_scene,
+#LANPR_goto_original_scene,
+#LANPR_goto_composition_scene,
+#LANPR_render_composited,
 )
\ No newline at end of file
diff --git a/release/scripts/startup/bl_ui/properties_render.py 
b/release/scripts/startup/bl_ui/properties_render.py
index c22fb320e50..ab0452556fd 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -1029,6 +1029,7 @@ class 
RENDER_PT_lanpr_software_chain_styles(RenderButtonsPanel, Panel):
 layout = self.layout
 scene = context.scene
 lanpr = scene.lanpr
+layout.prop(lanpr, "chaining_threshold")
 layout.label(text="Taper:")
 layout.prop(lanpr, "use_same_taper", expand = True)
 if lanpr.use_same_taper == "DISABLED":
diff --git a/source/blender/blenkernel/intern/scene.c 
b/source/blender/blenkernel/intern/scene.c
index cc0977d715f..eb8eedcb275 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -987,15 +987,19 @@ void BKE_scene_init(Scene *sce)
 
   sce->lanpr.enable_intersections = 1;
 
-  sce->lanpr.background_color[0] = 0.76;
-  sce->lanpr.background_color[1] = 0.54;
-  sce->lanpr.background_color[2] = 0.29;
+  sce->lanpr.background_color[0] = 0;
+  sce->lanpr.background_color[1] = 0;
+  sce->lanpr.background_color[2] = 0;
   sce->lanpr.background_color[3] = 1;
 
-  sce->lanpr.line_color[0] = 0.39;
-  sce->lanpr.line_color[1] = 0.12;
-  sce->lanpr.line_color[2] = 0.04;
+  sce->lanpr.line_color[0] = 1;
+  sce->lanpr.line_color[1] = 1;
+  sce->lanpr.line_color[2] = 1;
   sce->lanpr.line_color[3] = 1;
+
+  sce->lanpr.enable_intersections = 1;
+  sce->lanpr.enable_chaining = 1;
+  sce->lanpr.chaining_threshold = 0.01;
 }
 
 Scene *BKE_scene_add(Main *bmain, const char *name)
diff --git a/source/blender/draw/engines/lanpr/lanpr_chain.c 
b/source/blender/draw/engines/lanpr/lanpr_chain.c
index 7c4da87b422..5dfad61089f 100644
--- a/source/blender/draw/engines/lanpr/lanpr_chain.c
+++ b/source/blender/draw/engines/lanpr/lanpr_chain.c
@@ -195,7 +195,7 @@ void 
lanpr_reduce_render_line_chain_recursive(LANPR_RenderLineChain *rlc,
   }
 }
 
-void lanpr_NO_THREAD_chain_feature_lines(LANPR_RenderBuffer *rb, float 
dist_threshold)
+void lanpr_NO_THREAD_chain_feature_lines(LANPR_RenderBuffer *rb)
 {
   LANPR_RenderLineChain *rlc;
   LANPR_RenderLineChainItem *rlci;
@@ -412,16 +412,6 @@ void 
lanpr_NO_THREAD_chain_feature_lines(LANPR_RenderBuffer *rb, float dist_thre
   }
   ba = lanpr_get_point_bounding_area(rb, new_rv->fbcoord[0], 
new_rv->fbcoord[1]);
 }
-
-// LANPR_RenderLineChainItem* rlci;
-// printf("line:\n");
-// for (rlci = rlc->chain.first; rlci; rlci = rlci->item.next) {
-// printf("  %f,%f %d\n", rlci->pos[0],rlci->pos[1], rlci->occlusion);
-//}
-// printf("\n");
-
-// lanpr_reduce_render_line_chain_recursive(rlc,rlc->chain.first, 
rlc->chain.last,
-// dist_threshold);
   }
 }
 
@@ -623,7 +613,7 @@ void lanpr_connect_chains_image_space(LANPR_RenderBuffer 
*rb)
   dist = new_len;
 }
   }
-  if (dist < 0.01f && closest_cre) {
+  if (dist < rb->scene->lanpr.chaining_threshold && closest_cre) {
 closest_cre->picked = 1;
 closest_cre->rlc->picked = 1;
 BLI_remlink(>linked_chains, cre);
@@ -662,7 +652,7 @@ void lanpr_connect_chains_image_space(LANPR_RenderBuffer 
*rb)
   dist = new_len;
 }
   }
-  if (dist < 0.01f && closest_cre) {
+  if (dist 

[Bf-blender-cvs] [b165d0a4141] soc-2019-npr: LANPR: Removed "Tip Extend" data and properties. GP Modifiers will handle this.

2019-06-19 Thread YimingWu
Commit: b165d0a41418e2a638459f0f0c28a21a65d0b9f3
Author: YimingWu
Date:   Wed Jun 19 15:20:36 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rBb165d0a41418e2a638459f0f0c28a21a65d0b9f3

LANPR: Removed "Tip Extend" data and properties. GP Modifiers will handle this.

===

M   release/scripts/startup/bl_ui/properties_render.py
M   source/blender/makesdna/DNA_lanpr_types.h
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/intern/rna_scene.c

===

diff --git a/release/scripts/startup/bl_ui/properties_render.py 
b/release/scripts/startup/bl_ui/properties_render.py
index 1ce3101cf83..c22fb320e50 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -1014,7 +1014,7 @@ class RENDER_PT_lanpr_snake_settings(RenderButtonsPanel, 
Panel):
 layout.prop(lanpr,"extend_length")
 
 class RENDER_PT_lanpr_software_chain_styles(RenderButtonsPanel, Panel):
-bl_label = "Chain Styles"
+bl_label = "Chaining Options"
 bl_parent_id = "RENDER_PT_lanpr"
 bl_options = {'DEFAULT_CLOSED'}
 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_LANPR', 'BLENDER_OPENGL', 
'BLENDER_EEVEE'}
@@ -1047,12 +1047,6 @@ class 
RENDER_PT_lanpr_software_chain_styles(RenderButtonsPanel, Panel):
 col.prop(lanpr,"taper_left_distance")
 col.prop(lanpr,"taper_left_strength") 
 
-layout.label(text="Tip Extend:")
-layout.prop(lanpr, "enable_tip_extend",  expand = True)
-if lanpr.enable_tip_extend == "ENABLED":
-layout.label(text="---INOP---")
-layout.prop(lanpr,"extend_length")
-
 
 classes = (
 RENDER_PT_context,
diff --git a/source/blender/makesdna/DNA_lanpr_types.h 
b/source/blender/makesdna/DNA_lanpr_types.h
index 3f43f1250cb..b08b55298f3 100644
--- a/source/blender/makesdna/DNA_lanpr_types.h
+++ b/source/blender/makesdna/DNA_lanpr_types.h
@@ -50,9 +50,6 @@ struct Collection;
 #define LANPR_USE_DIFFERENT_TAPER 0
 #define LANPR_USE_SAME_TAPER 1
 
-#define LANPR_DISABLE_TIP_EXTEND 0
-#define LANPR_ENABLE_TIP_EXTEND 1
-
 #define LANPR_NORMAL_DONT_CARE 0
 #define LANPR_NORMAL_DIRECTIONAL 1
 #define LANPR_NORMAL_POINT 2
diff --git a/source/blender/makesdna/DNA_scene_types.h 
b/source/blender/makesdna/DNA_scene_types.h
index ef0e864b7a2..c05ed05ff77 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1660,9 +1660,6 @@ typedef struct SceneLANPR {
   float taper_right_distance;
   float taper_right_strength;
 
-  int enable_tip_extend;
-  float extend_length;
-
   int snake_sensitivity;
 
   /* shared */
diff --git a/source/blender/makesrna/intern/rna_scene.c 
b/source/blender/makesrna/intern/rna_scene.c
index 34c8eed211f..d6620a03cd8 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -7177,15 +7177,6 @@ static void rna_def_scene_lanpr(BlenderRNA *brna)
"Use same taper value for both sides of the line"},
   {0, NULL, 0, NULL, NULL}};
 
-  static const EnumPropertyItem rna_enum_lanpr_enable_tip_extend[] = {
-  {LANPR_DISABLE_TIP_EXTEND, "DISABLED", 0, "Disable", "Do not extend 
curve tips"},
-  {LANPR_ENABLE_TIP_EXTEND,
-   "ENABLED",
-   0,
-   "Enable",
-   "Extend curve tips to a user specified length"},
-  {0, NULL, 0, NULL, NULL}};
-
   srna = RNA_def_struct(brna, "SceneLANPR", NULL);
   RNA_def_struct_sdna(srna, "SceneLANPR");
   RNA_def_struct_ui_text(srna, "Scene LANPR Config", "LANPR global config");
@@ -7341,20 +7332,6 @@ static void rna_def_scene_lanpr(BlenderRNA *brna)
   RNA_def_property_flag(prop, PROP_EDITABLE);
   RNA_def_property_update(prop, NC_SCENE, NULL);
 
-  prop = RNA_def_property(srna, "enable_tip_extend", PROP_ENUM, PROP_NONE);
-  RNA_def_property_enum_items(prop, rna_enum_lanpr_enable_tip_extend);
-  RNA_def_property_enum_default(prop, LANPR_DISABLE_TIP_EXTEND);
-  RNA_def_property_ui_text(prop, "Extend Tips", "Extending tips of curves");
-  RNA_def_property_flag(prop, PROP_EDITABLE);
-  RNA_def_property_update(prop, NC_SCENE, NULL);
-
-  prop = RNA_def_property(srna, "extend_length", PROP_FLOAT, PROP_FACTOR);
-  RNA_def_property_float_default(prop, 1.0f);
-  RNA_def_property_ui_text(prop, "Extend Length", "Extend lenght of curves");
-  RNA_def_property_ui_range(prop, 0.0f, 100.0f, 0.1, 2);
-  RNA_def_property_flag(prop, PROP_EDITABLE);
-  RNA_def_property_update(prop, NC_SCENE, NULL);
-
   prop = RNA_def_property(srna, "crease_threshold", PROP_FLOAT, PROP_NONE);
   RNA_def_property_float_default(prop, 0.5f);
   RNA_def_property_ui_text(prop, "Crease Threshold", "cosine value of face 
angle");

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org

[Bf-blender-cvs] [6e38e95b964] soc-2019-npr: Merge branch 'master' into soc-2019-npr

2019-06-19 Thread YimingWu
Commit: 6e38e95b96469dcb5f05db9c055b18189d6607aa
Author: YimingWu
Date:   Wed Jun 19 13:23:43 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB6e38e95b96469dcb5f05db9c055b18189d6607aa

Merge branch 'master' into soc-2019-npr

===



===



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


[Bf-blender-cvs] [3134c786615] functions: remove turbulence force to have less distorted profiles

2019-06-19 Thread Jacques Lucke
Commit: 3134c7866159313216fa30b122c525e775ade1f8
Author: Jacques Lucke
Date:   Wed Jun 19 10:34:30 2019 +0200
Branches: functions
https://developer.blender.org/rB3134c7866159313216fa30b122c525e775ade1f8

remove turbulence force to have less distorted profiles

===

M   source/blender/simulations/bparticles/c_wrapper.cpp

===

diff --git a/source/blender/simulations/bparticles/c_wrapper.cpp 
b/source/blender/simulations/bparticles/c_wrapper.cpp
index 4f94ddef2e7..7315705683d 100644
--- a/source/blender/simulations/bparticles/c_wrapper.cpp
+++ b/source/blender/simulations/bparticles/c_wrapper.cpp
@@ -110,9 +110,8 @@ BParticlesDescription 
BParticles_playground_description(float control1,
   auto emitter1 = BParticles::new_point_emitter(emitter_position);
   auto emitter2 = BParticles::new_surface_emitter(mesh);
 
-  Description *description = new Description(
-  {new TestForce(control1), new TurbulenceForce(control2)},
-  {emitter1.release(), emitter2.release()});
+  Description *description = new Description({new TestForce(control1)},
+ {emitter1.release(), 
emitter2.release()});
   return wrap(description);
 }
 void BParticles_description_free(BParticlesDescription description_c)

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


[Bf-blender-cvs] [20c7fa6bcc1] functions: extract temporary method for old particle deletion

2019-06-19 Thread Jacques Lucke
Commit: 20c7fa6bcc13c8c67b1e51f8fff9d1ebbb868e78
Author: Jacques Lucke
Date:   Wed Jun 19 10:34:08 2019 +0200
Branches: functions
https://developer.blender.org/rB20c7fa6bcc13c8c67b1e51f8fff9d1ebbb868e78

extract temporary method for old particle deletion

===

M   source/blender/simulations/bparticles/playground_solver.cpp

===

diff --git a/source/blender/simulations/bparticles/playground_solver.cpp 
b/source/blender/simulations/bparticles/playground_solver.cpp
index 9c6fe145533..eb1ecb7683a 100644
--- a/source/blender/simulations/bparticles/playground_solver.cpp
+++ b/source/blender/simulations/bparticles/playground_solver.cpp
@@ -185,15 +185,7 @@ class SimpleSolver : public Solver {
 }
 
 /* Temporary Kill Code */
-auto birth_times = attributes.get_float("Birth Time");
-auto kill_states = attributes.get_byte("Kill State");
-
-for (uint pindex : indices_mask) {
-  float age = state.seconds_since_start - birth_times[pindex];
-  if (age > 5) {
-kill_states[pindex] = 1;
-  }
-}
+this->tag_old_particles_for_deletion(state, attributes, indices_mask);
   }
 
   struct EventIndexAtTime {
@@ -377,6 +369,21 @@ class SimpleSolver : public Solver {
 }
   }
 
+  BLI_NOINLINE void tag_old_particles_for_deletion(MyState ,
+   AttributeArrays attributes,
+   ArrayRef indices_mask)
+  {
+auto birth_times = attributes.get_float("Birth Time");
+auto kill_states = attributes.get_byte("Kill State");
+
+for (uint pindex : indices_mask) {
+  float age = state.seconds_since_start - birth_times[pindex];
+  if (age > 5) {
+kill_states[pindex] = 1;
+  }
+}
+  }
+
   BLI_NOINLINE void delete_dead_particles(ArrayRef blocks)
   {
 for (auto block : blocks) {

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


[Bf-blender-cvs] [d43d28a3485] functions: avoid creating the same arrays many times

2019-06-19 Thread Jacques Lucke
Commit: d43d28a3485c1d88f905388fa4b9c52dc777f4e7
Author: Jacques Lucke
Date:   Wed Jun 19 10:29:58 2019 +0200
Branches: functions
https://developer.blender.org/rBd43d28a3485c1d88f905388fa4b9c52dc777f4e7

avoid creating the same arrays many times

===

M   source/blender/simulations/bparticles/playground_solver.cpp

===

diff --git a/source/blender/simulations/bparticles/playground_solver.cpp 
b/source/blender/simulations/bparticles/playground_solver.cpp
index 0485de8a1be..9c6fe145533 100644
--- a/source/blender/simulations/bparticles/playground_solver.cpp
+++ b/source/blender/simulations/bparticles/playground_solver.cpp
@@ -66,6 +66,7 @@ class SimpleSolver : public Solver {
 }
   };
 
+  static const uint m_block_size = 1000;
   Description _description;
   AttributesInfo m_attributes;
   SmallVector m_emitter_infos;
@@ -106,7 +107,7 @@ class SimpleSolver : public Solver {
   StateBase *init() override
   {
 MyState *state = new MyState();
-state->particles = new ParticlesContainer(m_attributes, 1000);
+state->particles = new ParticlesContainer(m_attributes, m_block_size);
 return state;
   }
 
@@ -133,7 +134,8 @@ class SimpleSolver : public Solver {
 SimpleSolver *solver;
 MyState 
 ArrayRef blocks;
-float elapsed_seconds;
+ArrayRef full_indices_mask;
+ArrayRef full_time_diffs;
   };
 
   BLI_NOINLINE void step_blocks(MyState ,
@@ -142,8 +144,13 @@ class SimpleSolver : public Solver {
   {
 ParallelRangeSettings settings;
 BLI_parallel_range_settings_defaults();
+settings.use_threading = false;
 
-StepBlocksParallelData data = {this, state, blocks, elapsed_seconds};
+SmallVector full_indices_mask = Range(0, 
m_block_size).to_small_vector();
+SmallVector full_time_diffs(m_block_size);
+full_time_diffs.fill(elapsed_seconds);
+
+StepBlocksParallelData data = {this, state, blocks, full_indices_mask, 
full_time_diffs};
 
 BLI_task_parallel_range(0, blocks.size(), (void *), step_block_cb, 
);
   }
@@ -156,11 +163,10 @@ class SimpleSolver : public Solver {
 ParticlesBlock *block = data->blocks[index];
 AttributeArrays attributes = block->slice_active();
 
-SmallVector time_diffs(attributes.size());
-time_diffs.fill(data->elapsed_seconds);
+ArrayRef indices_mask = 
data->full_indices_mask.take_front(attributes.size());
+ArrayRef time_diffs = 
data->full_time_diffs.take_front(attributes.size());
 
-data->solver->step_slice(
-data->state, attributes, Range(0, 
attributes.size()).to_small_vector(), time_diffs);
+data->solver->step_slice(data->state, attributes, indices_mask, 
time_diffs);
   }
 
   BLI_NOINLINE void step_slice(MyState ,

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


[Bf-blender-cvs] [c2ad29397c6] master: Industry Compat keymap: Some curve edit keymap entries were using Click events

2019-06-19 Thread William Reynish
Commit: c2ad29397c69f05108ba1d5311596578dcf3fe91
Author: William Reynish
Date:   Wed Jun 19 10:29:15 2019 +0200
Branches: master
https://developer.blender.org/rBc2ad29397c69f05108ba1d5311596578dcf3fe91

Industry Compat keymap: Some curve edit keymap entries were using Click events

This was inconsistent and make the actions seem slow and unresponsive. Change 
to using Press, like other modes.

===

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

===

diff --git 
a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py 
b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
index 0a070118069..cbd7e877a75 100644
--- a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
+++ b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
@@ -2720,16 +2720,14 @@ def km_curve(params):
 
 
 items.extend([
-("curve.handle_type_set", {"type": 'V', "value": 'PRESS'}, None),
-("curve.vertex_add", {"type": 'LEFTMOUSE', "value": 'CLICK', "ctrl": 
True}, None),
-("curve.select_all", {"type": 'A', "value": 'CLICK', "ctrl": True}, 
{"properties": [("action", 'SELECT')]}),
-("curve.select_all", {"type": 'A', "value": 'CLICK', "ctrl": True, 
"shift": True}, {"properties": [("action", 'DESELECT')]}),
-("curve.select_all", {"type": 'I', "value": 'CLICK', "ctrl": True}, 
{"properties": [("action", 'INVERT')]}),
+("curve.select_all", {"type": 'A', "value": 'PRESS', "ctrl": True}, 
{"properties": [("action", 'SELECT')]}),
+("curve.select_all", {"type": 'A', "value": 'PRESS', "ctrl": True, 
"shift": True}, {"properties": [("action", 'DESELECT')]}),
+("curve.select_all", {"type": 'I', "value": 'PRESS', "ctrl": True}, 
{"properties": [("action", 'INVERT')]}),
 ("curve.select_row", {"type": 'R', "value": 'PRESS', "shift": True}, 
None),
 ("curve.select_more", {"type": 'UP_ARROW', "value": 'PRESS'}, None),
 ("curve.select_less", {"type": 'DOWN_ARROW', "value": 'PRESS'}, None),
 ("curve.select_linked", {"type": 'RIGHT_BRACKET', "value": 'PRESS'}, 
None),
-("curve.shortest_path_pick", {"type": 'LEFTMOUSE', "value": 'CLICK', 
"ctrl": True, "shift": True}, None),
+("curve.shortest_path_pick", {"type": 'LEFTMOUSE', "value": 'PRESS', 
"ctrl": True, "shift": True}, None),
 ("curve.duplicate_move", {"type": 'D', "value": 'PRESS', "ctrl": 
True}, None),
 op_menu("VIEW3D_MT_edit_curve_delete", {"type": 'BACK_SPACE', "value": 
'PRESS'}),
 op_menu("VIEW3D_MT_edit_curve_delete", {"type": 'DEL', "value": 
'PRESS'}),

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