Completed the support for plugins! It is not possible to add plugins.
Not all APIs are provided yet, please request whathever you are missing. Some example plugins are provided in demos/plugins. Just copy them to a folder in your project named addons/ and then enable them from the project settings. Have fun!
This commit is contained in:
@@ -48,6 +48,19 @@ void EditorPlugin::add_control_to_bottom_dock(Control *p_control, const String &
|
||||
EditorNode::get_singleton()->add_bottom_panel_item(p_title,p_control);
|
||||
}
|
||||
|
||||
void EditorPlugin::add_control_to_dock(DockSlot p_slot,Control *p_control) {
|
||||
|
||||
ERR_FAIL_NULL(p_control);
|
||||
EditorNode::get_singleton()->add_control_to_dock(EditorNode::DockSlot(p_slot),p_control);
|
||||
|
||||
}
|
||||
|
||||
void EditorPlugin::remove_control_from_docks(Control *p_control) {
|
||||
|
||||
ERR_FAIL_NULL(p_control);
|
||||
EditorNode::get_singleton()->remove_control_from_dock(p_control);
|
||||
|
||||
}
|
||||
|
||||
void EditorPlugin::add_control_to_container(CustomControlContainer p_location,Control *p_control) {
|
||||
|
||||
@@ -94,9 +107,13 @@ void EditorPlugin::add_control_to_container(CustomControlContainer p_location,Co
|
||||
}
|
||||
}
|
||||
|
||||
bool EditorPlugin::create_spatial_gizmo(Spatial* p_spatial) {
|
||||
Ref<SpatialEditorGizmo> EditorPlugin::create_spatial_gizmo(Spatial* p_spatial) {
|
||||
//??
|
||||
return false;
|
||||
if (get_script_instance() && get_script_instance()->has_method("create_spatial_gizmo")) {
|
||||
return get_script_instance()->call("create_spatial_gizmo",p_spatial);
|
||||
}
|
||||
|
||||
return Ref<SpatialEditorGizmo>();
|
||||
}
|
||||
|
||||
bool EditorPlugin::forward_input_event(const InputEvent& p_event) {
|
||||
@@ -218,27 +235,65 @@ EditorSelection* EditorPlugin::get_selection() {
|
||||
return EditorNode::get_singleton()->get_editor_selection();
|
||||
}
|
||||
|
||||
EditorImportExport *EditorPlugin::get_import_export() {
|
||||
return EditorImportExport::get_singleton();
|
||||
}
|
||||
|
||||
EditorSettings *EditorPlugin::get_editor_settings() {
|
||||
return EditorSettings::get_singleton();
|
||||
}
|
||||
|
||||
void EditorPlugin::add_import_plugin(const Ref<EditorImportPlugin>& p_editor_import) {
|
||||
|
||||
EditorNode::get_singleton()->add_editor_import_plugin(p_editor_import);
|
||||
}
|
||||
|
||||
void EditorPlugin::remove_import_plugin(const Ref<EditorImportPlugin>& p_editor_import){
|
||||
|
||||
EditorNode::get_singleton()->remove_editor_import_plugin(p_editor_import);
|
||||
|
||||
}
|
||||
|
||||
void EditorPlugin::add_export_plugin(const Ref<EditorExportPlugin>& p_editor_export){
|
||||
|
||||
EditorImportExport::get_singleton()->add_export_plugin(p_editor_export);
|
||||
}
|
||||
void EditorPlugin::remove_export_plugin(const Ref<EditorExportPlugin>& p_editor_export){
|
||||
|
||||
EditorImportExport::get_singleton()->remove_export_plugin(p_editor_export);
|
||||
|
||||
}
|
||||
|
||||
Control *EditorPlugin::get_base_control() {
|
||||
|
||||
return EditorNode::get_singleton()->get_gui_base();
|
||||
}
|
||||
|
||||
|
||||
void EditorPlugin::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("add_control_to_container","container","control:Control"),&EditorPlugin::add_control_to_container);
|
||||
ObjectTypeDB::bind_method(_MD("add_control_to_bottom_dock","control:Control","title"),&EditorPlugin::add_control_to_bottom_dock);
|
||||
ObjectTypeDB::bind_method(_MD("add_control_to_dock","slot","control:Control"),&EditorPlugin::add_control_to_dock);
|
||||
ObjectTypeDB::bind_method(_MD("remove_control_from_docks","control:Control"),&EditorPlugin::remove_control_from_docks);
|
||||
ObjectTypeDB::bind_method(_MD("add_custom_type","type","base","script:Script","icon:Texture"),&EditorPlugin::add_custom_type);
|
||||
ObjectTypeDB::bind_method(_MD("remove_custom_type","type"),&EditorPlugin::remove_custom_type);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("add_import_plugin","plugin:EditorImportPlugin"),&EditorPlugin::add_import_plugin);
|
||||
ObjectTypeDB::bind_method(_MD("remove_import_plugin","plugin:EditorImportPlugin"),&EditorPlugin::remove_import_plugin);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("add_export_plugin","plugin:EditorExportPlugin"),&EditorPlugin::add_export_plugin);
|
||||
ObjectTypeDB::bind_method(_MD("remove_export_plugin","plugin:EditorExportPlugin"),&EditorPlugin::remove_export_plugin);
|
||||
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("get_base_control:Control"),&EditorPlugin::get_base_control);
|
||||
ObjectTypeDB::bind_method(_MD("get_undo_redo:UndoRedo"),&EditorPlugin::_get_undo_redo);
|
||||
ObjectTypeDB::bind_method(_MD("get_selection:EditorSelection"),&EditorPlugin::get_selection);
|
||||
ObjectTypeDB::bind_method(_MD("get_import_export:EditorImportExport"),&EditorPlugin::get_import_export);
|
||||
ObjectTypeDB::bind_method(_MD("get_editor_settings:EditorSettings"),&EditorPlugin::get_import_export);
|
||||
ObjectTypeDB::bind_method(_MD("get_editor_settings:EditorSettings"),&EditorPlugin::get_editor_settings);
|
||||
|
||||
ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::BOOL,"forward_input_event",PropertyInfo(Variant::INPUT_EVENT,"event")));
|
||||
ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::BOOL,"forward_spatial_input_event",PropertyInfo(Variant::OBJECT,"camera",PROPERTY_HINT_RESOURCE_TYPE,"Camera"),PropertyInfo(Variant::INPUT_EVENT,"event")));
|
||||
MethodInfo gizmo = MethodInfo(Variant::OBJECT,"create_spatial_gizmo",PropertyInfo(Variant::OBJECT,"for_spatial:Spatial"));
|
||||
gizmo.return_val.hint=PROPERTY_HINT_RESOURCE_TYPE;
|
||||
gizmo.return_val.hint_string="EditorSpatialGizmo";
|
||||
ObjectTypeDB::add_virtual_method(get_type_static(),gizmo);
|
||||
ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::STRING,"get_name"));
|
||||
ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::BOOL,"has_main_screen"));
|
||||
ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo("make_visible",PropertyInfo(Variant::BOOL,"visible")));
|
||||
@@ -257,6 +312,16 @@ void EditorPlugin::_bind_methods() {
|
||||
BIND_CONSTANT( CONTAINER_CANVAS_EDITOR_MENU );
|
||||
BIND_CONSTANT( CONTAINER_CANVAS_EDITOR_SIDE );
|
||||
|
||||
BIND_CONSTANT( DOCK_SLOT_LEFT_UL );
|
||||
BIND_CONSTANT( DOCK_SLOT_LEFT_BL );
|
||||
BIND_CONSTANT( DOCK_SLOT_LEFT_UR );
|
||||
BIND_CONSTANT( DOCK_SLOT_LEFT_BR );
|
||||
BIND_CONSTANT( DOCK_SLOT_RIGHT_UL );
|
||||
BIND_CONSTANT( DOCK_SLOT_RIGHT_BL );
|
||||
BIND_CONSTANT( DOCK_SLOT_RIGHT_UR );
|
||||
BIND_CONSTANT( DOCK_SLOT_RIGHT_BR );
|
||||
BIND_CONSTANT( DOCK_SLOT_MAX );
|
||||
|
||||
}
|
||||
|
||||
EditorPlugin::EditorPlugin()
|
||||
|
||||
Reference in New Issue
Block a user