Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Repp <simon@openideas.at>2013-12-23 21:35:32 +0400
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2013-12-23 21:55:48 +0400
commit632c29fef3a566d6aac9ea35e7875f08f3d1cf74 (patch)
tree5f32deb9b89406e0f1108ff389228997a5c9db2c /source/blender/editors/space_info
parent3cc7978f19f55a4f3ff7209d67bbb1b0ccb7c4ff (diff)
UI: communicate external data autopack better in the UI.
Previously there was no way to see if autopack was enabled. Now the external data menu has 3 entries instead of 2: * Automatically Pack Into .blend (with checkbox to indicate autopack on/off) * Pack All Into .blend * Unpack All Into Files Fixes T37608, includes modifications by Brecht from the original patch. Reviewed By: brecht Differential Revision: http://developer.blender.org/D118
Diffstat (limited to 'source/blender/editors/space_info')
-rw-r--r--source/blender/editors/space_info/info_intern.h1
-rw-r--r--source/blender/editors/space_info/info_ops.c38
-rw-r--r--source/blender/editors/space_info/space_info.c1
3 files changed, 36 insertions, 4 deletions
diff --git a/source/blender/editors/space_info/info_intern.h b/source/blender/editors/space_info/info_intern.h
index b5426fe15e1..967bcec57c5 100644
--- a/source/blender/editors/space_info/info_intern.h
+++ b/source/blender/editors/space_info/info_intern.h
@@ -37,6 +37,7 @@ struct SpaceInfo;
struct wmOperatorType;
struct ReportList;
+void FILE_OT_autopack_toggle(struct wmOperatorType *ot);
void FILE_OT_pack_all(struct wmOperatorType *ot);
void FILE_OT_unpack_all(struct wmOperatorType *ot);
void FILE_OT_unpack_item(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c
index 6c76ba64893..6690d1ce7cb 100644
--- a/source/blender/editors/space_info/info_ops.c
+++ b/source/blender/editors/space_info/info_ops.c
@@ -70,7 +70,7 @@
#include "info_intern.h"
-/********************* pack blend file libararies operator *********************/
+/********************* pack blend file libaries operator *********************/
static int pack_libraries_exec(bContext *C, wmOperator *op)
{
@@ -124,6 +124,36 @@ void FILE_OT_unpack_libraries(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
+/********************* toogle auto-pack operator *********************/
+
+static int autopack_toggle_exec(bContext *C, wmOperator *op)
+{
+ Main *bmain = CTX_data_main(C);
+
+ if(G.fileflags & G_AUTOPACK) {
+ G.fileflags &= ~G_AUTOPACK;
+ }
+ else {
+ packAll(bmain, op->reports);
+ G.fileflags |= G_AUTOPACK;
+ }
+
+ return OPERATOR_FINISHED;
+}
+
+void FILE_OT_autopack_toggle(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Automatically Pack Into .blend";
+ ot->idname = "FILE_OT_autopack_toggle";
+ ot->description = "Automatically pack all external files into the .blend file";
+
+ /* api callbacks */
+ ot->exec = autopack_toggle_exec;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
/********************* pack all operator *********************/
@@ -168,7 +198,7 @@ static int pack_all_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(ev
void FILE_OT_pack_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Pack All";
+ ot->name = "Pack All Into .blend";
ot->idname = "FILE_OT_pack_all";
ot->description = "Pack all used external files into the .blend";
@@ -214,7 +244,7 @@ static int unpack_all_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(
count = countPackedFiles(bmain);
if (!count) {
- BKE_report(op->reports, RPT_WARNING, "No packed files (auto-pack disabled)");
+ BKE_report(op->reports, RPT_WARNING, "No packed files to unpack");
G.fileflags &= ~G_AUTOPACK;
return OPERATOR_CANCELLED;
}
@@ -238,7 +268,7 @@ static int unpack_all_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(
void FILE_OT_unpack_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Unpack All";
+ ot->name = "Unpack All Into Files";
ot->idname = "FILE_OT_unpack_all";
ot->description = "Unpack all files packed into this .blend to external ones";
diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c
index 96e0de17918..c029a4bf0bc 100644
--- a/source/blender/editors/space_info/space_info.c
+++ b/source/blender/editors/space_info/space_info.c
@@ -179,6 +179,7 @@ static void info_main_area_draw(const bContext *C, ARegion *ar)
static void info_operatortypes(void)
{
+ WM_operatortype_append(FILE_OT_autopack_toggle);
WM_operatortype_append(FILE_OT_pack_all);
WM_operatortype_append(FILE_OT_pack_libraries);
WM_operatortype_append(FILE_OT_unpack_all);