diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2016-09-23 02:40:19 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2016-09-23 02:40:19 +0300 |
commit | 1dfb89d229304c302b8849756aa0ddd7e8d96488 (patch) | |
tree | db7a2ed403101788b2cb308538d73a99c95621d6 /source | |
parent | 4a1feaa5558ed60388fd3be41db74fbc54f2ab08 (diff) | |
parent | 1b2b7cfa2007172e07d78324bb941d0160b59c42 (diff) |
Merge branch 'master' into blender2.8
Conflicts:
intern/ghost/intern/GHOST_ContextCGL.mm
intern/ghost/intern/GHOST_WindowCocoa.mm
source/blender/makesrna/intern/rna_main.c
Diffstat (limited to 'source')
107 files changed, 1096 insertions, 797 deletions
diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc index 41261ffaa30..5977a072ccd 100644 --- a/source/blender/alembic/intern/abc_mesh.cc +++ b/source/blender/alembic/intern/abc_mesh.cc @@ -1104,44 +1104,20 @@ void AbcMeshReader::readFaceSetsSample(Main *bmain, Mesh *mesh, size_t poly_star utils::assign_materials(bmain, m_object, mat_map); } -typedef std::pair<Alembic::AbcCoreAbstract::index_t, float> index_time_pair_t; - static void get_weight_and_index(CDStreamConfig &config, Alembic::AbcCoreAbstract::TimeSamplingPtr time_sampling, size_t samples_number) { - if (samples_number == 0) { - samples_number = 1; - } - - index_time_pair_t floor_index = time_sampling->getFloorIndex(config.time, samples_number); - - config.index = floor_index.first; - config.ceil_index = config.index; - - if (fabs(config.time - floor_index.second) < 0.0001f) { - config.weight = 0.0f; - return; - } + Alembic::AbcGeom::index_t i0, i1; - index_time_pair_t ceil_index = time_sampling->getCeilIndex(config.time, samples_number); - - if (config.index == ceil_index.first) { - config.weight = 0.0f; - return; - } - - config.ceil_index = ceil_index.first; - - float alpha = (config.time - floor_index.second) / (ceil_index.second - floor_index.second); - - /* Since we so closely match the ceiling, we'll just use it. */ - if (fabs(1.0f - alpha) < 0.0001f) { - config.index = config.ceil_index; - alpha = 0.0f; - } + config.weight = get_weight_and_index(config.time, + time_sampling, + samples_number, + i0, + i1); - config.weight = alpha; + config.index = i0; + config.ceil_index = i1; } void read_mesh_sample(ImportSettings *settings, diff --git a/source/blender/alembic/intern/abc_object.cc b/source/blender/alembic/intern/abc_object.cc index 5b7b85f10ea..32468fdaded 100644 --- a/source/blender/alembic/intern/abc_object.cc +++ b/source/blender/alembic/intern/abc_object.cc @@ -153,6 +153,61 @@ Object *AbcObjectReader::object() const return m_object; } +static Imath::M44d blend_matrices(const Imath::M44d &m0, const Imath::M44d &m1, const float weight) +{ + float mat0[4][4], mat1[4][4], ret[4][4]; + + /* Cannot use Imath::M44d::getValue() since this returns a pointer to + * doubles and interp_m4_m4m4 expects pointers to floats. So need to convert + * the matrices manually. + */ + + for (int i = 0; i < 4; ++i) { + for (int j = 0; j < 4; ++j) { + mat0[i][j] = m0[i][j]; + } + } + + for (int i = 0; i < 4; ++i) { + for (int j = 0; j < 4; ++j) { + mat1[i][j] = m1[i][j]; + } + } + + interp_m4_m4m4(ret, mat0, mat1, weight); + + Imath::M44d m; + + for (int i = 0; i < 4; ++i) { + for (int j = 0; j < 4; ++j) { + m[i][j] = ret[i][j]; + } + } + + return m; +} + +Imath::M44d get_matrix(const IXformSchema &schema, const float time) +{ + Alembic::AbcGeom::index_t i0, i1; + Alembic::AbcGeom::XformSample s0, s1; + + const float weight = get_weight_and_index(time, + schema.getTimeSampling(), + schema.getNumSamples(), + i0, + i1); + + schema.get(s0, Alembic::AbcGeom::ISampleSelector(i0)); + + if (i0 != i1) { + schema.get(s1, Alembic::AbcGeom::ISampleSelector(i1)); + return blend_matrices(s0.getMatrix(), s1.getMatrix(), weight); + } + + return s0.getMatrix(); +} + void AbcObjectReader::readObjectMatrix(const float time) { IXform ixform; @@ -194,11 +249,8 @@ void AbcObjectReader::readObjectMatrix(const float time) return; } - Alembic::AbcGeom::ISampleSelector sample_sel(time); - Alembic::AbcGeom::XformSample xs; - schema.get(xs, sample_sel); - - create_input_transform(sample_sel, ixform, m_object, m_object->obmat, m_settings->scale, has_alembic_parent); + const Imath::M44d matrix = get_matrix(schema, time); + convert_matrix(matrix, m_object, m_object->obmat, m_settings->scale, has_alembic_parent); invert_m4_m4(m_object->imat, m_object->obmat); diff --git a/source/blender/alembic/intern/abc_object.h b/source/blender/alembic/intern/abc_object.h index 2e885f296b1..a35faa37565 100644 --- a/source/blender/alembic/intern/abc_object.h +++ b/source/blender/alembic/intern/abc_object.h @@ -166,4 +166,6 @@ public: chrono_t maxTime() const; }; +Imath::M44d get_matrix(const Alembic::AbcGeom::IXformSchema &schema, const float time); + #endif /* __ABC_OBJECT_H__ */ diff --git a/source/blender/alembic/intern/abc_util.cc b/source/blender/alembic/intern/abc_util.cc index fbab0bcdf34..60c66bca1c8 100644 --- a/source/blender/alembic/intern/abc_util.cc +++ b/source/blender/alembic/intern/abc_util.cc @@ -201,16 +201,9 @@ void create_transform_matrix(float r_mat[4][4]) copy_m4_m4(r_mat, transform_mat); } -void create_input_transform(const Alembic::AbcGeom::ISampleSelector &sample_sel, - const Alembic::AbcGeom::IXform &ixform, Object *ob, - float r_mat[4][4], float scale, bool has_alembic_parent) +void convert_matrix(const Imath::M44d &xform, Object *ob, + float r_mat[4][4], float scale, bool has_alembic_parent) { - - const Alembic::AbcGeom::IXformSchema &ixform_schema = ixform.getSchema(); - Alembic::AbcGeom::XformSample xs; - ixform_schema.get(xs, sample_sel); - const Imath::M44d &xform = xs.getMatrix(); - for (int i = 0; i < 4; ++i) { for (int j = 0; j < 4; ++j) { r_mat[i][j] = xform[i][j]; @@ -435,3 +428,37 @@ bool has_property(const Alembic::Abc::ICompoundProperty &prop, const std::string return prop.getPropertyHeader(name) != NULL; } + +typedef std::pair<Alembic::AbcCoreAbstract::index_t, float> index_time_pair_t; + +float get_weight_and_index(float time, + const Alembic::AbcCoreAbstract::TimeSamplingPtr &time_sampling, + int samples_number, + Alembic::AbcGeom::index_t &i0, + Alembic::AbcGeom::index_t &i1) +{ + samples_number = std::max(samples_number, 1); + + index_time_pair_t t0 = time_sampling->getFloorIndex(time, samples_number); + i0 = i1 = t0.first; + + if (samples_number == 1 || (fabs(time - t0.second) < 0.0001f)) { + return 0.0f; + } + + index_time_pair_t t1 = time_sampling->getCeilIndex(time, samples_number); + i1 = t1.first; + + if (i0 == i1) { + return 0.0f; + } + + const float bias = (time - t0.second) / (t1.second - t0.second); + + if (fabs(1.0f - bias) < 0.0001f) { + i0 = i1; + return 0.0f; + } + + return bias; +} diff --git a/source/blender/alembic/intern/abc_util.h b/source/blender/alembic/intern/abc_util.h index 648570f5f27..9e9f0c397ba 100644 --- a/source/blender/alembic/intern/abc_util.h +++ b/source/blender/alembic/intern/abc_util.h @@ -59,9 +59,8 @@ bool begins_with(const TContainer &input, const TContainer &match) && std::equal(match.begin(), match.end(), input.begin()); } -void create_input_transform(const Alembic::AbcGeom::ISampleSelector &sample_sel, - const Alembic::AbcGeom::IXform &ixform, Object *ob, - float r_mat[4][4], float scale, bool has_alembic_parent = false); +void convert_matrix(const Imath::M44d &xform, Object *ob, + float r_mat[4][4], float scale, bool has_alembic_parent = false); template <typename Schema> void get_min_max_time_ex(const Schema &schema, chrono_t &min, chrono_t &max) @@ -95,6 +94,12 @@ void get_min_max_time(const Alembic::AbcGeom::IObject &object, const Schema &sch bool has_property(const Alembic::Abc::ICompoundProperty &prop, const std::string &name); +float get_weight_and_index(float time, + const Alembic::AbcCoreAbstract::TimeSamplingPtr &time_sampling, + int samples_number, + Alembic::AbcGeom::index_t &i0, + Alembic::AbcGeom::index_t &i1); + /* ************************** */ /* TODO(kevin): for now keeping these transformations hardcoded to make sure diff --git a/source/blender/alembic/intern/alembic_capi.cc b/source/blender/alembic/intern/alembic_capi.cc index 3cc549350ea..c6988351db8 100644 --- a/source/blender/alembic/intern/alembic_capi.cc +++ b/source/blender/alembic/intern/alembic_capi.cc @@ -799,9 +799,8 @@ void ABC_get_transform(AbcArchiveHandle *handle, Object *ob, const char *object_ return; } - ISampleSelector sample_sel(time); - - create_input_transform(sample_sel, ixform, ob, r_mat, scale); + const Imath::M44d matrix = get_matrix(schema, time); + convert_matrix(matrix, ob, r_mat, scale); } /* ***************************************** */ diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index 3ae01d8148a..55142510f9e 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -28,7 +28,7 @@ * and keep comment above the defines. * Use STRINGIFY() rather than defining with quotes */ #define BLENDER_VERSION 278 -#define BLENDER_SUBVERSION 0 +#define BLENDER_SUBVERSION 1 /* Several breakages with 270, e.g. constraint deg vs rad */ #define BLENDER_MINVERSION 270 #define BLENDER_MINSUBVERSION 6 diff --git a/source/blender/blenkernel/BKE_cachefile.h b/source/blender/blenkernel/BKE_cachefile.h index 7a9744ef9d6..b30143cbaec 100644 --- a/source/blender/blenkernel/BKE_cachefile.h +++ b/source/blender/blenkernel/BKE_cachefile.h @@ -39,6 +39,7 @@ struct Main; struct Scene; void BKE_cachefiles_init(void); +void BKE_cachefiles_exit(void); void *BKE_cachefile_add(struct Main *bmain, const char *name); diff --git a/source/blender/blenkernel/BKE_freestyle.h b/source/blender/blenkernel/BKE_freestyle.h index e10594634f0..50407f3bdfc 100644 --- a/source/blender/blenkernel/BKE_freestyle.h +++ b/source/blender/blenkernel/BKE_freestyle.h @@ -55,8 +55,7 @@ void BKE_freestyle_config_copy(FreestyleConfig *new_config, FreestyleConfig *con /* FreestyleConfig.modules */ FreestyleModuleConfig *BKE_freestyle_module_add(FreestyleConfig *config); bool BKE_freestyle_module_delete(FreestyleConfig *config, FreestyleModuleConfig *module_conf); -bool BKE_freestyle_module_move_up(FreestyleConfig *config, FreestyleModuleConfig *module_conf); -bool BKE_freestyle_module_move_down(FreestyleConfig *config, FreestyleModuleConfig *module_conf); +bool BKE_freestyle_module_move(FreestyleConfig *config, FreestyleModuleConfig *module_conf, int direction); /* FreestyleConfig.linesets */ FreestyleLineSet *BKE_freestyle_lineset_add(struct Main *bmain, FreestyleConfig *config, const char *name); diff --git a/source/blender/blenkernel/BKE_linestyle.h b/source/blender/blenkernel/BKE_linestyle.h index e96ef4e7be3..af9bf58ce77 100644 --- a/source/blender/blenkernel/BKE_linestyle.h +++ b/source/blender/blenkernel/BKE_linestyle.h @@ -73,10 +73,10 @@ int BKE_linestyle_alpha_modifier_remove(FreestyleLineStyle *linestyle, LineStyle int BKE_linestyle_thickness_modifier_remove(FreestyleLineStyle *linestyle, LineStyleModifier *modifier); int BKE_linestyle_geometry_modifier_remove(FreestyleLineStyle *linestyle, LineStyleModifier *modifier); -void BKE_linestyle_color_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction); -void BKE_linestyle_alpha_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction); -void BKE_linestyle_thickness_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction); -void BKE_linestyle_geometry_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction); +bool BKE_linestyle_color_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction); +bool BKE_linestyle_alpha_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction); +bool BKE_linestyle_thickness_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction); +bool BKE_linestyle_geometry_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction); void BKE_linestyle_modifier_list_color_ramps(FreestyleLineStyle *linestyle, ListBase *listbase); char *BKE_linestyle_path_to_color_ramp(FreestyleLineStyle *linestyle, struct ColorBand *color_ramp); diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 0805335da66..a8670395fc4 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -49,6 +49,7 @@ #include "BKE_blender_version.h" /* own include */ #include "BKE_blendfile.h" #include "BKE_brush.h" +#include "BKE_cachefile.h" #include "BKE_context.h" #include "BKE_depsgraph.h" #include "BKE_global.h" @@ -84,6 +85,7 @@ void BKE_blender_free(void) BKE_spacetypes_free(); /* after free main, it uses space callbacks */ IMB_exit(); + BKE_cachefiles_exit(); BKE_images_exit(); DAG_exit(); diff --git a/source/blender/blenkernel/intern/cachefile.c b/source/blender/blenkernel/intern/cachefile.c index 502f1d53ab2..e62e652b4a6 100644 --- a/source/blender/blenkernel/intern/cachefile.c +++ b/source/blender/blenkernel/intern/cachefile.c @@ -56,6 +56,11 @@ void BKE_cachefiles_init(void) BLI_spin_init(&spin); } +void BKE_cachefiles_exit(void) +{ + BLI_spin_end(&spin); +} + void *BKE_cachefile_add(Main *bmain, const char *name) { CacheFile *cache_file = BKE_libblock_alloc(bmain, ID_CF, name); diff --git a/source/blender/blenkernel/intern/freestyle.c b/source/blender/blenkernel/intern/freestyle.c index 3a15be5a09d..21fc1674dc5 100644 --- a/source/blender/blenkernel/intern/freestyle.c +++ b/source/blender/blenkernel/intern/freestyle.c @@ -151,22 +151,14 @@ bool BKE_freestyle_module_delete(FreestyleConfig *config, FreestyleModuleConfig return true; } -bool BKE_freestyle_module_move_up(FreestyleConfig *config, FreestyleModuleConfig *module_conf) -{ - if (BLI_findindex(&config->modules, module_conf) == -1) - return false; - BLI_remlink(&config->modules, module_conf); - BLI_insertlinkbefore(&config->modules, module_conf->prev, module_conf); - return true; -} - -bool BKE_freestyle_module_move_down(FreestyleConfig *config, FreestyleModuleConfig *module_conf) +/** + * Reinsert \a module_conf offset by \a direction from current position. + * \return if position of \a module_conf changed. + */ +bool BKE_freestyle_module_move(FreestyleConfig *config, FreestyleModuleConfig *module_conf, int direction) { - if (BLI_findindex(&config->modules, module_conf) == -1) - return false; - BLI_remlink(&config->modules, module_conf); - BLI_insertlinkafter(&config->modules, module_conf->next, module_conf); - return true; + return ((BLI_findindex(&config->modules, module_conf) > -1) && + (BLI_listbase_link_move(&config->modules, module_conf, direction) == true)); } void BKE_freestyle_lineset_unique_name(FreestyleConfig *config, FreestyleLineSet *lineset) diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 8a9cb73c8c9..a4eef2f9230 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1325,7 +1325,7 @@ char BKE_imtype_from_arg(const char *imtype_arg) else if (STREQ(imtype_arg, "EXR")) return R_IMF_IMTYPE_OPENEXR; else if (STREQ(imtype_arg, "MULTILAYER")) return R_IMF_IMTYPE_MULTILAYER; #endif - else if (STREQ(imtype_arg, "MPEG")) return R_IMF_IMTYPE_FFMPEG; + else if (STREQ(imtype_arg, "FFMPEG")) return R_IMF_IMTYPE_FFMPEG; else if (STREQ(imtype_arg, "FRAMESERVER")) return R_IMF_IMTYPE_FRAMESERVER; #ifdef WITH_CINEON else if (STREQ(imtype_arg, "CINEON")) return R_IMF_IMTYPE_CINEON; diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c index b538c556415..772ba2d9c80 100644 --- a/source/blender/blenkernel/intern/library_query.c +++ b/source/blender/blenkernel/intern/library_query.c @@ -831,10 +831,12 @@ void BKE_library_update_ID_link_user(ID *id_dst, ID *id_src, const int cd_flag) * This is a 'simplified' abstract version of #BKE_library_foreach_ID_link() above, quite useful to reduce * useless iterations in some cases. */ +/* XXX This has to be fully rethink, basing check on ID type is not really working anymore (and even worth once + * IDProps will support ID pointers), we'll have to do some quick checks on IDs themselves... */ bool BKE_library_idtype_can_use_idtype(const short id_type_owner, const short id_type_used) { - if (id_type_used == ID_AC) { - return id_type_can_have_animdata(id_type_owner); + if (id_type_can_have_animdata(id_type_owner)) { + return true; /* AnimationData can use virtually any kind of datablocks, through drivers especially. */ } switch ((ID_Type)id_type_owner) { @@ -931,10 +933,10 @@ static int foreach_libblock_id_users_callback(void *user_data, ID *self_id, ID * IDUsersIter *iter = user_data; /* XXX This is actually some kind of hack... - * Issue is, only ID pointer from shapekeys is the 'from' one, which is not actually ID usage. + * Issue is, shapekeys' 'from' ID pointer is not actually ID usage. * Maybe we should even nuke it from BKE_library_foreach_ID_link, not 100% sure yet... */ - if (GS(self_id->name) == ID_KE) { + if ((GS(self_id->name) == ID_KE) && (((Key *)self_id)->from == *id_p)) { return IDWALK_RET_NOP; } diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c index bdfe951a501..69b52c92c3f 100644 --- a/source/blender/blenkernel/intern/library_remap.c +++ b/source/blender/blenkernel/intern/library_remap.c @@ -132,6 +132,7 @@ void BKE_library_callback_remap_editor_id_reference_set(BKE_library_remap_editor } typedef struct IDRemap { + Main *bmain; /* Only used to trigger depsgraph updates in the right bmain. */ ID *old_id; ID *new_id; ID *id; /* The ID in which we are replacing old_id by new_id usages. */ @@ -211,7 +212,7 @@ static int foreach_libblock_remap_callback(void *user_data, ID *id_self, ID **id else { if (!is_never_null) { *id_p = new_id; - DAG_id_tag_update(id_self, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); + DAG_id_tag_update_ex(id_remap_data->bmain, id_self, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); } if (cb_flag & IDWALK_USER) { id_us_min(old_id); @@ -385,15 +386,15 @@ static void libblock_remap_data_postprocess_obdata_relink(Main *UNUSED(bmain), O * - \a id is non-NULL: * + If \a old_id is NULL, \a new_id must also be NULL, and all ID pointers from \a id are cleared (i.e. \a id * does not references any other datablock anymore). - * + If \a old_id is non-NULL, behavior is as with a NULL \a id, but only for given \a id. + * + If \a old_id is non-NULL, behavior is as with a NULL \a id, but only within given \a id. * - * \param bmain: the Main data storage to operate on (can be NULL if \a id is non-NULL). - * \param id: the datablock to operate on (can be NULL if \a bmain is non-NULL). + * \param bmain: the Main data storage to operate on (must never be NULL). + * \param id: the datablock to operate on (can be NULL, in which case we operate over all IDs from given bmain). * \param old_id: the datablock to dereference (may be NULL if \a id is non-NULL). * \param new_id: the new datablock to replace \a old_id references with (may be NULL). * \param r_id_remap_data: if non-NULL, the IDRemap struct to use (uselful to retrieve info about remapping process). */ -static void libblock_remap_data( +ATTR_NONNULL(1) static void libblock_remap_data( Main *bmain, ID *id, ID *old_id, ID *new_id, const short remap_flags, IDRemap *r_id_remap_data) { IDRemap id_remap_data; @@ -403,6 +404,7 @@ static void libblock_remap_data( if (r_id_remap_data == NULL) { r_id_remap_data = &id_remap_data; } + r_id_remap_data->bmain = bmain; r_id_remap_data->old_id = old_id; r_id_remap_data->new_id = new_id; r_id_remap_data->id = NULL; @@ -610,7 +612,7 @@ void BKE_libblock_relink_ex( BLI_assert(new_id == NULL); } - libblock_remap_data(NULL, id, old_id, new_id, remap_flags, NULL); + libblock_remap_data(bmain, id, old_id, new_id, remap_flags, NULL); /* Some after-process updates. * This is a bit ugly, but cannot see a way to avoid it. Maybe we should do a per-ID callback for this instead? diff --git a/source/blender/blenkernel/intern/linestyle.c b/source/blender/blenkernel/intern/linestyle.c index 430935a5fad..bd21215f91e 100644 --- a/source/blender/blenkernel/intern/linestyle.c +++ b/source/blender/blenkernel/intern/linestyle.c @@ -1343,33 +1343,25 @@ int BKE_linestyle_geometry_modifier_remove(FreestyleLineStyle *linestyle, LineSt return 0; } -static void move_modifier(ListBase *lb, LineStyleModifier *modifier, int direction) +/** + * Reinsert \a modifier in modifier list with an offset of \a direction. + * \return if position of \a modifier has changed. + */ +bool BKE_linestyle_color_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction) { - BLI_remlink(lb, modifier); - if (direction > 0) - BLI_insertlinkbefore(lb, modifier->prev, modifier); - else - BLI_insertlinkafter(lb, modifier->next, modifier); + return BLI_listbase_link_move(&linestyle->color_modifiers, modifier, direction); } - -void BKE_linestyle_color_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction) +bool BKE_linestyle_alpha_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction) { - move_modifier(&linestyle->color_modifiers, modifier, direction); + return BLI_listbase_link_move(&linestyle->alpha_modifiers, modifier, direction); } - -void BKE_linestyle_alpha_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction) +bool BKE_linestyle_thickness_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction) { - move_modifier(&linestyle->alpha_modifiers, modifier, direction); + return BLI_listbase_link_move(&linestyle->thickness_modifiers, modifier, direction); } - -void BKE_linestyle_thickness_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction) -{ - move_modifier(&linestyle->thickness_modifiers, modifier, direction); -} - -void BKE_linestyle_geometry_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction) +bool BKE_linestyle_geometry_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction) { - move_modifier(&linestyle->geometry_modifiers, modifier, direction); + return BLI_listbase_link_move(&linestyle->geometry_modifiers, modifier, direction); } void BKE_linestyle_modifier_list_color_ramps(FreestyleLineStyle *linestyle, ListBase *listbase) diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index de55a1977bf..b0ab6f707fa 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -69,10 +69,14 @@ typedef struct FFMpegContext { int ffmpeg_video_bitrate; int ffmpeg_audio_bitrate; int ffmpeg_gop_size; + int ffmpeg_max_b_frames; int ffmpeg_autosplit; int ffmpeg_autosplit_count; bool ffmpeg_preview; + int ffmpeg_crf; /* set to 0 to not use CRF mode; we have another flag for lossless anyway. */ + int ffmpeg_preset; /* see FFMpegPreset */ + AVFormatContext *outfile; AVStream *video_stream; AVStream *audio_stream; @@ -560,10 +564,37 @@ static AVStream *alloc_video_stream(FFMpegContext *context, RenderData *rd, int } c->gop_size = context->ffmpeg_gop_size; - c->bit_rate = context->ffmpeg_video_bitrate * 1000; - c->rc_max_rate = rd->ffcodecdata.rc_max_rate * 1000; - c->rc_min_rate = rd->ffcodecdata.rc_min_rate * 1000; - c->rc_buffer_size = rd->ffcodecdata.rc_buffer_size * 1024; + c->max_b_frames = context->ffmpeg_max_b_frames; + + if (context->ffmpeg_crf >= 0) { + ffmpeg_dict_set_int(&opts, "crf", context->ffmpeg_crf); + } else { + c->bit_rate = context->ffmpeg_video_bitrate * 1000; + c->rc_max_rate = rd->ffcodecdata.rc_max_rate * 1000; + c->rc_min_rate = rd->ffcodecdata.rc_min_rate * 1000; + c->rc_buffer_size = rd->ffcodecdata.rc_buffer_size * 1024; + } + + if (context->ffmpeg_preset) { + char const * preset_name; + switch(context->ffmpeg_preset) { + case FFM_PRESET_ULTRAFAST: preset_name = "ultrafast"; break; + case FFM_PRESET_SUPERFAST: preset_name = "superfast"; break; + case FFM_PRESET_VERYFAST: preset_name = "veryfast"; break; + case FFM_PRESET_FASTER: preset_name = "faster"; break; + case FFM_PRESET_FAST: preset_name = "fast"; break; + case FFM_PRESET_MEDIUM: preset_name = "medium"; break; + case FFM_PRESET_SLOW: preset_name = "slow"; break; + case FFM_PRESET_SLOWER: preset_name = "slower"; break; + case FFM_PRESET_VERYSLOW: preset_name = "veryslow"; break; + default: + printf("Unknown preset number %i, ignoring.\n", context->ffmpeg_preset); + preset_name = NULL; + } + if (preset_name != NULL) { + av_dict_set(&opts, "preset", preset_name, 0); + } + } #if 0 /* this options are not set in ffmpeg.c and leads to artifacts with MPEG-4 @@ -819,6 +850,12 @@ static int start_ffmpeg_impl(FFMpegContext *context, struct RenderData *rd, int context->ffmpeg_audio_bitrate = rd->ffcodecdata.audio_bitrate; context->ffmpeg_gop_size = rd->ffcodecdata.gop_size; context->ffmpeg_autosplit = rd->ffcodecdata.flags & FFMPEG_AUTOSPLIT_OUTPUT; + context->ffmpeg_crf = rd->ffcodecdata.constant_rate_factor; + context->ffmpeg_preset = rd->ffcodecdata.ffmpeg_preset; + + if ((rd->ffcodecdata.flags & FFMPEG_USE_MAX_B_FRAMES) != 0) { + context->ffmpeg_max_b_frames = rd->ffcodecdata.max_b_frames; + } /* Determine the correct filename */ ffmpeg_filepath_get(context, name, rd, context->ffmpeg_preview, suffix); @@ -852,12 +889,16 @@ static int start_ffmpeg_impl(FFMpegContext *context, struct RenderData *rd, int /* Returns after this must 'goto fail;' */ of->oformat = fmt; - of->packet_size = rd->ffcodecdata.mux_packet_size; - if (context->ffmpeg_audio_codec != AV_CODEC_ID_NONE) { - ffmpeg_dict_set_int(&opts, "muxrate", rd->ffcodecdata.mux_rate); - } - else { - av_dict_set(&opts, "muxrate", "0", 0); + + /* Only bother with setting packet size & mux rate when CRF is not used. */ + if (context->ffmpeg_crf == 0) { + of->packet_size = rd->ffcodecdata.mux_packet_size; + if (context->ffmpeg_audio_codec != AV_CODEC_ID_NONE) { + ffmpeg_dict_set_int(&opts, "muxrate", rd->ffcodecdata.mux_rate); + } + else { + av_dict_set(&opts, "muxrate", "0", 0); + } } ffmpeg_dict_set_int(&opts, "preload", (int)(0.5 * AV_TIME_BASE)); @@ -1503,14 +1544,6 @@ static void ffmpeg_set_expert_options(RenderData *rd) BKE_ffmpeg_property_add_string(rd, "video", "fast-pskip:1"); BKE_ffmpeg_property_add_string(rd, "video", "wpredp:2"); #endif - - if (rd->ffcodecdata.flags & FFMPEG_LOSSLESS_OUTPUT) { -#ifdef FFMPEG_HAVE_DEPRECATED_FLAGS2 - BKE_ffmpeg_property_add_string(rd, "video", "cqp:0"); -#else - BKE_ffmpeg_property_add_string(rd, "video", "qp:0"); -#endif - } } else if (codec_id == AV_CODEC_ID_DNXHD) { if (rd->ffcodecdata.flags & FFMPEG_LOSSLESS_OUTPUT) @@ -1622,9 +1655,10 @@ void BKE_ffmpeg_image_type_verify(RenderData *rd, ImageFormatData *imf) rd->ffcodecdata.audio_codec <= 0 || rd->ffcodecdata.video_bitrate <= 1) { - rd->ffcodecdata.codec = AV_CODEC_ID_MPEG2VIDEO; - - BKE_ffmpeg_preset_set(rd, FFMPEG_PRESET_DVD); + BKE_ffmpeg_preset_set(rd, FFMPEG_PRESET_H264); + rd->ffcodecdata.constant_rate_factor = FFM_CRF_MEDIUM; + rd->ffcodecdata.ffmpeg_preset = FFM_PRESET_MEDIUM; + rd->ffcodecdata.type = FFMPEG_MKV; } if (rd->ffcodecdata.type == FFMPEG_OGG) { rd->ffcodecdata.type = FFMPEG_MPEG2; diff --git a/source/blender/blenlib/BLI_listbase.h b/source/blender/blenlib/BLI_listbase.h index 9dfa80006de..96349a7b066 100644 --- a/source/blender/blenlib/BLI_listbase.h +++ b/source/blender/blenlib/BLI_listbase.h @@ -69,6 +69,7 @@ void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnew void BLI_insertlinkafter(struct ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1); void BLI_listbase_sort(struct ListBase *listbase, int (*cmp)(const void *, const void *)) ATTR_NONNULL(1, 2); void BLI_listbase_sort_r(ListBase *listbase, int (*cmp)(void *, const void *, const void *), void *thunk) ATTR_NONNULL(1, 2); +bool BLI_listbase_link_move(ListBase *listbase, void *vlink, int step) ATTR_NONNULL(); void BLI_freelist(struct ListBase *listbase) ATTR_NONNULL(1); int BLI_listbase_count_ex(const struct ListBase *listbase, const int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c index ebee2c7941c..c9bf4976ae8 100644 --- a/source/blender/blenlib/intern/listbase.c +++ b/source/blender/blenlib/intern/listbase.c @@ -342,6 +342,44 @@ void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink) } } +/** + * Reinsert \a vlink relative to its current position but offset by \a step. Doesn't move + * item if new position would exceed list (could optionally move to head/tail). + * + * \param step: Absolute value defines step size, sign defines direction. E.g pass -1 + * to move \a vlink before previous, or 1 to move behind next. + * \return If position of \a vlink has changed. + */ +bool BLI_listbase_link_move(ListBase *listbase, void *vlink, int step) +{ + Link *link = vlink; + Link *hook = link; + const bool is_up = step < 0; + + if (step == 0) { + return false; + } + BLI_assert(BLI_findindex(listbase, link) != -1); + + /* find link to insert before/after */ + for (int i = 0; i < ABS(step); i++) { + hook = is_up ? hook->prev : hook->next; + if (!hook) { + return false; + } + } + + /* reinsert link */ + BLI_remlink(listbase, vlink); + if (is_up) { + BLI_insertlinkbefore(listbase, hook, vlink); + } + else { + BLI_insertlinkafter(listbase, hook, vlink); + } + return true; +} + /** * Removes and disposes of the entire contents of listbase using direct free(3). diff --git a/source/blender/blenlib/intern/system.c b/source/blender/blenlib/intern/system.c index 898075e651e..863622f2546 100644 --- a/source/blender/blenlib/intern/system.c +++ b/source/blender/blenlib/intern/system.c @@ -35,7 +35,7 @@ # include <execinfo.h> #elif defined(WIN32) # include <windows.h> -# include <DbgHelp.h> +# include <dbghelp.h> #endif int BLI_cpu_support_sse2(void) diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index d7523ea0dfd..39fe914e53c 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -1304,4 +1304,18 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main) } } } + if (!MAIN_VERSION_ATLEAST(main, 279, 0)) { + if (!DNA_struct_elem_find(fd->filesdna, "FFMpegCodecData", "int", "ffmpeg_preset")) { + for (Scene *scene = main->scene.first; scene; scene = scene->id.next) { + /* "medium" is the preset FFmpeg uses when no presets are given. */ + scene->r.ffcodecdata.ffmpeg_preset = FFM_PRESET_MEDIUM; + } + } + if (!DNA_struct_elem_find(fd->filesdna, "FFMpegCodecData", "int", "constant_rate_factor")) { + for (Scene *scene = main->scene.first; scene; scene = scene->id.next) { + /* fall back to behaviour from before we introduced CRF for old files */ + scene->r.ffcodecdata.constant_rate_factor = FFM_CRF_NONE; + } + } + } } diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 8e458d14f1f..ed41ac0cb93 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -3720,7 +3720,7 @@ static void write_libraries(WriteData *wd, Main *main) for (id = lbarray[a]->first; id; id = id->next) { if (id->us > 0 && (id->tag & LIB_TAG_EXTERN)) { if (!BKE_idcode_is_linkable(GS(id->name))) { - printf("ERROR: write file: datablock '%s' from lib '%s' is not linkable " + printf("ERROR: write file: data-block '%s' from lib '%s' is not linkable " "but is flagged as directly linked", id->name, main->curlib->filepath); BLI_assert(0); } diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index 1bc2bff74e3..d97fb55af9c 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -221,7 +221,7 @@ int ArmatureImporter::create_bone(SkinInfo *skin, COLLADAFW::Node *node, EditBon * tail locations for the affected bones (nodes which don't have any connected child) * Hint: The extended_bones set gets populated in ArmatureImporter::create_bone **/ -void ArmatureImporter::fix_leaf_bones(bArmature *armature, Bone *bone) +void ArmatureImporter::fix_leaf_bones(bArmature *armature, Bone *bone, bool fix_orientation) { if (bone == NULL) return; @@ -237,7 +237,7 @@ void ArmatureImporter::fix_leaf_bones(bArmature *armature, Bone *bone) EditBone *ebone = bc_get_edit_bone(armature, bone->name); float vec[3]; - if (ebone->parent != NULL) { + if (ebone->parent != NULL && fix_orientation) { EditBone *parent = ebone->parent; sub_v3_v3v3(vec, ebone->head, parent->head); if (len_squared_v3(vec) < MINIMUM_BONE_LENGTH) @@ -257,7 +257,7 @@ void ArmatureImporter::fix_leaf_bones(bArmature *armature, Bone *bone) } for (Bone *child = (Bone *)bone->childbase.first; child; child = child->next) { - fix_leaf_bones(armature, child); + fix_leaf_bones(armature, child, fix_orientation); } } @@ -756,17 +756,10 @@ void ArmatureImporter::make_armatures(bContext *C, std::vector<Object *> &object /* and step back to edit mode to fix the leaf nodes */ ED_armature_to_edit(armature); - if (this->import_settings->fix_orientation || this->import_settings->find_chains) { + if (this->import_settings->find_chains) + connect_bone_chains(armature, (Bone *)armature->bonebase.first, UNLIMITED_CHAIN_MAX); - if (this->import_settings->find_chains) - connect_bone_chains(armature, (Bone *)armature->bonebase.first, UNLIMITED_CHAIN_MAX); - - if (this->import_settings->fix_orientation) - fix_leaf_bones(armature, (Bone *)armature->bonebase.first); - - // exit armature edit mode - - } + fix_leaf_bones(armature, (Bone *)armature->bonebase.first, this->import_settings->fix_orientation); fix_parent_connect(armature, (Bone *)armature->bonebase.first); diff --git a/source/blender/collada/ArmatureImporter.h b/source/blender/collada/ArmatureImporter.h index e006ccbc94a..524c524c9c9 100644 --- a/source/blender/collada/ArmatureImporter.h +++ b/source/blender/collada/ArmatureImporter.h @@ -111,7 +111,7 @@ private: BoneExtended &add_bone_extended(EditBone *bone, COLLADAFW::Node * node, int sibcount, std::vector<std::string> &layer_labels); void clear_extended_boneset(); - void fix_leaf_bones(bArmature *armature, Bone *bone); + void fix_leaf_bones(bArmature *armature, Bone *bone, bool fix_orientation); void fix_parent_connect(bArmature *armature, Bone *bone); void connect_bone_chains(bArmature *armature, Bone *bone, const int max_chain_length); diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 40dfa01ced8..4ad593b7059 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -4076,7 +4076,7 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, const bAni case ACHANNEL_SETTING_SOLO: /* NLA Tracks only */ //icon = ((enabled) ? ICON_SOLO_OFF : ICON_SOLO_ON); icon = ICON_SOLO_OFF; - tooltip = TIP_("NLA Track is the only one evaluated in this Animation Data block, with all others muted"); + tooltip = TIP_("NLA Track is the only one evaluated in this animation data-block, with all others muted"); break; /* --- */ diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 0a6ecd7f026..96dd80777f2 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -2141,7 +2141,7 @@ static void ANIM_OT_channels_clean_empty(wmOperatorType *ot) /* identifiers */ ot->name = "Remove Empty Animation Data"; ot->idname = "ANIM_OT_channels_clean_empty"; - ot->description = "Delete all empty animation data containers from visible datablocks"; + ot->description = "Delete all empty animation data containers from visible data-blocks"; /* api callbacks */ ot->exec = animchannels_clean_empty_exec; diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index dbc9c8b4f23..f8b98ebb8b7 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -343,12 +343,13 @@ static float normalization_factor_get(Scene *scene, FCurve *fcu, short flag, flo } } - range = max_coord - min_coord; - - if (range > FLT_EPSILON) { - factor = 2.0f / range; + if (max_coord > min_coord) { + range = max_coord - min_coord; + if (range > FLT_EPSILON) { + factor = 2.0f / range; + } + offset = -min_coord - range / 2.0f; } - offset = -min_coord - range / 2.0f; } BLI_assert(factor != 0.0f); if (r_offset) { diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 98be77b491f..f2a35bb1553 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -1771,8 +1771,10 @@ static int insert_key_button_exec(bContext *C, wmOperator *op) flag = ANIM_get_keyframing_flags(scene, 1); /* try to insert keyframe using property retrieved from UI */ - but = UI_context_active_but_get(C); - UI_context_active_but_prop_get(C, &ptr, &prop, &index); + if (!(but = UI_context_active_but_prop_get(C, &ptr, &prop, &index))) { + /* pass event on if no active button found */ + return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH); + } if ((ptr.id.data && ptr.data && prop) && RNA_property_animateable(&ptr, prop)) { if (ptr.type == &RNA_NlaStrip) { @@ -1873,7 +1875,10 @@ static int delete_key_button_exec(bContext *C, wmOperator *op) const bool all = RNA_boolean_get(op->ptr, "all"); /* try to insert keyframe using property retrieved from UI */ - UI_context_active_but_prop_get(C, &ptr, &prop, &index); + if (!UI_context_active_but_prop_get(C, &ptr, &prop, &index)) { + /* pass event on if no active button found */ + return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH); + } if (ptr.id.data && ptr.data && prop) { if (ptr.type == &RNA_NlaStrip) { @@ -1973,7 +1978,10 @@ static int clear_key_button_exec(bContext *C, wmOperator *op) const bool all = RNA_boolean_get(op->ptr, "all"); /* try to insert keyframe using property retrieved from UI */ - UI_context_active_but_prop_get(C, &ptr, &prop, &index); + if (!UI_context_active_but_prop_get(C, &ptr, &prop, &index)) { + /* pass event on if no active button found */ + return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH); + } if (ptr.id.data && ptr.data && prop) { path = RNA_path_from_ID_to_property(&ptr, prop); diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index b907ad150aa..4408ec26b3f 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -296,6 +296,12 @@ static int add_keyingset_button_exec(bContext *C, wmOperator *op) int index = 0, pflag = 0; const bool all = RNA_boolean_get(op->ptr, "all"); + /* try to add to keyingset using property retrieved from UI */ + if (!UI_context_active_but_prop_get(C, &ptr, &prop, &index)) { + /* pass event on if no active button found */ + return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH); + } + /* verify the Keying Set to use: * - use the active one for now (more control over this can be added later) * - add a new one if it doesn't exist @@ -326,9 +332,6 @@ static int add_keyingset_button_exec(bContext *C, wmOperator *op) ks = BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1); } - /* try to add to keyingset using property retrieved from UI */ - UI_context_active_but_prop_get(C, &ptr, &prop, &index); - /* check if property is able to be added */ if (ptr.id.data && ptr.data && prop && RNA_property_animateable(&ptr, prop)) { path = RNA_path_from_ID_to_property(&ptr, prop); @@ -396,6 +399,12 @@ static int remove_keyingset_button_exec(bContext *C, wmOperator *op) short success = 0; int index = 0; + /* try to add to keyingset using property retrieved from UI */ + if (UI_context_active_but_prop_get(C, &ptr, &prop, &index)) { + /* pass event on if no active button found */ + return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH); + } + /* verify the Keying Set to use: * - use the active one for now (more control over this can be added later) * - return error if it doesn't exist @@ -412,9 +421,6 @@ static int remove_keyingset_button_exec(bContext *C, wmOperator *op) ks = BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1); } - /* try to add to keyingset using property retrieved from UI */ - UI_context_active_but_prop_get(C, &ptr, &prop, &index); - if (ptr.id.data && ptr.data && prop) { path = RNA_path_from_ID_to_property(&ptr, prop); diff --git a/source/blender/editors/armature/pose_group.c b/source/blender/editors/armature/pose_group.c index 4d9df06f33f..c492772b282 100644 --- a/source/blender/editors/armature/pose_group.c +++ b/source/blender/editors/armature/pose_group.c @@ -292,7 +292,6 @@ static int group_move_exec(bContext *C, wmOperator *op) bPoseChannel *pchan; bActionGroup *grp; int dir = RNA_enum_get(op->ptr, "direction"); - int grpIndexA, grpIndexB; if (ELEM(NULL, ob, pose)) return OPERATOR_CANCELLED; @@ -305,51 +304,33 @@ static int group_move_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; /* move bone group */ - grpIndexA = pose->active_group; - if (dir == 1) { /* up */ - void *prev = grp->prev; - - if (prev == NULL) - return OPERATOR_FINISHED; - - BLI_remlink(&pose->agroups, grp); - BLI_insertlinkbefore(&pose->agroups, prev, grp); - - grpIndexB = grpIndexA - 1; - pose->active_group--; - } - else { /* down */ - void *next = grp->next; - - if (next == NULL) - return OPERATOR_FINISHED; - - BLI_remlink(&pose->agroups, grp); - BLI_insertlinkafter(&pose->agroups, next, grp); - - grpIndexB = grpIndexA + 1; - pose->active_group++; - } + if (BLI_listbase_link_move(&pose->agroups, grp, dir)) { + int grpIndexA = pose->active_group; + int grpIndexB = grpIndexA + dir; + + pose->active_group += dir; + /* fix changed bone group indices in bones (swap grpIndexA with grpIndexB) */ + for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { + if (pchan->agrp_index == grpIndexB) { + pchan->agrp_index = grpIndexA; + } + else if (pchan->agrp_index == grpIndexA) { + pchan->agrp_index = grpIndexB; + } + } - /* fix changed bone group indices in bones (swap grpIndexA with grpIndexB) */ - for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { - if (pchan->agrp_index == grpIndexB) - pchan->agrp_index = grpIndexA; - else if (pchan->agrp_index == grpIndexA) - pchan->agrp_index = grpIndexB; + /* notifiers for updates */ + WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); } - /* notifiers for updates */ - WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); - return OPERATOR_FINISHED; } void POSE_OT_group_move(wmOperatorType *ot) { static EnumPropertyItem group_slot_move[] = { - {1, "UP", 0, "Up", ""}, - {-1, "DOWN", 0, "Down", ""}, + {-1, "UP", 0, "Up", ""}, + {1, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL} }; @@ -365,7 +346,8 @@ void POSE_OT_group_move(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - RNA_def_enum(ot->srna, "direction", group_slot_move, 0, "Direction", "Direction to move, UP or DOWN"); + RNA_def_enum(ot->srna, "direction", group_slot_move, 0, "Direction", + "Direction to move the active Bone Group towards"); } /* bone group sort element */ diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c index 2012237ed4e..4af7f3f8727 100644 --- a/source/blender/editors/armature/pose_lib.c +++ b/source/blender/editors/armature/pose_lib.c @@ -766,32 +766,18 @@ static int poselib_move_exec(bContext *C, wmOperator *op) dir = RNA_enum_get(op->ptr, "direction"); /* move pose */ - if (dir == 1) { /* up */ - void *prev = marker->prev; + if (BLI_listbase_link_move(&act->markers, marker, dir)) { + act->active_marker = marker_index + dir + 1; - if (prev == NULL) - return OPERATOR_FINISHED; - - BLI_remlink(&act->markers, marker); - BLI_insertlinkbefore(&act->markers, prev, marker); + /* send notifiers for this - using keyframe editing notifiers, since action + * may be being shown in anim editors as active action + */ + WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); } - else { /* down */ - void *next = marker->next; - - if (next == NULL) - return OPERATOR_FINISHED; - - BLI_remlink(&act->markers, marker); - BLI_insertlinkafter(&act->markers, next, marker); + else { + return OPERATOR_CANCELLED; } - act->active_marker = marker_index - dir + 1; - - /* send notifiers for this - using keyframe editing notifiers, since action - * may be being shown in anim editors as active action - */ - WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); - /* done */ return OPERATOR_FINISHED; } @@ -800,8 +786,8 @@ void POSELIB_OT_pose_move(wmOperatorType *ot) { PropertyRNA *prop; static EnumPropertyItem pose_lib_pose_move[] = { - {1, "UP", 0, "Up", ""}, - {-1, "DOWN", 0, "Down", ""}, + {-1, "UP", 0, "Up", ""}, + {1, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL} }; @@ -824,7 +810,8 @@ void POSELIB_OT_pose_move(wmOperatorType *ot) RNA_def_property_flag(prop, PROP_ENUM_NO_TRANSLATE); ot->prop = prop; - RNA_def_enum(ot->srna, "direction", pose_lib_pose_move, 0, "Direction", "Direction to move, UP or DOWN"); + RNA_def_enum(ot->srna, "direction", pose_lib_pose_move, 0, "Direction", + "Direction to move the chosen pose towards"); } diff --git a/source/blender/editors/armature/pose_transform.c b/source/blender/editors/armature/pose_transform.c index fa7850bc2f4..b645f1fb2f3 100644 --- a/source/blender/editors/armature/pose_transform.c +++ b/source/blender/editors/armature/pose_transform.c @@ -414,7 +414,6 @@ static bPoseChannel *pose_bone_do_paste(Object *ob, bPoseChannel *chan, const bo static int pose_copy_exec(bContext *C, wmOperator *op) { - Main *bmain = CTX_data_main(C); Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); char str[FILE_MAX]; /* Sanity checking. */ @@ -424,13 +423,36 @@ static int pose_copy_exec(bContext *C, wmOperator *op) } /* Sets chan->flag to POSE_KEY if bone selected. */ set_pose_keys(ob); + /* Construct a local bmain and only put object and it's data into it, + * o this way we don't expand any other objects into the copy buffer + * file. + * + * TODO(sergey): Find an easier way to tell copy buffer to only store + * data we are actually interested in. Maybe pass it a flag to skip + * any datablock expansion? + */ + Main *temp_bmain = BKE_main_new(); + Object ob_copy = *ob; + bArmature arm_copy = *((bArmature *)ob->data); + ob_copy.data = &arm_copy; + BLI_addtail(&temp_bmain->object, &ob_copy); + BLI_addtail(&temp_bmain->armature, &arm_copy); + /* begin copy buffer on a temp bmain. */ + BKE_copybuffer_begin(temp_bmain); /* Store the whole object to the copy buffer because pose can't be * existing on it's own. */ - BKE_copybuffer_begin(bmain); - BKE_copybuffer_tag_ID(&ob->id); + BKE_copybuffer_tag_ID(&ob_copy.id); BLI_make_file_string("/", str, BKE_tempdir_base(), "copybuffer_pose.blend"); - BKE_copybuffer_save(bmain, str, op->reports); + BKE_copybuffer_save(temp_bmain, str, op->reports); + /* We clear the lists so no datablocks gets freed, + * This is required because objects in temp bmain shares same pointers + * as the real ones. + */ + BLI_listbase_clear(&temp_bmain->object); + BLI_listbase_clear(&temp_bmain->armature); + BKE_main_free(temp_bmain); + /* We are all done! */ BKE_report(op->reports, RPT_INFO, "Copied pose to buffer"); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index b40b51e337f..57e731874b4 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -1788,7 +1788,7 @@ void FONT_OT_unlink(wmOperatorType *ot) /* identifiers */ ot->name = "Unlink"; ot->idname = "FONT_OT_unlink"; - ot->description = "Unlink active font data block"; + ot->description = "Unlink active font data-block"; /* api callbacks */ ot->exec = font_unlink_exec; diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c index fcb2ce02bde..8576cbca239 100644 --- a/source/blender/editors/gpencil/gpencil_brush.c +++ b/source/blender/editors/gpencil/gpencil_brush.c @@ -1350,6 +1350,10 @@ static bool gpsculpt_brush_apply_standard(bContext *C, tGP_BrushEditData *gso) CTX_DATA_BEGIN(C, bGPDlayer *, gpl, editable_gpencil_layers) { + bGPDframe *gpf = gpl->actframe; + if (gpf == NULL) + continue; + /* calculate difference matrix if parent object */ if (gpl->parent != NULL) { ED_gpencil_parent_location(gpl, diff_mat); @@ -1358,10 +1362,8 @@ static bool gpsculpt_brush_apply_standard(bContext *C, tGP_BrushEditData *gso) else { parented = false; } - - bGPDframe *gpf = gpl->actframe; - bGPDstroke *gps; - for (gps = gpf->strokes.first; gps; gps = gps->next) { + + for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) { /* skip strokes that are invalid for current view */ if (ED_gpencil_stroke_can_use(C, gps) == false) continue; diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c index 9560ab188a4..7dcbe2cc24c 100644 --- a/source/blender/editors/gpencil/gpencil_data.c +++ b/source/blender/editors/gpencil/gpencil_data.c @@ -108,7 +108,7 @@ void GPENCIL_OT_data_add(wmOperatorType *ot) /* identifiers */ ot->name = "Grease Pencil Add New"; ot->idname = "GPENCIL_OT_data_add"; - ot->description = "Add new Grease Pencil datablock"; + ot->description = "Add new Grease Pencil data-block"; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* callbacks */ @@ -156,7 +156,7 @@ void GPENCIL_OT_data_unlink(wmOperatorType *ot) /* identifiers */ ot->name = "Grease Pencil Unlink"; ot->idname = "GPENCIL_OT_data_unlink"; - ot->description = "Unlink active Grease Pencil datablock"; + ot->description = "Unlink active Grease Pencil data-block"; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* callbacks */ @@ -197,7 +197,7 @@ void GPENCIL_OT_layer_add(wmOperatorType *ot) /* identifiers */ ot->name = "Add New Layer"; ot->idname = "GPENCIL_OT_layer_add"; - ot->description = "Add new Grease Pencil layer for the active Grease Pencil datablock"; + ot->description = "Add new Grease Pencil layer for the active Grease Pencil data-block"; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -272,21 +272,11 @@ static int gp_layer_move_exec(bContext *C, wmOperator *op) if (ELEM(NULL, gpd, gpl)) return OPERATOR_CANCELLED; - /* up or down? */ - if (direction == GP_LAYER_MOVE_UP) { - /* up */ - BLI_remlink(&gpd->layers, gpl); - BLI_insertlinkbefore(&gpd->layers, gpl->prev, gpl); - } - else { - /* down */ - BLI_remlink(&gpd->layers, gpl); - BLI_insertlinkafter(&gpd->layers, gpl->next, gpl); + BLI_assert(ELEM(direction, -1, 0, 1)); /* we use value below */ + if (BLI_listbase_link_move(&gpd->layers, gpl, direction)) { + WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL); } - /* notifiers */ - WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL); - return OPERATOR_FINISHED; } @@ -761,14 +751,12 @@ static int gp_stroke_arrange_exec(bContext *C, wmOperator *op) /* some stroke is already at front*/ if ((direction == GP_STROKE_MOVE_TOP) || (direction == GP_STROKE_MOVE_UP)) { if (gps == gpf->strokes.last) { - BKE_report(op->reports, RPT_ERROR, "Some selected stroke is already on top"); return OPERATOR_CANCELLED; } } /* some stroke is already at botom */ if ((direction == GP_STROKE_MOVE_BOTTOM) || (direction == GP_STROKE_MOVE_DOWN)) { if (gps == gpf->strokes.first) { - BKE_report(op->reports, RPT_ERROR, "Some selected stroke is already on bottom"); return OPERATOR_CANCELLED; } } @@ -784,23 +772,21 @@ static int gp_stroke_arrange_exec(bContext *C, wmOperator *op) for (LinkData *link = selected.first; link; link = link->next) { gps = link->data; BLI_remlink(&gpf->strokes, gps); - BLI_insertlinkafter(&gpf->strokes, gpf->strokes.last, gps); + BLI_addtail(&gpf->strokes, gps); } break; /* Bring Forward */ case GP_STROKE_MOVE_UP: for (LinkData *link = selected.last; link; link = link->prev) { gps = link->data; - BLI_remlink(&gpf->strokes, gps); - BLI_insertlinkafter(&gpf->strokes, gps->next, gps); + BLI_listbase_link_move(&gpf->strokes, gps, 1); } break; - /* Send Backward */ + /* Send Backward */ case GP_STROKE_MOVE_DOWN: for (LinkData *link = selected.first; link; link = link->next) { gps = link->data; - BLI_remlink(&gpf->strokes, gps); - BLI_insertlinkbefore(&gpf->strokes, gps->prev, gps); + BLI_listbase_link_move(&gpf->strokes, gps, -1); } break; /* Send to Back */ @@ -808,13 +794,15 @@ static int gp_stroke_arrange_exec(bContext *C, wmOperator *op) for (LinkData *link = selected.last; link; link = link->prev) { gps = link->data; BLI_remlink(&gpf->strokes, gps); - BLI_insertlinkbefore(&gpf->strokes, gpf->strokes.first, gps); + BLI_addhead(&gpf->strokes, gps); } break; default: BLI_assert(0); break; } + BLI_freelistN(&selected); + /* notifiers */ WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL); @@ -991,7 +979,7 @@ void GPENCIL_OT_brush_add(wmOperatorType *ot) /* identifiers */ ot->name = "Add Brush"; ot->idname = "GPENCIL_OT_brush_add"; - ot->description = "Add new Grease Pencil drawing brush for the active Grease Pencil datablock"; + ot->description = "Add new Grease Pencil drawing brush for the active Grease Pencil data-block"; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1349,7 +1337,7 @@ void GPENCIL_OT_palette_add(wmOperatorType *ot) /* identifiers */ ot->name = "Add Palette"; ot->idname = "GPENCIL_OT_palette_add"; - ot->description = "Add new Grease Pencil palette for the active Grease Pencil datablock"; + ot->description = "Add new Grease Pencil palette for the active Grease Pencil data-block"; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1566,7 +1554,7 @@ void GPENCIL_OT_palettecolor_add(wmOperatorType *ot) /* identifiers */ ot->name = "Add Palette Color"; ot->idname = "GPENCIL_OT_palettecolor_add"; - ot->description = "Add new Grease Pencil palette color for the active Grease Pencil datablock"; + ot->description = "Add new Grease Pencil palette color for the active Grease Pencil data-block"; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 7175ec3e83d..12d837dfb29 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -1504,6 +1504,9 @@ static int gp_stroke_cyclical_set_exec(bContext *C, wmOperator *op) /* loop all selected strokes */ CTX_DATA_BEGIN(C, bGPDlayer *, gpl, editable_gpencil_layers) { + if (gpl->actframe == NULL) + continue; + for (bGPDstroke *gps = gpl->actframe->strokes.last; gps; gps = gps->prev) { bGPDpalettecolor *palcolor = gps->palcolor; @@ -1724,6 +1727,9 @@ static int gp_stroke_join_exec(bContext *C, wmOperator *op) CTX_DATA_BEGIN(C, bGPDlayer *, gpl, editable_gpencil_layers) { bGPDframe *gpf = gpl->actframe; + if (gpf == NULL) + continue; + for (gps = gpf->strokes.first; gps; gps = gpsn) { gpsn = gps->next; if (gps->flag & GP_STROKE_SELECT) { diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 26a6fdd7d1f..fd5351394c3 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -161,13 +161,13 @@ enum { UI_BUT_NODE_LINK = (1 << 8), UI_BUT_NODE_ACTIVE = (1 << 9), UI_BUT_DRAG_LOCK = (1 << 10), - UI_BUT_DISABLED = (1 << 11), + UI_BUT_DISABLED = (1 << 11), /* grayed out and uneditable */ UI_BUT_COLOR_LOCK = (1 << 12), UI_BUT_ANIMATED = (1 << 13), UI_BUT_ANIMATED_KEY = (1 << 14), UI_BUT_DRIVEN = (1 << 15), UI_BUT_REDALERT = (1 << 16), - UI_BUT_INACTIVE = (1 << 17), + UI_BUT_INACTIVE = (1 << 17), /* grayed out but still editable */ UI_BUT_LAST_ACTIVE = (1 << 18), UI_BUT_UNDO = (1 << 19), UI_BUT_IMMEDIATE = (1 << 20), @@ -1021,19 +1021,13 @@ void ED_keymap_ui(struct wmKeyConfig *keyconf); void UI_drop_color_copy(struct wmDrag *drag, struct wmDropBox *drop); int UI_drop_color_poll(struct bContext *C, struct wmDrag *drag, const struct wmEvent *event); -/* UI_OT_space_context_cycle direction */ -enum { - SPACE_CONTEXT_CYCLE_PREV, - SPACE_CONTEXT_CYCLE_NEXT, -}; - bool UI_context_copy_to_selected_list( struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, struct ListBase *r_lb, bool *r_use_path_from_id, char **r_path); /* Helpers for Operators */ uiBut *UI_context_active_but_get(const struct bContext *C); -void UI_context_active_but_prop_get( +uiBut *UI_context_active_but_prop_get( const struct bContext *C, struct PointerRNA *r_ptr, struct PropertyRNA **r_prop, int *r_index); void UI_context_active_but_prop_handle(struct bContext *C); diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h index a81221ed54b..f8a5f30a596 100644 --- a/source/blender/editors/include/UI_resources.h +++ b/source/blender/editors/include/UI_resources.h @@ -298,7 +298,10 @@ enum { TH_V3D_CLIPPING_BORDER, TH_METADATA_BG, - TH_METADATA_TEXT + TH_METADATA_TEXT, + + TH_EDGE_BEVEL, + TH_VERTEX_BEVEL }; /* XXX WARNING: previous is saved in file, so do not change order! */ diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index cbe8654ceb6..6bba35e821f 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1247,7 +1247,6 @@ void UI_block_end_ex(const bContext *C, uiBlock *block, const int xy[2]) if (ot == NULL || WM_operator_poll_context((bContext *)C, ot, but->opcontext) == 0) { but->flag |= UI_BUT_DISABLED; - but->lock = true; } if (but->context) @@ -3122,8 +3121,7 @@ static uiBut *ui_def_but( but->a2 = a2; but->tip = tip; - but->lock = block->lock; - but->lockstr = block->lockstr; + but->disabled_info = block->lockstr; but->dt = block->dt; but->pie_dir = UI_RADIAL_NONE; @@ -3171,10 +3169,8 @@ static uiBut *ui_def_but( but->drawflag |= (block->flag & UI_BUT_ALIGN); - if (but->lock == true) { - if (but->lockstr) { - but->flag |= UI_BUT_DISABLED; - } + if (block->lock == true) { + but->flag |= UI_BUT_DISABLED; } /* keep track of UI_interface.h */ @@ -3219,11 +3215,10 @@ void ui_def_but_icon(uiBut *but, const int icon, const int flag) } } -static void ui_def_but_rna__disable(uiBut *but) +static void ui_def_but_rna__disable(uiBut *but, const char *info) { but->flag |= UI_BUT_DISABLED; - but->lock = true; - but->lockstr = ""; + but->disabled_info = info; } static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *but_p) @@ -3488,8 +3483,9 @@ static uiBut *ui_def_but_rna( but->flag |= UI_BUT_ICON_SUBMENU; } - if (!RNA_property_editable(&but->rnapoin, prop)) { - ui_def_but_rna__disable(but); + const char *info; + if (!RNA_property_editable_info(&but->rnapoin, prop, &info)) { + ui_def_but_rna__disable(but, info); } if (but->flag & UI_BUT_UNDO && (ui_but_is_rna_undo(but) == false)) { @@ -3520,7 +3516,7 @@ static uiBut *ui_def_but_rna_propname(uiBlock *block, int type, int retval, cons else { but = ui_def_but(block, type, retval, propname, x, y, width, height, NULL, min, max, a1, a2, tip); - ui_def_but_rna__disable(but); + ui_def_but_rna__disable(but, "Unknown Property."); } return but; @@ -3548,8 +3544,7 @@ static uiBut *ui_def_but_operator_ptr(uiBlock *block, int type, wmOperatorType * if (!ot) { but->flag |= UI_BUT_DISABLED; - but->lock = true; - but->lockstr = ""; + but->disabled_info = ""; } return but; diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index 88924495ae5..991cd54fecf 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -179,7 +179,7 @@ bool ui_but_anim_expression_create(uiBut *but, const char *str) id = (ID *)but->rnapoin.id.data; if ((id == NULL) || (GS(id->name) == ID_MA) || (GS(id->name) == ID_TE)) { if (G.debug & G_DEBUG) - printf("ERROR: create expression failed - invalid id-datablock for adding drivers (%p)\n", id); + printf("ERROR: create expression failed - invalid data-block for adding drivers (%p)\n", id); return false; } @@ -272,36 +272,6 @@ void ui_but_anim_autokey(bContext *C, uiBut *but, Scene *scene, float cfra) } } -void ui_but_anim_insert_keyframe(bContext *C) -{ - /* this operator calls UI_context_active_but_prop_get */ - WM_operator_name_call(C, "ANIM_OT_keyframe_insert_button", WM_OP_INVOKE_DEFAULT, NULL); -} - -void ui_but_anim_delete_keyframe(bContext *C) -{ - /* this operator calls UI_context_active_but_prop_get */ - WM_operator_name_call(C, "ANIM_OT_keyframe_delete_button", WM_OP_INVOKE_DEFAULT, NULL); -} - -void ui_but_anim_clear_keyframe(bContext *C) -{ - /* this operator calls UI_context_active_but_prop_get */ - WM_operator_name_call(C, "ANIM_OT_keyframe_clear_button", WM_OP_INVOKE_DEFAULT, NULL); -} - -void ui_but_anim_add_driver(bContext *C) -{ - /* this operator calls UI_context_active_but_prop_get */ - WM_operator_name_call(C, "ANIM_OT_driver_button_add", WM_OP_INVOKE_DEFAULT, NULL); -} - -void ui_but_anim_remove_driver(bContext *C) -{ - /* this operator calls UI_context_active_but_prop_get */ - WM_operator_name_call(C, "ANIM_OT_driver_button_remove", WM_OP_INVOKE_DEFAULT, NULL); -} - void ui_but_anim_copy_driver(bContext *C) { /* this operator calls UI_context_active_but_prop_get */ @@ -313,15 +283,3 @@ void ui_but_anim_paste_driver(bContext *C) /* this operator calls UI_context_active_but_prop_get */ WM_operator_name_call(C, "ANIM_OT_paste_driver_button", WM_OP_INVOKE_DEFAULT, NULL); } - -void ui_but_anim_add_keyingset(bContext *C) -{ - /* this operator calls UI_context_active_but_prop_get */ - WM_operator_name_call(C, "ANIM_OT_keyingset_button_add", WM_OP_INVOKE_DEFAULT, NULL); -} - -void ui_but_anim_remove_keyingset(bContext *C) -{ - /* this operator calls UI_context_active_but_prop_get */ - WM_operator_name_call(C, "ANIM_OT_keyingset_button_remove", WM_OP_INVOKE_DEFAULT, NULL); -} diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 5ee05a46ada..99913a0e88d 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1256,6 +1256,9 @@ void ui_draw_but_UNITVEC(uiBut *but, uiWidgetColors *wcol, const rcti *rect) /* matrix after circle */ glPopMatrix(); + + /* We disabled all blender lights above, so restore them here. */ + GPU_default_lights(); } static void ui_draw_but_curve_grid(const rcti *rect, float zoomx, float zoomy, float offsx, float offsy, float step) diff --git a/source/blender/editors/interface/interface_eyedropper.c b/source/blender/editors/interface/interface_eyedropper.c index ac7b6428217..31598a44b09 100644 --- a/source/blender/editors/interface/interface_eyedropper.c +++ b/source/blender/editors/interface/interface_eyedropper.c @@ -448,8 +448,20 @@ static int eyedropper_exec(bContext *C, wmOperator *op) static int eyedropper_poll(bContext *C) { - if (!CTX_wm_window(C)) return 0; - else return 1; + PointerRNA ptr; + PropertyRNA *prop; + int index_dummy; + uiBut *but; + + /* Only color buttons */ + if ((CTX_wm_window(C) != NULL) && + (but = UI_context_active_but_prop_get(C, &ptr, &prop, &index_dummy)) && + (but->type == UI_BTYPE_COLOR)) + { + return 1; + } + + return 0; } void UI_OT_eyedropper_color(wmOperatorType *ot) @@ -727,16 +739,35 @@ static int datadropper_exec(bContext *C, wmOperator *op) static int datadropper_poll(bContext *C) { - if (!CTX_wm_window(C)) return 0; - else return 1; + PointerRNA ptr; + PropertyRNA *prop; + int index_dummy; + uiBut *but; + + /* data dropper only supports object data */ + if ((CTX_wm_window(C) != NULL) && + (but = UI_context_active_but_prop_get(C, &ptr, &prop, &index_dummy)) && + (but->type == UI_BTYPE_SEARCH_MENU) && + (but->flag & UI_BUT_SEARCH_UNLINK)) + { + if (prop && RNA_property_type(prop) == PROP_POINTER) { + StructRNA *type = RNA_property_pointer_type(&ptr, prop); + const short idcode = RNA_type_to_ID_code(type); + if ((idcode == ID_OB) || OB_DATA_SUPPORT_ID(idcode)) { + return 1; + } + } + } + + return 0; } void UI_OT_eyedropper_id(wmOperatorType *ot) { /* identifiers */ - ot->name = "Eyedropper Datablock"; + ot->name = "Eyedropper Data-Block"; ot->idname = "UI_OT_eyedropper_id"; - ot->description = "Sample a datablock from the 3D View to store in a property"; + ot->description = "Sample a data-block from the 3D View to store in a property"; /* api callbacks */ ot->invoke = datadropper_invoke; @@ -1034,8 +1065,26 @@ static int depthdropper_exec(bContext *C, wmOperator *op) static int depthdropper_poll(bContext *C) { - if (!CTX_wm_window(C)) return 0; - else return 1; + PointerRNA ptr; + PropertyRNA *prop; + int index_dummy; + uiBut *but; + + /* check if there's an active button taking depth value */ + if ((CTX_wm_window(C) != NULL) && + (but = UI_context_active_but_prop_get(C, &ptr, &prop, &index_dummy)) && + (but->type == UI_BTYPE_NUM) && + (prop != NULL)) + { + if ((RNA_property_type(prop) == PROP_FLOAT) && + (RNA_property_subtype(prop) & PROP_UNIT_LENGTH) && + (RNA_property_array_check(prop) == false)) + { + return 1; + } + } + + return 0; } void UI_OT_eyedropper_depth(wmOperatorType *ot) @@ -1084,12 +1133,11 @@ static bool driverdropper_init(bContext *C, wmOperator *op) { DriverDropper *ddr; uiBut *but; - + op->customdata = ddr = MEM_callocN(sizeof(DriverDropper), "DriverDropper"); - - UI_context_active_but_prop_get(C, &ddr->ptr, &ddr->prop, &ddr->index); - but = UI_context_active_but_get(C); - + + but = UI_context_active_but_prop_get(C, &ddr->ptr, &ddr->prop, &ddr->index); + if ((ddr->ptr.data == NULL) || (ddr->prop == NULL) || (RNA_property_editable(&ddr->ptr, ddr->prop) == false) || diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 4972e16bf2e..369eba66f32 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1266,6 +1266,10 @@ static bool ui_drag_toggle_set_xy_xy( } } } + if (changed) { + /* apply now, not on release (or if handlers are cancelled for whatever reason) */ + ui_apply_but_funcs_after(C); + } return changed; } @@ -2248,9 +2252,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, bool buf_paste_alloc = false; bool show_report = false; /* use to display errors parsing paste input */ - if (mode == 'v' && but->lock == true) { - return; - } + BLI_assert((but->flag & UI_BUT_DISABLED) == 0); /* caller should check */ if (mode == 'c') { /* disallow copying from any passwords */ @@ -6974,6 +6976,12 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * if (but->flag & UI_BUT_DISABLED) return WM_UI_HANDLER_CONTINUE; + /* if but->pointype is set, but->poin should be too */ + BLI_assert(!but->pointype || but->poin); + + /* Only hard-coded stuff here, button interactions with configurable + * keymaps are handled using operators (see #ED_keymap_ui). */ + if ((data->state == BUTTON_STATE_HIGHLIGHT) || (event->type == EVT_DROP)) { /* handle copy-paste */ if (ELEM(event->type, CKEY, VKEY) && event->val == KM_PRESS && @@ -7001,91 +7009,6 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * else if (event->type == EVT_DROP) { ui_but_drop(C, event, but, data); } - /* handle eyedropper */ - else if ((event->type == EKEY) && (event->val == KM_PRESS)) { - if (IS_EVENT_MOD(event, shift, ctrl, alt, oskey)) { - /* pass */ - } - else { - if (but->type == UI_BTYPE_COLOR) { - WM_operator_name_call(C, "UI_OT_eyedropper_color", WM_OP_INVOKE_DEFAULT, NULL); - return WM_UI_HANDLER_BREAK; - } - else if ((but->type == UI_BTYPE_SEARCH_MENU) && - (but->flag & UI_BUT_SEARCH_UNLINK)) - { - if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_POINTER) { - StructRNA *type = RNA_property_pointer_type(&but->rnapoin, but->rnaprop); - const short idcode = RNA_type_to_ID_code(type); - if ((idcode == ID_OB) || OB_DATA_SUPPORT_ID(idcode)) { - WM_operator_name_call(C, "UI_OT_eyedropper_id", WM_OP_INVOKE_DEFAULT, NULL); - return WM_UI_HANDLER_BREAK; - } - } - } - else if (but->type == UI_BTYPE_NUM) { - if (but->rnaprop && - (RNA_property_type(but->rnaprop) == PROP_FLOAT) && - (RNA_property_subtype(but->rnaprop) & PROP_UNIT_LENGTH) && - (RNA_property_array_check(but->rnaprop) == false)) - { - WM_operator_name_call(C, "UI_OT_eyedropper_depth", WM_OP_INVOKE_DEFAULT, NULL); - return WM_UI_HANDLER_BREAK; - } - } - } - } - /* handle keyframing */ - else if ((event->type == IKEY) && - !IS_EVENT_MOD(event, ctrl, oskey) && - (event->val == KM_PRESS)) - { - if (event->alt) { - if (event->shift) { - ui_but_anim_clear_keyframe(C); - } - else { - ui_but_anim_delete_keyframe(C); - } - } - else { - ui_but_anim_insert_keyframe(C); - } - - ED_region_tag_redraw(data->region); - - return WM_UI_HANDLER_BREAK; - } - /* handle drivers */ - else if ((event->type == DKEY) && - !IS_EVENT_MOD(event, shift, oskey) && - (event->val == KM_PRESS)) - { - /* quick check to prevent this opening within the popup menu its self */ - if (!ELEM(NULL, but->rnapoin.data, but->rnaprop)) { - if (event->alt) - ui_but_anim_remove_driver(C); - else if (event->ctrl) - ui_but_anim_add_driver(C); - - ED_region_tag_redraw(data->region); - } - return WM_UI_HANDLER_BREAK; - } - /* handle keyingsets */ - else if ((event->type == KKEY) && - !IS_EVENT_MOD(event, shift, ctrl, oskey) && - (event->val == KM_PRESS)) - { - if (event->alt) - ui_but_anim_remove_keyingset(C); - else - ui_but_anim_add_keyingset(C); - - ED_region_tag_redraw(data->region); - - return WM_UI_HANDLER_BREAK; - } /* handle menu */ else if ((event->type == RIGHTMOUSE) && !IS_EVENT_MOD(event, shift, ctrl, alt, oskey) && @@ -7098,24 +7021,6 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * } } - /* verify if we can edit this button */ - if (ELEM(event->type, LEFTMOUSE, RETKEY)) { - /* this should become disabled button .. */ - if (but->lock == true) { - if (but->lockstr) { - WM_report(RPT_INFO, but->lockstr); - button_activate_state(C, but, BUTTON_STATE_EXIT); - return WM_UI_HANDLER_BREAK; - } - } - else if (but->pointype && but->poin == NULL) { - /* there's a pointer needed */ - BKE_reportf(NULL, RPT_WARNING, "DoButton pointer error: %s", but->str); - button_activate_state(C, but, BUTTON_STATE_EXIT); - return WM_UI_HANDLER_BREAK; - } - } - switch (but->type) { case UI_BTYPE_BUT: retval = ui_do_but_BUT(C, but, data, event); @@ -8095,8 +8000,13 @@ uiBut *UI_context_active_but_get(const struct bContext *C) return ui_context_button_active(C, NULL); } -/* helper function for insert keyframe, reset to default, etc operators */ -void UI_context_active_but_prop_get( +/** + * Version of #UI_context_active_but_get that also returns RNA property info. + * Helper function for insert keyframe, reset to default, etc operators. + * + * \return active button, NULL if none found or if it doesn't contain valid RNA data. + */ +uiBut *UI_context_active_but_prop_get( const bContext *C, struct PointerRNA *r_ptr, struct PropertyRNA **r_prop, int *r_index) { @@ -8112,6 +8022,8 @@ void UI_context_active_but_prop_get( *r_prop = NULL; *r_index = 0; } + + return activebut; } void UI_context_active_but_prop_handle(bContext *C) diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 8336efa381b..fcf827bdbe6 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -271,10 +271,10 @@ struct uiBut { uiButToolTipFunc tip_func; void *tip_argN; - const char *lockstr; + /* info on why button is disabled, displayed in tooltip */ + const char *disabled_info; BIFIconID icon; - bool lock; char dt; /* drawtype: UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied from the block */ signed char pie_dir; /* direction in a pie menu, used for collision detection (RadialDirection) */ char changed; /* could be made into a single flag */ @@ -729,15 +729,8 @@ void ui_block_align_calc(uiBlock *block); /* interface_anim.c */ void ui_but_anim_flag(uiBut *but, float cfra); -void ui_but_anim_insert_keyframe(struct bContext *C); -void ui_but_anim_delete_keyframe(struct bContext *C); -void ui_but_anim_clear_keyframe(struct bContext *C); -void ui_but_anim_add_driver(struct bContext *C); -void ui_but_anim_remove_driver(struct bContext *C); void ui_but_anim_copy_driver(struct bContext *C); void ui_but_anim_paste_driver(struct bContext *C); -void ui_but_anim_add_keyingset(struct bContext *C); -void ui_but_anim_remove_keyingset(struct bContext *C); bool ui_but_anim_expression_get(uiBut *but, char *str, size_t maxlen); bool ui_but_anim_expression_set(uiBut *but, const char *str); bool ui_but_anim_expression_create(uiBut *but, const char *str); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index e802cf82b8e..976b5ed1193 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -745,8 +745,7 @@ static void ui_item_disabled(uiLayout *layout, const char *name) but = uiDefBut(block, UI_BTYPE_LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); but->flag |= UI_BUT_DISABLED; - but->lock = true; - but->lockstr = ""; + but->disabled_info = ""; } /* operator items */ diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index cb539bb1c5d..7e516474bfd 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -1082,79 +1082,6 @@ static void UI_OT_drop_color(wmOperatorType *ot) RNA_def_boolean(ot->srna, "gamma", 0, "Gamma Corrected", "The source color is gamma corrected "); } -/* ------------------------------------------------------------------------- */ - -static EnumPropertyItem space_context_cycle_direction[] = { - {SPACE_CONTEXT_CYCLE_PREV, "PREV", 0, "Previous", ""}, - {SPACE_CONTEXT_CYCLE_NEXT, "NEXT", 0, "Next", ""}, - {0, NULL, 0, NULL, NULL} -}; - -static int space_context_cycle_poll(bContext *C) -{ - ScrArea *sa = CTX_wm_area(C); - return ELEM(sa->spacetype, SPACE_BUTS, SPACE_USERPREF); -} - -/** - * Helper to get the correct RNA pointer/property pair for changing - * the display context of active space type in \sa. - */ -static void context_cycle_prop_get( - bScreen *screen, const ScrArea *sa, - PointerRNA *r_ptr, PropertyRNA **r_prop) -{ - const char *propname; - - switch (sa->spacetype) { - case SPACE_BUTS: - RNA_pointer_create(&screen->id, &RNA_SpaceProperties, sa->spacedata.first, r_ptr); - propname = "context"; - break; - case SPACE_USERPREF: - RNA_pointer_create(NULL, &RNA_UserPreferences, &U, r_ptr); - propname = "active_section"; - break; - } - - *r_prop = RNA_struct_find_property(r_ptr, propname); -} - -static int space_context_cycle_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) -{ - const int direction = RNA_enum_get(op->ptr, "direction"); - - PointerRNA ptr; - PropertyRNA *prop; - context_cycle_prop_get(CTX_wm_screen(C), CTX_wm_area(C), &ptr, &prop); - - const int old_context = RNA_property_enum_get(&ptr, prop); - const int new_context = RNA_property_enum_step( - C, &ptr, prop, old_context, - direction == SPACE_CONTEXT_CYCLE_PREV ? -1 : 1); - RNA_property_enum_set(&ptr, prop, new_context); - RNA_property_update(C, &ptr, prop); - - return OPERATOR_FINISHED; -} - -static void UI_OT_space_context_cycle(wmOperatorType *ot) -{ - /* identifiers */ - ot->name = "Cycle Space Context"; - ot->description = "Cycle through the editor context by activating the next/previous one"; - ot->idname = "UI_OT_space_context_cycle"; - - /* api callbacks */ - ot->invoke = space_context_cycle_invoke; - ot->poll = space_context_cycle_poll; - - ot->flag = 0; - - RNA_def_enum(ot->srna, "direction", space_context_cycle_direction, SPACE_CONTEXT_CYCLE_NEXT, "Direction", - "Direction to cycle through"); -} - /* ********************************************************* */ /* Registration */ @@ -1174,7 +1101,6 @@ void ED_operatortypes_ui(void) WM_operatortype_append(UI_OT_edittranslation_init); #endif WM_operatortype_append(UI_OT_reloadtranslation); - WM_operatortype_append(UI_OT_space_context_cycle); /* external */ WM_operatortype_append(UI_OT_eyedropper_color); @@ -1185,12 +1111,29 @@ void ED_operatortypes_ui(void) /** * \brief User Interface Keymap - * - * For now only modal maps here, since UI uses special ui-handlers instead of operators. */ void ED_keymap_ui(wmKeyConfig *keyconf) { - WM_keymap_find(keyconf, "User Interface", 0, 0); + wmKeyMap *keymap = WM_keymap_find(keyconf, "User Interface", 0, 0); + + /* eyedroppers - notice they all have the same shortcut, but pass the event + * through until a suitable eyedropper for the active button is found */ + WM_keymap_add_item(keymap, "UI_OT_eyedropper_color", EKEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "UI_OT_eyedropper_id", EKEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "UI_OT_eyedropper_depth", EKEY, KM_PRESS, 0, 0); + + /* keyframes */ + WM_keymap_add_item(keymap, "ANIM_OT_keyframe_insert_button", IKEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "ANIM_OT_keyframe_delete_button", IKEY, KM_PRESS, KM_ALT, 0); + WM_keymap_add_item(keymap, "ANIM_OT_keyframe_clear_button", IKEY, KM_PRESS, KM_SHIFT | KM_ALT, 0); + + /* drivers */ + WM_keymap_add_item(keymap, "ANIM_OT_driver_button_add", DKEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "ANIM_OT_driver_button_remove", DKEY, KM_PRESS, KM_CTRL | KM_ALT, 0); + + /* keyingsets */ + WM_keymap_add_item(keymap, "ANIM_OT_keyingset_button_add", KKEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "ANIM_OT_keyingset_button_remove", KKEY, KM_PRESS, KM_ALT, 0); eyedropper_modal_keymap(keyconf); } diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 7a506c5c451..5602e2b9c6d 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -456,7 +456,7 @@ static uiTooltipData *ui_tooltip_data_from_button(bContext *C, uiBut *but) } /* button is disabled, we may be able to tell user why */ - if ((but->flag & UI_BUT_DISABLED) || but->lock) { + if (but->flag & UI_BUT_DISABLED) { const char *disabled_msg = NULL; /* if operator poll check failed, it can give pretty precise info why */ @@ -466,8 +466,8 @@ static uiTooltipData *ui_tooltip_data_from_button(bContext *C, uiBut *but) disabled_msg = CTX_wm_operator_poll_msg_get(C); } /* alternatively, buttons can store some reasoning too */ - else if (but->lockstr) { - disabled_msg = but->lockstr; + else if (but->disabled_info) { + disabled_msg = TIP_(but->disabled_info); } if (disabled_msg && disabled_msg[0]) { diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index f3157df4d28..462ad34582b 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -451,12 +451,12 @@ static void template_ID( if (id->lib) { if (id->tag & LIB_TAG_INDIRECT) { but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_INDIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y, - NULL, 0, 0, 0, 0, TIP_("Indirect library datablock, cannot change")); + NULL, 0, 0, 0, 0, TIP_("Indirect library data-block, cannot change")); UI_but_flag_enable(but, UI_BUT_DISABLED); } else { but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_DIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y, - NULL, 0, 0, 0, 0, TIP_("Direct linked library datablock, click to make local")); + NULL, 0, 0, 0, 0, TIP_("Direct linked library data-block, click to make local")); if (!id_make_local(CTX_data_main(C), id, true /* test */, false) || (idfrom && idfrom->lib)) UI_but_flag_enable(but, UI_BUT_DISABLED); } @@ -582,7 +582,7 @@ static void template_ID( else { if ((RNA_property_flag(template->prop) & PROP_NEVER_UNLINK) == 0) { but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, - TIP_("Unlink datablock " + TIP_("Unlink data-block " "(Shift + Click to set users to zero, data will then not be saved)")); UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_DELETE)); diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index c8ff335f2a0..6b7867c845f 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -305,6 +305,8 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo cp = ts->vertex; break; case TH_VERTEX_SELECT: cp = ts->vertex_select; break; + case TH_VERTEX_BEVEL: + cp = ts->vertex_bevel; break; case TH_VERTEX_UNREFERENCED: cp = ts->vertex_unreferenced; break; case TH_VERTEX_SIZE: @@ -321,6 +323,8 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo cp = ts->edge_sharp; break; case TH_EDGE_CREASE: cp = ts->edge_crease; break; + case TH_EDGE_BEVEL: + cp = ts->edge_bevel; break; case TH_EDITMESH_ACTIVE: cp = ts->editmesh_active; break; case TH_EDGE_FACESEL: @@ -898,12 +902,14 @@ void ui_theme_init_default(void) rgba_char_args_set(btheme->tv3d.transform, 0xff, 0xff, 0xff, 255); rgba_char_args_set(btheme->tv3d.vertex, 0, 0, 0, 255); rgba_char_args_set(btheme->tv3d.vertex_select, 255, 133, 0, 255); + rgba_char_args_set(btheme->tv3d.vertex_bevel, 0, 165, 255, 255); rgba_char_args_set(btheme->tv3d.vertex_unreferenced, 0, 0, 0, 255); btheme->tv3d.vertex_size = 3; btheme->tv3d.outline_width = 1; rgba_char_args_set(btheme->tv3d.edge, 0x0, 0x0, 0x0, 255); rgba_char_args_set(btheme->tv3d.edge_select, 255, 160, 0, 255); rgba_char_args_set(btheme->tv3d.edge_seam, 219, 37, 18, 255); + rgba_char_args_set(btheme->tv3d.edge_bevel, 0, 165, 255, 255); rgba_char_args_set(btheme->tv3d.edge_facesel, 75, 75, 75, 255); rgba_char_args_set(btheme->tv3d.face, 0, 0, 0, 18); rgba_char_args_set(btheme->tv3d.face_select, 255, 133, 0, 60); @@ -2734,6 +2740,14 @@ void init_userdef_do_versions(void) } } + if (!USER_VERSION_ATLEAST(278, 1)) { + bTheme *btheme; + for (btheme = U.themes.first; btheme; btheme = btheme->next) { + rgba_char_args_set(btheme->tv3d.vertex_bevel, 0, 165, 255, 255); + rgba_char_args_set(btheme->tv3d.edge_bevel, 0, 165, 255, 255); + } + } + /** * Include next version bump. * diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index bc6a4dc3de2..14cbcfc7fd0 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -2341,7 +2341,7 @@ void OBJECT_OT_make_local(wmOperatorType *ot) /* identifiers */ ot->name = "Make Local"; - ot->description = "Make library linked datablocks local to this file"; + ot->description = "Make library linked data-blocks local to this file"; ot->idname = "OBJECT_OT_make_local"; /* api callbacks */ @@ -2436,7 +2436,7 @@ void OBJECT_OT_make_single_user(wmOperatorType *ot) RNA_def_boolean(ot->srna, "object", 0, "Object", "Make single user objects"); RNA_def_boolean(ot->srna, "obdata", 0, "Object Data", "Make single user object data"); - RNA_def_boolean(ot->srna, "material", 0, "Materials", "Make materials local to each datablock"); + RNA_def_boolean(ot->srna, "material", 0, "Materials", "Make materials local to each data-block"); RNA_def_boolean(ot->srna, "texture", 0, "Textures", "Make textures local to each material (needs 'Materials' to be set too)"); RNA_def_boolean(ot->srna, "animation", 0, "Object Animation", "Make animation data local to each object"); diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index ad41fb23a69..bd016b7fcfb 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -3633,7 +3633,8 @@ static int vgroup_move_exec(bContext *C, wmOperator *op) Object *ob = ED_object_context(C); bDeformGroup *def; char *name_array; - int dir = RNA_enum_get(op->ptr, "direction"), ret; + int dir = RNA_enum_get(op->ptr, "direction"); + int ret = OPERATOR_FINISHED; def = BLI_findlink(&ob->defbase, ob->actdef - 1); if (!def) { @@ -3642,36 +3643,25 @@ static int vgroup_move_exec(bContext *C, wmOperator *op) name_array = vgroup_init_remap(ob); - if (dir == 1) { /*up*/ - void *prev = def->prev; + if (BLI_listbase_link_move(&ob->defbase, def, dir)) { + ret = vgroup_do_remap(ob, name_array, op); - BLI_remlink(&ob->defbase, def); - BLI_insertlinkbefore(&ob->defbase, prev, def); - } - else { /*down*/ - void *next = def->next; - - BLI_remlink(&ob->defbase, def); - BLI_insertlinkafter(&ob->defbase, next, def); + if (ret != OPERATOR_CANCELLED) { + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, ob); + } } - ret = vgroup_do_remap(ob, name_array, op); - if (name_array) MEM_freeN(name_array); - if (ret != OPERATOR_CANCELLED) { - DAG_id_tag_update(&ob->id, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, ob); - } - return ret; } void OBJECT_OT_vertex_group_move(wmOperatorType *ot) { static EnumPropertyItem vgroup_slot_move[] = { - {1, "UP", 0, "Up", ""}, - {-1, "DOWN", 0, "Down", ""}, + {-1, "UP", 0, "Up", ""}, + {1, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL} }; @@ -3687,7 +3677,8 @@ void OBJECT_OT_vertex_group_move(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - RNA_def_enum(ot->srna, "direction", vgroup_slot_move, 0, "Direction", "Direction to move, UP or DOWN"); + RNA_def_enum(ot->srna, "direction", vgroup_slot_move, 0, "Direction", + "Direction to move the active vertex group towards"); } static void vgroup_copy_active_to_sel_single(Object *ob, const int def_nr) diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index ee2772ce31a..db0ffb90344 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -133,6 +133,7 @@ typedef struct OGLRender { TaskPool *task_pool; bool pool_ok; + bool is_animation; SpinLock reports_lock; #ifdef DEBUG_TIME @@ -372,12 +373,10 @@ static void screen_opengl_render_doit(OGLRender *oglrender, RenderResult *rr) } if (ibuf_result != NULL) { - - RE_render_result_rect_from_ibuf(rr, &scene->r, ibuf_result, oglrender->view_id); - - if ((scene->r.stamp & R_STAMP_ALL) && (scene->r.stamp & R_STAMP_DRAW)) + if ((scene->r.stamp & R_STAMP_ALL) && (scene->r.stamp & R_STAMP_DRAW)) { BKE_image_stamp_buf(scene, camera, NULL, rect, NULL, rr->rectx, rr->recty, 4); - + } + RE_render_result_rect_from_ibuf(rr, &scene->r, ibuf_result, oglrender->view_id); IMB_freeImBuf(ibuf_result); } } @@ -636,6 +635,7 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op) oglrender->cfrao = scene->r.cfra; oglrender->write_still = is_write_still && !is_animation; + oglrender->is_animation = is_animation; oglrender->views_len = BKE_scene_multiview_num_views_get(&scene->r); @@ -701,12 +701,12 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op) oglrender->task_pool = BLI_task_pool_create(task_scheduler, oglrender); } + oglrender->pool_ok = true; + BLI_spin_init(&oglrender->reports_lock); } else { oglrender->task_pool = NULL; } - oglrender->pool_ok = true; - BLI_spin_init(&oglrender->reports_lock); #ifdef DEBUG_TIME oglrender->time_start = PIL_check_seconds_timer(); @@ -721,9 +721,11 @@ static void screen_opengl_render_end(bContext *C, OGLRender *oglrender) Scene *scene = oglrender->scene; int i; - BLI_task_pool_work_and_wait(oglrender->task_pool); - BLI_task_pool_free(oglrender->task_pool); - BLI_spin_end(&oglrender->reports_lock); + if (oglrender->is_animation) { + BLI_task_pool_work_and_wait(oglrender->task_pool); + BLI_task_pool_free(oglrender->task_pool); + BLI_spin_end(&oglrender->reports_lock); + } #ifdef DEBUG_TIME printf("Total render time: %f\n", PIL_check_seconds_timer() - oglrender->time_start); diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 39256bc8ca3..7eb2552487b 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -448,7 +448,8 @@ void OBJECT_OT_material_slot_move(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - RNA_def_enum(ot->srna, "direction", material_slot_move, 0, "Direction", "Direction to move, UP or DOWN"); + RNA_def_enum(ot->srna, "direction", material_slot_move, 0, "Direction", + "Direction to move the active material towards"); } /********************** new material operator *********************/ @@ -827,14 +828,10 @@ static int freestyle_module_move_exec(bContext *C, wmOperator *op) FreestyleModuleConfig *module = ptr.data; int dir = RNA_enum_get(op->ptr, "direction"); - if (dir == 1) { - BKE_freestyle_module_move_up(&srl->freestyleConfig, module); + if (BKE_freestyle_module_move(&srl->freestyleConfig, module, dir)) { + DAG_id_tag_update(&scene->id, 0); + WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); } - else { - BKE_freestyle_module_move_down(&srl->freestyleConfig, module); - } - DAG_id_tag_update(&scene->id, 0); - WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); return OPERATOR_FINISHED; } @@ -842,8 +839,8 @@ static int freestyle_module_move_exec(bContext *C, wmOperator *op) void SCENE_OT_freestyle_module_move(wmOperatorType *ot) { static EnumPropertyItem direction_items[] = { - {1, "UP", 0, "Up", ""}, - {-1, "DOWN", 0, "Down", ""}, + {-1, "UP", 0, "Up", ""}, + {1, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL} }; @@ -860,7 +857,8 @@ void SCENE_OT_freestyle_module_move(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; /* props */ - RNA_def_enum(ot->srna, "direction", direction_items, 0, "Direction", "Direction to move, UP or DOWN"); + RNA_def_enum(ot->srna, "direction", direction_items, 0, "Direction", + "Direction to move the chosen style module towards"); } static int freestyle_lineset_add_exec(bContext *C, wmOperator *UNUSED(op)) @@ -990,14 +988,10 @@ static int freestyle_lineset_move_exec(bContext *C, wmOperator *op) SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); int dir = RNA_enum_get(op->ptr, "direction"); - if (dir == 1) { - FRS_move_active_lineset_up(&srl->freestyleConfig); - } - else { - FRS_move_active_lineset_down(&srl->freestyleConfig); + if (FRS_move_active_lineset(&srl->freestyleConfig, dir)) { + DAG_id_tag_update(&scene->id, 0); + WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); } - DAG_id_tag_update(&scene->id, 0); - WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); return OPERATOR_FINISHED; } @@ -1005,8 +999,8 @@ static int freestyle_lineset_move_exec(bContext *C, wmOperator *op) void SCENE_OT_freestyle_lineset_move(wmOperatorType *ot) { static EnumPropertyItem direction_items[] = { - {1, "UP", 0, "Up", ""}, - {-1, "DOWN", 0, "Down", ""}, + {-1, "UP", 0, "Up", ""}, + {1, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL} }; @@ -1023,7 +1017,8 @@ void SCENE_OT_freestyle_lineset_move(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; /* props */ - RNA_def_enum(ot->srna, "direction", direction_items, 0, "Direction", "Direction to move, UP or DOWN"); + RNA_def_enum(ot->srna, "direction", direction_items, 0, "Direction", + "Direction to move the active line set towards"); } static int freestyle_linestyle_new_exec(bContext *C, wmOperator *op) @@ -1346,6 +1341,7 @@ static int freestyle_modifier_move_exec(bContext *C, wmOperator *op) PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_LineStyleModifier); LineStyleModifier *modifier = ptr.data; int dir = RNA_enum_get(op->ptr, "direction"); + bool changed = false; if (!freestyle_linestyle_check_report(lineset, op->reports)) { return OPERATOR_CANCELLED; @@ -1353,23 +1349,26 @@ static int freestyle_modifier_move_exec(bContext *C, wmOperator *op) switch (freestyle_get_modifier_type(&ptr)) { case LS_MODIFIER_TYPE_COLOR: - BKE_linestyle_color_modifier_move(lineset->linestyle, modifier, dir); + changed = BKE_linestyle_color_modifier_move(lineset->linestyle, modifier, dir); break; case LS_MODIFIER_TYPE_ALPHA: - BKE_linestyle_alpha_modifier_move(lineset->linestyle, modifier, dir); + changed = BKE_linestyle_alpha_modifier_move(lineset->linestyle, modifier, dir); break; case LS_MODIFIER_TYPE_THICKNESS: - BKE_linestyle_thickness_modifier_move(lineset->linestyle, modifier, dir); + changed = BKE_linestyle_thickness_modifier_move(lineset->linestyle, modifier, dir); break; case LS_MODIFIER_TYPE_GEOMETRY: - BKE_linestyle_geometry_modifier_move(lineset->linestyle, modifier, dir); + changed = BKE_linestyle_geometry_modifier_move(lineset->linestyle, modifier, dir); break; default: BKE_report(op->reports, RPT_ERROR, "The object the data pointer refers to is not a valid modifier"); return OPERATOR_CANCELLED; } - DAG_id_tag_update(&lineset->linestyle->id, 0); - WM_event_add_notifier(C, NC_LINESTYLE, lineset->linestyle); + + if (changed) { + DAG_id_tag_update(&lineset->linestyle->id, 0); + WM_event_add_notifier(C, NC_LINESTYLE, lineset->linestyle); + } return OPERATOR_FINISHED; } @@ -1377,8 +1376,8 @@ static int freestyle_modifier_move_exec(bContext *C, wmOperator *op) void SCENE_OT_freestyle_modifier_move(wmOperatorType *ot) { static EnumPropertyItem direction_items[] = { - {1, "UP", 0, "Up", ""}, - {-1, "DOWN", 0, "Down", ""}, + {-1, "UP", 0, "Up", ""}, + {1, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL} }; @@ -1395,7 +1394,8 @@ void SCENE_OT_freestyle_modifier_move(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; /* props */ - RNA_def_enum(ot->srna, "direction", direction_items, 0, "Direction", "Direction to move, UP or DOWN"); + RNA_def_enum(ot->srna, "direction", direction_items, 0, "Direction", + "Direction to move the chosen modifier towards"); } static int freestyle_stroke_material_create_exec(bContext *C, wmOperator *op) diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 574f8871e53..a26d4f040e4 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1383,9 +1383,12 @@ static void region_subwindow(wmWindow *win, ARegion *ar, bool activate) static void ed_default_handlers(wmWindowManager *wm, ScrArea *sa, ListBase *handlers, int flag) { /* note, add-handler checks if it already exists */ - + /* XXX it would be good to have boundbox checks for some of these... */ if (flag & ED_KEYMAP_UI) { + wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "User Interface", 0, 0); + WM_event_add_keymap_handler(handlers, keymap); + /* user interface widgets */ UI_region_handlers_add(handlers); } diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index e446194a1da..a6b6ccd5a66 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -4174,6 +4174,86 @@ static void SCREEN_OT_region_blend(wmOperatorType *ot) /* properties */ } +/* ******************** space context cycling operator ******************** */ + +/* SCREEN_OT_space_context_cycle direction */ +enum { + SPACE_CONTEXT_CYCLE_PREV, + SPACE_CONTEXT_CYCLE_NEXT, +}; + +static EnumPropertyItem space_context_cycle_direction[] = { + {SPACE_CONTEXT_CYCLE_PREV, "PREV", 0, "Previous", ""}, + {SPACE_CONTEXT_CYCLE_NEXT, "NEXT", 0, "Next", ""}, + {0, NULL, 0, NULL, NULL} +}; + +static int space_context_cycle_poll(bContext *C) +{ + ScrArea *sa = CTX_wm_area(C); + /* sa might be NULL if called out of window bounds */ + return (sa && ELEM(sa->spacetype, SPACE_BUTS, SPACE_USERPREF)); +} + +/** + * Helper to get the correct RNA pointer/property pair for changing + * the display context of active space type in \sa. + */ +static void context_cycle_prop_get( + bScreen *screen, const ScrArea *sa, + PointerRNA *r_ptr, PropertyRNA **r_prop) +{ + const char *propname; + + switch (sa->spacetype) { + case SPACE_BUTS: + RNA_pointer_create(&screen->id, &RNA_SpaceProperties, sa->spacedata.first, r_ptr); + propname = "context"; + break; + case SPACE_USERPREF: + RNA_pointer_create(NULL, &RNA_UserPreferences, &U, r_ptr); + propname = "active_section"; + break; + } + + *r_prop = RNA_struct_find_property(r_ptr, propname); +} + +static int space_context_cycle_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) +{ + const int direction = RNA_enum_get(op->ptr, "direction"); + + PointerRNA ptr; + PropertyRNA *prop; + context_cycle_prop_get(CTX_wm_screen(C), CTX_wm_area(C), &ptr, &prop); + + const int old_context = RNA_property_enum_get(&ptr, prop); + const int new_context = RNA_property_enum_step( + C, &ptr, prop, old_context, + direction == SPACE_CONTEXT_CYCLE_PREV ? -1 : 1); + RNA_property_enum_set(&ptr, prop, new_context); + RNA_property_update(C, &ptr, prop); + + return OPERATOR_FINISHED; +} + +static void SCREEN_OT_space_context_cycle(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Cycle Space Context"; + ot->description = "Cycle through the editor context by activating the next/previous one"; + ot->idname = "SCREEN_OT_space_context_cycle"; + + /* api callbacks */ + ot->invoke = space_context_cycle_invoke; + ot->poll = space_context_cycle_poll; + + ot->flag = 0; + + RNA_def_enum(ot->srna, "direction", space_context_cycle_direction, SPACE_CONTEXT_CYCLE_NEXT, "Direction", + "Direction to cycle through"); +} + /* **************** Assigning operatortypes to global list, adding handlers **************** */ @@ -4209,6 +4289,7 @@ void ED_operatortypes_screen(void) WM_operatortype_append(SCREEN_OT_screencast); WM_operatortype_append(SCREEN_OT_userpref_show); WM_operatortype_append(SCREEN_OT_region_blend); + WM_operatortype_append(SCREEN_OT_space_context_cycle); /*frame changes*/ WM_operatortype_append(SCREEN_OT_frame_offset); @@ -4332,10 +4413,9 @@ void ED_keymap_screen(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "SCREEN_OT_screenshot", F3KEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "SCREEN_OT_screencast", F3KEY, KM_PRESS, KM_ALT, 0); - /* UI */ - kmi = WM_keymap_add_item(keymap, "UI_OT_space_context_cycle", TABKEY, KM_PRESS, KM_CTRL, 0); + kmi = WM_keymap_add_item(keymap, "SCREEN_OT_space_context_cycle", TABKEY, KM_PRESS, KM_CTRL, 0); RNA_enum_set(kmi->ptr, "direction", SPACE_CONTEXT_CYCLE_NEXT); - kmi = WM_keymap_add_item(keymap, "UI_OT_space_context_cycle", TABKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0); + kmi = WM_keymap_add_item(keymap, "SCREEN_OT_space_context_cycle", TABKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0); RNA_enum_set(kmi->ptr, "direction", SPACE_CONTEXT_CYCLE_PREV); /* tests */ diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index d60c8e8dbd9..f5d115442c6 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -371,6 +371,8 @@ typedef struct ProjPaintState { */ const MLoopUV **dm_mloopuv; const MLoopUV **dm_mloopuv_clone; /* other UV map, use for cloning between layers */ + + bool use_colormanagement; } ProjPaintState; typedef union pixelPointer { @@ -1623,7 +1625,12 @@ static ProjPixel *project_paint_uvpixel_init( unsigned char rgba_ub[4]; float rgba[4]; project_face_pixel(lt_other_tri_uv, ibuf_other, w, rgba_ub, NULL); - srgb_to_linearrgb_uchar4(rgba, rgba_ub); + if (ps->use_colormanagement) { + srgb_to_linearrgb_uchar4(rgba, rgba_ub); + } + else { + rgba_uchar_to_float(rgba, rgba_ub); + } straight_to_premul_v4_v4(((ProjPixelClone *)projPixel)->clonepx.f, rgba); } } @@ -1632,7 +1639,12 @@ static ProjPixel *project_paint_uvpixel_init( float rgba[4]; project_face_pixel(lt_other_tri_uv, ibuf_other, w, NULL, rgba); premul_to_straight_v4(rgba); - linearrgb_to_srgb_uchar3(((ProjPixelClone *)projPixel)->clonepx.ch, rgba); + if (ps->use_colormanagement) { + linearrgb_to_srgb_uchar3(((ProjPixelClone *)projPixel)->clonepx.ch, rgba); + } + else { + rgb_float_to_uchar(((ProjPixelClone *)projPixel)->clonepx.ch, rgba); + } ((ProjPixelClone *)projPixel)->clonepx.ch[3] = rgba[3] * 255; } else { /* char to char */ @@ -4359,7 +4371,12 @@ static void do_projectpaint_draw( if (ps->is_texbrush) { mul_v3_v3v3(rgb, texrgb, ps->paint_color_linear); /* TODO(sergey): Support texture paint color space. */ - linearrgb_to_srgb_v3_v3(rgb, rgb); + if (ps->use_colormanagement) { + linearrgb_to_srgb_v3_v3(rgb, rgb); + } + else { + copy_v3_v3(rgb, rgb); + } } else { copy_v3_v3(rgb, ps->paint_color); @@ -4957,11 +4974,21 @@ static void paint_proj_stroke_ps( /* handle gradient and inverted stroke color here */ if (ps->tool == PAINT_TOOL_DRAW) { paint_brush_color_get(scene, brush, false, ps->mode == BRUSH_STROKE_INVERT, distance, pressure, ps->paint_color, NULL); - srgb_to_linearrgb_v3_v3(ps->paint_color_linear, ps->paint_color); + if (ps->use_colormanagement) { + srgb_to_linearrgb_v3_v3(ps->paint_color_linear, ps->paint_color); + } + else { + copy_v3_v3(ps->paint_color_linear, ps->paint_color); + } } else if (ps->tool == PAINT_TOOL_FILL) { copy_v3_v3(ps->paint_color, BKE_brush_color_get(scene, brush)); - srgb_to_linearrgb_v3_v3(ps->paint_color_linear, ps->paint_color); + if (ps->use_colormanagement) { + srgb_to_linearrgb_v3_v3(ps->paint_color_linear, ps->paint_color); + } + else { + copy_v3_v3(ps->paint_color_linear, ps->paint_color); + } } else if (ps->tool == PAINT_TOOL_MASK) { ps->stencil_value = brush->weight; @@ -5112,7 +5139,9 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps, int ps->normal_angle_inner__cos = cosf(ps->normal_angle_inner); ps->dither = settings->imapaint.dither; - + + ps->use_colormanagement = BKE_scene_check_color_management_enabled(CTX_data_scene(C)); + return; } @@ -5783,7 +5812,7 @@ void PAINT_OT_add_texture_paint_slot(wmOperatorType *ot) /* properties */ prop = RNA_def_enum(ot->srna, "type", layer_type_items, 0, "Type", "Merge method to use"); RNA_def_property_flag(prop, PROP_HIDDEN); - RNA_def_string(ot->srna, "name", IMA_DEF_NAME, MAX_ID_NAME - 2, "Name", "Image datablock name"); + RNA_def_string(ot->srna, "name", IMA_DEF_NAME, MAX_ID_NAME - 2, "Name", "Image data-block name"); prop = RNA_def_int(ot->srna, "width", 1024, 1, INT_MAX, "Width", "Image width", 1, 16384); RNA_def_property_subtype(prop, PROP_PIXEL); prop = RNA_def_int(ot->srna, "height", 1024, 1, INT_MAX, "Height", "Image height", 1, 16384); diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index 52c39e5c7a1..432918f0e37 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -813,7 +813,7 @@ static void SOUND_OT_unpack(wmOperatorType *ot) /* properties */ RNA_def_enum(ot->srna, "method", rna_enum_unpack_method_items, PF_USE_LOCAL, "Method", "How to unpack"); - RNA_def_string(ot->srna, "id", NULL, MAX_ID_NAME - 2, "Sound Name", "Sound datablock name to unpack"); /* XXX, weark!, will fail with library, name collisions */ + RNA_def_string(ot->srna, "id", NULL, MAX_ID_NAME - 2, "Sound Name", "Sound data-block name to unpack"); /* XXX, weark!, will fail with library, name collisions */ } /* ******************************************************* */ diff --git a/source/blender/editors/space_action/action_data.c b/source/blender/editors/space_action/action_data.c index 6755a6316cc..fdf2dfe8371 100644 --- a/source/blender/editors/space_action/action_data.c +++ b/source/blender/editors/space_action/action_data.c @@ -669,8 +669,8 @@ void ACTION_OT_unlink(wmOperatorType *ot) ot->poll = action_unlink_poll; /* properties */ - prop = RNA_def_boolean(ot->srna, "force_delete", false, "Force Delete", - "Clear Fake User and remove copy stashed in this datablock's NLA stack"); + prop = RNA_def_boolean(ot->srna, "force_delete", false, "Force Delete", "Clear Fake User and remove " + "copy stashed in this data-block's NLA stack"); RNA_def_property_flag(prop, PROP_SKIP_SAVE); } diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 2825af9d5cf..a1ecb1c4f5c 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -1011,7 +1011,7 @@ void buttons_context_draw(const bContext *C, uiLayout *layout) block = uiLayoutGetBlock(row); UI_block_emboss_set(block, UI_EMBOSS_NONE); but = uiDefIconButBitC(block, UI_BTYPE_ICON_TOGGLE, SB_PIN_CONTEXT, 0, ICON_UNPINNED, 0, 0, UI_UNIT_X, UI_UNIT_Y, &sbuts->flag, - 0, 0, 0, 0, TIP_("Follow context or keep fixed datablock displayed")); + 0, 0, 0, 0, TIP_("Follow context or keep fixed data-block displayed")); UI_but_flag_disable(but, UI_BUT_UNDO); /* skip undo on screen buttons */ UI_but_func_set(but, pin_cb, NULL, NULL); diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index 6778a0b1805..de8d7609509 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -476,7 +476,7 @@ void CLIP_OT_view_pan(wmOperatorType *ot) ot->poll = ED_space_clip_view_clip_poll; /* flags */ - ot->flag = OPTYPE_BLOCKING; + ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_CURSOR; /* properties */ RNA_def_float_vector(ot->srna, "offset", 2, NULL, -FLT_MAX, FLT_MAX, diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 9f5e98d2431..b7228f634bf 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -1061,7 +1061,8 @@ void FILE_OT_bookmark_move(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER; /* No undo! */ - RNA_def_enum(ot->srna, "direction", slot_move, 0, "Direction", "Direction to move, UP or DOWN"); + RNA_def_enum(ot->srna, "direction", slot_move, 0, "Direction", + "Direction to move the active bookmark towards"); } static int reset_recent_exec(bContext *C, wmOperator *UNUSED(op)) diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index a89d3494af0..b4dd5c4a87f 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -2546,7 +2546,7 @@ void IMAGE_OT_new(wmOperatorType *ot) ot->flag = OPTYPE_UNDO; /* properties */ - RNA_def_string(ot->srna, "name", IMA_DEF_NAME, MAX_ID_NAME - 2, "Name", "Image datablock name"); + RNA_def_string(ot->srna, "name", IMA_DEF_NAME, MAX_ID_NAME - 2, "Name", "Image data-block name"); prop = RNA_def_int(ot->srna, "width", 1024, 1, INT_MAX, "Width", "Image width", 1, 16384); RNA_def_property_subtype(prop, PROP_PIXEL); prop = RNA_def_int(ot->srna, "height", 1024, 1, INT_MAX, "Height", "Image height", 1, 16384); @@ -2847,7 +2847,7 @@ void IMAGE_OT_unpack(wmOperatorType *ot) /* properties */ RNA_def_enum(ot->srna, "method", rna_enum_unpack_method_items, PF_USE_LOCAL, "Method", "How to unpack"); - RNA_def_string(ot->srna, "id", NULL, MAX_ID_NAME - 2, "Image Name", "Image datablock name to unpack"); /* XXX, weark!, will fail with library, name collisions */ + RNA_def_string(ot->srna, "id", NULL, MAX_ID_NAME - 2, "Image Name", "Image data-block name to unpack"); /* XXX, weark!, will fail with library, name collisions */ } /******************** sample image operator ********************/ diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index 957d5a96e1e..9a8a5df78e4 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -424,7 +424,7 @@ static int nlachannels_pushdown_exec(bContext *C, wmOperator *op) /* active animdata block */ if (nla_panel_context(C, &adt_ptr, NULL, NULL) == 0 || (adt_ptr.data == NULL)) { BKE_report(op->reports, RPT_ERROR, "No active AnimData block to use " - "(select a datablock expander first or set the appropriate flags on an AnimData block)"); + "(select a data-block expander first or set the appropriate flags on an AnimData block)"); return OPERATOR_CANCELLED; } else { diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index 3e7e8ccc3f4..1f298373a80 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -605,8 +605,8 @@ static int nlaedit_add_actionclip_exec(bContext *C, wmOperator *op) else if (act->idroot == 0) { /* hopefully in this case (i.e. library of userless actions), the user knows what they're doing... */ BKE_reportf(op->reports, RPT_WARNING, - "Action '%s' does not specify what datablocks it can be used on " - "(try setting the 'ID Root Type' setting from the Datablocks Editor " + "Action '%s' does not specify what data-blocks it can be used on " + "(try setting the 'ID Root Type' setting from the data-blocks editor " "for this action to avoid future problems)", act->id.name + 2); } diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c index b50df02beae..d49df2afbd4 100644 --- a/source/blender/editors/space_node/node_add.c +++ b/source/blender/editors/space_node/node_add.c @@ -382,7 +382,7 @@ void NODE_OT_add_file(wmOperatorType *ot) WM_operator_properties_filesel( ot, FILE_TYPE_FOLDER | FILE_TYPE_IMAGE | FILE_TYPE_MOVIE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA); - RNA_def_string(ot->srna, "name", "Image", MAX_ID_NAME - 2, "Name", "Datablock name to assign"); + RNA_def_string(ot->srna, "name", "Image", MAX_ID_NAME - 2, "Name", "Data-block name to assign"); } /* ****************** Add Mask Node Operator ******************* */ @@ -441,7 +441,7 @@ void NODE_OT_add_mask(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; - RNA_def_string(ot->srna, "name", "Mask", MAX_ID_NAME - 2, "Name", "Datablock name to assign"); + RNA_def_string(ot->srna, "name", "Mask", MAX_ID_NAME - 2, "Name", "Data-block name to assign"); } /********************** New node tree operator *********************/ diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index fcee64775a9..7cf40ca07f6 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -835,11 +835,11 @@ static void outliner_draw_userbuts(uiBlock *block, ARegion *ar, SpaceOops *soops if (id->flag & LIB_FAKEUSER) { icon = ICON_FILE_TICK; - tip = TIP_("Datablock will be retained using a fake user"); + tip = TIP_("Data-block will be retained using a fake user"); } else { icon = ICON_X; - tip = TIP_("Datablock has no users and will be deleted"); + tip = TIP_("Data-block has no users and will be deleted"); } bt = uiDefIconButBitS(block, UI_BTYPE_TOGGLE, LIB_FAKEUSER, 1, icon, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, @@ -852,14 +852,14 @@ static void outliner_draw_userbuts(uiBlock *block, ARegion *ar, SpaceOops *soops bt = uiDefBut(block, UI_BTYPE_BUT, 1, buf, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, - TIP_("Number of users of this datablock")); + TIP_("Number of users of this data-block")); UI_but_flag_enable(bt, but_flag); bt = uiDefButBitS(block, UI_BTYPE_TOGGLE, LIB_FAKEUSER, 1, (id->flag & LIB_FAKEUSER) ? "F" : " ", (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), te->ys, UI_UNIT_X, UI_UNIT_Y, &id->flag, 0, 0, 0, 0, - TIP_("Datablock has a 'fake' user which will keep it in the file " + TIP_("Data-block has a 'fake' user which will keep it in the file " "even if nothing else uses it")); UI_but_func_set(bt, restrictbutton_id_user_toggle, id, NULL); UI_but_flag_enable(bt, but_flag); diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 65608c8c15a..8eb53d0d7b9 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -320,7 +320,7 @@ static void id_delete(bContext *C, ReportList *reports, TreeElement *te, TreeSto } else if (BKE_library_ID_is_indirectly_used(bmain, id) && ID_REAL_USERS(id) <= 1) { BKE_reportf(reports, RPT_WARNING, - "Cannot delete id '%s', indirectly used datablocks need at least one user", + "Cannot delete id '%s', indirectly used data-blocks need at least one user", id->name); return; } @@ -389,7 +389,7 @@ static int outliner_id_delete_invoke(bContext *C, wmOperator *op, const wmEvent void OUTLINER_OT_id_delete(wmOperatorType *ot) { - ot->name = "Delete Datablock"; + ot->name = "Delete Data-Block"; ot->idname = "OUTLINER_OT_id_delete"; ot->description = "Delete the ID under cursor"; @@ -422,7 +422,7 @@ static int outliner_id_remap_exec(bContext *C, wmOperator *op) if (ID_IS_LINKED_DATABLOCK(old_id)) { BKE_reportf(op->reports, RPT_WARNING, - "Old ID '%s' is linked from a library, indirect usages of this datablock will not be remapped", + "Old ID '%s' is linked from a library, indirect usages of this data-block will not be remapped", old_id->name); } @@ -1942,7 +1942,7 @@ static int outliner_orphans_purge_invoke(bContext *C, wmOperator *op, const wmEv { /* present a prompt to informing users that this change is irreversible */ return WM_operator_confirm_message(C, op, - "Purging unused datablocks cannot be undone. " + "Purging unused data-blocks cannot be undone. " "Click here to proceed..."); } @@ -1964,7 +1964,7 @@ void OUTLINER_OT_orphans_purge(wmOperatorType *ot) /* identifiers */ ot->idname = "OUTLINER_OT_orphans_purge"; ot->name = "Purge All"; - ot->description = "Clear all orphaned datablocks without any users from the file (cannot be undone)"; + ot->description = "Clear all orphaned data-blocks without any users from the file (cannot be undone)"; /* callbacks */ ot->invoke = outliner_orphans_purge_invoke; diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index e38886abeac..ecb4949350f 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -900,7 +900,7 @@ static EnumPropertyItem prop_object_op_types[] = { {OL_OP_DELETE, "DELETE", 0, "Delete", ""}, {OL_OP_DELETE_HIERARCHY, "DELETE_HIERARCHY", 0, "Delete Hierarchy", ""}, {OL_OP_REMAP, "REMAP", 0, "Remap Users", - "Make all users of selected datablocks to use instead a new chosen one"}, + "Make all users of selected data-blocks to use instead a new chosen one"}, {OL_OP_TOGVIS, "TOGVIS", 0, "Toggle Visible", ""}, {OL_OP_TOGSEL, "TOGSEL", 0, "Toggle Selectable", ""}, {OL_OP_TOGREN, "TOGREN", 0, "Toggle Renderable", ""}, @@ -1046,7 +1046,7 @@ static EnumPropertyItem prop_group_op_types[] = { {OL_GROUPOP_LINK, "LINK", 0, "Link Group Objects to Scene", ""}, {OL_GROUPOP_DELETE, "DELETE", 0, "Delete Group", "WARNING: no undo"}, {OL_GROUPOP_REMAP, "REMAP", 0, "Remap Users", - "Make all users of selected datablocks to use instead current (clicked) one"}, + "Make all users of selected data-blocks to use instead current (clicked) one"}, {OL_GROUPOP_INSTANCE, "INSTANCE", 0, "Instance Groups in Scene", ""}, {OL_GROUPOP_TOGVIS, "TOGVIS", 0, "Toggle Visible Group", ""}, {OL_GROUPOP_TOGSEL, "TOGSEL", 0, "Toggle Selectable", ""}, @@ -1153,9 +1153,9 @@ static EnumPropertyItem prop_id_op_types[] = { {OUTLINER_IDOP_SINGLE, "SINGLE", 0, "Make Single User", ""}, {OUTLINER_IDOP_DELETE, "DELETE", 0, "Delete", "WARNING: no undo"}, {OUTLINER_IDOP_REMAP, "REMAP", 0, "Remap Users", - "Make all users of selected datablocks to use instead current (clicked) one"}, + "Make all users of selected data-blocks to use instead current (clicked) one"}, {OUTLINER_IDOP_FAKE_ADD, "ADD_FAKE", 0, "Add Fake User", - "Ensure datablock gets saved even if it isn't in use (e.g. for motion and material libraries)"}, + "Ensure data-block gets saved even if it isn't in use (e.g. for motion and material libraries)"}, {OUTLINER_IDOP_FAKE_CLEAR, "CLEAR_FAKE", 0, "Clear Fake User", ""}, {OUTLINER_IDOP_RENAME, "RENAME", 0, "Rename", ""}, {OUTLINER_IDOP_SELECT_LINKED, "SELECT_LINKED", 0, "Select Linked", ""}, @@ -1476,8 +1476,8 @@ static int outliner_action_set_exec(bContext *C, wmOperator *op) else if (act->idroot == 0) { /* hopefully in this case (i.e. library of userless actions), the user knows what they're doing... */ BKE_reportf(op->reports, RPT_WARNING, - "Action '%s' does not specify what datablocks it can be used on " - "(try setting the 'ID Root Type' setting from the Datablocks Editor " + "Action '%s' does not specify what data-blocks it can be used on " + "(try setting the 'ID Root Type' setting from the data-blocks editor " "for this action to avoid future problems)", act->id.name + 2); } diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index e7428fd79d9..83012eac39e 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -197,7 +197,7 @@ void TEXT_OT_new(wmOperatorType *ot) /* identifiers */ ot->name = "Create Text Block"; ot->idname = "TEXT_OT_new"; - ot->description = "Create a new text data block"; + ot->description = "Create a new text data-block"; /* api callbacks */ ot->exec = text_new_exec; @@ -288,7 +288,7 @@ void TEXT_OT_open(wmOperatorType *ot) /* identifiers */ ot->name = "Open Text Block"; ot->idname = "TEXT_OT_open"; - ot->description = "Open a new text data block"; + ot->description = "Open a new text data-block"; /* api callbacks */ ot->exec = text_open_exec; @@ -348,7 +348,7 @@ void TEXT_OT_reload(wmOperatorType *ot) /* identifiers */ ot->name = "Reload"; ot->idname = "TEXT_OT_reload"; - ot->description = "Reload active text data block from its file"; + ot->description = "Reload active text data-block from its file"; /* api callbacks */ ot->exec = text_reload_exec; @@ -397,7 +397,7 @@ void TEXT_OT_unlink(wmOperatorType *ot) /* identifiers */ ot->name = "Unlink"; ot->idname = "TEXT_OT_unlink"; - ot->description = "Unlink active text data block"; + ot->description = "Unlink active text data-block"; /* api callbacks */ ot->exec = text_unlink_exec; @@ -512,7 +512,7 @@ void TEXT_OT_save(wmOperatorType *ot) /* identifiers */ ot->name = "Save"; ot->idname = "TEXT_OT_save"; - ot->description = "Save active text data block"; + ot->description = "Save active text data-block"; /* api callbacks */ ot->exec = text_save_exec; @@ -3187,7 +3187,7 @@ void TEXT_OT_to_3d_object(wmOperatorType *ot) /* identifiers */ ot->name = "To 3D Object"; ot->idname = "TEXT_OT_to_3d_object"; - ot->description = "Create 3D text object from active text data block"; + ot->description = "Create 3D text object from active text data-block"; /* api callbacks */ ot->exec = text_to_3d_object_exec; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index d308c11fe9e..0a7dc9012f9 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -3078,7 +3078,7 @@ static DMDrawOption draw_dm_bweights__setDrawOptions(void *userData, int index) if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) { const float bweight = BM_ELEM_CD_GET_FLOAT(eed, data->cd_layer_offset); if (bweight != 0.0f) { - UI_ThemeColorBlend(TH_WIRE_EDIT, TH_EDGE_SELECT, bweight); + UI_ThemeColorBlend(TH_WIRE_EDIT, TH_EDGE_BEVEL, bweight); return DM_DRAW_OPTION_NORMAL; } } @@ -3094,7 +3094,7 @@ static void draw_dm_bweights__mapFunc(void *userData, int index, const float co[ if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) { const float bweight = BM_ELEM_CD_GET_FLOAT(eve, data->cd_layer_offset); if (bweight != 0.0f) { - UI_ThemeColorBlend(TH_VERTEX, TH_VERTEX_SELECT, bweight); + UI_ThemeColorBlend(TH_VERTEX, TH_VERTEX_BEVEL, bweight); glVertex3fv(co); } } diff --git a/source/blender/freestyle/FRS_freestyle.h b/source/blender/freestyle/FRS_freestyle.h index 039a75a2f0f..a6382010ca7 100644 --- a/source/blender/freestyle/FRS_freestyle.h +++ b/source/blender/freestyle/FRS_freestyle.h @@ -63,8 +63,7 @@ void FRS_exit(void); void FRS_copy_active_lineset(struct FreestyleConfig *config); void FRS_paste_active_lineset(struct FreestyleConfig *config); void FRS_delete_active_lineset(struct FreestyleConfig *config); -void FRS_move_active_lineset_up(struct FreestyleConfig *config); -void FRS_move_active_lineset_down(struct FreestyleConfig *config); +bool FRS_move_active_lineset(struct FreestyleConfig *config, int direction); /* Testing */ struct Material *FRS_create_stroke_material(struct Main *bmain, struct FreestyleLineStyle *linestyle); diff --git a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp index 4d8c6a66d42..2af4447e4dc 100644 --- a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp +++ b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp @@ -730,24 +730,14 @@ void FRS_delete_active_lineset(FreestyleConfig *config) } } -void FRS_move_active_lineset_up(FreestyleConfig *config) -{ - FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(config); - - if (lineset) { - BLI_remlink(&config->linesets, lineset); - BLI_insertlinkbefore(&config->linesets, lineset->prev, lineset); - } -} - -void FRS_move_active_lineset_down(FreestyleConfig *config) +/** + * Reinsert the active lineset at an offset \a direction from current position. + * \return if position of active lineset has changed. + */ +bool FRS_move_active_lineset(FreestyleConfig *config, int direction) { FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(config); - - if (lineset) { - BLI_remlink(&config->linesets, lineset); - BLI_insertlinkafter(&config->linesets, lineset->next, lineset); - } + return (lineset != NULL) && BLI_listbase_link_move(&config->linesets, lineset, direction); } // Testing diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c index 04927a91181..ec1471744fa 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.c +++ b/source/blender/gpu/intern/gpu_framebuffer.c @@ -370,13 +370,13 @@ void GPU_framebuffer_blur( GPU_shader_uniform_texture(blur_shader, texture_source_uniform, tex); glViewport(0, 0, GPU_texture_width(blurtex), GPU_texture_height(blurtex)); - /* Peparing to draw quad */ - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); + /* Preparing to draw quad */ glMatrixMode(GL_TEXTURE); glLoadIdentity(); glMatrixMode(GL_PROJECTION); glLoadIdentity(); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); glDisable(GL_DEPTH_TEST); diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c index 41812872f11..01348549bc4 100644 --- a/source/blender/imbuf/intern/colormanagement.c +++ b/source/blender/imbuf/intern/colormanagement.c @@ -3268,6 +3268,13 @@ bool IMB_colormanagement_setup_glsl_draw_from_space(const ColorManagedViewSettin update_glsl_display_processor(applied_view_settings, display_settings, from_colorspace ? from_colorspace->name : global_role_scene_linear); + if (global_glsl_state.processor == NULL) { + /* Happens when requesting non-existing color space or LUT in the + * configuration file does not exist. + */ + return false; + } + return OCIO_setupGLSLDraw(&global_glsl_state.ocio_glsl_state, global_glsl_state.processor, global_glsl_state.use_curve_mapping ? &global_glsl_state.curve_mapping_settings : NULL, dither, predivide); @@ -3304,5 +3311,7 @@ bool IMB_colormanagement_setup_glsl_draw_ctx(const bContext *C, float dither, bo /* Finish GLSL-based display space conversion */ void IMB_colormanagement_finish_glsl_draw(void) { - OCIO_finishGLSLDraw(global_glsl_state.ocio_glsl_state); + if (global_glsl_state.ocio_glsl_state != NULL) { + OCIO_finishGLSLDraw(global_glsl_state.ocio_glsl_state); + } } diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 33695dad163..a21aee25eff 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -135,6 +135,37 @@ typedef struct QuicktimeCodecSettings { int pad1; } QuicktimeCodecSettings; +typedef enum FFMpegPreset { + FFM_PRESET_NONE, + FFM_PRESET_ULTRAFAST, + FFM_PRESET_SUPERFAST, + FFM_PRESET_VERYFAST, + FFM_PRESET_FASTER, + FFM_PRESET_FAST, + FFM_PRESET_MEDIUM, + FFM_PRESET_SLOW, + FFM_PRESET_SLOWER, + FFM_PRESET_VERYSLOW, +} FFMpegPreset; + + +/* Mapping from easily-understandable descriptions to CRF values. + * Assumes we output 8-bit video. Needs to be remapped if 10-bit + * is output. + * We use a slightly wider than "subjectively sane range" according + * to https://trac.ffmpeg.org/wiki/Encode/H.264#a1.ChooseaCRFvalue + */ +typedef enum FFMpegCrf { + FFM_CRF_NONE = -1, + FFM_CRF_LOSSLESS = 0, + FFM_CRF_PERC_LOSSLESS = 17, + FFM_CRF_HIGH = 20, + FFM_CRF_MEDIUM = 23, + FFM_CRF_LOW = 26, + FFM_CRF_VERYLOW = 29, + FFM_CRF_LOWEST = 32, +} FFMpegCrf; + typedef struct FFMpegCodecData { int type; int codec; @@ -146,13 +177,18 @@ typedef struct FFMpegCodecData { int audio_pad; float audio_volume; int gop_size; + int max_b_frames; /* only used if FFMPEG_USE_MAX_B_FRAMES flag is set. */ int flags; + int constant_rate_factor; + int ffmpeg_preset; /* see FFMpegPreset */ int rc_min_rate; int rc_max_rate; int rc_buffer_size; int mux_packet_size; int mux_rate; + int pad1; + IDProperty *properties; } FFMpegCodecData; @@ -1946,6 +1982,7 @@ enum { #endif FFMPEG_AUTOSPLIT_OUTPUT = 2, FFMPEG_LOSSLESS_OUTPUT = 4, + FFMPEG_USE_MAX_B_FRAMES = (1 << 3), }; /* Paint.flags */ diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index d338d279b72..759ebbfb5cb 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -240,9 +240,9 @@ typedef struct ThemeSpace { char wire[4], wire_edit[4], select[4]; char lamp[4], speaker[4], empty[4], camera[4]; char active[4], group[4], group_active[4], transform[4]; - char vertex[4], vertex_select[4], vertex_unreferenced[4]; + char vertex[4], vertex_select[4], vertex_bevel[4], vertex_unreferenced[4]; char edge[4], edge_select[4]; - char edge_seam[4], edge_sharp[4], edge_facesel[4], edge_crease[4]; + char edge_seam[4], edge_sharp[4], edge_facesel[4], edge_crease[4], edge_bevel[4]; char face[4], face_select[4]; /* solid faces */ char face_dot[4]; /* selected color */ char extra_edge_len[4], extra_edge_angle[4], extra_face_angle[4], extra_face_area[4]; diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index d430049557d..4a08e6b9b57 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -832,6 +832,7 @@ StructRNA *RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop); int RNA_property_pointer_poll(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *value); bool RNA_property_editable(PointerRNA *ptr, PropertyRNA *prop); +bool RNA_property_editable_info(PointerRNA *ptr, PropertyRNA *prop, const char **r_info); bool RNA_property_editable_index(PointerRNA *ptr, PropertyRNA *prop, int index); bool RNA_property_editable_flag(PointerRNA *ptr, PropertyRNA *prop); /* without lib check, only checks the flag */ bool RNA_property_animateable(PointerRNA *ptr, PropertyRNA *prop); @@ -892,7 +893,7 @@ int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop); void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value); int RNA_property_enum_get_default(PointerRNA *ptr, PropertyRNA *prop); void *RNA_property_enum_py_data_get(PropertyRNA *prop); -int RNA_property_enum_step(const struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, int from_value, int direction); +int RNA_property_enum_step(const struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, int from_value, int step); PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop); void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr_value); diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 9eb9b2ade6c..c63fbf272d8 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -121,7 +121,7 @@ void rna_ID_name_set(PointerRNA *ptr, const char *value) BLI_libblock_ensure_unique_name(G.main, id->name); } -static int rna_ID_name_editable(PointerRNA *ptr) +static int rna_ID_name_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { ID *id = (ID *)ptr->data; @@ -809,20 +809,20 @@ static void rna_def_ID_materials(BlenderRNA *brna) func = RNA_def_function(srna, "append", "rna_IDMaterials_append_id"); RNA_def_function_flag(func, FUNC_USE_MAIN); - RNA_def_function_ui_description(func, "Add a new material to the data block"); + RNA_def_function_ui_description(func, "Add a new material to the data-block"); parm = RNA_def_pointer(func, "material", "Material", "", "Material to add"); RNA_def_property_flag(parm, PROP_REQUIRED); func = RNA_def_function(srna, "pop", "rna_IDMaterials_pop_id"); RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_MAIN); - RNA_def_function_ui_description(func, "Remove a material from the data block"); + RNA_def_function_ui_description(func, "Remove a material from the data-block"); parm = RNA_def_int(func, "index", -1, -MAXMAT, MAXMAT, "", "Index of material to remove", 0, MAXMAT); RNA_def_boolean(func, "update_data", 0, "", "Update data by re-adjusting the material slots assigned"); parm = RNA_def_pointer(func, "material", "Material", "", "Material to remove"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "clear", "rna_IDMaterials_clear_id"); - RNA_def_function_ui_description(func, "Remove all materials from the data block"); + RNA_def_function_ui_description(func, "Remove all materials from the data-block"); RNA_def_boolean(func, "update_data", 0, "", "Update data by re-adjusting the material slots assigned"); } @@ -948,12 +948,12 @@ static void rna_def_ID(BlenderRNA *brna) prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_ID_RECALC); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Is Updated", "Datablock is tagged for recalculation"); + RNA_def_property_ui_text(prop, "Is Updated", "Data-block is tagged for recalculation"); prop = RNA_def_property(srna, "is_updated_data", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_ID_RECALC_DATA); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Is Updated Data", "Datablock data is tagged for recalculation"); + RNA_def_property_ui_text(prop, "Is Updated Data", "Data-block data is tagged for recalculation"); prop = RNA_def_property(srna, "is_library_indirect", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_INDIRECT); @@ -992,7 +992,7 @@ static void rna_def_ID(BlenderRNA *brna) parm = RNA_def_pointer(func, "id", "ID", "", "ID to count usages"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); parm = RNA_def_int(func, "count", 0, 0, INT_MAX, - "", "Number of usages/references of given id by current datablock", 0, INT_MAX); + "", "Number of usages/references of given id by current data-block", 0, INT_MAX); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "animation_data_create", "rna_ID_animation_data_create"); @@ -1038,7 +1038,7 @@ static void rna_def_library(BlenderRNA *brna) func = RNA_def_function(srna, "reload", "WM_lib_reload"); RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_CONTEXT); - RNA_def_function_ui_description(func, "Reload this library and all its linked datablocks"); + RNA_def_function_ui_description(func, "Reload this library and all its linked data-blocks"); } void RNA_def_ID(BlenderRNA *brna) { diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 6879a0534e9..6f054e586ec 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -1619,20 +1619,56 @@ bool RNA_property_editable(PointerRNA *ptr, PropertyRNA *prop) { ID *id = ptr->id.data; int flag; + const char *dummy_info; prop = rna_ensure_property(prop); - flag = prop->editable ? prop->editable(ptr) : prop->flag; + flag = prop->editable ? prop->editable(ptr, &dummy_info) : prop->flag; + return ((flag & PROP_EDITABLE) && (flag & PROP_REGISTER) == 0 && (!id || !ID_IS_LINKED_DATABLOCK(id) || (prop->flag & PROP_LIB_EXCEPTION))); } +/** + * Version of #RNA_property_editable that tries to return additional info in \a r_info that can be exposed in UI. + */ +bool RNA_property_editable_info(PointerRNA *ptr, PropertyRNA *prop, const char **r_info) +{ + ID *id = ptr->id.data; + int flag; + + prop = rna_ensure_property(prop); + *r_info = ""; + + /* get flag */ + if (prop->editable) { + flag = prop->editable(ptr, r_info); + } + else { + flag = prop->flag; + if ((flag & PROP_EDITABLE) == 0 || (flag & PROP_REGISTER)) { + *r_info = "This property is for internal use only and can't be edited."; + } + } + + /* property from linked data-block */ + if (id && ID_IS_LINKED_DATABLOCK(id) && (prop->flag & PROP_LIB_EXCEPTION) == 0) { + if (!(*r_info)[0]) { + *r_info = "Can't edit this property from a linked data-block."; + } + return false; + } + + return ((flag & PROP_EDITABLE) && (flag & PROP_REGISTER) == 0); +} + bool RNA_property_editable_flag(PointerRNA *ptr, PropertyRNA *prop) { int flag; + const char *dummy_info; prop = rna_ensure_property(prop); - flag = prop->editable ? prop->editable(ptr) : prop->flag; + flag = prop->editable ? prop->editable(ptr, &dummy_info) : prop->flag; return (flag & PROP_EDITABLE) != 0; } @@ -1647,9 +1683,11 @@ bool RNA_property_editable_index(PointerRNA *ptr, PropertyRNA *prop, int index) prop = rna_ensure_property(prop); flag = prop->flag; - - if (prop->editable) - flag &= prop->editable(ptr); + + if (prop->editable) { + const char *dummy_info; + flag &= prop->editable(ptr, &dummy_info); + } if (prop->itemeditable) flag &= prop->itemeditable(ptr, index); diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index 4283ac78b30..6c3ac935076 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -310,8 +310,8 @@ static void rna_def_dopesheet(BlenderRNA *brna) prop = RNA_def_property(srna, "use_datablock_sort", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ADS_FLAG_NO_DB_SORT); - RNA_def_property_ui_text(prop, "Sort Datablocks", - "Alphabetically sorts datablocks - mainly objects in the scene " + RNA_def_property_ui_text(prop, "Sort Data-Blocks", + "Alphabetically sorts data-blocks - mainly objects in the scene " "(disable to increase viewport speed)"); RNA_def_property_ui_icon(prop, ICON_SORTALPHA, 0); RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); @@ -377,7 +377,7 @@ static void rna_def_dopesheet(BlenderRNA *brna) prop = RNA_def_property(srna, "show_missing_nla", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NLA_NOACT); RNA_def_property_ui_text(prop, "Include Missing NLA", - "Include animation data blocks with no NLA data (NLA editor only)"); + "Include animation data-blocks with no NLA data (NLA editor only)"); RNA_def_property_ui_icon(prop, ICON_ACTION, 0); RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); @@ -510,7 +510,7 @@ static void rna_def_dopesheet(BlenderRNA *brna) prop = RNA_def_property(srna, "show_gpencil_3d_only", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_GP_3DONLY); RNA_def_property_ui_text(prop, "Active Scene Only", - "Only show Grease Pencil datablocks used as part of the active scene"); + "Only show Grease Pencil data-blocks used as part of the active scene"); RNA_def_property_ui_icon(prop, ICON_SCENE_DATA, 0); RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); } diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index 7a1954036e3..cdbf7582fa7 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -89,7 +89,7 @@ static void rna_AnimData_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Point DAG_id_tag_update(id, OB_RECALC_OB | OB_RECALC_DATA); } -static int rna_AnimData_action_editable(PointerRNA *ptr) +static int rna_AnimData_action_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { AnimData *adt = (AnimData *)ptr->data; @@ -305,7 +305,7 @@ static StructRNA *rna_ksPath_id_typef(PointerRNA *ptr) return ID_code_to_RNA_type(ksp->idtype); } -static int rna_ksPath_id_editable(PointerRNA *ptr) +static int rna_ksPath_id_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { KS_Path *ksp = (KS_Path *)ptr->data; return (ksp->idtype) ? PROP_EDITABLE : 0; @@ -393,7 +393,7 @@ static void rna_KeyingSet_name_set(PointerRNA *ptr, const char *value) } -static int rna_KeyingSet_active_ksPath_editable(PointerRNA *ptr) +static int rna_KeyingSet_active_ksPath_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { KeyingSet *ks = (KeyingSet *)ptr->data; @@ -806,7 +806,7 @@ static void rna_def_keyingset_paths(BlenderRNA *brna, PropertyRNA *cprop) parm = RNA_def_pointer(func, "ksp", "KeyingSetPath", "New Path", "Path created and added to the Keying Set"); RNA_def_function_return(func, parm); /* ID-block for target */ - parm = RNA_def_pointer(func, "target_id", "ID", "Target ID", "ID-Datablock for the destination"); + parm = RNA_def_pointer(func, "target_id", "ID", "Target ID", "ID data-block for the destination"); RNA_def_property_flag(parm, PROP_REQUIRED); /* rna-path */ /* XXX hopefully this is long enough */ diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index f4fb30e0793..22e45964742 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -221,7 +221,7 @@ static void rna_Curve_texspace_set(Main *UNUSED(bmain), Scene *UNUSED(scene), Po BKE_curve_texspace_calc(cu); } -static int rna_Curve_texspace_editable(PointerRNA *ptr) +static int rna_Curve_texspace_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { Curve *cu = (Curve *)ptr->data; return (cu->texflag & CU_AUTOSPACE) ? 0 : PROP_EDITABLE; diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index c521e93d33e..1d3b65bb7ba 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -199,13 +199,13 @@ static StructRNA *rna_DriverTarget_id_typef(PointerRNA *ptr) return ID_code_to_RNA_type(dtar->idtype); } -static int rna_DriverTarget_id_editable(PointerRNA *ptr) +static int rna_DriverTarget_id_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { DriverTarget *dtar = (DriverTarget *)ptr->data; return (dtar->idtype) ? PROP_EDITABLE : 0; } -static int rna_DriverTarget_id_type_editable(PointerRNA *ptr) +static int rna_DriverTarget_id_type_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { DriverTarget *dtar = (DriverTarget *)ptr->data; diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index 7eaf8b65902..9b881c13347 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -120,7 +120,7 @@ static char *rna_GPencilLayer_path(PointerRNA *ptr) return BLI_sprintfN("layers[\"%s\"]", name_esc); } -static int rna_GPencilLayer_active_frame_editable(PointerRNA *ptr) +static int rna_GPencilLayer_active_frame_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { bGPDlayer *gpl = (bGPDlayer *)ptr->data; diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h index ba0705b5caa..04b85b8997e 100644 --- a/source/blender/makesrna/intern/rna_internal_types.h +++ b/source/blender/makesrna/intern/rna_internal_types.h @@ -62,7 +62,7 @@ struct Scene; typedef void (*UpdateFunc)(struct Main *main, struct Scene *scene, struct PointerRNA *ptr); typedef void (*ContextPropUpdateFunc)(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop); typedef void (*ContextUpdateFunc)(struct bContext *C, struct PointerRNA *ptr); -typedef int (*EditableFunc)(struct PointerRNA *ptr); +typedef int (*EditableFunc)(struct PointerRNA *ptr, const char **r_info); typedef int (*ItemEditableFunc)(struct PointerRNA *ptr, int index); typedef struct IDProperty *(*IDPropertiesFunc)(struct PointerRNA *ptr, bool create); typedef struct StructRNA *(*StructRefineFunc)(struct PointerRNA *ptr); @@ -188,7 +188,9 @@ struct PropertyRNA { UpdateFunc update; int noteflag; - /* callback for testing if editable */ + /* Callback for testing if editable. Its r_info parameter can be used to + * return info on editable state that might be shown to user. E.g. tooltips + * of disabled buttons can show reason why button is disabled using this. */ EditableFunc editable; /* callback for testing if array-item editable (if applicable) */ ItemEditableFunc itemeditable; diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c index 502e22e2c07..f20e8fb8ed4 100644 --- a/source/blender/makesrna/intern/rna_key.c +++ b/source/blender/makesrna/intern/rna_key.c @@ -797,7 +797,7 @@ static void rna_def_key(BlenderRNA *brna) prop = RNA_def_property(srna, "user", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "from"); - RNA_def_property_ui_text(prop, "User", "Datablock using these shape keys"); + RNA_def_property_ui_text(prop, "User", "Data-block using these shape keys"); prop = RNA_def_property(srna, "use_relative", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "type", KEY_RELATIVE); diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c index 6bc9cc38a7d..9424ddf7d0e 100644 --- a/source/blender/makesrna/intern/rna_lattice.c +++ b/source/blender/makesrna/intern/rna_lattice.c @@ -171,7 +171,7 @@ static void rna_Lattice_use_outside_set(PointerRNA *ptr, int value) } } -static int rna_Lattice_size_editable(PointerRNA *ptr) +static int rna_Lattice_size_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { Lattice *lt = (Lattice *)ptr->data; diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c index 6686b23e847..59f079b4259 100644 --- a/source/blender/makesrna/intern/rna_main.c +++ b/source/blender/makesrna/intern/rna_main.c @@ -329,38 +329,38 @@ void RNA_def_main(BlenderRNA *brna) /* plural must match idtypes in readblenentry.c */ MainCollectionDef lists[] = { - {"cameras", "Camera", "rna_Main_camera_begin", "Cameras", "Camera datablocks", RNA_def_main_cameras}, - {"scenes", "Scene", "rna_Main_scene_begin", "Scenes", "Scene datablocks", RNA_def_main_scenes}, - {"objects", "Object", "rna_Main_object_begin", "Objects", "Object datablocks", RNA_def_main_objects}, - {"materials", "Material", "rna_Main_mat_begin", "Materials", "Material datablocks", RNA_def_main_materials}, - {"node_groups", "NodeTree", "rna_Main_nodetree_begin", "Node Groups", "Node group datablocks", RNA_def_main_node_groups}, - {"meshes", "Mesh", "rna_Main_mesh_begin", "Meshes", "Mesh datablocks", RNA_def_main_meshes}, - {"lamps", "Lamp", "rna_Main_lamp_begin", "Lamps", "Lamp datablocks", RNA_def_main_lamps}, - {"libraries", "Library", "rna_Main_library_begin", "Libraries", "Library datablocks", RNA_def_main_libraries}, - {"screens", "Screen", "rna_Main_screen_begin", "Screens", "Screen datablocks", RNA_def_main_screens}, - {"window_managers", "WindowManager", "rna_Main_wm_begin", "Window Managers", "Window manager datablocks", RNA_def_main_window_managers}, - {"images", "Image", "rna_Main_image_begin", "Images", "Image datablocks", RNA_def_main_images}, - {"lattices", "Lattice", "rna_Main_latt_begin", "Lattices", "Lattice datablocks", RNA_def_main_lattices}, - {"curves", "Curve", "rna_Main_curve_begin", "Curves", "Curve datablocks", RNA_def_main_curves}, - {"metaballs", "MetaBall", "rna_Main_mball_begin", "Metaballs", "Metaball datablocks", RNA_def_main_metaballs}, - {"fonts", "VectorFont", "rna_Main_font_begin", "Vector Fonts", "Vector font datablocks", RNA_def_main_fonts}, - {"textures", "Texture", "rna_Main_tex_begin", "Textures", "Texture datablocks", RNA_def_main_textures}, - {"brushes", "Brush", "rna_Main_brush_begin", "Brushes", "Brush datablocks", RNA_def_main_brushes}, - {"worlds", "World", "rna_Main_world_begin", "Worlds", "World datablocks", RNA_def_main_worlds}, - {"groups", "Group", "rna_Main_group_begin", "Groups", "Group datablocks", RNA_def_main_groups}, - {"shape_keys", "Key", "rna_Main_key_begin", "Shape Keys", "Shape Key datablocks", NULL}, - {"texts", "Text", "rna_Main_text_begin", "Texts", "Text datablocks", RNA_def_main_texts}, - {"speakers", "Speaker", "rna_Main_speaker_begin", "Speakers", "Speaker datablocks", RNA_def_main_speakers}, - {"sounds", "Sound", "rna_Main_sound_begin", "Sounds", "Sound datablocks", RNA_def_main_sounds}, - {"armatures", "Armature", "rna_Main_armature_begin", "Armatures", "Armature datablocks", RNA_def_main_armatures}, - {"actions", "Action", "rna_Main_action_begin", "Actions", "Action datablocks", RNA_def_main_actions}, - {"palettes", "Palette", "rna_Main_palettes_begin", "Palettes", "Palette datablocks", RNA_def_main_palettes}, - {"grease_pencil", "GreasePencil", "rna_Main_gpencil_begin", "Grease Pencil", "Grease Pencil datablocks", RNA_def_main_gpencil}, - {"movieclips", "MovieClip", "rna_Main_movieclips_begin", "Movie Clips", "Movie Clip datablocks", RNA_def_main_movieclips}, - {"masks", "Mask", "rna_Main_masks_begin", "Masks", "Masks datablocks", RNA_def_main_masks}, - {"linestyles", "FreestyleLineStyle", "rna_Main_linestyle_begin", "Line Styles", "Line Style datablocks", RNA_def_main_linestyles}, - {"cache_files", "CacheFile", "rna_Main_cachefiles_begin", "Cache Files", "Cache Files datablocks", RNA_def_main_cachefiles}, - {"paint_curves", "PaintCurve", "rna_Main_paintcurves_begin", "Paint Curves", "Paint Curves datablocks", RNA_def_main_paintcurves}, + {"cameras", "Camera", "rna_Main_camera_begin", "Cameras", "Camera data-blocks", RNA_def_main_cameras}, + {"scenes", "Scene", "rna_Main_scene_begin", "Scenes", "Scene data-blocks", RNA_def_main_scenes}, + {"objects", "Object", "rna_Main_object_begin", "Objects", "Object data-blocks", RNA_def_main_objects}, + {"materials", "Material", "rna_Main_mat_begin", "Materials", "Material data-blocks", RNA_def_main_materials}, + {"node_groups", "NodeTree", "rna_Main_nodetree_begin", "Node Groups", "Node group data-blocks", RNA_def_main_node_groups}, + {"meshes", "Mesh", "rna_Main_mesh_begin", "Meshes", "Mesh data-blocks", RNA_def_main_meshes}, + {"lamps", "Lamp", "rna_Main_lamp_begin", "Lamps", "Lamp data-blocks", RNA_def_main_lamps}, + {"libraries", "Library", "rna_Main_library_begin", "Libraries", "Library data-blocks", RNA_def_main_libraries}, + {"screens", "Screen", "rna_Main_screen_begin", "Screens", "Screen data-blocks", RNA_def_main_screens}, + {"window_managers", "WindowManager", "rna_Main_wm_begin", "Window Managers", "Window manager data-blocks", RNA_def_main_window_managers}, + {"images", "Image", "rna_Main_image_begin", "Images", "Image data-blocks", RNA_def_main_images}, + {"lattices", "Lattice", "rna_Main_latt_begin", "Lattices", "Lattice data-blocks", RNA_def_main_lattices}, + {"curves", "Curve", "rna_Main_curve_begin", "Curves", "Curve data-blocks", RNA_def_main_curves}, + {"metaballs", "MetaBall", "rna_Main_mball_begin", "Metaballs", "Metaball data-blocks", RNA_def_main_metaballs}, + {"fonts", "VectorFont", "rna_Main_font_begin", "Vector Fonts", "Vector font data-blocks", RNA_def_main_fonts}, + {"textures", "Texture", "rna_Main_tex_begin", "Textures", "Texture data-blocks", RNA_def_main_textures}, + {"brushes", "Brush", "rna_Main_brush_begin", "Brushes", "Brush data-blocks", RNA_def_main_brushes}, + {"worlds", "World", "rna_Main_world_begin", "Worlds", "World data-blocks", RNA_def_main_worlds}, + {"groups", "Group", "rna_Main_group_begin", "Groups", "Group data-blocks", RNA_def_main_groups}, + {"shape_keys", "Key", "rna_Main_key_begin", "Shape Keys", "Shape Key data-blocks", NULL}, + {"texts", "Text", "rna_Main_text_begin", "Texts", "Text data-blocks", RNA_def_main_texts}, + {"speakers", "Speaker", "rna_Main_speaker_begin", "Speakers", "Speaker data-blocks", RNA_def_main_speakers}, + {"sounds", "Sound", "rna_Main_sound_begin", "Sounds", "Sound data-blocks", RNA_def_main_sounds}, + {"armatures", "Armature", "rna_Main_armature_begin", "Armatures", "Armature data-blocks", RNA_def_main_armatures}, + {"actions", "Action", "rna_Main_action_begin", "Actions", "Action data-blocks", RNA_def_main_actions}, + {"palettes", "Palette", "rna_Main_palettes_begin", "Palettes", "Palette data-blocks", RNA_def_main_palettes}, + {"grease_pencil", "GreasePencil", "rna_Main_gpencil_begin", "Grease Pencil", "Grease Pencil data-blocks", RNA_def_main_gpencil}, + {"movieclips", "MovieClip", "rna_Main_movieclips_begin", "Movie Clips", "Movie Clip data-blocks", RNA_def_main_movieclips}, + {"masks", "Mask", "rna_Main_masks_begin", "Masks", "Masks data-blocks", RNA_def_main_masks}, + {"linestyles", "FreestyleLineStyle", "rna_Main_linestyle_begin", "Line Styles", "Line Style data-blocks", RNA_def_main_linestyles}, + {"cache_files", "CacheFile", "rna_Main_cachefiles_begin", "Cache Files", "Cache Files data-blocks", RNA_def_main_cachefiles}, + {"paint_curves", "PaintCurve", "rna_Main_paintcurves_begin", "Paint Curves", "Paint Curves data-blocks", RNA_def_main_paintcurves}, {NULL, NULL, NULL, NULL, NULL, NULL} }; @@ -368,7 +368,7 @@ void RNA_def_main(BlenderRNA *brna) srna = RNA_def_struct(brna, "BlendData", NULL); RNA_def_struct_ui_text(srna, "Blendfile Data", - "Main data structure representing a .blend file and all its datablocks"); + "Main data structure representing a .blend file and all its data-blocks"); RNA_def_struct_ui_icon(srna, ICON_BLENDER); prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); diff --git a/source/blender/makesrna/intern/rna_mask.c b/source/blender/makesrna/intern/rna_mask.c index a23d4444861..faf36d28ff9 100644 --- a/source/blender/makesrna/intern/rna_mask.c +++ b/source/blender/makesrna/intern/rna_mask.c @@ -632,13 +632,13 @@ static void rna_def_maskParent(BlenderRNA *brna) /* parent */ prop = RNA_def_property(srna, "parent", PROP_STRING, PROP_NONE); - RNA_def_property_ui_text(prop, "Parent", "Name of parent object in specified data block to which parenting happens"); + RNA_def_property_ui_text(prop, "Parent", "Name of parent object in specified data-block to which parenting happens"); RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2); RNA_def_property_update(prop, 0, "rna_Mask_update_parent"); /* sub_parent */ prop = RNA_def_property(srna, "sub_parent", PROP_STRING, PROP_NONE); - RNA_def_property_ui_text(prop, "Sub Parent", "Name of parent sub-object in specified data block to which parenting happens"); + RNA_def_property_ui_text(prop, "Sub Parent", "Name of parent sub-object in specified data-block to which parenting happens"); RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2); RNA_def_property_update(prop, 0, "rna_Mask_update_parent"); } diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 2a8cc073e22..752f406264a 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -233,7 +233,7 @@ static void rna_Material_active_texture_set(PointerRNA *ptr, PointerRNA value) set_current_material_texture(ma, value.data); } -static int rna_Material_active_texture_editable(PointerRNA *ptr) +static int rna_Material_active_texture_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { Material *ma = (Material *)ptr->id.data; diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 1d734864833..df034ed85d8 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -662,7 +662,7 @@ static void rna_MeshLoopColor_color_set(PointerRNA *ptr, const float *values) (&mcol->r)[2] = (char)(CLAMPIS(values[2] * 255.0f, 0, 255)); } -static int rna_Mesh_texspace_editable(PointerRNA *ptr) +static int rna_Mesh_texspace_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { Mesh *me = (Mesh *)ptr->data; return (me->texflag & ME_AUTOSPACE) ? 0 : PROP_EDITABLE; diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c index d3b66e4c3b4..9d13bc90e72 100644 --- a/source/blender/makesrna/intern/rna_meta.c +++ b/source/blender/makesrna/intern/rna_meta.c @@ -53,7 +53,7 @@ #include "WM_types.h" #include "WM_api.h" -static int rna_Meta_texspace_editable(PointerRNA *ptr) +static int rna_Meta_texspace_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { MetaBall *mb = (MetaBall *)ptr->data; return (mb->texflag & MB_AUTOSPACE) ? 0 : PROP_EDITABLE; diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c index eb87eafe16c..55bc40f573c 100644 --- a/source/blender/makesrna/intern/rna_nla.c +++ b/source/blender/makesrna/intern/rna_nla.c @@ -282,7 +282,7 @@ static void rna_NlaStrip_use_auto_blend_set(PointerRNA *ptr, int value) } } -static int rna_NlaStrip_action_editable(PointerRNA *ptr) +static int rna_NlaStrip_action_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { NlaStrip *strip = (NlaStrip *)ptr->data; diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 1e58b6421f2..e68f75a1399 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -8178,9 +8178,9 @@ static void rna_def_nodetree(BlenderRNA *brna) RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); parm = RNA_def_pointer(func, "result_1", "NodeTree", "Node Tree", "Active node tree from context"); RNA_def_function_output(func, parm); - parm = RNA_def_pointer(func, "result_2", "ID", "Owner ID", "ID data block that owns the node tree"); + parm = RNA_def_pointer(func, "result_2", "ID", "Owner ID", "ID data-block that owns the node tree"); RNA_def_function_output(func, parm); - parm = RNA_def_pointer(func, "result_3", "ID", "From ID", "Original ID data block selected from the context"); + parm = RNA_def_pointer(func, "result_3", "ID", "From ID", "Original ID data-block selected from the context"); RNA_def_function_output(func, parm); } diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 74e9df1889a..58034460de9 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -709,7 +709,7 @@ static void rna_Object_active_material_set(PointerRNA *ptr, PointerRNA value) assign_material(ob, value.data, ob->actcol, BKE_MAT_ASSIGN_EXISTING); } -static int rna_Object_active_material_editable(PointerRNA *ptr) +static int rna_Object_active_material_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { Object *ob = (Object *)ptr->id.data; bool is_editable; diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 1f34d8f23d4..0591e877634 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -556,13 +556,18 @@ static void rna_PoseChannel_constraints_remove(ID *id, bPoseChannel *pchan, Repo } } -static int rna_PoseChannel_proxy_editable(PointerRNA *ptr) +static int rna_PoseChannel_proxy_editable(PointerRNA *ptr, const char **r_info) { Object *ob = (Object *)ptr->id.data; bArmature *arm = ob->data; bPoseChannel *pchan = (bPoseChannel *)ptr->data; - return (ob->proxy && pchan->bone && (pchan->bone->layer & arm->layer_protected)) ? 0 : PROP_EDITABLE; + if (ob->proxy && pchan->bone && (pchan->bone->layer & arm->layer_protected)) { + *r_info = "Can't edit property of a proxy on a protected layer"; + return 0; + } + + return PROP_EDITABLE; } static int rna_PoseChannel_location_editable(PointerRNA *ptr, int index) diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index dfe319dd87d..dfaf0d51578 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -281,16 +281,11 @@ EnumPropertyItem rna_enum_image_type_items[] = { {R_IMF_IMTYPE_FRAMESERVER, "FRAMESERVER", ICON_FILE_SCRIPT, "Frame Server", "Output image to a frameserver"}, #endif #ifdef WITH_FFMPEG - {R_IMF_IMTYPE_H264, "H264", ICON_FILE_MOVIE, "H.264", "Output video in H.264 format"}, - {R_IMF_IMTYPE_FFMPEG, "FFMPEG", ICON_FILE_MOVIE, "MPEG", "Output video in MPEG format"}, - {R_IMF_IMTYPE_THEORA, "THEORA", ICON_FILE_MOVIE, "Ogg Theora", "Output video in Ogg format"}, + {R_IMF_IMTYPE_FFMPEG, "FFMPEG", ICON_FILE_MOVIE, "FFmpeg video", "The most versatile way to output video files"}, #endif #ifdef WITH_QUICKTIME {R_IMF_IMTYPE_QUICKTIME, "QUICKTIME", ICON_FILE_MOVIE, "QuickTime", "Output video in Quicktime format"}, #endif -#ifdef WITH_FFMPEG - {R_IMF_IMTYPE_XVID, "XVID", ICON_FILE_MOVIE, "Xvid", "Output video in Xvid format"}, -#endif {0, NULL, 0, NULL, NULL} }; @@ -920,6 +915,53 @@ static char *rna_RenderSettings_path(PointerRNA *UNUSED(ptr)) return BLI_sprintfN("render"); } +static char *rna_ImageFormatSettings_path(PointerRNA *ptr) +{ + ImageFormatData *imf = (ImageFormatData *)ptr->data; + ID *id = ptr->id.data; + + switch (GS(id->name)) { + case ID_SCE: + { + Scene *scene = (Scene *)id; + + if (&scene->r.im_format == imf) { + return BLI_sprintfN("render.image_settings"); + } + else if (&scene->r.bake.im_format == imf) { + return BLI_sprintfN("render.bake.image_settings"); + } + return BLI_sprintfN(".."); + } + case ID_NT: + { + bNodeTree *ntree = (bNodeTree *)id; + bNode *node; + + for (node = ntree->nodes.first; node; node = node->next) { + if (node->type == CMP_NODE_OUTPUT_FILE) { + if (&((NodeImageMultiFile *)node->storage)->format == imf) { + return BLI_sprintfN("nodes['%s'].format", node->name); + } + else { + bNodeSocket *sock; + + for (sock = node->inputs.first; sock; sock = sock->next) { + NodeImageMultiFileSocket *sockdata = sock->storage; + if (&sockdata->format == imf) { + return BLI_sprintfN("nodes['%s'].file_slots['%s'].format", node->name, sockdata->path); + } + } + } + } + } + return BLI_sprintfN(".."); + } + default: + return BLI_sprintfN(".."); + } +} + static int rna_RenderSettings_threads_get(PointerRNA *ptr) { RenderData *rd = (RenderData *)ptr->data; @@ -2605,7 +2647,7 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_src"); RNA_def_property_enum_items(prop, gpencil_source_3d_items); RNA_def_property_ui_text(prop, "Grease Pencil Source", - "Datablock where active Grease Pencil data is found from"); + "Data-block where active Grease Pencil data is found from"); RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL); prop = RNA_def_property(srna, "gpencil_sculpt", PROP_POINTER, PROP_NONE); @@ -5097,7 +5139,7 @@ static void rna_def_scene_image_format_data(BlenderRNA *brna) srna = RNA_def_struct(brna, "ImageFormatSettings", NULL); RNA_def_struct_sdna(srna, "ImageFormatData"); RNA_def_struct_nested(brna, srna, "Scene"); - /* RNA_def_struct_path_func(srna, "rna_RenderSettings_path"); *//* no need for the path, its not animated! */ + RNA_def_struct_path_func(srna, "rna_ImageFormatSettings_path"); RNA_def_struct_ui_text(srna, "Image Format", "Settings for image formats"); prop = RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE); @@ -5254,6 +5296,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna) PropertyRNA *prop; #ifdef WITH_FFMPEG + /* Container types */ static EnumPropertyItem ffmpeg_format_items[] = { {FFMPEG_MPEG1, "MPEG1", 0, "MPEG-1", ""}, {FFMPEG_MPEG2, "MPEG2", 0, "MPEG-2", ""}, @@ -5261,8 +5304,8 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna) {FFMPEG_AVI, "AVI", 0, "AVI", ""}, {FFMPEG_MOV, "QUICKTIME", 0, "Quicktime", ""}, {FFMPEG_DV, "DV", 0, "DV", ""}, - {FFMPEG_H264, "H264", 0, "H.264", ""}, - {FFMPEG_XVID, "XVID", 0, "Xvid", ""}, +// {FFMPEG_H264, "H264", 0, "H.264", ""}, not a container +// {FFMPEG_XVID, "XVID", 0, "Xvid", ""}, not a container {FFMPEG_OGG, "OGG", 0, "Ogg", ""}, {FFMPEG_MKV, "MKV", 0, "Matroska", ""}, {FFMPEG_FLV, "FLASH", 0, "Flash", ""}, @@ -5286,6 +5329,32 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; + static EnumPropertyItem ffmpeg_preset_items[] = { + {FFM_PRESET_ULTRAFAST, "ULTRAFAST", 0, "Ultra fast; biggest file", ""}, + {FFM_PRESET_SUPERFAST, "SUPERFAST", 0, "Super fast", ""}, + {FFM_PRESET_VERYFAST, "VERYFAST", 0, "Very fast", ""}, + {FFM_PRESET_FASTER, "FASTER", 0, "Faster", ""}, + {FFM_PRESET_FAST, "FAST", 0, "Fast", ""}, + {FFM_PRESET_MEDIUM, "MEDIUM", 0, "Medium speed", ""}, + {FFM_PRESET_SLOW, "SLOW", 0, "Slow", ""}, + {FFM_PRESET_SLOWER, "SLOWER", 0, "Slower", ""}, + {FFM_PRESET_VERYSLOW, "VERYSLOW", 0, "Very slow; smallest file", ""}, + {0, NULL, 0, NULL, NULL} + }; + + static EnumPropertyItem ffmpeg_crf_items[] = { + {FFM_CRF_NONE, "NONE", 0, "None; use constant bit-rate", + "Use 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", ""}, + {FFM_CRF_MEDIUM, "MEDIUM", 0, "Medium quality", ""}, + {FFM_CRF_LOW, "LOW", 0, "Low quality", ""}, + {FFM_CRF_VERYLOW, "VERYLOW", 0, "Very low quality", ""}, + {FFM_CRF_LOWEST, "LOWEST", 0, "Lowest quality", ""}, + {0, NULL, 0, NULL, NULL} + }; + static EnumPropertyItem ffmpeg_audio_codec_items[] = { {AV_CODEC_ID_NONE, "NONE", 0, "None", ""}, {AV_CODEC_ID_MP2, "MP2", 0, "MP2", ""}, @@ -5317,13 +5386,15 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna) RNA_def_property_enum_bitflag_sdna(prop, NULL, "type"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_enum_items(prop, ffmpeg_format_items); - RNA_def_property_ui_text(prop, "Format", "Output file format"); + RNA_def_property_enum_default(prop, FFMPEG_MKV); + RNA_def_property_ui_text(prop, "Container", "Output file container"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_FFmpegSettings_codec_settings_update"); prop = RNA_def_property(srna, "codec", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "codec"); 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_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_FFmpegSettings_codec_settings_update"); @@ -5355,8 +5426,25 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "gopsize", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "gop_size"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_range(prop, 0, 100); - RNA_def_property_ui_text(prop, "GOP Size", "Distance between key frames"); + RNA_def_property_range(prop, 0, 500); + RNA_def_property_int_default(prop, 25); + RNA_def_property_ui_text(prop, "Keyframe interval", + "Distance between key frames, also known as GOP size; " + "influences file size and seekability"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + + prop = RNA_def_property(srna, "max_b_frames", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "max_b_frames"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_range(prop, 0, 16); + RNA_def_property_ui_text(prop, "Max B-frames", + "Maximum number of B-frames between non-B-frames; influences file size and seekability"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + + prop = RNA_def_property(srna, "use_max_b_frames", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", FFMPEG_USE_MAX_B_FRAMES); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Use max B-frames", "Set a maximum number of B-frames"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "buffersize", PROP_INT, PROP_NONE); @@ -5373,6 +5461,24 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Mux Packet Size", "Mux packet size (byte)"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + prop = RNA_def_property(srna, "constant_rate_factor", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "constant_rate_factor"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_enum_items(prop, ffmpeg_crf_items); + RNA_def_property_enum_default(prop, FFM_CRF_MEDIUM); + RNA_def_property_ui_text(prop, "Output quality", + "Constant Rate Factor (CRF); tradeoff between video quality and file size"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + + prop = RNA_def_property(srna, "ffmpeg_preset", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "ffmpeg_preset"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_enum_items(prop, ffmpeg_preset_items); + RNA_def_property_enum_default(prop, FFM_PRESET_MEDIUM); + RNA_def_property_ui_text(prop, "Encoding speed", + "Tradeoff between encoding speed and compression ratio"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + prop = RNA_def_property(srna, "use_autosplit", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", FFMPEG_AUTOSPLIT_OUTPUT); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); @@ -6747,8 +6853,8 @@ void RNA_def_scene(BlenderRNA *brna) /* Struct definition */ srna = RNA_def_struct(brna, "Scene", "ID"); - RNA_def_struct_ui_text(srna, "Scene", - "Scene data block, consisting in objects and defining time and render related settings"); + RNA_def_struct_ui_text(srna, "Scene", "Scene data-block, consisting in objects and " + "defining time and render related settings"); RNA_def_struct_ui_icon(srna, ICON_SCENE_DATA); RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT); diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index c3a66058888..bb9c2a6c2fd 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -292,7 +292,7 @@ static int rna_Sequence_frame_length_get(PointerRNA *ptr) return BKE_sequence_tx_get_final_right(seq, false) - BKE_sequence_tx_get_final_left(seq, false); } -static int rna_Sequence_frame_editable(PointerRNA *ptr) +static int rna_Sequence_frame_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { Sequence *seq = (Sequence *)ptr->data; /* Effect sequences' start frame and length must be readonly! */ diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 944e350a77c..0cba9033b48 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -1635,7 +1635,7 @@ static void rna_FileBrowser_FSMenuEntry_name_set(PointerRNA *ptr, const char *va ED_fsmenu_entry_set_name(fsm, value); } -static int rna_FileBrowser_FSMenuEntry_name_get_editable(PointerRNA *ptr) +static int rna_FileBrowser_FSMenuEntry_name_get_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { FSMenuEntry *fsm = ptr->data; @@ -4286,17 +4286,17 @@ static void rna_def_space_node(BlenderRNA *brna) prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "ID", "Datablock whose nodes are being edited"); + RNA_def_property_ui_text(prop, "ID", "Data-block whose nodes are being edited"); prop = RNA_def_property(srna, "id_from", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "from"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "ID From", "Datablock from which the edited data-block is linked"); + RNA_def_property_ui_text(prop, "ID From", "Data-block from which the edited data-block is linked"); prop = RNA_def_property(srna, "path", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "treepath", NULL); RNA_def_property_struct_type(prop, "NodeTreePath"); - RNA_def_property_ui_text(prop, "Node Tree Path", "Path from the data block to the currently edited node tree"); + RNA_def_property_ui_text(prop, "Node Tree Path", "Path from the data-block to the currently edited node tree"); rna_def_space_node_path_api(brna, prop); prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 4488d1b25ee..91e7286819d 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -1365,6 +1365,11 @@ static void rna_def_userdef_theme_spaces_vertex(StructRNA *srna) RNA_def_property_ui_text(prop, "Vertex Size", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); + prop = RNA_def_property(srna, "vertex_bevel", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Vertex Bevel", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + prop = RNA_def_property(srna, "vertex_unreferenced", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Vertex Group Unreferenced", ""); @@ -1395,6 +1400,11 @@ static void rna_def_userdef_theme_spaces_edge(StructRNA *srna) RNA_def_property_ui_text(prop, "Edge Crease", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); + prop = RNA_def_property(srna, "edge_bevel", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Edge Bevel", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + prop = RNA_def_property(srna, "edge_facesel", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Edge UV Face Select", ""); @@ -2835,13 +2845,13 @@ static void rna_def_userdef_theme_space_nla(BlenderRNA *brna) prop = RNA_def_property(srna, "active_action", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, NULL, "anim_active"); RNA_def_property_array(prop, 4); - RNA_def_property_ui_text(prop, "Active Action", "Animation data block has active action"); + RNA_def_property_ui_text(prop, "Active Action", "Animation data-block has active action"); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop = RNA_def_property(srna, "active_action_unset", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, NULL, "anim_non_active"); RNA_def_property_array(prop, 4); - RNA_def_property_ui_text(prop, "No Active Action", "Animation data block doesn't have active action"); + RNA_def_property_ui_text(prop, "No Active Action", "Animation data-block doesn't have active action"); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop = RNA_def_property(srna, "strips", PROP_FLOAT, PROP_COLOR_GAMMA); @@ -4572,7 +4582,7 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna) prop = RNA_def_property(srna, "show_hidden_files_datablocks", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_HIDE_DOT); - RNA_def_property_ui_text(prop, "Hide Dot Files/Datablocks", "Hide files/data-blocks that start with a dot (.*)"); + RNA_def_property_ui_text(prop, "Hide Dot Files/Data-Blocks", "Hide files/data-blocks that start with a dot (.*)"); prop = RNA_def_property(srna, "use_filter_files", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_FILTERFILEEXTS); diff --git a/source/blender/makesrna/intern/rna_vfont.c b/source/blender/makesrna/intern/rna_vfont.c index e9ba0c78439..c743751649c 100644 --- a/source/blender/makesrna/intern/rna_vfont.c +++ b/source/blender/makesrna/intern/rna_vfont.c @@ -44,7 +44,7 @@ #include "WM_api.h" /* matching fnction in rna_ID.c */ -static int rna_VectorFont_filepath_editable(PointerRNA *ptr) +static int rna_VectorFont_filepath_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { VFont *vfont = ptr->id.data; if (BKE_vfont_is_builtin(vfont)) { diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c index 12cd93e418b..fbc036435f0 100644 --- a/source/blender/nodes/intern/node_common.c +++ b/source/blender/nodes/intern/node_common.c @@ -78,7 +78,7 @@ bNodeSocket *node_group_find_output_socket(bNode *groupnode, const char *identif /* groups display their internal tree name as label */ void node_group_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen) { - BLI_strncpy(label, (node->id) ? node->id->name + 2 : IFACE_("Missing Datablock"), maxlen); + BLI_strncpy(label, (node->id) ? node->id->name + 2 : IFACE_("Missing Data-Block"), maxlen); } int node_group_poll_instance(bNode *node, bNodeTree *nodetree) diff --git a/source/blender/render/intern/source/bake_api.c b/source/blender/render/intern/source/bake_api.c index 1a0ef4e64d4..73424a4e846 100644 --- a/source/blender/render/intern/source/bake_api.c +++ b/source/blender/render/intern/source/bake_api.c @@ -298,20 +298,16 @@ static bool cast_ray_highpoly( } if (hits[i].index != -1) { - /* cull backface */ - const float dot = dot_v3v3(dir_high, hits[i].no); - if (dot < 0.0f) { - float distance; - float hit_world[3]; - - /* distance comparison in world space */ - mul_v3_m4v3(hit_world, highpoly[i].obmat, hits[i].co); - distance = len_squared_v3v3(hit_world, co); - - if (distance < hit_distance) { - hit_mesh = i; - hit_distance = distance; - } + float distance; + float hit_world[3]; + + /* distance comparison in world space */ + mul_v3_m4v3(hit_world, highpoly[i].obmat, hits[i].co); + distance = len_squared_v3v3(hit_world, co); + + if (distance < hit_distance) { + hit_mesh = i; + hit_distance = distance; } } } diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c index 3405537a09c..e872ec1a524 100644 --- a/source/blender/windowmanager/intern/wm_files_link.c +++ b/source/blender/windowmanager/intern/wm_files_link.c @@ -466,7 +466,7 @@ static void wm_link_append_properties_common(wmOperatorType *ot, bool is_link) /* better not save _any_ settings for this operator */ /* properties */ prop = RNA_def_boolean(ot->srna, "link", is_link, - "Link", "Link the objects or datablocks rather than appending"); + "Link", "Link the objects or data-blocks rather than appending"); RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN); prop = RNA_def_boolean(ot->srna, "autoselect", true, "Select", "Select new objects"); @@ -675,7 +675,7 @@ static void lib_relocate_do( id_sort_by_name(which_libbase(bmain, GS(old_id->name)), old_id); BKE_reportf(reports, RPT_WARNING, - "Lib Reload: Replacing all references to old datablock '%s' by reloaded one failed, " + "Lib Reload: Replacing all references to old data-block '%s' by reloaded one failed, " "old one (%d remaining users) had to be kept and was renamed to '%s'", new_id->name, old_id->us, old_id->name); } diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 7177244611e..87ef0596e52 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -3963,9 +3963,9 @@ static int previews_ensure_exec(bContext *C, wmOperator *UNUSED(op)) static void WM_OT_previews_ensure(wmOperatorType *ot) { - ot->name = "Refresh DataBlock Previews"; + ot->name = "Refresh Data-Block Previews"; ot->idname = "WM_OT_previews_ensure"; - ot->description = "Ensure datablock previews are available and up-to-date " + ot->description = "Ensure data-block previews are available and up-to-date " "(to be saved in .blend file, only for some types like materials, textures, etc.)"; ot->exec = previews_ensure_exec; @@ -4022,9 +4022,9 @@ static int previews_clear_exec(bContext *C, wmOperator *op) static void WM_OT_previews_clear(wmOperatorType *ot) { - ot->name = "Clear DataBlock Previews"; + ot->name = "Clear Data-Block Previews"; ot->idname = "WM_OT_previews_clear"; - ot->description = "Clear datablock previews (only for some types like objects, materials, textures, etc.)"; + ot->description = "Clear data-block previews (only for some types like objects, materials, textures, etc.)"; ot->exec = previews_clear_exec; ot->invoke = WM_menu_invoke; @@ -4032,7 +4032,7 @@ static void WM_OT_previews_clear(wmOperatorType *ot) ot->prop = RNA_def_enum_flag(ot->srna, "id_type", preview_id_type_items, FILTER_ID_SCE | FILTER_ID_OB | FILTER_ID_GR | FILTER_ID_MA | FILTER_ID_LA | FILTER_ID_WO | FILTER_ID_TE | FILTER_ID_IM, - "DataBlock Type", "Which datablock previews to clear"); + "Data-Block Type", "Which data-block previews to clear"); } /* *************************** Doc from UI ************* */ diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index edbbf93bf7a..dd93a6ff424 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -1148,7 +1148,7 @@ int main( MEM_freeN(python_code); } else { - fprintf(stderr, "ERROR: cannot yield control to Python: no Python text data block named '%s'\n", python_main); + fprintf(stderr, "ERROR: cannot yield control to Python: no Python text data-block named '%s'\n", python_main); } } else { |