diff options
Diffstat (limited to 'source/blender/io')
28 files changed, 70 insertions, 81 deletions
diff --git a/source/blender/io/alembic/ABC_alembic.h b/source/blender/io/alembic/ABC_alembic.h index 5664a43233a..3d1391ac2a4 100644 --- a/source/blender/io/alembic/ABC_alembic.h +++ b/source/blender/io/alembic/ABC_alembic.h @@ -19,6 +19,8 @@ * \ingroup balembic */ +#include "DEG_depsgraph.h" + #ifdef __cplusplus extern "C" { #endif @@ -54,7 +56,6 @@ struct AlembicExportParams { bool curves_as_mesh; bool flatten_hierarchy; bool visible_objects_only; - bool renderable_only; bool face_sets; bool use_subdiv_schema; bool packuv; @@ -63,6 +64,7 @@ struct AlembicExportParams { bool export_particles; bool export_custom_properties; bool use_instancing; + enum eEvaluationMode evaluation_mode; /* See MOD_TRIANGULATE_NGON_xxx and MOD_TRIANGULATE_QUAD_xxx * in DNA_modifier_types.h */ diff --git a/source/blender/io/alembic/exporter/abc_custom_props.cc b/source/blender/io/alembic/exporter/abc_custom_props.cc index f5593e7ee30..4ea2fd03fff 100644 --- a/source/blender/io/alembic/exporter/abc_custom_props.cc +++ b/source/blender/io/alembic/exporter/abc_custom_props.cc @@ -141,7 +141,7 @@ void CustomPropertiesExporter::write_idparray(const IDProperty *idp_array) continue; } std::cerr << "Custom property " << idp_array->name << " has elements of varying type"; - BLI_assert(!"Mixed type IDP_ARRAY custom property found"); + BLI_assert_msg(0, "Mixed type IDP_ARRAY custom property found"); } #endif diff --git a/source/blender/io/alembic/exporter/abc_export_capi.cc b/source/blender/io/alembic/exporter/abc_export_capi.cc index 5b8998a0b1a..efe04d64cc3 100644 --- a/source/blender/io/alembic/exporter/abc_export_capi.cc +++ b/source/blender/io/alembic/exporter/abc_export_capi.cc @@ -213,8 +213,7 @@ bool ABC_export(Scene *scene, job->export_ok = false; BLI_strncpy(job->filename, filepath, sizeof(job->filename)); - job->depsgraph = DEG_graph_new( - job->bmain, scene, view_layer, DAG_EVAL_RENDER /* TODO(Sybren): params->evaluation_mode */); + job->depsgraph = DEG_graph_new(job->bmain, scene, view_layer, params->evaluation_mode); job->params = *params; bool export_ok = false; diff --git a/source/blender/io/alembic/exporter/abc_hierarchy_iterator.cc b/source/blender/io/alembic/exporter/abc_hierarchy_iterator.cc index e2be241c144..174b2abb90f 100644 --- a/source/blender/io/alembic/exporter/abc_hierarchy_iterator.cc +++ b/source/blender/io/alembic/exporter/abc_hierarchy_iterator.cc @@ -229,7 +229,7 @@ ABCAbstractWriter *ABCHierarchyIterator::create_data_writer_for_object_type( case OB_GPENCIL: return nullptr; case OB_TYPE_MAX: - BLI_assert(!"OB_TYPE_MAX should not be used"); + BLI_assert_msg(0, "OB_TYPE_MAX should not be used"); return nullptr; } diff --git a/source/blender/io/alembic/exporter/abc_writer_abstract.cc b/source/blender/io/alembic/exporter/abc_writer_abstract.cc index 27b5c2fa2a4..910e04f3bf5 100644 --- a/source/blender/io/alembic/exporter/abc_writer_abstract.cc +++ b/source/blender/io/alembic/exporter/abc_writer_abstract.cc @@ -137,7 +137,7 @@ void ABCAbstractWriter::update_bounding_box(Object *object) void ABCAbstractWriter::write_visibility(const HierarchyContext &context) { - const bool is_visible = context.is_object_visible(DAG_EVAL_RENDER); + const bool is_visible = context.is_object_visible(args_.export_params->evaluation_mode); Alembic::Abc::OObject abc_object = get_alembic_object(); if (!abc_visibility_.valid()) { diff --git a/source/blender/io/alembic/exporter/abc_writer_instance.cc b/source/blender/io/alembic/exporter/abc_writer_instance.cc index 1737e8c091e..353705f2c1d 100644 --- a/source/blender/io/alembic/exporter/abc_writer_instance.cc +++ b/source/blender/io/alembic/exporter/abc_writer_instance.cc @@ -59,7 +59,7 @@ Alembic::Abc::OCompoundProperty ABCInstanceWriter::abc_prop_for_custom_props() OObject ABCInstanceWriter::get_alembic_object() const { /* There is no OObject for an instance. */ - BLI_assert(!"ABCInstanceWriter cannot return its Alembic OObject"); + BLI_assert_msg(0, "ABCInstanceWriter cannot return its Alembic OObject"); return OObject(); } diff --git a/source/blender/io/alembic/exporter/abc_writer_mesh.cc b/source/blender/io/alembic/exporter/abc_writer_mesh.cc index fd7db005dd2..7ffb61e1d1b 100644 --- a/source/blender/io/alembic/exporter/abc_writer_mesh.cc +++ b/source/blender/io/alembic/exporter/abc_writer_mesh.cc @@ -162,7 +162,7 @@ ModifierData *ABCGenericMeshWriter::get_liquid_sim_modifier(Scene *scene, Object bool ABCGenericMeshWriter::is_supported(const HierarchyContext *context) const { if (args_.export_params->visible_objects_only) { - return context->is_object_visible(DAG_EVAL_RENDER); + return context->is_object_visible(args_.export_params->evaluation_mode); } return true; } diff --git a/source/blender/io/alembic/intern/abc_reader_mesh.cc b/source/blender/io/alembic/intern/abc_reader_mesh.cc index 79f34f671c7..c05df7f1ff5 100644 --- a/source/blender/io/alembic/intern/abc_reader_mesh.cc +++ b/source/blender/io/alembic/intern/abc_reader_mesh.cc @@ -565,7 +565,7 @@ void AbcMeshReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSelec Mesh *read_mesh = this->read_mesh(mesh, sample_sel, MOD_MESHSEQ_READ_ALL, nullptr); if (read_mesh != mesh) { - /* XXX fixme after 2.80; mesh->flag isn't copied by BKE_mesh_nomain_to_mesh() */ + /* XXX FIXME: after 2.80; mesh->flag isn't copied by #BKE_mesh_nomain_to_mesh(). */ /* read_mesh can be freed by BKE_mesh_nomain_to_mesh(), so get the flag before that happens. */ short autosmooth = (read_mesh->flag & ME_AUTOSMOOTH); BKE_mesh_nomain_to_mesh(read_mesh, mesh, m_object, &CD_MASK_EVERYTHING, true); diff --git a/source/blender/io/collada/AnimationExporter.cpp b/source/blender/io/collada/AnimationExporter.cpp index 73952b06bc9..9ba59c0414d 100644 --- a/source/blender/io/collada/AnimationExporter.cpp +++ b/source/blender/io/collada/AnimationExporter.cpp @@ -135,7 +135,7 @@ void AnimationExporter::exportAnimation(Object *ob, BCAnimationSampler &sampler) container_is_open = open_animation_container(container_is_open, ob); /* Now take care of the Object Animations - * Note: For Armatures the skeletal animation has already been exported (see above) + * NOTE: For Armatures the skeletal animation has already been exported (see above) * However Armatures also can have Object animation. */ bool export_as_matrix = this->export_settings.get_animation_transformation_type() == @@ -168,7 +168,7 @@ void AnimationExporter::exportAnimation(Object *ob, BCAnimationSampler &sampler) /* * Export all animation FCurves of an Object. * - * Note: This uses the keyframes as sample points, + * NOTE: This uses the keyframes as sample points, * and exports "baked keyframes" while keeping the tangent information * of the FCurves intact. This works for simple cases, but breaks * especially when negative scales are involved in the animation. @@ -337,7 +337,7 @@ void AnimationExporter::export_curve_animation(Object *ob, BCAnimationCurve &cur /* * Some curves can not be exported as is and need some conversion * For more information see implementation of get_modified_export_curve() - * note: if mcurve is not NULL then it must be deleted at end of this method; + * NOTE: if mcurve is not NULL then it must be deleted at end of this method; */ int channel_index = curve.get_channel_index(); @@ -775,7 +775,7 @@ std::string AnimationExporter::get_collada_name(std::string channel_type) const { /* * Translation table to map FCurve animation types to Collada animation. - * Todo: Maybe we can keep the names from the fcurves here instead of + * TODO: Maybe we can keep the names from the fcurves here instead of * mapping. However this is what i found in the old code. So keep * this map for now. */ @@ -799,9 +799,9 @@ std::string AnimationExporter::get_collada_name(std::string channel_type) const {"spot_size", "falloff_angle"}, {"fall_off_exponent", "falloff_exponent"}, {"spot_blend", "falloff_exponent"}, - /* Special blender profile (todo: make this more elegant). */ + /* Special blender profile (TODO: make this more elegant). */ {"blender/blender_dist", "blender/blender_dist"}, - /* Special blender profile (todo: make this more elegant). */ + /* Special blender profile (TODO: make this more elegant). */ {"distance", "blender/blender_dist"}, /* Cameras */ diff --git a/source/blender/io/collada/AnimationImporter.cpp b/source/blender/io/collada/AnimationImporter.cpp index 49f28325257..626e4258239 100644 --- a/source/blender/io/collada/AnimationImporter.cpp +++ b/source/blender/io/collada/AnimationImporter.cpp @@ -164,7 +164,7 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve) void AnimationImporter::fcurve_deg_to_rad(FCurve *cu) { for (unsigned int i = 0; i < cu->totvert; i++) { - /* TODO convert handles too */ + /* TODO: convert handles too. */ cu->bezt[i].vec[1][1] *= DEG2RADF(1.0f); cu->bezt[i].vec[0][1] *= DEG2RADF(1.0f); cu->bezt[i].vec[2][1] *= DEG2RADF(1.0f); @@ -174,7 +174,7 @@ void AnimationImporter::fcurve_deg_to_rad(FCurve *cu) void AnimationImporter::fcurve_scale(FCurve *cu, int scale) { for (unsigned int i = 0; i < cu->totvert; i++) { - /* TODO convert handles too */ + /* TODO: convert handles too. */ cu->bezt[i].vec[1][1] *= scale; cu->bezt[i].vec[0][1] *= scale; cu->bezt[i].vec[2][1] *= scale; @@ -305,7 +305,7 @@ bool AnimationImporter::write_animation(const COLLADAFW::Animation *anim) animation_to_fcurves(curve); break; default: - /* TODO there are also CARDINAL, HERMITE, BSPLINE and STEP types. */ + /* TODO: there are also CARDINAL, HERMITE, BSPLINE and STEP types. */ fprintf(stderr, "CARDINAL, HERMITE and BSPLINE anim interpolation types not supported yet.\n"); break; @@ -624,7 +624,7 @@ void AnimationImporter::Assign_transform_animations( } } break; case COLLADAFW::AnimationList::AXISANGLE: - /* TODO convert axis-angle to quat? or XYZ? */ + /* TODO: convert axis-angle to quat? or XYZ? */ default: unused_fcurve(curves); fprintf(stderr, @@ -972,7 +972,7 @@ void AnimationImporter::apply_matrix_curves(Object *ob, /* * This function returns the aspect ration from the Collada camera. * - * Note:COLLADA allows to specify either XFov, or YFov alone. + * NOTE:COLLADA allows to specify either XFov, or YFov alone. * In that case the aspect ratio can be determined from * the viewport aspect ratio (which is 1:1 ?) * XXX: check this: its probably wrong! @@ -1979,7 +1979,7 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, return false; } - /* TODO support other animclasses */ + /* TODO: support other animclasses. */ if (animclass != COLLADAFW::AnimationList::ANGLE) { report_class_type_unsupported(path, animclass, type); return false; diff --git a/source/blender/io/collada/BCAnimationCurve.h b/source/blender/io/collada/BCAnimationCurve.h index a1597cd47be..36b2a5e8509 100644 --- a/source/blender/io/collada/BCAnimationCurve.h +++ b/source/blender/io/collada/BCAnimationCurve.h @@ -116,7 +116,7 @@ class BCAnimationCurve { bool is_keyframe(int frame); void adjust_range(int frame); - std::string get_animation_name(Object *ob) const; /* xxx: this is collada specific */ + std::string get_animation_name(Object *ob) const; /* XXX: this is COLLADA specific. */ std::string get_channel_target() const; std::string get_channel_type() const; std::string get_channel_posebone() const; /* returns "" if channel is not a bone channel */ diff --git a/source/blender/io/collada/ControllerExporter.cpp b/source/blender/io/collada/ControllerExporter.cpp index 6f0d422dbe2..e61ed47adee 100644 --- a/source/blender/io/collada/ControllerExporter.cpp +++ b/source/blender/io/collada/ControllerExporter.cpp @@ -29,6 +29,7 @@ #include "BKE_action.h" #include "BKE_armature.h" +#include "BKE_deform.h" #include "BKE_global.h" #include "BKE_idprop.h" #include "BKE_lib_id.h" @@ -194,9 +195,9 @@ void ControllerExporter::export_skin_controller(Object *ob, Object *ob_arm) add_bind_shape_mat(ob); - std::string joints_source_id = add_joints_source(ob_arm, &ob->defbase, controller_id); - std::string inv_bind_mat_source_id = add_inv_bind_mats_source( - ob_arm, &ob->defbase, controller_id); + const ListBase *defbase = BKE_object_defgroup_list(ob); + std::string joints_source_id = add_joints_source(ob_arm, defbase, controller_id); + std::string inv_bind_mat_source_id = add_inv_bind_mats_source(ob_arm, defbase, controller_id); std::list<int> vcounts; std::list<int> joints; @@ -207,9 +208,9 @@ void ControllerExporter::export_skin_controller(Object *ob, Object *ob_arm) /* def group index -> joint index */ std::vector<int> joint_index_by_def_index; - bDeformGroup *def; + const bDeformGroup *def; - for (def = (bDeformGroup *)ob->defbase.first, i = 0, j = 0; def; def = def->next, i++) { + for (def = (const bDeformGroup *)defbase->first, i = 0, j = 0; def; def = def->next, i++) { if (is_bone_defgroup(ob_arm, def)) { joint_index_by_def_index.push_back(j++); } @@ -269,7 +270,7 @@ void ControllerExporter::export_skin_controller(Object *ob, Object *ob_arm) } std::string weights_source_id = add_weights_source(me, controller_id, weights); - add_joints_element(&ob->defbase, joints_source_id, inv_bind_mat_source_id); + add_joints_element(defbase, joints_source_id, inv_bind_mat_source_id); add_vertex_weights_element(weights_source_id, joints_source_id, vcounts, joints); BKE_id_free(nullptr, me); @@ -392,7 +393,7 @@ void ControllerExporter::add_weight_extras(Key *key) } } -void ControllerExporter::add_joints_element(ListBase *defbase, +void ControllerExporter::add_joints_element(const ListBase *defbase, const std::string &joints_source_id, const std::string &inv_bind_mat_source_id) { @@ -431,7 +432,7 @@ void ControllerExporter::add_bind_shape_mat(Object *ob) } std::string ControllerExporter::add_joints_source(Object *ob_arm, - ListBase *defbase, + const ListBase *defbase, const std::string &controller_id) { std::string source_id = controller_id + JOINTS_SOURCE_ID_SUFFIX; @@ -468,7 +469,7 @@ std::string ControllerExporter::add_joints_source(Object *ob_arm, } std::string ControllerExporter::add_inv_bind_mats_source(Object *ob_arm, - ListBase *defbase, + const ListBase *defbase, const std::string &controller_id) { std::string source_id = controller_id + BIND_POSES_SOURCE_ID_SUFFIX; @@ -568,13 +569,13 @@ std::string ControllerExporter::add_inv_bind_mats_source(Object *ob_arm, return source_id; } -Bone *ControllerExporter::get_bone_from_defgroup(Object *ob_arm, bDeformGroup *def) +Bone *ControllerExporter::get_bone_from_defgroup(Object *ob_arm, const bDeformGroup *def) { bPoseChannel *pchan = BKE_pose_channel_find_name(ob_arm->pose, def->name); return pchan ? pchan->bone : nullptr; } -bool ControllerExporter::is_bone_defgroup(Object *ob_arm, bDeformGroup *def) +bool ControllerExporter::is_bone_defgroup(Object *ob_arm, const bDeformGroup *def) { return get_bone_from_defgroup(ob_arm, def) != nullptr; } diff --git a/source/blender/io/collada/ControllerExporter.h b/source/blender/io/collada/ControllerExporter.h index 6a377a4119e..0aec9e8d179 100644 --- a/source/blender/io/collada/ControllerExporter.h +++ b/source/blender/io/collada/ControllerExporter.h @@ -97,7 +97,7 @@ class ControllerExporter : public COLLADASW::LibraryControllers, void export_morph_controller(Object *ob, Key *key); - void add_joints_element(ListBase *defbase, + void add_joints_element(const ListBase *defbase, const std::string &joints_source_id, const std::string &inv_bind_mat_source_id); @@ -110,16 +110,16 @@ class ControllerExporter : public COLLADASW::LibraryControllers, void add_weight_extras(Key *key); std::string add_joints_source(Object *ob_arm, - ListBase *defbase, + const ListBase *defbase, const std::string &controller_id); std::string add_inv_bind_mats_source(Object *ob_arm, - ListBase *defbase, + const ListBase *defbase, const std::string &controller_id); - Bone *get_bone_from_defgroup(Object *ob_arm, bDeformGroup *def); + Bone *get_bone_from_defgroup(Object *ob_arm, const bDeformGroup *def); - bool is_bone_defgroup(Object *ob_arm, bDeformGroup *def); + bool is_bone_defgroup(Object *ob_arm, const bDeformGroup *def); std::string add_weights_source(Mesh *me, const std::string &controller_id, diff --git a/source/blender/io/collada/DocumentImporter.cpp b/source/blender/io/collada/DocumentImporter.cpp index beadfc98c74..35bdc0a4e06 100644 --- a/source/blender/io/collada/DocumentImporter.cpp +++ b/source/blender/io/collada/DocumentImporter.cpp @@ -145,7 +145,7 @@ bool DocumentImporter::import() return false; } - /** TODO set up scene graph and such here */ + /** TODO: set up scene graph and such here. */ mImportStage = Fetching_Controller_data; COLLADASaxFWL::Loader loader2; COLLADAFW::Root root2(&loader2, this); @@ -189,7 +189,7 @@ void DocumentImporter::finish() std::vector<Object *> *objects_to_scale = new std::vector<Object *>(); - /** TODO Break up and put into 2-pass parsing of DAE */ + /** TODO: Break up and put into 2-pass parsing of DAE. */ std::vector<const COLLADAFW::VisualScene *>::iterator sit; for (sit = vscenes.begin(); sit != vscenes.end(); sit++) { PointerRNA sceneptr, unit_settings; @@ -1122,7 +1122,7 @@ bool DocumentImporter::writeLight(const COLLADAFW::Light *light) switch (light->getLightType()) { case COLLADAFW::Light::AMBIENT_LIGHT: { - lamp->type = LA_SUN; /* TODO needs more thoughts */ + lamp->type = LA_SUN; /* TODO: needs more thoughts. */ } break; case COLLADAFW::Light::SPOT_LIGHT: { lamp->type = LA_SPOT; diff --git a/source/blender/io/collada/ImageExporter.cpp b/source/blender/io/collada/ImageExporter.cpp index bb7b3bf0631..4dd7e617459 100644 --- a/source/blender/io/collada/ImageExporter.cpp +++ b/source/blender/io/collada/ImageExporter.cpp @@ -113,7 +113,7 @@ void ImagesExporter::export_UV_Image(Image *image, bool use_copies) /* This image is already located on the file system. * But we want to create copies here. * To move images into the same export directory. - * Note: If an image is already located in the export folder, + * NOTE: If an image is already located in the export folder, * then skip the copy (as it would result in a file copy error). */ if (BLI_path_cmp(source_path, export_path) != 0) { diff --git a/source/blender/io/collada/MeshImporter.cpp b/source/blender/io/collada/MeshImporter.cpp index a33256f9a59..5aa57159328 100644 --- a/source/blender/io/collada/MeshImporter.cpp +++ b/source/blender/io/collada/MeshImporter.cpp @@ -170,7 +170,7 @@ void VCOLDataWrapper::get_vcol(int v_index, MLoopCol *mloopcol) case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT: { COLLADAFW::ArrayPrimitiveType<float> *values = mVData->getFloatValues(); if (values->empty() || values->getCount() <= (v_index * stride + 2)) { - return; /* xxx need to create an error instead */ + return; /* XXX: need to create an error instead. */ } mloopcol->r = unit_float_to_uchar_clamp((*values)[v_index * stride]); @@ -181,7 +181,7 @@ void VCOLDataWrapper::get_vcol(int v_index, MLoopCol *mloopcol) case COLLADAFW::MeshVertexData::DATA_TYPE_DOUBLE: { COLLADAFW::ArrayPrimitiveType<double> *values = mVData->getDoubleValues(); if (values->empty() || values->getCount() <= (v_index * stride + 2)) { - return; /* xxx need to create an error instead */ + return; /* XXX: need to create an error instead. */ } mloopcol->r = unit_float_to_uchar_clamp((*values)[v_index * stride]); @@ -967,7 +967,7 @@ static void bc_remove_materials_from_object(Object *ob, Mesh *me) /** * Returns the list of Users of the given Mesh object. - * Note: This function uses the object user flag to control + * NOTE: This function uses the object user flag to control * which objects have already been processed. */ std::vector<Object *> MeshImporter::get_all_users_of(Mesh *reference_mesh) diff --git a/source/blender/io/collada/SkinInfo.cpp b/source/blender/io/collada/SkinInfo.cpp index c2f17174d75..f0e1c5e4c26 100644 --- a/source/blender/io/collada/SkinInfo.cpp +++ b/source/blender/io/collada/SkinInfo.cpp @@ -36,6 +36,7 @@ #include "DNA_scene_types.h" #include "BKE_action.h" +#include "BKE_deform.h" #include "BKE_object.h" #include "BKE_object_deform.h" @@ -289,7 +290,8 @@ void SkinInfo::link_armature(bContext *C, /* -1 means "weight towards the bind shape", we just don't assign it to any group */ if (joint != -1) { - bDeformGroup *def = (bDeformGroup *)BLI_findlink(&ob->defbase, joint); + const ListBase *defbase = BKE_object_defgroup_list(ob); + bDeformGroup *def = (bDeformGroup *)BLI_findlink(defbase, joint); ED_vgroup_vert_add(ob, def, vertex, weights[joint_weight], WEIGHT_REPLACE); } diff --git a/source/blender/io/collada/collada_internal.cpp b/source/blender/io/collada/collada_internal.cpp index 787af933e8f..355aa5c22f0 100644 --- a/source/blender/io/collada/collada_internal.cpp +++ b/source/blender/io/collada/collada_internal.cpp @@ -71,7 +71,7 @@ void UnitConverter::convertVector3(COLLADABU::Math::Vector3 &vec, float *v) v[2] = vec.z; } -/* TODO need also for angle conversion, time conversion... */ +/* TODO: need also for angle conversion, time conversion... */ void UnitConverter::dae_matrix_to_mat4_(float out[4][4], const COLLADABU::Math::Matrix4 &in) { diff --git a/source/blender/io/collada/collada_internal.h b/source/blender/io/collada/collada_internal.h index 1d2ed11bfe6..e3894093507 100644 --- a/source/blender/io/collada/collada_internal.h +++ b/source/blender/io/collada/collada_internal.h @@ -62,7 +62,7 @@ class UnitConverter { float getLinearMeter(void); - /* TODO need also for angle conversion, time conversion... */ + /* TODO: need also for angle conversion, time conversion... */ static void dae_matrix_to_mat4_(float out[4][4], const COLLADABU::Math::Matrix4 &in); static void mat4_to_dae(float out[4][4], float in[4][4]); diff --git a/source/blender/io/collada/collada_utils.cpp b/source/blender/io/collada/collada_utils.cpp index d7855d69d99..9967a526971 100644 --- a/source/blender/io/collada/collada_utils.cpp +++ b/source/blender/io/collada/collada_utils.cpp @@ -159,7 +159,7 @@ std::vector<bAction *> bc_getSceneActions(const bContext *C, Object *ob, bool al for (id = (ID *)bmain->actions.first; id; id = (ID *)(id->next)) { bAction *act = (bAction *)id; /* XXX This currently creates too many actions. - * TODO Need to check if the action is compatible to the given object. */ + * TODO: Need to check if the action is compatible to the given object. */ actions.push_back(act); } } @@ -281,7 +281,7 @@ bool bc_has_object_type(LinkNode *export_set, short obtype) for (node = export_set; node; node = node->next) { Object *ob = (Object *)node->link; - /* XXX - why is this checking for ob->data? - we could be looking for empties */ + /* XXX: why is this checking for ob->data? - we could be looking for empties. */ if (ob->type == obtype && ob->data) { return true; } @@ -728,7 +728,7 @@ void bc_set_IDPropertyMatrix(EditBone *ebone, const char *key, float mat[4][4]) /** * Stores a Float value as a custom bone property * - * Note: This function is currently not needed. Keep for future usage + * NOTE: This function is currently not needed. Keep for future usage */ static void bc_set_IDProperty(EditBone *ebone, const char *key, float value) { @@ -1018,7 +1018,7 @@ void bc_apply_global_transform(Vector &to_vec, const BCMatrix &global_transform, * Check if custom information about bind matrix exists and modify the from_mat * accordingly. * - * Note: This is old style for Blender <= 2.78 only kept for compatibility + * NOTE: This is old style for Blender <= 2.78 only kept for compatibility */ void bc_create_restpose_mat(BCExportSettings &export_settings, Bone *bone, diff --git a/source/blender/io/gpencil/gpencil_io.h b/source/blender/io/gpencil/gpencil_io.h index 24b13479359..fab867b38b3 100644 --- a/source/blender/io/gpencil/gpencil_io.h +++ b/source/blender/io/gpencil/gpencil_io.h @@ -27,9 +27,9 @@ extern "C" { #endif struct ARegion; -struct bContext; struct Object; struct View3D; +struct bContext; typedef struct GpencilIOParams { bContext *C; diff --git a/source/blender/io/gpencil/intern/gpencil_io_base.cc b/source/blender/io/gpencil/intern/gpencil_io_base.cc index 6c369382e0d..294f6bfccb7 100644 --- a/source/blender/io/gpencil/intern/gpencil_io_base.cc +++ b/source/blender/io/gpencil/intern/gpencil_io_base.cc @@ -100,11 +100,9 @@ void GpencilIO::prepare_camera_params(Scene *scene, const GpencilIOParams *ipara invert_m4_m4(viewmat, cam_ob->obmat); mul_m4_m4m4(persmat_, params.winmat, viewmat); - is_ortho_ = params.is_ortho; } else { unit_m4(persmat_); - is_ortho_ = false; } winx_ = params_.region->winx; @@ -129,7 +127,6 @@ void GpencilIO::prepare_camera_params(Scene *scene, const GpencilIOParams *ipara } else { is_camera_ = false; - is_ortho_ = false; /* Calc selected object boundbox. Need set initial value to some variables. */ camera_ratio_ = 1.0f; offset_.x = 0.0f; @@ -248,19 +245,14 @@ bool GpencilIO::gpencil_3D_point_to_screen_space(const float3 co, float2 &r_co) } /** Convert to render space. */ -float2 GpencilIO::gpencil_3D_point_to_render_space(const float3 co, const bool is_ortho) +float2 GpencilIO::gpencil_3D_point_to_render_space(const float3 co) { float3 parent_co = diff_mat_ * co; - mul_m4_v3(persmat_, parent_co); - - if (!is_ortho) { - parent_co.x = parent_co.x / max_ff(FLT_MIN, parent_co.z); - parent_co.y = parent_co.y / max_ff(FLT_MIN, parent_co.z); - } float2 r_co; - r_co.x = (parent_co.x + 1.0f) / 2.0f * (float)render_x_; - r_co.y = (parent_co.y + 1.0f) / 2.0f * (float)render_y_; + mul_v2_project_m4_v3(&r_co.x, persmat_, &parent_co.x); + r_co.x = (r_co.x + 1.0f) / 2.0f * (float)render_x_; + r_co.y = (r_co.y + 1.0f) / 2.0f * (float)render_y_; /* Invert X axis. */ if (invert_axis_[0]) { @@ -279,7 +271,7 @@ float2 GpencilIO::gpencil_3D_point_to_2D(const float3 co) { const bool is_camera = (bool)(rv3d_->persp == RV3D_CAMOB); if (is_camera) { - return gpencil_3D_point_to_render_space(co, is_orthographic()); + return gpencil_3D_point_to_render_space(co); } float2 result; gpencil_3D_point_to_screen_space(co, result); @@ -346,11 +338,6 @@ bool GpencilIO::is_camera_mode() return is_camera_; } -bool GpencilIO::is_orthographic() -{ - return is_ortho_; -} - /* Calculate selected strokes boundbox. */ void GpencilIO::selected_objects_boundbox_calc() { diff --git a/source/blender/io/gpencil/intern/gpencil_io_base.hh b/source/blender/io/gpencil/intern/gpencil_io_base.hh index c3c6f1156bb..02758883f19 100644 --- a/source/blender/io/gpencil/intern/gpencil_io_base.hh +++ b/source/blender/io/gpencil/intern/gpencil_io_base.hh @@ -37,9 +37,9 @@ struct Object; struct RegionView3D; struct Scene; -struct bGPdata; struct bGPDlayer; struct bGPDstroke; +struct bGPdata; using blender::Vector; @@ -88,14 +88,13 @@ class GpencilIO { /* Geometry functions. */ bool gpencil_3D_point_to_screen_space(const float3 co, float2 &r_co); - float2 gpencil_3D_point_to_render_space(const float3 co, const bool is_ortho); + float2 gpencil_3D_point_to_render_space(const float3 co); float2 gpencil_3D_point_to_2D(const float3 co); float stroke_point_radius_get(struct bGPDlayer *gpl, struct bGPDstroke *gps); void create_object_list(); bool is_camera_mode(); - bool is_orthographic(); float stroke_average_opacity_get(); @@ -109,7 +108,6 @@ class GpencilIO { private: float avg_opacity_; bool is_camera_; - bool is_ortho_; rctf select_boundbox_; /* Camera matrix. */ diff --git a/source/blender/io/gpencil/intern/gpencil_io_import_svg.hh b/source/blender/io/gpencil/intern/gpencil_io_import_svg.hh index 0e9271dd2c6..99e8b1ed4fd 100644 --- a/source/blender/io/gpencil/intern/gpencil_io_import_svg.hh +++ b/source/blender/io/gpencil/intern/gpencil_io_import_svg.hh @@ -24,10 +24,10 @@ #include "gpencil_io_import_base.hh" struct GpencilIOParams; -struct NSVGshape; struct NSVGpath; -struct bGPdata; +struct NSVGshape; struct bGPDframe; +struct bGPdata; #define SVG_IMPORTER_NAME "SVG Import for Grease Pencil" #define SVG_IMPORTER_VERSION "v1.0" diff --git a/source/blender/io/usd/intern/usd_hierarchy_iterator.cc b/source/blender/io/usd/intern/usd_hierarchy_iterator.cc index 66dfc21441e..a9cba7f36d9 100644 --- a/source/blender/io/usd/intern/usd_hierarchy_iterator.cc +++ b/source/blender/io/usd/intern/usd_hierarchy_iterator.cc @@ -121,7 +121,7 @@ AbstractHierarchyWriter *USDHierarchyIterator::create_data_writer(const Hierarch case OB_GPENCIL: return nullptr; case OB_TYPE_MAX: - BLI_assert(!"OB_TYPE_MAX should not be used"); + BLI_assert_msg(0, "OB_TYPE_MAX should not be used"); return nullptr; } diff --git a/source/blender/io/usd/intern/usd_writer_abstract.cc b/source/blender/io/usd/intern/usd_writer_abstract.cc index 5e66136abf1..6965ecf6249 100644 --- a/source/blender/io/usd/intern/usd_writer_abstract.cc +++ b/source/blender/io/usd/intern/usd_writer_abstract.cc @@ -128,7 +128,7 @@ bool USDAbstractWriter::mark_as_instance(const HierarchyContext &context, const if (context.export_path == context.original_export_path) { printf("USD ref error: export path is reference path: %s\n", context.export_path.c_str()); - BLI_assert(!"USD reference error"); + BLI_assert_msg(0, "USD reference error"); return false; } diff --git a/source/blender/io/usd/intern/usd_writer_camera.cc b/source/blender/io/usd/intern/usd_writer_camera.cc index 677be9a7fc4..50d644241df 100644 --- a/source/blender/io/usd/intern/usd_writer_camera.cc +++ b/source/blender/io/usd/intern/usd_writer_camera.cc @@ -61,7 +61,7 @@ static void camera_sensor_size_for_render(const Camera *camera, *r_sensor_y = camera->sensor_y; break; case CAMERA_SENSOR_FIT_AUTO: - BLI_assert(!"Camera fit should be either horizontal or vertical"); + BLI_assert_msg(0, "Camera fit should be either horizontal or vertical"); break; } } diff --git a/source/blender/io/usd/intern/usd_writer_light.cc b/source/blender/io/usd/intern/usd_writer_light.cc index f77c51c22ec..7ffae1dd398 100644 --- a/source/blender/io/usd/intern/usd_writer_light.cc +++ b/source/blender/io/usd/intern/usd_writer_light.cc @@ -87,7 +87,7 @@ void USDLightWriter::do_write(HierarchyContext &context) usd_light = pxr::UsdLuxDistantLight::Define(stage, usd_path); break; default: - BLI_assert(!"is_supported() returned true for unsupported light type"); + BLI_assert_msg(0, "is_supported() returned true for unsupported light type"); } /* Scale factor to get to somewhat-similar illumination. Since the USDViewer had similar |