Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_view3d/view3d_edit.c
| Context not available. | |||||
| #include "RNA_access.h" | #include "RNA_access.h" | ||||
| #include "RNA_define.h" | #include "RNA_define.h" | ||||
| #include "RNA_enum_types.h" | |||||
| #include "ED_armature.h" | #include "ED_armature.h" | ||||
| #include "ED_particle.h" | #include "ED_particle.h" | ||||
| Context not available. | |||||
| static int view3d_cursor3d_invoke(bContext *C, wmOperator *op, const wmEvent *event) | static int view3d_cursor3d_invoke(bContext *C, wmOperator *op, const wmEvent *event) | ||||
| { | { | ||||
| bool use_depth = (U.uiflag & USER_DEPTH_CURSOR); | bool use_tool_settings, use_depth; | ||||
| { | enum eV3DCursorOrient orientation; | ||||
| PropertyRNA *prop = RNA_struct_find_property(op->ptr, "use_depth"); | PropertyRNA *prop; | ||||
| if (RNA_property_is_set(op->ptr, prop)) { | |||||
| use_depth = RNA_property_boolean_get(op->ptr, prop); | prop = RNA_struct_find_property(op->ptr, "use_tool_settings"); | ||||
| } | use_tool_settings = RNA_property_boolean_get(op->ptr, prop); | ||||
| else { | |||||
| RNA_property_boolean_set(op->ptr, prop, use_depth); | if (use_tool_settings) { | ||||
| } | Scene *scene = CTX_data_scene(C); | ||||
| use_depth = scene->toolsettings->v3d_cursor_project; | |||||
| orientation = scene->toolsettings->v3d_cursor_orientation; | |||||
| } | |||||
| else { | |||||
| prop = RNA_struct_find_property(op->ptr, "use_depth"); | |||||
| use_depth = RNA_property_boolean_get(op->ptr, prop); | |||||
| orientation = RNA_enum_get(op->ptr, "orientation"); | |||||
| } | } | ||||
| const enum eV3DCursorOrient orientation = RNA_enum_get(op->ptr, "orientation"); | |||||
| ED_view3d_cursor3d_update(C, event->mval, use_depth, orientation); | ED_view3d_cursor3d_update(C, event->mval, use_depth, orientation); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| Context not available. | |||||
| // ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; | // ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| static const EnumPropertyItem orientation_items[] = { | |||||
| {V3D_CURSOR_ORIENT_NONE, "NONE", 0, "None", "Leave orientation unchanged"}, | |||||
| {V3D_CURSOR_ORIENT_VIEW, "VIEW", 0, "View", "Orient to the viewport"}, | |||||
| {V3D_CURSOR_ORIENT_XFORM, "XFORM", 0, "Transform", "Orient to the current transform setting"}, | |||||
| {V3D_CURSOR_ORIENT_GEOM, "GEOM", 0, "Geometry", "Match the surface normal"}, | |||||
| {0, NULL, 0, NULL, NULL}, | |||||
| }; | |||||
| prop = RNA_def_boolean( | prop = RNA_def_boolean( | ||||
| ot->srna, "use_depth", true, "Surface Project", | ot->srna, "use_depth", true, "Surface Project", | ||||
| Context not available. | |||||
| RNA_def_property_flag(prop, PROP_SKIP_SAVE); | RNA_def_property_flag(prop, PROP_SKIP_SAVE); | ||||
| prop = RNA_def_enum( | prop = RNA_def_enum( | ||||
| ot->srna, "orientation", orientation_items, V3D_CURSOR_ORIENT_VIEW, | ot->srna, "orientation", rna_enum_v3d_cursor_orientation_items_full, V3D_CURSOR_ORIENT_VIEW, | ||||
| "Orientation", "Preset viewpoint to use"); | "Orientation", "Preset viewpoint to use"); | ||||
| RNA_def_property_flag(prop, PROP_SKIP_SAVE); | RNA_def_property_flag(prop, PROP_SKIP_SAVE); | ||||
| prop = RNA_def_boolean( | |||||
| ot->srna, "use_tool_settings", true, "Use Tool Settings", | |||||
| "Use the global tool settings"); | |||||
| RNA_def_property_flag(prop, PROP_SKIP_SAVE); | |||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| Context not available. | |||||