Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_wm_gizmo.c
| Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | |||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| FunctionRNA *func; | FunctionRNA *func; | ||||
| PropertyRNA *parm; | PropertyRNA *parm; | ||||
| RNA_def_property_srna(cprop, "Gizmo"); | RNA_def_property_srna(cprop, "Gizmo"); | ||||
| srna = RNA_def_struct(brna, "Gizmo", NULL); | srna = RNA_def_struct(brna, "Gizmo", NULL); | ||||
| RNA_def_struct_sdna(srna, "wmGizmo"); | RNA_def_struct_sdna(srna, "wmGizmo"); | ||||
| RNA_def_struct_ui_text(srna, "Gizmo", "Collection of gizmos"); | RNA_def_struct_ui_text(srna, "Gizmo", "Interactable gizmo that can be drawn in 2D or 3D editors"); | ||||
| RNA_def_struct_refine_func(srna, "rna_Gizmo_refine"); | RNA_def_struct_refine_func(srna, "rna_Gizmo_refine"); | ||||
| # ifdef WITH_PYTHON | # ifdef WITH_PYTHON | ||||
| RNA_def_struct_register_funcs( | RNA_def_struct_register_funcs( | ||||
| srna, "rna_Gizmo_register", "rna_Gizmo_unregister", "rna_Gizmo_instance"); | srna, "rna_Gizmo_register", "rna_Gizmo_unregister", "rna_Gizmo_instance"); | ||||
| # endif | # endif | ||||
| RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT); | RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT); | ||||
| prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE); | prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_flag(prop, PROP_NEVER_NULL); | RNA_def_property_flag(prop, PROP_NEVER_NULL); | ||||
| RNA_def_property_struct_type(prop, "GizmoProperties"); | RNA_def_property_struct_type(prop, "GizmoProperties"); | ||||
| RNA_def_property_ui_text(prop, "Properties", ""); | RNA_def_property_ui_text(prop, "Properties", ""); | ||||
| RNA_def_property_pointer_funcs(prop, "rna_Gizmo_properties_get", NULL, NULL, NULL); | RNA_def_property_pointer_funcs(prop, "rna_Gizmo_properties_get", NULL, NULL, NULL); | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /* Registerable Variables */ | /* Registerable Variables */ | ||||
| RNA_define_verify_sdna(0); /* not in sdna */ | RNA_define_verify_sdna(0); /* not in sdna */ | ||||
| prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE); | prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE); | ||||
| RNA_def_property_ui_text(prop, | |||||
| "ID Name", | |||||
| "The unique identifier of this Gizmo." | |||||
| "Can be passed to GizmoGroup.gizmos.new() to create an instance of this Gizmo in that GizmoGroup."); | |||||
| RNA_def_property_string_sdna(prop, NULL, "type->idname"); | RNA_def_property_string_sdna(prop, NULL, "type->idname"); | ||||
| RNA_def_property_string_maxlength(prop, MAX_NAME); | RNA_def_property_string_maxlength(prop, MAX_NAME); | ||||
| RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Gizmo_bl_idname_set"); | RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Gizmo_bl_idname_set"); | ||||
| // RNA_def_property_clear_flag(prop, PROP_EDITABLE); | // RNA_def_property_clear_flag(prop, PROP_EDITABLE); | ||||
| RNA_def_property_flag(prop, PROP_REGISTER); | RNA_def_property_flag(prop, PROP_REGISTER); | ||||
| RNA_define_verify_sdna(1); /* not in sdna */ | RNA_define_verify_sdna(1); /* not in sdna */ | ||||
| /* wmGizmo.draw */ | /* wmGizmo.draw */ | ||||
| func = RNA_def_function(srna, "draw", NULL); | func = RNA_def_function(srna, "draw", NULL); | ||||
| RNA_def_function_ui_description(func, ""); | RNA_def_function_ui_description(func, "TODO: When is this called?"); | ||||
| RNA_def_function_flag(func, FUNC_REGISTER); | RNA_def_function_flag(func, FUNC_REGISTER); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| /* wmGizmo.draw_select */ | /* wmGizmo.draw_select */ | ||||
| func = RNA_def_function(srna, "draw_select", NULL); | func = RNA_def_function(srna, "draw_select", NULL); | ||||
| RNA_def_function_ui_description(func, ""); | RNA_def_function_ui_description(func, "TODO: When is this called?"); | ||||
| RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); | RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_int(func, "select_id", 0, 0, INT_MAX, "", "", 0, INT_MAX); | parm = RNA_def_int(func, "select_id", 0, 0, INT_MAX, "", "", 0, INT_MAX); | ||||
| /* wmGizmo.test_select */ | /* wmGizmo.test_select */ | ||||
| func = RNA_def_function(srna, "test_select", NULL); | func = RNA_def_function(srna, "test_select", NULL); | ||||
| RNA_def_function_ui_description(func, ""); | RNA_def_function_ui_description(func, "TODO: When is this called?"); | ||||
| RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); | RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_int_array(func, | parm = RNA_def_int_array(func, | ||||
| "location", | "location", | ||||
| 2, | 2, | ||||
| NULL, | NULL, | ||||
| INT_MIN, | INT_MIN, | ||||
| INT_MAX, | INT_MAX, | ||||
| "Location", | "Location", | ||||
| "Region coordinates", | "Region coordinates", | ||||
| INT_MIN, | INT_MIN, | ||||
| INT_MAX); | INT_MAX); | ||||
| RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_int( | parm = RNA_def_int( | ||||
| func, "intersect_id", -1, -1, INT_MAX, "", "Use -1 to skip this gizmo", -1, INT_MAX); | func, "intersect_id", -1, -1, INT_MAX, "", "Use -1 to skip this gizmo TODO: What does this mean?", -1, INT_MAX); | ||||
| RNA_def_function_return(func, parm); | RNA_def_function_return(func, parm); | ||||
| /* wmGizmo.handler */ | /* wmGizmo.handler */ | ||||
| static EnumPropertyItem tweak_actions[] = { | static EnumPropertyItem tweak_actions[] = { | ||||
| {WM_GIZMO_TWEAK_PRECISE, "PRECISE", 0, "Precise", ""}, | {WM_GIZMO_TWEAK_PRECISE, "PRECISE", 0, "Precise", ""}, | ||||
| {WM_GIZMO_TWEAK_SNAP, "SNAP", 0, "Snap", ""}, | {WM_GIZMO_TWEAK_SNAP, "SNAP", 0, "Snap", ""}, | ||||
| {0, NULL, 0, NULL, NULL}, | {0, NULL, 0, NULL, NULL}, | ||||
| }; | }; | ||||
| func = RNA_def_function(srna, "modal", NULL); | func = RNA_def_function(srna, "modal", NULL); | ||||
| RNA_def_function_ui_description(func, ""); | RNA_def_function_ui_description(func, "TODO: When is this called?"); | ||||
| RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); | RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_pointer(func, "event", "Event", "", ""); | parm = RNA_def_pointer(func, "event", "Event", "", ""); | ||||
| RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| /* TODO: should be a enum-flag. */ | /* TODO: should be a enum-flag. */ | ||||
| parm = RNA_def_enum_flag(func, "tweak", tweak_actions, 0, "Tweak", ""); | parm = RNA_def_enum_flag(func, "tweak", tweak_actions, 0, "Tweak", ""); | ||||
| RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| parm = RNA_def_enum_flag( | parm = RNA_def_enum_flag( | ||||
| func, "result", rna_enum_operator_return_items, OPERATOR_FINISHED, "result", ""); | func, "result", rna_enum_operator_return_items, OPERATOR_FINISHED, "result", ""); | ||||
| RNA_def_function_return(func, parm); | RNA_def_function_return(func, parm); | ||||
| /* wmGizmo.property_update */ | /* wmGizmo.property_update */ | ||||
| /* TODO */ | /* TODO */ | ||||
| /* wmGizmo.setup */ | /* wmGizmo.setup */ | ||||
| func = RNA_def_function(srna, "setup", NULL); | func = RNA_def_function(srna, "setup", NULL); | ||||
| RNA_def_function_ui_description(func, ""); | RNA_def_function_ui_description(func, "TODO: When is this called?"); | ||||
| RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); | RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); | ||||
| /* wmGizmo.invoke */ | /* wmGizmo.invoke */ | ||||
| func = RNA_def_function(srna, "invoke", NULL); | func = RNA_def_function(srna, "invoke", NULL); | ||||
| RNA_def_function_ui_description(func, ""); | RNA_def_function_ui_description(func, "TODO: When is this called?"); | ||||
| RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); | RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_pointer(func, "event", "Event", "", ""); | parm = RNA_def_pointer(func, "event", "Event", "", ""); | ||||
| RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_enum_flag( | parm = RNA_def_enum_flag( | ||||
| func, "result", rna_enum_operator_return_items, OPERATOR_FINISHED, "result", ""); | func, "result", rna_enum_operator_return_items, OPERATOR_FINISHED, "result", ""); | ||||
| RNA_def_function_return(func, parm); | RNA_def_function_return(func, parm); | ||||
| /* wmGizmo.exit */ | /* wmGizmo.exit */ | ||||
| func = RNA_def_function(srna, "exit", NULL); | func = RNA_def_function(srna, "exit", NULL); | ||||
| RNA_def_function_ui_description(func, ""); | RNA_def_function_ui_description(func, "TODO: When is this called?"); | ||||
| RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); | RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_boolean(func, "cancel", 0, "Cancel, otherwise confirm", ""); | parm = RNA_def_boolean(func, "cancel", 0, "Cancel, otherwise confirm", ""); | ||||
| RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| /* wmGizmo.cursor_get */ | /* wmGizmo.cursor_get */ | ||||
| /* TODO */ | /* TODO */ | ||||
| Show All 9 Lines | |||||
| prop = RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE); | prop = RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | RNA_def_property_clear_flag(prop, PROP_EDITABLE); | ||||
| RNA_def_property_struct_type(prop, "GizmoGroup"); | RNA_def_property_struct_type(prop, "GizmoGroup"); | ||||
| RNA_def_property_pointer_funcs(prop, "rna_Gizmo_group_get", NULL, NULL, NULL); | RNA_def_property_pointer_funcs(prop, "rna_Gizmo_group_get", NULL, NULL, NULL); | ||||
| RNA_def_property_ui_text(prop, "", "Gizmo group this gizmo is a member of"); | RNA_def_property_ui_text(prop, "", "Gizmo group this gizmo is a member of"); | ||||
| /* Color & Alpha */ | /* Color & Alpha */ | ||||
| prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR); | prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR); | ||||
| RNA_def_property_ui_text(prop, "Color", "Color to draw the gizmo with"); | |||||
| RNA_def_property_array(prop, 3); | RNA_def_property_array(prop, 3); | ||||
| RNA_def_property_float_funcs(prop, "rna_Gizmo_color_get", "rna_Gizmo_color_set", NULL); | RNA_def_property_float_funcs(prop, "rna_Gizmo_color_get", "rna_Gizmo_color_set", NULL); | ||||
| RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | |||||
| prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE); | prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE); | ||||
| RNA_def_property_ui_text(prop, "Alpha", ""); | RNA_def_property_ui_text(prop, "Alpha", "Opacity of the gizmo"); /* TODO: Doesn't seem to work for custom gizmos, only native ones. */ | ||||
| RNA_def_property_float_funcs(prop, "rna_Gizmo_alpha_get", "rna_Gizmo_alpha_set", NULL); | RNA_def_property_float_funcs(prop, "rna_Gizmo_alpha_get", "rna_Gizmo_alpha_set", NULL); | ||||
| RNA_def_property_range(prop, 0.0f, 1.0f); | RNA_def_property_range(prop, 0.0f, 1.0f); | ||||
| RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | ||||
| /* Color & Alpha (highlight) */ | /* Color & Alpha (highlight) */ | ||||
| prop = RNA_def_property(srna, "color_highlight", PROP_FLOAT, PROP_COLOR); | prop = RNA_def_property(srna, "color_highlight", PROP_FLOAT, PROP_COLOR); | ||||
| RNA_def_property_ui_text(prop, "Color", "Color to draw the gizmo with when it is being mouse-hovered"); | |||||
| RNA_def_property_array(prop, 3); | RNA_def_property_array(prop, 3); | ||||
| RNA_def_property_float_funcs(prop, "rna_Gizmo_color_hi_get", "rna_Gizmo_color_hi_set", NULL); | RNA_def_property_float_funcs(prop, "rna_Gizmo_color_hi_get", "rna_Gizmo_color_hi_set", NULL); | ||||
| RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | |||||
| prop = RNA_def_property(srna, "alpha_highlight", PROP_FLOAT, PROP_NONE); | prop = RNA_def_property(srna, "alpha_highlight", PROP_FLOAT, PROP_NONE); | ||||
| RNA_def_property_ui_text(prop, "Alpha", ""); | RNA_def_property_ui_text(prop, "Alpha", "Opacity of the gizmo when it is being mouse-hovered"); /* TODO: Doesn't seem to work for custom gizmos, only native ones. */ | ||||
| RNA_def_property_float_funcs(prop, "rna_Gizmo_alpha_hi_get", "rna_Gizmo_alpha_hi_set", NULL); | RNA_def_property_float_funcs(prop, "rna_Gizmo_alpha_hi_get", "rna_Gizmo_alpha_hi_set", NULL); | ||||
| RNA_def_property_range(prop, 0.0f, 1.0f); | RNA_def_property_range(prop, 0.0f, 1.0f); | ||||
| RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | ||||
| prop = RNA_def_property(srna, "matrix_space", PROP_FLOAT, PROP_MATRIX); | prop = RNA_def_property(srna, "matrix_space", PROP_FLOAT, PROP_MATRIX); | ||||
| RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); | RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); | ||||
| RNA_def_property_ui_text(prop, "Space Matrix", ""); | RNA_def_property_ui_text(prop, "Space Matrix", "TODO: Maths?"); | ||||
| RNA_def_property_float_funcs( | RNA_def_property_float_funcs( | ||||
| prop, "rna_Gizmo_matrix_space_get", "rna_Gizmo_matrix_space_set", NULL); | prop, "rna_Gizmo_matrix_space_get", "rna_Gizmo_matrix_space_set", NULL); | ||||
| RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | ||||
| prop = RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX); | prop = RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX); | ||||
| RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); | RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); | ||||
| RNA_def_property_ui_text(prop, "Basis Matrix", ""); | RNA_def_property_ui_text(prop, "Basis Matrix", "TODO: Maths?"); | ||||
| RNA_def_property_float_funcs( | RNA_def_property_float_funcs( | ||||
| prop, "rna_Gizmo_matrix_basis_get", "rna_Gizmo_matrix_basis_set", NULL); | prop, "rna_Gizmo_matrix_basis_get", "rna_Gizmo_matrix_basis_set", NULL); | ||||
| RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | ||||
| prop = RNA_def_property(srna, "matrix_offset", PROP_FLOAT, PROP_MATRIX); | prop = RNA_def_property(srna, "matrix_offset", PROP_FLOAT, PROP_MATRIX); | ||||
| RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); | RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); | ||||
| RNA_def_property_ui_text(prop, "Offset Matrix", ""); | RNA_def_property_ui_text(prop, "Offset Matrix", "TODO: Maths?"); | ||||
| RNA_def_property_float_funcs( | RNA_def_property_float_funcs( | ||||
| prop, "rna_Gizmo_matrix_offset_get", "rna_Gizmo_matrix_offset_set", NULL); | prop, "rna_Gizmo_matrix_offset_get", "rna_Gizmo_matrix_offset_set", NULL); | ||||
| RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | ||||
| prop = RNA_def_property(srna, "matrix_world", PROP_FLOAT, PROP_MATRIX); | prop = RNA_def_property(srna, "matrix_world", PROP_FLOAT, PROP_MATRIX); | ||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | RNA_def_property_clear_flag(prop, PROP_EDITABLE); | ||||
| RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); | RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); | ||||
| RNA_def_property_ui_text(prop, "Final World Matrix", ""); | RNA_def_property_ui_text(prop, "Final World Matrix", "Final resulting matrix of the gizmo after all transformations have been applied"); | ||||
| RNA_def_property_float_funcs(prop, "rna_Gizmo_matrix_world_get", NULL, NULL); | RNA_def_property_float_funcs(prop, "rna_Gizmo_matrix_world_get", NULL, NULL); | ||||
| prop = RNA_def_property(srna, "scale_basis", PROP_FLOAT, PROP_NONE); | prop = RNA_def_property(srna, "scale_basis", PROP_FLOAT, PROP_NONE); | ||||
| RNA_def_property_ui_text(prop, "Scale Basis", ""); | RNA_def_property_ui_text(prop, "Scale Basis", "TODO: What is this?"); | ||||
| RNA_def_property_float_funcs( | RNA_def_property_float_funcs( | ||||
| prop, "rna_Gizmo_scale_basis_get", "rna_Gizmo_scale_basis_set", NULL); | prop, "rna_Gizmo_scale_basis_get", "rna_Gizmo_scale_basis_set", NULL); | ||||
| RNA_def_property_range(prop, 0.0f, FLT_MAX); | RNA_def_property_range(prop, 0.0f, FLT_MAX); | ||||
| RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | ||||
| prop = RNA_def_property(srna, "line_width", PROP_FLOAT, PROP_PIXEL); | prop = RNA_def_property(srna, "line_width", PROP_FLOAT, PROP_PIXEL); | ||||
| RNA_def_property_ui_text(prop, "Line Width", ""); | RNA_def_property_ui_text(prop, "Line Width", "Thickness used for line drawing, in screen-space pixels. May look different at different monitor resolutions. Not affected by \"Resolution Scale\" and \"Line Width\" user preferences"); /* TODO: Is this accurate? */ | ||||
| RNA_def_property_float_funcs(prop, "rna_Gizmo_line_width_get", "rna_Gizmo_line_width_set", NULL); | RNA_def_property_float_funcs(prop, "rna_Gizmo_line_width_get", "rna_Gizmo_line_width_set", NULL); | ||||
| RNA_def_property_range(prop, 0.0f, FLT_MAX); | RNA_def_property_range(prop, 0.0f, 10.0f); | ||||
| RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | ||||
| prop = RNA_def_property(srna, "select_bias", PROP_FLOAT, PROP_NONE); | prop = RNA_def_property(srna, "select_bias", PROP_FLOAT, PROP_NONE); | ||||
| RNA_def_property_ui_text(prop, "Select Bias", "Depth bias used for selection"); | RNA_def_property_ui_text(prop, "Select Bias", "Depth bias used for selection"); /* TODO: in what unit? How come the default is 0.0 but it feels quite lenient? */ | ||||
| RNA_def_property_float_funcs( | RNA_def_property_float_funcs( | ||||
| prop, "rna_Gizmo_select_bias_get", "rna_Gizmo_select_bias_set", NULL); | prop, "rna_Gizmo_select_bias_get", "rna_Gizmo_select_bias_set", NULL); | ||||
| RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); | RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); | ||||
| /* wmGizmo.flag */ | /* wmGizmo.flag */ | ||||
| /* WM_GIZMO_HIDDEN */ | /* WM_GIZMO_HIDDEN */ | ||||
| prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_funcs(prop, "rna_Gizmo_flag_hide_get", "rna_Gizmo_flag_hide_set"); | RNA_def_property_boolean_funcs(prop, "rna_Gizmo_flag_hide_get", "rna_Gizmo_flag_hide_set"); | ||||
| RNA_def_property_ui_text(prop, "Hide", ""); | RNA_def_property_ui_text(prop, "Hide", "Disable the gizmo so it is not displayed and cannot be interacted with"); | ||||
| RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | ||||
| /* WM_GIZMO_HIDDEN_SELECT */ | /* WM_GIZMO_HIDDEN_SELECT */ | ||||
| prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_funcs( | RNA_def_property_boolean_funcs( | ||||
| prop, "rna_Gizmo_flag_hide_select_get", "rna_Gizmo_flag_hide_select_set"); | prop, "rna_Gizmo_flag_hide_select_get", "rna_Gizmo_flag_hide_select_set"); | ||||
| RNA_def_property_ui_text(prop, "Hide Select", ""); | RNA_def_property_ui_text(prop, "Hide Select", "Prevent this gizmo from being mouse hovered and interacted with"); | ||||
| RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | ||||
| /* WM_GIZMO_HIDDEN_KEYMAP */ | /* WM_GIZMO_HIDDEN_KEYMAP */ | ||||
| prop = RNA_def_property(srna, "hide_keymap", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "hide_keymap", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_funcs( | RNA_def_property_boolean_funcs( | ||||
| prop, "rna_Gizmo_flag_hide_keymap_get", "rna_Gizmo_flag_hide_keymap_set"); | prop, "rna_Gizmo_flag_hide_keymap_get", "rna_Gizmo_flag_hide_keymap_set"); | ||||
| RNA_def_property_ui_text(prop, "Hide Keymap", "Ignore the key-map for this gizmo"); | RNA_def_property_ui_text(prop, "Hide Keymap", "Ignore the key-map for this gizmo"); | ||||
| RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | ||||
| /* WM_GIZMO_MOVE_CURSOR */ | /* WM_GIZMO_MOVE_CURSOR */ | ||||
| prop = RNA_def_property(srna, "use_grab_cursor", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "use_grab_cursor", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_funcs( | RNA_def_property_boolean_funcs( | ||||
| prop, "rna_Gizmo_flag_use_grab_cursor_get", "rna_Gizmo_flag_use_grab_cursor_set"); | prop, "rna_Gizmo_flag_use_grab_cursor_get", "rna_Gizmo_flag_use_grab_cursor_set"); | ||||
| RNA_def_property_ui_text(prop, "Grab Cursor", ""); | RNA_def_property_ui_text(prop, "Grab Cursor", "Hide the cursor while click and dragging on this gizmo"); | ||||
| RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | ||||
| /* WM_GIZMO_DRAW_HOVER */ | /* WM_GIZMO_DRAW_HOVER */ | ||||
| prop = RNA_def_property(srna, "use_draw_hover", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "use_draw_hover", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_funcs( | RNA_def_property_boolean_funcs( | ||||
| prop, "rna_Gizmo_flag_use_draw_hover_get", "rna_Gizmo_flag_use_draw_hover_set"); | prop, "rna_Gizmo_flag_use_draw_hover_get", "rna_Gizmo_flag_use_draw_hover_set"); | ||||
| RNA_def_property_ui_text(prop, "Show Hover", ""); | RNA_def_property_ui_text(prop, "Show Hover", "Only draw this gizmo when it is being mouse-hovered, otherwise keep it hidden"); /* TODO: When select==True, this behaves differently: The gizmo is always drawn, but without hover highlighting. Bug? | ||||
| RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); /* TODO: Why was this commented out? */ | ||||
| /* WM_GIZMO_DRAW_MODAL */ | /* WM_GIZMO_DRAW_MODAL */ | ||||
| prop = RNA_def_property(srna, "use_draw_modal", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "use_draw_modal", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_funcs( | RNA_def_property_boolean_funcs( | ||||
| prop, "rna_Gizmo_flag_use_draw_modal_get", "rna_Gizmo_flag_use_draw_modal_set"); | prop, "rna_Gizmo_flag_use_draw_modal_get", "rna_Gizmo_flag_use_draw_modal_set"); | ||||
| RNA_def_property_ui_text(prop, "Show Active", "Show while dragging"); | RNA_def_property_ui_text(prop, "Show Active", "Draw the gizmo while it is being clicked and dragged"); | ||||
| RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | ||||
| /* WM_GIZMO_DRAW_VALUE */ | /* WM_GIZMO_DRAW_VALUE */ | ||||
| prop = RNA_def_property(srna, "use_draw_value", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "use_draw_value", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_funcs( | RNA_def_property_boolean_funcs( | ||||
| prop, "rna_Gizmo_flag_use_draw_value_get", "rna_Gizmo_flag_use_draw_value_set"); | prop, "rna_Gizmo_flag_use_draw_value_get", "rna_Gizmo_flag_use_draw_value_set"); | ||||
| RNA_def_property_ui_text( | RNA_def_property_ui_text( | ||||
| prop, "Show Value", "Show an indicator for the current value while dragging"); | prop, "Show Value", "Show an indicator for the current value while dragging"); /* TODO: AFAICS this does not work. */ | ||||
| RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | ||||
| /* WM_GIZMO_DRAW_OFFSET_SCALE */ | /* WM_GIZMO_DRAW_OFFSET_SCALE */ | ||||
| prop = RNA_def_property(srna, "use_draw_offset_scale", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "use_draw_offset_scale", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_funcs(prop, | RNA_def_property_boolean_funcs(prop, | ||||
| "rna_Gizmo_flag_use_draw_offset_scale_get", | "rna_Gizmo_flag_use_draw_offset_scale_get", | ||||
| "rna_Gizmo_flag_use_draw_offset_scale_set"); | "rna_Gizmo_flag_use_draw_offset_scale_set"); | ||||
| RNA_def_property_ui_text( | RNA_def_property_ui_text( | ||||
| prop, "Scale Offset", "Scale the offset matrix (use to apply screen-space offset)"); | prop, "Scale Offset", "Scale the offset matrix (use to apply screen-space offset)"); /* TODO: This might make more sense once matrix_offset gets a description. Currently it's unclear what this does. */ | ||||
| RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | ||||
| /* WM_GIZMO_DRAW_NO_SCALE (negated) */ | /* WM_GIZMO_DRAW_NO_SCALE (negated) */ | ||||
| prop = RNA_def_property(srna, "use_draw_scale", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "use_draw_scale", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_funcs( | RNA_def_property_boolean_funcs( | ||||
| prop, "rna_Gizmo_flag_use_draw_scale_get", "rna_Gizmo_flag_use_draw_scale_set"); | prop, "rna_Gizmo_flag_use_draw_scale_get", "rna_Gizmo_flag_use_draw_scale_set"); | ||||
| RNA_def_property_ui_text(prop, "Scale", "Use scale when calculating the matrix"); | RNA_def_property_ui_text(prop, "Scale", "The gizmo's scale is relative to the camera, rather than the world"); | ||||
| RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | ||||
| /* WM_GIZMO_SELECT_BACKGROUND */ | /* WM_GIZMO_SELECT_BACKGROUND */ | ||||
| prop = RNA_def_property(srna, "use_select_background", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "use_select_background", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_funcs(prop, | RNA_def_property_boolean_funcs(prop, | ||||
| "rna_Gizmo_flag_use_select_background_get", | "rna_Gizmo_flag_use_select_background_get", | ||||
| "rna_Gizmo_flag_use_select_background_set"); | "rna_Gizmo_flag_use_select_background_set"); | ||||
| RNA_def_property_ui_text(prop, "Select Background", "Don't write into the depth buffer"); | RNA_def_property_ui_text(prop, "Select Background", "Don't write into the depth buffer"); /* TODO: What effect does this have? Does it affect drawing, or selection? Does it have a performance cost?*/ | ||||
| RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | ||||
| /* WM_GIZMO_OPERATOR_TOOL_INIT */ | /* WM_GIZMO_OPERATOR_TOOL_INIT */ | ||||
| prop = RNA_def_property(srna, "use_operator_tool_properties", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "use_operator_tool_properties", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_funcs(prop, | RNA_def_property_boolean_funcs(prop, | ||||
| "rna_Gizmo_flag_use_operator_tool_properties_get", | "rna_Gizmo_flag_use_operator_tool_properties_get", | ||||
| "rna_Gizmo_flag_use_operator_tool_properties_set"); | "rna_Gizmo_flag_use_operator_tool_properties_set"); | ||||
| RNA_def_property_ui_text( | RNA_def_property_ui_text( | ||||
| prop, | prop, | ||||
| "Tool Property Init", | "Tool Property Init", | ||||
| "Merge active tool properties on activation (does not overwrite existing)"); | "Merge active tool properties on activation (does not overwrite existing)"); /* TODO: To make this clearer, there should be some explanation on how gizmos can be hooked up to tools. */ | ||||
| RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | ||||
| /* WM_GIZMO_EVENT_HANDLE_ALL */ | /* WM_GIZMO_EVENT_HANDLE_ALL */ | ||||
| prop = RNA_def_property(srna, "use_event_handle_all", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "use_event_handle_all", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_funcs( | RNA_def_property_boolean_funcs( | ||||
| prop, "rna_Gizmo_flag_use_event_handle_all_get", "rna_Gizmo_flag_use_event_handle_all_set"); | prop, "rna_Gizmo_flag_use_event_handle_all_get", "rna_Gizmo_flag_use_event_handle_all_set"); | ||||
| RNA_def_property_ui_text(prop, | RNA_def_property_ui_text(prop, | ||||
| "Handle All Events", | "Handle All Events", | ||||
| "When highlighted, " | "When highlighted, " | ||||
| "do not pass events through to be handled by other keymaps"); | "do not pass events through to be handled by other keymaps"); /* TODO: AFAICS, this does not work. */ | ||||
| RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw"); | ||||
| /* WM_GIZMO_NO_TOOLTIP (negated) */ | /* WM_GIZMO_NO_TOOLTIP (negated) */ | ||||
| prop = RNA_def_property(srna, "use_tooltip", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "use_tooltip", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_funcs( | RNA_def_property_boolean_funcs( | ||||
| prop, "rna_Gizmo_flag_use_tooltip_get", "rna_Gizmo_flag_use_tooltip_set"); | prop, "rna_Gizmo_flag_use_tooltip_get", "rna_Gizmo_flag_use_tooltip_set"); | ||||
| RNA_def_property_ui_text(prop, "Use Tooltip", "Use tooltips when hovering over this gizmo"); | RNA_def_property_ui_text(prop, "Use Tooltip", "Use tooltips when hovering over this gizmo"); /* TODO: AFAICS, this does not work. Also, where would it be taking the tooltip from? */ | ||||
| /* No update needed. */ | /* No update needed. */ | ||||
| /* wmGizmo.state (readonly) */ | /* wmGizmo.state (readonly) */ | ||||
| /* WM_GIZMO_STATE_HIGHLIGHT */ | /* WM_GIZMO_STATE_HIGHLIGHT */ | ||||
| prop = RNA_def_property(srna, "is_highlight", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "is_highlight", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_funcs(prop, "rna_Gizmo_state_is_highlight_get", NULL); | RNA_def_property_boolean_funcs(prop, "rna_Gizmo_state_is_highlight_get", NULL); | ||||
| RNA_def_property_ui_text(prop, "Highlight", ""); | RNA_def_property_ui_text(prop, "Highlight", "Whether mouse clicking would result in interaction with this gizmo, and mouse hover states are enabled"); /* TODO: Is this accurate? What is the state of is_highlight when the mouse is on the gizmo but hide_select==True? */ | ||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | RNA_def_property_clear_flag(prop, PROP_EDITABLE); | ||||
| /* WM_GIZMO_STATE_MODAL */ | /* WM_GIZMO_STATE_MODAL */ | ||||
| prop = RNA_def_property(srna, "is_modal", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "is_modal", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_funcs(prop, "rna_Gizmo_state_is_modal_get", NULL); | RNA_def_property_boolean_funcs(prop, "rna_Gizmo_state_is_modal_get", NULL); | ||||
| RNA_def_property_ui_text(prop, "Highlight", ""); | RNA_def_property_ui_text(prop, "Modal", "Whether the gizmo is currently being clicked and dragged"); | ||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | RNA_def_property_clear_flag(prop, PROP_EDITABLE); | ||||
| /* WM_GIZMO_STATE_SELECT */ | /* WM_GIZMO_STATE_SELECT */ | ||||
| /* (note that setting is involved, needs to handle array) */ | /* (note that setting is involved, needs to handle array) */ /* TODO: I don't understand this comment. Shouldn't it be in the set() function itself, if we're worried about passing arrays? */ | ||||
| prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_funcs(prop, "rna_Gizmo_state_select_get", "rna_Gizmo_state_select_set"); | RNA_def_property_boolean_funcs(prop, "rna_Gizmo_state_select_get", "rna_Gizmo_state_select_set"); | ||||
| RNA_def_property_ui_text(prop, "Select", ""); | RNA_def_property_ui_text(prop, "Select", ""); /* TODO: How is this different from is_modal? */ | ||||
| RNA_api_gizmo(srna); | RNA_api_gizmo(srna); | ||||
| srna = RNA_def_struct(brna, "GizmoProperties", NULL); | srna = RNA_def_struct(brna, "GizmoProperties", NULL); | ||||
| RNA_def_struct_ui_text(srna, "Gizmo Properties", "Input properties of an Gizmo"); | RNA_def_struct_ui_text(srna, "Gizmo Properties", "Input properties of a Gizmo"); /* TODO: This could use a usage example. */ | ||||
| RNA_def_struct_refine_func(srna, "rna_GizmoProperties_refine"); | RNA_def_struct_refine_func(srna, "rna_GizmoProperties_refine"); | ||||
| RNA_def_struct_idprops_func(srna, "rna_GizmoProperties_idprops"); | RNA_def_struct_idprops_func(srna, "rna_GizmoProperties_idprops"); | ||||
| RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES); | RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES); | ||||
| } | } | ||||
| static void rna_def_gizmogroup(BlenderRNA *brna) | static void rna_def_gizmogroup(BlenderRNA *brna) | ||||
| { | { | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| FunctionRNA *func; | FunctionRNA *func; | ||||
| PropertyRNA *parm; | PropertyRNA *parm; | ||||
| srna = RNA_def_struct(brna, "GizmoGroup", NULL); | srna = RNA_def_struct(brna, "GizmoGroup", NULL); | ||||
| RNA_def_struct_ui_text( | RNA_def_struct_ui_text( | ||||
| srna, "GizmoGroup", "Storage of an operator being executed, or registered after execution"); | srna, "GizmoGroup", "Class to create and manage a group of interactable 2D or 3D widgets, aka gizmos"); | ||||
| RNA_def_struct_sdna(srna, "wmGizmoGroup"); | RNA_def_struct_sdna(srna, "wmGizmoGroup"); | ||||
| RNA_def_struct_refine_func(srna, "rna_GizmoGroup_refine"); | RNA_def_struct_refine_func(srna, "rna_GizmoGroup_refine"); | ||||
| # ifdef WITH_PYTHON | # ifdef WITH_PYTHON | ||||
| RNA_def_struct_register_funcs( | RNA_def_struct_register_funcs( | ||||
| srna, "rna_GizmoGroup_register", "rna_GizmoGroup_unregister", "rna_GizmoGroup_instance"); | srna, "rna_GizmoGroup_register", "rna_GizmoGroup_unregister", "rna_GizmoGroup_instance"); | ||||
| # endif | # endif | ||||
| RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT); | RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT); | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /* Registration */ | /* Registration */ | ||||
| RNA_define_verify_sdna(0); /* not in sdna */ | RNA_define_verify_sdna(0); /* not in sdna */ | ||||
| prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE); | prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE); | ||||
| RNA_def_property_ui_text(prop, | |||||
| "ID Name", | |||||
| "The unique identifier of this GizmoGroup"); | |||||
| RNA_def_property_string_sdna(prop, NULL, "type->idname"); | RNA_def_property_string_sdna(prop, NULL, "type->idname"); | ||||
| RNA_def_property_string_maxlength(prop, MAX_NAME); | RNA_def_property_string_maxlength(prop, MAX_NAME); | ||||
| RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GizmoGroup_bl_idname_set"); | RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GizmoGroup_bl_idname_set"); | ||||
| RNA_def_property_flag(prop, PROP_REGISTER); | RNA_def_property_flag(prop, PROP_REGISTER); | ||||
| RNA_def_struct_name_property(srna, prop); | RNA_def_struct_name_property(srna, prop); | ||||
| prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); | prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); /* TODO: Is this even useful or necessary, or just a copy-paste from Panel that can be deleted? */ | ||||
| RNA_def_property_string_sdna(prop, NULL, "type->name"); | RNA_def_property_string_sdna(prop, NULL, "type->name"); | ||||
| RNA_def_property_string_maxlength(prop, MAX_NAME); /* else it uses the pointer size! */ | RNA_def_property_string_maxlength(prop, MAX_NAME); /* else it uses the pointer size! */ | ||||
| RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GizmoGroup_bl_label_set"); | RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GizmoGroup_bl_label_set"); | ||||
| // RNA_def_property_clear_flag(prop, PROP_EDITABLE); | // RNA_def_property_clear_flag(prop, PROP_EDITABLE); | ||||
| RNA_def_property_flag(prop, PROP_REGISTER); | RNA_def_property_flag(prop, PROP_REGISTER); | ||||
| prop = RNA_def_property(srna, "bl_space_type", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "bl_space_type", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_sdna(prop, NULL, "type->gzmap_params.spaceid"); | RNA_def_property_enum_sdna(prop, NULL, "type->gzmap_params.spaceid"); | ||||
| RNA_def_property_enum_items(prop, rna_enum_space_type_items); | RNA_def_property_enum_items(prop, rna_enum_space_type_items); | ||||
| RNA_def_property_flag(prop, PROP_REGISTER); | RNA_def_property_flag(prop, PROP_REGISTER); | ||||
| RNA_def_property_ui_text(prop, "Space Type", "The space where the panel is going to be used in"); | RNA_def_property_ui_text(prop, "Space Type", "The space where the gizmo group is going to be used in"); | ||||
| prop = RNA_def_property(srna, "bl_region_type", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "bl_region_type", PROP_ENUM, PROP_NONE); /* TODO: Is this even useful or necessary, or just a copy-paste from Panel that can be deleted? */ | ||||
| RNA_def_property_enum_sdna(prop, NULL, "type->gzmap_params.regionid"); | RNA_def_property_enum_sdna(prop, NULL, "type->gzmap_params.regionid"); | ||||
| RNA_def_property_enum_items(prop, rna_enum_region_type_items); | RNA_def_property_enum_items(prop, rna_enum_region_type_items); | ||||
| RNA_def_property_flag(prop, PROP_REGISTER); | RNA_def_property_flag(prop, PROP_REGISTER); | ||||
| RNA_def_property_ui_text( | RNA_def_property_ui_text( | ||||
| prop, "Region Type", "The region where the panel is going to be used in"); | prop, "Region Type", "The region where the panel is going to be used in"); | ||||
| prop = RNA_def_property(srna, "bl_owner_id", PROP_STRING, PROP_NONE); | prop = RNA_def_property(srna, "bl_owner_id", PROP_STRING, PROP_NONE); /* TODO: Is this even useful or necessary, or just a copy-paste from Panel that can be deleted? */ | ||||
| RNA_def_property_string_sdna(prop, NULL, "type->owner_id"); | RNA_def_property_string_sdna(prop, NULL, "type->owner_id"); | ||||
| RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); | RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); | ||||
| /* bl_options */ | /* bl_options */ | ||||
| static EnumPropertyItem gizmogroup_flag_items[] = { | static EnumPropertyItem gizmogroup_flag_items[] = { | ||||
| {WM_GIZMOGROUPTYPE_3D, "3D", 0, "3D", "Use in 3D viewport"}, | {WM_GIZMOGROUPTYPE_3D, "3D", 0, "3D", "Use in 3D viewport"}, | ||||
| {WM_GIZMOGROUPTYPE_SCALE, | {WM_GIZMOGROUPTYPE_SCALE, | ||||
| "SCALE", | "SCALE", | ||||
| Show All 24 Lines | |||||
| "The gizmos are made for use with virtual reality sessions and require special redraw " | "The gizmos are made for use with virtual reality sessions and require special redraw " | ||||
| "management"}, | "management"}, | ||||
| {0, NULL, 0, NULL, NULL}, | {0, NULL, 0, NULL, NULL}, | ||||
| }; | }; | ||||
| prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_sdna(prop, NULL, "type->flag"); | RNA_def_property_enum_sdna(prop, NULL, "type->flag"); | ||||
| RNA_def_property_enum_items(prop, gizmogroup_flag_items); | RNA_def_property_enum_items(prop, gizmogroup_flag_items); | ||||
| RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL | PROP_ENUM_FLAG); | RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL | PROP_ENUM_FLAG); | ||||
| RNA_def_property_ui_text(prop, "Options", "Options for this operator type"); | RNA_def_property_ui_text(prop, "Options", "Options for this gizmo group"); | ||||
| RNA_define_verify_sdna(1); /* not in sdna */ | RNA_define_verify_sdna(1); /* not in sdna */ | ||||
| /* Functions */ | /* Functions */ | ||||
| /* poll */ | /* poll */ | ||||
| func = RNA_def_function(srna, "poll", NULL); | func = RNA_def_function(srna, "poll", NULL); | ||||
| RNA_def_function_ui_description(func, "Test if the gizmo group can be called or not"); | RNA_def_function_ui_description(func, "Test if the gizmo group can be called or not"); | ||||
| Show All 11 Lines | |||||
| RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| /* return */ | /* return */ | ||||
| parm = RNA_def_pointer(func, "keymap", "KeyMap", "", ""); | parm = RNA_def_pointer(func, "keymap", "KeyMap", "", ""); | ||||
| RNA_def_property_flag(parm, PROP_NEVER_NULL); | RNA_def_property_flag(parm, PROP_NEVER_NULL); | ||||
| RNA_def_function_return(func, parm); | RNA_def_function_return(func, parm); | ||||
| /* setup */ | /* setup */ | ||||
| func = RNA_def_function(srna, "setup", NULL); | func = RNA_def_function(srna, "setup", NULL); | ||||
| RNA_def_function_ui_description(func, "Create gizmos function for the gizmo group"); | RNA_def_function_ui_description(func, "Runs when the poll function first returns True. Gizmos should be created here"); /* TODO: Is this accurate? */ | ||||
| RNA_def_function_flag(func, FUNC_REGISTER); | RNA_def_function_flag(func, FUNC_REGISTER); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| /* refresh */ | /* refresh */ | ||||
| func = RNA_def_function(srna, "refresh", NULL); | func = RNA_def_function(srna, "refresh", NULL); | ||||
| RNA_def_function_ui_description( | RNA_def_function_ui_description( | ||||
| func, "Refresh data (called on common state changes such as selection)"); | func, "Refresh data (called on common state changes such as selection)"); | ||||
| ▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
| "rna_iterator_listbase_next", | "rna_iterator_listbase_next", | ||||
| "rna_iterator_listbase_end", | "rna_iterator_listbase_end", | ||||
| "rna_iterator_listbase_get", | "rna_iterator_listbase_get", | ||||
| NULL, | NULL, | ||||
| NULL, | NULL, | ||||
| NULL, | NULL, | ||||
| NULL); | NULL); | ||||
| RNA_def_property_ui_text(prop, "Gizmos", "List of gizmos in the Gizmo Map"); | RNA_def_property_ui_text(prop, "Gizmos", "List of gizmos in the gizmo group"); | ||||
| rna_def_gizmo(brna, prop); | rna_def_gizmo(brna, prop); | ||||
| rna_def_gizmos(brna, prop); | rna_def_gizmos(brna, prop); | ||||
| RNA_define_verify_sdna(1); /* not in sdna */ | RNA_define_verify_sdna(1); /* not in sdna */ | ||||
| RNA_api_gizmogroup(srna); | RNA_api_gizmogroup(srna); | ||||
| srna = RNA_def_struct(brna, "GizmoGroupProperties", NULL); | srna = RNA_def_struct(brna, "GizmoGroupProperties", NULL); | ||||
| RNA_def_struct_ui_text(srna, "Gizmo Group Properties", "Input properties of a Gizmo Group"); | RNA_def_struct_ui_text(srna, "Gizmo Group Properties", "Input properties of a Gizmo Group"); /* TODO: This could use an example */ | ||||
| RNA_def_struct_refine_func(srna, "rna_GizmoGroupProperties_refine"); | RNA_def_struct_refine_func(srna, "rna_GizmoGroupProperties_refine"); | ||||
| RNA_def_struct_idprops_func(srna, "rna_GizmoGroupProperties_idprops"); | RNA_def_struct_idprops_func(srna, "rna_GizmoGroupProperties_idprops"); | ||||
| RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES); | RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES); | ||||
| } | } | ||||
| void RNA_def_wm_gizmo(BlenderRNA *brna) | void RNA_def_wm_gizmo(BlenderRNA *brna) | ||||
| { | { | ||||
| rna_def_gizmogroup(brna); | rna_def_gizmogroup(brna); | ||||
| } | } | ||||
| #endif /* RNA_RUNTIME */ | #endif /* RNA_RUNTIME */ | ||||
| Context not available. | |||||