改造一些

This commit is contained in:
2026-08-11 23:17:03 +08:00
parent c89a678245
commit aca480d988
29 changed files with 1348 additions and 771 deletions
+16
View File
@@ -5,6 +5,8 @@
#include <renderive/base/property/Validators.hpp>
#include <functional>
#include <memory>
#include <tuple>
#include <type_traits>
#include <utility>
namespace renderive {
template <Property_Product Product_Type, Property_Set Properties_Type, Property_Validator<Properties_Type> Validator_Type = No_Property_Validator<Properties_Type>>
@@ -36,6 +38,20 @@ public:
if(!parent || !(valid_argument(args) && ...))
return {};
validator(properties);
if constexpr (requires(Product& product) { attach_renderable_dependencies(product, args...); } &&
(std::copy_constructible<std::decay_t<Args>> && ...)) {
auto dependency_args = std::make_tuple(args...);
auto result = parent->plot().make_renderable<Product>(parent, properties, std::forward<Args>(args)...);
try {
std::apply([&result](const auto&... values) {
attach_renderable_dependencies(*result, values...);
}, dependency_args);
} catch (...) {
result->scene().detach_renderable(*result);
throw;
}
return result;
}
return parent->plot().make_renderable<Product>(parent, properties, std::forward<Args>(args)...);
}
private: