Merging r57605 through r57628 from trunk into soc-2013-depsgraph_mt

This commit is contained in:
Sergey Sharybin
2013-06-21 10:12:10 +00:00
38 changed files with 166 additions and 78 deletions

View File

@@ -1823,16 +1823,19 @@ DerivedMesh *CDDM_from_curve(Object *ob)
DerivedMesh *CDDM_from_curve_displist(Object *ob, ListBase *dispbase)
{
Curve *cu = (Curve *) ob->data;
DerivedMesh *dm;
CDDerivedMesh *cddm;
MVert *allvert;
MEdge *alledge;
MLoop *allloop;
MPoly *allpoly;
MLoopUV *alluv = NULL;
int totvert, totedge, totloop, totpoly;
bool use_orco_uv = (cu->flag & CU_UV_ORCO) != 0;
if (BKE_mesh_nurbs_displist_to_mdata(ob, dispbase, &allvert, &totvert, &alledge,
&totedge, &allloop, &allpoly, NULL,
&totedge, &allloop, &allpoly, (use_orco_uv) ? &alluv : NULL,
&totloop, &totpoly) != 0)
{
/* Error initializing mdata. This often happens when curve is empty */
@@ -1850,6 +1853,12 @@ DerivedMesh *CDDM_from_curve_displist(Object *ob, ListBase *dispbase)
memcpy(cddm->mloop, allloop, totloop * sizeof(MLoop));
memcpy(cddm->mpoly, allpoly, totpoly * sizeof(MPoly));
if (alluv) {
const char *uvname = "Orco";
CustomData_add_layer_named(&cddm->dm.polyData, CD_MTEXPOLY, CD_DEFAULT, NULL, totpoly, uvname);
CustomData_add_layer_named(&cddm->dm.loopData, CD_MLOOPUV, CD_ASSIGN, alluv, totloop, uvname);
}
MEM_freeN(allvert);
MEM_freeN(alledge);
MEM_freeN(allloop);

View File

@@ -1636,7 +1636,10 @@ void BKE_mesh_from_nurbs_displist(Object *ob, ListBase *dispbase, const bool use
void BKE_mesh_from_nurbs(Object *ob)
{
BKE_mesh_from_nurbs_displist(ob, &ob->disp, false);
Curve *cu = (Curve *) ob->data;
bool use_orco_uv = (cu->flag & CU_UV_ORCO) != 0;
BKE_mesh_from_nurbs_displist(ob, &ob->disp, use_orco_uv);
}
typedef struct EdgeLink {

View File

@@ -189,6 +189,8 @@ Paint *BKE_paint_get_active_from_context(const bContext *C)
return &ts->uvsculpt->paint;
else
return &ts->imapaint.paint;
default:
return &ts->imapaint.paint;
}
}
else {
@@ -238,6 +240,8 @@ PaintMode BKE_paintmode_get_active_from_context(const bContext *C)
return PAINT_SCULPT_UV;
else
return PAINT_TEXTURE_2D;
default:
return PAINT_TEXTURE_2D;
}
}
else {

View File

@@ -4171,6 +4171,8 @@ Sequence *BKE_sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoad
BKE_sequence_calc_disp(scene, seq);
if (seq_load->name[0] == '\0')
BLI_strncpy(seq_load->name, se->name, sizeof(seq_load->name));
if (seq_load->flag & SEQ_LOAD_MOVIE_SOUND) {
int start_frame_back = seq_load->start_frame;
@@ -4182,9 +4184,6 @@ Sequence *BKE_sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoad
seq_load->channel--;
}
if (seq_load->name[0] == '\0')
BLI_strncpy(seq_load->name, se->name, sizeof(seq_load->name));
/* can be NULL */
seq_load_apply(scene, seq, seq_load);

View File

@@ -60,7 +60,7 @@ typedef struct GHash {
typedef struct GHashIterator {
GHash *gh;
int curBucket;
unsigned int curBucket;
struct Entry *curEntry;
} GHashIterator;

View File

@@ -44,6 +44,8 @@
#ifdef __GNUC__
# pragma GCC diagnostic error "-Wsign-conversion"
# pragma GCC diagnostic error "-Wsign-compare"
# pragma GCC diagnostic error "-Wconversion"
#endif
const unsigned int hashsizes[] = {
@@ -152,7 +154,7 @@ bool BLI_ghash_remove(GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFr
void BLI_ghash_clear(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
{
int i;
unsigned int i;
if (keyfreefp || valfreefp) {
for (i = 0; i < gh->nbuckets; i++) {
@@ -220,7 +222,7 @@ bool BLI_ghash_haskey(GHash *gh, const void *key)
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
{
int i;
unsigned int i;
if (keyfreefp || valfreefp) {
for (i = 0; i < gh->nbuckets; i++) {
@@ -252,7 +254,7 @@ GHashIterator *BLI_ghashIterator_new(GHash *gh)
GHashIterator *ghi = MEM_mallocN(sizeof(*ghi), "ghash iterator");
ghi->gh = gh;
ghi->curEntry = NULL;
ghi->curBucket = -1;
ghi->curBucket = (unsigned int)-1;
while (!ghi->curEntry) {
ghi->curBucket++;
if (ghi->curBucket == ghi->gh->nbuckets)
@@ -265,7 +267,7 @@ void BLI_ghashIterator_init(GHashIterator *ghi, GHash *gh)
{
ghi->gh = gh;
ghi->curEntry = NULL;
ghi->curBucket = -1;
ghi->curBucket = (unsigned int)-1;
while (!ghi->curEntry) {
ghi->curBucket++;
if (ghi->curBucket == ghi->gh->nbuckets)

View File

@@ -41,6 +41,8 @@
#ifdef __GNUC__
# pragma GCC diagnostic error "-Wsign-conversion"
# pragma GCC diagnostic error "-Wsign-compare"
# pragma GCC diagnostic error "-Wconversion"
#endif
/***/
@@ -208,7 +210,7 @@ void *BLI_heap_popmin(Heap *heap)
{
void *ptr = heap->tree[0]->ptr;
BLI_assert(heap->size == 0);
BLI_assert(heap->size != 0);
heap->tree[0]->ptr = heap->freenodes;
heap->freenodes = heap->tree[0];

View File

@@ -45,6 +45,8 @@
#ifdef __GNUC__
# pragma GCC diagnostic error "-Wsign-conversion"
# pragma GCC diagnostic error "-Wsign-compare"
# pragma GCC diagnostic error "-Wconversion"
#endif
/* note: copied from BLO_blend_defs.h, don't use here because we're in BLI */
@@ -102,8 +104,8 @@ BLI_mempool *BLI_mempool_create(int esize, int totelem, int pchunk, int flag)
}
/* set the elem size */
if (esize < MEMPOOL_ELEM_SIZE_MIN) {
esize = MEMPOOL_ELEM_SIZE_MIN;
if (esize < (int)MEMPOOL_ELEM_SIZE_MIN) {
esize = (int)MEMPOOL_ELEM_SIZE_MIN;
}
if (flag & BLI_MEMPOOL_ALLOW_ITER) {

View File

@@ -562,10 +562,14 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad
RNA_string_get(&itemptr, "name", file_only);
BLI_join_dirfile(seq_load.path, sizeof(seq_load.path), dir_only, file_only);
/* Set seq_load.name, else all video/audio files get the same name! ugly! */
BLI_strncpy(seq_load.name, file_only, sizeof(seq_load.name));
seq = seq_load_func(C, ed->seqbasep, &seq_load);
if (seq) {
if (overlap == FALSE) {
if (BKE_sequence_test_overlap(ed->seqbasep, seq)) BKE_sequence_base_shuffle(ed->seqbasep, seq, scene);
if (BKE_sequence_test_overlap(ed->seqbasep, seq))
BKE_sequence_base_shuffle(ed->seqbasep, seq, scene);
}
}
}

View File

@@ -1736,12 +1736,15 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
}
/* convert flag to enum */
switch (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) {
switch (t->flag & T_PROP_EDIT_ALL) {
case T_PROP_EDIT:
proportional = PROP_EDIT_ON;
break;
case (T_PROP_EDIT | T_PROP_CONNECTED):
proportional = PROP_EDIT_CONNECTED;
break;
case T_PROP_EDIT:
proportional = PROP_EDIT_ON;
case (T_PROP_EDIT | T_PROP_PROJECTED):
proportional = PROP_EDIT_PROJECTED;
break;
default:
proportional = PROP_EDIT_OFF;
@@ -2945,7 +2948,7 @@ static void headerResize(TransInfo *t, float vec[3], char *str)
}
}
if (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) {
if (t->flag & T_PROP_EDIT_ALL) {
ofs += BLI_snprintf(str + ofs, MAX_INFO_LEN - ofs, IFACE_(" Proportional size: %.2f"), t->prop_size);
}
}
@@ -3143,7 +3146,7 @@ int Resize(TransInfo *t, const int mval[2])
/* vertices in the radius of the brush end */
/* outside the clipping area */
/* XXX HACK - dg */
if (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) {
if (t->flag & T_PROP_EDIT_ALL) {
clipUVData(t);
}
}
@@ -3663,7 +3666,7 @@ int Rotation(TransInfo *t, const int UNUSED(mval[2]))
RAD2DEGF(final), t->con.text, t->proptext);
}
if (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) {
if (t->flag & T_PROP_EDIT_ALL) {
ofs += BLI_snprintf(str + ofs, MAX_INFO_LEN - ofs, IFACE_(" Proportional size: %.2f"), t->prop_size);
}
@@ -3764,7 +3767,7 @@ int Trackball(TransInfo *t, const int UNUSED(mval[2]))
RAD2DEGF(phi[0]), RAD2DEGF(phi[1]), t->proptext);
}
if (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) {
if (t->flag & T_PROP_EDIT_ALL) {
ofs += BLI_snprintf(str + ofs, MAX_INFO_LEN - ofs, IFACE_(" Proportional size: %.2f"), t->prop_size);
}
@@ -3912,7 +3915,7 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str)
}
}
if (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) {
if (t->flag & T_PROP_EDIT_ALL) {
ofs += BLI_snprintf(str + ofs, MAX_INFO_LEN - ofs, IFACE_(" Proportional size: %.2f"), t->prop_size);
}
}
@@ -4019,7 +4022,7 @@ int Translation(TransInfo *t, const int UNUSED(mval[2]))
/* vertices in the radius of the brush end */
/* outside the clipping area */
/* XXX HACK - dg */
if (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) {
if (t->flag & T_PROP_EDIT_ALL) {
clipUVData(t);
}
}

View File

@@ -394,6 +394,8 @@ typedef struct TransInfo {
#define T_PROP_EDIT (1 << 11)
#define T_PROP_CONNECTED (1 << 12)
#define T_PROP_PROJECTED (1 << 25)
#define T_PROP_EDIT_ALL (T_PROP_EDIT | T_PROP_CONNECTED | T_PROP_PROJECTED)
#define T_V3D_ALIGN (1 << 14)
/* for 2d views like uv or ipo */

View File

@@ -201,6 +201,17 @@ static void set_prop_dist(TransInfo *t, const bool with_dist)
TransData *tob;
int a;
float _proj_vec[3];
const float *proj_vec = NULL;
if (t->flag & T_PROP_PROJECTED) {
if (t->spacetype == SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW) {
RegionView3D *rv3d = t->ar->regiondata;
normalize_v3_v3(_proj_vec, rv3d->viewinv[2]);
proj_vec = _proj_vec;
}
}
for (a = 0, tob = t->data; a < t->total; a++, tob++) {
tob->rdist = 0.0f; // init, it was mallocced
@@ -216,6 +227,13 @@ static void set_prop_dist(TransInfo *t, const bool with_dist)
if (td->flag & TD_SELECTED) {
sub_v3_v3v3(vec, tob->center, td->center);
mul_m3_v3(tob->mtx, vec);
if (proj_vec) {
float vec_p[3];
project_v3_v3v3(vec_p, vec, proj_vec);
sub_v3_v3(vec, vec_p);
}
dist = len_squared_v3(vec);
if ((tob->rdist == -1.0f) || (dist < (tob->rdist * tob->rdist))) {
tob->rdist = sqrtf(dist);
@@ -989,7 +1007,7 @@ static void createTransPose(TransInfo *t, Object *ob)
t->poseobj = ob; /* we also allow non-active objects to be transformed, in weightpaint */
/* disable PET, its not usable in pose mode yet [#32444] */
t->flag &= ~(T_PROP_EDIT | T_PROP_CONNECTED);
t->flag &= ~T_PROP_EDIT_ALL;
/* init trans data */
td = t->data = MEM_callocN(t->total * sizeof(TransData), "TransPoseBone");
@@ -2013,14 +2031,14 @@ static void createTransEditVerts(TransInfo *t)
float mtx[3][3], smtx[3][3], (*defmats)[3][3] = NULL, (*defcos)[3] = NULL;
float *dists = NULL;
int count = 0, countsel = 0, a, totleft;
int propmode = (t->flag & T_PROP_EDIT) ? (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) : 0;
int propmode = (t->flag & T_PROP_EDIT) ? (t->flag & T_PROP_EDIT_ALL) : 0;
int mirror = 0;
char *selstate = NULL;
short selectmode = ts->selectmode;
int cd_vert_bweight_offset = -1;
if (t->flag & T_MIRROR) {
EDBM_verts_mirror_cache_begin(em, 0, false, true);
EDBM_verts_mirror_cache_begin(em, 0, false, (t->flag & T_PROP_EDIT) == 0);
mirror = 1;
}
@@ -5827,7 +5845,7 @@ static void createTransNodeData(bContext *UNUSED(C), TransInfo *t)
}
/* nodes dont support PET and probably never will */
t->flag &= ~(T_PROP_EDIT | T_PROP_CONNECTED);
t->flag &= ~T_PROP_EDIT_ALL;
/* set transform flags on nodes */
for (node = snode->edittree->nodes.first; node; node = node->next) {

View File

@@ -1023,6 +1023,20 @@ void resetTransRestrictions(TransInfo *t)
t->flag &= ~T_ALL_RESTRICTIONS;
}
static int initTransInfo_edit_pet_to_flag(const int proportional)
{
switch (proportional) {
case PROP_EDIT_ON:
return T_PROP_EDIT;
case PROP_EDIT_CONNECTED:
return T_PROP_EDIT | T_PROP_CONNECTED;
case PROP_EDIT_PROJECTED:
return T_PROP_EDIT | T_PROP_PROJECTED;
default:
return 0;
}
}
/* the *op can be NULL */
int initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *event)
{
@@ -1245,24 +1259,14 @@ int initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *even
/* setting PET flag only if property exist in operator. Otherwise, assume it's not supported */
if (op && (prop = RNA_struct_find_property(op->ptr, "proportional"))) {
if (RNA_property_is_set(op->ptr, prop)) {
switch (RNA_property_enum_get(op->ptr, prop)) {
case PROP_EDIT_CONNECTED:
t->flag |= T_PROP_CONNECTED;
case PROP_EDIT_ON:
t->flag |= T_PROP_EDIT;
break;
}
t->flag |= initTransInfo_edit_pet_to_flag(RNA_property_enum_get(op->ptr, prop));
}
else {
/* use settings from scene only if modal */
if (t->flag & T_MODAL) {
if ((t->options & CTX_NO_PET) == 0) {
if (t->obedit && ts->proportional != PROP_EDIT_OFF) {
t->flag |= T_PROP_EDIT;
if (ts->proportional == PROP_EDIT_CONNECTED) {
t->flag |= T_PROP_CONNECTED;
}
if (t->obedit) {
t->flag |= initTransInfo_edit_pet_to_flag(ts->proportional);
}
else if (t->options & CTX_MASK) {
if (ts->proportional_mask) {
@@ -1310,9 +1314,11 @@ int initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *even
}
// Mirror is not supported with PET, turn it off.
#if 0
if (t->flag & T_PROP_EDIT) {
t->flag &= ~T_MIRROR;
}
#endif
setTransformViewMatrices(t);
initNumInput(&t->num);

View File

@@ -1501,7 +1501,8 @@ typedef struct Scene {
/* toolsettings->proportional */
#define PROP_EDIT_OFF 0
#define PROP_EDIT_ON 1
#define PROP_EDIT_CONNECTED 2
#define PROP_EDIT_CONNECTED 2
#define PROP_EDIT_PROJECTED 3
/* toolsettings->weightuser */
enum {

View File

@@ -120,6 +120,8 @@ EnumPropertyItem proportional_falloff_curve_only_items[] = {
EnumPropertyItem proportional_editing_items[] = {
{PROP_EDIT_OFF, "DISABLED", ICON_PROP_OFF, "Disable", "Proportional Editing disabled"},
{PROP_EDIT_ON, "ENABLED", ICON_PROP_ON, "Enable", "Proportional Editing enabled"},
{PROP_EDIT_PROJECTED, "PROJECTED", ICON_PROP_ON, "Projected (2D)",
"Proportional Editing using screen space locations"},
{PROP_EDIT_CONNECTED, "CONNECTED", ICON_PROP_CON, "Connected",
"Proportional Editing using connected geometry only"},
{0, NULL, 0, NULL, NULL}

View File

@@ -1416,6 +1416,10 @@ void shade_samples_fill_with_ps(ShadeSample *ssamp, PixStr *ps, int x, int y)
xs = (float)x + R.samples->centLut[b & 15] + 0.5f;
ys = (float)y + R.samples->centLut[b >> 4] + 0.5f;
}
else if (R.i.curblur) {
xs= (float)x + R.mblur_jit[R.i.curblur-1][0] + 0.5f;
ys= (float)y + R.mblur_jit[R.i.curblur-1][1] + 0.5f;
}
else {
xs = (float)x + 0.5f;
ys = (float)y + 0.5f;

View File

@@ -3824,6 +3824,10 @@ static void shade_tra_samples_fill(ShadeSample *ssamp, int x, int y, int z, int
xs= (float)x + R.samples->centLut[b & 15] + 0.5f;
ys= (float)y + R.samples->centLut[b>>4] + 0.5f;
}
else if (R.i.curblur) {
xs= (float)x + R.mblur_jit[R.i.curblur-1][0] + 0.5f;
ys= (float)y + R.mblur_jit[R.i.curblur-1][1] + 0.5f;
}
else {
xs= (float)x + 0.5f;
ys= (float)y + 0.5f;

View File

@@ -1261,7 +1261,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie)
{
KX_Scene* scene = scenes->at(scene_idx);
if (IS_TAGGED(scene->GetBlenderScene())) {
RemoveScene(scene); // XXX - not tested yet
m_ketsjiEngine->RemoveScene(scene->GetName());
scene_idx--;
numScenes--;
}

View File

@@ -363,6 +363,8 @@ void GPC_RenderTools::RenderText3D( int fontid,
double* mat,
float aspect)
{
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); /* needed for texture fonts otherwise they render as wireframe */
if (GLEW_ARB_multitexture) {
for (int i=0; i<MAXTEX; i++) {
glActiveTextureARB(GL_TEXTURE0_ARB+i);