/* active node */ static void active_node_panel(const bContext *C, Panel *pa) { SpaceNode *snode= CTX_wm_space_node(C); bNodeTree *ntree= (snode) ? snode->edittree : NULL; bNode *node = (ntree) ? nodeGetActive(ntree) : NULL; // xxx... for editing group nodes uiLayout *layout= pa->layout; uiBlock *block; PointerRNA ptr; /* verify pointers, and create RNA pointer for the node */ if ELEM(NULL, ntree, node) return; //if (node->id) /* for group nodes */ // RNA_pointer_create(node->id, &RNA_Node, node, &ptr); //else RNA_pointer_create(&ntree->id, &RNA_Node, node, &ptr); /* set update callback */ // xxx is this really needed block= uiLayoutGetBlock(layout); uiBlockSetHandleFunc(block, do_node_region_buttons, NULL); /* draw this node's name, etc. */ uiItemR(layout, &ptr, "label", 0, NULL, ICON_NODE); uiItemS(layout); uiItemR(layout, &ptr, "name", 0, NULL, ICON_NODE); uiItemS(layout); /* draw this node's settings */ if (node->typeinfo && node->typeinfo->uifuncbut) node->typeinfo->uifuncbut(layout, (bContext *)C, &ptr); else if (node->typeinfo && node->typeinfo->uifunc) node->typeinfo->uifunc(layout, (bContext *)C, &ptr); }
/* evaluation settings for active NLA-Strip */ static void nla_panel_evaluation(const bContext *C, Panel *pa) { PointerRNA strip_ptr; uiLayout *layout= pa->layout; uiLayout *column, *subcolumn, *subrow; uiBlock *block; /* check context and also validity of pointer */ if (!nla_panel_context(C, NULL, NULL, &strip_ptr)) return; block= uiLayoutGetBlock(layout); uiBlockSetHandleFunc(block, do_nla_region_buttons, NULL); column= uiLayoutColumn(layout, 1); uiItemR(column, &strip_ptr, "use_animated_influence", 0, NULL, ICON_NULL); subcolumn= uiLayoutColumn(column, 1); uiLayoutSetEnabled(subcolumn, RNA_boolean_get(&strip_ptr, "use_animated_influence")); uiItemR(subcolumn, &strip_ptr, "influence", 0, NULL, ICON_NULL); column= uiLayoutColumn(layout, 1); subrow= uiLayoutRow(column, 0); uiItemR(subrow, &strip_ptr, "use_animated_time", 0, NULL, ICON_NULL); uiItemR(subrow, &strip_ptr, "use_animated_time_cyclic", 0, NULL, ICON_NULL); subcolumn= uiLayoutColumn(column, 1); subrow= uiLayoutRow(subcolumn, 0); uiLayoutSetEnabled(subrow, RNA_boolean_get(&strip_ptr, "use_animated_time")); uiItemR(subcolumn, &strip_ptr, "strip_time", 0, NULL, ICON_NULL); }
/* evaluation settings for active NLA-Strip */ static void nla_panel_evaluation(const bContext *C, Panel *pa) { PointerRNA strip_ptr; uiLayout *layout = pa->layout; uiLayout *col, *sub; uiBlock *block; /* check context and also validity of pointer */ if (!nla_panel_context(C, NULL, NULL, &strip_ptr)) return; block = uiLayoutGetBlock(layout); UI_block_func_handle_set(block, do_nla_region_buttons, NULL); col = uiLayoutColumn(layout, true); uiItemR(col, &strip_ptr, "use_animated_influence", 0, NULL, ICON_NONE); sub = uiLayoutColumn(col, true); uiLayoutSetEnabled(sub, RNA_boolean_get(&strip_ptr, "use_animated_influence")); uiItemR(sub, &strip_ptr, "influence", 0, NULL, ICON_NONE); col = uiLayoutColumn(layout, true); sub = uiLayoutRow(col, false); uiItemR(sub, &strip_ptr, "use_animated_time", 0, NULL, ICON_NONE); uiItemR(sub, &strip_ptr, "use_animated_time_cyclic", 0, NULL, ICON_NONE); sub = uiLayoutRow(col, false); uiLayoutSetEnabled(sub, RNA_boolean_get(&strip_ptr, "use_animated_time")); uiItemR(sub, &strip_ptr, "strip_time", 0, NULL, ICON_NONE); }
/* 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); }
/* action-clip only settings for active NLA-Strip */ static void nla_panel_actclip(const bContext *C, Panel *pa) { PointerRNA strip_ptr; uiLayout *layout= pa->layout; uiLayout *column, *row; uiBlock *block; /* check context and also validity of pointer */ if (!nla_panel_context(C, NULL, NULL, &strip_ptr)) return; block= uiLayoutGetBlock(layout); uiBlockSetHandleFunc(block, do_nla_region_buttons, NULL); /* Strip Properties ------------------------------------- */ /* action pointer */ row= uiLayoutRow(layout, 1); uiItemR(row, &strip_ptr, "action", 0, NULL, ICON_ACTION); /* action extents */ // XXX custom names were used here (to avoid the prefixes)... probably not necessary in future? column= uiLayoutColumn(layout, 1); uiItemL(column, "Action Extents:", ICON_NULL); uiItemR(column, &strip_ptr, "action_frame_start", 0, "Start Frame", ICON_NULL); uiItemR(column, &strip_ptr, "action_frame_end", 0, "End Frame", ICON_NULL); uiItemO(column, NULL, ICON_NULL, "NLA_OT_action_sync_length"); /* action usage */ column= uiLayoutColumn(layout, 1); uiLayoutSetActive(column, RNA_boolean_get(&strip_ptr, "use_animated_time")==0); uiItemL(column, "Playback Settings:", ICON_NULL); uiItemR(column, &strip_ptr, "scale", 0, NULL, ICON_NULL); uiItemR(column, &strip_ptr, "repeat", 0, NULL, ICON_NULL); }
/* 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); }
/* 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); }
/* active AnimData */ static void nla_panel_animdata (const bContext *C, Panel *pa) { PointerRNA adt_ptr; /* AnimData *adt; */ uiLayout *layout= pa->layout; uiLayout *row; uiBlock *block; /* check context and also validity of pointer */ if (!nla_panel_context(C, &adt_ptr, NULL, NULL)) return; /* adt= adt_ptr.data; */ block= uiLayoutGetBlock(layout); uiBlockSetHandleFunc(block, do_nla_region_buttons, NULL); /* Active Action Properties ------------------------------------- */ /* action */ row= uiLayoutRow(layout, 1); uiTemplateID(row, (bContext *)C, &adt_ptr, "action", "ACTION_OT_new", NULL, NULL /*"ACTION_OT_unlink"*/); // XXX: need to make these operators /* extrapolation */ row= uiLayoutRow(layout, 1); uiItemR(row, &adt_ptr, "action_extrapolation", 0, NULL, ICON_NULL); /* blending */ row= uiLayoutRow(layout, 1); uiItemR(row, &adt_ptr, "action_blend_type", 0, NULL, ICON_NULL); /* influence */ row= uiLayoutRow(layout, 1); uiItemR(row, &adt_ptr, "action_influence", 0, NULL, ICON_NULL); }
/* 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); }
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); }
/* active AnimData */ static void nla_panel_animdata(const bContext *C, Panel *pa) { PointerRNA adt_ptr; /* AnimData *adt; */ uiLayout *layout = pa->layout; uiLayout *row; uiBlock *block; /* check context and also validity of pointer */ if (!nla_panel_context(C, &adt_ptr, NULL, NULL)) return; /* adt = adt_ptr.data; */ block = uiLayoutGetBlock(layout); UI_block_func_handle_set(block, do_nla_region_buttons, NULL); /* AnimData Source Properties ----------------------------------- */ /* icon + id-block name of block where AnimData came from to prevent * accidentally changing the properties of the wrong action */ if (adt_ptr.id.data) { ID *id = adt_ptr.id.data; PointerRNA id_ptr; RNA_id_pointer_create(id, &id_ptr); /* ID-block name > AnimData */ row = uiLayoutRow(layout, true); uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_LEFT); uiItemL(row, id->name + 2, RNA_struct_ui_icon(id_ptr.type)); /* id-block (src) */ uiItemL(row, "", VICO_SMALL_TRI_RIGHT_VEC); /* expander */ uiItemL(row, IFACE_("Animation Data"), ICON_ANIM_DATA); /* animdata */ uiItemS(layout); } /* Active Action Properties ------------------------------------- */ /* action */ row = uiLayoutRow(layout, true); uiTemplateID( row, (bContext *)C, &adt_ptr, "action", "ACTION_OT_new", NULL, "NLA_OT_action_unlink", UI_TEMPLATE_ID_FILTER_ALL); /* extrapolation */ row = uiLayoutRow(layout, true); uiItemR(row, &adt_ptr, "action_extrapolation", 0, NULL, ICON_NONE); /* blending */ row = uiLayoutRow(layout, true); uiItemR(row, &adt_ptr, "action_blend_type", 0, NULL, ICON_NONE); /* influence */ row = uiLayoutRow(layout, true); uiItemR(row, &adt_ptr, "action_influence", 0, NULL, ICON_NONE); }
/* draw settings for envelope modifier */ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width)) { FMod_Envelope *env = (FMod_Envelope *)fcm->data; FCM_EnvelopeData *fed; uiLayout *col, *row; uiBlock *block; uiBut *but; PointerRNA ptr; int i; /* init the RNA-pointer */ RNA_pointer_create(id, &RNA_FModifierEnvelope, fcm, &ptr); /* general settings */ col = uiLayoutColumn(layout, TRUE); uiItemL(col, IFACE_("Envelope:"), ICON_NONE); uiItemR(col, &ptr, "reference_value", 0, NULL, ICON_NONE); row = uiLayoutRow(col, TRUE); uiItemR(row, &ptr, "default_min", 0, IFACE_("Min"), ICON_NONE); uiItemR(row, &ptr, "default_max", 0, IFACE_("Max"), ICON_NONE); /* control points header */ /* TODO: move this control-point control stuff to using the new special widgets for lists * the current way is far too cramped */ row = uiLayoutRow(layout, FALSE); block = uiLayoutGetBlock(row); uiDefBut(block, LABEL, 1, IFACE_("Control Points:"), 0, 0, 7.5 * UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); but = uiDefBut(block, BUT, B_FMODIFIER_REDRAW, IFACE_("Add Point"), 0, 0, 7.5 * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Add a new control-point to the envelope on the current frame")); uiButSetFunc(but, fmod_envelope_addpoint_cb, env, NULL); /* control points list */ for (i = 0, fed = env->data; i < env->totvert; i++, fed++) { /* get a new row to operate on */ row = uiLayoutRow(layout, TRUE); block = uiLayoutGetBlock(row); uiBlockBeginAlign(block); but = uiDefButF(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Fra:"), 0, 0, 4.5 * UI_UNIT_X, UI_UNIT_Y, &fed->time, -MAXFRAMEF, MAXFRAMEF, 10, 1, TIP_("Frame that envelope point occurs")); uiButSetFunc(but, validate_fmodifier_cb, fcm, NULL); uiDefButF(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Min:"), 0, 0, 5 * UI_UNIT_X, UI_UNIT_Y, &fed->min, -UI_FLT_MAX, UI_FLT_MAX, 10, 2, TIP_("Minimum bound of envelope at this point")); uiDefButF(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Max:"), 0, 0, 5 * UI_UNIT_X, UI_UNIT_Y, &fed->max, -UI_FLT_MAX, UI_FLT_MAX, 10, 2, TIP_("Maximum bound of envelope at this point")); but = uiDefIconBut(block, BUT, B_FMODIFIER_REDRAW, ICON_X, 0, 0, 0.9 * UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete envelope control point")); uiButSetFunc(but, fmod_envelope_deletepoint_cb, env, SET_INT_IN_POINTER(i)); uiBlockBeginAlign(block); } }
static void graph_panel_key_properties(const bContext *C, Panel *pa) { bAnimListElem *ale; FCurve *fcu; BezTriple *bezt, *prevbezt; uiLayout *layout = pa->layout; uiLayout *col; uiBlock *block; if (!graph_panel_context(C, &ale, &fcu)) return; block = uiLayoutGetBlock(layout); uiBlockSetHandleFunc(block, do_graph_region_buttons, NULL); /* only show this info if there are keyframes to edit */ if (get_active_fcurve_keyframe_edit(fcu, &bezt, &prevbezt)) { PointerRNA bezt_ptr; /* RNA pointer to keyframe, to allow editing */ RNA_pointer_create(ale->id, &RNA_Keyframe, bezt, &bezt_ptr); /* interpolation */ col= uiLayoutColumn(layout, 0); uiItemR(col, &bezt_ptr, "interpolation", 0, NULL, ICON_NONE); /* numerical coordinate editing */ col= uiLayoutColumn(layout, 1); /* keyframe itself */ uiItemR(col, &bezt_ptr, "co", 0, "Key", ICON_NONE); /* previous handle - only if previous was Bezier interpolation */ if ((prevbezt) && (prevbezt->ipo == BEZT_IPO_BEZ)) uiItemR(col, &bezt_ptr, "handle_left", 0, NULL, ICON_NONE); /* next handle - only if current is Bezier interpolation */ if (bezt->ipo == BEZT_IPO_BEZ) uiItemR(col, &bezt_ptr, "handle_right", 0, NULL, ICON_NONE); } else { if ((fcu->bezt == NULL) && (fcu->modifiers.first)) { /* modifiers only - so no keyframes to be active */ uiItemL(layout, "F-Curve only has F-Modifiers", ICON_NONE); uiItemL(layout, "See Modifiers panel below", ICON_INFO); } else if (fcu->fpt) { /* samples only */ uiItemL(layout, "F-Curve doesn't have any keyframes as it only contains sampled points", ICON_NONE); } else uiItemL(layout, "No active keyframe on F-Curve", ICON_NONE); } MEM_freeN(ale); }
void gpencil_panel_standard_header(const bContext *C, Panel *pa) { PointerRNA ptr; RNA_pointer_create((ID *)CTX_wm_screen(C), &RNA_Space, CTX_wm_space_data(C), &ptr); uiItemR(pa->layout, &ptr, "show_grease_pencil", 0, "", ICON_NONE); }
/* 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, "New Layer", ICON_NONE, "GPENCIL_OT_layer_add"); row= uiLayoutRow(col, 1); uiItemO(row, "Delete Frame", ICON_NONE, "GPENCIL_OT_active_frame_delete"); uiItemO(row, "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, "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); }
static void graph_panel_properties(const bContext *C, Panel *pa) { bAnimListElem *ale; FCurve *fcu; PointerRNA fcu_ptr; uiLayout *layout = pa->layout; uiLayout *col, *row, *sub; // uiBlock *block; // UNUSED char name[256]; int icon = 0; if (!graph_panel_context(C, &ale, &fcu)) return; // UNUSED // block = uiLayoutGetBlock(layout); // uiBlockSetHandleFunc(block, do_graph_region_buttons, NULL); /* F-Curve pointer */ RNA_pointer_create(ale->id, &RNA_FCurve, fcu, &fcu_ptr); /* user-friendly 'name' for F-Curve */ /* TODO: only show the path if this is invalid? */ col = uiLayoutColumn(layout, false); icon = getname_anim_fcurve(name, ale->id, fcu); uiItemL(col, name, icon); /* RNA-Path Editing - only really should be enabled when things aren't working */ col = uiLayoutColumn(layout, true); uiLayoutSetEnabled(col, (fcu->flag & FCURVE_DISABLED) != 0); uiItemR(col, &fcu_ptr, "data_path", 0, "", ICON_RNA); uiItemR(col, &fcu_ptr, "array_index", 0, NULL, ICON_NONE); /* color settings */ col = uiLayoutColumn(layout, true); uiItemL(col, IFACE_("Display Color:"), ICON_NONE); row = uiLayoutRow(col, true); uiItemR(row, &fcu_ptr, "color_mode", 0, "", ICON_NONE); sub = uiLayoutRow(row, true); uiLayoutSetEnabled(sub, (fcu->color_mode == FCURVE_COLOR_CUSTOM)); uiItemR(sub, &fcu_ptr, "color", 0, "", ICON_NONE); MEM_freeN(ale); }
/* settings for 'location difference' driver variable type */ static void graph_panel_driverVar__locDiff(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); uiLayoutSetRedAlert(col, (dtar->flag & DTAR_FLAG_INVALID)); /* XXX: per field... */ uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", IFACE_("Ob/Bone 1:")); if (dtar->id && GS(dtar->id->name) == ID_OB && 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); } uiLayoutSetRedAlert(col, false); /* we can clear it again now - it's only needed when creating the ID/Bone fields */ uiItemR(col, &dtar_ptr, "transform_space", 0, NULL, ICON_NONE); col = uiLayoutColumn(layout, true); uiLayoutSetRedAlert(col, (dtar2->flag & DTAR_FLAG_INVALID)); /* XXX: per field... */ uiTemplateAnyID(col, &dtar2_ptr, "id", "id_type", IFACE_("Ob/Bone 2:")); if (dtar2->id && GS(dtar2->id->name) == ID_OB && 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); } uiLayoutSetRedAlert(col, false); /* we can clear it again now - it's only needed when creating the ID/Bone fields */ uiItemR(col, &dtar2_ptr, "transform_space", 0, NULL, ICON_NONE); }
static void act_viewmenu(bContext *C, uiLayout *layout, void *arg_unused) { bScreen *sc= CTX_wm_screen(C); ScrArea *sa= CTX_wm_area(C); SpaceAction *sact= CTX_wm_space_action(C); PointerRNA spaceptr; /* retrieve state */ RNA_pointer_create(&sc->id, &RNA_SpaceDopeSheetEditor, sact, &spaceptr); /* create menu */ //uiItemO(layout, NULL, ICON_MENU_PANEL, "ACT_OT_properties"); //uiItemS(layout); uiItemR(layout, NULL, 0, &spaceptr, "show_cframe_indicator", 0); uiItemR(layout, NULL, 0, &spaceptr, "show_sliders", 0); uiItemR(layout, NULL, 0, &spaceptr, "automerge_keyframes", 0); if (sact->flag & SACTION_DRAWTIME) uiItemO(layout, "Show Frames", 0, "ANIM_OT_time_toggle"); else uiItemO(layout, "Show Seconds", 0, "ANIM_OT_time_toggle"); uiItemS(layout); uiItemO(layout, NULL, 0, "ANIM_OT_previewrange_set"); uiItemO(layout, NULL, 0, "ANIM_OT_previewrange_clear"); uiItemO(layout, NULL, 0, "ACT_OT_previewrange_set"); uiItemS(layout); uiItemO(layout, NULL, 0, "ACT_OT_frame_jump"); uiItemO(layout, NULL, 0, "ACT_OT_view_all"); if (sa->full) uiItemO(layout, NULL, 0, "SCREEN_OT_screen_full_area"); // "Tile Window", Ctrl UpArrow else uiItemO(layout, NULL, 0, "SCREEN_OT_screen_full_area"); // "Maximize Window", Ctrl DownArrow }
static void v3d_editarmature_buts(uiLayout *layout, Object *ob) { // uiBlock *block= uiLayoutGetBlock(layout); bArmature *arm= ob->data; EditBone *ebone; // TransformProperties *tfp= v3d->properties_storage; // uiLayout *row; uiLayout *col; PointerRNA eboneptr; ebone= arm->act_edbone; if (!ebone || (ebone->layer & arm->layer)==0) { uiItemL(layout, "Nothing selected", ICON_NONE); return; } // row= uiLayoutRow(layout, 0); RNA_pointer_create(&arm->id, &RNA_EditBone, ebone, &eboneptr); col= uiLayoutColumn(layout, 0); uiItemR(col, &eboneptr, "head", 0, "Head", ICON_NONE); if (ebone->parent && ebone->flag & BONE_CONNECTED ) { PointerRNA parptr = RNA_pointer_get(&eboneptr, "parent"); uiItemR(col, &parptr, "tail_radius", 0, "Radius (Parent)", ICON_NONE); } else { uiItemR(col, &eboneptr, "head_radius", 0, "Radius", ICON_NONE); } uiItemR(col, &eboneptr, "tail", 0, "Tail", ICON_NONE); uiItemR(col, &eboneptr, "tail_radius", 0, "Radius", ICON_NONE); uiItemR(col, &eboneptr, "roll", 0, "Roll", ICON_NONE); }
/* draw settings for stepped interpolation modifier */ static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width)) { uiLayout *col, *sub; PointerRNA ptr; /* init the RNA-pointer */ RNA_pointer_create(id, &RNA_FModifierStepped, fcm, &ptr); /* block 1: "stepping" settings */ col = uiLayoutColumn(layout, FALSE); uiItemR(col, &ptr, "frame_step", 0, NULL, ICON_NONE); uiItemR(col, &ptr, "frame_offset", 0, NULL, ICON_NONE); /* block 2: start range settings */ col = uiLayoutColumn(layout, TRUE); uiItemR(col, &ptr, "use_frame_start", 0, NULL, ICON_NONE); sub = uiLayoutColumn(col, TRUE); uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_frame_start")); uiItemR(sub, &ptr, "frame_start", 0, NULL, ICON_NONE); /* block 3: end range settings */ col = uiLayoutColumn(layout, TRUE); uiItemR(col, &ptr, "use_frame_end", 0, NULL, ICON_NONE); sub = uiLayoutColumn(col, TRUE); uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_frame_end")); uiItemR(sub, &ptr, "frame_end", 0, NULL, ICON_NONE); }
static void ui_alembic_import_settings(uiLayout *layout, PointerRNA *imfptr) { uiLayout *box = uiLayoutBox(layout); uiLayout *row = uiLayoutRow(box, false); uiItemL(row, IFACE_("Manual Transform:"), ICON_NONE); row = uiLayoutRow(box, false); uiItemR(row, imfptr, "scale", 0, NULL, ICON_NONE); box = uiLayoutBox(layout); row = uiLayoutRow(box, false); uiItemL(row, IFACE_("Options:"), ICON_NONE); row = uiLayoutRow(box, false); uiItemR(row, imfptr, "set_frame_range", 0, NULL, ICON_NONE); row = uiLayoutRow(box, false); uiItemR(row, imfptr, "is_sequence", 0, NULL, ICON_NONE); row = uiLayoutRow(box, false); uiItemR(row, imfptr, "validate_meshes", 0, NULL, ICON_NONE); }
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); } } }
/* settings for 'location difference' driver variable type */ static void graph_panel_driverVar__locDiff(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_("Ob/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); } uiItemR(col, &dtar_ptr, "transform_space", 0, NULL, ICON_NONE); col = uiLayoutColumn(layout, TRUE); uiTemplateAnyID(col, &dtar2_ptr, "id", "id_type", IFACE_("Ob/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); } uiItemR(col, &dtar2_ptr, "transform_space", 0, NULL, ICON_NONE); }
void uiTemplateMovieClip(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, int compact) { PropertyRNA *prop; PointerRNA clipptr; MovieClip *clip; uiLayout *row, *split; uiBlock *block; if (!ptr->data) return; prop = RNA_struct_find_property(ptr, propname); if (!prop) { printf("%s: property not found: %s.%s\n", __func__, RNA_struct_identifier(ptr->type), propname); return; } if (RNA_property_type(prop) != PROP_POINTER) { printf("%s: expected pointer property for %s.%s\n", __func__, RNA_struct_identifier(ptr->type), propname); return; } clipptr = RNA_property_pointer_get(ptr, prop); clip = clipptr.data; uiLayoutSetContextPointer(layout, "edit_movieclip", &clipptr); if (!compact) uiTemplateID(layout, C, ptr, propname, NULL, "CLIP_OT_open", NULL); if (clip) { uiLayout *col; row = uiLayoutRow(layout, FALSE); block = uiLayoutGetBlock(row); uiDefBut(block, LABEL, 0, "File Path:", 0, 19, 145, 19, NULL, 0, 0, 0, 0, ""); row = uiLayoutRow(layout, FALSE); split = uiLayoutSplit(row, 0.0f, FALSE); row = uiLayoutRow(split, TRUE); uiItemR(row, &clipptr, "filepath", 0, "", ICON_NONE); uiItemO(row, "", ICON_FILE_REFRESH, "clip.reload"); col = uiLayoutColumn(layout, FALSE); uiTemplateColorspaceSettings(col, &clipptr, "colorspace_settings"); } }
void wm_stereo3d_set_draw(bContext *UNUSED(C), wmOperator *op) { Stereo3dData *s3dd = op->customdata; PointerRNA stereo3d_format_ptr; uiLayout *layout = op->layout; uiLayout *col; RNA_pointer_create(NULL, &RNA_Stereo3dDisplay, &s3dd->stereo3d_format, &stereo3d_format_ptr); col = uiLayoutColumn(layout, false); uiItemR(col, &stereo3d_format_ptr, "display_mode", 0, NULL, ICON_NONE); switch (s3dd->stereo3d_format.display_mode) { case S3D_DISPLAY_ANAGLYPH: { uiItemR(col, &stereo3d_format_ptr, "anaglyph_type", 0, NULL, ICON_NONE); break; } case S3D_DISPLAY_INTERLACE: { uiItemR(col, &stereo3d_format_ptr, "interlace_type", 0, NULL, ICON_NONE); uiItemR(col, &stereo3d_format_ptr, "use_interlace_swap", 0, NULL, ICON_NONE); break; } case S3D_DISPLAY_SIDEBYSIDE: { uiItemR(col, &stereo3d_format_ptr, "use_sidebyside_crosseyed", 0, NULL, ICON_NONE); /* fall-through */ } case S3D_DISPLAY_PAGEFLIP: case S3D_DISPLAY_TOPBOTTOM: default: { break; } } }
/* FIXME: 1) Must be same armature for both dtars, 2) Alignment issues... */ 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); uiLayoutSetRedAlert(col, (dtar->flag & DTAR_FLAG_INVALID)); /* XXX: per field... */ uiItemR(col, &dtar_ptr, "id", 0, IFACE_("Bone 1"), ICON_NONE); if (dtar->id && GS(dtar->id->name) == ID_OB && 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); uiLayoutSetRedAlert(col, (dtar2->flag & DTAR_FLAG_INVALID)); /* XXX: per field... */ uiItemR(col, &dtar2_ptr, "id", 0, IFACE_("Bone 2"), ICON_NONE); if (dtar2->id && GS(dtar2->id->name) == ID_OB && 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); } }
/* draw settings for noise modifier */ static void draw_modifier__noise(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width)) { uiLayout *split, *col; PointerRNA ptr; /* init the RNA-pointer */ RNA_pointer_create(id, &RNA_FModifierNoise, fcm, &ptr); /* blending mode */ uiItemR(layout, &ptr, "blend_type", 0, NULL, ICON_NONE); /* split into 2 columns */ split = uiLayoutSplit(layout, 0.5f, FALSE); /* col 1 */ col = uiLayoutColumn(split, FALSE); uiItemR(col, &ptr, "scale", 0, NULL, ICON_NONE); uiItemR(col, &ptr, "strength", 0, NULL, ICON_NONE); /* col 2 */ col = uiLayoutColumn(split, FALSE); uiItemR(col, &ptr, "phase", 0, NULL, ICON_NONE); uiItemR(col, &ptr, "depth", 0, NULL, ICON_NONE); }
static void draw_gpencil_space_specials(const bContext *C, uiLayout *layout) { uiLayout *col, *row; SpaceClip *sc = CTX_wm_space_clip(C); col = uiLayoutColumn(layout, FALSE); if (sc) { bScreen *screen = CTX_wm_screen(C); PointerRNA sc_ptr; RNA_pointer_create(&screen->id, &RNA_SpaceClipEditor, sc, &sc_ptr); row = uiLayoutRow(col, TRUE); uiItemR(row, &sc_ptr, "grease_pencil_source", UI_ITEM_R_EXPAND, NULL, ICON_NONE); } }
/* draw settings for limits modifier */ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width)) { uiLayout *split, *col /* , *row */ /* UNUSED */; PointerRNA ptr; /* init the RNA-pointer */ RNA_pointer_create(id, &RNA_FModifierLimits, fcm, &ptr); /* row 1: minimum */ { /* row = uiLayoutRow(layout, FALSE); */ /* UNUSED */ /* split into 2 columns */ split = uiLayoutSplit(layout, 0.5f, FALSE); /* x-minimum */ col = uiLayoutColumn(split, TRUE); uiItemR(col, &ptr, "use_min_x", 0, NULL, ICON_NONE); uiItemR(col, &ptr, "min_x", 0, NULL, ICON_NONE); /* y-minimum*/ col = uiLayoutColumn(split, TRUE); uiItemR(col, &ptr, "use_min_y", 0, NULL, ICON_NONE); uiItemR(col, &ptr, "min_y", 0, NULL, ICON_NONE); } /* row 2: maximum */ { /* row = uiLayoutRow(layout, FALSE); */ /* UNUSED */ /* split into 2 columns */ split = uiLayoutSplit(layout, 0.5f, FALSE); /* x-minimum */ col = uiLayoutColumn(split, TRUE); uiItemR(col, &ptr, "use_max_x", 0, NULL, ICON_NONE); uiItemR(col, &ptr, "max_x", 0, NULL, ICON_NONE); /* y-minimum*/ col = uiLayoutColumn(split, TRUE); uiItemR(col, &ptr, "use_max_y", 0, NULL, ICON_NONE); uiItemR(col, &ptr, "max_y", 0, NULL, ICON_NONE); } }
/* active NLA-Track */ static void nla_panel_track(const bContext *C, Panel *pa) { PointerRNA nlt_ptr; uiLayout *layout = pa->layout; uiLayout *row; uiBlock *block; /* check context and also validity of pointer */ if (!nla_panel_context(C, NULL, &nlt_ptr, NULL)) return; block = uiLayoutGetBlock(layout); UI_block_func_handle_set(block, do_nla_region_buttons, NULL); /* Info - Active NLA-Context:Track ---------------------- */ row = uiLayoutRow(layout, true); uiItemR(row, &nlt_ptr, "name", 0, NULL, ICON_NLA); }