You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
Merge pull request #11720 from ISylvox/EnhanceExperience-onUsing-DragNDropAssetTo2DViewport
Rename Patch9Rect into NinePatchRect on "Drag & Drop Asset to 2D Viewport" Feature
This commit is contained in:
@@ -4181,7 +4181,7 @@ void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String &
|
|||||||
editor_data->get_undo_redo().add_do_property(child, property, texture);
|
editor_data->get_undo_redo().add_do_property(child, property, texture);
|
||||||
|
|
||||||
// make visible for certain node type
|
// make visible for certain node type
|
||||||
if (default_type == "Patch9Rect") {
|
if (default_type == "NinePatchRect") {
|
||||||
editor_data->get_undo_redo().add_do_property(child, "rect/size", texture_size);
|
editor_data->get_undo_redo().add_do_property(child, "rect/size", texture_size);
|
||||||
} else if (default_type == "Polygon2D") {
|
} else if (default_type == "Polygon2D") {
|
||||||
PoolVector<Vector2> list;
|
PoolVector<Vector2> list;
|
||||||
@@ -4199,7 +4199,7 @@ void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String &
|
|||||||
}
|
}
|
||||||
Transform2D trans = canvas->get_canvas_transform();
|
Transform2D trans = canvas->get_canvas_transform();
|
||||||
Point2 target_position = (p_point - trans.get_origin()) / trans.get_scale().x - pos;
|
Point2 target_position = (p_point - trans.get_origin()) / trans.get_scale().x - pos;
|
||||||
if (default_type == "Polygon2D" || default_type == "TouchScreenButton" || default_type == "TextureRect" || default_type == "Patch9Rect") {
|
if (default_type == "Polygon2D" || default_type == "TouchScreenButton" || default_type == "TextureRect" || default_type == "NinePatchRect") {
|
||||||
target_position -= texture_size / 2;
|
target_position -= texture_size / 2;
|
||||||
}
|
}
|
||||||
// there's nothing to be used as source position so snapping will work as absolute if enabled
|
// there's nothing to be used as source position so snapping will work as absolute if enabled
|
||||||
@@ -4275,7 +4275,7 @@ void CanvasItemEditorViewport::_perform_drop_data() {
|
|||||||
child = memnew(TouchScreenButton);
|
child = memnew(TouchScreenButton);
|
||||||
else if (default_type == "TextureRect")
|
else if (default_type == "TextureRect")
|
||||||
child = memnew(TextureRect);
|
child = memnew(TextureRect);
|
||||||
else if (default_type == "Patch9Rect")
|
else if (default_type == "NinePatchRect")
|
||||||
child = memnew(NinePatchRect);
|
child = memnew(NinePatchRect);
|
||||||
else
|
else
|
||||||
child = memnew(Sprite); // default
|
child = memnew(Sprite); // default
|
||||||
@@ -4437,7 +4437,7 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte
|
|||||||
types.push_back("TouchScreenButton");
|
types.push_back("TouchScreenButton");
|
||||||
// Control
|
// Control
|
||||||
types.push_back("TextureRect");
|
types.push_back("TextureRect");
|
||||||
types.push_back("Patch9Rect");
|
types.push_back("NinePatchRect");
|
||||||
|
|
||||||
target_node = NULL;
|
target_node = NULL;
|
||||||
editor = p_node;
|
editor = p_node;
|
||||||
|
|||||||
@@ -907,7 +907,7 @@ void TextureRegionEditorPlugin::edit(Object *p_object) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool TextureRegionEditorPlugin::handles(Object *p_object) const {
|
bool TextureRegionEditorPlugin::handles(Object *p_object) const {
|
||||||
return p_object->is_class("Sprite") || p_object->is_class("Patch9Rect") || p_object->is_class("StyleBoxTexture") || p_object->is_class("AtlasTexture");
|
return p_object->is_class("Sprite") || p_object->is_class("NinePatchRect") || p_object->is_class("StyleBoxTexture") || p_object->is_class("AtlasTexture");
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextureRegionEditorPlugin::make_visible(bool p_visible) {
|
void TextureRegionEditorPlugin::make_visible(bool p_visible) {
|
||||||
|
|||||||
Reference in New Issue
Block a user