Alternative Upload geometry data in parallel to multiple GPUs using the "Multi-Device" #107552
|
@ -1552,10 +1552,9 @@ class CyclesPreferences(bpy.types.AddonPreferences):
|
|||
)
|
||||
|
||||
use_oneapirt: BoolProperty(
|
||||
name="Embree on GPU (Experimental)",
|
||||
description="Embree GPU execution will allow to use hardware ray tracing on Intel GPUs, which will provide better performance. "
|
||||
"However this support is experimental and some scenes may render incorrectly",
|
||||
default=False,
|
||||
name="Embree on GPU",
|
||||
description="Embree on GPU enables the use of hardware ray tracing on Intel GPUs, providing better overall performance",
|
||||
default=True,
|
||||
)
|
||||
|
||||
kernel_optimization_level: EnumProperty(
|
||||
|
@ -1782,7 +1781,6 @@ class CyclesPreferences(bpy.types.AddonPreferences):
|
|||
|
||||
elif compute_device_type == 'ONEAPI' and _cycles.with_embree_gpu:
|
||||
row = layout.row()
|
||||
row.use_property_split = True
|
||||
row.prop(self, "use_oneapirt")
|
||||
|
||||
def draw(self, context):
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
12:Portuguese (Português):pt_PT
|
||||
15:Russian (Русский):ru_RU
|
||||
18:Ukrainian (Українська):uk_UA
|
||||
41:Vietnamese (tiếng Việt):vi_VN
|
||||
41:Vietnamese (Tiếng Việt):vi_VN
|
||||
14:Traditional Chinese (繁體中文):zh_TW
|
||||
#
|
||||
0:Starting:
|
||||
|
@ -46,14 +46,14 @@
|
|||
6:Finnish (Suomi):fi_FI
|
||||
43:Hausa (Hausa):ha
|
||||
33:Hebrew (תירִבְעִ):he_IL
|
||||
40:Hindi (मानक हिन्दी):hi_IN
|
||||
40:Hindi (हिन्दी):hi_IN
|
||||
16:Croatian (Hrvatski):hr_HR
|
||||
31:Hungarian (Magyar):hu_HU
|
||||
27:Indonesian (Bahasa indonesia):id_ID
|
||||
# Skipped (see IMPORT_LANGUAGES_SKIP in settings.py). #44:Kazakh (қазақша):kk_KZ
|
||||
# Skipped (see IMPORT_LANGUAGES_SKIP in settings.py). #44:Kazakh (Қазақша):kk_KZ
|
||||
29:Kyrgyz (Кыргыз тили):ky_KG
|
||||
# Skipped (see IMPORT_LANGUAGES_SKIP in settings.py). #25:Nepali (नेपाली):ne_NP
|
||||
3:Dutch (Nederlandse taal):nl_NL
|
||||
3:Dutch (Nederlands):nl_NL
|
||||
19:Polish (Polski):pl_PL
|
||||
# Skipped (see IMPORT_LANGUAGES_SKIP in settings.py). #20:Romanian (Român):ro_RO
|
||||
17:Serbian (Српски):sr_RS
|
||||
|
|
|
@ -384,7 +384,6 @@ def dump_rna_messages(msgs, reports, settings, verbose=False):
|
|||
walk_keymap_hierarchy(lvl[3], msgsrc)
|
||||
|
||||
# Dump Messages
|
||||
operator_categories = {}
|
||||
|
||||
def process_cls_list(cls_list):
|
||||
if not cls_list:
|
||||
|
@ -411,15 +410,6 @@ def dump_rna_messages(msgs, reports, settings, verbose=False):
|
|||
bl_rna = bl_rna.base
|
||||
return cls_id
|
||||
|
||||
def operator_category(cls):
|
||||
"""Extract operators' categories, as displayed in 'search' space menu."""
|
||||
# NOTE: keep in sync with C code in ui_searchbox_region_draw_cb__operator().
|
||||
if issubclass(cls, bpy.types.OperatorProperties) and "_OT_" in cls.__name__:
|
||||
cat_id = cls.__name__.split("_OT_")[0]
|
||||
if cat_id not in operator_categories:
|
||||
cat_str = cat_id.capitalize() + ":"
|
||||
operator_categories[cat_id] = cat_str
|
||||
|
||||
if verbose:
|
||||
print(cls_list)
|
||||
cls_list.sort(key=full_class_id)
|
||||
|
@ -431,7 +421,6 @@ def dump_rna_messages(msgs, reports, settings, verbose=False):
|
|||
if (cls in blacklist_rna_class) or issubclass(cls, bpy.types.Operator):
|
||||
reports["rna_structs_skipped"].append(cls)
|
||||
else:
|
||||
operator_category(cls)
|
||||
walk_class(cls)
|
||||
# Recursively process subclasses.
|
||||
process_cls_list(cls.__subclasses__())
|
||||
|
@ -446,11 +435,6 @@ def dump_rna_messages(msgs, reports, settings, verbose=False):
|
|||
# Parse everything (recursively parsing from bpy_struct "class"...).
|
||||
process_cls_list(bpy.types.ID.__base__.__subclasses__())
|
||||
|
||||
# Finalize generated 'operator categories' messages.
|
||||
for cat_str in operator_categories.values():
|
||||
process_msg(msgs, bpy.app.translations.contexts.operator_default, cat_str, "Generated operator category",
|
||||
reports, check_ctxt_rna, settings)
|
||||
|
||||
# Parse keymap preset preferences
|
||||
for preset_filename in sorted(
|
||||
os.listdir(os.path.join(settings.PRESETS_DIR, "keyconfig"))):
|
||||
|
|
|
@ -34,7 +34,7 @@ LANGUAGES = (
|
|||
(0, "Automatic (Automatic)", "DEFAULT"),
|
||||
(1, "English (English)", "en_US"),
|
||||
(2, "Japanese (日本語)", "ja_JP"),
|
||||
(3, "Dutch (Nederlandse taal)", "nl_NL"),
|
||||
(3, "Dutch (Nederlands)", "nl_NL"),
|
||||
(4, "Italian (Italiano)", "it_IT"),
|
||||
(5, "German (Deutsch)", "de_DE"),
|
||||
(6, "Finnish (Suomi)", "fi_FI"),
|
||||
|
@ -74,11 +74,11 @@ LANGUAGES = (
|
|||
(37, "Amharic (አማርኛ)", "am_ET"),
|
||||
(38, "Uzbek (Oʻzbek)", "uz_UZ"),
|
||||
(39, "Uzbek Cyrillic (Ўзбек)", "uz_UZ@cyrillic"),
|
||||
(40, "Hindi (मानक हिन्दी)", "hi_IN"),
|
||||
(41, "Vietnamese (tiếng Việt)", "vi_VN"),
|
||||
(40, "Hindi (हिन्दी)", "hi_IN"),
|
||||
(41, "Vietnamese (Tiếng Việt)", "vi_VN"),
|
||||
(42, "Basque (Euskara)", "eu_EU"),
|
||||
(43, "Hausa (Hausa)", "ha"),
|
||||
(44, "Kazakh (қазақша)", "kk_KZ"),
|
||||
(44, "Kazakh (Қазақша)", "kk_KZ"),
|
||||
(45, "Abkhaz (Аԥсуа бызшәа)", "ab"),
|
||||
(46, "Thai (ภาษาไทย)", "th_TH"),
|
||||
(47, "Slovak (Slovenčina)", "sk_SK"),
|
||||
|
|
|
@ -184,8 +184,9 @@ class NODE_OT_add_simulation_zone(NodeAddOperator, Operator):
|
|||
output_node.location += Vector(self.offset)
|
||||
|
||||
# Connect geometry sockets by default.
|
||||
from_socket = input_node.outputs.get("Geometry")
|
||||
to_socket = output_node.inputs.get("Geometry")
|
||||
# Get the sockets by their types, because the name is not guaranteed due to i18n.
|
||||
from_socket = next(s for s in input_node.outputs if s.type == 'GEOMETRY')
|
||||
to_socket = next(s for s in output_node.inputs if s.type == 'GEOMETRY')
|
||||
tree.links.new(to_socket, from_socket)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
|
|
@ -840,12 +840,12 @@ bool AssetCatalogDefinitionFile::write_to_disk(const CatalogFilePath &dest_file_
|
|||
return false;
|
||||
}
|
||||
if (BLI_exists(dest_file_path.c_str())) {
|
||||
if (BLI_rename(dest_file_path.c_str(), backup_path.c_str())) {
|
||||
if (BLI_rename_overwrite(dest_file_path.c_str(), backup_path.c_str())) {
|
||||
/* TODO: communicate what went wrong. */
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (BLI_rename(writable_path.c_str(), dest_file_path.c_str())) {
|
||||
if (BLI_rename_overwrite(writable_path.c_str(), dest_file_path.c_str())) {
|
||||
/* TODO: communicate what went wrong. */
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -406,13 +406,6 @@ typedef struct bNodeType {
|
|||
#define NODE_CLASS_ATTRIBUTE 42
|
||||
#define NODE_CLASS_LAYOUT 100
|
||||
|
||||
typedef enum eNodeSizePreset {
|
||||
NODE_SIZE_DEFAULT,
|
||||
NODE_SIZE_SMALL,
|
||||
NODE_SIZE_MIDDLE,
|
||||
NODE_SIZE_LARGE,
|
||||
} eNodeSizePreset;
|
||||
|
||||
struct bNodeTreeExec;
|
||||
|
||||
typedef void (*bNodeClassCallback)(void *calldata, int nclass, const char *name);
|
||||
|
@ -496,26 +489,10 @@ void ntreeSetTypes(const struct bContext *C, struct bNodeTree *ntree);
|
|||
|
||||
struct bNodeTree *ntreeAddTree(struct Main *bmain, const char *name, const char *idname);
|
||||
|
||||
struct bNodeTree *ntreeAddTreeEmbedded(struct Main *bmain,
|
||||
struct ID *owner_id,
|
||||
const char *name,
|
||||
const char *idname);
|
||||
|
||||
/* Copy/free functions, need to manage ID users. */
|
||||
|
||||
/**
|
||||
* Free (or release) any data used by this node-tree.
|
||||
* Does not free the node-tree itself and does no ID user counting.
|
||||
*/
|
||||
void ntreeFreeTree(struct bNodeTree *ntree);
|
||||
/**
|
||||
* Free tree which is embedded into another data-block.
|
||||
*/
|
||||
void ntreeFreeEmbeddedTree(struct bNodeTree *ntree);
|
||||
struct bNodeTree *ntreeCopyTree_ex(const struct bNodeTree *ntree,
|
||||
struct Main *bmain,
|
||||
bool do_id_user);
|
||||
struct bNodeTree *ntreeCopyTree(struct Main *bmain, const struct bNodeTree *ntree);
|
||||
|
||||
/**
|
||||
* Get address of potential node-tree pointer of given ID.
|
||||
|
@ -524,14 +501,13 @@ struct bNodeTree *ntreeCopyTree(struct Main *bmain, const struct bNodeTree *ntre
|
|||
* sure, please use `ntreeFromID()` instead.
|
||||
*/
|
||||
struct bNodeTree **BKE_ntree_ptr_from_id(struct ID *id);
|
||||
|
||||
/**
|
||||
* Returns the private NodeTree object of the data-block, if it has one.
|
||||
*/
|
||||
struct bNodeTree *ntreeFromID(struct ID *id);
|
||||
|
||||
void ntreeFreeLocalNode(struct bNodeTree *ntree, struct bNode *node);
|
||||
void ntreeFreeLocalTree(struct bNodeTree *ntree);
|
||||
struct bNode *ntreeFindType(struct bNodeTree *ntree, int type);
|
||||
|
||||
/**
|
||||
* Check recursively if a node tree contains another.
|
||||
|
@ -539,7 +515,6 @@ struct bNode *ntreeFindType(struct bNodeTree *ntree, int type);
|
|||
bool ntreeContainsTree(const struct bNodeTree *tree_to_search_in,
|
||||
const struct bNodeTree *tree_to_search_for);
|
||||
|
||||
void ntreeUpdateAllNew(struct Main *main);
|
||||
void ntreeUpdateAllUsers(struct Main *main, struct ID *id);
|
||||
|
||||
/**
|
||||
|
@ -549,30 +524,15 @@ void ntreeUpdateAllUsers(struct Main *main, struct ID *id);
|
|||
*/
|
||||
void ntreeSetOutput(struct bNodeTree *ntree);
|
||||
|
||||
void ntreeNodeFlagSet(const bNodeTree *ntree, int flag, bool enable);
|
||||
/**
|
||||
* Returns localized tree for execution in threads.
|
||||
*/
|
||||
struct bNodeTree *ntreeLocalize(struct bNodeTree *ntree);
|
||||
/**
|
||||
* Merge local tree results back, and free local tree.
|
||||
*
|
||||
* We have to assume the editor already changed completely.
|
||||
*/
|
||||
void ntreeLocalMerge(struct Main *bmain, struct bNodeTree *localtree, struct bNodeTree *ntree);
|
||||
|
||||
/**
|
||||
* This is only direct data, tree itself should have been written.
|
||||
*/
|
||||
void ntreeBlendWrite(struct BlendWriter *writer, struct bNodeTree *ntree);
|
||||
/**
|
||||
* \note `ntree` itself has been read!
|
||||
*/
|
||||
void ntreeBlendReadData(struct BlendDataReader *reader,
|
||||
struct ID *owner_id,
|
||||
struct bNodeTree *ntree);
|
||||
void ntreeBlendReadLib(struct BlendLibReader *reader, struct bNodeTree *ntree);
|
||||
void ntreeBlendReadExpand(struct BlendExpander *expander, struct bNodeTree *ntree);
|
||||
|
||||
/** \} */
|
||||
|
||||
|
@ -580,31 +540,12 @@ void ntreeBlendReadExpand(struct BlendExpander *expander, struct bNodeTree *ntre
|
|||
/** \name Node Tree Interface
|
||||
* \{ */
|
||||
|
||||
struct bNodeSocket *ntreeFindSocketInterface(struct bNodeTree *ntree,
|
||||
eNodeSocketInOut in_out,
|
||||
const char *identifier);
|
||||
void ntreeRemoveSocketInterface(bNodeTree *ntree, bNodeSocket *sock);
|
||||
|
||||
struct bNodeSocket *ntreeAddSocketInterface(struct bNodeTree *ntree,
|
||||
eNodeSocketInOut in_out,
|
||||
const char *idname,
|
||||
const char *name);
|
||||
struct bNodeSocket *ntreeInsertSocketInterface(struct bNodeTree *ntree,
|
||||
eNodeSocketInOut in_out,
|
||||
const char *idname,
|
||||
struct bNodeSocket *next_sock,
|
||||
const char *name);
|
||||
struct bNodeSocket *ntreeAddSocketInterfaceFromSocket(struct bNodeTree *ntree,
|
||||
const struct bNode *from_node,
|
||||
const struct bNodeSocket *from_sock);
|
||||
struct bNodeSocket *ntreeAddSocketInterfaceFromSocketWithName(struct bNodeTree *ntree,
|
||||
const struct bNode *from_node,
|
||||
const struct bNodeSocket *from_sock,
|
||||
const char *idname,
|
||||
const char *name);
|
||||
struct bNodeSocket *ntreeInsertSocketInterfaceFromSocket(struct bNodeTree *ntree,
|
||||
struct bNodeSocket *next_sock,
|
||||
const struct bNode *from_node,
|
||||
const struct bNodeSocket *from_sock);
|
||||
void ntreeRemoveSocketInterface(struct bNodeTree *ntree, struct bNodeSocket *sock);
|
||||
|
||||
/** \} */
|
||||
|
||||
|
@ -615,7 +556,6 @@ void ntreeRemoveSocketInterface(struct bNodeTree *ntree, struct bNodeSocket *soc
|
|||
struct bNodeType *nodeTypeFind(const char *idname);
|
||||
void nodeRegisterType(struct bNodeType *ntype);
|
||||
void nodeUnregisterType(struct bNodeType *ntype);
|
||||
bool nodeTypeUndefined(const struct bNode *node);
|
||||
struct GHashIterator *nodeTypeGetIterator(void);
|
||||
|
||||
/* Helper macros for iterating over node types. */
|
||||
|
@ -639,11 +579,9 @@ bool nodeSocketIsRegistered(const struct bNodeSocket *sock);
|
|||
struct GHashIterator *nodeSocketTypeGetIterator(void);
|
||||
const char *nodeSocketTypeLabel(const bNodeSocketType *stype);
|
||||
|
||||
bool nodeIsStaticSocketType(const struct bNodeSocketType *stype);
|
||||
const char *nodeStaticSocketType(int type, int subtype);
|
||||
const char *nodeStaticSocketInterfaceType(int type, int subtype);
|
||||
const char *nodeStaticSocketLabel(int type, int subtype);
|
||||
const char *nodeSocketSubTypeLabel(int subtype);
|
||||
|
||||
/* Helper macros for iterating over node types. */
|
||||
#define NODE_SOCKET_TYPES_BEGIN(stype) \
|
||||
|
@ -678,24 +616,13 @@ struct bNodeSocket *nodeAddStaticSocket(struct bNodeTree *ntree,
|
|||
const char *identifier,
|
||||
const char *name);
|
||||
void nodeRemoveSocket(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock);
|
||||
void nodeRemoveSocketEx(struct bNodeTree *ntree,
|
||||
struct bNode *node,
|
||||
struct bNodeSocket *sock,
|
||||
bool do_id_user);
|
||||
void nodeRemoveAllSockets(struct bNodeTree *ntree, struct bNode *node);
|
||||
void nodeModifySocketType(struct bNodeTree *ntree,
|
||||
struct bNode *node,
|
||||
struct bNodeSocket *sock,
|
||||
const char *idname);
|
||||
|
||||
void nodeModifySocketTypeStatic(
|
||||
struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock, int type, int subtype);
|
||||
|
||||
struct bNode *nodeAddNode(const struct bContext *C, struct bNodeTree *ntree, const char *idname);
|
||||
struct bNode *nodeAddStaticNode(const struct bContext *C, struct bNodeTree *ntree, int type);
|
||||
/**
|
||||
* \note Goes over entire tree.
|
||||
*/
|
||||
void nodeUnlinkNode(struct bNodeTree *ntree, struct bNode *node);
|
||||
|
||||
/**
|
||||
* Find the first available, non-duplicate name for a given node.
|
||||
*/
|
||||
|
@ -706,13 +633,6 @@ void nodeUniqueName(struct bNodeTree *ntree, struct bNode *node);
|
|||
*/
|
||||
void nodeUniqueID(struct bNodeTree *ntree, struct bNode *node);
|
||||
|
||||
/**
|
||||
* Rebuild the `node_by_id` runtime vector set. Call after removing a node if not handled
|
||||
* separately. This is important instead of just using `nodes_by_id.remove()` since it maintains
|
||||
* the node order.
|
||||
*/
|
||||
void nodeRebuildIDVector(struct bNodeTree *node_tree);
|
||||
|
||||
/**
|
||||
* Delete node, associated animation data and ID user count.
|
||||
*/
|
||||
|
@ -725,47 +645,6 @@ void nodeDimensionsGet(const struct bNode *node, float *r_width, float *r_height
|
|||
void nodeTagUpdateID(struct bNode *node);
|
||||
void nodeInternalLinks(struct bNode *node, struct bNodeLink **r_links, int *r_len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace blender::bke {
|
||||
|
||||
/**
|
||||
* \note keeps socket list order identical, for copying links.
|
||||
* \param use_unique: If true, make sure the node's identifier and name are unique in the new
|
||||
* tree. Must be *true* if the \a dst_tree had nodes that weren't in the source node's tree.
|
||||
* Must be *false* when simply copying a node tree, so that identifiers don't change.
|
||||
*/
|
||||
bNode *node_copy_with_mapping(bNodeTree *dst_tree,
|
||||
const bNode &node_src,
|
||||
int flag,
|
||||
bool use_unique,
|
||||
Map<const bNodeSocket *, bNodeSocket *> &new_socket_map);
|
||||
|
||||
bNode *node_copy(bNodeTree *dst_tree, const bNode &src_node, int flag, bool use_unique);
|
||||
|
||||
/**
|
||||
* Move socket default from \a src (input socket) to locations specified by \a dst (output socket).
|
||||
* Result value moved in specific location. (potentially multiple group nodes socket values, if \a
|
||||
* dst is a group input node).
|
||||
* \note Conceptually, the effect should be such that the evaluation of
|
||||
* this graph again returns the value in src.
|
||||
*/
|
||||
void node_socket_move_default_value(Main &bmain,
|
||||
bNodeTree &tree,
|
||||
bNodeSocket &src,
|
||||
bNodeSocket &dst);
|
||||
|
||||
/**
|
||||
* Free the node itself.
|
||||
*
|
||||
* \note ID user reference-counting and changing the `nodes_by_id` vector are up to the caller.
|
||||
*/
|
||||
void node_free_node(bNodeTree *tree, bNode *node);
|
||||
|
||||
} // namespace blender::bke
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Also used via RNA API, so we check for proper input output direction.
|
||||
*/
|
||||
|
@ -776,25 +655,19 @@ struct bNodeLink *nodeAddLink(struct bNodeTree *ntree,
|
|||
struct bNodeSocket *tosock);
|
||||
void nodeRemLink(struct bNodeTree *ntree, struct bNodeLink *link);
|
||||
void nodeRemSocketLinks(struct bNodeTree *ntree, struct bNodeSocket *sock);
|
||||
/**
|
||||
* Set the mute status of a single link.
|
||||
*/
|
||||
void nodeLinkSetMute(struct bNodeTree *ntree, struct bNodeLink *link, const bool muted);
|
||||
bool nodeLinkIsHidden(const struct bNodeLink *link);
|
||||
bool nodeLinkIsSelected(const struct bNodeLink *link);
|
||||
void nodeInternalRelink(struct bNodeTree *ntree, struct bNode *node);
|
||||
|
||||
void nodeToView(const struct bNode *node, float x, float y, float *rx, float *ry);
|
||||
void nodeFromView(const struct bNode *node, float x, float y, float *rx, float *ry);
|
||||
bool nodeLinkIsHidden(const struct bNodeLink *link);
|
||||
|
||||
void nodeAttachNode(struct bNodeTree *ntree, struct bNode *node, struct bNode *parent);
|
||||
void nodeDetachNode(struct bNodeTree *ntree, struct bNode *node);
|
||||
|
||||
void nodePositionRelative(struct bNode *from_node,
|
||||
const struct bNode *to_node,
|
||||
const struct bNodeSocket *from_sock,
|
||||
const struct bNodeSocket *to_sock);
|
||||
void nodePositionPropagate(struct bNode *node);
|
||||
|
||||
/**
|
||||
* Same as above but expects that the socket definitely is in the node tree.
|
||||
*/
|
||||
void nodeFindNode(struct bNodeTree *ntree,
|
||||
struct bNodeSocket *sock,
|
||||
struct bNode **r_node,
|
||||
int *r_sockindex);
|
||||
/**
|
||||
* Finds a node based on its name.
|
||||
*/
|
||||
|
@ -806,65 +679,9 @@ bool nodeFindNodeTry(struct bNodeTree *ntree,
|
|||
struct bNodeSocket *sock,
|
||||
struct bNode **r_node,
|
||||
int *r_sockindex);
|
||||
/**
|
||||
* Same as above but expects that the socket definitely is in the node tree.
|
||||
*/
|
||||
void nodeFindNode(struct bNodeTree *ntree,
|
||||
struct bNodeSocket *sock,
|
||||
struct bNode **r_node,
|
||||
int *r_sockindex);
|
||||
/**
|
||||
* \note Recursive.
|
||||
*/
|
||||
struct bNode *nodeFindRootParent(bNode *node);
|
||||
|
||||
bool nodeIsParentAndChild(const bNode *parent, const bNode *child);
|
||||
|
||||
/**
|
||||
* Iterate over a chain of nodes, starting with \a node_start, executing
|
||||
* \a callback for each node (which can return false to end iterator).
|
||||
*
|
||||
* \param reversed: for backwards iteration
|
||||
* \note Recursive
|
||||
*/
|
||||
void nodeChainIter(const bNodeTree *ntree,
|
||||
const bNode *node_start,
|
||||
bool (*callback)(bNode *, bNode *, void *, const bool),
|
||||
void *userdata,
|
||||
bool reversed);
|
||||
/**
|
||||
* Iterate over a chain of nodes, starting with \a node_start, executing
|
||||
* \a callback for each node (which can return false to end iterator).
|
||||
*
|
||||
* Faster than nodeChainIter. Iter only once per node.
|
||||
* Can be called recursively (using another nodeChainIterBackwards) by
|
||||
* setting the recursion_lvl accordingly.
|
||||
*
|
||||
* \note Needs updated socket links (ntreeUpdateTree).
|
||||
* \note Recursive
|
||||
*/
|
||||
void nodeChainIterBackwards(const bNodeTree *ntree,
|
||||
const bNode *node_start,
|
||||
bool (*callback)(bNode *, bNode *, void *),
|
||||
void *userdata,
|
||||
int recursion_lvl);
|
||||
/**
|
||||
* Iterate over all parents of \a node, executing \a callback for each parent
|
||||
* (which can return false to end iterator)
|
||||
*
|
||||
* \note Recursive
|
||||
*/
|
||||
void nodeParentsIter(bNode *node, bool (*callback)(bNode *, void *), void *userdata);
|
||||
|
||||
/**
|
||||
* A dangling reroute node is a reroute node that does *not* have a "data source", i.e. no
|
||||
* non-reroute node is connected to its input.
|
||||
*/
|
||||
bool nodeIsDanglingReroute(const struct bNodeTree *ntree, const struct bNode *node);
|
||||
|
||||
struct bNodeLink *nodeFindLink(struct bNodeTree *ntree,
|
||||
const struct bNodeSocket *from,
|
||||
const struct bNodeSocket *to);
|
||||
int nodeCountSocketLinks(const struct bNodeTree *ntree, const struct bNodeSocket *sock);
|
||||
|
||||
void nodeSetSelected(struct bNode *node, bool select);
|
||||
|
@ -878,37 +695,9 @@ void nodeClearActive(struct bNodeTree *ntree);
|
|||
* Two active flags, ID nodes have special flag for buttons display.
|
||||
*/
|
||||
struct bNode *nodeGetActiveTexture(struct bNodeTree *ntree);
|
||||
struct bNode *nodeGetActivePaintCanvas(struct bNodeTree *ntree);
|
||||
|
||||
/**
|
||||
* \brief Does the given node supports the sub active flag.
|
||||
*
|
||||
* \param sub_active: The active flag to check. #NODE_ACTIVE_TEXTURE / #NODE_ACTIVE_PAINT_CANVAS.
|
||||
*/
|
||||
bool nodeSupportsActiveFlag(const struct bNode *node, int sub_active);
|
||||
|
||||
void nodeSetSocketAvailability(struct bNodeTree *ntree,
|
||||
struct bNodeSocket *sock,
|
||||
bool is_available);
|
||||
|
||||
int nodeSocketLinkLimit(const struct bNodeSocket *sock);
|
||||
|
||||
/**
|
||||
* If the node implements a `declare` function, this function makes sure that `node->declaration`
|
||||
* is up to date. It is expected that the sockets of the node are up to date already.
|
||||
*/
|
||||
bool nodeDeclarationEnsure(struct bNodeTree *ntree, struct bNode *node);
|
||||
/**
|
||||
* Just update `node->declaration` if necessary. This can also be called on nodes that may not be
|
||||
* up to date (e.g. because the need versioning or are dynamic).
|
||||
*/
|
||||
bool nodeDeclarationEnsureOnOutdatedNode(struct bNodeTree *ntree, struct bNode *node);
|
||||
/**
|
||||
* Update `socket->declaration` for all sockets in the node. This assumes that the node declaration
|
||||
* and sockets are up to date already.
|
||||
*/
|
||||
void nodeSocketDeclarationsUpdate(struct bNode *node);
|
||||
|
||||
/**
|
||||
* Node Instance Hash.
|
||||
*/
|
||||
|
@ -947,89 +736,22 @@ bool BKE_node_instance_hash_tag_key(bNodeInstanceHash *hash, bNodeInstanceKey ke
|
|||
void BKE_node_instance_hash_remove_untagged(bNodeInstanceHash *hash,
|
||||
bNodeInstanceValueFP valfreefp);
|
||||
|
||||
typedef GHashIterator bNodeInstanceHashIterator;
|
||||
|
||||
BLI_INLINE bNodeInstanceHashIterator *BKE_node_instance_hash_iterator_new(bNodeInstanceHash *hash)
|
||||
{
|
||||
return BLI_ghashIterator_new(hash->ghash);
|
||||
}
|
||||
BLI_INLINE void BKE_node_instance_hash_iterator_init(bNodeInstanceHashIterator *iter,
|
||||
bNodeInstanceHash *hash)
|
||||
{
|
||||
BLI_ghashIterator_init(iter, hash->ghash);
|
||||
}
|
||||
BLI_INLINE void BKE_node_instance_hash_iterator_free(bNodeInstanceHashIterator *iter)
|
||||
{
|
||||
BLI_ghashIterator_free(iter);
|
||||
}
|
||||
BLI_INLINE bNodeInstanceKey
|
||||
BKE_node_instance_hash_iterator_get_key(bNodeInstanceHashIterator *iter)
|
||||
{
|
||||
return *(bNodeInstanceKey *)BLI_ghashIterator_getKey(iter);
|
||||
}
|
||||
BLI_INLINE void *BKE_node_instance_hash_iterator_get_value(bNodeInstanceHashIterator *iter)
|
||||
{
|
||||
return BLI_ghashIterator_getValue(iter);
|
||||
}
|
||||
BLI_INLINE void BKE_node_instance_hash_iterator_step(bNodeInstanceHashIterator *iter)
|
||||
{
|
||||
BLI_ghashIterator_step(iter);
|
||||
}
|
||||
BLI_INLINE bool BKE_node_instance_hash_iterator_done(bNodeInstanceHashIterator *iter)
|
||||
{
|
||||
return BLI_ghashIterator_done(iter);
|
||||
}
|
||||
|
||||
#define NODE_INSTANCE_HASH_ITER(iter_, hash_) \
|
||||
for (BKE_node_instance_hash_iterator_init(&iter_, hash_); \
|
||||
BKE_node_instance_hash_iterator_done(&iter_) == false; \
|
||||
BKE_node_instance_hash_iterator_step(&iter_))
|
||||
|
||||
/* Node Previews */
|
||||
|
||||
bool BKE_node_preview_used(const struct bNode *node);
|
||||
bNodePreview *BKE_node_preview_verify(
|
||||
struct bNodeInstanceHash *previews, bNodeInstanceKey key, int xsize, int ysize, bool create);
|
||||
bNodePreview *BKE_node_preview_copy(struct bNodePreview *preview);
|
||||
void BKE_node_preview_free(struct bNodePreview *preview);
|
||||
void BKE_node_preview_init_tree(struct bNodeTree *ntree, int xsize, int ysize);
|
||||
void BKE_node_preview_remove_unused(struct bNodeTree *ntree);
|
||||
void BKE_node_preview_clear(struct bNodePreview *preview);
|
||||
void BKE_node_preview_clear_tree(struct bNodeTree *ntree);
|
||||
|
||||
void BKE_node_preview_merge_tree(struct bNodeTree *to_ntree,
|
||||
struct bNodeTree *from_ntree,
|
||||
bool remove_old);
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Node Type Access
|
||||
* \{ */
|
||||
|
||||
void nodeLabel(const struct bNodeTree *ntree, const struct bNode *node, char *label, int maxlen);
|
||||
/**
|
||||
* Get node socket label if it is set.
|
||||
*/
|
||||
const char *nodeSocketLabel(const struct bNodeSocket *sock);
|
||||
|
||||
bool nodeGroupPoll(const struct bNodeTree *nodetree,
|
||||
const struct bNodeTree *grouptree,
|
||||
const char **r_disabled_hint);
|
||||
|
||||
/**
|
||||
* Initialize a new node type struct with default values and callbacks.
|
||||
*/
|
||||
void node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass);
|
||||
void node_type_base_custom(struct bNodeType *ntype,
|
||||
const char *idname,
|
||||
const char *name,
|
||||
short nclass);
|
||||
void node_type_socket_templates(struct bNodeType *ntype,
|
||||
struct bNodeSocketTemplate *inputs,
|
||||
struct bNodeSocketTemplate *outputs);
|
||||
void node_type_size(struct bNodeType *ntype, int width, int minwidth, int maxwidth);
|
||||
void node_type_size_preset(struct bNodeType *ntype, eNodeSizePreset size);
|
||||
|
||||
/**
|
||||
* \warning Nodes defining a storage type _must_ allocate this for new nodes.
|
||||
* Otherwise nodes will reload as undefined (#46619).
|
||||
|
@ -1043,12 +765,6 @@ void node_type_storage(struct bNodeType *ntype,
|
|||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Node Generic Functions
|
||||
* \{ */
|
||||
|
||||
bool BKE_node_is_connected_to_output(const struct bNodeTree *ntree, const struct bNode *node);
|
||||
|
||||
/* ************** COMMON NODES *************** */
|
||||
|
||||
#define NODE_UNDEFINED -2 /* node type is not registered */
|
||||
|
@ -1620,32 +1336,6 @@ void BKE_nodetree_remove_layer_n(struct bNodeTree *ntree, struct Scene *scene, i
|
|||
void BKE_node_system_init(void);
|
||||
void BKE_node_system_exit(void);
|
||||
|
||||
extern bNodeTreeType NodeTreeTypeUndefined;
|
||||
extern struct bNodeType NodeTypeUndefined;
|
||||
extern struct bNodeSocketType NodeSocketTypeUndefined;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace blender::bke {
|
||||
|
||||
bNodeSocket *node_find_enabled_socket(bNode &node, eNodeSocketInOut in_out, StringRef name);
|
||||
bNodeSocket *node_find_enabled_input_socket(bNode &node, StringRef name);
|
||||
bNodeSocket *node_find_enabled_output_socket(bNode &node, StringRef name);
|
||||
|
||||
} // namespace blender::bke
|
||||
|
||||
#endif
|
||||
|
||||
#define NODE_STORAGE_FUNCS(StorageT) \
|
||||
[[maybe_unused]] static StorageT &node_storage(bNode &node) \
|
||||
{ \
|
||||
return *static_cast<StorageT *>(node.storage); \
|
||||
} \
|
||||
[[maybe_unused]] static const StorageT &node_storage(const bNode &node) \
|
||||
{ \
|
||||
return *static_cast<const StorageT *>(node.storage); \
|
||||
}
|
||||
|
|
|
@ -0,0 +1,372 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
* Copyright 2005 Blender Foundation */
|
||||
|
||||
#pragma once
|
||||
|
||||
/** \file
|
||||
* \ingroup bke
|
||||
*/
|
||||
|
||||
#include "BLI_compiler_compat.h"
|
||||
#include "BLI_ghash.h"
|
||||
|
||||
#include "DNA_listBase.h"
|
||||
|
||||
#include "BKE_node.h"
|
||||
|
||||
/* for FOREACH_NODETREE_BEGIN */
|
||||
#include "DNA_node_types.h"
|
||||
|
||||
#include "RNA_types.h"
|
||||
|
||||
#include "BLI_map.hh"
|
||||
#include "BLI_string_ref.hh"
|
||||
|
||||
namespace blender::bke {
|
||||
|
||||
bNodeTree *ntreeAddTreeEmbedded(Main *bmain, ID *owner_id, const char *name, const char *idname);
|
||||
|
||||
/* Copy/free functions, need to manage ID users. */
|
||||
|
||||
/**
|
||||
* Free (or release) any data used by this node-tree.
|
||||
* Does not free the node-tree itself and does no ID user counting.
|
||||
*/
|
||||
void ntreeFreeTree(bNodeTree *ntree);
|
||||
|
||||
bNodeTree *ntreeCopyTree_ex(const bNodeTree *ntree, Main *bmain, bool do_id_user);
|
||||
bNodeTree *ntreeCopyTree(Main *bmain, const bNodeTree *ntree);
|
||||
|
||||
void ntreeFreeLocalNode(bNodeTree *ntree, bNode *node);
|
||||
|
||||
bNode *ntreeFindType(bNodeTree *ntree, int type);
|
||||
|
||||
void ntreeUpdateAllNew(Main *main);
|
||||
|
||||
void ntreeNodeFlagSet(const bNodeTree *ntree, int flag, bool enable);
|
||||
|
||||
/**
|
||||
* Merge local tree results back, and free local tree.
|
||||
*
|
||||
* We have to assume the editor already changed completely.
|
||||
*/
|
||||
void ntreeLocalMerge(Main *bmain, bNodeTree *localtree, bNodeTree *ntree);
|
||||
|
||||
/**
|
||||
* \note `ntree` itself has been read!
|
||||
*/
|
||||
void ntreeBlendReadData(BlendDataReader *reader, ID *owner_id, bNodeTree *ntree);
|
||||
void ntreeBlendReadLib(BlendLibReader *reader, bNodeTree *ntree);
|
||||
|
||||
void ntreeBlendReadExpand(BlendExpander *expander, bNodeTree *ntree);
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Node Tree Interface
|
||||
* \{ */
|
||||
|
||||
bNodeSocket *ntreeFindSocketInterface(bNodeTree *ntree,
|
||||
eNodeSocketInOut in_out,
|
||||
const char *identifier);
|
||||
|
||||
bNodeSocket *ntreeInsertSocketInterface(bNodeTree *ntree,
|
||||
eNodeSocketInOut in_out,
|
||||
const char *idname,
|
||||
bNodeSocket *next_sock,
|
||||
const char *name);
|
||||
|
||||
bNodeSocket *ntreeAddSocketInterfaceFromSocket(bNodeTree *ntree,
|
||||
const bNode *from_node,
|
||||
const bNodeSocket *from_sock);
|
||||
|
||||
bNodeSocket *ntreeAddSocketInterfaceFromSocketWithName(bNodeTree *ntree,
|
||||
const bNode *from_node,
|
||||
const bNodeSocket *from_sock,
|
||||
const char *idname,
|
||||
const char *name);
|
||||
|
||||
bNodeSocket *ntreeInsertSocketInterfaceFromSocket(bNodeTree *ntree,
|
||||
bNodeSocket *next_sock,
|
||||
const bNode *from_node,
|
||||
const bNodeSocket *from_sock);
|
||||
|
||||
/** \} */
|
||||
|
||||
bool node_type_is_undefined(const bNode *node);
|
||||
|
||||
bool nodeIsStaticSocketType(const bNodeSocketType *stype);
|
||||
|
||||
const char *nodeSocketSubTypeLabel(int subtype);
|
||||
|
||||
void nodeRemoveSocketEx(bNodeTree *ntree, bNode *node, bNodeSocket *sock, bool do_id_user);
|
||||
|
||||
void nodeRemoveAllSockets(bNodeTree *ntree, bNode *node);
|
||||
|
||||
void nodeModifySocketType(bNodeTree *ntree, bNode *node, bNodeSocket *sock, const char *idname);
|
||||
|
||||
/**
|
||||
* \note Goes over entire tree.
|
||||
*/
|
||||
void nodeUnlinkNode(bNodeTree *ntree, bNode *node);
|
||||
|
||||
/**
|
||||
* Rebuild the `node_by_id` runtime vector set. Call after removing a node if not handled
|
||||
* separately. This is important instead of just using `nodes_by_id.remove()` since it maintains
|
||||
* the node order.
|
||||
*/
|
||||
void nodeRebuildIDVector(bNodeTree *node_tree);
|
||||
|
||||
/**
|
||||
* \note keeps socket list order identical, for copying links.
|
||||
* \param use_unique: If true, make sure the node's identifier and name are unique in the new
|
||||
* tree. Must be *true* if the \a dst_tree had nodes that weren't in the source node's tree.
|
||||
* Must be *false* when simply copying a node tree, so that identifiers don't change.
|
||||
*/
|
||||
bNode *node_copy_with_mapping(bNodeTree *dst_tree,
|
||||
const bNode &node_src,
|
||||
int flag,
|
||||
bool use_unique,
|
||||
Map<const bNodeSocket *, bNodeSocket *> &new_socket_map);
|
||||
|
||||
bNode *node_copy(bNodeTree *dst_tree, const bNode &src_node, int flag, bool use_unique);
|
||||
|
||||
/**
|
||||
* Move socket default from \a src (input socket) to locations specified by \a dst (output socket).
|
||||
* Result value moved in specific location. (potentially multiple group nodes socket values, if \a
|
||||
* dst is a group input node).
|
||||
* \note Conceptually, the effect should be such that the evaluation of
|
||||
* this graph again returns the value in src.
|
||||
*/
|
||||
void node_socket_move_default_value(Main &bmain,
|
||||
bNodeTree &tree,
|
||||
bNodeSocket &src,
|
||||
bNodeSocket &dst);
|
||||
|
||||
/**
|
||||
* Free the node itself.
|
||||
*
|
||||
* \note ID user reference-counting and changing the `nodes_by_id` vector are up to the caller.
|
||||
*/
|
||||
void node_free_node(bNodeTree *tree, bNode *node);
|
||||
|
||||
/**
|
||||
* Set the mute status of a single link.
|
||||
*/
|
||||
void nodeLinkSetMute(bNodeTree *ntree, bNodeLink *link, const bool muted);
|
||||
|
||||
bool nodeLinkIsSelected(const bNodeLink *link);
|
||||
|
||||
void nodeInternalRelink(bNodeTree *ntree, bNode *node);
|
||||
|
||||
void nodeToView(const bNode *node, float x, float y, float *rx, float *ry);
|
||||
|
||||
void nodeFromView(const bNode *node, float x, float y, float *rx, float *ry);
|
||||
|
||||
void nodePositionRelative(bNode *from_node,
|
||||
const bNode *to_node,
|
||||
const bNodeSocket *from_sock,
|
||||
const bNodeSocket *to_sock);
|
||||
|
||||
void nodePositionPropagate(bNode *node);
|
||||
|
||||
/**
|
||||
* \note Recursive.
|
||||
*/
|
||||
bNode *nodeFindRootParent(bNode *node);
|
||||
|
||||
/**
|
||||
* Iterate over a chain of nodes, starting with \a node_start, executing
|
||||
* \a callback for each node (which can return false to end iterator).
|
||||
*
|
||||
* \param reversed: for backwards iteration
|
||||
* \note Recursive
|
||||
*/
|
||||
void nodeChainIter(const bNodeTree *ntree,
|
||||
const bNode *node_start,
|
||||
bool (*callback)(bNode *, bNode *, void *, const bool),
|
||||
void *userdata,
|
||||
bool reversed);
|
||||
|
||||
/**
|
||||
* Iterate over a chain of nodes, starting with \a node_start, executing
|
||||
* \a callback for each node (which can return false to end iterator).
|
||||
*
|
||||
* Faster than nodeChainIter. Iter only once per node.
|
||||
* Can be called recursively (using another nodeChainIterBackwards) by
|
||||
* setting the recursion_lvl accordingly.
|
||||
*
|
||||
* \note Needs updated socket links (ntreeUpdateTree).
|
||||
* \note Recursive
|
||||
*/
|
||||
void nodeChainIterBackwards(const bNodeTree *ntree,
|
||||
const bNode *node_start,
|
||||
bool (*callback)(bNode *, bNode *, void *),
|
||||
void *userdata,
|
||||
int recursion_lvl);
|
||||
|
||||
/**
|
||||
* Iterate over all parents of \a node, executing \a callback for each parent
|
||||
* (which can return false to end iterator)
|
||||
*
|
||||
* \note Recursive
|
||||
*/
|
||||
void nodeParentsIter(bNode *node, bool (*callback)(bNode *, void *), void *userdata);
|
||||
|
||||
/**
|
||||
* A dangling reroute node is a reroute node that does *not* have a "data source", i.e. no
|
||||
* non-reroute node is connected to its input.
|
||||
*/
|
||||
bool nodeIsDanglingReroute(const struct bNodeTree *ntree, const struct bNode *node);
|
||||
|
||||
struct bNodeLink *nodeFindLink(struct bNodeTree *ntree,
|
||||
const struct bNodeSocket *from,
|
||||
const struct bNodeSocket *to);
|
||||
|
||||
struct bNode *nodeGetActivePaintCanvas(struct bNodeTree *ntree);
|
||||
|
||||
/**
|
||||
* \brief Does the given node supports the sub active flag.
|
||||
*
|
||||
* \param sub_active: The active flag to check. #NODE_ACTIVE_TEXTURE / #NODE_ACTIVE_PAINT_CANVAS.
|
||||
*/
|
||||
bool nodeSupportsActiveFlag(const struct bNode *node, int sub_active);
|
||||
|
||||
void nodeSetSocketAvailability(struct bNodeTree *ntree,
|
||||
struct bNodeSocket *sock,
|
||||
bool is_available);
|
||||
|
||||
/**
|
||||
* If the node implements a `declare` function, this function makes sure that `node->declaration`
|
||||
* is up to date. It is expected that the sockets of the node are up to date already.
|
||||
*/
|
||||
bool nodeDeclarationEnsure(struct bNodeTree *ntree, struct bNode *node);
|
||||
|
||||
/**
|
||||
* Just update `node->declaration` if necessary. This can also be called on nodes that may not be
|
||||
* up to date (e.g. because the need versioning or are dynamic).
|
||||
*/
|
||||
bool nodeDeclarationEnsureOnOutdatedNode(struct bNodeTree *ntree, struct bNode *node);
|
||||
|
||||
/**
|
||||
* Update `socket->declaration` for all sockets in the node. This assumes that the node declaration
|
||||
* and sockets are up to date already.
|
||||
*/
|
||||
void nodeSocketDeclarationsUpdate(struct bNode *node);
|
||||
|
||||
typedef GHashIterator bNodeInstanceHashIterator;
|
||||
|
||||
BLI_INLINE bNodeInstanceHashIterator *node_instance_hash_iterator_new(bNodeInstanceHash *hash)
|
||||
{
|
||||
return BLI_ghashIterator_new(hash->ghash);
|
||||
}
|
||||
|
||||
BLI_INLINE void node_instance_hash_iterator_init(bNodeInstanceHashIterator *iter,
|
||||
bNodeInstanceHash *hash)
|
||||
{
|
||||
BLI_ghashIterator_init(iter, hash->ghash);
|
||||
}
|
||||
|
||||
BLI_INLINE void node_instance_hash_iterator_free(bNodeInstanceHashIterator *iter)
|
||||
{
|
||||
BLI_ghashIterator_free(iter);
|
||||
}
|
||||
|
||||
BLI_INLINE bNodeInstanceKey node_instance_hash_iterator_get_key(bNodeInstanceHashIterator *iter)
|
||||
{
|
||||
return *(bNodeInstanceKey *)BLI_ghashIterator_getKey(iter);
|
||||
}
|
||||
|
||||
BLI_INLINE void *node_instance_hash_iterator_get_value(bNodeInstanceHashIterator *iter)
|
||||
{
|
||||
return BLI_ghashIterator_getValue(iter);
|
||||
}
|
||||
|
||||
BLI_INLINE void node_instance_hash_iterator_step(bNodeInstanceHashIterator *iter)
|
||||
{
|
||||
BLI_ghashIterator_step(iter);
|
||||
}
|
||||
|
||||
BLI_INLINE bool node_instance_hash_iterator_done(bNodeInstanceHashIterator *iter)
|
||||
{
|
||||
return BLI_ghashIterator_done(iter);
|
||||
}
|
||||
|
||||
#define NODE_INSTANCE_HASH_ITER(iter_, hash_) \
|
||||
for (blender::bke::node_instance_hash_iterator_init(&iter_, hash_); \
|
||||
blender::bke::node_instance_hash_iterator_done(&iter_) == false; \
|
||||
blender::bke::node_instance_hash_iterator_step(&iter_))
|
||||
|
||||
/* Node Previews */
|
||||
bool node_preview_used(const bNode *node);
|
||||
|
||||
bNodePreview *node_preview_verify(
|
||||
bNodeInstanceHash *previews, bNodeInstanceKey key, int xsize, int ysize, bool create);
|
||||
|
||||
bNodePreview *node_preview_copy(bNodePreview *preview);
|
||||
|
||||
void node_preview_free(bNodePreview *preview);
|
||||
|
||||
void node_preview_init_tree(bNodeTree *ntree, int xsize, int ysize);
|
||||
|
||||
void node_preview_remove_unused(bNodeTree *ntree);
|
||||
|
||||
void node_preview_clear(bNodePreview *preview);
|
||||
|
||||
void node_preview_merge_tree(bNodeTree *to_ntree, bNodeTree *from_ntree, bool remove_old);
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Node Type Access
|
||||
* \{ */
|
||||
void nodeLabel(const bNodeTree *ntree, const bNode *node, char *label, int maxlen);
|
||||
|
||||
/**
|
||||
* Get node socket label if it is set.
|
||||
*/
|
||||
const char *nodeSocketLabel(const bNodeSocket *sock);
|
||||
|
||||
/**
|
||||
* Initialize a new node type struct with default values and callbacks.
|
||||
*/
|
||||
void node_type_base(bNodeType *ntype, int type, const char *name, short nclass);
|
||||
|
||||
void node_type_socket_templates(bNodeType *ntype,
|
||||
bNodeSocketTemplate *inputs,
|
||||
bNodeSocketTemplate *outputs);
|
||||
|
||||
void node_type_size(bNodeType *ntype, int width, int minwidth, int maxwidth);
|
||||
|
||||
enum class eNodeSizePreset : int8_t {
|
||||
DEFAULT,
|
||||
SMALL,
|
||||
MIDDLE,
|
||||
LARGE,
|
||||
};
|
||||
|
||||
void node_type_size_preset(bNodeType *ntype, eNodeSizePreset size);
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Node Generic Functions
|
||||
* \{ */
|
||||
|
||||
bool node_is_connected_to_output(const struct bNodeTree *ntree, const struct bNode *node);
|
||||
|
||||
bNodeSocket *node_find_enabled_socket(bNode &node, eNodeSocketInOut in_out, StringRef name);
|
||||
|
||||
bNodeSocket *node_find_enabled_input_socket(bNode &node, StringRef name);
|
||||
|
||||
bNodeSocket *node_find_enabled_output_socket(bNode &node, StringRef name);
|
||||
|
||||
extern bNodeTreeType NodeTreeTypeUndefined;
|
||||
extern bNodeType NodeTypeUndefined;
|
||||
extern bNodeSocketType NodeSocketTypeUndefined;
|
||||
|
||||
} // namespace blender::bke
|
||||
|
||||
#define NODE_STORAGE_FUNCS(StorageT) \
|
||||
[[maybe_unused]] static StorageT &node_storage(bNode &node) \
|
||||
{ \
|
||||
return *static_cast<StorageT *>(node.storage); \
|
||||
} \
|
||||
[[maybe_unused]] static const StorageT &node_storage(const bNode &node) \
|
||||
{ \
|
||||
return *static_cast<const StorageT *>(node.storage); \
|
||||
}
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#include "DNA_node_types.h"
|
||||
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
|
||||
struct bNode;
|
||||
struct bNodeSocket;
|
||||
|
|
|
@ -1733,7 +1733,8 @@ static void sizelimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *U
|
|||
float obsize[3], size[3];
|
||||
|
||||
mat4_to_size(size, cob->matrix);
|
||||
mat4_to_size(obsize, cob->matrix);
|
||||
|
||||
copy_v3_v3(obsize, size);
|
||||
|
||||
if (data->flag & LIMIT_XMIN) {
|
||||
if (size[0] < data->xmin) {
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
#include "BKE_image_format.h"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_node_tree_update.h"
|
||||
#include "BKE_packedFile.h"
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "BKE_layer.h"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_object.h"
|
||||
|
||||
#include "DNA_ID.h"
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "BKE_lib_remap.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_main_namemap.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_report.h"
|
||||
#include "BKE_scene.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "BKE_lib_remap.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_mesh.hh"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_scene.h"
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include "BKE_lib_query.h"
|
||||
#include "BKE_linestyle.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_tree_update.h"
|
||||
#include "BKE_texture.h"
|
||||
|
||||
|
@ -2038,7 +2038,8 @@ void BKE_linestyle_default_shader(const bContext *C, FreestyleLineStyle *linesty
|
|||
|
||||
BLI_assert(linestyle->nodetree == nullptr);
|
||||
|
||||
ntree = ntreeAddTreeEmbedded(nullptr, &linestyle->id, "stroke_shader", "ShaderNodeTree");
|
||||
ntree = blender::bke::ntreeAddTreeEmbedded(
|
||||
nullptr, &linestyle->id, "stroke_shader", "ShaderNodeTree");
|
||||
|
||||
uv_along_stroke = nodeAddStaticNode(C, ntree, SH_NODE_UVALONGSTROKE);
|
||||
uv_along_stroke->locx = 0.0f;
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
#include "BKE_main.h"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_mesh.hh"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_scene.h"
|
||||
|
@ -1560,7 +1560,7 @@ void BKE_texpaint_slot_refresh_cache(Scene *scene, Material *ma, const struct Ob
|
|||
ma->texpaintslot = static_cast<TexPaintSlot *>(
|
||||
MEM_callocN(sizeof(TexPaintSlot) * count, "texpaint_slots"));
|
||||
|
||||
bNode *active_node = nodeGetActivePaintCanvas(ma->nodetree);
|
||||
bNode *active_node = blender::bke::nodeGetActivePaintCanvas(ma->nodetree);
|
||||
|
||||
fill_texpaint_slots_recursive(ma->nodetree, active_node, ob, ma, count, slot_filter);
|
||||
|
||||
|
@ -1932,7 +1932,7 @@ void BKE_material_copybuf_copy(Main *bmain, Material *ma)
|
|||
matcopybuf = blender::dna::shallow_copy(*ma);
|
||||
|
||||
if (ma->nodetree != nullptr) {
|
||||
matcopybuf.nodetree = ntreeCopyTree_ex(ma->nodetree, bmain, false);
|
||||
matcopybuf.nodetree = blender::bke::ntreeCopyTree_ex(ma->nodetree, bmain, false);
|
||||
}
|
||||
|
||||
matcopybuf.preview = nullptr;
|
||||
|
@ -1962,7 +1962,7 @@ void BKE_material_copybuf_paste(Main *bmain, Material *ma)
|
|||
(ma->id) = id;
|
||||
|
||||
if (matcopybuf.nodetree != nullptr) {
|
||||
ma->nodetree = ntreeCopyTree_ex(matcopybuf.nodetree, bmain, false);
|
||||
ma->nodetree = blender::bke::ntreeCopyTree_ex(matcopybuf.nodetree, bmain, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2001,7 +2001,7 @@ static void material_default_surface_init(Material *ma)
|
|||
{
|
||||
strcpy(ma->id.name, "MADefault Surface");
|
||||
|
||||
bNodeTree *ntree = ntreeAddTreeEmbedded(
|
||||
bNodeTree *ntree = blender::bke::ntreeAddTreeEmbedded(
|
||||
nullptr, &ma->id, "Shader Nodetree", ntreeType_Shader->idname);
|
||||
ma->use_nodes = true;
|
||||
|
||||
|
@ -2029,7 +2029,7 @@ static void material_default_volume_init(Material *ma)
|
|||
{
|
||||
strcpy(ma->id.name, "MADefault Volume");
|
||||
|
||||
bNodeTree *ntree = ntreeAddTreeEmbedded(
|
||||
bNodeTree *ntree = blender::bke::ntreeAddTreeEmbedded(
|
||||
nullptr, &ma->id, "Shader Nodetree", ntreeType_Shader->idname);
|
||||
ma->use_nodes = true;
|
||||
|
||||
|
@ -2054,7 +2054,7 @@ static void material_default_holdout_init(Material *ma)
|
|||
{
|
||||
strcpy(ma->id.name, "MADefault Holdout");
|
||||
|
||||
bNodeTree *ntree = ntreeAddTreeEmbedded(
|
||||
bNodeTree *ntree = blender::bke::ntreeAddTreeEmbedded(
|
||||
nullptr, &ma->id, "Shader Nodetree", ntreeType_Shader->idname);
|
||||
ma->use_nodes = true;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_runtime.hh"
|
||||
|
||||
#include "DNA_node_types.h"
|
||||
|
@ -39,7 +39,7 @@ static void update_node_vector(const bNodeTree &ntree)
|
|||
bNode &node = *nodes[i];
|
||||
node.runtime->index_in_tree = i;
|
||||
node.runtime->owner_tree = const_cast<bNodeTree *>(&ntree);
|
||||
tree_runtime.has_undefined_nodes_or_sockets |= node.typeinfo == &NodeTypeUndefined;
|
||||
tree_runtime.has_undefined_nodes_or_sockets |= node.typeinfo == &bke::NodeTypeUndefined;
|
||||
if (node.is_group()) {
|
||||
tree_runtime.group_nodes.append(&node);
|
||||
}
|
||||
|
@ -75,7 +75,8 @@ static void update_socket_vectors_and_owner_node(const bNodeTree &ntree)
|
|||
socket->runtime->index_in_inout_sockets = tree_runtime.input_sockets.append_and_get_index(
|
||||
socket);
|
||||
socket->runtime->owner_node = node;
|
||||
tree_runtime.has_undefined_nodes_or_sockets |= socket->typeinfo == &NodeSocketTypeUndefined;
|
||||
tree_runtime.has_undefined_nodes_or_sockets |= socket->typeinfo ==
|
||||
&bke::NodeSocketTypeUndefined;
|
||||
}
|
||||
LISTBASE_FOREACH (bNodeSocket *, socket, &node->outputs) {
|
||||
socket->runtime->index_in_node = node_runtime.outputs.append_and_get_index(socket);
|
||||
|
@ -83,7 +84,8 @@ static void update_socket_vectors_and_owner_node(const bNodeTree &ntree)
|
|||
socket->runtime->index_in_inout_sockets = tree_runtime.output_sockets.append_and_get_index(
|
||||
socket);
|
||||
socket->runtime->owner_node = node;
|
||||
tree_runtime.has_undefined_nodes_or_sockets |= socket->typeinfo == &NodeSocketTypeUndefined;
|
||||
tree_runtime.has_undefined_nodes_or_sockets |= socket->typeinfo ==
|
||||
&bke::NodeSocketTypeUndefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_runtime.hh"
|
||||
|
||||
#include "NOD_node_declaration.hh"
|
||||
|
@ -41,7 +41,7 @@ static InputSocketFieldType get_interface_input_field_type(const bNode &node,
|
|||
/* Outputs always support fields when the data type is correct. */
|
||||
return InputSocketFieldType::IsSupported;
|
||||
}
|
||||
if (node.typeinfo == &NodeTypeUndefined) {
|
||||
if (node.typeinfo == &blender::bke::NodeTypeUndefined) {
|
||||
return InputSocketFieldType::None;
|
||||
}
|
||||
if (node.type == NODE_CUSTOM) {
|
||||
|
@ -75,7 +75,7 @@ static OutputFieldDependency get_interface_output_field_dependency(const bNode &
|
|||
/* Input nodes get special treatment in #determine_group_input_states. */
|
||||
return OutputFieldDependency::ForDependentField();
|
||||
}
|
||||
if (node.typeinfo == &NodeTypeUndefined) {
|
||||
if (node.typeinfo == &blender::bke::NodeTypeUndefined) {
|
||||
return OutputFieldDependency::ForDataSource();
|
||||
}
|
||||
if (node.type == NODE_CUSTOM) {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "BKE_anim_data.h"
|
||||
#include "BKE_image.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_node_tree_update.h"
|
||||
|
||||
|
@ -540,7 +540,7 @@ class NodeTreeMainUpdater {
|
|||
void update_individual_nodes(bNodeTree &ntree)
|
||||
{
|
||||
for (bNode *node : ntree.all_nodes()) {
|
||||
nodeDeclarationEnsure(&ntree, node);
|
||||
blender::bke::nodeDeclarationEnsure(&ntree, node);
|
||||
if (this->should_update_individual_node(ntree, *node)) {
|
||||
bNodeType &ntype = *node->typeinfo;
|
||||
if (ntype.group_update_func) {
|
||||
|
@ -701,7 +701,7 @@ class NodeTreeMainUpdater {
|
|||
if ((ntree.runtime->changed_flag & allowed_flags) == ntree.runtime->changed_flag) {
|
||||
return;
|
||||
}
|
||||
BKE_node_preview_remove_unused(&ntree);
|
||||
blender::bke::node_preview_remove_unused(&ntree);
|
||||
}
|
||||
|
||||
void propagate_runtime_flags(const bNodeTree &ntree)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_node_tree_zones.hh"
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@
|
|||
#include "BKE_mesh_wrapper.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_multires.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_object_facemap.h"
|
||||
#include "BKE_paint.h"
|
||||
|
|
|
@ -335,7 +335,7 @@ int BKE_packedfile_write_to_file(ReportList *reports,
|
|||
|
||||
if (remove_tmp) {
|
||||
if (ret_value == RET_ERROR) {
|
||||
if (BLI_rename(filepath_temp, filepath) != 0) {
|
||||
if (BLI_rename_overwrite(filepath_temp, filepath) != 0) {
|
||||
BKE_reportf(reports,
|
||||
RPT_ERROR,
|
||||
"Error restoring temp file (check files '%s' '%s')",
|
||||
|
|
|
@ -3531,7 +3531,7 @@ void BKE_ptcache_disk_cache_rename(PTCacheID *pid, const char *name_src, const c
|
|||
if (frame != -1) {
|
||||
BLI_path_join(old_path_full, sizeof(old_path_full), path, de->d_name);
|
||||
ptcache_filepath(pid, new_path_full, frame, true, true);
|
||||
BLI_rename(old_path_full, new_path_full);
|
||||
BLI_rename_overwrite(old_path_full, new_path_full);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
#include "BKE_linestyle.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_mask.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_paint.h"
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "BKE_lib_query.h"
|
||||
#include "BKE_lib_remap.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_pointcache.h"
|
||||
#include "BKE_simulation.h"
|
||||
|
||||
|
@ -51,7 +51,7 @@ static void simulation_init_data(ID *id)
|
|||
|
||||
MEMCPY_STRUCT_AFTER(simulation, DNA_struct_default_get(Simulation), id);
|
||||
|
||||
ntreeAddTreeEmbedded(nullptr, id, "Geometry Nodetree", ntreeType_Geometry->idname);
|
||||
blender::bke::ntreeAddTreeEmbedded(nullptr, id, "Geometry Nodetree", ntreeType_Geometry->idname);
|
||||
}
|
||||
|
||||
static void simulation_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int flag)
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#include "BKE_lib_id.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_texture.h"
|
||||
|
|
|
@ -39,10 +39,29 @@ extern "C" {
|
|||
*/
|
||||
int BLI_exists(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
||||
int BLI_copy(const char *file, const char *to) ATTR_NONNULL();
|
||||
|
||||
/**
|
||||
* Rename a file or directory.
|
||||
*
|
||||
* \return zero on success (matching 'rename' behavior).
|
||||
*/
|
||||
int BLI_rename(const char *from, const char *to) ATTR_NONNULL();
|
||||
int BLI_rename(const char *from, const char *to);
|
||||
|
||||
/**
|
||||
* Rename a file or directory.
|
||||
*
|
||||
* \warning It's up to the caller to ensure `from` & `to` don't point to the same file
|
||||
* as this will result in `to` being deleted to make room for `from`
|
||||
* (which will then also be deleted).
|
||||
*
|
||||
* See #BLI_path_move to move directories.
|
||||
*
|
||||
* \param from: The path to rename from (return failure if it does not exist).
|
||||
* \param to: The destination path.
|
||||
* This will be deleted if it already exists, unless it's a directory which will fail.
|
||||
* \return zero on success (matching 'rename' behavior).
|
||||
*/
|
||||
int BLI_rename_overwrite(const char *from, const char *to) ATTR_NONNULL();
|
||||
/**
|
||||
* Deletes the specified file or directory (depending on dir), optionally
|
||||
* doing recursive delete of directory contents.
|
||||
|
|
|
@ -624,7 +624,11 @@ int BLI_string_find_split_words(const char *str,
|
|||
*/
|
||||
void BLI_string_debug_size_after_nil(char *str, size_t str_maxncpy);
|
||||
#else
|
||||
# define BLI_string_debug_size(str, str_maxncpy) (void)(0 ? ((str) + (str_maxncpy)) : 0)
|
||||
# define BLI_string_debug_size(str, str_maxncpy) \
|
||||
if (0) { \
|
||||
(void)str, (void)str_maxncpy; \
|
||||
} \
|
||||
((void)0)
|
||||
# define BLI_string_debug_size_after_nil(str, str_maxncpy) BLI_string_debug_size(str, str_maxncpy)
|
||||
#endif /* !WITH_STRSIZE_DEBUG */
|
||||
|
||||
|
|
|
@ -379,6 +379,43 @@ bool BLI_file_ensure_parent_dir_exists(const char *filepath)
|
|||
return BLI_dir_create_recursive(di);
|
||||
}
|
||||
|
||||
int BLI_rename(const char *from, const char *to)
|
||||
{
|
||||
#ifdef WIN32
|
||||
return urename(from, to);
|
||||
#else
|
||||
return rename(from, to);
|
||||
#endif
|
||||
}
|
||||
|
||||
int BLI_rename_overwrite(const char *from, const char *to)
|
||||
{
|
||||
if (!BLI_exists(from)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* NOTE(@ideasman42): there are no checks that `from` & `to` *aren't* the same file.
|
||||
* It's up to the caller to ensure this. In practice these paths are often generated
|
||||
* and known to be different rather than arbitrary user input.
|
||||
* In the case of arbitrary paths (renaming a file in the file-selector for example),
|
||||
* the caller must ensure file renaming doesn't cause user data loss.
|
||||
*
|
||||
* Support for checking the files aren't the same could be added, however path comparison
|
||||
* alone is *not* a guarantee the files are different (given the possibility of accessing
|
||||
* the same file through different paths via symbolic-links), we could instead support a
|
||||
* verizon of Python's * `os.path.samefile(..)` which compares the I-node & device.
|
||||
* In this particular case we would not want to follow symbolic-links as well.
|
||||
* Since this functionality isn't required at the moment, leave this as-is.
|
||||
* Noting it as a potential improvement. */
|
||||
if (BLI_exists(to)) {
|
||||
if (BLI_delete(to, false, false)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return BLI_rename(from, to);
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
static void callLocalErrorCallBack(const char *err)
|
||||
|
@ -691,23 +728,6 @@ int BLI_create_symlink(const char *file, const char *to)
|
|||
}
|
||||
# endif
|
||||
|
||||
/** \return true on success (i.e. given path now exists on FS), false otherwise. */
|
||||
int BLI_rename(const char *from, const char *to)
|
||||
{
|
||||
if (!BLI_exists(from)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Make sure `from` & `to` are different (case insensitive) before removing. */
|
||||
if (BLI_exists(to) && BLI_strcasecmp(from, to)) {
|
||||
if (BLI_delete(to, false, false)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return urename(from, to);
|
||||
}
|
||||
|
||||
#else /* The UNIX world */
|
||||
|
||||
/* results from recursive_operation and its callbacks */
|
||||
|
@ -1323,19 +1343,4 @@ int BLI_create_symlink(const char *file, const char *to)
|
|||
}
|
||||
# endif
|
||||
|
||||
int BLI_rename(const char *from, const char *to)
|
||||
{
|
||||
if (!BLI_exists(from)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (BLI_exists(to)) {
|
||||
if (BLI_delete(to, false, false)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return rename(from, to);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -602,30 +602,12 @@ void BLI_file_free_lines(LinkNode *lines)
|
|||
|
||||
bool BLI_file_older(const char *file1, const char *file2)
|
||||
{
|
||||
#ifdef WIN32
|
||||
struct _stat st1, st2;
|
||||
|
||||
UTF16_ENCODE(file1);
|
||||
UTF16_ENCODE(file2);
|
||||
|
||||
if (_wstat(file1_16, &st1)) {
|
||||
BLI_stat_t st1, st2;
|
||||
if (BLI_stat(file1, &st1)) {
|
||||
return false;
|
||||
}
|
||||
if (_wstat(file2_16, &st2)) {
|
||||
if (BLI_stat(file2, &st2)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
UTF16_UN_ENCODE(file2);
|
||||
UTF16_UN_ENCODE(file1);
|
||||
#else
|
||||
struct stat st1, st2;
|
||||
|
||||
if (stat(file1, &st1)) {
|
||||
return false;
|
||||
}
|
||||
if (stat(file2, &st2)) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
return (st1.st_mtime < st2.st_mtime);
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
#include "BKE_material.h"
|
||||
#include "BKE_mesh.hh"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_node.h" /* for tree type defines */
|
||||
#include "BKE_node.hh" /* for tree type defines */
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_packedFile.h"
|
||||
#include "BKE_report.h"
|
||||
|
@ -1844,7 +1844,7 @@ static void lib_link_id_embedded_id(BlendLibReader *reader, ID *id)
|
|||
bNodeTree *nodetree = ntreeFromID(id);
|
||||
if (nodetree != nullptr) {
|
||||
lib_link_id(reader, &nodetree->id);
|
||||
ntreeBlendReadLib(reader, nodetree);
|
||||
blender::bke::ntreeBlendReadLib(reader, nodetree);
|
||||
}
|
||||
|
||||
if (GS(id->name) == ID_SCE) {
|
||||
|
@ -1915,7 +1915,7 @@ static void direct_link_id_embedded_id(BlendDataReader *reader,
|
|||
(ID *)*nodetree,
|
||||
id_old != nullptr ? (ID *)ntreeFromID(id_old) : nullptr,
|
||||
0);
|
||||
ntreeBlendReadData(reader, id, *nodetree);
|
||||
blender::bke::ntreeBlendReadData(reader, id, *nodetree);
|
||||
}
|
||||
|
||||
if (GS(id->name) == ID_SCE) {
|
||||
|
@ -3950,7 +3950,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
|
|||
/* After all data has been read and versioned, uses LIB_TAG_NEW. Theoretically this should
|
||||
* not be calculated in the undo case, but it is currently needed even on undo to recalculate
|
||||
* a cache. */
|
||||
ntreeUpdateAllNew(bfd->main);
|
||||
blender::bke::ntreeUpdateAllNew(bfd->main);
|
||||
|
||||
placeholders_ensure_valid(bfd->main);
|
||||
|
||||
|
@ -4287,7 +4287,7 @@ static void expand_id_embedded_id(BlendExpander *expander, ID *id)
|
|||
bNodeTree *nodetree = ntreeFromID(id);
|
||||
if (nodetree != nullptr) {
|
||||
expand_id(expander, &nodetree->id);
|
||||
ntreeBlendReadExpand(expander, nodetree);
|
||||
blender::bke::ntreeBlendReadExpand(expander, nodetree);
|
||||
}
|
||||
|
||||
if (GS(id->name) == ID_SCE) {
|
||||
|
@ -4606,7 +4606,7 @@ static void library_link_end(Main *mainl, FileData **fd, const int flag)
|
|||
BKE_main_id_refcount_recompute(mainvar, false);
|
||||
|
||||
/* After all data has been read and versioned, uses LIB_TAG_NEW. */
|
||||
ntreeUpdateAllNew(mainvar);
|
||||
blender::bke::ntreeUpdateAllNew(mainvar);
|
||||
|
||||
placeholders_ensure_valid(mainvar);
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#include "BKE_mesh.hh"
|
||||
#include "BKE_mesh_legacy_convert.h"
|
||||
#include "BKE_multires.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
|
||||
#include "IMB_imbuf.h"
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
#include "BKE_main_namemap.h"
|
||||
#include "BKE_mesh.hh"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_workspace.h"
|
||||
|
||||
|
@ -940,7 +940,7 @@ static void version_geometry_nodes_primitive_uv_maps(bNodeTree &ntree)
|
|||
BLI_addhead(&ntree.nodes, node);
|
||||
}
|
||||
if (!new_nodes.is_empty()) {
|
||||
nodeRebuildIDVector(&ntree);
|
||||
blender::bke::nodeRebuildIDVector(&ntree);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1074,7 +1074,7 @@ static void version_geometry_nodes_extrude_smooth_propagation(bNodeTree &ntree)
|
|||
BLI_addhead(&ntree.nodes, node);
|
||||
}
|
||||
if (!new_nodes.is_empty()) {
|
||||
nodeRebuildIDVector(&ntree);
|
||||
blender::bke::nodeRebuildIDVector(&ntree);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "BKE_lib_id.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_main_namemap.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_runtime.hh"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
#include "BKE_main_namemap.h"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_mesh.hh"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_node_tree_update.h"
|
||||
#include "BKE_paint.h"
|
||||
|
|
|
@ -104,7 +104,7 @@
|
|||
#include "BKE_lib_override.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_packedFile.h"
|
||||
#include "BKE_report.h"
|
||||
#include "BKE_workspace.h"
|
||||
|
@ -1383,7 +1383,7 @@ static bool do_history(const char *name, ReportList *reports)
|
|||
if (BLI_exists(tempname1)) {
|
||||
SNPRINTF(tempname2, "%s%d", name, hisnr);
|
||||
|
||||
if (BLI_rename(tempname1, tempname2)) {
|
||||
if (BLI_rename_overwrite(tempname1, tempname2)) {
|
||||
BKE_report(reports, RPT_ERROR, "Unable to make version backup");
|
||||
return true;
|
||||
}
|
||||
|
@ -1395,7 +1395,7 @@ static bool do_history(const char *name, ReportList *reports)
|
|||
if (BLI_exists(name)) {
|
||||
SNPRINTF(tempname1, "%s%d", name, hisnr);
|
||||
|
||||
if (BLI_rename(name, tempname1)) {
|
||||
if (BLI_rename_overwrite(name, tempname1)) {
|
||||
BKE_report(reports, RPT_ERROR, "Unable to make version backup");
|
||||
return true;
|
||||
}
|
||||
|
@ -1562,7 +1562,7 @@ bool BLO_write_file(Main *mainvar,
|
|||
}
|
||||
}
|
||||
|
||||
if (BLI_rename(tempname, filepath) != 0) {
|
||||
if (BLI_rename_overwrite(tempname, filepath) != 0) {
|
||||
BKE_report(reports, RPT_ERROR, "Cannot change old file (file saved with @)");
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "BKE_main.h"
|
||||
#include "BKE_mball_tessellate.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_vfont.h"
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include "DNA_node_types.h"
|
||||
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
|
||||
#include "COM_NodeOperationBuilder.h"
|
||||
|
||||
|
@ -130,7 +130,7 @@ Node *COM_convert_bnode(bNode *b_node)
|
|||
Node *node = nullptr;
|
||||
|
||||
/* ignore undefined nodes with missing or invalid node data */
|
||||
if (nodeTypeUndefined(b_node)) {
|
||||
if (blender::bke::node_type_is_undefined(b_node)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
* Copyright 2011 Blender Foundation. */
|
||||
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_prototypes.h"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include "DNA_node_types.h"
|
||||
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_runtime.hh"
|
||||
|
||||
#include "COM_Converter.h"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_scene.h"
|
||||
|
||||
|
@ -37,7 +37,7 @@ static void compositor_init_node_previews(const RenderData *render_data, bNodeTr
|
|||
preview_width = int(blender::compositor::COM_PREVIEW_SIZE / aspect);
|
||||
preview_height = blender::compositor::COM_PREVIEW_SIZE;
|
||||
}
|
||||
BKE_node_preview_init_tree(node_tree, preview_width, preview_height);
|
||||
blender::bke::node_preview_init_tree(node_tree, preview_width, preview_height);
|
||||
}
|
||||
|
||||
static void compositor_reset_node_tree_status(bNodeTree *node_tree)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "COM_ConvertColorSpaceNode.h"
|
||||
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
* Copyright 2018 Blender Foundation. */
|
||||
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
|
||||
#include "NOD_composite.h"
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright 2011 Blender Foundation. */
|
||||
|
||||
#include "COM_FilterNode.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "COM_ConvolutionEdgeFilterOperation.h"
|
||||
|
||||
namespace blender::compositor {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright 2011 Blender Foundation. */
|
||||
|
||||
#include "COM_InvertNode.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "COM_InvertOperation.h"
|
||||
|
||||
namespace blender::compositor {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "COM_ScaleNode.h"
|
||||
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "COM_ScaleOperation.h"
|
||||
#include "COM_SetValueOperation.h"
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include "DNA_movieclip_types.h"
|
||||
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "COM_PreviewOperation.h"
|
||||
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "IMB_colormanagement.h"
|
||||
|
||||
namespace blender::compositor {
|
||||
|
@ -32,7 +32,7 @@ void PreviewOperation::verify_preview(bNodeInstanceHash *previews, bNodeInstance
|
|||
/* Size (0, 0) ensures the preview rect is not allocated in advance,
|
||||
* this is set later in init_execution once the resolution is determined.
|
||||
*/
|
||||
preview_ = BKE_node_preview_verify(previews, key, 0, 0, true);
|
||||
preview_ = blender::bke::node_preview_verify(previews, key, 0, 0, true);
|
||||
}
|
||||
|
||||
void PreviewOperation::init_execution()
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright 2017 Blender Foundation. */
|
||||
|
||||
#include "COM_SMAAOperation.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "COM_SMAAAreaTexture.h"
|
||||
|
||||
extern "C" {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "COM_WorkScheduler.h"
|
||||
|
||||
#include "BKE_image.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_scene.h"
|
||||
|
||||
#include "NOD_texture.h"
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "DNA_defaults.h"
|
||||
|
||||
#include "BKE_movieclip.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_tracking.h"
|
||||
|
||||
namespace blender::compositor {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include "NOD_derived_node_tree.hh"
|
||||
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_runtime.hh"
|
||||
|
||||
#include "COM_scheduler.hh"
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
#include "BKE_mesh.hh"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_movieclip.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_particle.h"
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include "BKE_layer.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
#include "DEG_depsgraph_build.h"
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
#include "BKE_material.h"
|
||||
#include "BKE_mball.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_particle.h"
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "BKE_layer.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
#include "DEG_depsgraph_build.h"
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "BKE_geometry_set.hh"
|
||||
#include "BKE_idprop.h"
|
||||
#include "BKE_layer.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_object.h"
|
||||
|
||||
#include "BLI_math.h"
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "BKE_anim_data.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_idtype.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_workspace.h"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "DRW_render.h"
|
||||
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
|
||||
#include "BLI_dynstr.h"
|
||||
#include "BLI_string_utils.h"
|
||||
|
@ -1029,7 +1029,7 @@ Material *EEVEE_material_default_diffuse_get(void)
|
|||
if (!e_data.diffuse_mat) {
|
||||
Material *ma = static_cast<Material *>(BKE_id_new_nomain(ID_MA, "EEVEEE default diffuse"));
|
||||
|
||||
bNodeTree *ntree = ntreeAddTreeEmbedded(
|
||||
bNodeTree *ntree = blender::bke::ntreeAddTreeEmbedded(
|
||||
nullptr, &ma->id, "Shader Nodetree", ntreeType_Shader->idname);
|
||||
ma->use_nodes = true;
|
||||
|
||||
|
@ -1056,7 +1056,7 @@ Material *EEVEE_material_default_glossy_get(void)
|
|||
if (!e_data.glossy_mat) {
|
||||
Material *ma = static_cast<Material *>(BKE_id_new_nomain(ID_MA, "EEVEEE default metal"));
|
||||
|
||||
bNodeTree *ntree = ntreeAddTreeEmbedded(
|
||||
bNodeTree *ntree = blender::bke::ntreeAddTreeEmbedded(
|
||||
nullptr, &ma->id, "Shader Nodetree", ntreeType_Shader->idname);
|
||||
ma->use_nodes = true;
|
||||
|
||||
|
@ -1085,7 +1085,7 @@ Material *EEVEE_material_default_error_get(void)
|
|||
if (!e_data.error_mat) {
|
||||
Material *ma = static_cast<Material *>(BKE_id_new_nomain(ID_MA, "EEVEEE default error"));
|
||||
|
||||
bNodeTree *ntree = ntreeAddTreeEmbedded(
|
||||
bNodeTree *ntree = blender::bke::ntreeAddTreeEmbedded(
|
||||
nullptr, &ma->id, "Shader Nodetree", ntreeType_Shader->idname);
|
||||
ma->use_nodes = true;
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "NOD_shader.h"
|
||||
|
||||
#include "eevee_instance.hh"
|
||||
|
@ -73,7 +73,7 @@ MaterialModule::MaterialModule(Instance &inst) : inst_(inst)
|
|||
{
|
||||
{
|
||||
diffuse_mat = (::Material *)BKE_id_new_nomain(ID_MA, "EEVEE default diffuse");
|
||||
bNodeTree *ntree = ntreeAddTreeEmbedded(
|
||||
bNodeTree *ntree = bke::ntreeAddTreeEmbedded(
|
||||
nullptr, &diffuse_mat->id, "Shader Nodetree", ntreeType_Shader->idname);
|
||||
diffuse_mat->use_nodes = true;
|
||||
/* To use the forward pipeline. */
|
||||
|
@ -95,7 +95,7 @@ MaterialModule::MaterialModule(Instance &inst) : inst_(inst)
|
|||
}
|
||||
{
|
||||
glossy_mat = (::Material *)BKE_id_new_nomain(ID_MA, "EEVEE default metal");
|
||||
bNodeTree *ntree = ntreeAddTreeEmbedded(
|
||||
bNodeTree *ntree = bke::ntreeAddTreeEmbedded(
|
||||
nullptr, &glossy_mat->id, "Shader Nodetree", ntreeType_Shader->idname);
|
||||
glossy_mat->use_nodes = true;
|
||||
/* To use the forward pipeline. */
|
||||
|
@ -119,7 +119,7 @@ MaterialModule::MaterialModule(Instance &inst) : inst_(inst)
|
|||
}
|
||||
{
|
||||
error_mat_ = (::Material *)BKE_id_new_nomain(ID_MA, "EEVEE default error");
|
||||
bNodeTree *ntree = ntreeAddTreeEmbedded(
|
||||
bNodeTree *ntree = bke::ntreeAddTreeEmbedded(
|
||||
nullptr, &error_mat_->id, "Shader Nodetree", ntreeType_Shader->idname);
|
||||
error_mat_->use_nodes = true;
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_world.h"
|
||||
#include "DEG_depsgraph_query.h"
|
||||
#include "NOD_shader.h"
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "BLI_memblock.h"
|
||||
|
||||
#include "BKE_image.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
|
||||
#include "BLI_dynstr.h"
|
||||
#include "BLI_hash.h"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "BLI_hash.h"
|
||||
/* get_image */
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "DNA_node_types.h"
|
||||
#include "ED_uvedit.h"
|
||||
/* get_image */
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "BKE_context.h"
|
||||
#include "BKE_idtype.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_object.h"
|
||||
#include "DEG_depsgraph.h"
|
||||
#include "RNA_define.h"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_curves.hh"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_runtime.hh"
|
||||
|
||||
#include "ED_curves.h"
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "BKE_cryptomatte.h"
|
||||
#include "BKE_image.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "NOD_composite.h"
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "BKE_colorband.h"
|
||||
#include "BKE_colortools.h"
|
||||
#include "BKE_curveprofile.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_tracking.h"
|
||||
|
||||
#include "IMB_colormanagement.h"
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "BKE_lib_override.h"
|
||||
#include "BKE_lib_remap.h"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_report.h"
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_text.h"
|
||||
|
|
|
@ -96,6 +96,21 @@ typedef struct eUSDOperatorOptions {
|
|||
bool as_background_job;
|
||||
} eUSDOperatorOptions;
|
||||
|
||||
/* Ensure that the prim_path is not set to
|
||||
* the absolute root path '/'. */
|
||||
static void process_prim_path(char *prim_path)
|
||||
{
|
||||
if (prim_path == NULL || prim_path[0] == '\0') {
|
||||
return;
|
||||
}
|
||||
|
||||
/* The absolute root "/" path indicates a no-op,
|
||||
* so clear the string. */
|
||||
if (prim_path[0] == '/' && strlen(prim_path) == 1) {
|
||||
prim_path[0] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
static int wm_usd_export_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
{
|
||||
eUSDOperatorOptions *options = MEM_callocN(sizeof(eUSDOperatorOptions), "eUSDOperatorOptions");
|
||||
|
@ -138,6 +153,10 @@ static int wm_usd_export_exec(bContext *C, wmOperator *op)
|
|||
const bool overwrite_textures = RNA_boolean_get(op->ptr, "overwrite_textures");
|
||||
const bool relative_paths = RNA_boolean_get(op->ptr, "relative_paths");
|
||||
|
||||
char root_prim_path[FILE_MAX];
|
||||
RNA_string_get(op->ptr, "root_prim_path", root_prim_path);
|
||||
process_prim_path(root_prim_path);
|
||||
|
||||
struct USDExportParams params = {
|
||||
export_animation,
|
||||
export_hair,
|
||||
|
@ -154,6 +173,8 @@ static int wm_usd_export_exec(bContext *C, wmOperator *op)
|
|||
relative_paths,
|
||||
};
|
||||
|
||||
STRNCPY(params.root_prim_path, root_prim_path);
|
||||
|
||||
bool ok = USD_export(C, filename, ¶ms, as_background_job);
|
||||
|
||||
return as_background_job || ok ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
|
||||
|
@ -179,6 +200,7 @@ static void wm_usd_export_draw(bContext *UNUSED(C), wmOperator *op)
|
|||
uiItemR(col, ptr, "export_uvmaps", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, ptr, "export_normals", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, ptr, "export_materials", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, ptr, "root_prim_path", 0, NULL, ICON_NONE);
|
||||
|
||||
col = uiLayoutColumn(box, true);
|
||||
uiItemR(col, ptr, "evaluation_mode", 0, NULL, ICON_NONE);
|
||||
|
@ -337,6 +359,14 @@ void WM_OT_usd_export(struct wmOperatorType *ot)
|
|||
"Relative Paths",
|
||||
"Use relative paths to reference external files (i.e. textures, volumes) in "
|
||||
"USD, otherwise use absolute paths");
|
||||
|
||||
RNA_def_string(ot->srna,
|
||||
"root_prim_path",
|
||||
NULL,
|
||||
FILE_MAX,
|
||||
"Root Prim",
|
||||
"If set, add a transform primitive with the given path to the stage "
|
||||
"as the parent of all exported data");
|
||||
}
|
||||
|
||||
/* ====== USD Import ====== */
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
#include "BKE_mesh.hh"
|
||||
#include "BKE_mesh_runtime.h"
|
||||
#include "BKE_nla.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_particle.h"
|
||||
#include "BKE_pointcloud.h"
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include "BKE_mesh.hh"
|
||||
#include "BKE_mesh_mapping.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_report.h"
|
||||
#include "BKE_scene.h"
|
||||
|
@ -516,7 +516,7 @@ static bool bake_object_check(const Scene *scene,
|
|||
if (image) {
|
||||
|
||||
if (node) {
|
||||
if (BKE_node_is_connected_to_output(ntree, node)) {
|
||||
if (blender::bke::node_is_connected_to_output(ntree, node)) {
|
||||
/* we don't return false since this may be a false positive
|
||||
* this can't be RPT_ERROR though, otherwise it prevents
|
||||
* multiple highpoly objects to be baked at once */
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include "BKE_layer.h"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_tree_update.h"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_report.h"
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
#include "BKE_light.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_pose_backup.h"
|
||||
#include "BKE_scene.h"
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "BKE_linestyle.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_report.h"
|
||||
#include "BKE_scene.h"
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "BKE_icons.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_paint.h"
|
||||
#include "BKE_scene.h"
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
#include "BKE_mesh.hh"
|
||||
#include "BKE_mesh_mapping.h"
|
||||
#include "BKE_mesh_runtime.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_paint.h"
|
||||
#include "BKE_report.h"
|
||||
#include "BKE_scene.h"
|
||||
|
@ -6636,7 +6636,8 @@ static void default_paint_slot_color_get(int layer_type, Material *ma, float col
|
|||
case LAYER_ROUGHNESS:
|
||||
case LAYER_METALLIC: {
|
||||
bNodeTree *ntree = nullptr;
|
||||
bNode *in_node = ma ? ntreeFindType(ma->nodetree, SH_NODE_BSDF_PRINCIPLED) : nullptr;
|
||||
bNode *in_node = ma ? blender::bke::ntreeFindType(ma->nodetree, SH_NODE_BSDF_PRINCIPLED) :
|
||||
nullptr;
|
||||
if (!in_node) {
|
||||
/* An existing material or Principled BSDF node could not be found.
|
||||
* Copy default color values from a default Principled BSDF instead. */
|
||||
|
@ -6667,7 +6668,7 @@ static void default_paint_slot_color_get(int layer_type, Material *ma, float col
|
|||
}
|
||||
/* Cleanup */
|
||||
if (ntree) {
|
||||
ntreeFreeTree(ntree);
|
||||
blender::bke::ntreeFreeTree(ntree);
|
||||
MEM_freeN(ntree);
|
||||
}
|
||||
return;
|
||||
|
@ -6740,7 +6741,7 @@ static bool proj_paint_add_slot(bContext *C, wmOperator *op)
|
|||
nodeSetActive(ntree, new_node);
|
||||
|
||||
/* Connect to first available principled BSDF node. */
|
||||
bNode *in_node = ntreeFindType(ntree, SH_NODE_BSDF_PRINCIPLED);
|
||||
bNode *in_node = blender::bke::ntreeFindType(ntree, SH_NODE_BSDF_PRINCIPLED);
|
||||
bNode *out_node = new_node;
|
||||
|
||||
if (in_node != nullptr) {
|
||||
|
@ -6776,7 +6777,7 @@ static bool proj_paint_add_slot(bContext *C, wmOperator *op)
|
|||
}
|
||||
else if (type == LAYER_DISPLACEMENT) {
|
||||
/* Connect to the displacement output socket */
|
||||
in_node = ntreeFindType(ntree, SH_NODE_OUTPUT_MATERIAL);
|
||||
in_node = blender::bke::ntreeFindType(ntree, SH_NODE_OUTPUT_MATERIAL);
|
||||
|
||||
if (in_node != nullptr) {
|
||||
in_sock = nodeFindSocket(in_node, SOCK_IN, layer_type_items[type].name);
|
||||
|
@ -6791,13 +6792,13 @@ static bool proj_paint_add_slot(bContext *C, wmOperator *op)
|
|||
if (in_sock != nullptr && link == nullptr) {
|
||||
nodeAddLink(ntree, out_node, out_sock, in_node, in_sock);
|
||||
|
||||
nodePositionRelative(out_node, in_node, out_sock, in_sock);
|
||||
blender::bke::nodePositionRelative(out_node, in_node, out_sock, in_sock);
|
||||
}
|
||||
}
|
||||
|
||||
ED_node_tree_propagate_change(C, bmain, ntree);
|
||||
/* In case we added more than one node, position them too. */
|
||||
nodePositionPropagate(out_node);
|
||||
blender::bke::nodePositionPropagate(out_node);
|
||||
|
||||
if (ima) {
|
||||
BKE_texpaint_slot_refresh_cache(scene, ma, ob);
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include "BKE_layer.h"
|
||||
#include "BKE_linestyle.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_paint.h"
|
||||
#include "BKE_particle.h"
|
||||
|
|
|
@ -70,17 +70,17 @@ static void search_items_for_asset_metadata(const bNodeTree &node_tree,
|
|||
}
|
||||
|
||||
const AssetRepresentation *asset = ED_asset_handle_get_representation(&asset_handle);
|
||||
params.add_single_node_item(ED_asset_handle_get_name(&asset_handle),
|
||||
asset_data.description == nullptr ? "" : asset_data.description,
|
||||
[asset](const bContext &C, bNodeTree &node_tree, bNode &node) {
|
||||
Main &bmain = *CTX_data_main(&C);
|
||||
node.flag &= ~NODE_OPTIONS;
|
||||
node.id = ED_asset_get_local_id_from_asset_or_append_and_reuse(
|
||||
&bmain, asset, ID_NT);
|
||||
id_us_plus(node.id);
|
||||
BKE_ntree_update_tag_node_property(&node_tree, &node);
|
||||
DEG_relations_tag_update(&bmain);
|
||||
});
|
||||
params.add_single_node_item(
|
||||
IFACE_(ED_asset_handle_get_name(&asset_handle)),
|
||||
asset_data.description == nullptr ? "" : IFACE_(asset_data.description),
|
||||
[asset](const bContext &C, bNodeTree &node_tree, bNode &node) {
|
||||
Main &bmain = *CTX_data_main(&C);
|
||||
node.flag &= ~NODE_OPTIONS;
|
||||
node.id = ED_asset_get_local_id_from_asset_or_append_and_reuse(&bmain, asset, ID_NT);
|
||||
id_us_plus(node.id);
|
||||
BKE_ntree_update_tag_node_property(&node_tree, &node);
|
||||
DEG_relations_tag_update(&bmain);
|
||||
});
|
||||
}
|
||||
|
||||
static void gather_search_items_for_all_assets(const bContext &C,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "BKE_global.h"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_node_tree_update.h"
|
||||
#include "BKE_report.h"
|
||||
|
@ -315,7 +315,7 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *op)
|
|||
}
|
||||
|
||||
for (bNode *new_node : node_map.values()) {
|
||||
nodeDeclarationEnsure(&tree, new_node);
|
||||
bke::nodeDeclarationEnsure(&tree, new_node);
|
||||
}
|
||||
|
||||
remap_pairing(tree, node_map);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "BKE_curve.h"
|
||||
#include "BKE_image.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_node_tree_update.h"
|
||||
#include "BKE_scene.h"
|
||||
|
@ -1150,6 +1150,9 @@ void ED_node_init_butfuncs()
|
|||
* Defined in blenkernel, but not registered in type hashes.
|
||||
*/
|
||||
|
||||
using blender::bke::NodeSocketTypeUndefined;
|
||||
using blender::bke::NodeTypeUndefined;
|
||||
|
||||
NodeTypeUndefined.draw_buttons = nullptr;
|
||||
NodeTypeUndefined.draw_buttons_ex = nullptr;
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ static void add_reroute_node_fn(nodes::LinkSearchOpParams ¶ms)
|
|||
static void add_group_input_node_fn(nodes::LinkSearchOpParams ¶ms)
|
||||
{
|
||||
/* Add a group input based on the connected socket, and add a new group input node. */
|
||||
bNodeSocket *interface_socket = ntreeAddSocketInterfaceFromSocket(
|
||||
bNodeSocket *interface_socket = bke::ntreeAddSocketInterfaceFromSocket(
|
||||
¶ms.node_tree, ¶ms.node, ¶ms.socket);
|
||||
const int group_input_index = BLI_findindex(¶ms.node_tree.inputs, interface_socket);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "BKE_image.h"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_node_tree_update.h"
|
||||
#include "BKE_report.h"
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "BKE_idtype.h"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_node_tree_update.h"
|
||||
#include "BKE_node_tree_zones.hh"
|
||||
|
@ -312,7 +312,7 @@ static Array<uiBlock *> node_uiblocks_init(const bContext &C, const Span<bNode *
|
|||
float2 node_to_view(const bNode &node, const float2 &co)
|
||||
{
|
||||
float2 result;
|
||||
nodeToView(&node, co.x, co.y, &result.x, &result.y);
|
||||
bke::nodeToView(&node, co.x, co.y, &result.x, &result.y);
|
||||
return result * UI_SCALE_FAC;
|
||||
}
|
||||
|
||||
|
@ -332,7 +332,7 @@ float2 node_from_view(const bNode &node, const float2 &co)
|
|||
const float x = co.x / UI_SCALE_FAC;
|
||||
const float y = co.y / UI_SCALE_FAC;
|
||||
float2 result;
|
||||
nodeFromView(&node, x, y, &result.x, &result.y);
|
||||
bke::nodeFromView(&node, x, y, &result.x, &result.y);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -402,7 +402,7 @@ static void node_update_basis(const bContext &C,
|
|||
uiLayout *row = uiLayoutRow(layout, true);
|
||||
uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_RIGHT);
|
||||
|
||||
const char *socket_label = nodeSocketLabel(socket);
|
||||
const char *socket_label = bke::nodeSocketLabel(socket);
|
||||
const char *socket_translation_context = node_socket_get_translation_context(*socket);
|
||||
socket->typeinfo->draw((bContext *)&C,
|
||||
row,
|
||||
|
@ -539,7 +539,7 @@ static void node_update_basis(const bContext &C,
|
|||
|
||||
uiLayout *row = uiLayoutRow(layout, true);
|
||||
|
||||
const char *socket_label = nodeSocketLabel(socket);
|
||||
const char *socket_label = bke::nodeSocketLabel(socket);
|
||||
const char *socket_translation_context = node_socket_get_translation_context(*socket);
|
||||
socket->typeinfo->draw((bContext *)&C,
|
||||
row,
|
||||
|
@ -1162,7 +1162,7 @@ static char *node_socket_get_tooltip(const SpaceNode *snode,
|
|||
}
|
||||
|
||||
if (output.str().empty()) {
|
||||
output << nodeSocketLabel(&socket);
|
||||
output << bke::nodeSocketLabel(&socket);
|
||||
}
|
||||
|
||||
return BLI_strdup(output.str().c_str());
|
||||
|
@ -2322,7 +2322,7 @@ static void node_draw_basis(const bContext &C,
|
|||
}
|
||||
|
||||
char showname[128];
|
||||
nodeLabel(&ntree, &node, showname, sizeof(showname));
|
||||
bke::nodeLabel(&ntree, &node, showname, sizeof(showname));
|
||||
|
||||
uiBut *but = uiDefBut(&block,
|
||||
UI_BTYPE_LABEL,
|
||||
|
@ -2351,7 +2351,7 @@ static void node_draw_basis(const bContext &C,
|
|||
const float outline_width = 1.0f;
|
||||
{
|
||||
/* Use warning color to indicate undefined types. */
|
||||
if (nodeTypeUndefined(&node)) {
|
||||
if (bke::node_type_is_undefined(&node)) {
|
||||
UI_GetThemeColorBlend4f(TH_REDALERT, TH_NODE, 0.4f, color);
|
||||
}
|
||||
/* Muted nodes get a mix of the background with the node color. */
|
||||
|
@ -2424,7 +2424,7 @@ static void node_draw_basis(const bContext &C,
|
|||
if (node.flag & SELECT) {
|
||||
UI_GetThemeColor4fv((node.flag & NODE_ACTIVE) ? TH_ACTIVE : TH_SELECT, color_outline);
|
||||
}
|
||||
else if (nodeTypeUndefined(&node)) {
|
||||
else if (bke::node_type_is_undefined(&node)) {
|
||||
UI_GetThemeColor4fv(TH_REDALERT, color_outline);
|
||||
}
|
||||
else if (ELEM(node.type, GEO_NODE_SIMULATION_INPUT, GEO_NODE_SIMULATION_OUTPUT)) {
|
||||
|
@ -2493,7 +2493,7 @@ static void node_draw_hidden(const bContext &C,
|
|||
/* Body. */
|
||||
float color[4];
|
||||
{
|
||||
if (nodeTypeUndefined(&node)) {
|
||||
if (bke::node_type_is_undefined(&node)) {
|
||||
/* Use warning color to indicate undefined types. */
|
||||
UI_GetThemeColorBlend4f(TH_REDALERT, TH_NODE, 0.4f, color);
|
||||
}
|
||||
|
@ -2557,7 +2557,7 @@ static void node_draw_hidden(const bContext &C,
|
|||
}
|
||||
|
||||
char showname[128];
|
||||
nodeLabel(&ntree, &node, showname, sizeof(showname));
|
||||
bke::nodeLabel(&ntree, &node, showname, sizeof(showname));
|
||||
|
||||
uiBut *but = uiDefBut(&block,
|
||||
UI_BTYPE_LABEL,
|
||||
|
@ -2590,7 +2590,7 @@ static void node_draw_hidden(const bContext &C,
|
|||
if (node.flag & SELECT) {
|
||||
UI_GetThemeColor4fv((node.flag & NODE_ACTIVE) ? TH_ACTIVE : TH_SELECT, color_outline);
|
||||
}
|
||||
else if (nodeTypeUndefined(&node)) {
|
||||
else if (bke::node_type_is_undefined(&node)) {
|
||||
UI_GetThemeColor4fv(TH_REDALERT, color_outline);
|
||||
}
|
||||
else {
|
||||
|
@ -2855,7 +2855,7 @@ static void frame_node_draw_label(TreeDrawContext &tree_draw_ctx,
|
|||
const float font_size = data->label_size / aspect;
|
||||
|
||||
char label[MAX_NAME];
|
||||
nodeLabel(&ntree, &node, label, sizeof(label));
|
||||
bke::nodeLabel(&ntree, &node, label, sizeof(label));
|
||||
|
||||
BLF_enable(fontid, BLF_ASPECT);
|
||||
BLF_aspect(fontid, aspect, aspect, 1.0f);
|
||||
|
@ -3247,14 +3247,14 @@ static void node_draw_nodetree(const bContext &C,
|
|||
nodelink_batch_start(snode);
|
||||
|
||||
LISTBASE_FOREACH (const bNodeLink *, link, &ntree.links) {
|
||||
if (!nodeLinkIsHidden(link) && !nodeLinkIsSelected(link)) {
|
||||
if (!nodeLinkIsHidden(link) && !bke::nodeLinkIsSelected(link)) {
|
||||
node_draw_link(C, region.v2d, snode, *link, false);
|
||||
}
|
||||
}
|
||||
|
||||
/* Draw selected node links after the unselected ones, so they are shown on top. */
|
||||
LISTBASE_FOREACH (const bNodeLink *, link, &ntree.links) {
|
||||
if (!nodeLinkIsHidden(link) && nodeLinkIsSelected(link)) {
|
||||
if (!nodeLinkIsHidden(link) && bke::nodeLinkIsSelected(link)) {
|
||||
node_draw_link(C, region.v2d, snode, *link, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "BKE_lib_id.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_node_tree_update.h"
|
||||
#include "BKE_report.h"
|
||||
|
@ -206,7 +206,7 @@ static void compo_freejob(void *cjv)
|
|||
CompoJob *cj = (CompoJob *)cjv;
|
||||
|
||||
if (cj->localtree) {
|
||||
ntreeLocalMerge(cj->bmain, cj->localtree, cj->ntree);
|
||||
bke::ntreeLocalMerge(cj->bmain, cj->localtree, cj->ntree);
|
||||
}
|
||||
if (cj->compositor_depsgraph != nullptr) {
|
||||
DEG_graph_free(cj->compositor_depsgraph);
|
||||
|
@ -506,7 +506,7 @@ void ED_node_shader_default(const bContext *C, ID *id)
|
|||
ma_default = BKE_material_default_surface();
|
||||
}
|
||||
|
||||
ma->nodetree = ntreeCopyTree(bmain, ma_default->nodetree);
|
||||
ma->nodetree = blender::bke::ntreeCopyTree(bmain, ma_default->nodetree);
|
||||
ma->nodetree->owner_id = &ma->id;
|
||||
for (bNode *node_iter : ma->nodetree->all_nodes()) {
|
||||
STRNCPY_UTF8(node_iter->name, DATA_(node_iter->name));
|
||||
|
@ -517,7 +517,7 @@ void ED_node_shader_default(const bContext *C, ID *id)
|
|||
}
|
||||
else if (ELEM(GS(id->name), ID_WO, ID_LA)) {
|
||||
/* Emission */
|
||||
bNodeTree *ntree = ntreeAddTreeEmbedded(
|
||||
bNodeTree *ntree = blender::bke::ntreeAddTreeEmbedded(
|
||||
nullptr, id, "Shader Nodetree", ntreeType_Shader->idname);
|
||||
bNode *shader, *output;
|
||||
|
||||
|
@ -568,7 +568,7 @@ void ED_node_composit_default(const bContext *C, Scene *sce)
|
|||
return;
|
||||
}
|
||||
|
||||
sce->nodetree = ntreeAddTreeEmbedded(
|
||||
sce->nodetree = blender::bke::ntreeAddTreeEmbedded(
|
||||
nullptr, &sce->id, "Compositing Nodetree", ntreeType_Composite->idname);
|
||||
|
||||
sce->nodetree->chunksize = 256;
|
||||
|
@ -601,7 +601,7 @@ void ED_node_texture_default(const bContext *C, Tex *tex)
|
|||
return;
|
||||
}
|
||||
|
||||
tex->nodetree = ntreeAddTreeEmbedded(
|
||||
tex->nodetree = blender::bke::ntreeAddTreeEmbedded(
|
||||
nullptr, &tex->id, "Texture Nodetree", ntreeType_Texture->idname);
|
||||
|
||||
bNode *out = nodeAddStaticNode(C, tex->nodetree, TEX_NODE_OUTPUT);
|
||||
|
@ -1354,7 +1354,7 @@ static int node_duplicate_exec(bContext *C, wmOperator *op)
|
|||
}
|
||||
|
||||
for (bNode *node : node_map.values()) {
|
||||
nodeDeclarationEnsure(ntree, node);
|
||||
blender::bke::nodeDeclarationEnsure(ntree, node);
|
||||
}
|
||||
|
||||
/* Clear flags for recursive depth-first iteration. */
|
||||
|
@ -1899,7 +1899,7 @@ static int node_delete_reconnect_exec(bContext *C, wmOperator * /*op*/)
|
|||
|
||||
LISTBASE_FOREACH_MUTABLE (bNode *, node, &snode->edittree->nodes) {
|
||||
if (node->flag & SELECT) {
|
||||
nodeInternalRelink(snode->edittree, node);
|
||||
blender::bke::nodeInternalRelink(snode->edittree, node);
|
||||
nodeRemoveNode(bmain, snode->edittree, node, true);
|
||||
}
|
||||
}
|
||||
|
@ -2186,7 +2186,7 @@ static int ntree_socket_add_exec(bContext *C, wmOperator *op)
|
|||
bNodeSocket *sock;
|
||||
if (active_sock) {
|
||||
/* Insert a copy of the active socket right after it. */
|
||||
sock = ntreeInsertSocketInterface(
|
||||
sock = blender::bke::ntreeInsertSocketInterface(
|
||||
ntree, in_out, active_sock->idname, active_sock->next, active_sock->name);
|
||||
/* XXX this only works for actual sockets, not interface templates! */
|
||||
// nodeSocketCopyValue(sock, &ntree_ptr, active_sock, &ntree_ptr);
|
||||
|
@ -2304,7 +2304,7 @@ static int ntree_socket_change_type_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
nodeModifySocketType(ntree, nullptr, iosock, socket_type->idname);
|
||||
blender::bke::nodeModifySocketType(ntree, nullptr, iosock, socket_type->idname);
|
||||
|
||||
/* Need the extra update here because the loop above does not check for valid links in the node
|
||||
* group we're currently editing. */
|
||||
|
|
|
@ -250,7 +250,7 @@ static bool node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode)
|
|||
* - `ngroup` (i.e. the source NodeTree) is left unscathed.
|
||||
* - Temp copy. do change ID user-count for the copies.
|
||||
*/
|
||||
bNodeTree *wgroup = ntreeCopyTree(bmain, ngroup);
|
||||
bNodeTree *wgroup = bke::ntreeCopyTree(bmain, ngroup);
|
||||
|
||||
/* Add the nodes into the `ntree`. */
|
||||
Vector<bNode *> new_nodes;
|
||||
|
@ -529,7 +529,7 @@ static bool node_group_separate_selected(
|
|||
}
|
||||
}
|
||||
if (!make_copy) {
|
||||
nodeRebuildIDVector(&ngroup);
|
||||
bke::nodeRebuildIDVector(&ngroup);
|
||||
}
|
||||
|
||||
/* add internal links to the ntree */
|
||||
|
@ -562,7 +562,7 @@ static bool node_group_separate_selected(
|
|||
remap_pairing(ntree, nodes_to_move, node_identifier_map);
|
||||
|
||||
for (bNode *node : node_map.values()) {
|
||||
nodeDeclarationEnsure(&ntree, node);
|
||||
bke::nodeDeclarationEnsure(&ntree, node);
|
||||
}
|
||||
|
||||
/* and copy across the animation,
|
||||
|
@ -697,7 +697,7 @@ static bool node_group_make_test_selected(bNodeTree &ntree,
|
|||
/* make a local pseudo node tree to pass to the node poll functions */
|
||||
bNodeTree *ngroup = ntreeAddTree(nullptr, "Pseudo Node Group", ntree_idname);
|
||||
BLI_SCOPED_DEFER([&]() {
|
||||
ntreeFreeTree(ngroup);
|
||||
bke::ntreeFreeTree(ngroup);
|
||||
MEM_freeN(ngroup);
|
||||
});
|
||||
|
||||
|
@ -791,7 +791,7 @@ static void get_min_max_of_nodes(const Span<bNode *> nodes,
|
|||
INIT_MINMAX2(min, max);
|
||||
for (const bNode *node : nodes) {
|
||||
float2 loc;
|
||||
nodeToView(node, node->offsetx, node->offsety, &loc.x, &loc.y);
|
||||
bke::nodeToView(node, node->offsetx, node->offsety, &loc.x, &loc.y);
|
||||
math::min_max(loc, min, max);
|
||||
if (use_size) {
|
||||
loc.x += node->width;
|
||||
|
@ -844,11 +844,11 @@ static bNodeSocket *add_interface_from_socket(const bNodeTree &original_tree,
|
|||
const bNodeSocket &socket_for_name = prefer_node_for_interface_name(socket.owner_node()) ?
|
||||
socket :
|
||||
socket_for_io;
|
||||
return ntreeAddSocketInterfaceFromSocketWithName(&tree_for_interface,
|
||||
&node_for_io,
|
||||
&socket_for_io,
|
||||
socket_for_io.idname,
|
||||
socket_for_name.name);
|
||||
return bke::ntreeAddSocketInterfaceFromSocketWithName(&tree_for_interface,
|
||||
&node_for_io,
|
||||
&socket_for_io,
|
||||
socket_for_io.idname,
|
||||
socket_for_name.name);
|
||||
}
|
||||
|
||||
static void node_group_make_insert_selected(const bContext &C,
|
||||
|
@ -960,7 +960,8 @@ static void node_group_make_insert_selected(const bContext &C,
|
|||
if (socket->is_directly_linked()) {
|
||||
continue;
|
||||
}
|
||||
const bNodeSocket *io_socket = ntreeAddSocketInterfaceFromSocket(&group, node, socket);
|
||||
const bNodeSocket *io_socket = bke::ntreeAddSocketInterfaceFromSocket(
|
||||
&group, node, socket);
|
||||
new_internal_links.append({node, socket, io_socket});
|
||||
}
|
||||
};
|
||||
|
@ -1012,7 +1013,7 @@ static void node_group_make_insert_selected(const bContext &C,
|
|||
BKE_ntree_update_tag_node_removed(&ntree);
|
||||
BKE_ntree_update_tag_node_new(&group, node);
|
||||
}
|
||||
nodeRebuildIDVector(&ntree);
|
||||
bke::nodeRebuildIDVector(&ntree);
|
||||
|
||||
/* Update input and output node first, since the group node declaration can depend on them. */
|
||||
nodes::update_node_declaration_and_sockets(group, *input_node);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "BLI_vector.hh"
|
||||
#include "BLI_vector_set.hh"
|
||||
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_interface.hh"
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "BKE_curve.h"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_node_tree_update.h"
|
||||
#include "BKE_screen.h"
|
||||
|
@ -1643,7 +1643,7 @@ static int mute_links_exec(bContext *C, wmOperator *op)
|
|||
bke::node_tree_runtime::AllowUsingOutdatedInfo allow_outdated_info{ntree};
|
||||
|
||||
for (bNodeLink *link : affected_links) {
|
||||
nodeLinkSetMute(&ntree, link, !(link->flag & NODE_LINK_MUTED));
|
||||
bke::nodeLinkSetMute(&ntree, link, !(link->flag & NODE_LINK_MUTED));
|
||||
const bool muted = link->flag & NODE_LINK_MUTED;
|
||||
|
||||
/* Propagate mute status downstream past reroute nodes. */
|
||||
|
@ -1652,7 +1652,7 @@ static int mute_links_exec(bContext *C, wmOperator *op)
|
|||
links.push_multiple(link->tonode->output_socket(0).directly_linked_links());
|
||||
while (!links.is_empty()) {
|
||||
bNodeLink *link = links.pop();
|
||||
nodeLinkSetMute(&ntree, link, muted);
|
||||
bke::nodeLinkSetMute(&ntree, link, muted);
|
||||
if (!link->tonode->is_reroute()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -1666,7 +1666,7 @@ static int mute_links_exec(bContext *C, wmOperator *op)
|
|||
links.push_multiple(link->fromnode->input_socket(0).directly_linked_links());
|
||||
while (!links.is_empty()) {
|
||||
bNodeLink *link = links.pop();
|
||||
nodeLinkSetMute(&ntree, link, muted);
|
||||
bke::nodeLinkSetMute(&ntree, link, muted);
|
||||
if (!link->fromnode->is_reroute()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -1722,7 +1722,7 @@ static int detach_links_exec(bContext *C, wmOperator * /*op*/)
|
|||
|
||||
for (bNode *node : ntree.all_nodes()) {
|
||||
if (node->flag & SELECT) {
|
||||
nodeInternalRelink(&ntree, node);
|
||||
bke::nodeInternalRelink(&ntree, node);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2254,7 +2254,7 @@ bNodeSocket *get_main_socket(bNodeTree &ntree, bNode &node, eNodeSocketInOut in_
|
|||
ListBase *sockets = (in_out == SOCK_IN) ? &node.inputs : &node.outputs;
|
||||
|
||||
/* Try to get the main socket based on the socket declaration. */
|
||||
nodeDeclarationEnsure(&ntree, &node);
|
||||
bke::nodeDeclarationEnsure(&ntree, &node);
|
||||
const nodes::NodeDeclaration *node_decl = node.declaration();
|
||||
if (node_decl != nullptr) {
|
||||
Span<nodes::SocketDeclarationPtr> socket_decls = (in_out == SOCK_IN) ? node_decl->inputs :
|
||||
|
@ -2371,7 +2371,7 @@ static void node_link_insert_offset_frame_chains(bNodeTree *ntree,
|
|||
{
|
||||
for (bNode *node : ntree->all_nodes()) {
|
||||
if (nodeIsParentAndChild(parent, node)) {
|
||||
nodeChainIter(ntree, node, node_link_insert_offset_frame_chain_cb, data, reversed);
|
||||
bke::nodeChainIter(ntree, node, node_link_insert_offset_frame_chain_cb, data, reversed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2402,7 +2402,7 @@ static bool node_link_insert_offset_chain_cb(bNode *fromnode,
|
|||
}
|
||||
}
|
||||
else if (ofs_node->parent) {
|
||||
bNode *node = nodeFindRootParent(ofs_node);
|
||||
bNode *node = bke::nodeFindRootParent(ofs_node);
|
||||
node_offset_apply(*node, data->offset_x);
|
||||
}
|
||||
else {
|
||||
|
@ -2430,7 +2430,7 @@ static void node_link_insert_offset_ntree(NodeInsertOfsData *iofsd,
|
|||
float margin = width;
|
||||
|
||||
/* NODE_TEST will be used later, so disable for all nodes */
|
||||
ntreeNodeFlagSet(ntree, NODE_TEST, false);
|
||||
bke::ntreeNodeFlagSet(ntree, NODE_TEST, false);
|
||||
|
||||
/* `insert.totr` isn't updated yet,
|
||||
* so `totr_insert` is used to get the correct world-space coords. */
|
||||
|
@ -2505,7 +2505,7 @@ static void node_link_insert_offset_ntree(NodeInsertOfsData *iofsd,
|
|||
node_offset_apply(*offs_node, addval);
|
||||
}
|
||||
else if (!insert.parent && offs_node->parent) {
|
||||
node_offset_apply(*nodeFindRootParent(offs_node), addval);
|
||||
node_offset_apply(*bke::nodeFindRootParent(offs_node), addval);
|
||||
}
|
||||
margin = addval;
|
||||
}
|
||||
|
@ -2521,13 +2521,13 @@ static void node_link_insert_offset_ntree(NodeInsertOfsData *iofsd,
|
|||
iofsd->offset_x = margin;
|
||||
|
||||
/* flag all parents of insert as offset to prevent them from being offset */
|
||||
nodeParentsIter(&insert, node_parents_offset_flag_enable_cb, nullptr);
|
||||
bke::nodeParentsIter(&insert, node_parents_offset_flag_enable_cb, nullptr);
|
||||
/* iterate over entire chain and apply offsets */
|
||||
nodeChainIter(ntree,
|
||||
right_alignment ? next : prev,
|
||||
node_link_insert_offset_chain_cb,
|
||||
iofsd,
|
||||
!right_alignment);
|
||||
bke::nodeChainIter(ntree,
|
||||
right_alignment ? next : prev,
|
||||
node_link_insert_offset_chain_cb,
|
||||
iofsd,
|
||||
!right_alignment);
|
||||
}
|
||||
|
||||
insert.parent = init_parent;
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_node_tree_update.h"
|
||||
#include "BKE_workspace.h"
|
||||
|
|
|
@ -236,7 +236,7 @@ static void node_socket_add_replace(const bContext *C,
|
|||
}
|
||||
else {
|
||||
sock_from_tmp = (bNodeSocket *)BLI_findlink(&node_from->outputs, item->socket_index);
|
||||
nodePositionRelative(node_from, node_to, sock_from_tmp, sock_to);
|
||||
bke::nodePositionRelative(node_from, node_to, sock_from_tmp, sock_to);
|
||||
}
|
||||
|
||||
node_link_item_apply(ntree, node_from, item);
|
||||
|
@ -468,7 +468,7 @@ static void ui_node_sock_name(const bNodeTree *ntree,
|
|||
bNode *node = sock->link->fromnode;
|
||||
char node_name[UI_MAX_NAME_STR];
|
||||
|
||||
nodeLabel(ntree, node, node_name, sizeof(node_name));
|
||||
bke::nodeLabel(ntree, node, node_name, sizeof(node_name));
|
||||
|
||||
if (BLI_listbase_is_empty(&node->inputs) && node->outputs.first != node->outputs.last) {
|
||||
BLI_snprintf(
|
||||
|
@ -834,7 +834,7 @@ static void ui_node_draw_input(
|
|||
|
||||
sub = uiLayoutRow(sub, true);
|
||||
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT);
|
||||
uiItemL(sub, IFACE_(nodeSocketLabel(&input)), ICON_NONE);
|
||||
uiItemL(sub, IFACE_(bke::nodeSocketLabel(&input)), ICON_NONE);
|
||||
}
|
||||
|
||||
if (dependency_loop) {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "BKE_context.h"
|
||||
#include "BKE_image.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "BKE_gpencil_legacy.h"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_lib_remap.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include "BKE_main.h"
|
||||
#include "BKE_main_namemap.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_particle.h"
|
||||
#include "BKE_report.h"
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "BLI_rect.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_node_tree_update.h"
|
||||
#include "BKE_report.h"
|
||||
|
@ -48,11 +48,11 @@ static void create_transform_data_for_node(TransData &td,
|
|||
|
||||
/* account for parents (nested nodes) */
|
||||
if (node.parent) {
|
||||
nodeToView(node.parent,
|
||||
node.locx + roundf(node.offsetx),
|
||||
node.locy + roundf(node.offsety),
|
||||
&locx,
|
||||
&locy);
|
||||
blender::bke::nodeToView(node.parent,
|
||||
node.locx + roundf(node.offsetx),
|
||||
node.locy + roundf(node.offsety),
|
||||
&locx,
|
||||
&locy);
|
||||
}
|
||||
else {
|
||||
locx = node.locx + roundf(node.offsetx);
|
||||
|
@ -249,11 +249,11 @@ static void flushTransNodes(TransInfo *t)
|
|||
|
||||
/* account for parents (nested nodes) */
|
||||
if (node->parent) {
|
||||
nodeFromView(node->parent,
|
||||
loc[0] - roundf(node->offsetx),
|
||||
loc[1] - roundf(node->offsety),
|
||||
&node->locx,
|
||||
&node->locy);
|
||||
blender::bke::nodeFromView(node->parent,
|
||||
loc[0] - roundf(node->offsetx),
|
||||
loc[1] - roundf(node->offsety),
|
||||
&node->locx,
|
||||
&node->locy);
|
||||
}
|
||||
else {
|
||||
node->locx = loc[0] - roundf(node->offsetx);
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "BKE_lib_id.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_undo_system.h"
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include "BKE_main.h"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_mesh.hh"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_tree_update.h"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_scene.h"
|
||||
|
@ -214,7 +214,7 @@ Material *BlenderStrokeRenderer::GetStrokeShader(Main *bmain,
|
|||
|
||||
if (iNodeTree) {
|
||||
// make a copy of linestyle->nodetree
|
||||
ntree = ntreeCopyTree_ex(iNodeTree, bmain, do_id_user);
|
||||
ntree = blender::bke::ntreeCopyTree_ex(iNodeTree, bmain, do_id_user);
|
||||
|
||||
// find the active Output Line Style node
|
||||
for (bNode *node = (bNode *)ntree->nodes.first; node; node = node->next) {
|
||||
|
@ -226,7 +226,8 @@ Material *BlenderStrokeRenderer::GetStrokeShader(Main *bmain,
|
|||
ma->nodetree = ntree;
|
||||
}
|
||||
else {
|
||||
ntree = ntreeAddTreeEmbedded(nullptr, &ma->id, "stroke_shader", "ShaderNodeTree");
|
||||
ntree = blender::bke::ntreeAddTreeEmbedded(
|
||||
nullptr, &ma->id, "stroke_shader", "ShaderNodeTree");
|
||||
}
|
||||
ma->use_nodes = true;
|
||||
ma->blend_method = MA_BM_HASHED;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "StrokeRenderer.h"
|
||||
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
|
||||
namespace Freestyle {
|
||||
|
||||
|
|
|
@ -364,22 +364,23 @@ class UVAABBIsland {
|
|||
* Technically, the algorithm here is only `O(n)`, In practice, to get reasonable results,
|
||||
* the input must be pre-sorted, which costs an additional `O(nlogn)` time complexity.
|
||||
*/
|
||||
static void pack_islands_alpaca_turbo(const int64_t start_index,
|
||||
static void pack_islands_alpaca_turbo(const int64_t exclude_index,
|
||||
const rctf &exclude,
|
||||
const Span<UVAABBIsland *> islands,
|
||||
const float target_aspect_y,
|
||||
MutableSpan<uv_phi> r_phis,
|
||||
rctf *r_extent)
|
||||
{
|
||||
/* Exclude an initial AABB near the origin. */
|
||||
float next_u1 = r_extent->xmax;
|
||||
float next_v1 = r_extent->ymax;
|
||||
float next_u1 = exclude.xmax;
|
||||
float next_v1 = exclude.ymax;
|
||||
bool zigzag = next_u1 < next_v1 * target_aspect_y; /* Horizontal or Vertical strip? */
|
||||
|
||||
float u0 = zigzag ? next_u1 : 0.0f;
|
||||
float v0 = zigzag ? 0.0f : next_v1;
|
||||
|
||||
/* Visit every island in order. */
|
||||
for (int64_t index = start_index; index < islands.size(); index++) {
|
||||
/* Visit every island in order, except the excluded islands at the start. */
|
||||
for (int64_t index = exclude_index; index < islands.size(); index++) {
|
||||
UVAABBIsland *island = islands[index];
|
||||
const float dsm_u = island->uv_diagonal.x;
|
||||
const float dsm_v = island->uv_diagonal.y;
|
||||
|
@ -474,15 +475,16 @@ static void update_hole_rotate(float2 &hole,
|
|||
* Also adds the concept of a "Hole", which is unused space that can be filled.
|
||||
* Tracking the "Hole" has a slight performance cost, while improving packing efficiency.
|
||||
*/
|
||||
static void pack_islands_alpaca_rotate(const int64_t start_index,
|
||||
static void pack_islands_alpaca_rotate(const int64_t exclude_index,
|
||||
const rctf &exclude,
|
||||
const Span<UVAABBIsland *> islands,
|
||||
const float target_aspect_y,
|
||||
MutableSpan<uv_phi> r_phis,
|
||||
rctf *r_extent)
|
||||
{
|
||||
/* Exclude an initial AABB near the origin. */
|
||||
float next_u1 = r_extent->xmax;
|
||||
float next_v1 = r_extent->ymax;
|
||||
float next_u1 = exclude.xmax;
|
||||
float next_v1 = exclude.ymax;
|
||||
bool zigzag = next_u1 / target_aspect_y < next_v1; /* Horizontal or Vertical strip? */
|
||||
|
||||
/* Track an AABB "hole" which may be filled at any time. */
|
||||
|
@ -493,8 +495,8 @@ static void pack_islands_alpaca_rotate(const int64_t start_index,
|
|||
float u0 = zigzag ? next_u1 : 0.0f;
|
||||
float v0 = zigzag ? 0.0f : next_v1;
|
||||
|
||||
/* Visit every island in order. */
|
||||
for (int64_t index = start_index; index < islands.size(); index++) {
|
||||
/* Visit every island in order, except the excluded islands at the start. */
|
||||
for (int64_t index = exclude_index; index < islands.size(); index++) {
|
||||
UVAABBIsland *island = islands[index];
|
||||
uv_phi &phi = r_phis[island->index];
|
||||
const float uvdiag_x = island->uv_diagonal.x * island->aspect_y;
|
||||
|
@ -579,7 +581,8 @@ static void pack_islands_alpaca_rotate(const int64_t start_index,
|
|||
/**
|
||||
* Use a fast algorithm to pack the supplied `aabbs`.
|
||||
*/
|
||||
static void pack_islands_fast(const int64_t start_index,
|
||||
static void pack_islands_fast(const int64_t exclude_index,
|
||||
const rctf &exclude,
|
||||
const Span<UVAABBIsland *> aabbs,
|
||||
const bool rotate,
|
||||
const float target_aspect_y,
|
||||
|
@ -587,10 +590,10 @@ static void pack_islands_fast(const int64_t start_index,
|
|||
rctf *r_extent)
|
||||
{
|
||||
if (rotate) {
|
||||
pack_islands_alpaca_rotate(start_index, aabbs, target_aspect_y, r_phis, r_extent);
|
||||
pack_islands_alpaca_rotate(exclude_index, exclude, aabbs, target_aspect_y, r_phis, r_extent);
|
||||
}
|
||||
else {
|
||||
pack_islands_alpaca_turbo(start_index, aabbs, target_aspect_y, r_phis, r_extent);
|
||||
pack_islands_alpaca_turbo(exclude_index, exclude, aabbs, target_aspect_y, r_phis, r_extent);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1078,8 +1081,8 @@ class UVMinimumEnclosingSquareFinder {
|
|||
|
||||
/**
|
||||
* Find the minimum bounding square that encloses the UVs as specified in `r_phis`.
|
||||
* If that square is smaller than `r_max_u` and `r_max_v`, then update `r_phis` accordingly.
|
||||
* \return True if `r_phis`, `r_max_u` and `r_max_v` are modified.
|
||||
* If that square is smaller than `r_extent`, then update `r_phis` accordingly.
|
||||
* \return True if `r_phis` and `r_extent` are modified.
|
||||
*/
|
||||
static bool rotate_inside_square(const Span<UVAABBIsland *> island_indices,
|
||||
const Span<PackIsland *> islands,
|
||||
|
@ -1131,13 +1134,15 @@ static bool rotate_inside_square(const Span<UVAABBIsland *> island_indices,
|
|||
}
|
||||
}
|
||||
|
||||
/* Now we have all the points in the correct space, compute the 2D convex hull. */
|
||||
const float(*source)[2] = reinterpret_cast<const float(*)[2]>(square_finder.points.data());
|
||||
|
||||
square_finder.indices.resize(square_finder.points.size());
|
||||
square_finder.indices.resize(square_finder.points.size()); /* Allocate worst-case.*/
|
||||
int convex_size = BLI_convexhull_2d(
|
||||
source, int(square_finder.points.size()), square_finder.indices.data());
|
||||
square_finder.indices.resize(convex_size);
|
||||
square_finder.indices.resize(convex_size); /* Resize to actual size.*/
|
||||
|
||||
/* Run the computation to find the best angle. (Slow!) */
|
||||
const float quad_180 = square_finder.update(DEG2RADF(-180.0f));
|
||||
square_finder.update_recursive(DEG2RADF(-180.0f), quad_180, DEG2RADF(180.0f), quad_180);
|
||||
|
||||
|
@ -1156,6 +1161,10 @@ static bool rotate_inside_square(const Span<UVAABBIsland *> island_indices,
|
|||
r_phis[i].translation.x -= square_finder.best_bounds.xmin;
|
||||
r_phis[i].translation.y -= square_finder.best_bounds.ymin;
|
||||
}
|
||||
|
||||
/* Write back new extent, translated to the origin. */
|
||||
r_extent->xmin = 0.0f;
|
||||
r_extent->ymin = 0.0f;
|
||||
r_extent->xmax = BLI_rctf_size_x(&square_finder.best_bounds);
|
||||
r_extent->ymax = BLI_rctf_size_y(&square_finder.best_bounds);
|
||||
return true; /* `r_phis` and `r_extent` were modified. */
|
||||
|
@ -1380,7 +1389,6 @@ static float pack_islands_scale_margin(const Span<PackIsland *> islands,
|
|||
*/
|
||||
|
||||
const bool all_can_rotate = can_rotate(islands, params);
|
||||
bool all_can_translate = true;
|
||||
|
||||
/* First, copy information from our input into the AABB structure. */
|
||||
Array<UVAABBIsland *> aabbs(islands.size());
|
||||
|
@ -1389,7 +1397,6 @@ static float pack_islands_scale_margin(const Span<PackIsland *> islands,
|
|||
float island_scale = scale;
|
||||
if (!pack_island->can_scale_(params)) {
|
||||
island_scale = 1.0f;
|
||||
all_can_translate = false;
|
||||
}
|
||||
UVAABBIsland *aabb = new UVAABBIsland();
|
||||
aabb->index = i;
|
||||
|
@ -1449,6 +1456,26 @@ static float pack_islands_scale_margin(const Span<PackIsland *> islands,
|
|||
});
|
||||
}
|
||||
|
||||
/* If some of the islands are locked, we build a summary about them here. */
|
||||
rctf locked_bounds; /* AABB of islands which can't translate. */
|
||||
int64_t locked_island_count = 0; /* Index of first non-locked island. */
|
||||
for (int64_t i = 0; i < islands.size(); i++) {
|
||||
PackIsland *pack_island = islands[i];
|
||||
if (pack_island->can_translate_(params)) {
|
||||
break;
|
||||
}
|
||||
if (i == 0) {
|
||||
float2 bottom_left = pack_island->pivot_ - pack_island->half_diagonal_;
|
||||
locked_bounds.xmin = bottom_left.x;
|
||||
locked_bounds.xmax = bottom_left.x;
|
||||
locked_bounds.ymin = bottom_left.y;
|
||||
locked_bounds.ymax = bottom_left.y;
|
||||
}
|
||||
float2 top_right = pack_island->pivot_ + pack_island->half_diagonal_;
|
||||
BLI_rctf_do_minmax_v(&locked_bounds, top_right);
|
||||
locked_island_count = i + 1;
|
||||
}
|
||||
|
||||
/* Partition `islands`, largest islands will go to a slow packer, the rest the fast packer.
|
||||
* See discussion above for details. */
|
||||
int64_t alpaca_cutoff = 1024; /* Regular situation, pack `32 * 32` islands with slow packer. */
|
||||
|
@ -1462,16 +1489,22 @@ static float pack_islands_scale_margin(const Span<PackIsland *> islands,
|
|||
std::min(alpaca_cutoff, islands.size()));
|
||||
rctf extent = {0.0f, 1e30f, 0.0f, 1e30f};
|
||||
|
||||
if (all_can_translate) {
|
||||
pack_islands_fast(0, slow_aabbs, all_can_rotate, params.target_aspect_y, r_phis, &extent);
|
||||
}
|
||||
/* Call the "fast" packer, which can sometimes give optimal results. */
|
||||
pack_islands_fast(locked_island_count,
|
||||
locked_bounds,
|
||||
slow_aabbs,
|
||||
all_can_rotate,
|
||||
params.target_aspect_y,
|
||||
r_phis,
|
||||
&extent);
|
||||
|
||||
if (all_can_translate) {
|
||||
/* Call the "optimal" packer. */
|
||||
if (locked_island_count == 0) {
|
||||
pack_islands_optimal_pack(slow_aabbs, params, r_phis, &extent);
|
||||
}
|
||||
|
||||
/* Call box_pack_2d (slow for large N.) */
|
||||
if (all_can_translate) {
|
||||
if (locked_island_count == 0) { /* box_pack_2d doesn't yet support locked islands. */
|
||||
pack_island_box_pack_2d(slow_aabbs, params, r_phis, &extent);
|
||||
}
|
||||
|
||||
|
@ -1485,14 +1518,21 @@ static float pack_islands_scale_margin(const Span<PackIsland *> islands,
|
|||
/* At this stage, `extent` contains the optimal/box_pack/xatlas UVs. */
|
||||
|
||||
if (all_can_rotate) {
|
||||
/* Attempt to improve the layout even further by finding the minimal-bounding-square. */
|
||||
rotate_inside_square(slow_aabbs, islands, params, scale, margin, r_phis, &extent);
|
||||
}
|
||||
|
||||
/* Call fast packer for remaining islands. */
|
||||
pack_islands_fast(
|
||||
slow_aabbs.size(), aabbs, all_can_rotate, params.target_aspect_y, r_phis, &extent);
|
||||
/* Call fast packer for remaining islands, excluding everything already placed. */
|
||||
rctf final_extent = {0.0f, 1e30f, 0.0f, 1e30f};
|
||||
pack_islands_fast(slow_aabbs.size(),
|
||||
extent,
|
||||
aabbs,
|
||||
all_can_rotate,
|
||||
params.target_aspect_y,
|
||||
r_phis,
|
||||
&final_extent);
|
||||
|
||||
return get_aspect_scaled_extent(extent, params);
|
||||
return get_aspect_scaled_extent(final_extent, params);
|
||||
}
|
||||
|
||||
/** Find the optimal scale to pack islands into the unit square.
|
||||
|
@ -1500,6 +1540,7 @@ static float pack_islands_scale_margin(const Span<PackIsland *> islands,
|
|||
*/
|
||||
static float pack_islands_margin_fraction(const Span<PackIsland *> &islands,
|
||||
const float margin_fraction,
|
||||
const bool rescale_margin,
|
||||
const UVPackIsland_Params ¶ms)
|
||||
{
|
||||
|
||||
|
@ -1576,8 +1617,8 @@ static float pack_islands_margin_fraction(const Span<PackIsland *> &islands,
|
|||
|
||||
/* Evaluate our `f`. */
|
||||
blender::Array<uv_phi> *phis_target = (phis_low == &phis_a) ? &phis_b : &phis_a;
|
||||
const float max_uv = pack_islands_scale_margin(
|
||||
islands, scale, margin_fraction, params, *phis_target);
|
||||
const float margin = rescale_margin ? margin_fraction * scale : margin_fraction;
|
||||
const float max_uv = pack_islands_scale_margin(islands, scale, margin, params, *phis_target);
|
||||
const float value = sqrtf(max_uv) - 1.0f;
|
||||
|
||||
if (value <= 0.0f) {
|
||||
|
@ -1786,7 +1827,7 @@ float pack_islands(const Span<PackIsland *> &islands, const UVPackIsland_Params
|
|||
params.scale_to_fit)
|
||||
{
|
||||
/* Uses a line search on scale. ~10x slower than other method. */
|
||||
return pack_islands_margin_fraction(islands, params.margin, params);
|
||||
return pack_islands_margin_fraction(islands, params.margin, false, params);
|
||||
}
|
||||
|
||||
float margin = params.margin;
|
||||
|
@ -1808,7 +1849,7 @@ float pack_islands(const Span<PackIsland *> &islands, const UVPackIsland_Params
|
|||
case ED_UVPACK_PIN_LOCK_ALL:
|
||||
case ED_UVPACK_PIN_LOCK_SCALE:
|
||||
case ED_UVPACK_PIN_LOCK_ROTATION_SCALE:
|
||||
return pack_islands_margin_fraction(islands, margin, params);
|
||||
return pack_islands_margin_fraction(islands, margin, true, params);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "BKE_global.h"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_mesh.hh"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_paint.h"
|
||||
#include "BKE_pbvh.h"
|
||||
#include "BKE_subdiv_ccg.h"
|
||||
|
|
|
@ -148,7 +148,7 @@ void IMB_index_builder_finish(anim_index_builder *fp, int rollback)
|
|||
}
|
||||
else {
|
||||
unlink(fp->filepath);
|
||||
BLI_rename(fp->filepath_temp, fp->filepath);
|
||||
BLI_rename_overwrite(fp->filepath_temp, fp->filepath);
|
||||
}
|
||||
|
||||
MEM_freeN(fp);
|
||||
|
@ -784,7 +784,7 @@ static void free_proxy_output_ffmpeg(struct proxy_output_ctx *ctx, int rollback)
|
|||
else {
|
||||
get_proxy_filepath(ctx->anim, ctx->proxy_size, filepath, false);
|
||||
unlink(filepath);
|
||||
BLI_rename(filepath_tmp, filepath);
|
||||
BLI_rename_overwrite(filepath_tmp, filepath);
|
||||
}
|
||||
|
||||
MEM_freeN(ctx);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue