1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include "tonemap.h" 17 18 #include <3d/ecs/components/post_process_component.h> 19 SCENE_BEGIN_NAMESPACE()20SCENE_BEGIN_NAMESPACE() 21 22 bool Tonemap::InitDynamicProperty(const META_NS::IProperty::Ptr& p, BASE_NS::string_view path) 23 { 24 BASE_NS::string cpath = "PostProcessComponent.tonemapConfiguration." + path; 25 if (p->GetName() == "Enabled") { 26 auto i = interface_cast<META_NS::IStackProperty>(p); 27 return flags_ && i && 28 i->PushValue(META_NS::IValue::Ptr( 29 new ConvertingValue<PPEffectEnabledConverter<CORE3D_NS::PostProcessComponent::TONEMAP_BIT>>( 30 flags_, { flags_ }))); 31 } 32 return AttachEngineProperty(p, cpath); 33 } 34 35 SCENE_END_NAMESPACE()