Skip to content

Commit

Permalink
Style: Cleanup single-line blocks, semicolons, dead code
Browse files Browse the repository at this point in the history
Remove currently unused implementation of TextureBasisU, could be re-added
later on if needed and ported.
  • Loading branch information
akien-mga committed Feb 16, 2022
1 parent f5b9cba commit b8b4580
Show file tree
Hide file tree
Showing 137 changed files with 847 additions and 1,269 deletions.
2 changes: 1 addition & 1 deletion core/core_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2291,8 +2291,8 @@ void Engine::register_singleton(const StringName &p_name, Object *p_object) {
s.ptr = p_object;
s.user_created = true;
::Engine::get_singleton()->add_singleton(s);
;
}

void Engine::unregister_singleton(const StringName &p_name) {
ERR_FAIL_COND_MSG(!has_singleton(p_name), "Attempt to remove unregistered singleton: " + String(p_name));
ERR_FAIL_COND_MSG(!::Engine::get_singleton()->is_singleton_user_created(p_name), "Attempt to remove non-user created singleton: " + String(p_name));
Expand Down
1 change: 0 additions & 1 deletion core/input/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,6 @@ Input::JoyEvent Input::_get_mapped_axis_event(const JoyDeviceMapping &mapping, J
// It doesn't make sense for a full axis to map to a button,
// but keeping as a default for a trigger with a positive half-axis.
event.value = (shifted_positive_value * 2) - 1;
;
break;
}
return event;
Expand Down
13 changes: 0 additions & 13 deletions core/io/marshalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1417,19 +1417,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
d.get_key_list(&keys);

for (const Variant &E : keys) {
/*
CharString utf8 = E->->utf8();
if (buf) {
encode_uint32(utf8.length()+1,buf);
buf+=4;
memcpy(buf,utf8.get_data(),utf8.length()+1);
}
r_len+=4+utf8.length()+1;
while (r_len%4)
r_len++; //pad
*/
int len;
Error err = encode_variant(E, buf, len, p_full_objects, p_depth + 1);
ERR_FAIL_COND_V(err, err);
Expand Down
5 changes: 0 additions & 5 deletions core/io/resource_format_binary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1607,11 +1607,6 @@ void ResourceFormatSaverBinaryInstance::write_variant(FileAccess *f, const Varia
d.get_key_list(&keys);

for (const Variant &E : keys) {
/*
if (!_check_type(dict[E]))
continue;
*/

write_variant(f, E, resource_map, external_resources, string_map);
write_variant(f, d[E], resource_map, external_resources, string_map);
}
Expand Down
24 changes: 0 additions & 24 deletions core/io/resource_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -672,10 +672,6 @@ int ResourceLoader::get_import_order(const String &p_path) {
if (!loader[i]->recognize_path(local_path)) {
continue;
}
/*
if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint))
continue;
*/

return loader[i]->get_import_order(p_path);
}
Expand All @@ -690,10 +686,6 @@ String ResourceLoader::get_import_group_file(const String &p_path) {
if (!loader[i]->recognize_path(local_path)) {
continue;
}
/*
if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint))
continue;
*/

return loader[i]->get_import_group_file(p_path);
}
Expand All @@ -708,10 +700,6 @@ bool ResourceLoader::is_import_valid(const String &p_path) {
if (!loader[i]->recognize_path(local_path)) {
continue;
}
/*
if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint))
continue;
*/

return loader[i]->is_import_valid(p_path);
}
Expand All @@ -726,10 +714,6 @@ bool ResourceLoader::is_imported(const String &p_path) {
if (!loader[i]->recognize_path(local_path)) {
continue;
}
/*
if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint))
continue;
*/

return loader[i]->is_imported(p_path);
}
Expand All @@ -744,10 +728,6 @@ void ResourceLoader::get_dependencies(const String &p_path, List<String> *p_depe
if (!loader[i]->recognize_path(local_path)) {
continue;
}
/*
if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint))
continue;
*/

loader[i]->get_dependencies(local_path, p_dependencies, p_add_types);
}
Expand All @@ -760,10 +740,6 @@ Error ResourceLoader::rename_dependencies(const String &p_path, const Map<String
if (!loader[i]->recognize_path(local_path)) {
continue;
}
/*
if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint))
continue;
*/

return loader[i]->rename_dependencies(local_path, p_map);
}
Expand Down
3 changes: 2 additions & 1 deletion core/math/bvh_cull.inc
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,9 @@ bool _cull_convex_iterative(uint32_t p_node_id, CullParams &r_params, bool p_ful
uint32_t child_id = leaf.get_item_ref_id(n);

// full up with results? exit early, no point in further testing
if (!_cull_hit(child_id, r_params))
if (!_cull_hit(child_id, r_params)) {
return false;
}
}
}
#endif // BVH_CONVEX_CULL_OPTIMIZED
Expand Down
6 changes: 4 additions & 2 deletions core/math/bvh_debug.inc
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
public:
#ifdef BVH_VERBOSE
void _debug_recursive_print_tree(int p_tree_id) const {
if (_root_node_id[p_tree_id] != BVHCommon::INVALID)
if (_root_node_id[p_tree_id] != BVHCommon::INVALID) {
_debug_recursive_print_tree_node(_root_node_id[p_tree_id]);
}
}

String _debug_aabb_to_string(const BVHABB_CLASS &aabb) const {
Expand Down Expand Up @@ -42,8 +43,9 @@ void _debug_recursive_print_tree_node(uint32_t p_node_id, int depth = 0) const {

sz += "[";
for (int n = 0; n < leaf.num_items; n++) {
if (n)
if (n) {
sz += ", ";
}
sz += "r";
sz += itos(leaf.get_item_ref_id(n));
}
Expand Down
10 changes: 0 additions & 10 deletions core/math/octree.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,6 @@ class Octree {
E = pair_map.insert(key, pdata);
E->get().eA = p_A->pair_list.push_back(&E->get());
E->get().eB = p_B->pair_list.push_back(&E->get());

/*
if (pair_callback)
pair_callback(pair_callback_userdata,p_A->userdata,p_B->userdata);
*/
} else {
E->get().refcount++;
}
Expand Down Expand Up @@ -854,11 +849,6 @@ void Octree<T, use_pairs, AL>::move(OctreeElementID p_id, const AABB &p_aabb) {
Octant *o = F->get().octant;
typename List<typename Element::OctantOwner, AL>::Element *N = F->next();

/*
if (!use_pairs)
o->elements.erase( F->get().E );
*/

if (use_pairs && e.pairable) {
o->pairable_elements.erase(F->get().E);
} else {
Expand Down
13 changes: 4 additions & 9 deletions core/object/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,13 +402,9 @@ void Object::set(const StringName &p_name, const Variant &p_value, bool *r_valid
#endif
}

//try built-in setgetter
// Try built-in setter.
{
if (ClassDB::set_property(this, p_name, p_value, r_valid)) {
/*
if (r_valid)
*r_valid=true;
*/
return;
}
}
Expand All @@ -421,15 +417,14 @@ void Object::set(const StringName &p_name, const Variant &p_value, bool *r_valid
return;

} else if (p_name == CoreStringNames::get_singleton()->_meta) {
//set_meta(p_name,p_value);
metadata = p_value.duplicate();
if (r_valid) {
*r_valid = true;
}
return;
}

//something inside the object... :|
// Something inside the object... :|
bool success = _setv(p_name, p_value);
if (success) {
if (r_valid) {
Expand Down Expand Up @@ -485,7 +480,7 @@ Variant Object::get(const StringName &p_name, bool *r_valid) const {
#endif
}

//try built-in setgetter
// Try built-in getter.
{
if (ClassDB::get_property(const_cast<Object *>(this), p_name, ret)) {
if (r_valid) {
Expand All @@ -510,7 +505,7 @@ Variant Object::get(const StringName &p_name, bool *r_valid) const {
return ret;

} else {
//something inside the object... :|
// Something inside the object... :|
bool success = _getv(p_name, ret);
if (success) {
if (r_valid) {
Expand Down
45 changes: 19 additions & 26 deletions core/object/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,7 @@ struct MethodInfo {
MethodInfo(const PropertyInfo &p_ret, const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3, const PropertyInfo &p_param4, const PropertyInfo &p_param5);
};

// old cast_to
//if ( is_type(T::get_class_static()) )
//return static_cast<T*>(this);
////else
//return nullptr;

// API used to extend in GDNative and other C compatible compiled languages
// API used to extend in GDNative and other C compatible compiled languages.
class MethodBind;

struct ObjectNativeExtension {
Expand Down Expand Up @@ -297,8 +291,10 @@ struct ObjectNativeExtension {
#define GDVIRTUAL_IS_OVERRIDDEN_PTR(m_obj, m_name) m_obj->_gdvirtual_##m_name##_overridden()

/*
the following is an incomprehensible blob of hacks and workarounds to compensate for many of the fallencies in C++. As a plus, this macro pretty much alone defines the object model.
*/
* The following is an incomprehensible blob of hacks and workarounds to
* compensate for many of the fallacies in C++. As a plus, this macro pretty
* much alone defines the object model.
*/

#define REVERSE_GET_PROPERTY_LIST \
public: \
Expand Down Expand Up @@ -534,7 +530,7 @@ class Object {
Set<String> editor_section_folding;
#endif
ScriptInstance *script_instance = nullptr;
Variant script; //reference does not yet exist, store it in a
Variant script; // Reference does not exist yet, store it in a Variant.
Dictionary metadata;
mutable StringName _class_name;
mutable const StringName *_class_ptr = nullptr;
Expand Down Expand Up @@ -583,6 +579,7 @@ class Object {
}
return can_die;
}

friend class NativeExtensionMethodBind;
_ALWAYS_INLINE_ const ObjectNativeExtension *_get_extension() const { return _extension; }
_ALWAYS_INLINE_ GDExtensionClassInstancePtr _get_extension_instance() const { return _extension_instance; }
Expand Down Expand Up @@ -617,9 +614,6 @@ class Object {
static void get_valid_parents_static(List<String> *p_parents);
static void _get_valid_parents_static(List<String> *p_parents);

//Variant _call_bind(const StringName& p_name, const Variant& p_arg1 = Variant(), const Variant& p_arg2 = Variant(), const Variant& p_arg3 = Variant(), const Variant& p_arg4 = Variant());
//void _call_deferred_bind(const StringName& p_name, const Variant& p_arg1 = Variant(), const Variant& p_arg2 = Variant(), const Variant& p_arg3 = Variant(), const Variant& p_arg4 = Variant());

Variant _call_bind(const Variant **p_args, int p_argcount, Callable::CallError &r_error);
Variant _call_deferred_bind(const Variant **p_args, int p_argcount, Callable::CallError &r_error);

Expand All @@ -641,7 +635,7 @@ class Object {

void _disconnect(const StringName &p_signal, const Callable &p_callable, bool p_force = false);

public: //should be protected, but bug in clang++
public: // Should be protected, but bug in clang++.
static void initialize_class();
_FORCE_INLINE_ static void register_custom_data_to_otdb() {}

Expand Down Expand Up @@ -729,8 +723,6 @@ class Object {
}

/* IAPI */
//void set(const String& p_name, const Variant& p_value);
//Variant get(const String& p_name) const;

void set(const StringName &p_name, const Variant &p_value, bool *r_valid = nullptr);
Variant get(const StringName &p_name, bool *r_valid = nullptr) const;
Expand All @@ -748,7 +740,7 @@ class Object {
void notification(int p_notification, bool p_reversed = false);
virtual String to_string();

//used mainly by script, get and set all INCLUDING string
// Used mainly by script, get and set all INCLUDING string.
virtual Variant getvar(const Variant &p_key, bool *r_valid = nullptr) const;
virtual void setvar(const Variant &p_key, const Variant &p_value, bool *r_valid = nullptr);

Expand All @@ -757,8 +749,6 @@ class Object {
void set_script(const Variant &p_script);
Variant get_script() const;

/* SCRIPT */

bool has_meta(const StringName &p_name) const;
void set_meta(const StringName &p_name, const Variant &p_value);
void remove_meta(const StringName &p_name);
Expand All @@ -768,13 +758,15 @@ class Object {
#ifdef TOOLS_ENABLED
void set_edited(bool p_edited);
bool is_edited() const;
uint32_t get_edited_version() const; //this function is used to check when something changed beyond a point, it's used mainly for generating previews
// This function is used to check when something changed beyond a point, it's used mainly for generating previews.
uint32_t get_edited_version() const;
#endif

void set_script_instance(ScriptInstance *p_instance);
_FORCE_INLINE_ ScriptInstance *get_script_instance() const { return script_instance; }

void set_script_and_instance(const Variant &p_script, ScriptInstance *p_instance); //some script languages can't control instance creation, so this function eases the process
// Some script languages can't control instance creation, so this function eases the process.
void set_script_and_instance(const Variant &p_script, ScriptInstance *p_instance);

void add_user_signal(const MethodInfo &p_signal);
Error emit_signal(const StringName &p_name, VARIANT_ARG_LIST);
Expand Down Expand Up @@ -803,10 +795,11 @@ class Object {

virtual void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const;

String tr(const StringName &p_message, const StringName &p_context = "") const; // translate message (internationalization)
// Translate message (internationalization).
String tr(const StringName &p_message, const StringName &p_context = "") const;
String tr_n(const StringName &p_message, const StringName &p_message_plural, int p_n, const StringName &p_context = "") const;

bool _is_queued_for_deletion = false; // set to true by SceneTree::queue_delete()
bool _is_queued_for_deletion = false; // Set to true by SceneTree::queue_delete().
bool is_queued_for_deletion() const;

_FORCE_INLINE_ void set_message_translation(bool p_enable) { _can_translate = p_enable; }
Expand Down Expand Up @@ -838,14 +831,14 @@ bool predelete_handler(Object *p_object);
void postinitialize_handler(Object *p_object);

class ObjectDB {
//this needs to add up to 63, 1 bit is for reference
// This needs to add up to 63, 1 bit is for reference.
#define OBJECTDB_VALIDATOR_BITS 39
#define OBJECTDB_VALIDATOR_MASK ((uint64_t(1) << OBJECTDB_VALIDATOR_BITS) - 1)
#define OBJECTDB_SLOT_MAX_COUNT_BITS 24
#define OBJECTDB_SLOT_MAX_COUNT_MASK ((uint64_t(1) << OBJECTDB_SLOT_MAX_COUNT_BITS) - 1)
#define OBJECTDB_REFERENCE_BIT (uint64_t(1) << (OBJECTDB_SLOT_MAX_COUNT_BITS + OBJECTDB_VALIDATOR_BITS))

struct ObjectSlot { //128 bits per slot
struct ObjectSlot { // 128 bits per slot.
uint64_t validator : OBJECTDB_VALIDATOR_BITS;
uint64_t next_free : OBJECTDB_SLOT_MAX_COUNT_BITS;
uint64_t is_ref_counted : 1;
Expand Down Expand Up @@ -875,7 +868,7 @@ class ObjectDB {
uint64_t id = p_instance_id;
uint32_t slot = id & OBJECTDB_SLOT_MAX_COUNT_MASK;

ERR_FAIL_COND_V(slot >= slot_max, nullptr); //this should never happen unless RID is corrupted
ERR_FAIL_COND_V(slot >= slot_max, nullptr); // This should never happen unless RID is corrupted.

spin_lock.lock();

Expand Down
6 changes: 4 additions & 2 deletions core/os/os.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,16 +391,18 @@ bool OS::has_feature(const String &p_feature) {
return true;
}
#else
if (p_feature == "release")
if (p_feature == "release") {
return true;
}
#endif
#ifdef TOOLS_ENABLED
if (p_feature == "editor") {
return true;
}
#else
if (p_feature == "standalone")
if (p_feature == "standalone") {
return true;
}
#endif

if (sizeof(void *) == 8 && p_feature == "64") {
Expand Down
Loading

0 comments on commit b8b4580

Please sign in to comment.