Files
oak-editor/include/node/factory.h
T
Mike-Solar d77348ad9f refactor(node): de-Qt oaknode and wrap it in a pure C ABI
- copy engine/node (188 files) to src/node/src, de-Qt in waves:
  core infra (Node/Param/Value/Variant/mathtypes), project/serializer,
  block/output, color, effect leaves, generator, gizmo/plugins
- strip QObject/signals/slots: notifications move to the facade's
  oakengine_event channel, ownership becomes explicit (unique_ptr,
  add_keyframe/add_gizmo), sender() replaced by current_gizmo
- QVariant replaced by olive::Variant, Qt math types by POD mathtypes,
  QXmlStreamReader/Writer by oakcommon's expat-based classes
- sink VideoParams/SubtitleParams/LoopMode/ColorTransform to oakcommon
  (M3.5); polygon/text rasterization behind backend hooks
- pure C ABI in include/node + src/node/c_api (oaknode_ prefix,
  OAKNODE_E_* codes, undoable variants take OakUndoCommand out-params)
- fix Project::clear() root_ reset + disconnect assert, Sequence
  TrackList leak
- 96 gtest cases green in standalone build (build-oaknode)
- docs: signal/slot handling strategy + M3 implementation status
2026-08-05 23:55:54 +08:00

97 lines
2.9 KiB
C

/***
Oak Video Editor - Non-Linear Video Editor
Copyright (C) 2026 Oak Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef OAK_EDITOR_NODE_FACTORY_H
#define OAK_EDITOR_NODE_FACTORY_H
#include "node/error.h"
#include "node/node.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @file factory.h
* @brief C ABI for olive::NodeFactory (src/node/src/factory.h): the
* internal node-type library.
*
* The library must be populated with oaknode_factory_initialize() before
* any other call; oaknode_factory_destroy() releases it. Prototype nodes
* from oaknode_factory_node_at() are owned by the library: read-only
* metadata queries only, never free them or add them to a graph.
*/
/**
* @brief Populate the internal node library (NodeFactory::initialize()).
* Idempotent: calling twice is a no-op.
*
* @return OAKNODE_OK or a negative OAKNODE_E_* error code.
*/
int oaknode_factory_initialize(void);
/**
* @brief Release the internal node library (NodeFactory::destroy()).
* Safe when not initialized.
*/
void oaknode_factory_destroy(void);
/**
* @brief Number of registered node types (the library size).
* OAKNODE_E_STATE when not initialized.
*/
int oaknode_factory_id_count(int *out_count);
/**
* @brief The type id of the registered node at `index`. Two-stage
* getter; OAKNODE_E_NOT_FOUND for an out-of-range index,
* OAKNODE_E_STATE when not initialized.
*/
int oaknode_factory_id_at(int index, char *buf, int buf_size);
/**
* @brief The display name of the node type `type_id`
* (NodeFactory::get_name_from_id()). Two-stage getter; an unknown id
* yields an empty string (required size 1).
*/
int oaknode_factory_name_from_id(const char *type_id, char *buf,
int buf_size);
/**
* @brief Create a node of `type_id` WITHOUT adding it to any graph
* (NodeFactory::create_from_id()). The caller owns the returned node
* and must release it with oaknode_node_free() while it is still
* orphaned. Returns NULL when the id is unknown or not initialized.
*/
OakNodeNode *oaknode_factory_create_from_id(const char *type_id);
/**
* @brief Borrow the prototype node at `index` in the library.
* OAKNODE_E_NOT_FOUND for an out-of-range index, OAKNODE_E_STATE when
* not initialized.
*/
int oaknode_factory_node_at(int index, OakNodeNode **out_node);
#ifdef __cplusplus
}
#endif
#endif //OAK_EDITOR_NODE_FACTORY_H