diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-01-29 07:42:19 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-01-29 07:42:19 +0400 |
commit | fe26492538edefe60a342bce109e17b9536e5a16 (patch) | |
tree | df81d2485abd06be9cd2f4536a661b05153dff94 /source/blender | |
parent | 8f969fdc40cded16ec58f6810585411adbb5538d (diff) | |
parent | cf9e619889fdcdc457e44d4b384cda091de55673 (diff) |
Merged changes in the trunk up to revision 54171.
Diffstat (limited to 'source/blender')
56 files changed, 679 insertions, 320 deletions
diff --git a/source/blender/avi/intern/avi.c b/source/blender/avi/intern/avi.c index d6301b723a7..fcc9526b58a 100644 --- a/source/blender/avi/intern/avi.c +++ b/source/blender/avi/intern/avi.c @@ -950,7 +950,6 @@ AviError AVI_write_frame(AviMovie *movie, int frame_num, ...) { AviList list; AviChunk chunk; - AviIndexEntry *temp; va_list ap; int stream; int64_t rec_off; @@ -965,15 +964,7 @@ AviError AVI_write_frame(AviMovie *movie, int frame_num, ...) if (frame_num + 1 > movie->index_entries) { const size_t entry_size = (movie->header->Streams + 1) * sizeof(AviIndexEntry); - - if (movie->entries != NULL) { - temp = (AviIndexEntry *)MEM_recallocN(movie->entries, (frame_num + 1) * entry_size); - } - else { - temp = (AviIndexEntry *) MEM_callocN((frame_num + 1) * entry_size, "newidxentry"); - } - - movie->entries = temp; + movie->entries = (AviIndexEntry *)MEM_recallocN(movie->entries, (frame_num + 1) * entry_size); movie->index_entries = frame_num + 1; } diff --git a/source/blender/blenkernel/BKE_packedFile.h b/source/blender/blenkernel/BKE_packedFile.h index 9dcbb41c7dc..b19a2092206 100644 --- a/source/blender/blenkernel/BKE_packedFile.h +++ b/source/blender/blenkernel/BKE_packedFile.h @@ -35,6 +35,7 @@ #define RET_OK 0 #define RET_ERROR 1 +struct ID; struct bSound; struct Image; struct Main; @@ -72,5 +73,10 @@ int seekPackedFile(struct PackedFile *pf, int offset, int whence); void rewindPackedFile(struct PackedFile *pf); int readPackedFile(struct PackedFile *pf, void *data, int size); +/* ID should be not NULL, return 1 if there's a packed file */ +int BKE_pack_check(struct ID *id); +/* ID should be not NULL, throws error when ID is Library */ +void BKE_unpack_id(struct Main *bmain, struct ID *id, struct ReportList *reports, int how); + #endif diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index dab54756c82..bc9c8a7ad50 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -312,7 +312,7 @@ static void motionpaths_calc_optimise_depsgraph(Scene *scene, ListBase *targets) BLI_addhead(&scene->base, base); mpt->ob->flag |= BA_TEMP_TAG; - + /* we really don't need to continue anymore once this happens, but this line might really 'break' */ break; } diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index aecf6e5e437..c8fd8aa93e5 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -507,7 +507,7 @@ void BKE_animdata_separate_by_basepath(ID *srcID, ID *dstID, ListBase *basepaths else if (dstAdt->action == srcAdt->action) { printf("Argh! Source and Destination share animation! ('%s' and '%s' both use '%s') Making new empty action\n", srcID->name, dstID->name, srcAdt->action->id.name); - + /* TODO: review this... */ id_us_min(&dstAdt->action->id); dstAdt->action = add_empty_action(dstAdt->action->id.name + 2); @@ -536,9 +536,9 @@ void BKE_animdata_separate_by_basepath(ID *srcID, ID *dstID, ListBase *basepaths /* just need to change lists */ BLI_remlink(&srcAdt->drivers, fcu); BLI_addtail(&dstAdt->drivers, fcu); - + /* TODO: add depsgraph flushing calls? */ - + /* can stop now, as moved already */ break; } diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index ad14dee168a..3a705a07e22 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -2258,7 +2258,7 @@ static void do_strip_modifiers(Scene *scene, Object *armob, Bone *bone, bPoseCha { bActionModifier *amod; bActionStrip *strip, *strip2; - float scene_cfra = (float)scene->r.cfra; + float scene_cfra = BKE_scene_frame_get(scene); int do_modif; for (strip = armob->nlastrips.first; strip; strip = strip->next) { diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 803b1e68915..cb0a11a16e0 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -1065,7 +1065,7 @@ static void do_mesh_key(Scene *scene, Object *ob, Key *key, char *out, const int if (key->slurph && key->type != KEY_RELATIVE) { const float ctime_scaled = key->ctime / 100.0f; float delta = (float)key->slurph / tot; - float cfra = (float)scene->r.cfra + scene->r.subframe; + float cfra = BKE_scene_frame_get(scene); int step, a; if (tot > 100 && slurph_opt) { @@ -1163,7 +1163,7 @@ static void do_curve_key(Scene *scene, Object *ob, Key *key, char *out, const in if (key->slurph && key->type != KEY_RELATIVE) { const float ctime_scaled = key->ctime / 100.0f; float delta = (float)key->slurph / tot; - float cfra = (float)scene->r.cfra + scene->r.subframe; + float cfra = BKE_scene_frame_get(scene); Nurb *nu; int i = 0, remain = 0; int step, a; @@ -1245,7 +1245,7 @@ static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int if (key->slurph && key->type != KEY_RELATIVE) { const float ctime_scaled = key->ctime / 100.0f; float delta = (float)key->slurph / tot; - float cfra = (float)scene->r.cfra + scene->r.subframe; + float cfra = BKE_scene_frame_get(scene); int a; for (a = 0; a < tot; a++, cfra += delta) { @@ -1360,7 +1360,7 @@ float *BKE_key_evaluate_object(Scene *scene, Object *ob, int *r_totelem) } else { /* do shapekey local drivers */ - float ctime = (float)scene->r.cfra + scene->r.subframe; + float ctime = BKE_scene_frame_get(scene); BKE_animsys_evaluate_animdata(scene, &key->id, key->adt, ctime, ADT_RECALC_DRIVERS); diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 8a6309593f1..a46196f38d8 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1822,7 +1822,7 @@ static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[4][4]) CLAMP(ctime, 0.0f, 1.0f); } else { - ctime = scene->r.cfra; + ctime = BKE_scene_frame_get(scene); if (IS_EQF(cu->pathlen, 0.0f) == 0) ctime /= cu->pathlen; @@ -2201,7 +2201,7 @@ void BKE_object_where_is_calc_mat4(Scene *scene, Object *ob, float obmat[4][4]) void BKE_object_where_is_calc(struct Scene *scene, Object *ob) { - BKE_object_where_is_calc_time(scene, ob, (float)scene->r.cfra); + BKE_object_where_is_calc_time(scene, ob, BKE_scene_frame_get(scene)); } void BKE_object_where_is_calc_simul(Scene *scene, Object *ob) @@ -2240,7 +2240,7 @@ void BKE_object_where_is_calc_simul(Scene *scene, Object *ob) bConstraintOb *cob; cob = BKE_constraints_make_evalob(scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT); - BKE_solve_constraints(&ob->constraints, cob, (float)scene->r.cfra); + BKE_solve_constraints(&ob->constraints, cob, BKE_scene_frame_get(scene)); BKE_constraints_clear_evalob(cob); } } @@ -2684,7 +2684,7 @@ void BKE_object_handle_update(Scene *scene, Object *ob) if (ob->recalc & OB_RECALC_DATA) { ID *data_id = (ID *)ob->data; AnimData *adt = BKE_animdata_from_id(data_id); - float ctime = (float)scene->r.cfra; /* XXX this is bad... */ + float ctime = BKE_scene_frame_get(scene); if (G.debug & G_DEBUG) printf("recalcdata %s\n", ob->id.name + 2); diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index 9fab052f80c..288e4ccde5d 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -44,9 +44,9 @@ #include "DNA_image_types.h" #include "DNA_ID.h" +#include "DNA_packedFile_types.h" #include "DNA_sound_types.h" #include "DNA_vfont_types.h" -#include "DNA_packedFile_types.h" #include "BLI_blenlib.h" #include "BLI_utildefines.h" @@ -233,11 +233,13 @@ void packAll(Main *bmain, ReportList *reports) Image *ima; VFont *vfont; bSound *sound; + int tot = 0; for (ima = bmain->image.first; ima; ima = ima->id.next) { if (ima->packedfile == NULL && ima->id.lib == NULL) { if (ima->source == IMA_SRC_FILE) { ima->packedfile = newPackedFile(reports, ima->name, ID_BLEND_PATH(bmain, &ima->id)); + tot ++; } else if (ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) { BKE_reportf(reports, RPT_WARNING, "Image '%s' skipped, movies and image sequences not supported", @@ -246,13 +248,26 @@ void packAll(Main *bmain, ReportList *reports) } } - for (vfont = bmain->vfont.first; vfont; vfont = vfont->id.next) - if (vfont->packedfile == NULL && vfont->id.lib == NULL && BKE_vfont_is_builtin(vfont) == FALSE) + for (vfont = bmain->vfont.first; vfont; vfont = vfont->id.next) { + if (vfont->packedfile == NULL && vfont->id.lib == NULL && BKE_vfont_is_builtin(vfont) == FALSE) { vfont->packedfile = newPackedFile(reports, vfont->name, bmain->name); + tot ++; + } + } - for (sound = bmain->sound.first; sound; sound = sound->id.next) - if (sound->packedfile == NULL && sound->id.lib == NULL) + for (sound = bmain->sound.first; sound; sound = sound->id.next) { + if (sound->packedfile == NULL && sound->id.lib == NULL) { sound->packedfile = newPackedFile(reports, sound->name, bmain->name); + tot++; + } + } + + if (tot == 0) + BKE_report(reports, RPT_INFO, "No files have been packed"); + else + BKE_reportf(reports, RPT_INFO, "Packed %d files", tot); + + } @@ -316,6 +331,9 @@ int writePackedFile(ReportList *reports, const char *filename, PackedFile *pf, i BKE_reportf(reports, RPT_ERROR, "Error writing file '%s'", name); ret_value = RET_ERROR; } + else + BKE_reportf(reports, RPT_INFO, "Saved packed file to: %s", name); + close(file); } else { @@ -439,6 +457,7 @@ char *unpackFile(ReportList *reports, const char *abs_name, const char *local_na case PF_USE_ORIGINAL: /* if file exists use it */ if (BLI_exists(abs_name)) { + BKE_reportf(reports, RPT_INFO, "Use existing file (instead of packed): %s", abs_name); temp = abs_name; break; } @@ -604,3 +623,48 @@ void unpackAll(Main *bmain, ReportList *reports, int how) unpackSound(bmain, reports, sound, how); } +/* ID should be not NULL, return 1 if there's a packed file */ +int BKE_pack_check(ID *id) +{ + if (GS(id->name) == ID_IM) { + Image *ima = (Image *)id; + return ima->packedfile != NULL; + } + if (GS(id->name) == ID_VF) { + VFont *vf = (VFont *)id; + return vf->packedfile != NULL; + } + if (GS(id->name) == ID_SO) { + bSound *snd = (bSound *)id; + return snd->packedfile != NULL; + } + if (GS(id->name) == ID_LI) { + Library *li = (Library *)id; + return li->packedfile != NULL; + } + return 0; +} + +/* ID should be not NULL */ +void BKE_unpack_id(Main *bmain, ID *id, ReportList *reports, int how) +{ + if (GS(id->name) == ID_IM) { + Image *ima = (Image *)id; + if (ima->packedfile) + unpackImage(reports, ima, how); + } + if (GS(id->name) == ID_VF) { + VFont *vf = (VFont *)id; + if (vf->packedfile) + unpackVFont(reports, vf, how); + } + if (GS(id->name) == ID_SO) { + bSound *snd = (bSound *)id; + if (snd->packedfile) + unpackSound(bmain, reports, snd, how); + } + if (GS(id->name) == ID_LI) { + Library *li = (Library *)id; + BKE_reportf(reports, RPT_ERROR, "Cannot unpack individual Library file, '%s'", li->name); + } +} diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index ce6e158b6d9..0d0944d6ea7 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -1720,7 +1720,7 @@ static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes) if (ccgdm->pbvh && ccgdm->multires.mmd && !fast) { if (dm->numTessFaceData) { BKE_pbvh_draw(ccgdm->pbvh, partial_redraw_planes, NULL, - setMaterial, FALSE); + setMaterial, FALSE); glShadeModel(GL_FLAT); } diff --git a/source/blender/bmesh/intern/bmesh_log.c b/source/blender/bmesh/intern/bmesh_log.c index 68f8f38fb26..1337cb7c8eb 100644 --- a/source/blender/bmesh/intern/bmesh_log.c +++ b/source/blender/bmesh/intern/bmesh_log.c @@ -165,13 +165,13 @@ static BMFace *bm_log_face_from_id(BMLog *log, unsigned int id) * Returns zero if no paint-mask layer is present */ static float vert_mask_get(BMesh *bm, BMVert *v) { - CustomData *cd = &bm->vdata; - if (CustomData_has_layer(&bm->vdata, CD_PAINT_MASK)) { - float *mask = CustomData_bmesh_get(cd, v->head.data, CD_PAINT_MASK); + float *mask = CustomData_bmesh_get(&bm->vdata, v->head.data, CD_PAINT_MASK); + BLI_assert((CustomData_has_layer(&bm->vdata, CD_PAINT_MASK) == 0) == (mask == NULL)); + if (mask) { return *mask; } else { - return 0; + return 0.0f; } } @@ -180,10 +180,10 @@ static float vert_mask_get(BMesh *bm, BMVert *v) * Has no effect is no paint-mask layer is present */ static void vert_mask_set(BMesh *bm, BMVert *v, float new_mask) { - CustomData *cd = &bm->vdata; - if (CustomData_has_layer(cd, CD_PAINT_MASK)) { - float *mask = CustomData_bmesh_get(cd, v->head.data, CD_PAINT_MASK); - (*mask) = new_mask; + float *mask = CustomData_bmesh_get(&bm->vdata, v->head.data, CD_PAINT_MASK); + BLI_assert((CustomData_has_layer(&bm->vdata, CD_PAINT_MASK) == 0) == (mask == NULL)); + if (*mask) { + *mask = new_mask; } } @@ -452,7 +452,8 @@ BMLog *BM_log_from_existing_entries_create(BMesh *bm, BMLogEntry *entry) /* Let BMLog manage the entry list again */ log->entries.first = log->entries.last = entry; - if (entry) { + + { while (entry->prev) { entry = entry->prev; log->entries.first = entry; diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp index 07b958cc335..ecc618a5346 100644 --- a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp +++ b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp @@ -345,8 +345,8 @@ void *DilateStepOperation::initializeTileData(rcti *rect) */ int half_window = this->m_iterations; int window = half_window * 2 + 1; - float *temp = (float *)MEM_mallocN((2*window - 1) * sizeof(float), "dilate erode temp"); - float *buf = (float *)MEM_mallocN((max(bwidth, bheight) + 5*half_window) * sizeof(float), "dilate erode buf"); + float *temp = (float *)MEM_mallocN((2 * window - 1) * sizeof(float), "dilate erode temp"); + float *buf = (float *)MEM_mallocN((max(bwidth, bheight) + 5 * half_window) * sizeof(float), "dilate erode buf"); for (y = 0; y < bheight; y++) { for (x = 0; x < window - 1; x++) { @@ -355,11 +355,11 @@ void *DilateStepOperation::initializeTileData(rcti *rect) for (x = 0; x < bwidth; x++) { buf[x + window - 1] = rectf[bwidth * y + x]; } - for (x = bwidth + window - 1; x < bwidth + 5*half_window; x++) { + for (x = bwidth + window - 1; x < bwidth + 5 * half_window; x++) { buf[x] = -MAXFLOAT; } - for(i = 0; i < (bwidth + 3*half_window) / window; i++) { + for (i = 0; i < (bwidth + 3 * half_window) / window; i++) { int start = (i + 1) * window - 1; temp[window - 1] = buf[start]; @@ -368,8 +368,8 @@ void *DilateStepOperation::initializeTileData(rcti *rect) temp[window - 1 + x] = max(temp[window + x - 2], buf[start + x]); } - start = half_window + (i-1) * window + 1; - for (x = -min(0, start); x < window - max(0, start+window - bwidth); x++) { + start = half_window + (i - 1) * window + 1; + for (x = -min(0, start); x < window - max(0, start + window - bwidth); x++) { rectf[bwidth * y + (start + x)] = max(temp[x], temp[x + window - 1]); } } @@ -382,11 +382,11 @@ void *DilateStepOperation::initializeTileData(rcti *rect) for (y = 0; y < bheight; y++) { buf[y + window - 1] = rectf[bwidth * y + x]; } - for (y = bheight + window - 1; y < bheight + 5*half_window; y++) { + for (y = bheight + window - 1; y < bheight + 5 * half_window; y++) { buf[y] = -MAXFLOAT; } - for(i = 0; i < (bheight + 3*half_window) / window; i++) { + for (i = 0; i < (bheight + 3 * half_window) / window; i++) { int start = (i + 1) * window - 1; temp[window - 1] = buf[start]; @@ -395,8 +395,8 @@ void *DilateStepOperation::initializeTileData(rcti *rect) temp[window - 1 + y] = max(temp[window + y - 2], buf[start + y]); } - start = half_window + (i-1) * window + 1; - for (y = -min(0, start); y < window - max(0, start+window - bheight); y++) { + start = half_window + (i - 1) * window + 1; + for (y = -min(0, start); y < window - max(0, start + window - bheight); y++) { rectf[bwidth * (y + start) + x] = max(temp[y], temp[y + window - 1]); } } @@ -464,8 +464,8 @@ void *ErodeStepOperation::initializeTileData(rcti *rect) int half_window = this->m_iterations; int window = half_window * 2 + 1; - float *temp = (float *)MEM_mallocN((2*window - 1) * sizeof(float), "dilate erode temp"); - float *buf = (float *)MEM_mallocN((max(bwidth, bheight) + 5*half_window) * sizeof(float), "dilate erode buf"); + float *temp = (float *)MEM_mallocN((2 * window - 1) * sizeof(float), "dilate erode temp"); + float *buf = (float *)MEM_mallocN((max(bwidth, bheight) + 5 * half_window) * sizeof(float), "dilate erode buf"); for (y = 0; y < bheight; y++) { for (x = 0; x < window - 1; x++) { @@ -474,11 +474,11 @@ void *ErodeStepOperation::initializeTileData(rcti *rect) for (x = 0; x < bwidth; x++) { buf[x + window - 1] = rectf[bwidth * y + x]; } - for (x = bwidth + window - 1; x < bwidth + 5*half_window; x++) { + for (x = bwidth + window - 1; x < bwidth + 5 * half_window; x++) { buf[x] = MAXFLOAT; } - for(i = 0; i < (bwidth + 3*half_window) / window; i++) { + for (i = 0; i < (bwidth + 3 * half_window) / window; i++) { int start = (i + 1) * window - 1; temp[window - 1] = buf[start]; @@ -487,8 +487,8 @@ void *ErodeStepOperation::initializeTileData(rcti *rect) temp[window - 1 + x] = min(temp[window + x - 2], buf[start + x]); } - start = half_window + (i-1) * window + 1; - for (x = -min(0, start); x < window - max(0, start+window - bwidth); x++) { + start = half_window + (i - 1) * window + 1; + for (x = -min(0, start); x < window - max(0, start + window - bwidth); x++) { rectf[bwidth * y + (start + x)] = min(temp[x], temp[x + window - 1]); } } @@ -501,11 +501,11 @@ void *ErodeStepOperation::initializeTileData(rcti *rect) for (y = 0; y < bheight; y++) { buf[y + window - 1] = rectf[bwidth * y + x]; } - for (y = bheight + window - 1; y < bheight + 5*half_window; y++) { + for (y = bheight + window - 1; y < bheight + 5 * half_window; y++) { buf[y] = MAXFLOAT; } - for(i = 0; i < (bheight + 3*half_window) / window; i++) { + for (i = 0; i < (bheight + 3 * half_window) / window; i++) { int start = (i + 1) * window - 1; temp[window - 1] = buf[start]; @@ -514,8 +514,8 @@ void *ErodeStepOperation::initializeTileData(rcti *rect) temp[window - 1 + y] = min(temp[window + y - 2], buf[start + y]); } - start = half_window + (i-1) * window + 1; - for (y = -min(0, start); y < window - max(0, start+window - bheight); y++) { + start = half_window + (i - 1) * window + 1; + for (y = -min(0, start); y < window - max(0, start + window - bheight); y++) { rectf[bwidth * (y + start) + x] = min(temp[y], temp[y + window - 1]); } } diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index f684e57c2bc..ef1b73fc58f 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -1203,7 +1203,7 @@ static int ed_marker_select_border_invoke_wrapper(bContext *C, wmOperator *op, w static void MARKER_OT_select_border(wmOperatorType *ot) { /* identifiers */ - ot->name = "Marker Border select"; + ot->name = "Marker Border Select"; ot->description = "Select all time markers using border selection"; ot->idname = "MARKER_OT_select_border"; @@ -1260,7 +1260,7 @@ static int ed_marker_select_all_exec(bContext *C, wmOperator *op) static void MARKER_OT_select_all(wmOperatorType *ot) { /* identifiers */ - ot->name = "(De)select all markers"; + ot->name = "(De)select all Markers"; ot->description = "Change selection of all time markers"; ot->idname = "MARKER_OT_select_all"; diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 9add193a514..64832a1311f 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -52,6 +52,7 @@ #include "DNA_material_types.h" #include "DNA_scene_types.h" #include "DNA_object_types.h" +#include "DNA_rigidbody_types.h" #include "BKE_animsys.h" #include "BKE_action.h" @@ -550,11 +551,12 @@ enum { * blocktypes, when using "standard" keying but 'Visual Keying' option in Auto-Keying * settings is on. */ -static short visualkey_can_use(PointerRNA *ptr, PropertyRNA *prop) +static bool visualkey_can_use(PointerRNA *ptr, PropertyRNA *prop) { bConstraint *con = NULL; short searchtype = VISUALKEY_NONE; - short has_parent = FALSE; + bool has_rigidbody = false; + bool has_parent = false; const char *identifier = NULL; /* validate data */ @@ -569,10 +571,14 @@ static short visualkey_can_use(PointerRNA *ptr, PropertyRNA *prop) if (ptr->type == &RNA_Object) { /* Object */ Object *ob = (Object *)ptr->data; + RigidBodyOb *rbo = ob->rigidbody_object; con = ob->constraints.first; identifier = RNA_property_identifier(prop); has_parent = (ob->parent != NULL); + + /* active rigidbody objects only, as only those are affected by sim */ + has_rigidbody = ((rbo) && (rbo->type == RBO_TYPE_ACTIVE)); } else if (ptr->type == &RNA_PoseBone) { /* Pose Channel */ @@ -584,13 +590,13 @@ static short visualkey_can_use(PointerRNA *ptr, PropertyRNA *prop) } /* check if any data to search using */ - if (ELEM(NULL, con, identifier) && (has_parent == FALSE)) - return 0; + if (ELEM(NULL, con, identifier) && (has_parent == false) && (has_rigidbody == false)) + return false; /* location or rotation identifiers only... */ if (identifier == NULL) { printf("%s failed: NULL identifier\n", __func__); - return 0; + return false; } else if (strstr(identifier, "location")) { searchtype = VISUALKEY_LOC; @@ -603,15 +609,15 @@ static short visualkey_can_use(PointerRNA *ptr, PropertyRNA *prop) } else { printf("%s failed: identifier - '%s'\n", __func__, identifier); - return 0; + return false; } /* only search if a searchtype and initial constraint are available */ if (searchtype) { - /* parent is always matching */ - if (has_parent) - return 1; + /* parent or rigidbody are always matching */ + if (has_parent || has_rigidbody) + return true; /* constraints */ for (; con; con = con->next) { @@ -623,48 +629,48 @@ static short visualkey_can_use(PointerRNA *ptr, PropertyRNA *prop) switch (con->type) { /* multi-transform constraints */ case CONSTRAINT_TYPE_CHILDOF: - return 1; + return true; case CONSTRAINT_TYPE_TRANSFORM: case CONSTRAINT_TYPE_TRANSLIKE: - return 1; + return true; case CONSTRAINT_TYPE_FOLLOWPATH: - return 1; + return true; case CONSTRAINT_TYPE_KINEMATIC: - return 1; + return true; /* single-transform constraits */ case CONSTRAINT_TYPE_TRACKTO: - if (searchtype == VISUALKEY_ROT) return 1; + if (searchtype == VISUALKEY_ROT) return true; break; case CONSTRAINT_TYPE_DAMPTRACK: - if (searchtype == VISUALKEY_ROT) return 1; + if (searchtype == VISUALKEY_ROT) return true; break; case CONSTRAINT_TYPE_ROTLIMIT: - if (searchtype == VISUALKEY_ROT) return 1; + if (searchtype == VISUALKEY_ROT) return true; break; case CONSTRAINT_TYPE_LOCLIMIT: - if (searchtype == VISUALKEY_LOC) return 1; + if (searchtype == VISUALKEY_LOC) return true; break; case CONSTRAINT_TYPE_SIZELIMIT: - if (searchtype == VISUALKEY_SCA) return 1; + if (searchtype == VISUALKEY_SCA) return true; break; case CONSTRAINT_TYPE_DISTLIMIT: - if (searchtype == VISUALKEY_LOC) return 1; + if (searchtype == VISUALKEY_LOC) return true; break; case CONSTRAINT_TYPE_ROTLIKE: - if (searchtype == VISUALKEY_ROT) return 1; + if (searchtype == VISUALKEY_ROT) return true; break; case CONSTRAINT_TYPE_LOCLIKE: - if (searchtype == VISUALKEY_LOC) return 1; + if (searchtype == VISUALKEY_LOC) return true; break; case CONSTRAINT_TYPE_SIZELIKE: - if (searchtype == VISUALKEY_SCA) return 1; + if (searchtype == VISUALKEY_SCA) return true; break; case CONSTRAINT_TYPE_LOCKTRACK: - if (searchtype == VISUALKEY_ROT) return 1; + if (searchtype == VISUALKEY_ROT) return true; break; case CONSTRAINT_TYPE_MINMAX: - if (searchtype == VISUALKEY_LOC) return 1; + if (searchtype == VISUALKEY_LOC) return true; break; default: @@ -673,8 +679,8 @@ static short visualkey_can_use(PointerRNA *ptr, PropertyRNA *prop) } } - /* when some condition is met, this function returns, so here it can be 0 */ - return 0; + /* when some condition is met, this function returns, so that means we've got nothing */ + return false; } /* This helper function extracts the value to use for visual-keyframing @@ -696,12 +702,12 @@ static float visualkey_get_value(PointerRNA *ptr, PropertyRNA *prop, int array_i */ if (ptr->type == &RNA_Object) { Object *ob = (Object *)ptr->data; - + /* Loc code is specific... */ if (strstr(identifier, "location")) { return ob->obmat[3][array_index]; } - + copy_m4_m4(tmat, ob->obmat); rotmode = ob->rotmode; } diff --git a/source/blender/editors/datafiles/CMakeLists.txt b/source/blender/editors/datafiles/CMakeLists.txt index e9b33a6c2a6..ed3088696b1 100644 --- a/source/blender/editors/datafiles/CMakeLists.txt +++ b/source/blender/editors/datafiles/CMakeLists.txt @@ -43,6 +43,7 @@ if(WITH_BLENDER) # blends data_to_c_simple(../../../../release/datafiles/preview.blend SRC) + data_to_c_simple(../../../../release/datafiles/preview_cycles.blend SRC) # images data_to_c_simple(../../../../release/datafiles/splash.png SRC) diff --git a/source/blender/editors/datafiles/SConscript b/source/blender/editors/datafiles/SConscript index 49888d573a0..fb1f9f37975 100644 --- a/source/blender/editors/datafiles/SConscript +++ b/source/blender/editors/datafiles/SConscript @@ -46,6 +46,7 @@ sources.extend(( os.path.join(env['DATA_SOURCES'], "startup.blend.c"), os.path.join(env['DATA_SOURCES'], "preview.blend.c"), + os.path.join(env['DATA_SOURCES'], "preview_cycles.blend.c"), os.path.join(env['DATA_SOURCES'], "add.png.c"), os.path.join(env['DATA_SOURCES'], "blob.png.c"), diff --git a/source/blender/editors/include/ED_datafiles.h b/source/blender/editors/include/ED_datafiles.h index afe23090ae3..19552d60387 100644 --- a/source/blender/editors/include/ED_datafiles.h +++ b/source/blender/editors/include/ED_datafiles.h @@ -36,6 +36,12 @@ extern int datatoc_startup_blend_size; extern char datatoc_startup_blend[]; +extern int datatoc_preview_blend_size; +extern char datatoc_preview_blend[]; + +extern int datatoc_preview_cycles_blend_size; +extern char datatoc_preview_cycles_blend[]; + extern int datatoc_blender_icons16_png_size; extern char datatoc_blender_icons16_png[]; diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 8b4b1752774..619fb18cd7a 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -169,7 +169,7 @@ static DrawInfo *def_internal_icon(ImBuf *bbuf, int icon_id, int xofs, int yofs, /* this code assumes square images */ imgsize = bbuf->x; for (y = 0; y < size; y++) { - memcpy(&iimg->rect[y * size], &bbuf->rect[(y + yofs) * imgsize + xofs], imgsize * sizeof(int)); + memcpy(&iimg->rect[y * size], &bbuf->rect[(y + yofs) * imgsize + xofs], size * sizeof(int)); } } } diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 00c45e41587..c2c1de9cbd7 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -247,6 +247,14 @@ Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, int } } + /* Do not allow closed panels without headers! Else user could get "disappeared" UI! */ + if ((pt->flag & PNL_NO_HEADER) && (pa->flag & PNL_CLOSED)) { + pa->flag &= ~PNL_CLOSED; + /* Force update of panels' positions! */ + pa->sizex = 0; + pa->sizey = 0; + } + BLI_strncpy(pa->drawname, drawname, UI_MAX_NAME_STR); /* if a new panel is added, we insert it right after the panel diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index ec2b4f5adf0..58d59391939 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -58,6 +58,7 @@ #include "BKE_material.h" #include "BKE_modifier.h" #include "BKE_object.h" +#include "BKE_packedFile.h" #include "BKE_particle.h" #include "BKE_report.h" #include "BKE_sca.h" @@ -546,7 +547,18 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str uiButSetFlag(but, UI_BUT_DISABLED); } - if (flag & UI_ID_OPEN) { + /* Due to space limit in UI - skip the "open" icon for packed data, and allow to unpack. + Only for images, sound and fonts */ + if (id && BKE_pack_check(id)) { + + but = uiDefIconButO(block, BUT, "FILE_OT_unpack_item", WM_OP_INVOKE_REGION_WIN, ICON_PACKAGE, 0, 0, UI_UNIT_X, UI_UNIT_Y, "Packed File"); + uiButGetOperatorPtrRNA(but); + + RNA_string_set(but->opptr, "id_name", id->name + 2); + RNA_int_set(but->opptr, "id_type", GS(id->name)); + + } + else if (flag & UI_ID_OPEN) { int w = id ? UI_UNIT_X : (flag & UI_ID_ADD_NEW) ? UI_UNIT_X * 3 : UI_UNIT_X * 6; if (openop) { diff --git a/source/blender/editors/mask/mask_add.c b/source/blender/editors/mask/mask_add.c index e43c8a2b53b..77abe43bba7 100644 --- a/source/blender/editors/mask/mask_add.c +++ b/source/blender/editors/mask/mask_add.c @@ -720,7 +720,7 @@ static int add_feather_vertex_invoke(bContext *C, wmOperator *op, wmEvent *event void MASK_OT_add_feather_vertex(wmOperatorType *ot) { /* identifiers */ - ot->name = "Add feather Vertex"; + ot->name = "Add Feather Vertex"; ot->description = "Add vertex to feather"; ot->idname = "MASK_OT_add_feather_vertex"; diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c index 99fa85b3ee7..8d5bfe624fd 100644 --- a/source/blender/editors/mesh/mesh_navmesh.c +++ b/source/blender/editors/mesh/mesh_navmesh.c @@ -56,7 +56,8 @@ #include "recast-capi.h" -static void createVertsTrisData(bContext *C, LinkNode *obs, int *nverts_r, float **verts_r, int *ntris_r, int **tris_r) +static void createVertsTrisData(bContext *C, LinkNode *obs, + int *nverts_r, float **verts_r, int *ntris_r, int **tris_r, unsigned int *r_lay) { MVert *mvert; int nfaces = 0, *tri, i, curnverts, basenverts, curnfaces; @@ -91,6 +92,8 @@ static void createVertsTrisData(bContext *C, LinkNode *obs, int *nverts_r, float if (mf->v4) ntris += 1; } + + *r_lay |= ob->lay; } /* create data */ @@ -295,7 +298,8 @@ static bool buildNavMesh(const RecastData *recastParams, int nverts, float *vert return true; } -static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh, struct recast_polyMeshDetail *dmesh, Base *base) +static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh, struct recast_polyMeshDetail *dmesh, + Base *base, unsigned int lay) { float co[3], rot[3]; BMEditMesh *em; @@ -316,7 +320,7 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh, if (createob) { /* create new object */ - obedit = ED_object_add_type(C, OB_MESH, co, rot, FALSE, 1); + obedit = ED_object_add_type(C, OB_MESH, co, rot, FALSE, lay); } else { obedit = base->object; @@ -452,15 +456,16 @@ static int navmesh_create_exec(bContext *C, wmOperator *op) struct recast_polyMesh *pmesh = NULL; struct recast_polyMeshDetail *dmesh = NULL; bool ok; + unsigned int lay = 0; int nverts = 0, ntris = 0; int *tris = 0; float *verts = NULL; - createVertsTrisData(C, obs, &nverts, &verts, &ntris, &tris); + createVertsTrisData(C, obs, &nverts, &verts, &ntris, &tris, &lay); BLI_linklist_free(obs, NULL); if ((ok = buildNavMesh(&scene->gm.recastData, nverts, verts, ntris, tris, &pmesh, &dmesh, op->reports))) { - createRepresentation(C, pmesh, dmesh, navmeshBase); + createRepresentation(C, pmesh, dmesh, navmeshBase, lay); } MEM_freeN(verts); @@ -478,7 +483,7 @@ static int navmesh_create_exec(bContext *C, wmOperator *op) void MESH_OT_navmesh_make(wmOperatorType *ot) { /* identifiers */ - ot->name = "Create navigation mesh"; + ot->name = "Create Navigation Mesh"; ot->description = "Create navigation mesh for selected objects"; ot->idname = "MESH_OT_navmesh_make"; diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 5e5e38c3e43..4807e7364ea 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1864,9 +1864,7 @@ static int game_physics_copy_exec(bContext *C, wmOperator *UNUSED(op)) ob_iter->max_vel = ob->max_vel; ob_iter->obstacleRad = ob->obstacleRad; ob_iter->mass = ob->mass; - ob_iter->anisotropicFriction[0] = ob->anisotropicFriction[0]; - ob_iter->anisotropicFriction[1] = ob->anisotropicFriction[1]; - ob_iter->anisotropicFriction[2] = ob->anisotropicFriction[2]; + copy_v3_v3(ob_iter->anisotropicFriction, ob->anisotropicFriction); ob_iter->collision_boundtype = ob->collision_boundtype; ob_iter->margin = ob->margin; ob_iter->bsoft = copy_bulletsoftbody(ob->bsoft); @@ -1874,6 +1872,9 @@ static int game_physics_copy_exec(bContext *C, wmOperator *UNUSED(op)) ob_iter->restrictflag |= OB_RESTRICT_RENDER; else ob_iter->restrictflag &= ~OB_RESTRICT_RENDER; + + ob_iter->col_group = ob->col_group; + ob_iter->col_mask = ob->col_mask; } } CTX_DATA_END; diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index 5c65e543cc9..d26ea89bd1e 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -399,7 +399,7 @@ void ED_keymap_object(wmKeyConfig *keyconf) RNA_enum_set(kmi->ptr, "type", 0); /* active */ kmi = WM_keymap_add_item(keymap, "RIGIDBODY_OT_objects_add", RKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0); RNA_enum_set(kmi->ptr, "type", 1); /* passive */ - kmi = WM_keymap_add_item(keymap, "RIGIDBODY_OT_objects_remove", RKEY, KM_PRESS, KM_CTRL | KM_ALT, 0); + WM_keymap_add_item(keymap, "RIGIDBODY_OT_objects_remove", RKEY, KM_PRESS, KM_CTRL | KM_ALT, 0); WM_keymap_add_menu(keymap, "VIEW3D_MT_object_specials", WKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 9749494bc66..da12db50cc5 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -1069,7 +1069,7 @@ static int object_track_clear_exec(bContext *C, wmOperator *op) void OBJECT_OT_track_clear(wmOperatorType *ot) { /* identifiers */ - ot->name = "Clear track"; + ot->name = "Clear Track"; ot->description = "Clear tracking constraint or flag from object"; ot->idname = "OBJECT_OT_track_clear"; diff --git a/source/blender/editors/physics/rigidbody_object.c b/source/blender/editors/physics/rigidbody_object.c index fc1e24840a4..38ed903a161 100644 --- a/source/blender/editors/physics/rigidbody_object.c +++ b/source/blender/editors/physics/rigidbody_object.c @@ -615,8 +615,7 @@ void RIGIDBODY_OT_mass_calculate(wmOperatorType *ot) ot->prop = prop = RNA_def_enum(ot->srna, "material", DummyRNA_DEFAULT_items, 0, "Material Preset", - "Type of material that objects are made of. " - "Determines material density"); + "Type of material that objects are made of (determines material density)"); RNA_def_enum_funcs(prop, rigidbody_materials_itemf); RNA_def_float(ot->srna, "density", 1.0, FLT_MIN, FLT_MAX, diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 25ad1f61aaf..16ebaf58a59 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -97,6 +97,7 @@ #include "WM_api.h" #include "WM_types.h" +#include "ED_datafiles.h" #include "ED_render.h" #include "ED_view3d.h" @@ -168,7 +169,8 @@ typedef struct ShaderPreview { int sizex, sizey; unsigned int *pr_rect; int pr_method; - + + Main *pr_main; } ShaderPreview; typedef struct IconPreviewSize { @@ -187,23 +189,33 @@ typedef struct IconPreview { /* *************************** Preview for buttons *********************** */ static Main *pr_main = NULL; +static Main *pr_main_cycles = NULL; -void ED_preview_init_dbase(void) -{ #ifndef WITH_HEADLESS - BlendFileData *bfd; - extern int datatoc_preview_blend_size; - extern char datatoc_preview_blend[]; +static Main *load_main_from_memory(char *blend, int blend_size) +{ const int fileflags = G.fileflags; - + Main *bmain = NULL; + BlendFileData *bfd; + G.fileflags |= G_FILE_NO_UI; - bfd = BLO_read_from_memory(datatoc_preview_blend, datatoc_preview_blend_size, NULL); + bfd = BLO_read_from_memory(blend, blend_size, NULL); if (bfd) { - pr_main = bfd->main; - + bmain = bfd->main; + MEM_freeN(bfd); } G.fileflags = fileflags; + + return bmain; +} +#endif + +void ED_preview_init_dbase(void) +{ +#ifndef WITH_HEADLESS + pr_main = load_main_from_memory(datatoc_preview_blend, datatoc_preview_blend_size); + pr_main_cycles = load_main_from_memory(datatoc_preview_cycles_blend, datatoc_preview_cycles_blend_size); #endif } @@ -211,6 +223,9 @@ void ED_preview_free_dbase(void) { if (pr_main) free_main(pr_main); + + if (pr_main_cycles) + free_main(pr_main_cycles); } static int preview_mat_has_sss(Material *mat, bNodeTree *ntree) @@ -239,7 +254,7 @@ static int preview_mat_has_sss(Material *mat, bNodeTree *ntree) return 0; } -static Scene *preview_get_scene(void) +static Scene *preview_get_scene(Main *pr_main) { if (pr_main == NULL) return NULL; @@ -253,8 +268,9 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre { Scene *sce; Base *base; + Main *pr_main = sp->pr_main; - sce = preview_get_scene(); + sce = preview_get_scene(pr_main); if (sce) { /* this flag tells render to not execute depsgraph or ipos etc */ @@ -299,45 +315,47 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre sp->matcopy = mat; BLI_addtail(&pr_main->mat, mat); - init_render_material(mat, 0, NULL); /* call that retrieves mode_l */ - end_render_material(mat); - - /* un-useful option */ - if (sp->pr_method == PR_ICON_RENDER) - mat->shade_flag &= ~MA_OBCOLOR; - - /* turn on raytracing if needed */ - if (mat->mode_l & MA_RAYMIRROR) - sce->r.mode |= R_RAYTRACE; - if (mat->material_type == MA_TYPE_VOLUME) - sce->r.mode |= R_RAYTRACE; - if ((mat->mode_l & MA_RAYTRANSP) && (mat->mode_l & MA_TRANSP)) - sce->r.mode |= R_RAYTRACE; - if (preview_mat_has_sss(mat, NULL)) - sce->r.mode |= R_SSS; - - /* turn off fake shadows if needed */ - /* this only works in a specific case where the preview.blend contains - * an object starting with 'c' which has a material linked to it (not the obdata) - * and that material has a fake shadow texture in the active texture slot */ - for (base = sce->base.first; base; base = base->next) { - if (base->object->id.name[2] == 'c') { - Material *shadmat = give_current_material(base->object, base->object->actcol); - if (shadmat) { - if (mat->mode & MA_SHADBUF) shadmat->septex = 0; - else shadmat->septex |= 1; + if (!BKE_scene_use_new_shading_nodes(scene)) { + init_render_material(mat, 0, NULL); /* call that retrieves mode_l */ + end_render_material(mat); + + /* un-useful option */ + if (sp->pr_method == PR_ICON_RENDER) + mat->shade_flag &= ~MA_OBCOLOR; + + /* turn on raytracing if needed */ + if (mat->mode_l & MA_RAYMIRROR) + sce->r.mode |= R_RAYTRACE; + if (mat->material_type == MA_TYPE_VOLUME) + sce->r.mode |= R_RAYTRACE; + if ((mat->mode_l & MA_RAYTRANSP) && (mat->mode_l & MA_TRANSP)) + sce->r.mode |= R_RAYTRACE; + if (preview_mat_has_sss(mat, NULL)) + sce->r.mode |= R_SSS; + + /* turn off fake shadows if needed */ + /* this only works in a specific case where the preview.blend contains + * an object starting with 'c' which has a material linked to it (not the obdata) + * and that material has a fake shadow texture in the active texture slot */ + for (base = sce->base.first; base; base = base->next) { + if (base->object->id.name[2] == 'c') { + Material *shadmat = give_current_material(base->object, base->object->actcol); + if (shadmat) { + if (mat->mode & MA_SHADBUF) shadmat->septex = 0; + else shadmat->septex |= 1; + } } } - } - - /* turn off bounce lights for volume, - * doesn't make much visual difference and slows it down too */ - if (mat->material_type == MA_TYPE_VOLUME) { - for (base = sce->base.first; base; base = base->next) { - if (base->object->type == OB_LAMP) { - /* if doesn't match 'Lamp.002' --> main key light */ - if (strcmp(base->object->id.name + 2, "Lamp.002") != 0) { - base->object->restrictflag |= OB_RESTRICT_RENDER; + + /* turn off bounce lights for volume, + * doesn't make much visual difference and slows it down too */ + if (mat->material_type == MA_TYPE_VOLUME) { + for (base = sce->base.first; base; base = base->next) { + if (base->object->type == OB_LAMP) { + /* if doesn't match 'Lamp.002' --> main key light */ + if (strcmp(base->object->id.name + 2, "Lamp.002") != 0) { + base->object->restrictflag |= OB_RESTRICT_RENDER; + } } } } @@ -432,19 +450,21 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre sp->lampcopy = la; BLI_addtail(&pr_main->lamp, la); } - - if (la && la->type == LA_SUN && (la->sun_effect_type & LA_SUN_EFFECT_SKY)) { - sce->lay = 1 << MA_ATMOS; - sce->world = scene->world; - sce->camera = (Object *)BLI_findstring(&pr_main->object, "CameraAtmo", offsetof(ID, name) + 2); - } - else { - sce->lay = 1 << MA_LAMP; - sce->world = NULL; - sce->camera = (Object *)BLI_findstring(&pr_main->object, "Camera", offsetof(ID, name) + 2); + + sce->lay = 1 << MA_LAMP; + + if (!BKE_scene_use_new_shading_nodes(scene)) { + if (la && la->type == LA_SUN && (la->sun_effect_type & LA_SUN_EFFECT_SKY)) { + sce->lay = 1 << MA_ATMOS; + sce->world = scene->world; + sce->camera = (Object *)BLI_findstring(&pr_main->object, "CameraAtmo", offsetof(ID, name) + 2); + } + else { + sce->world = NULL; + sce->camera = (Object *)BLI_findstring(&pr_main->object, "Camera", offsetof(ID, name) + 2); + } } - sce->r.mode &= ~R_SHADOW; - + for (base = sce->base.first; base; base = base->next) { if (base->object->id.name[2] == 'p') { if (base->object->type == OB_LAMP) @@ -639,6 +659,7 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs short idtype = GS(id->name); char name[32]; int sizex; + Main *pr_main = sp->pr_main; /* in case of split preview, use border render */ if (split) { @@ -648,7 +669,7 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs else sizex = sp->sizex; /* we have to set preview variables first */ - sce = preview_get_scene(); + sce = preview_get_scene(pr_main); if (sce) { sce->r.xsch = sizex; sce->r.ysch = sp->sizey; @@ -749,6 +770,7 @@ static void shader_preview_startjob(void *customdata, short *stop, short *do_upd static void shader_preview_free(void *customdata) { ShaderPreview *sp = customdata; + Main *pr_main = sp->pr_main; if (sp->matcopy) { struct IDProperty *properties; @@ -1076,13 +1098,14 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M Object *ob = CTX_data_active_object(C); wmJob *wm_job; ShaderPreview *sp; + Scene *scene = CTX_data_scene(C); wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), owner, "Shader Preview", WM_JOB_EXCL_RENDER, WM_JOB_TYPE_RENDER_PREVIEW); sp = MEM_callocN(sizeof(ShaderPreview), "shader preview"); /* customdata for preview thread */ - sp->scene = CTX_data_scene(C); + sp->scene = scene; sp->owner = owner; sp->sizex = sizex; sp->sizey = sizey; @@ -1090,6 +1113,14 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M sp->id = id; sp->parent = parent; sp->slot = slot; + + /* hardcoded preview .blend for cycles/internal, this should be solved + * once with custom preview .blend path for external engines */ + if (BKE_scene_use_new_shading_nodes(scene)) + sp->pr_main = pr_main_cycles; + else + sp->pr_main = pr_main; + if (ob && ob->totcol) copy_v4_v4(sp->col, ob->col); else sp->col[0] = sp->col[1] = sp->col[2] = sp->col[3] = 1.0f; diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index a22faea9eec..e7f5e57552c 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -729,7 +729,7 @@ static int actionzone_cancel(bContext *UNUSED(C), wmOperator *op) static void SCREEN_OT_actionzone(wmOperatorType *ot) { /* identifiers */ - ot->name = "Handle area action zones"; + ot->name = "Handle Area Action Zones"; ot->description = "Handle area action zones for mouse actions/gestures"; ot->idname = "SCREEN_OT_actionzone"; @@ -851,7 +851,7 @@ static int area_swap_modal(bContext *C, wmOperator *op, wmEvent *event) static void SCREEN_OT_area_swap(wmOperatorType *ot) { - ot->name = "Swap areas"; + ot->name = "Swap Areas"; ot->description = "Swap selected areas screen positions"; ot->idname = "SCREEN_OT_area_swap"; @@ -1169,7 +1169,7 @@ static int area_move_modal(bContext *C, wmOperator *op, wmEvent *event) static void SCREEN_OT_area_move(wmOperatorType *ot) { /* identifiers */ - ot->name = "Move area edges"; + ot->name = "Move Area Edges"; ot->description = "Move selected area edges"; ot->idname = "SCREEN_OT_area_move"; @@ -2568,7 +2568,7 @@ static int spacedata_cleanup(bContext *C, wmOperator *op) static void SCREEN_OT_spacedata_cleanup(wmOperatorType *ot) { /* identifiers */ - ot->name = "Clean-up space-data"; + ot->name = "Clean-up Space-data"; ot->description = "Remove unused settings for invisible editors"; ot->idname = "SCREEN_OT_spacedata_cleanup"; @@ -3368,7 +3368,7 @@ static int border_select_do(bContext *C, wmOperator *op) static void SCREEN_OT_border_select(wmOperatorType *ot) { /* identifiers */ - ot->name = "Border select"; + ot->name = "Border Select"; ot->idname = "SCREEN_OT_border_select"; /* api callbacks */ diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index 1763e62582a..efd0db3b442 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -272,7 +272,7 @@ void SCREEN_OT_screenshot(wmOperatorType *ot) WM_operator_properties_filesel(ot, FOLDERFILE | IMAGEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY); - RNA_def_boolean(ot->srna, "full", 1, "Full Screen", "Screenshot the whole Blender window"); + RNA_def_boolean(ot->srna, "full", 1, "Full Screen", "Capture the whole window. Otherwise only capture the active area"); } /* *************** screenshot movie job ************************* */ @@ -500,5 +500,5 @@ void SCREEN_OT_screencast(wmOperatorType *ot) ot->flag = 0; RNA_def_property(ot->srna, "filepath", PROP_STRING, PROP_FILEPATH); - RNA_def_boolean(ot->srna, "full", 1, "Full Screen", "Screencast the whole Blender window"); + RNA_def_boolean(ot->srna, "full", 1, "Full Screen", "Capture the whole window. Otherwise only capture the active area"); } diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index aaa1328f9f6..eb138bfeeef 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -264,7 +264,7 @@ static void SOUND_OT_update_animation_flags(wmOperatorType *ot) */ /* identifiers */ - ot->name = "Update animation"; + ot->name = "Update Animation"; ot->description = "Update animation flags"; ot->idname = "SOUND_OT_update_animation_flags"; @@ -300,7 +300,7 @@ static int sound_bake_animation_exec(bContext *C, wmOperator *UNUSED(op)) static void SOUND_OT_bake_animation(wmOperatorType *ot) { /* identifiers */ - ot->name = "Update animation cache"; + ot->name = "Update Animation Cache"; ot->description = "Update the audio animation cache"; ot->idname = "SOUND_OT_bake_animation"; diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index 26bae6e3978..cf4e76a8427 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -908,7 +908,7 @@ static int change_frame_modal(bContext *C, wmOperator *op, wmEvent *event) void CLIP_OT_change_frame(wmOperatorType *ot) { /* identifiers */ - ot->name = "Change frame"; + ot->name = "Change Frame"; ot->idname = "CLIP_OT_change_frame"; ot->description = "Interactively change the current frame number"; diff --git a/source/blender/editors/space_info/info_intern.h b/source/blender/editors/space_info/info_intern.h index 62e9a3a7f73..b5426fe15e1 100644 --- a/source/blender/editors/space_info/info_intern.h +++ b/source/blender/editors/space_info/info_intern.h @@ -39,6 +39,7 @@ struct ReportList; void FILE_OT_pack_all(struct wmOperatorType *ot); void FILE_OT_unpack_all(struct wmOperatorType *ot); +void FILE_OT_unpack_item(struct wmOperatorType *ot); void FILE_OT_pack_libraries(struct wmOperatorType *ot); void FILE_OT_unpack_libraries(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c index 104349e172a..663d136fdf2 100644 --- a/source/blender/editors/space_info/info_ops.c +++ b/source/blender/editors/space_info/info_ops.c @@ -46,9 +46,11 @@ #include "BKE_context.h" #include "BKE_global.h" #include "BKE_image.h" +#include "BKE_library.h" #include "BKE_main.h" #include "BKE_packedFile.h" #include "BKE_report.h" +#include "BKE_screen.h" #include "WM_api.h" @@ -249,6 +251,78 @@ void FILE_OT_unpack_all(wmOperatorType *ot) RNA_def_enum(ot->srna, "method", unpack_all_method_items, PF_USE_LOCAL, "Method", "How to unpack"); } +/********************* unpack single item operator *********************/ + +static const EnumPropertyItem unpack_item_method_items[] = { + {PF_USE_LOCAL, "USE_LOCAL", 0, "Use file from current directory (create when necessary)", ""}, + {PF_WRITE_LOCAL, "WRITE_LOCAL", 0, "Write file to current directory (overwrite existing file)", ""}, + {PF_USE_ORIGINAL, "USE_ORIGINAL", 0, "Use file in original location (create when necessary)", ""}, + {PF_WRITE_ORIGINAL, "WRITE_ORIGINAL", 0, "Write file to original location (overwrite existing file)", ""}, + /* {PF_ASK, "ASK", 0, "Ask for each file", ""}, */ + {0, NULL, 0, NULL, NULL}}; + + +static int unpack_item_exec(bContext *C, wmOperator *op) +{ + Main *bmain = CTX_data_main(C); + ID *id; + char idname[BKE_ST_MAXNAME]; + int type = RNA_int_get(op->ptr, "id_type"); + int method = RNA_enum_get(op->ptr, "method"); + + RNA_string_get(op->ptr, "id_name", idname); + id = BKE_libblock_find_name(type, idname); + + if (id == NULL) { + BKE_report(op->reports, RPT_WARNING, "No packed file"); + return OPERATOR_CANCELLED; + } + + if (method != PF_KEEP) + BKE_unpack_id(bmain, id, op->reports, method); /* XXX PF_ASK can't work here */ + + G.fileflags &= ~G_AUTOPACK; + + return OPERATOR_FINISHED; +} + +static int unpack_item_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) +{ + uiPopupMenu *pup; + uiLayout *layout; + + pup = uiPupMenuBegin(C, "Unpack", ICON_NONE); + layout = uiPupMenuLayout(pup); + + uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); + uiItemsFullEnumO(layout, op->type->idname, "method", op->ptr->data, WM_OP_EXEC_REGION_WIN, 0); + + uiPupMenuEnd(C, pup); + + return OPERATOR_CANCELLED; +} + +void FILE_OT_unpack_item(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Unpack Item"; + ot->idname = "FILE_OT_unpack_item"; + ot->description = "Unpack this file to an external file"; + + /* api callbacks */ + ot->exec = unpack_item_exec; + ot->invoke = unpack_item_invoke; + + /* flags */ + ot->flag = OPTYPE_UNDO; + + /* properties */ + RNA_def_enum(ot->srna, "method", unpack_item_method_items, PF_USE_LOCAL, "Method", "How to unpack"); + RNA_def_string(ot->srna, "id_name", "", BKE_ST_MAXNAME, "ID name", "Name of ID block to unpack"); + RNA_def_int(ot->srna, "id_type", 0, 0, INT_MAX, "ID Type", "Identifier type of ID block", 0, INT_MAX); +} + + /********************* make paths relative operator *********************/ static int make_paths_relative_exec(bContext *C, wmOperator *op) diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c index 023ffa50272..3050563e538 100644 --- a/source/blender/editors/space_info/info_report.c +++ b/source/blender/editors/space_info/info_report.c @@ -148,7 +148,7 @@ static int select_report_pick_invoke(bContext *C, wmOperator *op, wmEvent *event void INFO_OT_select_pick(wmOperatorType *ot) { /* identifiers */ - ot->name = "Select report"; + ot->name = "Select Report"; ot->description = "Select reports by index"; ot->idname = "INFO_OT_select_pick"; diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c index 60b04f7b029..1577ac338e7 100644 --- a/source/blender/editors/space_info/space_info.c +++ b/source/blender/editors/space_info/space_info.c @@ -180,6 +180,7 @@ static void info_operatortypes(void) WM_operatortype_append(FILE_OT_pack_all); WM_operatortype_append(FILE_OT_pack_libraries); WM_operatortype_append(FILE_OT_unpack_all); + WM_operatortype_append(FILE_OT_unpack_item); WM_operatortype_append(FILE_OT_unpack_libraries); WM_operatortype_append(FILE_OT_make_paths_relative); diff --git a/source/blender/editors/space_logic/logic_buttons.c b/source/blender/editors/space_logic/logic_buttons.c index e898a1baf74..a55da0e3b2c 100644 --- a/source/blender/editors/space_logic/logic_buttons.c +++ b/source/blender/editors/space_logic/logic_buttons.c @@ -145,7 +145,7 @@ void LOGIC_OT_links_cut(wmOperatorType *ot) { PropertyRNA *prop; - ot->name = "Cut links"; + ot->name = "Cut Links"; ot->idname = "LOGIC_OT_links_cut"; ot->description = "Remove logic brick connections"; diff --git a/source/blender/editors/space_logic/logic_ops.c b/source/blender/editors/space_logic/logic_ops.c index f28757bb431..2313885dbaf 100644 --- a/source/blender/editors/space_logic/logic_ops.c +++ b/source/blender/editors/space_logic/logic_ops.c @@ -330,8 +330,10 @@ static void LOGIC_OT_sensor_add(wmOperatorType *ot) /* properties */ ot->prop = prop = RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, SENS_ALWAYS, "Type", "Type of sensor to add"); RNA_def_enum_funcs(prop, rna_Sensor_type_itemf); - RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of the Sensor to add"); - RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object", "Name of the Object to add the Sensor to"); + prop = RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of the Sensor to add"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); + prop = RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object", "Name of the Object to add the Sensor to"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); } /* ************* Add/Remove Controller Operator ************* */ @@ -423,16 +425,14 @@ static int controller_add_exec(bContext *C, wmOperator *op) ob->scaflag |= OB_SHOWCONT; WM_event_add_notifier(C, NC_LOGIC, NULL); - - /* prevent the operator to get stuck with the "object" of the previous call - - * it only happens when it's called from the "smart controller", see bug #54102 */ - RNA_string_set(op->ptr, "object", ""); return OPERATOR_FINISHED; } static void LOGIC_OT_controller_add(wmOperatorType *ot) { + PropertyRNA *prop; + /* identifiers */ ot->name = "Add Controller"; ot->description = "Add a controller to the active object"; @@ -448,8 +448,10 @@ static void LOGIC_OT_controller_add(wmOperatorType *ot) /* properties */ ot->prop = RNA_def_enum(ot->srna, "type", controller_type_items, CONT_LOGIC_AND, "Type", "Type of controller to add"); - RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of the Controller to add"); - RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object", "Name of the Object to add the Controller to"); + prop = RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of the Controller to add"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); + prop = RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object", "Name of the Object to add the Controller to"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); } /* ************* Add/Remove Actuator Operator ************* */ @@ -551,8 +553,10 @@ static void LOGIC_OT_actuator_add(wmOperatorType *ot) /* properties */ ot->prop = prop = RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, CONT_LOGIC_AND, "Type", "Type of actuator to add"); RNA_def_enum_funcs(prop, rna_Actuator_type_itemf); - RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of the Actuator to add"); - RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object", "Name of the Object to add the Actuator to"); + prop = RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of the Actuator to add"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); + prop = RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object", "Name of the Object to add the Actuator to"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); } /* ************* Move Logic Bricks Operator ************* */ diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c index 18ce2c81716..b47be150417 100644 --- a/source/blender/editors/space_node/node_add.c +++ b/source/blender/editors/space_node/node_add.c @@ -305,7 +305,7 @@ void NODE_OT_add_reroute(wmOperatorType *ot) { PropertyRNA *prop; - ot->name = "Add reroute"; + ot->name = "Add Reroute"; ot->idname = "NODE_OT_add_reroute"; ot->invoke = WM_gesture_lines_invoke; diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 2fae92d674c..321eaa32e80 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -1749,7 +1749,7 @@ static int node_delete_reconnect_exec(bContext *C, wmOperator *UNUSED(op)) void NODE_OT_delete_reconnect(wmOperatorType *ot) { /* identifiers */ - ot->name = "Delete with reconnect"; + ot->name = "Delete with Reconnect"; ot->description = "Delete nodes; will reconnect nodes as if deletion was muted"; ot->idname = "NODE_OT_delete_reconnect"; @@ -2031,7 +2031,7 @@ static int node_clipboard_copy_exec(bContext *C, wmOperator *UNUSED(op)) void NODE_OT_clipboard_copy(wmOperatorType *ot) { /* identifiers */ - ot->name = "Copy to clipboard"; + ot->name = "Copy to Clipboard"; ot->description = "Copies selected nodes to the clipboard"; ot->idname = "NODE_OT_clipboard_copy"; @@ -2152,7 +2152,7 @@ static int node_clipboard_paste_invoke(bContext *C, wmOperator *op, wmEvent *eve void NODE_OT_clipboard_paste(wmOperatorType *ot) { /* identifiers */ - ot->name = "Paste from clipboard"; + ot->name = "Paste from Clipboard"; ot->description = "Pastes nodes from the clipboard to the active node tree"; ot->idname = "NODE_OT_clipboard_paste"; diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c index 7fa48c48ad6..8d7eef22822 100644 --- a/source/blender/editors/space_node/node_relationships.c +++ b/source/blender/editors/space_node/node_relationships.c @@ -876,7 +876,7 @@ void NODE_OT_links_cut(wmOperatorType *ot) { PropertyRNA *prop; - ot->name = "Cut links"; + ot->name = "Cut Links"; ot->idname = "NODE_OT_links_cut"; ot->description = "Use the mouse to cut (remove) some links"; diff --git a/source/blender/editors/space_script/script_edit.c b/source/blender/editors/space_script/script_edit.c index 4e6783e1862..96008004ee4 100644 --- a/source/blender/editors/space_script/script_edit.c +++ b/source/blender/editors/space_script/script_edit.c @@ -71,7 +71,7 @@ static int run_pyfile_exec(bContext *C, wmOperator *op) void SCRIPT_OT_python_file_run(wmOperatorType *ot) { /* identifiers */ - ot->name = "Run python file"; + ot->name = "Run Python File"; ot->description = "Run Python file"; ot->idname = "SCRIPT_OT_python_file_run"; ot->flag = OPTYPE_UNDO; diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index c6c70ccb424..15528093869 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -1124,7 +1124,7 @@ static int sequencer_snap_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(ev void SEQUENCER_OT_snap(struct wmOperatorType *ot) { /* identifiers */ - ot->name = "Snap strips"; + ot->name = "Snap Strips"; ot->idname = "SEQUENCER_OT_snap"; ot->description = "Frame where selected strips will be snapped"; diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index 192f45ac918..0d1ecb76d0e 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -704,7 +704,7 @@ static int sequencer_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEv void SEQUENCER_OT_select_linked_pick(wmOperatorType *ot) { /* identifiers */ - ot->name = "Select pick linked"; + ot->name = "Select Pick Linked"; ot->idname = "SEQUENCER_OT_select_linked_pick"; ot->description = "Select a chain of linked strips nearest to the mouse pointer"; @@ -739,7 +739,7 @@ static int sequencer_select_linked_exec(bContext *C, wmOperator *UNUSED(op)) void SEQUENCER_OT_select_linked(wmOperatorType *ot) { /* identifiers */ - ot->name = "Select linked"; + ot->name = "Select Linked"; ot->idname = "SEQUENCER_OT_select_linked"; ot->description = "Select all strips adjacent to the current selection"; diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index a1e132c6601..562d1ec4b64 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -972,7 +972,7 @@ static int viewrotate_cancel(bContext *C, wmOperator *op) void VIEW3D_OT_rotate(wmOperatorType *ot) { /* identifiers */ - ot->name = "Rotate view"; + ot->name = "Rotate View"; ot->description = "Rotate the view"; ot->idname = "VIEW3D_OT_rotate"; @@ -1330,7 +1330,7 @@ static int ndof_orbit_zoom_invoke(bContext *C, wmOperator *op, wmEvent *event) void VIEW3D_OT_ndof_orbit_zoom(struct wmOperatorType *ot) { /* identifiers */ - ot->name = "NDOF Orbit View with zoom"; + ot->name = "NDOF Orbit View with Zoom"; ot->description = "Explore every angle of an object using the 3D mouse"; ot->idname = "VIEW3D_OT_ndof_orbit_zoom"; @@ -1590,7 +1590,7 @@ static int ndof_all_invoke(bContext *C, wmOperator *op, wmEvent *event) void VIEW3D_OT_ndof_all(struct wmOperatorType *ot) { /* identifiers */ - ot->name = "NDOF move View"; + ot->name = "NDOF Move View"; ot->description = "Position your viewpoint with the 3D mouse"; ot->idname = "VIEW3D_OT_ndof_all"; @@ -1753,7 +1753,7 @@ void VIEW3D_OT_move(wmOperatorType *ot) { /* identifiers */ - ot->name = "Move view"; + ot->name = "Move View"; ot->description = "Move the view"; ot->idname = "VIEW3D_OT_move"; @@ -2375,7 +2375,7 @@ static int viewdolly_cancel(bContext *C, wmOperator *op) void VIEW3D_OT_dolly(wmOperatorType *ot) { /* identifiers */ - ot->name = "Dolly view"; + ot->name = "Dolly View"; ot->description = "Dolly in/out in the view"; ot->idname = "VIEW3D_OT_dolly"; @@ -3457,7 +3457,7 @@ void VIEW3D_OT_viewnumpad(wmOperatorType *ot) PropertyRNA *prop; /* identifiers */ - ot->name = "View numpad"; + ot->name = "View Numpad"; ot->description = "Use a preset viewpoint"; ot->idname = "VIEW3D_OT_viewnumpad"; diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index d29326db6b0..c4960de1e19 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -2336,7 +2336,7 @@ static void constraintTransLim(TransInfo *t, TransData *td) ListBase targets = {NULL, NULL}; /* only consider constraint if enabled */ - if (con->flag & CONSTRAINT_DISABLE) continue; + if (con->flag & (CONSTRAINT_DISABLE | CONSTRAINT_OFF)) continue; if (con->enforce == 0.0f) continue; /* only use it if it's tagged for this purpose (and the right type) */ @@ -2427,7 +2427,7 @@ static void constraintRotLim(TransInfo *UNUSED(t), TransData *td) /* Evaluate valid constraints */ for (con = td->con; con; con = con->next) { /* only consider constraint if enabled */ - if (con->flag & CONSTRAINT_DISABLE) continue; + if (con->flag & (CONSTRAINT_DISABLE | CONSTRAINT_OFF)) continue; if (con->enforce == 0.0f) continue; /* we're only interested in Limit-Rotation constraints */ @@ -2517,7 +2517,7 @@ static void constraintSizeLim(TransInfo *t, TransData *td) /* Evaluate valid constraints */ for (con = td->con; con; con = con->next) { /* only consider constraint if enabled */ - if (con->flag & CONSTRAINT_DISABLE) continue; + if (con->flag & (CONSTRAINT_DISABLE | CONSTRAINT_OFF)) continue; if (con->enforce == 0.0f) continue; /* we're only interested in Limit-Scale constraints */ @@ -4872,70 +4872,102 @@ int BoneEnvelope(TransInfo *t, const int UNUSED(mval[2])) static BMEdge *get_other_edge(BMVert *v, BMEdge *e) { BMIter iter; - BMEdge *e2; + BMEdge *e_iter; - BM_ITER_ELEM (e2, &iter, v, BM_EDGES_OF_VERT) { - if (BM_elem_flag_test(e2, BM_ELEM_SELECT) && e2 != e) - return e2; + BM_ITER_ELEM (e_iter, &iter, v, BM_EDGES_OF_VERT) { + if (BM_elem_flag_test(e_iter, BM_ELEM_SELECT) && e_iter != e) { + return e_iter; + } } return NULL; } +static void len_v3_ensure(float v[3], const float length) +{ + normalize_v3(v); + mul_v3_fl(v, length); +} + +/** + * Given 2 edges and a loop, step over the loops + * and calculate a direction to slide along. + * + * \param r_slide_vec the direction to slide, + * the length of the vector defines the slide distance. + */ static BMLoop *get_next_loop(BMVert *v, BMLoop *l, - BMEdge *olde, BMEdge *nexte, float vec[3]) + BMEdge *e_prev, BMEdge *e_next, float r_slide_vec[3]) { - BMLoop *firstl; - float a[3] = {0.0f, 0.0f, 0.0f}, n[3] = {0.0f, 0.0f, 0.0f}; + BMLoop *l_first; + float vec_accum[3] = {0.0f, 0.0f, 0.0f}; + float vec_accum_len = 0.0f; int i = 0; - firstl = l; + BLI_assert(BM_edge_share_vert(e_prev, e_next) == v); + + l_first = l; do { l = BM_face_other_edge_loop(l->f, l->e, v); if (l->radial_next == l) return NULL; - if (l->e == nexte) { + if (l->e == e_next) { if (i) { - mul_v3_fl(a, 1.0f / (float)i); + len_v3_ensure(vec_accum, vec_accum_len / (float)i); } else { - float f1[3], f2[3], f3[3]; + /* When there is no edge to slide along, + * we must slide along the vector defined by the face we're attach to */ + float e_dir_prev[3], e_dir_next[3], tvec[3]; - sub_v3_v3v3(f1, BM_edge_other_vert(olde, v)->co, v->co); - sub_v3_v3v3(f2, BM_edge_other_vert(nexte, v)->co, v->co); + sub_v3_v3v3(e_dir_prev, BM_edge_other_vert(e_prev, v)->co, v->co); + sub_v3_v3v3(e_dir_next, BM_edge_other_vert(e_next, v)->co, v->co); - cross_v3_v3v3(f3, f1, l->f->no); - cross_v3_v3v3(a, f2, l->f->no); - mul_v3_fl(a, -1.0f); + cross_v3_v3v3(tvec, l->f->no, e_dir_prev); + cross_v3_v3v3(vec_accum, e_dir_next, l->f->no); - mid_v3_v3v3(a, a, f3); + mid_v3_v3v3(vec_accum, vec_accum, tvec); + + /* check if we need to flip + * (compare the normal defines by the edges with the face normal) */ + cross_v3_v3v3(tvec, e_dir_prev, e_dir_next); + if (dot_v3v3(tvec, l->f->no) > 0.0f) { + negate_v3(vec_accum); + } } - - copy_v3_v3(vec, a); + + copy_v3_v3(r_slide_vec, vec_accum); return l; } else { - sub_v3_v3v3(n, BM_edge_other_vert(l->e, v)->co, v->co); - add_v3_v3v3(a, a, n); + /* accumulate the normalized edge vector, + * normalize so some edges don't skew the result */ + float tvec[3]; + sub_v3_v3v3(tvec, BM_edge_other_vert(l->e, v)->co, v->co); + vec_accum_len += normalize_v3(tvec); + add_v3_v3(vec_accum, tvec); i += 1; } - if (BM_face_other_edge_loop(l->f, l->e, v)->e == nexte) { - if (i) - mul_v3_fl(a, 1.0f / (float)i); - - copy_v3_v3(vec, a); + if (BM_face_other_edge_loop(l->f, l->e, v)->e == e_next) { + if (i) { + len_v3_ensure(vec_accum, vec_accum_len / (float)i); + } + + copy_v3_v3(r_slide_vec, vec_accum); return BM_face_other_edge_loop(l->f, l->e, v); } + BLI_assert(l != l->radial_next); l = l->radial_next; - } while (l != firstl); + } while (l != l_first); - if (i) - mul_v3_fl(a, 1.0f / (float)i); + if (i) { + len_v3_ensure(vec_accum, vec_accum_len / (float)i); + } - copy_v3_v3(vec, a); + copy_v3_v3(r_slide_vec, vec_accum); return NULL; } @@ -4991,7 +5023,7 @@ static int createEdgeSlideVerts(TransInfo *t) BMesh *bm = em->bm; BMIter iter; BMEdge *e, *e1; - BMVert *v, *v2, *first; + BMVert *v, *v2; TransDataEdgeSlideVert *sv_array; BMBVHTree *btree; SmallHash table; @@ -5098,6 +5130,7 @@ static int createEdgeSlideVerts(TransInfo *t) j = 0; while (1) { BMLoop *l, *l1, *l2; + BMVert *v_first; v = NULL; BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { @@ -5112,7 +5145,7 @@ static int createEdgeSlideVerts(TransInfo *t) if (!v->e) continue; - first = v; + v_first = v; /*walk along the edge loop*/ e = v->e; @@ -5132,7 +5165,7 @@ static int createEdgeSlideVerts(TransInfo *t) break; v = BM_edge_other_vert(e, v); - } while (e != first->e); + } while (e != v_first->e); BM_elem_flag_disable(v, BM_ELEM_TAG); @@ -5152,10 +5185,12 @@ static int createEdgeSlideVerts(TransInfo *t) } /*iterate over the loop*/ - first = v; + v_first = v; do { TransDataEdgeSlideVert *sv = sv_array + j; + BLI_assert(j < MEM_allocN_len(sv_array) / sizeof(*sv)); + sv->v = v; sv->origvert = *v; sv->loop_nr = loop_nr; @@ -5179,6 +5214,8 @@ static int createEdgeSlideVerts(TransInfo *t) if (!e) { //v2=v, v = BM_edge_other_vert(l1->e, v); + BLI_assert(j + 1 < MEM_allocN_len(sv_array) / sizeof(*sv)); + sv = sv_array + j + 1; sv->v = v; sv->origvert = *v; @@ -5208,7 +5245,7 @@ static int createEdgeSlideVerts(TransInfo *t) BM_elem_flag_disable(v, BM_ELEM_TAG); BM_elem_flag_disable(v2, BM_ELEM_TAG); - } while (e != first->e && l1); + } while (e != v_first->e && l1); loop_nr++; } diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 63cde9c7d59..80f35d531cd 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -930,8 +930,7 @@ void GPU_paint_update_image(Image *ima, int x, int y, int w, int h) ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL); if (ima->repbind || (GPU_get_mipmap() && !GTS.gpu_mipmap) || !ima->bindcode || !ibuf || - (!is_power_of_2_i(ibuf->x) || !is_power_of_2_i(ibuf->y)) || - (w == 0) || (h == 0)) + (w == 0) || (h == 0)) { /* these cases require full reload still */ GPU_free_image(ima); diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index 5f34fad09c6..d3a8742ede7 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -342,8 +342,8 @@ typedef enum FunctionFlag { FUNC_ALLOW_WRITE = 4096, /* registering */ - FUNC_REGISTER = 16, - FUNC_REGISTER_OPTIONAL = 16 | 32, + FUNC_REGISTER = 32, + FUNC_REGISTER_OPTIONAL = 32 | 64, /* internal flags */ FUNC_BUILTIN = 128, diff --git a/source/blender/makesrna/intern/rna_rigidbody.c b/source/blender/makesrna/intern/rna_rigidbody.c index c1eb3b9b000..938ef7a5032 100644 --- a/source/blender/makesrna/intern/rna_rigidbody.c +++ b/source/blender/makesrna/intern/rna_rigidbody.c @@ -55,19 +55,23 @@ EnumPropertyItem rigidbody_ob_shape_items[] = { {RB_SHAPE_CAPSULE, "CAPSULE", ICON_OUTLINER_OB_META, "Capsule", ""}, {RB_SHAPE_CYLINDER, "CYLINDER", ICON_MESH_CYLINDER, "Cylinder", ""}, {RB_SHAPE_CONE, "CONE", ICON_MESH_CONE, "Cone", ""}, - {RB_SHAPE_CONVEXH, "CONVEX_HULL", ICON_MESH_ICOSPHERE, "Convex Hull", "A mesh-like surface encompassing (i.e. shrinkwrap over) all verts. Best results with fewer vertices"}, - {RB_SHAPE_TRIMESH, "MESH", ICON_MESH_MONKEY, "Mesh", "Mesh consisting of triangles only, allowing for more detailed interactions than convex hulls"}, + {RB_SHAPE_CONVEXH, "CONVEX_HULL", ICON_MESH_ICOSPHERE, "Convex Hull", + "A mesh-like surface encompassing (i.e. shrinkwrap over) all vertices (best results with " + "fewer vertices)"}, + {RB_SHAPE_TRIMESH, "MESH", ICON_MESH_MONKEY, "Mesh", + "Mesh consisting of triangles only, allowing for more detailed interactions than convex hulls"}, {0, NULL, 0, NULL, NULL}}; /* collision shapes of constraints in rigid body sim */ EnumPropertyItem rigidbody_con_type_items[] = { - {RBC_TYPE_FIXED, "FIXED", ICON_FORCE_FORCE, "Fixed", "Glues rigid bodies together"}, - {RBC_TYPE_POINT, "POINT", ICON_FORCE_FORCE, "Point", "Constrains rigid bodies to move aound common pivot point"}, - {RBC_TYPE_HINGE, "HINGE", ICON_FORCE_FORCE, "Hinge", "Restricts rigid body rotation to one axis"}, - {RBC_TYPE_SLIDER, "SLIDER", ICON_FORCE_FORCE, "Slider", "Restricts rigid boddy translation to one axis"}, - {RBC_TYPE_PISTON, "PISTON", ICON_FORCE_FORCE, "Piston", "Restricts rigid boddy translation and rotation to one axis"}, - {RBC_TYPE_6DOF, "GENERIC", ICON_FORCE_FORCE, "Generic", "Restricts translation and rotation to specified axes"}, - {RBC_TYPE_6DOF_SPRING, "GENERIC_SPRING", ICON_FORCE_FORCE, "Generic Spring", "Restricts translation and rotation to specified axes with springs"}, + {RBC_TYPE_FIXED, "FIXED", ICON_FORCE_FORCE, "Fixed", "Glue rigid bodies together"}, + {RBC_TYPE_POINT, "POINT", ICON_FORCE_FORCE, "Point", "Constrain rigid bodies to move around common pivot point"}, + {RBC_TYPE_HINGE, "HINGE", ICON_FORCE_FORCE, "Hinge", "Restrict rigid body rotation to one axis"}, + {RBC_TYPE_SLIDER, "SLIDER", ICON_FORCE_FORCE, "Slider", "Restrict rigid body translation to one axis"}, + {RBC_TYPE_PISTON, "PISTON", ICON_FORCE_FORCE, "Piston", "Restrict rigid body translation and rotation to one axis"}, + {RBC_TYPE_6DOF, "GENERIC", ICON_FORCE_FORCE, "Generic", "Restrict translation and rotation to specified axes"}, + {RBC_TYPE_6DOF_SPRING, "GENERIC_SPRING", ICON_FORCE_FORCE, "Generic Spring", + "Restrict translation and rotation to specified axes with springs"}, {0, NULL, 0, NULL, NULL}}; @@ -560,7 +564,7 @@ static void rna_def_rigidbody_world(BlenderRNA *brna) RNA_def_property_range(prop, 0.0f, 100.0f); RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); RNA_def_property_float_default(prop, 1.0f); - RNA_def_property_ui_text(prop, "Time Scale", "Changes the speed of the simulation"); + RNA_def_property_ui_text(prop, "Time Scale", "Change the speed of the simulation"); RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_reset"); /* timestep */ @@ -569,7 +573,9 @@ static void rna_def_rigidbody_world(BlenderRNA *brna) RNA_def_property_range(prop, 1, SHRT_MAX); RNA_def_property_ui_range(prop, 60, 1000, 1, 0); RNA_def_property_int_default(prop, 60); - RNA_def_property_ui_text(prop, "Steps Per Second", "Number of simulation steps taken per second (higher values are more accurate but slower)"); + RNA_def_property_ui_text(prop, "Steps Per Second", + "Number of simulation steps taken per second (higher values are more accurate " + "but slower)"); RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_reset"); /* constraint solver iterations */ @@ -579,14 +585,18 @@ static void rna_def_rigidbody_world(BlenderRNA *brna) RNA_def_property_ui_range(prop, 10, 100, 1, 0); RNA_def_property_int_default(prop, 10); RNA_def_property_int_funcs(prop, NULL, "rna_RigidBodyWorld_num_solver_iterations_set", NULL); - RNA_def_property_ui_text(prop, "Solver Iterations", "Number of constraint solver iterations made per simulation step (higher values are more accurate but slower)"); + RNA_def_property_ui_text(prop, "Solver Iterations", + "Number of constraint solver iterations made per simulation step (higher values are more " + "accurate but slower)"); RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_reset"); /* split impulse */ prop = RNA_def_property(srna, "use_split_impulse", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", RBW_FLAG_USE_SPLIT_IMPULSE); RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyWorld_split_impulse_set"); - RNA_def_property_ui_text(prop, "Split Impulse", "Reduces extra velocity that can build up when objects collide (lowers simulation stabilty a litte so use only when necessary)"); + RNA_def_property_ui_text(prop, "Split Impulse", + "Reduce extra velocity that can build up when objects collide (lowers simulation " + "stability a little so use only when necessary)"); RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_reset"); /* cache */ @@ -626,7 +636,7 @@ static void rna_def_rigidbody_object(BlenderRNA *brna) prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", RBO_FLAG_DISABLED); RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyOb_disabled_set"); - RNA_def_property_ui_text(prop, "Enabled", "Rigid Body actively participated in the simulation"); + RNA_def_property_ui_text(prop, "Enabled", "Rigid Body actively participates to the simulation"); RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset"); prop = RNA_def_property(srna, "collision_shape", PROP_ENUM, PROP_NONE); @@ -639,7 +649,7 @@ static void rna_def_rigidbody_object(BlenderRNA *brna) prop = RNA_def_property(srna, "kinematic", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", RBO_FLAG_KINEMATIC); RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyOb_kinematic_state_set"); - RNA_def_property_ui_text(prop, "Kinematic", "Allows rigid body to be controlled by the animation system"); + RNA_def_property_ui_text(prop, "Kinematic", "Allow rigid body to be controlled by the animation system"); RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset"); /* Physics Parameters */ @@ -659,12 +669,14 @@ static void rna_def_rigidbody_object(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", RBO_FLAG_USE_DEACTIVATION); RNA_def_property_boolean_default(prop, TRUE); RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyOb_activation_state_set"); - RNA_def_property_ui_text(prop, "Enable Deactivation", "Enables deactivation of resting rigid bodies (increases performance and stability but can cause glitches)"); + RNA_def_property_ui_text(prop, "Enable Deactivation", + "Enable deactivation of resting rigid bodies (increases performance and stability " + "but can cause glitches)"); RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset"); prop = RNA_def_property(srna, "start_deactivated", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", RBO_FLAG_START_DEACTIVATED); - RNA_def_property_ui_text(prop, "Start Deactivated", "Deactivates rigid body at the start of the simulation"); + RNA_def_property_ui_text(prop, "Start Deactivated", "Deactivate rigid body at the start of the simulation"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset"); @@ -673,7 +685,8 @@ static void rna_def_rigidbody_object(BlenderRNA *brna) RNA_def_property_range(prop, FLT_MIN, FLT_MAX); // range must always be positive (and non-zero) RNA_def_property_float_default(prop, 0.4f); RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_linear_sleepThresh_set", NULL); - RNA_def_property_ui_text(prop, "Linear Velocity Deactivation Threshold", "Linear Velocity below which simulation stops simulating object"); + RNA_def_property_ui_text(prop, "Linear Velocity Deactivation Threshold", + "Linear Velocity below which simulation stops simulating object"); RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset"); prop = RNA_def_property(srna, "deactivate_angular_velocity", PROP_FLOAT, PROP_UNIT_VELOCITY); @@ -681,7 +694,8 @@ static void rna_def_rigidbody_object(BlenderRNA *brna) RNA_def_property_range(prop, FLT_MIN, FLT_MAX); // range must always be positive (and non-zero) RNA_def_property_float_default(prop, 0.5f); RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_angular_sleepThresh_set", NULL); - RNA_def_property_ui_text(prop, "Angular Velocity Deactivation Threshold", "Angular Velocity below which simulation stops simulating object"); + RNA_def_property_ui_text(prop, "Angular Velocity Deactivation Threshold", + "Angular Velocity below which simulation stops simulating object"); RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset"); /* Dynamics Parameters - Damping Parameters */ @@ -717,14 +731,17 @@ static void rna_def_rigidbody_object(BlenderRNA *brna) RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 3); RNA_def_property_float_default(prop, 0.0f); RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_restitution_set", NULL); - RNA_def_property_ui_text(prop, "Restitution", "Tendency of object to bounce after colliding with another (0 = stays still, 1 = perfectly elastic)"); + RNA_def_property_ui_text(prop, "Restitution", + "Tendency of object to bounce after colliding with another " + "(0 = stays still, 1 = perfectly elastic)"); RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset"); /* Collision Parameters - Sensitivity */ prop = RNA_def_property(srna, "use_margin", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", RBO_FLAG_USE_MARGIN); RNA_def_property_boolean_default(prop, FALSE); - RNA_def_property_ui_text(prop, "Collision Margin", "Use custom collision margin (some shapes will have a visible gap around them)"); + RNA_def_property_ui_text(prop, "Collision Margin", + "Use custom collision margin (some shapes will have a visible gap around them)"); RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_shape_reset"); prop = RNA_def_property(srna, "collision_margin", PROP_FLOAT, PROP_UNIT_LENGTH); @@ -733,13 +750,15 @@ static void rna_def_rigidbody_object(BlenderRNA *brna) RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01, 3); RNA_def_property_float_default(prop, 0.04f); RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_collision_margin_set", NULL); - RNA_def_property_ui_text(prop, "Collision Margin", "Threshold of distance near surface where collisions are still considered (best results when non-zero)"); + RNA_def_property_ui_text(prop, "Collision Margin", + "Threshold of distance near surface where collisions are still considered " + "(best results when non-zero)"); RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_shape_reset"); prop = RNA_def_property(srna, "collision_groups", PROP_BOOLEAN, PROP_LAYER_MEMBER); RNA_def_property_boolean_sdna(prop, NULL, "col_groups", 1); RNA_def_property_array(prop, 20); - RNA_def_property_ui_text(prop, "Collison Groups", "Collision Groups Rigid Body belongs to"); + RNA_def_property_ui_text(prop, "Collision Groups", "Collision Groups Rigid Body belongs to"); RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset"); RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); } @@ -751,7 +770,8 @@ static void rna_def_rigidbody_constraint(BlenderRNA *brna) srna = RNA_def_struct(brna, "RigidBodyConstraint", NULL); RNA_def_struct_sdna(srna, "RigidBodyCon"); - RNA_def_struct_ui_text(srna, "Rigid Body Constraint", "Constraint influencing Objects inside Rigid Body Simulation"); + RNA_def_struct_ui_text(srna, "Rigid Body Constraint", + "Constraint influencing Objects inside Rigid Body Simulation"); RNA_def_struct_path_func(srna, "rna_RigidBodyCon_path"); /* Enums */ @@ -772,7 +792,7 @@ static void rna_def_rigidbody_constraint(BlenderRNA *brna) prop = RNA_def_property(srna, "disable_collisions", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_DISABLE_COLLISIONS); RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_disable_collisions_set"); - RNA_def_property_ui_text(prop, "Disable Collisions", "Disables collisions between constrained ridid bodies"); + RNA_def_property_ui_text(prop, "Disable Collisions", "Disable collisions between constrained rigid bodies"); RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset"); prop = RNA_def_property(srna, "object1", PROP_POINTER, PROP_NONE); @@ -793,7 +813,8 @@ static void rna_def_rigidbody_constraint(BlenderRNA *brna) prop = RNA_def_property(srna, "use_breaking", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_BREAKING); RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_use_breaking_set"); - RNA_def_property_ui_text(prop, "Breakable", "Constraint can be broaken if it receives an impulse above the threshold"); + RNA_def_property_ui_text(prop, "Breakable", + "Constraint can be broken if it receives an impulse above the threshold"); RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset"); prop = RNA_def_property(srna, "breaking_threshold", PROP_FLOAT, PROP_NONE); @@ -802,14 +823,16 @@ static void rna_def_rigidbody_constraint(BlenderRNA *brna) RNA_def_property_ui_range(prop, 0.0f, 1000.0f, 100.0, 2); RNA_def_property_float_default(prop, 10.0f); RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_breaking_threshold_set", NULL); - RNA_def_property_ui_text(prop, "Breaking Threshold", "Impulse threshold that must be reached for the constraint to break"); + RNA_def_property_ui_text(prop, "Breaking Threshold", + "Impulse threshold that must be reached for the constraint to break"); RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset"); /* Solver Iterations */ prop = RNA_def_property(srna, "override_solver_iterations", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS); RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_override_solver_iterations_set"); - RNA_def_property_ui_text(prop, "Override Solver Iterations", "Overrides the number of solver iterations for this constraint"); + RNA_def_property_ui_text(prop, "Override Solver Iterations", + "Override the number of solver iterations for this constraint"); RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset"); prop = RNA_def_property(srna, "num_solver_iterations", PROP_INT, PROP_NONE); @@ -818,131 +841,133 @@ static void rna_def_rigidbody_constraint(BlenderRNA *brna) RNA_def_property_ui_range(prop, 1, 100, 1, 0); RNA_def_property_int_default(prop, 10); RNA_def_property_int_funcs(prop, NULL, "rna_RigidBodyCon_num_solver_iterations_set", NULL); - RNA_def_property_ui_text(prop, "Solver Iterations", "Number of constraint solver iterations made per simulation step (higher values are more accurate but slower)"); + RNA_def_property_ui_text(prop, "Solver Iterations", + "Number of constraint solver iterations made per simulation step (higher values are more " + "accurate but slower)"); RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset"); /* Limits */ prop = RNA_def_property(srna, "use_limit_lin_x", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_LIN_X); - RNA_def_property_ui_text(prop, "X Axis", "Limits translation on x axis"); + RNA_def_property_ui_text(prop, "X Axis", "Limit translation on X axis"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset"); prop = RNA_def_property(srna, "use_limit_lin_y", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_LIN_Y); - RNA_def_property_ui_text(prop, "Y Axis", "Limits translation on y axis"); + RNA_def_property_ui_text(prop, "Y Axis", "Limit translation on Y axis"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset"); prop = RNA_def_property(srna, "use_limit_lin_z", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_LIN_Z); - RNA_def_property_ui_text(prop, "Z Axis", "Limits translation on z axis"); + RNA_def_property_ui_text(prop, "Z Axis", "Limit translation on Z axis"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset"); prop = RNA_def_property(srna, "use_limit_ang_x", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_ANG_X); - RNA_def_property_ui_text(prop, "X Angle", "Limits rotation around x axis"); + RNA_def_property_ui_text(prop, "X Angle", "Limit rotation around X axis"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset"); prop = RNA_def_property(srna, "use_limit_ang_y", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_ANG_Y); - RNA_def_property_ui_text(prop, "Y Angle", "Limits rotation around y axis"); + RNA_def_property_ui_text(prop, "Y Angle", "Limit rotation around Y axis"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset"); prop = RNA_def_property(srna, "use_limit_ang_z", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_ANG_Z); - RNA_def_property_ui_text(prop, "Z Angle", "Limits rotation around z axis"); + RNA_def_property_ui_text(prop, "Z Angle", "Limit rotation around Z axis"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset"); prop = RNA_def_property(srna, "use_spring_x", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_SPRING_X); - RNA_def_property_ui_text(prop, "X Spring", "Enables spring on X axis"); + RNA_def_property_ui_text(prop, "X Spring", "Enable spring on X axis"); RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset"); prop = RNA_def_property(srna, "use_spring_y", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_SPRING_Y); - RNA_def_property_ui_text(prop, "Y Spring", "Enables spring on Y axis"); + RNA_def_property_ui_text(prop, "Y Spring", "Enable spring on Y axis"); RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset"); prop = RNA_def_property(srna, "use_spring_z", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_SPRING_Z); - RNA_def_property_ui_text(prop, "Z Spring", "Enables spring on Z axis"); + RNA_def_property_ui_text(prop, "Z Spring", "Enable spring on Z axis"); RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset"); prop = RNA_def_property(srna, "limit_lin_x_lower", PROP_FLOAT, PROP_UNIT_LENGTH); RNA_def_property_float_sdna(prop, NULL, "limit_lin_x_lower"); RNA_def_property_float_default(prop, -1.0f); - RNA_def_property_ui_text(prop, "Lower X Limit", "Lower limit of x axis translation"); + RNA_def_property_ui_text(prop, "Lower X Limit", "Lower limit of X axis translation"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset"); prop = RNA_def_property(srna, "limit_lin_x_upper", PROP_FLOAT, PROP_UNIT_LENGTH); RNA_def_property_float_sdna(prop, NULL, "limit_lin_x_upper"); RNA_def_property_float_default(prop, 1.0f); - RNA_def_property_ui_text(prop, "Upper X Limit", "Upper limit of x axis translation"); + RNA_def_property_ui_text(prop, "Upper X Limit", "Upper limit of X axis translation"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset"); prop = RNA_def_property(srna, "limit_lin_y_lower", PROP_FLOAT, PROP_UNIT_LENGTH); RNA_def_property_float_sdna(prop, NULL, "limit_lin_y_lower"); RNA_def_property_float_default(prop, -1.0f); - RNA_def_property_ui_text(prop, "Lower Y Limit", "Lower limit of y axis translation"); + RNA_def_property_ui_text(prop, "Lower Y Limit", "Lower limit of Y axis translation"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset"); prop = RNA_def_property(srna, "limit_lin_y_upper", PROP_FLOAT, PROP_UNIT_LENGTH); RNA_def_property_float_sdna(prop, NULL, "limit_lin_y_upper"); RNA_def_property_float_default(prop, 1.0f); - RNA_def_property_ui_text(prop, "Upper Y Limit", "Upper limit of y axis translation"); + RNA_def_property_ui_text(prop, "Upper Y Limit", "Upper limit of Y axis translation"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset"); prop = RNA_def_property(srna, "limit_lin_z_lower", PROP_FLOAT, PROP_UNIT_LENGTH); RNA_def_property_float_sdna(prop, NULL, "limit_lin_z_lower"); RNA_def_property_float_default(prop, -1.0f); - RNA_def_property_ui_text(prop, "Lower Z Limit", "Lower limit of z axis translation"); + RNA_def_property_ui_text(prop, "Lower Z Limit", "Lower limit of Z axis translation"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset"); prop = RNA_def_property(srna, "limit_lin_z_upper", PROP_FLOAT, PROP_UNIT_LENGTH); RNA_def_property_float_sdna(prop, NULL, "limit_lin_z_upper"); RNA_def_property_float_default(prop, 1.0f); - RNA_def_property_ui_text(prop, "Upper Z Limit", "Upper limit of z axis translation"); + RNA_def_property_ui_text(prop, "Upper Z Limit", "Upper limit of Z axis translation"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset"); prop = RNA_def_property(srna, "limit_ang_x_lower", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "limit_ang_x_lower"); RNA_def_property_range(prop, -M_PI * 2, M_PI * 2); RNA_def_property_float_default(prop, -M_PI_4); - RNA_def_property_ui_text(prop, "Lower X Angle Limit", "Lower limit of x axis rotation"); + RNA_def_property_ui_text(prop, "Lower X Angle Limit", "Lower limit of X axis rotation"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset"); prop = RNA_def_property(srna, "limit_ang_x_upper", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "limit_ang_x_upper"); RNA_def_property_range(prop, -M_PI * 2, M_PI * 2); RNA_def_property_float_default(prop, M_PI_4); - RNA_def_property_ui_text(prop, "Upper X Angle Limit", "Upper limit of x axis rotation"); + RNA_def_property_ui_text(prop, "Upper X Angle Limit", "Upper limit of X axis rotation"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset"); prop = RNA_def_property(srna, "limit_ang_y_lower", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "limit_ang_y_lower"); RNA_def_property_range(prop, -M_PI * 2, M_PI * 2); RNA_def_property_float_default(prop, -M_PI_4); - RNA_def_property_ui_text(prop, "Lower Y Angle Limit", "Lower limit of y axis rotation"); + RNA_def_property_ui_text(prop, "Lower Y Angle Limit", "Lower limit of Y axis rotation"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset"); prop = RNA_def_property(srna, "limit_ang_y_upper", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "limit_ang_y_upper"); RNA_def_property_range(prop, -M_PI * 2, M_PI * 2); RNA_def_property_float_default(prop, M_PI_4); - RNA_def_property_ui_text(prop, "Upper Y Angle Limit", "Upper limit of y axis rotation"); + RNA_def_property_ui_text(prop, "Upper Y Angle Limit", "Upper limit of Y axis rotation"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset"); prop = RNA_def_property(srna, "limit_ang_z_lower", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "limit_ang_z_lower"); RNA_def_property_range(prop, -M_PI * 2, M_PI * 2); RNA_def_property_float_default(prop, -M_PI_4); - RNA_def_property_ui_text(prop, "Lower Z Angle Limit", "Lower limit of z axis rotation"); + RNA_def_property_ui_text(prop, "Lower Z Angle Limit", "Lower limit of Z axis rotation"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset"); prop = RNA_def_property(srna, "limit_ang_z_upper", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "limit_ang_z_upper"); RNA_def_property_range(prop, -M_PI * 2, M_PI * 2); RNA_def_property_float_default(prop, M_PI_4); - RNA_def_property_ui_text(prop, "Upper Z Angle Limit", "Upper limit of z axis rotation"); + RNA_def_property_ui_text(prop, "Upper Z Angle Limit", "Upper limit of Z axis rotation"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset"); prop = RNA_def_property(srna, "spring_stiffness_x", PROP_FLOAT, PROP_UNIT_LENGTH); diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index b5b3897ed46..9bd20d854e7 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -946,7 +946,7 @@ static int rna_Function_registered_get(PointerRNA *ptr) static int rna_Function_registered_optional_get(PointerRNA *ptr) { FunctionRNA *func = (FunctionRNA *)ptr->data; - return func->flag & FUNC_REGISTER_OPTIONAL; + return func->flag & (FUNC_REGISTER_OPTIONAL & ~FUNC_REGISTER); } static int rna_Function_no_self_get(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 96bd0fb327e..843743b9a9a 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1830,28 +1830,29 @@ static void rna_def_tool_settings(BlenderRNA *brna) /* etch-a-ton */ prop = RNA_def_property(srna, "use_bone_sketching", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "bone_sketching", BONE_SKETCHING); - RNA_def_property_ui_text(prop, "Use Bone Sketching", "DOC BROKEN"); + RNA_def_property_ui_text(prop, "Use Bone Sketching", "Use sketching to create and edit bones"); /* RNA_def_property_ui_icon(prop, ICON_EDIT, 0); */ + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); prop = RNA_def_property(srna, "use_etch_quick", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "bone_sketching", BONE_SKETCHING_QUICK); - RNA_def_property_ui_text(prop, "Quick Sketching", "DOC BROKEN"); + RNA_def_property_ui_text(prop, "Quick Sketching", "Automatically convert and delete on stroke end"); prop = RNA_def_property(srna, "use_etch_overdraw", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "bone_sketching", BONE_SKETCHING_ADJUST); - RNA_def_property_ui_text(prop, "Overdraw Sketching", "DOC BROKEN"); + RNA_def_property_ui_text(prop, "Overdraw Sketching", "Adjust strokes by drawing near them"); prop = RNA_def_property(srna, "use_etch_autoname", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "skgen_retarget_options", SK_RETARGET_AUTONAME); - RNA_def_property_ui_text(prop, "Autoname", "DOC BROKEN"); + RNA_def_property_ui_text(prop, "Autoname Bones", "Automatically generate values to replace &N and &S suffix placeholders in template names"); prop = RNA_def_property(srna, "etch_number", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "skgen_num_string"); - RNA_def_property_ui_text(prop, "Number", "DOC BROKEN"); + RNA_def_property_ui_text(prop, "Number", "Text to replace &N with (e.g. 'Finger.&N' -> 'Finger.1' or 'Finger.One')"); prop = RNA_def_property(srna, "etch_side", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "skgen_num_string"); - RNA_def_property_ui_text(prop, "Side", "DOC BROKEN"); + RNA_def_property_ui_text(prop, "Side", "Text to replace &S with (e.g. 'Arm.&S' -> 'Arm.R' or 'Arm.Right')"); prop = RNA_def_property(srna, "etch_template", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "skgen_template"); @@ -1870,14 +1871,14 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "skgen_correlation_limit"); RNA_def_property_range(prop, 0.00001, 1.0); RNA_def_property_ui_range(prop, 0.01, 1.0, 0.01, 2); - RNA_def_property_ui_text(prop, "Limit", "Number of bones in the subdivided stroke"); + RNA_def_property_ui_text(prop, "Limit", "Correlation threshold for number of bones in the subdivided stroke"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); prop = RNA_def_property(srna, "etch_length_limit", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "skgen_length_limit"); RNA_def_property_range(prop, 0.00001, 100000.0); RNA_def_property_ui_range(prop, 0.001, 100.0, 0.1, 3); - RNA_def_property_ui_text(prop, "Length", "Number of bones in the subdivided stroke"); + RNA_def_property_ui_text(prop, "Length", "Maximum length of the subdivided bones"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); prop = RNA_def_property(srna, "etch_roll_mode", PROP_ENUM, PROP_NONE); @@ -3037,7 +3038,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "eyeseparation"); RNA_def_property_range(prop, 0.01, 5.0); RNA_def_property_ui_text(prop, "Eye Separation", - "Set the distance between the eyes - the camera focal length/30 should be fine"); + "Set the distance between the eyes - the camera focal distance/30 should be fine"); RNA_def_property_update(prop, NC_SCENE, NULL); /* Dome */ @@ -3162,10 +3163,12 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_update(prop, NC_SCENE, NULL); /* mode */ + /* not used *//* deprecated !!!!!!!!!!!!! */ prop = RNA_def_property(srna, "use_occlusion_culling", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_DBVT_CULLING); - RNA_def_property_ui_text(prop, "DBVT culling", - "Use optimized Bullet DBVT tree for view frustum and occlusion culling"); + RNA_def_property_ui_text(prop, "DBVT Culling", + "Use optimized Bullet DBVT tree for view frustum and occlusion culling " + "(more efficient, but it can waste unecessary CPU if the scene doesn't have Occluder objects"); /* not used *//* deprecated !!!!!!!!!!!!! */ prop = RNA_def_property(srna, "use_activity_culling", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index e877367790e..b0df27b957b 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -55,8 +55,10 @@ static void rna_Scene_frame_set(Scene *scene, int frame, float subframe) { - scene->r.cfra = frame; - scene->r.subframe = subframe; + float cfra = (float)frame + subframe; + + scene->r.cfra = floorf(cfra); + scene->r.subframe = cfra - floorf(cfra); CLAMP(scene->r.cfra, MINAFRAME, MAXFRAME); BKE_scene_update_for_newframe(G.main, scene, (1 << 20) - 1); diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index fad93ea9054..e5585b4f72d 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -791,7 +791,7 @@ static void rna_def_panel(BlenderRNA *brna) func = RNA_def_function(srna, "draw_header", NULL); RNA_def_function_ui_description(func, "Draw UI elements into the panel's header UI layout"); - RNA_def_function_flag(func, FUNC_REGISTER); + RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); parm = RNA_def_pointer(func, "context", "Context", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); @@ -863,7 +863,7 @@ static void rna_def_uilist(BlenderRNA *brna) func = RNA_def_function(srna, "draw_item", NULL); RNA_def_function_ui_description(func, "Draw an item in the list (NOTE: when you define your own draw_item " "function, you may want to check given 'item' is of the right type...)"); - RNA_def_function_flag(func, FUNC_REGISTER); + RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); parm = RNA_def_pointer(func, "context", "Context", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "layout", "UILayout", "", "Layout to draw the item"); diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 85a6db00703..4de92d090fc 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -6857,7 +6857,7 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr, StructRNA *srna, v i++; if (item == NULL) { - if ((flag & FUNC_REGISTER_OPTIONAL) == 0) { + if ((flag & (FUNC_REGISTER_OPTIONAL & ~FUNC_REGISTER)) == 0) { PyErr_Format(PyExc_AttributeError, "expected %.200s, %.200s class to have an \"%.200s\" attribute", class_type, py_class_name, diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c index 3d05f51fb96..91cff67fc49 100644 --- a/source/blender/python/mathutils/mathutils_geometry.c +++ b/source/blender/python/mathutils/mathutils_geometry.c @@ -251,6 +251,86 @@ static PyObject *M_Geometry_intersect_line_line(PyObject *UNUSED(self), PyObject } } +/* Line-Line intersection using algorithm from mathworld.wolfram.com */ + +PyDoc_STRVAR(M_Geometry_intersect_sphere_sphere_2d_doc, +".. function:: intersect_sphere_sphere_2d(p_a, radius_a, p_b, radius_b)\n" +"\n" +" Returns 2 points on between intersecting circles.\n" +"\n" +" :arg p_a: Center of the first circle\n" +" :type p_a: :class:`mathutils.Vector`\n" +" :arg radius_a: Radius of the first circle\n" +" :type radius_a: float\n" +" :arg p_b: Center of the second circle\n" +" :type p_b: :class:`mathutils.Vector`\n" +" :arg radius_b: Radius of the second circle\n" +" :type radius_b: float\n" +" :rtype: tuple of :class:`mathutils.Vector`'s or None when there is no intersection\n" +); +static PyObject *M_Geometry_intersect_sphere_sphere_2d(PyObject *UNUSED(self), PyObject *args) +{ + PyObject *ret; + VectorObject *vec_a, *vec_b; + float *v_a, *v_b; + float rad_a, rad_b; + float v_ab[2]; + float dist; + + if (!PyArg_ParseTuple(args, "O!fO!f:intersect_sphere_sphere_2d", + &vector_Type, &vec_a, &rad_a, + &vector_Type, &vec_b, &rad_b)) + { + return NULL; + } + + if (BaseMath_ReadCallback(vec_a) == -1 || + BaseMath_ReadCallback(vec_b) == -1) + { + return NULL; + } + + ret = PyTuple_New(2); + + v_a = vec_a->vec; + v_b = vec_b->vec; + + sub_v2_v2v2(v_ab, v_b, v_a); + dist = len_v2(v_ab); + + if (/* out of range */ + (dist > rad_a + rad_b) || + /* fully-contained in the other */ + (dist < abs(rad_a - rad_b)) || + /* co-incident */ + (dist < FLT_EPSILON)) + { + /* out of range */ + PyTuple_SET_ITEM(ret, 0, Py_None); Py_INCREF(Py_None); + PyTuple_SET_ITEM(ret, 1, Py_None); Py_INCREF(Py_None); + } + else { + const float dist_delta = ((rad_a * rad_a) - (rad_b * rad_b) + (dist * dist)) / (2.0f * dist); + const float h = powf(fabsf((rad_a * rad_a) - (dist_delta * dist_delta)), 0.5f); + float i_cent[2]; + float i1[2], i2[2]; + + i_cent[0] = v_a[0] + ((v_ab[0] * dist_delta) / dist); + i_cent[1] = v_a[1] + ((v_ab[1] * dist_delta) / dist); + + i1[0] = i_cent[0] + h * v_ab[1] / dist; + i1[1] = i_cent[1] - h * v_ab[0] / dist; + + i2[0] = i_cent[0] - h * v_ab[1] / dist; + i2[1] = i_cent[1] + h * v_ab[0] / dist; + + PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(i1, 2, Py_NEW, NULL)); + PyTuple_SET_ITEM(ret, 1, Vector_CreatePyObject(i2, 2, Py_NEW, NULL)); + } + + return ret; +} + PyDoc_STRVAR(M_Geometry_normal_doc, ".. function:: normal(v1, v2, v3, v4=None)\n" "\n" @@ -1376,6 +1456,7 @@ static PyMethodDef M_Geometry_methods[] = { {"intersect_line_sphere", (PyCFunction) M_Geometry_intersect_line_sphere, METH_VARARGS, M_Geometry_intersect_line_sphere_doc}, {"intersect_line_sphere_2d", (PyCFunction) M_Geometry_intersect_line_sphere_2d, METH_VARARGS, M_Geometry_intersect_line_sphere_2d_doc}, {"distance_point_to_plane", (PyCFunction) M_Geometry_distance_point_to_plane, METH_VARARGS, M_Geometry_distance_point_to_plane_doc}, + {"intersect_sphere_sphere_2d", (PyCFunction) M_Geometry_intersect_sphere_sphere_2d, METH_VARARGS, M_Geometry_intersect_sphere_sphere_2d_doc}, {"area_tri", (PyCFunction) M_Geometry_area_tri, METH_VARARGS, M_Geometry_area_tri_doc}, {"normal", (PyCFunction) M_Geometry_normal, METH_VARARGS, M_Geometry_normal_doc}, {"barycentric_transform", (PyCFunction) M_Geometry_barycentric_transform, METH_VARARGS, M_Geometry_barycentric_transform_doc}, diff --git a/source/blender/quicktime/apple/quicktime_export.c b/source/blender/quicktime/apple/quicktime_export.c index 1c4ab5a4b0e..c85df29de92 100644 --- a/source/blender/quicktime/apple/quicktime_export.c +++ b/source/blender/quicktime/apple/quicktime_export.c @@ -905,7 +905,7 @@ int fromcocoa_request_qtcodec_settings(bContext *C, wmOperator *op) void SCENE_OT_render_data_set_quicktime_codec(wmOperatorType *ot) { /* identifiers */ - ot->name = "Change codec"; + ot->name = "Change Codec"; ot->description = "Change Quicktime codec Settings"; ot->idname = "SCENE_OT_render_data_set_quicktime_codec"; diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 866932632c2..d77ca10e0b2 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -1879,8 +1879,6 @@ static void do_render_all_options(Render *re) /* ensure no images are in memory from previous animated sequences */ BKE_image_all_free_anim_ibufs(re->r.cfra); - re->pool = BKE_image_pool_new(); - if (RE_engine_render(re, 1)) { /* in this case external render overrides all */ } @@ -1893,7 +1891,12 @@ static void do_render_all_options(Render *re) re->display_draw(re->ddh, re->result, NULL); } else { + re->pool = BKE_image_pool_new(); + do_render_composite_fields_blur_3d(re); + + BKE_image_pool_free(re->pool); + re->pool = NULL; } re->i.lastframetime = PIL_check_seconds_timer() - re->i.starttime; @@ -1905,9 +1908,6 @@ static void do_render_all_options(Render *re) renderresult_stampinfo(re); re->display_draw(re->ddh, re->result, NULL); } - - BKE_image_pool_free(re->pool); - re->pool = NULL; } static int check_valid_camera(Scene *scene, Object *camera_override) diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 03a81e944c0..e22694a6560 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -3954,7 +3954,7 @@ static int wm_ndof_sensitivity_exec(bContext *UNUSED(C), wmOperator *op) static void WM_OT_ndof_sensitivity_change(wmOperatorType *ot) { - ot->name = "Change NDOF sensitivity"; + ot->name = "Change NDOF Sensitivity"; ot->idname = "WM_OT_ndof_sensitivity_change"; ot->description = "Change NDOF sensitivity"; |