コード例 #1
0
static const char *label(bNode *node)
{
	if (node->custom1 == 0)
		return IFACE_("Undistortion");
	else
		return IFACE_("Distortion");
}
コード例 #2
0
ファイル: fmodifier_ui.c プロジェクト: Eibriel/kiriblender
/* draw settings for cycles modifier */
static void draw_modifier__cycles(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width))
{
	uiLayout *split, *col;
	PointerRNA ptr;
	
	/* init the RNA-pointer */
	RNA_pointer_create(id, &RNA_FModifierCycles, fcm, &ptr);
	
	/* split into 2 columns 
	 * NOTE: the mode comboboxes shouldn't get labels, otherwise there isn't enough room
	 */
	split = uiLayoutSplit(layout, 0.5f, FALSE);
	
	/* before range */
	col = uiLayoutColumn(split, TRUE);
	uiItemL(col, IFACE_("Before:"), ICON_NONE);
	uiItemR(col, &ptr, "mode_before", 0, "", ICON_NONE);
	uiItemR(col, &ptr, "cycles_before", 0, NULL, ICON_NONE);
		
	/* after range */
	col = uiLayoutColumn(split, TRUE);
	uiItemL(col, IFACE_("After:"), ICON_NONE);
	uiItemR(col, &ptr, "mode_after", 0, "", ICON_NONE);
	uiItemR(col, &ptr, "cycles_after", 0, NULL, ICON_NONE);
}
コード例 #3
0
ファイル: info_ops.c プロジェクト: Walid-Shouman/Blender
static int unpack_all_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
	Main *bmain = CTX_data_main(C);
	uiPopupMenu *pup;
	uiLayout *layout;
	char title[64];
	int count = 0;
	
	count = countPackedFiles(bmain);
	
	if (!count) {
		BKE_report(op->reports, RPT_WARNING, "No packed files to unpack");
		G.fileflags &= ~G_AUTOPACK;
		return OPERATOR_CANCELLED;
	}

	if (count == 1)
		strcpy(title, IFACE_("Unpack 1 File"));
	else
		BLI_snprintf(title, sizeof(title), IFACE_("Unpack %d Files"), count);
	
	pup = uiPupMenuBegin(C, title, ICON_NONE);
	layout = uiPupMenuLayout(pup);

	uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
	uiItemsEnumO(layout, "FILE_OT_unpack_all", "method");

	uiPupMenuEnd(C, pup);

	return OPERATOR_CANCELLED;
}
コード例 #4
0
ファイル: graph_buttons.c プロジェクト: diekev/blender
/* settings for 'transform channel' driver variable type */
static void graph_panel_driverVar__transChan(uiLayout *layout, ID *id, DriverVar *dvar)
{
	DriverTarget *dtar = &dvar->targets[0];
	Object *ob = (Object *)dtar->id;
	PointerRNA dtar_ptr;
	uiLayout *col, *sub;
	
	/* initialize RNA pointer to the target */
	RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr); 
	
	/* properties */
	col = uiLayoutColumn(layout, true);
	uiLayoutSetRedAlert(col, (dtar->flag & DTAR_FLAG_INVALID)); /* XXX: per field... */
	uiItemR(col, &dtar_ptr, "id", 0, IFACE_("Object"), ICON_NONE);
	
	if (dtar->id && GS(dtar->id->name) == ID_OB && ob->pose) {
		PointerRNA tar_ptr;
		
		RNA_pointer_create(dtar->id, &RNA_Pose, ob->pose, &tar_ptr);
		uiItemPointerR(col, &dtar_ptr, "bone_target", &tar_ptr, "bones", IFACE_("Bone"), ICON_BONE_DATA);
	}
		
	sub = uiLayoutColumn(layout, true);
	uiItemR(sub, &dtar_ptr, "transform_type", 0, NULL, ICON_NONE);
	uiItemR(sub, &dtar_ptr, "transform_space", 0, IFACE_("Space"), ICON_NONE);
}
コード例 #5
0
ファイル: image_buttons.c プロジェクト: Eibriel/kiriblender
/* rl==NULL means composite result */
static char *pass_menu(RenderLayer *rl, short *curpass)
{
	RenderPass *rpass;
	int len = 64 + 32 * (rl ? BLI_countlist(&rl->passes) : 1);
	short a, nr = 0;
	char *str = MEM_callocN(len, "menu layers");
	
	strcpy(str, IFACE_("Pass %t"));
	a = strlen(str);
	
	/* rendered results don't have a Combined pass */
	if (rl == NULL || rl->rectf) {
		a += sprintf(str + a, "|%s %%x0", IFACE_("Combined"));
		nr = 1;
	}
	
	if (rl)
		for (rpass = rl->passes.first; rpass; rpass = rpass->next, nr++)
			a += sprintf(str + a, "|%s %%x%d", IFACE_(rpass->name), nr);
	
	if (*curpass >= nr)
		*curpass = 0;
	
	return str;
}
コード例 #6
0
ファイル: eevee_lightcache.c プロジェクト: wangyxuan/blender
void EEVEE_lightcache_info_update(SceneEEVEE *eevee)
{
  LightCache *lcache = eevee->light_cache;

  if (lcache != NULL) {
    if (lcache->flag & LIGHTCACHE_BAKING) {
      BLI_strncpy(
          eevee->light_cache_info, IFACE_("Baking light cache"), sizeof(eevee->light_cache_info));
      return;
    }

    char formatted_mem[15];
    BLI_str_format_byte_unit(formatted_mem, eevee_lightcache_memsize_get(lcache), true);

    int irr_samples = eevee_lightcache_irradiance_sample_count(lcache);

    BLI_snprintf(eevee->light_cache_info,
                 sizeof(eevee->light_cache_info),
                 IFACE_("%d Ref. Cubemaps, %d Irr. Samples (%s in memory)"),
                 lcache->cube_len - 1,
                 irr_samples,
                 formatted_mem);
  }
  else {
    BLI_strncpy(eevee->light_cache_info,
                IFACE_("No light cache in this scene"),
                sizeof(eevee->light_cache_info));
  }
}
コード例 #7
0
ファイル: image_buttons.c プロジェクト: zedd4x/bepuik
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, "");
	}
コード例 #8
0
static int poselib_add_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(evt))
{
	Scene *scene= CTX_data_scene(C);
	Object *ob= get_poselib_object(C);
	bPose *pose= (ob) ? ob->pose : NULL;
	uiPopupMenu *pup;
	uiLayout *layout;
	
	/* sanity check */
	if (ELEM(NULL, ob, pose)) 
		return OPERATOR_CANCELLED;
	
	/* start building */
	pup= uiPupMenuBegin(C, op->type->name, ICON_NONE);
	layout= uiPupMenuLayout(pup);
	uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
	
	/* add new (adds to the first unoccupied frame) */
	uiItemIntO(layout, IFACE_("Add New"), ICON_NONE, "POSELIB_OT_pose_add", "frame", poselib_get_free_index(ob->poselib));
	
	/* check if we have any choices to add a new pose in any other way */
	if ((ob->poselib) && (ob->poselib->markers.first)) {
		/* add new (on current frame) */
		uiItemIntO(layout, IFACE_("Add New (Current Frame)"), ICON_NONE, "POSELIB_OT_pose_add", "frame", CFRA);
		
		/* replace existing - submenu */
		uiItemMenuF(layout, IFACE_("Replace Existing..."), 0, poselib_add_menu_invoke__replacemenu, NULL);
	}
	
	uiPupMenuEnd(C, pup);
	
	/* this operator is only for a menu, not used further */
	return OPERATOR_CANCELLED;
}
コード例 #9
0
ファイル: io_collada.c プロジェクト: Bforartists/Bforartists
static void uiCollada_importSettings(uiLayout *layout, PointerRNA *imfptr)
{
    uiLayout *box, *row;

    /* Import Options: */
    box = uiLayoutBox(layout);
    row = uiLayoutRow(box, false);
    uiItemL(row, IFACE_("Import Data Options:"), ICON_MESH_DATA);

    row = uiLayoutRow(box, false);
    uiItemR(row, imfptr, "import_units", 0, NULL, ICON_NONE);

    box = uiLayoutBox(layout);
    row = uiLayoutRow(box, false);
    uiItemL(row, IFACE_("Armature Options:"), ICON_MESH_DATA);

    row = uiLayoutRow(box, false);
    uiItemR(row, imfptr, "fix_orientation", 0, NULL, ICON_NONE);

    row = uiLayoutRow(box, false);
    uiItemR(row, imfptr, "find_chains", 0, NULL, ICON_NONE);

    row = uiLayoutRow(box, false);
    uiItemR(row, imfptr, "min_chain_length", 0, NULL, ICON_NONE);
}
コード例 #10
0
/* settings for 'single property' driver variable type */
static void graph_panel_driverVar__singleProp(uiLayout *layout, ID *id, DriverVar *dvar)
{
	DriverTarget *dtar = &dvar->targets[0];
	PointerRNA dtar_ptr;
	uiLayout *row, *col;
	
	/* initialize RNA pointer to the target */
	RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr); 
	
	/* Target ID */
	row = uiLayoutRow(layout, FALSE);
	uiTemplateAnyID(row, &dtar_ptr, "id", "id_type", IFACE_("Prop:"));
	
	/* Target Property */
	// TODO: make this less technical...
	if (dtar->id) {
		PointerRNA root_ptr;
		
		/* get pointer for resolving the property selected */
		RNA_id_pointer_create(dtar->id, &root_ptr);
		
		col = uiLayoutColumn(layout, TRUE);
		/* rna path */
		uiTemplatePathBuilder(col, &dtar_ptr, "data_path", &root_ptr, IFACE_("Path"));
	}
}
コード例 #11
0
/* Graph Editor View Settings */
static void graph_panel_view(const bContext *C, Panel *pa)
{
	bScreen *sc = CTX_wm_screen(C);
	SpaceIpo *sipo = CTX_wm_space_graph(C);
	Scene *scene = CTX_data_scene(C);
	PointerRNA spaceptr, sceneptr;
	uiLayout *col, *sub, *row;
	
	/* get RNA pointers for use when creating the UI elements */
	RNA_id_pointer_create(&scene->id, &sceneptr);
	RNA_pointer_create(&sc->id, &RNA_SpaceGraphEditor, sipo, &spaceptr);

	/* 2D-Cursor */
	col = uiLayoutColumn(pa->layout, FALSE);
	uiItemR(col, &spaceptr, "show_cursor", 0, NULL, ICON_NONE);
		
	sub = uiLayoutColumn(col, TRUE);
	uiLayoutSetActive(sub, RNA_boolean_get(&spaceptr, "show_cursor"));
	uiItemO(sub, IFACE_("Cursor from Selection"), ICON_NONE, "GRAPH_OT_frame_jump");

	sub = uiLayoutColumn(col, TRUE);
	uiLayoutSetActive(sub, RNA_boolean_get(&spaceptr, "show_cursor"));
	row = uiLayoutSplit(sub, 0.7f, TRUE);
	uiItemR(row, &sceneptr, "frame_current", 0, IFACE_("Cursor X"), ICON_NONE);
	uiItemEnumO(row, "GRAPH_OT_snap", IFACE_("To Keys"), 0, "type", GRAPHKEYS_SNAP_CFRA);
	row = uiLayoutSplit(sub, 0.7f, TRUE);
	uiItemR(row, &spaceptr, "cursor_position_y", 0, IFACE_("Cursor Y"), ICON_NONE);
	uiItemEnumO(row, "GRAPH_OT_snap", IFACE_("To Keys"), 0, "type", GRAPHKEYS_SNAP_VALUE);
}
コード例 #12
0
ファイル: wm_window.c プロジェクト: vanangamudi/blender-main
void WM_window_open_temp(bContext *C, rcti *position, int type)
{
	wmWindow *win;
	ScrArea *sa;
	
	/* changes rect to fit within desktop */
	wm_window_check_position(position);
	
	/* test if we have a temp screen already */
	for (win = CTX_wm_manager(C)->windows.first; win; win = win->next)
		if (win->screen->temp)
			break;
	
	/* add new window? */
	if (win == NULL) {
		win = wm_window_new(C);
		
		win->posx = position->xmin;
		win->posy = position->ymin;
	}
	
	win->sizex = position->xmax - position->xmin;
	win->sizey = position->ymax - position->ymin;
	
	if (win->ghostwin) {
		wm_window_set_size(win, win->sizex, win->sizey);
		wm_window_raise(win);
	}
	
	/* add new screen? */
	if (win->screen == NULL)
		win->screen = ED_screen_add(win, CTX_data_scene(C), "temp");
	win->screen->temp = 1; 
	
	/* make window active, and validate/resize */
	CTX_wm_window_set(C, win);
	WM_check(C);
	
	/* ensure it shows the right spacetype editor */
	sa = win->screen->areabase.first;
	CTX_wm_area_set(C, sa);
	
	if (type == WM_WINDOW_RENDER) {
		ED_area_newspace(C, sa, SPACE_IMAGE);
	}
	else {
		ED_area_newspace(C, sa, SPACE_USERPREF);
	}
	
	ED_screen_set(C, win->screen);
	
	if (sa->spacetype == SPACE_IMAGE)
		GHOST_SetTitle(win->ghostwin, IFACE_("Blender Render"));
	else if (ELEM(sa->spacetype, SPACE_OUTLINER, SPACE_USERPREF))
		GHOST_SetTitle(win->ghostwin, IFACE_("Blender User Preferences"));
	else if (sa->spacetype == SPACE_FILE)
		GHOST_SetTitle(win->ghostwin, IFACE_("Blender File View"));
	else
		GHOST_SetTitle(win->ghostwin, "Blender");
}
コード例 #13
0
/* settings for 'single property' driver variable type */
static void graph_panel_driverVar__singleProp(uiLayout *layout, ID *id, DriverVar *dvar)
{
	DriverTarget *dtar = &dvar->targets[0];
	PointerRNA dtar_ptr;
	uiLayout *row, *col;
	
	/* initialize RNA pointer to the target */
	RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr); 
	
	/* Target ID */
	row = uiLayoutRow(layout, false);
	uiLayoutSetRedAlert(row, ((dtar->flag & DTAR_FLAG_INVALID) && !dtar->id));
	uiTemplateAnyID(row, &dtar_ptr, "id", "id_type", IFACE_("Prop:"));
	
	/* Target Property */
	if (dtar->id) {
		PointerRNA root_ptr;
		
		/* get pointer for resolving the property selected */
		RNA_id_pointer_create(dtar->id, &root_ptr);
		
		/* rna path */
		col = uiLayoutColumn(layout, true);
		uiLayoutSetRedAlert(col, (dtar->flag & DTAR_FLAG_INVALID));
		uiTemplatePathBuilder(col, &dtar_ptr, "data_path", &root_ptr, IFACE_("Path"));
	}
}
コード例 #14
0
/* settings for 'rotation difference' driver variable type */
static void graph_panel_driverVar__rotDiff(uiLayout *layout, ID *id, DriverVar *dvar)
{
	DriverTarget *dtar = &dvar->targets[0];
	DriverTarget *dtar2 = &dvar->targets[1];
	Object *ob1 = (Object *)dtar->id;
	Object *ob2 = (Object *)dtar2->id;
	PointerRNA dtar_ptr, dtar2_ptr;
	uiLayout *col;
	
	/* initialize RNA pointer to the target */
	RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr); 
	RNA_pointer_create(id, &RNA_DriverTarget, dtar2, &dtar2_ptr); 
	
	/* Bone 1 */
	col = uiLayoutColumn(layout, TRUE);
	uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", IFACE_("Bone 1:"));
		
	if (dtar->id && ob1->pose) {
		PointerRNA tar_ptr;
			
		RNA_pointer_create(dtar->id, &RNA_Pose, ob1->pose, &tar_ptr);
		uiItemPointerR(col, &dtar_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA);
	}
	
	col = uiLayoutColumn(layout, TRUE);
	uiTemplateAnyID(col, &dtar2_ptr, "id", "id_type", IFACE_("Bone 2:"));
		
	if (dtar2->id && ob2->pose) {
		PointerRNA tar_ptr;
			
		RNA_pointer_create(dtar2->id, &RNA_Pose, ob2->pose, &tar_ptr);
		uiItemPointerR(col, &dtar2_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA);
	}
}
コード例 #15
0
static void ui_node_sock_name(bNodeSocket *sock, char name[UI_MAX_NAME_STR])
{
	if (sock->link && sock->link->fromnode) {
		bNode *node = sock->link->fromnode;
		char node_name[UI_MAX_NAME_STR];

		if (node->type == NODE_GROUP) {
			if (node->id)
				BLI_strncpy(node_name, node->id->name + 2, UI_MAX_NAME_STR);
			else
				BLI_strncpy(node_name, N_(node->typeinfo->ui_name), UI_MAX_NAME_STR);
		}
		else
			BLI_strncpy(node_name, node->typeinfo->ui_name, UI_MAX_NAME_STR);

		if (BLI_listbase_is_empty(&node->inputs) &&
		    node->outputs.first != node->outputs.last)
		{
			BLI_snprintf(name, UI_MAX_NAME_STR, "%s | %s", IFACE_(node_name), IFACE_(sock->link->fromsock->name));
		}
		else {
			BLI_strncpy(name, IFACE_(node_name), UI_MAX_NAME_STR);
		}
	}
	else if (sock->type == SOCK_SHADER)
		BLI_strncpy(name, IFACE_("None"), UI_MAX_NAME_STR);
	else
		BLI_strncpy(name, IFACE_("Default"), UI_MAX_NAME_STR);
}
コード例 #16
0
/* settings for 'transform channel' driver variable type */
static void graph_panel_driverVar__transChan(uiLayout *layout, ID *id, DriverVar *dvar)
{
	DriverTarget *dtar = &dvar->targets[0];
	Object *ob = (Object *)dtar->id;
	PointerRNA dtar_ptr;
	uiLayout *col, *sub;
	
	/* initialize RNA pointer to the target */
	RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr); 
	
	/* properties */
	col = uiLayoutColumn(layout, TRUE);
	uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", IFACE_("Ob/Bone:"));
		
	if (dtar->id && ob->pose) {
		PointerRNA tar_ptr;
			
		RNA_pointer_create(dtar->id, &RNA_Pose, ob->pose, &tar_ptr);
		uiItemPointerR(col, &dtar_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA);
	}
		
	sub = uiLayoutColumn(layout, TRUE);
	uiItemR(sub, &dtar_ptr, "transform_type", 0, NULL, ICON_NONE);
	uiItemR(sub, &dtar_ptr, "transform_space", 0, IFACE_("Space"), ICON_NONE);
}
コード例 #17
0
ファイル: image_buttons.c プロジェクト: Eibriel/kiriblender
/* TODO, curlay should be removed? */
static char *layer_menu(RenderResult *rr, short *UNUSED(curlay))
{
	RenderLayer *rl;
	int len = 64 + RE_MAXNAME * BLI_countlist(&rr->layers);
	short a, nr = 0;
	char *str = MEM_callocN(len, "menu layers");
	
	strcpy(str, IFACE_("Layer %t"));
	a = strlen(str);
	
	/* compo result */
	if (rr->rectf) {
		a += sprintf(str + a, "|%s %%x0", IFACE_("Composite"));
		nr = 1;
	}
	else if (rr->rect32) {
		a += sprintf(str + a, "|%s %%x0", IFACE_("Sequence"));
		nr = 1;
	}
	for (rl = rr->layers.first; rl; rl = rl->next, nr++) {
		a += sprintf(str + a, "|%s %%x%d", rl->name, nr);
	}
	
	/* no curlay clip here, on render (redraws) the amount of layers can be 1 fir single-layer render */
	
	return str;
}
コード例 #18
0
/* Draw the contents for a grease-pencil panel*/
static void draw_gpencil_panel(bContext *C, uiLayout *layout, bGPdata *gpd, PointerRNA *ctx_ptr)
{
	PointerRNA gpd_ptr;
	bGPDlayer *gpl;
	uiLayout *col, *row;
	short v3d_stroke_opts = STROKE_OPTS_NORMAL;
	const short is_v3d = CTX_wm_view3d(C) != NULL;
	
	/* make new PointerRNA for Grease Pencil block */
	RNA_id_pointer_create((ID *)gpd, &gpd_ptr);
	
	/* draw gpd settings first ------------------------------------- */
	col = uiLayoutColumn(layout, 0);
	/* current Grease Pencil block */
	/* TODO: show some info about who owns this? */
	uiTemplateID(col, C, ctx_ptr, "grease_pencil", "GPENCIL_OT_data_add", NULL, "GPENCIL_OT_data_unlink");
	
	/* add new layer button - can be used even when no data, since it can add a new block too */
	uiItemO(col, IFACE_("New Layer"), ICON_NONE, "GPENCIL_OT_layer_add");
	row = uiLayoutRow(col, 1);
		uiItemO(row, IFACE_("Delete Frame"), ICON_NONE, "GPENCIL_OT_active_frame_delete");
		uiItemO(row, IFACE_("Convert"), ICON_NONE, "GPENCIL_OT_convert");
	
	/* sanity checks... */
	if (gpd == NULL)
		return;
	
	/* draw each layer --------------------------------------------- */
	for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
		col = uiLayoutColumn(layout, 1);
		gp_drawui_layer(col, gpd, gpl, is_v3d);
	}
	
	/* draw gpd drawing settings first ------------------------------------- */
	col = uiLayoutColumn(layout, 1);
		/* label */
		uiItemL(col, IFACE_("Drawing Settings:"), ICON_NONE);
		
		/* check whether advanced 3D-View drawing space options can be used */
		if (is_v3d) {
			if (gpd->flag & (GP_DATA_DEPTH_STROKE|GP_DATA_DEPTH_VIEW))
				v3d_stroke_opts = STROKE_OPTS_V3D_ON;
			else
				v3d_stroke_opts = STROKE_OPTS_V3D_OFF;
		}
		
		/* drawing space options */
		row= uiLayoutRow(col, 1);
			uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "VIEW", NULL, ICON_NONE);
			uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "CURSOR", NULL, ICON_NONE);
		row= uiLayoutRow(col, 1);
			uiLayoutSetActive(row, v3d_stroke_opts);
			uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "SURFACE", NULL, ICON_NONE);
			uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "STROKE", NULL, ICON_NONE);
		
		row= uiLayoutRow(col, 0);
			uiLayoutSetActive(row, v3d_stroke_opts==STROKE_OPTS_V3D_ON);
			uiItemR(row, &gpd_ptr, "use_stroke_endpoints", 0, NULL, ICON_NONE);
}
コード例 #19
0
ファイル: node_header.c プロジェクト: danielmarg/blender-main
static void node_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclass)
{
	Main *bmain = CTX_data_main(C);
	Scene *scene = CTX_data_scene(C);
	SpaceNode *snode = CTX_wm_space_node(C);
	bNodeTree *ntree;
	int nodeclass = GET_INT_FROM_POINTER(arg_nodeclass);
	int event, compatibility = 0;
	
	ntree = snode->nodetree;
	
	if (!ntree) {
		uiItemS(layout);
		return;
	}

	if (ntree->type == NTREE_SHADER) {
		if (BKE_scene_use_new_shading_nodes(scene))
			compatibility = NODE_NEW_SHADING;
		else
			compatibility = NODE_OLD_SHADING;
	}
	
	if (nodeclass == NODE_CLASS_GROUP) {
		bNodeTree *ngroup;
		
		uiLayoutSetFunc(layout, do_node_add_group, NULL);
		
		/* XXX hack: negative numbers used for empty group types */
		if (node_tree_has_type(ntree->type, NODE_GROUP))
			uiItemV(layout, IFACE_("New Group"), 0, -NODE_GROUP);
		uiItemS(layout);
		
		for (ngroup = bmain->nodetree.first, event = 0; ngroup; ngroup = ngroup->id.next, ++event) {
			/* only use group trees */
			if (ngroup->type == ntree->type && ngroup->nodetype == NODE_GROUP) {
				uiItemV(layout, ngroup->id.name + 2, 0, event);
			}
		}
	}
	else {
		bNodeType *ntype;
		
		uiLayoutSetFunc(layout, do_node_add_static, NULL);
		
		for (ntype = ntreeGetType(ntree->type)->node_types.first; ntype; ntype = ntype->next) {
			if (ntype->nclass == nodeclass && ntype->name) {
				if (!compatibility || (ntype->compatibility & compatibility)) {
					uiItemV(layout, IFACE_(ntype->name), 0, ntype->type);
				}
			}
		}
	}
}
コード例 #20
0
ファイル: image_buttons.c プロジェクト: zedd4x/bepuik
static const char *ui_imageuser_layer_fake_name(RenderResult *rr)
{
	if (rr->rectf) {
		return IFACE_("Composite");
	}
	else if (rr->rect32) {
		return IFACE_("Sequence");
	}
	else {
		return NULL;
	}
}
コード例 #21
0
static void setNearestAxis2d(TransInfo *t)
{
	/* no correction needed... just use whichever one is lower */
	if (abs(t->mval[0] - t->con.imval[0]) < abs(t->mval[1] - t->con.imval[1])) {
		t->con.mode |= CON_AXIS1;
		BLI_strncpy(t->con.text, IFACE_(" along Y axis"), sizeof(t->con.text));
	}
	else {
		t->con.mode |= CON_AXIS0;
		BLI_strncpy(t->con.text, IFACE_(" along X axis"), sizeof(t->con.text));
	}
}
コード例 #22
0
static void foreach_nodeclass(Scene *UNUSED(scene), void *calldata, bNodeClassCallback func)
{
	func(calldata, NODE_CLASS_INPUT, IFACE_("Input"));
	func(calldata, NODE_CLASS_OUTPUT, IFACE_("Output"));
	func(calldata, NODE_CLASS_OP_COLOR, IFACE_("Color"));
	func(calldata, NODE_CLASS_OP_VECTOR, IFACE_("Vector"));
	func(calldata, NODE_CLASS_OP_FILTER, IFACE_("Filter"));
	func(calldata, NODE_CLASS_CONVERTOR, IFACE_("Convertor"));
	func(calldata, NODE_CLASS_MATTE, IFACE_("Matte"));
	func(calldata, NODE_CLASS_DISTORT, IFACE_("Distort"));
	func(calldata, NODE_CLASS_GROUP, IFACE_("Group"));
	func(calldata, NODE_CLASS_LAYOUT, IFACE_("Layout"));
}
コード例 #23
0
ファイル: image_buttons.c プロジェクト: bitfusionio/blender
static const char *ui_imageuser_layer_fake_name(RenderResult *rr)
{
    RenderView *rv = RE_RenderViewGetById(rr, 0);
    if (rv->rectf) {
        return IFACE_("Composite");
    }
    else if (rv->rect32) {
        return IFACE_("Sequence");
    }
    else {
        return NULL;
    }
}
コード例 #24
0
static void node_tree_interface_panel(const bContext *C, Panel *pa)
{
	SpaceNode *snode = CTX_wm_space_node(C);
	bNodeTree *ntree = (snode) ? snode->edittree : NULL;
	bNodeSocket *sock;
	int in_out;
	uiLayout *layout = pa->layout, *row, *split, *col;
	PointerRNA ptr, sockptr, opptr;

	if (!ntree)
		return;
	
	RNA_id_pointer_create((ID *)ntree, &ptr);
	
	node_tree_find_active_socket(ntree, &sock, &in_out);
	RNA_pointer_create((ID *)ntree, &RNA_NodeSocketInterface, sock, &sockptr);
	
	row = uiLayoutRow(layout, false);
	
	split = uiLayoutRow(row, true);
	col = uiLayoutColumn(split, true);
	uiItemL(col, IFACE_("Inputs:"), ICON_NONE);
	uiTemplateList(col, (bContext *)C, "NODE_UL_interface_sockets", "inputs", &ptr, "inputs", &ptr, "active_input",
	               NULL, 0, 0, 0, 0);
	opptr = uiItemFullO(col, "NODE_OT_tree_socket_add", "", ICON_PLUS, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
	RNA_enum_set(&opptr, "in_out", SOCK_IN);
	
	col = uiLayoutColumn(split, true);
	uiItemL(col, IFACE_("Outputs:"), ICON_NONE);
	uiTemplateList(col, (bContext *)C, "NODE_UL_interface_sockets", "outputs", &ptr, "outputs", &ptr, "active_output",
	               NULL, 0, 0, 0, 0);
	opptr = uiItemFullO(col, "NODE_OT_tree_socket_add", "", ICON_PLUS, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
	RNA_enum_set(&opptr, "in_out", SOCK_OUT);
	
	col = uiLayoutColumn(row, true);
	opptr = uiItemFullO(col, "NODE_OT_tree_socket_move", "", ICON_TRIA_UP, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
	RNA_enum_set(&opptr, "direction", 1);
	opptr = uiItemFullO(col, "NODE_OT_tree_socket_move", "", ICON_TRIA_DOWN, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
	RNA_enum_set(&opptr, "direction", 2);
	
	if (sock) {
		row = uiLayoutRow(layout, true);
		uiItemR(row, &sockptr, "name", 0, NULL, ICON_NONE);
		uiItemO(row, "", ICON_X, "NODE_OT_tree_socket_remove");
		
		if (sock->typeinfo->interface_draw) {
			uiItemS(layout);
			sock->typeinfo->interface_draw((bContext *)C, layout, &sockptr);
		}
	}
}
コード例 #25
0
ファイル: image_buttons.c プロジェクト: Eibriel/kiriblender
static char *slot_menu(void)
{
	char *str;
	int a, slot;
	
	str = MEM_callocN(IMA_MAX_RENDER_SLOT * 32, "menu slots");
	
	strcpy(str, IFACE_("Slot %t"));
	a = strlen(str);

	for (slot = 0; slot < IMA_MAX_RENDER_SLOT; slot++)
		a += sprintf(str + a, IFACE_("|Slot %d %%x%d"), slot + 1, slot);
	
	return str;
}
コード例 #26
0
ファイル: image_buttons.c プロジェクト: dfelinto/blender
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--;
  }
}
コード例 #27
0
/*
 * Set the constraint according to the user defined orientation
 *
 * ftext is a format string passed to BLI_snprintf. It will add the name of
 * the orientation where %s is (logically).
 */
void setUserConstraint(TransInfo *t, short orientation, int mode, const char ftext[])
{
  char text[256];

  switch (orientation) {
    case V3D_ORIENT_GLOBAL: {
      float mtx[3][3];
      BLI_snprintf(text, sizeof(text), ftext, IFACE_("global"));
      unit_m3(mtx);
      setConstraint(t, mtx, mode, text);
      break;
    }
    case V3D_ORIENT_LOCAL:
      BLI_snprintf(text, sizeof(text), ftext, IFACE_("local"));
      setLocalConstraint(t, mode, text);
      break;
    case V3D_ORIENT_NORMAL:
      BLI_snprintf(text, sizeof(text), ftext, IFACE_("normal"));
      if (checkUseAxisMatrix(t)) {
        setAxisMatrixConstraint(t, mode, text);
      }
      else {
        setConstraint(t, t->spacemtx, mode, text);
      }
      break;
    case V3D_ORIENT_VIEW:
      BLI_snprintf(text, sizeof(text), ftext, IFACE_("view"));
      setConstraint(t, t->spacemtx, mode, text);
      break;
    case V3D_ORIENT_CURSOR:
      BLI_snprintf(text, sizeof(text), ftext, IFACE_("cursor"));
      setConstraint(t, t->spacemtx, mode, text);
      break;
    case V3D_ORIENT_GIMBAL:
      BLI_snprintf(text, sizeof(text), ftext, IFACE_("gimbal"));
      setConstraint(t, t->spacemtx, mode, text);
      break;
    case V3D_ORIENT_CUSTOM_MATRIX:
      BLI_snprintf(text, sizeof(text), ftext, IFACE_("custom matrix"));
      setConstraint(t, t->spacemtx, mode, text);
      break;
    case V3D_ORIENT_CUSTOM: {
      char orientation_str[128];
      BLI_snprintf(orientation_str,
                   sizeof(orientation_str),
                   "%s \"%s\"",
                   IFACE_("custom orientation"),
                   t->orientation.custom->name);
      BLI_snprintf(text, sizeof(text), ftext, orientation_str);
      setConstraint(t, t->spacemtx, mode, text);
      break;
    }
  }

  t->con.orientation = orientation;

  t->con.mode |= CON_USER;
}
コード例 #28
0
ファイル: editmesh_bevel.c プロジェクト: wisaac407/blender
static void edbm_bevel_update_header(bContext *C, wmOperator *op)
{
	const char *str = IFACE_("Confirm: (Enter/LMB), Cancel: (Esc/RMB), Mode: %s (M), Clamp Overlap: %s (C), "
	                         "Vertex Only: %s (V), Profile Control: %s (P), Offset: %s, Segments: %d, Profile: %.3f");

	char msg[UI_MAX_DRAW_STR];
	ScrArea *sa = CTX_wm_area(C);
	Scene *sce = CTX_data_scene(C);

	if (sa) {
		BevelData *opdata = op->customdata;
		char offset_str[NUM_STR_REP_LEN];
		const char *type_str;
		PropertyRNA *prop = RNA_struct_find_property(op->ptr, "offset_type");

		if (hasNumInput(&opdata->num_input[OFFSET_VALUE])) {
			outputNumInput(&opdata->num_input[OFFSET_VALUE], offset_str, &sce->unit);
		}
		else {
			BLI_snprintf(offset_str, NUM_STR_REP_LEN, "%f", RNA_float_get(op->ptr, "offset"));
		}

		RNA_property_enum_name_gettexted(C, op->ptr, prop, RNA_property_enum_get(op->ptr, prop), &type_str);

		BLI_snprintf(msg, sizeof(msg), str, type_str,
		             WM_bool_as_string(RNA_boolean_get(op->ptr, "clamp_overlap")),
		             WM_bool_as_string(RNA_boolean_get(op->ptr, "vertex_only")),
		             WM_bool_as_string(opdata->value_mode == PROFILE_VALUE),
		             offset_str, RNA_int_get(op->ptr, "segments"), RNA_float_get(op->ptr, "profile"));

		ED_area_headerprint(sa, msg);
	}
}
コード例 #29
0
void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer **memoryBuffers)
{
	if (this->m_chunkExecutionStates[chunkNumber] == COM_ES_SCHEDULED)
		this->m_chunkExecutionStates[chunkNumber] = COM_ES_EXECUTED;

	atomic_add_and_fetch_u(&this->m_chunksFinished, 1);
	if (memoryBuffers) {
		for (unsigned int index = 0; index < this->m_cachedMaxReadBufferOffset; index++) {
			MemoryBuffer *buffer = memoryBuffers[index];
			if (buffer) {
				if (buffer->isTemporarily()) {
					memoryBuffers[index] = NULL;
					delete buffer;
				}
			}
		}
		MEM_freeN(memoryBuffers);
	}
	if (this->m_bTree) {
		// status report is only performed for top level Execution Groups.
		float progress = this->m_chunksFinished;
		progress /= this->m_numberOfChunks;
		this->m_bTree->progress(this->m_bTree->prh, progress);

		char buf[128];
		BLI_snprintf(buf, sizeof(buf), IFACE_("Compositing | Tile %u-%u"),
		             this->m_chunksFinished,
		             this->m_numberOfChunks);
		this->m_bTree->stats_draw(this->m_bTree->sdh, buf);
	}
}
コード例 #30
0
ファイル: image_buttons.c プロジェクト: Eibriel/kiriblender
static void uiblock_layer_pass_arrow_buttons(uiLayout *layout, RenderResult *rr, ImageUser *iuser, short *render_slot)
{
	uiBlock *block = uiLayoutGetBlock(layout);
	uiLayout *row;
	uiBut *but;
	const float dpi_fac = UI_DPI_FAC;
	
	row = uiLayoutRow(layout, TRUE);

	if (rr == NULL || iuser == NULL)
		return;
	if (rr->layers.first == NULL) {
		uiItemL(row, IFACE_("No Layers in Render Result"), ICON_NONE);
		return;
	}

	/* decrease, increase arrows */
	but = uiDefIconBut(block, BUT, 0, ICON_TRIA_LEFT,   0, 0, 0.85f * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Previous Layer"));
	uiButSetFunc(but, image_multi_declay_cb, rr, iuser);
	but = uiDefIconBut(block, BUT, 0, ICON_TRIA_RIGHT,  0, 0, 0.90f * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Next Layer"));
	uiButSetFunc(but, image_multi_inclay_cb, rr, iuser);

	uiblock_layer_pass_buttons(row, rr, iuser, 230 * dpi_fac, render_slot);

	/* decrease, increase arrows */
	but = uiDefIconBut(block, BUT, 0, ICON_TRIA_LEFT,   0, 0, 0.85f * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Previous Pass"));
	uiButSetFunc(but, image_multi_decpass_cb, rr, iuser);
	but = uiDefIconBut(block, BUT, 0, ICON_TRIA_RIGHT,  0, 0, 0.90f * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Next Pass"));
	uiButSetFunc(but, image_multi_incpass_cb, rr, iuser);

	uiBlockEndAlign(block);
}