Merge branch 'master' into blender2.8

This commit is contained in:
Sybren A. Stüvel
2018-04-08 14:07:34 +02:00
24 changed files with 177 additions and 116 deletions

View File

@@ -782,6 +782,12 @@ int btGeneric6DofSpring2Constraint::get_limit_motor_info2(
btScalar cfm = BT_ZERO;
btScalar mA = BT_ONE / m_rbA.getInvMass();
btScalar mB = BT_ONE / m_rbB.getInvMass();
if (rotational) {
btScalar rrA = (m_calculatedTransformA.getOrigin() - transA.getOrigin()).length2();
btScalar rrB = (m_calculatedTransformB.getOrigin() - transB.getOrigin()).length2();
if (m_rbA.getInvMass()) mA = mA * rrA + 1 / (m_rbA.getInvInertiaTensorWorld() * ax1).length();
if (m_rbB.getInvMass()) mB = mB * rrB + 1 / (m_rbB.getInvInertiaTensorWorld() * ax1).length();
}
btScalar m = mA > mB ? mB : mA;
btScalar angularfreq = sqrt(ks / m);
@@ -800,7 +806,18 @@ int btGeneric6DofSpring2Constraint::get_limit_motor_info2(
btScalar fd = -kd * (vel) * (rotational ? -1 : 1) * dt;
btScalar f = (fs+fd);
info->m_constraintError[srow] = (vel + f * (rotational ? -1 : 1)) ;
// after the spring force affecting the body(es) the new velocity will be
// vel + f / m * (rotational ? -1 : 1)
// so in theory this should be set here for m_constraintError
// (with m_constraintError we set a desired velocity for the affected body(es))
// however in practice any value is fine as long as it is greater then the "proper" velocity,
// because the m_lowerLimit and the m_upperLimit will determinate the strength of the final pulling force
// so it is much simpler (and more robust) just to simply use inf (with the proper sign)
// you may also wonder what if the current velocity (vel) so high that the pulling force will not change its direction (in this iteration)
// will we not request a velocity with the wrong direction ?
// and the answare is not, because in practice during the solving the current velocity is subtracted from the m_constraintError
// so the sign of the force that is really matters
info->m_constraintError[srow] = (rotational ? -1 : 1) * (f < 0 ? -SIMD_INFINITY : SIMD_INFINITY);
btScalar minf = f < fd ? f : fd;
btScalar maxf = f < fd ? fd : f;

View File

@@ -203,6 +203,7 @@ def find_next(ele_dst, ele_src):
candidates = elems_depth_search(ele_dst, depth_src_a, other_edges_over_edge)
candidates = elems_depth_search(ele_dst, depth_src_b, other_edges_over_face, candidates)
candidates.discard(ele_src)
candidates.discard(ele_dst)
if not candidates:
return []
@@ -217,6 +218,8 @@ def find_next(ele_dst, ele_src):
for ele_test in candidates:
depth_test_a = elems_depth_measure(ele_dst, ele_test, other_edges_over_edge)
depth_test_b = elems_depth_measure(ele_dst, ele_test, other_edges_over_face)
if depth_test_a is None or depth_test_b is None:
continue
depth_test = tuple(zip(depth_test_a, depth_test_b))
# square so a few high values win over many small ones
diff_test = sum((abs(a[0] - b[0]) ** 2) +
@@ -237,9 +240,12 @@ def find_next(ele_dst, ele_src):
ele_best_ls = []
depth_accum_max = -1
for ele_test in ele_best_ls_init:
depth_test_a = elems_depth_measure(ele_src, ele_test, other_edges_over_edge)
depth_test_b = elems_depth_measure(ele_src, ele_test, other_edges_over_face)
if depth_test_a is None or depth_test_b is None:
continue
depth_accum_test = (
sum(elems_depth_measure(ele_src, ele_test, other_edges_over_edge)) +
sum(elems_depth_measure(ele_src, ele_test, other_edges_over_face)))
sum(depth_test_a) + sum(depth_test_b))
if depth_accum_test > depth_accum_max:
depth_accum_max = depth_accum_test

View File

@@ -460,12 +460,32 @@ class RENDER_PT_encoding(RenderButtonsPanel, Panel):
split.prop(rd.ffmpeg, "format")
split.prop(ffmpeg, "use_autosplit")
# Video:
layout.separator()
self.draw_vcodec(context)
# Audio:
layout.separator()
if ffmpeg.format != 'MP3':
layout.prop(ffmpeg, "audio_codec", text="Audio Codec")
if ffmpeg.audio_codec != 'NONE':
row = layout.row()
row.prop(ffmpeg, "audio_bitrate")
row.prop(ffmpeg, "audio_volume", slider=True)
def draw_vcodec(self, context):
"""Video codec options."""
layout = self.layout
ffmpeg = context.scene.render.ffmpeg
needs_codec = ffmpeg.format in {'AVI', 'QUICKTIME', 'MKV', 'OGG', 'MPEG4'}
if needs_codec:
layout.prop(ffmpeg, "codec")
if needs_codec and ffmpeg.codec == 'NONE':
return
if ffmpeg.codec in {'DNXHD'}:
layout.prop(ffmpeg, "use_lossless_output")
@@ -499,17 +519,6 @@ class RENDER_PT_encoding(RenderButtonsPanel, Panel):
col.prop(ffmpeg, "muxrate", text="Rate")
col.prop(ffmpeg, "packetsize", text="Packet Size")
layout.separator()
# Audio:
if ffmpeg.format != 'MP3':
layout.prop(ffmpeg, "audio_codec", text="Audio Codec")
if ffmpeg.audio_codec != 'NONE':
row = layout.row()
row.prop(ffmpeg, "audio_bitrate")
row.prop(ffmpeg, "audio_volume", slider=True)
class RENDER_PT_bake(RenderButtonsPanel, Panel):
bl_label = "Bake"

View File

@@ -587,7 +587,7 @@ void BKE_pose_eval_init(const struct EvaluationContext *UNUSED(eval_ctx),
const int num_channels = BLI_listbase_count(&pose->chanbase);
pose->chan_array = MEM_malloc_arrayN(
num_channels, sizeof(bPoseChannel*), "pose->chan_array");
num_channels, sizeof(bPoseChannel *), "pose->chan_array");
/* clear flags */
int pchan_index = 0;

View File

@@ -153,7 +153,7 @@ static void imagecache_put(Image *image, int index, ImBuf *ibuf)
if (image->cache == NULL) {
// char cache_name[64];
// BLI_snprintf(cache_name, sizeof(cache_name), "Image Datablock %s", image->id.name);
// SNPRINTF(cache_name, "Image Datablock %s", image->id.name);
image->cache = IMB_moviecache_create("Image Datablock Cache", sizeof(ImageCacheKey),
imagecache_hashhash, imagecache_hashcmp);
@@ -438,7 +438,7 @@ static void copy_image_packedfiles(ListBase *lb_dst, const ListBase *lb_src)
BLI_listbase_clear(lb_dst);
for (imapf_src = lb_src->first; imapf_src; imapf_src = imapf_src->next) {
ImagePackedFile *imapf_dst = MEM_mallocN(sizeof(ImagePackedFile), "Image Packed Files (copy)");
BLI_strncpy(imapf_dst->filepath, imapf_src->filepath, sizeof(imapf_dst->filepath));
STRNCPY(imapf_dst->filepath, imapf_src->filepath);
if (imapf_src->packedfile)
imapf_dst->packedfile = dupPackedFile(imapf_src->packedfile);
@@ -594,7 +594,7 @@ Image *BKE_image_load(Main *bmain, const char *filepath)
int file;
char str[FILE_MAX];
BLI_strncpy(str, filepath, sizeof(str));
STRNCPY(str, filepath);
BLI_path_abs(str, bmain->name);
/* exists? */
@@ -604,7 +604,7 @@ Image *BKE_image_load(Main *bmain, const char *filepath)
close(file);
ima = image_alloc(bmain, BLI_path_basename(filepath), IMA_SRC_FILE, IMA_TYPE_IMAGE);
BLI_strncpy(ima->name, filepath, sizeof(ima->name));
STRNCPY(ima->name, filepath);
if (BLI_testextensie_array(filepath, imb_ext_movie))
ima->source = IMA_SRC_MOVIE;
@@ -623,13 +623,13 @@ Image *BKE_image_load_exists_ex(const char *filepath, bool *r_exists)
Image *ima;
char str[FILE_MAX], strtest[FILE_MAX];
BLI_strncpy(str, filepath, sizeof(str));
STRNCPY(str, filepath);
BLI_path_abs(str, G.main->name);
/* first search an identical filepath */
for (ima = G.main->image.first; ima; ima = ima->id.next) {
if (ima->source != IMA_SRC_VIEWER && ima->source != IMA_SRC_GENERATED) {
BLI_strncpy(strtest, ima->name, sizeof(ima->name));
STRNCPY(strtest, ima->name);
BLI_path_abs(strtest, ID_BLEND_PATH(G.main, &ima->id));
if (BLI_path_cmp(strtest, str) == 0) {
@@ -670,7 +670,7 @@ static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const char
if (colorspace_settings->name[0] == '\0') {
const char *colorspace = IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_DEFAULT_FLOAT);
BLI_strncpy(colorspace_settings->name, colorspace, sizeof(colorspace_settings->name));
STRNCPY(colorspace_settings->name, colorspace);
}
if (ibuf != NULL) {
@@ -684,7 +684,7 @@ static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const char
if (colorspace_settings->name[0] == '\0') {
const char *colorspace = IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_DEFAULT_BYTE);
BLI_strncpy(colorspace_settings->name, colorspace, sizeof(colorspace_settings->name));
STRNCPY(colorspace_settings->name, colorspace);
}
if (ibuf != NULL) {
@@ -697,7 +697,7 @@ static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const char
return NULL;
}
BLI_strncpy(ibuf->name, name, sizeof(ibuf->name));
STRNCPY(ibuf->name, name);
ibuf->userflags |= IB_BITMAPDIRTY;
switch (gen_type) {
@@ -727,7 +727,7 @@ Image *BKE_image_add_generated(
int view_id;
const char *names[2] = {STEREO_LEFT_NAME, STEREO_RIGHT_NAME};
/* BLI_strncpy(ima->name, name, FILE_MAX); */ /* don't do this, this writes in ain invalid filepath! */
/* STRNCPY(ima->name, name); */ /* don't do this, this writes in ain invalid filepath! */
ima->gen_x = width;
ima->gen_y = height;
ima->gen_type = gen_type;
@@ -768,7 +768,7 @@ Image *BKE_image_add_from_imbuf(ImBuf *ibuf, const char *name)
ima = image_alloc(G.main, name, IMA_SRC_FILE, IMA_TYPE_IMAGE);
if (ima) {
BLI_strncpy(ima->name, ibuf->name, FILE_MAX);
STRNCPY(ima->name, ibuf->name);
image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
ima->ok = IMA_OK_LOADED;
}
@@ -814,7 +814,7 @@ static void image_memorypack_multiview(Image *ima)
pf->size = ibuf->encodedsize;
imapf = MEM_mallocN(sizeof(ImagePackedFile), "Image PackedFile");
BLI_strncpy(imapf->filepath, iv->filepath, sizeof(imapf->filepath));
STRNCPY(imapf->filepath, iv->filepath);
imapf->packedfile = pf;
BLI_addtail(&ima->packedfiles, imapf);
@@ -864,7 +864,7 @@ void BKE_image_memorypack(Image *ima)
pf->size = ibuf->encodedsize;
imapf = MEM_mallocN(sizeof(ImagePackedFile), "Image PackedFile");
BLI_strncpy(imapf->filepath, ima->name, sizeof(imapf->filepath));
STRNCPY(imapf->filepath, ima->name);
imapf->packedfile = pf;
BLI_addtail(&ima->packedfiles, imapf);
@@ -890,7 +890,7 @@ void BKE_image_packfiles(ReportList *reports, Image *ima, const char *basepath)
BLI_addtail(&ima->packedfiles, imapf);
imapf->packedfile = newPackedFile(reports, ima->name, basepath);
if (imapf->packedfile) {
BLI_strncpy(imapf->filepath, ima->name, sizeof(imapf->filepath));
STRNCPY(imapf->filepath, ima->name);
}
else {
BLI_freelinkN(&ima->packedfiles, imapf);
@@ -904,7 +904,7 @@ void BKE_image_packfiles(ReportList *reports, Image *ima, const char *basepath)
imapf->packedfile = newPackedFile(reports, iv->filepath, basepath);
if (imapf->packedfile) {
BLI_strncpy(imapf->filepath, iv->filepath, sizeof(imapf->filepath));
STRNCPY(imapf->filepath, iv->filepath);
}
else {
BLI_freelinkN(&ima->packedfiles, imapf);
@@ -924,7 +924,7 @@ void BKE_image_packfiles_from_mem(ReportList *reports, Image *ima, char *data, c
ImagePackedFile *imapf = MEM_mallocN(sizeof(ImagePackedFile), __func__);
BLI_addtail(&ima->packedfiles, imapf);
imapf->packedfile = newPackedFileMemory(data, data_len);
BLI_strncpy(imapf->filepath, ima->name, sizeof(imapf->filepath));
STRNCPY(imapf->filepath, ima->name);
}
}
@@ -1653,7 +1653,7 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
time_t t;
if (scene->r.stamp & R_STAMP_FILENAME) {
BLI_snprintf(stamp_data->file, sizeof(stamp_data->file), do_prefix ? "File %s" : "%s", G.relbase_valid ? G.main->name : "<untitled>");
SNPRINTF(stamp_data->file, do_prefix ? "File %s" : "%s", G.relbase_valid ? G.main->name : "<untitled>");
}
else {
stamp_data->file[0] = '\0';
@@ -1661,7 +1661,7 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
if (scene->r.stamp & R_STAMP_NOTE) {
/* Never do prefix for Note */
BLI_snprintf(stamp_data->note, sizeof(stamp_data->note), "%s", scene->r.stamp_udata);
SNPRINTF(stamp_data->note, "%s", scene->r.stamp_udata);
}
else {
stamp_data->note[0] = '\0';
@@ -1670,8 +1670,9 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
if (scene->r.stamp & R_STAMP_DATE) {
t = time(NULL);
tl = localtime(&t);
BLI_snprintf(text, sizeof(text), "%04d/%02d/%02d %02d:%02d:%02d", tl->tm_year + 1900, tl->tm_mon + 1, tl->tm_mday, tl->tm_hour, tl->tm_min, tl->tm_sec);
BLI_snprintf(stamp_data->date, sizeof(stamp_data->date), do_prefix ? "Date %s" : "%s", text);
SNPRINTF(text, "%04d/%02d/%02d %02d:%02d:%02d",
tl->tm_year + 1900, tl->tm_mon + 1, tl->tm_mday, tl->tm_hour, tl->tm_min, tl->tm_sec);
SNPRINTF(stamp_data->date, do_prefix ? "Date %s" : "%s", text);
}
else {
stamp_data->date[0] = '\0';
@@ -1680,10 +1681,10 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
if (use_dynamic && scene->r.stamp & R_STAMP_MARKER) {
const char *name = BKE_scene_find_last_marker_name(scene, CFRA);
if (name) BLI_strncpy(text, name, sizeof(text));
else BLI_strncpy(text, "<none>", sizeof(text));
if (name) STRNCPY(text, name);
else STRNCPY(text, "<none>");
BLI_snprintf(stamp_data->marker, sizeof(stamp_data->marker), do_prefix ? "Marker %s" : "%s", text);
SNPRINTF(stamp_data->marker, do_prefix ? "Marker %s" : "%s", text);
}
else {
stamp_data->marker[0] = '\0';
@@ -1692,7 +1693,7 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
if (use_dynamic && scene->r.stamp & R_STAMP_TIME) {
const short timecode_style = USER_TIMECODE_SMPTE_FULL;
BLI_timecode_string_from_time(text, sizeof(text), 0, FRA2TIME(scene->r.cfra), FPS, timecode_style);
BLI_snprintf(stamp_data->time, sizeof(stamp_data->time), do_prefix ? "Timecode %s" : "%s", text);
SNPRINTF(stamp_data->time, do_prefix ? "Timecode %s" : "%s", text);
}
else {
stamp_data->time[0] = '\0';
@@ -1705,24 +1706,24 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
if (scene->r.efra > 9)
digits = integer_digits_i(scene->r.efra);
BLI_snprintf(fmtstr, sizeof(fmtstr), do_prefix ? "Frame %%0%di" : "%%0%di", digits);
BLI_snprintf(stamp_data->frame, sizeof(stamp_data->frame), fmtstr, scene->r.cfra);
SNPRINTF(fmtstr, do_prefix ? "Frame %%0%di" : "%%0%di", digits);
SNPRINTF(stamp_data->frame, fmtstr, scene->r.cfra);
}
else {
stamp_data->frame[0] = '\0';
}
if (scene->r.stamp & R_STAMP_FRAME_RANGE) {
BLI_snprintf(stamp_data->frame_range, sizeof(stamp_data->frame),
do_prefix ? "Frame Range %d:%d" : "%d:%d",
scene->r.sfra, scene->r.efra);
SNPRINTF(stamp_data->frame_range,
do_prefix ? "Frame Range %d:%d" : "%d:%d",
scene->r.sfra, scene->r.efra);
}
else {
stamp_data->frame_range[0] = '\0';
}
if (use_dynamic && scene->r.stamp & R_STAMP_CAMERA) {
BLI_snprintf(stamp_data->camera, sizeof(stamp_data->camera), do_prefix ? "Camera %s" : "%s", camera ? camera->id.name + 2 : "<none>");
SNPRINTF(stamp_data->camera, do_prefix ? "Camera %s" : "%s", camera ? camera->id.name + 2 : "<none>");
}
else {
stamp_data->camera[0] = '\0';
@@ -1730,20 +1731,20 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
if (use_dynamic && scene->r.stamp & R_STAMP_CAMERALENS) {
if (camera && camera->type == OB_CAMERA) {
BLI_snprintf(text, sizeof(text), "%.2f", ((Camera *)camera->data)->lens);
SNPRINTF(text, "%.2f", ((Camera *)camera->data)->lens);
}
else {
BLI_strncpy(text, "<none>", sizeof(text));
STRNCPY(text, "<none>");
}
BLI_snprintf(stamp_data->cameralens, sizeof(stamp_data->cameralens), do_prefix ? "Lens %s" : "%s", text);
SNPRINTF(stamp_data->cameralens, do_prefix ? "Lens %s" : "%s", text);
}
else {
stamp_data->cameralens[0] = '\0';
}
if (scene->r.stamp & R_STAMP_SCENE) {
BLI_snprintf(stamp_data->scene, sizeof(stamp_data->scene), do_prefix ? "Scene %s" : "%s", scene->id.name + 2);
SNPRINTF(stamp_data->scene, do_prefix ? "Scene %s" : "%s", scene->id.name + 2);
}
else {
stamp_data->scene[0] = '\0';
@@ -1752,10 +1753,10 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
if (use_dynamic && scene->r.stamp & R_STAMP_SEQSTRIP) {
Sequence *seq = BKE_sequencer_foreground_frame_get(scene, scene->r.cfra);
if (seq) BLI_strncpy(text, seq->name + 2, sizeof(text));
else BLI_strncpy(text, "<none>", sizeof(text));
if (seq) STRNCPY(text, seq->name + 2);
else STRNCPY(text, "<none>");
BLI_snprintf(stamp_data->strip, sizeof(stamp_data->strip), do_prefix ? "Strip %s" : "%s", text);
SNPRINTF(stamp_data->strip, do_prefix ? "Strip %s" : "%s", text);
}
else {
stamp_data->strip[0] = '\0';
@@ -1768,21 +1769,21 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
if (use_dynamic && stats && (scene->r.stamp & R_STAMP_RENDERTIME)) {
BLI_timecode_string_from_time_simple(text, sizeof(text), stats->lastframetime);
BLI_snprintf(stamp_data->rendertime, sizeof(stamp_data->rendertime), do_prefix ? "RenderTime %s" : "%s", text);
SNPRINTF(stamp_data->rendertime, do_prefix ? "RenderTime %s" : "%s", text);
}
else {
stamp_data->rendertime[0] = '\0';
}
if (use_dynamic && stats && (scene->r.stamp & R_STAMP_MEMORY)) {
BLI_snprintf(stamp_data->memory, sizeof(stamp_data->memory), do_prefix ? "Peak Memory %.2fM" : "%.2fM", stats->mem_peak);
SNPRINTF(stamp_data->memory, do_prefix ? "Peak Memory %.2fM" : "%.2fM", stats->mem_peak);
}
else {
stamp_data->memory[0] = '\0';
}
}
if (scene->r.stamp & R_STAMP_FRAME_RANGE) {
BLI_snprintf(stamp_data->frame_range, sizeof(stamp_data->frame_range),
SNPRINTF(stamp_data->frame_range,
do_prefix ? "Frame Range %d:%d" : "%d:%d", scene->r.sfra, scene->r.efra);
}
else {
@@ -1796,73 +1797,73 @@ static void stampdata_from_template(StampData *stamp_data,
const StampData *stamp_data_template)
{
if (scene->r.stamp & R_STAMP_FILENAME) {
BLI_snprintf(stamp_data->file, sizeof(stamp_data->file), "File %s", stamp_data_template->file);
SNPRINTF(stamp_data->file, "File %s", stamp_data_template->file);
}
else {
stamp_data->file[0] = '\0';
}
if (scene->r.stamp & R_STAMP_NOTE) {
BLI_snprintf(stamp_data->note, sizeof(stamp_data->note), "%s", stamp_data_template->note);
SNPRINTF(stamp_data->note, "%s", stamp_data_template->note);
}
else {
stamp_data->note[0] = '\0';
}
if (scene->r.stamp & R_STAMP_DATE) {
BLI_snprintf(stamp_data->date, sizeof(stamp_data->date), "Date %s", stamp_data_template->date);
SNPRINTF(stamp_data->date, "Date %s", stamp_data_template->date);
}
else {
stamp_data->date[0] = '\0';
}
if (scene->r.stamp & R_STAMP_MARKER) {
BLI_snprintf(stamp_data->marker, sizeof(stamp_data->marker), "Marker %s", stamp_data_template->marker);
SNPRINTF(stamp_data->marker, "Marker %s", stamp_data_template->marker);
}
else {
stamp_data->marker[0] = '\0';
}
if (scene->r.stamp & R_STAMP_TIME) {
BLI_snprintf(stamp_data->time, sizeof(stamp_data->time), "Timecode %s", stamp_data_template->time);
SNPRINTF(stamp_data->time, "Timecode %s", stamp_data_template->time);
}
else {
stamp_data->time[0] = '\0';
}
if (scene->r.stamp & R_STAMP_FRAME) {
BLI_snprintf(stamp_data->frame, sizeof(stamp_data->frame), "Frame %s", stamp_data_template->frame);
SNPRINTF(stamp_data->frame, "Frame %s", stamp_data_template->frame);
}
else {
stamp_data->frame[0] = '\0';
}
if (scene->r.stamp & R_STAMP_CAMERA) {
BLI_snprintf(stamp_data->camera, sizeof(stamp_data->camera), "Camera %s", stamp_data_template->camera);
SNPRINTF(stamp_data->camera, "Camera %s", stamp_data_template->camera);
}
else {
stamp_data->camera[0] = '\0';
}
if (scene->r.stamp & R_STAMP_CAMERALENS) {
BLI_snprintf(stamp_data->cameralens, sizeof(stamp_data->cameralens), "Lens %s", stamp_data_template->cameralens);
SNPRINTF(stamp_data->cameralens, "Lens %s", stamp_data_template->cameralens);
}
else {
stamp_data->cameralens[0] = '\0';
}
if (scene->r.stamp & R_STAMP_SCENE) {
BLI_snprintf(stamp_data->scene, sizeof(stamp_data->scene), "Scene %s", stamp_data_template->scene);
SNPRINTF(stamp_data->scene, "Scene %s", stamp_data_template->scene);
}
else {
stamp_data->scene[0] = '\0';
}
if (scene->r.stamp & R_STAMP_SEQSTRIP) {
BLI_snprintf(stamp_data->strip, sizeof(stamp_data->strip), "Strip %s", stamp_data_template->strip);
SNPRINTF(stamp_data->strip, "Strip %s", stamp_data_template->strip);
}
else {
stamp_data->strip[0] = '\0';
}
if (scene->r.stamp & R_STAMP_RENDERTIME) {
BLI_snprintf(stamp_data->rendertime, sizeof(stamp_data->rendertime), "RenderTime %s", stamp_data_template->rendertime);
SNPRINTF(stamp_data->rendertime, "RenderTime %s", stamp_data_template->rendertime);
}
else {
stamp_data->rendertime[0] = '\0';
}
if (scene->r.stamp & R_STAMP_MEMORY) {
BLI_snprintf(stamp_data->memory, sizeof(stamp_data->memory), "Peak Memory %s", stamp_data_template->memory);
SNPRINTF(stamp_data->memory, "Peak Memory %s", stamp_data_template->memory);
}
else {
stamp_data->memory[0] = '\0';
@@ -2197,8 +2198,8 @@ void BKE_render_result_stamp_data(RenderResult *rr, const char *key, const char
stamp_data = rr->stamp_data;
StampDataCustomField *field = MEM_mallocN(sizeof(StampDataCustomField),
"StampData Custom Field");
BLI_strncpy(field->key, key, sizeof(field->key));
BLI_strncpy(field->value, value, sizeof(field->value));
STRNCPY(field->key, key);
STRNCPY(field->value, value);
BLI_addtail(&stamp_data->custom_fields, field);
}
@@ -3001,7 +3002,7 @@ static void image_init_multilayer_multiview(Image *ima, RenderResult *rr)
if (rr) {
for (RenderView *rv = rr->views.first; rv; rv = rv->next) {
ImageView *iv = MEM_callocN(sizeof(ImageView), "Viewer Image View");
BLI_strncpy(iv->name, rv->name, sizeof(iv->name));
STRNCPY(iv->name, rv->name);
BLI_addtail(&ima->views, iv);
}
}
@@ -3082,8 +3083,8 @@ static void image_add_view(Image *ima, const char *viewname, const char *filepat
ImageView *iv;
iv = MEM_mallocN(sizeof(ImageView), "Viewer Image View");
BLI_strncpy(iv->name, viewname, sizeof(iv->name));
BLI_strncpy(iv->filepath, filepath, sizeof(iv->filepath));
STRNCPY(iv->name, viewname);
STRNCPY(iv->filepath, filepath);
/* For stereo drawing we need to ensure:
* STEREO_LEFT_NAME == STEREO_LEFT_ID and
@@ -3533,7 +3534,7 @@ static ImBuf *load_image_single(
ImagePackedFile *imapf = MEM_mallocN(sizeof(ImagePackedFile), "Image Packefile");
BLI_addtail(&ima->packedfiles, imapf);
BLI_strncpy(imapf->filepath, filepath, sizeof(imapf->filepath));
STRNCPY(imapf->filepath, filepath);
imapf->packedfile = newPackedFile(NULL, filepath, ID_BLEND_PATH(G.main, &ima->id));
}
}
@@ -4688,7 +4689,7 @@ static void image_update_views_format(Image *ima, ImageUser *iuser)
for (srv = scene->r.views.first; srv; srv = srv->next) {
if (BKE_scene_multiview_is_render_view_active(&scene->r, srv)) {
char filepath[FILE_MAX];
BLI_snprintf(filepath, sizeof(filepath), "%s%s%s", prefix, srv->suffix, ext);
SNPRINTF(filepath, "%s%s%s", prefix, srv->suffix, ext);
image_add_view(ima, srv->name, filepath);
}
}
@@ -4699,7 +4700,7 @@ static void image_update_views_format(Image *ima, ImageUser *iuser)
int file;
char str[FILE_MAX];
BLI_strncpy(str, iv->filepath, sizeof(str));
STRNCPY(str, iv->filepath);
BLI_path_abs(str, G.main->name);
/* exists? */

View File

@@ -18,8 +18,8 @@
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/editors/util/undo_system.c
* \ingroup edutil
/** \file blender/blenkernel/intern/undo_system.c
* \ingroup bke
*
* Used by ED_undo.h, internal implementation.
*/

View File

@@ -77,6 +77,16 @@ size_t BLI_str_partition_ex_utf8(
#define BLI_UTF8_WIDTH_MAX 2 /* columns */
#define BLI_UTF8_ERR ((unsigned int)-1)
/** \name String Copy/Format Macros
* Avoid repeating destination with `sizeof(..)`.
* \note `ARRAY_SIZE` allows pointers on some platforms.
* \{ */
#define STRNCPY_UTF8(dst, src) \
BLI_strncpy_utf8(dst, src, ARRAY_SIZE(dst))
#define STRNCPY_UTF8_RLEN(dst, src) \
BLI_strncpy_utf8_rlen(dst, src, ARRAY_SIZE(dst))
/** \} */
#ifdef __cplusplus
}
#endif

View File

@@ -592,6 +592,12 @@ void AnimationImporter:: Assign_color_animations(const COLLADAFW::UniqueId& list
BLI_strncpy(rna_path, anim_type, sizeof(rna_path));
const COLLADAFW::AnimationList *animlist = animlist_map[listid];
if (animlist == NULL)
{
fprintf(stderr, "Collada: No animlist found for ID: %s of type %s\n", listid.toAscii().c_str(), anim_type);
return;
}
const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings();
//all the curves belonging to the current binding
std::vector<FCurve *> animcurves;
@@ -889,11 +895,22 @@ static const double get_aspect_ratio(const COLLADAFW::Camera *camera)
return aspect;
}
static ListBase &get_animation_curves(Material *ma)
{
bAction *act;
if (!ma->adt || !ma->adt->action)
act = verify_adt_action((ID *)&ma->id, 1);
else
act = ma->adt->action;
return act->curves;
}
void AnimationImporter::translate_Animations(COLLADAFW::Node *node,
std::map<COLLADAFW::UniqueId, COLLADAFW::Node *>& root_map,
std::multimap<COLLADAFW::UniqueId, Object *>& object_map,
std::map<COLLADAFW::UniqueId, const COLLADAFW::Object *> FW_object_map)
std::map<COLLADAFW::UniqueId, const COLLADAFW::Object *> FW_object_map,
std::map<COLLADAFW::UniqueId, Material*> uid_material_map)
{
bool is_joint = node->getType() == COLLADAFW::Node::JOINT;
COLLADAFW::UniqueId uid = node->getUniqueId();
@@ -1071,11 +1088,6 @@ void AnimationImporter::translate_Animations(COLLADAFW::Node *node,
}
}
if (animType->material != 0) {
Material *ma = give_current_material(ob, 1);
if (!ma->adt || !ma->adt->action) act = verify_adt_action((ID *)&ma->id, 1);
else act = ma->adt->action;
ListBase *AnimCurves = &(act->curves);
const COLLADAFW::InstanceGeometryPointerArray& nodeGeoms = node->getInstanceGeometries();
for (unsigned int i = 0; i < nodeGeoms.getCount(); i++) {
@@ -1084,30 +1096,36 @@ void AnimationImporter::translate_Animations(COLLADAFW::Node *node,
const COLLADAFW::UniqueId & matuid = matBinds[j].getReferencedMaterial();
const COLLADAFW::Effect *ef = (COLLADAFW::Effect *) (FW_object_map[matuid]);
if (ef != NULL) { /* can be NULL [#28909] */
const COLLADAFW::CommonEffectPointerArray& commonEffects = ef->getCommonEffects();
Material *ma = uid_material_map[matuid];
if (!ma) {
fprintf(stderr, "Collada: Node %s refers to undefined material\n", node->getName().c_str());
continue;
}
ListBase &AnimCurves = get_animation_curves(ma);
const COLLADAFW::CommonEffectPointerArray& commonEffects = ef->getCommonEffects();
COLLADAFW::EffectCommon *efc = commonEffects[0];
if ((animType->material & MATERIAL_SHININESS) != 0) {
const COLLADAFW::FloatOrParam *shin = &(efc->getShininess());
const COLLADAFW::UniqueId& listid = shin->getAnimationList();
Assign_float_animations(listid, AnimCurves, "specular_hardness");
const COLLADAFW::UniqueId& listid = shin->getAnimationList();
Assign_float_animations(listid, &AnimCurves, "specular_hardness");
}
if ((animType->material & MATERIAL_IOR) != 0) {
const COLLADAFW::FloatOrParam *ior = &(efc->getIndexOfRefraction());
const COLLADAFW::UniqueId& listid = ior->getAnimationList();
Assign_float_animations(listid, AnimCurves, "raytrace_transparency.ior");
const COLLADAFW::UniqueId& listid = ior->getAnimationList();
Assign_float_animations(listid, &AnimCurves, "raytrace_transparency.ior");
}
if ((animType->material & MATERIAL_SPEC_COLOR) != 0) {
const COLLADAFW::ColorOrTexture *cot = &(efc->getSpecular());
const COLLADAFW::UniqueId& listid = cot->getColor().getAnimationList();
Assign_color_animations(listid, AnimCurves, "specular_color");
const COLLADAFW::UniqueId& listid = cot->getColor().getAnimationList();
Assign_color_animations(listid, &AnimCurves, "specular_color");
}
if ((animType->material & MATERIAL_DIFF_COLOR) != 0) {
const COLLADAFW::ColorOrTexture *cot = &(efc->getDiffuse());
const COLLADAFW::UniqueId& listid = cot->getColor().getAnimationList();
Assign_color_animations(listid, AnimCurves, "diffuse_color");
const COLLADAFW::UniqueId& listid = cot->getColor().getAnimationList();
Assign_color_animations(listid, &AnimCurves, "diffuse_color");
}
}
}

View File

@@ -156,7 +156,8 @@ public:
void translate_Animations(COLLADAFW::Node * Node,
std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>& root_map,
std::multimap<COLLADAFW::UniqueId, Object*>& object_map,
std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map);
std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map,
std::map<COLLADAFW::UniqueId, Material*> uid_material_map);
AnimMix* get_animation_type( const COLLADAFW::Node * node, std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map );

View File

@@ -317,7 +317,7 @@ void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, COLLADAFW
translate_anim_recursive(node, node, parob);
}
else {
anim_importer.translate_Animations(node, root_map, object_map, FW_object_map);
anim_importer.translate_Animations(node, root_map, object_map, FW_object_map, uid_material_map);
COLLADAFW::NodePointerArray &children = node->getChildNodes();
for (i = 0; i < children.getCount(); i++) {
translate_anim_recursive(children[i], node, NULL);

View File

@@ -151,7 +151,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
include_animations = RNA_boolean_get(op->ptr, "include_animations");
sample_animations = RNA_boolean_get(op->ptr, "sample_animations");
sampling_rate = (sample_animations)? RNA_int_get(op->ptr, "sampling_rate") : 0;
sampling_rate = (sample_animations) ? RNA_int_get(op->ptr, "sampling_rate") : 0;
deform_bones_only = RNA_boolean_get(op->ptr, "deform_bones_only");
@@ -490,8 +490,7 @@ static int wm_collada_import_exec(bContext *C, wmOperator *op)
import_settings.min_chain_length = min_chain_length;
import_settings.keep_bind_info = keep_bind_info != 0;
if (collada_import(C, &import_settings) )
{
if (collada_import(C, &import_settings)) {
DEG_id_tag_update(&CTX_data_scene(C)->id, DEG_TAG_BASE_FLAGS_UPDATE);
return OPERATOR_FINISHED;
}

View File

@@ -21,7 +21,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/editors/metaball/lattice_intern.h
/** \file blender/editors/lattice/lattice_intern.h
* \ingroup edlattice
*/

View File

@@ -24,7 +24,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/editors/metaball/lattice_ops.c
/** \file blender/editors/lattice/lattice_ops.c
* \ingroup edlattice
*/

View File

@@ -643,7 +643,7 @@ static void render_image_restore_layer(RenderJob *rj)
/* For single layer renders keep the active layer
* visible, or show the compositing result. */
RenderResult *rr = RE_AcquireResultRead(rj->re);
if(RE_HasCombinedLayer(rr)) {
if (RE_HasCombinedLayer(rr)) {
sima->iuser.layer = 0;
}
RE_ReleaseResult(rj->re);

View File

@@ -25,7 +25,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/editors/util/undo.c
/** \file blender/editors/undo/ed_undo.c
* \ingroup edundo
*/

View File

@@ -18,7 +18,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/editors/util/memfile_undo.c
/** \file blender/editors/undo/memfile_undo.c
* \ingroup edundo
*
* Wrapper between 'ED_undo.h' and 'BKE_undo_system.h' API's.

View File

@@ -18,7 +18,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/editors/util/undo_system_types.c
/** \file blender/editors/undo/undo_system_types.c
* \ingroup edundo
*/

View File

@@ -25,7 +25,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/imbuf/intern/IMB_metadata.h
/** \file blender/imbuf/IMB_metadata.h
* \ingroup imbuf
*/

View File

@@ -81,7 +81,7 @@ short IMB_saveiff(struct ImBuf *ibuf, const char *name, int flags)
bool IMB_prepare_write_ImBuf(const bool isfloat, ImBuf *ibuf)
{
bool changed = false;
bool changed = false;
if (isfloat) {
/* pass */
@@ -90,9 +90,9 @@ bool IMB_prepare_write_ImBuf(const bool isfloat, ImBuf *ibuf)
if (ibuf->rect == NULL && ibuf->rect_float) {
ibuf->rect_colorspace = colormanage_colorspace_get_roled(COLOR_ROLE_DEFAULT_BYTE);
IMB_rect_from_float(ibuf);
if (ibuf->rect != NULL) {
changed = true;
}
if (ibuf->rect != NULL) {
changed = true;
}
}
}

View File

@@ -5230,7 +5230,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna)
};
static const EnumPropertyItem ffmpeg_codec_items[] = {
{AV_CODEC_ID_NONE, "NONE", 0, "None", ""},
{AV_CODEC_ID_NONE, "NONE", 0, "No Video", "Disables video output, for audio-only renders"},
{AV_CODEC_ID_MPEG1VIDEO, "MPEG1", 0, "MPEG-1", ""},
{AV_CODEC_ID_MPEG2VIDEO, "MPEG2", 0, "MPEG-2", ""},
{AV_CODEC_ID_MPEG4, "MPEG4", 0, "MPEG-4(divx)", ""},
@@ -5260,8 +5260,8 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna)
};
static const EnumPropertyItem ffmpeg_crf_items[] = {
{FFM_CRF_NONE, "NONE", 0, "None; use custom bitrate",
"Use constant bit rate, rather than constant output quality"},
{FFM_CRF_NONE, "NONE", 0, "Constant Bitrate",
"Configure constant bit rate, rather than constant output quality"},
{FFM_CRF_LOSSLESS, "LOSSLESS", 0, "Lossless", ""},
{FFM_CRF_PERC_LOSSLESS, "PERC_LOSSLESS", 0, "Perceptually lossless", ""},
{FFM_CRF_HIGH, "HIGH", 0, "High quality", ""},
@@ -5273,7 +5273,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna)
};
static const EnumPropertyItem ffmpeg_audio_codec_items[] = {
{AV_CODEC_ID_NONE, "NONE", 0, "None", ""},
{AV_CODEC_ID_NONE, "NONE", 0, "No Audio", "Disables audio output, for video-only renders"},
{AV_CODEC_ID_MP2, "MP2", 0, "MP2", ""},
{AV_CODEC_ID_MP3, "MP3", 0, "MP3", ""},
{AV_CODEC_ID_AC3, "AC3", 0, "AC3", ""},
@@ -5312,7 +5312,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_enum_items(prop, ffmpeg_codec_items);
RNA_def_property_enum_default(prop, AV_CODEC_ID_H264);
RNA_def_property_ui_text(prop, "Codec", "FFmpeg codec to use");
RNA_def_property_ui_text(prop, "Video Codec", "FFmpeg codec to use for video output");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_FFmpegSettings_codec_settings_update");
prop = RNA_def_property(srna, "video_bitrate", PROP_INT, PROP_NONE);

View File

@@ -907,7 +907,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
RNA_def_property_range(prop, 0.0, 1.0);
RNA_def_property_ui_range(prop, 0.0, 1.0, 0.1, 3);
RNA_def_property_ui_text(prop, "Clipping",
"Value under which voxels are considered empty space to optimize caching or rendering");
"Value under which voxels are considered empty space to optimize caching or rendering");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
}

View File

@@ -41,7 +41,7 @@ static bNodeSocketTemplate sh_node_volume_principled_in[] = {
{ SOCK_FLOAT, 1, N_("Blackbody Intensity"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
{ SOCK_RGBA, 1, N_("Blackbody Tint"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Temperature"), 1000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 6500.0f},
{ SOCK_STRING, 1, N_("Temperature Attribute"),0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_STRING, 1, N_("Temperature Attribute"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ -1, 0, "" }
};

View File

@@ -381,7 +381,7 @@ static uiBlock *block_create_confirm_quit(struct bContext *C, struct ARegion *ar
uiStyle *style = UI_style_get();
uiBlock *block = UI_block_begin(C, ar, "confirm_quit_popup", UI_EMBOSS);
UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_LOOP | UI_BLOCK_NO_WIN_CLIP );
UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_LOOP | UI_BLOCK_NO_WIN_CLIP | UI_BLOCK_NUMSELECT);
UI_block_emboss_set(block, UI_EMBOSS);
uiLayout *layout = UI_block_layout(