Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_attribute_color_ramp.cc
| Show All 31 Lines | |||||
| namespace blender::nodes { | namespace blender::nodes { | ||||
| static void execute_on_component(const GeoNodeExecParams ¶ms, GeometryComponent &component) | static void execute_on_component(const GeoNodeExecParams ¶ms, GeometryComponent &component) | ||||
| { | { | ||||
| const bNode &bnode = params.node(); | const bNode &bnode = params.node(); | ||||
| NodeAttributeColorRamp *node_storage = (NodeAttributeColorRamp *)bnode.storage; | NodeAttributeColorRamp *node_storage = (NodeAttributeColorRamp *)bnode.storage; | ||||
| /* Use the type of the input attribute, but create a color attribute if it doesn't exist yet. */ | |||||
| const CustomDataType result_type = params.get_input_attribute_data_type( | |||||
| "Attribute", component, CD_PROP_COLOR); | |||||
| const std::string result_name = params.get_input<std::string>("Result"); | const std::string result_name = params.get_input<std::string>("Result"); | ||||
| /* Once we support more domains at the user level, we have to decide how the result domain is | /* Once we support more domains at the user level, we have to decide how the result domain is | ||||
| * chosen. */ | * chosen. */ | ||||
| const AttributeDomain result_domain = ATTR_DOMAIN_POINT; | const AttributeDomain result_domain = ATTR_DOMAIN_POINT; | ||||
| const CustomDataType result_type = CD_PROP_COLOR; | |||||
| WriteAttributePtr attribute_result = component.attribute_try_ensure_for_write( | WriteAttributePtr attribute_result = component.attribute_try_ensure_for_write( | ||||
| result_name, result_domain, result_type); | result_name, result_domain, result_type); | ||||
| if (!attribute_result) { | if (!attribute_result) { | ||||
| return; | return; | ||||
| } | } | ||||
| Color4fWriteAttribute attribute_out = std::move(attribute_result); | Color4fWriteAttribute attribute_out = std::move(attribute_result); | ||||
| ▲ Show 20 Lines • Show All 54 Lines • Show Last 20 Lines | |||||