Fix: Dont unpack resources that are packed in linked files
These remain linked, so data remains to be read/loaded from the packed version from the library (making this a useless and wasteful duplication, also changes could be perceived as lost). Tooltip was also reading "Unpack all files packed **into this .blend** to external ones", so that bring it in line with the tooltip. This came up in #122033 Pull Request: https://projects.blender.org/blender/blender/pulls/122092
This commit is contained in:
committed by
Philipp Oeser
parent
692af3f9aa
commit
c6aa1fec2b
@@ -114,13 +114,13 @@ int BKE_packedfile_count_all(Main *bmain)
|
|||||||
for (ima = static_cast<Image *>(bmain->images.first); ima;
|
for (ima = static_cast<Image *>(bmain->images.first); ima;
|
||||||
ima = static_cast<Image *>(ima->id.next))
|
ima = static_cast<Image *>(ima->id.next))
|
||||||
{
|
{
|
||||||
if (BKE_image_has_packedfile(ima)) {
|
if (BKE_image_has_packedfile(ima) && !ID_IS_LINKED(ima)) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (vf = static_cast<VFont *>(bmain->fonts.first); vf; vf = static_cast<VFont *>(vf->id.next)) {
|
for (vf = static_cast<VFont *>(bmain->fonts.first); vf; vf = static_cast<VFont *>(vf->id.next)) {
|
||||||
if (vf->packedfile) {
|
if (vf->packedfile && !ID_IS_LINKED(vf)) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -128,7 +128,7 @@ int BKE_packedfile_count_all(Main *bmain)
|
|||||||
for (sound = static_cast<bSound *>(bmain->sounds.first); sound;
|
for (sound = static_cast<bSound *>(bmain->sounds.first); sound;
|
||||||
sound = static_cast<bSound *>(sound->id.next))
|
sound = static_cast<bSound *>(sound->id.next))
|
||||||
{
|
{
|
||||||
if (sound->packedfile) {
|
if (sound->packedfile && !ID_IS_LINKED(sound)) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -136,7 +136,7 @@ int BKE_packedfile_count_all(Main *bmain)
|
|||||||
for (volume = static_cast<Volume *>(bmain->volumes.first); volume;
|
for (volume = static_cast<Volume *>(bmain->volumes.first); volume;
|
||||||
volume = static_cast<Volume *>(volume->id.next))
|
volume = static_cast<Volume *>(volume->id.next))
|
||||||
{
|
{
|
||||||
if (volume->packedfile) {
|
if (volume->packedfile && !ID_IS_LINKED(volume)) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -782,13 +782,13 @@ void BKE_packedfile_unpack_all(Main *bmain, ReportList *reports, enum ePF_FileSt
|
|||||||
for (ima = static_cast<Image *>(bmain->images.first); ima;
|
for (ima = static_cast<Image *>(bmain->images.first); ima;
|
||||||
ima = static_cast<Image *>(ima->id.next))
|
ima = static_cast<Image *>(ima->id.next))
|
||||||
{
|
{
|
||||||
if (BKE_image_has_packedfile(ima)) {
|
if (BKE_image_has_packedfile(ima) && !ID_IS_LINKED(ima)) {
|
||||||
BKE_packedfile_unpack_image(bmain, reports, ima, how);
|
BKE_packedfile_unpack_image(bmain, reports, ima, how);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (vf = static_cast<VFont *>(bmain->fonts.first); vf; vf = static_cast<VFont *>(vf->id.next)) {
|
for (vf = static_cast<VFont *>(bmain->fonts.first); vf; vf = static_cast<VFont *>(vf->id.next)) {
|
||||||
if (vf->packedfile) {
|
if (vf->packedfile && !ID_IS_LINKED(vf)) {
|
||||||
BKE_packedfile_unpack_vfont(bmain, reports, vf, how);
|
BKE_packedfile_unpack_vfont(bmain, reports, vf, how);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -796,7 +796,7 @@ void BKE_packedfile_unpack_all(Main *bmain, ReportList *reports, enum ePF_FileSt
|
|||||||
for (sound = static_cast<bSound *>(bmain->sounds.first); sound;
|
for (sound = static_cast<bSound *>(bmain->sounds.first); sound;
|
||||||
sound = static_cast<bSound *>(sound->id.next))
|
sound = static_cast<bSound *>(sound->id.next))
|
||||||
{
|
{
|
||||||
if (sound->packedfile) {
|
if (sound->packedfile && !ID_IS_LINKED(sound)) {
|
||||||
BKE_packedfile_unpack_sound(bmain, reports, sound, how);
|
BKE_packedfile_unpack_sound(bmain, reports, sound, how);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -804,7 +804,7 @@ void BKE_packedfile_unpack_all(Main *bmain, ReportList *reports, enum ePF_FileSt
|
|||||||
for (volume = static_cast<Volume *>(bmain->volumes.first); volume;
|
for (volume = static_cast<Volume *>(bmain->volumes.first); volume;
|
||||||
volume = static_cast<Volume *>(volume->id.next))
|
volume = static_cast<Volume *>(volume->id.next))
|
||||||
{
|
{
|
||||||
if (volume->packedfile) {
|
if (volume->packedfile && !ID_IS_LINKED(volume)) {
|
||||||
BKE_packedfile_unpack_volume(bmain, reports, volume, how);
|
BKE_packedfile_unpack_volume(bmain, reports, volume, how);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -841,6 +841,11 @@ bool BKE_packedfile_id_check(const ID *id)
|
|||||||
|
|
||||||
void BKE_packedfile_id_unpack(Main *bmain, ID *id, ReportList *reports, enum ePF_FileStatus how)
|
void BKE_packedfile_id_unpack(Main *bmain, ID *id, ReportList *reports, enum ePF_FileStatus how)
|
||||||
{
|
{
|
||||||
|
/* Dont unpack resources that are packed in linked IDs. */
|
||||||
|
if (ID_IS_LINKED(id)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (GS(id->name)) {
|
switch (GS(id->name)) {
|
||||||
case ID_IM: {
|
case ID_IM: {
|
||||||
Image *ima = (Image *)id;
|
Image *ima = (Image *)id;
|
||||||
|
|||||||
@@ -1536,6 +1536,10 @@ static void template_ID(const bContext *C,
|
|||||||
|
|
||||||
RNA_string_set(but->opptr, "id_name", id->name + 2);
|
RNA_string_set(but->opptr, "id_name", id->name + 2);
|
||||||
RNA_int_set(but->opptr, "id_type", GS(id->name));
|
RNA_int_set(but->opptr, "id_type", GS(id->name));
|
||||||
|
|
||||||
|
if (ID_IS_LINKED(id)) {
|
||||||
|
UI_but_flag_enable(but, UI_BUT_DISABLED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (flag & UI_ID_OPEN) {
|
else if (flag & UI_ID_OPEN) {
|
||||||
const char *button_text = (id) ? "" : IFACE_("Open");
|
const char *button_text = (id) ? "" : IFACE_("Open");
|
||||||
|
|||||||
Reference in New Issue
Block a user