void POSELIB_OT_pose_rename(wmOperatorType *ot) { PropertyRNA *prop; /* identifiers */ ot->name = "PoseLib Rename Pose"; ot->idname = "POSELIB_OT_pose_rename"; ot->description = "Rename specified pose from the active Pose Library"; /* api callbacks */ ot->invoke = poselib_rename_invoke; ot->exec = poselib_rename_exec; ot->poll = has_poselib_pose_data_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ /* NOTE: name not pose is the operator's "main" property, so that it will get activated in the popup for easy renaming */ ot->prop = RNA_def_string(ot->srna, "name", "RenamedPose", 64, "New Pose Name", "New name for pose"); prop = RNA_def_enum(ot->srna, "pose", DummyRNA_NULL_items, 0, "Pose", "The pose to rename"); RNA_def_enum_funcs(prop, poselib_stored_pose_itemf); }
void CONSOLE_OT_scrollback_append(wmOperatorType *ot) { /* defined in DNA_space_types.h */ static EnumPropertyItem console_line_type_items[] = { {CONSOLE_LINE_OUTPUT, "OUTPUT", 0, "Output", ""}, {CONSOLE_LINE_INPUT, "INPUT", 0, "Input", ""}, {CONSOLE_LINE_INFO, "INFO", 0, "Information", ""}, {CONSOLE_LINE_ERROR, "ERROR", 0, "Error", ""}, {0, NULL, 0, NULL, NULL}}; /* identifiers */ ot->name = "Scrollback Append"; ot->description = "Append scrollback text by type"; ot->idname = "CONSOLE_OT_scrollback_append"; /* api callbacks */ ot->exec = console_scrollback_append_exec; ot->poll = ED_operator_console_active; /* properties */ RNA_def_string(ot->srna, "text", "", 0, "Text", "Text to insert at the cursor position"); RNA_def_enum(ot->srna, "type", console_line_type_items, CONSOLE_LINE_OUTPUT, "Type", "Console output type"); }
void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; static EnumPropertyItem node_nodetree_items[] = { {0, "SHADER", 0, "Shader", ""}, {1, "COMPOSITE", 0, "Composite", ""}, {2, "TEXTURE", 0, "Texture", ""}, {0, NULL, 0, NULL, NULL}}; RNA_def_property_srna(cprop, "BlendDataNodeTrees"); srna= RNA_def_struct(brna, "BlendDataNodeTrees", NULL); RNA_def_struct_sdna(srna, "Main"); RNA_def_struct_ui_text(srna, "Main Node Trees", "Collection of node trees"); func= RNA_def_function(srna, "new", "rna_Main_nodetree_new"); RNA_def_function_ui_description(func, "Add a new node tree to the main database"); parm= RNA_def_string(func, "name", "NodeGroup", 0, "", "New name for the datablock."); RNA_def_property_flag(parm, PROP_REQUIRED); parm= RNA_def_enum(func, "type", node_nodetree_items, 0, "Type", "The type of node_group to add"); RNA_def_property_flag(parm, PROP_REQUIRED); /* return type */ parm= RNA_def_pointer(func, "tree", "NodeTree", "", "New node tree datablock."); RNA_def_function_return(func, parm); func= RNA_def_function(srna, "remove", "rna_Main_nodetree_remove"); RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Remove a node tree from the current blendfile."); parm= RNA_def_pointer(func, "tree", "NodeTree", "", "Node tree to remove."); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); func= RNA_def_function(srna, "tag", "rna_Main_node_groups_tag"); parm= RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_property_flag(parm, PROP_REQUIRED); }
static void rna_def_masklayers(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; PropertyRNA *prop; FunctionRNA *func; PropertyRNA *parm; RNA_def_property_srna(cprop, "MaskLayers"); srna = RNA_def_struct(brna, "MaskLayers", NULL); RNA_def_struct_sdna(srna, "Mask"); RNA_def_struct_ui_text(srna, "Mask Layers", "Collection of layers used by mask"); func = RNA_def_function(srna, "new", "rna_Mask_layers_new"); RNA_def_function_ui_description(func, "Add layer to this mask"); RNA_def_string(func, "name", NULL, 0, "Name", "Name of new layer"); parm = RNA_def_pointer(func, "layer", "MaskLayer", "", "New mask layer"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "remove", "rna_Mask_layers_remove"); RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Remove layer from this mask"); parm = RNA_def_pointer(func, "layer", "MaskLayer", "", "Shape to be removed"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); /* clear all layers */ func = RNA_def_function(srna, "clear", "rna_Mask_layers_clear"); RNA_def_function_ui_description(func, "Remove all mask layers"); /* active layer */ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "MaskLayer"); RNA_def_property_pointer_funcs(prop, "rna_Mask_layer_active_get", "rna_Mask_layer_active_set", NULL, NULL); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK); RNA_def_property_ui_text(prop, "Active Shape", "Active layer in this mask"); }
static void rna_def_strip_fcurves(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; RNA_def_property_srna(cprop, "NlaStripFCurves"); srna = RNA_def_struct(brna, "NlaStripFCurves", NULL); RNA_def_struct_sdna(srna, "NlaStrip"); RNA_def_struct_ui_text(srna, "NLA-Strip F-Curves", "Collection of NLA strip F-Curves"); /* Strip.fcurves.find(...) */ func = RNA_def_function(srna, "find", "rna_NlaStrip_fcurve_find"); RNA_def_function_ui_description(func, "Find an F-Curve. Note that this function performs a linear scan " "of all F-Curves in the NLA strip."); RNA_def_function_flag(func, FUNC_USE_REPORTS); parm = RNA_def_string(func, "data_path", NULL, 0, "Data Path", "F-Curve data path"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Array index", 0, INT_MAX); parm = RNA_def_pointer(func, "fcurve", "FCurve", "", "The found F-Curve, or None if it doesn't exist"); RNA_def_function_return(func, parm); }
void SEQUENCER_OT_strip_modifier_move(wmOperatorType *ot) { static EnumPropertyItem direction_items[] = { {SEQ_MODIFIER_MOVE_UP, "UP", 0, "Up", "Move modifier up in the stack"}, {SEQ_MODIFIER_MOVE_DOWN, "DOWN", 0, "Down", "Move modifier down in the stack"}, {0, NULL, 0, NULL, NULL} }; /* identifiers */ ot->name = "Move Strip Modifier"; ot->idname = "SEQUENCER_OT_strip_modifier_move"; ot->description = "Move modifier up and down in the stack"; /* api callbacks */ ot->exec = strip_modifier_move_exec; ot->poll = strip_modifier_active_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ RNA_def_string(ot->srna, "name", "Name", MAX_NAME, "Name", "Name of modifier to remove"); RNA_def_enum(ot->srna, "direction", direction_items, SEQ_MODIFIER_MOVE_UP, "Type", ""); }
static void rna_def_render_layer(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; FunctionRNA *func; srna= RNA_def_struct(brna, "RenderLayer", NULL); RNA_def_struct_ui_text(srna, "Render Layer", ""); func= RNA_def_function(srna, "load_from_file", "RE_layer_load_from_file"); RNA_def_function_ui_description(func, "Copies the pixels of this renderlayer from an image file"); RNA_def_function_flag(func, FUNC_USE_REPORTS); prop= RNA_def_string(func, "filename", "", 0, "Filename", "Filename to load into this render tile, must be no smaller than the renderlayer"); RNA_def_property_flag(prop, PROP_REQUIRED); RNA_def_int(func, "x", 0, 0, INT_MAX, "Offset X", "Offset the position to copy from if the image is larger than the render layer", 0, INT_MAX); RNA_def_int(func, "y", 0, 0, INT_MAX, "Offset Y", "Offset the position to copy from if the image is larger than the render layer", 0, INT_MAX); RNA_define_verify_sdna(0); rna_def_render_layer_common(srna, 0); prop= RNA_def_property(srna, "passes", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "RenderPass"); RNA_def_property_collection_funcs(prop, "rna_RenderLayer_passes_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL); prop= RNA_def_property(srna, "rect", PROP_FLOAT, PROP_NONE); RNA_def_property_flag(prop, PROP_DYNAMIC); RNA_def_property_multi_array(prop, 2, NULL); RNA_def_property_dynamic_array_funcs(prop, "rna_RenderLayer_rect_get_length"); RNA_def_property_float_funcs(prop, "rna_RenderLayer_rect_get", "rna_RenderLayer_rect_set", NULL); RNA_define_verify_sdna(1); }
static void edit_actuator_properties(wmOperatorType *ot) { RNA_def_string(ot->srna, "actuator", NULL, MAX_NAME, "Actuator", "Name of the actuator to edit"); RNA_def_string(ot->srna, "object", NULL, MAX_NAME, "Object", "Name of the object the actuator belongs to"); }
void RNA_api_ui_layout(StructRNA *srna) { FunctionRNA *func; PropertyRNA *parm; static EnumPropertyItem curve_type_items[] = { {0, "NONE", 0, "None", ""}, {'v', "VECTOR", 0, "Vector", ""}, {'c', "COLOR", 0, "Color", ""}, {'h', "HUE", 0, "Hue", ""}, {0, NULL, 0, NULL, NULL} }; static float node_socket_color_default[] = { 0.0f, 0.0f, 0.0f, 1.0f }; /* simple layout specifiers */ func = RNA_def_function(srna, "row", "uiLayoutRow"); parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in"); RNA_def_function_return(func, parm); RNA_def_function_ui_description(func, "Sub-layout. Items placed in this sublayout are placed next to each other " "in a row"); RNA_def_boolean(func, "align", false, "", "Align buttons to each other"); func = RNA_def_function(srna, "column", "uiLayoutColumn"); parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in"); RNA_def_function_return(func, parm); RNA_def_function_ui_description(func, "Sub-layout. Items placed in this sublayout are placed under each other " "in a column"); RNA_def_boolean(func, "align", false, "", "Align buttons to each other"); func = RNA_def_function(srna, "column_flow", "uiLayoutColumnFlow"); RNA_def_int(func, "columns", 0, 0, INT_MAX, "", "Number of columns, 0 is automatic", 0, INT_MAX); parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in"); RNA_def_function_return(func, parm); RNA_def_boolean(func, "align", false, "", "Align buttons to each other"); /* box layout */ func = RNA_def_function(srna, "box", "uiLayoutBox"); parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in"); RNA_def_function_return(func, parm); RNA_def_function_ui_description(func, "Sublayout (items placed in this sublayout are placed " "under each other in a column and are surrounded by a box)"); /* split layout */ func = RNA_def_function(srna, "split", "uiLayoutSplit"); parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in"); RNA_def_function_return(func, parm); RNA_def_float(func, "percentage", 0.0f, 0.0f, 1.0f, "Percentage", "Percentage of width to split at", 0.0f, 1.0f); RNA_def_boolean(func, "align", false, "", "Align buttons to each other"); /* radial/pie layout */ func = RNA_def_function(srna, "menu_pie", "uiLayoutRadial"); parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in"); RNA_def_function_return(func, parm); RNA_def_function_ui_description(func, "Sublayout. Items placed in this sublayout are placed " "in a radial fashion around the menu center)"); /* Icon of a rna pointer */ func = RNA_def_function(srna, "icon", "rna_ui_get_rnaptr_icon"); parm = RNA_def_int(func, "icon_value", ICON_NONE, 0, INT_MAX, "", "Icon identifier", 0, INT_MAX); RNA_def_function_return(func, parm); RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT); parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take the icon"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); RNA_def_function_ui_description(func, "Return the custom icon for this data, " "use it e.g. to get materials or texture icons"); /* UI name, description and icon of an enum item */ func = RNA_def_function(srna, "enum_item_name", "rna_ui_get_enum_name"); parm = RNA_def_string(func, "name", NULL, 0, "", "UI name of the enum item"); RNA_def_function_return(func, parm); RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT); api_ui_item_rna_common(func); parm = RNA_def_string(func, "identifier", NULL, 0, "", "Identifier of the enum item"); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_function_ui_description(func, "Return the UI name for this enum item"); func = RNA_def_function(srna, "enum_item_description", "rna_ui_get_enum_description"); parm = RNA_def_string(func, "description", NULL, 0, "", "UI description of the enum item"); RNA_def_function_return(func, parm); RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT); api_ui_item_rna_common(func); parm = RNA_def_string(func, "identifier", NULL, 0, "", "Identifier of the enum item"); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_function_ui_description(func, "Return the UI description for this enum item"); func = RNA_def_function(srna, "enum_item_icon", "rna_ui_get_enum_icon"); parm = RNA_def_int(func, "icon_value", ICON_NONE, 0, INT_MAX, "", "Icon identifier", 0, INT_MAX); RNA_def_function_return(func, parm); RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT); api_ui_item_rna_common(func); parm = RNA_def_string(func, "identifier", NULL, 0, "", "Identifier of the enum item"); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_function_ui_description(func, "Return the icon for this enum item"); /* items */ func = RNA_def_function(srna, "prop", "rna_uiItemR"); RNA_def_function_ui_description(func, "Item. Exposes an RNA item and places it into the layout"); api_ui_item_rna_common(func); api_ui_item_common(func); RNA_def_boolean(func, "expand", false, "", "Expand button to show more detail"); RNA_def_boolean(func, "slider", false, "", "Use slider widget for numeric values"); RNA_def_boolean(func, "toggle", false, "", "Use toggle widget for boolean values"); RNA_def_boolean(func, "icon_only", false, "", "Draw only icons in buttons, no text"); RNA_def_boolean(func, "event", false, "", "Use button to input key events"); RNA_def_boolean(func, "full_event", false, "", "Use button to input full events including modifiers"); RNA_def_boolean(func, "emboss", true, "", "Draw the button itself, just the icon/text"); RNA_def_int(func, "index", -1, -2, INT_MAX, "", "The index of this button, when set a single member of an array can be accessed, " "when set to -1 all array members are used", -2, INT_MAX); /* RNA_NO_INDEX == -1 */ parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED); RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item"); func = RNA_def_function(srna, "props_enum", "uiItemsEnumR"); api_ui_item_rna_common(func); func = RNA_def_function(srna, "prop_menu_enum", "rna_uiItemMenuEnumR"); api_ui_item_rna_common(func); api_ui_item_common(func); func = RNA_def_function(srna, "prop_enum", "rna_uiItemEnumR_string"); api_ui_item_rna_common(func); parm = RNA_def_string(func, "value", NULL, 0, "", "Enum property value"); RNA_def_property_flag(parm, PROP_REQUIRED); api_ui_item_common(func); func = RNA_def_function(srna, "prop_search", "rna_uiItemPointerR"); api_ui_item_rna_common(func); parm = RNA_def_pointer(func, "search_data", "AnyType", "", "Data from which to take collection to search in"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); parm = RNA_def_string(func, "search_property", NULL, 0, "", "Identifier of search collection property"); RNA_def_property_flag(parm, PROP_REQUIRED); api_ui_item_common(func); func = RNA_def_function(srna, "operator", "rna_uiItemO"); api_ui_item_op_common(func); RNA_def_boolean(func, "emboss", true, "", "Draw the button itself, just the icon/text"); parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED); RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item"); parm = RNA_def_pointer(func, "properties", "OperatorProperties", "", "Operator properties to fill in, return when 'properties' is set to true"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR); RNA_def_function_return(func, parm); RNA_def_function_ui_description(func, "Item. Places a button into the layout to call an Operator"); func = RNA_def_function(srna, "operator_enum", "uiItemsEnumO"); parm = RNA_def_string(func, "operator", NULL, 0, "", "Identifier of the operator"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator"); RNA_def_property_flag(parm, PROP_REQUIRED); func = RNA_def_function(srna, "operator_menu_enum", "rna_uiItemMenuEnumO"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); api_ui_item_op(func); /* cant use api_ui_item_op_common because property must come right after */ parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator"); RNA_def_property_flag(parm, PROP_REQUIRED); api_ui_item_common(func); /* useful in C but not in python */ #if 0 func = RNA_def_function(srna, "operator_enum_single", "uiItemEnumO_string"); api_ui_item_op_common(func); parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_string(func, "value", NULL, 0, "", "Enum property value"); RNA_def_property_flag(parm, PROP_REQUIRED); func = RNA_def_function(srna, "operator_boolean", "uiItemBooleanO"); api_ui_item_op_common(func); parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_boolean(func, "value", false, "", "Value of the property to call the operator with"); RNA_def_property_flag(parm, PROP_REQUIRED); */ func = RNA_def_function(srna, "operator_int", "uiItemIntO"); api_ui_item_op_common(func); parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_int(func, "value", 0, INT_MIN, INT_MAX, "", "Value of the property to call the operator with", INT_MIN, INT_MAX); RNA_def_property_flag(parm, PROP_REQUIRED); */ func = RNA_def_function(srna, "operator_float", "uiItemFloatO"); api_ui_item_op_common(func); parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_float(func, "value", 0, -FLT_MAX, FLT_MAX, "", "Value of the property to call the operator with", -FLT_MAX, FLT_MAX); RNA_def_property_flag(parm, PROP_REQUIRED); */ func = RNA_def_function(srna, "operator_string", "uiItemStringO"); api_ui_item_op_common(func); parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_string(func, "value", NULL, 0, "", "Value of the property to call the operator with"); RNA_def_property_flag(parm, PROP_REQUIRED); #endif func = RNA_def_function(srna, "label", "rna_uiItemL"); RNA_def_function_ui_description(func, "Item. Display text and/or icon in the layout"); api_ui_item_common(func); parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED); RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item"); func = RNA_def_function(srna, "menu", "rna_uiItemM"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); parm = RNA_def_string(func, "menu", NULL, 0, "", "Identifier of the menu"); api_ui_item_common(func); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED); RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item"); func = RNA_def_function(srna, "separator", "uiItemS"); RNA_def_function_ui_description(func, "Item. Inserts empty space into the layout between items"); /* context */ func = RNA_def_function(srna, "context_pointer_set", "uiLayoutSetContextPointer"); parm = RNA_def_string(func, "name", NULL, 0, "Name", "Name of entry in the context"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "data", "AnyType", "", "Pointer to put in context"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR); /* templates */ func = RNA_def_function(srna, "template_header", "uiTemplateHeader"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); func = RNA_def_function(srna, "template_ID", "uiTemplateID"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); api_ui_item_rna_common(func); RNA_def_string(func, "new", NULL, 0, "", "Operator identifier to create a new ID block"); RNA_def_string(func, "open", NULL, 0, "", "Operator identifier to open a file for creating a new ID block"); RNA_def_string(func, "unlink", NULL, 0, "", "Operator identifier to unlink the ID block"); func = RNA_def_function(srna, "template_ID_preview", "uiTemplateIDPreview"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); api_ui_item_rna_common(func); RNA_def_string(func, "new", NULL, 0, "", "Operator identifier to create a new ID block"); RNA_def_string(func, "open", NULL, 0, "", "Operator identifier to open a file for creating a new ID block"); RNA_def_string(func, "unlink", NULL, 0, "", "Operator identifier to unlink the ID block"); RNA_def_int(func, "rows", 0, 0, INT_MAX, "Number of thumbnail preview rows to display", "", 0, INT_MAX); RNA_def_int(func, "cols", 0, 0, INT_MAX, "Number of thumbnail preview columns to display", "", 0, INT_MAX); func = RNA_def_function(srna, "template_any_ID", "rna_uiTemplateAnyID"); parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_string(func, "type_property", NULL, 0, "", "Identifier of property in data giving the type of the ID-blocks to use"); RNA_def_property_flag(parm, PROP_REQUIRED); api_ui_item_common_text(func); func = RNA_def_function(srna, "template_path_builder", "rna_uiTemplatePathBuilder"); parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "root", "ID", "", "ID-block from which path is evaluated from"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR); api_ui_item_common_text(func); func = RNA_def_function(srna, "template_modifier", "uiTemplateModifier"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); RNA_def_function_ui_description(func, "Generates the UI layout for modifiers"); parm = RNA_def_pointer(func, "data", "Modifier", "", "Modifier data"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "template_constraint", "uiTemplateConstraint"); RNA_def_function_ui_description(func, "Generates the UI layout for constraints"); parm = RNA_def_pointer(func, "data", "Constraint", "", "Constraint data"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "template_preview", "uiTemplatePreview"); RNA_def_function_ui_description(func, "Item. A preview window for materials, textures, lamps or worlds"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); parm = RNA_def_pointer(func, "id", "ID", "", "ID data-block"); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_boolean(func, "show_buttons", true, "", "Show preview buttons?"); RNA_def_pointer(func, "parent", "ID", "", "ID data-block"); RNA_def_pointer(func, "slot", "TextureSlot", "", "Texture slot"); RNA_def_string(func, "preview_id", NULL, 0, "", "Identifier of this preview widget, if not set the ID type will be used " "(i.e. all previews of materials without explicit ID will have the same size...)"); func = RNA_def_function(srna, "template_curve_mapping", "uiTemplateCurveMapping"); RNA_def_function_ui_description(func, "Item. A curve mapping widget used for e.g falloff curves for lamps"); api_ui_item_rna_common(func); RNA_def_enum(func, "type", curve_type_items, 0, "Type", "Type of curves to display"); RNA_def_boolean(func, "levels", false, "", "Show black/white levels"); RNA_def_boolean(func, "brush", false, "", "Show brush options"); RNA_def_boolean(func, "use_negative_slope", false, "", "Use a negative slope by default"); func = RNA_def_function(srna, "template_color_ramp", "uiTemplateColorRamp"); RNA_def_function_ui_description(func, "Item. A color ramp widget"); api_ui_item_rna_common(func); RNA_def_boolean(func, "expand", false, "", "Expand button to show more detail"); func = RNA_def_function(srna, "template_icon_view", "uiTemplateIconView"); RNA_def_function_ui_description(func, "Enum. Large widget showing Icon previews"); api_ui_item_rna_common(func); RNA_def_boolean(func, "show_labels", false, "", "Show enum label in preview buttons"); RNA_def_float(func, "scale", 5.0f, 1.0f, 100.0f, "Scale", "Scale the icon size (by the button size)", 1.0f, 100.0f); func = RNA_def_function(srna, "template_histogram", "uiTemplateHistogram"); RNA_def_function_ui_description(func, "Item. A histogramm widget to analyze imaga data"); api_ui_item_rna_common(func); func = RNA_def_function(srna, "template_waveform", "uiTemplateWaveform"); RNA_def_function_ui_description(func, "Item. A waveform widget to analyze imaga data"); api_ui_item_rna_common(func); func = RNA_def_function(srna, "template_vectorscope", "uiTemplateVectorscope"); RNA_def_function_ui_description(func, "Item. A vectorscope widget to analyze imaga data"); api_ui_item_rna_common(func); func = RNA_def_function(srna, "template_layers", "uiTemplateLayers"); api_ui_item_rna_common(func); parm = RNA_def_pointer(func, "used_layers_data", "AnyType", "", "Data from which to take property"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR); parm = RNA_def_string(func, "used_layers_property", NULL, 0, "", "Identifier of property in data"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_int(func, "active_layer", 0, 0, INT_MAX, "Active Layer", "", 0, INT_MAX); RNA_def_property_flag(parm, PROP_REQUIRED); func = RNA_def_function(srna, "template_color_picker", "uiTemplateColorPicker"); RNA_def_function_ui_description(func, "Item. A color wheel widget to pick colors"); api_ui_item_rna_common(func); RNA_def_boolean(func, "value_slider", false, "", "Display the value slider to the right of the color wheel"); RNA_def_boolean(func, "lock", false, "", "Lock the color wheel display to value 1.0 regardless of actual color"); RNA_def_boolean(func, "lock_luminosity", false, "", "Keep the color at its original vector length"); RNA_def_boolean(func, "cubic", false, "", "Cubic saturation for picking values close to white"); func = RNA_def_function(srna, "template_palette", "uiTemplatePalette"); RNA_def_function_ui_description(func, "Item. A palette used to pick colors"); api_ui_item_rna_common(func); RNA_def_boolean(func, "color", 0, "", "Display the colors as colors or values"); func = RNA_def_function(srna, "template_image_layers", "uiTemplateImageLayers"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); parm = RNA_def_pointer(func, "image", "Image", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "image_user", "ImageUser", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED); func = RNA_def_function(srna, "template_image", "uiTemplateImage"); RNA_def_function_ui_description(func, "Item(s). User interface for selecting images and their source paths"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); api_ui_item_rna_common(func); parm = RNA_def_pointer(func, "image_user", "ImageUser", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); RNA_def_boolean(func, "compact", false, "", "Use more compact layout"); RNA_def_boolean(func, "multiview", false, "", "Expose Multi-View options"); func = RNA_def_function(srna, "template_image_settings", "uiTemplateImageSettings"); RNA_def_function_ui_description(func, "User interface for setting image format options"); parm = RNA_def_pointer(func, "image_settings", "ImageFormatSettings", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); RNA_def_boolean(func, "color_management", false, "", "Show color management settings"); func = RNA_def_function(srna, "template_image_stereo_3d", "uiTemplateImageStereo3d"); RNA_def_function_ui_description(func, "User interface for setting image stereo 3d options"); parm = RNA_def_pointer(func, "stereo_3d_format", "Stereo3dFormat", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); func = RNA_def_function(srna, "template_image_views", "uiTemplateImageViews"); RNA_def_function_ui_description(func, "User interface for setting image views output options"); parm = RNA_def_pointer(func, "image_settings", "ImageFormatSettings", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); func = RNA_def_function(srna, "template_movieclip", "uiTemplateMovieClip"); RNA_def_function_ui_description(func, "Item(s). User interface for selecting movie clips and their source paths"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); api_ui_item_rna_common(func); RNA_def_boolean(func, "compact", false, "", "Use more compact layout"); func = RNA_def_function(srna, "template_track", "uiTemplateTrack"); RNA_def_function_ui_description(func, "Item. A movie-track widget to preview tracking image."); api_ui_item_rna_common(func); func = RNA_def_function(srna, "template_marker", "uiTemplateMarker"); RNA_def_function_ui_description(func, "Item. A widget to control single marker settings."); api_ui_item_rna_common(func); parm = RNA_def_pointer(func, "clip_user", "MovieClipUser", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); parm = RNA_def_pointer(func, "track", "MovieTrackingTrack", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); RNA_def_boolean(func, "compact", false, "", "Use more compact layout"); func = RNA_def_function(srna, "template_movieclip_information", "uiTemplateMovieclipInformation"); RNA_def_function_ui_description(func, "Item. Movie clip information data."); api_ui_item_rna_common(func); parm = RNA_def_pointer(func, "clip_user", "MovieClipUser", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); func = RNA_def_function(srna, "template_list", "uiTemplateList"); RNA_def_function_ui_description(func, "Item. A list widget to display data, e.g. vertexgroups."); RNA_def_function_flag(func, FUNC_USE_CONTEXT); parm = RNA_def_string(func, "listtype_name", NULL, 0, "", "Identifier of the list type to use"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_string(func, "list_id", NULL, 0, "", "Identifier of this list widget (mandatory when using default \"" UI_UL_DEFAULT_CLASS_NAME "\" class). " "If this is set, the uilist gets a custom ID, otherwise it takes the " "name of the class used to define the uilist (for example, if the " "class name is \"OBJECT_UL_vgroups\", and list_id is not set by the " "script, then bl_idname = \"OBJECT_UL_vgroups\")"); parm = RNA_def_pointer(func, "dataptr", "AnyType", "", "Data from which to take the Collection property"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR); parm = RNA_def_string(func, "propname", NULL, 0, "", "Identifier of the Collection property in data"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "active_dataptr", "AnyType", "", "Data from which to take the integer property, index of the active item"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); parm = RNA_def_string(func, "active_propname", NULL, 0, "", "Identifier of the integer property in active_data, index of the active item"); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_string(func, "item_dyntip_propname", NULL, 0, "", "Identifier of a string property in items, to use as tooltip content"); RNA_def_int(func, "rows", 5, 0, INT_MAX, "", "Default and minimum number of rows to display", 0, INT_MAX); RNA_def_int(func, "maxrows", 5, 0, INT_MAX, "", "Default maximum number of rows to display", 0, INT_MAX); RNA_def_enum(func, "type", uilist_layout_type_items, UILST_LAYOUT_DEFAULT, "Type", "Type of layout to use"); RNA_def_int(func, "columns", 9, 0, INT_MAX, "", "Number of items to display per row, for GRID layout", 0, INT_MAX); func = RNA_def_function(srna, "template_running_jobs", "uiTemplateRunningJobs"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); RNA_def_function(srna, "template_operator_search", "uiTemplateOperatorSearch"); func = RNA_def_function(srna, "template_header_3D", "uiTemplateHeader3D"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); func = RNA_def_function(srna, "template_edit_mode_selection", "uiTemplateEditModeSelection"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); func = RNA_def_function(srna, "template_reports_banner", "uiTemplateReportsBanner"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); func = RNA_def_function(srna, "template_node_link", "uiTemplateNodeLink"); parm = RNA_def_pointer(func, "ntree", "NodeTree", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "node", "Node", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "socket", "NodeSocket", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED); func = RNA_def_function(srna, "template_node_view", "uiTemplateNodeView"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); parm = RNA_def_pointer(func, "ntree", "NodeTree", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "node", "Node", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "socket", "NodeSocket", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED); func = RNA_def_function(srna, "template_texture_user", "uiTemplateTextureUser"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); func = RNA_def_function(srna, "template_keymap_item_properties", "uiTemplateKeymapItemProperties"); parm = RNA_def_pointer(func, "item", "KeyMapItem", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); func = RNA_def_function(srna, "template_component_menu", "uiTemplateComponentMenu"); RNA_def_function_ui_description(func, "Item. Display expanded property in a popup menu"); parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR); parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data"); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_string(func, "name", NULL, 0, "", ""); func = RNA_def_function(srna, "introspect", "uiLayoutIntrospect"); parm = RNA_def_string(func, "string", NULL, 1024 * 1024, "Descr", "DESCR"); RNA_def_function_return(func, parm); /* color management templates */ func = RNA_def_function(srna, "template_colorspace_settings", "uiTemplateColorspaceSettings"); RNA_def_function_ui_description(func, "Item. A widget to control input color space settings."); api_ui_item_rna_common(func); func = RNA_def_function(srna, "template_colormanaged_view_settings", "uiTemplateColormanagedViewSettings"); RNA_def_function_ui_description(func, "Item. A widget to control color managed view settings settings."); RNA_def_function_flag(func, FUNC_USE_CONTEXT); api_ui_item_rna_common(func); /* RNA_def_boolean(func, "show_global_settings", false, "", "Show widgets to control global color management settings"); */ /* node socket icon */ func = RNA_def_function(srna, "template_node_socket", "uiTemplateNodeSocket"); RNA_def_function_ui_description(func, "Node Socket Icon"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); RNA_def_float_array(func, "color", 4, node_socket_color_default, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f); }
static void api_ui_item_op(FunctionRNA *func) { PropertyRNA *parm; parm = RNA_def_string(func, "operator", "", 0, "", "Identifier of the operator"); RNA_def_property_flag(parm, PROP_REQUIRED); }
void RNA_api_scene(StructRNA *srna) { FunctionRNA *func; PropertyRNA *parm; func = RNA_def_function(srna, "frame_set", "rna_Scene_frame_set"); RNA_def_function_ui_description(func, "Set scene frame updating all objects immediately"); parm = RNA_def_int(func, "frame", 0, MINAFRAME, MAXFRAME, "", "Frame number to set", MINAFRAME, MAXFRAME); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_float(func, "subframe", 0.0, 0.0, 1.0, "", "Sub-frame time, between 0.0 and 1.0", 0.0, 1.0); func = RNA_def_function(srna, "update", "rna_Scene_update_tagged"); RNA_def_function_ui_description(func, "Update data tagged to be updated from previous access to data or operators"); /* Ray Cast */ func = RNA_def_function(srna, "ray_cast", "rna_Scene_ray_cast"); RNA_def_function_ui_description(func, "Cast a ray onto in object space"); /* ray start and end */ parm = RNA_def_float_vector(func, "start", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_float_vector(func, "end", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4); RNA_def_property_flag(parm, PROP_REQUIRED); /* return location and normal */ parm = RNA_def_boolean(func, "result", 0, "", ""); RNA_def_function_output(func, parm); parm = RNA_def_pointer(func, "object", "Object", "", "Ray cast object"); RNA_def_function_output(func, parm); parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f); RNA_def_function_output(func, parm); parm = RNA_def_float_vector(func, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "The hit location of this ray cast", -1e4, 1e4); RNA_def_property_flag(parm, PROP_THICK_WRAP); RNA_def_function_output(func, parm); parm = RNA_def_float_vector(func, "normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal", "The face normal at the ray cast hit location", -1e4, 1e4); RNA_def_property_flag(parm, PROP_THICK_WRAP); RNA_def_function_output(func, parm); #ifdef WITH_COLLADA /* don't remove this, as COLLADA exporting cannot be done through operators in render() callback. */ func = RNA_def_function(srna, "collada_export", "rna_Scene_collada_export"); parm = RNA_def_string(func, "filepath", "", FILE_MAX, "File Path", "File path to write Collada file"); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_property_subtype(parm, PROP_FILEPATH); /* allow non utf8 */ parm = RNA_def_boolean(func, "apply_modifiers", 0, "Apply Modifiers", "Apply modifiers"); parm = RNA_def_int(func, "export_mesh_type", 0, INT_MIN, INT_MAX, "Resolution", "Modifier resolution for export", INT_MIN, INT_MAX); parm = RNA_def_boolean(func, "selected", 0, "Selection Only", "Export only selected elements"); parm = RNA_def_boolean(func, "include_children", 0, "Include Children", "Export all children of selected objects (even if not selected)"); parm = RNA_def_boolean(func, "include_armatures", 0, "Include Armatures", "Export related armatures (even if not selected)"); parm = RNA_def_boolean(func, "include_shapekeys", 0, "Include Shape Keys", "Export all Shape Keys from Mesh Objects"); parm = RNA_def_boolean(func, "deform_bones_only", 0, "Deform Bones only", "Only export deforming bones with armatures"); parm = RNA_def_boolean(func, "active_uv_only", 0, "Active UV Layer only", "Export only the active UV Layer"); parm = RNA_def_boolean(func, "include_uv_textures", 0, "Include UV Textures", "Export textures assigned to the object UV maps"); parm = RNA_def_boolean(func, "include_material_textures", 0, "Include Material Textures", "Export textures assigned to the object Materials"); parm = RNA_def_boolean(func, "use_texture_copies", 0, "copy", "Copy textures to same folder where the .dae file is exported"); parm = RNA_def_boolean(func, "use_ngons", 1, "Use NGons", "Keep NGons in Export"); parm = RNA_def_boolean(func, "use_object_instantiation", 1, "Use Object Instances", "Instantiate multiple Objects from same Data"); parm = RNA_def_boolean(func, "sort_by_name", 0, "Sort by Object name", "Sort exported data by Object name"); parm = RNA_def_boolean(func, "second_life", 0, "Export for Second Life", "Compatibility mode for Second Life"); parm = RNA_def_int(func, "export_transformation_type", 0, INT_MIN, INT_MAX, "Transformation", "Transformation type for translation, scale and rotation", INT_MIN, INT_MAX); RNA_def_function_ui_description(func, "Export to collada file"); #endif }
static void rna_def_render_engine(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; FunctionRNA *func; srna= RNA_def_struct(brna, "RenderEngine", NULL); RNA_def_struct_sdna(srna, "RenderEngine"); RNA_def_struct_ui_text(srna, "Render Engine", "Render engine"); RNA_def_struct_refine_func(srna, "rna_RenderEngine_refine"); RNA_def_struct_register_funcs(srna, "rna_RenderEngine_register", "rna_RenderEngine_unregister", "rna_RenderEngine_instance"); /* final render callbacks */ func= RNA_def_function(srna, "update", NULL); RNA_def_function_ui_description(func, "Export scene data for render"); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); RNA_def_pointer(func, "data", "BlendData", "", ""); RNA_def_pointer(func, "scene", "Scene", "", ""); func= RNA_def_function(srna, "render", NULL); RNA_def_function_ui_description(func, "Render scene into an image"); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); RNA_def_pointer(func, "scene", "Scene", "", ""); /* viewport render callbacks */ func= RNA_def_function(srna, "view_update", NULL); RNA_def_function_ui_description(func, "Update on data changes for viewport render"); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); RNA_def_pointer(func, "context", "Context", "", ""); func= RNA_def_function(srna, "view_draw", NULL); RNA_def_function_ui_description(func, "Draw viewport render"); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); RNA_def_pointer(func, "context", "Context", "", ""); /* tag for redraw */ RNA_def_function(srna, "tag_redraw", "engine_tag_redraw"); RNA_def_function_ui_description(func, "Request redraw for viewport rendering"); /* tag for update */ RNA_def_function(srna, "tag_update", "engine_tag_update"); RNA_def_function_ui_description(func, "Request update call for viewport rendering"); func= RNA_def_function(srna, "begin_result", "RE_engine_begin_result"); prop= RNA_def_int(func, "x", 0, 0, INT_MAX, "X", "", 0, INT_MAX); RNA_def_property_flag(prop, PROP_REQUIRED); prop= RNA_def_int(func, "y", 0, 0, INT_MAX, "Y", "", 0, INT_MAX); RNA_def_property_flag(prop, PROP_REQUIRED); prop= RNA_def_int(func, "w", 0, 0, INT_MAX, "Width", "", 0, INT_MAX); RNA_def_property_flag(prop, PROP_REQUIRED); prop= RNA_def_int(func, "h", 0, 0, INT_MAX, "Height", "", 0, INT_MAX); RNA_def_property_flag(prop, PROP_REQUIRED); prop= RNA_def_pointer(func, "result", "RenderResult", "Result", ""); RNA_def_function_return(func, prop); func= RNA_def_function(srna, "update_result", "RE_engine_update_result"); prop= RNA_def_pointer(func, "result", "RenderResult", "Result", ""); RNA_def_property_flag(prop, PROP_REQUIRED); func= RNA_def_function(srna, "end_result", "RE_engine_end_result"); prop= RNA_def_pointer(func, "result", "RenderResult", "Result", ""); RNA_def_property_flag(prop, PROP_REQUIRED); func= RNA_def_function(srna, "test_break", "RE_engine_test_break"); prop= RNA_def_boolean(func, "do_break", 0, "Break", ""); RNA_def_function_return(func, prop); func= RNA_def_function(srna, "update_stats", "RE_engine_update_stats"); prop= RNA_def_string(func, "stats", "", 0, "Stats", ""); RNA_def_property_flag(prop, PROP_REQUIRED); prop= RNA_def_string(func, "info", "", 0, "Info", ""); RNA_def_property_flag(prop, PROP_REQUIRED); func= RNA_def_function(srna, "update_progress", "RE_engine_update_progress"); prop= RNA_def_float(func, "progress", 0, 0.0f, 1.0f, "", "Percentage of render that's done", 0.0f, 1.0f); RNA_def_property_flag(prop, PROP_REQUIRED); func= RNA_def_function(srna, "report", "RE_engine_report"); prop= RNA_def_enum_flag(func, "type", wm_report_items, 0, "Type", ""); RNA_def_property_flag(prop, PROP_REQUIRED); prop= RNA_def_string(func, "message", "", 0, "Report Message", ""); RNA_def_property_flag(prop, PROP_REQUIRED); RNA_define_verify_sdna(0); prop= RNA_def_property(srna, "is_animation", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", RE_ENGINE_ANIMATION); prop= RNA_def_property(srna, "is_preview", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", RE_ENGINE_PREVIEW); /* registration */ prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->idname"); RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP); prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_TRANSLATE); RNA_def_property_string_sdna(prop, NULL, "type->name"); RNA_def_property_flag(prop, PROP_REGISTER); prop= RNA_def_property(srna, "bl_use_preview", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_PREVIEW); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); prop= RNA_def_property(srna, "bl_use_postprocess", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "type->flag", RE_USE_POSTPROCESS); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); prop= RNA_def_property(srna, "bl_use_shading_nodes", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_SHADING_NODES); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); RNA_define_verify_sdna(1); }
void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; PropertyRNA *parm; FunctionRNA *func; static EnumPropertyItem seq_effect_items[] = { {SEQ_TYPE_CROSS, "CROSS", 0, "Cross", ""}, {SEQ_TYPE_ADD, "ADD", 0, "Add", ""}, {SEQ_TYPE_SUB, "SUBTRACT", 0, "Subtract", ""}, {SEQ_TYPE_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", ""}, {SEQ_TYPE_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""}, {SEQ_TYPE_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""}, {SEQ_TYPE_MUL, "MULTIPLY", 0, "Multiply", ""}, {SEQ_TYPE_OVERDROP, "OVER_DROP", 0, "Over Drop", ""}, {SEQ_TYPE_WIPE, "WIPE", 0, "Wipe", ""}, {SEQ_TYPE_GLOW, "GLOW", 0, "Glow", ""}, {SEQ_TYPE_TRANSFORM, "TRANSFORM", 0, "Transform", ""}, {SEQ_TYPE_COLOR, "COLOR", 0, "Color", ""}, {SEQ_TYPE_SPEED, "SPEED", 0, "Speed", ""}, {SEQ_TYPE_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""}, {SEQ_TYPE_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""}, {SEQ_TYPE_GAUSSIAN_BLUR, "GAUSSIAN_BLUR", 0, "Gaussian Blur", ""}, {0, NULL, 0, NULL, NULL} }; RNA_def_property_srna(cprop, "Sequences"); srna = RNA_def_struct(brna, "Sequences", NULL); RNA_def_struct_sdna(srna, "Editing"); RNA_def_struct_ui_text(srna, "Sequences", "Collection of Sequences"); func = RNA_def_function(srna, "new_clip", "rna_Sequences_new_clip"); RNA_def_function_flag(func, FUNC_USE_SELF_ID); RNA_def_function_ui_description(func, "Add a new movie clip sequence"); parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "clip", "MovieClip", "", "Movie clip to add"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); parm = RNA_def_int(func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_int(func, "frame_start", 0, -MAXFRAME, MAXFRAME, "", "The start frame for the new sequence", -MAXFRAME, MAXFRAME); RNA_def_property_flag(parm, PROP_REQUIRED); /* return type */ parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "new_mask", "rna_Sequences_new_mask"); RNA_def_function_flag(func, FUNC_USE_SELF_ID); RNA_def_function_ui_description(func, "Add a new mask sequence"); parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "mask", "Mask", "", "Mask to add"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); parm = RNA_def_int(func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_int(func, "frame_start", 0, -MAXFRAME, MAXFRAME, "", "The start frame for the new sequence", -MAXFRAME, MAXFRAME); RNA_def_property_flag(parm, PROP_REQUIRED); /* return type */ parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "new_scene", "rna_Sequences_new_scene"); RNA_def_function_flag(func, FUNC_USE_SELF_ID); RNA_def_function_ui_description(func, "Add a new scene sequence"); parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene to add"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); parm = RNA_def_int(func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_int(func, "frame_start", 0, -MAXFRAME, MAXFRAME, "", "The start frame for the new sequence", -MAXFRAME, MAXFRAME); RNA_def_property_flag(parm, PROP_REQUIRED); /* return type */ parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "new_image", "rna_Sequences_new_image"); RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID); RNA_def_function_ui_description(func, "Add a new image sequence"); parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_string(func, "filepath", "File", 0, "", "Filepath to image"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_int(func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_int(func, "frame_start", 0, -MAXFRAME, MAXFRAME, "", "The start frame for the new sequence", -MAXFRAME, MAXFRAME); RNA_def_property_flag(parm, PROP_REQUIRED); /* return type */ parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "new_movie", "rna_Sequences_new_movie"); RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID); RNA_def_function_ui_description(func, "Add a new movie sequence"); parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_string(func, "filepath", "File", 0, "", "Filepath to movie"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_int(func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_int(func, "frame_start", 0, -MAXFRAME, MAXFRAME, "", "The start frame for the new sequence", -MAXFRAME, MAXFRAME); RNA_def_property_flag(parm, PROP_REQUIRED); /* return type */ parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "new_sound", "rna_Sequences_new_sound"); RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID | FUNC_USE_MAIN); RNA_def_function_ui_description(func, "Add a new sound sequence"); parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_string(func, "filepath", "File", 0, "", "Filepath to movie"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_int(func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_int(func, "frame_start", 0, -MAXFRAME, MAXFRAME, "", "The start frame for the new sequence", -MAXFRAME, MAXFRAME); RNA_def_property_flag(parm, PROP_REQUIRED); /* return type */ parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "new_effect", "rna_Sequences_new_effect"); RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID); RNA_def_function_ui_description(func, "Add a new effect sequence"); parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_enum(func, "type", seq_effect_items, 0, "Type", "type for the new sequence"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_int(func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ); /* don't use MAXFRAME since it makes importer scripts fail */ RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_int(func, "frame_start", 0, INT_MIN, INT_MAX, "", "The start frame for the new sequence", INT_MIN, INT_MAX); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_int(func, "frame_end", 0, INT_MIN, INT_MAX, "", "The end frame for the new sequence", INT_MIN, INT_MAX); RNA_def_pointer(func, "seq1", "Sequence", "", "Sequence 1 for effect"); RNA_def_pointer(func, "seq2", "Sequence", "", "Sequence 2 for effect"); RNA_def_pointer(func, "seq3", "Sequence", "", "Sequence 3 for effect"); /* return type */ parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "remove", "rna_Sequences_remove"); RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Remove a Sequence"); parm = RNA_def_pointer(func, "sequence", "Sequence", "", "Sequence to remove"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); }
static void api_ui_item_op(FunctionRNA *func) { PropertyRNA *parm; parm = RNA_def_string(func, "operator", NULL, 0, "", "Identifier of the operator"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); }
void RNA_api_operator(StructRNA *srna) { FunctionRNA *func; PropertyRNA *parm; /* utility, not for registering */ func = RNA_def_function(srna, "report", "rna_Operator_report"); parm = RNA_def_enum_flag(func, "type", rna_enum_wm_report_items, 0, "Type", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_string(func, "message", NULL, 0, "Report Message", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); /* utility, not for registering */ func = RNA_def_function(srna, "is_repeat", "rna_Operator_is_repeat"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); /* return */ parm = RNA_def_boolean(func, "result", 0, "result", ""); RNA_def_function_return(func, parm); /* Registration */ /* poll */ func = RNA_def_function(srna, "poll", NULL); RNA_def_function_ui_description(func, "Test if the operator can be called or not"); RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL); RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", "")); parm = RNA_def_pointer(func, "context", "Context", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); /* exec */ func = RNA_def_function(srna, "execute", NULL); RNA_def_function_ui_description(func, "Execute the operator"); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); parm = RNA_def_pointer(func, "context", "Context", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); /* better name? */ parm = RNA_def_enum_flag( func, "result", rna_enum_operator_return_items, OPERATOR_CANCELLED, "result", ""); RNA_def_function_return(func, parm); /* check */ func = RNA_def_function(srna, "check", NULL); RNA_def_function_ui_description( func, "Check the operator settings, return True to signal a change to redraw"); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); parm = RNA_def_pointer(func, "context", "Context", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); parm = RNA_def_boolean(func, "result", 0, "result", ""); /* better name? */ RNA_def_function_return(func, parm); /* invoke */ func = RNA_def_function(srna, "invoke", NULL); RNA_def_function_ui_description(func, "Invoke the operator"); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); parm = RNA_def_pointer(func, "context", "Context", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); parm = RNA_def_pointer(func, "event", "Event", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); /* better name? */ parm = RNA_def_enum_flag( func, "result", rna_enum_operator_return_items, OPERATOR_CANCELLED, "result", ""); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "modal", NULL); /* same as invoke */ RNA_def_function_ui_description(func, "Modal operator function"); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); parm = RNA_def_pointer(func, "context", "Context", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); parm = RNA_def_pointer(func, "event", "Event", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); /* better name? */ parm = RNA_def_enum_flag( func, "result", rna_enum_operator_return_items, OPERATOR_CANCELLED, "result", ""); RNA_def_function_return(func, parm); /* draw */ func = RNA_def_function(srna, "draw", NULL); RNA_def_function_ui_description(func, "Draw function for the operator"); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); parm = RNA_def_pointer(func, "context", "Context", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); /* cancel */ func = RNA_def_function(srna, "cancel", NULL); RNA_def_function_ui_description(func, "Called when the operator is canceled"); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); parm = RNA_def_pointer(func, "context", "Context", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); }
void RNA_api_wm(StructRNA *srna) { FunctionRNA *func; PropertyRNA *parm; func = RNA_def_function(srna, "fileselect_add", "WM_event_add_fileselect"); RNA_def_function_ui_description( func, "Opens a file selector with an operator. " "The string properties 'filepath', 'filename', 'directory' and a 'files' " "collection are assigned when present in the operator"); rna_generic_op_invoke(func, 0); func = RNA_def_function(srna, "modal_handler_add", "rna_event_modal_handler_add"); RNA_def_function_ui_description( func, "Add a modal handler to the window manager, for the given modal operator " "(called by invoke() with self, just before returning {'RUNNING_MODAL'})"); RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT); parm = RNA_def_pointer(func, "operator", "Operator", "", "Operator to call"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); RNA_def_function_return( func, RNA_def_boolean(func, "handle", 1, "", "Whether adding the handler was successful")); func = RNA_def_function(srna, "event_timer_add", "rna_event_timer_add"); RNA_def_function_ui_description( func, "Add a timer to the given window, to generate periodic 'TIMER' events"); parm = RNA_def_property(func, "time_step", PROP_FLOAT, PROP_NONE); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); RNA_def_property_range(parm, 0.0, FLT_MAX); RNA_def_property_ui_text(parm, "Time Step", "Interval in seconds between timer events"); RNA_def_pointer(func, "window", "Window", "", "Window to attach the timer to, or None"); parm = RNA_def_pointer(func, "result", "Timer", "", ""); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "event_timer_remove", "rna_event_timer_remove"); parm = RNA_def_pointer(func, "timer", "Timer", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); func = RNA_def_function(srna, "gizmo_group_type_ensure", "rna_gizmo_group_type_ensure"); RNA_def_function_ui_description( func, "Activate an existing widget group (when the persistent option isn't set)"); RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_REPORTS); parm = RNA_def_string(func, "identifier", NULL, 0, "", "Gizmo group type name"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); func = RNA_def_function( srna, "gizmo_group_type_unlink_delayed", "rna_gizmo_group_type_unlink_delayed"); RNA_def_function_ui_description(func, "Unlink a widget group (when the persistent option is set)"); RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_REPORTS); parm = RNA_def_string(func, "identifier", NULL, 0, "", "Gizmo group type name"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); /* Progress bar interface */ func = RNA_def_function(srna, "progress_begin", "rna_progress_begin"); RNA_def_function_ui_description(func, "Start progress report"); parm = RNA_def_property(func, "min", PROP_FLOAT, PROP_NONE); RNA_def_property_ui_text(parm, "min", "any value in range [0,9999]"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_property(func, "max", PROP_FLOAT, PROP_NONE); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); RNA_def_property_ui_text(parm, "max", "any value in range [min+1,9998]"); func = RNA_def_function(srna, "progress_update", "rna_progress_update"); RNA_def_function_ui_description(func, "Update the progress feedback"); parm = RNA_def_property(func, "value", PROP_FLOAT, PROP_NONE); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); RNA_def_property_ui_text( parm, "value", "Any value between min and max as set in progress_begin()"); func = RNA_def_function(srna, "progress_end", "rna_progress_end"); RNA_def_function_ui_description(func, "Terminate progress report"); /* invoke functions, for use with python */ func = RNA_def_function(srna, "invoke_props_popup", "rna_Operator_props_popup"); RNA_def_function_ui_description( func, "Operator popup invoke " "(show operator properties and execute it automatically on changes)"); rna_generic_op_invoke(func, WM_GEN_INVOKE_EVENT | WM_GEN_INVOKE_RETURN); /* invoked dialog opens popup with OK button, does not auto-exec operator. */ func = RNA_def_function(srna, "invoke_props_dialog", "WM_operator_props_dialog_popup"); RNA_def_function_ui_description( func, "Operator dialog (non-autoexec popup) invoke " "(show operator properties and only execute it on click on OK button)"); rna_generic_op_invoke(func, WM_GEN_INVOKE_SIZE | WM_GEN_INVOKE_RETURN); /* invoke enum */ func = RNA_def_function(srna, "invoke_search_popup", "rna_Operator_enum_search_invoke"); RNA_def_function_ui_description( func, "Operator search popup invoke which " "searches values of the operator's :class:`bpy.types.Operator.bl_property` " "(which must be an EnumProperty), executing it on confirmation"); rna_generic_op_invoke(func, 0); /* invoke functions, for use with python */ func = RNA_def_function(srna, "invoke_popup", "WM_operator_ui_popup"); RNA_def_function_ui_description(func, "Operator popup invoke " "(only shows operator's properties, without executing it)"); rna_generic_op_invoke(func, WM_GEN_INVOKE_SIZE | WM_GEN_INVOKE_RETURN); func = RNA_def_function(srna, "invoke_confirm", "rna_Operator_confirm"); RNA_def_function_ui_description( func, "Operator confirmation popup " "(only to let user confirm the execution, no operator properties shown)"); rna_generic_op_invoke(func, WM_GEN_INVOKE_EVENT | WM_GEN_INVOKE_RETURN); /* wrap UI_popup_menu_begin */ func = RNA_def_function(srna, "popmenu_begin__internal", "rna_PopMenuBegin"); RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT); parm = RNA_def_string(func, "title", NULL, 0, "", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(parm, rna_enum_icon_items); /* return */ parm = RNA_def_pointer(func, "menu", "UIPopupMenu", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR); RNA_def_function_return(func, parm); /* wrap UI_popup_menu_end */ func = RNA_def_function(srna, "popmenu_end__internal", "rna_PopMenuEnd"); RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT); parm = RNA_def_pointer(func, "menu", "UIPopupMenu", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR | PARM_REQUIRED); /* wrap UI_popover_begin */ func = RNA_def_function(srna, "popover_begin__internal", "rna_PopoverBegin"); RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT); RNA_def_property(func, "ui_units_x", PROP_INT, PROP_UNSIGNED); /* return */ parm = RNA_def_pointer(func, "menu", "UIPopover", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR); RNA_def_function_return(func, parm); /* wrap UI_popover_end */ func = RNA_def_function(srna, "popover_end__internal", "rna_PopoverEnd"); RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT); parm = RNA_def_pointer(func, "menu", "UIPopover", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR | PARM_REQUIRED); RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Active key map"); /* wrap uiPieMenuBegin */ func = RNA_def_function(srna, "piemenu_begin__internal", "rna_PieMenuBegin"); RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT); parm = RNA_def_string(func, "title", NULL, 0, "", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(parm, rna_enum_icon_items); parm = RNA_def_pointer(func, "event", "Event", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR); /* return */ parm = RNA_def_pointer(func, "menu_pie", "UIPieMenu", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR); RNA_def_function_return(func, parm); /* wrap uiPieMenuEnd */ func = RNA_def_function(srna, "piemenu_end__internal", "rna_PieMenuEnd"); RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT); parm = RNA_def_pointer(func, "menu", "UIPieMenu", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR | PARM_REQUIRED); /* access last operator options (optionally create). */ func = RNA_def_function( srna, "operator_properties_last", "rna_WindoManager_operator_properties_last"); RNA_def_function_flag(func, FUNC_NO_SELF); parm = RNA_def_string(func, "operator", NULL, 0, "", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); /* return */ parm = RNA_def_pointer(func, "result", "OperatorProperties", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR); RNA_def_function_return(func, parm); RNA_def_function(srna, "print_undo_steps", "rna_WindowManager_print_undo_steps"); }
void RNA_api_keymapitems(StructRNA *srna) { FunctionRNA *func; PropertyRNA *parm; func = RNA_def_function(srna, "new", "rna_KeyMap_item_new"); RNA_def_function_flag(func, FUNC_USE_REPORTS); parm = RNA_def_string(func, "idname", NULL, 0, "Operator Identifier", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_enum(func, "type", rna_enum_event_type_items, 0, "Type", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_enum(func, "value", rna_enum_event_value_items, 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); RNA_def_boolean(func, "any", 0, "Any", ""); RNA_def_boolean(func, "shift", 0, "Shift", ""); RNA_def_boolean(func, "ctrl", 0, "Ctrl", ""); RNA_def_boolean(func, "alt", 0, "Alt", ""); RNA_def_boolean(func, "oskey", 0, "OS Key", ""); RNA_def_enum(func, "key_modifier", rna_enum_event_type_items, 0, "Key Modifier", ""); RNA_def_boolean(func, "head", 0, "At Head", "Force item to be added at start (not end) of key map so that " "it doesn't get blocked by an existing key map item"); parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "new_modal", "rna_KeyMap_item_new_modal"); RNA_def_function_flag(func, FUNC_USE_REPORTS); parm = RNA_def_string(func, "propvalue", NULL, 0, "Property Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_enum(func, "type", rna_enum_event_type_items, 0, "Type", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_enum(func, "value", rna_enum_event_value_items, 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); RNA_def_boolean(func, "any", 0, "Any", ""); RNA_def_boolean(func, "shift", 0, "Shift", ""); RNA_def_boolean(func, "ctrl", 0, "Ctrl", ""); RNA_def_boolean(func, "alt", 0, "Alt", ""); RNA_def_boolean(func, "oskey", 0, "OS Key", ""); RNA_def_enum(func, "key_modifier", rna_enum_event_type_items, 0, "Key Modifier", ""); parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "new_from_item", "rna_KeyMap_item_new_from_item"); RNA_def_function_flag(func, FUNC_USE_REPORTS); parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Item to use as a reference"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); RNA_def_boolean(func, "head", 0, "At Head", ""); parm = RNA_def_pointer(func, "result", "KeyMapItem", "Item", "Added key map item"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "remove", "rna_KeyMap_item_remove"); RNA_def_function_flag(func, FUNC_USE_REPORTS); parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); func = RNA_def_function(srna, "from_id", "WM_keymap_item_find_id"); parm = RNA_def_property(func, "id", PROP_INT, PROP_NONE); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); RNA_def_property_ui_text(parm, "id", "ID of the item"); parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", ""); RNA_def_function_return(func, parm); /* Keymap introspection * Args follow: KeyConfigs.find_item_from_operator */ func = RNA_def_function(srna, "find_from_operator", "rna_KeyMap_item_find_from_operator"); RNA_def_function_flag(func, FUNC_USE_SELF_ID); parm = RNA_def_string(func, "idname", NULL, 0, "Operator Identifier", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_pointer(func, "properties", "OperatorProperties", "", ""); RNA_def_parameter_flags(parm, 0, PARM_RNAPTR); RNA_def_enum_flag( func, "include", rna_enum_event_type_mask_items, EVT_TYPE_MASK_ALL, "Include", ""); RNA_def_enum_flag(func, "exclude", rna_enum_event_type_mask_items, 0, "Exclude", ""); parm = RNA_def_pointer(func, "item", "KeyMapItem", "", ""); RNA_def_parameter_flags(parm, 0, PARM_RNAPTR); RNA_def_function_return(func, parm); }
static void rna_def_render_engine(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; FunctionRNA *func; PropertyRNA *parm; static const EnumPropertyItem render_pass_type_items[] = { {SOCK_FLOAT, "VALUE", 0, "Value", ""}, {SOCK_VECTOR, "VECTOR", 0, "Vector", ""}, {SOCK_RGBA, "COLOR", 0, "Color", ""}, {0, NULL, 0, NULL, NULL} }; srna = RNA_def_struct(brna, "RenderEngine", NULL); RNA_def_struct_sdna(srna, "RenderEngine"); RNA_def_struct_ui_text(srna, "Render Engine", "Render engine"); RNA_def_struct_refine_func(srna, "rna_RenderEngine_refine"); RNA_def_struct_register_funcs(srna, "rna_RenderEngine_register", "rna_RenderEngine_unregister", "rna_RenderEngine_instance"); /* final render callbacks */ func = RNA_def_function(srna, "update", NULL); RNA_def_function_ui_description(func, "Export scene data for render"); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); RNA_def_pointer(func, "data", "BlendData", "", ""); RNA_def_pointer(func, "scene", "Scene", "", ""); func = RNA_def_function(srna, "render", NULL); RNA_def_function_ui_description(func, "Render scene into an image"); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); RNA_def_pointer(func, "scene", "Scene", "", ""); func = RNA_def_function(srna, "bake", NULL); RNA_def_function_ui_description(func, "Bake passes"); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); parm = RNA_def_pointer(func, "scene", "Scene", "", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_pointer(func, "object", "Object", "", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_enum(func, "pass_type", rna_enum_bake_pass_type_items, 0, "Pass", "Pass to bake"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_int(func, "pass_filter", 0, 0, INT_MAX, "Pass Filter", "Filter to combined, diffuse, glossy, transmission and subsurface passes", 0, INT_MAX); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_int(func, "object_id", 0, 0, INT_MAX, "Object Id", "Id of the current object being baked in relation to the others", 0, INT_MAX); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_pointer(func, "pixel_array", "BakePixel", "", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_int(func, "num_pixels", 0, 0, INT_MAX, "Number of Pixels", "Size of the baking batch", 0, INT_MAX); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_int(func, "depth", 0, 0, INT_MAX, "Pixels depth", "Number of channels", 1, INT_MAX); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); /* TODO, see how array size of 0 works, this shouldnt be used */ parm = RNA_def_pointer(func, "result", "AnyType", "", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); /* viewport render callbacks */ func = RNA_def_function(srna, "view_update", NULL); RNA_def_function_ui_description(func, "Update on data changes for viewport render"); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); RNA_def_pointer(func, "context", "Context", "", ""); func = RNA_def_function(srna, "view_draw", NULL); RNA_def_function_ui_description(func, "Draw viewport render"); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); RNA_def_pointer(func, "context", "Context", "", ""); /* shader script callbacks */ func = RNA_def_function(srna, "update_script_node", NULL); RNA_def_function_ui_description(func, "Compile shader script node"); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); parm = RNA_def_pointer(func, "node", "Node", "", ""); RNA_def_parameter_flags(parm, 0, PARM_RNAPTR); /* tag for redraw */ func = RNA_def_function(srna, "tag_redraw", "engine_tag_redraw"); RNA_def_function_ui_description(func, "Request redraw for viewport rendering"); /* tag for update */ func = RNA_def_function(srna, "tag_update", "engine_tag_update"); RNA_def_function_ui_description(func, "Request update call for viewport rendering"); func = RNA_def_function(srna, "update_render_passes", NULL); RNA_def_function_ui_description(func, "Update the render passes that will be generated"); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); parm = RNA_def_pointer(func, "scene", "Scene", "", ""); parm = RNA_def_pointer(func, "renderlayer", "SceneRenderLayer", "", ""); func = RNA_def_function(srna, "begin_result", "RE_engine_begin_result"); RNA_def_function_ui_description(func, "Create render result to write linear floating point render layers and passes"); parm = RNA_def_int(func, "x", 0, 0, INT_MAX, "X", "", 0, INT_MAX); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_int(func, "y", 0, 0, INT_MAX, "Y", "", 0, INT_MAX); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_int(func, "w", 0, 0, INT_MAX, "Width", "", 0, INT_MAX); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_int(func, "h", 0, 0, INT_MAX, "Height", "", 0, INT_MAX); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); RNA_def_string(func, "layer", NULL, 0, "Layer", "Single layer to get render result for"); /* NULL ok here */ RNA_def_string(func, "view", NULL, 0, "View", "Single view to get render result for"); /* NULL ok here */ parm = RNA_def_pointer(func, "result", "RenderResult", "Result", ""); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "update_result", "RE_engine_update_result"); RNA_def_function_ui_description(func, "Signal that pixels have been updated and can be redrawn in the user interface"); parm = RNA_def_pointer(func, "result", "RenderResult", "Result", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); func = RNA_def_function(srna, "end_result", "RE_engine_end_result"); RNA_def_function_ui_description(func, "All pixels in the render result have been set and are final"); parm = RNA_def_pointer(func, "result", "RenderResult", "Result", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); RNA_def_boolean(func, "cancel", 0, "Cancel", "Don't mark tile as done, don't merge results unless forced"); RNA_def_boolean(func, "highlight", 0, "Highlight", "Don't mark tile as done yet"); RNA_def_boolean(func, "do_merge_results", 0, "Merge Results", "Merge results even if cancel=true"); func = RNA_def_function(srna, "add_pass", "RE_engine_add_pass"); RNA_def_function_ui_description(func, "Add a pass to the render layer"); parm = RNA_def_string(func, "name", NULL, 0, "Name", "Name of the Pass, without view or channel tag"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_int(func, "channels", 0, 0, INT_MAX, "Channels", "", 0, INT_MAX); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_string(func, "chan_id", NULL, 0, "Channel IDs", "Channel names, one character per channel"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); RNA_def_string(func, "layer", NULL, 0, "Layer", "Single layer to add render pass to"); /* NULL ok here */ func = RNA_def_function(srna, "get_result", "RE_engine_get_result"); RNA_def_function_ui_description(func, "Get final result for non-pixel operations"); parm = RNA_def_pointer(func, "result", "RenderResult", "Result", ""); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "test_break", "RE_engine_test_break"); RNA_def_function_ui_description(func, "Test if the render operation should been canceled, this is a fast call that should be used regularly for responsiveness"); parm = RNA_def_boolean(func, "do_break", 0, "Break", ""); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "active_view_get", "RE_engine_active_view_get"); parm = RNA_def_string(func, "view", NULL, 0, "View", "Single view active"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "active_view_set", "RE_engine_active_view_set"); parm = RNA_def_string(func, "view", NULL, 0, "View", "Single view to set as active"); /* NULL ok here */ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); func = RNA_def_function(srna, "camera_shift_x", "RE_engine_get_camera_shift_x"); parm = RNA_def_pointer(func, "camera", "Object", "", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); RNA_def_boolean(func, "use_spherical_stereo", 0, "Spherical Stereo", ""); parm = RNA_def_float(func, "shift_x", 0.0f, 0.0f, FLT_MAX, "Shift X", "", 0.0f, FLT_MAX); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "camera_model_matrix", "RE_engine_get_camera_model_matrix"); parm = RNA_def_pointer(func, "camera", "Object", "", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); RNA_def_boolean(func, "use_spherical_stereo", 0, "Spherical Stereo", ""); parm = RNA_def_float_matrix(func, "r_model_matrix", 4, 4, NULL, 0.0f, 0.0f, "Model Matrix", "Normalized camera model matrix", 0.0f, 0.0f); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); func = RNA_def_function(srna, "use_spherical_stereo", "RE_engine_get_spherical_stereo"); parm = RNA_def_pointer(func, "camera", "Object", "", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_boolean(func, "use_spherical_stereo", 0, "Spherical Stereo", ""); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "update_stats", "RE_engine_update_stats"); RNA_def_function_ui_description(func, "Update and signal to redraw render status text"); parm = RNA_def_string(func, "stats", NULL, 0, "Stats", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_string(func, "info", NULL, 0, "Info", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); func = RNA_def_function(srna, "frame_set", "RE_engine_frame_set"); RNA_def_function_ui_description(func, "Evaluate scene at a different frame (for motion blur)"); parm = RNA_def_int(func, "frame", 0, INT_MIN, INT_MAX, "Frame", "", INT_MIN, INT_MAX); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_float(func, "subframe", 0.0f, 0.0f, 1.0f, "Subframe", "", 0.0f, 1.0f); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); func = RNA_def_function(srna, "update_progress", "RE_engine_update_progress"); RNA_def_function_ui_description(func, "Update progress percentage of render"); parm = RNA_def_float(func, "progress", 0, 0.0f, 1.0f, "", "Percentage of render that's done", 0.0f, 1.0f); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); func = RNA_def_function(srna, "update_memory_stats", "RE_engine_update_memory_stats"); RNA_def_function_ui_description(func, "Update memory usage statistics"); RNA_def_float(func, "memory_used", 0, 0.0f, FLT_MAX, "", "Current memory usage in megabytes", 0.0f, FLT_MAX); RNA_def_float(func, "memory_peak", 0, 0.0f, FLT_MAX, "", "Peak memory usage in megabytes", 0.0f, FLT_MAX); func = RNA_def_function(srna, "report", "RE_engine_report"); RNA_def_function_ui_description(func, "Report info, warning or error messages"); parm = RNA_def_enum_flag(func, "type", rna_enum_wm_report_items, 0, "Type", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_string(func, "message", NULL, 0, "Report Message", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); func = RNA_def_function(srna, "error_set", "RE_engine_set_error_message"); RNA_def_function_ui_description(func, "Set error message displaying after the render is finished"); parm = RNA_def_string(func, "message", NULL, 0, "Report Message", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); func = RNA_def_function(srna, "bind_display_space_shader", "engine_bind_display_space_shader"); RNA_def_function_ui_description(func, "Bind GLSL fragment shader that converts linear colors to display space colors using scene color management settings"); parm = RNA_def_pointer(func, "scene", "Scene", "", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); func = RNA_def_function(srna, "unbind_display_space_shader", "engine_unbind_display_space_shader"); RNA_def_function_ui_description(func, "Unbind GLSL display space shader, must always be called after binding the shader"); func = RNA_def_function(srna, "support_display_space_shader", "engine_support_display_space_shader"); RNA_def_function_ui_description(func, "Test if GLSL display space shader is supported for the combination of graphics card and scene settings"); parm = RNA_def_pointer(func, "scene", "Scene", "", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_boolean(func, "supported", 0, "Supported", ""); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "get_preview_pixel_size", "engine_get_preview_pixel_size"); RNA_def_function_ui_description(func, "Get the pixel size that should be used for preview rendering"); parm = RNA_def_pointer(func, "scene", "Scene", "", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_int(func, "pixel_size", 0, 1, 8, "Pixel Size", "", 1, 8); RNA_def_function_return(func, parm); RNA_define_verify_sdna(0); prop = RNA_def_property(srna, "is_animation", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", RE_ENGINE_ANIMATION); prop = RNA_def_property(srna, "is_preview", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", RE_ENGINE_PREVIEW); prop = RNA_def_property(srna, "camera_override", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_funcs(prop, "rna_RenderEngine_camera_override_get", NULL, NULL, NULL); RNA_def_property_struct_type(prop, "Object"); prop = RNA_def_property(srna, "layer_override", PROP_BOOLEAN, PROP_LAYER_MEMBER); RNA_def_property_boolean_sdna(prop, NULL, "layer_override", 1); RNA_def_property_array(prop, 20); prop = RNA_def_property(srna, "tile_x", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "tile_x"); prop = RNA_def_property(srna, "tile_y", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "tile_y"); prop = RNA_def_property(srna, "resolution_x", PROP_INT, PROP_PIXEL); RNA_def_property_int_sdna(prop, NULL, "resolution_x"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "resolution_y", PROP_INT, PROP_PIXEL); RNA_def_property_int_sdna(prop, NULL, "resolution_y"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* Render Data */ prop = RNA_def_property(srna, "render", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "RenderSettings"); RNA_def_property_pointer_funcs(prop, "rna_RenderEngine_render_get", NULL, NULL, NULL); RNA_def_property_ui_text(prop, "Render Data", ""); prop = RNA_def_property(srna, "use_highlight_tiles", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", RE_ENGINE_HIGHLIGHT_TILES); func = RNA_def_function(srna, "register_pass", "RE_engine_register_pass"); RNA_def_function_ui_description(func, "Register a render pass that will be part of the render with the current settings"); prop = RNA_def_pointer(func, "scene", "Scene", "", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); prop = RNA_def_pointer(func, "srl", "SceneRenderLayer", "", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); prop = RNA_def_string(func, "name", NULL, MAX_NAME, "Name", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); prop = RNA_def_int(func, "channels", 1, 1, 8, "Channels", "", 1, 4); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); prop = RNA_def_string(func, "chanid", NULL, 8, "Channel IDs", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); prop = RNA_def_enum(func, "type", render_pass_type_items, SOCK_FLOAT, "Type", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); /* registration */ prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->idname"); RNA_def_property_flag(prop, PROP_REGISTER); prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->name"); RNA_def_property_flag(prop, PROP_REGISTER); prop = RNA_def_property(srna, "bl_use_preview", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_PREVIEW); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); prop = RNA_def_property(srna, "bl_use_texture_preview", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_TEXTURE_PREVIEW); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); prop = RNA_def_property(srna, "bl_use_postprocess", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "type->flag", RE_USE_POSTPROCESS); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); prop = RNA_def_property(srna, "bl_use_shading_nodes", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_SHADING_NODES); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); prop = RNA_def_property(srna, "bl_use_shading_nodes_custom", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_SHADING_NODES_CUSTOM); RNA_def_property_boolean_default(prop, true); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); prop = RNA_def_property(srna, "bl_use_exclude_layers", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_EXCLUDE_LAYERS); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); prop = RNA_def_property(srna, "bl_use_save_buffers", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_SAVE_BUFFERS); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); prop = RNA_def_property(srna, "bl_use_spherical_stereo", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_SPHERICAL_STEREO); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); RNA_define_verify_sdna(1); }
static void edit_modifier_properties(wmOperatorType *ot) { RNA_def_string(ot->srna, "modifier", "", MAX_NAME, "Modifier", "Name of the modifier to edit"); }
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"); }
static void edit_sensor_properties(wmOperatorType *ot) { RNA_def_string(ot->srna, "sensor", "", MAX_NAME, "Sensor", "Name of the sensor to edit"); RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object", "Name of the object the sensor belongs to"); }
static void gpencil_edit_modifier_properties(wmOperatorType *ot) { PropertyRNA *prop = RNA_def_string( ot->srna, "modifier", NULL, MAX_NAME, "Modifier", "Name of the modifier to edit"); RNA_def_property_flag(prop, PROP_HIDDEN); }
static void edit_controller_properties(wmOperatorType *ot) { RNA_def_string(ot->srna, "controller", "", MAX_NAME, "Controller", "Name of the controller to edit"); RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object", "Name of the object the controller belongs to"); }
/* keyingset.paths */ static void rna_def_keyingset_paths(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; PropertyRNA *prop; RNA_def_property_srna(cprop, "KeyingSetPaths"); srna = RNA_def_struct(brna, "KeyingSetPaths", NULL); RNA_def_struct_sdna(srna, "KeyingSet"); RNA_def_struct_ui_text(srna, "Keying set paths", "Collection of keying set paths"); /* Add Path */ func = RNA_def_function(srna, "add", "rna_KeyingSet_paths_add"); RNA_def_function_ui_description(func, "Add a new path for the Keying Set"); RNA_def_function_flag(func, FUNC_USE_REPORTS); /* return arg */ parm = RNA_def_pointer(func, "ksp", "KeyingSetPath", "New Path", "Path created and added to the Keying Set"); RNA_def_function_return(func, parm); /* ID-block for target */ parm = RNA_def_pointer(func, "target_id", "ID", "Target ID", "ID-Datablock for the destination"); RNA_def_property_flag(parm, PROP_REQUIRED); /* rna-path */ /* XXX hopefully this is long enough */ parm = RNA_def_string(func, "data_path", "", 256, "Data-Path", "RNA-Path to destination property"); RNA_def_property_flag(parm, PROP_REQUIRED); /* index (defaults to -1 for entire array) */ RNA_def_int(func, "index", -1, -1, INT_MAX, "Index", "The index of the destination property (i.e. axis of Location/Rotation/etc.), " "or -1 for the entire array", 0, INT_MAX); /* grouping */ RNA_def_enum(func, "group_method", keyingset_path_grouping_items, KSP_GROUP_KSNAME, "Grouping Method", "Method used to define which Group-name to use"); RNA_def_string(func, "group_name", "", 64, "Group Name", "Name of Action Group to assign destination to (only if grouping mode is to use this name)"); /* Remove Path */ func = RNA_def_function(srna, "remove", "rna_KeyingSet_paths_remove"); RNA_def_function_ui_description(func, "Remove the given path from the Keying Set"); RNA_def_function_flag(func, FUNC_USE_REPORTS); /* path to remove */ parm = RNA_def_pointer(func, "path", "KeyingSetPath", "Path", ""); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); /* Remove All Paths */ func = RNA_def_function(srna, "clear", "rna_KeyingSet_paths_clear"); RNA_def_function_ui_description(func, "Remove all the paths from the Keying Set"); RNA_def_function_flag(func, FUNC_USE_REPORTS); prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "KeyingSetPath"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_editable_func(prop, "rna_KeyingSet_active_ksPath_editable"); RNA_def_property_pointer_funcs(prop, "rna_KeyingSet_active_ksPath_get", "rna_KeyingSet_active_ksPath_set", NULL, NULL); RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes"); prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "active_path"); RNA_def_property_int_funcs(prop, "rna_KeyingSet_active_ksPath_index_get", "rna_KeyingSet_active_ksPath_index_set", "rna_KeyingSet_active_ksPath_index_range"); RNA_def_property_ui_text(prop, "Active Path Index", "Current Keying Set index"); }
void RNA_api_object(StructRNA *srna) { FunctionRNA *func; PropertyRNA *parm; static const EnumPropertyItem mesh_type_items[] = { {eModifierMode_Realtime, "PREVIEW", 0, "Preview", "Apply modifier preview settings"}, {eModifierMode_Render, "RENDER", 0, "Render", "Apply modifier render settings"}, {0, NULL, 0, NULL, NULL} }; static const EnumPropertyItem dupli_eval_mode_items[] = { {DAG_EVAL_VIEWPORT, "VIEWPORT", 0, "Viewport", "Generate duplis using viewport settings"}, {DAG_EVAL_PREVIEW, "PREVIEW", 0, "Preview", "Generate duplis using preview settings"}, {DAG_EVAL_RENDER, "RENDER", 0, "Render", "Generate duplis using render settings"}, {0, NULL, 0, NULL, NULL} }; #ifndef NDEBUG static const EnumPropertyItem mesh_dm_info_items[] = { {0, "SOURCE", 0, "Source", "Source mesh"}, {1, "DEFORM", 0, "Deform", "Objects deform mesh"}, {2, "FINAL", 0, "Final", "Objects final mesh"}, {0, NULL, 0, NULL, NULL} }; #endif /* Matrix space conversion */ func = RNA_def_function(srna, "convert_space", "rna_Scene_mat_convert_space"); RNA_def_function_ui_description(func, "Convert (transform) the given matrix from one space to another"); RNA_def_function_flag(func, FUNC_USE_REPORTS); parm = RNA_def_pointer(func, "pose_bone", "PoseBone", "", "Bone to use to define spaces (may be None, in which case only the two 'WORLD' and " "'LOCAL' spaces are usable)"); parm = RNA_def_property(func, "matrix", PROP_FLOAT, PROP_MATRIX); RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4); RNA_def_property_ui_text(parm, "", "The matrix to transform"); parm = RNA_def_property(func, "matrix_return", PROP_FLOAT, PROP_MATRIX); RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4); RNA_def_property_ui_text(parm, "", "The transformed matrix"); RNA_def_function_output(func, parm); parm = RNA_def_enum(func, "from_space", space_items, CONSTRAINT_SPACE_WORLD, "", "The space in which 'matrix' is currently"); parm = RNA_def_enum(func, "to_space", space_items, CONSTRAINT_SPACE_WORLD, "", "The space to which you want to transform 'matrix'"); /* Camera-related operations */ func = RNA_def_function(srna, "calc_matrix_camera", "rna_Object_calc_matrix_camera"); RNA_def_function_ui_description(func, "Generate the camera projection matrix of this object " "(mostly useful for Camera and Lamp types)"); parm = RNA_def_property(func, "result", PROP_FLOAT, PROP_MATRIX); RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4); RNA_def_property_ui_text(parm, "", "The camera projection matrix"); RNA_def_function_output(func, parm); parm = RNA_def_int(func, "x", 1, 0, INT_MAX, "", "Width of the render area", 0, 10000); parm = RNA_def_int(func, "y", 1, 0, INT_MAX, "", "Height of the render area", 0, 10000); parm = RNA_def_float(func, "scale_x", 1.0f, 1.0e-6f, FLT_MAX, "", "Width scaling factor", 1.0e-2f, 100.0f); parm = RNA_def_float(func, "scale_y", 1.0f, 1.0e-6f, FLT_MAX, "", "height scaling factor", 1.0e-2f, 100.0f); func = RNA_def_function(srna, "camera_fit_coords", "rna_Object_camera_fit_coords"); RNA_def_function_ui_description(func, "Compute the coordinate (and scale for ortho cameras) " "given object should be to 'see' all given coordinates"); parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene to get render size information from, if available"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_float_array(func, "coordinates", 1, NULL, -FLT_MAX, FLT_MAX, "", "Coordinates to fit in", -FLT_MAX, FLT_MAX); RNA_def_parameter_flags(parm, PROP_NEVER_NULL | PROP_DYNAMIC, PARM_REQUIRED); parm = RNA_def_property(func, "co_return", PROP_FLOAT, PROP_XYZ); RNA_def_property_array(parm, 3); RNA_def_property_ui_text(parm, "", "The location to aim to be able to see all given points"); RNA_def_parameter_flags(parm, 0, PARM_OUTPUT); parm = RNA_def_property(func, "scale_return", PROP_FLOAT, PROP_NONE); RNA_def_property_ui_text(parm, "", "The ortho scale to aim to be able to see all given points (if relevant)"); RNA_def_parameter_flags(parm, 0, PARM_OUTPUT); /* mesh */ func = RNA_def_function(srna, "to_mesh", "rna_Object_to_mesh"); RNA_def_function_ui_description(func, "Create a Mesh data-block with modifiers applied"); RNA_def_function_flag(func, FUNC_USE_REPORTS); parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene within which to evaluate modifiers"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); parm = RNA_def_boolean(func, "apply_modifiers", 0, "", "Apply modifiers"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); RNA_def_boolean(func, "calc_tessface", true, "Calculate Tessellation", "Calculate tessellation faces"); RNA_def_boolean(func, "calc_undeformed", false, "Calculate Undeformed", "Calculate undeformed vertex coordinates"); parm = RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh created from object, remove it if it is only used for export"); RNA_def_function_return(func, parm); /* duplis */ func = RNA_def_function(srna, "dupli_list_create", "rna_Object_create_duplilist"); RNA_def_function_ui_description(func, "Create a list of dupli objects for this object, needs to " "be freed manually with free_dupli_list to restore the " "objects real matrix and layers"); parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene within which to evaluate duplis"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); RNA_def_enum(func, "settings", dupli_eval_mode_items, 0, "", "Generate texture coordinates for rendering"); RNA_def_function_flag(func, FUNC_USE_REPORTS); func = RNA_def_function(srna, "dupli_list_clear", "rna_Object_free_duplilist"); RNA_def_function_ui_description(func, "Free the list of dupli objects"); /* Armature */ func = RNA_def_function(srna, "find_armature", "modifiers_isDeformedByArmature"); RNA_def_function_ui_description(func, "Find armature influencing this object as a parent or via a modifier"); parm = RNA_def_pointer(func, "ob_arm", "Object", "", "Armature object influencing this object or NULL"); RNA_def_function_return(func, parm); /* Shape key */ func = RNA_def_function(srna, "shape_key_add", "rna_Object_shape_key_add"); RNA_def_function_ui_description(func, "Add shape key to this object"); RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); RNA_def_string(func, "name", "Key", 0, "", "Unique name for the new keyblock"); /* optional */ RNA_def_boolean(func, "from_mix", 1, "", "Create new shape from existing mix of shapes"); parm = RNA_def_pointer(func, "key", "ShapeKey", "", "New shape keyblock"); RNA_def_parameter_flags(parm, 0, PARM_RNAPTR); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "shape_key_remove", "rna_Object_shape_key_remove"); RNA_def_function_ui_description(func, "Remove a Shape Key from this object"); RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS); parm = RNA_def_pointer(func, "key", "ShapeKey", "", "Keyblock to be removed"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); /* Ray Cast */ func = RNA_def_function(srna, "ray_cast", "rna_Object_ray_cast"); RNA_def_function_ui_description(func, "Cast a ray onto in object space"); RNA_def_function_flag(func, FUNC_USE_REPORTS); /* ray start and end */ parm = RNA_def_float_vector(func, "origin", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_float_vector(func, "direction", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); RNA_def_float(func, "distance", BVH_RAYCAST_DIST_MAX, 0.0, BVH_RAYCAST_DIST_MAX, "", "Maximum distance", 0.0, BVH_RAYCAST_DIST_MAX); /* return location and normal */ parm = RNA_def_boolean(func, "result", 0, "", ""); RNA_def_function_output(func, parm); parm = RNA_def_float_vector(func, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "The hit location of this ray cast", -1e4, 1e4); RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); RNA_def_function_output(func, parm); parm = RNA_def_float_vector(func, "normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal", "The face normal at the ray cast hit location", -1e4, 1e4); RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); RNA_def_function_output(func, parm); parm = RNA_def_int(func, "index", 0, 0, 0, "", "The face index, -1 when original data isn't available", 0, 0); RNA_def_function_output(func, parm); /* Nearest Point */ func = RNA_def_function(srna, "closest_point_on_mesh", "rna_Object_closest_point_on_mesh"); RNA_def_function_ui_description(func, "Find the nearest point in object space"); RNA_def_function_flag(func, FUNC_USE_REPORTS); /* location of point for test and max distance */ parm = RNA_def_float_vector(func, "origin", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); /* default is sqrt(FLT_MAX) */ RNA_def_float(func, "distance", 1.844674352395373e+19, 0.0, FLT_MAX, "", "Maximum distance", 0.0, FLT_MAX); /* return location and normal */ parm = RNA_def_boolean(func, "result", 0, "", ""); RNA_def_function_output(func, parm); parm = RNA_def_float_vector(func, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "The location on the object closest to the point", -1e4, 1e4); RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); RNA_def_function_output(func, parm); parm = RNA_def_float_vector(func, "normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal", "The face normal at the closest point", -1e4, 1e4); RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); RNA_def_function_output(func, parm); parm = RNA_def_int(func, "index", 0, 0, 0, "", "The face index, -1 when original data isn't available", 0, 0); RNA_def_function_output(func, parm); /* View */ func = RNA_def_function(srna, "is_visible", "rna_Object_is_visible"); RNA_def_function_ui_description(func, "Determine if object is visible in a given scene"); parm = RNA_def_pointer(func, "scene", "Scene", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); parm = RNA_def_boolean(func, "result", 0, "", "Object visibility"); RNA_def_function_return(func, parm); /* utility function for checking if the object is modified */ func = RNA_def_function(srna, "is_modified", "rna_Object_is_modified"); RNA_def_function_ui_description(func, "Determine if this object is modified from the base mesh data"); parm = RNA_def_pointer(func, "scene", "Scene", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_boolean(func, "result", 0, "", "Object visibility"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "is_deform_modified", "rna_Object_is_deform_modified"); RNA_def_function_ui_description(func, "Determine if this object is modified by a deformation from the base mesh data"); parm = RNA_def_pointer(func, "scene", "Scene", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_boolean(func, "result", 0, "", "Object visibility"); RNA_def_function_return(func, parm); #ifndef NDEBUG /* mesh */ func = RNA_def_function(srna, "dm_info", "rna_Object_dm_info"); RNA_def_function_ui_description(func, "Returns a string for derived mesh data"); parm = RNA_def_enum(func, "type", mesh_dm_info_items, 0, "", "Modifier settings to apply"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); /* weak!, no way to return dynamic string type */ parm = RNA_def_string(func, "result", NULL, 16384, "result", ""); RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); /* needed for string return value */ RNA_def_function_output(func, parm); #endif /* NDEBUG */ func = RNA_def_function(srna, "update_from_editmode", "rna_Object_update_from_editmode"); RNA_def_function_ui_description(func, "Load the objects edit-mode data into the object data"); parm = RNA_def_boolean(func, "result", 0, "", "Success"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "cache_release", "BKE_object_free_caches"); RNA_def_function_ui_description(func, "Release memory used by caches associated with this object. Intended to be used by render engines only"); }
void RNA_api_object(StructRNA *srna) { FunctionRNA *func; PropertyRNA *parm; static const EnumPropertyItem mesh_type_items[] = { {eModifierMode_Realtime, "PREVIEW", 0, "Preview", "Apply modifier preview settings"}, {eModifierMode_Render, "RENDER", 0, "Render", "Apply modifier render settings"}, {0, NULL, 0, NULL, NULL}, }; # ifndef NDEBUG static const EnumPropertyItem mesh_dm_info_items[] = { {0, "SOURCE", 0, "Source", "Source mesh"}, {1, "DEFORM", 0, "Deform", "Objects deform mesh"}, {2, "FINAL", 0, "Final", "Objects final mesh"}, {0, NULL, 0, NULL, NULL}, }; # endif /* Special wrapper to access the base selection value */ func = RNA_def_function(srna, "select_get", "rna_Object_select_get"); RNA_def_function_ui_description( func, "Test if the object is selected. The selection state is per view layer"); RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); parm = RNA_def_pointer( func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer"); parm = RNA_def_boolean(func, "result", 0, "", "Object selected"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "select_set", "rna_Object_select_set"); RNA_def_function_ui_description( func, "Select or deselect the object. The selection state is per view layer"); RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); parm = RNA_def_boolean(func, "state", 0, "", "Selection state to define"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_pointer( func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer"); func = RNA_def_function(srna, "hide_get", "rna_Object_hide_get"); RNA_def_function_ui_description( func, "Test if the object is hidden for viewport editing. This hiding state is per view layer"); RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); parm = RNA_def_pointer( func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer"); parm = RNA_def_boolean(func, "result", 0, "", "Object hideed"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "hide_set", "rna_Object_hide_set"); RNA_def_function_ui_description( func, "Hide the object for viewport editing. This hiding state is per view layer"); RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); parm = RNA_def_boolean(func, "state", 0, "", "Hide state to define"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_pointer( func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer"); func = RNA_def_function(srna, "visible_get", "rna_Object_visible_get"); RNA_def_function_ui_description(func, "Test if the object is visible in the 3D viewport, taking into " "account all visibility settings"); RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); parm = RNA_def_pointer( func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer"); parm = RNA_def_pointer( func, "viewport", "SpaceView3D", "", "Use this instead of the active 3D viewport"); parm = RNA_def_boolean(func, "result", 0, "", "Object visible"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "holdout_get", "rna_Object_holdout_get"); RNA_def_function_ui_description(func, "Test if object is masked in the view layer"); RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); parm = RNA_def_pointer( func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer"); parm = RNA_def_boolean(func, "result", 0, "", "Object holdout"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "indirect_only_get", "rna_Object_indirect_only_get"); RNA_def_function_ui_description(func, "Test if object is set to contribute only indirectly (through " "shadows and reflections) in the view layer"); RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); parm = RNA_def_pointer( func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer"); parm = RNA_def_boolean(func, "result", 0, "", "Object indirect only"); RNA_def_function_return(func, parm); /* Local View */ func = RNA_def_function(srna, "local_view_get", "rna_Object_local_view_get"); RNA_def_function_ui_description(func, "Get the local view state for this object"); RNA_def_function_flag(func, FUNC_USE_REPORTS); parm = RNA_def_pointer(func, "viewport", "SpaceView3D", "", "Viewport in local view"); RNA_def_parameter_flags(parm, 0, PARM_RNAPTR | PARM_REQUIRED); parm = RNA_def_boolean(func, "result", 0, "", "Object local view state"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "local_view_set", "rna_Object_local_view_set"); RNA_def_function_ui_description(func, "Set the local view state for this object"); RNA_def_function_flag(func, FUNC_USE_REPORTS); parm = RNA_def_pointer(func, "viewport", "SpaceView3D", "", "Viewport in local view"); RNA_def_parameter_flags(parm, 0, PARM_RNAPTR | PARM_REQUIRED); parm = RNA_def_boolean(func, "state", 0, "", "Local view state to define"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); /* Matrix space conversion */ func = RNA_def_function(srna, "convert_space", "rna_Object_mat_convert_space"); RNA_def_function_ui_description( func, "Convert (transform) the given matrix from one space to another"); RNA_def_function_flag(func, FUNC_USE_REPORTS); parm = RNA_def_pointer( func, "pose_bone", "PoseBone", "", "Bone to use to define spaces (may be None, in which case only the two 'WORLD' and " "'LOCAL' spaces are usable)"); parm = RNA_def_property(func, "matrix", PROP_FLOAT, PROP_MATRIX); RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4); RNA_def_property_ui_text(parm, "", "The matrix to transform"); parm = RNA_def_property(func, "matrix_return", PROP_FLOAT, PROP_MATRIX); RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4); RNA_def_property_ui_text(parm, "", "The transformed matrix"); RNA_def_function_output(func, parm); parm = RNA_def_enum(func, "from_space", space_items, CONSTRAINT_SPACE_WORLD, "", "The space in which 'matrix' is currently"); parm = RNA_def_enum(func, "to_space", space_items, CONSTRAINT_SPACE_WORLD, "", "The space to which you want to transform 'matrix'"); /* Camera-related operations */ func = RNA_def_function(srna, "calc_matrix_camera", "rna_Object_calc_matrix_camera"); RNA_def_function_ui_description(func, "Generate the camera projection matrix of this object " "(mostly useful for Camera and Light types)"); parm = RNA_def_pointer( func, "depsgraph", "Depsgraph", "", "Depsgraph to get evaluated data from"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_property(func, "result", PROP_FLOAT, PROP_MATRIX); RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4); RNA_def_property_ui_text(parm, "", "The camera projection matrix"); RNA_def_function_output(func, parm); parm = RNA_def_int(func, "x", 1, 0, INT_MAX, "", "Width of the render area", 0, 10000); parm = RNA_def_int(func, "y", 1, 0, INT_MAX, "", "Height of the render area", 0, 10000); parm = RNA_def_float( func, "scale_x", 1.0f, 1.0e-6f, FLT_MAX, "", "Width scaling factor", 1.0e-2f, 100.0f); parm = RNA_def_float( func, "scale_y", 1.0f, 1.0e-6f, FLT_MAX, "", "Height scaling factor", 1.0e-2f, 100.0f); func = RNA_def_function(srna, "camera_fit_coords", "rna_Object_camera_fit_coords"); RNA_def_function_ui_description(func, "Compute the coordinate (and scale for ortho cameras) " "given object should be to 'see' all given coordinates"); parm = RNA_def_pointer( func, "depsgraph", "Depsgraph", "", "Depsgraph to get evaluated data from"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_float_array(func, "coordinates", 1, NULL, -FLT_MAX, FLT_MAX, "", "Coordinates to fit in", -FLT_MAX, FLT_MAX); RNA_def_parameter_flags(parm, PROP_NEVER_NULL | PROP_DYNAMIC, PARM_REQUIRED); parm = RNA_def_property(func, "co_return", PROP_FLOAT, PROP_XYZ); RNA_def_property_array(parm, 3); RNA_def_property_ui_text(parm, "", "The location to aim to be able to see all given points"); RNA_def_parameter_flags(parm, 0, PARM_OUTPUT); parm = RNA_def_property(func, "scale_return", PROP_FLOAT, PROP_NONE); RNA_def_property_ui_text( parm, "", "The ortho scale to aim to be able to see all given points (if relevant)"); RNA_def_parameter_flags(parm, 0, PARM_OUTPUT); /* mesh */ func = RNA_def_function(srna, "to_mesh", "rna_Object_to_mesh"); RNA_def_function_ui_description( func, "Create a Mesh data-block from the current state of the object. The object owns the " "data-block. To force free it use to_mesh_clear(). " "The result is temporary and can not be used by objects from the main database"); RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_boolean(func, "preserve_all_data_layers", false, "", "Preserve all data layers in the mesh, like UV maps and vertex groups. " "By default Blender only computes the subset of data layers needed for viewport " "display and rendering, for better performance"); RNA_def_pointer( func, "depsgraph", "Depsgraph", "Dependency Graph", "Evaluated dependency graph which is required when preserve_all_data_layers is true"); parm = RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh created from object"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "to_mesh_clear", "rna_Object_to_mesh_clear"); RNA_def_function_ui_description(func, "Clears mesh data-block created by to_mesh()"); /* Armature */ func = RNA_def_function(srna, "find_armature", "modifiers_isDeformedByArmature"); RNA_def_function_ui_description( func, "Find armature influencing this object as a parent or via a modifier"); parm = RNA_def_pointer( func, "ob_arm", "Object", "", "Armature object influencing this object or NULL"); RNA_def_function_return(func, parm); /* Shape key */ func = RNA_def_function(srna, "shape_key_add", "rna_Object_shape_key_add"); RNA_def_function_ui_description(func, "Add shape key to this object"); RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); RNA_def_string(func, "name", "Key", 0, "", "Unique name for the new keyblock"); /* optional */ RNA_def_boolean(func, "from_mix", 1, "", "Create new shape from existing mix of shapes"); parm = RNA_def_pointer(func, "key", "ShapeKey", "", "New shape keyblock"); RNA_def_parameter_flags(parm, 0, PARM_RNAPTR); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "shape_key_remove", "rna_Object_shape_key_remove"); RNA_def_function_ui_description(func, "Remove a Shape Key from this object"); RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS); parm = RNA_def_pointer(func, "key", "ShapeKey", "", "Keyblock to be removed"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); func = RNA_def_function(srna, "shape_key_clear", "rna_Object_shape_key_clear"); RNA_def_function_ui_description(func, "Remove all Shape Keys from this object"); RNA_def_function_flag(func, FUNC_USE_MAIN); /* Ray Cast */ func = RNA_def_function(srna, "ray_cast", "rna_Object_ray_cast"); RNA_def_function_ui_description( func, "Cast a ray onto evaluated geometry, in object space " "(using context's or provided depsgraph to get evaluated mesh if needed)"); RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); /* ray start and end */ parm = RNA_def_float_vector(func, "origin", 3, NULL, -FLT_MAX, FLT_MAX, "", "Origin of the ray, in object space", -1e4, 1e4); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_float_vector(func, "direction", 3, NULL, -FLT_MAX, FLT_MAX, "", "Direction of the ray, in object space", -1e4, 1e4); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); RNA_def_float(func, "distance", BVH_RAYCAST_DIST_MAX, 0.0, BVH_RAYCAST_DIST_MAX, "", "Maximum distance", 0.0, BVH_RAYCAST_DIST_MAX); parm = RNA_def_pointer( func, "depsgraph", "Depsgraph", "", "Depsgraph to use to get evaluated data, when called from original object " "(only needed if current Context's depsgraph is not suitable)"); RNA_def_parameter_flags(parm, 0, PARM_RNAPTR); /* return location and normal */ parm = RNA_def_boolean(func, "result", 0, "", "Wheter the ray successfully hit the geometry"); RNA_def_function_output(func, parm); parm = RNA_def_float_vector(func, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "The hit location of this ray cast", -1e4, 1e4); RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); RNA_def_function_output(func, parm); parm = RNA_def_float_vector(func, "normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal", "The face normal at the ray cast hit location", -1e4, 1e4); RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); RNA_def_function_output(func, parm); parm = RNA_def_int( func, "index", 0, 0, 0, "", "The face index, -1 when original data isn't available", 0, 0); RNA_def_function_output(func, parm); /* Nearest Point */ func = RNA_def_function(srna, "closest_point_on_mesh", "rna_Object_closest_point_on_mesh"); RNA_def_function_ui_description( func, "Find the nearest point on evaluated geometry, in object space " "(using context's or provided depsgraph to get evaluated mesh if needed)"); RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); /* location of point for test and max distance */ parm = RNA_def_float_vector(func, "origin", 3, NULL, -FLT_MAX, FLT_MAX, "", "Point to find closest geometry from (in object space)", -1e4, 1e4); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); /* default is sqrt(FLT_MAX) */ RNA_def_float( func, "distance", 1.844674352395373e+19, 0.0, FLT_MAX, "", "Maximum distance", 0.0, FLT_MAX); parm = RNA_def_pointer( func, "depsgraph", "Depsgraph", "", "Depsgraph to use to get evaluated data, when called from original object " "(only needed if current Context's depsgraph is not suitable)"); RNA_def_parameter_flags(parm, 0, PARM_RNAPTR); /* return location and normal */ parm = RNA_def_boolean(func, "result", 0, "", "Wheter closest point on geometry was found"); RNA_def_function_output(func, parm); parm = RNA_def_float_vector(func, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "The location on the object closest to the point", -1e4, 1e4); RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); RNA_def_function_output(func, parm); parm = RNA_def_float_vector(func, "normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal", "The face normal at the closest point", -1e4, 1e4); RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); RNA_def_function_output(func, parm); parm = RNA_def_int( func, "index", 0, 0, 0, "", "The face index, -1 when original data isn't available", 0, 0); RNA_def_function_output(func, parm); /* View */ /* utility function for checking if the object is modified */ func = RNA_def_function(srna, "is_modified", "rna_Object_is_modified"); RNA_def_function_ui_description(func, "Determine if this object is modified from the base mesh data"); parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene in which to check the object"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_boolean(func, "result", 0, "", "Whether the object is modified"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "is_deform_modified", "rna_Object_is_deform_modified"); RNA_def_function_ui_description( func, "Determine if this object is modified by a deformation from the base mesh data"); parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene in which to check the object"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_boolean(func, "result", 0, "", "Whether the object is deform-modified"); RNA_def_function_return(func, parm); # ifndef NDEBUG /* mesh */ func = RNA_def_function(srna, "dm_info", "rna_Object_me_eval_info"); RNA_def_function_ui_description( func, "Returns a string for original/evaluated mesh data (debug builds only, " "using context's or provided depsgraph to get evaluated mesh if needed)"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); parm = RNA_def_enum(func, "type", mesh_dm_info_items, 0, "", "Modifier settings to apply"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_pointer( func, "depsgraph", "Depsgraph", "", "Depsgraph to use to get evaluated data, when called from original object " "(only needed if current Context's depsgraph is not suitable)"); RNA_def_parameter_flags(parm, 0, PARM_RNAPTR); /* weak!, no way to return dynamic string type */ parm = RNA_def_string(func, "result", NULL, 16384, "", "Requested informations"); RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); /* needed for string return value */ RNA_def_function_output(func, parm); # endif /* NDEBUG */ func = RNA_def_function(srna, "update_from_editmode", "rna_Object_update_from_editmode"); RNA_def_function_ui_description(func, "Load the objects edit-mode data into the object data"); RNA_def_function_flag(func, FUNC_USE_MAIN); parm = RNA_def_boolean(func, "result", 0, "", "Success"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "cache_release", "BKE_object_free_caches"); RNA_def_function_ui_description(func, "Release memory used by caches associated with this object. " "Intended to be used by render engines only"); }
void RNA_api_ui_layout(StructRNA *srna) { FunctionRNA *func; PropertyRNA *parm; static EnumPropertyItem curve_type_items[] = { {0, "NONE", 0, "None", ""}, {'v', "VECTOR", 0, "Vector", ""}, {'c', "COLOR", 0, "Color", ""}, {0, NULL, 0, NULL, NULL} }; static EnumPropertyItem list_type_items[] = { {0, "DEFAULT", 0, "None", ""}, {'c', "COMPACT", 0, "Compact", ""}, {'i', "ICONS", 0, "Icons", ""}, {0, NULL, 0, NULL, NULL} }; /* simple layout specifiers */ func = RNA_def_function(srna, "row", "uiLayoutRow"); parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in"); RNA_def_function_return(func, parm); RNA_def_function_ui_description(func, "Sub-layout. Items placed in this sublayout are placed next to each other " "in a row"); RNA_def_boolean(func, "align", 0, "", "Align buttons to each other"); func = RNA_def_function(srna, "column", "uiLayoutColumn"); parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in"); RNA_def_function_return(func, parm); RNA_def_function_ui_description(func, "Sub-layout. Items placed in this sublayout are placed under each other " "in a column"); RNA_def_boolean(func, "align", 0, "", "Align buttons to each other"); func = RNA_def_function(srna, "column_flow", "uiLayoutColumnFlow"); RNA_def_int(func, "columns", 0, 0, INT_MAX, "", "Number of columns, 0 is automatic", 0, INT_MAX); parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in"); RNA_def_function_return(func, parm); RNA_def_boolean(func, "align", 0, "", "Align buttons to each other"); /* box layout */ func = RNA_def_function(srna, "box", "uiLayoutBox"); parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in"); RNA_def_function_return(func, parm); RNA_def_function_ui_description(func, "Sublayout (items placed in this sublayout are placed " "under each other in a column and are surrounded by a box)"); /* split layout */ func = RNA_def_function(srna, "split", "uiLayoutSplit"); parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in"); RNA_def_function_return(func, parm); RNA_def_float(func, "percentage", 0.0f, 0.0f, 1.0f, "Percentage", "Percentage of width to split at", 0.0f, 1.0f); RNA_def_boolean(func, "align", 0, "", "Align buttons to each other"); /* items */ func = RNA_def_function(srna, "prop", "rna_uiItemR"); RNA_def_function_ui_description(func, "Item. Exposes an RNA item and places it into the layout"); api_ui_item_rna_common(func); api_ui_item_common(func); RNA_def_boolean(func, "expand", 0, "", "Expand button to show more detail"); RNA_def_boolean(func, "slider", 0, "", "Use slider widget for numeric values"); RNA_def_boolean(func, "toggle", 0, "", "Use toggle widget for boolean values"); RNA_def_boolean(func, "icon_only", 0, "", "Draw only icons in buttons, no text"); RNA_def_boolean(func, "event", 0, "", "Use button to input key events"); RNA_def_boolean(func, "full_event", 0, "", "Use button to input full events including modifiers"); RNA_def_boolean(func, "emboss", 1, "", "Draw the button itself, just the icon/text"); RNA_def_int(func, "index", -1, -2, INT_MAX, "", "The index of this button, when set a single member of an array can be accessed, " "when set to -1 all array members are used", -2, INT_MAX); /* RNA_NO_INDEX == -1 */ func = RNA_def_function(srna, "props_enum", "uiItemsEnumR"); api_ui_item_rna_common(func); func = RNA_def_function(srna, "prop_menu_enum", "uiItemMenuEnumR"); api_ui_item_rna_common(func); api_ui_item_common(func); func = RNA_def_function(srna, "prop_enum", "uiItemEnumR_string"); api_ui_item_rna_common(func); parm = RNA_def_string(func, "value", "", 0, "", "Enum property value"); RNA_def_property_flag(parm, PROP_REQUIRED); api_ui_item_common(func); func = RNA_def_function(srna, "prop_search", "uiItemPointerR"); api_ui_item_rna_common(func); parm = RNA_def_pointer(func, "search_data", "AnyType", "", "Data from which to take collection to search in"); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL); parm = RNA_def_string(func, "search_property", "", 0, "", "Identifier of search collection property"); RNA_def_property_flag(parm, PROP_REQUIRED); api_ui_item_common(func); func = RNA_def_function(srna, "operator", "rna_uiItemO"); api_ui_item_op_common(func); RNA_def_boolean(func, "emboss", 1, "", "Draw the button itself, just the icon/text"); parm = RNA_def_pointer(func, "properties", "OperatorProperties", "", "Operator properties to fill in, return when 'properties' is set to true"); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR); RNA_def_function_return(func, parm); RNA_def_function_ui_description(func, "Item. Places a button into the layout to call an Operator"); /* func= RNA_def_function(srna, "operator_enum_single", "uiItemEnumO_string"); api_ui_item_op_common(func); parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator"); RNA_def_property_flag(parm, PROP_REQUIRED); parm= RNA_def_string(func, "value", "", 0, "", "Enum property value"); RNA_def_property_flag(parm, PROP_REQUIRED); */ func = RNA_def_function(srna, "operator_enum", "uiItemsEnumO"); parm = RNA_def_string(func, "operator", "", 0, "", "Identifier of the operator"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator"); RNA_def_property_flag(parm, PROP_REQUIRED); func = RNA_def_function(srna, "operator_menu_enum", "uiItemMenuEnumO"); api_ui_item_op(func); /* cant use api_ui_item_op_common because property must come right after */ parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator"); RNA_def_property_flag(parm, PROP_REQUIRED); api_ui_item_common(func); /* func= RNA_def_function(srna, "operator_boolean", "uiItemBooleanO"); api_ui_item_op_common(func); parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator"); RNA_def_property_flag(parm, PROP_REQUIRED); parm= RNA_def_boolean(func, "value", 0, "", "Value of the property to call the operator with"); RNA_def_property_flag(parm, PROP_REQUIRED); */ /* func= RNA_def_function(srna, "operator_int", "uiItemIntO"); api_ui_item_op_common(func); parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator"); RNA_def_property_flag(parm, PROP_REQUIRED); parm= RNA_def_int(func, "value", 0, INT_MIN, INT_MAX, "", "Value of the property to call the operator with", INT_MIN, INT_MAX); RNA_def_property_flag(parm, PROP_REQUIRED); */ /* func= RNA_def_function(srna, "operator_float", "uiItemFloatO"); api_ui_item_op_common(func); parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator"); RNA_def_property_flag(parm, PROP_REQUIRED); parm= RNA_def_float(func, "value", 0, -FLT_MAX, FLT_MAX, "", "Value of the property to call the operator with", -FLT_MAX, FLT_MAX); RNA_def_property_flag(parm, PROP_REQUIRED); */ /* func= RNA_def_function(srna, "operator_string", "uiItemStringO"); api_ui_item_op_common(func); parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator"); RNA_def_property_flag(parm, PROP_REQUIRED); parm= RNA_def_string(func, "value", "", 0, "", "Value of the property to call the operator with"); RNA_def_property_flag(parm, PROP_REQUIRED); */ func = RNA_def_function(srna, "label", "uiItemL"); RNA_def_function_ui_description(func, "Item. Display text in the layout"); api_ui_item_common(func); func = RNA_def_function(srna, "menu", "uiItemM"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); parm = RNA_def_string(func, "menu", "", 0, "", "Identifier of the menu"); api_ui_item_common(func); RNA_def_property_flag(parm, PROP_REQUIRED); func = RNA_def_function(srna, "separator", "uiItemS"); RNA_def_function_ui_description(func, "Item. Inserts empty space into the layout between items"); /* context */ func = RNA_def_function(srna, "context_pointer_set", "uiLayoutSetContextPointer"); parm = RNA_def_string(func, "name", "", 0, "Name", "Name of entry in the context"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "data", "AnyType", "", "Pointer to put in context"); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR); /* templates */ func = RNA_def_function(srna, "template_header", "uiTemplateHeader"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); RNA_def_boolean(func, "menus", 1, "", "The header has menus, and should show menu expander"); func = RNA_def_function(srna, "template_ID", "uiTemplateID"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); api_ui_item_rna_common(func); RNA_def_string(func, "new", "", 0, "", "Operator identifier to create a new ID block"); RNA_def_string(func, "open", "", 0, "", "Operator identifier to open a file for creating a new ID block"); RNA_def_string(func, "unlink", "", 0, "", "Operator identifier to unlink the ID block"); func = RNA_def_function(srna, "template_ID_preview", "uiTemplateIDPreview"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); api_ui_item_rna_common(func); RNA_def_string(func, "new", "", 0, "", "Operator identifier to create a new ID block"); RNA_def_string(func, "open", "", 0, "", "Operator identifier to open a file for creating a new ID block"); RNA_def_string(func, "unlink", "", 0, "", "Operator identifier to unlink the ID block"); RNA_def_int(func, "rows", 0, 0, INT_MAX, "Number of thumbnail preview rows to display", "", 0, INT_MAX); RNA_def_int(func, "cols", 0, 0, INT_MAX, "Number of thumbnail preview columns to display", "", 0, INT_MAX); func = RNA_def_function(srna, "template_any_ID", "uiTemplateAnyID"); parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property"); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL); parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in data"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_string(func, "type_property", "", 0, "", "Identifier of property in data giving the type of the ID-blocks to use"); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_string_translate(func, "text", "", 0, "", "Custom label to display in UI"); func = RNA_def_function(srna, "template_path_builder", "uiTemplatePathBuilder"); parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property"); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL); parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in data"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "root", "ID", "", "ID-block from which path is evaluated from"); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR); RNA_def_string_translate(func, "text", "", 0, "", "Custom label to display in UI"); func = RNA_def_function(srna, "template_modifier", "uiTemplateModifier"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); RNA_def_function_ui_description(func, "Layout . Generates the UI layout for modifiers"); parm = RNA_def_pointer(func, "data", "Modifier", "", "Modifier data"); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL); parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "template_constraint", "uiTemplateConstraint"); RNA_def_function_ui_description(func, "Layout . Generates the UI layout for constraints"); parm = RNA_def_pointer(func, "data", "Constraint", "", "Constraint data"); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL); parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "template_preview", "uiTemplatePreview"); RNA_def_function_ui_description(func, "Item. A preview window for materials, textures, lamps, etc"); parm = RNA_def_pointer(func, "id", "ID", "", "ID datablock"); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_boolean(func, "show_buttons", 1, "", "Show preview buttons?"); RNA_def_pointer(func, "parent", "ID", "", "ID datablock"); RNA_def_pointer(func, "slot", "TextureSlot", "", "Texture slot"); func = RNA_def_function(srna, "template_curve_mapping", "uiTemplateCurveMapping"); RNA_def_function_ui_description(func, "Item. A curve mapping widget used for e.g falloff curves for lamps"); api_ui_item_rna_common(func); RNA_def_enum(func, "type", curve_type_items, 0, "Type", "Type of curves to display"); RNA_def_boolean(func, "levels", 0, "", "Show black/white levels"); RNA_def_boolean(func, "brush", 0, "", "Show brush options"); func = RNA_def_function(srna, "template_color_ramp", "uiTemplateColorRamp"); RNA_def_function_ui_description(func, "Item. A color ramp widget"); api_ui_item_rna_common(func); RNA_def_boolean(func, "expand", 0, "", "Expand button to show more detail"); func = RNA_def_function(srna, "template_histogram", "uiTemplateHistogram"); RNA_def_function_ui_description(func, "Item. A histogramm widget to analyze imaga data"); api_ui_item_rna_common(func); func = RNA_def_function(srna, "template_waveform", "uiTemplateWaveform"); RNA_def_function_ui_description(func, "Item. A waveform widget to analyze imaga data"); api_ui_item_rna_common(func); func = RNA_def_function(srna, "template_vectorscope", "uiTemplateVectorscope"); RNA_def_function_ui_description(func, "Item. A vectorscope widget to analyze imaga data"); api_ui_item_rna_common(func); func = RNA_def_function(srna, "template_layers", "uiTemplateLayers"); api_ui_item_rna_common(func); parm = RNA_def_pointer(func, "used_layers_data", "AnyType", "", "Data from which to take property"); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR); parm = RNA_def_string(func, "used_layers_property", "", 0, "", "Identifier of property in data"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_int(func, "active_layer", 0, 0, INT_MAX, "Active Layer", "", 0, INT_MAX); RNA_def_property_flag(parm, PROP_REQUIRED); func = RNA_def_function(srna, "template_color_wheel", "uiTemplateColorWheel"); RNA_def_function_ui_description(func, "Item. A color wheel widget to pick colors"); api_ui_item_rna_common(func); RNA_def_boolean(func, "value_slider", 0, "", "Display the value slider to the right of the color wheel"); RNA_def_boolean(func, "lock", 0, "", "Lock the color wheel display to value 1.0 regardless of actual color"); RNA_def_boolean(func, "lock_luminosity", 0, "", "Keep the color at its original vector length"); RNA_def_boolean(func, "cubic", 1, "", "Cubic saturation for picking values close to white"); func = RNA_def_function(srna, "template_image_layers", "uiTemplateImageLayers"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); parm = RNA_def_pointer(func, "image", "Image", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "image_user", "ImageUser", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED); func = RNA_def_function(srna, "template_image", "uiTemplateImage"); RNA_def_function_ui_description(func, "Item(s). User interface for selecting images and their source paths"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); api_ui_item_rna_common(func); parm = RNA_def_pointer(func, "image_user", "ImageUser", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL); RNA_def_boolean(func, "compact", 0, "", "Use more compact layout"); func = RNA_def_function(srna, "template_image_settings", "uiTemplateImageSettings"); RNA_def_function_ui_description(func, "User interface for setting image format options"); parm = RNA_def_pointer(func, "image_settings", "ImageFormatSettings", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL); func = RNA_def_function(srna, "template_movieclip", "uiTemplateMovieClip"); RNA_def_function_ui_description(func, "Item(s). User interface for selecting movie clips and their source paths"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); api_ui_item_rna_common(func); RNA_def_boolean(func, "compact", 0, "", "Use more compact layout"); func = RNA_def_function(srna, "template_track", "uiTemplateTrack"); RNA_def_function_ui_description(func, "Item. A movie-track widget to preview tracking image."); api_ui_item_rna_common(func); func = RNA_def_function(srna, "template_marker", "uiTemplateMarker"); RNA_def_function_ui_description(func, "Item. A widget to control single marker settings."); api_ui_item_rna_common(func); parm = RNA_def_pointer(func, "clip_user", "MovieClipUser", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL); parm = RNA_def_pointer(func, "track", "MovieTrackingTrack", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL); RNA_def_boolean(func, "compact", 0, "", "Use more compact layout"); func = RNA_def_function(srna, "template_list", "uiTemplateList"); RNA_def_function_ui_description(func, "Item. A list widget to display data. e.g. vertexgroups"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property"); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR); parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in data"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "active_data", "AnyType", "", "Data from which to take property for the active element"); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL); parm = RNA_def_string(func, "active_property", "", 0, "", "Identifier of property in data, for the active element"); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_string(func, "prop_list", "", 0, "", "Identifier of a string property in each data member, specifying which " "of its properties should have a widget displayed in its row " "(format: \"propname1:propname2:propname3:...\")"); RNA_def_int(func, "rows", 5, 0, INT_MAX, "", "Number of rows to display", 0, INT_MAX); RNA_def_int(func, "maxrows", 5, 0, INT_MAX, "", "Maximum number of rows to display", 0, INT_MAX); RNA_def_enum(func, "type", list_type_items, 0, "Type", "Type of list to use"); func = RNA_def_function(srna, "template_running_jobs", "uiTemplateRunningJobs"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); RNA_def_function(srna, "template_operator_search", "uiTemplateOperatorSearch"); func = RNA_def_function(srna, "template_header_3D", "uiTemplateHeader3D"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); func = RNA_def_function(srna, "template_edit_mode_selection", "uiTemplateEditModeSelection"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); func = RNA_def_function(srna, "template_reports_banner", "uiTemplateReportsBanner"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); func = RNA_def_function(srna, "template_node_link", "uiTemplateNodeLink"); parm = RNA_def_pointer(func, "ntree", "NodeTree", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "node", "Node", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "socket", "NodeSocket", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED); func = RNA_def_function(srna, "template_node_view", "uiTemplateNodeView"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); parm = RNA_def_pointer(func, "ntree", "NodeTree", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "node", "Node", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "socket", "NodeSocket", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED); func = RNA_def_function(srna, "template_texture_user", "uiTemplateTextureUser"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); func = RNA_def_function(srna, "template_keymap_item_properties", "uiTemplateKeymapItemProperties"); parm = RNA_def_pointer(func, "item", "KeyMapItem", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL); func = RNA_def_function(srna, "introspect", "uiLayoutIntrospect"); parm = RNA_def_string(func, "string", "", 1024*1024, "Descr", "DESCR"); RNA_def_function_return(func, parm); }
static void rna_def_uilist(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; PropertyRNA *parm; FunctionRNA *func; srna = RNA_def_struct(brna, "UIList", NULL); RNA_def_struct_ui_text(srna, "UIList", "UI list containing the elements of a collection"); RNA_def_struct_sdna(srna, "uiList"); RNA_def_struct_refine_func(srna, "rna_UIList_refine"); RNA_def_struct_register_funcs(srna, "rna_UIList_register", "rna_UIList_unregister", NULL); RNA_def_struct_idprops_func(srna, "rna_UIList_idprops"); RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES | STRUCT_PUBLIC_NAMESPACE_INHERIT); /* Registration */ prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->idname"); RNA_def_property_flag(prop, PROP_REGISTER); RNA_def_property_ui_text(prop, "ID Name", "If this is set, the uilist gets a custom ID, otherwise it takes the " "name of the class used to define the uilist (for example, if the " "class name is \"OBJECT_UL_vgroups\", and bl_idname is not set by the " "script, then bl_idname = \"OBJECT_UL_vgroups\")"); /* Data */ prop = RNA_def_property(srna, "layout_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, rna_enum_uilist_layout_type_items); RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* Filter options */ prop = RNA_def_property(srna, "use_filter_show", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "filter_flag", UILST_FLT_SHOW); RNA_def_property_ui_text(prop, "Show Filter", "Show filtering options"); prop = RNA_def_property(srna, "filter_name", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "filter_byname"); RNA_def_property_flag(prop, PROP_TEXTEDIT_UPDATE); RNA_def_property_ui_text(prop, "Filter by Name", "Only show items matching this name (use '*' as wildcard)"); prop = RNA_def_property(srna, "use_filter_invert", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "filter_flag", UILST_FLT_EXCLUDE); RNA_def_property_ui_text(prop, "Invert", "Invert filtering (show hidden items, and vice-versa)"); prop = RNA_def_property(srna, "use_filter_sort_alpha", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "filter_sort_flag", UILST_FLT_SORT_ALPHA); RNA_def_property_ui_icon(prop, ICON_SORTALPHA, 0); RNA_def_property_ui_text(prop, "Sort by Name", "Sort items by their name"); prop = RNA_def_property(srna, "use_filter_sort_reverse", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "filter_sort_flag", UILST_FLT_SORT_REVERSE); RNA_def_property_ui_text(prop, "Invert", "Invert the order of shown items"); /* draw_item */ func = RNA_def_function(srna, "draw_item", NULL); RNA_def_function_ui_description(func, "Draw an item in the list (NOTE: when you define your own draw_item " "function, you may want to check given 'item' is of the right type...)"); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); parm = RNA_def_pointer(func, "context", "Context", "", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_pointer(func, "layout", "UILayout", "", "Layout to draw the item"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take Collection property"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR); parm = RNA_def_pointer(func, "item", "AnyType", "", "Item of the collection property"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR); parm = RNA_def_int(func, "icon", 0, 0, INT_MAX, "", "Icon of the item in the collection", 0, INT_MAX); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_pointer(func, "active_data", "AnyType", "", "Data from which to take property for the active element"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); parm = RNA_def_string(func, "active_property", NULL, 0, "", "Identifier of property in active_data, for the active element"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); RNA_def_int(func, "index", 0, 0, INT_MAX, "", "Index of the item in the collection", 0, INT_MAX); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_PYFUNC_OPTIONAL); prop = RNA_def_property(func, "flt_flag", PROP_INT, PROP_UNSIGNED); RNA_def_property_ui_text(prop, "", "The filter-flag result for this item"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_PYFUNC_OPTIONAL); /* draw_filter */ func = RNA_def_function(srna, "draw_filter", NULL); RNA_def_function_ui_description(func, "Draw filtering options"); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); parm = RNA_def_pointer(func, "context", "Context", "", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_pointer(func, "layout", "UILayout", "", "Layout to draw the item"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); /* filter */ func = RNA_def_function(srna, "filter_items", NULL); RNA_def_function_ui_description(func, "Filter and/or re-order items of the collection (output filter results in " "filter_flags, and reorder results in filter_neworder arrays)"); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); parm = RNA_def_pointer(func, "context", "Context", "", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take Collection property"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR); parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data, for the collection"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); prop = RNA_def_property(func, "filter_flags", PROP_INT, PROP_UNSIGNED); RNA_def_property_flag(prop, PARM_REQUIRED | PROP_DYNAMIC); RNA_def_property_array(prop, 1); /* XXX Dummy value, default 0 does not work */ RNA_def_property_ui_text(prop, "", "An array of filter flags, one for each item in the collection (NOTE: " "FILTER_ITEM bit is reserved, it defines whether the item is shown or not)"); RNA_def_function_output(func, prop); prop = RNA_def_property(func, "filter_neworder", PROP_INT, PROP_UNSIGNED); RNA_def_property_flag(prop, PARM_REQUIRED | PROP_DYNAMIC); RNA_def_property_array(prop, 1); /* XXX Dummy value, default 0 does not work */ RNA_def_property_ui_text(prop, "", "An array of indices, one for each item in the collection, mapping the org " "index to the new one"); RNA_def_function_output(func, prop); /* "Constants"! */ RNA_define_verify_sdna(0); /* not in sdna */ prop = RNA_def_property(srna, "bitflag_filter_item", PROP_INT, PROP_UNSIGNED); RNA_def_property_ui_text(prop, "FILTER_ITEM", "The value of the reserved bitflag 'FILTER_ITEM' (in filter_flags values)"); RNA_def_property_int_funcs(prop, "rna_UIList_filter_const_FILTER_ITEM_get", NULL, NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); }
void RNA_api_mesh(StructRNA *srna) { FunctionRNA *func; PropertyRNA *parm; const int normals_array_dim[] = {1, 3}; func = RNA_def_function(srna, "transform", "rna_Mesh_transform"); RNA_def_function_ui_description(func, "Transform mesh vertices by a matrix " "(Warning: inverts normals if matrix is negative)"); parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_boolean(func, "shape_keys", 0, "", "Transform Shape Keys"); func = RNA_def_function(srna, "flip_normals", "rna_Mesh_flip_normals"); RNA_def_function_ui_description(func, "Invert winding of all polygons " "(clears tessellation, does not handle custom normals)"); func = RNA_def_function(srna, "calc_normals", "BKE_mesh_calc_normals"); RNA_def_function_ui_description(func, "Calculate vertex normals"); func = RNA_def_function(srna, "create_normals_split", "rna_Mesh_create_normals_split"); RNA_def_function_ui_description(func, "Empty split vertex normals"); func = RNA_def_function(srna, "calc_normals_split", "BKE_mesh_calc_normals_split"); RNA_def_function_ui_description(func, "Calculate split vertex normals, which preserve sharp edges"); func = RNA_def_function(srna, "free_normals_split", "rna_Mesh_free_normals_split"); RNA_def_function_ui_description(func, "Free split vertex normals"); func = RNA_def_function(srna, "calc_tangents", "rna_Mesh_calc_tangents"); RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Compute tangents and bitangent signs, to be used together with the split normals " "to get a complete tangent space for normal mapping " "(split normals are also computed if not yet present)"); parm = RNA_def_string(func, "uvmap", NULL, MAX_CUSTOMDATA_LAYER_NAME, "", "Name of the UV map to use for tangent space computation"); func = RNA_def_function(srna, "free_tangents", "rna_Mesh_free_tangents"); RNA_def_function_ui_description(func, "Free tangents"); func = RNA_def_function(srna, "calc_tessface", "rna_Mesh_calc_tessface"); RNA_def_function_ui_description(func, "Calculate face tessellation (supports editmode too)"); RNA_def_boolean(func, "free_mpoly", 0, "Free MPoly", "Free data used by polygons and loops. " "WARNING: This destructive operation removes regular faces, " "only used on temporary mesh data-blocks to reduce memory footprint of render " "engines and export scripts"); func = RNA_def_function(srna, "calc_smooth_groups", "rna_Mesh_calc_smooth_groups"); RNA_def_function_ui_description(func, "Calculate smooth groups from sharp edges"); RNA_def_boolean(func, "use_bitflags", false, "", "Produce bitflags groups instead of simple numeric values"); /* return values */ parm = RNA_def_int_array(func, "poly_groups", 1, NULL, 0, 0, "", "Smooth Groups", 0, 0); RNA_def_property_flag(parm, PROP_DYNAMIC | PROP_OUTPUT); parm = RNA_def_int(func, "groups", 0, 0, INT_MAX, "groups", "Total number of groups", 0, INT_MAX); RNA_def_property_flag(parm, PROP_OUTPUT); func = RNA_def_function(srna, "normals_split_custom_set", "rna_Mesh_normals_split_custom_set"); RNA_def_function_ui_description(func, "Define custom split normals of this mesh " "(use zero-vectors to keep auto ones)"); RNA_def_function_flag(func, FUNC_USE_REPORTS); /* TODO, see how array size of 0 works, this shouldnt be used */ parm = RNA_def_float_array(func, "normals", 1, NULL, -1.0f, 1.0f, "", "Normals", 0.0f, 0.0f); RNA_def_property_multi_array(parm, 2, normals_array_dim); RNA_def_property_flag(parm, PROP_DYNAMIC | PROP_REQUIRED); func = RNA_def_function(srna, "normals_split_custom_set_from_vertices", "rna_Mesh_normals_split_custom_set_from_vertices"); RNA_def_function_ui_description(func, "Define custom split normals of this mesh, from vertices' normals " "(use zero-vectors to keep auto ones)"); RNA_def_function_flag(func, FUNC_USE_REPORTS); /* TODO, see how array size of 0 works, this shouldnt be used */ parm = RNA_def_float_array(func, "normals", 1, NULL, -1.0f, 1.0f, "", "Normals", 0.0f, 0.0f); RNA_def_property_multi_array(parm, 2, normals_array_dim); RNA_def_property_flag(parm, PROP_DYNAMIC | PROP_REQUIRED); func = RNA_def_function(srna, "update", "ED_mesh_update"); RNA_def_boolean(func, "calc_edges", 0, "Calculate Edges", "Force recalculation of edges"); RNA_def_boolean(func, "calc_tessface", 0, "Calculate Tessellation", "Force recalculation of tessellation faces"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); func = RNA_def_function(srna, "unit_test_compare", "rna_Mesh_unit_test_compare"); RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to compare to"); /* return value */ parm = RNA_def_string(func, "result", "nothing", 64, "Return value", "String description of result of comparison"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "validate", "BKE_mesh_validate"); RNA_def_function_ui_description(func, "Validate geometry, return True when the mesh has had " "invalid geometry corrected/removed"); RNA_def_boolean(func, "verbose", false, "Verbose", "Output information about the errors found"); RNA_def_boolean(func, "clean_customdata", true, "Clean Custom Data", "Remove temp/cached custom-data layers, like e.g. normals..."); parm = RNA_def_boolean(func, "result", 0, "Result", ""); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "validate_material_indices", "BKE_mesh_validate_material_indices"); RNA_def_function_ui_description(func, "Validate material indices of polygons, return True when the mesh has had " "invalid indices corrected (to default 0)"); parm = RNA_def_boolean(func, "result", 0, "Result", ""); RNA_def_function_return(func, parm); }
static void api_ui_item_common_text(FunctionRNA *func) { RNA_def_string(func, "text", NULL, 0, "", "Override automatic text of the item"); RNA_def_string(func, "text_ctxt", NULL, 0, "", "Override automatic translation context of the given text"); RNA_def_boolean(func, "translate", true, "", "Translate the given text, when UI translation is enabled"); }