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, "Frame",
	                       "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);
}
示例#2
0
static void rna_def_region(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;

	srna = RNA_def_struct(brna, "Region", NULL);
	RNA_def_struct_ui_text(srna, "Region", "Region in a subdivided screen area");
	RNA_def_struct_sdna(srna, "ARegion");

	prop = RNA_def_property(srna, "id", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "swinid");
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Region ID", "Unique ID for this region");

	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "regiontype");
	RNA_def_property_enum_items(prop, rna_enum_region_type_items);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Region Type", "Type of this region");

	prop = RNA_def_property(srna, "x", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "winrct.xmin");
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "X Position", "The window relative vertical location of the region");

	prop = RNA_def_property(srna, "y", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "winrct.ymin");
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Y Position", "The window relative horizontal location of the region");

	prop = RNA_def_property(srna, "width", PROP_INT, PROP_UNSIGNED);
	RNA_def_property_int_sdna(prop, NULL, "winx");
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Width", "Region width");

	prop = RNA_def_property(srna, "height", PROP_INT, PROP_UNSIGNED);
	RNA_def_property_int_sdna(prop, NULL, "winy");
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Height", "Region height");

	prop = RNA_def_property(srna, "view2d", PROP_POINTER, PROP_NONE);
	RNA_def_property_pointer_sdna(prop, NULL, "v2d");
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_flag(prop, PROP_NEVER_NULL);
	RNA_def_property_ui_text(prop, "View2D", "2D view of the region");

	RNA_def_function(srna, "tag_redraw", "ED_region_tag_redraw");
}
示例#3
0
void RNA_def_main_sounds(BlenderRNA *brna, PropertyRNA *cprop)
{
	StructRNA *srna;
	FunctionRNA *func;
	PropertyRNA *parm;

	RNA_def_property_srna(cprop, "BlendDataSounds");
	srna= RNA_def_struct(brna, "BlendDataSounds", NULL);
	RNA_def_struct_sdna(srna, "Main");
	RNA_def_struct_ui_text(srna, "Main Sounds", "Collection of sounds");

	/* TODO, 'load' */

	func= RNA_def_function(srna, "tag", "rna_Main_sounds_tag");
	parm= RNA_def_boolean(func, "value", 0, "Value", "");
	RNA_def_property_flag(parm, PROP_REQUIRED);
}
示例#4
0
void RNA_api_texture(StructRNA *srna)
{
	FunctionRNA *func;
	PropertyRNA *parm;

	func= RNA_def_function(srna, "evaluate", "texture_evaluate");
	RNA_def_function_ui_description(func, "Evaluate the texture at the coordinates given");

	parm= RNA_def_float_vector(func, "value", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
	RNA_def_property_flag(parm, PROP_REQUIRED);

	/* return location and normal */
	parm= RNA_def_float_vector(func, "result", 4, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4);
	RNA_def_property_flag(parm, PROP_THICK_WRAP);
	RNA_def_function_output(func, parm);

}
示例#5
0
static void rna_def_header(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;
	PropertyRNA *parm;
	FunctionRNA *func;

	srna = RNA_def_struct(brna, "Header", NULL);
	RNA_def_struct_ui_text(srna, "Header", "Editor header containing UI elements");
	RNA_def_struct_sdna(srna, "Header");
	RNA_def_struct_refine_func(srna, "rna_Header_refine");
	RNA_def_struct_register_funcs(srna, "rna_Header_register", "rna_Header_unregister", NULL);
	RNA_def_struct_flag(srna, STRUCT_PUBLIC_NAMESPACE_INHERIT);

	/* draw */
	func = RNA_def_function(srna, "draw", NULL);
	RNA_def_function_ui_description(func, "Draw UI elements into the header UI layout");
	RNA_def_function_flag(func, FUNC_REGISTER);
	parm = RNA_def_pointer(func, "context", "Context", "", "");
	RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);

	RNA_define_verify_sdna(0); /* not in sdna */

	prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
	RNA_def_property_pointer_sdna(prop, NULL, "layout");
	RNA_def_property_struct_type(prop, "UILayout");
	RNA_def_property_ui_text(prop, "Layout", "Structure of the header in the UI");

	/* 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 header gets a custom ID, otherwise it takes the "
	                         "name of the class used to define the panel; for example, if the "
	                         "class name is \"OBJECT_HT_hello\", and bl_idname is not set by the "
	                         "script, then bl_idname = \"OBJECT_HT_hello\"");

	prop = RNA_def_property(srna, "bl_space_type", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "type->space_type");
	RNA_def_property_enum_items(prop, rna_enum_space_type_items);
	RNA_def_property_flag(prop, PROP_REGISTER);
	RNA_def_property_ui_text(prop, "Space type", "The space where the header is going to be used in");

	RNA_define_verify_sdna(1);
}
示例#6
0
static void rna_def_render_slot(BlenderRNA *brna)
{
  StructRNA *srna;
  PropertyRNA *prop, *parm;
  FunctionRNA *func;

  srna = RNA_def_struct(brna, "RenderSlot", NULL);
  RNA_def_struct_ui_text(srna, "Render Slot", "Parameters defining the render slot");

  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
  RNA_def_property_string_sdna(prop, NULL, "name");
  RNA_def_property_ui_text(prop, "Name", "Render slot name");
  RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);

  func = RNA_def_function(srna, "clear", "rna_RenderSlot_clear");
  RNA_def_function_flag(func, FUNC_USE_SELF_ID);
  RNA_def_function_ui_description(func, "Clear the render slot");
  parm = RNA_def_pointer(func, "iuser", "ImageUser", "ImageUser", "");
  RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
示例#7
0
static void rna_def_render_result(BlenderRNA *brna)
{
	StructRNA *srna;
	FunctionRNA *func;
	PropertyRNA *parm;
	
	srna = RNA_def_struct(brna, "RenderResult", NULL);
	RNA_def_struct_ui_text(srna, "Render Result", "Result of rendering, including all layers and passes");

	func = RNA_def_function(srna, "load_from_file", "RE_result_load_from_file");
	RNA_def_function_ui_description(func, "Copies the pixels of this render result from an image file");
	RNA_def_function_flag(func, FUNC_USE_REPORTS);
	parm = RNA_def_string_file_name(func, "filename", NULL, FILE_MAX, "File Name",
	                                "Filename to load into this render tile, must be no smaller than "
	                                "the render result");
	RNA_def_property_flag(parm, PROP_REQUIRED);

	RNA_define_verify_sdna(0);

	parm = RNA_def_property(srna, "resolution_x", PROP_INT, PROP_PIXEL);
	RNA_def_property_int_sdna(parm, NULL, "rectx");
	RNA_def_property_clear_flag(parm, PROP_EDITABLE);

	parm = RNA_def_property(srna, "resolution_y", PROP_INT, PROP_PIXEL);
	RNA_def_property_int_sdna(parm, NULL, "recty");
	RNA_def_property_clear_flag(parm, PROP_EDITABLE);

	parm = RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);
	RNA_def_property_struct_type(parm, "RenderLayer");
	RNA_def_property_collection_funcs(parm, "rna_RenderResult_layers_begin", "rna_iterator_listbase_next",
	                                  "rna_iterator_listbase_end", "rna_iterator_listbase_get",
	                                  NULL, NULL, NULL, NULL);

	parm = RNA_def_property(srna, "views", PROP_COLLECTION, PROP_NONE);
	RNA_def_property_struct_type(parm, "RenderView");
	RNA_def_property_collection_funcs(parm, "rna_RenderResult_views_begin", "rna_iterator_listbase_next",
	                                  "rna_iterator_listbase_end", "rna_iterator_listbase_get",
	                                  NULL, NULL, NULL, NULL);

	RNA_define_verify_sdna(1);
}
示例#8
0
static void rna_def_gpencil_data(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;
	FunctionRNA *func;

	static EnumPropertyItem draw_mode_items[] = {
		{GP_DATA_VIEWALIGN, "CURSOR", 0, "Cursor", "Draw stroke at the 3D cursor"},
		{0, "VIEW", 0, "View", "Stick stroke to the view "}, /* weird, GP_DATA_VIEWALIGN is inverted */
		{GP_DATA_VIEWALIGN | GP_DATA_DEPTH_VIEW, "SURFACE", 0, "Surface", "Stick stroke to surfaces"},
		{GP_DATA_VIEWALIGN | GP_DATA_DEPTH_STROKE, "STROKE", 0, "Stroke", "Stick stroke to other strokes"},
		{0, NULL, 0, NULL, NULL}
	};

	srna = RNA_def_struct(brna, "GreasePencil", "ID");
	RNA_def_struct_sdna(srna, "bGPdata");
	RNA_def_struct_ui_text(srna, "Grease Pencil", "Freehand annotation sketchbook");
	RNA_def_struct_ui_icon(srna, ICON_GREASEPENCIL);
	
	/* Layers */
	prop = RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);
	RNA_def_property_collection_sdna(prop, NULL, "layers", NULL);
	RNA_def_property_struct_type(prop, "GPencilLayer");
	RNA_def_property_ui_text(prop, "Layers", "");
	rna_def_gpencil_layers_api(brna, prop);
	
	/* Flags */
	prop = RNA_def_property(srna, "draw_mode", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
	RNA_def_property_enum_items(prop, draw_mode_items);
	RNA_def_property_ui_text(prop, "Draw Mode", "");
	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);

	prop = RNA_def_property(srna, "use_stroke_endpoints", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_DEPTH_STROKE_ENDPOINTS);
	RNA_def_property_ui_text(prop, "Only Endpoints", "Only use the first and last parts of the stroke for snapping");
	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);

	func = RNA_def_function(srna, "clear", "rna_GPencil_clear");
	RNA_def_function_ui_description(func, "Remove all the grease pencil data");
}
示例#9
0
static void rna_api_animdata_drivers(BlenderRNA *brna, PropertyRNA *cprop)
{
	StructRNA *srna;
	PropertyRNA *parm;
	FunctionRNA *func;

	/* PropertyRNA *prop; */
	
	RNA_def_property_srna(cprop, "AnimDataDrivers");
	srna = RNA_def_struct(brna, "AnimDataDrivers", NULL);
	RNA_def_struct_sdna(srna, "AnimData");
	RNA_def_struct_ui_text(srna, "Drivers", "Collection of Driver F-Curves");
	
	func = RNA_def_function(srna, "from_existing", "rna_Driver_from_existing");
	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
	RNA_def_function_ui_description(func, "Add a new driver given an existing one");
	RNA_def_pointer(func, "src_driver", "FCurve", "", "Existing Driver F-Curve to use as template for a new one");
	/* return type */
	parm = RNA_def_pointer(func, "driver", "FCurve", "", "New Driver F-Curve");
	RNA_def_function_return(func, parm);
}
示例#10
0
static void rna_def_render_passes(BlenderRNA *brna, PropertyRNA *cprop)
{
	StructRNA *srna;

	FunctionRNA *func;
	PropertyRNA *parm;

	RNA_def_property_srna(cprop, "RenderPasses");
	srna = RNA_def_struct(brna, "RenderPasses", NULL);
	RNA_def_struct_sdna(srna, "RenderLayer");
	RNA_def_struct_ui_text(srna, "Render Passes", "Collection of render passes");

	func = RNA_def_function(srna, "find_by_type", "rna_RenderPass_find_by_type");
	RNA_def_function_ui_description(func, "Get the render pass for a given type and view");
	parm = RNA_def_enum(func, "pass_type", render_pass_type_items, SCE_PASS_COMBINED, "Pass", "");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	parm = RNA_def_string(func, "view", NULL, 0, "View", "Render view to get pass from");  /* NULL ok here */
	RNA_def_property_flag(parm, PROP_REQUIRED);
	parm = RNA_def_pointer(func, "render_pass", "RenderPass", "", "The matching render pass");
	RNA_def_function_return(func, parm);

}
示例#11
0
static void rna_def_gpencil_frame(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;

	FunctionRNA *func;
	
	srna = RNA_def_struct(brna, "GPencilFrame", NULL);
	RNA_def_struct_sdna(srna, "bGPDframe");
	RNA_def_struct_ui_text(srna, "Grease Pencil Frame", "Collection of related sketches on a particular frame");
	
	/* Strokes */
	prop = RNA_def_property(srna, "strokes", PROP_COLLECTION, PROP_NONE);
	RNA_def_property_collection_sdna(prop, NULL, "strokes", NULL);
	RNA_def_property_struct_type(prop, "GPencilStroke");
	RNA_def_property_ui_text(prop, "Strokes", "Freehand curves defining the sketch on this frame");
	rna_def_gpencil_strokes_api(brna, prop);

	/* Frame Number */
	prop = RNA_def_property(srna, "frame_number", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "framenum");
	/* XXX note: this cannot occur on the same frame as another sketch */
	RNA_def_property_range(prop, -MAXFRAME, MAXFRAME);
	RNA_def_property_ui_text(prop, "Frame Number", "The frame on which this sketch appears");
	
	/* Flags */
	prop = RNA_def_property(srna, "is_edited", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_FRAME_PAINT); /* XXX should it be editable? */
	RNA_def_property_ui_text(prop, "Paint Lock", "Frame is being edited (painted on)");
	
	prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_FRAME_SELECT);
	RNA_def_property_ui_text(prop, "Select", "Frame is selected for editing in the Dope Sheet");
	
	
	/* API */
	func = RNA_def_function(srna, "clear", "rna_GPencil_frame_clear");
	RNA_def_function_ui_description(func, "Remove all the grease pencil frame data");
}
示例#12
0
static void rna_def_render_layer(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;
	FunctionRNA *func;
	
	srna = RNA_def_struct(brna, "RenderLayer", NULL);
	RNA_def_struct_ui_text(srna, "Render Layer", "");

	func = RNA_def_function(srna, "load_from_file", "RE_layer_load_from_file");
	RNA_def_function_ui_description(func, "Copies the pixels of this renderlayer from an image file");
	RNA_def_function_flag(func, FUNC_USE_REPORTS);
	prop = RNA_def_string(func, "filename", "", 0, "Filename",
	                      "Filename to load into this render tile, must be no smaller than the renderlayer");
	RNA_def_property_flag(prop, PROP_REQUIRED);
	RNA_def_int(func, "x", 0, 0, INT_MAX, "Offset X",
	            "Offset the position to copy from if the image is larger than the render layer", 0, INT_MAX);
	RNA_def_int(func, "y", 0, 0, INT_MAX, "Offset Y",
	            "Offset the position to copy from if the image is larger than the render layer", 0, INT_MAX);

	RNA_define_verify_sdna(0);

	rna_def_render_layer_common(srna, 0);

	prop = RNA_def_property(srna, "passes", PROP_COLLECTION, PROP_NONE);
	RNA_def_property_struct_type(prop, "RenderPass");
	RNA_def_property_collection_funcs(prop, "rna_RenderLayer_passes_begin", "rna_iterator_listbase_next",
	                                  "rna_iterator_listbase_end", "rna_iterator_listbase_get",
	                                  NULL, NULL, NULL, NULL);

	prop = RNA_def_property(srna, "rect", PROP_FLOAT, PROP_NONE);
	RNA_def_property_flag(prop, PROP_DYNAMIC);
	RNA_def_property_multi_array(prop, 2, NULL);
	RNA_def_property_dynamic_array_funcs(prop, "rna_RenderLayer_rect_get_length");
	RNA_def_property_float_funcs(prop, "rna_RenderLayer_rect_get", "rna_RenderLayer_rect_set", NULL);

	RNA_define_verify_sdna(1);
}
示例#13
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);
}
示例#14
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", "", 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, "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, "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, "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");

	/* TODO, pack/unpack, maybe should be generic functions? */
}
示例#15
0
void RNA_def_view_layer(BlenderRNA *brna)
{
  FunctionRNA *func;
  StructRNA *srna;
  PropertyRNA *prop;

  srna = RNA_def_struct(brna, "ViewLayer", NULL);
  RNA_def_struct_ui_text(srna, "View Layer", "View layer");
  RNA_def_struct_ui_icon(srna, ICON_RENDER_RESULT);
  RNA_def_struct_path_func(srna, "rna_ViewLayer_path");
  RNA_def_struct_idprops_func(srna, "rna_ViewLayer_idprops");

  rna_def_view_layer_common(srna, true);

  func = RNA_def_function(srna, "update_render_passes", "rna_ViewLayer_update_render_passes");
  RNA_def_function_ui_description(func,
                                  "Requery the enabled render passes from the render engine");
  RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_NO_SELF);

  prop = RNA_def_property(srna, "layer_collection", PROP_POINTER, PROP_NONE);
  RNA_def_property_struct_type(prop, "LayerCollection");
  RNA_def_property_pointer_sdna(prop, NULL, "layer_collections.first");
  RNA_def_property_flag(prop, PROP_NEVER_NULL);
  RNA_def_property_ui_text(
      prop,
      "Layer Collection",
      "Root of collections hierarchy of this view layer,"
      "its 'collection' pointer property is the same as the scene's master collection");

  prop = RNA_def_property(srna, "active_layer_collection", PROP_POINTER, PROP_NONE);
  RNA_def_property_struct_type(prop, "LayerCollection");
  RNA_def_property_pointer_funcs(prop,
                                 "rna_ViewLayer_active_layer_collection_get",
                                 "rna_ViewLayer_active_layer_collection_set",
                                 NULL,
                                 NULL);
  RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
  RNA_def_property_ui_text(
      prop, "Active Layer Collection", "Active layer collection in this view layer's hierarchy");
  RNA_def_property_update(prop, NC_SCENE | ND_LAYER, NULL);

  prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
  RNA_def_property_collection_sdna(prop, NULL, "object_bases", NULL);
  RNA_def_property_struct_type(prop, "Object");
  RNA_def_property_collection_funcs(
      prop, NULL, NULL, NULL, "rna_ViewLayer_objects_get", NULL, NULL, NULL, NULL);
  RNA_def_property_ui_text(prop, "Objects", "All the objects in this layer");
  rna_def_layer_objects(brna, prop);

  /* layer options */
  prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
  RNA_def_property_boolean_sdna(prop, NULL, "flag", VIEW_LAYER_RENDER);
  RNA_def_property_ui_text(prop, "Enabled", "Enable or disable rendering of this View Layer");
  RNA_def_property_update(prop, NC_SCENE | ND_LAYER, NULL);

  prop = RNA_def_property(srna, "use_freestyle", PROP_BOOLEAN, PROP_NONE);
  RNA_def_property_boolean_sdna(prop, NULL, "flag", VIEW_LAYER_FREESTYLE);
  RNA_def_property_ui_text(prop, "Freestyle", "Render stylized strokes in this Layer");
  RNA_def_property_update(prop, NC_SCENE | ND_LAYER, NULL);

  /* Freestyle */
  rna_def_freestyle_settings(brna);

  prop = RNA_def_property(srna, "freestyle_settings", PROP_POINTER, PROP_NONE);
  RNA_def_property_flag(prop, PROP_NEVER_NULL);
  RNA_def_property_pointer_sdna(prop, NULL, "freestyle_config");
  RNA_def_property_struct_type(prop, "FreestyleSettings");
  RNA_def_property_ui_text(prop, "Freestyle Settings", "");

  /* debug update routine */
  func = RNA_def_function(srna, "update", "rna_ViewLayer_update_tagged");
  RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
  RNA_def_function_ui_description(
      func, "Update data tagged to be updated from previous access to data or operators");

  /* Dependency Graph */
  prop = RNA_def_property(srna, "depsgraph", PROP_POINTER, PROP_NONE);
  RNA_def_property_struct_type(prop, "Depsgraph");
  RNA_def_property_ui_text(prop, "Dependency Graph", "Dependencies in the scene data");
  RNA_def_property_pointer_funcs(prop, "rna_ViewLayer_depsgraph_get", NULL, NULL, NULL);

  /* Nested Data  */
  /* *** Non-Animated *** */
  RNA_define_animate_sdna(false);
  rna_def_layer_collection(brna);
  rna_def_object_base(brna);
  RNA_define_animate_sdna(true);
  /* *** Animated *** */
}
示例#16
0
static void rna_def_layer_collection(BlenderRNA *brna)
{
  StructRNA *srna;
  FunctionRNA *func;
  PropertyRNA *prop;

  srna = RNA_def_struct(brna, "LayerCollection", NULL);
  RNA_def_struct_ui_text(srna, "Layer Collection", "Layer collection");
  RNA_def_struct_ui_icon(srna, ICON_GROUP);

  prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE);
  RNA_def_property_flag(prop, PROP_NEVER_NULL);
  RNA_def_property_clear_flag(prop, PROP_EDITABLE | PROP_ANIMATABLE);
  RNA_def_property_struct_type(prop, "Collection");
  RNA_def_property_ui_text(prop, "Collection", "Collection this layer collection is wrapping");

  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
  RNA_def_property_string_sdna(prop, NULL, "collection->id.name");
  RNA_def_property_clear_flag(prop, PROP_EDITABLE | PROP_ANIMATABLE);
  RNA_def_property_ui_text(prop, "Name", "Name of this view layer (same as its collection one)");
  RNA_def_property_string_funcs(
      prop, "rna_LayerCollection_name_get", "rna_LayerCollection_name_length", NULL);
  RNA_def_struct_name_property(srna, prop);

  prop = RNA_def_property(srna, "children", PROP_COLLECTION, PROP_NONE);
  RNA_def_property_collection_sdna(prop, NULL, "layer_collections", NULL);
  RNA_def_property_struct_type(prop, "LayerCollection");
  RNA_def_property_ui_text(prop, "Children", "Child layer collections");

  /* Restriction flags. */
  prop = RNA_def_property(srna, "exclude", PROP_BOOLEAN, PROP_NONE);
  RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_EXCLUDE);
  RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
  RNA_def_property_ui_text(prop, "Exclude from View Layer", "Exclude from view layer");
  RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
  RNA_def_property_ui_icon(prop, ICON_CHECKBOX_HLT, -1);
  RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_exclude_update");

  prop = RNA_def_property(srna, "holdout", PROP_BOOLEAN, PROP_NONE);
  RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_HOLDOUT);
  RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
  RNA_def_property_ui_icon(prop, ICON_HOLDOUT_OFF, 1);
  RNA_def_property_ui_text(prop, "Holdout", "Mask out objects in collection from view layer");
  RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_update");

  prop = RNA_def_property(srna, "indirect_only", PROP_BOOLEAN, PROP_NONE);
  RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_INDIRECT_ONLY);
  RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
  RNA_def_property_ui_icon(prop, ICON_INDIRECT_ONLY_OFF, 1);
  RNA_def_property_ui_text(
      prop,
      "Indirect Only",
      "Objects in collection only contribute indirectly (through shadows and reflections) "
      "in the view layer");
  RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_update");

  prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE);
  RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_HIDE);
  RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
  RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
  RNA_def_property_ui_text(prop, "Hide in Viewport", "Temporarily hide in viewport");
  RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollection_update");

  /* Run-time flags. */
  prop = RNA_def_property(srna, "is_visible", PROP_BOOLEAN, PROP_NONE);
  RNA_def_property_boolean_sdna(prop, NULL, "runtime_flag", LAYER_COLLECTION_VISIBLE);
  RNA_def_property_clear_flag(prop, PROP_EDITABLE);
  RNA_def_property_ui_text(
      prop,
      "Visible",
      "Whether this collection is visible, take into account the collection parent");

  func = RNA_def_function(srna, "has_objects", "rna_LayerCollection_has_objects");
  RNA_def_function_ui_description(func, "");
  RNA_def_function_return(func, RNA_def_boolean(func, "result", 0, "", ""));

  func = RNA_def_function(
      srna, "has_selected_objects", "rna_LayerCollection_has_selected_objects");
  RNA_def_function_ui_description(func, "");
  prop = RNA_def_pointer(
      func, "view_layer", "ViewLayer", "", "ViewLayer the layer collection belongs to");
  RNA_def_parameter_flags(prop, 0, PARM_REQUIRED);
  RNA_def_function_return(func, RNA_def_boolean(func, "result", 0, "", ""));
}
示例#17
0
static void rna_def_color_ramp(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;
	FunctionRNA *func;

	static EnumPropertyItem prop_interpolation_items[] = {
		{COLBAND_INTERP_EASE, "EASE", 0, "Ease", ""},
		{COLBAND_INTERP_CARDINAL, "CARDINAL", 0, "Cardinal", ""},
		{COLBAND_INTERP_LINEAR, "LINEAR", 0, "Linear", ""},
		{COLBAND_INTERP_B_SPLINE, "B_SPLINE", 0, "B-Spline", ""},
		{COLBAND_INTERP_CONSTANT, "CONSTANT", 0, "Constant", ""},
		{0, NULL, 0, NULL, NULL}
	};
	
	static EnumPropertyItem prop_mode_items[] = {
		{COLBAND_BLEND_RGB, "RGB", 0, "RGB", ""},
		{COLBAND_BLEND_HSV, "HSV", 0, "HSV", ""},
		{COLBAND_BLEND_HSL, "HSL", 0, "HSL", ""},
		{0, NULL, 0, NULL, NULL}
	};

	static EnumPropertyItem prop_hsv_items[] = {
		{COLBAND_HUE_NEAR, "NEAR", 0, "Near", ""},
		{COLBAND_HUE_FAR, "FAR", 0, "Far", ""},
		{COLBAND_HUE_CW, "CW", 0, "Clockwise", ""},
		{COLBAND_HUE_CCW, "CCW", 0, "Counter-Clockwise", ""},
		{0, NULL, 0, NULL, NULL}
	};

	srna = RNA_def_struct(brna, "ColorRamp", NULL);
	RNA_def_struct_sdna(srna, "ColorBand");
	RNA_def_struct_path_func(srna, "rna_ColorRamp_path");
	RNA_def_struct_ui_text(srna, "Color Ramp", "Color ramp mapping a scalar value to a color");
	
	prop = RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_COLOR);
	RNA_def_property_collection_sdna(prop, NULL, "data", "tot");
	RNA_def_property_struct_type(prop, "ColorRampElement");
	RNA_def_property_ui_text(prop, "Elements", "");
	RNA_def_property_update(prop, 0, "rna_ColorRamp_update");
	rna_def_color_ramp_element_api(brna, prop);

	prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "ipotype");
	RNA_def_property_enum_items(prop, prop_interpolation_items);
	RNA_def_property_ui_text(prop, "Interpolation", "Set interpolation between color stops");
	RNA_def_property_update(prop, 0, "rna_ColorRamp_update");

	prop = RNA_def_property(srna, "hue_interpolation", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "ipotype_hue");
	RNA_def_property_enum_items(prop, prop_hsv_items);
	RNA_def_property_ui_text(prop, "Color Interpolation", "Set color interpolation");
	RNA_def_property_update(prop, 0, "rna_ColorRamp_update");

	prop = RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "color_mode");
	RNA_def_property_enum_items(prop, prop_mode_items);
	RNA_def_property_ui_text(prop, "Color Mode", "Set color mode to use for interpolation");
	RNA_def_property_update(prop, 0, "rna_ColorRamp_update");

#if 0 /* use len(elements) */
	prop = RNA_def_property(srna, "total", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "tot");
	/* needs a function to do the right thing when adding elements like colorband_add_cb() */
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_range(prop, 0, 31); /* MAXCOLORBAND = 32 */
	RNA_def_property_ui_text(prop, "Total", "Total number of elements");
	RNA_def_property_update(prop, 0, "rna_ColorRamp_update");
#endif
	
	func = RNA_def_function(srna, "evaluate", "rna_ColorRamp_eval");
	RNA_def_function_ui_description(func, "Evaluate ColorRamp");
	prop = RNA_def_float(func, "position", 1.0f, 0.0f, 1.0f, "Position", "Evaluate ColorRamp at position", 0.0f, 1.0f);
	RNA_def_property_flag(prop, PROP_REQUIRED);
	/* return */
	prop = RNA_def_float_color(func, "color", 4, NULL, -FLT_MAX, FLT_MAX, "Color", "Color at given position",
	                           -FLT_MAX, FLT_MAX);
	RNA_def_property_flag(prop, PROP_THICK_WRAP);
	RNA_def_function_output(func, prop);
}
示例#18
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);
}
示例#19
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");
}
示例#20
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);
}
示例#21
0
static void rna_def_area(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;
	FunctionRNA *func;

	srna = RNA_def_struct(brna, "Area", NULL);
	RNA_def_struct_ui_text(srna, "Area", "Area in a subdivided screen, containing an editor");
	RNA_def_struct_sdna(srna, "ScrArea");

	prop = RNA_def_property(srna, "spaces", PROP_COLLECTION, PROP_NONE);
	RNA_def_property_collection_sdna(prop, NULL, "spacedata", NULL);
	RNA_def_property_struct_type(prop, "Space");
	RNA_def_property_ui_text(prop, "Spaces",
	                         "Spaces contained in this area, the first being the active space "
	                         "(NOTE: Useful for example to restore a previously used 3D view space "
	                         "in a certain area to get the old view orientation)");
	rna_def_area_spaces(brna, prop);

	prop = RNA_def_property(srna, "regions", PROP_COLLECTION, PROP_NONE);
	RNA_def_property_collection_sdna(prop, NULL, "regionbase", NULL);
	RNA_def_property_struct_type(prop, "Region");
	RNA_def_property_ui_text(prop, "Regions", "Regions this area is subdivided in");

	prop = RNA_def_property(srna, "show_menus", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", HEADER_NO_PULLDOWN);
	RNA_def_property_ui_text(prop, "Show Menus", "Show menus in the header");

	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "spacetype");
	RNA_def_property_enum_items(prop, rna_enum_space_type_items);
	RNA_def_property_enum_default(prop, SPACE_VIEW3D);
	RNA_def_property_enum_funcs(prop, "rna_Area_type_get", "rna_Area_type_set", "rna_Area_type_itemf");
	RNA_def_property_ui_text(prop, "Editor Type", "Current editor type for this area");
	RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
	RNA_def_property_update(prop, 0, "rna_Area_type_update");

	prop = RNA_def_property(srna, "x", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "totrct.xmin");
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "X Position", "The window relative vertical location of the area");

	prop = RNA_def_property(srna, "y", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "totrct.ymin");
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Y Position", "The window relative horizontal location of the area");

	prop = RNA_def_property(srna, "width", PROP_INT, PROP_UNSIGNED);
	RNA_def_property_int_sdna(prop, NULL, "winx");
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Width", "Area width");

	prop = RNA_def_property(srna, "height", PROP_INT, PROP_UNSIGNED);
	RNA_def_property_int_sdna(prop, NULL, "winy");
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Height", "Area height");

	RNA_def_function(srna, "tag_redraw", "ED_area_tag_redraw");

	func = RNA_def_function(srna, "header_text_set", "ED_area_headerprint");
	RNA_def_function_ui_description(func, "Set the header text");
	RNA_def_string(func, "text", NULL, 0, "Text", "New string for the header, no argument clears the text");
}
示例#22
0
static void rna_def_panel(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;
	PropertyRNA *parm;
	FunctionRNA *func;

	static const EnumPropertyItem panel_flag_items[] = {
		{PNL_DEFAULT_CLOSED, "DEFAULT_CLOSED", 0, "Default Closed",
		                     "Defines if the panel has to be open or collapsed at the time of its creation"},
		{PNL_NO_HEADER, "HIDE_HEADER", 0, "Hide Header",
		                "If set to False, the panel shows a header, which contains a clickable "
		                "arrow to collapse the panel and the label (see bl_label)"},
		{0, NULL, 0, NULL, NULL}
	};

	srna = RNA_def_struct(brna, "Panel", NULL);
	RNA_def_struct_ui_text(srna, "Panel", "Panel containing UI elements");
	RNA_def_struct_sdna(srna, "Panel");
	RNA_def_struct_refine_func(srna, "rna_Panel_refine");
	RNA_def_struct_register_funcs(srna, "rna_Panel_register", "rna_Panel_unregister", NULL);
	RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
	RNA_def_struct_flag(srna, STRUCT_PUBLIC_NAMESPACE_INHERIT);

	/* poll */
	func = RNA_def_function(srna, "poll", NULL);
	RNA_def_function_ui_description(func, "If this method returns a non-null output, then the panel can be drawn");
	RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL);
	RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", ""));
	parm = RNA_def_pointer(func, "context", "Context", "", "");
	RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);

	/* draw */
	func = RNA_def_function(srna, "draw", NULL);
	RNA_def_function_ui_description(func, "Draw UI elements into the panel UI layout");
	RNA_def_function_flag(func, FUNC_REGISTER);
	parm = RNA_def_pointer(func, "context", "Context", "", "");
	RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);

	func = RNA_def_function(srna, "draw_header", NULL);
	RNA_def_function_ui_description(func, "Draw UI elements into the panel's header UI layout");
	RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
	parm = RNA_def_pointer(func, "context", "Context", "", "");
	RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);

	prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
	RNA_def_property_struct_type(prop, "UILayout");
	RNA_def_property_ui_text(prop, "Layout", "Defines the structure of the panel in the UI");

	prop = RNA_def_property(srna, "text", PROP_STRING, PROP_NONE);
	RNA_def_property_string_sdna(prop, NULL, "drawname");
	RNA_def_property_ui_text(prop, "Text", "XXX todo");

	/* 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 panel gets a custom ID, otherwise it takes the "
	                         "name of the class used to define the panel. For example, if the "
	                         "class name is \"OBJECT_PT_hello\", and bl_idname is not set by the "
	                         "script, then bl_idname = \"OBJECT_PT_hello\"");

	prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
	RNA_def_property_string_sdna(prop, NULL, "type->label");
	RNA_def_property_flag(prop, PROP_REGISTER);
	RNA_def_property_ui_text(prop, "Label",
	                         "The panel label, shows up in the panel header at the right of the "
	                         "triangle used to collapse the panel");

	prop = RNA_def_property(srna, "bl_translation_context", PROP_STRING, PROP_NONE);
	RNA_def_property_string_sdna(prop, NULL, "type->translation_context");
	RNA_def_property_string_default(prop, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
	RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
	RNA_define_verify_sdna(true);

	prop = RNA_def_property(srna, "bl_category", PROP_STRING, PROP_NONE);
	RNA_def_property_string_sdna(prop, NULL, "type->category");
	RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);

	prop = RNA_def_property(srna, "bl_space_type", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "type->space_type");
	RNA_def_property_enum_items(prop, rna_enum_space_type_items);
	RNA_def_property_flag(prop, PROP_REGISTER);
	RNA_def_property_ui_text(prop, "Space type", "The space where the panel is going to be used in");

	prop = RNA_def_property(srna, "bl_region_type", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "type->region_type");
	RNA_def_property_enum_items(prop, rna_enum_region_type_items);
	RNA_def_property_flag(prop, PROP_REGISTER);
	RNA_def_property_ui_text(prop, "Region Type", "The region where the panel is going to be used in");

	prop = RNA_def_property(srna, "bl_context", PROP_STRING, PROP_NONE);
	RNA_def_property_string_sdna(prop, NULL, "type->context");
	RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); /* Only used in Properties Editor and 3D View - Thomas */
	RNA_def_property_ui_text(prop, "Context",
	                         "The context in which the panel belongs to. (TODO: explain the "
	                         "possible combinations bl_context/bl_region_type/bl_space_type)");

	prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "type->flag");
	RNA_def_property_enum_items(prop, panel_flag_items);
	RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL | PROP_ENUM_FLAG);
	RNA_def_property_ui_text(prop, "Options",  "Options for this panel type");

	prop = RNA_def_property(srna, "use_pin", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", PNL_PIN);
	RNA_def_property_ui_text(prop, "Pin",  "");
	/* XXX, should only tag region for redraw */
	RNA_def_property_update(prop, NC_WINDOW, NULL);
}
示例#23
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? */
}
示例#24
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", ""},
		{'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);
}
示例#25
0
static void rna_def_armature(BlenderRNA *brna)
{
	StructRNA *srna;
	FunctionRNA *func;
	PropertyRNA *prop;
	
	static EnumPropertyItem prop_drawtype_items[] = {
		{ARM_OCTA, "OCTAHEDRAL", 0, "Octahedral", "Display bones as octahedral shape (default)"},
		{ARM_LINE, "STICK", 0, "Stick", "Display bones as simple 2D lines with dots"},
		{ARM_B_BONE, "BBONE", 0, "B-Bone", "Display bones as boxes, showing subdivision and B-Splines"},
		{ARM_ENVELOPE, "ENVELOPE", 0, "Envelope",
		               "Display bones as extruded spheres, showing deformation influence volume"},
		{ARM_WIRE, "WIRE", 0, "Wire", "Display bones as thin wires, showing subdivision and B-Splines"},
		{0, NULL, 0, NULL, NULL}
	};
	static EnumPropertyItem prop_vdeformer[] = {
		{ARM_VDEF_BLENDER, "BLENDER", 0, "Blender", "Use Blender's armature vertex deformation"},
		{ARM_VDEF_BGE_CPU, "BGE_CPU", 0, "BGE", "Use vertex deformation code optimized for the BGE"},
		{0, NULL, 0, NULL, NULL}
	};
	static EnumPropertyItem prop_ghost_type_items[] = {
		{ARM_GHOST_CUR, "CURRENT_FRAME", 0, "Around Frame",
		                "Display Ghosts of poses within a fixed number of frames around the current frame"},
		{ARM_GHOST_RANGE, "RANGE", 0, "In Range", "Display Ghosts of poses within specified range"},
		{ARM_GHOST_KEYS, "KEYS", 0, "On Keyframes", "Display Ghosts of poses on Keyframes"},
		{0, NULL, 0, NULL, NULL}
	};
	static const EnumPropertyItem prop_pose_position_items[] = {
		{0, "POSE", 0, "Pose Position", "Show armature in posed state"},
		{ARM_RESTPOS, "REST", 0, "Rest Position", "Show Armature in binding pose state (no posing possible)"},
		{0, NULL, 0, NULL, NULL}
	};
	
	srna = RNA_def_struct(brna, "Armature", "ID");
	RNA_def_struct_ui_text(srna, "Armature",
	                       "Armature datablock containing a hierarchy of bones, usually used for rigging characters");
	RNA_def_struct_ui_icon(srna, ICON_ARMATURE_DATA);
	RNA_def_struct_sdna(srna, "bArmature");

	func = RNA_def_function(srna, "transform", "rna_Armature_transform");
	RNA_def_function_ui_description(func, "Transform armature bones by a matrix");
	prop = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
	RNA_def_property_flag(prop, PROP_REQUIRED);

	/* Animation Data */
	rna_def_animdata_common(srna);
	
	/* Collections */
	prop = RNA_def_property(srna, "bones", PROP_COLLECTION, PROP_NONE);
	RNA_def_property_collection_sdna(prop, NULL, "bonebase", NULL);
	RNA_def_property_collection_funcs(prop, NULL, "rna_Armature_bones_next", NULL, NULL, NULL, NULL, NULL, NULL);
	RNA_def_property_struct_type(prop, "Bone");
	RNA_def_property_ui_text(prop, "Bones", "");
	rna_def_armature_bones(brna, prop);

	prop = RNA_def_property(srna, "edit_bones", PROP_COLLECTION, PROP_NONE);
	RNA_def_property_collection_sdna(prop, NULL, "edbo", NULL);
	RNA_def_property_struct_type(prop, "EditBone");
	RNA_def_property_ui_text(prop, "Edit Bones", "");
	rna_def_armature_edit_bones(brna, prop);

	/* Enum values */
	prop = RNA_def_property(srna, "pose_position", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
	RNA_def_property_enum_items(prop, prop_pose_position_items);
	RNA_def_property_ui_text(prop, "Pose Position", "Show armature in binding pose or final posed state");
	RNA_def_property_update(prop, 0, "rna_Armature_update_data");
	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
	
	prop = RNA_def_property(srna, "draw_type", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "drawtype");
	RNA_def_property_enum_items(prop, prop_drawtype_items);
	RNA_def_property_ui_text(prop, "Draw Type", "");
	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);

	prop = RNA_def_property(srna, "deform_method", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "gevertdeformer");
	RNA_def_property_enum_items(prop, prop_vdeformer);
	RNA_def_property_ui_text(prop, "Vertex Deformer", "Vertex Deformer Method (Game Engine only)");
	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
	
/* XXX deprecated ....... old animviz for armatures only */
	prop = RNA_def_property(srna, "ghost_type", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "ghosttype");
	RNA_def_property_enum_items(prop, prop_ghost_type_items);
	RNA_def_property_ui_text(prop, "Ghost Type", "Method of Onion-skinning for active Action");
	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
/* XXX deprecated ....... old animviz for armatures only	 */

	/* Boolean values */
	/* layer */
	prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
	RNA_def_property_boolean_sdna(prop, NULL, "layer", 1);
	RNA_def_property_array(prop, 32);
	RNA_def_property_ui_text(prop, "Visible Layers", "Armature layer visibility");
	RNA_def_property_boolean_funcs(prop, NULL, "rna_Armature_layer_set");
	RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Armature_update_layers");
	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
	
	/* layer protection */
	prop = RNA_def_property(srna, "layers_protected", PROP_BOOLEAN, PROP_LAYER);
	RNA_def_property_boolean_sdna(prop, NULL, "layer_protected", 1);
	RNA_def_property_array(prop, 32);
	RNA_def_property_ui_text(prop, "Layer Proxy Protection",
	                         "Protected layers in Proxy Instances are restored to Proxy settings "
	                         "on file reload and undo");
	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
		
	/* flag */
	prop = RNA_def_property(srna, "show_axes", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_DRAWAXES);
	RNA_def_property_ui_text(prop, "Draw Axes", "Draw bone axes");
	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
	
	prop = RNA_def_property(srna, "show_names", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_DRAWNAMES);
	RNA_def_property_ui_text(prop, "Draw Names", "Draw bone names");
	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
	
	prop = RNA_def_property(srna, "use_deform_delay", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_DELAYDEFORM);
	RNA_def_property_ui_text(prop, "Delay Deform", "Don't deform children when manipulating bones in Pose Mode");
	RNA_def_property_update(prop, 0, "rna_Armature_update_data");
	
	prop = RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_MIRROR_EDIT);
	RNA_def_property_ui_text(prop, "X-Axis Mirror", "Apply changes to matching bone on opposite side of X-Axis");
	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
	
	prop = RNA_def_property(srna, "use_auto_ik", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_AUTO_IK);
	RNA_def_property_ui_text(prop, "Auto IK", "Add temporary IK constraints while grabbing bones in Pose Mode");
	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
	
	prop = RNA_def_property(srna, "show_bone_custom_shapes", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ARM_NO_CUSTOM);
	RNA_def_property_ui_text(prop, "Draw Custom Bone Shapes", "Draw bones with their custom shapes");
	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
	
	prop = RNA_def_property(srna, "show_group_colors", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_COL_CUSTOM);
	RNA_def_property_ui_text(prop, "Draw Bone Group Colors", "Draw bone group colors");
	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
	
/* XXX deprecated ....... old animviz for armatures only */
	prop = RNA_def_property(srna, "show_only_ghost_selected", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_GHOST_ONLYSEL);
	RNA_def_property_ui_text(prop, "Draw Ghosts on Selected Bones Only", "");
	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
/* XXX deprecated ....... old animviz for armatures only */

	/* Number fields */
/* XXX deprecated ....... old animviz for armatures only */
	/* ghost/onionskining settings */
	prop = RNA_def_property(srna, "ghost_step", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "ghostep");
	RNA_def_property_range(prop, 0, 30);
	RNA_def_property_ui_text(prop, "Ghosting Step",
	                         "Number of frame steps on either side of current frame to show as ghosts "
	                         "(only for 'Around Current Frame' Onion-skinning method)");
	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
	
	prop = RNA_def_property(srna, "ghost_size", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "ghostsize");
	RNA_def_property_range(prop, 1, 20);
	RNA_def_property_ui_text(prop, "Ghosting Frame Step",
	                         "Frame step for Ghosts (not for 'On Keyframes' Onion-skinning method)");
	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
	
	prop = RNA_def_property(srna, "ghost_frame_start", PROP_INT, PROP_TIME);
	RNA_def_property_int_sdna(prop, NULL, "ghostsf");
	RNA_def_property_int_funcs(prop, NULL, "rna_Armature_ghost_start_frame_set", NULL);
	RNA_def_property_ui_text(prop, "Ghosting Start Frame",
	                         "Starting frame of range of Ghosts to display (not for "
	                         "'Around Current Frame' Onion-skinning method)");
	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
	
	prop = RNA_def_property(srna, "ghost_frame_end", PROP_INT, PROP_TIME);
	RNA_def_property_int_sdna(prop, NULL, "ghostef");
	RNA_def_property_int_funcs(prop, NULL, "rna_Armature_ghost_end_frame_set", NULL);
	RNA_def_property_ui_text(prop, "Ghosting End Frame",
	                         "End frame of range of Ghosts to display "
	                         "(not for 'Around Current Frame' Onion-skinning method)");
	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
/* XXX deprecated ....... old animviz for armatures only */


	prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_funcs(prop, "rna_Armature_is_editmode_get", NULL);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Is Editmode", "True when used in editmode");
}
示例#26
0
		{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 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

	/* mesh */
	func = RNA_def_function(srna, "to_mesh", "rna_Object_to_mesh");
	RNA_def_function_ui_description(func, "Create a Mesh datablock 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_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
	parm = RNA_def_boolean(func, "apply_modifiers", 0, "", "Apply modifiers");
	RNA_def_property_flag(parm, PROP_REQUIRED);
	parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply");
	RNA_def_property_flag(parm, PROP_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 */
示例#27
0
static void rna_def_curvemapping(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;
	FunctionRNA *func;

	srna = RNA_def_struct(brna, "CurveMapping", NULL);
	RNA_def_struct_ui_text(srna, "CurveMapping",
	                       "Curve mapping to map color, vector and scalar values to other values using "
	                       "a user defined curve");
	
	prop = RNA_def_property(srna, "use_clip", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", CUMA_DO_CLIP);
	RNA_def_property_ui_text(prop, "Clip", "Force the curve view to fit a defined boundary");
	RNA_def_property_boolean_funcs(prop, NULL, "rna_CurveMapping_clip_set");

	prop = RNA_def_property(srna, "clip_min_x", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "clipr.xmin");
	RNA_def_property_range(prop, -100.0f, 100.0f);
	RNA_def_property_ui_text(prop, "Clip Min X", "");
	RNA_def_property_float_funcs(prop, NULL, NULL, "rna_CurveMapping_clipminx_range");

	prop = RNA_def_property(srna, "clip_min_y", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "clipr.ymin");
	RNA_def_property_range(prop, -100.0f, 100.0f);
	RNA_def_property_ui_text(prop, "Clip Min Y", "");
	RNA_def_property_float_funcs(prop, NULL, NULL, "rna_CurveMapping_clipminy_range");

	prop = RNA_def_property(srna, "clip_max_x", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "clipr.xmax");
	RNA_def_property_range(prop, -100.0f, 100.0f);
	RNA_def_property_ui_text(prop, "Clip Max X", "");
	RNA_def_property_float_funcs(prop, NULL, NULL, "rna_CurveMapping_clipmaxx_range");

	prop = RNA_def_property(srna, "clip_max_y", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "clipr.ymax");
	RNA_def_property_range(prop, -100.0f, 100.0f);
	RNA_def_property_ui_text(prop, "Clip Max Y", "");
	RNA_def_property_float_funcs(prop, NULL, NULL, "rna_CurveMapping_clipmaxy_range");

	prop = RNA_def_property(srna, "curves", PROP_COLLECTION, PROP_NONE);
	RNA_def_property_collection_funcs(prop, "rna_CurveMapping_curves_begin", "rna_iterator_array_next",
	                                  "rna_iterator_array_end", "rna_iterator_array_get",
	                                  "rna_CurveMapping_curves_length", NULL, NULL, NULL);
	RNA_def_property_struct_type(prop, "CurveMap");
	RNA_def_property_ui_text(prop, "Curves", "");

	prop = RNA_def_property(srna, "black_level", PROP_FLOAT, PROP_COLOR);
	RNA_def_property_float_sdna(prop, NULL, "black");
	RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
	RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 1, 3);
	RNA_def_property_ui_text(prop, "Black Level", "For RGB curves, the color that black is mapped to");
	RNA_def_property_float_funcs(prop, NULL, "rna_CurveMapping_black_level_set", NULL);

	prop = RNA_def_property(srna, "white_level", PROP_FLOAT, PROP_COLOR);
	RNA_def_property_float_sdna(prop, NULL, "white");
	RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
	RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 1, 3);
	RNA_def_property_ui_text(prop, "White Level", "For RGB curves, the color that white is mapped to");
	RNA_def_property_float_funcs(prop, NULL, "rna_CurveMapping_white_level_set", NULL);

	func = RNA_def_function(srna, "update", "curvemapping_changed_all");
	RNA_def_function_ui_description(func, "Update curve mapping after making changes");

	func = RNA_def_function(srna, "initialize", "rna_CurveMap_initialize");
	RNA_def_function_ui_description(func, "Initialize curve");
}
示例#28
0
文件: rna_ID.c 项目: pawkoz/dyplom
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");
}
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);
}
示例#30
0
文件: rna_ID.c 项目: pawkoz/dyplom
static void rna_def_ID(BlenderRNA *brna)
{
	StructRNA *srna;
	FunctionRNA *func;
	PropertyRNA *prop, *parm;

	static EnumPropertyItem update_flag_items[] = {
		{OB_RECALC_OB, "OBJECT", 0, "Object", ""},
		{OB_RECALC_DATA, "DATA", 0, "Data", ""},
		{OB_RECALC_TIME, "TIME", 0, "Time", ""},
		{0, NULL, 0, NULL, NULL}
	};

	srna = RNA_def_struct(brna, "ID", NULL);
	RNA_def_struct_ui_text(srna, "ID",
	                       "Base type for data-blocks, defining a unique name, linking from other libraries "
	                       "and garbage collection");
	RNA_def_struct_flag(srna, STRUCT_ID | STRUCT_ID_REFCOUNT);
	RNA_def_struct_refine_func(srna, "rna_ID_refine");
	RNA_def_struct_idprops_func(srna, "rna_ID_idprops");

	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
	RNA_def_property_ui_text(prop, "Name", "Unique data-block ID name");
	RNA_def_property_string_funcs(prop, "rna_ID_name_get", "rna_ID_name_length", "rna_ID_name_set");
	RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2);
	RNA_def_property_editable_func(prop, "rna_ID_name_editable");
	RNA_def_property_update(prop, NC_ID | NA_RENAME, NULL);
	RNA_def_struct_name_property(srna, prop);

	prop = RNA_def_property(srna, "users", PROP_INT, PROP_UNSIGNED);
	RNA_def_property_int_sdna(prop, NULL, "us");
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Users", "Number of times this data-block is referenced");

	prop = RNA_def_property(srna, "use_fake_user", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_FAKEUSER);
	RNA_def_property_ui_text(prop, "Fake User", "Save this data-block even if it has no users");
	RNA_def_property_boolean_funcs(prop, NULL, "rna_ID_fake_user_set");

	prop = RNA_def_property(srna, "tag", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_DOIT);
	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
	RNA_def_property_ui_text(prop, "Tag",
	                         "Tools can use this to tag data for their own purposes "
	                         "(initial state is undefined)");

	prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_ID_RECALC);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Is Updated", "Datablock is tagged for recalculation");

	prop = RNA_def_property(srna, "is_updated_data", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_ID_RECALC_DATA);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Is Updated Data", "Datablock data is tagged for recalculation");

	prop = RNA_def_property(srna, "is_library_indirect", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_INDIRECT);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Is Indirect", "Is this ID block linked indirectly");

	prop = RNA_def_property(srna, "library", PROP_POINTER, PROP_NONE);
	RNA_def_property_pointer_sdna(prop, NULL, "lib");
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Library", "Library file the data-block is linked from");

	prop = RNA_def_pointer(srna, "preview", "ImagePreview", "Preview",
	                       "Preview image and icon of this data-block (None if not supported for this type of data)");
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_pointer_funcs(prop, "rna_IDPreview_get", NULL, NULL, NULL);

	/* functions */
	func = RNA_def_function(srna, "copy", "rna_ID_copy");
	RNA_def_function_ui_description(func, "Create a copy of this data-block (not supported for all data-blocks)");
	parm = RNA_def_pointer(func, "id", "ID", "", "New copy of the ID");
	RNA_def_function_return(func, parm);

	func = RNA_def_function(srna, "user_clear", "rna_ID_user_clear");
	RNA_def_function_ui_description(func, "Clear the user count of a data-block so its not saved, "
	                                "on reload the data will be removed");

	func = RNA_def_function(srna, "animation_data_create", "rna_ID_animation_data_create");
	RNA_def_function_flag(func, FUNC_USE_MAIN);
	RNA_def_function_ui_description(func, "Create animation data to this ID, note that not all ID types support this");
	parm = RNA_def_pointer(func, "anim_data", "AnimData", "", "New animation data or NULL");
	RNA_def_function_return(func, parm);

	func = RNA_def_function(srna, "animation_data_clear", "rna_ID_animation_data_free");
	RNA_def_function_flag(func, FUNC_USE_MAIN);
	RNA_def_function_ui_description(func, "Clear animation on this this ID");

	func = RNA_def_function(srna, "update_tag", "rna_ID_update_tag");
	RNA_def_function_flag(func, FUNC_USE_REPORTS);
	RNA_def_function_ui_description(func,
	                                "Tag the ID to update its display data, "
	                                "e.g. when calling :class:`bpy.types.Scene.update`");
	RNA_def_enum_flag(func, "refresh", update_flag_items, 0, "", "Type of updates to perform");
}