Refactor: Use VectorSet for panels, menus, gizmos, lists, operators
Previously, the global storage of these types either used a GHash or a blender::Map. VectorSet is preferrable to GHash because it's type safe, clearer, and faster. It's preferrable to Map because the key doesn't have to be duplicated and because iteration is faster. This PR moves these registered types to VectorSet, just like the node, node socket, and node tree types. Note that none of these types use RAII for allocation, so freeing is still done manually. Testing was manually interacting with each of these systems, including with addons that register their own types. Pull Request: https://projects.blender.org/blender/blender/pulls/133778
This commit is contained in:
@@ -393,11 +393,11 @@ static PyObject *pyop_as_string(PyObject * /*self*/, PyObject *args)
|
||||
|
||||
static PyObject *pyop_dir(PyObject * /*self*/)
|
||||
{
|
||||
const wmOperatorTypeMap &map = WM_operatortype_map();
|
||||
PyObject *list = PyList_New(map.size());
|
||||
const blender::Span<wmOperatorType *> types = WM_operatortypes_registered_get();
|
||||
PyObject *list = PyList_New(types.size());
|
||||
|
||||
int i = 0;
|
||||
for (wmOperatorType *ot : map.values()) {
|
||||
for (wmOperatorType *ot : types) {
|
||||
PyList_SET_ITEM(list, i, PyUnicode_FromString(ot->idname));
|
||||
i++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user