[Bf-blender-cvs] [b65ea517eb9] blender2.8: Merge branch 'master' into blender2.8

Campbell Barton noreply at git.blender.org
Sun Apr 1 11:07:30 CEST 2018


Commit: b65ea517eb932bde950bde51979c6a3fd258efa8
Author: Campbell Barton
Date:   Sun Apr 1 11:03:25 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBb65ea517eb932bde950bde51979c6a3fd258efa8

Merge branch 'master' into blender2.8

- Undo that changes modes currently asserts,
  since undo is now screen data.

  Most likely we will change how object mode and workspaces work
  since it's not practical/maintainable at the moment.

- Removed view_layer from particle settings
  (wasn't needed and complicated undo).

===================================================================



===================================================================

diff --cc source/blender/blenfont/intern/blf_font.c
index b4ee0173010,af0c2fab7dd..07e568dd279
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@@ -1132,13 -921,9 +1132,13 @@@ static void blf_font_fill(FontBLF *font
  	font->dpi = 0;
  	font->size = 0;
  	BLI_listbase_clear(&font->cache);
 +	BLI_listbase_clear(&font->kerning_caches);
  	font->glyph_cache = NULL;
 +	font->kerning_cache = NULL;
 +#if BLF_BLUR_ENABLE
  	font->blur = 0;
 +#endif
- 	font->max_tex_size = -1;
+ 	font->tex_size_max = -1;
  
  	font->buf_info.fbuf = NULL;
  	font->buf_info.cbuf = NULL;
diff --cc source/blender/blenfont/intern/blf_glyph.c
index f5a645af5e0,60dfdae519b..6183b54ebcc
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@@ -503,21 -460,18 +506,21 @@@ void blf_glyph_render(FontBLF *font, Gl
  		glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
  
  		glBindTexture(GL_TEXTURE_2D, g->tex);
- 		glTexSubImage2D(GL_TEXTURE_2D, 0, g->xoff, g->yoff, g->width, g->height, GL_RED, GL_UNSIGNED_BYTE, g->bitmap);
 -		glTexSubImage2D(GL_TEXTURE_2D, 0, g->offset_x, g->offset_y, g->width, g->height, GL_ALPHA, GL_UNSIGNED_BYTE, g->bitmap);
 -		glPopClientAttrib();
++		glTexSubImage2D(GL_TEXTURE_2D, 0, g->offset_x, g->offset_y, g->width, g->height, GL_RED, GL_UNSIGNED_BYTE, g->bitmap);
 +
 +		glPixelStorei(GL_UNPACK_LSB_FIRST, lsb_first);
 +		glPixelStorei(GL_UNPACK_ROW_LENGTH, row_length);
 +		glPixelStorei(GL_UNPACK_ALIGNMENT, alignment);
  
- 		g->uv[0][0] = ((float)g->xoff) / ((float)gc->p2_width);
- 		g->uv[0][1] = ((float)g->yoff) / ((float)gc->p2_height);
- 		g->uv[1][0] = ((float)(g->xoff + g->width)) / ((float)gc->p2_width);
- 		g->uv[1][1] = ((float)(g->yoff + g->height)) / ((float)gc->p2_height);
+ 		g->uv[0][0] = ((float)g->offset_x) / ((float)gc->p2_width);
+ 		g->uv[0][1] = ((float)g->offset_y) / ((float)gc->p2_height);
+ 		g->uv[1][0] = ((float)(g->offset_x + g->width)) / ((float)gc->p2_width);
+ 		g->uv[1][1] = ((float)(g->offset_y + g->height)) / ((float)gc->p2_height);
  
  		/* update the x offset for the next glyph. */
- 		gc->x_offs += (int)BLI_rctf_size_x(&g->box) + gc->pad;
+ 		gc->offset_x += (int)BLI_rctf_size_x(&g->box) + gc->pad;
  
- 		gc->rem_glyphs--;
+ 		gc->glyphs_len_free--;
  		g->build_tex = 1;
  	}
  
diff --cc source/blender/blenkernel/CMakeLists.txt
index f36a9e99a64,d789671ab24..6a1c3ea883c
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@@ -194,8 -188,8 +195,9 @@@ set(SR
  	intern/tracking_solver.c
  	intern/tracking_stabilize.c
  	intern/tracking_util.c
+ 	intern/undo_system.c
  	intern/unit.c
 +	intern/workspace.c
  	intern/world.c
  	intern/writeavi.c
  	intern/writeframeserver.c
@@@ -309,8 -297,8 +311,9 @@@
  	BKE_text.h
  	BKE_texture.h
  	BKE_tracking.h
+ 	BKE_undo_system.h
  	BKE_unit.h
 +	BKE_workspace.h
  	BKE_world.h
  	BKE_writeavi.h
  	BKE_writeframeserver.h
diff --cc source/blender/blenkernel/intern/blender_undo.c
index dbfe3dee300,6b31c8c96f9..98482bcc8b1
--- a/source/blender/blenkernel/intern/blender_undo.c
+++ b/source/blender/blenkernel/intern/blender_undo.c
@@@ -51,22 -49,14 +49,15 @@@
  #include "BKE_blender_undo.h"  /* own include */
  #include "BKE_blendfile.h"
  #include "BKE_appdir.h"
- #include "BKE_brush.h"
  #include "BKE_context.h"
 -#include "BKE_depsgraph.h"
  #include "BKE_global.h"
- #include "BKE_image.h"
  #include "BKE_main.h"
- #include "RE_pipeline.h"
  
  #include "BLO_undofile.h"
- #include "BLO_readfile.h"
  #include "BLO_writefile.h"
  
 +#include "DEG_depsgraph.h"
 +
  /* -------------------------------------------------------------------- */
  
  /** \name Global Undo
diff --cc source/blender/blenkernel/intern/camera.c
index 4431ce38c23,132cbd07ac3..8c4bced1563
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@@ -48,8 -47,6 +48,7 @@@
  #include "BKE_animsys.h"
  #include "BKE_camera.h"
  #include "BKE_object.h"
- #include "BKE_global.h"
 +#include "BKE_layer.h"
  #include "BKE_library.h"
  #include "BKE_library_query.h"
  #include "BKE_library_remap.h"
diff --cc source/blender/blenkernel/intern/lattice.c
index d92d0d9edbf,4b9748133d7..c41ad78977e
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@@ -53,8 -53,8 +53,7 @@@
  #include "BKE_anim.h"
  #include "BKE_cdderivedmesh.h"
  #include "BKE_curve.h"
 -#include "BKE_depsgraph.h"
  #include "BKE_displist.h"
- #include "BKE_global.h"
  #include "BKE_key.h"
  #include "BKE_lattice.h"
  #include "BKE_library.h"
diff --cc source/blender/blenkernel/intern/mask.c
index 3256c16e2f6,b5742dbdbb7..ba5a6a25048
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@@ -51,7 -51,7 +51,7 @@@
  
  #include "BKE_animsys.h"
  #include "BKE_curve.h"
- #include "BKE_global.h"
 -#include "BKE_depsgraph.h"
++
  #include "BKE_library.h"
  #include "BKE_main.h"
  #include "BKE_mask.h"
diff --cc source/blender/blenkernel/intern/mask_evaluate.c
index 7d977463abf,e2a9691e577..61c136d2c4f
--- a/source/blender/blenkernel/intern/mask_evaluate.c
+++ b/source/blender/blenkernel/intern/mask_evaluate.c
@@@ -42,7 -42,7 +42,6 @@@
  #include "DNA_mask_types.h"
  
  #include "BKE_curve.h"
- #include "BKE_global.h"
 -#include "BKE_depsgraph.h"
  #include "BKE_mask.h"
  
  #include "DEG_depsgraph.h"
diff --cc source/blender/blenkernel/intern/particle_system.c
index b80eca0ed59,8aeeee5a1ad..8bb35dae96c
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@@ -76,9 -76,7 +76,8 @@@
  #include "BKE_effect.h"
  #include "BKE_library_query.h"
  #include "BKE_particle.h"
- #include "BKE_global.h"
  
 +#include "BKE_collection.h"
  #include "BKE_DerivedMesh.h"
  #include "BKE_object.h"
  #include "BKE_material.h"
diff --cc source/blender/blenkernel/intern/world.c
index a57fc1fe027,5736c9331bf..e87e84736c8
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@@ -33,6 -33,6 +33,7 @@@
  #include <string.h>
  #include <stdlib.h>
  #include <math.h>
++
  #include "MEM_guardedalloc.h"
  
  #include "DNA_world_types.h"
diff --cc source/blender/blenloader/intern/readfile.c
index 2b2dbb8a53b,7b51ddcce92..97d132a3e40
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@@ -6561,9 -6300,8 +6560,10 @@@ static void direct_link_windowmanager(F
  	wm->defaultconf = NULL;
  	wm->addonconf = NULL;
  	wm->userconf = NULL;
- 	
+ 	wm->undo_stack = NULL;
+ 
 +	wm->message_bus = NULL;
 +
  	BLI_listbase_clear(&wm->jobs);
  	BLI_listbase_clear(&wm->drags);
  	
diff --cc source/blender/editors/armature/editarmature_undo.c
index 36e6ec4ba7f,f27d68d0634..217de06d99b
--- a/source/blender/editors/armature/editarmature_undo.c
+++ b/source/blender/editors/armature/editarmature_undo.c
@@@ -33,12 -33,23 +33,24 @@@
  #include "MEM_guardedalloc.h"
  
  #include "BLI_math.h"
+ #include "BLI_array_utils.h"
  
  #include "BKE_context.h"
 -#include "BKE_depsgraph.h"
+ #include "BKE_undo_system.h"
+ 
++#include "DEG_depsgraph.h"
 +
  #include "ED_armature.h"
+ #include "ED_object.h"
  #include "ED_util.h"
  
+ #include "WM_types.h"
+ #include "WM_api.h"
+ 
+ /* -------------------------------------------------------------------- */
+ /** \name Undo Conversion
+  * \{ */
+ 
  typedef struct UndoArmature {
  	EditBone *act_edbone;
  	ListBase lb;
@@@ -104,9 -116,76 +117,76 @@@ static Object *editarm_object_from_cont
  	return NULL;
  }
  
- /* and this is all the undo system needs to know */
- void undo_push_armature(bContext *C, const char *name)
+ /** \} */
+ 
+ /* -------------------------------------------------------------------- */
+ /** \name Implements ED Undo System
+  * \{ */
+ 
+ typedef struct ArmatureUndoStep {
+ 	UndoStep step;
+ 	/* note: will split out into list for multi-object-editmode. */
+ 	UndoRefID_Object obedit_ref;
+ 	UndoArmature data;
+ } ArmatureUndoStep;
+ 
+ static bool armature_undosys_poll(bContext *C)
+ {
+ 	return editarm_object_from_context(C) != NULL;
+ }
+ 
+ static bool armature_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+ {
+ 	ArmatureUndoStep *us = (ArmatureUndoStep *)us_p;
+ 	us->obedit_ref.ptr = editarm_object_from_context(C);
+ 	bArmature *arm = us->obedit_ref.ptr->data;
+ 	undoarm_from_editarm(&us->data, arm);
+ 	us->step.data_size = us->data.undo_size;
+ 	return true;
+ }
+ 
+ static void armature_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UNUSED(dir))
+ {
+ 	/* TODO(campbell): undo_system: use low-level API to set mode. */
+ 	ED_object_mode_set(C, OB_MODE_EDIT);
+ 	BLI_assert(armature_undosys_poll(C));
+ 
+ 	ArmatureUndoStep *us = (ArmatureUndoStep *)us_p;
+ 	Object *obedit = us->obedit_ref.ptr;
+ 	bArmature *arm = obedit->data;
+ 	undoarm_to_editarm(&us->data, arm);
 -	DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
++	DEG_id_tag_update(&obedit->id, OB_RECALC_DATA);
+ 	WM_event_add_notifier(C, NC_GEOM | ND_DATA, NULL);
+ }
+ 
+ static void armature_undosys_step_free(UndoStep *us_p)
+ {
+ 	ArmatureUndoStep *us = (ArmatureUndoStep *)us_p;
+ 	undoarm_free_data(&us->data);
+ }
+ 
+ static void armature_undosys_foreach_ID_ref(
+         UndoStep *us_p, UndoTypeForEachIDRefFn foreach_ID_ref_fn, void *user_data)
  {
- 	// XXX solve getdata()
- 	undo_editmode_push(C, name, get_armature_edit, free_undoBones, undoBones_to_editBones, editBones_to_undoBones, NULL);
+ 	ArmatureUndoStep *us = (ArmatureUndoStep *)us_p;
+ 	foreach_ID_ref_fn(user_data, ((UndoRefID *)&us->obedit_ref));
  }
+ 
+ /* Export for ED_undo_sys. */
+ void ED_armature_undosys_type(UndoType *ut)
+ {
+ 	ut->name = "Edit Armature";
+ 	ut->poll = armature_undosys_poll;
+ 	ut->step_encode = armature_undosys_step_encode;
+ 	ut->step_decode = armature_undosys_step_decode;
+ 	ut->step_free = armature_undosys_step_free;
+ 
+ 	ut->step_foreach_ID_ref = armature_undosys_foreach_ID_ref;
+ 
+ 	ut->mode = BKE_UNDOTYPE_MODE_STORE;
+ 	ut->use_context = true;
+ 
+ 	ut->step_size = sizeof(ArmatureUndoStep);
+ }
+ 
+ /** \} */
diff --cc source/blender/editors/curve/editcurve_undo.c
index f8f96eb3bc9,1bc2d6219b9..

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list