[Bf-blender-cvs] [269ceb666b0] greasepencil-edit-curve: Merge branch 'master' into greasepencil-edit-curve
Falk David
noreply at git.blender.org
Sat Sep 12 12:17:34 CEST 2020
Commit: 269ceb666b01b8cddbfb5babddf38546a41eba39
Author: Falk David
Date: Sat Sep 12 12:14:15 2020 +0200
Branches: greasepencil-edit-curve
https://developer.blender.org/rB269ceb666b01b8cddbfb5babddf38546a41eba39
Merge branch 'master' into greasepencil-edit-curve
===================================================================
===================================================================
diff --cc source/blender/blenkernel/BKE_gpencil.h
index 4ec8609831b,f1912b14e8c..518bd2a949f
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@@ -47,8 -47,8 +47,9 @@@ struct bGPDlayer
struct bGPDlayer_Mask;
struct bGPDspoint;
struct bGPDstroke;
+struct bGPDcurve;
struct bGPdata;
+ struct BlendDataReader;
#define GPENCIL_SIMPLIFY(scene) ((scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_ENABLE))
#define GPENCIL_SIMPLIFY_ONPLAY(playing) \
diff --cc source/blender/blenkernel/intern/gpencil.c
index c384088f139,03ac7e622e1..560069b1650
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@@ -111,6 -119,154 +119,161 @@@ static void greasepencil_foreach_id(ID
}
}
+ static void greasepencil_blend_write(BlendWriter *writer, ID *id, const void *id_address)
+ {
+ bGPdata *gpd = (bGPdata *)id;
+ if (gpd->id.us > 0 || BLO_write_is_undo(writer)) {
+ /* Clean up, important in undo case to reduce false detection of changed data-blocks. */
+ /* XXX not sure why the whole run-time data is not cleared in reading code,
+ * for now mimicking it here. */
+ gpd->runtime.sbuffer = NULL;
+ gpd->runtime.sbuffer_used = 0;
+ gpd->runtime.sbuffer_size = 0;
+ gpd->runtime.tot_cp_points = 0;
+
+ /* write gpd data block to file */
+ BLO_write_id_struct(writer, bGPdata, id_address, &gpd->id);
+ BKE_id_blend_write(writer, &gpd->id);
+
+ if (gpd->adt) {
+ BKE_animdata_blend_write(writer, gpd->adt);
+ }
+
+ BLO_write_pointer_array(writer, gpd->totcol, gpd->mat);
+
+ /* write grease-pencil layers to file */
+ BLO_write_struct_list(writer, bGPDlayer, &gpd->layers);
+ LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
+ /* Write mask list. */
+ BLO_write_struct_list(writer, bGPDlayer_Mask, &gpl->mask_layers);
+ /* write this layer's frames to file */
+ BLO_write_struct_list(writer, bGPDframe, &gpl->frames);
+ LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
+ /* write strokes */
+ BLO_write_struct_list(writer, bGPDstroke, &gpf->strokes);
+ LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
+ BLO_write_struct_array(writer, bGPDspoint, gps->totpoints, gps->points);
+ BLO_write_struct_array(writer, bGPDtriangle, gps->tot_triangles, gps->triangles);
+ BKE_defvert_blend_write(writer, gps->totpoints, gps->dvert);
+ }
+ }
+ }
+ }
+ }
+
+ void BKE_gpencil_blend_read_data(BlendDataReader *reader, bGPdata *gpd)
+ {
+ /* we must firstly have some grease-pencil data to link! */
+ if (gpd == NULL) {
+ return;
+ }
+
+ /* relink animdata */
+ BLO_read_data_address(reader, &gpd->adt);
+ BKE_animdata_blend_read_data(reader, gpd->adt);
+
+ /* Ensure full objectmode for linked grease pencil. */
+ if (gpd->id.lib != NULL) {
+ gpd->flag &= ~GP_DATA_STROKE_PAINTMODE;
+ gpd->flag &= ~GP_DATA_STROKE_EDITMODE;
+ gpd->flag &= ~GP_DATA_STROKE_SCULPTMODE;
+ gpd->flag &= ~GP_DATA_STROKE_WEIGHTMODE;
+ gpd->flag &= ~GP_DATA_STROKE_VERTEXMODE;
+ }
+
+ /* init stroke buffer */
+ gpd->runtime.sbuffer = NULL;
+ gpd->runtime.sbuffer_used = 0;
+ gpd->runtime.sbuffer_size = 0;
+ gpd->runtime.tot_cp_points = 0;
+
+ /* relink palettes (old palettes deprecated, only to convert old files) */
+ BLO_read_list(reader, &gpd->palettes);
+ if (gpd->palettes.first != NULL) {
+ LISTBASE_FOREACH (Palette *, palette, &gpd->palettes) {
+ BLO_read_list(reader, &palette->colors);
+ }
+ }
+
+ /* materials */
+ BLO_read_pointer_array(reader, (void **)&gpd->mat);
+
+ /* relink layers */
+ BLO_read_list(reader, &gpd->layers);
+
+ LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
+ /* relink frames */
+ BLO_read_list(reader, &gpl->frames);
+
+ BLO_read_data_address(reader, &gpl->actframe);
+
+ gpl->runtime.icon_id = 0;
+
+ /* Relink masks. */
+ BLO_read_list(reader, &gpl->mask_layers);
+
+ LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
+ /* relink strokes (and their points) */
+ BLO_read_list(reader, &gpf->strokes);
+
+ LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
+ /* relink stroke points array */
+ BLO_read_data_address(reader, &gps->points);
+ /* Relink geometry*/
+ BLO_read_data_address(reader, &gps->triangles);
+
++ /* relink stroke edit curve. */
++ BLO_read_data_address(reader, &gps->editcurve);
++ if (gps->editcurve != NULL) {
++ /* relink curve point array */
++ BLO_read_data_address(reader, &gps->editcurve->curve_points);
++ }
++
+ /* relink weight data */
+ if (gps->dvert) {
+ BLO_read_data_address(reader, &gps->dvert);
+ BKE_defvert_blend_read(reader, gps->totpoints, gps->dvert);
+ }
+ }
+ }
+ }
+ }
+
+ static void greasepencil_blend_read_data(BlendDataReader *reader, ID *id)
+ {
+ bGPdata *gpd = (bGPdata *)id;
+ BKE_gpencil_blend_read_data(reader, gpd);
+ }
+
+ static void greasepencil_blend_read_lib(BlendLibReader *reader, ID *id)
+ {
+ bGPdata *gpd = (bGPdata *)id;
+
+ /* Relink all data-lock linked by GP data-lock */
+ /* Layers */
+ LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
+ /* Layer -> Parent References */
+ BLO_read_id_address(reader, gpd->id.lib, &gpl->parent);
+ }
+
+ /* materials */
+ for (int a = 0; a < gpd->totcol; a++) {
+ BLO_read_id_address(reader, gpd->id.lib, &gpd->mat[a]);
+ }
+ }
+
+ static void greasepencil_blend_read_expand(BlendExpander *expander, ID *id)
+ {
+ bGPdata *gpd = (bGPdata *)id;
+ LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
+ BLO_expand(expander, gpl->parent);
+ }
+
+ for (int a = 0; a < gpd->totcol; a++) {
+ BLO_expand(expander, gpd->mat[a]);
+ }
+ }
+
IDTypeInfo IDType_ID_GD = {
.id_code = ID_GD,
.id_filter = FILTER_ID_GD,
diff --cc source/blender/blenkernel/intern/gpencil_geom.c
index 20b9380cfbb,a9b0eede055..2e81c5c0747
--- a/source/blender/blenkernel/intern/gpencil_geom.c
+++ b/source/blender/blenkernel/intern/gpencil_geom.c
@@@ -2430,8 -2382,12 +2412,12 @@@ bool BKE_gpencil_convert_mesh(Main *bma
pt->pressure = 1.0f;
pt->strength = 1.0f;
}
+ /* If has only 3 points subdivide. */
+ if (mp->totloop == 3) {
- BKE_gpencil_stroke_subdivide(gps_fill, 1, GP_SUBDIV_SIMPLE);
++ BKE_gpencil_stroke_subdivide(gpd, gps_fill, 1, GP_SUBDIV_SIMPLE);
+ }
- BKE_gpencil_stroke_geometry_update(gps_fill);
+ BKE_gpencil_stroke_geometry_update(gpd, gps_fill);
}
}
}
@@@ -2443,8 -2402,9 +2432,9 @@@
}
bGPDframe *gpf_stroke = BKE_gpencil_layer_frame_get(
gpl_stroke, CFRA + frame_offset, GP_GETFRAME_ADD_NEW);
+
gpencil_generate_edgeloops(
- ob_eval, gpf_stroke, stroke_mat_index, angle, thickness, offset, matrix, use_seams);
+ ob_eval, gpd, gpf_stroke, stroke_mat_index, angle, thickness, offset, matrix, use_seams);
/* Tag for recalculation */
DEG_id_tag_update(&gpd->id, ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE);
diff --cc source/blender/blenloader/intern/versioning_290.c
index 6aa7de06277,cf07e9acad3..3be814a67c1
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@@ -555,21 -576,27 +576,42 @@@ void blo_do_versions_290(FileData *fd,
}
}
+ /* Hair and PointCloud attributes. */
+ for (Hair *hair = bmain->hairs.first; hair != NULL; hair = hair->id.next) {
+ do_versions_point_attributes(&hair->pdata);
+ }
+ for (PointCloud *pointcloud = bmain->pointclouds.first; pointcloud != NULL;
+ pointcloud = pointcloud->id.next) {
+ do_versions_point_attributes(&pointcloud->pdata);
+ }
+
+ /* Show outliner mode column by default. */
+ LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
+ LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
+ LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) {
+ if (space->spacetype == SPACE_OUTLINER) {
+ SpaceOutliner *space_outliner = (SpaceOutliner *)space;
+
+ space_outliner->flag |= SO_MODE_COLUMN;
+ }
+ }
+ }
+ }
/* Keep this block, even when empty. */
+
+ /* Init grease pencil default curve resolution. */
+ if (!DNA_struct_elem_find(fd->filesdna, "bGPdata", "int", "curve_edit_resolution")) {
+ LISTBASE_FOREACH (bGPdata *, gpd, &bmain->gpencils) {
+ gpd->curve_edit_resolution = GP_DEFAULT_CURVE_RESOLUTION;
+ gpd->flag |= GP_DATA_CURVE_ADAPTIVE_RESOLUTION;
+ }
+ }
+ /* Init grease pencil curve editing error threshold. */
+ if (!DNA_struct_elem_find(fd->filesdna, "bGPdata", "float", "curve_edit_threshold")) {
+ LISTBASE_FOREACH (bGPdata *, gpd, &bmain->gpencils) {
+ gpd->curve_edit_threshold = GP_DEFAULT_CURVE_ERROR;
+ gpd->curve_edit_corner_angle = GP_DEFAULT_CURVE_EDIT_CORNER_ANGLE;
+ }
+ }
}
}
diff --cc source/blender/blenloader/intern/writefile.c
index a0245346771,b3e937a29b2..44a875cac4e
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@@ -106,28 -104,13 +104,14 @@@
#include "DNA_fileglobal_types.h"
#include "DNA_fluid_types.h"
#include "DNA_genfile.h"
- #include "DNA_gpencil_modifier_types.h"
+#include "DNA_gpencil_types.h"
- #include "DNA_hair_types.h"
- #include "DNA_key_types.h"
- #include "DNA_lattice_types.h"
- #include "DNA_layer_types.h"
- #include "DNA_light_types.h"
#include "DNA_lightprobe_types.h"
- #include "DNA_linestyle_types.h"
- #include "DNA_mask_types.h"
- #include "DNA_material_types.h"
- #include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
- #include "DNA_meta_types.h"
#include "DNA_movieclip_types.h"
- #include "DNA_node_types.h"
#include "DNA_object_force_types.h"
#include "DNA_object_types.h"
- #include "DNA_packedFile_types.h"
#include "DNA_particle_typ
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list