You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-13 13:31:48 +00:00
Merge pull request #65421 from V-Sekai/spriteframes_read_only
This commit is contained in:
@@ -984,11 +984,17 @@ void SpriteFramesEditor::_update_library(bool p_skip_selector) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SpriteFramesEditor::edit(SpriteFrames *p_frames) {
|
void SpriteFramesEditor::edit(SpriteFrames *p_frames) {
|
||||||
if (frames == p_frames) {
|
bool new_read_only_state = false;
|
||||||
|
if (p_frames) {
|
||||||
|
new_read_only_state = EditorNode::get_singleton()->is_resource_read_only(p_frames);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (frames == p_frames && new_read_only_state == read_only) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
frames = p_frames;
|
frames = p_frames;
|
||||||
|
read_only = new_read_only_state;
|
||||||
|
|
||||||
if (p_frames) {
|
if (p_frames) {
|
||||||
if (!p_frames->has_animation(edited_anim)) {
|
if (!p_frames->has_animation(edited_anim)) {
|
||||||
@@ -1009,6 +1015,20 @@ void SpriteFramesEditor::edit(SpriteFrames *p_frames) {
|
|||||||
} else {
|
} else {
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
new_anim->set_disabled(read_only);
|
||||||
|
remove_anim->set_disabled(read_only);
|
||||||
|
anim_speed->set_editable(!read_only);
|
||||||
|
anim_loop->set_disabled(read_only);
|
||||||
|
load->set_disabled(read_only);
|
||||||
|
load_sheet->set_disabled(read_only);
|
||||||
|
copy->set_disabled(read_only);
|
||||||
|
paste->set_disabled(read_only);
|
||||||
|
empty->set_disabled(read_only);
|
||||||
|
empty2->set_disabled(read_only);
|
||||||
|
move_up->set_disabled(read_only);
|
||||||
|
move_down->set_disabled(read_only);
|
||||||
|
_delete->set_disabled(read_only);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteFramesEditor::set_undo_redo(Ref<EditorUndoRedoManager> p_undo_redo) {
|
void SpriteFramesEditor::set_undo_redo(Ref<EditorUndoRedoManager> p_undo_redo) {
|
||||||
@@ -1016,6 +1036,10 @@ void SpriteFramesEditor::set_undo_redo(Ref<EditorUndoRedoManager> p_undo_redo) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Variant SpriteFramesEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
|
Variant SpriteFramesEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
|
||||||
|
if (read_only) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!frames->has_animation(edited_anim)) {
|
if (!frames->has_animation(edited_anim)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1038,6 +1062,10 @@ Variant SpriteFramesEditor::get_drag_data_fw(const Point2 &p_point, Control *p_f
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SpriteFramesEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const {
|
bool SpriteFramesEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const {
|
||||||
|
if (read_only) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Dictionary d = p_data;
|
Dictionary d = p_data;
|
||||||
|
|
||||||
if (!d.has("type")) {
|
if (!d.has("type")) {
|
||||||
@@ -1169,6 +1197,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
|
|||||||
remove_anim->set_flat(true);
|
remove_anim->set_flat(true);
|
||||||
remove_anim->set_tooltip_text(TTR("Remove Animation"));
|
remove_anim->set_tooltip_text(TTR("Remove Animation"));
|
||||||
hbc_animlist->add_child(remove_anim);
|
hbc_animlist->add_child(remove_anim);
|
||||||
|
remove_anim->set_disabled(true);
|
||||||
remove_anim->connect("pressed", callable_mp(this, &SpriteFramesEditor::_animation_remove));
|
remove_anim->connect("pressed", callable_mp(this, &SpriteFramesEditor::_animation_remove));
|
||||||
|
|
||||||
anim_search_box = memnew(LineEdit);
|
anim_search_box = memnew(LineEdit);
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ class SpriteFramesEditor : public HSplitContainer {
|
|||||||
};
|
};
|
||||||
int dominant_param = PARAM_FRAME_COUNT;
|
int dominant_param = PARAM_FRAME_COUNT;
|
||||||
|
|
||||||
|
bool read_only = false;
|
||||||
|
|
||||||
Button *load = nullptr;
|
Button *load = nullptr;
|
||||||
Button *load_sheet = nullptr;
|
Button *load_sheet = nullptr;
|
||||||
Button *_delete = nullptr;
|
Button *_delete = nullptr;
|
||||||
|
|||||||
Reference in New Issue
Block a user