You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-06 17:25:19 +00:00
Fix theme application in various curve editors
This commit is contained in:
@@ -147,12 +147,15 @@ void AbstractPolygon2DEditor::_menu_option(int p_option) {
|
|||||||
|
|
||||||
void AbstractPolygon2DEditor::_notification(int p_what) {
|
void AbstractPolygon2DEditor::_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
|
case NOTIFICATION_ENTER_TREE:
|
||||||
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
|
button_create->set_icon(get_theme_icon(SNAME("CurveCreate"), SNAME("EditorIcons")));
|
||||||
|
button_edit->set_icon(get_theme_icon(SNAME("CurveEdit"), SNAME("EditorIcons")));
|
||||||
|
button_delete->set_icon(get_theme_icon(SNAME("CurveDelete"), SNAME("EditorIcons")));
|
||||||
|
} break;
|
||||||
case NOTIFICATION_READY: {
|
case NOTIFICATION_READY: {
|
||||||
disable_polygon_editing(false, String());
|
disable_polygon_editing(false, String());
|
||||||
|
|
||||||
button_create->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("CurveCreate"), SNAME("EditorIcons")));
|
|
||||||
button_edit->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("CurveEdit"), SNAME("EditorIcons")));
|
|
||||||
button_delete->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("CurveDelete"), SNAME("EditorIcons")));
|
|
||||||
button_edit->set_pressed(true);
|
button_edit->set_pressed(true);
|
||||||
|
|
||||||
get_tree()->connect("node_removed", callable_mp(this, &AbstractPolygon2DEditor::_node_removed));
|
get_tree()->connect("node_removed", callable_mp(this, &AbstractPolygon2DEditor::_node_removed));
|
||||||
|
|||||||
@@ -38,14 +38,13 @@
|
|||||||
|
|
||||||
void Path2DEditor::_notification(int p_what) {
|
void Path2DEditor::_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_READY: {
|
case NOTIFICATION_ENTER_TREE:
|
||||||
//button_create->set_icon( get_icon("Edit","EditorIcons"));
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
//button_edit->set_icon( get_icon("MovePoint","EditorIcons"));
|
curve_edit->set_icon(get_theme_icon(SNAME("CurveEdit"), SNAME("EditorIcons")));
|
||||||
//set_pressed_button(button_edit);
|
curve_edit_curve->set_icon(get_theme_icon(SNAME("CurveCurve"), SNAME("EditorIcons")));
|
||||||
//button_edit->set_pressed(true);
|
curve_create->set_icon(get_theme_icon(SNAME("CurveCreate"), SNAME("EditorIcons")));
|
||||||
|
curve_del->set_icon(get_theme_icon(SNAME("CurveDelete"), SNAME("EditorIcons")));
|
||||||
} break;
|
curve_close->set_icon(get_theme_icon(SNAME("CurveClose"), SNAME("EditorIcons")));
|
||||||
case NOTIFICATION_PHYSICS_PROCESS: {
|
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -532,41 +531,41 @@ Path2DEditor::Path2DEditor(EditorNode *p_editor) {
|
|||||||
|
|
||||||
sep = memnew(VSeparator);
|
sep = memnew(VSeparator);
|
||||||
base_hb->add_child(sep);
|
base_hb->add_child(sep);
|
||||||
|
|
||||||
curve_edit = memnew(Button);
|
curve_edit = memnew(Button);
|
||||||
curve_edit->set_flat(true);
|
curve_edit->set_flat(true);
|
||||||
curve_edit->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("CurveEdit"), SNAME("EditorIcons")));
|
|
||||||
curve_edit->set_toggle_mode(true);
|
curve_edit->set_toggle_mode(true);
|
||||||
curve_edit->set_focus_mode(Control::FOCUS_NONE);
|
curve_edit->set_focus_mode(Control::FOCUS_NONE);
|
||||||
curve_edit->set_tooltip(TTR("Select Points") + "\n" + TTR("Shift+Drag: Select Control Points") + "\n" + keycode_get_string((Key)KeyModifierMask::CMD) + TTR("Click: Add Point") + "\n" + TTR("Left Click: Split Segment (in curve)") + "\n" + TTR("Right Click: Delete Point"));
|
curve_edit->set_tooltip(TTR("Select Points") + "\n" + TTR("Shift+Drag: Select Control Points") + "\n" + keycode_get_string((Key)KeyModifierMask::CMD) + TTR("Click: Add Point") + "\n" + TTR("Left Click: Split Segment (in curve)") + "\n" + TTR("Right Click: Delete Point"));
|
||||||
curve_edit->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected), varray(MODE_EDIT));
|
curve_edit->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected), varray(MODE_EDIT));
|
||||||
base_hb->add_child(curve_edit);
|
base_hb->add_child(curve_edit);
|
||||||
|
|
||||||
curve_edit_curve = memnew(Button);
|
curve_edit_curve = memnew(Button);
|
||||||
curve_edit_curve->set_flat(true);
|
curve_edit_curve->set_flat(true);
|
||||||
curve_edit_curve->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("CurveCurve"), SNAME("EditorIcons")));
|
|
||||||
curve_edit_curve->set_toggle_mode(true);
|
curve_edit_curve->set_toggle_mode(true);
|
||||||
curve_edit_curve->set_focus_mode(Control::FOCUS_NONE);
|
curve_edit_curve->set_focus_mode(Control::FOCUS_NONE);
|
||||||
curve_edit_curve->set_tooltip(TTR("Select Control Points (Shift+Drag)"));
|
curve_edit_curve->set_tooltip(TTR("Select Control Points (Shift+Drag)"));
|
||||||
curve_edit_curve->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected), varray(MODE_EDIT_CURVE));
|
curve_edit_curve->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected), varray(MODE_EDIT_CURVE));
|
||||||
base_hb->add_child(curve_edit_curve);
|
base_hb->add_child(curve_edit_curve);
|
||||||
|
|
||||||
curve_create = memnew(Button);
|
curve_create = memnew(Button);
|
||||||
curve_create->set_flat(true);
|
curve_create->set_flat(true);
|
||||||
curve_create->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("CurveCreate"), SNAME("EditorIcons")));
|
|
||||||
curve_create->set_toggle_mode(true);
|
curve_create->set_toggle_mode(true);
|
||||||
curve_create->set_focus_mode(Control::FOCUS_NONE);
|
curve_create->set_focus_mode(Control::FOCUS_NONE);
|
||||||
curve_create->set_tooltip(TTR("Add Point (in empty space)"));
|
curve_create->set_tooltip(TTR("Add Point (in empty space)"));
|
||||||
curve_create->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected), varray(MODE_CREATE));
|
curve_create->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected), varray(MODE_CREATE));
|
||||||
base_hb->add_child(curve_create);
|
base_hb->add_child(curve_create);
|
||||||
|
|
||||||
curve_del = memnew(Button);
|
curve_del = memnew(Button);
|
||||||
curve_del->set_flat(true);
|
curve_del->set_flat(true);
|
||||||
curve_del->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("CurveDelete"), SNAME("EditorIcons")));
|
|
||||||
curve_del->set_toggle_mode(true);
|
curve_del->set_toggle_mode(true);
|
||||||
curve_del->set_focus_mode(Control::FOCUS_NONE);
|
curve_del->set_focus_mode(Control::FOCUS_NONE);
|
||||||
curve_del->set_tooltip(TTR("Delete Point"));
|
curve_del->set_tooltip(TTR("Delete Point"));
|
||||||
curve_del->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected), varray(MODE_DELETE));
|
curve_del->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected), varray(MODE_DELETE));
|
||||||
base_hb->add_child(curve_del);
|
base_hb->add_child(curve_del);
|
||||||
|
|
||||||
curve_close = memnew(Button);
|
curve_close = memnew(Button);
|
||||||
curve_close->set_flat(true);
|
curve_close->set_flat(true);
|
||||||
curve_close->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("CurveClose"), SNAME("EditorIcons")));
|
|
||||||
curve_close->set_focus_mode(Control::FOCUS_NONE);
|
curve_close->set_focus_mode(Control::FOCUS_NONE);
|
||||||
curve_close->set_tooltip(TTR("Close Curve"));
|
curve_close->set_tooltip(TTR("Close Curve"));
|
||||||
curve_close->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected), varray(ACTION_CLOSE));
|
curve_close->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected), varray(ACTION_CLOSE));
|
||||||
|
|||||||
@@ -539,12 +539,29 @@ void Path3DEditorPlugin::_handle_option_pressed(int p_option) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Path3DEditorPlugin::_update_theme() {
|
||||||
|
// TODO: Split the EditorPlugin instance from the UI instance and connect this properly.
|
||||||
|
// See the 2D path editor for inspiration.
|
||||||
|
curve_edit->set_icon(Node3DEditor::get_singleton()->get_theme_icon(SNAME("CurveEdit"), SNAME("EditorIcons")));
|
||||||
|
curve_create->set_icon(Node3DEditor::get_singleton()->get_theme_icon(SNAME("CurveCreate"), SNAME("EditorIcons")));
|
||||||
|
curve_del->set_icon(Node3DEditor::get_singleton()->get_theme_icon(SNAME("CurveDelete"), SNAME("EditorIcons")));
|
||||||
|
curve_close->set_icon(Node3DEditor::get_singleton()->get_theme_icon(SNAME("CurveClose"), SNAME("EditorIcons")));
|
||||||
|
}
|
||||||
|
|
||||||
void Path3DEditorPlugin::_notification(int p_what) {
|
void Path3DEditorPlugin::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
switch (p_what) {
|
||||||
curve_create->connect("pressed", callable_mp(this, &Path3DEditorPlugin::_mode_changed), make_binds(0));
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
curve_edit->connect("pressed", callable_mp(this, &Path3DEditorPlugin::_mode_changed), make_binds(1));
|
curve_create->connect("pressed", callable_mp(this, &Path3DEditorPlugin::_mode_changed), make_binds(0));
|
||||||
curve_del->connect("pressed", callable_mp(this, &Path3DEditorPlugin::_mode_changed), make_binds(2));
|
curve_edit->connect("pressed", callable_mp(this, &Path3DEditorPlugin::_mode_changed), make_binds(1));
|
||||||
curve_close->connect("pressed", callable_mp(this, &Path3DEditorPlugin::_close_curve));
|
curve_del->connect("pressed", callable_mp(this, &Path3DEditorPlugin::_mode_changed), make_binds(2));
|
||||||
|
curve_close->connect("pressed", callable_mp(this, &Path3DEditorPlugin::_close_curve));
|
||||||
|
|
||||||
|
_update_theme();
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case NOTIFICATION_READY: {
|
||||||
|
Node3DEditor::get_singleton()->connect("theme_changed", callable_mp(this, &Path3DEditorPlugin::_update_theme));
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -567,33 +584,33 @@ Path3DEditorPlugin::Path3DEditorPlugin(EditorNode *p_node) {
|
|||||||
sep = memnew(VSeparator);
|
sep = memnew(VSeparator);
|
||||||
sep->hide();
|
sep->hide();
|
||||||
Node3DEditor::get_singleton()->add_control_to_menu_panel(sep);
|
Node3DEditor::get_singleton()->add_control_to_menu_panel(sep);
|
||||||
|
|
||||||
curve_edit = memnew(Button);
|
curve_edit = memnew(Button);
|
||||||
curve_edit->set_flat(true);
|
curve_edit->set_flat(true);
|
||||||
curve_edit->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("CurveEdit"), SNAME("EditorIcons")));
|
|
||||||
curve_edit->set_toggle_mode(true);
|
curve_edit->set_toggle_mode(true);
|
||||||
curve_edit->hide();
|
curve_edit->hide();
|
||||||
curve_edit->set_focus_mode(Control::FOCUS_NONE);
|
curve_edit->set_focus_mode(Control::FOCUS_NONE);
|
||||||
curve_edit->set_tooltip(TTR("Select Points") + "\n" + TTR("Shift+Drag: Select Control Points") + "\n" + keycode_get_string((Key)KeyModifierMask::CMD) + TTR("Click: Add Point") + "\n" + TTR("Right Click: Delete Point"));
|
curve_edit->set_tooltip(TTR("Select Points") + "\n" + TTR("Shift+Drag: Select Control Points") + "\n" + keycode_get_string((Key)KeyModifierMask::CMD) + TTR("Click: Add Point") + "\n" + TTR("Right Click: Delete Point"));
|
||||||
Node3DEditor::get_singleton()->add_control_to_menu_panel(curve_edit);
|
Node3DEditor::get_singleton()->add_control_to_menu_panel(curve_edit);
|
||||||
|
|
||||||
curve_create = memnew(Button);
|
curve_create = memnew(Button);
|
||||||
curve_create->set_flat(true);
|
curve_create->set_flat(true);
|
||||||
curve_create->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("CurveCreate"), SNAME("EditorIcons")));
|
|
||||||
curve_create->set_toggle_mode(true);
|
curve_create->set_toggle_mode(true);
|
||||||
curve_create->hide();
|
curve_create->hide();
|
||||||
curve_create->set_focus_mode(Control::FOCUS_NONE);
|
curve_create->set_focus_mode(Control::FOCUS_NONE);
|
||||||
curve_create->set_tooltip(TTR("Add Point (in empty space)") + "\n" + TTR("Split Segment (in curve)"));
|
curve_create->set_tooltip(TTR("Add Point (in empty space)") + "\n" + TTR("Split Segment (in curve)"));
|
||||||
Node3DEditor::get_singleton()->add_control_to_menu_panel(curve_create);
|
Node3DEditor::get_singleton()->add_control_to_menu_panel(curve_create);
|
||||||
|
|
||||||
curve_del = memnew(Button);
|
curve_del = memnew(Button);
|
||||||
curve_del->set_flat(true);
|
curve_del->set_flat(true);
|
||||||
curve_del->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("CurveDelete"), SNAME("EditorIcons")));
|
|
||||||
curve_del->set_toggle_mode(true);
|
curve_del->set_toggle_mode(true);
|
||||||
curve_del->hide();
|
curve_del->hide();
|
||||||
curve_del->set_focus_mode(Control::FOCUS_NONE);
|
curve_del->set_focus_mode(Control::FOCUS_NONE);
|
||||||
curve_del->set_tooltip(TTR("Delete Point"));
|
curve_del->set_tooltip(TTR("Delete Point"));
|
||||||
Node3DEditor::get_singleton()->add_control_to_menu_panel(curve_del);
|
Node3DEditor::get_singleton()->add_control_to_menu_panel(curve_del);
|
||||||
|
|
||||||
curve_close = memnew(Button);
|
curve_close = memnew(Button);
|
||||||
curve_close->set_flat(true);
|
curve_close->set_flat(true);
|
||||||
curve_close->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("CurveClose"), SNAME("EditorIcons")));
|
|
||||||
curve_close->hide();
|
curve_close->hide();
|
||||||
curve_close->set_focus_mode(Control::FOCUS_NONE);
|
curve_close->set_focus_mode(Control::FOCUS_NONE);
|
||||||
curve_close->set_tooltip(TTR("Close Curve"));
|
curve_close->set_tooltip(TTR("Close Curve"));
|
||||||
|
|||||||
@@ -80,6 +80,8 @@ class Path3DEditorPlugin : public EditorPlugin {
|
|||||||
|
|
||||||
Path3D *path;
|
Path3D *path;
|
||||||
|
|
||||||
|
void _update_theme();
|
||||||
|
|
||||||
void _mode_changed(int p_idx);
|
void _mode_changed(int p_idx);
|
||||||
void _close_curve();
|
void _close_curve();
|
||||||
void _handle_option_pressed(int p_option);
|
void _handle_option_pressed(int p_option);
|
||||||
|
|||||||
@@ -713,20 +713,21 @@ void GenericTilePolygonEditor::set_multiple_polygon_mode(bool p_multiple_polygon
|
|||||||
|
|
||||||
void GenericTilePolygonEditor::_notification(int p_what) {
|
void GenericTilePolygonEditor::_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_READY:
|
case NOTIFICATION_ENTER_TREE:
|
||||||
button_create->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("CurveCreate"), SNAME("EditorIcons")));
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
button_edit->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("CurveEdit"), SNAME("EditorIcons")));
|
button_create->set_icon(get_theme_icon(SNAME("CurveCreate"), SNAME("EditorIcons")));
|
||||||
button_delete->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("CurveDelete"), SNAME("EditorIcons")));
|
button_edit->set_icon(get_theme_icon(SNAME("CurveEdit"), SNAME("EditorIcons")));
|
||||||
button_center_view->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("CenterView"), SNAME("EditorIcons")));
|
button_delete->set_icon(get_theme_icon(SNAME("CurveDelete"), SNAME("EditorIcons")));
|
||||||
button_pixel_snap->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("Snap"), SNAME("EditorIcons")));
|
button_center_view->set_icon(get_theme_icon(SNAME("CenterView"), SNAME("EditorIcons")));
|
||||||
button_advanced_menu->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons")));
|
button_pixel_snap->set_icon(get_theme_icon(SNAME("Snap"), SNAME("EditorIcons")));
|
||||||
|
button_advanced_menu->set_icon(get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons")));
|
||||||
|
|
||||||
PopupMenu *p = button_advanced_menu->get_popup();
|
PopupMenu *p = button_advanced_menu->get_popup();
|
||||||
p->set_item_icon(p->get_item_index(ROTATE_RIGHT), get_theme_icon(SNAME("RotateRight"), SNAME("EditorIcons")));
|
p->set_item_icon(p->get_item_index(ROTATE_RIGHT), get_theme_icon(SNAME("RotateRight"), SNAME("EditorIcons")));
|
||||||
p->set_item_icon(p->get_item_index(ROTATE_LEFT), get_theme_icon(SNAME("RotateLeft"), SNAME("EditorIcons")));
|
p->set_item_icon(p->get_item_index(ROTATE_LEFT), get_theme_icon(SNAME("RotateLeft"), SNAME("EditorIcons")));
|
||||||
p->set_item_icon(p->get_item_index(FLIP_HORIZONTALLY), get_theme_icon(SNAME("MirrorX"), SNAME("EditorIcons")));
|
p->set_item_icon(p->get_item_index(FLIP_HORIZONTALLY), get_theme_icon(SNAME("MirrorX"), SNAME("EditorIcons")));
|
||||||
p->set_item_icon(p->get_item_index(FLIP_VERTICALLY), get_theme_icon(SNAME("MirrorY"), SNAME("EditorIcons")));
|
p->set_item_icon(p->get_item_index(FLIP_VERTICALLY), get_theme_icon(SNAME("MirrorY"), SNAME("EditorIcons")));
|
||||||
break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user