[Bf-blender-cvs] [3bfd81ce294] master: Partial revert of "Theme: Blender Light update"

2019-06-13 Thread Campbell Barton
Commit: 3bfd81ce29472d8217eca1c7c107da16e751baea
Author: Campbell Barton
Date:   Fri Jun 14 15:15:07 2019 +1000
Branches: master
https://developer.blender.org/rB3bfd81ce29472d8217eca1c7c107da16e751baea

Partial revert of "Theme: Blender Light update"

Partially reverts commit 3b58bf3c7ebc1c6aaea98678ea4d462d9191007a

Green highlights aren't as bright as yellow/orange & were
reverted for the default theme, do the same for the light theme.

===

M   release/scripts/presets/interface_theme/blender_light.xml

===

diff --git a/release/scripts/presets/interface_theme/blender_light.xml 
b/release/scripts/presets/interface_theme/blender_light.xml
index a1856f34ed8..dc0bb6b629e 100644
--- a/release/scripts/presets/interface_theme/blender_light.xml
+++ b/release/scripts/presets/interface_theme/blender_light.xml
@@ -344,43 +344,43 @@
 
 
   
   https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [fe555a80737] master: Theme: Update Blender Light

2019-06-13 Thread Campbell Barton
Commit: fe555a807375cf9b5b311e1f4fe1646860ef5172
Author: Campbell Barton
Date:   Fri Jun 14 14:49:49 2019 +1000
Branches: master
https://developer.blender.org/rBfe555a807375cf9b5b311e1f4fe1646860ef5172

Theme: Update Blender Light

===

M   release/scripts/presets/interface_theme/blender_light.xml

===

diff --git a/release/scripts/presets/interface_theme/blender_light.xml 
b/release/scripts/presets/interface_theme/blender_light.xml
index 45c500e0c80..a1856f34ed8 100644
--- a/release/scripts/presets/interface_theme/blender_light.xml
+++ b/release/scripts/presets/interface_theme/blender_light.xml
@@ -455,7 +455,7 @@
   
 
   
 
   
 
   
 
   
 
   https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [170541c5c7b] master: Cleanup: remove developer panel

2019-06-13 Thread Campbell Barton
Commit: 170541c5c7bf3015c41aa6d87dadc406b885f381
Author: Campbell Barton
Date:   Fri Jun 14 13:55:27 2019 +1000
Branches: master
https://developer.blender.org/rB170541c5c7bf3015c41aa6d87dadc406b885f381

Cleanup: remove developer panel

Defined whole panel for a single checkbox which is hidden by default.

===

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 8c34dfd5f20..f8ae62374b9 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -5546,6 +5546,10 @@ class VIEW3D_PT_overlay_edit_mesh(Panel):
 row.prop(overlay, "show_edge_bevel_weight", text="Bevel", toggle=True)
 row.prop(overlay, "show_edge_seams", text="Seams", toggle=True)
 
+if context.preferences.view.show_developer_ui:
+col.label(text="Developer")
+col.prop(overlay, "show_extra_indices", text="Indices")
+
 
 class VIEW3D_PT_overlay_edit_mesh_shading(Panel):
 bl_space_type = 'VIEW_3D'
@@ -5706,29 +5710,6 @@ class VIEW3D_PT_overlay_edit_mesh_freestyle(Panel):
 row.prop(overlay, "show_freestyle_face_marks", text="Face Marks")
 
 
-class VIEW3D_PT_overlay_edit_mesh_developer(Panel):
-bl_space_type = 'VIEW_3D'
-bl_region_type = 'HEADER'
-bl_parent_id = 'VIEW3D_PT_overlay_edit_mesh'
-bl_label = "Developer"
-
-@classmethod
-def poll(cls, context):
-return context.mode == 'EDIT_MESH' and 
context.preferences.view.show_developer_ui
-
-def draw(self, context):
-layout = self.layout
-
-view = context.space_data
-overlay = view.overlay
-display_all = overlay.show_overlays
-
-col = layout.column()
-col.active = display_all
-
-col.prop(overlay, "show_extra_indices", text="Indices")
-
-
 class VIEW3D_PT_overlay_edit_curve(Panel):
 bl_space_type = 'VIEW_3D'
 bl_region_type = 'HEADER'
@@ -6686,7 +6667,6 @@ classes = (
 VIEW3D_PT_overlay_edit_mesh_measurement,
 VIEW3D_PT_overlay_edit_mesh_normals,
 VIEW3D_PT_overlay_edit_mesh_freestyle,
-VIEW3D_PT_overlay_edit_mesh_developer,
 VIEW3D_PT_overlay_edit_curve,
 VIEW3D_PT_overlay_paint,
 VIEW3D_PT_overlay_pose,

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


[Bf-blender-cvs] [a4bd3f7d7e5] master: Mesh Selection: Move Selection ID Context Utilities to ED_view3d.

2019-06-13 Thread mano-wii
Commit: a4bd3f7d7e5634c96fd15d4bd8c2ed0211dc990a
Author: mano-wii
Date:   Thu Jun 13 23:40:49 2019 -0300
Branches: master
https://developer.blender.org/rBa4bd3f7d7e5634c96fd15d4bd8c2ed0211dc990a

Mesh Selection: Move Selection ID Context Utilities to ED_view3d.

This patch does not bring functional changes, but it is a good change if we 
want to use these utilities in areas other than those using BMesh (eg painting 
editors).

This is also a step to replace `ED_view3d_select_id_validate`. That function 
erroneously checks `V3D_INVALID_BACKBUF` which causes it to update 
unnecessarily.

Reviewers: campbellbarton

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

===

M   source/blender/editors/include/ED_mesh.h
M   source/blender/editors/include/ED_view3d.h
M   source/blender/editors/mesh/CMakeLists.txt
M   source/blender/editors/mesh/editmesh_select.c
M   source/blender/editors/space_view3d/view3d_select.c

===

diff --git a/source/blender/editors/include/ED_mesh.h 
b/source/blender/editors/include/ED_mesh.h
index 0a8304f3f8a..5d8038d0b28 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -142,22 +142,6 @@ bool BMBVH_EdgeVisible(struct BMBVHTree *tree,
 void ED_mesh_undosys_type(struct UndoType *ut);
 
 /* editmesh_select.c */
-struct EDBMSelectID_Context;
-struct EDBMSelectID_Context *EDBM_select_id_context_create(struct ViewContext 
*vc,
-   struct Base **bases,
-   const uint 
bases_len,
-   short select_mode);
-void EDBM_select_id_context_destroy(struct EDBMSelectID_Context *sel_id_ctx);
-struct BMElem *EDBM_select_id_bm_elem_get(struct EDBMSelectID_Context 
*sel_id_ctx,
-  const uint sel_id,
-  uint *r_base_index);
-
-uint EDBM_select_id_context_offset_for_object_elem(const struct 
EDBMSelectID_Context *sel_id_ctx,
-   int base_index,
-   char htype);
-
-uint EDBM_select_id_context_elem_len(const struct EDBMSelectID_Context 
*sel_id_ctx);
-
 void EDBM_select_mirrored(
 struct BMEditMesh *em, const int axis, const bool extend, int *r_totmirr, 
int *r_totfail);
 void EDBM_automerge(struct Scene *scene, struct Object *ob, bool update, const 
char hflag);
diff --git a/source/blender/editors/include/ED_view3d.h 
b/source/blender/editors/include/ED_view3d.h
index 751f71cc53b..21a18a0b387 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -512,6 +512,23 @@ int view3d_opengl_select(struct ViewContext *vc,
  eV3DSelectObjectFilter select_filter);
 
 /* view3d_select.c */
+struct EDSelectID_Context;
+struct EDSelectID_Context *ED_view3d_select_id_context_create(struct 
ViewContext *vc,
+  struct Base 
**bases,
+  const uint 
bases_len,
+  short 
select_mode);
+
+void ED_view3d_select_id_context_destroy(struct EDSelectID_Context 
*sel_id_ctx);
+uint ED_view3d_select_id_context_offset_for_object_elem(
+const struct EDSelectID_Context *sel_id_ctx, int base_index, char 
elem_type);
+
+uint ED_view3d_select_id_context_elem_len(const struct EDSelectID_Context 
*sel_id_ctx);
+bool ED_view3d_select_id_elem_get(struct EDSelectID_Context *sel_id_ctx,
+  const uint sel_id,
+  uint *r_elem,
+  uint *r_base_index,
+  char *r_elem_type);
+
 float ED_view3d_select_dist_px(void);
 void ED_view3d_viewcontext_init(struct bContext *C, struct ViewContext *vc);
 void ED_view3d_viewcontext_init_object(struct ViewContext *vc, struct Object 
*obact);
diff --git a/source/blender/editors/mesh/CMakeLists.txt 
b/source/blender/editors/mesh/CMakeLists.txt
index 9a779db4812..57bf67e825e 100644
--- a/source/blender/editors/mesh/CMakeLists.txt
+++ b/source/blender/editors/mesh/CMakeLists.txt
@@ -23,7 +23,6 @@ set(INC
   ../../blentranslation
   ../../bmesh
   ../../depsgraph
-  ../../draw
   ../../gpu
   ../../imbuf
   ../../makesdna
diff --git a/source/blender/editors/mesh/editmesh_select.c 
b/source/blender/editors/mesh/editmesh_select.c
index 75d685fb9c6..7b770f055b4 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -68,8 +68,6 @@
 #include "DEG_depsgraph.h"
 #include "DEG_depsgraph_query.h"
 
-#include "DRW_engine.h"
-
 #include 

[Bf-blender-cvs] [accd8d005bb] master: Docs: minor improvements to --app-template help text

2019-06-13 Thread Campbell Barton
Commit: accd8d005bba1a78566b19f368b6485a698c9f68
Author: Campbell Barton
Date:   Fri Jun 14 12:59:14 2019 +1000
Branches: master
https://developer.blender.org/rBaccd8d005bba1a78566b19f368b6485a698c9f68

Docs: minor improvements to --app-template help text

===

M   source/creator/creator_args.c

===

diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c
index c1dd87507d4..11257cce670 100644
--- a/source/creator/creator_args.c
+++ b/source/creator/creator_args.c
@@ -1085,8 +1085,8 @@ static int arg_handle_debug_fpe_set(int UNUSED(argc),
 }
 
 static const char arg_handle_app_template_doc[] =
-"\n\t"
-"Set the application template, use 'default' for none.";
+"\n"
+"\tSet the application template (matching the directory name), use 
'default' for none.";
 static int arg_handle_app_template(int argc, const char **argv, void 
*UNUSED(data))
 {
   if (argc > 1) {

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


[Bf-blender-cvs] [16366724bd7] soc-2019-openxr: Draw into OpenGL offscreen context in the DirectX window.

2019-06-13 Thread Julian Eisel
Commit: 16366724bd7f7c7e6904ba96ec27d86054c4cb65
Author: Julian Eisel
Date:   Fri Jun 14 02:33:53 2019 +0200
Branches: soc-2019-openxr
https://developer.blender.org/rB16366724bd7f7c7e6904ba96ec27d86054c4cb65

Draw into OpenGL offscreen context in the DirectX window.

The window doesn't show anything of course. However we draw (at least I
assume it does) as regular, just into a window offscreen context.

A valid 3D view is created in the window. It's not visible but you see
cursor changes as you move over the window. So handling works.

===

M   intern/ghost/GHOST_C-api.h
M   intern/ghost/GHOST_IContext.h
M   intern/ghost/intern/GHOST_C-api.cpp
M   source/blender/makesdna/DNA_windowmanager_types.h
M   source/blender/windowmanager/intern/wm_operators.c
M   source/blender/windowmanager/intern/wm_window.c
M   source/blender/windowmanager/wm_window.h

===

diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index 0dff8209966..8acfa8ec943 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -733,6 +733,11 @@ extern GHOST_TSuccess 
GHOST_ActivateOpenGLContext(GHOST_ContextHandle contexthan
  */
 extern GHOST_TSuccess GHOST_ReleaseOpenGLContext(GHOST_ContextHandle 
contexthandle);
 
+/**
+ * Get the OpenGL framebuffer handle that serves as a default framebuffer.
+ */
+extern unsigned int 
GHOST_GetContextDefaultOpenGLFramebuffer(GHOST_ContextHandle contexthandle);
+
 /**
  * Get the OpenGL framebuffer handle that serves as a default framebuffer.
  */
diff --git a/intern/ghost/GHOST_IContext.h b/intern/ghost/GHOST_IContext.h
index a341e18ca0a..5f213601e6b 100644
--- a/intern/ghost/GHOST_IContext.h
+++ b/intern/ghost/GHOST_IContext.h
@@ -56,6 +56,8 @@ class GHOST_IContext {
*/
   virtual GHOST_TSuccess releaseDrawingContext() = 0;
 
+  virtual unsigned int getDefaultFramebuffer() = 0;
+
 #ifdef WITH_CXX_GUARDEDALLOC
   MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_IContext")
 #endif
diff --git a/intern/ghost/intern/GHOST_C-api.cpp 
b/intern/ghost/intern/GHOST_C-api.cpp
index 73442ae6e01..a326742bfe8 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -649,6 +649,13 @@ GHOST_TSuccess 
GHOST_ReleaseOpenGLContext(GHOST_ContextHandle contexthandle)
   return context->releaseDrawingContext();
 }
 
+unsigned int GHOST_GetContextDefaultOpenGLFramebuffer(GHOST_ContextHandle 
contexthandle)
+{
+  GHOST_IContext *context = (GHOST_IContext *)contexthandle;
+
+  return context->getDefaultFramebuffer();
+}
+
 unsigned int GHOST_GetDefaultOpenGLFramebuffer(GHOST_WindowHandle windowhandle)
 {
   GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
diff --git a/source/blender/makesdna/DNA_windowmanager_types.h 
b/source/blender/makesdna/DNA_windowmanager_types.h
index e94670249b9..c219e25b470 100644
--- a/source/blender/makesdna/DNA_windowmanager_types.h
+++ b/source/blender/makesdna/DNA_windowmanager_types.h
@@ -205,6 +205,8 @@ typedef struct wmWindow {
 
   /** Don't want to include ghost.h stuff. */
   void *ghostwin;
+  /** Ghost context for rendering the window offscreen (usually unused). */
+  void *offscreen_context;
   /** Don't want to include gpu stuff. */
   void *gpuctx;
 
diff --git a/source/blender/windowmanager/intern/wm_operators.c 
b/source/blender/windowmanager/intern/wm_operators.c
index 074d03de93b..4f8ef594937 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -75,6 +75,7 @@
 #include "BKE_report.h"
 #include "BKE_scene.h"
 #include "BKE_screen.h" /* BKE_ST_MAXNAME */
+#include "BKE_workspace.h"
 #include "BKE_unit.h"
 
 #include "BKE_idcode.h"
@@ -3563,6 +3564,69 @@ static void 
xr_session_gpu_binding_context_destroy(eWM_xrGraphicsBinding graphic
   }
 }
 
+#  ifdef WIN32
+static void xr_session_window_create(bContext *C)
+{
+  Main *bmain = CTX_data_main(C);
+  Scene *scene = CTX_data_scene(C);
+  ViewLayer *view_layer = CTX_data_view_layer(C);
+  wmWindow *win_prev = CTX_wm_window(C);
+
+  rcti rect;
+  wmWindow *win;
+  bScreen *screen;
+  ScrArea *sa;
+  int screen_size[2];
+
+  wm_get_screensize(_size[0], _size[1]);
+  BLI_rcti_init(, 0, screen_size[0], 0, screen_size[1]);
+  BLI_rcti_scale(, 0.8f);
+  wm_window_check_position();
+
+  win = WM_window_open_directx(C, );
+
+  if (WM_window_get_active_workspace(win) == NULL) {
+WorkSpace *workspace = WM_window_get_active_workspace(win_prev);
+BKE_workspace_active_set(win->workspace_hook, workspace);
+  }
+
+  /* add new screen layout */
+  WorkSpace *workspace = WM_window_get_active_workspace(win);
+  WorkSpaceLayout *layout = ED_workspace_layout_add(bmain, workspace, win, "VR 
Session");
+
+  screen = BKE_workspace_layout_screen_get(layout);
+  WM_window_set_active_layout(win, workspace, layout);
+
+  /* Set scene and view layer to match 

[Bf-blender-cvs] [8ac0fef4dfd] master: Cleanup: sort structs

2019-06-13 Thread Campbell Barton
Commit: 8ac0fef4dfd142ec3d185fd3572abea948e664c9
Author: Campbell Barton
Date:   Fri Jun 14 10:12:10 2019 +1000
Branches: master
https://developer.blender.org/rB8ac0fef4dfd142ec3d185fd3572abea948e664c9

Cleanup: sort structs

===

M   source/blender/blenkernel/BKE_sound.h
M   source/blender/depsgraph/DEG_depsgraph_build.h
M   source/blender/draw/intern/DRW_render.h
M   source/blender/editors/sculpt_paint/sculpt_intern.h

===

diff --git a/source/blender/blenkernel/BKE_sound.h 
b/source/blender/blenkernel/BKE_sound.h
index 4694e86f4d6..1567985bd53 100644
--- a/source/blender/blenkernel/BKE_sound.h
+++ b/source/blender/blenkernel/BKE_sound.h
@@ -29,10 +29,10 @@
 #  include 
 #endif
 
+struct Depsgraph;
 struct Main;
 struct Sequence;
 struct bSound;
-struct Depsgraph;
 
 typedef struct SoundWaveform {
   int length;
diff --git a/source/blender/depsgraph/DEG_depsgraph_build.h 
b/source/blender/depsgraph/DEG_depsgraph_build.h
index effcece6e00..2f342e3d0ef 100644
--- a/source/blender/depsgraph/DEG_depsgraph_build.h
+++ b/source/blender/depsgraph/DEG_depsgraph_build.h
@@ -33,7 +33,6 @@ struct Depsgraph;
 
 /*  */
 
-struct bNodeTree;
 struct CacheFile;
 struct Collection;
 struct CustomData_MeshMasks;
@@ -44,6 +43,7 @@ struct ModifierData;
 struct Object;
 struct Scene;
 struct ViewLayer;
+struct bNodeTree;
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/source/blender/draw/intern/DRW_render.h 
b/source/blender/draw/intern/DRW_render.h
index b10e6c4e202..51918f45e23 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -81,9 +81,9 @@ struct rcti;
 
 typedef struct DRWInterface DRWInterface;
 typedef struct DRWPass DRWPass;
-typedef struct DRWView DRWView;
 typedef struct DRWShadingGroup DRWShadingGroup;
 typedef struct DRWUniform DRWUniform;
+typedef struct DRWView DRWView;
 
 /* Opaque type to avoid usage as a DRWCall but it is exactly the same thing. */
 typedef struct DRWCallBuffer DRWCallBuffer;
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h 
b/source/blender/editors/sculpt_paint/sculpt_intern.h
index 4287feed92c..e66e1c49685 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -33,8 +33,8 @@
 
 #include "BKE_pbvh.h"
 
-struct Main;
 struct KeyBlock;
+struct Main;
 struct Object;
 struct SculptOrigVertData;
 struct SculptUndoNode;

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


[Bf-blender-cvs] [35d49595c6e] master: Cleanup: minor adjustments to --help text formatting

2019-06-13 Thread Campbell Barton
Commit: 35d49595c6e6bab101ce8d2ef57ccea41efca76b
Author: Campbell Barton
Date:   Fri Jun 14 09:50:13 2019 +1000
Branches: master
https://developer.blender.org/rB35d49595c6e6bab101ce8d2ef57ccea41efca76b

Cleanup: minor adjustments to --help text formatting

- Single quote args so they show with string literals in the manual.
- Improve the description of animation playback mode.

===

M   source/creator/creator_args.c

===

diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c
index 3cd02fde8ac..c1dd87507d4 100644
--- a/source/creator/creator_args.c
+++ b/source/creator/creator_args.c
@@ -1168,7 +1168,11 @@ static int arg_handle_env_system_set(int argc, const 
char **argv, void *UNUSED(d
 
 static const char arg_handle_playback_mode_doc[] =
 " \n"
-"\tPlayback , only operates this way when not running in 
background.\n\n"
+"\tInstead of showing Blender's user interface, this runs Blender as an 
animation player,\n"
+"\tto view movies and image sequences rendered in Blender (ignored if '-b' 
is set).\n"
+"\n"
+"\tPlayback Arguments:\n"
+"\n"
 "\t-p  \n"
 "\t\tOpen with lower left corner at , .\n"
 "\t-m\n"
@@ -1278,7 +1282,7 @@ static int arg_handle_no_window_focus(int UNUSED(argc),
 
 static const char arg_handle_start_with_console_doc[] =
 "\n\t"
-"Start with the console window open (ignored if -b is set), (Windows 
only).";
+"Start with the console window open (ignored if '-b' is set), (Windows 
only).";
 static int arg_handle_start_with_console(int UNUSED(argc),
  const char **UNUSED(argv),
  void *UNUSED(data))
@@ -1340,13 +1344,13 @@ static const char arg_handle_output_set_doc[] =
 "\n"
 "\tThe '#' characters are replaced by the frame number, and used to define 
zero padding.\n"
 "\n"
-"\t* 'ani_##_test.png' becomes 'ani_01_test.png'\n"
+"\t* 'animation_##_test.png' becomes 'animation_01_test.png'\n"
 "\t* 'test-##.png' becomes 'test-01.png'\n"
 "\n"
 "\tWhen the filename does not contain '#', The suffix '' is added to 
the filename.\n"
 "\n"
 "\tThe frame number will be added at the end of the filename, eg:\n"
-"\t# blender -b foobar.blend -o //render_ -F PNG -x 1 -a\n"
+"\t# blender -b animation.blend -o //render_ -F PNG -x 1 -a\n"
 "\t'//render_' becomes '//render_', writing frames as 
'//render_0001.png'";
 static int arg_handle_output_set(int argc, const char **argv, void *data)
 {
@@ -1370,7 +1374,7 @@ static int arg_handle_output_set(int argc, const char 
**argv, void *data)
 static const char arg_handle_engine_set_doc[] =
 "\n"
 "\tSpecify the render engine.\n"
-"\tUse -E help to list available engines.";
+"\tUse '-E' help to list available engines.";
 static int arg_handle_engine_set(int argc, const char **argv, void *data)
 {
   bContext *C = data;
@@ -1397,7 +1401,7 @@ static int arg_handle_engine_set(int argc, const char 
**argv, void *data)
   else {
 printf(
 "\nError: no blend loaded. "
-"order the arguments so '-E  / --engine ' is after a blend is 
loaded.\n");
+"order the arguments so '-E / --engine' is after a blend is 
loaded.\n");
   }
 }
 
@@ -1412,11 +1416,11 @@ static int arg_handle_engine_set(int argc, const char 
**argv, void *data)
 static const char arg_handle_image_type_set_doc[] =
 "\n"
 "\tSet the render format.\n"
-"\tValid options are 'TGA' 'RAWTGA' 'JPEG' 'IRIS' 'IRIZ' 'AVIRAW' 
'AVIJPEG' 'PNG' 'BMP'\n"
+"\tValid options are:\n"
+"\t'TGA' 'RAWTGA' 'JPEG' 'IRIS' 'IRIZ' 'AVIRAW' 'AVIJPEG' 'PNG' 'BMP'\n"
 "\n"
-"\tFormats that can be compiled into Blender, not available on all 
systems: 'HDR' 'TIFF' "
-"'OPEN_EXR'\n"
-"\t'OPEN_EXR_MULTILAYER' 'MPEG' 'CINEON' 'DPX' 'DDS' 'JP2'";
+"\tFormats that can be compiled into Blender, not available on all 
systems:\n"
+"\t'HDR' 'TIFF' 'OPEN_EXR' 'OPEN_EXR_MULTILAYER' 'MPEG' 'CINEON' 'DPX' 
'DDS' 'JP2'";
 static int arg_handle_image_type_set(int argc, const char **argv, void *data)
 {
   bContext *C = data;

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


[Bf-blender-cvs] [fc8127d0702] soc-2019-openxr: (Disabled) code to open a DirectX window with the VR session

2019-06-13 Thread Julian Eisel
Commit: fc8127d0702ad7eb80bfce9c461e12a20724a9ba
Author: Julian Eisel
Date:   Thu Jun 13 23:20:18 2019 +0200
Branches: soc-2019-openxr
https://developer.blender.org/rBfc8127d0702ad7eb80bfce9c461e12a20724a9ba

(Disabled) code to open a DirectX window with the VR session

The window immediately crashes, hence keeping it disabled for now.

Not sure how much of this I'll leave in, for now this is mainly for
testing DirectX compatibility.

===

M   intern/ghost/GHOST_C-api.h
M   intern/ghost/GHOST_IWindow.h
M   intern/ghost/intern/GHOST_C-api.cpp
M   intern/ghost/intern/GHOST_Window.h
M   intern/ghost/intern/GHOST_WindowWin32.cpp
M   source/blender/windowmanager/WM_api.h
M   source/blender/windowmanager/intern/wm_operators.c
M   source/blender/windowmanager/intern/wm_window.c

===

diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index d68553eca0f..0dff8209966 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -203,6 +203,8 @@ extern GHOST_TSuccess 
GHOST_DisposeOpenGLContext(GHOST_SystemHandle systemhandle
 extern GHOST_ContextHandle GHOST_CreateDirectXContext(GHOST_SystemHandle 
systemhandle);
 #endif
 
+extern GHOST_ContextHandle GHOST_GetWindowContext(GHOST_WindowHandle 
windowhandle);
+
 /**
  * Returns the window user data.
  * \param windowhandle The handle to the window
diff --git a/intern/ghost/GHOST_IWindow.h b/intern/ghost/GHOST_IWindow.h
index 52894a7c38d..cf65decf9c6 100644
--- a/intern/ghost/GHOST_IWindow.h
+++ b/intern/ghost/GHOST_IWindow.h
@@ -77,6 +77,8 @@ class GHOST_IWindow {
*/
   virtual GHOST_TSuccess setDrawingContextType(GHOST_TDrawingContextType type) 
= 0;
 
+  virtual class GHOST_IContext *getDrawingContext() = 0;
+
   /**
* Sets the title displayed in the title bar.
* \param title The title to display in the title bar.
diff --git a/intern/ghost/intern/GHOST_C-api.cpp 
b/intern/ghost/intern/GHOST_C-api.cpp
index 1e9b8161239..73442ae6e01 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -136,6 +136,13 @@ GHOST_ContextHandle 
GHOST_CreateDirectXContext(GHOST_SystemHandle systemhandle)
 }
 #endif
 
+GHOST_ContextHandle GHOST_GetWindowContext(GHOST_WindowHandle windowhandle)
+{
+  GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
+
+  return (GHOST_ContextHandle)window->getDrawingContext();
+}
+
 GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
   const char *title,
   GHOST_TInt32 left,
diff --git a/intern/ghost/intern/GHOST_Window.h 
b/intern/ghost/intern/GHOST_Window.h
index 50a563453f6..a5673335eac 100644
--- a/intern/ghost/intern/GHOST_Window.h
+++ b/intern/ghost/intern/GHOST_Window.h
@@ -227,6 +227,11 @@ class GHOST_Window : public GHOST_IWindow {
*/
   virtual bool getModifiedState();
 
+  inline GHOST_IContext *getDrawingContext()
+  {
+return (GHOST_IContext *)m_context;
+  }
+
   /**
* Returns the type of drawing context used in this window.
* \return The current type of drawing context.
diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp 
b/intern/ghost/intern/GHOST_WindowWin32.cpp
index def075bd47c..891d7d4027a 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@ -23,6 +23,7 @@
 
 #define _USE_MATH_DEFINES
 
+#include "GHOST_ContextD3D.h"
 #include "GHOST_WindowWin32.h"
 #include "GHOST_SystemWin32.h"
 #include "GHOST_DropTargetWin32.h"
@@ -724,6 +725,27 @@ GHOST_Context 
*GHOST_WindowWin32::newDrawingContext(GHOST_TDrawingContextType ty
 #  error  // must specify either core or compat at build time
 #endif
   }
+  else if (type == GHOST_kDrawingContextTypeD3D) {
+GHOST_Context *context;
+
+HWND wnd = CreateWindowA("STATIC",
+ "BlenderD3D",
+ WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | 
WS_CLIPCHILDREN,
+ 0,
+ 0,
+ 64,
+ 64,
+ NULL,
+ NULL,
+ GetModuleHandle(NULL),
+ NULL);
+
+HDC mHDC = GetDC(wnd);
+
+context = new GHOST_ContextD3D(false, wnd, mHDC);
+
+return context;
+  }
 
   return NULL;
 }
diff --git a/source/blender/windowmanager/WM_api.h 
b/source/blender/windowmanager/WM_api.h
index 5ed1be81bff..8f54c4579ca 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -109,6 +109,7 @@ int WM_window_pixels_x(const struct wmWindow *win);
 int WM_window_pixels_y(const struct wmWindow *win);
 void WM_window_rect_calc(const struct wmWindow *win, struct rcti *r_rect);
 void WM_window_screen_rect_calc(const struct wmWindow 

[Bf-blender-cvs] [d2493bdd776] soc-2019-outliner: Outliner Visibility: Add Invisible filter

2019-06-13 Thread Nathan Craddock
Commit: d2493bdd776ae18140cf8769e59229ea772bcb85
Author: Nathan Craddock
Date:   Thu Jun 13 15:20:01 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rBd2493bdd776ae18140cf8769e59229ea772bcb85

Outliner Visibility: Add Invisible filter

This adds an object invisible filter to the outliner to only show hidden
or disabled objects in the outliner. In large scenes, it is often
difficult to locate hidden objects in the outliner to show them again.
This invisible filter makes it easier.

===

M   source/blender/editors/space_outliner/outliner_tree.c
M   source/blender/makesdna/DNA_space_types.h
M   source/blender/makesrna/intern/rna_space.c

===

diff --git a/source/blender/editors/space_outliner/outliner_tree.c 
b/source/blender/editors/space_outliner/outliner_tree.c
index 6c2aa992ee9..f4e55c3e6b7 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -2008,6 +2008,8 @@ static int outliner_exclude_filter_get(SpaceOutliner 
*soops)
 case SO_FILTER_OB_VISIBLE:
   exclude_filter |= SO_FILTER_OB_STATE_VISIBLE;
   break;
+case SO_FILTER_OB_INVISIBLE:
+  exclude_filter |= SO_FILTER_OB_STATE_INVISIBLE;
 case SO_FILTER_OB_SELECTED:
   exclude_filter |= SO_FILTER_OB_STATE_SELECTED;
   break;
@@ -2086,6 +2088,11 @@ static bool outliner_element_visible_get(ViewLayer 
*view_layer,
   return false;
 }
   }
+  else if (exclude_filter & SO_FILTER_OB_STATE_INVISIBLE) {
+if ((base->flag & BASE_VISIBLE) != 0) {
+  return false;
+}
+  }
   else if (exclude_filter & SO_FILTER_OB_STATE_SELECTED) {
 if ((base->flag & BASE_SELECTED) == 0) {
   return false;
diff --git a/source/blender/makesdna/DNA_space_types.h 
b/source/blender/makesdna/DNA_space_types.h
index 69c8d6b9cda..81da40d44b6 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -283,13 +283,14 @@ typedef enum eSpaceOutliner_Filter {
   SO_FILTER_NO_OB_CAMERA = (1 << 10),
   SO_FILTER_NO_OB_OTHERS = (1 << 11),
 
-  SO_FILTER_UNUSED_12 = (1 << 12), /* cleared */
-  SO_FILTER_OB_STATE_VISIBLE = (1 << 13),  /* Not set via DNA. */
-  SO_FILTER_OB_STATE_SELECTED = (1 << 14), /* Not set via DNA. */
-  SO_FILTER_OB_STATE_ACTIVE = (1 << 15),   /* Not set via DNA. */
-  SO_FILTER_NO_COLLECTION = (1 << 16),
-
-  SO_FILTER_ID_TYPE = (1 << 17),
+  SO_FILTER_UNUSED_12 = (1 << 12),  /* cleared */
+  SO_FILTER_OB_STATE_VISIBLE = (1 << 13),   /* Not set via DNA. */
+  SO_FILTER_OB_STATE_INVISIBLE = (1 << 14), /* Not set via DNA. */
+  SO_FILTER_OB_STATE_SELECTED = (1 << 15),  /* Not set via DNA. */
+  SO_FILTER_OB_STATE_ACTIVE = (1 << 16),/* Not set via DNA. */
+  SO_FILTER_NO_COLLECTION = (1 << 17),
+
+  SO_FILTER_ID_TYPE = (1 << 18),
 } eSpaceOutliner_Filter;
 
 #define SO_FILTER_OB_TYPE \
@@ -297,7 +298,8 @@ typedef enum eSpaceOutliner_Filter {
SO_FILTER_NO_OB_LAMP | SO_FILTER_NO_OB_CAMERA | SO_FILTER_NO_OB_OTHERS)
 
 #define SO_FILTER_OB_STATE \
-  (SO_FILTER_OB_STATE_VISIBLE | SO_FILTER_OB_STATE_SELECTED | 
SO_FILTER_OB_STATE_ACTIVE)
+  (SO_FILTER_OB_STATE_VISIBLE | SO_FILTER_OB_STATE_INVISIBLE | 
SO_FILTER_OB_STATE_SELECTED | \
+   SO_FILTER_OB_STATE_ACTIVE)
 
 #define SO_FILTER_ANY \
   (SO_FILTER_NO_OB_CONTENT | SO_FILTER_NO_CHILDREN | SO_FILTER_OB_TYPE | 
SO_FILTER_OB_STATE | \
@@ -307,8 +309,9 @@ typedef enum eSpaceOutliner_Filter {
 typedef enum eSpaceOutliner_StateFilter {
   SO_FILTER_OB_ALL = 0,
   SO_FILTER_OB_VISIBLE = 1,
-  SO_FILTER_OB_SELECTED = 2,
-  SO_FILTER_OB_ACTIVE = 3,
+  SO_FILTER_OB_INVISIBLE = 2,
+  SO_FILTER_OB_SELECTED = 3,
+  SO_FILTER_OB_ACTIVE = 4,
 } eSpaceOutliner_StateFilter;
 
 /* SpaceOutliner.show_restrict_flags */
diff --git a/source/blender/makesrna/intern/rna_space.c 
b/source/blender/makesrna/intern/rna_space.c
index 72803a7090f..b485143d808 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -2790,6 +2790,7 @@ static void rna_def_space_outliner(BlenderRNA *brna)
   static const EnumPropertyItem filter_state_items[] = {
   {SO_FILTER_OB_ALL, "ALL", 0, "All", "Show all objects in the view 
layer"},
   {SO_FILTER_OB_VISIBLE, "VISIBLE", 0, "Visible", "Show visible objects"},
+  {SO_FILTER_OB_INVISIBLE, "INVISIBLE", 0, "Invisible", "Show invisible 
objects"},
   {SO_FILTER_OB_SELECTED, "SELECTED", 0, "Selected", "Show selected 
objects"},
   {SO_FILTER_OB_ACTIVE, "ACTIVE", 0, "Active", "Show only the active 
object"},
   {0, NULL, 0, NULL, NULL},

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


[Bf-blender-cvs] [1840fd4fa87] soc-2019-outliner: Merge branch 'master' into soc-2019-outliner

2019-06-13 Thread Nathan Craddock
Commit: 1840fd4fa87dc9efac2ebd72ea562d76065bf25d
Author: Nathan Craddock
Date:   Thu Jun 13 14:05:29 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rB1840fd4fa87dc9efac2ebd72ea562d76065bf25d

Merge branch 'master' into soc-2019-outliner

===



===

diff --cc source/blender/editors/object/object_add.c
index 1e0fcd17063,99c3d7da2a2..647c02413a6
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@@ -2023,8 -2024,23 +2024,23 @@@ static Base *duplibase_for_convert
BKE_collection_object_add_from(bmain, scene, ob, obn);
  
basen = BKE_view_layer_base_find(view_layer, obn);
 -  ED_object_base_select(basen, BA_SELECT);
 -  ED_object_base_select(base, BA_DESELECT);
 +  ED_object_base_select(view_layer, basen, BA_SELECT);
-   ED_object_base_select(view_layer, basen, BA_DESELECT);
++  ED_object_base_select(view_layer, base, BA_DESELECT);
+ 
+   /* XXX Doing that here is stupid, it means we update and re-evaluate the 
whole depsgraph every
+* time we need to duplicate an object to convert it. Even worse, this is 
not 100% correct, since
+* we do not yet have duplicated obdata.
+* However, that is a safe solution for now. Proper, longer-term solution 
is to refactor
+* convert_exec to:
+*  - duplicate all data it needs to in a first loop.
+*  - do a single update.
+*  - convert data in a second loop. */
+   DEG_graph_tag_relations_update(depsgraph);
+   CustomData_MeshMasks customdata_mask_prev = scene->customdata_mask;
+   CustomData_MeshMasks_update(>customdata_mask, _MASK_MESH);
+   BKE_scene_graph_update_tagged(depsgraph, bmain);
+   scene->customdata_mask = customdata_mask_prev;
+ 
return basen;
  }

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


[Bf-blender-cvs] [ad1ff2b6018] soc-2019-outliner: Outliner: Refine synced selection

2019-06-13 Thread Nathan Craddock
Commit: ad1ff2b6018fe794613a1d1b27e97052de0d2952
Author: Nathan Craddock
Date:   Thu Jun 13 13:56:08 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rBad1ff2b6018fe794613a1d1b27e97052de0d2952

Outliner: Refine synced selection

Any selection event that uses ED_object_base_select will now
mark the outliners as being dirty. When an outliner draws and is
dirty with synced selection enabled, it will sync its selection
state with the view layer.

More work still needs to be done. This may not be the best way
to implement it (selections from scripts won't be tracked). Also,
selection from the outliner isn't perfect.

===

M   source/blender/editors/animation/anim_channels_edit.c
M   source/blender/editors/animation/anim_markers.c
M   source/blender/editors/armature/armature_relations.c
M   source/blender/editors/gpencil/gpencil_convert.c
M   source/blender/editors/include/ED_object.h
M   source/blender/editors/mesh/editmesh_tools.c
M   source/blender/editors/object/object_add.c
M   source/blender/editors/object/object_collection.c
M   source/blender/editors/object/object_constraint.c
M   source/blender/editors/object/object_edit.c
M   source/blender/editors/object/object_relations.c
M   source/blender/editors/object/object_select.c
M   source/blender/editors/space_nla/nla_channels.c
M   source/blender/editors/space_outliner/outliner_dragdrop.c
M   source/blender/editors/space_outliner/outliner_select.c
M   source/blender/editors/space_outliner/outliner_tools.c
M   source/blender/editors/space_view3d/view3d_select.c
M   source/blender/editors/space_view3d/view3d_view.c
M   source/blender/editors/transform/transform_conversions.c
M   source/blender/editors/undo/ed_undo.c
M   source/blender/makesdna/DNA_layer_types.h
M   source/blender/makesrna/intern/rna_layer.c
M   source/blender/makesrna/intern/rna_object_api.c
M   source/blender/windowmanager/intern/wm_event_system.c

===

diff --git a/source/blender/editors/animation/anim_channels_edit.c 
b/source/blender/editors/animation/anim_channels_edit.c
index 21b9c7252d2..3b8a171c385 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -2867,7 +2867,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext 
*ac, int channel_index,
   if (base->flag & BASE_SELECTABLE) {
 if (selectmode == SELECT_INVERT) {
   /* swap select */
-  ED_object_base_select(base, BA_INVERT);
+  ED_object_base_select(view_layer, base, BA_INVERT);
 
   if (adt) {
 adt->flag ^= ADT_UI_SELECTED;
@@ -2879,14 +2879,14 @@ static int mouse_anim_channels(bContext *C, 
bAnimContext *ac, int channel_index,
   /* deselect all */
   /* TODO: should this deselect all other types of channels too? */
   for (b = view_layer->object_bases.first; b; b = b->next) {
-ED_object_base_select(b, BA_DESELECT);
+ED_object_base_select(view_layer, b, BA_DESELECT);
 if (b->object->adt) {
   b->object->adt->flag &= ~(ADT_UI_SELECTED | ADT_UI_ACTIVE);
 }
   }
 
   /* select object now */
-  ED_object_base_select(base, BA_SELECT);
+  ED_object_base_select(view_layer, base, BA_SELECT);
   if (adt) {
 adt->flag |= ADT_UI_SELECTED;
   }
diff --git a/source/blender/editors/animation/anim_markers.c 
b/source/blender/editors/animation/anim_markers.c
index dec34eb04ac..6d85630abca 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -1200,7 +1200,7 @@ static void select_marker_camera_switch(
 if (marker->frame == cfra) {
   base = BKE_view_layer_base_find(view_layer, marker->camera);
   if (base) {
-ED_object_base_select(base, sel);
+ED_object_base_select(view_layer, base, sel);
 if (sel) {
   ED_object_base_activate(C, base);
 }
diff --git a/source/blender/editors/armature/armature_relations.c 
b/source/blender/editors/armature/armature_relations.c
index 2c61818d902..6ddf4a5c083 100644
--- a/source/blender/editors/armature/armature_relations.c
+++ b/source/blender/editors/armature/armature_relations.c
@@ -614,7 +614,7 @@ static int separate_armature_exec(bContext *C, wmOperator 
*op)
   view_layer, CTX_wm_view3d(C), _len);
 
   CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
-ED_object_base_select(base, BA_DESELECT);
+ED_object_base_select(view_layer, base, BA_DESELECT);
   }
   CTX_DATA_END;
 
@@ -635,7 +635,7 @@ static int separate_armature_exec(bContext *C, wmOperator 
*op)
  */
 
 /* 1) only edit-base selected */
-

[Bf-blender-cvs] [3f1ee807b6f] soc-2019-adaptive-cloth: Cloth: accurately find UVs for the edges

2019-06-13 Thread ishbosamiya
Commit: 3f1ee807b6fe88e3cef0084302045f51bc944819
Author: ishbosamiya
Date:   Fri Jun 14 00:08:14 2019 +0530
Branches: soc-2019-adaptive-cloth
https://developer.blender.org/rB3f1ee807b6fe88e3cef0084302045f51bc944819

Cloth: accurately find UVs for the edges

Earlier, the mesh would keep splitting at the seams of the UV islands because 
the distance would be so large. This is now fixed, it correctly finds the UVs 
of the corresponding edge that match the world space positions as well.

===

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

===

diff --git a/source/blender/blenkernel/intern/cloth.c 
b/source/blender/blenkernel/intern/cloth.c
index 7ad115f16b2..40e95a92662 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -448,31 +448,45 @@ static float cloth_remeshing_edge_size(BMesh *bm, BMEdge 
*edge, LinkNodePair *si
 {
   /* BMVert v1 = *edge->v1; */
   float u1[2], u2[2];
+  float u12[2];
 
   /**
* Get UV Coordinates of v1 and v2
*/
   BMLoop *l;
-  BMIter liter;
+  BMLoop *l2;
   MLoopUV *luv;
   const int cd_loop_uv_offset = CustomData_get_offset(>ldata, CD_MLOOPUV);
 
-  BM_ITER_ELEM (l, , edge->v1, BM_LOOPS_OF_VERT) {
-luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
-copy_v2_v2(u1, luv->uv);
+  l = edge->l;
+  if (l->v == edge->v1) {
+if (l->next->v == edge->v2) {
+  l2 = l->next;
+}
+else {
+  l2 = l->prev;
+}
   }
-  BM_ITER_ELEM (l, , edge->v2, BM_LOOPS_OF_VERT) {
-luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
-copy_v2_v2(u2, luv->uv);
+  else {
+if (l->next->v == edge->v1) {
+  l2 = l->next;
+}
+else {
+  l2 = l->prev;
+}
   }
 
+  luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
+  copy_v2_v2(u1, luv->uv);
+  luv = BM_ELEM_CD_GET_VOID_P(l2, cd_loop_uv_offset);
+  copy_v2_v2(u2, luv->uv);
+  copy_v2_v2(u12, u1);
+  sub_v2_v2(u12, u2);
+
   /**
*TODO(Ish): Need to add functionality when the vertex is on a seam
*/
 
-  float u12[2];
-  copy_v2_v2(u12, u1);
-  sub_v2_v2(u12, u2);
   float value = 0.0;
   float temp_v2[2];
   /* int index = BM_elem_index_get(); */

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


[Bf-blender-cvs] [d882e3abd90] soc-2019-adaptive-cloth: Cloth: Improved split edges significantly

2019-06-13 Thread ishbosamiya
Commit: d882e3abd9008c80bfd29823874f85fd539beb9a
Author: ishbosamiya
Date:   Thu Jun 13 12:27:42 2019 +0530
Branches: soc-2019-adaptive-cloth
https://developer.blender.org/rBd882e3abd9008c80bfd29823874f85fd539beb9a

Cloth: Improved split edges significantly

Now it sorts the bad edges based on the size and then splits the edges. This 
ensures proper size and aspect ratio of the triangles.

===

M   source/blender/blenkernel/BKE_cloth.h
M   source/blender/blenkernel/intern/cloth.c

===

diff --git a/source/blender/blenkernel/BKE_cloth.h 
b/source/blender/blenkernel/BKE_cloth.h
index e19dc0e54a0..6a1668d15a0 100644
--- a/source/blender/blenkernel/BKE_cloth.h
+++ b/source/blender/blenkernel/BKE_cloth.h
@@ -68,6 +68,11 @@ typedef struct ClothSolverResult {
   float max_error, min_error, avg_error;
 } ClothSolverResult;
 
+typedef struct Edge_Pair {
+  float size;
+  struct BMEdge *edge;
+} Edge_Pair;
+
 /**
  * This structure describes a cloth object against which the
  * simulation can run.
diff --git a/source/blender/blenkernel/intern/cloth.c 
b/source/blender/blenkernel/intern/cloth.c
index 675a4f7ba44..7ad115f16b2 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -35,6 +35,7 @@
 #include "BLI_math.h"
 #include "BLI_edgehash.h"
 #include "BLI_linklist.h"
+#include "BLI_array.h"
 
 #include "DEG_depsgraph.h"
 #include "DEG_depsgraph_query.h"
@@ -485,24 +486,50 @@ static float cloth_remeshing_edge_size(BMesh *bm, BMEdge 
*edge, LinkNodePair *si
   return sqrtf(fmax(value, 0.0f));
 }
 
-static int cloth_remeshing_find_bad_edges(BMesh *bm, LinkNodePair *sizing)
+static int cloth_remeshing_edge_pair_compare(const void *a, const void *b)
 {
+  Edge_Pair *ea = (Edge_Pair *)a;
+  Edge_Pair *eb = (Edge_Pair *)b;
+  if (ea->size < eb->size) {
+return 1;
+  }
+  if (ea->size > eb->size) {
+return -1;
+  }
+  return 0;
+}
+
+static void cloth_remeshing_find_bad_edges(BMesh *bm,
+   LinkNodePair *sizing,
+   BMEdge ***r_edges,
+   int *r_edges_len)
+{
+  Edge_Pair *edge_pairs = MEM_mallocN(sizeof(Edge_Pair) * bm->totedge, "Edge 
Pairs");
+
   int tagged = 0;
   BMEdge *e;
   BMIter eiter;
-  /* clearing out the tags */
-  BM_ITER_MESH (e, , bm, BM_EDGES_OF_MESH) {
-BM_elem_flag_disable(e, BM_ELEM_TAG);
-  }
   BM_ITER_MESH (e, , bm, BM_EDGES_OF_MESH) {
 float size = cloth_remeshing_edge_size(bm, e, sizing);
 if (size > 1.0f) {
-  BM_elem_flag_enable(e, BM_ELEM_TAG);
+  edge_pairs[tagged].size = size;
+  edge_pairs[tagged].edge = e;
   tagged++;
 }
   }
 
-  return tagged;
+  /* sort the list based on the size */
+  qsort(edge_pairs, tagged, sizeof(Edge_Pair), 
cloth_remeshing_edge_pair_compare);
+
+  *r_edges = MEM_mallocN(sizeof(BMEdge *) * tagged, "Bad Edges");
+
+  for (int i = 0; i < tagged; i++) {
+(*r_edges)[i] = edge_pairs[i].edge;
+  }
+
+  *r_edges_len = tagged;
+
+  MEM_freeN(edge_pairs);
 }
 
 static BMVert *cloth_remeshing_split_edge_keep_triangles(BMesh *bm,
@@ -686,41 +713,19 @@ static void cloth_remeshing_export_obj(BMesh *bm, char 
*file_name)
 static bool cloth_remeshing_split_edges(ClothModifierData *clmd, LinkNodePair 
*sizing)
 {
   BMesh *bm = clmd->clothObject->bm;
-  int tagged = cloth_remeshing_find_bad_edges(bm, sizing);
-  printf("tagged: %d\n", tagged);
-  if (tagged == 0) {
+  int num_bad_edges;
+  BMEdge **bad_edges;
+  cloth_remeshing_find_bad_edges(bm, sizing, _edges, _bad_edges);
+  printf("tagged: %d\n", num_bad_edges);
+  if (num_bad_edges == 0) {
 return false;
   }
   BMEdge *e;
-  BMIter iter;
-  BM_ITER_MESH (e, , bm, BM_EDGES_OF_MESH) {
-if (BM_elem_flag_test_bool(e, BM_ELEM_TAG)) {
-  /* int v1_index = BM_elem_index_get(e->v1); */
-  /* int v2_index = BM_elem_index_get(e->v2); */
-  /* BMEdge(*new_edges)[3]; */
-  /* int new_edge_count = 0; */
-  cloth_remeshing_split_edge_keep_triangles(bm, e, e->v1, 0.5);
-  /* BMVert *new_v = cloth_remeshing_split_edge_keep_triangles(bm, e, 
e->v1, 0.5); */
-  BM_elem_flag_disable(e, BM_ELEM_TAG);
-  /* ClothSizing *sizing_mean = MEM_mallocN(sizeof(ClothSizing), 
"ClothSizing_single"); */
-
-  /* /\* average of the sizing of the other 2 vertices *\/ */
-  /* ClothSizing *sizing_01 = (ClothSizing 
*)BLI_linklist_find(sizing->list, v1_index)->link;
-   */
-  /* ClothSizing *sizing_02 = (ClothSizing 
*)BLI_linklist_find(sizing->list, v2_index)->link;
-   */
-  /* add_m2_m2m2(sizing_mean->m, */
-  /* /\* first vertex sizing *\/ */
-  /* sizing_01->m, */
-  /* /\* second vertex sizing *\/ */
-  /* sizing_02->m); */
-  /* mul_m2_fl(sizing_mean->m, 0.5f); */
-
-  /* /\* 

[Bf-blender-cvs] [5eeb22cb407] soc-2019-adaptive-cloth: Cloth: support for UVs during obj export

2019-06-13 Thread ishbosamiya
Commit: 5eeb22cb407a543499c3355d3373b16116acd17c
Author: ishbosamiya
Date:   Thu Jun 13 01:50:08 2019 +0530
Branches: soc-2019-adaptive-cloth
https://developer.blender.org/rB5eeb22cb407a543499c3355d3373b16116acd17c

Cloth: support for UVs during obj export

===

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

===

diff --git a/source/blender/blenkernel/intern/cloth.c 
b/source/blender/blenkernel/intern/cloth.c
index 9609602bbb5..675a4f7ba44 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -596,6 +596,8 @@ static void cloth_remeshing_export_obj(BMesh *bm, char 
*file_name)
   } Face;
   Vert *verts;
   verts = MEM_mallocN(sizeof(Vert) * bm->totvert, "Verts");
+  UV *uvs;
+  uvs = MEM_mallocN(sizeof(UV) * bm->totvert, "UVs");
   Face *faces;
   faces = MEM_mallocN(sizeof(Face) * bm->totface, "Faces");
   for (int i = 0; i < bm->totface; i++) {
@@ -632,6 +634,15 @@ static void cloth_remeshing_export_obj(BMesh *bm, char 
*file_name)
   faces[curr_i].uv[faces[curr_i].len - 1] = vert_i + 1;
   faces[curr_i].len++;
 }
+BMLoop *l;
+BMIter liter;
+MLoopUV *luv;
+const int cd_loop_uv_offset = CustomData_get_offset(>ldata, 
CD_MLOOPUV);
+
+BM_ITER_ELEM (l, , v, BM_LOOPS_OF_VERT) {
+  luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
+  copy_v2_v2(uvs[vert_i].uv, luv->uv);
+}
 vert_i++;
   }
 
@@ -639,6 +650,10 @@ static void cloth_remeshing_export_obj(BMesh *bm, char 
*file_name)
 fprintf(fout, "v %f %f %f\n", verts[i].co[0], verts[i].co[1], 
verts[i].co[2]);
   }
 
+  for (int i = 0; i < bm->totvert; i++) {
+fprintf(fout, "vt %f %f\n", uvs[i].uv[0], uvs[i].uv[1]);
+  }
+
   for (int i = 0; i < bm->totvert; i++) {
 fprintf(fout, "vn %f %f %f\n", verts[i].no[0], verts[i].no[1], 
verts[i].no[2]);
   }
@@ -646,7 +661,7 @@ static void cloth_remeshing_export_obj(BMesh *bm, char 
*file_name)
   for (int i = 0; i < bm->totface; i++) {
 fprintf(fout, "f ");
 for (int j = 0; j < faces[i].len - 1; j++) {
-  fprintf(fout, "%d//%d ", faces[i].vi[j], faces[i].vi[j]);
+  fprintf(fout, "%d/%d/%d ", faces[i].vi[j], faces[i].uv[j], 
faces[i].vi[j]);
 }
 fprintf(fout, "\n");
   }
@@ -661,6 +676,7 @@ static void cloth_remeshing_export_obj(BMesh *bm, char 
*file_name)
   }
 
   MEM_freeN(faces);
+  MEM_freeN(uvs);
   MEM_freeN(verts);
 
   fclose(fout);

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


[Bf-blender-cvs] [f7d2e5c0caf] soc-2019-adaptive-cloth: Cloth: obj export support Done for testing purposes, export out the meshes as obj and render the obj sequence separately Current limitation: onl

2019-06-13 Thread ishbosamiya
Commit: f7d2e5c0caf4978941e29da086f64e5746fd92c2
Author: ishbosamiya
Date:   Wed Jun 12 22:48:19 2019 +0530
Branches: soc-2019-adaptive-cloth
https://developer.blender.org/rBf7d2e5c0caf4978941e29da086f64e5746fd92c2

Cloth: obj export support
Done for testing purposes, export out the meshes as obj and render the obj 
sequence separately
Current limitation: only upto 6 verts per face supported, easy to add more but 
mesh should stay triangulated for the most part

===

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

===

diff --git a/source/blender/blenkernel/intern/cloth.c 
b/source/blender/blenkernel/intern/cloth.c
index 8e91de7e71f..9609602bbb5 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -573,6 +573,100 @@ static BMVert 
*cloth_remeshing_split_edge_keep_triangles(BMesh *bm,
   return new_v;
 }
 
+static void cloth_remeshing_export_obj(BMesh *bm, char *file_name)
+{
+  FILE *fout = fopen(file_name, "w");
+  if (!fout) {
+printf("File not written, couldn't find path to %s\n", file_name);
+return;
+  }
+  printf("Writing file %s\n", file_name);
+  typedef struct Vert {
+float co[3];
+float no[3];
+  } Vert;
+  typedef struct UV {
+float uv[2];
+  } UV;
+  typedef struct Face {
+int *vi;
+int *uv;
+int len;
+BMFace *bm_face;
+  } Face;
+  Vert *verts;
+  verts = MEM_mallocN(sizeof(Vert) * bm->totvert, "Verts");
+  Face *faces;
+  faces = MEM_mallocN(sizeof(Face) * bm->totface, "Faces");
+  for (int i = 0; i < bm->totface; i++) {
+faces[i].vi = NULL;
+faces[i].uv = NULL;
+faces[i].len = 0;
+faces[i].bm_face = NULL;
+  }
+  BMVert *v;
+  BMIter viter;
+  int vert_i = 0;
+  int face_i = 0;
+  BM_ITER_MESH (v, , bm, BM_VERTS_OF_MESH) {
+copy_v3_v3(verts[vert_i].co, v->co);
+copy_v3_v3(verts[vert_i].no, v->no);
+BMFace *f;
+BMIter fiter;
+BM_ITER_ELEM (f, , v, BM_FACES_OF_VERT) {
+  int curr_i = face_i;
+  for (int i = 0; i < face_i; i++) {
+if (faces[i].bm_face == f) {
+  curr_i = i;
+  break;
+}
+  }
+  if (faces[curr_i].len == 0) {
+faces[curr_i].len = 1;
+faces[curr_i].vi = MEM_mallocN(sizeof(int) * 6, "face vi");
+faces[curr_i].uv = MEM_mallocN(sizeof(int) * 6, "face uv");
+faces[curr_i].bm_face = f;
+face_i++;
+  }
+  faces[curr_i].vi[faces[curr_i].len - 1] = vert_i + 1;
+  faces[curr_i].uv[faces[curr_i].len - 1] = vert_i + 1;
+  faces[curr_i].len++;
+}
+vert_i++;
+  }
+
+  for (int i = 0; i < bm->totvert; i++) {
+fprintf(fout, "v %f %f %f\n", verts[i].co[0], verts[i].co[1], 
verts[i].co[2]);
+  }
+
+  for (int i = 0; i < bm->totvert; i++) {
+fprintf(fout, "vn %f %f %f\n", verts[i].no[0], verts[i].no[1], 
verts[i].no[2]);
+  }
+
+  for (int i = 0; i < bm->totface; i++) {
+fprintf(fout, "f ");
+for (int j = 0; j < faces[i].len - 1; j++) {
+  fprintf(fout, "%d//%d ", faces[i].vi[j], faces[i].vi[j]);
+}
+fprintf(fout, "\n");
+  }
+
+  for (int i = 0; i < bm->totface; i++) {
+if (faces[i].vi) {
+  MEM_freeN(faces[i].vi);
+}
+if (faces[i].uv) {
+  MEM_freeN(faces[i].uv);
+}
+  }
+
+  MEM_freeN(faces);
+  MEM_freeN(verts);
+
+  fclose(fout);
+  printf("File %s written\n", file_name);
+}
+
 static bool cloth_remeshing_split_edges(ClothModifierData *clmd, LinkNodePair 
*sizing)
 {
   BMesh *bm = clmd->clothObject->bm;
@@ -638,9 +732,15 @@ static void cloth_remeshing_static(ClothModifierData *clmd)
   /**
* Split edges
*/
-  while (cloth_remeshing_split_edges(clmd, )) {
-/* empty while */
-  }
+  /* while (cloth_remeshing_split_edges(clmd, )) { */
+  /*   /\* empty while *\/ */
+  /* } */
+  cloth_remeshing_split_edges(clmd, );
+  static int file_no = 0;
+  file_no++;
+  char file_name[100];
+  sprintf(file_name, "/tmp/objs/%03d.obj", file_no);
+  cloth_remeshing_export_obj(clmd->clothObject->bm, file_name);
 
   /**
* Collapse edges

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


[Bf-blender-cvs] [a5e9b66be23] soc-2019-adaptive-cloth: Cloth: split face to triangles test

2019-06-13 Thread ishbosamiya
Commit: a5e9b66be2389e185caa3adcf164cd02c705c6cd
Author: ishbosamiya
Date:   Wed Jun 12 16:43:25 2019 +0530
Branches: soc-2019-adaptive-cloth
https://developer.blender.org/rBa5e9b66be2389e185caa3adcf164cd02c705c6cd

Cloth: split face to triangles test

It works for meshes that have convex uv layouts, otherwise goes into an 
infinite loop

===

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

===

diff --git a/source/blender/blenkernel/intern/cloth.c 
b/source/blender/blenkernel/intern/cloth.c
index 6da3b80cc32..8e91de7e71f 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -431,7 +431,7 @@ static void cloth_remeshing_init_bmesh(Object *ob, 
ClothModifierData *clmd, Mesh
   clmd->clothObject->bm = clmd->clothObject->bm_prev;
 }
 
-static Mesh *cloth_remeshing_update_cloth_object_bmesh(Object *ob, 
ClothModifierData *clmd)
+static Mesh *cloth_remeshing_update_cloth_object_bmesh(Object *UNUSED(ob), 
ClothModifierData *clmd)
 {
   Mesh *mesh_result = NULL;
   CustomData_MeshMasks cddata_masks = cloth_remeshing_get_cd_mesh_masks();
@@ -445,8 +445,7 @@ static Mesh 
*cloth_remeshing_update_cloth_object_bmesh(Object *ob, ClothModifier
 
 static float cloth_remeshing_edge_size(BMesh *bm, BMEdge *edge, LinkNodePair 
*sizing)
 {
-  BMVert v1 = *edge->v1;
-  BMVert v2 = *edge->v2;
+  /* BMVert v1 = *edge->v1; */
   float u1[2], u2[2];
 
   /**
@@ -475,7 +474,7 @@ static float cloth_remeshing_edge_size(BMesh *bm, BMEdge 
*edge, LinkNodePair *si
   sub_v2_v2(u12, u2);
   float value = 0.0;
   float temp_v2[2];
-  int index = BM_elem_index_get();
+  /* int index = BM_elem_index_get(); */
   /* ClothSizing *sizing_temp = (ClothSizing *)BLI_linklist_find(sizing->list, 
index)->link; */
   ClothSizing *sizing_temp = (ClothSizing *)BLI_linklist_find(sizing->list, 
0)->link;
   /* TODO(Ish): sizing_temp needs to be average of the both vertices, for 
static it doesn't matter
@@ -489,8 +488,6 @@ static float cloth_remeshing_edge_size(BMesh *bm, BMEdge 
*edge, LinkNodePair *si
 static int cloth_remeshing_find_bad_edges(BMesh *bm, LinkNodePair *sizing)
 {
   int tagged = 0;
-  BMVert *v;
-  BMIter iter;
   BMEdge *e;
   BMIter eiter;
   /* clearing out the tags */
@@ -527,7 +524,7 @@ static BMVert 
*cloth_remeshing_split_edge_keep_triangles(BMesh *bm,
 else {
   f2 = f;
 }
-printf("face_i: %d\n", face_i);
+/* printf("face_i: %d\n", face_i); */
   }
 
   if (!f1) {
@@ -536,7 +533,6 @@ static BMVert 
*cloth_remeshing_split_edge_keep_triangles(BMesh *bm,
 
   /* split the edge */
   BMEdge *new_edge;
-  BMEdge old_edge = *e;
   BMVert *new_v = BM_edge_split(bm, e, v, _edge, fac);
   BM_elem_flag_disable(new_edge, BM_ELEM_TAG);
 
@@ -546,23 +542,31 @@ static BMVert 
*cloth_remeshing_split_edge_keep_triangles(BMesh *bm,
* create new edge between this
* vert and newly created vert */
   BM_ITER_ELEM (vert, , f1, BM_VERTS_OF_FACE) {
-if (vert == old_edge.v1 || vert == old_edge.v2 || vert == new_v) {
+if (vert == e->v1 || vert == e->v2 || vert == new_edge->v1 || vert == 
new_edge->v2 ||
+vert == new_v) {
   continue;
 }
-
-BM_face_create_quad_tri(bm, vert, old_edge.v1, new_v, NULL, NULL, 
BM_CREATE_NOP);
-BM_face_create_quad_tri(bm, vert, new_v, old_edge.v2, NULL, NULL, 
BM_CREATE_NOP);
-BM_face_kill(bm, f1);
+BMLoop *l_a = NULL, *l_b = NULL;
+l_a = BM_face_vert_share_loop(f1, vert);
+l_b = BM_face_vert_share_loop(f1, new_v);
+if (!BM_face_split(bm, f1, l_a, l_b, NULL, NULL, true)) {
+  printf("face not split: f1\n");
+}
+break;
   }
   if (f2) {
 BM_ITER_ELEM (vert, , f2, BM_VERTS_OF_FACE) {
-  if (vert == old_edge.v1 || vert == old_edge.v2 || vert == new_v) {
+  if (vert == e->v1 || vert == e->v2 || vert == new_edge->v1 || vert == 
new_edge->v2 ||
+  vert == new_v) {
 continue;
   }
-
-  BM_face_create_quad_tri(bm, vert, old_edge.v1, new_v, NULL, NULL, 
BM_CREATE_NOP);
-  BM_face_create_quad_tri(bm, vert, new_v, old_edge.v2, NULL, NULL, 
BM_CREATE_NOP);
-  BM_face_kill(bm, f2);
+  BMLoop *l_a = NULL, *l_b = NULL;
+  l_a = BM_face_vert_share_loop(f2, vert);
+  l_b = BM_face_vert_share_loop(f2, new_v);
+  if (!BM_face_split(bm, f2, l_a, l_b, NULL, NULL, true)) {
+printf("face not split: f2\n");
+  }
+  break;
 }
   }
 
@@ -581,11 +585,12 @@ static bool cloth_remeshing_split_edges(ClothModifierData 
*clmd, LinkNodePair *s
   BMIter iter;
   BM_ITER_MESH (e, , bm, BM_EDGES_OF_MESH) {
 if (BM_elem_flag_test_bool(e, BM_ELEM_TAG)) {
-  int v1_index = BM_elem_index_get(e->v1);
-  int v2_index = BM_elem_index_get(e->v2);
-  BMEdge(*new_edges)[3];
-  int new_edge_count = 0;
-  BMVert *new_v = cloth_remeshing_split_edge_keep_triangles(bm, e, e->v1, 
0.5);
+  /* int 

[Bf-blender-cvs] [5e626e76645] master: Fix T61768 Eevee Offscreen rendering

2019-06-13 Thread Clément Foucault
Commit: 5e626e76645905e71182a9379f0bf86ae3010203
Author: Clément Foucault
Date:   Thu Jun 13 21:31:46 2019 +0200
Branches: master
https://developer.blender.org/rB5e626e76645905e71182a9379f0bf86ae3010203

Fix T61768 Eevee Offscreen rendering

The issue was caused by a bad usage of GPUOffscreen.

The Framebuffer was created using a window framebuffer and used
in a viewport callback when another GPUContext was bound.

This change allows up to 3 framebuffers per GPUOffscreen.

Most common case will be using 2 framebuffers (one for init and
one for drawing) but in the case of more (bad usage) it will just
degrade performance a bit.

===

M   source/blender/gpu/intern/gpu_framebuffer.c

===

diff --git a/source/blender/gpu/intern/gpu_framebuffer.c 
b/source/blender/gpu/intern/gpu_framebuffer.c
index e4d083947b4..5950027a103 100644
--- a/source/blender/gpu/intern/gpu_framebuffer.c
+++ b/source/blender/gpu/intern/gpu_framebuffer.c
@@ -801,12 +801,55 @@ void GPU_framebuffer_recursive_downsample(GPUFrameBuffer 
*fb,
 
 /* GPUOffScreen */
 
+#define MAX_CTX_FB_LEN 3
+
 struct GPUOffScreen {
-  GPUFrameBuffer *fb;
+  struct {
+GPUContext *ctx;
+GPUFrameBuffer *fb;
+  } framebuffers[MAX_CTX_FB_LEN];
+
   GPUTexture *color;
   GPUTexture *depth;
 };
 
+/* Returns the correct framebuffer for the current context. */
+static GPUFrameBuffer *gpu_offscreen_fb_get(GPUOffScreen *ofs)
+{
+  GPUContext *ctx = GPU_context_active_get();
+  BLI_assert(ctx);
+
+  for (int i = 0; i < MAX_CTX_FB_LEN; i++) {
+if (ofs->framebuffers[i].fb == NULL) {
+  ofs->framebuffers[i].ctx = ctx;
+  GPU_framebuffer_ensure_config(
+  >framebuffers[i].fb,
+  {GPU_ATTACHMENT_TEXTURE(ofs->depth), 
GPU_ATTACHMENT_TEXTURE(ofs->color)});
+}
+
+if (ofs->framebuffers[i].ctx == ctx) {
+  return ofs->framebuffers[i].fb;
+}
+  }
+
+  /* List is full, this should never happen or
+   * it might just slow things down if it happens
+   * regulary. In this case we just empty the list
+   * and start over. This is most likely never going
+   * to happen under normal usage. */
+  BLI_assert(0);
+  printf(
+  "Warning: GPUOffscreen used in more than 3 GPUContext. "
+  "This may create performance drop.\n");
+
+  for (int i = 0; i < MAX_CTX_FB_LEN; i++) {
+GPU_framebuffer_free(ofs->framebuffers[i].fb);
+ofs->framebuffers[i].fb = NULL;
+  }
+
+  return gpu_offscreen_fb_get(ofs);
+}
+
 GPUOffScreen *GPU_offscreen_create(
 int width, int height, int samples, bool depth, bool high_bitdepth, char 
err_out[256])
 {
@@ -834,11 +877,10 @@ GPUOffScreen *GPU_offscreen_create(
 
   gpuPushAttr(GPU_VIEWPORT_BIT);
 
-  GPU_framebuffer_ensure_config(
-  >fb, {GPU_ATTACHMENT_TEXTURE(ofs->depth), 
GPU_ATTACHMENT_TEXTURE(ofs->color)});
+  GPUFrameBuffer *fb = gpu_offscreen_fb_get(ofs);
 
   /* check validity at the very end! */
-  if (!GPU_framebuffer_check_valid(ofs->fb, err_out)) {
+  if (!GPU_framebuffer_check_valid(fb, err_out)) {
 GPU_offscreen_free(ofs);
 gpuPopAttr();
 return NULL;
@@ -853,8 +895,10 @@ GPUOffScreen *GPU_offscreen_create(
 
 void GPU_offscreen_free(GPUOffScreen *ofs)
 {
-  if (ofs->fb) {
-GPU_framebuffer_free(ofs->fb);
+  for (int i = 0; i < MAX_CTX_FB_LEN; i++) {
+if (ofs->framebuffers[i].fb) {
+  GPU_framebuffer_free(ofs->framebuffers[i].fb);
+}
   }
   if (ofs->color) {
 GPU_texture_free(ofs->color);
@@ -874,7 +918,8 @@ void GPU_offscreen_bind(GPUOffScreen *ofs, bool save)
 gpuPushFrameBuffer(fb);
   }
   glDisable(GL_SCISSOR_TEST);
-  GPU_framebuffer_bind(ofs->fb);
+  GPUFrameBuffer *ofs_fb = gpu_offscreen_fb_get(ofs);
+  GPU_framebuffer_bind(ofs_fb);
 }
 
 void GPU_offscreen_unbind(GPUOffScreen *UNUSED(ofs), bool restore)
@@ -899,7 +944,9 @@ void GPU_offscreen_draw_to_screen(GPUOffScreen *ofs, int x, 
int y)
   const int w = GPU_texture_width(ofs->color);
   const int h = GPU_texture_height(ofs->color);
 
-  glBindFramebuffer(GL_READ_FRAMEBUFFER, ofs->fb->object);
+  GPUFrameBuffer *ofs_fb = gpu_offscreen_fb_get(ofs);
+
+  glBindFramebuffer(GL_READ_FRAMEBUFFER, ofs_fb->object);
   GLenum status = glCheckFramebufferStatus(GL_READ_FRAMEBUFFER);
 
   if (status == GL_FRAMEBUFFER_COMPLETE) {
@@ -950,7 +997,8 @@ void GPU_offscreen_read_pixels(GPUOffScreen *ofs, int type, 
void *pixels)
 glReadPixels(0, 0, w, h, GL_RGBA, type, pixels);
 
 /* restore the original frame-bufer */
-glBindFramebuffer(GL_FRAMEBUFFER, ofs->fb->object);
+GPUFrameBuffer *ofs_fb = gpu_offscreen_fb_get(ofs);
+glBindFramebuffer(GL_FRAMEBUFFER, ofs_fb->object);
 
   finally:
 /* cleanup */
@@ -983,7 +1031,7 @@ void GPU_offscreen_viewport_data_get(GPUOffScreen *ofs,
  GPUTexture **r_color,
  GPUTexture **r_depth)
 {
-  *r_fb = ofs->fb;
+  *r_fb = 

[Bf-blender-cvs] [1688a57a8e6] master: Fix T65783: Gpencil Edit mode doesn't round data icon

2019-06-13 Thread Antonioya
Commit: 1688a57a8e68a71bf16acea1f78395b19406e601
Author: Antonioya
Date:   Thu Jun 13 20:38:31 2019 +0200
Branches: master
https://developer.blender.org/rB1688a57a8e68a71bf16acea1f78395b19406e601

Fix T65783: Gpencil Edit mode doesn't round data icon

See D5071 for more details

Thanks to @brecht for his help

===

M   source/blender/editors/space_outliner/outliner_draw.c

===

diff --git a/source/blender/editors/space_outliner/outliner_draw.c 
b/source/blender/editors/space_outliner/outliner_draw.c
index feff1dc5f4a..2541d0a935c 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -116,6 +116,12 @@ static void outliner_tree_dimensions(SpaceOutliner *soops, 
int *r_width, int *r_
 static bool is_object_data_in_editmode(const ID *id, const Object *obact)
 {
   const short id_type = GS(id->name);
+
+  if (id_type == ID_GD && obact && obact->data == id) {
+bGPdata *gpd = (bGPdata *)id;
+return GPENCIL_EDIT_MODE(gpd);
+  }
+
   return ((obact && (obact->mode & OB_MODE_EDIT)) && (id && 
OB_DATA_SUPPORT_EDITMODE(id_type)) &&
   (GS(((ID *)obact->data)->name) == id_type) && 
BKE_object_data_is_in_editmode(id));
 }

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


[Bf-blender-cvs] [0b40af97f41] master: Fix T59275: generated texture coordinates don't stick to mesh for shape keys

2019-06-13 Thread Brecht Van Lommel
Commit: 0b40af97f41137b083dedbf64b0685f9f0fb1987
Author: Brecht Van Lommel
Date:   Thu Jun 13 20:22:10 2019 +0200
Branches: master
https://developer.blender.org/rB0b40af97f41137b083dedbf64b0685f9f0fb1987

Fix T59275: generated texture coordinates don't stick to mesh for shape keys

No need for this optimization in Eevee anymore, instead the modifier stack will
only compute CD_ORCO when needed.

===

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

===

diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c 
b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 17c680bbcde..961602625f0 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -4931,10 +4931,9 @@ void DRW_mesh_batch_cache_create_requested(
   }
 
   if (batch_requested & (MBC_SURFACE | MBC_SURF_PER_MAT | MBC_WIRE_LOOPS_UVS)) 
{
-/* Optimization : Only create orco layer if mesh is deformed. */
+/* Modifiers will only generate an orco layer if the mesh is deformed. */
 if (cache->cd_needed.orco != 0) {
-  CustomData *cd_vdata = (me->edit_mesh) ? >edit_mesh->bm->vdata : 
>vdata;
-  if (CustomData_get_layer(cd_vdata, CD_ORCO) != NULL && 
ob->modifiers.first != NULL) {
+  if (CustomData_get_layer(>vdata, CD_ORCO) != NULL) {
 /* Orco layer is needed. */
   }
   else if (cache->cd_needed.tan_orco == 0) {

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


[Bf-blender-cvs] [15dd2899923] master: Mesh: don't compute CD_ORCO layer when there are no deforming modifiers

2019-06-13 Thread Brecht Van Lommel
Commit: 15dd2899923093db6c070b4520e0678affe49d09
Author: Brecht Van Lommel
Date:   Mon Jun 10 15:42:15 2019 +0200
Branches: master
https://developer.blender.org/rB15dd2899923093db6c070b4520e0678affe49d09

Mesh: don't compute CD_ORCO layer when there are no deforming modifiers

This saves memory and evaluation time for simple static meshes with e.g. a
subdivision surface modifier. If no CD_ORCO layer exists then we assume the
actual vertex coordinates are equal to the original undeformed coordinates.

===

M   source/blender/blenkernel/BKE_modifier.h
M   source/blender/blenkernel/intern/DerivedMesh.c
M   source/blender/blenkernel/intern/modifier.c

===

diff --git a/source/blender/blenkernel/BKE_modifier.h 
b/source/blender/blenkernel/BKE_modifier.h
index 0909e73777a..30a366805b6 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -391,15 +391,15 @@ typedef struct CDMaskLink {
   struct CustomData_MeshMasks mask;
 } CDMaskLink;
 
-/* Calculates and returns a linked list of CustomData_MeshMasks indicating the
- * data required by each modifier in the stack pointed to by md for correct
- * evaluation, assuming the data indicated by dataMask is required at the
- * end of the stack.
+/* Calculates and returns a linked list of CustomData_MeshMasks and modified
+ * final datamask, indicating the data required by each modifier in the stack
+ * pointed to by md for correct evaluation, assuming the data indicated by
+ * final_datamask is required at the end of the stack.
  */
 struct CDMaskLink *modifiers_calcDataMasks(struct Scene *scene,
struct Object *ob,
struct ModifierData *md,
-   const struct CustomData_MeshMasks 
*dataMask,
+   struct CustomData_MeshMasks 
*final_datamask,
int required_mode,
ModifierData *previewmd,
const struct CustomData_MeshMasks 
*previewmask);
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c 
b/source/blender/blenkernel/intern/DerivedMesh.c
index 2fc486687bb..7f1a0e6a744 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -1033,18 +1033,18 @@ static void mesh_copy_autosmooth(Mesh *me, Mesh 
*me_orig)
 }
 
 static void mesh_calc_modifier_final_normals(const Mesh *mesh_input,
- const CustomData_MeshMasks 
*dataMask,
+ const CustomData_MeshMasks 
*final_datamask,
  const bool sculpt_dyntopo,
  Mesh *mesh_final)
 {
   /* Compute normals. */
   const bool do_loop_normals = ((mesh_input->flag & ME_AUTOSMOOTH) != 0 ||
-(dataMask->lmask & CD_MASK_NORMAL) != 0);
+(final_datamask->lmask & CD_MASK_NORMAL) != 0);
   /* Some modifiers may need this info from their target (other) object,
* simpler to generate it here as well.
* Note that they will always be generated when no loop normals are 
comptuted,
* since they are needed by drawing code. */
-  const bool do_poly_normals = ((dataMask->pmask & CD_MASK_NORMAL) != 0);
+  const bool do_poly_normals = ((final_datamask->pmask & CD_MASK_NORMAL) != 0);
 
   if (do_loop_normals) {
 /* In case we also need poly normals, add the layer and compute them here
@@ -1071,7 +1071,7 @@ static void mesh_calc_modifier_final_normals(const Mesh 
*mesh_input,
 
   if (sculpt_dyntopo == false) {
 /* watch this! after 2.75a we move to from tessface to looptri (by 
default) */
-if (dataMask->fmask & CD_MASK_MFACE) {
+if (final_datamask->fmask & CD_MASK_MFACE) {
   BKE_mesh_tessface_ensure(mesh_final);
 }
 
@@ -1197,8 +1197,9 @@ static void mesh_calc_modifiers(struct Depsgraph 
*depsgraph,
* this fine grained so that for example vertex groups are preserved up to
* an armature modifier, but not through a following subsurf modifier where
* subdividing them is expensive. */
+  CustomData_MeshMasks final_datamask = *dataMask;
   CDMaskLink *datamasks = modifiers_calcDataMasks(
-  scene, ob, md, dataMask, required_mode, previewmd, );
+  scene, ob, md, _datamask, required_mode, previewmd, );
   CDMaskLink *md_datamask = datamasks;
   /* XXX Always copying POLYINDEX, else tessellated data are no more valid! */
   CustomData_MeshMasks append_mask = CD_MASK_BAREMESH_ORIGINDEX;
@@ -1316,8 +1317,8 @@ static void mesh_calc_modifiers(struct Depsgraph 
*depsgraph,
   continue;
 }
 
-/* Add an orco layer if needed by this 

[Bf-blender-cvs] [45145e746d0] master: Fix part of T63595: generated texture coordinates don't stick to deforming mesh

2019-06-13 Thread Brecht Van Lommel
Commit: 45145e746d0b414b0d9d2db6182e26f226950efa
Author: Brecht Van Lommel
Date:   Thu Jun 13 19:56:25 2019 +0200
Branches: master
https://developer.blender.org/rB45145e746d0b414b0d9d2db6182e26f226950efa

Fix part of T63595: generated texture coordinates don't stick to deforming mesh

Always compute CD_ORCO undeformed coordinates now for rendering, same as before.
There is still a refresh issue to be fixed, when switching from solid to 
textured
mode in the viewport.

Computing such undeformed coordinates can be expensive and is not actually 
needed
if the mesh is only using e.g. UV maps. This was the same in 2.79, at least now 
we
are skipping the computation when there are no deforming mdifiers on the mesh.

===

M   source/blender/blenkernel/intern/object_update.c
M   source/blender/editors/space_view3d/drawobject.c
M   source/blender/editors/space_view3d/view3d_draw_legacy.c
M   source/blender/editors/space_view3d/view3d_intern.h

===

diff --git a/source/blender/blenkernel/intern/object_update.c 
b/source/blender/blenkernel/intern/object_update.c
index 84e46f1ef70..6a6adb82225 100644
--- a/source/blender/blenkernel/intern/object_update.c
+++ b/source/blender/blenkernel/intern/object_update.c
@@ -168,13 +168,16 @@ void BKE_object_handle_data_update(Depsgraph *depsgraph, 
Scene *scene, Object *o
 
   CustomData_MeshMasks cddata_masks = scene->customdata_mask;
   CustomData_MeshMasks_update(_masks, _MASK_BAREMESH);
+  if (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER) {
+/* Make sure Freestyle edge/face marks appear in DM for render (see 
T40315). */
 #ifdef WITH_FREESTYLE
-  /* make sure Freestyle edge/face marks appear in DM for render (see 
T40315) */
-  if (DEG_get_mode(depsgraph) != DAG_EVAL_VIEWPORT) {
 cddata_masks.emask |= CD_MASK_FREESTYLE_EDGE;
 cddata_masks.pmask |= CD_MASK_FREESTYLE_FACE;
-  }
 #endif
+/* Always compute UVs, vertex colors as orcos for render. */
+cddata_masks.lmask |= CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL;
+cddata_masks.vmask |= CD_MASK_ORCO;
+  }
   if (em) {
 makeDerivedMesh(depsgraph, scene, ob, em, _masks); /* was 
CD_MASK_BAREMESH */
   }
diff --git a/source/blender/editors/space_view3d/drawobject.c 
b/source/blender/editors/space_view3d/drawobject.c
index cc76c151a29..38e8d285c77 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -50,14 +50,6 @@
 
 #include "view3d_intern.h" /* bad level include */
 
-int view3d_effective_drawtype(const struct View3D *v3d)
-{
-  if (v3d->shading.type == OB_RENDER) {
-return v3d->shading.prev_type;
-  }
-  return v3d->shading.type;
-}
-
 /* OpenGL Circle Drawing - Tables for Optimized Drawing Speed */
 /* 32 values of sin function (still same result!) */
 #define CIRCLE_RESOL 32
diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c 
b/source/blender/editors/space_view3d/view3d_draw_legacy.c
index 755852a2e18..dd97a023825 100644
--- a/source/blender/editors/space_view3d/view3d_draw_legacy.c
+++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c
@@ -771,14 +771,9 @@ void ED_view3d_datamask(const bContext *C,
 const View3D *v3d,
 CustomData_MeshMasks *r_cddata_masks)
 {
-  const int drawtype = view3d_effective_drawtype(v3d);
-
-  if (ELEM(drawtype, OB_TEXTURE, OB_MATERIAL)) {
+  if (ELEM(v3d->shading.type, OB_TEXTURE, OB_MATERIAL, OB_RENDER)) {
 r_cddata_masks->lmask |= CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL;
-
-if (drawtype == OB_MATERIAL) {
-  r_cddata_masks->vmask |= CD_MASK_ORCO;
-}
+r_cddata_masks->vmask |= CD_MASK_ORCO;
   }
 
   if ((CTX_data_mode_enum(C) == CTX_MODE_EDIT_MESH) &&
diff --git a/source/blender/editors/space_view3d/view3d_intern.h 
b/source/blender/editors/space_view3d/view3d_intern.h
index e499672acc1..3a6825aacb4 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -126,9 +126,6 @@ void VIEW3D_OT_fly(struct wmOperatorType *ot);
 /* view3d_walk.c */
 void VIEW3D_OT_walk(struct wmOperatorType *ot);
 
-/* drawobject.c */
-int view3d_effective_drawtype(const struct View3D *v3d);
-
 /* view3d_draw.c */
 void view3d_main_region_draw(const struct bContext *C, struct ARegion *ar);
 void view3d_draw_region_info(const struct bContext *C, struct ARegion *ar);

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


[Bf-blender-cvs] [09cc318fd67] master: T65783: UI Inconsistency with Grease Pencil icons in Properties and Outliner

2019-06-13 Thread Antonioya
Commit: 09cc318fd679c0b4c3100efbd43985572efe5f49
Author: Antonioya
Date:   Thu Jun 13 19:19:57 2019 +0200
Branches: master
https://developer.blender.org/rB09cc318fd679c0b4c3100efbd43985572efe5f49

T65783: UI Inconsistency with Grease Pencil icons in Properties and Outliner

Fixed Properties and tab icons

===

M   source/blender/makesrna/intern/rna_gpencil.c

===

diff --git a/source/blender/makesrna/intern/rna_gpencil.c 
b/source/blender/makesrna/intern/rna_gpencil.c
index 2e2cb9c1054..3b7a0a5a275 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -1653,7 +1653,7 @@ static void rna_def_gpencil_data(BlenderRNA *brna)
   srna = RNA_def_struct(brna, "GreasePencil", "ID");
   RNA_def_struct_sdna(srna, "bGPdata");
   RNA_def_struct_ui_text(srna, "Grease Pencil", "Freehand annotation 
sketchbook");
-  RNA_def_struct_ui_icon(srna, ICON_GREASEPENCIL);
+  RNA_def_struct_ui_icon(srna, ICON_OUTLINER_DATA_GREASEPENCIL);
 
   /* Layers */
   prop = RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);

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


[Bf-blender-cvs] [3ac37fb552a] soc-2019-openxr: Fix compile errors with older MSVC/Win-SDK versions

2019-06-13 Thread Julian Eisel
Commit: 3ac37fb552a511060a05df3c6d34da406d82ae60
Author: Julian Eisel
Date:   Thu Jun 13 18:21:16 2019 +0200
Branches: soc-2019-openxr
https://developer.blender.org/rB3ac37fb552a511060a05df3c6d34da406d82ae60

Fix compile errors with older MSVC/Win-SDK versions

Reported by @LazyDodo, thanks!

===

M   source/blender/windowmanager/xr/intern/wm_xr_event.c
M   source/blender/windowmanager/xr/intern/wm_xr_openxr_includes.h

===

diff --git a/source/blender/windowmanager/xr/intern/wm_xr_event.c 
b/source/blender/windowmanager/xr/intern/wm_xr_event.c
index 0a730feaa17..876fc6ff4da 100644
--- a/source/blender/windowmanager/xr/intern/wm_xr_event.c
+++ b/source/blender/windowmanager/xr/intern/wm_xr_event.c
@@ -18,6 +18,8 @@
  * \ingroup wm
  */
 
+#include 
+
 #include "BLI_compiler_attrs.h"
 #include "BLI_utildefines.h"
 
diff --git a/source/blender/windowmanager/xr/intern/wm_xr_openxr_includes.h 
b/source/blender/windowmanager/xr/intern/wm_xr_openxr_includes.h
index 6e008cc1eb3..9b306e96378 100644
--- a/source/blender/windowmanager/xr/intern/wm_xr_openxr_includes.h
+++ b/source/blender/windowmanager/xr/intern/wm_xr_openxr_includes.h
@@ -16,6 +16,10 @@
 
 /** \file
  * \ingroup wm
+ *
+ * \note This is taken mostly from the OpenXR SDK, but with modified D3D 
versions (e.g. d3d11_4.h
+ * -> d3d11.h). Take care for that when updating, we don't want to require 
newest Win SDKs to be
+ * installed.
  */
 
 #ifndef __WM_XR_SYSTEM_INCLUDES_H__
@@ -33,7 +37,7 @@
 #  include 
 #endif
 #ifdef XR_USE_GRAPHICS_API_D3D11
-#  include 
+#  include 
 #endif
 #ifdef XR_USE_GRAPHICS_API_D3D12
 #  include 

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


[Bf-blender-cvs] [c49f91a3b60] master: Fix T65669 Bones in Envelope Display break apart after selecting bone

2019-06-13 Thread Clément Foucault
Commit: c49f91a3b604da2b26b6c8bc2d3736c84870fe1b
Author: Clément Foucault
Date:   Tue Jun 11 23:35:35 2019 +0200
Branches: master
https://developer.blender.org/rBc49f91a3b604da2b26b6c8bc2d3736c84870fe1b

Fix T65669 Bones in Envelope Display break apart after selecting bone

This was because the VAOs were not updated if an instance batch was
reusing a VBO containing instances attributes which was reinitialized.

Now we ensure the Batch will reconfigure the VAOs if the VBO is 0.

===

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

===

diff --git a/source/blender/draw/intern/draw_instance_data.c 
b/source/blender/draw/intern/draw_instance_data.c
index e7a41ee3e43..3e5dfb53fc7 100644
--- a/source/blender/draw/intern/draw_instance_data.c
+++ b/source/blender/draw/intern/draw_instance_data.c
@@ -141,7 +141,7 @@ GPUBatch 
*DRW_temp_batch_instance_request(DRWInstanceDataList *idatalist,
 
   GPUBatch *batch = BLI_memblock_alloc(idatalist->pool_instancing);
   bool is_compatible = (batch->gl_prim_type == geom->gl_prim_type) && 
(batch->inst == buf) &&
-   (batch->phase == GPU_BATCH_READY_TO_DRAW);
+   (buf->vbo_id != 0) && (batch->phase == 
GPU_BATCH_READY_TO_DRAW);
   for (int i = 0; i < GPU_BATCH_VBO_MAX_LEN && is_compatible; i++) {
 if (batch->verts[i] != geom->verts[i]) {
   is_compatible = false;
@@ -167,7 +167,7 @@ GPUBatch *DRW_temp_batch_request(DRWInstanceDataList 
*idatalist,
  GPUPrimType prim_type)
 {
   GPUBatch *batch = BLI_memblock_alloc(idatalist->pool_batching);
-  bool is_compatible = (batch->verts[0] == buf) &&
+  bool is_compatible = (batch->verts[0] == buf) && (buf->vbo_id != 0) &&
(batch->gl_prim_type == 
convert_prim_type_to_gl(prim_type));
   if (!is_compatible) {
 GPU_batch_clear(batch);

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


[Bf-blender-cvs] [30116a52749] master: Fix T65109: Object deleted when removed from the RigidBodyWorld collection.

2019-06-13 Thread Bastien Montagne
Commit: 30116a5274930ece7acaf8b4c6d5e389b32f8b69
Author: Bastien Montagne
Date:   Thu Jun 13 17:57:55 2019 +0200
Branches: master
https://developer.blender.org/rB30116a5274930ece7acaf8b4c6d5e389b32f8b69

Fix T65109: Object deleted when removed from the RigidBodyWorld collection.

While user should never do that, it appears many end up using a 'view
layer' instancing collection as RBW collection, and even worse, have
objects in that unique collection.

Therefore, when removing RB simulation from an object, which among other
things has to remove it from the RBW collection, it would fully delete
the object from the blend file.

This fix merely checks the usercount of RB-removed object, and if it is
at 1 (which means object was in a single collection), it adds it to the
scene's master collection first.

===

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

===

diff --git a/source/blender/blenkernel/intern/rigidbody.c 
b/source/blender/blenkernel/intern/rigidbody.c
index ad15214c3b8..d4d753eb685 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -1326,6 +1326,15 @@ void BKE_rigidbody_remove_object(struct Main *bmain, 
Scene *scene, Object *ob)
   }
   FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
 }
+
+/* Relying on usercount of the object should be OK, and it is much cheaper 
than looping in all
+ * collections to check whether the object is already in another one... */
+if (ID_REAL_USERS(>id) == 1) {
+  /* Some users seems to find it funny to use a view-layer instancing 
collection
+   * as RBW collection... Despite this being a bad (ab)use of the system, 
avoid losing objects
+   * when we remove them from RB simulation. */
+  BKE_collection_object_add(bmain, BKE_collection_master(scene), ob);
+}
 BKE_collection_object_remove(bmain, rbw->group, ob, false);
   }

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


[Bf-blender-cvs] [84936ce0ee5] master: Defaults: refactor startup.blend code, more consistely apply to templates

2019-06-13 Thread Brecht Van Lommel
Commit: 84936ce0ee51453a8690a41e8eda8c7d424c928e
Author: Brecht Van Lommel
Date:   Thu Jun 13 17:40:04 2019 +0200
Branches: master
https://developer.blender.org/rB84936ce0ee51453a8690a41e8eda8c7d424c928e

Defaults: refactor startup.blend code, more consistely apply to templates

There were various changes only applied to specific builtin templates even
though they should apply to all, since it's possible to do e.g. use grease
pencil objects in the general template or use mesh sculpting in the grease
pencil template.

Also, nearly all changes now apply to builtin templates only. This was
already the case for most, and the distinction seems to have been more by
accident than intent.

===

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

===

diff --git a/source/blender/blenloader/intern/versioning_defaults.c 
b/source/blender/blenloader/intern/versioning_defaults.c
index 5b241d613e3..617329ef5f2 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -152,315 +152,285 @@ static ID *rename_id_for_versioning(Main *bmain,
   return id;
 }
 
-/**
- * Update defaults in startup.blend, without having to save and embed the file.
- * This function can be emptied each time the startup.blend is updated. */
-void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
+static bool blo_is_builtin_template(const char *app_template)
 {
   /* For all builtin templates shipped with Blender. */
-  const bool builtin_template =
-  (!app_template ||
-   STR_ELEM(app_template, "2D_Animation", "Sculpting", "VFX", 
"Video_Editing"));
-
-  /* For all startup.blend files. */
-  for (bScreen *screen = bmain->screens.first; screen; screen = 
screen->id.next) {
-for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
-  for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
-if (builtin_template) {
-  /* Remove all stored panels, we want to use defaults
-   * (order, open/closed) as defined by UI code here! */
-  BKE_area_region_panels_free(>panels);
-  BLI_freelistN(>panels_category_active);
-
-  /* Reset size so it uses consistent defaults from the region types. 
*/
-  ar->sizex = 0;
-  ar->sizey = 0;
-}
+  return (!app_template ||
+  STR_ELEM(app_template, "2D_Animation", "Sculpting", "VFX", 
"Video_Editing"));
+}
 
-/* some toolbars have been saved as initialized,
- * we don't want them to have odd zoom-level or scrolling set, see: 
T47047 */
-if (ELEM(ar->regiontype, RGN_TYPE_UI, RGN_TYPE_TOOLS, 
RGN_TYPE_TOOL_PROPS)) {
-  ar->v2d.flag &= ~V2D_IS_INITIALISED;
-}
+static void blo_update_defaults_screen(bScreen *screen,
+   const char *app_template,
+   const char *workspace_name)
+{
+  /* For all app templates. */
+  for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
+  /* Some toolbars have been saved as initialized,
+   * we don't want them to have odd zoom-level or scrolling set, see: 
T47047 */
+  if (ELEM(ar->regiontype, RGN_TYPE_UI, RGN_TYPE_TOOLS, 
RGN_TYPE_TOOL_PROPS)) {
+ar->v2d.flag &= ~V2D_IS_INITIALISED;
   }
+}
 
-  for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
-switch (sl->spacetype) {
-  case SPACE_VIEW3D: {
-View3D *v3d = (View3D *)sl;
-v3d->overlay.texture_paint_mode_opacity = 1.0f;
-v3d->overlay.weight_paint_mode_opacity = 1.0f;
-v3d->overlay.vertex_paint_mode_opacity = 1.0f;
-/* Use dimmed selected edges. */
-v3d->overlay.edit_flag &= ~V3D_OVERLAY_EDIT_EDGES;
-/* grease pencil settings */
-v3d->vertex_opacity = 1.0f;
-v3d->gp_flag |= V3D_GP_SHOW_EDIT_LINES;
-/* Remove dither pattern in wireframe mode. */
-v3d->shading.xray_alpha_wire = 0.0f;
-/* Skip startups that use the viewport color by default. */
-if (v3d->shading.background_type != 
V3D_SHADING_BACKGROUND_VIEWPORT) {
-  copy_v3_fl(v3d->shading.background_color, 0.05f);
-}
-break;
-  }
-  case SPACE_FILE: {
-SpaceFile *sfile = (SpaceFile *)sl;
-if (sfile->params) {
-  const char *dir_default = BKE_appdir_folder_default();
-  if (dir_default) {
-STRNCPY(sfile->params->dir, dir_default);
-sfile->params->file[0] = '\0';
-  }
-}
-break;
+/* Set default folder. */
+for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+  if 

[Bf-blender-cvs] [245129e8e2a] master: Fix T65445: wrong defaults when appending workspaces from builtin templates

2019-06-13 Thread Brecht Van Lommel
Commit: 245129e8e2a6fb24b7a3c6623eae9a6b2010c238
Author: Brecht Van Lommel
Date:   Thu Jun 13 16:33:01 2019 +0200
Branches: master
https://developer.blender.org/rB245129e8e2a6fb24b7a3c6623eae9a6b2010c238

Fix T65445: wrong defaults when appending workspaces from builtin templates

===

M   source/blender/blenloader/BLO_readfile.h
M   source/blender/blenloader/intern/versioning_defaults.c
M   source/blender/editors/screen/workspace_edit.c

===

diff --git a/source/blender/blenloader/BLO_readfile.h 
b/source/blender/blenloader/BLO_readfile.h
index cf00e4d5f84..8769ed37d16 100644
--- a/source/blender/blenloader/BLO_readfile.h
+++ b/source/blender/blenloader/BLO_readfile.h
@@ -40,6 +40,7 @@ struct Scene;
 struct UserDef;
 struct View3D;
 struct ViewLayer;
+struct WorkSpace;
 struct bContext;
 struct bScreen;
 struct wmWindowManager;
@@ -166,6 +167,7 @@ void BLO_expand_main(void *fdhandle, struct Main *mainvar);
 /* Update defaults in startup.blend & userprefs.blend, without having to save 
and embed it */
 void BLO_update_defaults_userpref_blend(void);
 void BLO_update_defaults_startup_blend(struct Main *mainvar, const char 
*app_template);
+void BLO_update_defaults_workspace(struct WorkSpace *workspace, const char 
*app_template);
 
 /* Version patch user preferences. */
 void BLO_version_defaults_userpref_blend(struct Main *mainvar, struct UserDef 
*userdef);
diff --git a/source/blender/blenloader/intern/versioning_defaults.c 
b/source/blender/blenloader/intern/versioning_defaults.c
index 617329ef5f2..355260f7b26 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -286,7 +286,7 @@ static void blo_update_defaults_screen(bScreen *screen,
   }
 }
 
-static void blo_update_defaults_workspace(WorkSpace *workspace, const char 
*app_template)
+void BLO_update_defaults_workspace(WorkSpace *workspace, const char 
*app_template)
 {
   ListBase *layouts = BKE_workspace_layouts_get(workspace);
   for (WorkSpaceLayout *layout = layouts->first; layout; layout = 
layout->next) {
@@ -367,7 +367,7 @@ void BLO_update_defaults_startup_blend(Main *bmain, const 
char *app_template)
 {
   /* For all app templates. */
   for (WorkSpace *workspace = bmain->workspaces.first; workspace; workspace = 
workspace->id.next) {
-blo_update_defaults_workspace(workspace, app_template);
+BLO_update_defaults_workspace(workspace, app_template);
   }
 
   /* For builtin templates only. */
diff --git a/source/blender/editors/screen/workspace_edit.c 
b/source/blender/editors/screen/workspace_edit.c
index 9fcd0e5295c..6030b6fded5 100644
--- a/source/blender/editors/screen/workspace_edit.c
+++ b/source/blender/editors/screen/workspace_edit.c
@@ -376,6 +376,9 @@ static int workspace_append_activate_exec(bContext *C, 
wmOperator *op)
 BLI_assert(appended_workspace != NULL);
 
 if (appended_workspace) {
+  /* Set defaults. */
+  BLO_update_defaults_workspace(appended_workspace, NULL);
+
   /* Reorder to last position. */
   BKE_id_reorder(>workspaces, _workspace->id, NULL, true);

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


[Bf-blender-cvs] [0d159bf74e3] soc-2019-npr: LANPR: Removed duplicated code in stroke modifier.

2019-06-13 Thread Yiming Wu
Commit: 0d159bf74e34a335a79bf28f3e78c04cd4ba9959
Author: Yiming Wu
Date:   Thu Jun 13 23:09:22 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB0d159bf74e34a335a79bf28f3e78c04cd4ba9959

LANPR: Removed duplicated code in stroke modifier.

===

M   source/blender/gpencil_modifiers/intern/MOD_gpencilstroke.c

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilstroke.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilstroke.c
index ee1efaa7802..9fe6fd66dd9 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilstroke.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilstroke.c
@@ -81,6 +81,11 @@ static void copyData(const GpencilModifierData *md, 
GpencilModifierData *target)
   BKE_gpencil_modifier_copyData_generic(md, target);
 }
 
+static void deformStroke(GpencilModifierData *md, Depsgraph *depsgraph, Object 
*ob, bGPDlayer *gpl, bGPDframe *gpf){
+  lanpr_update_data_for_external(depsgraph);
+  lanpr_generate_gpencil_from_chain(md, depsgraph, ob, gpl, gpf);
+}
+
 static void bakeModifier(Main *UNUSED(bmain),
  Depsgraph *depsgraph,
  GpencilModifierData *md,
@@ -91,10 +96,7 @@ static void bakeModifier(Main *UNUSED(bmain),
 
   for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
 for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
-  // lanpr_generate_gpencil_geometry(md, depsgraph, ob, gpl, gpf);
-  lanpr_update_data_for_external(depsgraph);
-  lanpr_generate_gpencil_from_chain(md, depsgraph, ob, gpl, gpf);
-  return;
+  deformStroke(md, depsgraph, ob, gpl, gpf);
 }
   }
 }
@@ -105,9 +107,7 @@ static void bakeModifier(Main *UNUSED(bmain),
 static void generateStrokes(
 GpencilModifierData *md, Depsgraph *depsgraph, Object *ob, bGPDlayer *gpl, 
bGPDframe *gpf)
 {
-  // lanpr_generate_gpencil_geometry(md, depsgraph, ob, gpl, gpf);
-  lanpr_update_data_for_external(depsgraph);
-  lanpr_generate_gpencil_from_chain(md, depsgraph, ob, gpl, gpf);
+  deformStroke(md, depsgraph, ob, gpl, gpf);
 }
 
 static void updateDepsgraph(GpencilModifierData *md, const 
ModifierUpdateDepsgraphContext *ctx)

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


[Bf-blender-cvs] [7e0f3fe8a01] soc-2019-bevel-profiles: Fix build error

2019-06-13 Thread Hans Goudey
Commit: 7e0f3fe8a01b5d8978d3507f6154002f31d3
Author: Hans Goudey
Date:   Thu Jun 13 10:59:45 2019 -0400
Branches: soc-2019-bevel-profiles
https://developer.blender.org/rB7e0f3fe8a01b5d8978d3507f6154002f31d3

Fix build error

===

M   source/blender/bmesh/tools/bmesh_bevel.h

===

diff --git a/source/blender/bmesh/tools/bmesh_bevel.h 
b/source/blender/bmesh/tools/bmesh_bevel.h
index c64f9bfe702..06418f0ff9a 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.h
+++ b/source/blender/bmesh/tools/bmesh_bevel.h
@@ -21,7 +21,8 @@
  * \ingroup bmesh
  */
 
-#include "BKE_profile_path.h"
+//#include "BKE_profile_path.h"
+#include "DNA_color_types.h"
 
 struct MDeformVert;

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


[Bf-blender-cvs] [242b5932ca4] master: Industry Compat keymap: Fix broken Tab key in the Text Editor

2019-06-13 Thread William Reynish
Commit: 242b5932ca4670aa5e5284777bb3c743182cb5a7
Author: William Reynish
Date:   Thu Jun 13 16:45:37 2019 +0200
Branches: master
https://developer.blender.org/rB242b5932ca4670aa5e5284777bb3c743182cb5a7

Industry Compat keymap: Fix broken Tab key in the Text Editor

Was being used for operator search here, which doesn't make any sense

===

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 1ae27169ee6..41d22ebbcb4 100644
--- a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
+++ b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
@@ -1485,7 +1485,6 @@ def km_text_generic(params):
 )
 
 items.extend([
-("wm.search_menu", {"type": 'TAB', "value": 'PRESS'}, None),
 ("text.start_find", {"type": 'F', "value": 'PRESS', "ctrl": True}, 
None),
 ("text.jump", {"type": 'J', "value": 'PRESS', "ctrl": True}, None),
 ("text.find", {"type": 'G', "value": 'PRESS', "ctrl": True}, None),

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


[Bf-blender-cvs] [75b98c6623e] soc-2019-bevel-profiles: Custom Profile Orientation Regularization: Fix first problem with travervsal. Fix build error. More debugging code for marking boundverts as sta

2019-06-13 Thread Hans Goudey
Commit: 75b98c6623e2e98829439878863ba36730c0d358
Author: Hans Goudey
Date:   Thu Jun 13 10:42:36 2019 -0400
Branches: soc-2019-bevel-profiles
https://developer.blender.org/rB75b98c6623e2e98829439878863ba36730c0d358

Custom Profile Orientation Regularization: Fix first problem with travervsal. 
Fix build error. More debugging code for marking boundverts as start

===

M   source/blender/bmesh/tools/bmesh_bevel.c

===

diff --git a/source/blender/bmesh/tools/bmesh_bevel.c 
b/source/blender/bmesh/tools/bmesh_bevel.c
index c54f8af9828..61e9d78ed88 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -40,6 +40,7 @@
 
 //#include "BKE_profile_path.h"
 #include "BKE_colortools.h"
+#include "DNA_color_types.h"
 
 #include "bmesh.h"
 #include "bmesh_bevel.h" /* own include */
@@ -324,7 +325,7 @@ typedef struct BevelParams {
 
 // #pragma GCC diagnostic ignored "-Wpadded"
 
- #include "bevdebug.c" /* HANS-TODO: Comment this back out before commit! */
+// #include "bevdebug.c" /* HANS-TODO: Comment this back out before commit! */
 
 /* Some flags to re-enable old behavior for a while,
  * in case fixes broke things not caught by regression tests. */
@@ -5493,8 +5494,8 @@ static EdgeHalf *next_edgehalf_bev(BevelParams *bp,
 {
   EdgeHalf *new_edge;
   EdgeHalf *next_edge = NULL;
-  float d_cur[3];
-  float d_other[3];
+  float d_start[3];
+  float d_new[3];
   float v1_dist_to_bv;
   float v2_dist_to_bv;
   float new_angle;
@@ -5509,7 +5510,7 @@ static EdgeHalf *next_edgehalf_bev(BevelParams *bp,
 
   /* Case 1: The next EdgeHalf is across a BevVert from the current EdgeHalf */
   if (toward_bv) {
-printf("TOWARD_BV");
+printf("[toward_bv]");
 /* Find the direction vector of the current edge (pointing INTO the 
BevVert) .
  * v1 and v2 don't necessarily have an order, so we need to check which is 
closer to bv */
 /* HANS-TODO: r_bv not initialized */
@@ -5517,18 +5518,21 @@ static EdgeHalf *next_edgehalf_bev(BevelParams *bp,
 v2_dist_to_bv = fabsf(len_v3v3(start_edge->e->v2->co, (*r_bv)->v->co));
 /* HANS-TODO: Helper function for this comparison? */
 if (v1_dist_to_bv < v2_dist_to_bv) {
-  sub_v3_v3v3(d_cur, start_edge->e->v1->co, start_edge->e->v2->co);
+  sub_v3_v3v3(d_start, start_edge->e->v1->co, start_edge->e->v2->co);
 }
 else {
-  sub_v3_v3v3(d_cur, start_edge->e->v2->co, start_edge->e->v1->co);
+  sub_v3_v3v3(d_start, start_edge->e->v2->co, start_edge->e->v1->co);
 }
+#if DEBUG_CUSTOM_PROFILE_ORIENTATION
+printf("[d_start:(%0.2f, %0.2f, %0.2f)]", (double)d_start[0],
+  (double)d_start[1],
+  (double)d_start[2]);
+#endif
 
 /* Find the beveled edge coming out of the BevVert most parallel to the 
current edge */
 new_edge = start_edge;
 //new_edge = next_bev(*r_bv, start_edge);
 new_edge = new_edge->next;
-//printf("new_edge_AFTER: %p\n", (void *)new_edge);
-//printf("start_edge_AFTER: %p\n", (void *)start_edge);
 #if DEBUG_CUSTOM_PROFILE_ORIENTATION
 //if (new_edge) {
 //  printf("[new_edge]");
@@ -5547,22 +5551,25 @@ static EdgeHalf *next_edgehalf_bev(BevelParams *bp,
 continue;
   }
 #if DEBUG_CUSTOM_PROFILE_ORIENTATION
-  printf("[while loop]");
+  printf("[new_edge]");
 #endif
   /* Find direction vector of the possible next edge (pointing OUT of the 
BevVert) */
   v1_dist_to_bv = fabsf(len_v3v3(new_edge->e->v1->co, (*r_bv)->v->co));
   v2_dist_to_bv = fabsf(len_v3v3(new_edge->e->v2->co, (*r_bv)->v->co));
   if (v1_dist_to_bv > v2_dist_to_bv) {
-sub_v3_v3v3(d_other, new_edge->e->v1->co, new_edge->e->v2->co);
+sub_v3_v3v3(d_new, new_edge->e->v1->co, new_edge->e->v2->co);
   }
   else {
-sub_v3_v3v3(d_other, new_edge->e->v2->co, new_edge->e->v1->co);
+sub_v3_v3v3(d_new, new_edge->e->v2->co, new_edge->e->v1->co);
   }
 
   /* Use this edge if it is the most parallel to the orignial so far */
-  new_angle = angle_v3v3(d_cur, d_other);
+  new_angle = angle_v3v3(d_start, d_new);
 #if DEBUG_CUSTOM_PROFILE_ORIENTATION
-  printf("[angle:%0.2f]", (double)new_angle);
+  printf("[d_new:(%0.2f, %0.2f, %0.2f)][angle:%0.2f]", (double)d_new[0],
+   (double)d_new[1],
+   (double)d_new[2],
+   (double)new_angle);
 #endif
   if (new_angle < best_angle) {
 second_best_angle = best_angle; /* For remembering if the choice was 
too close */
@@ -5580,17 +5587,17 @@ static EdgeHalf *next_edgehalf_bev(BevelParams *bp,
 #endif
 }
 
-/* Only return a new Edge if one was found and if the 

[Bf-blender-cvs] [40a12b4a38f] soc-2019-npr: LANPR: Fix pointer conversion for MSVC.

2019-06-13 Thread Yiming Wu
Commit: 40a12b4a38f03e043233d6878c07a90a14a740fa
Author: Yiming Wu
Date:   Thu Jun 13 22:33:04 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB40a12b4a38f03e043233d6878c07a90a14a740fa

LANPR: Fix pointer conversion for MSVC.

===

M   source/blender/draw/engines/lanpr/lanpr_chain.c

===

diff --git a/source/blender/draw/engines/lanpr/lanpr_chain.c 
b/source/blender/draw/engines/lanpr/lanpr_chain.c
index 90eaad5be80..c77140f9df6 100644
--- a/source/blender/draw/engines/lanpr/lanpr_chain.c
+++ b/source/blender/draw/engines/lanpr/lanpr_chain.c
@@ -524,7 +524,7 @@ void 
lanpr_split_chains_for_fixed_occlusion(LANPR_RenderBuffer *rb)
   }
 }
   }
-  for(rlc = rb->chains.first;rlc;rlc=rlc->item.next){
+  for(rlc = rb->chains.first;rlc;rlc=(LANPR_RenderLineChain *)rlc->item.next){
 lanpr_link_chain_with_bounding_areas(rb,rlc);
   }
 }
@@ -583,7 +583,7 @@ void lanpr_connect_chains_image_space(LANPR_RenderBuffer 
*rb)
   closest_cre = NULL;
   if(!ba->linked_chains.first) break;
   for(cre = ba->linked_chains.first;cre;cre = next_cre){
-next_cre = cre->item.next;
+next_cre = (LANPR_ChainRegisterEntry*)cre->item.next;
 if(cre->rlc == rlc || 
((LANPR_RenderLineChainItem*)cre->rlc->chain.first)->occlusion != occlusion) 
continue;
 if(cre->rlc->picked){
   BLI_remlink(>linked_chains,cre);
@@ -618,7 +618,7 @@ void lanpr_connect_chains_image_space(LANPR_RenderBuffer 
*rb)
   closest_cre = NULL;
   if(!ba->linked_chains.first) break;
   for(cre = ba->linked_chains.first;cre;cre = next_cre){
-next_cre = cre->item.next;
+next_cre = (LANPR_ChainRegisterEntry*)cre->item.next;
 if(cre->rlc == rlc || 
((LANPR_RenderLineChainItem*)cre->rlc->chain.first)->occlusion != occlusion) 
continue;
 if(cre->rlc->picked){
   BLI_remlink(>linked_chains,cre);

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


[Bf-blender-cvs] [01bcee7efb2] master: Fix: Sequencer timecodes was using wrong properties

2019-06-13 Thread William Reynish
Commit: 01bcee7efb2e048dd215cb4d5000264936cd20bf
Author: William Reynish
Date:   Thu Jun 13 15:54:45 2019 +0200
Branches: master
https://developer.blender.org/rB01bcee7efb2e048dd215cb4d5000264936cd20bf

Fix: Sequencer timecodes was using wrong properties

  - The Start value and the Playhead value both used 'frame_start', which only 
tells you where the strip was originally inserted. Instead 'frame_final_start' 
is now used, which results in the correct timeline values.
  - When scaling the sidebar some of the the labels weren't scaling correctly, 
this has been fixed
  - Use Hold Cut/Cut instead of Hard/Soft Cut, for consistency

Patch by Peter Fog

Differential revision: https://developer.blender.org/D5065

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_sequencer.py 
b/release/scripts/startup/bl_ui/space_sequencer.py
index a9ca3f9dd5d..41a5e496a66 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -1314,26 +1314,31 @@ class 
SEQUENCER_PT_info_timecodes(SequencerButtonsPanel, Panel):
 
 sub = layout.column(align=True)
 sub.enabled = not strip.lock
-split = sub.split(factor=0.5 + max_factor)
+split = sub.split(factor=0.5 + max_factor, align=True)
 split.alignment = 'RIGHT'
 split.label(text="Start")
-split.prop(strip, "frame_start", 
text=str(bpy.utils.smpte_from_frame(strip.frame_start)))
-split = sub.split(factor=0.5 + max_factor)
+split.prop(strip, "frame_final_start", 
text=str(bpy.utils.smpte_from_frame(strip.frame_final_start)))
+
+split = sub.split(factor=0.5 + max_factor, align=True)
 split.alignment = 'RIGHT'
 split.label(text="End")
 split.prop(strip, "frame_final_end", 
text=str(bpy.utils.smpte_from_frame(strip.frame_final_end)))
-split = sub.split(factor=0.5 + max_factor)
+
+split = sub.split(factor=0.5 + max_factor, align=True)
 split.alignment = 'RIGHT'
 split.label(text="Duration")
 split.prop(strip, "frame_final_duration", 
text=str(bpy.utils.smpte_from_frame(strip.frame_final_duration)))
 
 if not isinstance(strip, bpy.types.EffectSequence):
+
 layout.alignment = 'RIGHT'
 sub = layout.column(align=True)
+
 split = sub.split(factor=0.5 + max_factor, align=True)
 split.alignment = 'RIGHT'
-split.label(text="Soft Trim Start")
+split.label(text="Strip Offset Start")
 split.prop(strip, "frame_offset_start", 
text=str(bpy.utils.smpte_from_frame(strip.frame_offset_start)))
+
 split = sub.split(factor=0.5 + max_factor, align=True)
 split.alignment = 'RIGHT'
 split.label(text='End')
@@ -1341,31 +1346,32 @@ class 
SEQUENCER_PT_info_timecodes(SequencerButtonsPanel, Panel):
 
 layout.alignment = 'RIGHT'
 sub = layout.column(align=True)
-split = sub.split(factor=0.5 + max_factor)
+
+split = sub.split(factor=0.5 + max_factor,  align=True)
 split.alignment = 'RIGHT'
-split.label(text="Hard Trim Start")
+split.label(text="Hold Offset Start")
 split.prop(strip, "animation_offset_start", 
text=str(bpy.utils.smpte_from_frame(strip.animation_offset_start)))
+
 split = sub.split(factor=0.5 + max_factor, align=True)
 split.alignment = 'RIGHT'
 split.label(text='End')
 split.prop(strip, "animation_offset_end", 
text=str(bpy.utils.smpte_from_frame(strip.animation_offset_end)))
 
-playhead = frame_current - strip.frame_start
 col = layout.column(align=True)
 col = col.box()
 col.active = (
-(frame_current >= strip.frame_start) and
-(frame_current <= strip.frame_start + strip.frame_final_duration)
+(frame_current >= strip.frame_final_start) and
+(frame_current <= strip.frame_final_start + 
strip.frame_final_duration)
 )
-split = col.split(factor=0.5 + max_factor)
+
+split = col.split(factor=0.5 + max_factor, align=True)
 split.alignment = 'RIGHT'
 split.label(text="Playhead")
-split.label(text="%s:   %s" % ((bpy.utils.smpte_from_frame(playhead)), 
(str(playhead
-
-''' Old data - anyone missing this data?
-col.label(text=iface_("Frame Offset %d:%d") % 
(strip.frame_offset_start, strip.frame_offset_end),
-  translate=False)
-col.label(text=iface_("Frame Still %d:%d") % (strip.frame_still_start, 
strip.frame_still_end), translate=False)'''
+split = split.split(factor=0.8 + max_factor, align=True)
+playhead = frame_current - strip.frame_final_start
+

[Bf-blender-cvs] [9d269a97be5] master: Fix "Fix Deform" not working in Blender 2.8

2019-06-13 Thread Sergey Sharybin
Commit: 9d269a97be52a65728387255fbcf692192a505ad
Author: Sergey Sharybin
Date:   Thu Jun 13 15:21:16 2019 +0200
Branches: master
https://developer.blender.org/rB9d269a97be52a65728387255fbcf692192a505ad

Fix "Fix Deform" not working in Blender 2.8

Need to copy changes to the evaluated mesh before requesting
new deformed mesh.

Tested on a file from T32406.

===

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

===

diff --git a/source/blender/editors/object/object_vgroup.c 
b/source/blender/editors/object/object_vgroup.c
index 94c456110bc..678f6f50096 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -1315,7 +1315,7 @@ static void getVerticalAndHorizontalChange(const float 
norm[3],
  * coord is a point on the plane
  */
 static void moveCloserToDistanceFromPlane(Depsgraph *depsgraph,
-  Scene *scene,
+  Scene *UNUSED(scene),
   Object *ob,
   Mesh *me,
   int index,
@@ -1328,11 +1328,13 @@ static void moveCloserToDistanceFromPlane(Depsgraph 
*depsgraph,
 {
   Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
   Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
+  Mesh *mesh_eval = (Mesh *)object_eval->data;
 
   Mesh *me_deform;
-  MDeformWeight *dw;
+  MDeformWeight *dw, *dw_eval;
   MVert m;
   MDeformVert *dvert = me->dvert + index;
+  MDeformVert *dvert_eval = mesh_eval->dvert + index;
   int totweight = dvert->totweight;
   float oldw = 0;
   float oldPos[3] = {0};
@@ -1364,6 +1366,7 @@ static void moveCloserToDistanceFromPlane(Depsgraph 
*depsgraph,
 for (i = 0; i < totweight; i++) {
   dwIndices[i] = i;
   dw = (dvert->dw + i);
+  dw_eval = (dvert_eval->dw + i);
   vc = hc = 0;
   if (!dw->weight) {
 changes[i][0] = 0;
@@ -1375,7 +1378,7 @@ static void moveCloserToDistanceFromPlane(Depsgraph 
*depsgraph,
 if (me_deform) {
   /* DO NOT try to do own cleanup here, this is call for dramatic 
failures and bugs!
* Better to over-free and recompute a bit. */
-  BKE_object_free_derived_caches(ob);
+  BKE_object_free_derived_caches(object_eval);
 }
 oldw = dw->weight;
 if (k) {
@@ -1393,11 +1396,13 @@ static void moveCloserToDistanceFromPlane(Depsgraph 
*depsgraph,
 if (dw->weight > 1) {
   dw->weight = 1;
 }
+dw_eval->weight = dw->weight;
 me_deform = mesh_get_eval_deform(depsgraph, scene_eval, object_eval, 
_MASK_BAREMESH);
 m = me_deform->mvert[index];
 getVerticalAndHorizontalChange(
 norm, d, coord, oldPos, distToStart, m.co, changes, dists, i);
 dw->weight = oldw;
+dw_eval->weight = oldw;
 if (!k) {
   vc = changes[i][0];
   hc = changes[i][1];
@@ -1492,7 +1497,7 @@ static void moveCloserToDistanceFromPlane(Depsgraph 
*depsgraph,
   if (me_deform) {
 /* DO NOT try to do own cleanup here, this is call for dramatic 
failures and bugs!
  * Better to over-free and recompute a bit. */
-BKE_object_free_derived_caches(ob);
+BKE_object_free_derived_caches(object_eval);
   }
 }
   } while (wasChange && ((distToStart - distToBe) / fabsf(distToStart - 
distToBe) ==
@@ -1507,7 +1512,7 @@ static void moveCloserToDistanceFromPlane(Depsgraph 
*depsgraph,
 /* this is used to try to smooth a surface by only adjusting the nonzero 
weights of a vertex
  * but it could be used to raise or lower an existing 'bump.' */
 static void vgroup_fix(
-const bContext *C, Scene *scene, Object *ob, float distToBe, float 
strength, float cp)
+const bContext *C, Scene *UNUSED(scene), Object *ob, float distToBe, float 
strength, float cp)
 {
   Depsgraph *depsgraph = CTX_data_depsgraph(C);
   Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);

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


[Bf-blender-cvs] [64b759ba88a] master: Fix "Fix Deform" access evaluated data form original objects

2019-06-13 Thread Sergey Sharybin
Commit: 64b759ba88aa8e1c0c5d88d1b273e4e9c3176507
Author: Sergey Sharybin
Date:   Thu Jun 13 15:08:45 2019 +0200
Branches: master
https://developer.blender.org/rB64b759ba88aa8e1c0c5d88d1b273e4e9c3176507

Fix "Fix Deform" access evaluated data form original objects

This is part of T60517.

===

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

===

diff --git a/source/blender/editors/object/object_vgroup.c 
b/source/blender/editors/object/object_vgroup.c
index 2e958385a60..94c456110bc 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -59,6 +59,7 @@
 
 #include "DEG_depsgraph.h"
 #include "DEG_depsgraph_build.h"
+#include "DEG_depsgraph_query.h"
 
 #include "DNA_armature_types.h"
 #include "RNA_access.h"
@@ -1325,6 +1326,9 @@ static void moveCloserToDistanceFromPlane(Depsgraph 
*depsgraph,
   float strength,
   float cp)
 {
+  Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
+  Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
+
   Mesh *me_deform;
   MDeformWeight *dw;
   MVert m;
@@ -1349,7 +1353,7 @@ static void moveCloserToDistanceFromPlane(Depsgraph 
*depsgraph,
   float originalDistToBe = distToBe;
   do {
 wasChange = false;
-me_deform = mesh_get_eval_deform(depsgraph, scene, ob, _MASK_BAREMESH);
+me_deform = mesh_get_eval_deform(depsgraph, scene_eval, object_eval, 
_MASK_BAREMESH);
 m = me_deform->mvert[index];
 copy_v3_v3(oldPos, m.co);
 distToStart = dot_v3v3(norm, oldPos) + d;
@@ -1389,7 +1393,7 @@ static void moveCloserToDistanceFromPlane(Depsgraph 
*depsgraph,
 if (dw->weight > 1) {
   dw->weight = 1;
 }
-me_deform = mesh_get_eval_deform(depsgraph, scene, ob, 
_MASK_BAREMESH);
+me_deform = mesh_get_eval_deform(depsgraph, scene_eval, object_eval, 
_MASK_BAREMESH);
 m = me_deform->mvert[index];
 getVerticalAndHorizontalChange(
 norm, d, coord, oldPos, distToStart, m.co, changes, dists, i);
@@ -1506,6 +1510,8 @@ static void vgroup_fix(
 const bContext *C, Scene *scene, Object *ob, float distToBe, float 
strength, float cp)
 {
   Depsgraph *depsgraph = CTX_data_depsgraph(C);
+  Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
+  Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
   int i;
 
   Mesh *me = ob->data;
@@ -1522,7 +1528,8 @@ static void vgroup_fix(
 MVert *p = MEM_callocN(sizeof(MVert) * (count), "deformedPoints");
 int k;
 
-Mesh *me_deform = mesh_get_eval_deform(depsgraph, scene, ob, 
_MASK_BAREMESH);
+Mesh *me_deform = mesh_get_eval_deform(
+depsgraph, scene_eval, object_eval, _MASK_BAREMESH);
 k = count;
 while (k--) {
   p[k] = me_deform->mvert[verts[k]];
@@ -1540,7 +1547,7 @@ static void vgroup_fix(
 d = -dot_v3v3(norm, coord);
 /* dist = (dot_v3v3(norm, m.co) + d); */ /* UNUSED */
 moveCloserToDistanceFromPlane(
-depsgraph, scene, ob, me, i, norm, coord, d, distToBe, 
strength, cp);
+depsgraph, scene_eval, object_eval, me, i, norm, coord, d, 
distToBe, strength, cp);
   }
 }

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


[Bf-blender-cvs] [1e8b007d50f] master: Set Node Editor to use Box Select tool by default

2019-06-13 Thread William Reynish
Commit: 1e8b007d50f76362bb4067800bc1c12c9f87b1c6
Author: William Reynish
Date:   Thu Jun 13 14:41:21 2019 +0200
Branches: master
https://developer.blender.org/rB1e8b007d50f76362bb4067800bc1c12c9f87b1c6

Set Node Editor to use Box Select tool by default

This makes Shift and Ctrl work properly to extend and subtract selections.
This also moves Cut Links to Ctrl-RMB, which doesn't conflict with the 
selection tool.

===

M   release/scripts/presets/keyconfig/keymap_data/blender_default.py
M   source/blender/windowmanager/intern/wm_toolsystem.c

===

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py 
b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 72204762a22..970178faf35 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -1617,7 +1617,7 @@ def km_node_editor(params):
  {"properties": [("detach", True)]}),
 ("node.resize", {"type": 'EVT_TWEAK_L', "value": 'ANY'}, None),
 ("node.add_reroute", {"type": params.action_tweak, "value": 'ANY', 
"shift": True}, None),
-("node.links_cut", {"type": params.action_tweak, "value": 'ANY', 
"ctrl": True}, None),
+("node.links_cut", {"type": 'RIGHTMOUSE', "value": 'ANY', "ctrl": 
True}, None),
 ("node.select_link_viewer", {"type": 'LEFTMOUSE', "value": 'PRESS', 
"shift": True, "ctrl": True}, None),
 ("node.backimage_move", {"type": 'MIDDLEMOUSE', "value": 'PRESS', 
"alt": True}, None),
 ("node.backimage_zoom", {"type": 'V', "value": 'PRESS'},
diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c 
b/source/blender/windowmanager/intern/wm_toolsystem.c
index 0c916896560..fa69d750665 100644
--- a/source/blender/windowmanager/intern/wm_toolsystem.c
+++ b/source/blender/windowmanager/intern/wm_toolsystem.c
@@ -731,8 +731,7 @@ static const char *toolsystem_default_tool(const bToolKey 
*tkey)
   }
   break;
 case SPACE_NODE: {
-  /* 'Select Box' interferes with cut-links which is handy. */
-  return "builtin.select";
+  return "builtin.select_box";
 }
   }

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


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

2019-06-13 Thread Antonioya
Commit: 82c6ebee9a02293cd589ef2edf2f6f05bfb8b63b
Author: Antonioya
Date:   Thu Jun 13 13:51:58 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB82c6ebee9a02293cd589ef2edf2f6f05bfb8b63b

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] [1f1b638b403] master: Cleanup: clang-format

2019-06-13 Thread Antonioya
Commit: 1f1b638b4030bf2d3cef2142ed07ed5929df1444
Author: Antonioya
Date:   Thu Jun 13 13:43:07 2019 +0200
Branches: master
https://developer.blender.org/rB1f1b638b4030bf2d3cef2142ed07ed5929df1444

Cleanup: clang-format

===

M   source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl

===

diff --git 
a/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl 
b/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl
index 5fc0990baaa..3dc1f379f71 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl
@@ -49,8 +49,7 @@ vec4 get_blend_color(int mode, vec4 src_color, vec4 mix_color)
   src_color = vec4(vec3(src_color.rgb / src_color.a), src_color.a);
   mix_color = vec4(vec3(mix_color.rgb / mix_color.a), mix_color.a);
 
-  outcolor = vec4(mix(src_color.rgb, mix_color.rgb, mix_color.a),
-src_color.a);
+  outcolor = vec4(mix(src_color.rgb, mix_color.rgb, mix_color.a), 
src_color.a);
   break;
 }
 case MODE_OVERLAY:

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


[Bf-blender-cvs] [6f43541d8c7] master: GPencil: Reorganize blend shader

2019-06-13 Thread Antonioya
Commit: 6f43541d8c7fbdf11b86c99b00b52a3876d502f3
Author: Antonioya
Date:   Thu Jun 13 13:35:12 2019 +0200
Branches: master
https://developer.blender.org/rB6f43541d8c7fbdf11b86c99b00b52a3876d502f3

GPencil: Reorganize blend shader

Reorganize code and change some functions to mimic other softwares blend modes. 
Still need more work.

===

M   source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl

===

diff --git 
a/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl 
b/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl
index 22abf6f61c3..5fc0990baaa 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl
@@ -33,46 +33,76 @@ float overlay_color(float a, float b)
   return rtn;
 }
 
-vec4 get_blend_color(int mode, vec4 src_color, vec4 blend_color)
+vec4 get_blend_color(int mode, vec4 src_color, vec4 mix_color)
 {
-  vec4 mix_color = blend_color;
   vec4 outcolor;
 
   if (mix_color.a == 0) {
-outcolor = src_color;
-  }
-  else if (mode == MODE_OVERLAY) {
-mix_color.rgb = mix(src_color.rgb, mix_color.rgb, mix_color.a);
-outcolor.r = overlay_color(src_color.r, mix_color.r);
-outcolor.g = overlay_color(src_color.g, mix_color.g);
-outcolor.b = overlay_color(src_color.b, mix_color.b);
-outcolor.a = src_color.a;
-  }
-  else if (mode == MODE_ADD) {
-mix_color.rgb = mix(src_color.rgb, mix_color.rgb, mix_color.a);
-outcolor = src_color + mix_color;
-outcolor.a = src_color.a;
-  }
-  else if (mode == MODE_SUB) {
-mix_color.rgb = mix(src_color.rgb, mix_color.rgb, mix_color.a);
-outcolor = src_color - mix_color;
-outcolor.a = clamp(src_color.a - mix_color.a, 0.0, 1.0);
-  }
-  else if (mode == MODE_MULTIPLY) {
-mix_color.rgb = mix(src_color.rgb, mix_color.rgb, mix_color.a);
-outcolor = src_color * mix_color;
-outcolor.a = src_color.a;
-  }
-  else if (mode == MODE_DIVIDE) {
-mix_color.rgb = mix(src_color.rgb, mix_color.rgb, mix_color.a);
-outcolor = src_color / mix_color;
-outcolor.a = src_color.a;
-  }
-  else {
-outcolor = mix_color;
-outcolor.a = src_color.a;
+return src_color;
   }
 
+  switch(mode)
+  {
+case MODE_REGULAR:
+{
+  /* premult */
+  src_color = vec4(vec3(src_color.rgb / src_color.a), src_color.a);
+  mix_color = vec4(vec3(mix_color.rgb / mix_color.a), mix_color.a);
+
+  outcolor = vec4(mix(src_color.rgb, mix_color.rgb, mix_color.a),
+src_color.a);
+  break;
+}
+case MODE_OVERLAY:
+{
+  src_color = vec4(vec3(src_color.rgb / src_color.a), src_color.a);
+  mix_color = vec4(vec3(mix_color.rgb / mix_color.a), mix_color.a);
+
+  mix_color.rgb = mix(src_color.rgb, mix_color.rgb, mix_color.a);
+  outcolor.r = overlay_color(src_color.r, mix_color.r);
+  outcolor.g = overlay_color(src_color.g, mix_color.g);
+  outcolor.b = overlay_color(src_color.b, mix_color.b);
+  outcolor.a = src_color.a;
+  break;
+}
+case MODE_ADD:
+{
+  mix_color.rgb = mix(src_color.rgb, mix_color.rgb, mix_color.a);
+  outcolor = src_color + mix_color;
+  outcolor.a = src_color.a;
+  break;
+}
+case MODE_SUB:
+{
+  mix_color.rgb = mix(src_color.rgb, mix_color.rgb, mix_color.a);
+  outcolor = src_color - mix_color;
+  outcolor.a = clamp(src_color.a - mix_color.a, 0.0, 1.0);
+  break;
+}
+case MODE_MULTIPLY:
+{
+  src_color = vec4(vec3(src_color.rgb / src_color.a), src_color.a);
+  mix_color = vec4(vec3(mix_color.rgb / mix_color.a), mix_color.a);
+
+  mix_color.rgb = mix(src_color.rgb, mix_color.rgb, mix_color.a);
+  outcolor = src_color * mix_color;
+  outcolor.a = src_color.a;
+  break;
+}
+case MODE_DIVIDE:
+{
+  mix_color.rgb = mix(src_color.rgb, mix_color.rgb, mix_color.a);
+  outcolor = src_color / mix_color;
+  outcolor.a = src_color.a;
+  break;
+}
+default:
+{
+  outcolor = mix_color;
+  outcolor.a = src_color.a;
+  break;
+}
+  }
   return clamp(outcolor, 0.0, 1.0);
 }
 
@@ -110,43 +140,27 @@ void main()
   vec4 mix_color = texelFetch(blendColor, uv, 0).rgba;
   float mix_depth = texelFetch(blendDepth, uv, 0).r;
 
-  /* Default mode */
-  if (mode == MODE_REGULAR) {
-if (stroke_color.a > 0) {
-  if (mix_color.a > 0) {
-/* premult */
-stroke_color = vec4(vec3(stroke_color.rgb / stroke_color.a), 
stroke_color.a);
-mix_color = vec4(vec3(mix_color.rgb / mix_color.a), mix_color.a);
-
-FragColor = vec4(mix(stroke_color.rgb, mix_color.rgb, mix_color.a), 
stroke_color.a);
-gl_FragDepth = mix_depth;
-  }
-  else {
-FragColor = stroke_color;
-gl_FragDepth = stroke_depth;
-

[Bf-blender-cvs] [e0c98e18f9e] master: GPencil: Remove blend_opacity from shader

2019-06-13 Thread Antonioya
Commit: e0c98e18f9e808e3a5fffe191ac091343aa4887c
Author: Antonioya
Date:   Wed Jun 12 17:15:50 2019 +0200
Branches: master
https://developer.blender.org/rBe0c98e18f9e808e3a5fffe191ac091343aa4887c

GPencil: Remove blend_opacity from shader

The opacity was already used and using it in the shader only duplicate the 
blend.

===

M   source/blender/draw/engines/gpencil/gpencil_engine.c
M   source/blender/draw/engines/gpencil/gpencil_engine.h
M   source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 62b893867f3..233e2ee2deb 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -535,7 +535,6 @@ void GPENCIL_cache_init(void *vedata)
 DRW_shgroup_uniform_texture_ref(blend_shgrp, "blendDepth", 
_data.temp_depth_tx_fx);
 DRW_shgroup_uniform_int(blend_shgrp, "mode", >storage->blend_mode, 1);
 DRW_shgroup_uniform_int(blend_shgrp, "clamp_layer", 
>storage->clamp_layer, 1);
-DRW_shgroup_uniform_float(blend_shgrp, "blend_opacity", 
>storage->blend_opacity, 1);
 DRW_shgroup_uniform_int(mix_shgrp, "tonemapping", 
>storage->tonemapping, 1);
 
 /* create effects passes */
@@ -975,7 +974,6 @@ void GPENCIL_draw_scene(void *ved)
   GPU_framebuffer_clear_color_depth(fbl->temp_fb_b, clearcol, 
1.0f);
   stl->storage->blend_mode = array_elm->mode;
   stl->storage->clamp_layer = (int)array_elm->clamp_layer;
-  stl->storage->blend_opacity = array_elm->blend_opacity;
   stl->storage->tonemapping = DRW_state_do_color_management() ? 0 
: 1;
   DRW_draw_pass(psl->blend_pass);
   stl->storage->tonemapping = 0;
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h 
b/source/blender/draw/engines/gpencil/gpencil_engine.h
index a7e4c9d58d6..94a57c7f5d6 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -174,7 +174,6 @@ typedef struct GPENCIL_Storage {
 
   int blend_mode;
   int clamp_layer;
-  float blend_opacity;
 
   /* simplify settings*/
   bool simplify_fill;
diff --git 
a/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl 
b/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl
index 009f58b8789..22abf6f61c3 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl
@@ -8,7 +8,6 @@ uniform sampler2D blendColor;
 uniform sampler2D blendDepth;
 uniform int mode;
 uniform int clamp_layer;
-uniform float blend_opacity;
 uniform int tonemapping;
 
 #define ON 1
@@ -43,34 +42,34 @@ vec4 get_blend_color(int mode, vec4 src_color, vec4 
blend_color)
 outcolor = src_color;
   }
   else if (mode == MODE_OVERLAY) {
-mix_color.rgb = mix(src_color.rgb, mix_color.rgb, mix_color.a * 
blend_opacity);
+mix_color.rgb = mix(src_color.rgb, mix_color.rgb, mix_color.a);
 outcolor.r = overlay_color(src_color.r, mix_color.r);
 outcolor.g = overlay_color(src_color.g, mix_color.g);
 outcolor.b = overlay_color(src_color.b, mix_color.b);
 outcolor.a = src_color.a;
   }
   else if (mode == MODE_ADD) {
-mix_color.rgb = mix(src_color.rgb, mix_color.rgb, mix_color.a * 
blend_opacity);
+mix_color.rgb = mix(src_color.rgb, mix_color.rgb, mix_color.a);
 outcolor = src_color + mix_color;
 outcolor.a = src_color.a;
   }
   else if (mode == MODE_SUB) {
-mix_color.rgb = mix(src_color.rgb, mix_color.rgb, mix_color.a * 
blend_opacity);
+mix_color.rgb = mix(src_color.rgb, mix_color.rgb, mix_color.a);
 outcolor = src_color - mix_color;
-outcolor.a = clamp(src_color.a - (mix_color.a * blend_opacity), 0.0, 1.0);
+outcolor.a = clamp(src_color.a - mix_color.a, 0.0, 1.0);
   }
   else if (mode == MODE_MULTIPLY) {
-mix_color.rgb = mix(src_color.rgb, mix_color.rgb, mix_color.a * 
blend_opacity);
+mix_color.rgb = mix(src_color.rgb, mix_color.rgb, mix_color.a);
 outcolor = src_color * mix_color;
 outcolor.a = src_color.a;
   }
   else if (mode == MODE_DIVIDE) {
-mix_color.rgb = mix(src_color.rgb, mix_color.rgb, mix_color.a * 
blend_opacity);
+mix_color.rgb = mix(src_color.rgb, mix_color.rgb, mix_color.a);
 outcolor = src_color / mix_color;
 outcolor.a = src_color.a;
   }
   else {
-outcolor = mix_color * blend_opacity;
+outcolor = mix_color;
 outcolor.a = src_color.a;
   }

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


[Bf-blender-cvs] [dd201e3fc3d] functions: Merge branch 'master' into functions

2019-06-13 Thread Jacques Lucke
Commit: dd201e3fc3dd97489d5c314e5a1cb279deb51532
Author: Jacques Lucke
Date:   Thu Jun 13 11:31:10 2019 +0200
Branches: functions
https://developer.blender.org/rBdd201e3fc3dd97489d5c314e5a1cb279deb51532

Merge branch 'master' into functions

===



===



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


[Bf-blender-cvs] [36faf739a71] master: Particle system: Move runtime data to runtime field

2019-06-13 Thread Sergey Sharybin
Commit: 36faf739a71624b6ca10cec7233779f9eeace0bd
Author: Sergey Sharybin
Date:   Wed Jun 5 12:39:40 2019 +0200
Branches: master
https://developer.blender.org/rB36faf739a71624b6ca10cec7233779f9eeace0bd

Particle system: Move runtime data to runtime field

Allows it to be preserved during copy-on-write update when on-geometry
related update is needed.

This is a required part for T63537, where we need to preserve the entire
evaluation data when object is tagged for only RECALC_COPY_ON_WRITE.

Reviewers: brecht

Reviewed By: brecht

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

===

M   source/blender/blenkernel/BKE_particle.h
M   source/blender/blenkernel/intern/object.c
M   source/blender/blenkernel/intern/particle.c
M   source/blender/blenkernel/intern/particle_distribute.c
M   source/blender/blenkernel/intern/particle_system.c
M   source/blender/blenloader/intern/readfile.c
M   source/blender/draw/intern/draw_cache_impl_particles.c
M   source/blender/editors/physics/particle_edit.c
M   source/blender/editors/physics/particle_object.c
M   source/blender/editors/transform/transform_conversions.c
M   source/blender/makesdna/DNA_modifier_types.h
M   source/blender/makesrna/intern/rna_particle.c
M   source/blender/modifiers/intern/MOD_explode.c
M   source/blender/modifiers/intern/MOD_particleinstance.c
M   source/blender/modifiers/intern/MOD_particlesystem.c

===

diff --git a/source/blender/blenkernel/BKE_particle.h 
b/source/blender/blenkernel/BKE_particle.h
index 164dbbbf482..ca3a560286f 100644
--- a/source/blender/blenkernel/BKE_particle.h
+++ b/source/blender/blenkernel/BKE_particle.h
@@ -38,6 +38,7 @@ struct ParticleKey;
 struct ParticleSettings;
 struct ParticleSystem;
 struct ParticleSystemModifierData;
+struct ParticleSystemModifierDataRuntime;
 
 struct BVHTreeRay;
 struct BVHTreeRayHit;
@@ -608,6 +609,13 @@ float psys_get_current_display_percentage(struct 
ParticleSystem *psys,
 #define DMCACHE_NOTFOUND -1
 #define DMCACHE_ISCHILD -2
 
+/*  Particle system modifier helpers.   */
+
+struct Mesh *BKE_particle_modifier_mesh_final_get(struct 
ParticleSystemModifierData *psmd);
+struct Mesh *BKE_particle_modifier_mesh_original_get(struct 
ParticleSystemModifierData *psmd);
+struct ParticleSystemModifierDataRuntime *BKE_particle_modifier_runtime_ensure(
+struct ParticleSystemModifierData *psmd);
+
 /*  Depsgraph evaluation  */
 
 struct Depsgraph;
diff --git a/source/blender/blenkernel/intern/object.c 
b/source/blender/blenkernel/intern/object.c
index 2a66edc8d42..e74b2b0f671 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -497,12 +497,13 @@ void BKE_object_free_caches(Object *object)
   for (md = object->modifiers.first; md != NULL; md = md->next) {
 if (md->type == eModifierType_ParticleSystem) {
   ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md;
-  if (psmd->mesh_final) {
-BKE_id_free(NULL, psmd->mesh_final);
-psmd->mesh_final = NULL;
-if (psmd->mesh_original) {
-  BKE_id_free(NULL, psmd->mesh_original);
-  psmd->mesh_original = NULL;
+  ParticleSystemModifierDataRuntime *psmd_runtime = 
BKE_particle_modifier_runtime_ensure(psmd);
+  if (psmd_runtime->mesh_final) {
+BKE_id_free(NULL, psmd_runtime->mesh_final);
+psmd_runtime->mesh_final = NULL;
+if (psmd_runtime->mesh_original) {
+  BKE_id_free(NULL, psmd_runtime->mesh_original);
+  psmd_runtime->mesh_original = NULL;
 }
 psmd->flag |= eParticleSystemFlag_file_loaded;
 update_flag |= ID_RECALC_GEOMETRY;
diff --git a/source/blender/blenkernel/intern/particle.c 
b/source/blender/blenkernel/intern/particle.c
index 13649eaf096..61ee5685451 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -1889,7 +1889,8 @@ void psys_particle_on_emitter(ParticleSystemModifierData 
*psmd,
   float vtan[3],
   float orco[3])
 {
-  if (psmd && psmd->mesh_final) {
+  Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd);
+  if (psmd && mesh_final) {
 if (psmd->psys->part->distr == PART_DISTR_GRID && psmd->psys->part->from 
!= PART_FROM_VERT) {
   if (vec) {
 copy_v3_v3(vec, fuv);
@@ -1902,7 +1903,7 @@ void psys_particle_on_emitter(ParticleSystemModifierData 
*psmd,
 }
 /* we cant use the num_dmcache */
 psys_particle_on_dm(
-psmd->mesh_final, from, index, index_dmcache, fuv, foffset, vec, nor, 
utan, vtan, orco);
+mesh_final, from, index, index_dmcache, fuv, foffset, vec, nor, utan, 
vtan, orco);
   }
   else {
 psys_particle_on_shape(from, index, fuv, vec, nor, utan, vtan, orco);
@@ 

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

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

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] [3005b71b266] sybren-usd-experiments: Support instanced collections

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

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] [27537daee1b] master: Clear Datablocks Preview: add some more generic options.

2019-06-13 Thread Bastien Montagne
Commit: 27537daee1b62aab0fb0d01b89b7d2c044e796cd
Author: Bastien Montagne
Date:   Thu Jun 13 11:10:17 2019 +0200
Branches: master
https://developer.blender.org/rB27537daee1b62aab0fb0d01b89b7d2c044e796cd

Clear Datablocks Preview: add some more generic options.

Sometimes one may want to nuke all previews altogether, running the
operator for all eight individual ID types would be tedious then...

===

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

===

diff --git a/source/blender/windowmanager/intern/wm_operators.c 
b/source/blender/windowmanager/intern/wm_operators.c
index 31205ab11f4..63ca46e05c6 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -3353,6 +3353,22 @@ static void WM_OT_previews_ensure(wmOperatorType *ot)
 
 /* Only types supporting previews currently. */
 static const EnumPropertyItem preview_id_type_items[] = {
+{FILTER_ID_SCE | FILTER_ID_GR | FILTER_ID_OB | FILTER_ID_MA | FILTER_ID_LA 
| FILTER_ID_WO |
+ FILTER_ID_TE | FILTER_ID_IM,
+ "ALL",
+ 0,
+ "All Types",
+ ""},
+{FILTER_ID_SCE | FILTER_ID_GR | FILTER_ID_OB,
+ "GEOMETRY",
+ 0,
+ "All Geometry Types",
+ "Clear previews for scenes, collections and objects"},
+{FILTER_ID_MA | FILTER_ID_LA | FILTER_ID_WO | FILTER_ID_TE | FILTER_ID_IM,
+ "SHADING",
+ 0,
+ "All Shading Types",
+ "Clear previews for materiasl, lights, worlds, textures and images"},
 {FILTER_ID_SCE, "SCENE", 0, "Scenes", ""},
 {FILTER_ID_GR, "GROUP", 0, "Groups", ""},
 {FILTER_ID_OB, "OBJECT", 0, "Objects", ""},

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


[Bf-blender-cvs] [8556b0da70a] master: Fix T65034: Viewing material calls frame update handler

2019-06-13 Thread Sergey Sharybin
Commit: 8556b0da70ac5fc0c4530cc9de9238ecdf0ec678
Author: Sergey Sharybin
Date:   Wed Jun 12 17:50:58 2019 +0200
Branches: master
https://developer.blender.org/rB8556b0da70ac5fc0c4530cc9de9238ecdf0ec678

Fix T65034: Viewing material calls frame update handler

Use lower level dependency graph evaluation which doesn't run any handlers,
doesn't touch sound system, doesn't inform image editors about changes.

Should probably move such evaluation steps to a helper function in DEG module,
but that is more like a cleanup.

Reviewers: brecht

Reviewed By: brecht

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

===

M   source/blender/render/intern/source/external_engine.c

===

diff --git a/source/blender/render/intern/source/external_engine.c 
b/source/blender/render/intern/source/external_engine.c
index a41f7bbe5fc..83d857211d0 100644
--- a/source/blender/render/intern/source/external_engine.c
+++ b/source/blender/render/intern/source/external_engine.c
@@ -510,7 +510,16 @@ static void engine_depsgraph_init(RenderEngine *engine, 
ViewLayer *view_layer)
   engine->depsgraph = DEG_graph_new(scene, view_layer, DAG_EVAL_RENDER);
   DEG_debug_name_set(engine->depsgraph, "RENDER");
 
-  BKE_scene_graph_update_for_newframe(engine->depsgraph, bmain);
+  if (engine->re->r.scemode & R_BUTS_PREVIEW) {
+Depsgraph *depsgraph = engine->depsgraph;
+DEG_graph_relations_update(depsgraph, bmain, scene, view_layer);
+DEG_evaluate_on_framechange(bmain, depsgraph, CFRA);
+DEG_ids_check_recalc(bmain, depsgraph, scene, view_layer, true);
+DEG_ids_clear_recalc(bmain, depsgraph);
+  }
+  else {
+BKE_scene_graph_update_for_newframe(engine->depsgraph, bmain);
+  }
 }
 
 static void engine_depsgraph_free(RenderEngine *engine)

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


[Bf-blender-cvs] [d63438e4d16] master: Cleanup: correct wireframe xray flag name

2019-06-13 Thread Campbell Barton
Commit: d63438e4d167149e9aa2ed958e979ea0fc534793
Author: Campbell Barton
Date:   Thu Jun 13 17:33:51 2019 +1000
Branches: master
https://developer.blender.org/rBd63438e4d167149e9aa2ed958e979ea0fc534793

Cleanup: correct wireframe xray flag name

Revert part of d56c0a0a6affcdfd7335c

===

M   source/blender/blenkernel/intern/screen.c
M   source/blender/blenloader/intern/versioning_280.c
M   source/blender/editors/include/ED_view3d.h
M   source/blender/editors/space_view3d/view3d_edit.c
M   source/blender/makesdna/DNA_view3d_types.h
M   source/blender/makesrna/intern/rna_space.c

===

diff --git a/source/blender/blenkernel/intern/screen.c 
b/source/blender/blenkernel/intern/screen.c
index 3ff8b6ff18c..86fec1ee754 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -839,7 +839,7 @@ void BKE_screen_view3d_shading_init(View3DShading *shading)
 
   shading->type = OB_SOLID;
   shading->prev_type = OB_SOLID;
-  shading->flag = V3D_SHADING_SPECULAR_HIGHLIGHT | V3D_SHADING_XRAY_BONE;
+  shading->flag = V3D_SHADING_SPECULAR_HIGHLIGHT | V3D_SHADING_XRAY_WIREFRAME;
   shading->light = V3D_LIGHTING_STUDIO;
   shading->shadow_intensity = 0.5f;
   shading->xray_alpha = 0.5f;
diff --git a/source/blender/blenloader/intern/versioning_280.c 
b/source/blender/blenloader/intern/versioning_280.c
index b11de24ad67..4b55364f0b1 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -2354,7 +2354,7 @@ void blo_do_versions_280(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
   for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
 if (sl->spacetype == SPACE_VIEW3D) {
   View3D *v3d = (View3D *)sl;
-  v3d->shading.flag |= V3D_SHADING_XRAY_BONE;
+  v3d->shading.flag |= V3D_SHADING_XRAY_WIREFRAME;
 }
   }
 }
diff --git a/source/blender/editors/include/ED_view3d.h 
b/source/blender/editors/include/ED_view3d.h
index 5ce9133a531..751f71cc53b 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -701,7 +701,7 @@ void ED_view3d_shade_update(struct Main *bmain, struct 
View3D *v3d, struct ScrAr
 #define XRAY_ALPHA(v3d) \
   (((v3d)->shading.type == OB_WIRE) ? (v3d)->shading.xray_alpha_wire : 
(v3d)->shading.xray_alpha)
 #define XRAY_FLAG(v3d) \
-  (((v3d)->shading.type == OB_WIRE) ? V3D_SHADING_XRAY_BONE : V3D_SHADING_XRAY)
+  (((v3d)->shading.type == OB_WIRE) ? V3D_SHADING_XRAY_WIREFRAME : 
V3D_SHADING_XRAY)
 #define XRAY_FLAG_ENABLED(v3d) (((v3d)->shading.flag & XRAY_FLAG(v3d)) != 0)
 #define XRAY_ENABLED(v3d) (XRAY_FLAG_ENABLED(v3d) && (XRAY_ALPHA(v3d) < 1.0f))
 #define XRAY_ACTIVE(v3d) (XRAY_ENABLED(v3d) && ((v3d)->shading.type < 
OB_MATERIAL))
diff --git a/source/blender/editors/space_view3d/view3d_edit.c 
b/source/blender/editors/space_view3d/view3d_edit.c
index 1ee572211c0..6e12091cf75 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -5204,7 +5204,7 @@ static int toggle_xray_exec(bContext *C, wmOperator *op)
   ELEM(v3d->shading.type, OB_WIRE, OB_SOLID));
 
 if (v3d->shading.type == OB_WIRE) {
-  v3d->shading.flag ^= V3D_SHADING_XRAY_BONE;
+  v3d->shading.flag ^= V3D_SHADING_XRAY_WIREFRAME;
 }
 else {
   v3d->shading.flag ^= V3D_SHADING_XRAY;
diff --git a/source/blender/makesdna/DNA_view3d_types.h 
b/source/blender/makesdna/DNA_view3d_types.h
index 0170b27e15f..31ffb3efebd 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -419,7 +419,7 @@ enum {
   V3D_SHADING_CAVITY = (1 << 5),
   V3D_SHADING_MATCAP_FLIP_X = (1 << 6),
   V3D_SHADING_SCENE_WORLD = (1 << 7),
-  V3D_SHADING_XRAY_BONE = (1 << 8),
+  V3D_SHADING_XRAY_WIREFRAME = (1 << 8),
   V3D_SHADING_WORLD_ORIENTATION = (1 << 9),
   V3D_SHADING_BACKFACE_CULLING = (1 << 10),
   V3D_SHADING_DEPTH_OF_FIELD = (1 << 11),
diff --git a/source/blender/makesrna/intern/rna_space.c 
b/source/blender/makesrna/intern/rna_space.c
index 84955c69ee0..f592f607f97 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -3141,7 +3141,7 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna)
   RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 
   prop = RNA_def_property(srna, "show_xray_wireframe", PROP_BOOLEAN, 
PROP_NONE);
-  RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_XRAY_BONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "flag", 
V3D_SHADING_XRAY_WIREFRAME);
   RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
   RNA_def_property_ui_text(prop, "Show X-Ray", "Show whole scene transparent");