Initialize class/struct variables with default values in modules/
This commit is contained in:
parent
57e2822a05
commit
f7209b459b
100 changed files with 533 additions and 772 deletions
|
|
@ -1046,26 +1046,7 @@ RID GridMap::get_bake_mesh_instance(int p_idx) {
|
|||
}
|
||||
|
||||
GridMap::GridMap() {
|
||||
collision_layer = 1;
|
||||
collision_mask = 1;
|
||||
|
||||
cell_size = Vector3(2, 2, 2);
|
||||
octant_size = 8;
|
||||
awaiting_update = false;
|
||||
_in_tree = false;
|
||||
center_x = true;
|
||||
center_y = true;
|
||||
center_z = true;
|
||||
|
||||
clip = false;
|
||||
clip_floor = 0;
|
||||
clip_axis = Vector3::AXIS_Z;
|
||||
clip_above = true;
|
||||
cell_scale = 1.0;
|
||||
|
||||
navigation = nullptr;
|
||||
set_notify_transform(true);
|
||||
recreating_octants = false;
|
||||
}
|
||||
|
||||
GridMap::~GridMap() {
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class GridMap : public Node3D {
|
|||
int16_t y;
|
||||
int16_t z;
|
||||
};
|
||||
uint64_t key;
|
||||
uint64_t key = 0;
|
||||
|
||||
_FORCE_INLINE_ bool operator<(const IndexKey &p_key) const {
|
||||
return key < p_key.key;
|
||||
|
|
@ -68,7 +68,7 @@ class GridMap : public Node3D {
|
|||
y = (int16_t)p_vector.y;
|
||||
z = (int16_t)p_vector.z;
|
||||
}
|
||||
IndexKey() { key = 0; }
|
||||
IndexKey() {}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -80,13 +80,7 @@ class GridMap : public Node3D {
|
|||
unsigned int rot : 5;
|
||||
unsigned int layer : 8;
|
||||
};
|
||||
uint32_t cell;
|
||||
|
||||
Cell() {
|
||||
item = 0;
|
||||
rot = 0;
|
||||
layer = 0;
|
||||
}
|
||||
uint32_t cell = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -103,7 +97,7 @@ class GridMap : public Node3D {
|
|||
RID instance;
|
||||
RID multimesh;
|
||||
struct Item {
|
||||
int index;
|
||||
int index = 0;
|
||||
Transform transform;
|
||||
IndexKey key;
|
||||
};
|
||||
|
|
@ -116,7 +110,7 @@ class GridMap : public Node3D {
|
|||
RID collision_debug;
|
||||
RID collision_debug_instance;
|
||||
|
||||
bool dirty;
|
||||
bool dirty = false;
|
||||
RID static_body;
|
||||
Map<IndexKey, NavMesh> navmesh_ids;
|
||||
};
|
||||
|
|
@ -129,35 +123,37 @@ class GridMap : public Node3D {
|
|||
int16_t empty;
|
||||
};
|
||||
|
||||
uint64_t key;
|
||||
uint64_t key = 0;
|
||||
|
||||
_FORCE_INLINE_ bool operator<(const OctantKey &p_key) const {
|
||||
return key < p_key.key;
|
||||
}
|
||||
|
||||
//OctantKey(const IndexKey& p_k, int p_item) { indexkey=p_k.key; item=p_item; }
|
||||
OctantKey() { key = 0; }
|
||||
OctantKey() {}
|
||||
};
|
||||
|
||||
uint32_t collision_layer;
|
||||
uint32_t collision_mask;
|
||||
uint32_t collision_layer = 1;
|
||||
uint32_t collision_mask = 1;
|
||||
|
||||
Transform last_transform;
|
||||
|
||||
bool _in_tree;
|
||||
Vector3 cell_size;
|
||||
int octant_size;
|
||||
bool center_x, center_y, center_z;
|
||||
float cell_scale;
|
||||
Navigation3D *navigation;
|
||||
bool _in_tree = false;
|
||||
Vector3 cell_size = Vector3(2, 2, 2);
|
||||
int octant_size = 8;
|
||||
bool center_x = true;
|
||||
bool center_y = true;
|
||||
bool center_z = true;
|
||||
float cell_scale = 1.0;
|
||||
Navigation3D *navigation = nullptr;
|
||||
|
||||
bool clip;
|
||||
bool clip_above;
|
||||
int clip_floor;
|
||||
bool clip = false;
|
||||
bool clip_above = true;
|
||||
int clip_floor = 0;
|
||||
|
||||
bool recreating_octants;
|
||||
bool recreating_octants = false;
|
||||
|
||||
Vector3::Axis clip_axis;
|
||||
Vector3::Axis clip_axis = Vector3::AXIS_Z;
|
||||
|
||||
Ref<MeshLibrary> mesh_library;
|
||||
|
||||
|
|
@ -167,10 +163,10 @@ class GridMap : public Node3D {
|
|||
void _recreate_octant_data();
|
||||
|
||||
struct BakeLight {
|
||||
RS::LightType type;
|
||||
RS::LightType type = RS::LightType::LIGHT_DIRECTIONAL;
|
||||
Vector3 pos;
|
||||
Vector3 dir;
|
||||
float param[RS::LIGHT_PARAM_MAX];
|
||||
float param[RS::LIGHT_PARAM_MAX] = {};
|
||||
};
|
||||
|
||||
_FORCE_INLINE_ Vector3 _octant_get_offset(const OctantKey &p_key) const {
|
||||
|
|
@ -183,7 +179,7 @@ class GridMap : public Node3D {
|
|||
bool _octant_update(const OctantKey &p_key);
|
||||
void _octant_clean_up(const OctantKey &p_key);
|
||||
void _octant_transform(const OctantKey &p_key);
|
||||
bool awaiting_update;
|
||||
bool awaiting_update = false;
|
||||
|
||||
void _queue_octants_dirty();
|
||||
void _update_octants_callback();
|
||||
|
|
|
|||
|
|
@ -769,7 +769,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Ref<In
|
|||
|
||||
struct _CGMEItemSort {
|
||||
String name;
|
||||
int id;
|
||||
int id = 0;
|
||||
_FORCE_INLINE_ bool operator<(const _CGMEItemSort &r_it) const { return name < r_it.name; }
|
||||
};
|
||||
|
||||
|
|
@ -1151,7 +1151,6 @@ void GridMapEditor::_bind_methods() {
|
|||
}
|
||||
|
||||
GridMapEditor::GridMapEditor(EditorNode *p_editor) {
|
||||
input_action = INPUT_NONE;
|
||||
editor = p_editor;
|
||||
undo_redo = p_editor->get_undo_redo();
|
||||
|
||||
|
|
@ -1234,7 +1233,6 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
|
|||
settings_pick_distance->set_value(EDITOR_DEF("editors/grid_map/pick_distance", 5000.0));
|
||||
settings_vbc->add_margin_child(TTR("Pick Distance:"), settings_pick_distance);
|
||||
|
||||
clip_mode = CLIP_DISABLED;
|
||||
options->get_popup()->connect("id_pressed", callable_mp(this, &GridMapEditor::_menu_option));
|
||||
|
||||
HBoxContainer *hb = memnew(HBoxContainer);
|
||||
|
|
@ -1275,8 +1273,6 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
|
|||
|
||||
EDITOR_DEF("editors/grid_map/preview_size", 64);
|
||||
|
||||
display_mode = DISPLAY_THUMBNAIL;
|
||||
|
||||
mesh_library_palette = memnew(ItemList);
|
||||
add_child(mesh_library_palette);
|
||||
mesh_library_palette->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
|
|
@ -1296,11 +1292,6 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
|
|||
edit_floor[1] = -1;
|
||||
edit_floor[2] = -1;
|
||||
|
||||
cursor_visible = false;
|
||||
selected_palette = -1;
|
||||
lock_view = false;
|
||||
cursor_rot = 0;
|
||||
|
||||
selection_mesh = RenderingServer::get_singleton()->mesh_create();
|
||||
paste_mesh = RenderingServer::get_singleton()->mesh_create();
|
||||
|
||||
|
|
@ -1418,8 +1409,6 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
|
|||
}
|
||||
|
||||
_set_selection(false);
|
||||
updating = false;
|
||||
accumulated_floor_delta = 0.0;
|
||||
|
||||
indicator_mat.instance();
|
||||
indicator_mat->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED);
|
||||
|
|
|
|||
|
|
@ -65,11 +65,11 @@ class GridMapEditor : public VBoxContainer {
|
|||
};
|
||||
|
||||
UndoRedo *undo_redo;
|
||||
InputAction input_action;
|
||||
InputAction input_action = INPUT_NONE;
|
||||
Panel *panel;
|
||||
MenuButton *options;
|
||||
SpinBox *floor;
|
||||
double accumulated_floor_delta;
|
||||
double accumulated_floor_delta = 0.0;
|
||||
Button *mode_thumbnail;
|
||||
Button *mode_list;
|
||||
LineEdit *search_box;
|
||||
|
|
@ -82,19 +82,19 @@ class GridMapEditor : public VBoxContainer {
|
|||
|
||||
struct SetItem {
|
||||
Vector3i position;
|
||||
int new_value;
|
||||
int new_orientation;
|
||||
int old_value;
|
||||
int old_orientation;
|
||||
int new_value = 0;
|
||||
int new_orientation = 0;
|
||||
int old_value = 0;
|
||||
int old_orientation = 0;
|
||||
};
|
||||
|
||||
List<SetItem> set_items;
|
||||
|
||||
GridMap *node = nullptr;
|
||||
MeshLibrary *last_mesh_library;
|
||||
ClipMode clip_mode;
|
||||
ClipMode clip_mode = CLIP_DISABLED;
|
||||
|
||||
bool lock_view;
|
||||
bool lock_view = false;
|
||||
Transform grid_xform;
|
||||
Transform edit_grid_xform;
|
||||
Vector3::Axis edit_axis;
|
||||
|
|
@ -112,9 +112,9 @@ class GridMapEditor : public VBoxContainer {
|
|||
RID paste_instance;
|
||||
|
||||
struct ClipboardItem {
|
||||
int cell_item;
|
||||
int cell_item = 0;
|
||||
Vector3 grid_offset;
|
||||
int orientation;
|
||||
int orientation = 0;
|
||||
RID instance;
|
||||
};
|
||||
|
||||
|
|
@ -125,14 +125,14 @@ class GridMapEditor : public VBoxContainer {
|
|||
Ref<StandardMaterial3D> outer_mat;
|
||||
Ref<StandardMaterial3D> selection_floor_mat;
|
||||
|
||||
bool updating;
|
||||
bool updating = false;
|
||||
|
||||
struct Selection {
|
||||
Vector3 click;
|
||||
Vector3 current;
|
||||
Vector3 begin;
|
||||
Vector3 end;
|
||||
bool active;
|
||||
bool active = false;
|
||||
} selection;
|
||||
Selection last_selection;
|
||||
|
||||
|
|
@ -141,18 +141,18 @@ class GridMapEditor : public VBoxContainer {
|
|||
Vector3 current;
|
||||
Vector3 begin;
|
||||
Vector3 end;
|
||||
int orientation;
|
||||
int orientation = 0;
|
||||
};
|
||||
PasteIndicator paste_indicator;
|
||||
|
||||
bool cursor_visible;
|
||||
bool cursor_visible = false;
|
||||
Transform cursor_transform;
|
||||
|
||||
Vector3 cursor_origin;
|
||||
|
||||
int display_mode;
|
||||
int selected_palette;
|
||||
int cursor_rot;
|
||||
int display_mode = DISPLAY_THUMBNAIL;
|
||||
int selected_palette = -1;
|
||||
int cursor_rot = 0;
|
||||
|
||||
enum Menu {
|
||||
MENU_OPTION_NEXT_LEVEL,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue