Exemple #1
0
static void ui_imageuser_layer_menu(bContext *UNUSED(C), uiLayout *layout, void *rnd_pt)
{
	void **rnd_data = rnd_pt;
	uiBlock *block = uiLayoutGetBlock(layout);
	RenderResult *rr = rnd_data[0];
	ImageUser *iuser = rnd_data[1];
	RenderLayer *rl;
	RenderLayer rl_fake = {NULL};
	const char *fake_name;
	int nr;

	uiBlockSetCurLayout(block, layout);
	uiLayoutColumn(layout, false);

	uiDefBut(block, LABEL, 0, IFACE_("Layer"),
	         0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
	uiItemS(layout);

	nr = BLI_countlist(&rr->layers) - 1;
	fake_name = ui_imageuser_layer_fake_name(rr);

	if (fake_name) {
		BLI_strncpy(rl_fake.name, fake_name, sizeof(rl_fake.name));
		nr += 1;
	}

	for (rl = rr->layers.last; rl; rl = rl->prev, nr--) {
final:
		uiDefButS(block, BUTM, B_NOP, IFACE_(rl->name), 0, 0,
		          UI_UNIT_X * 5, UI_UNIT_X, &iuser->layer, (float) nr, 0.0, 0, -1, "");
	}
Exemple #2
0
static void uiblock_layer_pass_buttons(uiLayout *layout, RenderResult *rr, ImageUser *iuser, int w, short *render_slot)
{
	uiBlock *block = uiLayoutGetBlock(layout);
	uiBut *but;
	RenderLayer *rl = NULL;
	int wmenu1, wmenu2, wmenu3, layer;
	char *strp;

	uiLayoutRow(layout, TRUE);

	/* layer menu is 1/3 larger than pass */
	wmenu1 = (2 * w) / 5;
	wmenu2 = (3 * w) / 5;
	wmenu3 = (3 * w) / 6;
	
	/* menu buts */
	if (render_slot) {
		strp = slot_menu();
		but = uiDefButS(block, MENU, 0, strp, 0, 0, wmenu1, UI_UNIT_Y, render_slot, 0, 0, 0, 0, TIP_("Select Slot"));
		uiButSetFunc(but, image_multi_cb, rr, iuser);
		MEM_freeN(strp);
	}

	if (rr) {
		strp = layer_menu(rr, &iuser->layer);
		but = uiDefButS(block, MENU, 0, strp, 0, 0, wmenu2, UI_UNIT_Y, &iuser->layer, 0, 0, 0, 0, TIP_("Select Layer"));
		uiButSetFunc(but, image_multi_cb, rr, iuser);
		MEM_freeN(strp);

		layer = iuser->layer;
		if (rr->rectf || rr->rect32)
			layer--;  /* fake compo/sequencer layer */
		
		rl = BLI_findlink(&rr->layers, layer); /* return NULL is meant to be */
		strp = pass_menu(rl, &iuser->pass);
		but = uiDefButS(block, MENU, 0, strp, 0, 0, wmenu3, UI_UNIT_Y, &iuser->pass, 0, 0, 0, 0, TIP_("Select Pass"));
		uiButSetFunc(but, image_multi_cb, rr, iuser);
		MEM_freeN(strp);
	}
}
Exemple #3
0
static void ui_imageuser_slot_menu(bContext *UNUSED(C), uiLayout *layout, void *image_p)
{
  uiBlock *block = uiLayoutGetBlock(layout);
  Image *image = image_p;
  int slot_id;

  uiDefBut(block,
           UI_BTYPE_LABEL,
           0,
           IFACE_("Slot"),
           0,
           0,
           UI_UNIT_X * 5,
           UI_UNIT_Y,
           NULL,
           0.0,
           0.0,
           0,
           0,
           "");
  uiItemS(layout);

  slot_id = BLI_listbase_count(&image->renderslots) - 1;
  for (RenderSlot *slot = image->renderslots.last; slot; slot = slot->prev) {
    char str[64];
    if (slot->name[0] != '\0') {
      BLI_strncpy(str, slot->name, sizeof(str));
    }
    else {
      BLI_snprintf(str, sizeof(str), IFACE_("Slot %d"), slot_id + 1);
    }
    uiDefButS(block,
              UI_BTYPE_BUT_MENU,
              B_NOP,
              str,
              0,
              0,
              UI_UNIT_X * 5,
              UI_UNIT_X,
              &image->render_slot,
              (float)slot_id,
              0.0,
              0,
              -1,
              "");
    slot_id--;
  }
}
Exemple #4
0
static void ui_imageuser_slot_menu(bContext *UNUSED(C), uiLayout *layout, void *render_slot_p)
{
	uiBlock *block = uiLayoutGetBlock(layout);
	short *render_slot = render_slot_p;
	int slot;

	uiDefBut(block, LABEL, 0, IFACE_("Slot"),
	         0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
	uiItemS(layout);

	slot = IMA_MAX_RENDER_SLOT;
	while (slot--) {
		char str[32];
		BLI_snprintf(str, sizeof(str), IFACE_("Slot %d"), slot + 1);
		uiDefButS(block, BUTM, B_NOP, str, 0, 0,
		          UI_UNIT_X * 5, UI_UNIT_X, render_slot, (float) slot, 0.0, 0, -1, "");
	}
}
Exemple #5
0
static void ui_imageuser_layer_menu(bContext *UNUSED(C), uiLayout *layout, void *rnd_pt)
{
    void **rnd_data = rnd_pt;
    uiBlock *block = uiLayoutGetBlock(layout);
    Image *image = rnd_data[0];
    ImageUser *iuser = rnd_data[1];
    Scene *scene = iuser->scene;
    RenderResult *rr;
    RenderLayer *rl;
    RenderLayer rl_fake = {NULL};
    const char *fake_name;
    int nr;

    /* may have been freed since drawing */
    rr = BKE_image_acquire_renderresult(scene, image);
    if (UNLIKELY(rr == NULL)) {
        return;
    }

    UI_block_layout_set_current(block, layout);
    uiLayoutColumn(layout, false);

    uiDefBut(block, UI_BTYPE_LABEL, 0, IFACE_("Layer"),
             0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
    uiItemS(layout);

    nr = BLI_listbase_count(&rr->layers) - 1;
    fake_name = ui_imageuser_layer_fake_name(rr);

    if (fake_name) {
        BLI_strncpy(rl_fake.name, fake_name, sizeof(rl_fake.name));
        nr += 1;
    }

    for (rl = rr->layers.last; rl; rl = rl->prev, nr--) {
final:
        uiDefButS(block, UI_BTYPE_BUT_MENU, B_NOP, rl->name, 0, 0,
                  UI_UNIT_X * 5, UI_UNIT_X, &iuser->layer, (float) nr, 0.0, 0, -1, "");
    }
Exemple #6
0
static void ui_imageuser_slot_menu(bContext *UNUSED(C), uiLayout *layout, void *image_p)
{
    uiBlock *block = uiLayoutGetBlock(layout);
    Image *image = image_p;
    int slot;

    uiDefBut(block, UI_BTYPE_LABEL, 0, IFACE_("Slot"),
             0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
    uiItemS(layout);

    slot = IMA_MAX_RENDER_SLOT;
    while (slot--) {
        char str[64];
        if (image->render_slots[slot].name[0] != '\0') {
            BLI_strncpy(str, image->render_slots[slot].name, sizeof(str));
        }
        else {
            BLI_snprintf(str, sizeof(str), IFACE_("Slot %d"), slot + 1);
        }
        uiDefButS(block, UI_BTYPE_BUT_MENU, B_NOP, str, 0, 0,
                  UI_UNIT_X * 5, UI_UNIT_X, &image->render_slot, (float) slot, 0.0, 0, -1, "");
    }
}