Cleanup: Nuke most of remaining evil G.main from RNA.
The few ones in getters/setters we cannot remove as easily, for now we can live with those I think...
This commit is contained in:
parent
edce44d693
commit
38cb29d67e
@ -458,9 +458,9 @@ static Material *rna_IDMaterials_pop_id(ID *id, Main *bmain, ReportList *reports
|
||||
return ma;
|
||||
}
|
||||
|
||||
static void rna_IDMaterials_clear_id(ID *id, int remove_material_slot)
|
||||
static void rna_IDMaterials_clear_id(ID *id, Main *bmain, int remove_material_slot)
|
||||
{
|
||||
BKE_material_clear_id(G.main, id, remove_material_slot);
|
||||
BKE_material_clear_id(bmain, id, remove_material_slot);
|
||||
|
||||
DAG_id_tag_update(id, OB_RECALC_DATA);
|
||||
WM_main_add_notifier(NC_OBJECT | ND_DRAW, id);
|
||||
@ -882,6 +882,7 @@ static void rna_def_ID_materials(BlenderRNA *brna)
|
||||
RNA_def_function_return(func, parm);
|
||||
|
||||
func = RNA_def_function(srna, "clear", "rna_IDMaterials_clear_id");
|
||||
RNA_def_function_flag(func, FUNC_USE_MAIN);
|
||||
RNA_def_function_ui_description(func, "Remove all materials from the data-block");
|
||||
RNA_def_boolean(func, "update_data", 0, "", "Update data by re-adjusting the material slots assigned");
|
||||
}
|
||||
|
@ -726,7 +726,7 @@ static bNode *rna_NodeTree_node_new(bNodeTree *ntree, bContext *C, ReportList *r
|
||||
return node;
|
||||
}
|
||||
|
||||
static void rna_NodeTree_node_remove(bNodeTree *ntree, ReportList *reports, PointerRNA *node_ptr)
|
||||
static void rna_NodeTree_node_remove(bNodeTree *ntree, Main *bmain, ReportList *reports, PointerRNA *node_ptr)
|
||||
{
|
||||
bNode *node = node_ptr->data;
|
||||
|
||||
@ -742,11 +742,11 @@ static void rna_NodeTree_node_remove(bNodeTree *ntree, ReportList *reports, Poin
|
||||
nodeFreeNode(ntree, node);
|
||||
RNA_POINTER_INVALIDATE(node_ptr);
|
||||
|
||||
ntreeUpdateTree(G.main, ntree); /* update group node socket links */
|
||||
ntreeUpdateTree(bmain, ntree); /* update group node socket links */
|
||||
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
|
||||
}
|
||||
|
||||
static void rna_NodeTree_node_clear(bNodeTree *ntree, ReportList *reports)
|
||||
static void rna_NodeTree_node_clear(bNodeTree *ntree, Main *bmain, ReportList *reports)
|
||||
{
|
||||
bNode *node = ntree->nodes.first;
|
||||
|
||||
@ -764,7 +764,7 @@ static void rna_NodeTree_node_clear(bNodeTree *ntree, ReportList *reports)
|
||||
node = next_node;
|
||||
}
|
||||
|
||||
ntreeUpdateTree(G.main, ntree);
|
||||
ntreeUpdateTree(bmain, ntree);
|
||||
|
||||
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
|
||||
}
|
||||
@ -787,7 +787,7 @@ static void rna_NodeTree_active_node_set(PointerRNA *ptr, const PointerRNA value
|
||||
nodeClearActive(ntree);
|
||||
}
|
||||
|
||||
static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, ReportList *reports,
|
||||
static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, Main *bmain, ReportList *reports,
|
||||
bNodeSocket *fromsock, bNodeSocket *tosock,
|
||||
int verify_limits)
|
||||
{
|
||||
@ -829,15 +829,15 @@ static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, ReportList *reports,
|
||||
if (tonode)
|
||||
nodeUpdate(ntree, tonode);
|
||||
|
||||
ntreeUpdateTree(G.main, ntree);
|
||||
ntreeUpdateTree(bmain, ntree);
|
||||
|
||||
ED_node_tag_update_nodetree(G.main, ntree, ret->tonode);
|
||||
ED_node_tag_update_nodetree(bmain, ntree, ret->tonode);
|
||||
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void rna_NodeTree_link_remove(bNodeTree *ntree, ReportList *reports, PointerRNA *link_ptr)
|
||||
static void rna_NodeTree_link_remove(bNodeTree *ntree, Main *bmain, ReportList *reports, PointerRNA *link_ptr)
|
||||
{
|
||||
bNodeLink *link = link_ptr->data;
|
||||
|
||||
@ -852,11 +852,11 @@ static void rna_NodeTree_link_remove(bNodeTree *ntree, ReportList *reports, Poin
|
||||
nodeRemLink(ntree, link);
|
||||
RNA_POINTER_INVALIDATE(link_ptr);
|
||||
|
||||
ntreeUpdateTree(G.main, ntree);
|
||||
ntreeUpdateTree(bmain, ntree);
|
||||
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
|
||||
}
|
||||
|
||||
static void rna_NodeTree_link_clear(bNodeTree *ntree, ReportList *reports)
|
||||
static void rna_NodeTree_link_clear(bNodeTree *ntree, Main *bmain, ReportList *reports)
|
||||
{
|
||||
bNodeLink *link = ntree->links.first;
|
||||
|
||||
@ -870,7 +870,7 @@ static void rna_NodeTree_link_clear(bNodeTree *ntree, ReportList *reports)
|
||||
|
||||
link = next_link;
|
||||
}
|
||||
ntreeUpdateTree(G.main, ntree);
|
||||
ntreeUpdateTree(bmain, ntree);
|
||||
|
||||
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
|
||||
}
|
||||
@ -933,7 +933,7 @@ static void rna_NodeTree_active_output_set(PointerRNA *ptr, int value)
|
||||
}
|
||||
}
|
||||
|
||||
static bNodeSocket *rna_NodeTree_inputs_new(bNodeTree *ntree, ReportList *reports, const char *type, const char *name)
|
||||
static bNodeSocket *rna_NodeTree_inputs_new(bNodeTree *ntree, Main *bmain, ReportList *reports, const char *type, const char *name)
|
||||
{
|
||||
bNodeSocket *sock;
|
||||
|
||||
@ -942,13 +942,13 @@ static bNodeSocket *rna_NodeTree_inputs_new(bNodeTree *ntree, ReportList *report
|
||||
|
||||
sock = ntreeAddSocketInterface(ntree, SOCK_IN, type, name);
|
||||
|
||||
ntreeUpdateTree(G.main, ntree);
|
||||
ntreeUpdateTree(bmain, ntree);
|
||||
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
|
||||
|
||||
return sock;
|
||||
}
|
||||
|
||||
static bNodeSocket *rna_NodeTree_outputs_new(bNodeTree *ntree, ReportList *reports, const char *type, const char *name)
|
||||
static bNodeSocket *rna_NodeTree_outputs_new(bNodeTree *ntree, Main *bmain, ReportList *reports, const char *type, const char *name)
|
||||
{
|
||||
bNodeSocket *sock;
|
||||
|
||||
@ -957,13 +957,13 @@ static bNodeSocket *rna_NodeTree_outputs_new(bNodeTree *ntree, ReportList *repor
|
||||
|
||||
sock = ntreeAddSocketInterface(ntree, SOCK_OUT, type, name);
|
||||
|
||||
ntreeUpdateTree(G.main, ntree);
|
||||
ntreeUpdateTree(bmain, ntree);
|
||||
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
|
||||
|
||||
return sock;
|
||||
}
|
||||
|
||||
static void rna_NodeTree_socket_remove(bNodeTree *ntree, ReportList *reports, bNodeSocket *sock)
|
||||
static void rna_NodeTree_socket_remove(bNodeTree *ntree, Main *bmain, ReportList *reports, bNodeSocket *sock)
|
||||
{
|
||||
if (!rna_NodeTree_check(ntree, reports))
|
||||
return;
|
||||
@ -974,12 +974,12 @@ static void rna_NodeTree_socket_remove(bNodeTree *ntree, ReportList *reports, bN
|
||||
else {
|
||||
ntreeRemoveSocketInterface(ntree, sock);
|
||||
|
||||
ntreeUpdateTree(G.main, ntree);
|
||||
ntreeUpdateTree(bmain, ntree);
|
||||
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
|
||||
}
|
||||
}
|
||||
|
||||
static void rna_NodeTree_inputs_clear(bNodeTree *ntree, ReportList *reports)
|
||||
static void rna_NodeTree_inputs_clear(bNodeTree *ntree, Main *bmain, ReportList *reports)
|
||||
{
|
||||
bNodeSocket *sock, *nextsock;
|
||||
|
||||
@ -991,11 +991,11 @@ static void rna_NodeTree_inputs_clear(bNodeTree *ntree, ReportList *reports)
|
||||
ntreeRemoveSocketInterface(ntree, sock);
|
||||
}
|
||||
|
||||
ntreeUpdateTree(G.main, ntree);
|
||||
ntreeUpdateTree(bmain, ntree);
|
||||
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
|
||||
}
|
||||
|
||||
static void rna_NodeTree_outputs_clear(bNodeTree *ntree, ReportList *reports)
|
||||
static void rna_NodeTree_outputs_clear(bNodeTree *ntree, Main *bmain, ReportList *reports)
|
||||
{
|
||||
bNodeSocket *sock, *nextsock;
|
||||
|
||||
@ -1007,11 +1007,11 @@ static void rna_NodeTree_outputs_clear(bNodeTree *ntree, ReportList *reports)
|
||||
ntreeRemoveSocketInterface(ntree, sock);
|
||||
}
|
||||
|
||||
ntreeUpdateTree(G.main, ntree);
|
||||
ntreeUpdateTree(bmain, ntree);
|
||||
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
|
||||
}
|
||||
|
||||
static void rna_NodeTree_inputs_move(bNodeTree *ntree, int from_index, int to_index)
|
||||
static void rna_NodeTree_inputs_move(bNodeTree *ntree, Main *bmain, int from_index, int to_index)
|
||||
{
|
||||
bNodeSocket *sock;
|
||||
|
||||
@ -1038,11 +1038,11 @@ static void rna_NodeTree_inputs_move(bNodeTree *ntree, int from_index, int to_in
|
||||
|
||||
ntree->update |= NTREE_UPDATE_GROUP_IN;
|
||||
|
||||
ntreeUpdateTree(G.main, ntree);
|
||||
ntreeUpdateTree(bmain, ntree);
|
||||
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
|
||||
}
|
||||
|
||||
static void rna_NodeTree_outputs_move(bNodeTree *ntree, int from_index, int to_index)
|
||||
static void rna_NodeTree_outputs_move(bNodeTree *ntree, Main *bmain, int from_index, int to_index)
|
||||
{
|
||||
bNodeSocket *sock;
|
||||
|
||||
@ -1069,16 +1069,18 @@ static void rna_NodeTree_outputs_move(bNodeTree *ntree, int from_index, int to_i
|
||||
|
||||
ntree->update |= NTREE_UPDATE_GROUP_OUT;
|
||||
|
||||
ntreeUpdateTree(G.main, ntree);
|
||||
ntreeUpdateTree(bmain, ntree);
|
||||
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
|
||||
}
|
||||
|
||||
static void rna_NodeTree_interface_update(bNodeTree *ntree, bContext *C)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
|
||||
ntree->update |= NTREE_UPDATE_GROUP;
|
||||
ntreeUpdateTree(G.main, ntree);
|
||||
ntreeUpdateTree(bmain, ntree);
|
||||
|
||||
ED_node_tag_update_nodetree(CTX_data_main(C), ntree, NULL);
|
||||
ED_node_tag_update_nodetree(bmain, ntree, NULL);
|
||||
}
|
||||
|
||||
|
||||
@ -1608,7 +1610,7 @@ static void rna_Node_name_set(PointerRNA *ptr, const char *value)
|
||||
BKE_animdata_fix_paths_rename_all(NULL, "nodes", oldname, node->name);
|
||||
}
|
||||
|
||||
static bNodeSocket *rna_Node_inputs_new(ID *id, bNode *node, ReportList *reports, const char *type, const char *name, const char *identifier)
|
||||
static bNodeSocket *rna_Node_inputs_new(ID *id, bNode *node, Main *bmain, ReportList *reports, const char *type, const char *name, const char *identifier)
|
||||
{
|
||||
bNodeTree *ntree = (bNodeTree *)id;
|
||||
bNodeSocket *sock;
|
||||
@ -1619,14 +1621,14 @@ static bNodeSocket *rna_Node_inputs_new(ID *id, bNode *node, ReportList *reports
|
||||
BKE_report(reports, RPT_ERROR, "Unable to create socket");
|
||||
}
|
||||
else {
|
||||
ntreeUpdateTree(G.main, ntree);
|
||||
ntreeUpdateTree(bmain, ntree);
|
||||
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
|
||||
}
|
||||
|
||||
return sock;
|
||||
}
|
||||
|
||||
static bNodeSocket *rna_Node_outputs_new(ID *id, bNode *node, ReportList *reports, const char *type, const char *name, const char *identifier)
|
||||
static bNodeSocket *rna_Node_outputs_new(ID *id, bNode *node, Main *bmain, ReportList *reports, const char *type, const char *name, const char *identifier)
|
||||
{
|
||||
bNodeTree *ntree = (bNodeTree *)id;
|
||||
bNodeSocket *sock;
|
||||
@ -1637,14 +1639,14 @@ static bNodeSocket *rna_Node_outputs_new(ID *id, bNode *node, ReportList *report
|
||||
BKE_report(reports, RPT_ERROR, "Unable to create socket");
|
||||
}
|
||||
else {
|
||||
ntreeUpdateTree(G.main, ntree);
|
||||
ntreeUpdateTree(bmain, ntree);
|
||||
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
|
||||
}
|
||||
|
||||
return sock;
|
||||
}
|
||||
|
||||
static void rna_Node_socket_remove(ID *id, bNode *node, ReportList *reports, bNodeSocket *sock)
|
||||
static void rna_Node_socket_remove(ID *id, bNode *node, Main *bmain, ReportList *reports, bNodeSocket *sock)
|
||||
{
|
||||
bNodeTree *ntree = (bNodeTree *)id;
|
||||
|
||||
@ -1654,12 +1656,12 @@ static void rna_Node_socket_remove(ID *id, bNode *node, ReportList *reports, bNo
|
||||
else {
|
||||
nodeRemoveSocket(ntree, node, sock);
|
||||
|
||||
ntreeUpdateTree(G.main, ntree);
|
||||
ntreeUpdateTree(bmain, ntree);
|
||||
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
|
||||
}
|
||||
}
|
||||
|
||||
static void rna_Node_inputs_clear(ID *id, bNode *node)
|
||||
static void rna_Node_inputs_clear(ID *id, bNode *node, Main *bmain)
|
||||
{
|
||||
bNodeTree *ntree = (bNodeTree *)id;
|
||||
bNodeSocket *sock, *nextsock;
|
||||
@ -1669,11 +1671,11 @@ static void rna_Node_inputs_clear(ID *id, bNode *node)
|
||||
nodeRemoveSocket(ntree, node, sock);
|
||||
}
|
||||
|
||||
ntreeUpdateTree(G.main, ntree);
|
||||
ntreeUpdateTree(bmain, ntree);
|
||||
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
|
||||
}
|
||||
|
||||
static void rna_Node_outputs_clear(ID *id, bNode *node)
|
||||
static void rna_Node_outputs_clear(ID *id, bNode *node, Main *bmain)
|
||||
{
|
||||
bNodeTree *ntree = (bNodeTree *)id;
|
||||
bNodeSocket *sock, *nextsock;
|
||||
@ -1683,11 +1685,11 @@ static void rna_Node_outputs_clear(ID *id, bNode *node)
|
||||
nodeRemoveSocket(ntree, node, sock);
|
||||
}
|
||||
|
||||
ntreeUpdateTree(G.main, ntree);
|
||||
ntreeUpdateTree(bmain, ntree);
|
||||
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
|
||||
}
|
||||
|
||||
static void rna_Node_inputs_move(ID *id, bNode *node, int from_index, int to_index)
|
||||
static void rna_Node_inputs_move(ID *id, bNode *node, Main *bmain, int from_index, int to_index)
|
||||
{
|
||||
bNodeTree *ntree = (bNodeTree *)id;
|
||||
bNodeSocket *sock;
|
||||
@ -1713,11 +1715,11 @@ static void rna_Node_inputs_move(ID *id, bNode *node, int from_index, int to_ind
|
||||
}
|
||||
}
|
||||
|
||||
ntreeUpdateTree(G.main, ntree);
|
||||
ntreeUpdateTree(bmain, ntree);
|
||||
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
|
||||
}
|
||||
|
||||
static void rna_Node_outputs_move(ID *id, bNode *node, int from_index, int to_index)
|
||||
static void rna_Node_outputs_move(ID *id, bNode *node, Main *bmain, int from_index, int to_index)
|
||||
{
|
||||
bNodeTree *ntree = (bNodeTree *)id;
|
||||
bNodeSocket *sock;
|
||||
@ -1743,7 +1745,7 @@ static void rna_Node_outputs_move(ID *id, bNode *node, int from_index, int to_in
|
||||
}
|
||||
}
|
||||
|
||||
ntreeUpdateTree(G.main, ntree);
|
||||
ntreeUpdateTree(bmain, ntree);
|
||||
WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
|
||||
}
|
||||
|
||||
@ -2216,7 +2218,7 @@ static void rna_NodeSocketInterface_update(Main *bmain, Scene *UNUSED(scene), Po
|
||||
return;
|
||||
|
||||
ntree->update |= NTREE_UPDATE_GROUP;
|
||||
ntreeUpdateTree(G.main, ntree);
|
||||
ntreeUpdateTree(bmain, ntree);
|
||||
|
||||
ED_node_tag_update_nodetree(bmain, ntree, NULL);
|
||||
}
|
||||
@ -5022,17 +5024,17 @@ static void rna_def_cmp_output_file_slots_api(BlenderRNA *brna, PropertyRNA *cpr
|
||||
|
||||
func = RNA_def_function(srna, "remove", "rna_Node_socket_remove");
|
||||
RNA_def_function_ui_description(func, "Remove a file slot from this node");
|
||||
RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS);
|
||||
RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS);
|
||||
parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "The socket to remove");
|
||||
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
||||
|
||||
func = RNA_def_function(srna, "clear", "rna_Node_inputs_clear");
|
||||
RNA_def_function_ui_description(func, "Remove all file slots from this node");
|
||||
RNA_def_function_flag(func, FUNC_USE_SELF_ID);
|
||||
RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
|
||||
|
||||
func = RNA_def_function(srna, "move", "rna_Node_inputs_move");
|
||||
RNA_def_function_ui_description(func, "Move a file slot to another position");
|
||||
RNA_def_function_flag(func, FUNC_USE_SELF_ID);
|
||||
RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
|
||||
parm = RNA_def_int(func, "from_index", -1, 0, INT_MAX, "From Index", "Index of the socket to move", 0, 10000);
|
||||
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
||||
parm = RNA_def_int(func, "to_index", -1, 0, INT_MAX, "To Index", "Target index for the socket", 0, 10000);
|
||||
@ -7765,7 +7767,7 @@ static void rna_def_node_sockets_api(BlenderRNA *brna, PropertyRNA *cprop, int i
|
||||
|
||||
func = RNA_def_function(srna, "new", newfunc);
|
||||
RNA_def_function_ui_description(func, "Add a socket to this node");
|
||||
RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS);
|
||||
RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS);
|
||||
parm = RNA_def_string(func, "type", NULL, MAX_NAME, "Type", "Data type");
|
||||
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
||||
parm = RNA_def_string(func, "name", NULL, MAX_NAME, "Name", "");
|
||||
@ -7777,17 +7779,17 @@ static void rna_def_node_sockets_api(BlenderRNA *brna, PropertyRNA *cprop, int i
|
||||
|
||||
func = RNA_def_function(srna, "remove", "rna_Node_socket_remove");
|
||||
RNA_def_function_ui_description(func, "Remove a socket from this node");
|
||||
RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS);
|
||||
RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS);
|
||||
parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "The socket to remove");
|
||||
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
||||
|
||||
func = RNA_def_function(srna, "clear", clearfunc);
|
||||
RNA_def_function_ui_description(func, "Remove all sockets from this node");
|
||||
RNA_def_function_flag(func, FUNC_USE_SELF_ID);
|
||||
RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
|
||||
|
||||
func = RNA_def_function(srna, "move", movefunc);
|
||||
RNA_def_function_ui_description(func, "Move a socket to another position");
|
||||
RNA_def_function_flag(func, FUNC_USE_SELF_ID);
|
||||
RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
|
||||
parm = RNA_def_int(func, "from_index", -1, 0, INT_MAX, "From Index", "Index of the socket to move", 0, 10000);
|
||||
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
||||
parm = RNA_def_int(func, "to_index", -1, 0, INT_MAX, "To Index", "Target index for the socket", 0, 10000);
|
||||
@ -8158,14 +8160,14 @@ static void rna_def_nodetree_nodes_api(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
|
||||
func = RNA_def_function(srna, "remove", "rna_NodeTree_node_remove");
|
||||
RNA_def_function_ui_description(func, "Remove a node from this node tree");
|
||||
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
||||
RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
|
||||
parm = RNA_def_pointer(func, "node", "Node", "", "The node to remove");
|
||||
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
||||
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
|
||||
|
||||
func = RNA_def_function(srna, "clear", "rna_NodeTree_node_clear");
|
||||
RNA_def_function_ui_description(func, "Remove all nodes from this node tree");
|
||||
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
||||
RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
|
||||
|
||||
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "Node");
|
||||
@ -8188,7 +8190,7 @@ static void rna_def_nodetree_link_api(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
|
||||
func = RNA_def_function(srna, "new", "rna_NodeTree_link_new");
|
||||
RNA_def_function_ui_description(func, "Add a node link to this node tree");
|
||||
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
||||
RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
|
||||
parm = RNA_def_pointer(func, "input", "NodeSocket", "", "The input socket");
|
||||
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
|
||||
parm = RNA_def_pointer(func, "output", "NodeSocket", "", "The output socket");
|
||||
@ -8200,14 +8202,14 @@ static void rna_def_nodetree_link_api(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
|
||||
func = RNA_def_function(srna, "remove", "rna_NodeTree_link_remove");
|
||||
RNA_def_function_ui_description(func, "remove a node link from the node tree");
|
||||
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
||||
RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
|
||||
parm = RNA_def_pointer(func, "link", "NodeLink", "", "The node link to remove");
|
||||
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
||||
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
|
||||
|
||||
func = RNA_def_function(srna, "clear", "rna_NodeTree_link_clear");
|
||||
RNA_def_function_ui_description(func, "remove all node links from the node tree");
|
||||
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
||||
RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
|
||||
}
|
||||
|
||||
static void rna_def_node_tree_sockets_api(BlenderRNA *brna, PropertyRNA *cprop, int in_out)
|
||||
@ -8228,7 +8230,7 @@ static void rna_def_node_tree_sockets_api(BlenderRNA *brna, PropertyRNA *cprop,
|
||||
|
||||
func = RNA_def_function(srna, "new", newfunc);
|
||||
RNA_def_function_ui_description(func, "Add a socket to this node tree");
|
||||
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
||||
RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
|
||||
parm = RNA_def_string(func, "type", NULL, MAX_NAME, "Type", "Data type");
|
||||
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
||||
parm = RNA_def_string(func, "name", NULL, MAX_NAME, "Name", "");
|
||||
@ -8239,16 +8241,17 @@ static void rna_def_node_tree_sockets_api(BlenderRNA *brna, PropertyRNA *cprop,
|
||||
|
||||
func = RNA_def_function(srna, "remove", "rna_NodeTree_socket_remove");
|
||||
RNA_def_function_ui_description(func, "Remove a socket from this node tree");
|
||||
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
||||
RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
|
||||
parm = RNA_def_pointer(func, "socket", "NodeSocketInterface", "", "The socket to remove");
|
||||
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
||||
|
||||
func = RNA_def_function(srna, "clear", clearfunc);
|
||||
RNA_def_function_ui_description(func, "Remove all sockets from this node tree");
|
||||
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
||||
RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
|
||||
|
||||
func = RNA_def_function(srna, "move", movefunc);
|
||||
RNA_def_function_ui_description(func, "Move a socket to another position");
|
||||
RNA_def_function_flag(func, FUNC_USE_MAIN);
|
||||
parm = RNA_def_int(func, "from_index", -1, 0, INT_MAX, "From Index", "Index of the socket to move", 0, 10000);
|
||||
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
||||
parm = RNA_def_int(func, "to_index", -1, 0, INT_MAX, "To Index", "Target index for the socket", 0, 10000);
|
||||
|
@ -140,10 +140,10 @@ static void rna_Object_camera_fit_coords(
|
||||
/* copied from Mesh_getFromObject and adapted to RNA interface */
|
||||
/* settings: 0 - preview, 1 - render */
|
||||
static Mesh *rna_Object_to_mesh(
|
||||
Object *ob, ReportList *reports, Scene *sce,
|
||||
Object *ob, Main *bmain, ReportList *reports, Scene *sce,
|
||||
int apply_modifiers, int settings, int calc_tessface, int calc_undeformed)
|
||||
{
|
||||
return rna_Main_meshes_new_from_object(G.main, reports, sce, ob, apply_modifiers, settings, calc_tessface, calc_undeformed);
|
||||
return rna_Main_meshes_new_from_object(bmain, reports, sce, ob, apply_modifiers, settings, calc_tessface, calc_undeformed);
|
||||
}
|
||||
|
||||
/* mostly a copy from convertblender.c */
|
||||
@ -558,7 +558,7 @@ void RNA_api_object(StructRNA *srna)
|
||||
/* mesh */
|
||||
func = RNA_def_function(srna, "to_mesh", "rna_Object_to_mesh");
|
||||
RNA_def_function_ui_description(func, "Create a Mesh data-block with modifiers applied");
|
||||
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
||||
RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
|
||||
parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene within which to evaluate modifiers");
|
||||
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
|
||||
parm = RNA_def_boolean(func, "apply_modifiers", 0, "", "Apply modifiers");
|
||||
|
@ -628,7 +628,7 @@ static PointerRNA rna_Scene_objects_get(CollectionPropertyIterator *iter)
|
||||
return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ((Base *)internal->link)->object);
|
||||
}
|
||||
|
||||
static Base *rna_Scene_object_link(Scene *scene, bContext *C, ReportList *reports, Object *ob)
|
||||
static Base *rna_Scene_object_link(Scene *scene, Main *UNUSED(bmain), bContext *C, ReportList *reports, Object *ob)
|
||||
{
|
||||
Scene *scene_act = CTX_data_scene(C);
|
||||
Base *base;
|
||||
@ -653,14 +653,14 @@ static Base *rna_Scene_object_link(Scene *scene, bContext *C, ReportList *report
|
||||
DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
|
||||
|
||||
/* slows down importers too much, run scene.update() */
|
||||
/* DAG_srelations_tag_update(G.main); */
|
||||
/* DAG_srelations_tag_update(bmain); */
|
||||
|
||||
WM_main_add_notifier(NC_SCENE | ND_OB_ACTIVE, scene);
|
||||
|
||||
return base;
|
||||
}
|
||||
|
||||
static void rna_Scene_object_unlink(Scene *scene, ReportList *reports, Object *ob)
|
||||
static void rna_Scene_object_unlink(Scene *scene, Main *bmain, ReportList *reports, Object *ob)
|
||||
{
|
||||
Base *base = BKE_scene_base_find(scene, ob);
|
||||
if (!base) {
|
||||
@ -681,7 +681,7 @@ static void rna_Scene_object_unlink(Scene *scene, ReportList *reports, Object *o
|
||||
id_us_min(&ob->id);
|
||||
|
||||
/* needed otherwise the depgraph will contain freed objects which can crash, see [#20958] */
|
||||
DAG_relations_tag_update(G.main);
|
||||
DAG_relations_tag_update(bmain);
|
||||
|
||||
WM_main_add_notifier(NC_SCENE | ND_OB_ACTIVE, scene);
|
||||
}
|
||||
@ -6649,7 +6649,7 @@ static void rna_def_scene_objects(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
|
||||
func = RNA_def_function(srna, "link", "rna_Scene_object_link");
|
||||
RNA_def_function_ui_description(func, "Link object to scene, run scene.update() after");
|
||||
RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
|
||||
RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
|
||||
parm = RNA_def_pointer(func, "object", "Object", "", "Object to add to scene");
|
||||
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
|
||||
parm = RNA_def_pointer(func, "base", "ObjectBase", "", "The newly created base");
|
||||
@ -6657,7 +6657,7 @@ static void rna_def_scene_objects(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
|
||||
func = RNA_def_function(srna, "unlink", "rna_Scene_object_unlink");
|
||||
RNA_def_function_ui_description(func, "Unlink object from scene");
|
||||
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
||||
RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
|
||||
parm = RNA_def_pointer(func, "object", "Object", "", "Object to remove from scene");
|
||||
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
|
||||
|
||||
|
@ -134,7 +134,8 @@ static void rna_Scene_update_tagged(Scene *scene, Main *bmain)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, int preview, const char *view, char *name)
|
||||
static void rna_SceneRender_get_frame_path(
|
||||
RenderData *rd, Main *bmain, int frame, int preview, const char *view, char *name)
|
||||
{
|
||||
const char *suffix = BKE_scene_multiview_view_suffix_get(rd, view);
|
||||
|
||||
@ -147,20 +148,20 @@ static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, int previe
|
||||
}
|
||||
else {
|
||||
BKE_image_path_from_imformat(
|
||||
name, rd->pic, G.main->name, (frame == INT_MIN) ? rd->cfra : frame,
|
||||
name, rd->pic, bmain->name, (frame == INT_MIN) ? rd->cfra : frame,
|
||||
&rd->im_format, (rd->scemode & R_EXTENSION) != 0, true, suffix);
|
||||
}
|
||||
}
|
||||
|
||||
static void rna_Scene_ray_cast(
|
||||
Scene *scene, float origin[3], float direction[3], float ray_dist,
|
||||
Scene *scene, Main *bmain,
|
||||
float origin[3], float direction[3], float ray_dist,
|
||||
int *r_success, float r_location[3], float r_normal[3], int *r_index,
|
||||
Object **r_ob, float r_obmat[16])
|
||||
{
|
||||
normalize_v3(direction);
|
||||
|
||||
SnapObjectContext *sctx = ED_transform_snap_object_context_create(
|
||||
G.main, scene, 0);
|
||||
SnapObjectContext *sctx = ED_transform_snap_object_context_create(bmain, scene, 0);
|
||||
|
||||
bool ret = ED_transform_snap_object_project_ray_ex(
|
||||
sctx,
|
||||
@ -296,6 +297,7 @@ void RNA_api_scene(StructRNA *srna)
|
||||
|
||||
/* Ray Cast */
|
||||
func = RNA_def_function(srna, "ray_cast", "rna_Scene_ray_cast");
|
||||
RNA_def_function_flag(func, FUNC_USE_MAIN);
|
||||
RNA_def_function_ui_description(func, "Cast a ray onto in object space");
|
||||
/* ray start and end */
|
||||
parm = RNA_def_float_vector(func, "origin", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
|
||||
@ -377,6 +379,7 @@ void RNA_api_scene_render(StructRNA *srna)
|
||||
PropertyRNA *parm;
|
||||
|
||||
func = RNA_def_function(srna, "frame_path", "rna_SceneRender_get_frame_path");
|
||||
RNA_def_function_flag(func, FUNC_USE_MAIN);
|
||||
RNA_def_function_ui_description(func, "Return the absolute path to the filename to be written for a given frame");
|
||||
RNA_def_int(func, "frame", INT_MIN, INT_MIN, INT_MAX, "",
|
||||
"Frame number to use, if unset the current frame will be used", MINAFRAME, MAXFRAME);
|
||||
|
Loading…
Reference in New Issue
Block a user