Changeset View
Standalone View
source/blender/nodes/intern/node_geometry_exec.cc
| Show First 20 Lines • Show All 120 Lines • ▼ Show 20 Lines | for (const bNodeSocket *socket : node_.input_sockets()) { | ||||
| } | } | ||||
| } | } | ||||
| return nullptr; | return nullptr; | ||||
| } | } | ||||
| std::string GeoNodeExecParams::attribute_producer_name() const | std::string GeoNodeExecParams::attribute_producer_name() const | ||||
| { | { | ||||
| return node_.label_or_name() + TIP_(" node"); | return BLI_sprintfN(TIP_("%s node"), node_.label_or_name()); | ||||
HooglyBoogly: This probably results in a memory leak (converting an allocated `char *` to a `std::string` | |||||
pioverfourAuthorUnsubmitted Done Inline ActionsAh, that’s unfortunate! This is outside the scope of this patch but do you have suggestions on how to properly do string formatting for i18n in C++, since as far as I understand the options we have for C code don’t? pioverfour: Ah, that’s unfortunate!
This is outside the scope of this patch but do you have suggestions on… | |||||
HooglyBooglyUnsubmitted Not Done Inline ActionsI haven't looked into this much, but I think we should probably use something like fmt::format. We already use that library, so I think we could just make it required. The string concatenation we usually do is bad, and it would be nice to have an alternative that didn't rely on BLI_sprintfN HooglyBoogly: I haven't looked into this much, but I think we should probably use something like `fmt… | |||||
pioverfourAuthorUnsubmitted Not Done Inline ActionsThanks! It looks like: return fmt::format(TIP_("{} node"), node_.label_or_name());works just as well as before. There are some issues however (already there before): whenever something changes (node renamed, link switched, etc.), the tooltip reverts to English. This is because the TIP_ macro indirectly calls BLT_translate(), which in turn does this: return BLI_thread_is_main(); I’m guessing the node name is computed from a thread other than the main one? If i18n is now expected to happen in other threads, I suppose BLT_translate() should be modified to account for this. pioverfour: Thanks! It looks like:
```
return fmt::format(TIP_("{} node"), node_.label_or_name());
```… | |||||
HooglyBooglyUnsubmitted Not Done Inline ActionsGood find! The fact that we translate these strings during evaluation is bad actually, it would be good to avoid that. They should only be translated when we display them in the UI. To do that we would need a better way to make inspection strings for fields, but that should be doable. HooglyBoogly: Good find! The fact that we translate these strings during evaluation is bad actually, it would… | |||||
| } | } | ||||
| void GeoNodeExecParams::set_default_remaining_outputs() | void GeoNodeExecParams::set_default_remaining_outputs() | ||||
| { | { | ||||
| params_.set_default_remaining_outputs(); | params_.set_default_remaining_outputs(); | ||||
| } | } | ||||
| void GeoNodeExecParams::check_input_access(StringRef identifier, | void GeoNodeExecParams::check_input_access(StringRef identifier, | ||||
| ▲ Show 20 Lines • Show All 77 Lines • Show Last 20 Lines | |||||

This probably results in a memory leak (converting an allocated char * to a std::string