本文整理汇总了C++中RNA_def_property_string_sdna函数的典型用法代码示例。如果您正苦于以下问题:C++ RNA_def_property_string_sdna函数的具体用法?C++ RNA_def_property_string_sdna怎么用?C++ RNA_def_property_string_sdna使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RNA_def_property_string_sdna函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rna_def_render_view
static void rna_def_render_view(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "RenderView", NULL);
RNA_def_struct_ui_text(srna, "Render View", "");
RNA_define_verify_sdna(0);
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "name");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_struct_name_property(srna, prop);
RNA_define_verify_sdna(1);
}
示例2: rna_def_header
static void rna_def_header(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
PropertyRNA *parm;
FunctionRNA *func;
srna = RNA_def_struct(brna, "Header", NULL);
RNA_def_struct_ui_text(srna, "Header", "Editor header containing UI elements");
RNA_def_struct_sdna(srna, "Header");
RNA_def_struct_refine_func(srna, "rna_Header_refine");
RNA_def_struct_register_funcs(srna, "rna_Header_register", "rna_Header_unregister", NULL);
/* draw */
func = RNA_def_function(srna, "draw", NULL);
RNA_def_function_ui_description(func, "Draw UI elements into the header UI layout");
RNA_def_function_flag(func, FUNC_REGISTER);
parm = RNA_def_pointer(func, "context", "Context", "", "");
RNA_def_property_flag(parm, PROP_REQUIRED);
RNA_define_verify_sdna(0); /* not in sdna */
prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "layout");
RNA_def_property_struct_type(prop, "UILayout");
RNA_def_property_ui_text(prop, "Layout", "Structure of the header in the UI");
/* registration */
prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "type->idname");
RNA_def_property_flag(prop, PROP_REGISTER);
RNA_def_property_ui_text(prop, "ID Name",
"If this is set, the header gets a custom ID, otherwise it takes the "
"name of the class used to define the panel; for example, if the "
"class name is \"OBJECT_HT_hello\", and bl_idname is not set by the "
"script, then bl_idname = \"OBJECT_HT_hello\"");
prop = RNA_def_property(srna, "bl_space_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "type->space_type");
RNA_def_property_enum_items(prop, space_type_items);
RNA_def_property_flag(prop, PROP_REGISTER);
RNA_def_property_ui_text(prop, "Space type", "The space where the header is going to be used in");
RNA_define_verify_sdna(1);
}
示例3: rna_def_image_packed_files
/* image.packed_files */
static void rna_def_image_packed_files(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "ImagePackedFile", NULL);
RNA_def_struct_sdna(srna, "ImagePackedFile");
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", "");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
RNA_def_property_string_sdna(prop, NULL, "filepath");
RNA_def_struct_name_property(srna, prop);
RNA_api_image_packed_file(srna);
}
示例4: RNA_def_vfont
void RNA_def_vfont(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "VectorFont", "ID");
RNA_def_struct_ui_text(srna, "Vector Font", "Vector font for Text objects");
RNA_def_struct_sdna(srna, "VFont");
RNA_def_struct_ui_icon(srna, ICON_FILE_FONT);
prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_string_sdna(prop, NULL, "name");
RNA_def_property_ui_text(prop, "File Path", "");
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", "");
}
示例5: rna_def_render_slot
static void rna_def_render_slot(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop, *parm;
FunctionRNA *func;
srna = RNA_def_struct(brna, "RenderSlot", NULL);
RNA_def_struct_ui_text(srna, "Render Slot", "Parameters defining the render slot");
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "name");
RNA_def_property_ui_text(prop, "Name", "Render slot name");
RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);
func = RNA_def_function(srna, "clear", "rna_RenderSlot_clear");
RNA_def_function_flag(func, FUNC_USE_SELF_ID);
RNA_def_function_ui_description(func, "Clear the render slot");
parm = RNA_def_pointer(func, "iuser", "ImageUser", "ImageUser", "");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
示例6: RNA_def_vfont
void RNA_def_vfont(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "VectorFont", "ID");
RNA_def_struct_ui_text(srna, "Vector Font", "Vector font for Text objects");
RNA_def_struct_sdna(srna, "VFont");
RNA_def_struct_ui_icon(srna, ICON_FILE_FONT);
prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
RNA_def_property_string_sdna(prop, NULL, "name");
RNA_def_property_editable_func(prop, "rna_VectorFont_filepath_editable");
RNA_def_property_ui_text(prop, "File Path", "");
RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_VectorFont_reload_update");
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", "");
}
示例7: rna_def_radar_sensor
static void rna_def_radar_sensor(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
static EnumPropertyItem axis_items[] = {
{SENS_RADAR_X_AXIS, "XAXIS", 0, "+X axis", ""},
{SENS_RADAR_Y_AXIS, "YAXIS", 0, "+Y axis", ""},
{SENS_RADAR_Z_AXIS, "ZAXIS", 0, "+Z axis", ""},
{SENS_RADAR_NEG_X_AXIS, "NEGXAXIS", 0, "-X axis", ""},
{SENS_RADAR_NEG_Y_AXIS, "NEGYAXIS", 0, "-Y axis", ""},
{SENS_RADAR_NEG_Z_AXIS, "NEGZAXIS", 0, "-Z axis", ""},
{0, NULL, 0, NULL, NULL}
};
srna = RNA_def_struct(brna, "RadarSensor", "Sensor");
RNA_def_struct_ui_text(srna, "Radar Sensor",
"Sensor to detect objects in a cone shaped radar emanating from the current object");
RNA_def_struct_sdna_from(srna, "bRadarSensor", "data");
prop = RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "name");
RNA_def_property_ui_text(prop, "Property", "Only look for objects with this property (blank = all objects)");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, axis_items);
RNA_def_property_ui_text(prop, "Axis", "Along which axis the radar cone is cast");
RNA_def_property_update(prop, NC_LOGIC, NULL);
/*XXX TODO - use radians internally then change to PROP_ANGLE */
prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 179.9);
RNA_def_property_ui_text(prop, "Angle", "Opening angle of the radar cone (in degrees)");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "range");
RNA_def_property_range(prop, 0.0, 10000.0);
RNA_def_property_ui_text(prop, "Distance", "Depth of the radar cone");
RNA_def_property_update(prop, NC_LOGIC, NULL);
}
示例8: rna_def_library
static void rna_def_library(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "Library", "ID");
RNA_def_struct_ui_text(srna, "Library", "External .blend file from which data is linked");
RNA_def_struct_ui_icon(srna, ICON_LIBRARY_DATA_DIRECT);
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 Path", "Path to the library .blend file");
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Library_filepath_set");
prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Library");
RNA_def_property_ui_text(prop, "Parent", "");
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", "");
}
示例9: rna_def_py_component
static void rna_def_py_component(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
/* Python Component */
srna = RNA_def_struct(brna, "PythonComponent", NULL);
RNA_def_struct_sdna(srna, "PythonComponent");
RNA_def_struct_ui_text(srna, "Python Component", "");
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);
prop = RNA_def_property(srna, "properties", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "properties", NULL);
RNA_def_property_struct_type(prop, "PythonComponentProperty");
RNA_def_property_ui_text(prop, "Properties", "Component properties");
}
示例10: rna_def_sound
static void rna_def_sound(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "Sound", "ID");
RNA_def_struct_sdna(srna, "bSound");
RNA_def_struct_ui_text(
srna, "Sound", "Sound data-block referencing an external or packed sound file");
RNA_def_struct_ui_icon(srna, ICON_SOUND);
/*rna_def_ipo_common(srna); */
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 Path", "Sound sample file used by this Sound data-block");
RNA_def_property_update(prop, 0, "rna_Sound_update");
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, "use_memory_cache", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_funcs(prop, "rna_Sound_caching_get", "rna_Sound_caching_set");
RNA_def_property_ui_text(prop, "Caching", "The sound file is decoded and loaded into RAM");
RNA_def_property_update(prop, 0, "rna_Sound_caching_update");
prop = RNA_def_property(srna, "use_mono", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", SOUND_FLAGS_MONO);
RNA_def_property_ui_text(
prop,
"Mono",
"If the file contains multiple audio channels they are rendered to a single one");
RNA_def_property_update(prop, 0, "rna_Sound_update");
RNA_api_sound(srna);
}
示例11: rna_def_py_component_property
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");
//.........这里部分代码省略.........
示例12: rna_def_keyblock
static void rna_def_keyblock(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "ShapeKey", NULL);
RNA_def_struct_ui_text(srna, "Shape Key", "Shape key in a shape keys datablock");
RNA_def_struct_sdna(srna, "KeyBlock");
RNA_def_struct_path_func(srna, "rna_ShapeKey_path");
RNA_def_struct_ui_icon(srna, ICON_SHAPEKEY_DATA);
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_ui_text(prop, "Name", "Name of Shape Key");
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ShapeKey_name_set");
RNA_def_struct_name_property(srna, prop);
/* keys need to be sorted to edit this */
prop = RNA_def_property(srna, "frame", PROP_FLOAT, PROP_TIME);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_float_sdna(prop, NULL, "pos");
RNA_def_property_ui_text(prop, "Frame", "Frame for absolute keys");
RNA_def_property_update(prop, 0, "rna_Key_update_data");
/* for now, this is editable directly, as users can set this even if they're not animating them
* (to test results) */
prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "curval");
RNA_def_property_float_funcs(prop, NULL, "rna_ShapeKey_value_set", "rna_ShapeKey_value_range");
RNA_def_property_ui_range(prop, -10.0f, 10.0f, 10, 3);
RNA_def_property_ui_text(prop, "Value", "Value of shape key at the current frame");
RNA_def_property_update(prop, 0, "rna_Key_update_data");
prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "type");
RNA_def_property_enum_items(prop, keyblock_type_items);
RNA_def_property_ui_text(prop, "Interpolation", "Interpolation type for absolute shape keys");
RNA_def_property_update(prop, 0, "rna_Key_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 weight group, to blend with basis shape");
RNA_def_property_update(prop, 0, "rna_Key_update_data");
prop = RNA_def_property(srna, "relative_key", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "ShapeKey");
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
RNA_def_property_pointer_funcs(prop, "rna_ShapeKey_relative_key_get",
"rna_ShapeKey_relative_key_set", NULL, NULL);
RNA_def_property_ui_text(prop, "Relative Key", "Shape used as a relative key");
RNA_def_property_update(prop, 0, "rna_Key_update_data");
prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYBLOCK_MUTE);
RNA_def_property_ui_text(prop, "Mute", "Mute this shape key");
RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 1);
RNA_def_property_update(prop, 0, "rna_Key_update_data");
prop = RNA_def_property(srna, "slider_min", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "slidermin");
RNA_def_property_range(prop, -10.0f, 10.0f);
RNA_def_property_float_funcs(prop, NULL, "rna_ShapeKey_slider_min_set", "rna_ShapeKey_slider_min_range");
RNA_def_property_ui_text(prop, "Slider Min", "Minimum for slider");
prop = RNA_def_property(srna, "slider_max", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "slidermax");
RNA_def_property_range(prop, -10.0f, 10.0f);
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_float_funcs(prop, NULL, "rna_ShapeKey_slider_max_set", "rna_ShapeKey_slider_max_range");
RNA_def_property_ui_text(prop, "Slider Max", "Maximum for slider");
prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "data", "totelem");
RNA_def_property_struct_type(prop, "UnknownType");
RNA_def_property_ui_text(prop, "Data", "");
RNA_def_property_collection_funcs(prop, "rna_ShapeKey_data_begin", NULL, NULL, "rna_ShapeKey_data_get",
"rna_ShapeKey_data_length", NULL, NULL, NULL);
}
示例13: rna_def_layer_collection
static void rna_def_layer_collection(BlenderRNA *brna)
{
StructRNA *srna;
FunctionRNA *func;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "LayerCollection", NULL);
RNA_def_struct_ui_text(srna, "Layer Collection", "Layer collection");
RNA_def_struct_ui_icon(srna, ICON_GROUP);
prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_clear_flag(prop, PROP_EDITABLE | PROP_ANIMATABLE);
RNA_def_property_struct_type(prop, "Collection");
RNA_def_property_ui_text(prop, "Collection", "Collection this layer collection is wrapping");
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "collection->id.name");
RNA_def_property_clear_flag(prop, PROP_EDITABLE | PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Name", "Name of this view layer (same as its collection one)");
RNA_def_property_string_funcs(
prop, "rna_LayerCollection_name_get", "rna_LayerCollection_name_length", NULL);
RNA_def_struct_name_property(srna, prop);
prop = RNA_def_property(srna, "children", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "layer_collections", NULL);
RNA_def_property_struct_type(prop, "LayerCollection");
RNA_def_property_ui_text(prop, "Children", "Child layer collections");
/* Restriction flags. */
prop = RNA_def_property(srna, "exclude", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_EXCLUDE);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Exclude from View Layer", "Exclude from view layer");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_icon(prop, ICON_CHECKBOX_HLT, -1);
RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_exclude_update");
prop = RNA_def_property(srna, "holdout", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_HOLDOUT);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_icon(prop, ICON_HOLDOUT_OFF, 1);
RNA_def_property_ui_text(prop, "Holdout", "Mask out objects in collection from view layer");
RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_update");
prop = RNA_def_property(srna, "indirect_only", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_INDIRECT_ONLY);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_icon(prop, ICON_INDIRECT_ONLY_OFF, 1);
RNA_def_property_ui_text(
prop,
"Indirect Only",
"Objects in collection only contribute indirectly (through shadows and reflections) "
"in the view layer");
RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_update");
prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_HIDE);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
RNA_def_property_ui_text(prop, "Hide in Viewport", "Temporarily hide in viewport");
RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollection_update");
/* Run-time flags. */
prop = RNA_def_property(srna, "is_visible", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "runtime_flag", LAYER_COLLECTION_VISIBLE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(
prop,
"Visible",
"Whether this collection is visible, take into account the collection parent");
func = RNA_def_function(srna, "has_objects", "rna_LayerCollection_has_objects");
RNA_def_function_ui_description(func, "");
RNA_def_function_return(func, RNA_def_boolean(func, "result", 0, "", ""));
func = RNA_def_function(
srna, "has_selected_objects", "rna_LayerCollection_has_selected_objects");
RNA_def_function_ui_description(func, "");
prop = RNA_def_pointer(
func, "view_layer", "ViewLayer", "", "ViewLayer the layer collection belongs to");
RNA_def_parameter_flags(prop, 0, PARM_REQUIRED);
RNA_def_function_return(func, RNA_def_boolean(func, "result", 0, "", ""));
}
示例14: rna_def_image
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 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, "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_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");
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, "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);
//.........这里部分代码省略.........
示例15: rna_def_menu
static void rna_def_menu(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
PropertyRNA *parm;
FunctionRNA *func;
srna = RNA_def_struct(brna, "Menu", NULL);
RNA_def_struct_ui_text(srna, "Menu", "Editor menu containing buttons");
RNA_def_struct_sdna(srna, "Menu");
RNA_def_struct_refine_func(srna, "rna_Menu_refine");
RNA_def_struct_register_funcs(srna, "rna_Menu_register", "rna_Menu_unregister", NULL);
RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
RNA_def_struct_flag(srna, STRUCT_PUBLIC_NAMESPACE_INHERIT);
/* poll */
func = RNA_def_function(srna, "poll", NULL);
RNA_def_function_ui_description(func, "If this method returns a non-null output, then the menu can be drawn");
RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL);
RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", ""));
parm = RNA_def_pointer(func, "context", "Context", "", "");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
/* draw */
func = RNA_def_function(srna, "draw", NULL);
RNA_def_function_ui_description(func, "Draw UI elements into the menu UI layout");
RNA_def_function_flag(func, FUNC_REGISTER);
parm = RNA_def_pointer(func, "context", "Context", "", "");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
RNA_define_verify_sdna(false); /* not in sdna */
prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "layout");
RNA_def_property_struct_type(prop, "UILayout");
RNA_def_property_ui_text(prop, "Layout", "Defines the structure of the menu in the UI");
/* registration */
prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "type->idname");
RNA_def_property_flag(prop, PROP_REGISTER);
RNA_def_property_ui_text(prop, "ID Name",
"If this is set, the menu gets a custom ID, otherwise it takes the "
"name of the class used to define the menu (for example, if the "
"class name is \"OBJECT_MT_hello\", and bl_idname is not set by the "
"script, then bl_idname = \"OBJECT_MT_hello\")");
prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "type->label");
RNA_def_property_flag(prop, PROP_REGISTER);
RNA_def_property_ui_text(prop, "Label", "The menu label");
prop = RNA_def_property(srna, "bl_translation_context", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "type->translation_context");
RNA_def_property_string_default(prop, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "type->description");
RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Menu_bl_description_set");
/* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */
RNA_define_verify_sdna(1);
}