Alright, this hopefully fixes some problems with the last transform commit.
Replaced old transform call when extruding and duplicating. Added a CTX_NOPET context flag for extrude. This is done rather a bit hackishly in Transform right now, better to do it with a on/off pet flag in TransInfo and check that everywhere instead. Made sure transinfo Ext was initialised at NULL (I'm pretty sure it was in another spot, but LetterRip reported some crash leading me to believe that it might not be all the time. Better be safe than sorry). Connected PET for curves uses the real distance for the fall off calculations now.
This commit is contained in:
@@ -53,6 +53,7 @@
|
|||||||
#define CTX_NONE 0
|
#define CTX_NONE 0
|
||||||
#define CTX_TEXTURE 1
|
#define CTX_TEXTURE 1
|
||||||
#define CTX_EDGE 2
|
#define CTX_EDGE 2
|
||||||
|
#define CTX_NOPET 4
|
||||||
|
|
||||||
/* TRANSFORM PROPORTIONAL FALLOFF MODES */
|
/* TRANSFORM PROPORTIONAL FALLOFF MODES */
|
||||||
#define PROP_SHARP 0
|
#define PROP_SHARP 0
|
||||||
|
|||||||
@@ -79,6 +79,7 @@
|
|||||||
#include "BIF_poseobject.h"
|
#include "BIF_poseobject.h"
|
||||||
#include "BIF_mywindow.h"
|
#include "BIF_mywindow.h"
|
||||||
#include "BIF_editdeform.h"
|
#include "BIF_editdeform.h"
|
||||||
|
#include "BIF_transform.h"
|
||||||
|
|
||||||
#include "BDR_editobject.h"
|
#include "BDR_editobject.h"
|
||||||
#include "BDR_drawobject.h"
|
#include "BDR_drawobject.h"
|
||||||
@@ -1998,7 +1999,7 @@ void extrude_armature(void)
|
|||||||
|
|
||||||
/* Transform the endpoints */
|
/* Transform the endpoints */
|
||||||
countall();
|
countall();
|
||||||
transform('g');
|
Transform(TFM_TRANSLATION, CTX_NOPET);
|
||||||
allqueue(REDRAWBUTSEDIT, 0);
|
allqueue(REDRAWBUTSEDIT, 0);
|
||||||
allqueue(REDRAWBUTSOBJECT, 0);
|
allqueue(REDRAWBUTSOBJECT, 0);
|
||||||
allqueue(REDRAWOOPS, 0);
|
allqueue(REDRAWOOPS, 0);
|
||||||
@@ -2162,7 +2163,7 @@ void adduplicate_armature(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
transform('g');
|
Transform(TFM_TRANSLATION, CTX_NOPET);
|
||||||
allqueue(REDRAWBUTSEDIT, 0);
|
allqueue(REDRAWBUTSEDIT, 0);
|
||||||
allqueue(REDRAWBUTSOBJECT, 0);
|
allqueue(REDRAWBUTSOBJECT, 0);
|
||||||
allqueue(REDRAWOOPS, 0);
|
allqueue(REDRAWOOPS, 0);
|
||||||
|
|||||||
@@ -79,6 +79,7 @@
|
|||||||
#include "BIF_editkey.h"
|
#include "BIF_editkey.h"
|
||||||
#include "BIF_mywindow.h"
|
#include "BIF_mywindow.h"
|
||||||
#include "BIF_interface.h"
|
#include "BIF_interface.h"
|
||||||
|
#include "BIF_transform.h"
|
||||||
|
|
||||||
#include "BSE_view.h" /* For persp... */
|
#include "BSE_view.h" /* For persp... */
|
||||||
#include "BSE_edit.h"
|
#include "BSE_edit.h"
|
||||||
@@ -2792,7 +2793,7 @@ void addvert_Nurb(int mode)
|
|||||||
allqueue(REDRAWVIEW3D, 0);
|
allqueue(REDRAWVIEW3D, 0);
|
||||||
allqueue(REDRAWBUTSEDIT, 0);
|
allqueue(REDRAWBUTSEDIT, 0);
|
||||||
|
|
||||||
if(mode=='e') transform('d');
|
if(mode=='e') Transform(TFM_TRANSLATION, CTX_NOPET);
|
||||||
else while(get_mbut()&R_MOUSE) BIF_wait_for_statechange();
|
else while(get_mbut()&R_MOUSE) BIF_wait_for_statechange();
|
||||||
|
|
||||||
if(mode!='e') {
|
if(mode!='e') {
|
||||||
@@ -2829,7 +2830,7 @@ void extrude_nurb()
|
|||||||
makeDispList(G.obedit);
|
makeDispList(G.obedit);
|
||||||
BIF_undo_push("Extrude");
|
BIF_undo_push("Extrude");
|
||||||
countall();
|
countall();
|
||||||
transform('d');
|
Transform(TFM_TRANSLATION, CTX_NOPET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3057,7 +3058,7 @@ void adduplicate_nurb()
|
|||||||
adduplicateflagNurb(1);
|
adduplicateflagNurb(1);
|
||||||
|
|
||||||
countall();
|
countall();
|
||||||
transform('d');
|
Transform(TFM_TRANSLATION, CTX_NOPET);
|
||||||
}
|
}
|
||||||
|
|
||||||
void delNurb()
|
void delNurb()
|
||||||
|
|||||||
@@ -58,6 +58,7 @@
|
|||||||
#include "BIF_toolbox.h"
|
#include "BIF_toolbox.h"
|
||||||
#include "BIF_space.h"
|
#include "BIF_space.h"
|
||||||
#include "BIF_editmode_undo.h"
|
#include "BIF_editmode_undo.h"
|
||||||
|
#include "BIF_transform.h"
|
||||||
|
|
||||||
#include "BDR_editobject.h"
|
#include "BDR_editobject.h"
|
||||||
#include "BDR_editmball.h"
|
#include "BDR_editmball.h"
|
||||||
@@ -302,7 +303,7 @@ void adduplicate_mball()
|
|||||||
ml= ml->prev;
|
ml= ml->prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
transform('g');
|
Transform(TFM_TRANSLATION, CTX_NOPET);
|
||||||
allqueue(REDRAWBUTSEDIT, 0);
|
allqueue(REDRAWBUTSEDIT, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,7 @@
|
|||||||
#include "BIF_screen.h"
|
#include "BIF_screen.h"
|
||||||
#include "BIF_space.h"
|
#include "BIF_space.h"
|
||||||
#include "BIF_toolbox.h"
|
#include "BIF_toolbox.h"
|
||||||
|
#include "BIF_transform.h"
|
||||||
|
|
||||||
#include "BDR_editobject.h"
|
#include "BDR_editobject.h"
|
||||||
|
|
||||||
@@ -436,7 +437,7 @@ void adduplicate_mesh(void)
|
|||||||
|
|
||||||
waitcursor(0);
|
waitcursor(0);
|
||||||
countall();
|
countall();
|
||||||
transform('d');
|
Transform(TFM_TRANSLATION, CTX_NOPET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -561,7 +561,7 @@ void extrude_mesh(void)
|
|||||||
|
|
||||||
/* individual faces? */
|
/* individual faces? */
|
||||||
if(nr==2) {
|
if(nr==2) {
|
||||||
Transform(TFM_SHRINKFATTEN, CTX_NONE);
|
Transform(TFM_SHRINKFATTEN, CTX_NOPET);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(transmode=='n') {
|
if(transmode=='n') {
|
||||||
@@ -569,7 +569,7 @@ void extrude_mesh(void)
|
|||||||
VecSubf(nor, nor, G.obedit->obmat[3]);
|
VecSubf(nor, nor, G.obedit->obmat[3]);
|
||||||
BIF_setSingleAxisConstraint(nor, NULL);
|
BIF_setSingleAxisConstraint(nor, NULL);
|
||||||
}
|
}
|
||||||
Transform(TFM_TRANSLATION, CTX_NONE);
|
Transform(TFM_TRANSLATION, CTX_NOPET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -99,6 +99,7 @@
|
|||||||
#include "BIF_toets.h"
|
#include "BIF_toets.h"
|
||||||
#include "BIF_toolbox.h"
|
#include "BIF_toolbox.h"
|
||||||
#include "BIF_gl.h"
|
#include "BIF_gl.h"
|
||||||
|
#include "BIF_transform.h"
|
||||||
|
|
||||||
#include "BPY_extern.h"
|
#include "BPY_extern.h"
|
||||||
#include "BPY_menus.h"
|
#include "BPY_menus.h"
|
||||||
@@ -1279,13 +1280,13 @@ static void do_view3d_transformmenu(void *arg, int event)
|
|||||||
{
|
{
|
||||||
switch(event) {
|
switch(event) {
|
||||||
case 1:
|
case 1:
|
||||||
transform('g');
|
Transform(TFM_TRANSLATION, CTX_NONE);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
transform('r');
|
Transform(TFM_ROTATION, CTX_NONE);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
transform('s');
|
Transform(TFM_RESIZE, CTX_NONE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
allqueue(REDRAWVIEW3D, 0);
|
allqueue(REDRAWVIEW3D, 0);
|
||||||
|
|||||||
@@ -205,37 +205,39 @@ static void sort_trans_data(TransInfo *t)
|
|||||||
|
|
||||||
/* distance calculated from not-selected vertex to nearest selected vertex
|
/* distance calculated from not-selected vertex to nearest selected vertex
|
||||||
warning; this is loops inside loop, has minor N^2 issues, but by sorting list it is OK */
|
warning; this is loops inside loop, has minor N^2 issues, but by sorting list it is OK */
|
||||||
static void set_prop_dist(TransInfo *t)
|
static void set_prop_dist(TransInfo *t, short with_dist)
|
||||||
{
|
{
|
||||||
TransData *tob;
|
TransData *tob;
|
||||||
int a;
|
int a;
|
||||||
|
|
||||||
for(a=0, tob= t->data; a<t->total; a++, tob++) {
|
for(a=0, tob= t->data; a<t->total; a++, tob++) {
|
||||||
|
|
||||||
tob->dist= 0.0f; // init, it was mallocced
|
tob->rdist= 0.0f; // init, it was mallocced
|
||||||
|
|
||||||
if((tob->flag & TD_SELECTED)==0) {
|
if((tob->flag & TD_SELECTED)==0) {
|
||||||
TransData *td;
|
TransData *td;
|
||||||
int i;
|
int i;
|
||||||
float dist, vec[3];
|
float dist, vec[3];
|
||||||
|
|
||||||
tob->dist = -1.0f; // signal for next loop
|
tob->rdist = -1.0f; // signal for next loop
|
||||||
|
|
||||||
for (i = 0, td= t->data; i < t->total; i++, td++) {
|
for (i = 0, td= t->data; i < t->total; i++, td++) {
|
||||||
if(td->flag & TD_SELECTED) {
|
if(td->flag & TD_SELECTED) {
|
||||||
VecSubf(vec, tob->center, td->center);
|
VecSubf(vec, tob->center, td->center);
|
||||||
Mat3MulVecfl(tob->mtx, vec);
|
Mat3MulVecfl(tob->mtx, vec);
|
||||||
dist = Normalise(vec);
|
dist = Normalise(vec);
|
||||||
if (tob->dist == -1.0f) {
|
if (tob->rdist == -1.0f) {
|
||||||
tob->dist = dist;
|
tob->rdist = dist;
|
||||||
}
|
}
|
||||||
else if (dist < tob->dist) {
|
else if (dist < tob->rdist) {
|
||||||
tob->dist = dist;
|
tob->rdist = dist;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else break; // by definition transdata has selected items in beginning
|
else break; // by definition transdata has selected items in beginning
|
||||||
}
|
}
|
||||||
tob->rdist = tob->dist;
|
if (with_dist) {
|
||||||
|
tob->dist = tob->rdist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -555,7 +557,7 @@ static void calc_distanceCurveVerts(TransData *head, TransData *tail) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
td->dist = 1000000000.0f;
|
td->dist = 10000000.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
td_near = NULL;
|
td_near = NULL;
|
||||||
@@ -576,9 +578,6 @@ static void calc_distanceCurveVerts(TransData *head, TransData *tail) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* TEMPORARY
|
|
||||||
Eventually, will have to call other code to set REAL distance */
|
|
||||||
td->rdist = td->dist;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1284,6 +1283,7 @@ static void createTransData(TransInfo *t)
|
|||||||
createTransPose();
|
createTransPose();
|
||||||
}
|
}
|
||||||
else if (G.obedit) {
|
else if (G.obedit) {
|
||||||
|
t->ext = NULL;
|
||||||
if (G.obedit->type == OB_MESH) {
|
if (G.obedit->type == OB_MESH) {
|
||||||
if(t->mode==TFM_SHRINKFATTEN) vertexnormals(0);
|
if(t->mode==TFM_SHRINKFATTEN) vertexnormals(0);
|
||||||
createTransEditVerts();
|
createTransEditVerts();
|
||||||
@@ -1306,11 +1306,13 @@ static void createTransData(TransInfo *t)
|
|||||||
|
|
||||||
if(G.f & G_PROPORTIONAL) {
|
if(G.f & G_PROPORTIONAL) {
|
||||||
if (G.obedit->type==OB_CURVE) {
|
if (G.obedit->type==OB_CURVE) {
|
||||||
|
sort_trans_data(t); // makes selected become first in array
|
||||||
|
set_prop_dist(t, 0);
|
||||||
sort_trans_data_dist(t);
|
sort_trans_data_dist(t);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sort_trans_data(t); // makes selected become first in array
|
sort_trans_data(t); // makes selected become first in array
|
||||||
set_prop_dist(t);
|
set_prop_dist(t, 1);
|
||||||
sort_trans_data_dist(t);
|
sort_trans_data_dist(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1334,11 +1336,22 @@ static void createTransData(TransInfo *t)
|
|||||||
void Transform(int mode, int context)
|
void Transform(int mode, int context)
|
||||||
{
|
{
|
||||||
int ret_val = 0;
|
int ret_val = 0;
|
||||||
short pmval[2] = {0, 0}, mval[2], val;
|
short pmval[2] = {0, 0}, mval[2], val, oldprop;
|
||||||
float mati[3][3];
|
float mati[3][3];
|
||||||
unsigned short event;
|
unsigned short event;
|
||||||
char cmode = '\0';
|
char cmode = '\0';
|
||||||
|
|
||||||
|
/* STUPID HACK, but this needs fixing right now */
|
||||||
|
if (G.f & G_PROPORTIONAL)
|
||||||
|
oldprop = 1;
|
||||||
|
else
|
||||||
|
oldprop = 0;
|
||||||
|
|
||||||
|
if (context & CTX_NOPET) {
|
||||||
|
G.f &= ~G_PROPORTIONAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*joeedh -> hopefully may be what makes the old transform() constant*/
|
/*joeedh -> hopefully may be what makes the old transform() constant*/
|
||||||
/* ton: I doubt, but it doesnt harm for now. shouldnt be needed though */
|
/* ton: I doubt, but it doesnt harm for now. shouldnt be needed though */
|
||||||
areawinset(curarea->win);
|
areawinset(curarea->win);
|
||||||
@@ -1650,6 +1663,11 @@ void Transform(int mode, int context)
|
|||||||
clear_trans_object_base_flags();
|
clear_trans_object_base_flags();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (context & CTX_NOPET) {
|
||||||
|
if (oldprop)
|
||||||
|
G.f |= G_PROPORTIONAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* send events out for redraws */
|
/* send events out for redraws */
|
||||||
allqueue(REDRAWVIEW3D, 0);
|
allqueue(REDRAWVIEW3D, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user