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/intern/armature.c
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/intern/armature.c')
-rw-r--r--source/blender/blenkernel/intern/armature.c14
1 files changed, 10 insertions, 4 deletions
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);