当前位置: 首页>>代码示例>>C++>>正文


C++ TSharedPtr::AddExtender方法代码示例

本文整理汇总了C++中TSharedPtr::AddExtender方法的典型用法代码示例。如果您正苦于以下问题:C++ TSharedPtr::AddExtender方法的具体用法?C++ TSharedPtr::AddExtender怎么用?C++ TSharedPtr::AddExtender使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TSharedPtr的用法示例。


在下文中一共展示了TSharedPtr::AddExtender方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: StartupModule

void FSkookumScriptEditor::StartupModule()
  {
  // Get pointer to runtime module
  m_runtime_p = FModuleManager::Get().GetModule("SkookumScriptRuntime");

  // Tell runtime that editor is present (needed even in commandlet mode as we might have to demand-load blueprints)
  get_runtime()->set_editor_interface(this);

  // Clear contents of scripts folder for a fresh start
  // Won't work here if project has several maps using different blueprints
  //FString directory_to_delete(m_scripts_path / TEXT("Object"));
  //IFileManager::Get().DeleteDirectory(*directory_to_delete, false, true);

  // Reset super classes
  m_used_classes.Empty();

  // Label used to extract package path from Sk class meta file
  m_package_name_key = TEXT("// UE4 Package Name: \"");
  m_package_path_key = TEXT("// UE4 Package Path: \"");

  // String to insert into/remove from Sk project ini file
  m_editable_ini_settings_p = TEXT("Editable=false\r\nCanMakeEditable=true\r\n");

  if (IsRunningCommandlet())
    {
    // Tell runtime to start skookum now
    get_runtime()->startup_skookum();
    }
  else
    {
    // Hook up delegates
    m_on_asset_loaded_handle = FCoreUObjectDelegates::OnAssetLoaded.AddRaw(this, &FSkookumScriptEditor::on_asset_loaded);
    m_on_object_modified_handle = FCoreUObjectDelegates::OnObjectModified.AddRaw(this, &FSkookumScriptEditor::on_object_modified);
    m_on_map_opened_handle = FEditorDelegates::OnMapOpened.AddRaw(this, &FSkookumScriptEditor::on_map_opened);
    m_on_new_asset_created_handle = FEditorDelegates::OnNewAssetCreated.AddRaw(this, &FSkookumScriptEditor::on_new_asset_created);
    m_on_assets_deleted_handle = FEditorDelegates::OnAssetsDeleted.AddRaw(this, &FSkookumScriptEditor::on_assets_deleted);
    m_on_asset_post_import_handle = FEditorDelegates::OnAssetPostImport.AddRaw(this, &FSkookumScriptEditor::on_asset_post_import);

    FAssetRegistryModule & asset_registry = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(AssetRegistryConstants::ModuleName);
    m_on_asset_added_handle = asset_registry.Get().OnAssetAdded().AddRaw(this, &FSkookumScriptEditor::on_asset_added);
    m_on_asset_renamed_handle = asset_registry.Get().OnAssetRenamed().AddRaw(this, &FSkookumScriptEditor::on_asset_renamed);
    m_on_in_memory_asset_created_handle = asset_registry.Get().OnInMemoryAssetCreated().AddRaw(this, &FSkookumScriptEditor::on_in_memory_asset_created);
    m_on_in_memory_asset_deleted_handle = asset_registry.Get().OnInMemoryAssetDeleted().AddRaw(this, &FSkookumScriptEditor::on_in_memory_asset_deleted);

    //---------------------------------------------------------------------------------------
    // UI extension

    // Register commands and styles
    FSkookumScriptEditorCommands::Register();
    FSlateStyleRegistry::UnRegisterSlateStyle(FSkookumStyles::GetStyleSetName()); // Hot reload hack
    FSkookumStyles::Initialize();

    // Button commands 
    m_button_commands = MakeShareable(new FUICommandList);
    m_button_commands->MapAction(
      FSkookumScriptEditorCommands::Get().m_skookum_button,
      FExecuteAction::CreateRaw(this, &FSkookumScriptEditor::on_skookum_button_clicked),
      FCanExecuteAction());

    // Add to level tool bar
    m_level_tool_bar_extender = MakeShareable(new FExtender);
    m_level_tool_bar_extension = m_level_tool_bar_extender->AddToolBarExtension("Compile", EExtensionHook::After, m_button_commands, FToolBarExtensionDelegate::CreateRaw(this, &FSkookumScriptEditor::add_skookum_button_to_level_tool_bar));
    FLevelEditorModule & level_editor_module = FModuleManager::LoadModuleChecked<FLevelEditorModule>("LevelEditor");
    m_level_extension_manager = level_editor_module.GetToolBarExtensibilityManager();
    m_level_extension_manager->AddExtender(m_level_tool_bar_extender);

    // Add to blueprint tool bar
    m_blueprint_tool_bar_extender = MakeShareable(new FExtender);
    m_blueprint_tool_bar_extension = m_blueprint_tool_bar_extender->AddToolBarExtension("Asset", EExtensionHook::After, m_button_commands, FToolBarExtensionDelegate::CreateRaw(this, &FSkookumScriptEditor::add_skookum_button_to_blueprint_tool_bar));
    FBlueprintEditorModule & blueprint_editor_module = FModuleManager::LoadModuleChecked<FBlueprintEditorModule>("Kismet");
    m_blueprint_extension_manager = blueprint_editor_module.GetMenuExtensibilityManager();
    m_blueprint_extension_manager->AddExtender(m_blueprint_tool_bar_extender);
    }

  }
开发者ID:marynate,项目名称:SkookumScript-UnrealEngine-1,代码行数:75,代码来源:SkookumScriptEditor.cpp


注:本文中的TSharedPtr::AddExtender方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。