Commit: fc383cd56ef9223ef2087001a810f56c5002886e
Author: Bastien Montagne
Date:   Tue Oct 18 10:38:19 2016 +0200
Branches: multi_previews_id
https://developer.blender.org/rBfc383cd56ef9223ef2087001a810f56c5002886e

Add preview to Action datablock.

Hopefully did not forget anything.

===================================================================

M       source/blender/blenkernel/intern/action.c
M       source/blender/blenkernel/intern/icons.c
M       source/blender/blenloader/intern/readfile.c
M       source/blender/blenloader/intern/writefile.c
M       source/blender/editors/interface/interface_icons.c
M       source/blender/makesdna/DNA_action_types.h

===================================================================

diff --git a/source/blender/blenkernel/intern/action.c 
b/source/blender/blenkernel/intern/action.c
index 470098f..04c00f1 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -63,6 +63,7 @@
 #include "BKE_library_remap.h"
 #include "BKE_main.h"
 #include "BKE_object.h"
+#include "BKE_icons.h"
 
 #include "BIK_api.h"
 
@@ -115,6 +116,8 @@ void BKE_action_free(bAction *act)
                
        /* Free pose-references (aka local markers) */
        BLI_freelistN(&act->markers);
+
+       BKE_previewimg_free(&act->preview);
 }
 
 /* .................................. */
@@ -158,6 +161,8 @@ bAction *BKE_action_copy(Main *bmain, bAction *src)
        
        BKE_id_copy_ensure_local(bmain, &src->id, &dst->id);
 
+       BKE_previewimg_id_copy(&dst->id, &src->id);
+
        return dst;
 }
 
diff --git a/source/blender/blenkernel/intern/icons.c 
b/source/blender/blenkernel/intern/icons.c
index b35d1eb..ea0301c 100644
--- a/source/blender/blenkernel/intern/icons.c
+++ b/source/blender/blenkernel/intern/icons.c
@@ -377,6 +377,7 @@ PreviewImage **BKE_previewimg_id_get_p(ID *id)
                ID_PRV_CASE(ID_OB, Object);
                ID_PRV_CASE(ID_GR, Group);
                ID_PRV_CASE(ID_SCE, Scene);
+               ID_PRV_CASE(ID_AC, bAction);
 #undef ID_PRV_CASE
        }
 
diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index c1da78d..6065358 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2545,6 +2545,8 @@ static void direct_link_action(FileData *fd, bAction *act)
                agrp->channels.first= newdataadr(fd, agrp->channels.first);
                agrp->channels.last= newdataadr(fd, agrp->channels.last);
        }
+
+       act->preview = direct_link_preview_image(fd, act->preview);
 }
 
 static void lib_link_nladata_strips(FileData *fd, ID *id, ListBase *list)
diff --git a/source/blender/blenloader/intern/writefile.c 
b/source/blender/blenloader/intern/writefile.c
index dab6d70..e606f0e 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -818,6 +818,8 @@ static void write_actions(WriteData *wd, ListBase *idbase)
                        for (marker = act->markers.first; marker; marker = 
marker->next) {
                                writestruct(wd, DATA, TimeMarker, 1, marker);
                        }
+
+                       write_previews(wd, act->preview);
                }
        }
 
diff --git a/source/blender/editors/interface/interface_icons.c 
b/source/blender/editors/interface/interface_icons.c
index a4d5285..2dacbba 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -1490,6 +1490,7 @@ int ui_id_icon_get(const bContext *C, ID *id, const bool 
big)
                case ID_IM: /* fall through */
                case ID_WO: /* fall through */
                case ID_LA: /* fall through */
+               case ID_AC: /* fall through */
                        iconid = BKE_icon_id_ensure(id);
                        /* checks if not exists, or changed */
                        UI_id_icon_render(C, NULL, id, big, true);
diff --git a/source/blender/makesdna/DNA_action_types.h 
b/source/blender/makesdna/DNA_action_types.h
index f3df909..5994316 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -537,6 +537,8 @@ typedef struct bAction {
        
        int idroot;         /* type of ID-blocks that action can be assigned to 
(if 0, will be set to whatever ID first evaluates it) */
        int pad;
+
+       struct PreviewImage *preview;
 } bAction;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to