This commit is contained in:
1 parent
d77cc6a40e
commit
cc6acb188d
11 files changed
+548
-165
No files matched your search
@@ -16,8 +16,8 @@ use shared::{
|
||||
};
|
||||
|
||||
use crate::assets::{
|
||||
spawn_asset_at, spawn_subasset_at, AssetSelection, AssetSubAssetKind, EditorAsset,
|
||||
EditorAssetKind, EditorAssets, ASSETS_ROOT, BUILTINS_FOLDER,
|
||||
AssetSelection, AssetSubAssetKind, EditorAsset, EditorAssetKind, EditorAssets, ASSETS_ROOT,
|
||||
BUILTINS_FOLDER,
|
||||
};
|
||||
use crate::scene_io::{SceneIo, SceneIoRequest};
|
||||
|
||||
@@ -29,6 +29,9 @@ use crate::asset_db::{
|
||||
find_asset_by_path, find_asset_mut_by_path, save_registry, update_import_settings,
|
||||
ImportSettings, MaterialImportPolicy, ModelHierarchyMode, ModelPlacementMode,
|
||||
};
|
||||
use crate::assets::operators::{
|
||||
apply_material_operator, apply_texture_operator, place_asset_operator, place_subasset_operator,
|
||||
};
|
||||
use crate::assets::static_mesh::{
|
||||
load_static_mesh_manifest, material_id_from_label, part_id_from_label,
|
||||
refresh_static_mesh_artifact,
|
||||
@@ -37,9 +40,7 @@ use crate::assets::{
|
||||
asset_cache_key, draw_asset_cell_with, invalidate_on_catalog_refresh, kind_icon,
|
||||
prefetch_folder_thumbnails, AssetThumbnailCache, ThumbnailCacheSnapshot, ThumbnailStudio,
|
||||
};
|
||||
use crate::ui::helpers::{
|
||||
apply_material_asset_to_selection, apply_texture_to_selection, asset_label,
|
||||
};
|
||||
use crate::ui::helpers::asset_label;
|
||||
use crate::ui::theme::{panel_heading, ACCENT, BORDER, ELEVATED_BG, TEXT, TEXT_DIM, WIDGET_BG};
|
||||
use crate::ui::widgets::{icon_button_small, tool_button};
|
||||
|
||||
@@ -724,14 +725,14 @@ fn selection_footer(world: &mut World, ui: &mut egui::Ui, selected_entities: &Se
|
||||
AssetSubAssetKind::Mesh => {
|
||||
if ui.button("Place At Origin").clicked() {
|
||||
if let Some(selection) = selection.as_ref() {
|
||||
spawn_subasset_at(world, selection, Vec3::ZERO);
|
||||
place_subasset_operator(world, selection.clone(), Vec3::ZERO);
|
||||
}
|
||||
}
|
||||
}
|
||||
AssetSubAssetKind::Texture => {
|
||||
if ui.button("Apply Texture To Selection").clicked() {
|
||||
if let Some(asset) = texture_asset_from_subasset_selection(world, &selection) {
|
||||
apply_texture_to_selection(world, &asset, selected_entities);
|
||||
apply_texture_operator(world, asset, selected_entities);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -745,7 +746,7 @@ fn selection_footer(world: &mut World, ui: &mut egui::Ui, selected_entities: &Se
|
||||
if matches!(asset.kind, EditorAssetKind::Texture)
|
||||
&& ui.button("Apply Texture To Selection").clicked()
|
||||
{
|
||||
apply_texture_to_selection(world, &asset, selected_entities);
|
||||
apply_texture_operator(world, asset.clone(), selected_entities);
|
||||
}
|
||||
if matches!(
|
||||
asset.kind,
|
||||
@@ -756,7 +757,7 @@ fn selection_footer(world: &mut World, ui: &mut egui::Ui, selected_entities: &Se
|
||||
| EditorAssetKind::Level
|
||||
) && ui.button("Place At Origin").clicked()
|
||||
{
|
||||
spawn_asset_at(world, &asset, Vec3::ZERO);
|
||||
place_asset_operator(world, asset.clone(), Vec3::ZERO);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -1796,7 +1797,7 @@ fn subasset_details_panel(
|
||||
match embedded.kind {
|
||||
AssetSubAssetKind::Mesh => {
|
||||
if ui.button("Place At Origin").clicked() {
|
||||
spawn_subasset_at(world, selection, Vec3::ZERO);
|
||||
place_subasset_operator(world, selection.clone(), Vec3::ZERO);
|
||||
}
|
||||
}
|
||||
AssetSubAssetKind::Texture => {
|
||||
@@ -1804,7 +1805,7 @@ fn subasset_details_panel(
|
||||
if let Some(asset) =
|
||||
texture_asset_from_subasset_selection(world, &Some(selection.clone()))
|
||||
{
|
||||
apply_texture_to_selection(world, &asset, selected_entities);
|
||||
apply_texture_operator(world, asset, selected_entities);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1832,11 +1833,11 @@ fn asset_action_buttons(
|
||||
) {
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
if matches!(asset.kind, EditorAssetKind::Texture) && ui.button("Apply Texture").clicked() {
|
||||
apply_texture_to_selection(world, asset, selected_entities);
|
||||
apply_texture_operator(world, asset.clone(), selected_entities);
|
||||
}
|
||||
if matches!(asset.kind, EditorAssetKind::Material) && ui.button("Apply Material").clicked()
|
||||
{
|
||||
apply_material_asset_to_selection(world, asset, selected_entities);
|
||||
apply_material_operator(world, asset.clone(), selected_entities);
|
||||
}
|
||||
if matches!(
|
||||
asset.kind,
|
||||
@@ -1847,7 +1848,7 @@ fn asset_action_buttons(
|
||||
| EditorAssetKind::Level
|
||||
) && ui.button("Place At Origin").clicked()
|
||||
{
|
||||
spawn_asset_at(world, asset, Vec3::ZERO);
|
||||
place_asset_operator(world, asset.clone(), Vec3::ZERO);
|
||||
}
|
||||
if matches!(asset.kind, EditorAssetKind::Model)
|
||||
&& has_embedded_assets(world, asset)
|
||||
@@ -2808,7 +2809,7 @@ fn asset_context_menu(
|
||||
| EditorAssetKind::Level
|
||||
) && ui.button("Place at Origin").clicked()
|
||||
{
|
||||
spawn_asset_at(world, asset, Vec3::ZERO);
|
||||
place_asset_operator(world, asset.clone(), Vec3::ZERO);
|
||||
ui.close();
|
||||
}
|
||||
if matches!(asset.kind, EditorAssetKind::Model) && has_embedded_assets(world, asset) {
|
||||
@@ -2835,13 +2836,13 @@ fn asset_context_menu(
|
||||
if matches!(asset.kind, EditorAssetKind::Texture)
|
||||
&& ui.button("Apply as Base Color Texture").clicked()
|
||||
{
|
||||
apply_texture_to_selection(world, asset, selected_entities);
|
||||
apply_texture_operator(world, asset.clone(), selected_entities);
|
||||
ui.close();
|
||||
}
|
||||
if matches!(asset.kind, EditorAssetKind::Material)
|
||||
&& ui.button("Apply Material To Selection").clicked()
|
||||
{
|
||||
apply_material_asset_to_selection(world, asset, selected_entities);
|
||||
apply_material_operator(world, asset.clone(), selected_entities);
|
||||
ui.close();
|
||||
}
|
||||
if matches!(asset.kind, EditorAssetKind::Model) && ui.button("Reimport").clicked() {
|
||||
@@ -2880,7 +2881,7 @@ fn subasset_context_menu(
|
||||
match embedded.kind {
|
||||
AssetSubAssetKind::Mesh => {
|
||||
if ui.button("Place at Origin").clicked() {
|
||||
spawn_subasset_at(world, &embedded.selection, Vec3::ZERO);
|
||||
place_subasset_operator(world, embedded.selection.clone(), Vec3::ZERO);
|
||||
ui.close();
|
||||
}
|
||||
}
|
||||
@@ -2889,7 +2890,7 @@ fn subasset_context_menu(
|
||||
if let Some(asset) =
|
||||
texture_asset_from_subasset_selection(world, &Some(embedded.selection.clone()))
|
||||
{
|
||||
apply_texture_to_selection(world, &asset, selected_entities);
|
||||
apply_texture_operator(world, asset, selected_entities);
|
||||
}
|
||||
ui.close();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user