改造一些
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user