[Bf-blender-cvs] [95e0cb499b1] datablock_idprops: Cleanup and minor changes.
Bastien Montagne
noreply at git.blender.org
Mon Mar 27 15:20:01 CEST 2017
Commit: 95e0cb499b1401fa62de1c36126a98fdc300a734
Author: Bastien Montagne
Date: Mon Mar 27 14:49:40 2017 +0200
Branches: datablock_idprops
https://developer.blender.org/rB95e0cb499b1401fa62de1c36126a98fdc300a734
Cleanup and minor changes.
No functional change expected, mostly:
* Some renaming, bit of style editing, cleanup...
* Removing some useless diff from master.
===================================================================
M source/blender/blenkernel/intern/idprop.c
M source/blender/blenkernel/intern/library_query.c
M source/blender/blenkernel/intern/library_remap.c
M source/blender/blenloader/intern/readfile.c
M source/blender/editors/include/UI_interface.h
M source/blender/editors/interface/interface_intern.h
M source/blender/editors/interface/interface_layout.c
M source/blender/editors/interface/interface_regions.c
M source/blender/editors/interface/interface_templates.c
M source/blender/editors/interface/interface_utils.c
M source/blender/editors/object/object_relations.c
M source/blender/makesrna/RNA_access.h
M source/blender/makesrna/intern/rna_access.c
M source/blender/makesrna/intern/rna_define.c
M source/blender/makesrna/intern/rna_internal_types.h
M source/blender/python/intern/bpy_props.c
M source/blender/python/intern/bpy_rna.c
M source/creator/creator.c
M source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
===================================================================
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index 99a6d6a9865..4bd17f38ebd 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -490,6 +490,7 @@ static void IDP_id_unregister(IDProperty *prop)
/** \} */
+
/* -------------------------------------------------------------------- */
/* Group Functions */
diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c
index 378690add1a..8fec5046b1f 100644
--- a/source/blender/blenkernel/intern/library_query.c
+++ b/source/blender/blenkernel/intern/library_query.c
@@ -33,6 +33,7 @@
#include "DNA_actuator_types.h"
#include "DNA_anim_types.h"
+#include "DNA_armature_types.h"
#include "DNA_brush_types.h"
#include "DNA_camera_types.h"
#include "DNA_constraint_types.h"
@@ -61,7 +62,6 @@
#include "DNA_text_types.h"
#include "DNA_vfont_types.h"
#include "DNA_world_types.h"
-#include "DNA_armature_types.h"
#include "BLI_utildefines.h"
#include "BLI_listbase.h"
@@ -71,17 +71,18 @@
#include "BKE_animsys.h"
#include "BKE_constraint.h"
#include "BKE_fcurve.h"
+#include "BKE_idprop.h"
#include "BKE_library.h"
#include "BKE_library_query.h"
#include "BKE_main.h"
#include "BKE_modifier.h"
+#include "BKE_node.h"
#include "BKE_particle.h"
#include "BKE_rigidbody.h"
#include "BKE_sca.h"
#include "BKE_sequencer.h"
#include "BKE_tracking.h"
-#include "BKE_idprop.h"
-#include "BKE_node.h"
+
#define FOREACH_FINALIZE _finalize
#define FOREACH_FINALIZE_VOID FOREACH_FINALIZE: (void)0
@@ -142,8 +143,6 @@ typedef struct LibraryForeachIDData {
BLI_LINKSTACK_DECLARE(ids_todo, ID *);
} LibraryForeachIDData;
-static void library_foreach_idproperty_ID_link(LibraryForeachIDData *data, IDProperty *prop, int flag);
-
static void library_foreach_rigidbodyworldSceneLooper(
struct RigidBodyWorld *UNUSED(rbw), ID **id_pointer, void *user_data, int cb_flag)
{
@@ -594,6 +593,15 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
break;
}
+ case ID_AR:
+ {
+ bArmature *arm = (bArmature *) id;
+ Bone *bone;
+ for (bone = arm->bonebase.first; bone; bone=bone->next)
+ library_foreach_idproperty_ID_link(&data, bone->prop, IDWALK_CB_USER);
+ break;
+ }
+
case ID_ME:
{
Mesh *mesh = (Mesh *) id;
@@ -779,7 +787,9 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
CALLBACK_INVOKE(ntree->gpd, IDWALK_CB_USER);
for (node = ntree->nodes.first; node; node = node->next) {
CALLBACK_INVOKE_ID(node->id, IDWALK_CB_USER);
+
library_foreach_idproperty_ID_link(&data, node->prop, IDWALK_CB_USER);
+
bNodeSocket *sock;
for (sock = node->inputs.first; sock; sock = sock->next)
library_foreach_idproperty_ID_link(&data, sock->prop, IDWALK_CB_USER);
@@ -939,14 +949,6 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
break;
}
- case ID_AR:
- {
- bArmature *arm = (bArmature *) id;
- Bone *bone;
- for (bone = arm->bonebase.first; bone; bone=bone->next)
- library_foreach_idproperty_ID_link(&data, bone->prop, IDWALK_CB_USER);
- break;
- }
/* Nothing needed for those... */
case ID_IM:
case ID_VF:
@@ -1003,21 +1005,25 @@ void BKE_library_update_ID_link_user(ID *id_dst, ID *id_src, const int cb_flag)
* IDProps will support ID pointers), we'll have to do some quick checks on IDs themselves... */
bool BKE_library_id_can_use_idtype(ID *id_owner, const short id_type_used)
{
- // any type of ID can be used in custom props
- if (id_owner->properties)
+ /* any type of ID can be used in custom props. */
+ if (id_owner->properties) {
return true;
+ }
const short id_type_owner = GS(id_owner->name);
- // IDProps of bones for armatures and bNode->id can have virtually pointer to any type
- if (ELEM(id_type_owner, ID_NT, ID_AR))
+ /* IDProps of armature bones and nodes, and bNode->id can use virtually any type of ID. */
+ if (ELEM(id_type_owner, ID_NT, ID_AR)) {
return true;
+ }
- if (ntreeFromID(id_owner))
+ if (ntreeFromID(id_owner)) {
return true;
+ }
- if (BKE_animdata_from_id(id_owner))
+ if (BKE_animdata_from_id(id_owner)) {
return true; /* AnimationData can use virtually any kind of datablocks, through drivers especially. */
+ }
switch ((ID_Type)id_type_owner) {
case ID_LI:
diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c
index 5536deb2964..a5be5915ca5 100644
--- a/source/blender/blenkernel/intern/library_remap.c
+++ b/source/blender/blenkernel/intern/library_remap.c
@@ -449,16 +449,15 @@ ATTR_NONNULL(1) static void libblock_remap_data(
while (i--) {
for (ID *id_curr = lb_array[i]->first; id_curr; id_curr = id_curr->next) {
- /* Note that we cannot skip indirect usages of old_id here (if requested), we still need to check it for
- * the user count handling...
- * XXX No more true (except for debug usage of those skipping counters). */
- if (!BKE_library_id_can_use_idtype(id_curr, GS(old_id->name))) {
- continue;
+ if (BKE_library_id_can_use_idtype(id_curr, GS(old_id->name))) {
+ /* Note that we cannot skip indirect usages of old_id here (if requested), we still need to check it for
+ * the user count handling...
+ * XXX No more true (except for debug usage of those skipping counters). */
+ r_id_remap_data->id = id_curr;
+ libblock_remap_data_preprocess(r_id_remap_data);
+ BKE_library_foreach_ID_link(
+ NULL, id_curr, foreach_libblock_remap_callback, (void *)r_id_remap_data, IDWALK_NOP);
}
- r_id_remap_data->id = id_curr;
- libblock_remap_data_preprocess(r_id_remap_data);
- BKE_library_foreach_ID_link(
- NULL, id_curr, foreach_libblock_remap_callback, (void *)r_id_remap_data, IDWALK_NOP);
}
}
}
@@ -748,6 +747,7 @@ void BKE_libblock_free_ex(Main *bmain, void *idv, const bool do_id_user, const b
BPY_id_release(id);
#endif
+ /* XXX TODO this is a no-go, have to check how to remove that call!!! */
/* Currently we should remap id to NULL regardless do_id_user,
because when we will try to remove some other block,
which point to this one with idprop, the attempt
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index ca541a67926..cc1b263208b 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -129,6 +129,7 @@
#include "BKE_library_idmap.h"
#include "BKE_library_query.h"
#include "BKE_idcode.h"
+#include "BKE_idprop.h"
#include "BKE_material.h"
#include "BKE_main.h" // for Main
#include "BKE_mesh.h" // for ME_ defines (patching)
@@ -147,7 +148,6 @@
#include "BKE_outliner_treehash.h"
#include "BKE_sound.h"
#include "BKE_colortools.h"
-#include "BKE_idprop.h"
#include "NOD_common.h"
#include "NOD_socket.h"
@@ -4765,7 +4765,7 @@ static void lib_link_object(FileData *fd, Main *main)
for (ob = main->object.first; ob; ob = ob->id.next) {
if (ob->id.tag & LIB_TAG_NEED_LINK) {
lib_link_animdata(fd, &ob->id, ob->adt);
-
+
// XXX deprecated - old animation system <<<
ob->ipo = newlibadr_us(fd, ob->id.lib, ob->ipo);
ob->action = newlibadr_us(fd, ob->id.lib, ob->action);
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 992181f4e9b..4f275ae7022 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -695,7 +695,7 @@ void UI_but_func_search_set(
int UI_searchbox_size_y(void);
int UI_searchbox_size_x(void);
/* check if a string is in an existing search box */
-int UI_search_items_find_index(uiSearchItems *items, const char *name, size_t offset);
+int UI_search_items_find_index(uiSearchItems *items, const char *name, const size_t offset);
void UI_block_func_handle_set(uiBlock *block, uiBlockHandleFunc func, void *arg);
void UI_block_func_butmenu_set(uiBlock *block, uiMenuHandleFunc func, void *arg);
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 639f3d7faa1..4455aaeb8be 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -604,7 +604,7 @@ int ui_searchbox_autocomplete(struct bContext *C, struct ARegion *ar, uiBut *but
void ui_searchbox_event(struct bContext *C, struct ARegion *ar, uiBut *but, const struct wmEvent *event);
bool ui_searchbox_apply(uiBut *but, struct ARegion *ar);
void ui_searchbox_free(struct bContext *C, struct ARegion *ar);
-void ui_but_search_refresh(uiBut *but, bool is_template_ID);
+void ui_but_search_refresh(uiBut *but, const bool is_template_ID);
uiBlock *ui_popup_block_refresh(
struct bContext *C, uiPopupBlockHandle *handle,
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 0fbbe312b18..bb789f91e76 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -1400,8 +1400,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
/* property with separate label */
else if (type == PROP_ENUM || type == PROP_STRING || type == PROP_POINTER) {
but = ui_item_with_label(layout, block, name, icon, ptr, prop, index, 0, 0, w, h, flag);
- if (but)
- ui_but_add_search(but, ptr, prop, NULL, NULL);
+ ui_but_add_search(but, ptr, prop, NULL, NULL);
if (layout->redalert)
UI_but_flag_enable(but, UI_BUT_REDALERT);
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 17018f422c8..ca3b21b4bbe 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -47,7 +47,6 @@
#include "BKE_screen.h"
#include "BKE_report.h"
#include "BKE_global.h"
-#include "BKE_library.h
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list