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:
authorJoshua Leung <aligorith@gmail.com>2015-12-13 11:03:13 +0300
committerJoshua Leung <aligorith@gmail.com>2015-12-13 11:03:13 +0300
commita1f87064c4c0cd9e8eafc19c599c4ad4ccdba49f (patch)
treed016e95050f10eda7bc44e1bdfa2f7c4fc0fc024 /source/blender/editors/transform/transform_manipulator.c
parentd9ee88d126ddb59b68d2561694b522a99e4923b6 (diff)
Grease Pencil: Merge GPencil_Editing_Stage3 branch into master
This commit merges all the work done in the GPencil_Editing_Stage3 branch as of ef2aecf2db981b5344e0d14e7f074f1742b0b2f7 into master. For more details about the changes that this brings, see the WIP release notes: http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.77/GPencil
Diffstat (limited to 'source/blender/editors/transform/transform_manipulator.c')
-rw-r--r--source/blender/editors/transform/transform_manipulator.c41
1 files changed, 36 insertions, 5 deletions
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index 8131758f93c..74d27fb3068 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -37,12 +37,14 @@
#include "DNA_armature_types.h"
#include "DNA_curve_types.h"
+#include "DNA_gpencil_types.h"
#include "DNA_lattice_types.h"
#include "DNA_meta_types.h"
#include "DNA_screen_types.h"
#include "DNA_scene_types.h"
#include "DNA_view3d_types.h"
+#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
@@ -272,6 +274,8 @@ static int calc_manipulator_stats(const bContext *C)
RegionView3D *rv3d = ar->regiondata;
Base *base;
Object *ob = OBACT;
+ bGPdata *gpd = CTX_data_gpencil_data(C);
+ const bool is_gp_edit = ((gpd) && (gpd->flag & GP_DATA_STROKE_EDITMODE));
int a, totsel = 0;
/* transform widget matrix */
@@ -282,8 +286,32 @@ static int calc_manipulator_stats(const bContext *C)
/* transform widget centroid/center */
INIT_MINMAX(scene->twmin, scene->twmax);
zero_v3(scene->twcent);
-
- if (obedit) {
+
+ if (is_gp_edit) {
+ CTX_DATA_BEGIN(C, bGPDstroke *, gps, editable_gpencil_strokes)
+ {
+ /* we're only interested in selected points here... */
+ if (gps->flag & GP_STROKE_SELECT) {
+ bGPDspoint *pt;
+ int i;
+
+ /* Change selection status of all points, then make the stroke match */
+ for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
+ if (pt->flag & GP_SPOINT_SELECT) {
+ calc_tw_center(scene, &pt->x);
+ totsel++;
+ }
+ }
+ }
+ }
+ CTX_DATA_END;
+
+ /* selection center */
+ if (totsel) {
+ mul_v3_fl(scene->twcent, 1.0f / (float)totsel); /* centroid! */
+ }
+ }
+ else if (obedit) {
ob = obedit;
if ((ob->lay & v3d->lay) == 0) return 0;
@@ -546,7 +574,7 @@ static int calc_manipulator_stats(const bContext *C)
}
/* global, local or normal orientation? */
- if (ob && totsel) {
+ if (ob && totsel && !is_gp_edit) {
switch (v3d->twmode) {
@@ -1595,9 +1623,12 @@ void BIF_draw_manipulator(const bContext *C)
case V3D_AROUND_CENTER_BOUNDS:
case V3D_AROUND_ACTIVE:
{
- Object *ob;
+ bGPdata *gpd = CTX_data_gpencil_data(C);
+ Object *ob = OBACT;
+
if (((v3d->around == V3D_AROUND_ACTIVE) && (scene->obedit == NULL)) &&
- ((ob = OBACT) && !(ob->mode & OB_MODE_POSE)))
+ ((gpd == NULL) || !(gpd->flag & GP_DATA_STROKE_EDITMODE)) &&
+ (!(ob->mode & OB_MODE_POSE)))
{
copy_v3_v3(rv3d->twmat[3], ob->obmat[3]);
}