コード例 #1
0
ファイル: rna_dynamicpaint.c プロジェクト: 244xiao/blender
static void rna_def_canvas_surface(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;
	PropertyRNA *parm;
	FunctionRNA *func;

	/*  Surface format */
	static EnumPropertyItem prop_dynamicpaint_surface_format[] = {
		/*{MOD_DPAINT_SURFACE_F_PTEX, "PTEX", ICON_TEXTURE_SHADED, "Ptex", ""}, */
		{MOD_DPAINT_SURFACE_F_VERTEX, "VERTEX", ICON_OUTLINER_DATA_MESH, "Vertex", ""},
		{MOD_DPAINT_SURFACE_F_IMAGESEQ, "IMAGE", ICON_FILE_IMAGE, "Image Sequence", ""},
		{0, NULL, 0, NULL, NULL}
	};

	/*  Surface type - generated dynamically based on surface format */
	static EnumPropertyItem prop_dynamicpaint_surface_type[] = {
		{MOD_DPAINT_SURFACE_T_PAINT, "PAINT", 0, "Paint", ""},
		{0, NULL, 0, NULL, NULL}
	};

	/*  Surface output preview. currently only paint has multiple outputs */
	static EnumPropertyItem prop_dynamicpaint_surface_preview[] = {
		{MOD_DPAINT_SURFACE_PREV_PAINT, "PAINT", 0, "Paint", ""},
		{MOD_DPAINT_SURFACE_PREV_WETMAP, "WETMAP", 0, "Wetmap", ""},
		{0, NULL, 0, NULL, NULL}
	};

	/*  Initial color setting */
	static EnumPropertyItem prop_dynamicpaint_init_color_type[] = {
		{MOD_DPAINT_INITIAL_NONE, "NONE", 0, "None", ""},
		{MOD_DPAINT_INITIAL_COLOR, "COLOR", ICON_COLOR, "Color", ""},
		{MOD_DPAINT_INITIAL_TEXTURE, "TEXTURE", ICON_TEXTURE, "UV Texture", ""},
		{MOD_DPAINT_INITIAL_VERTEXCOLOR, "VERTEX_COLOR", ICON_GROUP_VCOL, "Vertex Color", ""},
		{0, NULL, 0, NULL, NULL}
	};

	/*  Effect type
	 *   Only used by ui to view per effect settings */
	static EnumPropertyItem prop_dynamicpaint_effecttype[] = {
		{1, "SPREAD", 0, "Spread", ""},
		{2, "DRIP", 0, "Drip", ""},
		{3, "SHRINK", 0, "Shrink", ""},
		{0, NULL, 0, NULL, NULL}
	};

	/* Displacemap file format */
	static EnumPropertyItem prop_dynamicpaint_image_fileformat[] = {
		{MOD_DPAINT_IMGFORMAT_PNG, "PNG", 0, "PNG", ""},
#ifdef WITH_OPENEXR
		{MOD_DPAINT_IMGFORMAT_OPENEXR, "OPENEXR", 0, "OpenEXR", ""},
#endif
		{0, NULL, 0, NULL, NULL}
	};

	/* Displacemap type */
	static EnumPropertyItem prop_dynamicpaint_displace_type[] = {
		{MOD_DPAINT_DISP_DISPLACE, "DISPLACE", 0, "Displacement", ""},
		{MOD_DPAINT_DISP_DEPTH, "DEPTH", 0, "Depth", ""},
		{0, NULL, 0, NULL, NULL}
	};



	/* Surface */
	srna = RNA_def_struct(brna, "DynamicPaintSurface", NULL);
	RNA_def_struct_sdna(srna, "DynamicPaintSurface");
	RNA_def_struct_ui_text(srna, "Paint Surface", "A canvas surface layer");
	RNA_def_struct_path_func(srna, "rna_DynamicPaintSurface_path");

	prop = RNA_def_property(srna, "surface_format", PROP_ENUM, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
	RNA_def_property_enum_sdna(prop, NULL, "format");
	RNA_def_property_enum_items(prop, prop_dynamicpaint_surface_format);
	RNA_def_property_ui_text(prop, "Format", "Surface Format");
	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurfaces_changeFormat");

	prop = RNA_def_property(srna, "surface_type", PROP_ENUM, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
	RNA_def_property_enum_sdna(prop, NULL, "type");
	RNA_def_property_enum_items(prop, prop_dynamicpaint_surface_type);
	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_DynamicPaint_surface_type_itemf");
	RNA_def_property_ui_text(prop, "Surface Type", "Surface Type");
	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_changeType");

	prop = RNA_def_property(srna, "is_active", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_ACTIVE);
	RNA_def_property_ui_text(prop, "Is Active", "Toggle whether surface is processed or ignored");
	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");

	prop = RNA_def_property(srna, "show_preview", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_PREVIEW);
	RNA_def_property_ui_text(prop, "Show Preview", "Display surface preview in 3D-views");
	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_changePreview");

	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
	RNA_def_property_ui_text(prop, "Name", "Surface name");
	RNA_def_property_update(prop, NC_OBJECT, "rna_DynamicPaintSurface_uniqueName");
	RNA_def_struct_name_property(srna, prop);

	prop = RNA_def_property(srna, "brush_group", PROP_POINTER, PROP_NONE);
	RNA_def_property_struct_type(prop, "Group");
	RNA_def_property_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Brush Group", "Only use brush objects from this group");
	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_resetDependancy");


	/*
	 *   Paint, wet and displace
	 */

	prop = RNA_def_property(srna, "use_dissolve", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DISSOLVE);
	RNA_def_property_ui_text(prop, "Dissolve", "Enable to make surface changes disappear over time");
	
	prop = RNA_def_property(srna, "dissolve_speed", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "diss_speed");
	RNA_def_property_range(prop, 1.0, 10000.0);
	RNA_def_property_ui_range(prop, 1.0, 10000.0, 5, -1);
	RNA_def_property_ui_text(prop, "Dissolve Speed", "Approximately in how many frames should dissolve happen");

	prop = RNA_def_property(srna, "use_drying", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_USE_DRYING);
	RNA_def_property_ui_text(prop, "Dry", "Enable to make surface wetness dry over time");
	
	prop = RNA_def_property(srna, "dry_speed", PROP_INT, PROP_NONE);
	RNA_def_property_range(prop, 1.0, 10000.0);
	RNA_def_property_ui_range(prop, 1.0, 10000.0, 5, -1);
	RNA_def_property_ui_text(prop, "Dry Speed", "Approximately in how many frames should drying happen");
	
	/*
	 *   Simulation settings
	 */
	prop = RNA_def_property(srna, "image_resolution", PROP_INT, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
	RNA_def_property_range(prop, 16.0, 4096.0);
	RNA_def_property_ui_range(prop, 16.0, 4096.0, 1, -1);
	RNA_def_property_ui_text(prop, "Resolution", "Output image resolution");
	
	prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
	RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
	RNA_def_property_ui_text(prop, "UV Map", "UV map name");
	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_DynamicPaint_uvlayer_set");
	
	prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "start_frame");
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
	RNA_def_property_range(prop, 1.0, 9999.0);
	RNA_def_property_ui_range(prop, 1.0, 9999, 1, -1);
	RNA_def_property_ui_text(prop, "Start Frame", "Simulation start frame");
	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurfaces_updateFrames");
	
	prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "end_frame");
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
	RNA_def_property_range(prop, 1.0, 9999.0);
	RNA_def_property_ui_range(prop, 1.0, 9999.0, 1, -1);
	RNA_def_property_ui_text(prop, "End Frame", "Simulation end frame");
	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurfaces_updateFrames");
	
	prop = RNA_def_property(srna, "frame_substeps", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "substeps");
	RNA_def_property_range(prop, 0.0, 20.0);
	RNA_def_property_ui_range(prop, 0.0, 10, 1, -1);
	RNA_def_property_ui_text(prop, "Sub-Steps", "Do extra frames between scene frames to ensure smooth motion");
	
	prop = RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_ANTIALIAS);
	RNA_def_property_ui_text(prop, "Anti-aliasing", "Use 5x multisampling to smooth paint edges");
	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_reset");

	prop = RNA_def_property(srna, "brush_influence_scale", PROP_FLOAT, PROP_FACTOR);
	RNA_def_property_float_sdna(prop, NULL, "influence_scale");
	RNA_def_property_range(prop, 0.0, 1.0);
	RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
	RNA_def_property_ui_text(prop, "Influence Scale", "Adjust influence brush objects have on this surface");
	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");

	prop = RNA_def_property(srna, "brush_radius_scale", PROP_FLOAT, PROP_FACTOR);
	RNA_def_property_float_sdna(prop, NULL, "radius_scale");
	RNA_def_property_range(prop, 0.0, 10.0);
	RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
	RNA_def_property_ui_text(prop, "Radius Scale", "Adjust radius of proximity brushes or particles for this surface");
	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");

	/*
	 *	Initial Color
	 */

	prop = RNA_def_property(srna, "init_color_type", PROP_ENUM, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
	RNA_def_property_enum_items(prop, prop_dynamicpaint_init_color_type);
	RNA_def_property_ui_text(prop, "Initial Color", "");
	RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_DRAW | ND_MODIFIER, "rna_DynamicPaintSurface_initialcolortype");

	prop = RNA_def_property(srna, "init_color", PROP_FLOAT, PROP_COLOR_GAMMA);
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
	RNA_def_property_array(prop, 4);
	RNA_def_property_ui_text(prop, "Color", "Initial color of the surface");
	RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_DRAW | ND_MODIFIER, "rna_DynamicPaintSurface_reset");

	prop = RNA_def_property(srna, "init_texture", PROP_POINTER, PROP_NONE);
	RNA_def_property_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Texture", "");
	RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_DRAW | ND_MODIFIER, "rna_DynamicPaintSurface_reset");

	prop = RNA_def_property(srna, "init_layername", PROP_STRING, PROP_NONE);
	RNA_def_property_ui_text(prop, "Data Layer", "");
	RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_DRAW | ND_MODIFIER, "rna_DynamicPaintSurface_reset");

	/*
	 *   Effect Settings
	 */
	prop = RNA_def_property(srna, "effect_ui", PROP_ENUM, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
	RNA_def_property_enum_items(prop, prop_dynamicpaint_effecttype);
	RNA_def_property_ui_text(prop, "Effect Type", "");
	
	prop = RNA_def_property(srna, "use_dry_log", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DRY_LOG);
	RNA_def_property_ui_text(prop, "Slow", "Use logarithmic drying (makes high values to dry faster than low values)");

	prop = RNA_def_property(srna, "use_dissolve_log", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DISSOLVE_LOG);
	RNA_def_property_ui_text(prop, "Slow",
	                         "Use logarithmic dissolve (makes high values to fade faster than low values)");
	
	prop = RNA_def_property(srna, "use_spread", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
	RNA_def_property_boolean_sdna(prop, NULL, "effect", MOD_DPAINT_EFFECT_DO_SPREAD);
	RNA_def_property_ui_text(prop, "Use Spread", "Process spread effect (spread wet paint around surface)");
	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_reset");
	
	prop = RNA_def_property(srna, "spread_speed", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "spread_speed");
	RNA_def_property_range(prop, 0.001, 10.0);
	RNA_def_property_ui_range(prop, 0.01, 5.0, 1, 2);
	RNA_def_property_ui_text(prop, "Spread Speed", "How fast spread effect moves on the canvas surface");

	prop = RNA_def_property(srna, "color_dry_threshold", PROP_FLOAT, PROP_FACTOR);
	RNA_def_property_float_sdna(prop, NULL, "color_dry_threshold");
	RNA_def_property_range(prop, 0.0, 1.0);
	RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
	RNA_def_property_ui_text(prop, "Color Dry", "The wetness level when colors start to shift to the background");

	prop = RNA_def_property(srna, "color_spread_speed", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "color_spread_speed");
	RNA_def_property_range(prop, 0.0, 2.0);
	RNA_def_property_ui_range(prop, 0.0, 2.0, 1, 2);
	RNA_def_property_ui_text(prop, "Color Spread", "How fast colors get mixed within wet paint");
	
	prop = RNA_def_property(srna, "use_drip", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
	RNA_def_property_boolean_sdna(prop, NULL, "effect", MOD_DPAINT_EFFECT_DO_DRIP);
	RNA_def_property_ui_text(prop, "Use Drip", "Process drip effect (drip wet paint to gravity direction)");
	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_reset");
	
	prop = RNA_def_property(srna, "use_shrink", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
	RNA_def_property_boolean_sdna(prop, NULL, "effect", MOD_DPAINT_EFFECT_DO_SHRINK);
	RNA_def_property_ui_text(prop, "Use Shrink", "Process shrink effect (shrink paint areas)");
	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_reset");
	
	prop = RNA_def_property(srna, "shrink_speed", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "shrink_speed");
	RNA_def_property_range(prop, 0.001, 10.0);
	RNA_def_property_ui_range(prop, 0.01, 5.0, 1, 2);
	RNA_def_property_ui_text(prop, "Shrink Speed", "How fast shrink effect moves on the canvas surface");

	prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
	RNA_def_property_struct_type(prop, "EffectorWeights");
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Effector Weights", "");

	prop = RNA_def_property(srna, "drip_velocity", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "drip_vel");
	RNA_def_property_range(prop, -200.0f, 200.0f);
	RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
	RNA_def_property_ui_text(prop, "Velocity", "How much surface velocity affects dripping");

	prop = RNA_def_property(srna, "drip_acceleration", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "drip_acc");
	RNA_def_property_range(prop, -200.0f, 200.0f);
	RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
	RNA_def_property_ui_text(prop, "Acceleration", "How much surface acceleration affects dripping");

	/*
	 *   Output settings
	 */
	prop = RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_MULALPHA);
	RNA_def_property_ui_text(prop, "Premultiply alpha", "Multiply color by alpha (recommended for Blender input)");
	
	prop = RNA_def_property(srna, "image_output_path", PROP_STRING, PROP_DIRPATH);
	RNA_def_property_string_sdna(prop, NULL, "image_output_path");
	RNA_def_property_ui_text(prop, "Output Path", "Directory to save the textures");

	/* output for primary surface data */
	prop = RNA_def_property(srna, "output_name_a", PROP_STRING, PROP_NONE);
	RNA_def_property_string_sdna(prop, NULL, "output_name");
	RNA_def_property_ui_text(prop, "Output Name", "Name used to save output from this surface");

	prop = RNA_def_property(srna, "use_output_a", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_OUT1);
	RNA_def_property_ui_text(prop, "Use Output", "Save this output layer");

	/* output for secondary sufrace data */
	prop = RNA_def_property(srna, "output_name_b", PROP_STRING, PROP_NONE);
	RNA_def_property_string_sdna(prop, NULL, "output_name2");
	RNA_def_property_ui_text(prop, "Output Name", "Name used to save output from this surface");

	prop = RNA_def_property(srna, "use_output_b", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_OUT2);
	RNA_def_property_ui_text(prop, "Use Output", "Save this output layer");

	prop = RNA_def_property(srna, "preview_id", PROP_ENUM, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
	RNA_def_property_enum_sdna(prop, NULL, "preview_id");
	RNA_def_property_enum_items(prop, prop_dynamicpaint_surface_preview);
	RNA_def_property_ui_text(prop, "Preview", "");
	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");

	/* to check if output name exists */
	func = RNA_def_function(srna, "output_exists", "rna_DynamicPaint_is_output_exists");
	RNA_def_function_ui_description(func, "Checks if surface output layer of given name exists");
	parm = RNA_def_pointer(func, "object", "Object", "", "");
	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
	parm = RNA_def_int(func, "index", 0, 0, 1, "Index", "", 0, 1);
	RNA_def_property_flag(parm, PROP_REQUIRED);
	/* return type */
	parm = RNA_def_boolean(func, "exists", 0, "", "");
	RNA_def_function_return(func, parm);
	
	prop = RNA_def_property(srna, "depth_clamp", PROP_FLOAT, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
	RNA_def_property_range(prop, 0.00, 50.0);
	RNA_def_property_ui_range(prop, 0.00, 5.0, 1, 2);
	RNA_def_property_ui_text(prop, "Max Displace",
	                         "Maximum level of depth intersection in object space (use 0.0 to disable)");
	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");

	prop = RNA_def_property(srna, "displace_factor", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "disp_factor");
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
	RNA_def_property_range(prop, -50.0, 50.0);
	RNA_def_property_ui_range(prop, -5.0, 5.0, 1, 2);
	RNA_def_property_ui_text(prop, "Displace Factor", "Strength of displace when applied to the mesh");
	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
	
	prop = RNA_def_property(srna, "image_fileformat", PROP_ENUM, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
	RNA_def_property_enum_items(prop, prop_dynamicpaint_image_fileformat);
	RNA_def_property_ui_text(prop, "File Format", "");
	
	prop = RNA_def_property(srna, "displace_type", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "disp_type");
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
	RNA_def_property_enum_items(prop, prop_dynamicpaint_displace_type);
	RNA_def_property_ui_text(prop, "Data Type", "");

	prop = RNA_def_property(srna, "use_incremental_displace", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DISP_INCREMENTAL);
	RNA_def_property_ui_text(prop, "Incremental", "New displace is added cumulatively on top of existing");
	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_reset");

	/* wave simulator settings */
	prop = RNA_def_property(srna, "wave_damping", PROP_FLOAT, PROP_NONE);
	RNA_def_property_range(prop, 0.0, 1.0);
	RNA_def_property_ui_range(prop, 0.01, 1.0, 1, 2);
	RNA_def_property_ui_text(prop, "Damping", "Wave damping factor");

	prop = RNA_def_property(srna, "wave_speed", PROP_FLOAT, PROP_NONE);
	RNA_def_property_range(prop, 0.01, 5.0);
	RNA_def_property_ui_range(prop, 0.20, 4.0, 1, 2);
	RNA_def_property_ui_text(prop, "Speed", "Wave propagation speed");

	prop = RNA_def_property(srna, "wave_timescale", PROP_FLOAT, PROP_NONE);
	RNA_def_property_range(prop, 0.01, 3.0);
	RNA_def_property_ui_range(prop, 0.01, 1.5, 1, 2);
	RNA_def_property_ui_text(prop, "Timescale", "Wave time scaling factor");

	prop = RNA_def_property(srna, "wave_spring", PROP_FLOAT, PROP_NONE);
	RNA_def_property_range(prop, 0.0, 1.0);
	RNA_def_property_ui_range(prop, 0.01, 1.0, 1, 2);
	RNA_def_property_ui_text(prop, "Spring", "Spring force that pulls water level back to zero");

	prop = RNA_def_property(srna, "use_wave_open_border", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_WAVE_OPEN_BORDERS);
	RNA_def_property_ui_text(prop, "Open Borders", "Pass waves through mesh edges");

	
	/* cache */
	prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
	RNA_def_property_flag(prop, PROP_NEVER_NULL);
	RNA_def_property_pointer_sdna(prop, NULL, "pointcache");
	RNA_def_property_ui_text(prop, "Point Cache", "");

	/* is cache used */
	prop = RNA_def_property(srna, "is_cache_user", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_funcs(prop, "rna_DynamicPaint_is_cache_user_get", NULL);
	RNA_def_property_ui_text(prop, "Use Cache", "");
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);

	/* whether this surface has preview data for 3D view */
	RNA_define_verify_sdna(FALSE);
	prop = RNA_def_property(srna, "use_color_preview", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_funcs(prop, "rna_DynamicPaint_use_color_preview_get", NULL);
	RNA_def_property_ui_text(prop, "Use Color Preview", "Whether this surface has some color preview for 3D view");
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
	RNA_define_verify_sdna(TRUE);
}
コード例 #2
0
static void rna_def_armature(BlenderRNA *brna)
{
    StructRNA *srna;
    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", "Uses Blender's armature vertex deformation"},
        {ARM_VDEF_BGE_CPU, "BGE_CPU", 0, "BGE", "Uses 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");

    /* 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, 0, "rna_Armature_bones_next", 0, 0, 0, 0, 0);
    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, "vert_deformer", 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", "");
    RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
    RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);

// XXX depreceated ....... 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 depreceated ....... 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 temporaral 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 depreceated ....... 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 depreceated ....... old animviz for armatures only

    /* deformflag */
    prop= RNA_def_property(srna, "use_deform_vertex_groups", PROP_BOOLEAN, PROP_NONE);
    RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_VGROUP);
    RNA_def_property_ui_text(prop, "Deform Vertex Groups", "Enable Vertex Groups when defining deform");
    RNA_def_property_update(prop, 0, "rna_Armature_update_data");

    prop= RNA_def_property(srna, "use_deform_envelopes", PROP_BOOLEAN, PROP_NONE);
    RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_ENVELOPE);
    RNA_def_property_ui_text(prop, "Deform Envelopes", "Enable Bone Envelopes when defining deform");
    RNA_def_property_update(prop, 0, "rna_Armature_update_data");

    prop= RNA_def_property(srna, "use_deform_preserve_volume", PROP_BOOLEAN, PROP_NONE);
    RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_QUATERNION);
    RNA_def_property_ui_text(prop, "Use Dual Quaternion Deformation", "Enable deform rotation with Quaternions");
    RNA_def_property_update(prop, 0, "rna_Armature_update_data");

    //prop= RNA_def_property(srna, "deform_invert_vertexgroups", PROP_BOOLEAN, PROP_NONE);
    //RNA_def_property_boolean_negative_sdna(prop, NULL, "deformflag", ARM_DEF_INVERT_VGROUP);
    //RNA_def_property_ui_text(prop, "Invert Vertex Group Influence", "Invert Vertex Group influence (only for Modifiers)");
    //RNA_def_property_update(prop, 0, "rna_Armature_update_data");

    /* Number fields */
// XXX depreceated ....... 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 depreceated ....... old animviz for armatures only
}
コード例 #3
0
ファイル: rna_rigidbody.c プロジェクト: 244xiao/blender
static void rna_def_rigidbody_object(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;
	
	
	srna = RNA_def_struct(brna, "RigidBodyObject", NULL);
	RNA_def_struct_sdna(srna, "RigidBodyOb");
	RNA_def_struct_ui_text(srna, "Rigid Body Object", "Settings for object participating in Rigid Body Simulation");
	RNA_def_struct_path_func(srna, "rna_RigidBodyOb_path");
	
	/* Enums */
	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "type");
	RNA_def_property_enum_items(prop, rigidbody_object_type_items);
	RNA_def_property_enum_funcs(prop, NULL, "rna_RigidBodyOb_type_set", NULL);
	RNA_def_property_ui_text(prop, "Type", "Role of object in Rigid Body Simulations");
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
	RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
	
	/* booleans */
	prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", RBO_FLAG_DISABLED);
	RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyOb_disabled_set");
	RNA_def_property_ui_text(prop, "Enabled", "Rigid Body actively participates to the simulation");
	RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
	
	prop = RNA_def_property(srna, "collision_shape", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "shape");
	RNA_def_property_enum_items(prop, rigidbody_object_shape_items);
	RNA_def_property_ui_text(prop, "Collision Shape", "Collision Shape of object in Rigid Body Simulations");
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
	RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
	
	prop = RNA_def_property(srna, "kinematic", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", RBO_FLAG_KINEMATIC);
	RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyOb_kinematic_state_set");
	RNA_def_property_ui_text(prop, "Kinematic", "Allow rigid body to be controlled by the animation system");
	RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
	
	/* Physics Parameters */
	prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_UNIT_MASS);
	RNA_def_property_float_sdna(prop, NULL, "mass");
	RNA_def_property_range(prop, 0.001f, FLT_MAX); // range must always be positive (and non-zero)
	RNA_def_property_float_default(prop, 1.0f);
	RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_mass_set", NULL);
	RNA_def_property_ui_text(prop, "Mass", "How much the object 'weighs' irrespective of gravity");
	RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
	
	/* Dynamics Parameters - Activation */
	// TODO: define and figure out how to implement these
	
	/* Dynamics Parameters - Deactivation */
	prop = RNA_def_property(srna, "use_deactivation", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", RBO_FLAG_USE_DEACTIVATION);
	RNA_def_property_boolean_default(prop, TRUE);
	RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyOb_activation_state_set");
	RNA_def_property_ui_text(prop, "Enable Deactivation",
	                         "Enable deactivation of resting rigid bodies (increases performance and stability "
	                         "but can cause glitches)");
	RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
	
	prop = RNA_def_property(srna, "use_start_deactivated", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", RBO_FLAG_START_DEACTIVATED);
	RNA_def_property_ui_text(prop, "Start Deactivated", "Deactivate rigid body at the start of the simulation");
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
	RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
	
	prop = RNA_def_property(srna, "deactivate_linear_velocity", PROP_FLOAT, PROP_UNIT_VELOCITY);
	RNA_def_property_float_sdna(prop, NULL, "lin_sleep_thresh");
	RNA_def_property_range(prop, FLT_MIN, FLT_MAX); // range must always be positive (and non-zero)
	RNA_def_property_float_default(prop, 0.4f);
	RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_linear_sleepThresh_set", NULL);
	RNA_def_property_ui_text(prop, "Linear Velocity Deactivation Threshold",
	                         "Linear Velocity below which simulation stops simulating object");
	RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
	
	prop = RNA_def_property(srna, "deactivate_angular_velocity", PROP_FLOAT, PROP_UNIT_VELOCITY);
	RNA_def_property_float_sdna(prop, NULL, "ang_sleep_thresh");
	RNA_def_property_range(prop, FLT_MIN, FLT_MAX); // range must always be positive (and non-zero)
	RNA_def_property_float_default(prop, 0.5f);
	RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_angular_sleepThresh_set", NULL);
	RNA_def_property_ui_text(prop, "Angular Velocity Deactivation Threshold",
	                         "Angular Velocity below which simulation stops simulating object");
	RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
	
	/* Dynamics Parameters - Damping Parameters */
	prop = RNA_def_property(srna, "linear_damping", PROP_FLOAT, PROP_FACTOR);
	RNA_def_property_float_sdna(prop, NULL, "lin_damping");
	RNA_def_property_range(prop, 0.0f, 1.0f);
	RNA_def_property_float_default(prop, 0.04f);
	RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_linear_damping_set", NULL);
	RNA_def_property_ui_text(prop, "Linear Damping", "Amount of linear velocity that is lost over time");
	RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
	
	prop = RNA_def_property(srna, "angular_damping", PROP_FLOAT, PROP_FACTOR);
	RNA_def_property_float_sdna(prop, NULL, "ang_damping");
	RNA_def_property_range(prop, 0.0f, 1.0f);
	RNA_def_property_float_default(prop, 0.1f);
	RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_angular_damping_set", NULL);
	RNA_def_property_ui_text(prop, "Angular Damping", "Amount of angular velocity that is lost over time");
	RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
	
	/* Collision Parameters - Surface Parameters */
	prop = RNA_def_property(srna, "friction", PROP_FLOAT, PROP_FACTOR);
	RNA_def_property_float_sdna(prop, NULL, "friction");
	RNA_def_property_range(prop, 0.0f, FLT_MAX);
	RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 3);
	RNA_def_property_float_default(prop, 0.5f);
	RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_friction_set", NULL);
	RNA_def_property_ui_text(prop, "Friction", "Resistance of object to movement");
	RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
	
	prop = RNA_def_property(srna, "restitution", PROP_FLOAT, PROP_FACTOR);
	RNA_def_property_float_sdna(prop, NULL, "restitution");
	RNA_def_property_range(prop, 0.0f, FLT_MAX);
	RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 3);
	RNA_def_property_float_default(prop, 0.0f);
	RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_restitution_set", NULL);
	RNA_def_property_ui_text(prop, "Restitution",
	                         "Tendency of object to bounce after colliding with another "
	                         "(0 = stays still, 1 = perfectly elastic)");
	RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
	
	/* Collision Parameters - Sensitivity */
	prop = RNA_def_property(srna, "use_margin", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", RBO_FLAG_USE_MARGIN);
	RNA_def_property_boolean_default(prop, FALSE);
	RNA_def_property_ui_text(prop, "Collision Margin",
	                         "Use custom collision margin (some shapes will have a visible gap around them)");
	RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_shape_reset");
	
	prop = RNA_def_property(srna, "collision_margin", PROP_FLOAT, PROP_UNIT_LENGTH);
	RNA_def_property_float_sdna(prop, NULL, "margin");
	RNA_def_property_range(prop, 0.0f, 1.0f);
	RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01, 3);
	RNA_def_property_float_default(prop, 0.04f);
	RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_collision_margin_set", NULL);
	RNA_def_property_ui_text(prop, "Collision Margin",
	                         "Threshold of distance near surface where collisions are still considered "
	                         "(best results when non-zero)");
	RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_shape_reset");
	
	prop = RNA_def_property(srna, "collision_groups", PROP_BOOLEAN, PROP_LAYER_MEMBER);
	RNA_def_property_boolean_sdna(prop, NULL, "col_groups", 1);
	RNA_def_property_array(prop, 20);
	RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyOb_collision_groups_set");
	RNA_def_property_ui_text(prop, "Collision Groups", "Collision Groups Rigid Body belongs to");
	RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
}
コード例 #4
0
static void rna_def_property(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;
	static EnumPropertyItem subtype_items[] = {
		{PROP_NONE, "NONE", 0, "None", ""},
		{PROP_FILEPATH, "FILE_PATH", 0, "File Path", ""},
		{PROP_DIRPATH, "DIRECTORY_PATH", 0, "Directory Path", ""},
		{PROP_UNSIGNED, "UNSIGNED", 0, "Unsigned Number", ""},
		{PROP_PERCENTAGE, "PERCENTAGE", 0, "Percentage", ""},
		{PROP_FACTOR, "FACTOR", 0, "Factor", ""},
		{PROP_ANGLE, "ANGLE", 0, "Angle", ""},
		{PROP_TIME, "TIME", 0, "Time", ""},
		{PROP_DISTANCE, "DISTANCE", 0, "Distance", ""},
		{PROP_COLOR, "COLOR", 0, "Color", ""},
		{PROP_TRANSLATION, "TRANSLATION", 0, "Translation", ""},
		{PROP_DIRECTION, "DIRECTION", 0, "Direction", ""},
		{PROP_MATRIX, "MATRIX", 0, "Matrix", ""},
		{PROP_EULER, "EULER", 0, "Euler", ""},
		{PROP_QUATERNION, "QUATERNION", 0, "Quaternion", ""},
		{PROP_XYZ, "XYZ", 0, "XYZ", ""},
		{PROP_COLOR_GAMMA, "COLOR_GAMMA", 0, "Gamma Corrected Color", ""},
		{PROP_LAYER, "LAYER", 0, "Layer", ""},
		{PROP_LAYER_MEMBER, "LAYER_MEMBERSHIP", 0, "Layer Membership", ""},
		{0, NULL, 0, NULL, NULL}};

	srna= RNA_def_struct(brna, "Property", NULL);
	RNA_def_struct_ui_text(srna, "Property Definition", "RNA property definition");
	RNA_def_struct_refine_func(srna, "rna_Property_refine");
	RNA_def_struct_ui_icon(srna, ICON_RNA);

	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_string_funcs(prop, "rna_Property_name_get", "rna_Property_name_length", NULL);
	RNA_def_property_ui_text(prop, "Name", "Human readable name");

	prop= RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_string_funcs(prop, "rna_Property_identifier_get", "rna_Property_identifier_length", NULL);
	RNA_def_property_ui_text(prop, "Identifier", "Unique name used in the code and scripting");
	RNA_def_struct_name_property(srna, prop);
		
	prop= RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_string_funcs(prop, "rna_Property_description_get", "rna_Property_description_length", NULL);
	RNA_def_property_ui_text(prop, "Description", "Description of the property for tooltips");

	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_enum_items(prop, property_type_items);
	RNA_def_property_enum_funcs(prop, "rna_Property_type_get", NULL, NULL);
	RNA_def_property_ui_text(prop, "Type", "Data type of the property");

	prop= RNA_def_property(srna, "subtype", PROP_ENUM, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_enum_items(prop, subtype_items);
	RNA_def_property_enum_funcs(prop, "rna_Property_subtype_get", NULL, NULL);
	RNA_def_property_ui_text(prop, "Subtype", "Semantic interpretation of the property");

	prop= RNA_def_property(srna, "srna", PROP_POINTER, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_struct_type(prop, "Struct");
	RNA_def_property_pointer_funcs(prop, "rna_Property_srna_get", NULL, NULL, NULL);
	RNA_def_property_ui_text(prop, "Base", "Struct definition used for properties assigned to this item");

	prop= RNA_def_property(srna, "unit", PROP_ENUM, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_enum_items(prop, property_unit_items);
	RNA_def_property_enum_funcs(prop, "rna_Property_unit_get", NULL, NULL);
	RNA_def_property_ui_text(prop, "Unit", "Type of units for this property");

	prop= RNA_def_property(srna, "is_readonly", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_boolean_funcs(prop, "rna_Property_readonly_get", NULL);
	RNA_def_property_ui_text(prop, "Read Only", "Property is editable through RNA");

	prop= RNA_def_property(srna, "is_required", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_boolean_funcs(prop, "rna_Property_is_required_get", NULL);
	RNA_def_property_ui_text(prop, "Required", "False when this property is an optional argument in an RNA function");

	prop= RNA_def_property(srna, "is_never_none", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_boolean_funcs(prop, "rna_Property_is_never_none_get", NULL);
	RNA_def_property_ui_text(prop, "Never None", "True when this value can't be set to None");

	prop= RNA_def_property(srna, "is_hidden", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_boolean_funcs(prop, "rna_Property_is_hidden_get", NULL);
	RNA_def_property_ui_text(prop, "Hidden", "True when the property is hidden");

	prop= RNA_def_property(srna, "is_output", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_boolean_funcs(prop, "rna_Property_use_output_get", NULL);
	RNA_def_property_ui_text(prop, "Return", "True when this property is an output value from an RNA function");

	prop= RNA_def_property(srna, "is_registered", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_boolean_funcs(prop, "rna_Property_registered_get", NULL);
	RNA_def_property_ui_text(prop, "Registered", "Property is registered as part of type registration");

	prop= RNA_def_property(srna, "is_registered_optional", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_boolean_funcs(prop, "rna_Property_registered_optional_get", NULL);
	RNA_def_property_ui_text(prop, "Registered Optionally", "Property is optionally registered as part of type registration");
	
	prop= RNA_def_property(srna, "is_runtime", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_boolean_funcs(prop, "rna_Property_runtime_get", NULL);
	RNA_def_property_ui_text(prop, "Read Only", "Property is editable through RNA");

	prop= RNA_def_property(srna, "is_enum_flag", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_boolean_funcs(prop, "rna_Property_is_enum_flag_get", NULL);
	RNA_def_property_ui_text(prop, "Enum Flag", "True when multiple enums ");
}
コード例 #5
0
ファイル: rna_color.c プロジェクト: akonneker/blensor
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");
}
コード例 #6
0
static void rna_def_image(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;
	static const EnumPropertyItem prop_type_items[]= {
		{IMA_TYPE_IMAGE, "IMAGE", 0, "Image", ""},
		{IMA_TYPE_MULTILAYER, "MULTILAYER", 0, "Multilayer", ""},
		{IMA_TYPE_UV_TEST, "UV_TEST", 0, "UV Test", ""},
		{IMA_TYPE_R_RESULT, "RENDER_RESULT", 0, "Render Result", ""},
		{IMA_TYPE_COMPOSITE, "COMPOSITING", 0, "Compositing", ""},
		{0, NULL, 0, NULL, NULL}};
	static const EnumPropertyItem prop_generated_type_items[]= {
		{0, "BLANK", 0, "Blank", "Generate a blank image"},
		{1, "UV_GRID", 0, "UV Grid", "Generated grid to test UV mappings"},
		{2, "COLOR_GRID", 0, "Color Grid", "Generated improved UV grid to test UV mappings"},
		{0, NULL, 0, NULL, NULL}};
	static const EnumPropertyItem prop_mapping_items[]= {
		{0, "UV", 0, "UV Coordinates", "Use UV coordinates for mapping the image"},
		{IMA_REFLECT, "REFLECTION", 0, "Reflection", "Use reflection mapping for mapping the image"},
		{0, NULL, 0, NULL, NULL}};
	static const EnumPropertyItem prop_field_order_items[]= {
		{0, "EVEN", 0, "Upper First", "Upper field first"},
		{IMA_STD_FIELD, "ODD", 0, "Lower First", "Lower field first"},
		{0, NULL, 0, NULL, NULL}};

	srna= RNA_def_struct(brna, "Image", "ID");
	RNA_def_struct_ui_text(srna, "Image", "Image datablock referencing an external or packed image");
	RNA_def_struct_ui_icon(srna, ICON_IMAGE_DATA);

	prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
	RNA_def_property_string_sdna(prop, NULL, "name");
	RNA_def_property_ui_text(prop, "File Name", "Image/Movie file name");
	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, "rna_Image_reload_update");

	/* eek. this is horrible but needed so we can save to a new name without blanking the data :( */
	prop= RNA_def_property(srna, "filepath_raw", PROP_STRING, PROP_FILEPATH);
	RNA_def_property_string_sdna(prop, NULL, "name");
	RNA_def_property_ui_text(prop, "File Name", "Image/Movie file name (without data refreshing)");

	prop= RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_items(prop, image_type_items);
	RNA_def_property_enum_funcs(prop, "rna_Image_file_format_get", "rna_Image_file_format_set", NULL);
	RNA_def_property_ui_text(prop, "File Format", "Format used for re-saving this file");

	prop= RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_items(prop, image_source_items);
	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Image_source_itemf");
	RNA_def_property_ui_text(prop, "Source", "Where the image comes from");
	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, "rna_Image_source_update");

	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_items(prop, prop_type_items);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Type", "How to generate the image");
	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);

	prop= RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
	RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
	RNA_def_property_ui_text(prop, "Packed File", "");
	
	prop= RNA_def_property(srna, "field_order", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
	RNA_def_property_enum_items(prop, prop_field_order_items);
	RNA_def_property_ui_text(prop, "Field Order", "Order of video fields. Select which lines are displayed first");
	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
	
	/* booleans */
	prop= RNA_def_property(srna, "use_fields", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_FIELDS);
	RNA_def_property_ui_text(prop, "Fields", "Use fields of the image");
	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, "rna_Image_fields_update");

	prop= RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_DO_PREMUL);
	RNA_def_property_ui_text(prop, "Premultiply", "Convert RGB from key alpha to premultiplied alpha");
	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, "rna_Image_reload_update");

	prop= RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_funcs(prop, "rna_Image_dirty_get", NULL);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Dirty", "Image has changed and is not saved");

	/* generated image (image_generated_change_cb) */
	prop= RNA_def_property(srna, "generated_type", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "gen_type");
	RNA_def_property_enum_items(prop, prop_generated_type_items);
	RNA_def_property_ui_text(prop, "Generated Type", "Generated image type");
	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, "rna_Image_generated_update");

	prop= RNA_def_property(srna, "generated_width", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "gen_x");
	RNA_def_property_range(prop, 1, 16384);
	RNA_def_property_ui_text(prop, "Generated Width", "Generated image width");
	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, "rna_Image_generated_update");

	prop= RNA_def_property(srna, "generated_height", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "gen_y");
	RNA_def_property_range(prop, 1, 16384);
	RNA_def_property_ui_text(prop, "Generated Height", "Generated image height");
	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, "rna_Image_generated_update");

	prop= RNA_def_property(srna, "use_generated_float", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "gen_flag", IMA_GEN_FLOAT);
	RNA_def_property_ui_text(prop, "Float Buffer", "Generate floating point buffer");
	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, "rna_Image_generated_update");

	/* realtime properties */
	prop= RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
	RNA_def_property_enum_items(prop, prop_mapping_items);
	RNA_def_property_ui_text(prop, "Mapping", "Mapping type to use for this image in the game engine");
	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);

	prop= RNA_def_property(srna, "display_aspect", PROP_FLOAT, PROP_XYZ);
	RNA_def_property_float_sdna(prop, NULL, "aspx");
	RNA_def_property_array(prop, 2);
	RNA_def_property_range(prop, 0.1f, 5000.0f);
	RNA_def_property_ui_text(prop, "Display Aspect", "Display Aspect for this image, does not affect rendering");
	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);

	prop= RNA_def_property(srna, "use_animation", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "tpageflag", IMA_TWINANIM);
	RNA_def_property_ui_text(prop, "Animated", "Use as animated texture in the game engine");
	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, "rna_Image_animated_update");

	prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "twsta");
	RNA_def_property_range(prop, 0, 128);
	RNA_def_property_ui_text(prop, "Animation Start", "Start frame of an animated texture");
	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, "rna_Image_animated_update");

	prop= RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "twend");
	RNA_def_property_range(prop, 0, 128);
	RNA_def_property_ui_text(prop, "Animation End", "End frame of an animated texture");
	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, "rna_Image_animated_update");

	prop= RNA_def_property(srna, "fps", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "animspeed");
	RNA_def_property_range(prop, 1, 100);
	RNA_def_property_ui_text(prop, "Animation Speed", "Speed of the animation in frames per second");
	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);

	prop= RNA_def_property(srna, "use_tiles", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "tpageflag", IMA_TILES);
	RNA_def_property_ui_text(prop, "Tiles", "Use of tilemode for faces (default shift-LMB to pick the tile for selected faces)");
	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);

	prop= RNA_def_property(srna, "tiles_x", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "xrep");
	RNA_def_property_range(prop, 1, 16);
	RNA_def_property_ui_text(prop, "Tiles X", "Degree of repetition in the X direction");
	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);

	prop= RNA_def_property(srna, "tiles_y", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "yrep");
	RNA_def_property_range(prop, 1, 16);
	RNA_def_property_ui_text(prop, "Tiles Y", "Degree of repetition in the Y direction");
	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);

	prop= RNA_def_property(srna, "use_clamp_x", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "tpageflag", IMA_CLAMP_U);
	RNA_def_property_ui_text(prop, "Clamp X", "Disable texture repeating horizontally");
	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);

	prop= RNA_def_property(srna, "use_clamp_y", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "tpageflag", IMA_CLAMP_V);
	RNA_def_property_ui_text(prop, "Clamp Y", "Disable texture repeating vertically");
	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);

	prop= RNA_def_property(srna, "bindcode", PROP_INT, PROP_UNSIGNED);
	RNA_def_property_int_sdna(prop, NULL, "bindcode");
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Bindcode", "OpenGL bindcode");
	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);

	/*
	   Image.has_data and Image.depth are temporary,
	   Update import_obj.py when they are replaced (Arystan)
	*/
	prop= RNA_def_property(srna, "has_data", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_funcs(prop, "rna_Image_has_data_get", NULL);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Has data", "True if this image has data");

	prop= RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
	RNA_def_property_int_funcs(prop, "rna_Image_depth_get", NULL, NULL);
	RNA_def_property_ui_text(prop, "Depth", "Image bit depth");
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);

	prop= RNA_def_int_vector(srna, "size" , 2 , NULL , 0, 0, "Size" , "Width and height in pixels, zero when image data cant be loaded" , 0 , 0);
	RNA_def_property_int_funcs(prop, "rna_Image_size_get" , NULL, NULL);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);

	prop= RNA_def_float_vector(srna, "resolution" , 2 , NULL , 0, 0, "Resolution" , "X/Y pixels per meter" , 0 , 0);
	RNA_def_property_float_funcs(prop, "rna_Image_resolution_get" , "rna_Image_resolution_set", NULL);

	prop= RNA_def_property(srna, "pixels", 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, "Pixels", "Image pixels in floating point values");
	RNA_def_property_dynamic_array_funcs(prop, "rna_Image_pixels_get_length");
	RNA_def_property_float_funcs(prop, "rna_Image_pixels_get", "rna_Image_pixels_set", NULL);

	RNA_api_image(srna);
}
コード例 #7
0
static void rna_def_nlastrip(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;
	
		/* enum defs */
	static EnumPropertyItem prop_type_items[] = {
		{NLASTRIP_TYPE_CLIP, "CLIP", 0, "Action Clip", "NLA Strip references some Action"},
		{NLASTRIP_TYPE_TRANSITION, "TRANSITION", 0, "Transition", "NLA Strip 'transitions' between adjacent strips"},
		{NLASTRIP_TYPE_META, "META", 0, "Meta", "NLA Strip acts as a container for adjacent strips"},
		{0, NULL, 0, NULL, NULL}};
	
	/* struct definition */
	srna= RNA_def_struct(brna, "NlaStrip", NULL);
	RNA_def_struct_ui_text(srna, "NLA Strip", "A container referencing an existing Action");
	RNA_def_struct_path_func(srna, "rna_NlaStrip_path");
	RNA_def_struct_ui_icon(srna, ICON_NLA); // XXX
	
	/* name property */
	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
	RNA_def_property_ui_text(prop, "Name", "");
	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_NlaStrip_name_set");
	RNA_def_struct_name_property(srna, prop);
	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
	
	/* Enums */
	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "type");
	RNA_def_property_clear_flag(prop, PROP_EDITABLE); // XXX for now, not editable, since this is dangerous
	RNA_def_property_enum_items(prop, prop_type_items);
	RNA_def_property_ui_text(prop, "Type", "Type of NLA Strip");
	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
	
	prop= RNA_def_property(srna, "extrapolation", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "extendmode");
	RNA_def_property_enum_items(prop, nla_mode_extend_items);
	RNA_def_property_ui_text(prop, "Extrapolation", "Action to take for gaps past the strip extents");
	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
	
	prop= RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "blendmode");
	RNA_def_property_enum_items(prop, nla_mode_blend_items);
	RNA_def_property_ui_text(prop, "Blending", "Method used for combining strip's result with accumulated result");
	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
	
	/* Strip extents */
	prop= RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_TIME);
	RNA_def_property_float_sdna(prop, NULL, "start");
	RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_start_frame_set", NULL);
	RNA_def_property_ui_text(prop, "Start Frame", "");
	RNA_def_property_update(prop, 0, "rna_NlaStrip_transform_update");
	
	prop= RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_TIME);
	RNA_def_property_float_sdna(prop, NULL, "end");
	RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_end_frame_set", NULL);
	RNA_def_property_ui_text(prop, "End Frame", "");
	RNA_def_property_update(prop, 0, "rna_NlaStrip_transform_update");
	
	/* Blending */
	prop= RNA_def_property(srna, "blend_in", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "blendin");
	RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_blend_in_set", NULL);
	RNA_def_property_ui_text(prop, "Blend In", "Number of frames at start of strip to fade in influence");
	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
	
	prop= RNA_def_property(srna, "blend_out", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "blendout");
	RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_blend_out_set", NULL);
	RNA_def_property_ui_text(prop, "Blend Out", "");
	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
	
	prop= RNA_def_property(srna, "use_auto_blend", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_AUTO_BLENDS);
	RNA_def_property_ui_text(prop, "Auto Blend In/Out", "Number of frames for Blending In/Out is automatically determined from overlapping strips");
	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
	
	/* Action */
	prop= RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
	RNA_def_property_pointer_sdna(prop, NULL, "act");
	RNA_def_property_flag(prop, PROP_EDITABLE); 
	RNA_def_property_ui_text(prop, "Action", "Action referenced by this strip");
	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
	
	/* Action extents */
	prop= RNA_def_property(srna, "action_frame_start", PROP_FLOAT, PROP_TIME);
	RNA_def_property_float_sdna(prop, NULL, "actstart");
	RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_action_start_frame_set", NULL);
	RNA_def_property_ui_text(prop, "Action Start Frame", "");
	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
	
	prop= RNA_def_property(srna, "action_frame_end", PROP_FLOAT, PROP_TIME);
	RNA_def_property_float_sdna(prop, NULL, "actend");
	RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_action_end_frame_set", NULL);
	RNA_def_property_ui_text(prop, "Action End Frame", "");
	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
	
	/* Action Reuse */
	prop= RNA_def_property(srna, "repeat", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "repeat"); 
	RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_repeat_set", NULL);
	RNA_def_property_range(prop, 0.1f, 1000.0f); /* these limits have currently be chosen arbitarily, but could be extended (minimum should still be > 0 though) if needed... */
	RNA_def_property_ui_text(prop, "Repeat", "Number of times to repeat the action range");
	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
	
	prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "scale"); 
	RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_scale_set", NULL);
	RNA_def_property_range(prop, 0.0001f, 1000.0f); /* these limits can be extended, but beyond this, we can get some crazy+annoying bugs due to numeric errors */
	RNA_def_property_ui_text(prop, "Scale", "Scaling factor for action");
	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
	
	/* Strip's F-Curves */
	prop= RNA_def_property(srna, "fcurves", PROP_COLLECTION, PROP_NONE);
	RNA_def_property_struct_type(prop, "FCurve");
	RNA_def_property_ui_text(prop, "F-Curves", "F-Curves for controlling the strip's influence and timing");
	
	/* Strip's F-Modifiers */
	prop= RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
	RNA_def_property_struct_type(prop, "FModifier");
	RNA_def_property_ui_text(prop, "Modifiers", "Modifiers affecting all the F-Curves in the referenced Action");
	
	/* Strip's Sub-Strips (for Meta-Strips) */
	prop= RNA_def_property(srna, "strips", PROP_COLLECTION, PROP_NONE);
	RNA_def_property_struct_type(prop, "NlaStrip");
	RNA_def_property_ui_text(prop, "NLA Strips", "NLA Strips that this strip acts as a container for (if it is of type Meta)");
	
	/* Settings - Values necessary for evaluation */
	prop= RNA_def_property(srna, "influence", PROP_FLOAT, PROP_NONE);
	RNA_def_property_range(prop, 0.0f, 1.0f);
	RNA_def_property_ui_text(prop, "Influence", "Amount the strip contributes to the current result");
	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
	
	prop= RNA_def_property(srna, "strip_time", PROP_FLOAT, PROP_TIME);
	RNA_def_property_ui_text(prop, "Strip Time", "Frame of referenced Action to evaluate");
	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
	
		// TODO: should the animated_influence/time settings be animatable themselves?
	prop= RNA_def_property(srna, "use_animated_influence", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_USR_INFLUENCE);
	RNA_def_property_boolean_funcs(prop, NULL, "rna_NlaStrip_animated_influence_set");
	RNA_def_property_ui_text(prop, "Animated Influence", "Influence setting is controlled by an F-Curve rather than automatically determined");
	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
	
	prop= RNA_def_property(srna, "use_animated_time", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_USR_TIME);
	RNA_def_property_boolean_funcs(prop, NULL, "rna_NlaStrip_animated_time_set");
	RNA_def_property_ui_text(prop, "Animated Strip Time", "Strip time is controlled by an F-Curve rather than automatically determined");
	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
	
	prop= RNA_def_property(srna, "use_animated_time_cyclic", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_USR_TIME_CYCLIC);
	RNA_def_property_ui_text(prop, "Cyclic Strip Time", "Cycle the animated time within the action start & end");
	RNA_def_property_update(prop, 0, "rna_NlaStrip_transform_update"); // is there a better update flag?
	
	/* settings */
	prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* can be made editable by hooking it up to the necessary NLA API methods */
	RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_ACTIVE);
	RNA_def_property_ui_text(prop, "Active", "NLA Strip is active");
	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
	
	prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_SELECT);
	RNA_def_property_ui_text(prop, "Select", "NLA Strip is selected");
	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
	
	prop= RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_MUTED);
	RNA_def_property_ui_text(prop, "Muted", "NLA Strip is not evaluated");
	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
	
	prop= RNA_def_property(srna, "use_reverse", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_REVERSE);
	RNA_def_property_ui_text(prop, "Reversed", "NLA Strip is played back in reverse order (only when timing is automatically determined)");
	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
	
	// TODO: 
	// - sync length
}
コード例 #8
0
static void rna_def_text(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;
	
	srna = RNA_def_struct(brna, "Text", "ID");
	RNA_def_struct_ui_text(srna, "Text", "Text datablock referencing an external or packed text file");
	RNA_def_struct_ui_icon(srna, ICON_TEXT);
	RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
	
	prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_NONE);
	RNA_def_property_string_funcs(prop, "rna_Text_filename_get", "rna_Text_filename_length", "rna_Text_filename_set");
	RNA_def_property_ui_text(prop, "File Path", "Filename of the text file");

	prop = RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flags", TXT_ISDIRTY);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Dirty", "Text file has been edited since last save");

	prop = RNA_def_property(srna, "is_modified", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_boolean_funcs(prop, "rna_Text_modified_get", NULL);
	RNA_def_property_ui_text(prop, "Modified", "Text file on disk is different than the one in memory");

	prop = RNA_def_property(srna, "is_in_memory", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flags", TXT_ISMEM);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Memory", "Text file is in memory, without a corresponding file on disk");
	
	prop = RNA_def_property(srna, "use_module", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flags", TXT_ISSCRIPT);
	RNA_def_property_ui_text(prop, "Register",
	                         "Register this text as a module on loading, Text name must end with \".py\"");

	prop = RNA_def_property(srna, "use_tabs_as_spaces", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flags", TXT_TABSTOSPACES);
	RNA_def_property_ui_text(prop, "Tabs as Spaces", "Automatically converts all new tabs into spaces");

	prop = RNA_def_property(srna, "lines", PROP_COLLECTION, PROP_NONE);
	RNA_def_property_struct_type(prop, "TextLine");
	RNA_def_property_ui_text(prop, "Lines", "Lines of text");
	
	prop = RNA_def_property(srna, "current_line", PROP_POINTER, PROP_NONE);
	RNA_def_property_flag(prop, PROP_NEVER_NULL);
	RNA_def_property_pointer_sdna(prop, NULL, "curl");
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_struct_type(prop, "TextLine");
	RNA_def_property_ui_text(prop, "Current Line", "Current line, and start line of selection if one exists");

	prop = RNA_def_property(srna, "current_character", PROP_INT, PROP_UNSIGNED);
	RNA_def_property_int_sdna(prop, NULL, "curc");
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Current Character",
	                         "Index of current character in current line, and also start index of "
	                         "character in selection if one exists");
	
	prop = RNA_def_property(srna, "select_end_line", PROP_POINTER, PROP_NONE);
	RNA_def_property_flag(prop, PROP_NEVER_NULL);
	RNA_def_property_pointer_sdna(prop, NULL, "sell");
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_struct_type(prop, "TextLine");
	RNA_def_property_ui_text(prop, "Selection End Line", "End line of selection");
	
	prop = RNA_def_property(srna, "select_end_character", PROP_INT, PROP_UNSIGNED);
	RNA_def_property_int_sdna(prop, NULL, "selc");
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Selection End Character",
	                         "Index of character after end of selection in the selection end line");
	
	prop = RNA_def_property(srna, "markers", PROP_COLLECTION, PROP_NONE);
	RNA_def_property_struct_type(prop, "TextMarker");
	RNA_def_property_ui_text(prop, "Markers", "Text markers highlighting part of the text");

	RNA_api_text(srna);
}
コード例 #9
0
static void rna_def_screen(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;

	srna = RNA_def_struct(brna, "Screen", "ID");
	RNA_def_struct_sdna(srna, "Screen"); /* it is actually bScreen but for 2.5 the dna is patched! */
	RNA_def_struct_ui_text(srna, "Screen", "Screen datablock, defining the layout of areas in a window");
	RNA_def_struct_ui_icon(srna, ICON_SPLITSCREEN);

	/* pointers */
	prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
	RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
	RNA_def_property_pointer_funcs(prop, NULL, "rna_Screen_scene_set", NULL, NULL);
	RNA_def_property_ui_text(prop, "Scene", "Active scene to be edited in the screen");
	RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
	RNA_def_property_update(prop, 0, "rna_Screen_scene_update");

	/* collections */
	prop = RNA_def_property(srna, "areas", PROP_COLLECTION, PROP_NONE);
	RNA_def_property_collection_sdna(prop, NULL, "areabase", NULL);
	RNA_def_property_struct_type(prop, "Area");
	RNA_def_property_ui_text(prop, "Areas", "Areas the screen is subdivided into");

	/* readonly status indicators */
	prop = RNA_def_property(srna, "is_animation_playing", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_boolean_funcs(prop, "rna_Screen_is_animation_playing_get", NULL);
	RNA_def_property_ui_text(prop, "Animation Playing", "Animation playback is active");

	prop = RNA_def_property(srna, "show_fullscreen", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_boolean_funcs(prop, "rna_Screen_fullscreen_get", NULL);
	RNA_def_property_ui_text(prop, "Maximize", "An area is maximized, filling this screen");

	/* Define Anim Playback Areas */
	prop = RNA_def_property(srna, "use_play_top_left_3d_editor", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_REGION);
	RNA_def_property_ui_text(prop, "Top-Left 3D Editor", "");
	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");

	prop = RNA_def_property(srna, "use_play_3d_editors", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_3D_WIN);
	RNA_def_property_ui_text(prop, "All 3D View Editors", "");
	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");

	prop = RNA_def_property(srna, "use_play_animation_editors", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_ANIM_WIN);
	RNA_def_property_ui_text(prop, "Animation Editors", "");
	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");

	prop = RNA_def_property(srna, "use_play_properties_editors", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_BUTS_WIN);
	RNA_def_property_ui_text(prop, "Property Editors", "");
	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");

	prop = RNA_def_property(srna, "use_play_image_editors", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_IMAGE_WIN);
	RNA_def_property_ui_text(prop, "Image Editors", "");
	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");

	prop = RNA_def_property(srna, "use_play_sequence_editors", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_SEQ);
	RNA_def_property_ui_text(prop, "Sequencer Editors", "");
	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");

	prop = RNA_def_property(srna, "use_play_node_editors", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_NODES);
	RNA_def_property_ui_text(prop, "Node Editors", "");
	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");

	prop = RNA_def_property(srna, "use_play_clip_editors", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_CLIPS);
	RNA_def_property_ui_text(prop, "Clip Editors", "");
	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
}
コード例 #10
0
ファイル: rna_main.c プロジェクト: Walid-Shouman/Blender
void RNA_def_main(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;
	CollectionDefFunc *func;

	/* plural must match idtypes in readblenentry.c */
	MainCollectionDef lists[] = {
		{"cameras", "Camera", "rna_Main_camera_begin", "Cameras", "Camera datablocks", RNA_def_main_cameras},
		{"scenes", "Scene", "rna_Main_scene_begin", "Scenes", "Scene datablocks", RNA_def_main_scenes},
		{"objects", "Object", "rna_Main_object_begin", "Objects", "Object datablocks", RNA_def_main_objects},
		{"materials", "Material", "rna_Main_mat_begin", "Materials", "Material datablocks", RNA_def_main_materials},
		{"node_groups", "NodeTree", "rna_Main_nodetree_begin", "Node Groups", "Node group datablocks", RNA_def_main_node_groups},
		{"meshes", "Mesh", "rna_Main_mesh_begin", "Meshes", "Mesh datablocks", RNA_def_main_meshes},
		{"lamps", "Lamp", "rna_Main_lamp_begin", "Lamps", "Lamp datablocks", RNA_def_main_lamps},
		{"libraries", "Library", "rna_Main_library_begin", "Libraries", "Library datablocks", RNA_def_main_libraries},
		{"screens", "Screen", "rna_Main_screen_begin", "Screens", "Screen datablocks", RNA_def_main_screens},
		{"window_managers", "WindowManager", "rna_Main_wm_begin", "Window Managers", "Window manager datablocks", RNA_def_main_window_managers},
		{"images", "Image", "rna_Main_image_begin", "Images", "Image datablocks", RNA_def_main_images},
		{"lattices", "Lattice", "rna_Main_latt_begin", "Lattices", "Lattice datablocks", RNA_def_main_lattices},
		{"curves", "Curve", "rna_Main_curve_begin", "Curves", "Curve datablocks", RNA_def_main_curves},
		{"metaballs", "MetaBall", "rna_Main_mball_begin", "Metaballs", "Metaball datablocks", RNA_def_main_metaballs},
		{"fonts", "VectorFont", "rna_Main_font_begin", "Vector Fonts", "Vector font datablocks", RNA_def_main_fonts},
		{"textures", "Texture", "rna_Main_tex_begin", "Textures", "Texture datablocks", RNA_def_main_textures},
		{"brushes", "Brush", "rna_Main_brush_begin", "Brushes", "Brush datablocks", RNA_def_main_brushes},
		{"worlds", "World", "rna_Main_world_begin", "Worlds", "World datablocks", RNA_def_main_worlds},
		{"groups", "Group", "rna_Main_group_begin", "Groups", "Group datablocks", RNA_def_main_groups},
		{"shape_keys", "Key", "rna_Main_key_begin", "Shape Keys", "Shape Key datablocks", NULL},
		{"scripts", "ID", "rna_Main_script_begin", "Scripts", "Script datablocks (DEPRECATED)", NULL},
		{"texts", "Text", "rna_Main_text_begin", "Texts", "Text datablocks", RNA_def_main_texts},
		{"speakers", "Speaker", "rna_Main_speaker_begin", "Speakers", "Speaker datablocks", RNA_def_main_speakers},
		{"sounds", "Sound", "rna_Main_sound_begin", "Sounds", "Sound datablocks", RNA_def_main_sounds},
		{"armatures", "Armature", "rna_Main_armature_begin", "Armatures", "Armature datablocks", RNA_def_main_armatures},
		{"actions", "Action", "rna_Main_action_begin", "Actions", "Action datablocks", RNA_def_main_actions},
		{"particles", "ParticleSettings", "rna_Main_particle_begin", "Particles", "Particle datablocks", RNA_def_main_particles},
		{"grease_pencil", "GreasePencil", "rna_Main_gpencil_begin", "Grease Pencil", "Grease Pencil datablocks", RNA_def_main_gpencil},
		{"movieclips", "MovieClip", "rna_Main_movieclips_begin", "Movie Clips", "Movie Clip datablocks", RNA_def_main_movieclips},
		{"masks", "Mask", "rna_Main_masks_begin", "Masks", "Masks datablocks", RNA_def_main_masks},
		{"linestyles", "FreestyleLineStyle", "rna_Main_linestyle_begin", "Line Styles", "Line Style datablocks", RNA_def_main_linestyles},
		{NULL, NULL, NULL, NULL, NULL, NULL}
	};

	int i;
	
	srna = RNA_def_struct(brna, "BlendData", NULL);
	RNA_def_struct_ui_text(srna, "Blendfile Data",
	                       "Main data structure representing a .blend file and all its datablocks");
	RNA_def_struct_ui_icon(srna, ICON_BLENDER);

	prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
	RNA_def_property_string_maxlength(prop, FILE_MAX);
	RNA_def_property_string_funcs(prop, "rna_Main_filepath_get", "rna_Main_filepath_length", "rna_Main_filepath_set");
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Filename", "Path to the .blend file");
	
	prop = RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_boolean_funcs(prop, "rna_Main_is_dirty_get", NULL);
	RNA_def_property_ui_text(prop, "File Has Unsaved Changes", "Have recent edits been saved to disk");

	prop = RNA_def_property(srna, "is_saved", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_boolean_funcs(prop, "rna_Main_is_saved_get", NULL);
	RNA_def_property_ui_text(prop, "File is Saved", "Has the current session been saved to disk as a .blend file");

	prop = RNA_def_property(srna, "use_autopack", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_funcs(prop, "rna_Main_use_autopack_get", "rna_Main_use_autopack_set");
	RNA_def_property_ui_text(prop, "Use Autopack", "Automatically pack all external data into .blend file");

	for (i = 0; lists[i].name; i++) {
		prop = RNA_def_property(srna, lists[i].identifier, PROP_COLLECTION, PROP_NONE);
		RNA_def_property_struct_type(prop, lists[i].type);
		RNA_def_property_collection_funcs(prop, lists[i].iter_begin, "rna_iterator_listbase_next",
		                                  "rna_iterator_listbase_end", "rna_iterator_listbase_get",
		                                  NULL, NULL, NULL, NULL);
		RNA_def_property_ui_text(prop, lists[i].name, lists[i].description);

		/* collection functions */
		func = lists[i].func;
		if (func)
			func(brna, prop);
	}

	RNA_api_main(srna);

#ifdef UNIT_TEST

	RNA_define_verify_sdna(0);

	prop = RNA_def_property(srna, "test", PROP_POINTER, PROP_NONE);
	RNA_def_property_struct_type(prop, "Test");
	RNA_def_property_pointer_funcs(prop, "rna_Test_test_get", NULL, NULL, NULL);

	RNA_define_verify_sdna(1);

#endif
}
コード例 #11
0
ファイル: rna_lamp.c プロジェクト: DrangPo/blender
static void rna_def_lamp_shadow(StructRNA *srna, int spot, int area)
{
	PropertyRNA *prop;

	static EnumPropertyItem prop_shadow_items[] = {
		{0, "NOSHADOW", 0, "No Shadow", ""},
		{LA_SHAD_RAY, "RAY_SHADOW", 0, "Ray Shadow", "Use ray tracing for shadow"},
		{0, NULL, 0, NULL, NULL}
	};

	static EnumPropertyItem prop_spot_shadow_items[] = {
		{0, "NOSHADOW", 0, "No Shadow", ""},
		{LA_SHAD_BUF, "BUFFER_SHADOW", 0, "Buffer Shadow", "Let spotlight produce shadows using shadow buffer"},
		{LA_SHAD_RAY, "RAY_SHADOW", 0, "Ray Shadow", "Use ray tracing for shadow"},
		{0, NULL, 0, NULL, NULL}
	};

	static EnumPropertyItem prop_ray_sampling_method_items[] = {
		{LA_SAMP_HALTON, "ADAPTIVE_QMC", 0, "Adaptive QMC", ""},
		{LA_SAMP_HAMMERSLEY, "CONSTANT_QMC", 0, "Constant QMC", ""},
		{0, NULL, 0, NULL, NULL}
	};
	
	static EnumPropertyItem prop_spot_ray_sampling_method_items[] = {
		{LA_SAMP_HALTON, "ADAPTIVE_QMC", 0, "Adaptive QMC", ""},
		{LA_SAMP_HAMMERSLEY, "CONSTANT_QMC", 0, "Constant QMC", ""},
		{LA_SAMP_CONSTANT, "CONSTANT_JITTERED", 0, "Constant Jittered", ""},
		{0, NULL, 0, NULL, NULL}
	};

	static EnumPropertyItem prop_shadbuftype_items[] = {
		{LA_SHADBUF_REGULAR, "REGULAR", 0, "Classical", "Classic shadow buffer"},
		{LA_SHADBUF_HALFWAY, "HALFWAY", 0, "Classic-Halfway",
		                     "Regular buffer, averaging the closest and 2nd closest Z value to reducing "
		                     "bias artifacts"},
		{LA_SHADBUF_IRREGULAR, "IRREGULAR", 0, "Irregular",
		                       "Irregular buffer produces sharp shadow always, but it doesn't show up for raytracing"},
		{LA_SHADBUF_DEEP, "DEEP", 0, "Deep",
		                  "Deep shadow buffer supports transparency and better filtering, at the cost of "
		                  "more memory usage and processing time"},
		{0, NULL, 0, NULL, NULL}
	};

	static EnumPropertyItem prop_shadbuffiltertype_items[] = {
		{LA_SHADBUF_BOX, "BOX", 0, "Box", "Apply the Box filter to shadow buffer samples"},
		{LA_SHADBUF_TENT, "TENT", 0, "Tent", "Apply the Tent Filter to shadow buffer samples"},
		{LA_SHADBUF_GAUSS, "GAUSS", 0, "Gauss", "Apply the Gauss filter to shadow buffer samples"},
		{0, NULL, 0, NULL, NULL}
	};

	static EnumPropertyItem prop_numbuffer_items[] = {
		{1, "BUFFERS_1", 0, "1", "Only one buffer rendered"},
		{4, "BUFFERS_4", 0, "4", "Render 4 buffers for better AA, this quadruples memory usage"},
		{9, "BUFFERS_9", 0, "9", "Render 9 buffers for better AA, this uses nine times more memory"},
		{0, NULL, 0, NULL, NULL}
	};

	/* GE only */
	static EnumPropertyItem prop_ge_shadowbuffer_type_items[] = {
		{LA_SHADMAP_SIMPLE, "SIMPLE", 0, "Simple", "Simple shadow maps"},
		{LA_SHADMAP_VARIANCE, "VARIANCE", 0, "Variance", "Variance shadow maps"},
		{0, NULL, 0, NULL, NULL}
	};

	prop = RNA_def_property(srna, "use_shadow", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_funcs(prop, "rna_use_shadow_get", "rna_use_shadow_set");
	RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");

	prop = RNA_def_property(srna, "shadow_method", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_bitflag_sdna(prop, NULL, "mode");
	RNA_def_property_enum_items(prop, (spot) ? prop_spot_shadow_items : prop_shadow_items);
	RNA_def_property_update(prop, 0, "rna_Lamp_update");

	prop = RNA_def_property(srna, "shadow_buffer_size", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "bufsize");
	RNA_def_property_range(prop, 128, 10240);
	RNA_def_property_ui_text(prop, "Shadow Buffer Size",
	                         "Resolution of the shadow buffer, higher values give crisper shadows "
	                         "but use more memory");
	RNA_def_property_int_funcs(prop, NULL, "rna_Lamp_buffer_size_set", NULL);
	RNA_def_property_update(prop, 0, "rna_Lamp_update");

	prop = RNA_def_property(srna, "shadow_filter_type", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "filtertype");
	RNA_def_property_enum_items(prop, prop_shadbuffiltertype_items);
	RNA_def_property_ui_text(prop, "Shadow Filter Type", "Type of shadow filter (Buffer Shadows)");
	RNA_def_property_update(prop, 0, "rna_Lamp_update");

	prop = RNA_def_property(srna, "shadow_sample_buffers", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "buffers");
	RNA_def_property_enum_items(prop, prop_numbuffer_items);
	RNA_def_property_ui_text(prop, "Shadow Sample Buffers",
	                         "Number of shadow buffers to render for better AA, this increases memory usage");
	RNA_def_property_update(prop, 0, "rna_Lamp_update");

	prop = RNA_def_property(srna, "shadow_buffer_clip_start", PROP_FLOAT, PROP_DISTANCE);
	RNA_def_property_float_sdna(prop, NULL, "clipsta");
	RNA_def_property_range(prop, 0.0f, 9999.0f);
	RNA_def_property_ui_text(prop, "Shadow Buffer Clip Start",
	                         "Shadow map clip start, below which objects will not generate shadows");
	RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");

	prop = RNA_def_property(srna, "shadow_buffer_clip_end", PROP_FLOAT, PROP_DISTANCE);
	RNA_def_property_float_sdna(prop, NULL, "clipend");
	RNA_def_property_range(prop, 0.0f, 9999.0f);
	RNA_def_property_ui_text(prop, "Shadow Buffer Clip End",
	                         "Shadow map clip end, beyond which objects will not generate shadows");
	RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");

	prop = RNA_def_property(srna, "shadow_buffer_bias", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "bias");
	RNA_def_property_range(prop, 0.001f, 5.0f);
	RNA_def_property_ui_text(prop, "Shadow Buffer Bias", "Shadow buffer sampling bias");
	RNA_def_property_update(prop, 0, "rna_Lamp_update");

	prop = RNA_def_property(srna, "shadow_buffer_bleed_bias", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "bleedbias");
	RNA_def_property_range(prop, 0.f, 1.f);
	RNA_def_property_ui_text(prop, "Shadow Buffer Bleed Bias", "Bias for reducing light-bleed on variance shadow maps");
	RNA_def_property_update(prop, 0, "rna_Lamp_update");

	prop = RNA_def_property(srna, "shadow_buffer_soft", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "soft");
	RNA_def_property_range(prop, 0.0f, 100.0f);
	RNA_def_property_ui_text(prop, "Shadow Buffer Soft", "Size of shadow buffer sampling area");
	RNA_def_property_update(prop, 0, "rna_Lamp_update");

	prop = RNA_def_property(srna, "shadow_buffer_samples", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "samp");
	RNA_def_property_range(prop, 1, 16);
	RNA_def_property_ui_text(prop, "Samples", "Number of shadow buffer samples");
	RNA_def_property_update(prop, 0, "rna_Lamp_update");

	prop = RNA_def_property(srna, "shadow_buffer_type", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "buftype");
	RNA_def_property_enum_items(prop, prop_shadbuftype_items);
	RNA_def_property_ui_text(prop, "Shadow Buffer Type", "Type of shadow buffer");
	RNA_def_property_update(prop, 0, "rna_Lamp_update");

	prop = RNA_def_property(srna, "ge_shadow_buffer_type", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "shadowmap_type");
	RNA_def_property_enum_items(prop, prop_ge_shadowbuffer_type_items);
	RNA_def_property_ui_text(prop, "Shadow Map Type", "The shadow mapping algorithm used");
	RNA_def_property_update(prop, 0, "rna_Lamp_update");


	prop = RNA_def_property(srna, "use_auto_clip_start", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "bufflag", LA_SHADBUF_AUTO_START);
	RNA_def_property_ui_text(prop, "Autoclip Start",
	                         "Automatic calculation of clipping-start, based on visible vertices");
	RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");

	prop = RNA_def_property(srna, "use_auto_clip_end", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "bufflag", LA_SHADBUF_AUTO_END);
	RNA_def_property_ui_text(prop, "Autoclip End", "Automatic calculation of clipping-end, based on visible vertices");
	RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");

	prop = RNA_def_property(srna, "compression_threshold", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "compressthresh");
	RNA_def_property_range(prop, 0.0f, 1.0f);
	RNA_def_property_ui_text(prop, "Compress", "Deep shadow map compression threshold");
	RNA_def_property_update(prop, 0, "rna_Lamp_update");

	prop = RNA_def_property(srna, "shadow_color", PROP_FLOAT, PROP_COLOR);
	RNA_def_property_float_sdna(prop, NULL, "shdwr");
	RNA_def_property_array(prop, 3);
	RNA_def_property_ui_text(prop, "Shadow Color", "Color of shadows cast by the lamp");
	RNA_def_property_update(prop, 0, "rna_Lamp_update");

	prop = RNA_def_property(srna, "use_only_shadow", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_ONLYSHADOW);
	RNA_def_property_ui_text(prop, "Only Shadow", "Cast shadows only, without illuminating objects");
	RNA_def_property_update(prop, 0, "rna_Lamp_update");

	prop = RNA_def_property(srna, "shadow_ray_sample_method", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "ray_samp_method");
	RNA_def_property_enum_items(prop, (area) ? prop_spot_ray_sampling_method_items : prop_ray_sampling_method_items);
	RNA_def_property_ui_text(prop, "Shadow Ray Sampling Method",
	                         "Method for generating shadow samples: Adaptive QMC is fastest, "
	                         "Constant QMC is less noisy but slower");
	RNA_def_property_update(prop, 0, "rna_Lamp_update");

	prop = RNA_def_property(srna, (area) ? "shadow_ray_samples_x" : "shadow_ray_samples", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "ray_samp");
	RNA_def_property_range(prop, 1, 64);
	RNA_def_property_ui_text(prop, (area) ? "Shadow Ray Samples" : "Shadow Ray Samples X",
	                         "Number of samples taken extra (samples x samples)");
	RNA_def_property_update(prop, 0, "rna_Lamp_update");

	if (area) {
		prop = RNA_def_property(srna, "shadow_ray_samples_y", PROP_INT, PROP_NONE);
		RNA_def_property_int_sdna(prop, NULL, "ray_sampy");
		RNA_def_property_range(prop, 1, 64);
		RNA_def_property_ui_text(prop, "Shadow Ray Samples Y",
		                         "Number of samples taken extra (samples x samples)");
		RNA_def_property_update(prop, 0, "rna_Lamp_update");
	}

	prop = RNA_def_property(srna, "shadow_adaptive_threshold", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "adapt_thresh");
	RNA_def_property_range(prop, 0.0f, 1.0f);
	RNA_def_property_ui_text(prop, "Shadow Adaptive Threshold", "Threshold for Adaptive Sampling (Raytraced shadows)");
	RNA_def_property_update(prop, 0, "rna_Lamp_update");

	prop = RNA_def_property(srna, "shadow_soft_size", PROP_FLOAT, PROP_DISTANCE);
	RNA_def_property_float_sdna(prop, NULL, "area_size");
	RNA_def_property_range(prop, 0.0f, FLT_MAX);
	RNA_def_property_ui_range(prop, 0, 100, 0.1, 3);
	RNA_def_property_ui_text(prop, "Shadow Soft Size", "Light size for ray shadow sampling (Raytraced shadows)");
	RNA_def_property_update(prop, 0, "rna_Lamp_update");

	prop = RNA_def_property(srna, "use_shadow_layer", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_LAYER_SHADOW);
	RNA_def_property_ui_text(prop, "Shadow Layer", "Objects on the same layers only cast shadows");
	RNA_def_property_update(prop, 0, "rna_Lamp_update");
}
コード例 #12
0
static void rna_def_image(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;
	static const EnumPropertyItem prop_type_items[] = {
		{IMA_TYPE_IMAGE, "IMAGE", 0, "Image", ""},
		{IMA_TYPE_MULTILAYER, "MULTILAYER", 0, "Multilayer", ""},
		{IMA_TYPE_UV_TEST, "UV_TEST", 0, "UV Test", ""},
		{IMA_TYPE_R_RESULT, "RENDER_RESULT", 0, "Render Result", ""},
		{IMA_TYPE_COMPOSITE, "COMPOSITING", 0, "Compositing", ""},
		{0, NULL, 0, NULL, NULL}
	};
	static const EnumPropertyItem prop_mapping_items[] = {
		{0, "UV", 0, "UV Coordinates", "Use UV coordinates for mapping the image"},
		{IMA_REFLECT, "REFLECTION", 0, "Reflection", "Use reflection mapping for mapping the image"},
		{0, NULL, 0, NULL, NULL}
	};
	static const EnumPropertyItem prop_field_order_items[] = {
		{0, "EVEN", 0, "Upper First", "Upper field first"},
		{IMA_STD_FIELD, "ODD", 0, "Lower First", "Lower field first"},
		{0, NULL, 0, NULL, NULL}
	};
	static const EnumPropertyItem alpha_mode_items[] = {
		{IMA_ALPHA_STRAIGHT, "STRAIGHT", 0, "Straight", "Transparent RGB and alpha pixels are unmodified"},
		{IMA_ALPHA_PREMUL, "PREMUL", 0, "Premultiplied", "Transparent RGB pixels are multiplied by the alpha channel"},
		{0, NULL, 0, NULL, NULL}
	};

	srna = RNA_def_struct(brna, "Image", "ID");
	RNA_def_struct_ui_text(srna, "Image", "Image data-block referencing an external or packed image");
	RNA_def_struct_ui_icon(srna, ICON_IMAGE_DATA);

	prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
	RNA_def_property_string_sdna(prop, NULL, "name");
	RNA_def_property_ui_text(prop, "File Name", "Image/Movie file name");
	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_reload_update");

	/* eek. this is horrible but needed so we can save to a new name without blanking the data :( */
	prop = RNA_def_property(srna, "filepath_raw", PROP_STRING, PROP_FILEPATH);
	RNA_def_property_string_sdna(prop, NULL, "name");
	RNA_def_property_ui_text(prop, "File Name", "Image/Movie file name (without data refreshing)");

	prop = RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_items(prop, image_type_items);
	RNA_def_property_enum_funcs(prop, "rna_Image_file_format_get", "rna_Image_file_format_set", NULL);
	RNA_def_property_ui_text(prop, "File Format", "Format used for re-saving this file");

	prop = RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_items(prop, image_source_items);
	RNA_def_property_enum_funcs(prop, NULL, "rna_Image_source_set", "rna_Image_source_itemf");
	RNA_def_property_ui_text(prop, "Source", "Where the image comes from");
	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);

	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_items(prop, prop_type_items);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Type", "How to generate the image");
	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);

	prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
	RNA_def_property_struct_type(prop, "PackedFile");
	RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
	RNA_def_property_pointer_funcs(prop, "rna_Image_packed_file_get", NULL, NULL, NULL);
	RNA_def_property_ui_text(prop, "Packed File", "First packed file of the image");

	prop = RNA_def_property(srna, "packed_files", PROP_COLLECTION, PROP_NONE);
	RNA_def_property_collection_sdna(prop, NULL, "packedfiles", NULL);
	RNA_def_property_struct_type(prop, "ImagePackedFile");
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Packed Files", "Collection of packed images");

	prop = RNA_def_property(srna, "field_order", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
	RNA_def_property_enum_items(prop, prop_field_order_items);
	RNA_def_property_ui_text(prop, "Field Order", "Order of video fields (select which lines are displayed first)");
	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);

	/* booleans */
	prop = RNA_def_property(srna, "use_fields", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_FIELDS);
	RNA_def_property_ui_text(prop, "Fields", "Use fields of the image");
	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_fields_update");
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
	

	prop = RNA_def_property(srna, "use_view_as_render", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_VIEW_AS_RENDER);
	RNA_def_property_ui_text(prop, "View as Render", "Apply render part of display transformation when displaying this image on the screen");
	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);

	prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMA_IGNORE_ALPHA);
	RNA_def_property_ui_text(prop, "Use Alpha", "Use the alpha channel information from the image or make image fully opaque");
	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_colormanage_update");

	prop = RNA_def_property(srna, "use_deinterlace", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_DEINTERLACE);
	RNA_def_property_ui_text(prop, "Deinterlace", "Deinterlace movie file on load");
	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_reload_update");

	prop = RNA_def_property(srna, "use_multiview", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_USE_VIEWS);
	RNA_def_property_ui_text(prop, "Use Multi-View", "Use Multiple Views (when available)");
	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_views_format_update");

	prop = RNA_def_property(srna, "is_stereo_3d", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_funcs(prop, "rna_Image_is_stereo_3d_get", NULL);
	RNA_def_property_ui_text(prop, "Stereo 3D", "Image has left and right views");
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);

	prop = RNA_def_property(srna, "is_multiview", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_funcs(prop, "rna_Image_is_multiview_get", NULL);
	RNA_def_property_ui_text(prop, "Multiple Views", "Image has more than one view");
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);

	prop = RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_funcs(prop, "rna_Image_dirty_get", NULL);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Dirty", "Image has changed and is not saved");

	/* generated image (image_generated_change_cb) */
	prop = RNA_def_property(srna, "generated_type", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "gen_type");
	RNA_def_property_enum_items(prop, image_generated_type_items);
	RNA_def_property_ui_text(prop, "Generated Type", "Generated image type");
	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
	
	prop = RNA_def_property(srna, "generated_width", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "gen_x");
	RNA_def_property_flag(prop, PROP_PROPORTIONAL);
	RNA_def_property_range(prop, 1, 65536);
	RNA_def_property_ui_text(prop, "Generated Width", "Generated image width");
	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
	
	prop = RNA_def_property(srna, "generated_height", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "gen_y");
	RNA_def_property_flag(prop, PROP_PROPORTIONAL);
	RNA_def_property_range(prop, 1, 65536);
	RNA_def_property_ui_text(prop, "Generated Height", "Generated image height");
	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
	
	prop = RNA_def_property(srna, "use_generated_float", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "gen_flag", IMA_GEN_FLOAT);
	RNA_def_property_ui_text(prop, "Float Buffer", "Generate floating point buffer");
	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);

	prop = RNA_def_property(srna, "generated_color", PROP_FLOAT, PROP_COLOR_GAMMA);
	RNA_def_property_float_sdna(prop, NULL, "gen_color");
	RNA_def_property_array(prop, 4);
	RNA_def_property_ui_text(prop, "Color", "Fill color for the generated image");
	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);

	/* realtime properties */
	prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
	RNA_def_property_enum_items(prop, prop_mapping_items);
	RNA_def_property_ui_text(prop, "Mapping", "Mapping type to use for this image in the game engine");
	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);

	prop = RNA_def_property(srna, "display_aspect", PROP_FLOAT, PROP_XYZ);
	RNA_def_property_float_sdna(prop, NULL, "aspx");
	RNA_def_property_array(prop, 2);
	RNA_def_property_range(prop, 0.1f, FLT_MAX);
	RNA_def_property_ui_range(prop, 0.1f, 5000.f, 1, 2);
	RNA_def_property_ui_text(prop, "Display Aspect", "Display Aspect for this image, does not affect rendering");
	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);

	prop = RNA_def_property(srna, "use_animation", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "tpageflag", IMA_TWINANIM);
	RNA_def_property_ui_text(prop, "Animated", "Use as animated texture in the game engine");
	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_animated_update");

	prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "twsta");
	RNA_def_property_range(prop, 0, 255);
	RNA_def_property_ui_text(prop, "Animation Start", "Start frame of an animated texture");
	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_animated_update");

	prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "twend");
	RNA_def_property_range(prop, 0, 255);
	RNA_def_property_ui_text(prop, "Animation End", "End frame of an animated texture");
	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_animated_update");

	prop = RNA_def_property(srna, "fps", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "animspeed");
	RNA_def_property_range(prop, 1, 100);
	RNA_def_property_ui_text(prop, "Animation Speed", "Speed of the animation in frames per second");
	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);

	prop = RNA_def_property(srna, "use_tiles", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "tpageflag", IMA_TILES);
	RNA_def_property_ui_text(prop, "Tiles",
	                         "Use of tilemode for faces (default shift-LMB to pick the tile for selected faces)");
	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);

	prop = RNA_def_property(srna, "tiles_x", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "xrep");
	RNA_def_property_range(prop, 1, 16);
	RNA_def_property_ui_text(prop, "Tiles X", "Degree of repetition in the X direction");
	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);

	prop = RNA_def_property(srna, "tiles_y", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "yrep");
	RNA_def_property_range(prop, 1, 16);
	RNA_def_property_ui_text(prop, "Tiles Y", "Degree of repetition in the Y direction");
	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);

	prop = RNA_def_property(srna, "use_clamp_x", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "tpageflag", IMA_CLAMP_U);
	RNA_def_property_ui_text(prop, "Clamp X", "Disable texture repeating horizontally");
	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);

	prop = RNA_def_property(srna, "use_clamp_y", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "tpageflag", IMA_CLAMP_V);
	RNA_def_property_ui_text(prop, "Clamp Y", "Disable texture repeating vertically");
	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);

	prop = RNA_def_property(srna, "bindcode", PROP_INT, PROP_UNSIGNED);
	RNA_def_property_int_sdna(prop, NULL, "bindcode");
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Bindcode", "OpenGL bindcode");
	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);

	prop = RNA_def_property(srna, "render_slots", PROP_COLLECTION, PROP_NONE);
	RNA_def_property_struct_type(prop, "RenderSlot");
	RNA_def_property_ui_text(prop, "Render Slots", "Render slots of the image");
	RNA_def_property_collection_funcs(prop, "rna_Image_render_slots_begin", "rna_iterator_array_next",
	                                  "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL);
	RNA_def_property_srna(prop, "RenderSlots");

	/*
	 * Image.has_data and Image.depth are temporary,
	 * Update import_obj.py when they are replaced (Arystan)
	 */
	prop = RNA_def_property(srna, "has_data", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_funcs(prop, "rna_Image_has_data_get", NULL);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Has data", "True if this image has data");

	prop = RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
	RNA_def_property_int_funcs(prop, "rna_Image_depth_get", NULL, NULL);
	RNA_def_property_ui_text(prop, "Depth", "Image bit depth");
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);

	prop = RNA_def_int_vector(srna, "size", 2, NULL, 0, 0, "Size",
	                          "Width and height in pixels, zero when image data cant be loaded", 0, 0);
	RNA_def_property_subtype(prop, PROP_PIXEL);
	RNA_def_property_int_funcs(prop, "rna_Image_size_get", NULL, NULL);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);

	prop = RNA_def_float_vector(srna, "resolution", 2, NULL, 0, 0, "Resolution", "X/Y pixels per meter", 0, 0);
	RNA_def_property_float_funcs(prop, "rna_Image_resolution_get", "rna_Image_resolution_set", NULL);

	prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_UNSIGNED);
	RNA_def_property_int_funcs(prop, "rna_Image_frame_duration_get", NULL, NULL);
	RNA_def_property_ui_text(prop, "Duration", "Duration (in frames) of the image (1 when not a video/sequence)");
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);

	/* NOTE about pixels/channels/is_floa:
	 * this properties describes how image is stored internally (inside of ImBuf),
	 * not how it was saved to disk or how it'll be saved on disk
	 */
	prop = RNA_def_property(srna, "pixels", 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, "Pixels", "Image pixels in floating point values");
	RNA_def_property_dynamic_array_funcs(prop, "rna_Image_pixels_get_length");
	RNA_def_property_float_funcs(prop, "rna_Image_pixels_get", "rna_Image_pixels_set", NULL);

	prop = RNA_def_property(srna, "channels", PROP_INT, PROP_UNSIGNED);
	RNA_def_property_int_funcs(prop, "rna_Image_channels_get", NULL, NULL);
	RNA_def_property_ui_text(prop, "Channels", "Number of channels in pixels buffer");
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);

	prop = RNA_def_property(srna, "is_float", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_funcs(prop, "rna_Image_is_float_get", NULL);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Is Float", "True if this image is stored in float buffer");

	prop = RNA_def_property(srna, "colorspace_settings", PROP_POINTER, PROP_NONE);
	RNA_def_property_pointer_sdna(prop, NULL, "colorspace_settings");
	RNA_def_property_struct_type(prop, "ColorManagedInputColorspaceSettings");
	RNA_def_property_ui_text(prop, "Color Space Settings", "Input color space settings");

	prop = RNA_def_property(srna, "alpha_mode", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_items(prop, alpha_mode_items);
	RNA_def_property_ui_text(prop, "Alpha Mode", "Representation of alpha information in the RGBA pixels");
	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_colormanage_update");

	/* multiview */
	prop = RNA_def_property(srna, "views_format", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "views_format");
	RNA_def_property_enum_items(prop, views_format_items);
	RNA_def_property_ui_text(prop, "Views Format", "Mode to load image views");
	RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_views_format_update");

	prop = RNA_def_property(srna, "stereo_3d_format", PROP_POINTER, PROP_NONE);
	RNA_def_property_pointer_sdna(prop, NULL, "stereo3d_format");
	RNA_def_property_flag(prop, PROP_NEVER_NULL);
	RNA_def_property_struct_type(prop, "Stereo3dFormat");
	RNA_def_property_ui_text(prop, "Stereo 3D Format", "Settings for stereo 3d");

	RNA_api_image(srna);
}
コード例 #13
0
static void rna_def_lattice(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;

	srna = RNA_def_struct(brna, "Lattice", "ID");
	RNA_def_struct_ui_text(srna, "Lattice", "Lattice datablock defining a grid for deforming other objects");
	RNA_def_struct_ui_icon(srna, ICON_LATTICE_DATA);

	prop = RNA_def_property(srna, "points_u", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "pntsu");
	RNA_def_property_int_funcs(prop, NULL, "rna_Lattice_points_u_set", NULL);
	RNA_def_property_range(prop, 1, 64);
	RNA_def_property_ui_text(prop, "U", "Point in U direction (can't be changed when there are shape keys)");
	RNA_def_property_update(prop, 0, "rna_Lattice_update_size");
	RNA_def_property_editable_func(prop, "rna_Lattice_size_editable");

	prop = RNA_def_property(srna, "points_v", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "pntsv");
	RNA_def_property_int_funcs(prop, NULL, "rna_Lattice_points_v_set", NULL);
	RNA_def_property_range(prop, 1, 64);
	RNA_def_property_ui_text(prop, "V", "Point in V direction (can't be changed when there are shape keys)");
	RNA_def_property_update(prop, 0, "rna_Lattice_update_size");
	RNA_def_property_editable_func(prop, "rna_Lattice_size_editable");

	prop = RNA_def_property(srna, "points_w", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "pntsw");
	RNA_def_property_int_funcs(prop, NULL, "rna_Lattice_points_w_set", NULL);
	RNA_def_property_range(prop, 1, 64);
	RNA_def_property_ui_text(prop, "W", "Point in W direction (can't be changed when there are shape keys)");
	RNA_def_property_update(prop, 0, "rna_Lattice_update_size");
	RNA_def_property_editable_func(prop, "rna_Lattice_size_editable");

	prop = RNA_def_property(srna, "interpolation_type_u", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "typeu");
	RNA_def_property_enum_items(prop, keyblock_type_items);
	RNA_def_property_ui_text(prop, "Interpolation Type U", "");
	RNA_def_property_update(prop, 0, "rna_Lattice_update_data");

	prop = RNA_def_property(srna, "interpolation_type_v", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "typev");
	RNA_def_property_enum_items(prop, keyblock_type_items);
	RNA_def_property_ui_text(prop, "Interpolation Type V", "");
	RNA_def_property_update(prop, 0, "rna_Lattice_update_data");

	prop = RNA_def_property(srna, "interpolation_type_w", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "typew");
	RNA_def_property_enum_items(prop, keyblock_type_items);
	RNA_def_property_ui_text(prop, "Interpolation Type W", "");
	RNA_def_property_update(prop, 0, "rna_Lattice_update_data");

	prop = RNA_def_property(srna, "use_outside", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", LT_OUTSIDE);
	RNA_def_property_boolean_funcs(prop, NULL, "rna_Lattice_use_outside_set");
	RNA_def_property_ui_text(prop, "Outside", "Only draw, and take into account, the outer vertices");
	RNA_def_property_update(prop, 0, "rna_Lattice_update_data");
	
	prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
	RNA_def_property_string_sdna(prop, NULL, "vgroup");
	RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group to apply the influence of the lattice");
	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Lattice_vg_name_set");
	RNA_def_property_update(prop, 0, "rna_Lattice_update_data");

	prop = RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE);
	RNA_def_property_pointer_sdna(prop, NULL, "key");
	RNA_def_property_ui_text(prop, "Shape Keys", "");

	prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
	RNA_def_property_struct_type(prop, "LatticePoint");
	RNA_def_property_collection_funcs(prop, "rna_Lattice_points_begin", "rna_iterator_array_next",
	                                  "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL);
	RNA_def_property_ui_text(prop, "Points", "Points of the lattice");
	
	/* pointers */
	rna_def_animdata_common(srna);
}
コード例 #14
0
ファイル: rna_rigidbody.c プロジェクト: 244xiao/blender
static void rna_def_rigidbody_constraint(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;

	srna = RNA_def_struct(brna, "RigidBodyConstraint", NULL);
	RNA_def_struct_sdna(srna, "RigidBodyCon");
	RNA_def_struct_ui_text(srna, "Rigid Body Constraint",
	                       "Constraint influencing Objects inside Rigid Body Simulation");
	RNA_def_struct_path_func(srna, "rna_RigidBodyCon_path");

	/* Enums */
	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "type");
	RNA_def_property_enum_items(prop, rigidbody_constraint_type_items);
	RNA_def_property_enum_funcs(prop, NULL, "rna_RigidBodyCon_type_set", NULL);
	RNA_def_property_ui_text(prop, "Type", "Type of Rigid Body Constraint");
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
	RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_ENABLED);
	RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_enabled_set");
	RNA_def_property_ui_text(prop, "Enabled", "Enable this constraint");
	RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "disable_collisions", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_DISABLE_COLLISIONS);
	RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_disable_collisions_set");
	RNA_def_property_ui_text(prop, "Disable Collisions", "Disable collisions between constrained rigid bodies");
	RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "object1", PROP_POINTER, PROP_NONE);
	RNA_def_property_pointer_sdna(prop, NULL, "ob1");
	RNA_def_property_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Object 1", "First Rigid Body Object to be constrained");
	RNA_def_property_flag(prop, PROP_EDITABLE);
	RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "object2", PROP_POINTER, PROP_NONE);
	RNA_def_property_pointer_sdna(prop, NULL, "ob2");
	RNA_def_property_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Object 2", "Second Rigid Body Object to be constrained");
	RNA_def_property_flag(prop, PROP_EDITABLE);
	RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");

	/* Breaking Threshold */
	prop = RNA_def_property(srna, "use_breaking", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_BREAKING);
	RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_use_breaking_set");
	RNA_def_property_ui_text(prop, "Breakable",
	                         "Constraint can be broken if it receives an impulse above the threshold");
	RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "breaking_threshold", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "breaking_threshold");
	RNA_def_property_range(prop, 0.0f, FLT_MAX);
	RNA_def_property_ui_range(prop, 0.0f, 1000.0f, 100.0, 2);
	RNA_def_property_float_default(prop, 10.0f);
	RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_breaking_threshold_set", NULL);
	RNA_def_property_ui_text(prop, "Breaking Threshold",
	                         "Impulse threshold that must be reached for the constraint to break");
	RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");

	/* Solver Iterations */
	prop = RNA_def_property(srna, "use_override_solver_iterations", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS);
	RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_override_solver_iterations_set");
	RNA_def_property_ui_text(prop, "Override Solver Iterations",
	                         "Override the number of solver iterations for this constraint");
	RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "solver_iterations", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "num_solver_iterations");
	RNA_def_property_range(prop, 1, 1000);
	RNA_def_property_ui_range(prop, 1, 100, 1, -1);
	RNA_def_property_int_default(prop, 10);
	RNA_def_property_int_funcs(prop, NULL, "rna_RigidBodyCon_num_solver_iterations_set", NULL);
	RNA_def_property_ui_text(prop, "Solver Iterations",
	                         "Number of constraint solver iterations made per simulation step (higher values are more "
	                         "accurate but slower)");
	RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");

	/* Limits */
	prop = RNA_def_property(srna, "use_limit_lin_x", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_LIN_X);
	RNA_def_property_ui_text(prop, "X Axis", "Limit translation on X axis");
	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "use_limit_lin_y", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_LIN_Y);
	RNA_def_property_ui_text(prop, "Y Axis", "Limit translation on Y axis");
	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "use_limit_lin_z", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_LIN_Z);
	RNA_def_property_ui_text(prop, "Z Axis", "Limit translation on Z axis");
	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "use_limit_ang_x", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_ANG_X);
	RNA_def_property_ui_text(prop, "X Angle", "Limit rotation around X axis");
	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "use_limit_ang_y", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_ANG_Y);
	RNA_def_property_ui_text(prop, "Y Angle", "Limit rotation around Y axis");
	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "use_limit_ang_z", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_ANG_Z);
	RNA_def_property_ui_text(prop, "Z Angle", "Limit rotation around Z axis");
	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "use_spring_x", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_SPRING_X);
	RNA_def_property_ui_text(prop, "X Spring", "Enable spring on X axis");
	RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "use_spring_y", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_SPRING_Y);
	RNA_def_property_ui_text(prop, "Y Spring", "Enable spring on Y axis");
	RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "use_spring_z", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_SPRING_Z);
	RNA_def_property_ui_text(prop, "Z Spring", "Enable spring on Z axis");
	RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "use_motor_lin", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_MOTOR_LIN);
	RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_use_motor_lin_set");
	RNA_def_property_ui_text(prop, "Linear Motor", "Enable linear motor");
	RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "use_motor_ang", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_MOTOR_ANG);
	RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_use_motor_ang_set");
	RNA_def_property_ui_text(prop, "Angular Motor", "Enable angular motor");
	RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "limit_lin_x_lower", PROP_FLOAT, PROP_UNIT_LENGTH);
	RNA_def_property_float_sdna(prop, NULL, "limit_lin_x_lower");
	RNA_def_property_float_default(prop, -1.0f);
	RNA_def_property_ui_text(prop, "Lower X Limit", "Lower limit of X axis translation");
	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "limit_lin_x_upper", PROP_FLOAT, PROP_UNIT_LENGTH);
	RNA_def_property_float_sdna(prop, NULL, "limit_lin_x_upper");
	RNA_def_property_float_default(prop, 1.0f);
	RNA_def_property_ui_text(prop, "Upper X Limit", "Upper limit of X axis translation");
	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "limit_lin_y_lower", PROP_FLOAT, PROP_UNIT_LENGTH);
	RNA_def_property_float_sdna(prop, NULL, "limit_lin_y_lower");
	RNA_def_property_float_default(prop, -1.0f);
	RNA_def_property_ui_text(prop, "Lower Y Limit", "Lower limit of Y axis translation");
	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "limit_lin_y_upper", PROP_FLOAT, PROP_UNIT_LENGTH);
	RNA_def_property_float_sdna(prop, NULL, "limit_lin_y_upper");
	RNA_def_property_float_default(prop, 1.0f);
	RNA_def_property_ui_text(prop, "Upper Y Limit", "Upper limit of Y axis translation");
	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "limit_lin_z_lower", PROP_FLOAT, PROP_UNIT_LENGTH);
	RNA_def_property_float_sdna(prop, NULL, "limit_lin_z_lower");
	RNA_def_property_float_default(prop, -1.0f);
	RNA_def_property_ui_text(prop, "Lower Z Limit", "Lower limit of Z axis translation");
	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "limit_lin_z_upper", PROP_FLOAT, PROP_UNIT_LENGTH);
	RNA_def_property_float_sdna(prop, NULL, "limit_lin_z_upper");
	RNA_def_property_float_default(prop, 1.0f);
	RNA_def_property_ui_text(prop, "Upper Z Limit", "Upper limit of Z axis translation");
	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "limit_ang_x_lower", PROP_FLOAT, PROP_ANGLE);
	RNA_def_property_float_sdna(prop, NULL, "limit_ang_x_lower");
	RNA_def_property_range(prop, -M_PI * 2, M_PI * 2);
	RNA_def_property_float_default(prop, -M_PI_4);
	RNA_def_property_ui_text(prop, "Lower X Angle Limit", "Lower limit of X axis rotation");
	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "limit_ang_x_upper", PROP_FLOAT, PROP_ANGLE);
	RNA_def_property_float_sdna(prop, NULL, "limit_ang_x_upper");
	RNA_def_property_range(prop, -M_PI * 2, M_PI * 2);
	RNA_def_property_float_default(prop, M_PI_4);
	RNA_def_property_ui_text(prop, "Upper X Angle Limit", "Upper limit of X axis rotation");
	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "limit_ang_y_lower", PROP_FLOAT, PROP_ANGLE);
	RNA_def_property_float_sdna(prop, NULL, "limit_ang_y_lower");
	RNA_def_property_range(prop, -M_PI * 2, M_PI * 2);
	RNA_def_property_float_default(prop, -M_PI_4);
	RNA_def_property_ui_text(prop, "Lower Y Angle Limit", "Lower limit of Y axis rotation");
	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "limit_ang_y_upper", PROP_FLOAT, PROP_ANGLE);
	RNA_def_property_float_sdna(prop, NULL, "limit_ang_y_upper");
	RNA_def_property_range(prop, -M_PI * 2, M_PI * 2);
	RNA_def_property_float_default(prop, M_PI_4);
	RNA_def_property_ui_text(prop, "Upper Y Angle Limit", "Upper limit of Y axis rotation");
	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "limit_ang_z_lower", PROP_FLOAT, PROP_ANGLE);
	RNA_def_property_float_sdna(prop, NULL, "limit_ang_z_lower");
	RNA_def_property_range(prop, -M_PI * 2, M_PI * 2);
	RNA_def_property_float_default(prop, -M_PI_4);
	RNA_def_property_ui_text(prop, "Lower Z Angle Limit", "Lower limit of Z axis rotation");
	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "limit_ang_z_upper", PROP_FLOAT, PROP_ANGLE);
	RNA_def_property_float_sdna(prop, NULL, "limit_ang_z_upper");
	RNA_def_property_range(prop, -M_PI * 2, M_PI * 2);
	RNA_def_property_float_default(prop, M_PI_4);
	RNA_def_property_ui_text(prop, "Upper Z Angle Limit", "Upper limit of Z axis rotation");
	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "spring_stiffness_x", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "spring_stiffness_x");
	RNA_def_property_range(prop, 0.0f, FLT_MAX);
	RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
	RNA_def_property_float_default(prop, 10.0f);
	RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_stiffness_x_set", NULL);
	RNA_def_property_ui_text(prop, "X Axis Stiffness", "Stiffness on the X axis");
	RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "spring_stiffness_y", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "spring_stiffness_y");
	RNA_def_property_range(prop, 0.0f, FLT_MAX);
	RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
	RNA_def_property_float_default(prop, 10.0f);
	RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_stiffness_y_set", NULL);
	RNA_def_property_ui_text(prop, "Y Axis Stiffness", "Stiffness on the Y axis");
	RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "spring_stiffness_z", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "spring_stiffness_z");
	RNA_def_property_range(prop, 0.0f, FLT_MAX);
	RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
	RNA_def_property_float_default(prop, 10.0f);
	RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_stiffness_z_set", NULL);
	RNA_def_property_ui_text(prop, "Z Axis Stiffness", "Stiffness on the Z axis");
	RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "spring_damping_x", PROP_FLOAT, PROP_FACTOR);
	RNA_def_property_float_sdna(prop, NULL, "spring_damping_x");
	RNA_def_property_range(prop, 0.0f, 1.0f);
	RNA_def_property_float_default(prop, 0.5f);
	RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_damping_x_set", NULL);
	RNA_def_property_ui_text(prop, "Damping X", "Damping on the X axis");
	RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "spring_damping_y", PROP_FLOAT, PROP_FACTOR);
	RNA_def_property_float_sdna(prop, NULL, "spring_damping_y");
	RNA_def_property_range(prop, 0.0f, 1.0f);
	RNA_def_property_float_default(prop, 0.5f);
	RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_damping_y_set", NULL);
	RNA_def_property_ui_text(prop, "Damping Y", "Damping on the Y axis");
	RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "spring_damping_z", PROP_FLOAT, PROP_FACTOR);
	RNA_def_property_float_sdna(prop, NULL, "spring_damping_z");
	RNA_def_property_range(prop, 0.0f, 1.0f);
	RNA_def_property_float_default(prop, 0.5f);
	RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_damping_z_set", NULL);
	RNA_def_property_ui_text(prop, "Damping Z", "Damping on the Z axis");
	RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "motor_lin_target_velocity", PROP_FLOAT, PROP_UNIT_VELOCITY);
	RNA_def_property_float_sdna(prop, NULL, "motor_lin_target_velocity");
	RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
	RNA_def_property_ui_range(prop, -100.0f, 100.0f, 1, 3);
	RNA_def_property_float_default(prop, 1.0f);
	RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_motor_lin_target_velocity_set", NULL);
	RNA_def_property_ui_text(prop, "Target Velocity", "Target linear motor velocity");
	RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "motor_lin_max_impulse", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "motor_lin_max_impulse");
	RNA_def_property_range(prop, 0.0f, FLT_MAX);
	RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
	RNA_def_property_float_default(prop, 1.0f);
	RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_motor_lin_max_impulse_set", NULL);
	RNA_def_property_ui_text(prop, "Max Impulse", "Maximum linear motor impulse");
	RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "motor_ang_target_velocity", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "motor_ang_target_velocity");
	RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
	RNA_def_property_ui_range(prop, -100.0f, 100.0f, 1, 3);
	RNA_def_property_float_default(prop, 1.0f);
	RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_motor_ang_target_velocity_set", NULL);
	RNA_def_property_ui_text(prop, "Target Velocity", "Target angular motor velocity");
	RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");

	prop = RNA_def_property(srna, "motor_ang_max_impulse", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "motor_ang_max_impulse");
	RNA_def_property_range(prop, 0.0f, FLT_MAX);
	RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
	RNA_def_property_float_default(prop, 1.0f);
	RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_motor_ang_max_impulse_set", NULL);
	RNA_def_property_ui_text(prop, "Max Impulse", "Maximum angular motor impulse");
	RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
}
コード例 #15
0
ファイル: rna_test.c プロジェクト: Eibriel/kiriblender
void RNA_def_test(BlenderRNA *brna)
{
#ifdef UNIT_TEST
	StructRNA *srna;
	PropertyRNA *prop;
	unsigned short dimsize[] = {MARRAY_DIMSIZE};

	srna = RNA_def_struct(brna, "Test", NULL);
	RNA_def_struct_sdna(srna, "Test");

	prop = RNA_def_float_array(srna, "farr", ARRAY_SIZE, NULL, 0.0f, 0.0f, "farr", "float array", 0.0f, 0.0f);
	RNA_def_property_float_funcs(prop, "rna_Test_farr_get", "rna_Test_farr_set", NULL);

	prop = RNA_def_int_array(srna, "iarr", ARRAY_SIZE, NULL, 0, 0, "iarr", "int array", 0, 0);
	RNA_def_property_int_funcs(prop, "rna_Test_iarr_get", "rna_Test_iarr_set", NULL);

	prop = RNA_def_boolean_array(srna, "barr", ARRAY_SIZE, NULL, "barr", "boolean array");
	RNA_def_property_boolean_funcs(prop, "rna_Test_barr_get", "rna_Test_barr_set");

	/* dynamic arrays */

	prop = RNA_def_float_array(srna, "fdarr", DYNAMIC_ARRAY_SIZE, NULL, 0.0f, 0.0f, "fdarr",
	                           "dynamic float array", 0.0f, 0.0f);
	RNA_def_property_flag(prop, PROP_DYNAMIC);
	RNA_def_property_dynamic_array_funcs(prop, "rna_Test_fdarr_get_length", "rna_Test_fdarr_set_length");
	RNA_def_property_float_funcs(prop, "rna_Test_fdarr_get", "rna_Test_fdarr_set", NULL);

	prop = RNA_def_int_array(srna, "idarr", DYNAMIC_ARRAY_SIZE, NULL, 0, 0, "idarr", "int array", 0, 0);
	RNA_def_property_flag(prop, PROP_DYNAMIC);
	RNA_def_property_dynamic_array_funcs(prop, "rna_Test_idarr_get_length", "rna_Test_idarr_set_length");
	RNA_def_property_int_funcs(prop, "rna_Test_idarr_get", "rna_Test_idarr_set", NULL);
	
	prop = RNA_def_boolean_array(srna, "bdarr", DYNAMIC_ARRAY_SIZE, NULL, "bdarr", "boolean array");
	RNA_def_property_flag(prop, PROP_DYNAMIC);
	RNA_def_property_dynamic_array_funcs(prop, "rna_Test_bdarr_get_length", "rna_Test_bdarr_set_length");
	RNA_def_property_boolean_funcs(prop, "rna_Test_bdarr_get", "rna_Test_bdarr_set");

	/* multidimensional arrays */

	prop = RNA_def_property(srna, "fmarr", PROP_FLOAT, PROP_NONE);
	RNA_def_property_multidimensional_array(prop, MARRAY_SIZE(float), MARRAY_TOTDIM, dimsize);
	RNA_def_property_float_funcs(prop, "rna_Test_fmarr_get", "rna_Test_fmarr_set", NULL);

	prop = RNA_def_property(srna, "imarr", PROP_INT, PROP_NONE);
	RNA_def_property_multidimensional_array(prop, MARRAY_SIZE(int), MARRAY_TOTDIM, dimsize);
	RNA_def_property_int_funcs(prop, "rna_Test_imarr_get", "rna_Test_imarr_set", NULL);

	prop = RNA_def_property(srna, "bmarr", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_multidimensional_array(prop, MARRAY_SIZE(int), MARRAY_TOTDIM, dimsize);
	RNA_def_property_boolean_funcs(prop, "rna_Test_bmarr_get", "rna_Test_bmarr_set");

	/* dynamic multidimensional arrays */

	prop = RNA_def_property(srna, "fdmarr", PROP_FLOAT, PROP_NONE);
	RNA_def_property_multidimensional_array(prop, DYNAMIC_MARRAY_SIZE(float), MARRAY_TOTDIM, dimsize);
	RNA_def_property_flag(prop, PROP_DYNAMIC);
	RNA_def_property_dynamic_array_funcs(prop, "rna_Test_fdmarr_get_length", "rna_Test_fdmarr_set_length");
	RNA_def_property_float_funcs(prop, "rna_Test_fdmarr_get", "rna_Test_fdmarr_set", NULL);

	prop = RNA_def_property(srna, "idmarr", PROP_INT, PROP_NONE);
	RNA_def_property_multidimensional_array(prop, DYNAMIC_MARRAY_SIZE(int), MARRAY_TOTDIM, dimsize);
	RNA_def_property_flag(prop, PROP_DYNAMIC);
	RNA_def_property_dynamic_array_funcs(prop, "rna_Test_idmarr_get_length", "rna_Test_idmarr_set_length");
	RNA_def_property_int_funcs(prop, "rna_Test_idmarr_get", "rna_Test_idmarr_set", NULL);

	prop = RNA_def_property(srna, "bdmarr", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_multidimensional_array(prop, DYNAMIC_MARRAY_SIZE(int), MARRAY_TOTDIM, dimsize);
	RNA_def_property_flag(prop, PROP_DYNAMIC);
	RNA_def_property_dynamic_array_funcs(prop, "rna_Test_bdmarr_get_length", "rna_Test_bdmarr_set_length");
	RNA_def_property_boolean_funcs(prop, "rna_Test_bdmarr_get", "rna_Test_bdmarr_set");
#else
	(void)brna;
#endif
}
コード例 #16
0
static void rna_def_gpencil_layer(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;
	
	srna = RNA_def_struct(brna, "GPencilLayer", NULL);
	RNA_def_struct_sdna(srna, "bGPDlayer");
	RNA_def_struct_ui_text(srna, "Grease Pencil Layer", "Collection of related sketches");
	
	/* Name */
	prop = RNA_def_property(srna, "info", PROP_STRING, PROP_NONE);
	RNA_def_property_ui_text(prop, "Info", "Layer name");
	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GPencilLayer_info_set");
	RNA_def_struct_name_property(srna, prop);
	
	/* Frames */
	prop = RNA_def_property(srna, "frames", PROP_COLLECTION, PROP_NONE);
	RNA_def_property_collection_sdna(prop, NULL, "frames", NULL);
	RNA_def_property_struct_type(prop, "GPencilFrame");
	RNA_def_property_ui_text(prop, "Frames", "Sketches for this layer on different frames");
	
	/* Active Frame */
	prop = RNA_def_property(srna, "active_frame", PROP_POINTER, PROP_NONE);
	RNA_def_property_pointer_sdna(prop, NULL, "actframe");
	RNA_def_property_ui_text(prop, "Active Frame", "Frame currently being displayed for this layer");
	RNA_def_property_editable_func(prop, "rna_GPencilLayer_active_frame_editable");
	
	/* Drawing Color */
	prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
	RNA_def_property_array(prop, 3);
	RNA_def_property_range(prop, 0.0f, 1.0f);
	RNA_def_property_ui_text(prop, "Color", "Color for all strokes in this layer");
	RNA_def_property_update(prop, NC_SCREEN | ND_GPENCIL, NULL);
	
	prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "color[3]");
	RNA_def_property_range(prop, 0.3, 1.0f);
	RNA_def_property_ui_text(prop, "Opacity", "Layer Opacity");
	RNA_def_property_update(prop, NC_SCREEN | ND_GPENCIL, NULL);
	
	/* Line Thickness */
	prop = RNA_def_property(srna, "line_width", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "thickness");
	RNA_def_property_range(prop, 1, 10);
	RNA_def_property_ui_text(prop, "Thickness", "Thickness of strokes (in pixels)");
	RNA_def_property_update(prop, NC_SCREEN | ND_GPENCIL, NULL);
	
	/* Onion-Skinning */
	prop = RNA_def_property(srna, "use_onion_skinning", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_ONIONSKIN);
	RNA_def_property_ui_text(prop, "Onion Skinning", "Ghost frames on either side of frame");
	RNA_def_property_update(prop, NC_SCREEN | ND_GPENCIL, NULL);
	
	prop = RNA_def_property(srna, "ghost_range_max", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "gstep");
	RNA_def_property_range(prop, 0, 120);
	RNA_def_property_ui_text(prop, "Max Ghost Range",
	                         "Maximum number of frames on either side of the active frame to show "
	                         "(0 = show the 'first' available sketch on either side)");
	RNA_def_property_update(prop, NC_SCREEN | ND_GPENCIL, NULL);
	
	/* Flags */
	prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_HIDE);
	RNA_def_property_ui_text(prop, "Hide", "Set layer Visibility");
	RNA_def_property_update(prop, NC_SCREEN | ND_GPENCIL, NULL);
	
	prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_LOCKED);
	RNA_def_property_ui_text(prop, "Locked", "Protect layer from further editing and/or frame changes");
	RNA_def_property_update(prop, NC_SCREEN | ND_GPENCIL, NULL);
	
	prop = RNA_def_property(srna, "lock_frame", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_FRAMELOCK);
	RNA_def_property_ui_text(prop, "Frame Locked", "Lock current frame displayed by layer");
	RNA_def_property_update(prop, NC_SCREEN | ND_GPENCIL, NULL);

	/* expose as layers.active */
#if 0
	prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_ACTIVE);
	RNA_def_property_boolean_funcs(prop, NULL, "rna_GPencilLayer_active_set");
	RNA_def_property_ui_text(prop, "Active", "Set active layer for editing");
	RNA_def_property_update(prop, NC_SCREEN | ND_GPENCIL, NULL);
#endif

	prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_SELECT);
	RNA_def_property_ui_text(prop, "Select", "Layer is selected for editing in the DopeSheet");
	RNA_def_property_update(prop, NC_SCREEN | ND_GPENCIL, NULL);
	
	/* XXX keep this option? */
	prop = RNA_def_property(srna, "show_points", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_DRAWDEBUG);
	RNA_def_property_ui_text(prop, "Show Points", "Draw the points which make up the strokes (for debugging purposes)");
	RNA_def_property_update(prop, NC_SCREEN | ND_GPENCIL, NULL);

	/* X-Ray */
	prop = RNA_def_property(srna, "show_x_ray", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GP_LAYER_NO_XRAY);
	RNA_def_property_ui_text(prop, "X Ray", "Make the layer draw in front of objects");
	RNA_def_property_update(prop, NC_SCREEN | ND_GPENCIL, NULL);
}
コード例 #17
0
ファイル: rna_sculpt_paint.c プロジェクト: diekev/blender
static void rna_def_particle_edit(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;

	static EnumPropertyItem select_mode_items[] = {
		{SCE_SELECT_PATH, "PATH", ICON_PARTICLE_PATH, "Path", "Path edit mode"},
		{SCE_SELECT_POINT, "POINT", ICON_PARTICLE_POINT, "Point", "Point select mode"},
		{SCE_SELECT_END, "TIP", ICON_PARTICLE_TIP, "Tip", "Tip select mode"},
		{0, NULL, 0, NULL, NULL}
	};

	static EnumPropertyItem puff_mode[] = {
		{0, "ADD", 0, "Add", "Make hairs more puffy"},
		{1, "SUB", 0, "Sub", "Make hairs less puffy"},
		{0, NULL, 0, NULL, NULL}
	};

	static EnumPropertyItem length_mode[] = {
		{0, "GROW", 0, "Grow", "Make hairs longer"},
		{1, "SHRINK", 0, "Shrink", "Make hairs shorter"},
		{0, NULL, 0, NULL, NULL}
	};

	static EnumPropertyItem edit_type_items[] = {
		{PE_TYPE_PARTICLES, "PARTICLES", 0, "Particles", ""},
		{PE_TYPE_SOFTBODY, "SOFT_BODY", 0, "Soft body", ""},
		{PE_TYPE_CLOTH, "CLOTH", 0, "Cloth", ""},
		{0, NULL, 0, NULL, NULL}
	};


	/* edit */

	srna = RNA_def_struct(brna, "ParticleEdit", NULL);
	RNA_def_struct_sdna(srna, "ParticleEditSettings");
	RNA_def_struct_path_func(srna, "rna_ParticleEdit_path");
	RNA_def_struct_ui_text(srna, "Particle Edit", "Properties of particle editing mode");

	prop = RNA_def_property(srna, "tool", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "brushtype");
	RNA_def_property_enum_items(prop, particle_edit_hair_brush_items);
	RNA_def_property_enum_funcs(prop, NULL, "rna_ParticleEdit_tool_set", "rna_ParticleEdit_tool_itemf");
	RNA_def_property_ui_text(prop, "Tool", "");

	prop = RNA_def_property(srna, "select_mode", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_bitflag_sdna(prop, NULL, "selectmode");
	RNA_def_property_enum_items(prop, select_mode_items);
	RNA_def_property_ui_text(prop, "Selection Mode", "Particle select and display mode");
	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_update");

	prop = RNA_def_property(srna, "use_preserve_length", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_KEEP_LENGTHS);
	RNA_def_property_ui_text(prop, "Keep Lengths", "Keep path lengths constant");

	prop = RNA_def_property(srna, "use_preserve_root", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_LOCK_FIRST);
	RNA_def_property_ui_text(prop, "Keep Root", "Keep root keys unmodified");

	prop = RNA_def_property(srna, "use_emitter_deflect", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_DEFLECT_EMITTER);
	RNA_def_property_ui_text(prop, "Deflect Emitter", "Keep paths from intersecting the emitter");

	prop = RNA_def_property(srna, "emitter_distance", PROP_FLOAT, PROP_UNSIGNED);
	RNA_def_property_float_sdna(prop, NULL, "emitterdist");
	RNA_def_property_ui_range(prop, 0.0f, 10.0f, 10, 3);
	RNA_def_property_ui_text(prop, "Emitter Distance", "Distance to keep particles away from the emitter");

	prop = RNA_def_property(srna, "use_fade_time", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_FADE_TIME);
	RNA_def_property_ui_text(prop, "Fade Time", "Fade paths and keys further away from current frame");
	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_update");

	prop = RNA_def_property(srna, "use_auto_velocity", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_AUTO_VELOCITY);
	RNA_def_property_ui_text(prop, "Auto Velocity", "Calculate point velocities automatically");

	prop = RNA_def_property(srna, "show_particles", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_DRAW_PART);
	RNA_def_property_ui_text(prop, "Draw Particles", "Draw actual particles");
	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_redo");

	prop = RNA_def_property(srna, "use_default_interpolate", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_INTERPOLATE_ADDED);
	RNA_def_property_ui_text(prop, "Interpolate", "Interpolate new particles from the existing ones");

	prop = RNA_def_property(srna, "default_key_count", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "totaddkey");
	RNA_def_property_range(prop, 2, SHRT_MAX);
	RNA_def_property_ui_range(prop, 2, 20, 10, 3);
	RNA_def_property_ui_text(prop, "Keys", "How many keys to make new particles with");

	prop = RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE);
	RNA_def_property_struct_type(prop, "ParticleBrush");
	RNA_def_property_pointer_funcs(prop, "rna_ParticleEdit_brush_get", NULL, NULL, NULL);
	RNA_def_property_ui_text(prop, "Brush", "");

	prop = RNA_def_property(srna, "draw_step", PROP_INT, PROP_NONE);
	RNA_def_property_range(prop, 1, 10);
	RNA_def_property_ui_text(prop, "Steps", "How many steps to draw the path with");
	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_redo");

	prop = RNA_def_property(srna, "fade_frames", PROP_INT, PROP_NONE);
	RNA_def_property_range(prop, 1, 100);
	RNA_def_property_ui_text(prop, "Frames", "How many frames to fade");
	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_update");

	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "edittype");
	RNA_def_property_enum_items(prop, edit_type_items);
	RNA_def_property_ui_text(prop, "Type", "");
	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_redo");

	prop = RNA_def_property(srna, "is_editable", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_funcs(prop, "rna_ParticleEdit_editable_get", NULL);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Editable", "A valid edit mode exists");

	prop = RNA_def_property(srna, "is_hair", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_funcs(prop, "rna_ParticleEdit_hair_get", NULL);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Hair", "Editing hair");

	prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Object", "The edited object");

	prop = RNA_def_property(srna, "shape_object", PROP_POINTER, PROP_NONE);
	RNA_def_property_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Shape Object", "Outer shape to use for tools");
	RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Mesh_object_poll");
	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_redo");

	/* brush */

	srna = RNA_def_struct(brna, "ParticleBrush", NULL);
	RNA_def_struct_sdna(srna, "ParticleBrushData");
	RNA_def_struct_path_func(srna, "rna_ParticleBrush_path");
	RNA_def_struct_ui_text(srna, "Particle Brush", "Particle editing brush");

	prop = RNA_def_property(srna, "size", PROP_INT, PROP_PIXEL);
	RNA_def_property_range(prop, 1, SHRT_MAX);
	RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 10, 3);
	RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels");

	prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
	RNA_def_property_range(prop, 0.001, 1.0);
	RNA_def_property_ui_text(prop, "Strength", "Brush strength");

	prop = RNA_def_property(srna, "count", PROP_INT, PROP_NONE);
	RNA_def_property_range(prop, 1, 1000);
	RNA_def_property_ui_range(prop, 1, 100, 10, 3);
	RNA_def_property_ui_text(prop, "Count", "Particle count");

	prop = RNA_def_property(srna, "steps", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "step");
	RNA_def_property_range(prop, 1, SHRT_MAX);
	RNA_def_property_ui_range(prop, 1, 50, 10, 3);
	RNA_def_property_ui_text(prop, "Steps", "Brush steps");

	prop = RNA_def_property(srna, "puff_mode", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "invert");
	RNA_def_property_enum_items(prop, puff_mode);
	RNA_def_property_ui_text(prop, "Puff Mode", "");

	prop = RNA_def_property(srna, "use_puff_volume", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_BRUSH_DATA_PUFF_VOLUME);
	RNA_def_property_ui_text(prop, "Puff Volume",
	                         "Apply puff to unselected end-points (helps maintain hair volume when puffing root)");

	prop = RNA_def_property(srna, "length_mode", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "invert");
	RNA_def_property_enum_items(prop, length_mode);
	RNA_def_property_ui_text(prop, "Length Mode", "");

	/* dummy */
	prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
	RNA_def_property_struct_type(prop, "CurveMapping");
	RNA_def_property_pointer_funcs(prop, "rna_ParticleBrush_curve_get", NULL, NULL, NULL);
	RNA_def_property_ui_text(prop, "Curve", "");
}
コード例 #18
0
ファイル: rna_animation.c プロジェクト: diekev/blender
static void rna_def_animdata(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;
	
	srna = RNA_def_struct(brna, "AnimData", NULL);
	RNA_def_struct_ui_text(srna, "Animation Data", "Animation data for data-block");
	RNA_def_struct_ui_icon(srna, ICON_ANIM_DATA);
	
	/* NLA */
	prop = RNA_def_property(srna, "nla_tracks", PROP_COLLECTION, PROP_NONE);
	RNA_def_property_collection_sdna(prop, NULL, "nla_tracks", NULL);
	RNA_def_property_struct_type(prop, "NlaTrack");
	RNA_def_property_ui_text(prop, "NLA Tracks", "NLA Tracks (i.e. Animation Layers)");

	rna_api_animdata_nla_tracks(brna, prop);
	
	/* Active Action */
	prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
	/* this flag as well as the dynamic test must be defined for this to be editable... */
	RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
	RNA_def_property_pointer_funcs(prop, NULL, "rna_AnimData_action_set", NULL, "rna_Action_id_poll");
	RNA_def_property_editable_func(prop, "rna_AnimData_action_editable");
	RNA_def_property_ui_text(prop, "Action", "Active Action for this data-block");
	RNA_def_property_update(prop, NC_ANIMATION | ND_NLA_ACTCHANGE, "rna_AnimData_update");

	/* Active Action Settings */
	prop = RNA_def_property(srna, "action_extrapolation", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "act_extendmode");
	RNA_def_property_enum_items(prop, rna_enum_nla_mode_extend_items);
	RNA_def_property_ui_text(prop, "Action Extrapolation",
	                         "Action to take for gaps past the Active Action's range (when evaluating with NLA)");
	RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL);
	
	prop = RNA_def_property(srna, "action_blend_type", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "act_blendmode");
	RNA_def_property_enum_items(prop, rna_enum_nla_mode_blend_items);
	RNA_def_property_ui_text(prop, "Action Blending",
	                         "Method used for combining Active Action's result with result of NLA stack");
	RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL); /* this will do? */
	
	prop = RNA_def_property(srna, "action_influence", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "act_influence");
	RNA_def_property_float_default(prop, 1.0f);
	RNA_def_property_range(prop, 0.0f, 1.0f);
	RNA_def_property_ui_text(prop, "Action Influence",
	                         "Amount the Active Action contributes to the result of the NLA stack");
	RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL); /* this will do? */
	
	/* Drivers */
	prop = RNA_def_property(srna, "drivers", PROP_COLLECTION, PROP_NONE);
	RNA_def_property_collection_sdna(prop, NULL, "drivers", NULL);
	RNA_def_property_struct_type(prop, "FCurve");
	RNA_def_property_ui_text(prop, "Drivers", "The Drivers/Expressions for this data-block");
	
	rna_api_animdata_drivers(brna, prop);
	
	/* General Settings */
	prop = RNA_def_property(srna, "use_nla", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ADT_NLA_EVAL_OFF);
	RNA_def_property_ui_text(prop, "NLA Evaluation Enabled", "NLA stack is evaluated when evaluating this block");
	RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL); /* this will do? */

	prop = RNA_def_property(srna, "use_tweak_mode", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", ADT_NLA_EDIT_ON);
	RNA_def_property_boolean_funcs(prop, NULL, "rna_AnimData_tweakmode_set");
	RNA_def_property_ui_text(prop, "Use NLA Tweak Mode", "Whether to enable or disable tweak mode in NLA");
	RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL);
}
コード例 #19
0
ファイル: rna_meta.c プロジェクト: YasirArafath/blender-git
static void rna_def_metaball(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;
	static EnumPropertyItem prop_update_items[] = {
		{MB_UPDATE_ALWAYS, "UPDATE_ALWAYS", 0, "Always", "While editing, update metaball always"},
		{MB_UPDATE_HALFRES, "HALFRES", 0, "Half", "While editing, update metaball in half resolution"},
		{MB_UPDATE_FAST, "FAST", 0, "Fast", "While editing, update metaball without polygonization"},
		{MB_UPDATE_NEVER, "NEVER", 0, "Never", "While editing, don't update metaball at all"},
		{0, NULL, 0, NULL, NULL}
	};
	
	srna = RNA_def_struct(brna, "MetaBall", "ID");
	RNA_def_struct_ui_text(srna, "MetaBall", "Metaball datablock to defined blobby surfaces");
	RNA_def_struct_ui_icon(srna, ICON_META_DATA);

	prop = RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_NONE);
	RNA_def_property_collection_sdna(prop, NULL, "elems", NULL);
	RNA_def_property_struct_type(prop, "MetaElement");
	RNA_def_property_ui_text(prop, "Elements", "Meta elements");
	rna_def_metaball_elements(brna, prop);

	/* enums */
	prop = RNA_def_property(srna, "update_method", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "flag");
	RNA_def_property_enum_items(prop, prop_update_items);
	RNA_def_property_ui_text(prop, "Update", "Metaball edit update behavior");
	RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
	
	/* number values */
	prop = RNA_def_property(srna, "resolution", PROP_FLOAT, PROP_DISTANCE);
	RNA_def_property_float_sdna(prop, NULL, "wiresize");
	RNA_def_property_range(prop, 0.005f, 10000.0f);
	RNA_def_property_ui_range(prop, 0.05f, 1000.0f, 2.5f, 3);
	RNA_def_property_ui_text(prop, "Wire Size", "Polygonization resolution in the 3D viewport");
	RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
	
	prop = RNA_def_property(srna, "render_resolution", PROP_FLOAT, PROP_DISTANCE);
	RNA_def_property_float_sdna(prop, NULL, "rendersize");
	RNA_def_property_range(prop, 0.005f, 10000.0f);
	RNA_def_property_ui_range(prop, 0.025f, 1000.0f, 2.5f, 3);
	RNA_def_property_ui_text(prop, "Render Size", "Polygonization resolution in rendering");
	RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
	
	prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "thresh");
	RNA_def_property_range(prop, 0.0f, 5.0f);
	RNA_def_property_ui_text(prop, "Threshold", "Influence of meta elements");
	RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");

	/* texture space */
	prop = RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "texflag", MB_AUTOSPACE);
	RNA_def_property_ui_text(prop, "Auto Texture Space",
	                         "Adjust active object's texture space automatically when transforming object");
	
	prop = RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION);
	RNA_def_property_array(prop, 3);
	RNA_def_property_ui_text(prop, "Texture Space Location", "Texture space location");
	RNA_def_property_editable_func(prop, "rna_Meta_texspace_editable");
	RNA_def_property_float_funcs(prop, "rna_Meta_texspace_loc_get", "rna_Meta_texspace_loc_set", NULL);
	RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
	
	prop = RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ);
	RNA_def_property_array(prop, 3);
	RNA_def_property_flag(prop, PROP_PROPORTIONAL);
	RNA_def_property_ui_text(prop, "Texture Space Size", "Texture space size");
	RNA_def_property_editable_func(prop, "rna_Meta_texspace_editable");
	RNA_def_property_float_funcs(prop, "rna_Meta_texspace_size_get", "rna_Meta_texspace_size_set", NULL);
	RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
	
	/* not supported yet */
#if 0
	prop = RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER);
	RNA_def_property_float(prop, NULL, "rot");
	RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation");
	RNA_def_property_editable_func(prop, "rna_Meta_texspace_editable");
	RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
#endif
	
	/* materials */
	prop = RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
	RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
	RNA_def_property_struct_type(prop, "Material");
	RNA_def_property_ui_text(prop, "Materials", "");
	RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
	RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int");
	
	prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_funcs(prop, "rna_Meta_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");

	/* anim */
	rna_def_animdata_common(srna);

	RNA_api_meta(srna);
}
コード例 #20
0
ファイル: rna_ID.c プロジェクト: mauge123/mechanical-blender
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");
}
コード例 #21
0
static void rna_def_number_property(StructRNA *srna, PropertyType type)
{
	PropertyRNA *prop;

	prop= RNA_def_property(srna, "default", type, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Default", "Default value for this number");

	switch(type) {
		case PROP_BOOLEAN:
			RNA_def_property_boolean_funcs(prop, "rna_BoolProperty_default_get", NULL);
			break;
		case PROP_INT:
			RNA_def_property_int_funcs(prop, "rna_IntProperty_default_get", NULL, NULL);
			break;
		case PROP_FLOAT:
			RNA_def_property_float_funcs(prop, "rna_FloatProperty_default_get", NULL, NULL);
			break;
		default:
			break;
	}


	prop= RNA_def_property(srna, "default_array", type, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_array(prop, RNA_MAX_ARRAY_DIMENSION); /* no fixed default length, important its not 0 though */
	RNA_def_property_flag(prop, PROP_DYNAMIC);
	RNA_def_property_dynamic_array_funcs(prop, "rna_NumberProperty_default_array_get_length"); /* same for all types */

	switch(type) {
		case PROP_BOOLEAN:
			RNA_def_property_boolean_funcs(prop, "rna_BoolProperty_default_array_get", NULL);
			break;
		case PROP_INT:
			RNA_def_property_int_funcs(prop, "rna_IntProperty_default_array_get", NULL, NULL);
			break;
		case PROP_FLOAT:
			RNA_def_property_float_funcs(prop, "rna_FloatProperty_default_array_get", NULL, NULL);
			break;
		default:
			break;
	}
	RNA_def_property_ui_text(prop, "Default Array", "Default value for this array");


	prop= RNA_def_property(srna, "array_length", PROP_INT, PROP_UNSIGNED);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_int_funcs(prop, "rna_Property_array_length_get", NULL, NULL);
	RNA_def_property_ui_text(prop, "Array Length", "Maximum length of the array, 0 means unlimited");

	if(type == PROP_BOOLEAN)
		return;

	prop= RNA_def_property(srna, "hard_min", type, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	if(type == PROP_INT) RNA_def_property_int_funcs(prop, "rna_IntProperty_hard_min_get", NULL, NULL);
	else RNA_def_property_float_funcs(prop, "rna_FloatProperty_hard_min_get", NULL, NULL);
	RNA_def_property_ui_text(prop, "Hard Minimum", "Minimum value used by buttons");

	prop= RNA_def_property(srna, "hard_max", type, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	if(type == PROP_INT) RNA_def_property_int_funcs(prop, "rna_IntProperty_hard_max_get", NULL, NULL);
	else RNA_def_property_float_funcs(prop, "rna_FloatProperty_hard_max_get", NULL, NULL);
	RNA_def_property_ui_text(prop, "Hard Maximum", "Maximum value used by buttons");

	prop= RNA_def_property(srna, "soft_min", type, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	if(type == PROP_INT) RNA_def_property_int_funcs(prop, "rna_IntProperty_soft_min_get", NULL, NULL);
	else RNA_def_property_float_funcs(prop, "rna_FloatProperty_soft_min_get", NULL, NULL);
	RNA_def_property_ui_text(prop, "Soft Minimum", "Minimum value used by buttons");

	prop= RNA_def_property(srna, "soft_max", type, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	if(type == PROP_INT) RNA_def_property_int_funcs(prop, "rna_IntProperty_soft_max_get", NULL, NULL);
	else RNA_def_property_float_funcs(prop, "rna_FloatProperty_soft_max_get", NULL, NULL);
	RNA_def_property_ui_text(prop, "Soft Maximum", "Maximum value used by buttons");

	prop= RNA_def_property(srna, "step", type, PROP_UNSIGNED);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	if(type == PROP_INT) RNA_def_property_int_funcs(prop, "rna_IntProperty_step_get", NULL, NULL);
	else RNA_def_property_float_funcs(prop, "rna_FloatProperty_step_get", NULL, NULL);
	RNA_def_property_ui_text(prop, "Step", "Step size used by number buttons, for floats 1/100th of the step size");

	if(type == PROP_FLOAT) {
		prop= RNA_def_property(srna, "precision", PROP_INT, PROP_UNSIGNED);
		RNA_def_property_clear_flag(prop, PROP_EDITABLE);
		RNA_def_property_int_funcs(prop, "rna_FloatProperty_precision_get", NULL, NULL);
		RNA_def_property_ui_text(prop, "Precision", "Number of digits after the dot used by buttons");
	}
}
コード例 #22
0
ファイル: rna_ID.c プロジェクト: mauge123/mechanical-blender
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, "tag", LIB_TAG_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, "tag", LIB_TAG_ID_RECALC);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Is Updated", "Data-block is tagged for recalculation");

	prop = RNA_def_property(srna, "is_updated_data", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_ID_RECALC_DATA);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Is Updated Data", "Data-block data is tagged for recalculation");

	prop = RNA_def_property(srna, "is_library_indirect", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_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)");
	RNA_def_function_flag(func, FUNC_USE_MAIN);
	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, "user_remap", "rna_ID_user_remap");
	RNA_def_function_ui_description(func, "Replace all usage in the .blend file of this ID by new given one");
	RNA_def_function_flag(func, FUNC_USE_MAIN);
	parm = RNA_def_pointer(func, "new_id", "ID", "", "New ID to use");
	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);

	func = RNA_def_function(srna, "user_of_id", "BKE_library_ID_use_ID");
	RNA_def_function_ui_description(func, "Count the number of times that ID uses/references given one");
	parm = RNA_def_pointer(func, "id", "ID", "", "ID to count usages");
	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
	parm = RNA_def_int(func, "count", 0, 0, INT_MAX,
	                   "", "Number of usages/references of given id by current data-block", 0, INT_MAX);
	RNA_def_function_return(func, parm);

	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");
}
コード例 #23
0
ファイル: rna_color.c プロジェクト: akonneker/blensor
static void rna_def_colormanage(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;

	static EnumPropertyItem display_device_items[] = {
		{0, "DEFAULT", 0, "Default", ""},
		{0, NULL, 0, NULL, NULL}
	};

	static EnumPropertyItem look_items[] = {
		{0, "NONE", 0, "None", "Do not modify image in an artistic manner"},
		{0, NULL, 0, NULL, NULL}
	};

	static EnumPropertyItem view_transform_items[] = {
		{0, "NONE", 0, "None", "Do not perform any color transform on display, use old non-color managed technique for display"},
		{0, NULL, 0, NULL, NULL}
	};

	static EnumPropertyItem color_space_items[] = {
		{0, "NONE", 0, "None", "Do not perform any color transform on load, treat colors as in scene linear space already"},
		{0, NULL, 0, NULL, NULL}
	};

	/* ** Display Settings  **  */
	srna = RNA_def_struct(brna, "ColorManagedDisplaySettings", NULL);
	RNA_def_struct_path_func(srna, "rna_ColorManagedDisplaySettings_path");
	RNA_def_struct_ui_text(srna, "ColorManagedDisplaySettings", "Color management specific to display device");

	prop = RNA_def_property(srna, "display_device", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_items(prop, display_device_items);
	RNA_def_property_enum_funcs(prop, "rna_ColorManagedDisplaySettings_display_device_get",
	                                  "rna_ColorManagedDisplaySettings_display_device_set",
	                                  "rna_ColorManagedDisplaySettings_display_device_itemf");
	RNA_def_property_ui_text(prop, "Display Device", "Display device name");
	RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagedDisplaySettings_display_device_update");

	/* ** View Settings  **  */
	srna = RNA_def_struct(brna, "ColorManagedViewSettings", NULL);
	RNA_def_struct_path_func(srna, "rna_ColorManagedViewSettings_path");
	RNA_def_struct_ui_text(srna, "ColorManagedViewSettings", "Color management settings used for displaying images on the display");

	prop = RNA_def_property(srna, "look", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_items(prop, look_items);
	RNA_def_property_enum_funcs(prop, "rna_ColorManagedViewSettings_look_get",
	                                  "rna_ColorManagedViewSettings_look_set",
	                                  "rna_ColorManagedViewSettings_look_itemf");
	RNA_def_property_ui_text(prop, "Look", "Additional transform applied before view transform for an artistic needs");
	RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");

	prop = RNA_def_property(srna, "view_transform", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_items(prop, view_transform_items);
	RNA_def_property_enum_funcs(prop, "rna_ColorManagedViewSettings_view_transform_get",
	                                  "rna_ColorManagedViewSettings_view_transform_set",
	                                  "rna_ColorManagedViewSettings_view_transform_itemf");
	RNA_def_property_ui_text(prop, "View Transform", "View used when converting image to a display space");
	RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");

	prop = RNA_def_property(srna, "exposure", PROP_FLOAT, PROP_FACTOR);
	RNA_def_property_float_sdna(prop, NULL, "exposure");
	RNA_def_property_range(prop, -10.0f, 10.0f);
	RNA_def_property_float_default(prop, 0.0f);
	RNA_def_property_ui_text(prop, "Exposure", "Exposure (stops) applied before display transform");
	RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");

	prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_FACTOR);
	RNA_def_property_float_sdna(prop, NULL, "gamma");
	RNA_def_property_float_default(prop, 1.0f);
	RNA_def_property_range(prop, 0.0f, 5.0f);
	RNA_def_property_ui_text(prop, "Gamma", "Amount of gamma modification applied after display transform");
	RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");

	prop = RNA_def_property(srna, "curve_mapping", PROP_POINTER, PROP_NONE);
	RNA_def_property_pointer_sdna(prop, NULL, "curve_mapping");
	RNA_def_property_ui_text(prop, "Curve", "Color curve mapping applied before display transform");
	RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");

	prop = RNA_def_property(srna, "use_curve_mapping", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", COLORMANAGE_VIEW_USE_CURVES);
	RNA_def_property_boolean_funcs(prop, NULL, "rna_ColorManagedViewSettings_use_curves_set");
	RNA_def_property_ui_text(prop, "Use Curves", "Use RGB curved for pre-display transformation");
	RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");

	/* ** Colorspace **  */
	srna = RNA_def_struct(brna, "ColorManagedInputColorspaceSettings", NULL);
	RNA_def_struct_path_func(srna, "rna_ColorManagedInputColorspaceSettings_path");
	RNA_def_struct_ui_text(srna, "ColorManagedInputColorspaceSettings", "Input color space settings");

	prop = RNA_def_property(srna, "name", PROP_ENUM, PROP_NONE);
	RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
	RNA_def_property_enum_items(prop, color_space_items);
	RNA_def_property_enum_funcs(prop, "rna_ColorManagedColorspaceSettings_colorspace_get",
	                                  "rna_ColorManagedColorspaceSettings_colorspace_set",
	                                  "rna_ColorManagedColorspaceSettings_colorspace_itemf");
	RNA_def_property_ui_text(prop, "Input Color Space", "Color space of the image or movie on disk");
	RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagedColorspaceSettings_reload_update");

	//
	srna = RNA_def_struct(brna, "ColorManagedSequencerColorspaceSettings", NULL);
	RNA_def_struct_path_func(srna, "rna_ColorManagedSequencerColorspaceSettings_path");
	RNA_def_struct_ui_text(srna, "ColorManagedSequencerColorspaceSettings", "Input color space settings");

	prop = RNA_def_property(srna, "name", PROP_ENUM, PROP_NONE);
	RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
	RNA_def_property_enum_items(prop, color_space_items);
	RNA_def_property_enum_funcs(prop, "rna_ColorManagedColorspaceSettings_colorspace_get",
	                                  "rna_ColorManagedColorspaceSettings_colorspace_set",
	                                  "rna_ColorManagedColorspaceSettings_colorspace_itemf");
	RNA_def_property_ui_text(prop, "Color Space", "Color space that the sequencer operates in");
	RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagedColorspaceSettings_reload_update");
}
コード例 #24
0
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 datablocks, 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 datablock 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 datablock 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 datablock 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 (initial state is undefined)");

	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 datablock is linked from");

	/* functions */
	func= RNA_def_function(srna, "copy", "rna_ID_copy");
	RNA_def_function_ui_description(func, "Create a copy of this datablock (not supported for all datablocks)");
	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 datablock so its not saved, "
	                                      "on reload the data will be removed");

	func= RNA_def_function(srna, "animation_data_create", "BKE_id_add_animdata");
	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", "BKE_free_animdata");
	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");
	RNA_def_enum_flag(func, "refresh", update_flag_items, 0, "", "Type of updates to perform");
}
コード例 #25
0
static void rna_def_bone_common(StructRNA *srna, int editbone)
{
    PropertyRNA *prop;

    /* strings */
    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", "");
    RNA_def_struct_name_property(srna, prop);
    if(editbone) RNA_def_property_string_funcs(prop, NULL, NULL, "rna_EditBone_name_set");
    else RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Bone_name_set");
    RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");

    /* flags */
    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);
    if(editbone) RNA_def_property_boolean_funcs(prop, NULL, "rna_EditBone_layer_set");
    else RNA_def_property_boolean_funcs(prop, NULL, "rna_Bone_layer_set");
    RNA_def_property_ui_text(prop, "Layers", "Layers bone exists in");
    RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");

    prop= RNA_def_property(srna, "use_connect", PROP_BOOLEAN, PROP_NONE);
    RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_CONNECTED);
    if(editbone) RNA_def_property_boolean_funcs(prop, NULL, "rna_EditBone_connected_set");
    else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
    RNA_def_property_ui_text(prop, "Connected", "When bone has a parent, bone's head is struck to the parent's tail");
    RNA_def_property_update(prop, 0, "rna_Armature_update_data");

    prop= RNA_def_property(srna, "use_inherit_rotation", PROP_BOOLEAN, PROP_NONE);
    RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_HINGE);
    RNA_def_property_ui_text(prop, "Inherit Rotation", "Bone inherits rotation or scale from parent bone");
    RNA_def_property_update(prop, 0, "rna_Armature_update_data");

    prop= RNA_def_property(srna, "use_envelope_multiply", PROP_BOOLEAN, PROP_NONE);
    RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_MULT_VG_ENV);
    RNA_def_property_ui_text(prop, "Multiply Vertex Group with Envelope", "When deforming bone, multiply effects of Vertex Group weights with Envelope influence");
    RNA_def_property_update(prop, 0, "rna_Armature_update_data");

    prop= RNA_def_property(srna, "use_deform", PROP_BOOLEAN, PROP_NONE);
    RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_NO_DEFORM);
    RNA_def_property_ui_text(prop, "Deform", "Bone does not deform any geometry");
    RNA_def_property_update(prop, 0, "rna_Armature_update_data");

    prop= RNA_def_property(srna, "use_inherit_scale", PROP_BOOLEAN, PROP_NONE);
    RNA_def_property_ui_text(prop, "Inherit Scale", "Bone inherits scaling from parent bone");
    RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_NO_SCALE);
    RNA_def_property_update(prop, 0, "rna_Armature_update_data");

    prop= RNA_def_property(srna, "use_local_location", PROP_BOOLEAN, PROP_NONE);
    RNA_def_property_ui_text(prop, "Local Location", "Bone location is set in local space");
    RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_NO_LOCAL_LOCATION);
    RNA_def_property_update(prop, 0, "rna_Armature_update_data");

    prop= RNA_def_property(srna, "show_wire", PROP_BOOLEAN, PROP_NONE);
    RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_DRAWWIRE);
    RNA_def_property_ui_text(prop, "Draw Wire", "Bone is always drawn as Wireframe regardless of viewport draw mode. Useful for non-obstructive custom bone shapes");
    RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");

    prop= RNA_def_property(srna, "use_cyclic_offset", PROP_BOOLEAN, PROP_NONE);
    RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_NO_CYCLICOFFSET);
    RNA_def_property_ui_text(prop, "Cyclic Offset", "When bone doesn't have a parent, it receives cyclic offset effects");
    RNA_def_property_update(prop, 0, "rna_Armature_update_data");

    prop= RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
    RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_UNSELECTABLE);
    RNA_def_property_ui_text(prop, "Selectable", "Bone is able to be selected");
    RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");

    /* Number values */
    /* envelope deform settings */
    prop= RNA_def_property(srna, "envelope_distance", PROP_FLOAT, PROP_NONE);
    RNA_def_property_float_sdna(prop, NULL, "dist");
    RNA_def_property_range(prop, 0.0f, 1000.0f);
    RNA_def_property_ui_text(prop, "Envelope Deform Distance", "Bone deformation distance (for Envelope deform only)");
    RNA_def_property_update(prop, 0, "rna_Armature_update_data");

    prop= RNA_def_property(srna, "envelope_weight", PROP_FLOAT, PROP_NONE);
    RNA_def_property_float_sdna(prop, NULL, "weight");
    RNA_def_property_range(prop, 0.0f, 1000.0f);
    RNA_def_property_ui_text(prop, "Envelope Deform Weight", "Bone deformation weight (for Envelope deform only)");
    RNA_def_property_update(prop, 0, "rna_Armature_update_data");

    prop= RNA_def_property(srna, "head_radius", PROP_FLOAT, PROP_UNSIGNED);
    if(editbone) RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
    else RNA_def_property_update(prop, 0, "rna_Armature_update_data");
    RNA_def_property_float_sdna(prop, NULL, "rad_head");
    //RNA_def_property_range(prop, 0, 1000);  // XXX range is 0 to lim, where lim= 10000.0f*MAX2(1.0, view3d->grid);
    RNA_def_property_ui_range(prop, 0.01, 100, 0.1, 3);
    RNA_def_property_ui_text(prop, "Envelope Head Radius", "Radius of head of bone (for Envelope deform only)");

    prop= RNA_def_property(srna, "tail_radius", PROP_FLOAT, PROP_UNSIGNED);
    if(editbone) RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
    else RNA_def_property_update(prop, 0, "rna_Armature_update_data");
    RNA_def_property_float_sdna(prop, NULL, "rad_tail");
    //RNA_def_property_range(prop, 0, 1000);  // XXX range is 0 to lim, where lim= 10000.0f*MAX2(1.0, view3d->grid);
    RNA_def_property_ui_range(prop, 0.01, 100, 0.1, 3);
    RNA_def_property_ui_text(prop, "Envelope Tail Radius", "Radius of tail of bone (for Envelope deform only)");

    /* b-bones deform settings */
    prop= RNA_def_property(srna, "bbone_segments", PROP_INT, PROP_NONE);
    RNA_def_property_int_sdna(prop, NULL, "segments");
    RNA_def_property_range(prop, 1, 32);
    RNA_def_property_ui_text(prop, "B-Bone Segments", "Number of subdivisions of bone (for B-Bones only)");
    RNA_def_property_update(prop, 0, "rna_Armature_update_data");

    prop= RNA_def_property(srna, "bbone_in", PROP_FLOAT, PROP_NONE);
    RNA_def_property_float_sdna(prop, NULL, "ease1");
    RNA_def_property_range(prop, 0.0f, 2.0f);
    RNA_def_property_ui_text(prop, "B-Bone Ease In", "Length of first Bezier Handle (for B-Bones only)");
    RNA_def_property_update(prop, 0, "rna_Armature_update_data");

    prop= RNA_def_property(srna, "bbone_out", PROP_FLOAT, PROP_NONE);
    RNA_def_property_float_sdna(prop, NULL, "ease2");
    RNA_def_property_range(prop, 0.0f, 2.0f);
    RNA_def_property_ui_text(prop, "B-Bone Ease Out", "Length of second Bezier Handle (for B-Bones only)");
    RNA_def_property_update(prop, 0, "rna_Armature_update_data");

    prop= RNA_def_property(srna, "bbone_x", PROP_FLOAT, PROP_NONE);
    RNA_def_property_float_sdna(prop, NULL, "xwidth");
    RNA_def_property_range(prop, 0.0f, 1000.0f);
    RNA_def_property_ui_text(prop, "B-Bone Display X Width", "B-Bone X size");
    RNA_def_property_update(prop, 0, "rna_Armature_update_data");

    prop= RNA_def_property(srna, "bbone_z", PROP_FLOAT, PROP_NONE);
    RNA_def_property_float_sdna(prop, NULL, "zwidth");
    RNA_def_property_range(prop, 0.0f, 1000.0f);
    RNA_def_property_ui_text(prop, "B-Bone Display Z Width", "B-Bone Z size");
    RNA_def_property_update(prop, 0, "rna_Armature_update_data");
}
コード例 #26
0
static void rna_def_sensor(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;

	srna = RNA_def_struct(brna, "Sensor", NULL);
	RNA_def_struct_ui_text(srna, "Sensor", "Game engine logic brick to detect events");
	RNA_def_struct_sdna(srna, "bSensor");
	RNA_def_struct_refine_func(srna, "rna_Sensor_refine");

	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
	RNA_def_property_ui_text(prop, "Name", "Sensor name");
	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Sensor_name_set");
	RNA_def_struct_name_property(srna, prop);
	RNA_def_property_update(prop, NC_LOGIC, NULL);

	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
	RNA_def_property_enum_items(prop, sensor_type_items);
	RNA_def_property_enum_funcs(prop, NULL, "rna_Sensor_type_set", "rna_Sensor_type_itemf");
	RNA_def_property_ui_text(prop, "Type", "");
	RNA_def_property_update(prop, NC_LOGIC, NULL);

	prop = RNA_def_property(srna, "pin", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", SENS_PIN);
	RNA_def_property_ui_text(prop, "Pinned", "Display when not linked to a visible states controller");
	RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
	RNA_def_property_update(prop, NC_LOGIC, NULL);

	prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SENS_DEACTIVATE);
	RNA_def_property_ui_text(prop, "Active", "Set active state of the sensor");
	RNA_def_property_update(prop, NC_LOGIC, NULL);

	prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", SENS_SHOW);
	RNA_def_property_ui_text(prop, "Expanded", "Set sensor expanded in the user interface");
	RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
	RNA_def_property_update(prop, NC_LOGIC, NULL);

	prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_ui_text(prop, "Invert Output", "Invert the level(output) of this sensor");
	RNA_def_property_update(prop, NC_LOGIC, NULL);

	prop = RNA_def_property(srna, "use_level", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "level", 1);
	RNA_def_property_ui_text(prop, "Level",
	                         "Level detector, trigger controllers of new states "
	                         "(only applicable upon logic state transition)");
	RNA_def_property_boolean_funcs(prop, NULL, "rna_Sensor_level_set");
	RNA_def_property_update(prop, NC_LOGIC, NULL);

	prop = RNA_def_property(srna, "use_pulse_true_level", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "pulse", SENS_PULSE_REPEAT);
	RNA_def_property_ui_text(prop, "Pulse True Level", "Activate TRUE level triggering (pulse mode)");
	RNA_def_property_update(prop, NC_LOGIC, NULL);

	prop = RNA_def_property(srna, "use_pulse_false_level", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "pulse", SENS_NEG_PULSE_MODE);
	RNA_def_property_ui_text(prop, "Pulse False Level", "Activate FALSE level triggering (pulse mode)");
	RNA_def_property_update(prop, NC_LOGIC, NULL);
	
	prop = RNA_def_property(srna, "frequency", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "freq");
	RNA_def_property_ui_text(prop, "Frequency", "Delay between repeated pulses(in logic tics, 0=no delay)");
	RNA_def_property_range(prop, 0, 10000);
	RNA_def_property_update(prop, NC_LOGIC, NULL);

	prop = RNA_def_property(srna, "use_tap", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "tap", 1);
	RNA_def_property_boolean_funcs(prop, NULL, "rna_Sensor_tap_set");
	RNA_def_property_ui_text(prop, "Tap",
	                         "Trigger controllers only for an instant, even while the sensor remains true");
	RNA_def_property_update(prop, NC_LOGIC, NULL);

	prop = RNA_def_property(srna, "controllers", PROP_COLLECTION, PROP_NONE);
	RNA_def_property_collection_sdna(prop, NULL, "links", NULL);
	RNA_def_property_struct_type(prop, "Controller");
	RNA_def_property_ui_text(prop, "Controllers", "The list containing the controllers connected to the sensor");
	RNA_def_property_collection_funcs(prop, "rna_Sensor_controllers_begin", "rna_iterator_array_next",
	                                  "rna_iterator_array_end", "rna_iterator_array_dereference_get",
	                                  "rna_Sensor_controllers_length", NULL, NULL, NULL);


	RNA_api_sensor(srna);
}
コード例 #27
0
static void rna_def_gpencil_layer(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;

	FunctionRNA *func;
	
	srna = RNA_def_struct(brna, "GPencilLayer", NULL);
	RNA_def_struct_sdna(srna, "bGPDlayer");
	RNA_def_struct_ui_text(srna, "Grease Pencil Layer", "Collection of related sketches");
	RNA_def_struct_path_func(srna, "rna_GPencilLayer_path");
	
	/* Name */
	prop = RNA_def_property(srna, "info", PROP_STRING, PROP_NONE);
	RNA_def_property_ui_text(prop, "Info", "Layer name");
	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GPencilLayer_info_set");
	RNA_def_struct_name_property(srna, prop);
	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);

	/* Frames */
	prop = RNA_def_property(srna, "frames", PROP_COLLECTION, PROP_NONE);
	RNA_def_property_collection_sdna(prop, NULL, "frames", NULL);
	RNA_def_property_struct_type(prop, "GPencilFrame");
	RNA_def_property_ui_text(prop, "Frames", "Sketches for this layer on different frames");
	rna_def_gpencil_frames_api(brna, prop);

	/* Active Frame */
	prop = RNA_def_property(srna, "active_frame", PROP_POINTER, PROP_NONE);
	RNA_def_property_pointer_sdna(prop, NULL, "actframe");
	RNA_def_property_ui_text(prop, "Active Frame", "Frame currently being displayed for this layer");
	RNA_def_property_editable_func(prop, "rna_GPencilLayer_active_frame_editable");
	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);

	/* Draw Style */
	// TODO: replace these with a "draw type" combo (i.e. strokes only, filled strokes, strokes + fills, volumetric)?
	prop = RNA_def_property(srna, "use_volumetric_strokes", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_VOLUMETRIC);
	RNA_def_property_ui_text(prop, "Volumetric Strokes", "Draw strokes as a series of circular blobs, resulting in a volumetric effect");
	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
	
	/* Stroke Drawing Color */
	prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
	RNA_def_property_array(prop, 3);
	RNA_def_property_range(prop, 0.0f, 1.0f);
	RNA_def_property_ui_text(prop, "Color", "Color for all strokes in this layer");
	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
	
	prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "color[3]");
	RNA_def_property_range(prop, 0.0, 1.0f);
	RNA_def_property_ui_text(prop, "Opacity", "Layer Opacity");
	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
	
	/* Fill Drawing Color */
	prop = RNA_def_property(srna, "fill_color", PROP_FLOAT, PROP_COLOR_GAMMA);
	RNA_def_property_float_sdna(prop, NULL, "fill");
	RNA_def_property_array(prop, 3);
	RNA_def_property_range(prop, 0.0f, 1.0f);
	RNA_def_property_ui_text(prop, "Fill Color", "Color for filling region bounded by each stroke");
	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
	
	prop = RNA_def_property(srna, "fill_alpha", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "fill[3]");
	RNA_def_property_range(prop, 0.0, 1.0f);
	RNA_def_property_ui_text(prop, "Fill Opacity", "Opacity for filling region bounded by each stroke");
	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
	
	/* Line Thickness */
	prop = RNA_def_property(srna, "line_width", PROP_INT, PROP_PIXEL);
	RNA_def_property_int_sdna(prop, NULL, "thickness");
	//RNA_def_property_range(prop, 1, 10); /* 10 px limit comes from Windows OpenGL limits for natively-drawn strokes */
	RNA_def_property_int_funcs(prop, NULL, NULL, "rna_GPencilLayer_line_width_range");
	RNA_def_property_ui_text(prop, "Thickness", "Thickness of strokes (in pixels)");
	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
	
	/* Onion-Skinning */
	prop = RNA_def_property(srna, "use_onion_skinning", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_ONIONSKIN);
	RNA_def_property_ui_text(prop, "Onion Skinning", "Ghost frames on either side of frame");
	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
	
	prop = RNA_def_property(srna, "ghost_before_range", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "gstep");
	RNA_def_property_range(prop, 0, 120);
	RNA_def_property_ui_text(prop, "Frames Before",
	                         "Maximum number of frames to show before current frame "
	                         "(0 = show only the previous sketch)");
	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
	
	prop = RNA_def_property(srna, "ghost_after_range", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "gstep_next");
	RNA_def_property_range(prop, 0, 120);
	RNA_def_property_ui_text(prop, "Frames After",
	                         "Maximum number of frames to show after current frame "
	                         "(0 = show only the next sketch)");
	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
	
	prop = RNA_def_property(srna, "use_ghost_custom_colors", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_GHOST_PREVCOL | GP_LAYER_GHOST_NEXTCOL);
	RNA_def_property_ui_text(prop, "Use Custom Ghost Colors", "Use custom colors for ghost frames");
	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
	
	prop = RNA_def_property(srna, "before_color", PROP_FLOAT, PROP_COLOR_GAMMA);
	RNA_def_property_float_sdna(prop, NULL, "gcolor_prev");
	RNA_def_property_array(prop, 3);
	RNA_def_property_range(prop, 0.0f, 1.0f);
	RNA_def_property_ui_text(prop, "Before Color", "Base color for ghosts before the active frame");
	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
	
	prop = RNA_def_property(srna, "after_color", PROP_FLOAT, PROP_COLOR_GAMMA);
	RNA_def_property_float_sdna(prop, NULL, "gcolor_next");
	RNA_def_property_array(prop, 3);
	RNA_def_property_range(prop, 0.0f, 1.0f);
	RNA_def_property_ui_text(prop, "After Color", "Base color for ghosts after the active frame");
	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
	
	/* Flags */
	prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_HIDE);
	RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 1);
	RNA_def_property_ui_text(prop, "Hide", "Set layer Visibility");
	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
	
	prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_LOCKED);
	RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
	RNA_def_property_ui_text(prop, "Locked", "Protect layer from further editing and/or frame changes");
	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
	
	prop = RNA_def_property(srna, "lock_frame", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_FRAMELOCK);
	RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
	RNA_def_property_ui_text(prop, "Frame Locked", "Lock current frame displayed by layer");
	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");

	/* expose as layers.active */
#if 0
	prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_ACTIVE);
	RNA_def_property_boolean_funcs(prop, NULL, "rna_GPencilLayer_active_set");
	RNA_def_property_ui_text(prop, "Active", "Set active layer for editing");
	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
#endif

	prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_SELECT);
	RNA_def_property_ui_text(prop, "Select", "Layer is selected for editing in the Dope Sheet");
	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
	
	/* XXX keep this option? */
	prop = RNA_def_property(srna, "show_points", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_DRAWDEBUG);
	RNA_def_property_ui_text(prop, "Show Points", "Draw the points which make up the strokes (for debugging purposes)");
	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
	
	/* X-Ray */
	prop = RNA_def_property(srna, "show_x_ray", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GP_LAYER_NO_XRAY);
	RNA_def_property_ui_text(prop, "X Ray", "Make the layer draw in front of objects");
	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
	
	
	/* Read-only state props (for simpler UI code) */
	prop = RNA_def_property(srna, "is_stroke_visible", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_funcs(prop, "rna_GPencilLayer_is_stroke_visible_get", NULL);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Is Stroke Visible", "True when opacity of stroke is set high enough to be visible");
	
	prop = RNA_def_property(srna, "is_fill_visible", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_funcs(prop, "rna_GPencilLayer_is_fill_visible_get", NULL);
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Is Fill Visible", "True when opacity of fill is set high enough to be visible");
	
	/* Layers API */
	func = RNA_def_function(srna, "clear", "rna_GPencil_layer_clear");
	RNA_def_function_ui_description(func, "Remove all the grease pencil layer data");
}
コード例 #28
0
ファイル: rna_rigidbody.c プロジェクト: 244xiao/blender
static void rna_def_rigidbody_world(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;
	FunctionRNA *func;

	srna = RNA_def_struct(brna, "RigidBodyWorld", NULL);
	RNA_def_struct_sdna(srna, "RigidBodyWorld");
	RNA_def_struct_ui_text(srna, "Rigid Body World", "Self-contained rigid body simulation environment and settings");
	RNA_def_struct_path_func(srna, "rna_RigidBodyWorld_path");
	
	/* groups */
	prop = RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
	RNA_def_property_struct_type(prop, "Group");
	RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
	RNA_def_property_ui_text(prop, "Group", "Group containing objects participating in this simulation");
	RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_reset");

	prop = RNA_def_property(srna, "constraints", PROP_POINTER, PROP_NONE);
	RNA_def_property_struct_type(prop, "Group");
	RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
	RNA_def_property_ui_text(prop, "Constraints", "Group containing rigid body constraint objects");
	RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_reset");
	
	/* booleans */
	prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", RBW_FLAG_MUTED);
	RNA_def_property_ui_text(prop, "Enabled", "Simulation will be evaluated");
	RNA_def_property_update(prop, NC_SCENE, NULL);
	
	/* time scale */
	prop = RNA_def_property(srna, "time_scale", PROP_FLOAT, PROP_NONE);
	RNA_def_property_float_sdna(prop, NULL, "time_scale");
	RNA_def_property_range(prop, 0.0f, 100.0f);
	RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
	RNA_def_property_float_default(prop, 1.0f);
	RNA_def_property_ui_text(prop, "Time Scale", "Change the speed of the simulation");
	RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_reset");
	
	/* timestep */
	prop = RNA_def_property(srna, "steps_per_second", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "steps_per_second");
	RNA_def_property_range(prop, 1, SHRT_MAX);
	RNA_def_property_ui_range(prop, 60, 1000, 1, -1);
	RNA_def_property_int_default(prop, 60);
	RNA_def_property_ui_text(prop, "Steps Per Second",
	                         "Number of simulation steps taken per second (higher values are more accurate "
	                         "but slower)");
	RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_reset");
	
	/* constraint solver iterations */
	prop = RNA_def_property(srna, "solver_iterations", PROP_INT, PROP_NONE);
	RNA_def_property_int_sdna(prop, NULL, "num_solver_iterations");
	RNA_def_property_range(prop, 1, 1000);
	RNA_def_property_ui_range(prop, 10, 100, 1, -1);
	RNA_def_property_int_default(prop, 10);
	RNA_def_property_int_funcs(prop, NULL, "rna_RigidBodyWorld_num_solver_iterations_set", NULL);
	RNA_def_property_ui_text(prop, "Solver Iterations",
	                         "Number of constraint solver iterations made per simulation step (higher values are more "
	                         "accurate but slower)");
	RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_reset");
	
	/* split impulse */
	prop = RNA_def_property(srna, "use_split_impulse", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", RBW_FLAG_USE_SPLIT_IMPULSE);
	RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyWorld_split_impulse_set");
	RNA_def_property_ui_text(prop, "Split Impulse",
	                         "Reduce extra velocity that can build up when objects collide (lowers simulation "
	                         "stability a little so use only when necessary)");
	RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_reset");

	/* cache */
	prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
	RNA_def_property_flag(prop, PROP_NEVER_NULL);
	RNA_def_property_pointer_sdna(prop, NULL, "pointcache");
	RNA_def_property_ui_text(prop, "Point Cache", "");

	/* effector weights */
	prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
	RNA_def_property_struct_type(prop, "EffectorWeights");
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
	RNA_def_property_ui_text(prop, "Effector Weights", "");

	/* Sweep test */
	func = RNA_def_function(srna, "convex_sweep_test", "rna_RigidBodyWorld_convex_sweep_test");
	RNA_def_function_ui_description(func, "Sweep test convex rigidbody against the current rigidbody world");
	RNA_def_function_flag(func, FUNC_USE_REPORTS);

	prop = RNA_def_pointer(func, "object", "Object", "", "Rigidbody object with a convex collision shape");
	RNA_def_property_flag(prop, PROP_REQUIRED | PROP_NEVER_NULL);
	RNA_def_property_clear_flag(prop, PROP_THICK_WRAP);

	/* ray start and end */
	prop = RNA_def_float_vector(func, "start", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
	RNA_def_property_flag(prop, PROP_REQUIRED);
	prop = RNA_def_float_vector(func, "end", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
	RNA_def_property_flag(prop, PROP_REQUIRED);

	prop = RNA_def_float_vector(func, "object_location", 3, NULL, -FLT_MAX, FLT_MAX, "Location",
	                            "The hit location of this sweep test", -1e4, 1e4);
	RNA_def_property_flag(prop, PROP_THICK_WRAP);
	RNA_def_function_output(func, prop);

	prop = RNA_def_float_vector(func, "hitpoint", 3, NULL, -FLT_MAX, FLT_MAX, "Hitpoint",
	                            "The hit location of this sweep test", -1e4, 1e4);
	RNA_def_property_flag(prop, PROP_THICK_WRAP);
	RNA_def_function_output(func, prop);

	prop = RNA_def_float_vector(func, "normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal",
	                            "The face normal at the sweep test hit location", -1e4, 1e4);
	RNA_def_property_flag(prop, PROP_THICK_WRAP);
	RNA_def_function_output(func, prop);

	prop = RNA_def_int(func, "has_hit", 0, 0, 0, "", "If the function has found collision point, value is 1, otherwise 0", 0, 0);
	RNA_def_function_output(func, prop);
}