예제 #1
0
static int wm_alembic_export_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
  if (!RNA_struct_property_is_set(op->ptr, "as_background_job")) {
    RNA_boolean_set(op->ptr, "as_background_job", true);
  }

  RNA_boolean_set(op->ptr, "init_scene_frame_range", true);

  if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
    Main *bmain = CTX_data_main(C);
    char filepath[FILE_MAX];

    if (BKE_main_blendfile_path(bmain)[0] == '\0') {
      BLI_strncpy(filepath, "untitled", sizeof(filepath));
    }
    else {
      BLI_strncpy(filepath, BKE_main_blendfile_path(bmain), sizeof(filepath));
    }

    BLI_path_extension_replace(filepath, sizeof(filepath), ".abc");
    RNA_string_set(op->ptr, "filepath", filepath);
  }

  WM_event_add_fileselect(C, op);

  return OPERATOR_RUNNING_MODAL;

  UNUSED_VARS(event);
}
예제 #2
0
int unpackLibraries(Main *bmain, ReportList *reports)
{
	Library *lib;
	char *newname;
	int ret_value = RET_ERROR;

	for (lib = bmain->library.first; lib; lib = lib->id.next) {
		if (lib->packedfile && lib->name[0]) {

			newname = unpackFile(reports, BKE_main_blendfile_path(bmain), lib->filepath, lib->filepath, lib->packedfile, PF_WRITE_ORIGINAL);
			if (newname != NULL) {
				ret_value = RET_OK;

				printf("Unpacked .blend library: %s\n", newname);

				freePackedFile(lib->packedfile);
				lib->packedfile = NULL;

				MEM_freeN(newname);
			}
		}
	}

	return(ret_value);
}
예제 #3
0
static void rna_ImagePackedFile_save(ImagePackedFile *imapf, Main *bmain, ReportList *reports)
{
	if (writePackedFile(reports, BKE_main_blendfile_path(bmain), imapf->filepath, imapf->packedfile, 0) != RET_OK) {
		BKE_reportf(reports, RPT_ERROR, "Could not save packed file to disk as '%s'",
		            imapf->filepath);
	}
}
예제 #4
0
파일: sound.c 프로젝트: wangyxuan/blender
bSound *BKE_sound_new_file_exists_ex(Main *bmain, const char *filepath, bool *r_exists)
{
  bSound *sound;
  char str[FILE_MAX], strtest[FILE_MAX];

  BLI_strncpy(str, filepath, sizeof(str));
  BLI_path_abs(str, BKE_main_blendfile_path(bmain));

  /* first search an identical filepath */
  for (sound = bmain->sounds.first; sound; sound = sound->id.next) {
    BLI_strncpy(strtest, sound->name, sizeof(sound->name));
    BLI_path_abs(strtest, ID_BLEND_PATH(bmain, &sound->id));

    if (BLI_path_cmp(strtest, str) == 0) {
      id_us_plus(&sound->id); /* officially should not, it doesn't link here! */
      if (r_exists) {
        *r_exists = true;
      }
      return sound;
    }
  }

  if (r_exists) {
    *r_exists = false;
  }
  return BKE_sound_new_file(bmain, filepath);
}
예제 #5
0
static PyObject *bpy_lib_load(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
{
	Main *bmain = CTX_data_main(BPy_GetContext());
	BPy_Library *ret;
	const char *filename = NULL;
	bool is_rel = false, is_link = false;

	static const char *_keywords[] = {"filepath", "link", "relative", NULL};
	static _PyArg_Parser _parser = {"s|O&O&:load", _keywords, 0};
	if (!_PyArg_ParseTupleAndKeywordsFast(
	        args, kw, &_parser,
	        &filename,
	        PyC_ParseBool, &is_link,
	        PyC_ParseBool, &is_rel))
	{
		return NULL;
	}

	ret = PyObject_New(BPy_Library, &bpy_lib_Type);

	BLI_strncpy(ret->relpath, filename, sizeof(ret->relpath));
	BLI_strncpy(ret->abspath, filename, sizeof(ret->abspath));
	BLI_path_abs(ret->abspath, BKE_main_blendfile_path(bmain));

	ret->blo_handle = NULL;
	ret->flag = ((is_link ? FILE_LINK : 0) |
	             (is_rel ? FILE_RELPATH : 0));

	ret->dict = _PyDict_NewPresized(MAX_LIBARRAY);

	return (PyObject *)ret;
}
예제 #6
0
/* no libraries for now */
void packAll(Main *bmain, ReportList *reports, bool verbose)
{
	Image *ima;
	VFont *vfont;
	bSound *sound;
	int tot = 0;

	for (ima = bmain->image.first; ima; ima = ima->id.next) {
		if (BKE_image_has_packedfile(ima) == false && !ID_IS_LINKED(ima)) {
			if (ima->source == IMA_SRC_FILE) {
				BKE_image_packfiles(reports, ima, ID_BLEND_PATH(bmain, &ima->id));
				tot ++;
			}
			else if (BKE_image_is_animated(ima) && verbose) {
				BKE_reportf(reports, RPT_WARNING, "Image '%s' skipped, movies and image sequences not supported",
				            ima->id.name + 2);
			}
		}
	}

	for (vfont = bmain->vfont.first; vfont; vfont = vfont->id.next) {
		if (vfont->packedfile == NULL && !ID_IS_LINKED(vfont) && BKE_vfont_is_builtin(vfont) == false) {
			vfont->packedfile = newPackedFile(reports, vfont->name, BKE_main_blendfile_path(bmain));
			tot ++;
		}
	}

	for (sound = bmain->sound.first; sound; sound = sound->id.next) {
		if (sound->packedfile == NULL && !ID_IS_LINKED(sound)) {
			sound->packedfile = newPackedFile(reports, sound->name, BKE_main_blendfile_path(bmain));
			tot++;
		}
	}

	if (tot > 0)
		BKE_reportf(reports, RPT_INFO, "Packed %d files", tot);
	else if (verbose)
		BKE_report(reports, RPT_INFO, "No new files have been packed");
}
예제 #7
0
파일: info_ops.c 프로젝트: wchargin/blender
static int make_paths_absolute_exec(bContext *C, wmOperator *op)
{
	Main *bmain = CTX_data_main(C);

	if (!G.relbase_valid) {
		BKE_report(op->reports, RPT_WARNING, "Cannot set absolute paths with an unsaved blend file");
		return OPERATOR_CANCELLED;
	}

	BKE_bpath_absolute_convert(bmain, BKE_main_blendfile_path(bmain), op->reports);

	/* redraw everything so any changed paths register */
	WM_main_add_notifier(NC_WINDOW, NULL);

	return OPERATOR_FINISHED;
}
예제 #8
0
int unpackImage(Main *bmain, ReportList *reports, Image *ima, int how)
{
	int ret_value = RET_ERROR;

	if (ima != NULL) {
		while (ima->packedfiles.last) {
			char localname[FILE_MAX], absname[FILE_MAX];
			char *newname;
			ImagePackedFile *imapf = ima->packedfiles.last;

			unpack_generate_paths(imapf->filepath, (ID *)ima, absname, localname, sizeof(absname), sizeof(localname));
			newname = unpackFile(reports, BKE_main_blendfile_path(bmain), absname, localname, imapf->packedfile, how);

			if (newname != NULL) {
				ImageView *iv;

				ret_value = ret_value == RET_ERROR ? RET_ERROR : RET_OK;
				freePackedFile(imapf->packedfile);
				imapf->packedfile = NULL;

				/* update the new corresponding view filepath */
				iv = BLI_findstring(&ima->views, imapf->filepath, offsetof(ImageView, filepath));
				if (iv) {
					BLI_strncpy(iv->filepath, newname, sizeof(imapf->filepath));
				}

				/* keep the new name in the image for non-pack specific reasons */
				if (how != PF_REMOVE) {
					BLI_strncpy(ima->name, newname, sizeof(imapf->filepath));
				}
				MEM_freeN(newname);
			}
			else {
				ret_value = RET_ERROR;
			}

			BLI_remlink(&ima->packedfiles, imapf);
			MEM_freeN(imapf);
		}
	}

	if (ret_value == RET_OK) {
		BKE_image_signal(bmain, ima, NULL, IMA_SIGNAL_RELOAD);
	}

	return(ret_value);
}
예제 #9
0
void packLibraries(Main *bmain, ReportList *reports)
{
	Library *lib;

	/* test for relativenss */
	for (lib = bmain->library.first; lib; lib = lib->id.next)
		if (!BLI_path_is_rel(lib->name))
			break;

	if (lib) {
		BKE_reportf(reports, RPT_ERROR, "Cannot pack absolute file: '%s'", lib->name);
		return;
	}

	for (lib = bmain->library.first; lib; lib = lib->id.next)
		if (lib->packedfile == NULL)
			lib->packedfile = newPackedFile(reports, lib->name, BKE_main_blendfile_path(bmain));
}
예제 #10
0
static int editsource_text_edit(bContext *C,
                                wmOperator *op,
                                const char filepath[FILE_MAX],
                                const int line)
{
  struct Main *bmain = CTX_data_main(C);
  Text *text;

  /* Developers may wish to copy-paste to an external editor. */
  printf("%s:%d\n", filepath, line);

  for (text = bmain->texts.first; text; text = text->id.next) {
    if (text->name && BLI_path_cmp(text->name, filepath) == 0) {
      break;
    }
  }

  if (text == NULL) {
    text = BKE_text_load(bmain, filepath, BKE_main_blendfile_path(bmain));
    id_us_ensure_real(&text->id);
  }

  if (text == NULL) {
    BKE_reportf(op->reports, RPT_WARNING, "File '%s' cannot be opened", filepath);
    return OPERATOR_CANCELLED;
  }
  else {
    /* naughty!, find text area to set, not good behavior
     * but since this is a dev tool lets allow it - campbell */
    ScrArea *sa = BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_TEXT, 0);
    if (sa) {
      SpaceText *st = sa->spacedata.first;
      st->text = text;
    }
    else {
      BKE_reportf(op->reports, RPT_INFO, "See '%s' in the text editor", text->id.name + 2);
    }

    txt_move_toline(text, line - 1, false);
    WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, text);
  }

  return OPERATOR_FINISHED;
}
예제 #11
0
int unpackVFont(Main *bmain, ReportList *reports, VFont *vfont, int how)
{
	char localname[FILE_MAX], absname[FILE_MAX];
	char *newname;
	int ret_value = RET_ERROR;

	if (vfont != NULL) {
		unpack_generate_paths(vfont->name, (ID *)vfont, absname, localname, sizeof(absname), sizeof(localname));
		newname = unpackFile(reports, BKE_main_blendfile_path(bmain), absname, localname, vfont->packedfile, how);
		if (newname != NULL) {
			ret_value = RET_OK;
			freePackedFile(vfont->packedfile);
			vfont->packedfile = NULL;
			BLI_strncpy(vfont->name, newname, sizeof(vfont->name));
			MEM_freeN(newname);
		}
	}

	return (ret_value);
}
예제 #12
0
파일: sound.c 프로젝트: wangyxuan/blender
bSound *BKE_sound_new_file(Main *bmain, const char *filepath)
{
  bSound *sound;
  const char *path;
  char str[FILE_MAX];

  BLI_strncpy(str, filepath, sizeof(str));

  path = BKE_main_blendfile_path(bmain);

  BLI_path_abs(str, path);

  sound = BKE_libblock_alloc(bmain, ID_SO, BLI_path_basename(filepath), 0);
  BLI_strncpy(sound->name, filepath, FILE_MAX);
  /* sound->type = SOUND_TYPE_FILE; */ /* XXX unused currently */

  BKE_sound_load(bmain, sound);

  return sound;
}
예제 #13
0
/* memfile is the undo buffer */
bool BKE_blendfile_read_from_memfile(
        bContext *C, struct MemFile *memfile,
        ReportList *reports, int skip_flags)
{
	Main *bmain = CTX_data_main(C);
	BlendFileData *bfd;

	bfd = BLO_read_from_memfile(bmain, BKE_main_blendfile_path(bmain), memfile, reports, skip_flags);
	if (bfd) {
		/* remove the unused screens and wm */
		while (bfd->main->wm.first)
			BKE_libblock_free(bfd->main, bfd->main->wm.first);
		while (bfd->main->screen.first)
			BKE_libblock_free(bfd->main, bfd->main->screen.first);

		setup_app_data(C, bfd, "<memory1>", reports);
	}
	else {
		BKE_reports_prepend(reports, "Loading failed: ");
	}

	return (bfd != NULL);
}
예제 #14
0
int unpackSound(Main *bmain, ReportList *reports, bSound *sound, int how)
{
	char localname[FILE_MAX], absname[FILE_MAX];
	char *newname;
	int ret_value = RET_ERROR;

	if (sound != NULL) {
		unpack_generate_paths(sound->name, (ID *)sound, absname, localname, sizeof(absname), sizeof(localname));
		newname = unpackFile(reports, BKE_main_blendfile_path(bmain), absname, localname, sound->packedfile, how);
		if (newname != NULL) {
			BLI_strncpy(sound->name, newname, sizeof(sound->name));
			MEM_freeN(newname);

			freePackedFile(sound->packedfile);
			sound->packedfile = NULL;

			BKE_sound_load(bmain, sound);

			ret_value = RET_OK;
		}
	}

	return(ret_value);
}
예제 #15
0
/* call this with NULL to restore assigned ID pointers in preview scene */
static Scene *preview_prepare_scene(
    Main *bmain, Scene *scene, ID *id, int id_type, ShaderPreview *sp)
{
  Scene *sce;
  Main *pr_main = sp->pr_main;

  memcpy(pr_main->name, BKE_main_blendfile_path(bmain), sizeof(pr_main->name));

  sce = preview_get_scene(pr_main);
  if (sce) {
    ViewLayer *view_layer = sce->view_layers.first;

    /* this flag tells render to not execute depsgraph or ipos etc */
    sce->r.scemode |= R_BUTS_PREVIEW;
    /* set world always back, is used now */
    sce->world = pr_main->worlds.first;
    /* now: exposure copy */
    if (scene->world) {
      sce->world->exp = scene->world->exp;
      sce->world->range = scene->world->range;
    }

    sce->r.color_mgt_flag = scene->r.color_mgt_flag;
    BKE_color_managed_display_settings_copy(&sce->display_settings, &scene->display_settings);

    BKE_color_managed_view_settings_free(&sce->view_settings);
    BKE_color_managed_view_settings_copy(&sce->view_settings, &scene->view_settings);

    /* prevent overhead for small renders and icons (32) */
    if (id && sp->sizex < 40) {
      sce->r.tilex = sce->r.tiley = 64;
    }
    else {
      sce->r.tilex = sce->r.xsch / 4;
      sce->r.tiley = sce->r.ysch / 4;
    }

    if ((id && sp->pr_method == PR_ICON_RENDER) && id_type != ID_WO) {
      sce->r.alphamode = R_ALPHAPREMUL;
    }
    else {
      sce->r.alphamode = R_ADDSKY;
    }

    sce->r.cfra = scene->r.cfra;

    if (id_type == ID_TE) {
      /* Texture is not actually rendered with engine, just set dummy value. */
      BLI_strncpy(sce->r.engine, RE_engine_id_BLENDER_EEVEE, sizeof(sce->r.engine));
    }
    else {
      BLI_strncpy(sce->r.engine, scene->r.engine, sizeof(sce->r.engine));
    }

    if (id_type == ID_MA) {
      Material *mat = NULL, *origmat = (Material *)id;

      if (origmat) {
        /* work on a copy */
        BLI_assert(sp->id_copy != NULL);
        mat = sp->matcopy = (Material *)sp->id_copy;
        sp->id_copy = NULL;
        BLI_addtail(&pr_main->materials, mat);

        /* Use current scene world for lighting. */
        if (mat->pr_flag == MA_PREVIEW_WORLD && sp->pr_method == PR_BUTS_RENDER) {
          /* Use current scene world to light sphere. */
          sce->world = preview_get_localized_world(sp, scene->world);
        }
        else if (sce->world) {
          /* Use a default world color. Using the current
           * scene world can be slow if it has big textures. */
          sce->world->use_nodes = false;
          sce->world->horr = 0.05f;
          sce->world->horg = 0.05f;
          sce->world->horb = 0.05f;
        }

        if (sp->pr_method == PR_ICON_RENDER && sp->pr_main == G_pr_main_grease_pencil) {
          /* For grease pencil, always use sphere for icon renders. */
          set_preview_visibility(sce, view_layer, MA_SPHERE_A, sp->pr_method);
        }
        else {
          /* Use specified preview shape for both preview panel and icon previews. */
          set_preview_visibility(sce, view_layer, mat->pr_type, sp->pr_method);
        }

        if (sp->pr_method != PR_ICON_RENDER) {
          if (mat->nodetree && sp->pr_method == PR_NODE_RENDER) {
            /* two previews, they get copied by wmJob */
            BKE_node_preview_init_tree(mat->nodetree, sp->sizex, sp->sizey, true);
            /* WATCH: Accessing origmat is not safe! */
            BKE_node_preview_init_tree(origmat->nodetree, sp->sizex, sp->sizey, true);
          }
        }
      }
      else {
        sce->display.render_aa = SCE_DISPLAY_AA_OFF;
      }

      for (Base *base = view_layer->object_bases.first; base; base = base->next) {
        if (base->object->id.name[2] == 'p') {
          /* copy over object color, in case material uses it */
          copy_v4_v4(base->object->color, sp->color);

          if (OB_TYPE_SUPPORT_MATERIAL(base->object->type)) {
            /* don't use assign_material, it changed mat->id.us, which shows in the UI */
            Material ***matar = give_matarar(base->object);
            int actcol = max_ii(base->object->actcol - 1, 0);

            if (matar && actcol < base->object->totcol) {
              (*matar)[actcol] = mat;
            }
          }
          else if (base->object->type == OB_LAMP) {
            base->flag |= BASE_VISIBLE;
          }
        }
      }
    }
    else if (id_type == ID_TE) {
      Tex *tex = NULL, *origtex = (Tex *)id;

      if (origtex) {
        BLI_assert(sp->id_copy != NULL);
        tex = sp->texcopy = (Tex *)sp->id_copy;
        sp->id_copy = NULL;
        BLI_addtail(&pr_main->textures, tex);
      }

      if (tex && tex->nodetree && sp->pr_method == PR_NODE_RENDER) {
        /* two previews, they get copied by wmJob */
        BKE_node_preview_init_tree(tex->nodetree, sp->sizex, sp->sizey, true);
        /* WATCH: Accessing origtex is not safe! */
        BKE_node_preview_init_tree(origtex->nodetree, sp->sizex, sp->sizey, true);
      }
    }
    else if (id_type == ID_LA) {
      Light *la = NULL, *origla = (Light *)id;

      /* work on a copy */
      if (origla) {
        BLI_assert(sp->id_copy != NULL);
        la = sp->lampcopy = (Light *)sp->id_copy;
        sp->id_copy = NULL;
        BLI_addtail(&pr_main->lights, la);
      }

      set_preview_visibility(sce, view_layer, MA_LAMP, sp->pr_method);

      if (sce->world) {
        /* Only use lighting from the light. */
        sce->world->use_nodes = false;
        sce->world->horr = 0.0f;
        sce->world->horg = 0.0f;
        sce->world->horb = 0.0f;
      }

      for (Base *base = view_layer->object_bases.first; base; base = base->next) {
        if (base->object->id.name[2] == 'p') {
          if (base->object->type == OB_LAMP) {
            base->object->data = la;
          }
        }
      }

      if (la && la->nodetree && sp->pr_method == PR_NODE_RENDER) {
        /* two previews, they get copied by wmJob */
        BKE_node_preview_init_tree(la->nodetree, sp->sizex, sp->sizey, true);
        /* WATCH: Accessing origla is not safe! */
        BKE_node_preview_init_tree(origla->nodetree, sp->sizex, sp->sizey, true);
      }
    }
    else if (id_type == ID_WO) {
      World *wrld = NULL, *origwrld = (World *)id;

      if (origwrld) {
        BLI_assert(sp->id_copy != NULL);
        wrld = sp->worldcopy = (World *)sp->id_copy;
        sp->id_copy = NULL;
        BLI_addtail(&pr_main->worlds, wrld);
      }

      set_preview_visibility(sce, view_layer, MA_SKY, sp->pr_method);
      sce->world = wrld;

      if (wrld && wrld->nodetree && sp->pr_method == PR_NODE_RENDER) {
        /* two previews, they get copied by wmJob */
        BKE_node_preview_init_tree(wrld->nodetree, sp->sizex, sp->sizey, true);
        /* WATCH: Accessing origwrld is not safe! */
        BKE_node_preview_init_tree(origwrld->nodetree, sp->sizex, sp->sizey, true);
      }
    }

    return sce;
  }

  return NULL;
}
예제 #16
0
void unpack_menu(bContext *C, const char *opname, const char *id_name, const char *abs_name, const char *folder, struct PackedFile *pf)
{
	Main *bmain = CTX_data_main(C);
	PointerRNA props_ptr;
	uiPopupMenu *pup;
	uiLayout *layout;
	char line[FILE_MAX + 100];
	wmOperatorType *ot = WM_operatortype_find(opname, 1);

	pup = UI_popup_menu_begin(C, IFACE_("Unpack File"), ICON_NONE);
	layout = UI_popup_menu_layout(pup);

	uiItemFullO_ptr(
	        layout, ot, IFACE_("Remove Pack"), ICON_NONE,
	        NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
	RNA_enum_set(&props_ptr, "method", PF_REMOVE);
	RNA_string_set(&props_ptr, "id", id_name);

	if (G.relbase_valid) {
		char local_name[FILE_MAXDIR + FILE_MAX], fi[FILE_MAX];

		BLI_split_file_part(abs_name, fi, sizeof(fi));
		BLI_snprintf(local_name, sizeof(local_name), "//%s/%s", folder, fi);
		if (!STREQ(abs_name, local_name)) {
			switch (checkPackedFile(BKE_main_blendfile_path(bmain), local_name, pf)) {
				case PF_NOFILE:
					BLI_snprintf(line, sizeof(line), IFACE_("Create %s"), local_name);
					uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
					RNA_enum_set(&props_ptr, "method", PF_WRITE_LOCAL);
					RNA_string_set(&props_ptr, "id", id_name);

					break;
				case PF_EQUAL:
					BLI_snprintf(line, sizeof(line), IFACE_("Use %s (identical)"), local_name);
					//uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_USE_LOCAL);
					uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
					RNA_enum_set(&props_ptr, "method", PF_USE_LOCAL);
					RNA_string_set(&props_ptr, "id", id_name);

					break;
				case PF_DIFFERS:
					BLI_snprintf(line, sizeof(line), IFACE_("Use %s (differs)"), local_name);
					//uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_USE_LOCAL);
					uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
					RNA_enum_set(&props_ptr, "method", PF_USE_LOCAL);
					RNA_string_set(&props_ptr, "id", id_name);

					BLI_snprintf(line, sizeof(line), IFACE_("Overwrite %s"), local_name);
					//uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_WRITE_LOCAL);
					uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
					RNA_enum_set(&props_ptr, "method", PF_WRITE_LOCAL);
					RNA_string_set(&props_ptr, "id", id_name);
					break;
			}
		}
	}

	switch (checkPackedFile(BKE_main_blendfile_path(bmain), abs_name, pf)) {
		case PF_NOFILE:
			BLI_snprintf(line, sizeof(line), IFACE_("Create %s"), abs_name);
			//uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_WRITE_ORIGINAL);
			uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
			RNA_enum_set(&props_ptr, "method", PF_WRITE_ORIGINAL);
			RNA_string_set(&props_ptr, "id", id_name);
			break;
		case PF_EQUAL:
			BLI_snprintf(line, sizeof(line), IFACE_("Use %s (identical)"), abs_name);
			//uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_USE_ORIGINAL);
			uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
			RNA_enum_set(&props_ptr, "method", PF_USE_ORIGINAL);
			RNA_string_set(&props_ptr, "id", id_name);
			break;
		case PF_DIFFERS:
			BLI_snprintf(line, sizeof(line), IFACE_("Use %s (differs)"), abs_name);
			//uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_USE_ORIGINAL);
			uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
			RNA_enum_set(&props_ptr, "method", PF_USE_ORIGINAL);
			RNA_string_set(&props_ptr, "id", id_name);

			BLI_snprintf(line, sizeof(line), IFACE_("Overwrite %s"), abs_name);
			//uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_WRITE_ORIGINAL);
			uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
			RNA_enum_set(&props_ptr, "method", PF_WRITE_ORIGINAL);
			RNA_string_set(&props_ptr, "id", id_name);
			break;
	}

	UI_popup_menu_end(C, pup);
}