Merge branch 'master' into blender2.8
This commit is contained in:
@@ -180,7 +180,7 @@ static void deg_debug_graphviz_legend(const DebugContext &ctx)
|
||||
#ifdef COLOR_SCHEME_NODE_TYPE
|
||||
const int (*pair)[2];
|
||||
for (pair = deg_debug_node_type_color_map; (*pair)[0] >= 0; ++pair) {
|
||||
DepsNodeFactory *nti = DEG_get_node_factory((eDEG_NODE_TYPE)(*pair)[0]);
|
||||
DepsNodeFactory *nti = deg_type_get_factory((eDepsNode_Type)(*pair)[0]);
|
||||
deg_debug_graphviz_legend_color(ctx,
|
||||
nti->tname().c_str(),
|
||||
deg_debug_colors_light[(*pair)[1] % deg_debug_max_colors]);
|
||||
@@ -403,6 +403,8 @@ static void deg_debug_graphviz_node(const DebugContext &ctx,
|
||||
case DEG_NODE_TYPE_OPERATION:
|
||||
deg_debug_graphviz_node_single(ctx, node);
|
||||
break;
|
||||
case NUM_DEG_NODE_TYPES:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -263,7 +263,7 @@ DepsNode *Depsgraph::find_node_from_pointer(const PointerRNA *ptr,
|
||||
TimeSourceDepsNode *Depsgraph::add_time_source()
|
||||
{
|
||||
if (time_source == NULL) {
|
||||
DepsNodeFactory *factory = deg_get_node_factory(DEG_NODE_TYPE_TIMESOURCE);
|
||||
DepsNodeFactory *factory = deg_type_get_factory(DEG_NODE_TYPE_TIMESOURCE);
|
||||
time_source = (TimeSourceDepsNode *)factory->create_node(NULL, "", "Time Source");
|
||||
}
|
||||
return time_source;
|
||||
@@ -284,7 +284,7 @@ IDDepsNode *Depsgraph::add_id_node(ID *id, bool do_tag, ID *id_cow_hint)
|
||||
BLI_assert((id->tag & LIB_TAG_COPY_ON_WRITE) == 0);
|
||||
IDDepsNode *id_node = find_id_node(id);
|
||||
if (!id_node) {
|
||||
DepsNodeFactory *factory = deg_get_node_factory(DEG_NODE_TYPE_ID_REF);
|
||||
DepsNodeFactory *factory = deg_type_get_factory(DEG_NODE_TYPE_ID_REF);
|
||||
id_node = (IDDepsNode *)factory->create_node(id, "", id->name);
|
||||
id_node->init_copy_on_write(id_cow_hint);
|
||||
if (do_tag) {
|
||||
|
||||
@@ -103,10 +103,7 @@ struct DepsNodeFactoryImpl : public DepsNodeFactory {
|
||||
void deg_register_node_typeinfo(DepsNodeFactory *factory);
|
||||
|
||||
/* Get typeinfo for specified type */
|
||||
DepsNodeFactory *deg_get_node_factory(const eDepsNode_Type type);
|
||||
|
||||
/* Get typeinfo for provided node */
|
||||
DepsNodeFactory *deg_node_get_factory(const DepsNode *node);
|
||||
DepsNodeFactory *deg_type_get_factory(const eDepsNode_Type type);
|
||||
|
||||
/* Editors Integration -------------------------------------------------- */
|
||||
|
||||
|
||||
@@ -51,14 +51,7 @@ namespace DEG {
|
||||
|
||||
/* Global type registry */
|
||||
|
||||
/**
|
||||
* \note For now, this is a hashtable not array, since the core node types
|
||||
* currently do not have contiguous ID values. Using a hash here gives us
|
||||
* more flexibility, albeit using more memory and also sacrificing a little
|
||||
* speed. Later on, when things stabilise we may turn this back to an array
|
||||
* since there are only just a few node types that an array would cope fine...
|
||||
*/
|
||||
static GHash *_depsnode_typeinfo_registry = NULL;
|
||||
static DepsNodeFactory *depsnode_typeinfo_registry[NUM_DEG_NODE_TYPES] = {NULL};
|
||||
|
||||
/* Registration ------------------------------------------- */
|
||||
|
||||
@@ -66,28 +59,16 @@ static GHash *_depsnode_typeinfo_registry = NULL;
|
||||
void deg_register_node_typeinfo(DepsNodeFactory *factory)
|
||||
{
|
||||
BLI_assert(factory != NULL);
|
||||
BLI_ghash_insert(_depsnode_typeinfo_registry,
|
||||
SET_INT_IN_POINTER(factory->type()),
|
||||
factory);
|
||||
depsnode_typeinfo_registry[factory->type()] = factory;
|
||||
}
|
||||
|
||||
/* Getters ------------------------------------------------- */
|
||||
|
||||
/* Get typeinfo for specified type */
|
||||
DepsNodeFactory *deg_get_node_factory(const eDepsNode_Type type)
|
||||
DepsNodeFactory *deg_type_get_factory(const eDepsNode_Type type)
|
||||
{
|
||||
/* look up type - at worst, it doesn't exist in table yet, and we fail */
|
||||
return (DepsNodeFactory *)BLI_ghash_lookup(_depsnode_typeinfo_registry,
|
||||
SET_INT_IN_POINTER(type));
|
||||
}
|
||||
|
||||
/* Get typeinfo for provided node */
|
||||
DepsNodeFactory *deg_node_get_factory(const DepsNode *node)
|
||||
{
|
||||
if (node != NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return deg_get_node_factory(node->type);
|
||||
return depsnode_typeinfo_registry[type];
|
||||
}
|
||||
|
||||
/* Stringified opcodes ------------------------------------- */
|
||||
@@ -183,9 +164,6 @@ const char *DepsOperationStringifier::operator[](eDepsOperation_Code opcode)
|
||||
/* Register all node types */
|
||||
void DEG_register_node_types(void)
|
||||
{
|
||||
/* initialise registry */
|
||||
DEG::_depsnode_typeinfo_registry = BLI_ghash_int_new("Depsgraph Node Type Registry");
|
||||
|
||||
/* register node types */
|
||||
DEG::deg_register_base_depsnodes();
|
||||
DEG::deg_register_component_depsnodes();
|
||||
@@ -195,5 +173,4 @@ void DEG_register_node_types(void)
|
||||
/* Free registry on exit */
|
||||
void DEG_free_node_types(void)
|
||||
{
|
||||
BLI_ghash_free(DEG::_depsnode_typeinfo_registry, NULL, NULL);
|
||||
}
|
||||
|
||||
@@ -96,9 +96,9 @@ typedef enum eDepsNode_LinkedState_Type {
|
||||
/* Types of Nodes */
|
||||
typedef enum eDepsNode_Type {
|
||||
/* Fallback type for invalid return value */
|
||||
DEG_NODE_TYPE_UNDEFINED = -1,
|
||||
DEG_NODE_TYPE_UNDEFINED = 0,
|
||||
/* Inner Node (Operation) */
|
||||
DEG_NODE_TYPE_OPERATION = 0,
|
||||
DEG_NODE_TYPE_OPERATION,
|
||||
|
||||
/* **** Generic Types **** */
|
||||
|
||||
@@ -149,6 +149,9 @@ typedef enum eDepsNode_Type {
|
||||
DEG_NODE_TYPE_CACHE,
|
||||
/* Batch Cache Component */
|
||||
DEG_NODE_TYPE_BATCH_CACHE,
|
||||
|
||||
/* Total number of meaningful node types. */
|
||||
NUM_DEG_NODE_TYPES,
|
||||
} eDepsNode_Type;
|
||||
|
||||
/* Identifiers for common operations (as an enum). */
|
||||
|
||||
@@ -250,7 +250,7 @@ ComponentDepsNode *IDDepsNode::add_component(eDepsNode_Type type,
|
||||
{
|
||||
ComponentDepsNode *comp_node = find_component(type, name);
|
||||
if (!comp_node) {
|
||||
DepsNodeFactory *factory = deg_get_node_factory(type);
|
||||
DepsNodeFactory *factory = deg_type_get_factory(type);
|
||||
comp_node = (ComponentDepsNode *)factory->create_node(this->id_orig, "", name);
|
||||
|
||||
/* Register. */
|
||||
|
||||
@@ -227,7 +227,7 @@ OperationDepsNode *ComponentDepsNode::add_operation(const DepsEvalOperationCb& o
|
||||
{
|
||||
OperationDepsNode *op_node = find_operation(opcode, name, name_tag);
|
||||
if (!op_node) {
|
||||
DepsNodeFactory *factory = deg_get_node_factory(DEG_NODE_TYPE_OPERATION);
|
||||
DepsNodeFactory *factory = deg_type_get_factory(DEG_NODE_TYPE_OPERATION);
|
||||
op_node = (OperationDepsNode *)factory->create_node(this->owner->id_orig, "", name);
|
||||
|
||||
/* register opnode in this component's operation set */
|
||||
|
||||
Reference in New Issue
Block a user