Beispiel #1
0
void CLIP_OT_change_frame(wmOperatorType *ot)
{
	/* identifiers */
	ot->name = "Change Frame";
	ot->idname = "CLIP_OT_change_frame";
	ot->description = "Interactively change the current frame number";

	/* api callbacks */
	ot->exec = change_frame_exec;
	ot->invoke = change_frame_invoke;
	ot->modal = change_frame_modal;
	ot->poll = change_frame_poll;

	/* flags */
	ot->flag = OPTYPE_BLOCKING | OPTYPE_UNDO;

	/* rna */
	RNA_def_int(ot->srna, "frame", 0, MINAFRAME, MAXFRAME, "Frame", "", MINAFRAME, MAXFRAME);
}
Beispiel #2
0
static void MARKER_OT_duplicate(wmOperatorType *ot)
{
	/* identifiers */
	ot->name= "Duplicate Time Marker";
	ot->description= "Duplicate selected time marker(s).";
	ot->idname= "MARKER_OT_duplicate";
	
	/* api callbacks */
	ot->exec= ed_marker_duplicate_exec;
	ot->invoke= ed_marker_duplicate_invoke;
	ot->modal= ed_marker_move_modal;
	ot->poll= ED_operator_areaactive;
	
	/* flags */
	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
	
	/* rna storage */
	RNA_def_int(ot->srna, "frames", 0, INT_MIN, INT_MAX, "Frames", "", INT_MIN, INT_MAX);
}
Beispiel #3
0
void ANIM_OT_keying_set_active_set (wmOperatorType *ot)
{
	/* identifiers */
	ot->name= "Set Active Keying Set";
	ot->idname= "ANIM_OT_keying_set_active_set";
	
	/* callbacks */
	ot->invoke= keyingset_active_menu_invoke;
	ot->exec= keyingset_active_menu_exec; 
	ot->poll= ED_operator_areaactive;
	
	/* flags */
	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
	
	/* keyingset to use
	 *	- here the type is int not enum, since many of the indices here are determined dynamically
	 */
	RNA_def_int(ot->srna, "type", 0, INT_MIN, INT_MAX, "Keying Set Number", "Index (determined internally) of the Keying Set to use", 0, 1);
}
Beispiel #4
0
static void MARKER_OT_select_all_toggle(wmOperatorType *ot)
{
	/* identifiers */
	ot->name= "(De)select all markers";
	ot->description= "(de)select all time markers.";
	ot->idname= "MARKER_OT_select_all_toggle";
	
	/* api callbacks */
	ot->exec= ed_marker_select_all_exec;
	ot->invoke= ed_marker_select_all_invoke;
	ot->poll= ED_operator_areaactive;
	
	/* flags */
	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
	
	/* rna */
	RNA_def_boolean(ot->srna, "select_swap", 0, "Select Swap", "");
	RNA_def_int(ot->srna, "select_type", 0, INT_MIN, INT_MAX, "Select Type", "", INT_MIN, INT_MAX);
}
Beispiel #5
0
void FILE_OT_unpack_item(wmOperatorType *ot)
{
	/* identifiers */
	ot->name = "Unpack Item";
	ot->idname = "FILE_OT_unpack_item";
	ot->description = "Unpack this file to an external file";
	
	/* api callbacks */
	ot->exec = unpack_item_exec;
	ot->invoke = unpack_item_invoke;
	
	/* flags */
	ot->flag = OPTYPE_UNDO;
	
	/* properties */
	RNA_def_enum(ot->srna, "method", unpack_item_method_items, PF_USE_LOCAL, "Method", "How to unpack");
	RNA_def_string(ot->srna, "id_name", NULL, BKE_ST_MAXNAME, "ID name", "Name of ID block to unpack");
	RNA_def_int(ot->srna, "id_type", ID_IM, 0, INT_MAX, "ID Type", "Identifier type of ID block", 0, INT_MAX);
}
void VIEW3D_OT_layers(wmOperatorType *ot)
{
	/* identifiers */
	ot->name = "Layers";
	ot->description = "Toggle layer(s) visibility";
	ot->idname = "VIEW3D_OT_layers";
	
	/* api callbacks */
	ot->invoke = view3d_layers_invoke;
	ot->exec = view3d_layers_exec;
	ot->poll = view3d_layers_poll;
	
	/* flags */
	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
	
	RNA_def_int(ot->srna, "nr", 1, 0, 20, "Number", "The layer number to set, zero for all layers", 0, 20);
	RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Add this layer to the current view layers");
	RNA_def_boolean(ot->srna, "toggle", 1, "Toggle", "Toggle the layer");
}
Beispiel #7
0
void POSELIB_OT_pose_add(wmOperatorType *ot)
{
	/* identifiers */
	ot->name = "PoseLib Add Pose";
	ot->idname = "POSELIB_OT_pose_add";
	ot->description = "Add the current Pose to the active Pose Library";
	
	/* api callbacks */
	ot->invoke = poselib_add_menu_invoke;
	ot->exec = poselib_add_exec;
	ot->poll = ED_operator_posemode;
	
	/* flags */
	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
	
	/* properties */
	RNA_def_int(ot->srna, "frame", 1, 0, INT_MAX, "Frame", "Frame to store pose on", 0, INT_MAX);
	RNA_def_string(ot->srna, "name", "Pose", 64, "Pose Name", "Name of newly added Pose");
}
Beispiel #8
0
static void MARKER_OT_move(wmOperatorType *ot)
{
	/* identifiers */
	ot->name= "Move Time Marker";
	ot->description= "Move selected time marker(s)";
	ot->idname= "MARKER_OT_move";
	
	/* api callbacks */
	ot->exec= ed_marker_move_exec;
	ot->invoke= ed_marker_move_invoke_wrapper;
	ot->modal= ed_marker_move_modal;
	ot->poll= ed_markers_poll_selected_markers;
	
	/* flags */
	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
	
	/* rna storage */
	RNA_def_int(ot->srna, "frames", 0, INT_MIN, INT_MAX, "Frames", "", INT_MIN, INT_MAX);
}
Beispiel #9
0
void WM_OT_collada_import(wmOperatorType *ot)
{
	ot->name = "Import COLLADA";
	ot->description = "Load a Collada file";
	ot->idname = "WM_OT_collada_import";

	ot->invoke = WM_operator_filesel;
	ot->exec = wm_collada_import_exec;
	ot->poll = WM_operator_winactive;

	//ot->flag |= OPTYPE_PRESET;

	ot->ui = wm_collada_import_draw;

	WM_operator_properties_filesel(
	        ot, FILE_TYPE_FOLDER | FILE_TYPE_COLLADA, FILE_BLENDER, FILE_OPENFILE,
	        WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);

	RNA_def_boolean(ot->srna,
		"import_units", 0, "Import Units",
		"If disabled match import to Blender's current Unit settings, "
		"otherwise use the settings from the Imported scene");

	RNA_def_boolean(ot->srna,
		"fix_orientation", 0, "Fix Leaf Bones",
		"Fix Orientation of Leaf Bones (Collada does only support Joints)");

	RNA_def_boolean(ot->srna,
		"find_chains", 0, "Find Bone Chains",
		"Find best matching Bone Chains and ensure bones in chain are connected");

	RNA_def_int(ot->srna,
		"min_chain_length",
		0,
		0,
		INT_MAX,
		"Minimum Chain Length",
		"When searching Bone Chains disregard chains of length below this value",
		0,
		INT_MAX);

}
Beispiel #10
0
void NLA_OT_action_pushdown(wmOperatorType *ot)
{
	/* identifiers */
	ot->name = "Push Down Action";
	ot->idname = "NLA_OT_action_pushdown";
	ot->description = "Push action down onto the top of the NLA stack as a new strip";
	
	/* callbacks */
	ot->exec = nlachannels_pushdown_exec;
	ot->poll = nlaop_poll_tweakmode_off;
	
	/* flags */
	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
	
	/* properties */
	ot->prop = RNA_def_int(ot->srna, "channel_index", -1, -1, INT_MAX, "Channel Index",
	                       "Index of NLA action channel to perform pushdown operation on",
	                       0, INT_MAX);
	RNA_def_property_flag(ot->prop, PROP_SKIP_SAVE);
}
Beispiel #11
0
static void GRAPH_OT_cursor_set(wmOperatorType *ot)
{
	/* identifiers */
	ot->name = "Set Cursor";
	ot->idname = "GRAPH_OT_cursor_set";
	ot->description = "Interactively set the current frame number and value cursor";
	
	/* api callbacks */
	ot->exec = graphview_cursor_exec;
	ot->invoke = graphview_cursor_invoke;
	ot->modal = graphview_cursor_modal;
	ot->poll = graphview_cursor_poll;
	
	/* flags */
	ot->flag = OPTYPE_BLOCKING | OPTYPE_UNDO;

	/* rna */
	RNA_def_int(ot->srna, "frame", 0, MINAFRAME, MAXFRAME, "Frame", "", MINAFRAME, MAXFRAME);
	RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Value", "", -100.0f, 100.0f);
}
void ARMATURE_OT_subdivide(wmOperatorType *ot)
{
	PropertyRNA *prop;

	/* identifiers */
	ot->name = "Subdivide Multi";
	ot->idname = "ARMATURE_OT_subdivide";
	ot->description = "Break selected bones into chains of smaller bones";
	
	/* api callbacks */
	ot->exec = armature_subdivide_exec;
	ot->poll = ED_operator_editarmature;
	
	/* flags */
	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
	
	/* Properties */
	prop = RNA_def_int(ot->srna, "number_cuts", 1, 1, 1000, "Number of Cuts", "", 1, 10);
	/* avoid re-using last var because it can cause _very_ high poly meshes and annoy users (or worse crash) */
	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
Beispiel #13
0
void MESH_OT_bevel(wmOperatorType *ot)
{
	/* identifiers */
	ot->name = "Bevel";
	ot->description = "Edge Bevel";
	ot->idname = "MESH_OT_bevel";

	/* api callbacks */
	ot->exec = edbm_bevel_exec;
	ot->invoke = edbm_bevel_invoke;
	ot->modal = edbm_bevel_modal;
	ot->cancel = edbm_bevel_cancel;
	ot->poll = ED_operator_editmesh;

	/* flags */
	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_GRAB_POINTER | OPTYPE_BLOCKING;

	RNA_def_float(ot->srna, "offset", 0.0f, -FLT_MAX, FLT_MAX, "Offset", "", 0.0f, 1.0f);
	RNA_def_int(ot->srna, "segments", 1, 1, 50, "Segments", "Segments for curved edge", 1, 8);
	RNA_def_boolean(ot->srna, "vertex_only", false, "Vertex only", "Bevel only vertices");
}
void MESH_OT_primitive_circle_add(wmOperatorType *ot)
{
	/* identifiers */
	ot->name = "Add Circle";
	ot->description = "Construct a circle mesh";
	ot->idname = "MESH_OT_primitive_circle_add";

	/* api callbacks */
	ot->invoke = WM_operator_view3d_distance_invoke;
	ot->exec = add_primitive_circle_exec;
	ot->poll = ED_operator_scene_editable;

	/* flags */
	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;

	/* props */
	RNA_def_int(ot->srna, "vertices", 32, 3, INT_MAX, "Vertices", "", 3, 500);
	make_prim_radius_prop(ot);
	RNA_def_enum(ot->srna, "fill_type", fill_type_items, 0, "Fill Type", "");

	ED_object_add_generic_props(ot, true);
}
Beispiel #15
0
void TRANSFORM_OT_vertex_random(struct wmOperatorType *ot)
{
	/* identifiers */
	ot->name = "Randomize";
	ot->description = "Randomize vertices";
	ot->idname = "TRANSFORM_OT_vertex_random";

	/* api callbacks */
	ot->exec = object_rand_verts_exec;
	ot->poll = ED_transverts_poll;

	/* flags */
	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;

	/* props */
	RNA_def_float(ot->srna, "offset",  0.1f, -FLT_MAX, FLT_MAX, "Amount", "Distance to offset", -10.0f, 10.0f);
	RNA_def_float(ot->srna, "uniform",  0.0f, 0.0f, 1.0f, "Uniform",
	              "Increase for uniform offset distance", 0.0f, 1.0f);
	RNA_def_float(ot->srna, "normal",  0.0f, 0.0f, 1.0f, "normal",
	              "Align offset direction to normals", 0.0f, 1.0f);
	RNA_def_int(ot->srna, "seed", 0, 0, 10000, "Random Seed", "Seed for the random number generator", 0, 50);
}
Beispiel #16
0
static void rna_def_strip_fcurves(BlenderRNA *brna, PropertyRNA *cprop)
{
	StructRNA *srna;

	FunctionRNA *func;
	PropertyRNA *parm;

	RNA_def_property_srna(cprop, "NlaStripFCurves");
	srna = RNA_def_struct(brna, "NlaStripFCurves", NULL);
	RNA_def_struct_sdna(srna, "NlaStrip");
	RNA_def_struct_ui_text(srna, "NLA-Strip F-Curves", "Collection of NLA strip F-Curves");

	/* Strip.fcurves.find(...) */
	func = RNA_def_function(srna, "find", "rna_NlaStrip_fcurve_find");
	RNA_def_function_ui_description(func, "Find an F-Curve. Note that this function performs a linear scan "
	                                "of all F-Curves in the NLA strip.");
	RNA_def_function_flag(func, FUNC_USE_REPORTS);
	parm = RNA_def_string(func, "data_path", NULL, 0, "Data Path", "F-Curve data path");
	RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
	RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Array index", 0, INT_MAX);

	parm = RNA_def_pointer(func, "fcurve", "FCurve", "", "The found F-Curve, or None if it doesn't exist");
	RNA_def_function_return(func, parm);
}
Beispiel #17
0
static void ANIM_OT_change_frame(wmOperatorType *ot)
{
	PropertyRNA *prop;

	/* identifiers */
	ot->name = "Change Frame";
	ot->idname = "ANIM_OT_change_frame";
	ot->description = "Interactively change the current frame number";
	
	/* api callbacks */
	ot->exec = change_frame_exec;
	ot->invoke = change_frame_invoke;
	ot->cancel = change_frame_cancel;
	ot->modal = change_frame_modal;
	ot->poll = change_frame_poll;
	
	/* flags */
	ot->flag = OPTYPE_BLOCKING | OPTYPE_UNDO | OPTYPE_GRAB_CURSOR;

	/* rna */
	ot->prop = RNA_def_int(ot->srna, "frame", 0, MINAFRAME, MAXFRAME, "Frame", "", MINAFRAME, MAXFRAME);
	prop = RNA_def_boolean(ot->srna, "snap", false, "Snap", "");
	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
Beispiel #18
0
static void rna_def_ID_materials(BlenderRNA *brna)
{
	StructRNA *srna;
	FunctionRNA *func;
	PropertyRNA *parm;
	
	/* for mesh/mball/curve materials */
	srna= RNA_def_struct(brna, "IDMaterials", NULL);
	RNA_def_struct_sdna(srna, "ID");
	RNA_def_struct_ui_text(srna, "ID Materials", "Collection of materials");

	func= RNA_def_function(srna, "append", "material_append_id");
	RNA_def_function_ui_description(func, "Add a new material to the data block");
	parm= RNA_def_pointer(func, "material", "Material", "", "Material to add");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	
	func= RNA_def_function(srna, "pop", "material_pop_id");
	RNA_def_function_ui_description(func, "Remove a material from the data block");
	parm= RNA_def_int(func, "index", 0, 0, MAXMAT, "", "Index of material to remove", 0, MAXMAT);
	RNA_def_property_flag(parm, PROP_REQUIRED);
	RNA_def_boolean(func, "update_data", 0, "", "Update data by re-adjusting the material slots assigned");
	parm= RNA_def_pointer(func, "material", "Material", "", "Material to remove");
	RNA_def_function_return(func, parm);
}
Beispiel #19
0
void RNA_api_sequence_strip(StructRNA *srna)
{
	FunctionRNA *func;
	PropertyRNA *parm;

	func = RNA_def_function(srna, "update", "rna_Sequence_update_rnafunc");
	RNA_def_function_flag(func, FUNC_USE_SELF_ID);
	RNA_def_function_ui_description(func, "Update the strip dimensions");
	parm = RNA_def_boolean(func, "data", false, "Data",
	                       "Update strip data");

	func = RNA_def_function(srna, "strip_elem_from_frame", "BKE_sequencer_give_stripelem");
	RNA_def_function_ui_description(func, "Return the strip element from a given frame or None");
	parm = RNA_def_int(func, "frame", 0, -MAXFRAME, MAXFRAME, "Frame",
	                   "The frame to get the strip element from", -MAXFRAME, MAXFRAME);
	RNA_def_property_flag(parm, PROP_REQUIRED);
	RNA_def_function_return(func, RNA_def_pointer(func, "elem", "SequenceElement", "",
	                                              "strip element of the current frame"));

	func = RNA_def_function(srna, "swap", "rna_Sequence_swap_internal");
	RNA_def_function_flag(func, FUNC_USE_REPORTS);
	parm = RNA_def_pointer(func, "other", "Sequence", "Other", "");
	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
}
void MESH_OT_primitive_ico_sphere_add(wmOperatorType *ot)
{
	PropertyRNA *prop;

	/* identifiers */
	ot->name = "Add Ico Sphere";
	ot->description = "Construct an Icosphere mesh";
	ot->idname = "MESH_OT_primitive_ico_sphere_add";

	/* api callbacks */
	ot->invoke = WM_operator_view3d_distance_invoke;
	ot->exec = add_primitive_icosphere_exec;
	ot->poll = ED_operator_scene_editable;

	/* flags */
	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;

	/* props */
	RNA_def_int(ot->srna, "subdivisions", 2, 1, INT_MAX, "Subdivisions", "", 1, 8);
	prop = RNA_def_float(ot->srna, "size", 1.0f, 0.0f, FLT_MAX, "Size", "", 0.001f, 100.00);
	RNA_def_property_subtype(prop, PROP_DISTANCE);

	ED_object_add_generic_props(ot, true);
}
void RNA_api_mesh(StructRNA *srna)
{
	FunctionRNA *func;
	PropertyRNA *parm;
	const int normals_array_dim[] = {1, 3};

	func = RNA_def_function(srna, "transform", "rna_Mesh_transform");
	RNA_def_function_ui_description(func, "Transform mesh vertices by a matrix "
	                                      "(Warning: inverts normals if matrix is negative)");
	parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
	RNA_def_property_flag(parm, PROP_REQUIRED);
	RNA_def_boolean(func, "shape_keys", 0, "", "Transform Shape Keys");

	func = RNA_def_function(srna, "flip_normals", "rna_Mesh_flip_normals");
	RNA_def_function_ui_description(func, "Invert winding of all polygons "
	                                      "(clears tessellation, does not handle custom normals)");

	func = RNA_def_function(srna, "calc_normals", "BKE_mesh_calc_normals");
	RNA_def_function_ui_description(func, "Calculate vertex normals");

	func = RNA_def_function(srna, "create_normals_split", "rna_Mesh_create_normals_split");
	RNA_def_function_ui_description(func, "Empty split vertex normals");

	func = RNA_def_function(srna, "calc_normals_split", "BKE_mesh_calc_normals_split");
	RNA_def_function_ui_description(func, "Calculate split vertex normals, which preserve sharp edges");

	func = RNA_def_function(srna, "free_normals_split", "rna_Mesh_free_normals_split");
	RNA_def_function_ui_description(func, "Free split vertex normals");

	func = RNA_def_function(srna, "calc_tangents", "rna_Mesh_calc_tangents");
	RNA_def_function_flag(func, FUNC_USE_REPORTS);
	RNA_def_function_ui_description(func,
	                                "Compute tangents and bitangent signs, to be used together with the split normals "
	                                "to get a complete tangent space for normal mapping "
	                                "(split normals are also computed if not yet present)");
	parm = RNA_def_string(func, "uvmap", NULL, MAX_CUSTOMDATA_LAYER_NAME, "",
	                      "Name of the UV map to use for tangent space computation");

	func = RNA_def_function(srna, "free_tangents", "rna_Mesh_free_tangents");
	RNA_def_function_ui_description(func, "Free tangents");

	func = RNA_def_function(srna, "calc_tessface", "rna_Mesh_calc_tessface");
	RNA_def_function_ui_description(func, "Calculate face tessellation (supports editmode too)");
	RNA_def_boolean(func, "free_mpoly", 0, "Free MPoly", "Free data used by polygons and loops. "
	                "WARNING: This destructive operation removes regular faces, "
	                "only used on temporary mesh data-blocks to reduce memory footprint of render "
	                "engines and export scripts");

	func = RNA_def_function(srna, "calc_smooth_groups", "rna_Mesh_calc_smooth_groups");
	RNA_def_function_ui_description(func, "Calculate smooth groups from sharp edges");
	RNA_def_boolean(func, "use_bitflags", false, "", "Produce bitflags groups instead of simple numeric values");
	/* return values */
	parm = RNA_def_int_array(func, "poly_groups", 1, NULL, 0, 0, "", "Smooth Groups", 0, 0);
	RNA_def_property_flag(parm, PROP_DYNAMIC | PROP_OUTPUT);
	parm = RNA_def_int(func, "groups", 0, 0, INT_MAX, "groups", "Total number of groups", 0, INT_MAX);
	RNA_def_property_flag(parm, PROP_OUTPUT);

	func = RNA_def_function(srna, "normals_split_custom_set", "rna_Mesh_normals_split_custom_set");
	RNA_def_function_ui_description(func,
	                                "Define custom split normals of this mesh "
	                                "(use zero-vectors to keep auto ones)");
	RNA_def_function_flag(func, FUNC_USE_REPORTS);
	/* TODO, see how array size of 0 works, this shouldnt be used */
	parm = RNA_def_float_array(func, "normals", 1, NULL, -1.0f, 1.0f, "", "Normals", 0.0f, 0.0f);
	RNA_def_property_multi_array(parm, 2, normals_array_dim);
	RNA_def_property_flag(parm, PROP_DYNAMIC | PROP_REQUIRED);

	func = RNA_def_function(srna, "normals_split_custom_set_from_vertices",
	                        "rna_Mesh_normals_split_custom_set_from_vertices");
	RNA_def_function_ui_description(func,
	                                "Define custom split normals of this mesh, from vertices' normals "
	                                "(use zero-vectors to keep auto ones)");
	RNA_def_function_flag(func, FUNC_USE_REPORTS);
	/* TODO, see how array size of 0 works, this shouldnt be used */
	parm = RNA_def_float_array(func, "normals", 1, NULL, -1.0f, 1.0f, "", "Normals", 0.0f, 0.0f);
	RNA_def_property_multi_array(parm, 2, normals_array_dim);
	RNA_def_property_flag(parm, PROP_DYNAMIC | PROP_REQUIRED);

	func = RNA_def_function(srna, "update", "ED_mesh_update");
	RNA_def_boolean(func, "calc_edges", 0, "Calculate Edges", "Force recalculation of edges");
	RNA_def_boolean(func, "calc_tessface", 0, "Calculate Tessellation", "Force recalculation of tessellation faces");
	RNA_def_function_flag(func, FUNC_USE_CONTEXT);

	func = RNA_def_function(srna, "unit_test_compare", "rna_Mesh_unit_test_compare");
	RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to compare to");
	/* return value */
	parm = RNA_def_string(func, "result", "nothing", 64, "Return value", "String description of result of comparison");
	RNA_def_function_return(func, parm);

	func = RNA_def_function(srna, "validate", "BKE_mesh_validate");
	RNA_def_function_ui_description(func, "Validate geometry, return True when the mesh has had "
	                                "invalid geometry corrected/removed");
	RNA_def_boolean(func, "verbose", false, "Verbose", "Output information about the errors found");
	RNA_def_boolean(func, "clean_customdata", true, "Clean Custom Data",
	                "Remove temp/cached custom-data layers, like e.g. normals...");
	parm = RNA_def_boolean(func, "result", 0, "Result", "");
	RNA_def_function_return(func, parm);

	func = RNA_def_function(srna, "validate_material_indices", "BKE_mesh_validate_material_indices");
	RNA_def_function_ui_description(func, "Validate material indices of polygons, return True when the mesh has had "
	                                "invalid indices corrected (to default 0)");
	parm = RNA_def_boolean(func, "result", 0, "Result", "");
	RNA_def_function_return(func, parm);
}
Beispiel #22
0
void RNA_api_ui_layout(StructRNA *srna)
{
    FunctionRNA *func;
    PropertyRNA *parm;

    static EnumPropertyItem curve_type_items[] = {
        {0, "NONE", 0, "None", ""},
        {'v', "VECTOR", 0, "Vector", ""},
        {'c', "COLOR", 0, "Color", ""},
        {0, NULL, 0, NULL, NULL}
    };

    static EnumPropertyItem list_type_items[] = {
        {0, "DEFAULT", 0, "None", ""},
        {'c', "COMPACT", 0, "Compact", ""},
        {'i', "ICONS", 0, "Icons", ""},
        {0, NULL, 0, NULL, NULL}
    };

    /* simple layout specifiers */
    func = RNA_def_function(srna, "row", "uiLayoutRow");
    parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
    RNA_def_function_return(func, parm);
    RNA_def_function_ui_description(func,
                                    "Sub-layout. Items placed in this sublayout are placed next to each other "
                                    "in a row");
    RNA_def_boolean(func, "align", 0, "", "Align buttons to each other");

    func = RNA_def_function(srna, "column", "uiLayoutColumn");
    parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
    RNA_def_function_return(func, parm);
    RNA_def_function_ui_description(func,
                                    "Sub-layout. Items placed in this sublayout are placed under each other "
                                    "in a column");
    RNA_def_boolean(func, "align", 0, "", "Align buttons to each other");

    func = RNA_def_function(srna, "column_flow", "uiLayoutColumnFlow");
    RNA_def_int(func, "columns", 0, 0, INT_MAX, "", "Number of columns, 0 is automatic", 0, INT_MAX);
    parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
    RNA_def_function_return(func, parm);
    RNA_def_boolean(func, "align", 0, "", "Align buttons to each other");

    /* box layout */
    func = RNA_def_function(srna, "box", "uiLayoutBox");
    parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
    RNA_def_function_return(func, parm);
    RNA_def_function_ui_description(func, "Sublayout (items placed in this sublayout are placed "
                                    "under each other in a column and are surrounded by a box)");

    /* split layout */
    func = RNA_def_function(srna, "split", "uiLayoutSplit");
    parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
    RNA_def_function_return(func, parm);
    RNA_def_float(func, "percentage", 0.0f, 0.0f, 1.0f, "Percentage", "Percentage of width to split at", 0.0f, 1.0f);
    RNA_def_boolean(func, "align", 0, "", "Align buttons to each other");

    /* items */
    func = RNA_def_function(srna, "prop", "rna_uiItemR");
    RNA_def_function_ui_description(func, "Item. Exposes an RNA item and places it into the layout");
    api_ui_item_rna_common(func);
    api_ui_item_common(func);
    RNA_def_boolean(func, "expand", 0, "", "Expand button to show more detail");
    RNA_def_boolean(func, "slider", 0, "", "Use slider widget for numeric values");
    RNA_def_boolean(func, "toggle", 0, "", "Use toggle widget for boolean values");
    RNA_def_boolean(func, "icon_only", 0, "", "Draw only icons in buttons, no text");
    RNA_def_boolean(func, "event", 0, "", "Use button to input key events");
    RNA_def_boolean(func, "full_event", 0, "", "Use button to input full events including modifiers");
    RNA_def_boolean(func, "emboss", 1, "", "Draw the button itself, just the icon/text");
    RNA_def_int(func, "index", -1, -2, INT_MAX, "",
                "The index of this button, when set a single member of an array can be accessed, "
                "when set to -1 all array members are used", -2, INT_MAX); /* RNA_NO_INDEX == -1 */

    func = RNA_def_function(srna, "props_enum", "uiItemsEnumR");
    api_ui_item_rna_common(func);

    func = RNA_def_function(srna, "prop_menu_enum", "uiItemMenuEnumR");
    api_ui_item_rna_common(func);
    api_ui_item_common(func);

    func = RNA_def_function(srna, "prop_enum", "uiItemEnumR_string");
    api_ui_item_rna_common(func);
    parm = RNA_def_string(func, "value", "", 0, "", "Enum property value");
    RNA_def_property_flag(parm, PROP_REQUIRED);
    api_ui_item_common(func);

    func = RNA_def_function(srna, "prop_search", "uiItemPointerR");
    api_ui_item_rna_common(func);
    parm = RNA_def_pointer(func, "search_data", "AnyType", "", "Data from which to take collection to search in");
    RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
    parm = RNA_def_string(func, "search_property", "", 0, "", "Identifier of search collection property");
    RNA_def_property_flag(parm, PROP_REQUIRED);
    api_ui_item_common(func);

    func = RNA_def_function(srna, "operator", "rna_uiItemO");
    api_ui_item_op_common(func);
    RNA_def_boolean(func, "emboss", 1, "", "Draw the button itself, just the icon/text");
    parm = RNA_def_pointer(func, "properties", "OperatorProperties", "",
                           "Operator properties to fill in, return when 'properties' is set to true");
    RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR);
    RNA_def_function_return(func, parm);
    RNA_def_function_ui_description(func, "Item. Places a button into the layout to call an Operator");

    /*	func= RNA_def_function(srna, "operator_enum_single", "uiItemEnumO_string");
    	api_ui_item_op_common(func);
    	parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
    	RNA_def_property_flag(parm, PROP_REQUIRED);
    	parm= RNA_def_string(func, "value", "", 0, "", "Enum property value");
    	RNA_def_property_flag(parm, PROP_REQUIRED); */

    func = RNA_def_function(srna, "operator_enum", "uiItemsEnumO");
    parm = RNA_def_string(func, "operator", "", 0, "", "Identifier of the operator");
    RNA_def_property_flag(parm, PROP_REQUIRED);
    parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
    RNA_def_property_flag(parm, PROP_REQUIRED);

    func = RNA_def_function(srna, "operator_menu_enum", "uiItemMenuEnumO");
    api_ui_item_op(func); /* cant use api_ui_item_op_common because property must come right after */
    parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
    RNA_def_property_flag(parm, PROP_REQUIRED);
    api_ui_item_common(func);

    /*	func= RNA_def_function(srna, "operator_boolean", "uiItemBooleanO");
    	api_ui_item_op_common(func);
    	parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
    	RNA_def_property_flag(parm, PROP_REQUIRED);
    	parm= RNA_def_boolean(func, "value", 0, "", "Value of the property to call the operator with");
    	RNA_def_property_flag(parm, PROP_REQUIRED); */

    /*	func= RNA_def_function(srna, "operator_int", "uiItemIntO");
    	api_ui_item_op_common(func);
    	parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
    	RNA_def_property_flag(parm, PROP_REQUIRED);
    	parm= RNA_def_int(func, "value", 0, INT_MIN, INT_MAX, "",
    	                  "Value of the property to call the operator with", INT_MIN, INT_MAX);
    	RNA_def_property_flag(parm, PROP_REQUIRED); */

    /*	func= RNA_def_function(srna, "operator_float", "uiItemFloatO");
    	api_ui_item_op_common(func);
    	parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
    	RNA_def_property_flag(parm, PROP_REQUIRED);
    	parm= RNA_def_float(func, "value", 0, -FLT_MAX, FLT_MAX, "",
    	                    "Value of the property to call the operator with", -FLT_MAX, FLT_MAX);
    	RNA_def_property_flag(parm, PROP_REQUIRED); */

    /*	func= RNA_def_function(srna, "operator_string", "uiItemStringO");
    	api_ui_item_op_common(func);
    	parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
    	RNA_def_property_flag(parm, PROP_REQUIRED);
    	parm= RNA_def_string(func, "value", "", 0, "", "Value of the property to call the operator with");
    	RNA_def_property_flag(parm, PROP_REQUIRED); */

    func = RNA_def_function(srna, "label", "uiItemL");
    RNA_def_function_ui_description(func, "Item. Display text in the layout");
    api_ui_item_common(func);

    func = RNA_def_function(srna, "menu", "uiItemM");
    RNA_def_function_flag(func, FUNC_USE_CONTEXT);
    parm = RNA_def_string(func, "menu", "", 0, "", "Identifier of the menu");
    api_ui_item_common(func);
    RNA_def_property_flag(parm, PROP_REQUIRED);

    func = RNA_def_function(srna, "separator", "uiItemS");
    RNA_def_function_ui_description(func, "Item. Inserts empty space into the layout between items");

    /* context */
    func = RNA_def_function(srna, "context_pointer_set", "uiLayoutSetContextPointer");
    parm = RNA_def_string(func, "name", "", 0, "Name", "Name of entry in the context");
    RNA_def_property_flag(parm, PROP_REQUIRED);
    parm = RNA_def_pointer(func, "data", "AnyType", "", "Pointer to put in context");
    RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR);

    /* templates */
    func = RNA_def_function(srna, "template_header", "uiTemplateHeader");
    RNA_def_function_flag(func, FUNC_USE_CONTEXT);
    RNA_def_boolean(func, "menus", 1, "", "The header has menus, and should show menu expander");

    func = RNA_def_function(srna, "template_ID", "uiTemplateID");
    RNA_def_function_flag(func, FUNC_USE_CONTEXT);
    api_ui_item_rna_common(func);
    RNA_def_string(func, "new", "", 0, "", "Operator identifier to create a new ID block");
    RNA_def_string(func, "open", "", 0, "", "Operator identifier to open a file for creating a new ID block");
    RNA_def_string(func, "unlink", "", 0, "", "Operator identifier to unlink the ID block");

    func = RNA_def_function(srna, "template_ID_preview", "uiTemplateIDPreview");
    RNA_def_function_flag(func, FUNC_USE_CONTEXT);
    api_ui_item_rna_common(func);
    RNA_def_string(func, "new", "", 0, "", "Operator identifier to create a new ID block");
    RNA_def_string(func, "open", "", 0, "", "Operator identifier to open a file for creating a new ID block");
    RNA_def_string(func, "unlink", "", 0, "", "Operator identifier to unlink the ID block");
    RNA_def_int(func, "rows", 0, 0, INT_MAX, "Number of thumbnail preview rows to display", "", 0, INT_MAX);
    RNA_def_int(func, "cols", 0, 0, INT_MAX, "Number of thumbnail preview columns to display", "", 0, INT_MAX);

    func = RNA_def_function(srna, "template_any_ID", "uiTemplateAnyID");
    parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
    RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
    parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in data");
    RNA_def_property_flag(parm, PROP_REQUIRED);
    parm = RNA_def_string(func, "type_property", "", 0, "",
                          "Identifier of property in data giving the type of the ID-blocks to use");
    RNA_def_property_flag(parm, PROP_REQUIRED);
    RNA_def_string_translate(func, "text", "", 0, "", "Custom label to display in UI");

    func = RNA_def_function(srna, "template_path_builder", "uiTemplatePathBuilder");
    parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
    RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
    parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in data");
    RNA_def_property_flag(parm, PROP_REQUIRED);
    parm = RNA_def_pointer(func, "root", "ID", "", "ID-block from which path is evaluated from");
    RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR);
    RNA_def_string_translate(func, "text", "", 0, "", "Custom label to display in UI");

    func = RNA_def_function(srna, "template_modifier", "uiTemplateModifier");
    RNA_def_function_flag(func, FUNC_USE_CONTEXT);
    RNA_def_function_ui_description(func, "Layout . Generates the UI layout for modifiers");
    parm = RNA_def_pointer(func, "data", "Modifier", "", "Modifier data");
    RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
    parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
    RNA_def_function_return(func, parm);

    func = RNA_def_function(srna, "template_constraint", "uiTemplateConstraint");
    RNA_def_function_ui_description(func, "Layout . Generates the UI layout for constraints");
    parm = RNA_def_pointer(func, "data", "Constraint", "", "Constraint data");
    RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
    parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
    RNA_def_function_return(func, parm);

    func = RNA_def_function(srna, "template_preview", "uiTemplatePreview");
    RNA_def_function_ui_description(func, "Item. A preview window for materials, textures, lamps, etc");
    parm = RNA_def_pointer(func, "id", "ID", "", "ID datablock");
    RNA_def_property_flag(parm, PROP_REQUIRED);
    RNA_def_boolean(func, "show_buttons", 1, "", "Show preview buttons?");
    RNA_def_pointer(func, "parent", "ID", "", "ID datablock");
    RNA_def_pointer(func, "slot", "TextureSlot", "", "Texture slot");

    func = RNA_def_function(srna, "template_curve_mapping", "uiTemplateCurveMapping");
    RNA_def_function_ui_description(func, "Item. A curve mapping widget used for e.g falloff curves for lamps");
    api_ui_item_rna_common(func);
    RNA_def_enum(func, "type", curve_type_items, 0, "Type", "Type of curves to display");
    RNA_def_boolean(func, "levels", 0, "", "Show black/white levels");
    RNA_def_boolean(func, "brush", 0, "", "Show brush options");

    func = RNA_def_function(srna, "template_color_ramp", "uiTemplateColorRamp");
    RNA_def_function_ui_description(func, "Item. A color ramp widget");
    api_ui_item_rna_common(func);
    RNA_def_boolean(func, "expand", 0, "", "Expand button to show more detail");

    func = RNA_def_function(srna, "template_histogram", "uiTemplateHistogram");
    RNA_def_function_ui_description(func, "Item. A histogramm widget to analyze imaga data");
    api_ui_item_rna_common(func);

    func = RNA_def_function(srna, "template_waveform", "uiTemplateWaveform");
    RNA_def_function_ui_description(func, "Item. A waveform widget to analyze imaga data");
    api_ui_item_rna_common(func);

    func = RNA_def_function(srna, "template_vectorscope", "uiTemplateVectorscope");
    RNA_def_function_ui_description(func, "Item. A vectorscope widget to analyze imaga data");
    api_ui_item_rna_common(func);

    func = RNA_def_function(srna, "template_layers", "uiTemplateLayers");
    api_ui_item_rna_common(func);
    parm = RNA_def_pointer(func, "used_layers_data", "AnyType", "", "Data from which to take property");
    RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR);
    parm = RNA_def_string(func, "used_layers_property", "", 0, "", "Identifier of property in data");
    RNA_def_property_flag(parm, PROP_REQUIRED);
    parm = RNA_def_int(func, "active_layer", 0, 0, INT_MAX, "Active Layer", "", 0, INT_MAX);
    RNA_def_property_flag(parm, PROP_REQUIRED);

    func = RNA_def_function(srna, "template_color_wheel", "uiTemplateColorWheel");
    RNA_def_function_ui_description(func, "Item. A color wheel widget to pick colors");
    api_ui_item_rna_common(func);
    RNA_def_boolean(func, "value_slider", 0, "", "Display the value slider to the right of the color wheel");
    RNA_def_boolean(func, "lock", 0, "", "Lock the color wheel display to value 1.0 regardless of actual color");
    RNA_def_boolean(func, "lock_luminosity", 0, "", "Keep the color at its original vector length");
    RNA_def_boolean(func, "cubic", 1, "", "Cubic saturation for picking values close to white");

    func = RNA_def_function(srna, "template_image_layers", "uiTemplateImageLayers");
    RNA_def_function_flag(func, FUNC_USE_CONTEXT);
    parm = RNA_def_pointer(func, "image", "Image", "", "");
    RNA_def_property_flag(parm, PROP_REQUIRED);
    parm = RNA_def_pointer(func, "image_user", "ImageUser", "", "");
    RNA_def_property_flag(parm, PROP_REQUIRED);

    func = RNA_def_function(srna, "template_image", "uiTemplateImage");
    RNA_def_function_ui_description(func, "Item(s). User interface for selecting images and their source paths");
    RNA_def_function_flag(func, FUNC_USE_CONTEXT);
    api_ui_item_rna_common(func);
    parm = RNA_def_pointer(func, "image_user", "ImageUser", "", "");
    RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
    RNA_def_boolean(func, "compact", 0, "", "Use more compact layout");

    func = RNA_def_function(srna, "template_image_settings", "uiTemplateImageSettings");
    RNA_def_function_ui_description(func, "User interface for setting image format options");
    parm = RNA_def_pointer(func, "image_settings", "ImageFormatSettings", "", "");
    RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);

    func = RNA_def_function(srna, "template_movieclip", "uiTemplateMovieClip");
    RNA_def_function_ui_description(func, "Item(s). User interface for selecting movie clips and their source paths");
    RNA_def_function_flag(func, FUNC_USE_CONTEXT);
    api_ui_item_rna_common(func);
    RNA_def_boolean(func, "compact", 0, "", "Use more compact layout");

    func = RNA_def_function(srna, "template_track", "uiTemplateTrack");
    RNA_def_function_ui_description(func, "Item. A movie-track widget to preview tracking image.");
    api_ui_item_rna_common(func);

    func = RNA_def_function(srna, "template_marker", "uiTemplateMarker");
    RNA_def_function_ui_description(func, "Item. A widget to control single marker settings.");
    api_ui_item_rna_common(func);
    parm = RNA_def_pointer(func, "clip_user", "MovieClipUser", "", "");
    RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
    parm = RNA_def_pointer(func, "track", "MovieTrackingTrack", "", "");
    RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
    RNA_def_boolean(func, "compact", 0, "", "Use more compact layout");

    func = RNA_def_function(srna, "template_list", "uiTemplateList");
    RNA_def_function_ui_description(func, "Item. A list widget to display data. e.g. vertexgroups");
    RNA_def_function_flag(func, FUNC_USE_CONTEXT);
    parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
    RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR);
    parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in data");
    RNA_def_property_flag(parm, PROP_REQUIRED);
    parm = RNA_def_pointer(func, "active_data", "AnyType", "",
                           "Data from which to take property for the active element");
    RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
    parm = RNA_def_string(func, "active_property", "", 0, "",
                          "Identifier of property in data, for the active element");
    RNA_def_property_flag(parm, PROP_REQUIRED);
    RNA_def_string(func, "prop_list", "", 0, "",
                   "Identifier of a string property in each data member, specifying which "
                   "of its properties should have a widget displayed in its row "
                   "(format: \"propname1:propname2:propname3:...\")");
    RNA_def_int(func, "rows", 5, 0, INT_MAX, "", "Number of rows to display", 0, INT_MAX);
    RNA_def_int(func, "maxrows", 5, 0, INT_MAX, "", "Maximum number of rows to display", 0, INT_MAX);
    RNA_def_enum(func, "type", list_type_items, 0, "Type", "Type of list to use");

    func = RNA_def_function(srna, "template_running_jobs", "uiTemplateRunningJobs");
    RNA_def_function_flag(func, FUNC_USE_CONTEXT);

    RNA_def_function(srna, "template_operator_search", "uiTemplateOperatorSearch");

    func = RNA_def_function(srna, "template_header_3D", "uiTemplateHeader3D");
    RNA_def_function_flag(func, FUNC_USE_CONTEXT);

    func = RNA_def_function(srna, "template_edit_mode_selection", "uiTemplateEditModeSelection");
    RNA_def_function_flag(func, FUNC_USE_CONTEXT);

    func = RNA_def_function(srna, "template_reports_banner", "uiTemplateReportsBanner");
    RNA_def_function_flag(func, FUNC_USE_CONTEXT);

    func = RNA_def_function(srna, "template_node_link", "uiTemplateNodeLink");
    parm = RNA_def_pointer(func, "ntree", "NodeTree", "", "");
    RNA_def_property_flag(parm, PROP_REQUIRED);
    parm = RNA_def_pointer(func, "node", "Node", "", "");
    RNA_def_property_flag(parm, PROP_REQUIRED);
    parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "");
    RNA_def_property_flag(parm, PROP_REQUIRED);

    func = RNA_def_function(srna, "template_node_view", "uiTemplateNodeView");
    RNA_def_function_flag(func, FUNC_USE_CONTEXT);
    parm = RNA_def_pointer(func, "ntree", "NodeTree", "", "");
    RNA_def_property_flag(parm, PROP_REQUIRED);
    parm = RNA_def_pointer(func, "node", "Node", "", "");
    RNA_def_property_flag(parm, PROP_REQUIRED);
    parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "");
    RNA_def_property_flag(parm, PROP_REQUIRED);

    func = RNA_def_function(srna, "template_texture_user", "uiTemplateTextureUser");
    RNA_def_function_flag(func, FUNC_USE_CONTEXT);

    func = RNA_def_function(srna, "template_keymap_item_properties", "uiTemplateKeymapItemProperties");
    parm = RNA_def_pointer(func, "item", "KeyMapItem", "", "");
    RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);

    func = RNA_def_function(srna, "introspect", "uiLayoutIntrospect");
    parm = RNA_def_string(func, "string", "", 1024*1024, "Descr", "DESCR");
    RNA_def_function_return(func, parm);
}
Beispiel #23
0
/* default properties for fileselect */
void WM_operator_properties_filesel(
        wmOperatorType *ot, int filter, short type, short action,
        short flag, short display, short sort)
{
	PropertyRNA *prop;

	static EnumPropertyItem file_display_items[] = {
		{FILE_DEFAULTDISPLAY, "DEFAULT", 0, "Default", "Automatically determine display type for files"},
		{FILE_SHORTDISPLAY, "LIST_SHORT", ICON_SHORTDISPLAY, "Short List", "Display files as short list"},
		{FILE_LONGDISPLAY, "LIST_LONG", ICON_LONGDISPLAY, "Long List", "Display files as a detailed list"},
		{FILE_IMGDISPLAY, "THUMBNAIL", ICON_IMGDISPLAY, "Thumbnails", "Display files as thumbnails"},
		{0, NULL, 0, NULL, NULL}
	};

	if (flag & WM_FILESEL_FILEPATH)
		RNA_def_string_file_path(ot->srna, "filepath", NULL, FILE_MAX, "File Path", "Path to file");

	if (flag & WM_FILESEL_DIRECTORY)
		RNA_def_string_dir_path(ot->srna, "directory", NULL, FILE_MAX, "Directory", "Directory of the file");

	if (flag & WM_FILESEL_FILENAME)
		RNA_def_string_file_name(ot->srna, "filename", NULL, FILE_MAX, "File Name", "Name of the file");

	if (flag & WM_FILESEL_FILES)
		RNA_def_collection_runtime(ot->srna, "files", &RNA_OperatorFileListElement, "Files", "");

	if (action == FILE_SAVE) {
		/* note, this is only used to check if we should highlight the filename area red when the
		 * filepath is an existing file. */
		prop = RNA_def_boolean(ot->srna, "check_existing", true, "Check Existing",
		                       "Check and warn on overwriting existing files");
		RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
	}

	prop = RNA_def_boolean(ot->srna, "filter_blender", (filter & FILE_TYPE_BLENDER) != 0, "Filter .blend files", "");
	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
	prop = RNA_def_boolean(ot->srna, "filter_backup", (filter & FILE_TYPE_BLENDER_BACKUP) != 0, "Filter .blend files", "");
	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
	prop = RNA_def_boolean(ot->srna, "filter_image", (filter & FILE_TYPE_IMAGE) != 0, "Filter image files", "");
	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
	prop = RNA_def_boolean(ot->srna, "filter_movie", (filter & FILE_TYPE_MOVIE) != 0, "Filter movie files", "");
	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
	prop = RNA_def_boolean(ot->srna, "filter_python", (filter & FILE_TYPE_PYSCRIPT) != 0, "Filter python files", "");
	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
	prop = RNA_def_boolean(ot->srna, "filter_font", (filter & FILE_TYPE_FTFONT) != 0, "Filter font files", "");
	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
	prop = RNA_def_boolean(ot->srna, "filter_sound", (filter & FILE_TYPE_SOUND) != 0, "Filter sound files", "");
	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
	prop = RNA_def_boolean(ot->srna, "filter_text", (filter & FILE_TYPE_TEXT) != 0, "Filter text files", "");
	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
	prop = RNA_def_boolean(ot->srna, "filter_btx", (filter & FILE_TYPE_BTX) != 0, "Filter btx files", "");
	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
	prop = RNA_def_boolean(ot->srna, "filter_collada", (filter & FILE_TYPE_COLLADA) != 0, "Filter COLLADA files", "");
	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
	prop = RNA_def_boolean(ot->srna, "filter_folder", (filter & FILE_TYPE_FOLDER) != 0, "Filter folders", "");
	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
	prop = RNA_def_boolean(ot->srna, "filter_blenlib", (filter & FILE_TYPE_BLENDERLIB) != 0, "Filter Blender IDs", "");
	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);

	prop = RNA_def_int(ot->srna, "filemode", type, FILE_LOADLIB, FILE_SPECIAL,
	                   "File Browser Mode", "The setting for the file browser mode to load a .blend file, a library or a special file",
	                   FILE_LOADLIB, FILE_SPECIAL);
	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);

	if (flag & WM_FILESEL_RELPATH)
		RNA_def_boolean(ot->srna, "relative_path", true, "Relative Path", "Select the file relative to the blend file");

	if ((filter & FILE_TYPE_IMAGE) || (filter & FILE_TYPE_MOVIE)) {
		prop = RNA_def_boolean(ot->srna, "show_multiview", 0, "Enable Multi-View", "");
		RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
		prop = RNA_def_boolean(ot->srna, "use_multiview", 0, "Use Multi-View", "");
		RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
	}

	prop = RNA_def_enum(ot->srna, "display_type", file_display_items, display, "Display Type", "");
	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);

	prop = RNA_def_enum(ot->srna, "sort_method", rna_enum_file_sort_items, sort, "File sorting mode", "");
	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);

}
Beispiel #24
0
void RNA_api_object(StructRNA *srna)
{
	FunctionRNA *func;
	PropertyRNA *parm;

	static const EnumPropertyItem mesh_type_items[] = {
		{eModifierMode_Realtime, "PREVIEW", 0, "Preview", "Apply modifier preview settings"},
		{eModifierMode_Render, "RENDER", 0, "Render", "Apply modifier render settings"},
		{0, NULL, 0, NULL, NULL}
	};

	static const EnumPropertyItem dupli_eval_mode_items[] = {
		{DAG_EVAL_VIEWPORT, "VIEWPORT", 0, "Viewport", "Generate duplis using viewport settings"},
		{DAG_EVAL_PREVIEW, "PREVIEW", 0, "Preview", "Generate duplis using preview settings"},
		{DAG_EVAL_RENDER, "RENDER", 0, "Render", "Generate duplis using render settings"},
		{0, NULL, 0, NULL, NULL}
	};

#ifndef NDEBUG
	static const EnumPropertyItem mesh_dm_info_items[] = {
		{0, "SOURCE", 0, "Source", "Source mesh"},
		{1, "DEFORM", 0, "Deform", "Objects deform mesh"},
		{2, "FINAL", 0, "Final", "Objects final mesh"},
		{0, NULL, 0, NULL, NULL}
	};
#endif

	/* Matrix space conversion */
	func = RNA_def_function(srna, "convert_space", "rna_Scene_mat_convert_space");
	RNA_def_function_ui_description(func, "Convert (transform) the given matrix from one space to another");
	RNA_def_function_flag(func, FUNC_USE_REPORTS);
	parm = RNA_def_pointer(func, "pose_bone", "PoseBone", "",
	                       "Bone to use to define spaces (may be None, in which case only the two 'WORLD' and "
	                       "'LOCAL' spaces are usable)");
	parm = RNA_def_property(func, "matrix", PROP_FLOAT, PROP_MATRIX);
	RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
	RNA_def_property_ui_text(parm, "", "The matrix to transform");
	parm = RNA_def_property(func, "matrix_return", PROP_FLOAT, PROP_MATRIX);
	RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
	RNA_def_property_ui_text(parm, "", "The transformed matrix");
	RNA_def_function_output(func, parm);
	parm = RNA_def_enum(func, "from_space", space_items, CONSTRAINT_SPACE_WORLD, "",
	                    "The space in which 'matrix' is currently");
	parm = RNA_def_enum(func, "to_space", space_items, CONSTRAINT_SPACE_WORLD, "",
	                    "The space to which you want to transform 'matrix'");

	/* Camera-related operations */
	func = RNA_def_function(srna, "calc_matrix_camera", "rna_Object_calc_matrix_camera");
	RNA_def_function_ui_description(func, "Generate the camera projection matrix of this object "
	                                      "(mostly useful for Camera and Lamp types)");
	parm = RNA_def_property(func, "result", PROP_FLOAT, PROP_MATRIX);
	RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
	RNA_def_property_ui_text(parm, "", "The camera projection matrix");
	RNA_def_function_output(func, parm);
	parm = RNA_def_int(func, "x", 1, 0, INT_MAX, "", "Width of the render area", 0, 10000);
	parm = RNA_def_int(func, "y", 1, 0, INT_MAX, "", "Height of the render area", 0, 10000);
	parm = RNA_def_float(func, "scale_x", 1.0f, 1.0e-6f, FLT_MAX, "", "Width scaling factor", 1.0e-2f, 100.0f);
	parm = RNA_def_float(func, "scale_y", 1.0f, 1.0e-6f, FLT_MAX, "", "height scaling factor", 1.0e-2f, 100.0f);

	func = RNA_def_function(srna, "camera_fit_coords", "rna_Object_camera_fit_coords");
	RNA_def_function_ui_description(func, "Compute the coordinate (and scale for ortho cameras) "
	                                      "given object should be to 'see' all given coordinates");
	parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene to get render size information from, if available");
	RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
	parm = RNA_def_float_array(func, "coordinates", 1, NULL, -FLT_MAX, FLT_MAX, "", "Coordinates to fit in",
	                           -FLT_MAX, FLT_MAX);
	RNA_def_parameter_flags(parm, PROP_NEVER_NULL | PROP_DYNAMIC, PARM_REQUIRED);
	parm = RNA_def_property(func, "co_return", PROP_FLOAT, PROP_XYZ);
	RNA_def_property_array(parm, 3);
	RNA_def_property_ui_text(parm, "", "The location to aim to be able to see all given points");
	RNA_def_parameter_flags(parm, 0, PARM_OUTPUT);
	parm = RNA_def_property(func, "scale_return", PROP_FLOAT, PROP_NONE);
	RNA_def_property_ui_text(parm, "", "The ortho scale to aim to be able to see all given points (if relevant)");
	RNA_def_parameter_flags(parm, 0, PARM_OUTPUT);

	/* mesh */
	func = RNA_def_function(srna, "to_mesh", "rna_Object_to_mesh");
	RNA_def_function_ui_description(func, "Create a Mesh data-block with modifiers applied");
	RNA_def_function_flag(func, FUNC_USE_REPORTS);
	parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene within which to evaluate modifiers");
	RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
	parm = RNA_def_boolean(func, "apply_modifiers", 0, "", "Apply modifiers");
	RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
	parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply");
	RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
	RNA_def_boolean(func, "calc_tessface", true, "Calculate Tessellation", "Calculate tessellation faces");
	RNA_def_boolean(func, "calc_undeformed", false, "Calculate Undeformed", "Calculate undeformed vertex coordinates");
	parm = RNA_def_pointer(func, "mesh", "Mesh", "",
	                       "Mesh created from object, remove it if it is only used for export");
	RNA_def_function_return(func, parm);

	/* duplis */
	func = RNA_def_function(srna, "dupli_list_create", "rna_Object_create_duplilist");
	RNA_def_function_ui_description(func, "Create a list of dupli objects for this object, needs to "
	                                "be freed manually with free_dupli_list to restore the "
	                                "objects real matrix and layers");
	parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene within which to evaluate duplis");
	RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
	RNA_def_enum(func, "settings", dupli_eval_mode_items, 0, "", "Generate texture coordinates for rendering");
	RNA_def_function_flag(func, FUNC_USE_REPORTS);

	func = RNA_def_function(srna, "dupli_list_clear", "rna_Object_free_duplilist");
	RNA_def_function_ui_description(func, "Free the list of dupli objects");

	/* Armature */
	func = RNA_def_function(srna, "find_armature", "modifiers_isDeformedByArmature");
	RNA_def_function_ui_description(func, "Find armature influencing this object as a parent or via a modifier");
	parm = RNA_def_pointer(func, "ob_arm", "Object", "", "Armature object influencing this object or NULL");
	RNA_def_function_return(func, parm);

	/* Shape key */
	func = RNA_def_function(srna, "shape_key_add", "rna_Object_shape_key_add");
	RNA_def_function_ui_description(func, "Add shape key to this object");
	RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
	RNA_def_string(func, "name", "Key", 0, "", "Unique name for the new keyblock"); /* optional */
	RNA_def_boolean(func, "from_mix", 1, "", "Create new shape from existing mix of shapes");
	parm = RNA_def_pointer(func, "key", "ShapeKey", "", "New shape keyblock");
	RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
	RNA_def_function_return(func, parm);

	func = RNA_def_function(srna, "shape_key_remove", "rna_Object_shape_key_remove");
	RNA_def_function_ui_description(func, "Remove a Shape Key from this object");
	RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
	parm = RNA_def_pointer(func, "key", "ShapeKey", "", "Keyblock to be removed");
	RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
	RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);

	/* Ray Cast */
	func = RNA_def_function(srna, "ray_cast", "rna_Object_ray_cast");
	RNA_def_function_ui_description(func, "Cast a ray onto in object space");
	RNA_def_function_flag(func, FUNC_USE_REPORTS);
	
	/* ray start and end */
	parm = RNA_def_float_vector(func, "origin", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
	RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
	parm = RNA_def_float_vector(func, "direction", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
	RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
	RNA_def_float(func, "distance", BVH_RAYCAST_DIST_MAX, 0.0, BVH_RAYCAST_DIST_MAX,
	              "", "Maximum distance", 0.0, BVH_RAYCAST_DIST_MAX);

	/* return location and normal */
	parm = RNA_def_boolean(func, "result", 0, "", "");
	RNA_def_function_output(func, parm);
	parm = RNA_def_float_vector(func, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location",
	                            "The hit location of this ray cast", -1e4, 1e4);
	RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
	RNA_def_function_output(func, parm);
	parm = RNA_def_float_vector(func, "normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal",
	                            "The face normal at the ray cast hit location", -1e4, 1e4);
	RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
	RNA_def_function_output(func, parm);
	parm = RNA_def_int(func, "index", 0, 0, 0, "", "The face index, -1 when original data isn't available", 0, 0);
	RNA_def_function_output(func, parm);

	/* Nearest Point */
	func = RNA_def_function(srna, "closest_point_on_mesh", "rna_Object_closest_point_on_mesh");
	RNA_def_function_ui_description(func, "Find the nearest point in object space");
	RNA_def_function_flag(func, FUNC_USE_REPORTS);

	/* location of point for test and max distance */
	parm = RNA_def_float_vector(func, "origin", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
	RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
	/* default is sqrt(FLT_MAX) */
	RNA_def_float(func, "distance", 1.844674352395373e+19, 0.0, FLT_MAX, "", "Maximum distance", 0.0, FLT_MAX);

	/* return location and normal */
	parm = RNA_def_boolean(func, "result", 0, "", "");
	RNA_def_function_output(func, parm);
	parm = RNA_def_float_vector(func, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location",
	                            "The location on the object closest to the point", -1e4, 1e4);
	RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
	RNA_def_function_output(func, parm);
	parm = RNA_def_float_vector(func, "normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal",
	                            "The face normal at the closest point", -1e4, 1e4);
	RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
	RNA_def_function_output(func, parm);

	parm = RNA_def_int(func, "index", 0, 0, 0, "", "The face index, -1 when original data isn't available", 0, 0);
	RNA_def_function_output(func, parm);

	/* View */
	func = RNA_def_function(srna, "is_visible", "rna_Object_is_visible");
	RNA_def_function_ui_description(func, "Determine if object is visible in a given scene");
	parm = RNA_def_pointer(func, "scene", "Scene", "", "");
	RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
	parm = RNA_def_boolean(func, "result", 0, "", "Object visibility");
	RNA_def_function_return(func, parm);

	/* utility function for checking if the object is modified */
	func = RNA_def_function(srna, "is_modified", "rna_Object_is_modified");
	RNA_def_function_ui_description(func, "Determine if this object is modified from the base mesh data");
	parm = RNA_def_pointer(func, "scene", "Scene", "", "");
	RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
	parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply");
	RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
	parm = RNA_def_boolean(func, "result", 0, "", "Object visibility");
	RNA_def_function_return(func, parm);

	func = RNA_def_function(srna, "is_deform_modified", "rna_Object_is_deform_modified");
	RNA_def_function_ui_description(func, "Determine if this object is modified by a deformation from the base mesh data");
	parm = RNA_def_pointer(func, "scene", "Scene", "", "");
	RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
	parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply");
	RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
	parm = RNA_def_boolean(func, "result", 0, "", "Object visibility");
	RNA_def_function_return(func, parm);

#ifndef NDEBUG
	/* mesh */
	func = RNA_def_function(srna, "dm_info", "rna_Object_dm_info");
	RNA_def_function_ui_description(func, "Returns a string for derived mesh data");

	parm = RNA_def_enum(func, "type", mesh_dm_info_items, 0, "", "Modifier settings to apply");
	RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
	/* weak!, no way to return dynamic string type */
	parm = RNA_def_string(func, "result", NULL, 16384, "result", "");
	RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); /* needed for string return value */
	RNA_def_function_output(func, parm);
#endif /* NDEBUG */

	func = RNA_def_function(srna, "update_from_editmode", "rna_Object_update_from_editmode");
	RNA_def_function_ui_description(func, "Load the objects edit-mode data into the object data");
	parm = RNA_def_boolean(func, "result", 0, "", "Success");
	RNA_def_function_return(func, parm);

	func = RNA_def_function(srna, "cache_release", "BKE_object_free_caches");
	RNA_def_function_ui_description(func, "Release memory used by caches associated with this object. Intended to be used by render engines only");
}
Beispiel #25
0
void WM_OT_collada_export(wmOperatorType *ot)
{
    static EnumPropertyItem prop_bc_export_mesh_type[] = {
        {BC_MESH_TYPE_VIEW, "view", 0, "View", "Apply modifier's view settings"},
        {BC_MESH_TYPE_RENDER, "render", 0, "Render", "Apply modifier's render settings"},
        {0, NULL, 0, NULL, NULL}
    };

    static EnumPropertyItem prop_bc_export_transformation_type[] = {
        {BC_TRANSFORMATION_TYPE_MATRIX, "matrix", 0, "Matrix", "Use <matrix> to specify transformations"},
        {BC_TRANSFORMATION_TYPE_TRANSROTLOC, "transrotloc", 0, "TransRotLoc", "Use <translate>, <rotate>, <scale> to specify transformations"},
        {BC_TRANSFORMATION_TYPE_BOTH, "both", 0, "Both", "Use <matrix> AND <translate>, <rotate>, <scale> to specify transformations"},
        {0, NULL, 0, NULL, NULL}
    };

    ot->name = "Export COLLADA";
    ot->description = "Export COLLADA\nSave a Collada file";
    ot->idname = "WM_OT_collada_export";

    ot->invoke = wm_collada_export_invoke;
    ot->exec = wm_collada_export_exec;
    ot->poll = WM_operator_winactive;

    ot->flag |= OPTYPE_PRESET;

    ot->ui = wm_collada_export_draw;

    WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_COLLADA, FILE_BLENDER, FILE_SAVE,
                                   WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);

    RNA_def_boolean(ot->srna,
                    "apply_modifiers", 0, "Apply Modifiers",
                    "Apply modifiers to exported mesh (non destructive))");

    RNA_def_int(ot->srna, "export_mesh_type", 0, INT_MIN, INT_MAX,
                "Resolution", "Modifier resolution for export", INT_MIN, INT_MAX);

    RNA_def_enum(ot->srna, "export_mesh_type_selection", prop_bc_export_mesh_type, 0,
                 "Resolution", "Modifier resolution for export");

    RNA_def_boolean(ot->srna, "selected", 0, "Selection Only",
                    "Export only selected elements");

    RNA_def_boolean(ot->srna, "include_children", 0, "Include Children",
                    "Export all children of selected objects (even if not selected)");

    RNA_def_boolean(ot->srna, "include_armatures", 0, "Include Armatures",
                    "Export related armatures (even if not selected)");

    RNA_def_boolean(ot->srna, "include_shapekeys", 1, "Include Shape Keys",
                    "Export all Shape Keys from Mesh Objects");

    RNA_def_boolean(ot->srna, "deform_bones_only", 0, "Deform Bones only",
                    "Only export deforming bones with armatures");


    RNA_def_boolean(ot->srna, "active_uv_only", 0, "Only Selected UV Map",
                    "Export only the selected UV Map");

    RNA_def_boolean(ot->srna, "include_uv_textures", 0, "Include UV Textures",
                    "Export textures assigned to the object UV Maps");

    RNA_def_boolean(ot->srna, "include_material_textures", 0, "Include Material Textures",
                    "Export textures assigned to the object Materials");

    RNA_def_boolean(ot->srna, "use_texture_copies", 1, "Copy",
                    "Copy textures to same folder where the .dae file is exported");


    RNA_def_boolean(ot->srna, "triangulate", 1, "Triangulate",
                    "Export Polygons (Quads & NGons) as Triangles");

    RNA_def_boolean(ot->srna, "use_object_instantiation", 1, "Use Object Instances",
                    "Instantiate multiple Objects from same Data");

    RNA_def_boolean(ot->srna, "sort_by_name", 0, "Sort by Object name",
                    "Sort exported data by Object name");

    RNA_def_int(ot->srna, "export_transformation_type", 0, INT_MIN, INT_MAX,
                "Transform", "Transformation type for translation, scale and rotation", INT_MIN, INT_MAX);

    RNA_def_enum(ot->srna, "export_transformation_type_selection", prop_bc_export_transformation_type, 0,
                 "Transform", "Transformation type for translation, scale and rotation");

    RNA_def_boolean(ot->srna, "open_sim", 0, "Export to SL/OpenSim",
                    "Compatibility mode for SL, OpenSim and other compatible online worlds");
}
Beispiel #26
0
void RNA_api_image(StructRNA *srna)
{
	FunctionRNA *func;
	PropertyRNA *parm;

	func = RNA_def_function(srna, "save_render", "rna_Image_save_render");
	RNA_def_function_ui_description(func, "Save image to a specific path using a scenes render settings");
	RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
	parm = RNA_def_string_file_path(func, "filepath", NULL, 0, "", "Save path");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	RNA_def_pointer(func, "scene", "Scene", "", "Scene to take image parameters from");

	func = RNA_def_function(srna, "save", "rna_Image_save");
	RNA_def_function_ui_description(func, "Save image to its source path");
	RNA_def_function_flag(func, FUNC_USE_REPORTS);

	func = RNA_def_function(srna, "pack", "rna_Image_pack");
	RNA_def_function_ui_description(func, "Pack an image as embedded data into the .blend file");
	RNA_def_function_flag(func, FUNC_USE_REPORTS);
	RNA_def_boolean(func, "as_png", 0, "as_png", "Pack the image as PNG (needed for generated/dirty images)");

	func = RNA_def_function(srna, "unpack", "rna_Image_unpack");
	RNA_def_function_ui_description(func, "Save an image packed in the .blend file to disk");
	RNA_def_function_flag(func, FUNC_USE_REPORTS);
	RNA_def_enum(func, "method", unpack_method_items, PF_USE_LOCAL, "method", "How to unpack");

	func = RNA_def_function(srna, "reload", "rna_Image_reload");
	RNA_def_function_ui_description(func, "Reload the image from its source path");

	func = RNA_def_function(srna, "update", "rna_Image_update");
	RNA_def_function_ui_description(func, "Update the display image from the floating point buffer");
	RNA_def_function_flag(func, FUNC_USE_REPORTS);

	func = RNA_def_function(srna, "scale", "rna_Image_scale");
	RNA_def_function_ui_description(func, "Scale the image in pixels");
	RNA_def_function_flag(func, FUNC_USE_REPORTS);
	parm = RNA_def_int(func, "width", 1, 1, 10000, "", "Width", 1, 10000);
	RNA_def_property_flag(parm, PROP_REQUIRED);
	parm = RNA_def_int(func, "height", 1, 1, 10000, "", "Height", 1, 10000);
	RNA_def_property_flag(parm, PROP_REQUIRED);

	func = RNA_def_function(srna, "gl_touch", "rna_Image_gl_touch");
	RNA_def_function_ui_description(func, "Delay the image from being cleaned from the cache due inactivity");
	RNA_def_function_flag(func, FUNC_USE_REPORTS);
	RNA_def_int(func, "frame", 0, 0, INT_MAX, "Frame",
	            "Frame of image sequence or movie", 0, INT_MAX);
	RNA_def_int(func, "filter", GL_LINEAR_MIPMAP_NEAREST, -INT_MAX, INT_MAX, "Filter",
	            "The texture minifying function to use if the image wasn't loaded", -INT_MAX, INT_MAX);
	RNA_def_int(func, "mag", GL_LINEAR, -INT_MAX, INT_MAX, "Magnification",
	            "The texture magnification function to use if the image wasn't loaded", -INT_MAX, INT_MAX);
	/* return value */
	parm = RNA_def_int(func, "error", 0, -INT_MAX, INT_MAX, "Error", "OpenGL error value", -INT_MAX, INT_MAX);
	RNA_def_function_return(func, parm);

	func = RNA_def_function(srna, "gl_load", "rna_Image_gl_load");
	RNA_def_function_ui_description(func, "Load the image into OpenGL graphics memory");
	RNA_def_function_flag(func, FUNC_USE_REPORTS);
	RNA_def_int(func, "frame", 0, 0, INT_MAX, "Frame",
	            "Frame of image sequence or movie", 0, INT_MAX);
	RNA_def_int(func, "filter", GL_LINEAR_MIPMAP_NEAREST, -INT_MAX, INT_MAX, "Filter",
	            "The texture minifying function", -INT_MAX, INT_MAX);
	RNA_def_int(func, "mag", GL_LINEAR, -INT_MAX, INT_MAX, "Magnification",
	            "The texture magnification function", -INT_MAX, INT_MAX);

	/* return value */
	parm = RNA_def_int(func, "error", 0, -INT_MAX, INT_MAX, "Error", "OpenGL error value", -INT_MAX, INT_MAX);
	RNA_def_function_return(func, parm);

	func = RNA_def_function(srna, "gl_free", "rna_Image_gl_free");
	RNA_def_function_ui_description(func, "Free the image from OpenGL graphics memory");

	/* path to an frame specified by image user */
	func = RNA_def_function(srna, "filepath_from_user", "rna_Image_filepath_from_user");
	RNA_def_function_ui_description(func, "Return the absolute path to the filepath of an image frame specified by the image user");
	RNA_def_pointer(func, "image_user", "ImageUser", "", "Image user of the image to get filepath for");
	parm = RNA_def_string_file_path(func, "filepath", NULL, FILE_MAX, "File Path",
	                                "The resulting filepath from the image and it's user");
	RNA_def_property_flag(parm, PROP_THICK_WRAP);  /* needed for string return value */
	RNA_def_function_output(func, parm);

	/* TODO, pack/unpack, maybe should be generic functions? */
}
Beispiel #27
0
static void rna_def_render_engine(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;
	FunctionRNA *func;
	
	srna= RNA_def_struct(brna, "RenderEngine", NULL);
	RNA_def_struct_sdna(srna, "RenderEngine");
	RNA_def_struct_ui_text(srna, "Render Engine", "Render engine");
	RNA_def_struct_refine_func(srna, "rna_RenderEngine_refine");
	RNA_def_struct_register_funcs(srna, "rna_RenderEngine_register", "rna_RenderEngine_unregister", "rna_RenderEngine_instance");

	/* final render callbacks */
	func= RNA_def_function(srna, "update", NULL);
	RNA_def_function_ui_description(func, "Export scene data for render");
	RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
	RNA_def_pointer(func, "data", "BlendData", "", "");
	RNA_def_pointer(func, "scene", "Scene", "", "");

	func= RNA_def_function(srna, "render", NULL);
	RNA_def_function_ui_description(func, "Render scene into an image");
	RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
	RNA_def_pointer(func, "scene", "Scene", "", "");

	/* viewport render callbacks */
	func= RNA_def_function(srna, "view_update", NULL);
	RNA_def_function_ui_description(func, "Update on data changes for viewport render");
	RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
	RNA_def_pointer(func, "context", "Context", "", "");

	func= RNA_def_function(srna, "view_draw", NULL);
	RNA_def_function_ui_description(func, "Draw viewport render");
	RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
	RNA_def_pointer(func, "context", "Context", "", "");

	/* tag for redraw */
	RNA_def_function(srna, "tag_redraw", "engine_tag_redraw");
	RNA_def_function_ui_description(func, "Request redraw for viewport rendering");

	/* tag for update */
	RNA_def_function(srna, "tag_update", "engine_tag_update");
	RNA_def_function_ui_description(func, "Request update call for viewport rendering");

	func= RNA_def_function(srna, "begin_result", "RE_engine_begin_result");
	prop= RNA_def_int(func, "x", 0, 0, INT_MAX, "X", "", 0, INT_MAX);
	RNA_def_property_flag(prop, PROP_REQUIRED);
	prop= RNA_def_int(func, "y", 0, 0, INT_MAX, "Y", "", 0, INT_MAX);
	RNA_def_property_flag(prop, PROP_REQUIRED);
	prop= RNA_def_int(func, "w", 0, 0, INT_MAX, "Width", "", 0, INT_MAX);
	RNA_def_property_flag(prop, PROP_REQUIRED);
	prop= RNA_def_int(func, "h", 0, 0, INT_MAX, "Height", "", 0, INT_MAX);
	RNA_def_property_flag(prop, PROP_REQUIRED);
	prop= RNA_def_pointer(func, "result", "RenderResult", "Result", "");
	RNA_def_function_return(func, prop);

	func= RNA_def_function(srna, "update_result", "RE_engine_update_result");
	prop= RNA_def_pointer(func, "result", "RenderResult", "Result", "");
	RNA_def_property_flag(prop, PROP_REQUIRED);

	func= RNA_def_function(srna, "end_result", "RE_engine_end_result");
	prop= RNA_def_pointer(func, "result", "RenderResult", "Result", "");
	RNA_def_property_flag(prop, PROP_REQUIRED);

	func= RNA_def_function(srna, "test_break", "RE_engine_test_break");
	prop= RNA_def_boolean(func, "do_break", 0, "Break", "");
	RNA_def_function_return(func, prop);

	func= RNA_def_function(srna, "update_stats", "RE_engine_update_stats");
	prop= RNA_def_string(func, "stats", "", 0, "Stats", "");
	RNA_def_property_flag(prop, PROP_REQUIRED);
	prop= RNA_def_string(func, "info", "", 0, "Info", "");
	RNA_def_property_flag(prop, PROP_REQUIRED);

	func= RNA_def_function(srna, "update_progress", "RE_engine_update_progress");
	prop= RNA_def_float(func, "progress", 0, 0.0f, 1.0f, "", "Percentage of render that's done", 0.0f, 1.0f);
	RNA_def_property_flag(prop, PROP_REQUIRED);

	func= RNA_def_function(srna, "report", "RE_engine_report");
	prop= RNA_def_enum_flag(func, "type", wm_report_items, 0, "Type", "");
	RNA_def_property_flag(prop, PROP_REQUIRED);
	prop= RNA_def_string(func, "message", "", 0, "Report Message", "");
	RNA_def_property_flag(prop, PROP_REQUIRED);

	RNA_define_verify_sdna(0);

	prop= RNA_def_property(srna, "is_animation", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", RE_ENGINE_ANIMATION);

	prop= RNA_def_property(srna, "is_preview", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", RE_ENGINE_PREVIEW);

	/* registration */

	prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
	RNA_def_property_string_sdna(prop, NULL, "type->idname");
	RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP);

	prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_TRANSLATE);
	RNA_def_property_string_sdna(prop, NULL, "type->name");
	RNA_def_property_flag(prop, PROP_REGISTER);

	prop= RNA_def_property(srna, "bl_use_preview", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_PREVIEW);
	RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);

	prop= RNA_def_property(srna, "bl_use_postprocess", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_negative_sdna(prop, NULL, "type->flag", RE_USE_POSTPROCESS);
	RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);

	prop= RNA_def_property(srna, "bl_use_shading_nodes", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_SHADING_NODES);
	RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);

	RNA_define_verify_sdna(1);
}
Beispiel #28
0
static void rna_def_uilist(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;
	PropertyRNA *parm;
	FunctionRNA *func;

	srna = RNA_def_struct(brna, "UIList", NULL);
	RNA_def_struct_ui_text(srna, "UIList", "UI list containing the elements of a collection");
	RNA_def_struct_sdna(srna, "uiList");
	RNA_def_struct_refine_func(srna, "rna_UIList_refine");
	RNA_def_struct_register_funcs(srna, "rna_UIList_register", "rna_UIList_unregister", NULL);
	RNA_def_struct_idprops_func(srna, "rna_UIList_idprops");
	RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES | STRUCT_PUBLIC_NAMESPACE_INHERIT);

	/* Registration */
	prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
	RNA_def_property_string_sdna(prop, NULL, "type->idname");
	RNA_def_property_flag(prop, PROP_REGISTER);
	RNA_def_property_ui_text(prop, "ID Name",
	                         "If this is set, the uilist gets a custom ID, otherwise it takes the "
	                         "name of the class used to define the uilist (for example, if the "
	                         "class name is \"OBJECT_UL_vgroups\", and bl_idname is not set by the "
	                         "script, then bl_idname = \"OBJECT_UL_vgroups\")");

	/* Data */
	prop = RNA_def_property(srna, "layout_type", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_items(prop, rna_enum_uilist_layout_type_items);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);

	/* Filter options */
	prop = RNA_def_property(srna, "use_filter_show", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "filter_flag", UILST_FLT_SHOW);
	RNA_def_property_ui_text(prop, "Show Filter", "Show filtering options");

	prop = RNA_def_property(srna, "filter_name", PROP_STRING, PROP_NONE);
	RNA_def_property_string_sdna(prop, NULL, "filter_byname");
	RNA_def_property_flag(prop, PROP_TEXTEDIT_UPDATE);
	RNA_def_property_ui_text(prop, "Filter by Name", "Only show items matching this name (use '*' as wildcard)");

	prop = RNA_def_property(srna, "use_filter_invert", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "filter_flag", UILST_FLT_EXCLUDE);
	RNA_def_property_ui_text(prop, "Invert", "Invert filtering (show hidden items, and vice-versa)");

	prop = RNA_def_property(srna, "use_filter_sort_alpha", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "filter_sort_flag", UILST_FLT_SORT_ALPHA);
	RNA_def_property_ui_icon(prop, ICON_SORTALPHA, 0);
	RNA_def_property_ui_text(prop, "Sort by Name", "Sort items by their name");

	prop = RNA_def_property(srna, "use_filter_sort_reverse", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "filter_sort_flag", UILST_FLT_SORT_REVERSE);
	RNA_def_property_ui_text(prop, "Invert", "Invert the order of shown items");

	/* draw_item */
	func = RNA_def_function(srna, "draw_item", NULL);
	RNA_def_function_ui_description(func, "Draw an item in the list (NOTE: when you define your own draw_item "
	                                      "function, you may want to check given 'item' is of the right type...)");
	RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
	parm = RNA_def_pointer(func, "context", "Context", "", "");
	RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
	parm = RNA_def_pointer(func, "layout", "UILayout", "", "Layout to draw the item");
	RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
	parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take Collection property");
	RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
	parm = RNA_def_pointer(func, "item", "AnyType", "", "Item of the collection property");
	RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
	parm = RNA_def_int(func, "icon", 0, 0, INT_MAX, "", "Icon of the item in the collection", 0, INT_MAX);
	RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
	parm = RNA_def_pointer(func, "active_data", "AnyType", "",
	                       "Data from which to take property for the active element");
	RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
	parm = RNA_def_string(func, "active_property", NULL, 0, "",
	                      "Identifier of property in active_data, for the active element");
	RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
	RNA_def_int(func, "index", 0, 0, INT_MAX, "", "Index of the item in the collection", 0, INT_MAX);
	RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_PYFUNC_OPTIONAL);
	prop = RNA_def_property(func, "flt_flag", PROP_INT, PROP_UNSIGNED);
	RNA_def_property_ui_text(prop, "", "The filter-flag result for this item");
	RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_PYFUNC_OPTIONAL);

	/* draw_filter */
	func = RNA_def_function(srna, "draw_filter", NULL);
	RNA_def_function_ui_description(func, "Draw filtering options");
	RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
	parm = RNA_def_pointer(func, "context", "Context", "", "");
	RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
	parm = RNA_def_pointer(func, "layout", "UILayout", "", "Layout to draw the item");
	RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);

	/* filter */
	func = RNA_def_function(srna, "filter_items", NULL);
	RNA_def_function_ui_description(func, "Filter and/or re-order items of the collection (output filter results in "
	                                      "filter_flags, and reorder results in filter_neworder arrays)");
	RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
	parm = RNA_def_pointer(func, "context", "Context", "", "");
	RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
	parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take Collection property");
	RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
	parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data, for the collection");
	RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
	prop = RNA_def_property(func, "filter_flags", PROP_INT, PROP_UNSIGNED);
	RNA_def_property_flag(prop, PARM_REQUIRED | PROP_DYNAMIC);
	RNA_def_property_array(prop, 1);  /* XXX Dummy value, default 0 does not work */
	RNA_def_property_ui_text(prop, "", "An array of filter flags, one for each item in the collection (NOTE: "
	                                   "FILTER_ITEM bit is reserved, it defines whether the item is shown or not)");
	RNA_def_function_output(func, prop);
	prop = RNA_def_property(func, "filter_neworder", PROP_INT, PROP_UNSIGNED);
	RNA_def_property_flag(prop, PARM_REQUIRED | PROP_DYNAMIC);
	RNA_def_property_array(prop, 1);  /* XXX Dummy value, default 0 does not work */
	RNA_def_property_ui_text(prop, "", "An array of indices, one for each item in the collection, mapping the org "
	                                   "index to the new one");
	RNA_def_function_output(func, prop);

	/* "Constants"! */
	RNA_define_verify_sdna(0); /* not in sdna */

	prop = RNA_def_property(srna, "bitflag_filter_item", PROP_INT, PROP_UNSIGNED);
	RNA_def_property_ui_text(prop, "FILTER_ITEM",
	                               "The value of the reserved bitflag 'FILTER_ITEM' (in filter_flags values)");
	RNA_def_property_int_funcs(prop, "rna_UIList_filter_const_FILTER_ITEM_get", NULL, NULL);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
}
void RNA_api_ui_layout(StructRNA *srna)
{
	FunctionRNA *func;
	PropertyRNA *parm;

	static EnumPropertyItem curve_type_items[] = {
		{0, "NONE", 0, "None", ""},
		{'v', "VECTOR", 0, "Vector", ""},
		{'c', "COLOR", 0, "Color", ""},
		{'h', "HUE", 0, "Hue", ""},
		{0, NULL, 0, NULL, NULL}
	};

	static float node_socket_color_default[] = { 0.0f, 0.0f, 0.0f, 1.0f };

	/* simple layout specifiers */
	func = RNA_def_function(srna, "row", "uiLayoutRow");
	parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
	RNA_def_function_return(func, parm);
	RNA_def_function_ui_description(func,
	                                "Sub-layout. Items placed in this sublayout are placed next to each other "
	                                "in a row");
	RNA_def_boolean(func, "align", false, "", "Align buttons to each other");
	
	func = RNA_def_function(srna, "column", "uiLayoutColumn");
	parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
	RNA_def_function_return(func, parm);
	RNA_def_function_ui_description(func,
	                                "Sub-layout. Items placed in this sublayout are placed under each other "
	                                "in a column");
	RNA_def_boolean(func, "align", false, "", "Align buttons to each other");

	func = RNA_def_function(srna, "column_flow", "uiLayoutColumnFlow");
	RNA_def_int(func, "columns", 0, 0, INT_MAX, "", "Number of columns, 0 is automatic", 0, INT_MAX);
	parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
	RNA_def_function_return(func, parm);
	RNA_def_boolean(func, "align", false, "", "Align buttons to each other");

	/* box layout */
	func = RNA_def_function(srna, "box", "uiLayoutBox");
	parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
	RNA_def_function_return(func, parm);
	RNA_def_function_ui_description(func, "Sublayout (items placed in this sublayout are placed "
	                                "under each other in a column and are surrounded by a box)");
	
	/* split layout */
	func = RNA_def_function(srna, "split", "uiLayoutSplit");
	parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
	RNA_def_function_return(func, parm);
	RNA_def_float(func, "percentage", 0.0f, 0.0f, 1.0f, "Percentage", "Percentage of width to split at", 0.0f, 1.0f);
	RNA_def_boolean(func, "align", false, "", "Align buttons to each other");

	/* radial/pie layout */
	func = RNA_def_function(srna, "menu_pie", "uiLayoutRadial");
	parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
	RNA_def_function_return(func, parm);
	RNA_def_function_ui_description(func, "Sublayout. Items placed in this sublayout are placed "
	                                "in a radial fashion around the menu center)");

	/* Icon of a rna pointer */
	func = RNA_def_function(srna, "icon", "rna_ui_get_rnaptr_icon");
	parm = RNA_def_int(func, "icon_value", ICON_NONE, 0, INT_MAX, "", "Icon identifier", 0, INT_MAX);
	RNA_def_function_return(func, parm);
	RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
	parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take the icon");
	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
	RNA_def_function_ui_description(func, "Return the custom icon for this data, "
	                                      "use it e.g. to get materials or texture icons");

	/* UI name, description and icon of an enum item */
	func = RNA_def_function(srna, "enum_item_name", "rna_ui_get_enum_name");
	parm = RNA_def_string(func, "name", NULL, 0, "", "UI name of the enum item");
	RNA_def_function_return(func, parm);
	RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
	api_ui_item_rna_common(func);
	parm = RNA_def_string(func, "identifier", NULL, 0, "", "Identifier of the enum item");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	RNA_def_function_ui_description(func, "Return the UI name for this enum item");

	func = RNA_def_function(srna, "enum_item_description", "rna_ui_get_enum_description");
	parm = RNA_def_string(func, "description", NULL, 0, "", "UI description of the enum item");
	RNA_def_function_return(func, parm);
	RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
	api_ui_item_rna_common(func);
	parm = RNA_def_string(func, "identifier", NULL, 0, "", "Identifier of the enum item");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	RNA_def_function_ui_description(func, "Return the UI description for this enum item");

	func = RNA_def_function(srna, "enum_item_icon", "rna_ui_get_enum_icon");
	parm = RNA_def_int(func, "icon_value", ICON_NONE, 0, INT_MAX, "", "Icon identifier", 0, INT_MAX);
	RNA_def_function_return(func, parm);
	RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
	api_ui_item_rna_common(func);
	parm = RNA_def_string(func, "identifier", NULL, 0, "", "Identifier of the enum item");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	RNA_def_function_ui_description(func, "Return the icon for this enum item");

	/* items */
	func = RNA_def_function(srna, "prop", "rna_uiItemR");
	RNA_def_function_ui_description(func, "Item. Exposes an RNA item and places it into the layout");
	api_ui_item_rna_common(func);
	api_ui_item_common(func);
	RNA_def_boolean(func, "expand", false, "", "Expand button to show more detail");
	RNA_def_boolean(func, "slider", false, "", "Use slider widget for numeric values");
	RNA_def_boolean(func, "toggle", false, "", "Use toggle widget for boolean values");
	RNA_def_boolean(func, "icon_only", false, "", "Draw only icons in buttons, no text");
	RNA_def_boolean(func, "event", false, "", "Use button to input key events");
	RNA_def_boolean(func, "full_event", false, "", "Use button to input full events including modifiers");
	RNA_def_boolean(func, "emboss", true, "", "Draw the button itself, just the icon/text");
	RNA_def_int(func, "index", -1, -2, INT_MAX, "",
	            "The index of this button, when set a single member of an array can be accessed, "
	            "when set to -1 all array members are used", -2, INT_MAX); /* RNA_NO_INDEX == -1 */
	parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
	RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");

	func = RNA_def_function(srna, "props_enum", "uiItemsEnumR");
	api_ui_item_rna_common(func);

	func = RNA_def_function(srna, "prop_menu_enum", "rna_uiItemMenuEnumR");
	api_ui_item_rna_common(func);
	api_ui_item_common(func);

	func = RNA_def_function(srna, "prop_enum", "rna_uiItemEnumR_string");
	api_ui_item_rna_common(func);
	parm = RNA_def_string(func, "value", NULL, 0, "", "Enum property value");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	api_ui_item_common(func);

	func = RNA_def_function(srna, "prop_search", "rna_uiItemPointerR");
	api_ui_item_rna_common(func);
	parm = RNA_def_pointer(func, "search_data", "AnyType", "", "Data from which to take collection to search in");
	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
	parm = RNA_def_string(func, "search_property", NULL, 0, "", "Identifier of search collection property");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	api_ui_item_common(func);

	func = RNA_def_function(srna, "operator", "rna_uiItemO");
	api_ui_item_op_common(func);
	RNA_def_boolean(func, "emboss", true, "", "Draw the button itself, just the icon/text");
	parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
	RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
	parm = RNA_def_pointer(func, "properties", "OperatorProperties", "",
	                       "Operator properties to fill in, return when 'properties' is set to true");
	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR);
	RNA_def_function_return(func, parm);
	RNA_def_function_ui_description(func, "Item. Places a button into the layout to call an Operator");

	func = RNA_def_function(srna, "operator_enum", "uiItemsEnumO");
	parm = RNA_def_string(func, "operator", NULL, 0, "", "Identifier of the operator");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
	RNA_def_property_flag(parm, PROP_REQUIRED);

	func = RNA_def_function(srna, "operator_menu_enum", "rna_uiItemMenuEnumO");
	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
	api_ui_item_op(func); /* cant use api_ui_item_op_common because property must come right after */
	parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	api_ui_item_common(func);

	/* useful in C but not in python */
#if 0

	func = RNA_def_function(srna, "operator_enum_single", "uiItemEnumO_string");
	api_ui_item_op_common(func);
	parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	parm = RNA_def_string(func, "value", NULL, 0, "", "Enum property value");
	RNA_def_property_flag(parm, PROP_REQUIRED);

	func = RNA_def_function(srna, "operator_boolean", "uiItemBooleanO");
	api_ui_item_op_common(func);
	parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	parm = RNA_def_boolean(func, "value", false, "", "Value of the property to call the operator with");
	RNA_def_property_flag(parm, PROP_REQUIRED); */

	func = RNA_def_function(srna, "operator_int", "uiItemIntO");
	api_ui_item_op_common(func);
	parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	parm = RNA_def_int(func, "value", 0, INT_MIN, INT_MAX, "",
	                  "Value of the property to call the operator with", INT_MIN, INT_MAX);
	RNA_def_property_flag(parm, PROP_REQUIRED); */

	func = RNA_def_function(srna, "operator_float", "uiItemFloatO");
	api_ui_item_op_common(func);
	parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	parm = RNA_def_float(func, "value", 0, -FLT_MAX, FLT_MAX, "",
	                    "Value of the property to call the operator with", -FLT_MAX, FLT_MAX);
	RNA_def_property_flag(parm, PROP_REQUIRED); */

	func = RNA_def_function(srna, "operator_string", "uiItemStringO");
	api_ui_item_op_common(func);
	parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	parm = RNA_def_string(func, "value", NULL, 0, "", "Value of the property to call the operator with");
	RNA_def_property_flag(parm, PROP_REQUIRED);
#endif

	func = RNA_def_function(srna, "label", "rna_uiItemL");
	RNA_def_function_ui_description(func, "Item. Display text and/or icon in the layout");
	api_ui_item_common(func);
	parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
	RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");

	func = RNA_def_function(srna, "menu", "rna_uiItemM");
	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
	parm = RNA_def_string(func, "menu", NULL, 0, "", "Identifier of the menu");
	api_ui_item_common(func);
	RNA_def_property_flag(parm, PROP_REQUIRED);
	parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
	RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");

	func = RNA_def_function(srna, "separator", "uiItemS");
	RNA_def_function_ui_description(func, "Item. Inserts empty space into the layout between items");

	/* context */
	func = RNA_def_function(srna, "context_pointer_set", "uiLayoutSetContextPointer");
	parm = RNA_def_string(func, "name", NULL, 0, "Name", "Name of entry in the context");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	parm = RNA_def_pointer(func, "data", "AnyType", "", "Pointer to put in context");
	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR);
	
	/* templates */
	func = RNA_def_function(srna, "template_header", "uiTemplateHeader");
	RNA_def_function_flag(func, FUNC_USE_CONTEXT);

	func = RNA_def_function(srna, "template_ID", "uiTemplateID");
	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
	api_ui_item_rna_common(func);
	RNA_def_string(func, "new", NULL, 0, "", "Operator identifier to create a new ID block");
	RNA_def_string(func, "open", NULL, 0, "", "Operator identifier to open a file for creating a new ID block");
	RNA_def_string(func, "unlink", NULL, 0, "", "Operator identifier to unlink the ID block");
	
	func = RNA_def_function(srna, "template_ID_preview", "uiTemplateIDPreview");
	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
	api_ui_item_rna_common(func);
	RNA_def_string(func, "new", NULL, 0, "", "Operator identifier to create a new ID block");
	RNA_def_string(func, "open", NULL, 0, "", "Operator identifier to open a file for creating a new ID block");
	RNA_def_string(func, "unlink", NULL, 0, "", "Operator identifier to unlink the ID block");
	RNA_def_int(func, "rows", 0, 0, INT_MAX, "Number of thumbnail preview rows to display", "", 0, INT_MAX);
	RNA_def_int(func, "cols", 0, 0, INT_MAX, "Number of thumbnail preview columns to display", "", 0, INT_MAX);
	
	func = RNA_def_function(srna, "template_any_ID", "rna_uiTemplateAnyID");
	parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
	parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	parm = RNA_def_string(func, "type_property", NULL, 0, "",
	                      "Identifier of property in data giving the type of the ID-blocks to use");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	api_ui_item_common_text(func);
	
	func = RNA_def_function(srna, "template_path_builder", "rna_uiTemplatePathBuilder");
	parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
	parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	parm = RNA_def_pointer(func, "root", "ID", "", "ID-block from which path is evaluated from");
	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR);
	api_ui_item_common_text(func);
	
	func = RNA_def_function(srna, "template_modifier", "uiTemplateModifier");
	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
	RNA_def_function_ui_description(func, "Generates the UI layout for modifiers");
	parm = RNA_def_pointer(func, "data", "Modifier", "", "Modifier data");
	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
	parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
	RNA_def_function_return(func, parm);

	func = RNA_def_function(srna, "template_constraint", "uiTemplateConstraint");
	RNA_def_function_ui_description(func, "Generates the UI layout for constraints");
	parm = RNA_def_pointer(func, "data", "Constraint", "", "Constraint data");
	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
	parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
	RNA_def_function_return(func, parm);

	func = RNA_def_function(srna, "template_preview", "uiTemplatePreview");
	RNA_def_function_ui_description(func, "Item. A preview window for materials, textures, lamps or worlds");
	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
	parm = RNA_def_pointer(func, "id", "ID", "", "ID data-block");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	RNA_def_boolean(func, "show_buttons", true, "", "Show preview buttons?");
	RNA_def_pointer(func, "parent", "ID", "", "ID data-block");
	RNA_def_pointer(func, "slot", "TextureSlot", "", "Texture slot");
	RNA_def_string(func, "preview_id", NULL, 0, "",
	               "Identifier of this preview widget, if not set the ID type will be used "
	               "(i.e. all previews of materials without explicit ID will have the same size...)");

	func = RNA_def_function(srna, "template_curve_mapping", "uiTemplateCurveMapping");
	RNA_def_function_ui_description(func, "Item. A curve mapping widget used for e.g falloff curves for lamps");
	api_ui_item_rna_common(func);
	RNA_def_enum(func, "type", curve_type_items, 0, "Type", "Type of curves to display");
	RNA_def_boolean(func, "levels", false, "", "Show black/white levels");
	RNA_def_boolean(func, "brush", false, "", "Show brush options");
	RNA_def_boolean(func, "use_negative_slope", false, "", "Use a negative slope by default");

	func = RNA_def_function(srna, "template_color_ramp", "uiTemplateColorRamp");
	RNA_def_function_ui_description(func, "Item. A color ramp widget");
	api_ui_item_rna_common(func);
	RNA_def_boolean(func, "expand", false, "", "Expand button to show more detail");

	func = RNA_def_function(srna, "template_icon_view", "uiTemplateIconView");
	RNA_def_function_ui_description(func, "Enum. Large widget showing Icon previews");
	api_ui_item_rna_common(func);
	RNA_def_boolean(func, "show_labels", false, "", "Show enum label in preview buttons");
	RNA_def_float(func, "scale", 5.0f, 1.0f, 100.0f, "Scale", "Scale the icon size (by the button size)", 1.0f, 100.0f);

	func = RNA_def_function(srna, "template_histogram", "uiTemplateHistogram");
	RNA_def_function_ui_description(func, "Item. A histogramm widget to analyze imaga data");
	api_ui_item_rna_common(func);
	
	func = RNA_def_function(srna, "template_waveform", "uiTemplateWaveform");
	RNA_def_function_ui_description(func, "Item. A waveform widget to analyze imaga data");
	api_ui_item_rna_common(func);
	
	func = RNA_def_function(srna, "template_vectorscope", "uiTemplateVectorscope");
	RNA_def_function_ui_description(func, "Item. A vectorscope widget to analyze imaga data");
	api_ui_item_rna_common(func);
	
	func = RNA_def_function(srna, "template_layers", "uiTemplateLayers");
	api_ui_item_rna_common(func);
	parm = RNA_def_pointer(func, "used_layers_data", "AnyType", "", "Data from which to take property");
	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR);
	parm = RNA_def_string(func, "used_layers_property", NULL, 0, "", "Identifier of property in data");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	parm = RNA_def_int(func, "active_layer", 0, 0, INT_MAX, "Active Layer", "", 0, INT_MAX);
	RNA_def_property_flag(parm, PROP_REQUIRED);
	
	func = RNA_def_function(srna, "template_color_picker", "uiTemplateColorPicker");
	RNA_def_function_ui_description(func, "Item. A color wheel widget to pick colors");
	api_ui_item_rna_common(func);
	RNA_def_boolean(func, "value_slider", false, "", "Display the value slider to the right of the color wheel");
	RNA_def_boolean(func, "lock", false, "", "Lock the color wheel display to value 1.0 regardless of actual color");
	RNA_def_boolean(func, "lock_luminosity", false, "", "Keep the color at its original vector length");
	RNA_def_boolean(func, "cubic", false, "", "Cubic saturation for picking values close to white");

	func = RNA_def_function(srna, "template_palette", "uiTemplatePalette");
	RNA_def_function_ui_description(func, "Item. A palette used to pick colors");
	api_ui_item_rna_common(func);
	RNA_def_boolean(func, "color", 0, "", "Display the colors as colors or values");

	func = RNA_def_function(srna, "template_image_layers", "uiTemplateImageLayers");
	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
	parm = RNA_def_pointer(func, "image", "Image", "", "");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	parm = RNA_def_pointer(func, "image_user", "ImageUser", "", "");
	RNA_def_property_flag(parm, PROP_REQUIRED);

	func = RNA_def_function(srna, "template_image", "uiTemplateImage");
	RNA_def_function_ui_description(func, "Item(s). User interface for selecting images and their source paths");
	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
	api_ui_item_rna_common(func);
	parm = RNA_def_pointer(func, "image_user", "ImageUser", "", "");
	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
	RNA_def_boolean(func, "compact", false, "", "Use more compact layout");
	RNA_def_boolean(func, "multiview", false, "", "Expose Multi-View options");

	func = RNA_def_function(srna, "template_image_settings", "uiTemplateImageSettings");
	RNA_def_function_ui_description(func, "User interface for setting image format options");
	parm = RNA_def_pointer(func, "image_settings", "ImageFormatSettings", "", "");
	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
	RNA_def_boolean(func, "color_management", false, "", "Show color management settings");

	func = RNA_def_function(srna, "template_image_stereo_3d", "uiTemplateImageStereo3d");
	RNA_def_function_ui_description(func, "User interface for setting image stereo 3d options");
	parm = RNA_def_pointer(func, "stereo_3d_format", "Stereo3dFormat", "", "");
	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);

	func = RNA_def_function(srna, "template_image_views", "uiTemplateImageViews");
	RNA_def_function_ui_description(func, "User interface for setting image views output options");
	parm = RNA_def_pointer(func, "image_settings", "ImageFormatSettings", "", "");
	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);

	func = RNA_def_function(srna, "template_movieclip", "uiTemplateMovieClip");
	RNA_def_function_ui_description(func, "Item(s). User interface for selecting movie clips and their source paths");
	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
	api_ui_item_rna_common(func);
	RNA_def_boolean(func, "compact", false, "", "Use more compact layout");

	func = RNA_def_function(srna, "template_track", "uiTemplateTrack");
	RNA_def_function_ui_description(func, "Item. A movie-track widget to preview tracking image.");
	api_ui_item_rna_common(func);

	func = RNA_def_function(srna, "template_marker", "uiTemplateMarker");
	RNA_def_function_ui_description(func, "Item. A widget to control single marker settings.");
	api_ui_item_rna_common(func);
	parm = RNA_def_pointer(func, "clip_user", "MovieClipUser", "", "");
	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
	parm = RNA_def_pointer(func, "track", "MovieTrackingTrack", "", "");
	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
	RNA_def_boolean(func, "compact", false, "", "Use more compact layout");

	func = RNA_def_function(srna, "template_movieclip_information", "uiTemplateMovieclipInformation");
	RNA_def_function_ui_description(func, "Item. Movie clip information data.");
	api_ui_item_rna_common(func);
	parm = RNA_def_pointer(func, "clip_user", "MovieClipUser", "", "");
	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);

	func = RNA_def_function(srna, "template_list", "uiTemplateList");
	RNA_def_function_ui_description(func, "Item. A list widget to display data, e.g. vertexgroups.");
	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
	parm = RNA_def_string(func, "listtype_name", NULL, 0, "", "Identifier of the list type to use");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	parm = RNA_def_string(func, "list_id", NULL, 0, "",
	                      "Identifier of this list widget (mandatory when using default \"" UI_UL_DEFAULT_CLASS_NAME
	                      "\" class). "
	                      "If this is set, the uilist gets a custom ID, otherwise it takes the "
	                      "name of the class used to define the uilist (for example, if the "
	                      "class name is \"OBJECT_UL_vgroups\", and list_id is not set by the "
	                      "script, then bl_idname = \"OBJECT_UL_vgroups\")");
	parm = RNA_def_pointer(func, "dataptr", "AnyType", "", "Data from which to take the Collection property");
	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR);
	parm = RNA_def_string(func, "propname", NULL, 0, "", "Identifier of the Collection property in data");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	parm = RNA_def_pointer(func, "active_dataptr", "AnyType", "",
	                       "Data from which to take the integer property, index of the active item");
	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
	parm = RNA_def_string(func, "active_propname", NULL, 0, "",
	                      "Identifier of the integer property in active_data, index of the active item");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	RNA_def_string(func, "item_dyntip_propname", NULL, 0, "",
	               "Identifier of a string property in items, to use as tooltip content");
	RNA_def_int(func, "rows", 5, 0, INT_MAX, "", "Default and minimum number of rows to display", 0, INT_MAX);
	RNA_def_int(func, "maxrows", 5, 0, INT_MAX, "", "Default maximum number of rows to display", 0, INT_MAX);
	RNA_def_enum(func, "type", uilist_layout_type_items, UILST_LAYOUT_DEFAULT, "Type", "Type of layout to use");
	RNA_def_int(func, "columns", 9, 0, INT_MAX, "", "Number of items to display per row, for GRID layout", 0, INT_MAX);

	func = RNA_def_function(srna, "template_running_jobs", "uiTemplateRunningJobs");
	RNA_def_function_flag(func, FUNC_USE_CONTEXT);

	RNA_def_function(srna, "template_operator_search", "uiTemplateOperatorSearch");

	func = RNA_def_function(srna, "template_header_3D", "uiTemplateHeader3D");
	RNA_def_function_flag(func, FUNC_USE_CONTEXT);

	func = RNA_def_function(srna, "template_edit_mode_selection", "uiTemplateEditModeSelection");
	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
	
	func = RNA_def_function(srna, "template_reports_banner", "uiTemplateReportsBanner");
	RNA_def_function_flag(func, FUNC_USE_CONTEXT);

	func = RNA_def_function(srna, "template_node_link", "uiTemplateNodeLink");
	parm = RNA_def_pointer(func, "ntree", "NodeTree", "", "");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	parm = RNA_def_pointer(func, "node", "Node", "", "");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "");
	RNA_def_property_flag(parm, PROP_REQUIRED);

	func = RNA_def_function(srna, "template_node_view", "uiTemplateNodeView");
	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
	parm = RNA_def_pointer(func, "ntree", "NodeTree", "", "");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	parm = RNA_def_pointer(func, "node", "Node", "", "");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "");
	RNA_def_property_flag(parm, PROP_REQUIRED);

	func = RNA_def_function(srna, "template_texture_user", "uiTemplateTextureUser");
	RNA_def_function_flag(func, FUNC_USE_CONTEXT);

	func = RNA_def_function(srna, "template_keymap_item_properties", "uiTemplateKeymapItemProperties");
	parm = RNA_def_pointer(func, "item", "KeyMapItem", "", "");
	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);

	func = RNA_def_function(srna, "template_component_menu", "uiTemplateComponentMenu");
	RNA_def_function_ui_description(func, "Item. Display expanded property in a popup menu");
	parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR);
	parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	RNA_def_string(func, "name", NULL, 0, "", "");

	func = RNA_def_function(srna, "introspect", "uiLayoutIntrospect");
	parm = RNA_def_string(func, "string", NULL, 1024 * 1024, "Descr", "DESCR");
	RNA_def_function_return(func, parm);

	/* color management templates */
	func = RNA_def_function(srna, "template_colorspace_settings", "uiTemplateColorspaceSettings");
	RNA_def_function_ui_description(func, "Item. A widget to control input color space settings.");
	api_ui_item_rna_common(func);

	func = RNA_def_function(srna, "template_colormanaged_view_settings", "uiTemplateColormanagedViewSettings");
	RNA_def_function_ui_description(func, "Item. A widget to control color managed view settings settings.");
	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
	api_ui_item_rna_common(func);
	/* RNA_def_boolean(func, "show_global_settings", false, "", "Show widgets to control global color management settings"); */

	/* node socket icon */
	func = RNA_def_function(srna, "template_node_socket", "uiTemplateNodeSocket");
	RNA_def_function_ui_description(func, "Node Socket Icon");
	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
	RNA_def_float_array(func, "color", 4, node_socket_color_default, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f);
}
Beispiel #30
0
static void rna_def_image_preview(BlenderRNA *brna)
{
	StructRNA *srna;
	FunctionRNA *func;
	PropertyRNA *prop;

	srna = RNA_def_struct(brna, "ImagePreview", NULL);
	RNA_def_struct_sdna(srna, "PreviewImage");
	RNA_def_struct_ui_text(srna, "Image Preview", "Preview image and icon");

	prop = RNA_def_property(srna, "is_image_custom", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag[ICON_SIZE_PREVIEW]", PRV_USER_EDITED);
	RNA_def_property_boolean_funcs(prop, NULL, "rna_ImagePreview_is_image_custom_set");
	RNA_def_property_ui_text(prop, "Custom Image", "True if this preview image has been modified by py script,"
	                         "and is no more auto-generated by Blender");

	prop = RNA_def_int_vector(srna, "image_size", 2, NULL, 0, 0, "Image Size",
	                          "Width and height in pixels", 0, 0);
	RNA_def_property_subtype(prop, PROP_PIXEL);
	RNA_def_property_int_funcs(prop, "rna_ImagePreview_image_size_get", "rna_ImagePreview_image_size_set", NULL);

	prop = RNA_def_property(srna, "image_pixels", PROP_INT, PROP_NONE);
	RNA_def_property_flag(prop, PROP_DYNAMIC);
	RNA_def_property_multi_array(prop, 1, NULL);
	RNA_def_property_ui_text(prop, "Image Pixels", "Image pixels, as bytes (always RGBA 32bits)");
	RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_image_pixels_get_length");
	RNA_def_property_int_funcs(prop, "rna_ImagePreview_image_pixels_get", "rna_ImagePreview_image_pixels_set", NULL);

	prop = RNA_def_property(srna, "image_pixels_float", PROP_FLOAT, PROP_NONE);
	RNA_def_property_flag(prop, PROP_DYNAMIC);
	RNA_def_property_multi_array(prop, 1, NULL);
	RNA_def_property_ui_text(prop, "Float Image Pixels",
	                         "Image pixels components, as floats (RGBA concatenated values)");
	RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_image_pixels_float_get_length");
	RNA_def_property_float_funcs(prop, "rna_ImagePreview_image_pixels_float_get",
	                             "rna_ImagePreview_image_pixels_float_set", NULL);


	prop = RNA_def_property(srna, "is_icon_custom", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag[ICON_SIZE_ICON]", PRV_USER_EDITED);
	RNA_def_property_boolean_funcs(prop, NULL, "rna_ImagePreview_is_icon_custom_set");
	RNA_def_property_ui_text(prop, "Custom Icon", "True if this preview icon has been modified by py script,"
	                         "and is no more auto-generated by Blender");

	prop = RNA_def_int_vector(srna, "icon_size", 2, NULL, 0, 0, "Icon Size",
	                          "Width and height in pixels", 0, 0);
	RNA_def_property_subtype(prop, PROP_PIXEL);
	RNA_def_property_int_funcs(prop, "rna_ImagePreview_icon_size_get", "rna_ImagePreview_icon_size_set", NULL);

	prop = RNA_def_property(srna, "icon_pixels", PROP_INT, PROP_NONE);
	RNA_def_property_flag(prop, PROP_DYNAMIC);
	RNA_def_property_multi_array(prop, 1, NULL);
	RNA_def_property_ui_text(prop, "Icon Pixels", "Icon pixels, as bytes (always RGBA 32bits)");
	RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_icon_pixels_get_length");
	RNA_def_property_int_funcs(prop, "rna_ImagePreview_icon_pixels_get", "rna_ImagePreview_icon_pixels_set", NULL);

	prop = RNA_def_property(srna, "icon_pixels_float", PROP_FLOAT, PROP_NONE);
	RNA_def_property_flag(prop, PROP_DYNAMIC);
	RNA_def_property_multi_array(prop, 1, NULL);
	RNA_def_property_ui_text(prop, "Float Icon Pixels", "Icon pixels components, as floats (RGBA concatenated values)");
	RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_icon_pixels_float_get_length");
	RNA_def_property_float_funcs(prop, "rna_ImagePreview_icon_pixels_float_get",
	                             "rna_ImagePreview_icon_pixels_float_set", NULL);

	prop = RNA_def_int(srna, "icon_id", 0, INT_MIN, INT_MAX, "Icon ID",
	                   "Unique integer identifying this preview as an icon (zero means invalid)", INT_MIN, INT_MAX);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_int_funcs(prop, "rna_ImagePreview_icon_id_get", NULL, NULL);

	func = RNA_def_function(srna, "reload", "rna_ImagePreview_icon_reload");
	RNA_def_function_ui_description(func, "Reload the preview from its source path");
}