73 uiItemR(layout,
ptr,
"overflow", 0,
"", ICON_NONE);
74 uiItemR(layout,
ptr,
"align_x", 0,
"", ICON_NONE);
75 uiItemR(layout,
ptr,
"align_y", 0,
"", ICON_NONE);
115 return {0.0f, 0.0f, 0.0f};
118 switch (pivot_mode) {
134 return {0.0f, 0.0f, 0.0f};
164 params.error_message_add(NodeWarningType::Error,
TIP_(
"Font not specified"));
169 layout.
text =
params.extract_input<std::string>(
"String");
170 if (layout.
text.empty()) {
182 const float font_size =
std::max(
params.extract_input<
float>(
"Size"), 0.0f);
183 const float char_spacing =
params.extract_input<
float>(
"Character Spacing");
184 const float word_spacing =
params.extract_input<
float>(
"Word Spacing");
185 const float line_spacing =
params.extract_input<
float>(
"Line Spacing");
186 const float textbox_w =
params.extract_input<
float>(
"Text Box Width");
189 params.extract_input<
float>(
"Text Box Height");
191 Curve cu = dna::shallow_zero_initialize();
195 cu.smallcaps_scale = 0.75f;
198 cu.spacemode = align_x;
199 cu.align_y = align_y;
200 cu.fsize = font_size;
201 cu.spacing = char_spacing;
202 cu.wordspace = word_spacing;
203 cu.linedist = line_spacing;
205 cu.overflow = overflow;
207 cu.tb->w = textbox_w;
208 cu.tb->h = textbox_h;
212 cu.len_char32 = len_chars;
216 cu.str = (
char *)
MEM_mallocN(len_bytes +
sizeof(char32_t), __func__);
220 struct CharTrans *chartransdata =
nullptr;
223 const char32_t *r_text =
nullptr;
226 nullptr, &cu,
FO_DUPLI,
nullptr, &r_text, &text_len, &
text_free, &chartransdata);
248 if (
params.output_is_required(
"Line")) {
250 for (
const int i : layout.
positions.index_range()) {
277 bool pivot_required =
params.output_is_required(
"Pivot Point");
283 Curve cu = dna::shallow_zero_initialize();
292 if (curves_id ==
nullptr) {
293 if (pivot_required) {
305 curves.transform(size_matrix);
307 if (pivot_required) {
327 for (const int i : range) {
328 handles[i] = char_handles.lookup(layout.char_codes[i]);
329 transforms[i] = float4x4::from_location({layout.positions[i].x, layout.positions[i].y, 0});
340 if (
params.output_is_required(
"Line")) {
347 AnonymousAttributeFieldInput::Create<int>(std::move(line_id),
348 params.attribute_producer_name()));
351 if (
params.output_is_required(
"Pivot Point")) {
361 params.set_output(
"Pivot Point",
362 AnonymousAttributeFieldInput::Create<float3>(
363 std::move(pivot_id),
params.attribute_producer_name()));
371 params.set_default_remaining_outputs();
378 params.set_output(
"Remainder", std::move(layout->truncated_text));
381 if (layout->positions.size() == 0) {
383 params.set_default_remaining_outputs();
394 params.set_output(
"Curve Instances", std::move(geometry_set_out));
412 "NodeGeometryStringToCurves",
void BKE_nurbList_free(struct ListBase *lb)
Low-level operations for curves.
void node_type_size(struct bNodeType *ntype, int width, int minwidth, int maxwidth)
void node_type_update(struct bNodeType *ntype, void(*updatefunc)(struct bNodeTree *ntree, struct bNode *node))
#define NODE_STORAGE_FUNCS(StorageT)
void nodeSetSocketAvailability(struct bNodeTree *ntree, struct bNodeSocket *sock, bool is_available)
void node_type_init(struct bNodeType *ntype, void(*initfunc)(struct bNodeTree *ntree, struct bNode *node))
#define NODE_CLASS_GEOMETRY
void node_type_storage(struct bNodeType *ntype, const char *storagename, void(*freefunc)(struct bNode *node), void(*copyfunc)(struct bNodeTree *dest_ntree, struct bNode *dest_node, const struct bNode *src_node))
#define GEO_NODE_STRING_TO_CURVES
void nodeRegisterType(struct bNodeType *ntype)
struct VFont * BKE_vfont_builtin_get(void)
void BKE_vfont_build_char(struct Curve *cu, struct ListBase *nubase, unsigned int character, struct CharInfo *info, float ofsx, float ofsy, float rot, int charidx, float fsize)
bool BKE_vfont_to_curve_ex(struct Object *ob, struct Curve *cu, int mode, struct ListBase *r_nubase, const char32_t **r_text, int *r_text_len, bool *r_text_free, struct CharTrans **r_chartransdata)
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
size_t BLI_str_utf8_as_utf32(char32_t *__restrict dst_w, const char *__restrict src_c, size_t maxncpy) ATTR_NONNULL(1
int BLI_str_utf8_offset_from_index(const char *str, int index) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
size_t BLI_strlen_utf8_ex(const char *strc, size_t *r_len_bytes) ATTR_NONNULL(1
GeometryNodeStringToCurvesAlignXMode
@ GEO_NODE_STRING_TO_CURVES_ALIGN_X_LEFT
GeometryNodeStringToCurvesPivotMode
@ GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_MIDPOINT
@ GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_BOTTOM_RIGHT
@ GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_BOTTOM_CENTER
@ GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_TOP_LEFT
@ GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_TOP_CENTER
@ GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_TOP_RIGHT
@ GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_BOTTOM_LEFT
GeometryNodeStringToCurvesAlignYMode
@ GEO_NODE_STRING_TO_CURVES_ALIGN_Y_TOP_BASELINE
GeometryNodeStringToCurvesOverflowMode
@ GEO_NODE_STRING_TO_CURVES_MODE_TRUNCATE
@ GEO_NODE_STRING_TO_CURVES_MODE_SCALE_TO_FIT
@ GEO_NODE_STRING_TO_CURVES_MODE_OVERFLOW
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to curves
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
void uiLayoutSetPropDecorate(uiLayout *layout, bool is_sep)
void uiTemplateID(uiLayout *layout, const struct bContext *C, struct PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, int filter, bool live_icon, const char *text)
@ UI_TEMPLATE_ID_FILTER_ALL
blender::Span< int > instance_reference_handles() const
std::optional< blender::bke::MutableAttributeAccessor > attributes_for_write() final
int add_reference(const InstanceReference &reference)
void resize(int capacity)
blender::MutableSpan< blender::float4x4 > instance_transforms()
void reinitialize(const int64_t new_size)
IndexRange index_range() const
void resize(const int64_t new_size)
static CurvesGeometry & wrap(::CurvesGeometry &dna_struct)
GSpanAttributeWriter lookup_or_add_for_write_only_span(const AttributeIDRef &attribute_id, const eAttrDomain domain, const eCustomDataType data_type)
void make_available(bNode &node) const
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
void(* MEM_freeN)(void *vmemh)
void *(* MEM_calloc_arrayN)(size_t len, size_t size, const char *str)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
Curves * curve_legacy_to_curves(const Curve &curve_legacy)
OwnedAnonymousAttributeID< true > StrongAnonymousAttributeID
static void node_layout(uiLayout *layout, struct bContext *C, PointerRNA *ptr)
static float3 get_pivot_point(GeoNodeExecParams ¶ms, bke::CurvesGeometry &curves)
static std::optional< TextLayout > get_text_layout(GeoNodeExecParams ¶ms)
static Map< int, int > create_curve_instances(GeoNodeExecParams ¶ms, TextLayout &layout, InstancesComponent &instances)
static void node_update(bNodeTree *ntree, bNode *node)
static void node_init(bNodeTree *UNUSED(ntree), bNode *node)
static void add_instances_from_handles(InstancesComponent &instances, const Map< int, int > &char_handles, const TextLayout &layout)
static void create_attributes(GeoNodeExecParams ¶ms, const TextLayout &layout, InstancesComponent &instances)
static void node_geo_exec(GeoNodeExecParams params)
static void node_declare(NodeDeclarationBuilder &b)
void parallel_for(IndexRange range, int64_t grain_size, const Function &function)
vec_base< float, 3 > float3
vec_base< float, 2 > float2
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
static void node_init(const struct bContext *C, bNodeTree *ntree, bNode *node)
void register_node_type_geo_string_to_curves()
void geo_node_type_base(bNodeType *ntype, int type, const char *name, short nclass)
void node_copy_standard_storage(bNodeTree *UNUSED(dest_ntree), bNode *dest_node, const bNode *src_node)
void node_free_standard_storage(bNode *node)
static void text_free(SpaceLink *sl)
GeometryComponent & get_component_for_write(GeometryComponentType component_type)
static GeometrySet create_with_curves(Curves *curves, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
NodeGeometryExecFunction geometry_node_execute
void(* draw_buttons)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr)
NodeDeclareFunction declare
MutableVArraySpan< T > span
void apply_scale(const float scale)
static float4x4 identity()
Vector< char32_t > char_codes
std::string truncated_text
Array< int > line_numbers
Map< int, float3 > pivot_points
Vector< float2 > positions