|
@@ -43,7 +43,7 @@ void GridMapEditor::_node_removed(Node *p_node) {
|
|
|
if (p_node == node) {
|
|
|
node = NULL;
|
|
|
hide();
|
|
|
- theme_pallete->hide();
|
|
|
+ mesh_library_palette->hide();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -320,12 +320,12 @@ bool GridMapEditor::do_input_action(Camera *p_camera, const Point2 &p_point, boo
|
|
|
if (!spatial_editor)
|
|
|
return false;
|
|
|
|
|
|
- if (selected_pallete < 0 && input_action != INPUT_COPY && input_action != INPUT_SELECT && input_action != INPUT_DUPLICATE)
|
|
|
+ if (selected_palette < 0 && input_action != INPUT_COPY && input_action != INPUT_SELECT && input_action != INPUT_DUPLICATE)
|
|
|
return false;
|
|
|
- Ref<MeshLibrary> theme = node->get_theme();
|
|
|
- if (theme.is_null())
|
|
|
+ Ref<MeshLibrary> mesh_library = node->get_mesh_library();
|
|
|
+ if (mesh_library.is_null())
|
|
|
return false;
|
|
|
- if (input_action != INPUT_COPY && input_action != INPUT_SELECT && input_action != INPUT_DUPLICATE && !theme->has_item(selected_pallete))
|
|
|
+ if (input_action != INPUT_COPY && input_action != INPUT_SELECT && input_action != INPUT_DUPLICATE && !mesh_library->has_item(selected_palette))
|
|
|
return false;
|
|
|
|
|
|
Camera *camera = p_camera;
|
|
@@ -407,9 +407,9 @@ bool GridMapEditor::do_input_action(Camera *p_camera, const Point2 &p_point, boo
|
|
|
|
|
|
int item = node->get_cell_item(cell[0], cell[1], cell[2]);
|
|
|
if (item >= 0) {
|
|
|
- selected_pallete = item;
|
|
|
- theme_pallete->set_current(item);
|
|
|
- update_pallete();
|
|
|
+ selected_palette = item;
|
|
|
+ mesh_library_palette->set_current(item);
|
|
|
+ update_palette();
|
|
|
_update_cursor_instance();
|
|
|
}
|
|
|
return true;
|
|
@@ -417,12 +417,12 @@ bool GridMapEditor::do_input_action(Camera *p_camera, const Point2 &p_point, boo
|
|
|
if (input_action == INPUT_PAINT) {
|
|
|
SetItem si;
|
|
|
si.pos = Vector3(cell[0], cell[1], cell[2]);
|
|
|
- si.new_value = selected_pallete;
|
|
|
+ si.new_value = selected_palette;
|
|
|
si.new_orientation = cursor_rot;
|
|
|
si.old_value = node->get_cell_item(cell[0], cell[1], cell[2]);
|
|
|
si.old_orientation = node->get_cell_item_orientation(cell[0], cell[1], cell[2]);
|
|
|
set_items.push_back(si);
|
|
|
- node->set_cell_item(cell[0], cell[1], cell[2], selected_pallete, cursor_rot);
|
|
|
+ node->set_cell_item(cell[0], cell[1], cell[2], selected_palette, cursor_rot);
|
|
|
return true;
|
|
|
} else if (input_action == INPUT_ERASE) {
|
|
|
SetItem si;
|
|
@@ -474,7 +474,7 @@ void GridMapEditor::_fill_selection() {
|
|
|
|
|
|
for (int k = selection.begin.z; k <= selection.end.z; k++) {
|
|
|
|
|
|
- undo_redo->add_do_method(node, "set_cell_item", i, j, k, selected_pallete, cursor_rot);
|
|
|
+ undo_redo->add_do_method(node, "set_cell_item", i, j, k, selected_palette, cursor_rot);
|
|
|
undo_redo->add_undo_method(node, "set_cell_item", i, j, k, node->get_cell_item(i, j, k), node->get_cell_item_orientation(i, j, k));
|
|
|
}
|
|
|
}
|
|
@@ -712,42 +712,42 @@ void GridMapEditor::_set_display_mode(int p_mode) {
|
|
|
|
|
|
display_mode = p_mode;
|
|
|
|
|
|
- update_pallete();
|
|
|
+ update_palette();
|
|
|
}
|
|
|
|
|
|
-void GridMapEditor::update_pallete() {
|
|
|
- int selected = theme_pallete->get_current();
|
|
|
+void GridMapEditor::update_palette() {
|
|
|
+ int selected = mesh_library_palette->get_current();
|
|
|
|
|
|
- theme_pallete->clear();
|
|
|
+ mesh_library_palette->clear();
|
|
|
if (display_mode == DISPLAY_THUMBNAIL) {
|
|
|
- theme_pallete->set_max_columns(0);
|
|
|
- theme_pallete->set_icon_mode(ItemList::ICON_MODE_TOP);
|
|
|
+ mesh_library_palette->set_max_columns(0);
|
|
|
+ mesh_library_palette->set_icon_mode(ItemList::ICON_MODE_TOP);
|
|
|
} else if (display_mode == DISPLAY_LIST) {
|
|
|
- theme_pallete->set_max_columns(1);
|
|
|
- theme_pallete->set_icon_mode(ItemList::ICON_MODE_LEFT);
|
|
|
+ mesh_library_palette->set_max_columns(1);
|
|
|
+ mesh_library_palette->set_icon_mode(ItemList::ICON_MODE_LEFT);
|
|
|
}
|
|
|
|
|
|
float min_size = EDITOR_DEF("editors/grid_map/preview_size", 64);
|
|
|
- theme_pallete->set_fixed_icon_size(Size2(min_size, min_size));
|
|
|
- theme_pallete->set_fixed_column_width(min_size * 3 / 2);
|
|
|
- theme_pallete->set_max_text_lines(2);
|
|
|
+ mesh_library_palette->set_fixed_icon_size(Size2(min_size, min_size));
|
|
|
+ mesh_library_palette->set_fixed_column_width(min_size * 3 / 2);
|
|
|
+ mesh_library_palette->set_max_text_lines(2);
|
|
|
|
|
|
- Ref<MeshLibrary> theme = node->get_theme();
|
|
|
+ Ref<MeshLibrary> mesh_library = node->get_mesh_library();
|
|
|
|
|
|
- if (theme.is_null()) {
|
|
|
- last_theme = NULL;
|
|
|
+ if (mesh_library.is_null()) {
|
|
|
+ last_mesh_library = NULL;
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
Vector<int> ids;
|
|
|
- ids = theme->get_item_list();
|
|
|
+ ids = mesh_library->get_item_list();
|
|
|
|
|
|
List<_CGMEItemSort> il;
|
|
|
for (int i = 0; i < ids.size(); i++) {
|
|
|
|
|
|
_CGMEItemSort is;
|
|
|
is.id = ids[i];
|
|
|
- is.name = theme->get_item_name(ids[i]);
|
|
|
+ is.name = mesh_library->get_item_name(ids[i]);
|
|
|
il.push_back(is);
|
|
|
}
|
|
|
il.sort();
|
|
@@ -757,28 +757,28 @@ void GridMapEditor::update_pallete() {
|
|
|
for (List<_CGMEItemSort>::Element *E = il.front(); E; E = E->next()) {
|
|
|
int id = E->get().id;
|
|
|
|
|
|
- theme_pallete->add_item("");
|
|
|
+ mesh_library_palette->add_item("");
|
|
|
|
|
|
- String name = theme->get_item_name(id);
|
|
|
- Ref<Texture> preview = theme->get_item_preview(id);
|
|
|
+ String name = mesh_library->get_item_name(id);
|
|
|
+ Ref<Texture> preview = mesh_library->get_item_preview(id);
|
|
|
|
|
|
if (!preview.is_null()) {
|
|
|
- theme_pallete->set_item_icon(item, preview);
|
|
|
- theme_pallete->set_item_tooltip(item, name);
|
|
|
+ mesh_library_palette->set_item_icon(item, preview);
|
|
|
+ mesh_library_palette->set_item_tooltip(item, name);
|
|
|
}
|
|
|
if (name != "") {
|
|
|
- theme_pallete->set_item_text(item, name);
|
|
|
+ mesh_library_palette->set_item_text(item, name);
|
|
|
}
|
|
|
- theme_pallete->set_item_metadata(item, id);
|
|
|
+ mesh_library_palette->set_item_metadata(item, id);
|
|
|
|
|
|
item++;
|
|
|
}
|
|
|
|
|
|
if (selected != -1) {
|
|
|
- theme_pallete->select(selected);
|
|
|
+ mesh_library_palette->select(selected);
|
|
|
}
|
|
|
|
|
|
- last_theme = theme.operator->();
|
|
|
+ last_mesh_library = mesh_library.operator->();
|
|
|
}
|
|
|
|
|
|
void GridMapEditor::edit(GridMap *p_gridmap) {
|
|
@@ -805,7 +805,7 @@ void GridMapEditor::edit(GridMap *p_gridmap) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- update_pallete();
|
|
|
+ update_palette();
|
|
|
|
|
|
set_process(true);
|
|
|
|
|
@@ -914,7 +914,7 @@ void GridMapEditor::_notification(int p_what) {
|
|
|
switch (p_what) {
|
|
|
|
|
|
case NOTIFICATION_ENTER_TREE: {
|
|
|
- theme_pallete->connect("item_selected", this, "_item_selected_cbk");
|
|
|
+ mesh_library_palette->connect("item_selected", this, "_item_selected_cbk");
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
|
grid[i] = VS::get_singleton()->mesh_create();
|
|
@@ -959,9 +959,9 @@ void GridMapEditor::_notification(int p_what) {
|
|
|
}
|
|
|
grid_xform = xf;
|
|
|
}
|
|
|
- Ref<MeshLibrary> cgmt = node->get_theme();
|
|
|
- if (cgmt.operator->() != last_theme)
|
|
|
- update_pallete();
|
|
|
+ Ref<MeshLibrary> cgmt = node->get_mesh_library();
|
|
|
+ if (cgmt.operator->() != last_mesh_library)
|
|
|
+ update_palette();
|
|
|
|
|
|
if (lock_view) {
|
|
|
|
|
@@ -994,10 +994,10 @@ void GridMapEditor::_update_cursor_instance() {
|
|
|
VisualServer::get_singleton()->free(cursor_instance);
|
|
|
cursor_instance = RID();
|
|
|
|
|
|
- if (selected_pallete >= 0) {
|
|
|
+ if (selected_palette >= 0) {
|
|
|
|
|
|
- if (node && !node->get_theme().is_null()) {
|
|
|
- Ref<Mesh> mesh = node->get_theme()->get_item_mesh(selected_pallete);
|
|
|
+ if (node && !node->get_mesh_library().is_null()) {
|
|
|
+ Ref<Mesh> mesh = node->get_mesh_library()->get_item_mesh(selected_palette);
|
|
|
if (!mesh.is_null() && mesh->get_rid().is_valid()) {
|
|
|
|
|
|
cursor_instance = VisualServer::get_singleton()->instance_create2(mesh->get_rid(), get_tree()->get_root()->get_world()->get_scenario());
|
|
@@ -1008,7 +1008,7 @@ void GridMapEditor::_update_cursor_instance() {
|
|
|
}
|
|
|
|
|
|
void GridMapEditor::_item_selected_cbk(int idx) {
|
|
|
- selected_pallete = theme_pallete->get_item_metadata(idx);
|
|
|
+ selected_palette = mesh_library_palette->get_item_metadata(idx);
|
|
|
|
|
|
_update_cursor_instance();
|
|
|
}
|
|
@@ -1146,9 +1146,9 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
|
|
|
|
|
|
display_mode = DISPLAY_THUMBNAIL;
|
|
|
|
|
|
- theme_pallete = memnew(ItemList);
|
|
|
- add_child(theme_pallete);
|
|
|
- theme_pallete->set_v_size_flags(SIZE_EXPAND_FILL);
|
|
|
+ mesh_library_palette = memnew(ItemList);
|
|
|
+ add_child(mesh_library_palette);
|
|
|
+ mesh_library_palette->set_v_size_flags(SIZE_EXPAND_FILL);
|
|
|
|
|
|
edit_axis = Vector3::AXIS_Y;
|
|
|
edit_floor[0] = -1;
|
|
@@ -1156,7 +1156,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
|
|
|
edit_floor[2] = -1;
|
|
|
|
|
|
cursor_visible = false;
|
|
|
- selected_pallete = -1;
|
|
|
+ selected_palette = -1;
|
|
|
lock_view = false;
|
|
|
cursor_rot = 0;
|
|
|
last_mouseover = Vector3(-1, -1, -1);
|