* Merging trunk up to r38981.

* Fixing a minor issue in a previous commit.
This commit is contained in:
2011-08-03 12:44:52 +00:00
40 changed files with 500 additions and 286 deletions

View File

@@ -52,6 +52,8 @@ void fdrawXORcirc(float xofs, float yofs, float rad);
/* glStipple defines */
extern unsigned char stipple_halftone[128];
extern unsigned char stipple_quarttone[128];
extern unsigned char stipple_diag_stripes_pos[128];
extern unsigned char stipple_diag_stripes_neg[128];
/**
* Draw a lined (non-looping) arc with the given

View File

@@ -148,6 +148,7 @@ void BIF_selectOrientation(void);
#define P_ALIGN_SNAP (P_GEO_SNAP|(1 << 5))
#define P_CONSTRAINT (1 << 6)
#define P_OPTIONS (1 << 7)
#define P_CORRECT_UV (1 << 8)
void Transform_Properties(struct wmOperatorType *ot, int flags);

View File

@@ -92,6 +92,44 @@ GLubyte stipple_quarttone[128] = {
136,136,136,136,0,0,0,0,34,34,34,34,0,0,0,0};
GLubyte stipple_diag_stripes_pos[128] = {
0x00, 0xff, 0x00, 0xff, 0x01, 0xfe, 0x01, 0xfe,
0x03, 0xfc, 0x03, 0xfc, 0x07, 0xf8, 0x07, 0xf8,
0x0f, 0xf0, 0x0f, 0xf0, 0x1f, 0xe0, 0x1f, 0xe0,
0x3f, 0xc0, 0x3f, 0xc0, 0x7f, 0x80, 0x7f, 0x80,
0xff, 0x00, 0xff, 0x00, 0xfe, 0x01, 0xfe, 0x01,
0xfc, 0x03, 0xfc, 0x03, 0xf8, 0x07, 0xf8, 0x07,
0xf0, 0x0f, 0xf0, 0x0f, 0xe0, 0x1f, 0xe0, 0x1f,
0xc0, 0x3f, 0xc0, 0x3f, 0x80, 0x7f, 0x80, 0x7f,
0x00, 0xff, 0x00, 0xff, 0x01, 0xfe, 0x01, 0xfe,
0x03, 0xfc, 0x03, 0xfc, 0x07, 0xf8, 0x07, 0xf8,
0x0f, 0xf0, 0x0f, 0xf0, 0x1f, 0xe0, 0x1f, 0xe0,
0x3f, 0xc0, 0x3f, 0xc0, 0x7f, 0x80, 0x7f, 0x80,
0xff, 0x00, 0xff, 0x00, 0xfe, 0x01, 0xfe, 0x01,
0xfc, 0x03, 0xfc, 0x03, 0xf8, 0x07, 0xf8, 0x07,
0xf0, 0x0f, 0xf0, 0x0f, 0xe0, 0x1f, 0xe0, 0x1f,
0xc0, 0x3f, 0xc0, 0x3f, 0x80, 0x7f, 0x80, 0x7f};
GLubyte stipple_diag_stripes_neg[128] = {
0xff, 0x00, 0xff, 0x00, 0xfe, 0x01, 0xfe, 0x01,
0xfc, 0x03, 0xfc, 0x03, 0xf8, 0x07, 0xf8, 0x07,
0xf0, 0x0f, 0xf0, 0x0f, 0xe0, 0x1f, 0xe0, 0x1f,
0xc0, 0x3f, 0xc0, 0x3f, 0x80, 0x7f, 0x80, 0x7f,
0x00, 0xff, 0x00, 0xff, 0x01, 0xfe, 0x01, 0xfe,
0x03, 0xfc, 0x03, 0xfc, 0x07, 0xf8, 0x07, 0xf8,
0x0f, 0xf0, 0x0f, 0xf0, 0x1f, 0xe0, 0x1f, 0xe0,
0x3f, 0xc0, 0x3f, 0xc0, 0x7f, 0x80, 0x7f, 0x80,
0xff, 0x00, 0xff, 0x00, 0xfe, 0x01, 0xfe, 0x01,
0xfc, 0x03, 0xfc, 0x03, 0xf8, 0x07, 0xf8, 0x07,
0xf0, 0x0f, 0xf0, 0x0f, 0xe0, 0x1f, 0xe0, 0x1f,
0xc0, 0x3f, 0xc0, 0x3f, 0x80, 0x7f, 0x80, 0x7f,
0x00, 0xff, 0x00, 0xff, 0x01, 0xfe, 0x01, 0xfe,
0x03, 0xfc, 0x03, 0xfc, 0x07, 0xf8, 0x07, 0xf8,
0x0f, 0xf0, 0x0f, 0xf0, 0x1f, 0xe0, 0x1f, 0xe0,
0x3f, 0xc0, 0x3f, 0xc0, 0x7f, 0x80, 0x7f, 0x80};
void fdrawbezier(float vec[4][3])
{
float dist;

View File

@@ -452,14 +452,10 @@ static int view_ndof_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
wmNDOFMotionData* ndof = (wmNDOFMotionData*) event->customdata;
float dt = ndof->dt > 0.25f ? 0.0125f : ndof->dt;
/* this is probably the first event for this motion, so set dt to something reasonable
* TODO: replace such guesswork with a flag or field from the NDOF manager
*/
float dt = ndof->dt;
/* tune these until it feels right */
const float zoom_sensitivity = 0.5f;
const float pan_sensitivity = 300.f;
const float zoom_sensitivity = 0.5f; // 50% per second (I think)
const float pan_sensitivity = 300.f; // screen pixels per second
float pan_x = pan_sensitivity * dt * ndof->tvec[0] / sima->zoom;
float pan_y = pan_sensitivity * dt * ndof->tvec[1] / sima->zoom;

View File

@@ -719,7 +719,8 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor
{
Speaker *spk= (Speaker *)id;
outliner_add_element(soops, &te->subtree, spk->adt, te, TSE_ANIM_DATA, 0);
if(spk->adt)
outliner_add_element(soops, &te->subtree, spk, te, TSE_ANIM_DATA, 0);
}
break;
case ID_WO:

View File

@@ -640,6 +640,25 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline
/* draw sound wave */
if(seq->type == SEQ_SOUND) drawseqwave(scene, seq, x1, y1, x2, y2, (ar->v2d.cur.xmax - ar->v2d.cur.xmin)/ar->winx);
/* draw lock */
if(seq->flag & SEQ_LOCK) {
glEnable(GL_POLYGON_STIPPLE);
glEnable(GL_BLEND);
/* light stripes */
glColor4ub(255, 255, 255, 32);
glPolygonStipple(stipple_diag_stripes_pos);
glRectf(x1, y1, x2, y2);
/* dark stripes */
glColor4ub(0, 0, 0, 32);
glPolygonStipple(stipple_diag_stripes_neg);
glRectf(x1, y1, x2, y2);
glDisable(GL_POLYGON_STIPPLE);
glDisable(GL_BLEND);
}
get_seq_color3ubv(scene, seq, col);
if (G.moving && (seq->flag & SELECT)) {
if(seq->flag & SEQ_OVERLAP) {

View File

@@ -1190,7 +1190,7 @@ int ED_view3d_lock(RegionView3D *rv3d)
return TRUE;
}
/* dont set windows active in in here, is used by renderwin too */
/* dont set windows active in here, is used by renderwin too */
void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d)
{
if(rv3d->persp==RV3D_CAMOB) { /* obs/camera */

View File

@@ -4264,7 +4264,7 @@ static int createSlideVerts(TransInfo *t)
/* UV correction vars */
GHash **uvarray= NULL;
SlideData *sld = MEM_callocN(sizeof(*sld), "sld");
int uvlay_tot= CustomData_number_of_layers(&em->fdata, CD_MTFACE);
const int uvlay_tot= (t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) ? CustomData_number_of_layers(&em->fdata, CD_MTFACE) : 0;
int uvlay_idx;
TransDataSlideUv *slideuvs=NULL, *suv=NULL, *suv_last=NULL;
RegionView3D *v3d = t->ar ? t->ar->regiondata : NULL; /* background mode support */
@@ -4636,7 +4636,7 @@ static int createSlideVerts(TransInfo *t)
sld->end[0] = (int) end[0];
sld->end[1] = (int) end[1];
if (uvlay_tot) { // XXX && (scene->toolsettings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT)) {
if (uvlay_tot) {
int maxnum = 0;
uvarray = MEM_callocN( uvlay_tot * sizeof(GHash *), "SlideUVs Array");
@@ -4826,8 +4826,6 @@ void initEdgeSlide(TransInfo *t)
int doEdgeSlide(TransInfo *t, float perc)
{
Mesh *me= t->obedit->data;
EditMesh *em = me->edit_mesh;
SlideData *sld = t->customData;
EditVert *ev, *nearest = sld->nearest;
EditVert *centerVert, *upVert, *downVert;
@@ -4838,7 +4836,7 @@ int doEdgeSlide(TransInfo *t, float perc)
int prop=1, flip=0;
/* UV correction vars */
GHash **uvarray= sld->uvhash;
int uvlay_tot= CustomData_number_of_layers(&em->fdata, CD_MTFACE);
const int uvlay_tot= sld->uvlay_tot;
int uvlay_idx;
TransDataSlideUv *suv;
float uv_tmp[2];
@@ -4864,7 +4862,7 @@ int doEdgeSlide(TransInfo *t, float perc)
tempev = editedge_getOtherVert((perc>=0)?tempsv->up:tempsv->down, ev);
interp_v3_v3v3(ev->co, tempsv->origvert.co, tempev->co, fabs(perc));
if (uvlay_tot) { // XXX scene->toolsettings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) {
if (uvlay_tot) {
for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) {
suv = BLI_ghash_lookup( uvarray[uvlay_idx], ev );
if (suv && suv->fuv_list && suv->uv_up && suv->uv_down) {
@@ -4894,7 +4892,7 @@ int doEdgeSlide(TransInfo *t, float perc)
if(newlen < 0.0f) {newlen = 0.0;}
if(flip == 0) {
interp_v3_v3v3(ev->co, editedge_getOtherVert(tempsv->down,ev)->co, editedge_getOtherVert(tempsv->up,ev)->co, fabs(newlen));
if (uvlay_tot) { // XXX scene->toolsettings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) {
if (uvlay_tot) {
/* dont do anything if no UVs */
for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) {
suv = BLI_ghash_lookup( uvarray[uvlay_idx], ev );
@@ -4911,7 +4909,7 @@ int doEdgeSlide(TransInfo *t, float perc)
} else{
interp_v3_v3v3(ev->co, editedge_getOtherVert(tempsv->up,ev)->co, editedge_getOtherVert(tempsv->down,ev)->co, fabs(newlen));
if (uvlay_tot) { // XXX scene->toolsettings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) {
if (uvlay_tot) {
/* dont do anything if no UVs */
for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) {
suv = BLI_ghash_lookup( uvarray[uvlay_idx], ev );

View File

@@ -1037,6 +1037,22 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
t->options |= CTX_NO_PET;
}
}
/* initialize UV transform from */
if (RNA_struct_find_property(op->ptr, "correct_uv")) {
if(RNA_property_is_set(op->ptr, "correct_uv")) {
if(RNA_boolean_get(op->ptr, "correct_uv")) {
t->settings->uvcalc_flag |= UVCALC_TRANSFORM_CORRECT;
}
else {
t->settings->uvcalc_flag &= ~UVCALC_TRANSFORM_CORRECT;
}
}
else {
RNA_boolean_set(op->ptr, "correct_uv", t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT);
}
}
}
else if(t->spacetype==SPACE_IMAGE)
{

View File

@@ -360,11 +360,17 @@ static int transform_modal(bContext *C, wmOperator *op, wmEvent *event)
TransInfo *t = op->customdata;
#if 0
// stable 2D mouse coords map to different 3D coords while the 3D mouse is active
// in other words, 2D deltas are no longer good enough!
// disable until individual 'transformers' behave better
if (event->type == NDOF_MOTION)
{
/* puts("transform_modal: passing through NDOF_MOTION"); */
return OPERATOR_PASS_THROUGH;
}
#endif
/* XXX insert keys are called here, and require context */
t->context= C;
@@ -502,6 +508,11 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
RNA_def_boolean(ot->srna, "texture_space", 0, "Edit Object data texture space", "");
}
if (flags & P_CORRECT_UV)
{
RNA_def_boolean(ot->srna, "correct_uv", 0, "Correct UV coords when transforming", "");
}
// Add confirm method all the time. At the end because it's not really that important and should be hidden only in log, not in keymap edit
/*prop =*/ RNA_def_boolean(ot->srna, "release_confirm", 0, "Confirm on Release", "Always confirm operation when releasing button");
//RNA_def_property_flag(prop, PROP_HIDDEN);
@@ -749,7 +760,7 @@ void TRANSFORM_OT_edge_slide(struct wmOperatorType *ot)
RNA_def_float_factor(ot->srna, "value", 0, -1.0f, 1.0f, "Factor", "", -1.0f, 1.0f);
Transform_Properties(ot, P_MIRROR|P_SNAP);
Transform_Properties(ot, P_MIRROR|P_SNAP|P_CORRECT_UV);
}
void TRANSFORM_OT_edge_crease(struct wmOperatorType *ot)

View File

@@ -601,6 +601,9 @@ extern UserDef U; /* from blenkernel blender.c */
/* actually... users probably don't care about what the mode
is called, just that it feels right */
#define NDOF_ORBIT_INVERT_AXES (1 << 6)
/* zoom is up/down if this flag is set (otherwise forward/backward) */
#define NDOF_ZOOM_UPDOWN (1 << 7)
#define NDOF_INVERT_ZOOM (1 << 8)
#ifdef __cplusplus

View File

@@ -3291,7 +3291,7 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "r.cfra");
RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
RNA_def_property_int_funcs(prop, NULL, "rna_Scene_current_frame_set", NULL);
RNA_def_property_ui_text(prop, "Current Frame", "Current Frame");
RNA_def_property_ui_text(prop, "Current Frame", "Current Frame, to update animation data from python frame_set() instead");
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, NC_SCENE|ND_FRAME, "rna_Scene_frame_update");

View File

@@ -730,7 +730,7 @@ static void atm_tile(RenderPart *pa, RenderLayer *rl)
if(zpass==NULL) return;
/* check for at least one sun lamp that its atmosphere flag is is enabled */
/* check for at least one sun lamp that its atmosphere flag is enabled */
for(go=R.lights.first; go; go= go->next) {
lar= go->lampren;
if(lar->type==LA_SUN && lar->sunsky && (lar->sunsky->effect_type & LA_SUN_EFFECT_AP))

View File

@@ -2324,12 +2324,27 @@ static void attach_ndof_data(wmEvent* event, const GHOST_TEventNDOFMotionData* g
const float s = U.ndof_sensitivity;
data->tvec[0]= s * ghost->tx;
data->tvec[1]= s * ghost->ty;
data->tvec[2]= s * ghost->tz;
data->rvec[0]= s * ghost->rx;
data->rvec[1]= s * ghost->ry;
data->rvec[2]= s * ghost->rz;
if (U.ndof_flag & NDOF_ZOOM_UPDOWN)
{
// swap Y and Z
data->tvec[1]= s * ghost->tz;
data->tvec[2]= s * ghost->ty;
// should this affect rotation also?
// initial guess is 'yes', but get user feedback immediately!
data->rvec[1]= s * ghost->rz;
data->rvec[2]= s * ghost->ry;
}
else
{
data->tvec[1]= s * ghost->ty;
data->tvec[2]= s * ghost->tz;
data->rvec[1]= s * ghost->ry;
data->rvec[2]= s * ghost->rz;
}
data->dt = ghost->dt;