Style: Apply clang-tidy's modernize-use-default-member-init

This commit is contained in:
Rémi Verschelde 2021-04-05 13:36:41 +02:00
parent 0f0c0e5933
commit 65a2888057
No known key found for this signature in database
GPG key ID: C3336907360768E1
8 changed files with 62 additions and 99 deletions

View file

@ -130,7 +130,7 @@ AnimationCurve::~AnimationCurve() {
AnimationCurveNode::AnimationCurveNode(uint64_t id, const ElementPtr element, const std::string &name, AnimationCurveNode::AnimationCurveNode(uint64_t id, const ElementPtr element, const std::string &name,
const Document &doc, const char *const *target_prop_whitelist /*= NULL*/, const Document &doc, const char *const *target_prop_whitelist /*= NULL*/,
size_t whitelist_size /*= 0*/) : size_t whitelist_size /*= 0*/) :
Object(id, element, name), target(), doc(doc) { Object(id, element, name), doc(doc) {
const ScopePtr sc = GetRequiredScope(element); const ScopePtr sc = GetRequiredScope(element);
// find target node // find target node

View file

@ -93,7 +93,7 @@ using namespace Util;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
LazyObject::LazyObject(uint64_t id, const ElementPtr element, const Document &doc) : LazyObject::LazyObject(uint64_t id, const ElementPtr element, const Document &doc) :
doc(doc), element(element), id(id), flags() { doc(doc), element(element), id(id) {
// empty // empty
} }
@ -252,7 +252,7 @@ FileGlobalSettings::~FileGlobalSettings() {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
Document::Document(const Parser &parser, const ImportSettings &settings) : Document::Document(const Parser &parser, const ImportSettings &settings) :
settings(settings), parser(parser), SafeToImport(false) { settings(settings), parser(parser) {
// Cannot use array default initialization syntax because vc8 fails on it // Cannot use array default initialization syntax because vc8 fails on it
for (unsigned int &timeStamp : creationTimeStamp) { for (unsigned int &timeStamp : creationTimeStamp) {
timeStamp = 0; timeStamp = 0;

View file

@ -80,60 +80,52 @@ namespace FBXDocParser {
/** FBX import settings, parts of which are publicly accessible via their corresponding AI_CONFIG constants */ /** FBX import settings, parts of which are publicly accessible via their corresponding AI_CONFIG constants */
struct ImportSettings { struct ImportSettings {
ImportSettings() :
strictMode(true), readAllLayers(true), readAllMaterials(true), readMaterials(true), readTextures(true), readCameras(true), readLights(true), readAnimations(true), readWeights(true), preservePivots(true), optimizeEmptyAnimationCurves(true), useLegacyEmbeddedTextureNaming(false), removeEmptyBones(true), convertToMeters(false) {
// empty
}
/** enable strict mode: /** enable strict mode:
* - only accept fbx 2012, 2013 files * - only accept fbx 2012, 2013 files
* - on the slightest error, give up. * - on the slightest error, give up.
* *
* Basically, strict mode means that the fbx file will actually * Basically, strict mode means that the fbx file will actually
* be validated. Strict mode is off by default. */ * be validated.*/
bool strictMode; bool strictMode = true;
/** specifies whether all geometry layers are read and scanned for /** specifies whether all geometry layers are read and scanned for
* usable data channels. The FBX spec indicates that many readers * usable data channels. The FBX spec indicates that many readers
* will only read the first channel and that this is in some way * will only read the first channel and that this is in some way
* the recommended way- in reality, however, it happens a lot that * the recommended way- in reality, however, it happens a lot that
* vertex data is spread among multiple layers. The default * vertex data is spread among multiple layers.*/
* value for this option is true.*/ bool readAllLayers = true;
bool readAllLayers;
/** specifies whether all materials are read, or only those that /** specifies whether all materials are read, or only those that
* are referenced by at least one mesh. Reading all materials * are referenced by at least one mesh. Reading all materials
* may make FBX reading a lot slower since all objects * may make FBX reading a lot slower since all objects
* need to be processed. * need to be processed.
* This bit is ignored unless readMaterials=true*/ * This bit is ignored unless readMaterials=true.*/
bool readAllMaterials; bool readAllMaterials = true;
/** import materials (true) or skip them and assign a default /** import materials (true) or skip them and assign a default
* material. The default value is true.*/ * material.*/
bool readMaterials; bool readMaterials = true;
/** import embedded textures? Default value is true.*/ /** import embedded textures?*/
bool readTextures; bool readTextures = true;
/** import cameras? Default value is true.*/ /** import cameras?*/
bool readCameras; bool readCameras = true;
/** import light sources? Default value is true.*/ /** import light sources?*/
bool readLights; bool readLights = true;
/** import animations (i.e. animation curves, the node /** import animations (i.e. animation curves, the node
* skeleton is always imported). Default value is true. */ * skeleton is always imported).*/
bool readAnimations; bool readAnimations = true;
/** read bones (vertex weights and deform info). /** read bones (vertex weights and deform info).*/
* Default value is true. */ bool readWeights = true;
bool readWeights;
/** preserve transformation pivots and offsets. Since these can /** preserve transformation pivots and offsets. Since these can
* not directly be represented in assimp, additional dummy * not directly be represented in assimp, additional dummy
* nodes will be generated. Note that settings this to false * nodes will be generated. Note that settings this to false
* can make animation import a lot slower. The default value * can make animation import a lot slower.
* is true.
* *
* The naming scheme for the generated nodes is: * The naming scheme for the generated nodes is:
* <OriginalName>_$AssimpFbx$_<TransformName> * <OriginalName>_$AssimpFbx$_<TransformName>
@ -149,24 +141,21 @@ struct ImportSettings {
* Scaling * Scaling
* Rotation * Rotation
**/ **/
bool preservePivots; bool preservePivots = true;
/** do not import animation curves that specify a constant /** do not import animation curves that specify a constant
* values matching the corresponding node transformation. * values matching the corresponding node transformation.*/
* The default value is true. */ bool optimizeEmptyAnimationCurves = true;
bool optimizeEmptyAnimationCurves;
/** use legacy naming for embedded textures eg: (*0, *1, *2) /** use legacy naming for embedded textures eg: (*0, *1, *2).*/
*/ bool useLegacyEmbeddedTextureNaming = false;
bool useLegacyEmbeddedTextureNaming;
/** Empty bones shall be removed /** Empty bones shall be removed.*/
*/ bool removeEmptyBones = true;
bool removeEmptyBones;
/** Set to true to perform a conversion from cm to meter after the import /** Set to true to perform a conversion from cm to meter after
*/ * the import.*/
bool convertToMeters; bool convertToMeters = false;
}; };
} // namespace FBXDocParser } // namespace FBXDocParser

View file

@ -171,7 +171,7 @@ Material::~Material() {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
Texture::Texture(uint64_t id, const ElementPtr element, const Document &doc, const std::string &name) : Texture::Texture(uint64_t id, const ElementPtr element, const Document &doc, const std::string &name) :
Object(id, element, name), uvScaling(1.0f, 1.0f), media(nullptr) { Object(id, element, name), uvScaling(1.0f, 1.0f) {
const ScopePtr sc = GetRequiredScope(element); const ScopePtr sc = GetRequiredScope(element);
const ElementPtr Type = sc->GetElement("Type"); const ElementPtr Type = sc->GetElement("Type");
@ -297,7 +297,7 @@ void LayeredTexture::fillTexture(const Document &doc) {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
Video::Video(uint64_t id, const ElementPtr element, const Document &doc, const std::string &name) : Video::Video(uint64_t id, const ElementPtr element, const Document &doc, const std::string &name) :
Object(id, element, name), contentLength(0), content(0) { Object(id, element, name) {
const ScopePtr sc = GetRequiredScope(element); const ScopePtr sc = GetRequiredScope(element);
const ElementPtr Type = sc->GetElement("Type"); const ElementPtr Type = sc->GetElement("Type");

View file

@ -88,7 +88,7 @@ using namespace Util;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
Geometry::Geometry(uint64_t id, const ElementPtr element, const std::string &name, const Document &doc) : Geometry::Geometry(uint64_t id, const ElementPtr element, const std::string &name, const Document &doc) :
Object(id, element, name), skin() { Object(id, element, name) {
const std::vector<const Connection *> &conns = doc.GetConnectionsByDestinationSequenced(ID(), "Deformer"); const std::vector<const Connection *> &conns = doc.GetConnectionsByDestinationSequenced(ID(), "Deformer");
for (const Connection *con : conns) { for (const Connection *con : conns) {
const Skin *sk = ProcessSimpleConnection<Skin>(*con, false, "Skin -> Geometry", element); const Skin *sk = ProcessSimpleConnection<Skin>(*con, false, "Skin -> Geometry", element);

View file

@ -216,7 +216,7 @@ Scope::~Scope() {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
Parser::Parser(const TokenList &tokens, bool is_binary) : Parser::Parser(const TokenList &tokens, bool is_binary) :
tokens(tokens), last(), current(), cursor(tokens.begin()), is_binary(is_binary) { tokens(tokens), cursor(tokens.begin()), is_binary(is_binary) {
root = new_Scope(*this, true); root = new_Scope(*this, true);
scopes.push_back(root); scopes.push_back(root);
} }

View file

@ -145,8 +145,7 @@ std::string PeekPropertyName(const Element &element) {
} // namespace } // namespace
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
PropertyTable::PropertyTable() : PropertyTable::PropertyTable() {
templateProps(), element() {
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View file

@ -691,21 +691,21 @@ private:
}; };
struct Particles { struct Particles {
bool inactive; bool inactive = true;
float inactive_time; float inactive_time = 0.0;
bool emitting; bool emitting = false;
bool one_shot; bool one_shot = false;
int amount; int amount = 0;
float lifetime; float lifetime = 1.0;
float pre_process_time; float pre_process_time = 0.0;
float explosiveness; float explosiveness = 0.0;
float randomness; float randomness = 0.0;
bool restart_request; bool restart_request = false;
AABB custom_aabb; AABB custom_aabb = AABB(Vector3(-4, -4, -4), Vector3(8, 8, 8));
bool use_local_coords; bool use_local_coords = true;
RID process_material; RID process_material;
RS::ParticlesDrawOrder draw_order; RS::ParticlesDrawOrder draw_order = RS::PARTICLES_DRAW_ORDER_INDEX;
Vector<RID> draw_passes; Vector<RID> draw_passes;
@ -730,21 +730,21 @@ private:
RID sub_emitter; RID sub_emitter;
float phase; float phase = 0.0;
float prev_phase; float prev_phase = 0.0;
uint64_t prev_ticks; uint64_t prev_ticks = 0;
uint32_t random_seed; uint32_t random_seed = 0;
uint32_t cycle_number; uint32_t cycle_number = 0;
float speed_scale; float speed_scale = 1.0;
int fixed_fps; int fixed_fps = 0;
bool fractional_delta; bool fractional_delta = false;
float frame_remainder; float frame_remainder = 0;
float collision_base_size; float collision_base_size = 0.01;
bool clear; bool clear = true;
bool force_sub_emit = false; bool force_sub_emit = false;
@ -757,31 +757,6 @@ private:
Set<RID> collisions; Set<RID> collisions;
Particles() :
inactive(true),
inactive_time(0.0),
emitting(false),
one_shot(false),
amount(0),
lifetime(1.0),
pre_process_time(0.0),
explosiveness(0.0),
randomness(0.0),
restart_request(false),
custom_aabb(AABB(Vector3(-4, -4, -4), Vector3(8, 8, 8))),
use_local_coords(true),
draw_order(RS::PARTICLES_DRAW_ORDER_INDEX),
prev_ticks(0),
random_seed(0),
cycle_number(0),
speed_scale(1.0),
fixed_fps(0),
fractional_delta(false),
frame_remainder(0),
collision_base_size(0.01),
clear(true) {
}
Dependency dependency; Dependency dependency;
ParticlesFrameParams frame_params; ParticlesFrameParams frame_params;