コード例 #1
0
static void rna_def_maskParent(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;

	static EnumPropertyItem mask_id_type_items[] = {
		{ID_MC, "MOVIECLIP", ICON_SEQUENCE, "Movie Clip", ""},
		{0, NULL, 0, NULL, NULL}};

	static EnumPropertyItem parent_type_items[] = {
		{MASK_PARENT_POINT_TRACK, "POINT_TRACK", 0, "Point Track", ""},
		{MASK_PARENT_PLANE_TRACK, "PLANE_TRACK", 0, "Plane Track", ""},
		{0, NULL, 0, NULL, NULL}};

	srna = RNA_def_struct(brna, "MaskParent", NULL);
	RNA_def_struct_ui_text(srna, "Mask Parent", "Parenting settings for masking element");

	/* Target Properties - ID-block to Drive */
	prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
	RNA_def_property_struct_type(prop, "ID");
	RNA_def_property_flag(prop, PROP_EDITABLE);
	// RNA_def_property_editable_func(prop, "rna_maskSpline_id_editable");
	/* note: custom set function is ONLY to avoid rna setting a user for this. */
	RNA_def_property_pointer_funcs(prop, NULL, "rna_MaskParent_id_set", "rna_MaskParent_id_typef", NULL);
	RNA_def_property_ui_text(prop, "ID", "ID-block to which masking element would be parented to or to it's property");
	RNA_def_property_update(prop, 0, "rna_Mask_update_parent");

	prop = RNA_def_property(srna, "id_type", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "id_type");
	RNA_def_property_enum_items(prop, mask_id_type_items);
	RNA_def_property_enum_default(prop, ID_MC);
	RNA_def_property_enum_funcs(prop, NULL, "rna_MaskParent_id_type_set", NULL);
	//RNA_def_property_editable_func(prop, "rna_MaskParent_id_type_editable");
	RNA_def_property_ui_text(prop, "ID Type", "Type of ID-block that can be used");
	RNA_def_property_update(prop, 0, "rna_Mask_update_parent");

	/* type */
	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_items(prop, parent_type_items);
	RNA_def_property_ui_text(prop, "Parent Type", "Parent Type");
	RNA_def_property_update(prop, 0, "rna_Mask_update_parent");

	/* parent */
	prop = RNA_def_property(srna, "parent", PROP_STRING, PROP_NONE);
	RNA_def_property_ui_text(prop, "Parent", "Name of parent object in specified data block to which parenting happens");
	RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2);
	RNA_def_property_update(prop, 0, "rna_Mask_update_parent");

	/* sub_parent */
	prop = RNA_def_property(srna, "sub_parent", PROP_STRING, PROP_NONE);
	RNA_def_property_ui_text(prop, "Sub Parent", "Name of parent sub-object in specified data block to which parenting happens");
	RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2);
	RNA_def_property_update(prop, 0, "rna_Mask_update_parent");
}
コード例 #2
0
ファイル: rna_fcurve.c プロジェクト: jinjoh/NOOR
static void rna_def_drivertarget(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;
	
	srna= RNA_def_struct(brna, "DriverTarget", NULL);
	RNA_def_struct_ui_text(srna, "Driver Target", "Variable from some source/target for driver relationship.");
	
	/* Variable Name */
	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
	RNA_def_struct_name_property(srna, prop);
	RNA_def_property_ui_text(prop, "Name", "Name to use in scripted expressions/functions. (No spaces or dots are allowed. Also, must not start with a symbol or digit)");
	//RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data"); // XXX disabled for now, until we can turn off auto updates
	
	/* Target Properties - ID-block to Drive */
	prop= RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
	RNA_def_property_struct_type(prop, "ID");
	RNA_def_property_flag(prop, PROP_EDITABLE);
	RNA_def_property_editable_func(prop, "rna_DriverTarget_id_editable");
	RNA_def_property_pointer_funcs(prop, NULL, NULL, "rna_DriverTarget_id_typef");
	RNA_def_property_ui_text(prop, "ID", "ID-block that the specific property used can be found from");
	//RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data"); // XXX disabled for now, until we can turn off auto updates
	
	prop= RNA_def_property(srna, "id_type", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "idtype");
	RNA_def_property_enum_items(prop, id_type_items);
	RNA_def_property_enum_default(prop, ID_OB);
	RNA_def_property_ui_text(prop, "ID Type", "Type of ID-block that can be used.");
	//RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data"); // XXX disabled for now, until we can turn off auto updates
	
	/* Target Properties - Property to Drive */
	prop= RNA_def_property(srna, "rna_path", PROP_STRING, PROP_NONE);
	RNA_def_property_string_funcs(prop, "rna_DriverTarget_RnaPath_get", "rna_DriverTarget_RnaPath_length", "rna_DriverTarget_RnaPath_set");
	RNA_def_property_ui_text(prop, "RNA Path", "RNA Path (from Object) to property used");
	//RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data"); // XXX disabled for now, until we can turn off auto updates
	
	prop= RNA_def_property(srna, "array_index", PROP_INT, PROP_NONE);
	RNA_def_property_ui_text(prop, "RNA Array Index", "Index to the specific property used (if applicable)");
	//RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data"); // XXX disabled for now, until we can turn off auto updates
}
コード例 #3
0
ファイル: rna_screen.c プロジェクト: wchargin/blender
static void rna_def_area(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;
	FunctionRNA *func;

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

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

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

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

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

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

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

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

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

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

	func = RNA_def_function(srna, "header_text_set", "ED_area_headerprint");
	RNA_def_function_ui_description(func, "Set the header text");
	RNA_def_string(func, "text", NULL, 0, "Text", "New string for the header, no argument clears the text");
}
コード例 #4
0
ファイル: rna_python_component.c プロジェクト: UPBGE/blender
static void rna_def_py_component_property(BlenderRNA *brna)
{
    StructRNA *srna;
    PropertyRNA *prop;

    static EnumPropertyItem empty_items[] = {
        {0, "EMPTY", 0, "Empty", ""},
        {0, NULL, 0, NULL, NULL}
    };

    /* Base Python Component Property */
    srna = RNA_def_struct(brna, "PythonComponentProperty", NULL);
    RNA_def_struct_sdna(srna, "PythonComponentProperty");
    RNA_def_struct_ui_text(srna, "Python Component Property", "A property of a Python Component");
    RNA_def_struct_refine_func(srna, "rna_PythonComponentProperty_refine");

    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);
    RNA_def_property_clear_flag(prop, PROP_EDITABLE);
    RNA_def_property_update(prop, NC_LOGIC, NULL);

    /* Boolean */
    srna = RNA_def_struct(brna, "ComponentBooleanProperty", "PythonComponentProperty");
    RNA_def_struct_sdna(srna, "PythonComponentProperty");
    RNA_def_struct_ui_text(srna, "Python Component Boolean Property", "A boolean property of a Python Component");

    prop = RNA_def_property(srna, "value", PROP_BOOLEAN, PROP_NONE);
    RNA_def_property_boolean_sdna(prop, NULL, "boolval", 1);
    RNA_def_property_ui_text(prop, "Value", "Property value");
    RNA_def_property_update(prop, NC_LOGIC, NULL);

    /* Int */
    srna = RNA_def_struct(brna, "ComponentIntProperty", "PythonComponentProperty");
    RNA_def_struct_sdna(srna, "PythonComponentProperty");
    RNA_def_struct_ui_text(srna, "Python Component Integer Property", "An integer property of a Python Component");

    prop = RNA_def_property(srna, "value", PROP_INT, PROP_NONE);
    RNA_def_property_int_sdna(prop, NULL, "intval");
    RNA_def_property_ui_text(prop, "Value", "Property value");
    RNA_def_property_update(prop, NC_LOGIC, NULL);

    /* Float */
    srna = RNA_def_struct(brna, "ComponentFloatProperty", "PythonComponentProperty");
    RNA_def_struct_sdna(srna, "PythonComponentProperty");
    RNA_def_struct_ui_text(srna, "Python Component Float Property", "A float property of a Python Component");

    prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE);
    RNA_def_property_float_sdna(prop, NULL, "floatval");
    RNA_def_property_ui_text(prop, "Value", "Property value");
    RNA_def_property_update(prop, NC_LOGIC, NULL);

    /* String */
    srna = RNA_def_struct(brna, "ComponentStringProperty", "PythonComponentProperty");
    RNA_def_struct_sdna(srna, "PythonComponentProperty");
    RNA_def_struct_ui_text(srna, "Python Component String Property", "A string property of a Python Component");

    prop = RNA_def_property(srna, "value", PROP_STRING, PROP_NONE);
    RNA_def_property_string_sdna(prop, NULL, "strval");
    RNA_def_property_string_maxlength(prop, MAX_PROPSTRING);
    RNA_def_property_ui_text(prop, "Value", "Property value");
    RNA_def_property_update(prop, NC_LOGIC, NULL);

    /* Set */
    srna = RNA_def_struct(brna, "ComponentSetProperty", "PythonComponentProperty");
    RNA_def_struct_sdna(srna, "PythonComponentProperty");
    RNA_def_struct_ui_text(srna, "Python Component Set Property", "A set property of a Python Component");

    prop = RNA_def_property(srna, "value", PROP_ENUM, PROP_NONE);
    RNA_def_property_enum_items(prop, empty_items);
    RNA_def_property_enum_funcs(prop, "rna_ComponentSetProperty_get", "rna_ComponentSetProperty_set", "rna_ComponentSetProperty_itemf");
    RNA_def_property_enum_default(prop, 0);
    RNA_def_property_ui_text(prop, "Value", "Property value");
    RNA_def_property_update(prop, NC_LOGIC, NULL);

    /* Vector 2D */
    srna = RNA_def_struct(brna, "ComponentVector2DProperty", "PythonComponentProperty");
    RNA_def_struct_sdna(srna, "PythonComponentProperty");
    RNA_def_struct_ui_text(srna, "Python Component Vector 2D Property", "A 2D vector property of a Python Component");

    prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_COORDS);
    RNA_def_property_float_sdna(prop, NULL, "vec");
    RNA_def_property_array(prop, 2);
    RNA_def_property_ui_text(prop, "Value", "Property value");
    RNA_def_property_update(prop, NC_LOGIC, NULL);

    /* Vector 3D */
    srna = RNA_def_struct(brna, "ComponentVector3DProperty", "PythonComponentProperty");
    RNA_def_struct_sdna(srna, "PythonComponentProperty");
    RNA_def_struct_ui_text(srna, "Python Component Vector 3D Property", "A 3D vector property of a Python Component");

    prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_COORDS);
    RNA_def_property_float_sdna(prop, NULL, "vec");
    RNA_def_property_array(prop, 3);
    RNA_def_property_ui_text(prop, "Value", "Property value");
    RNA_def_property_update(prop, NC_LOGIC, NULL);

    /* Vector 4D */
    srna = RNA_def_struct(brna, "ComponentVector4DProperty", "PythonComponentProperty");
    RNA_def_struct_sdna(srna, "PythonComponentProperty");
    RNA_def_struct_ui_text(srna, "Python Component Vector 4D Property", "A 4D vector property of a Python Component");

    prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_COORDS);
    RNA_def_property_float_sdna(prop, NULL, "vec");
    RNA_def_property_array(prop, 4);
    RNA_def_property_ui_text(prop, "Value", "Property value");
    RNA_def_property_update(prop, NC_LOGIC, NULL);
}
コード例 #5
0
ファイル: rna_animation.c プロジェクト: 244xiao/blender
static void rna_def_keyingset_path(BlenderRNA *brna)
{
	StructRNA *srna;
	PropertyRNA *prop;
	
	srna = RNA_def_struct(brna, "KeyingSetPath", NULL);
	RNA_def_struct_sdna(srna, "KS_Path");
	RNA_def_struct_ui_text(srna, "Keying Set Path", "Path to a setting for use in a Keying Set");
	
	/* ID */
	prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
	RNA_def_property_struct_type(prop, "ID");
	RNA_def_property_flag(prop, PROP_EDITABLE);
	RNA_def_property_editable_func(prop, "rna_ksPath_id_editable");
	RNA_def_property_pointer_funcs(prop, NULL, NULL, "rna_ksPath_id_typef", NULL);
	RNA_def_property_ui_text(prop, "ID-Block",
	                         "ID-Block that keyframes for Keying Set should be added to "
	                         "(for Absolute Keying Sets only)");
	RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET | NA_EDITED, NULL); /* XXX: maybe a bit too noisy */
	
	prop = RNA_def_property(srna, "id_type", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "idtype");
	RNA_def_property_enum_items(prop, id_type_items);
	RNA_def_property_enum_default(prop, ID_OB);
	RNA_def_property_enum_funcs(prop, NULL, "rna_ksPath_id_type_set", NULL);
	RNA_def_property_ui_text(prop, "ID Type", "Type of ID-block that can be used");
	RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET | NA_EDITED, NULL); /* XXX: maybe a bit too noisy */
	
	/* Group */
	prop = RNA_def_property(srna, "group", PROP_STRING, PROP_NONE);
	RNA_def_property_ui_text(prop, "Group Name", "Name of Action Group to assign setting(s) for this path to");
	RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET | NA_EDITED, NULL); /* XXX: maybe a bit too noisy */
	
	/* Grouping */
	prop = RNA_def_property(srna, "group_method", PROP_ENUM, PROP_NONE);
	RNA_def_property_enum_sdna(prop, NULL, "groupmode");
	RNA_def_property_enum_items(prop, keyingset_path_grouping_items);
	RNA_def_property_ui_text(prop, "Grouping Method", "Method used to define which Group-name to use");
	RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET | NA_EDITED, NULL); /* XXX: maybe a bit too noisy */
	
	/* Path + Array Index */
	prop = RNA_def_property(srna, "data_path", PROP_STRING, PROP_NONE);
	RNA_def_property_string_funcs(prop, "rna_ksPath_RnaPath_get", "rna_ksPath_RnaPath_length",
	                              "rna_ksPath_RnaPath_set");
	RNA_def_property_ui_text(prop, "Data Path", "Path to property setting");
	RNA_def_struct_name_property(srna, prop); /* XXX this is the best indicator for now... */
	RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET | NA_EDITED, NULL);

	/* called 'index' when given as function arg */
	prop = RNA_def_property(srna, "array_index", PROP_INT, PROP_NONE);
	RNA_def_property_ui_text(prop, "RNA Array Index", "Index to the specific setting if applicable");
	RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET | NA_EDITED, NULL); /* XXX: maybe a bit too noisy */
	
	/* Flags */
	prop = RNA_def_property(srna, "use_entire_array", PROP_BOOLEAN, PROP_NONE);
	RNA_def_property_boolean_sdna(prop, NULL, "flag", KSP_FLAG_WHOLE_ARRAY);
	RNA_def_property_ui_text(prop, "Entire Array",
	                         "When an 'array/vector' type is chosen (Location, Rotation, Color, etc.), "
	                         "entire array is to be used");
	RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET | NA_EDITED, NULL); /* XXX: maybe a bit too noisy */
	
	/* Keyframing Settings */
	rna_def_common_keying_flags(srna, 0);
}