Skip to content

Add material editing support in editor#27

Merged
amasiye merged 1 commit into
mainfrom
develop
Apr 26, 2026
Merged

Add material editing support in editor#27
amasiye merged 1 commit into
mainfrom
develop

Conversation

@amasiye

@amasiye amasiye commented Apr 26, 2026

Copy link
Copy Markdown
Contributor

This pull request adds first-class support for physics material assets throughout the project, including CLI generation, editor integration, and unit tests. The main changes include the introduction of a GenerateMaterial command, a material file generation strategy, material asset handling in the editor, and comprehensive test coverage for the new features.

Material Asset Support

  • Added a new GenerateMaterial command for CLI-based creation of physics material assets (src/Commands/GenerateMaterial.php)
  • Implemented MaterialFileGenerationStrategy to standardize material asset file creation (src/Strategies/AssetFileGeneration/MaterialFileGenerationStrategy.php)
  • Created MaterialWriter for serializing and saving material asset data (src/Editor/MaterialWriter.php)
  • Added MaterialReferenceInputControl for referencing materials in the editor UI (src/Editor/Widgets/Controls/MaterialReferenceInputControl.php)

Editor and Asset Panel Integration

  • Updated the assets panel and modal dialogs to support material asset creation and selection (src/Editor/Widgets/AssetsPanel.php) [1] [2]
  • Ensured the NewGame command creates a Materials directory within assets (src/Commands/NewGame.php, [1] [2]

Testing and Validation

  • Added and updated unit tests to verify material asset creation, editor integration, file serialization, and editing/saving of material assets (tests/Unit/CliAssetsDirectoryTest.php, [1] [2] [3]; tests/Unit/AssetsPanelTest.php, [4]; tests/Unit/EditorAssetSelectionTest.php, [5] [6] [7]

Dependency Updates

  • Updated composer.json to allow Symfony Console 8.x for broader compatibility

These changes collectively enable robust creation, management, and editing of physics material assets in both CLI and editor workflows.

@amasiye amasiye merged commit 8174f7e into main Apr 26, 2026
0 of 2 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3404ee09ba

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +12 to +16
#[AsCommand(
name: 'generate:material',
description: 'Generate a new physics material',
)]
class GenerateMaterial extends Command

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Register material generator in CLI bootstrap

Expose this command through the main CLI application; GenerateMaterial is added here, but bin/sendama still only registers the older command set in Application::addCommands(...), so sendama generate:material will not be discoverable and users will get an unknown-command error despite the new command class existing.

Useful? React with 👍 / 👎.

Comment thread src/Editor/Editor.php
Comment on lines +3906 to +3910
$assetPath = is_string($asset['relativePath'] ?? null)
? $asset['relativePath']
: (is_string($asset['path'] ?? null) ? $asset['path'] : null);

return is_string($assetPath) && str_ends_with(strtolower($assetPath), '.material.php');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve .material.php suffix when renaming material assets

Update the rename normalization path to treat .material.php as a compound suffix. Material assets are now first-class (isMaterialAsset checks for .material.php), but resolveAssetFileNameSuffix() still preserves only .prefab.php and .scene.php, so renaming a material from the generic asset inspector can silently produce *.php and make it stop being recognized as a material asset by the editor/pickers.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant