Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonioya <blendergit@gmail.com>2018-08-30 13:22:55 +0300
committerAntonioya <blendergit@gmail.com>2018-08-30 13:23:08 +0300
commit9a646b6a2060dbc3b2f4031f7933842c597d0716 (patch)
treec9e02dd7168547a246c11177c977311f24435a8d /source/blender/blenkernel
parent9d00b0f7963508c3f8de8eff6a376dcb085da438 (diff)
GP: New Armature modifier and tools to handle weights
This commit adds a new armature modifier for grease pencil. The deformations are done reusing the mesh deform routines. There is also a new operator in weight paint mode to help the artist to generate weights base on armatures. This operator is required because 2D animation workflow is not equal to meshes when parent an object to armatures. In the drawing engine has been added the option to handle the Fade object parameter used in armatures to see the strokes while move the bones. When rename bones, all related data of grease pencil is renamed too. This not only affect new armature code, but also layers parented and hook modifiers. Thanks @aligorith for his review and help.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_lattice.h4
-rw-r--r--source/blender/blenkernel/intern/armature.c14
-rw-r--r--source/blender/blenkernel/intern/gpencil_modifier.c7
3 files changed, 17 insertions, 8 deletions
diff --git a/source/blender/blenkernel/BKE_lattice.h b/source/blender/blenkernel/BKE_lattice.h
index e98839e3dbc..2ca6a35eec5 100644
--- a/source/blender/blenkernel/BKE_lattice.h
+++ b/source/blender/blenkernel/BKE_lattice.h
@@ -44,6 +44,7 @@ struct Scene;
struct BPoint;
struct MDeformVert;
struct Depsgraph;
+struct bGPDstroke;
void BKE_lattice_resize(struct Lattice *lt, int u, int v, int w, struct Object *ltOb);
void BKE_lattice_init(struct Lattice *lt);
@@ -73,7 +74,8 @@ void lattice_deform_verts(struct Object *laOb, struct Object *target,
void armature_deform_verts(struct Object *armOb, struct Object *target,
const struct Mesh *mesh, float (*vertexCos)[3],
float (*defMats)[3][3], int numVerts, int deformflag,
- float (*prevCos)[3], const char *defgrp_name);
+ float (*prevCos)[3], const char *defgrp_name,
+ struct bGPDstroke *gps);
float (*BKE_lattice_vertexcos_get(struct Object *ob, int *r_numVerts))[3];
void BKE_lattice_vertexcos_apply(struct Object *ob, float (*vertexCos)[3]);
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 7383d80cfa8..a3f7dbe70be 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -46,6 +46,7 @@
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
#include "DNA_constraint_types.h"
+#include "DNA_gpencil_types.h"
#include "DNA_mesh_types.h"
#include "DNA_lattice_types.h"
#include "DNA_listBase.h"
@@ -970,7 +971,7 @@ static void armature_bbone_defmats_cb(void *userdata, Link *iter, int index)
void armature_deform_verts(Object *armOb, Object *target, const Mesh * mesh, float (*vertexCos)[3],
float (*defMats)[3][3], int numVerts, int deformflag,
- float (*prevCos)[3], const char *defgrp_name)
+ float (*prevCos)[3], const char *defgrp_name, bGPDstroke *gps)
{
bPoseChanDeform *pdef_info_array;
bPoseChanDeform *pdef_info = NULL;
@@ -1024,7 +1025,7 @@ void armature_deform_verts(Object *armOb, Object *target, const Mesh * mesh, flo
/* get the def_nr for the overall armature vertex group if present */
armature_def_nr = defgroup_name_index(target, defgrp_name);
- if (ELEM(target->type, OB_MESH, OB_LATTICE)) {
+ if (ELEM(target->type, OB_MESH, OB_LATTICE, OB_GPENCIL)) {
defbase_tot = BLI_listbase_count(&target->defbase);
if (target->type == OB_MESH) {
@@ -1033,17 +1034,22 @@ void armature_deform_verts(Object *armOb, Object *target, const Mesh * mesh, flo
if (dverts)
target_totvert = me->totvert;
}
- else {
+ else if (target->type == OB_LATTICE) {
Lattice *lt = target->data;
dverts = lt->dvert;
if (dverts)
target_totvert = lt->pntsu * lt->pntsv * lt->pntsw;
}
+ else if (target->type == OB_GPENCIL) {
+ dverts = gps->dvert;
+ if (dverts)
+ target_totvert = gps->totpoints;
+ }
}
/* get a vertex-deform-index to posechannel array */
if (deformflag & ARM_DEF_VGROUP) {
- if (ELEM(target->type, OB_MESH, OB_LATTICE)) {
+ if (ELEM(target->type, OB_MESH, OB_LATTICE, OB_GPENCIL)) {
/* if we have a Mesh, only use dverts if it has them */
if (mesh) {
use_dverts = (mesh->dvert != NULL);
diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c
index 1cfbaed37fe..af82d8fa200 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -423,9 +423,10 @@ void BKE_gpencil_stroke_modifiers(Depsgraph *depsgraph, Object *ob, bGPDlayer *g
/* some modifiers could require a recalc of fill triangulation data */
if (gpd->flag & GP_DATA_STROKE_FORCE_RECALC) {
if (ELEM(md->type,
- eGpencilModifierType_Hook,
- eGpencilModifierType_Lattice,
- eGpencilModifierType_Offset))
+ eGpencilModifierType_Armature,
+ eGpencilModifierType_Hook,
+ eGpencilModifierType_Lattice,
+ eGpencilModifierType_Offset))
{
gps->flag |= GP_STROKE_RECALC_CACHES;