Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_space.c
| Show First 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | |||||
| #ifndef RNA_RUNTIME | #ifndef RNA_RUNTIME | ||||
| static EnumPropertyItem stereo3d_eye_items[] = { | static EnumPropertyItem stereo3d_eye_items[] = { | ||||
| {STEREO_LEFT_ID, "LEFT_EYE", ICON_NONE, "Left Eye"}, | {STEREO_LEFT_ID, "LEFT_EYE", ICON_NONE, "Left Eye"}, | ||||
| {STEREO_RIGHT_ID, "RIGHT_EYE", ICON_NONE, "Right Eye"}, | {STEREO_RIGHT_ID, "RIGHT_EYE", ICON_NONE, "Right Eye"}, | ||||
| {0, NULL, 0, NULL, NULL} | {0, NULL, 0, NULL, NULL} | ||||
| }; | }; | ||||
| #endif | #endif | ||||
| static EnumPropertyItem translate_items_full[] = { | |||||
| { V3D_MANIP_GLOBAL, "GLOBAL", ICON_MAN_TRANS, "Global", "Align the transformation axes to world space" }, | |||||
| { V3D_MANIP_LOCAL, "LOCAL", ICON_MAN_TRANS, "Local", "Align the transformation axes to the selected objects' local space" }, | |||||
| { V3D_MANIP_NORMAL, "NORMAL", ICON_MAN_TRANS, "Normal", | |||||
| "Align the transformation axes to average normal of selected elements " | |||||
| "(bone Y axis for pose mode)" }, | |||||
| { V3D_MANIP_GIMBAL, "GIMBAL", ICON_MAN_TRANS, "Gimbal", "Align each axis to the Euler rotation axis as used for input" }, | |||||
| { V3D_MANIP_VIEW, "VIEW", ICON_MAN_TRANS, "View", "Align the transformation axes to the window" }, | |||||
| { V3D_MANIP_NONE, "NONE", ICON_MAN_TRANS, "None", "This will hide this particular axis" }, | |||||
| { 0, NULL, 0, NULL, NULL } | |||||
| }; | |||||
| static EnumPropertyItem rotate_items_full[] = { | |||||
| { V3D_MANIP_GLOBAL, "GLOBAL", ICON_MAN_ROT, "Global", "Align the transformation axes to world space" }, | |||||
| { V3D_MANIP_LOCAL, "LOCAL", ICON_MAN_ROT, "Local", "Align the transformation axes to the selected objects' local space" }, | |||||
| { V3D_MANIP_NORMAL, "NORMAL", ICON_MAN_ROT, "Normal", | |||||
| "Align the transformation axes to average normal of selected elements " | |||||
| "(bone Y axis for pose mode)" }, | |||||
| { V3D_MANIP_GIMBAL, "GIMBAL", ICON_MAN_ROT, "Gimbal", "Align each axis to the Euler rotation axis as used for input" }, | |||||
| { V3D_MANIP_VIEW, "VIEW", ICON_MAN_ROT, "View", "Align the transformation axes to the window" }, | |||||
| { V3D_MANIP_NONE, "NONE", ICON_MAN_ROT, "None", "This will hide this particular axis" }, | |||||
| { 0, NULL, 0, NULL, NULL } | |||||
| }; | |||||
| static EnumPropertyItem scale_items_full[] = { | |||||
| { V3D_MANIP_GLOBAL, "GLOBAL", ICON_MAN_SCALE, "Global", "Align the transformation axes to world space" }, | |||||
| { V3D_MANIP_LOCAL, "LOCAL", ICON_MAN_SCALE, "Local", "Align the transformation axes to the selected objects' local space" }, | |||||
| { V3D_MANIP_NORMAL, "NORMAL", ICON_MAN_SCALE, "Normal", | |||||
| "Align the transformation axes to average normal of selected elements " | |||||
| "(bone Y axis for pose mode)" }, | |||||
| { V3D_MANIP_GIMBAL, "GIMBAL", ICON_MAN_SCALE, "Gimbal", "Align each axis to the Euler rotation axis as used for input" }, | |||||
| { V3D_MANIP_VIEW, "VIEW", ICON_MAN_SCALE, "View", "Align the transformation axes to the window" }, | |||||
| { V3D_MANIP_NONE, "NONE", ICON_MAN_SCALE, "None", "This will hide this particular axis" }, | |||||
| { 0, NULL, 0, NULL, NULL } | |||||
| }; | |||||
| static EnumPropertyItem pivot_items_full[] = { | static EnumPropertyItem pivot_items_full[] = { | ||||
| {V3D_AROUND_CENTER_BOUNDS, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", | {V3D_AROUND_CENTER_BOUNDS, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", | ||||
| "Pivot around bounding box center of selected object(s)"}, | "Pivot around bounding box center of selected object(s)"}, | ||||
| {V3D_AROUND_CURSOR, "CURSOR", ICON_CURSOR, "3D Cursor", "Pivot around the 3D cursor"}, | {V3D_AROUND_CURSOR, "CURSOR", ICON_CURSOR, "3D Cursor", "Pivot around the 3D cursor"}, | ||||
| {V3D_AROUND_LOCAL_ORIGINS, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION, | {V3D_AROUND_LOCAL_ORIGINS, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION, | ||||
| "Individual Origins", "Pivot around each object's own origin"}, | "Individual Origins", "Pivot around each object's own origin"}, | ||||
| {V3D_AROUND_CENTER_MEAN, "MEDIAN_POINT", ICON_ROTATECENTER, "Median Point", | {V3D_AROUND_CENTER_MEAN, "MEDIAN_POINT", ICON_ROTATECENTER, "Median Point", | ||||
| "Pivot around the median point of selected objects"}, | "Pivot around the median point of selected objects"}, | ||||
| Show All 17 Lines | |||||
| static EnumPropertyItem transform_orientation_items[] = { | static EnumPropertyItem transform_orientation_items[] = { | ||||
| {V3D_MANIP_GLOBAL, "GLOBAL", 0, "Global", "Align the transformation axes to world space"}, | {V3D_MANIP_GLOBAL, "GLOBAL", 0, "Global", "Align the transformation axes to world space"}, | ||||
| {V3D_MANIP_LOCAL, "LOCAL", 0, "Local", "Align the transformation axes to the selected objects' local space"}, | {V3D_MANIP_LOCAL, "LOCAL", 0, "Local", "Align the transformation axes to the selected objects' local space"}, | ||||
| {V3D_MANIP_NORMAL, "NORMAL", 0, "Normal", | {V3D_MANIP_NORMAL, "NORMAL", 0, "Normal", | ||||
| "Align the transformation axes to average normal of selected elements " | "Align the transformation axes to average normal of selected elements " | ||||
| "(bone Y axis for pose mode)"}, | "(bone Y axis for pose mode)"}, | ||||
| {V3D_MANIP_GIMBAL, "GIMBAL", 0, "Gimbal", "Align each axis to the Euler rotation axis as used for input"}, | {V3D_MANIP_GIMBAL, "GIMBAL", 0, "Gimbal", "Align each axis to the Euler rotation axis as used for input"}, | ||||
| {V3D_MANIP_VIEW, "VIEW", 0, "View", "Align the transformation axes to the window"}, | {V3D_MANIP_VIEW, "VIEW", 0, "View", "Align the transformation axes to the window"}, | ||||
| {V3D_MANIP_MULTI_TRANSF, "MULTITRANSFORM", 0, "Multiple", "Set different orientations to different transformation manipulators" }, | |||||
| // {V3D_MANIP_CUSTOM, "CUSTOM", 0, "Custom", "Use a custom transform orientation"}, | // {V3D_MANIP_CUSTOM, "CUSTOM", 0, "Custom", "Use a custom transform orientation"}, | ||||
| {0, NULL, 0, NULL, NULL} | {0, NULL, 0, NULL, NULL} | ||||
| }; | }; | ||||
| #ifndef RNA_RUNTIME | #ifndef RNA_RUNTIME | ||||
| static EnumPropertyItem autosnap_items[] = { | static EnumPropertyItem autosnap_items[] = { | ||||
| {SACTSNAP_OFF, "NONE", 0, "No Auto-Snap", ""}, | {SACTSNAP_OFF, "NONE", 0, "No Auto-Snap", ""}, | ||||
| /* {-1, "", 0, "", ""}, */ | /* {-1, "", 0, "", ""}, */ | ||||
| ▲ Show 20 Lines • Show All 281 Lines • ▼ Show 20 Lines | EnumPropertyItem *rna_TransformOrientation_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) | ||||
| } | } | ||||
| RNA_enum_item_end(&item, &totitem); | RNA_enum_item_end(&item, &totitem); | ||||
| *r_free = true; | *r_free = true; | ||||
| return item; | return item; | ||||
| } | } | ||||
| EnumPropertyItem *rna_TransformTranslate_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) | |||||
| { | |||||
| Scene *scene = NULL; | |||||
| ListBase *transform_spaces; | |||||
| TransformOrientation *ts = NULL; | |||||
| EnumPropertyItem tmp = { 0, "", 0, "", "" }; | |||||
| EnumPropertyItem *item = NULL; | |||||
| int i = 0, totitem = 0; | |||||
| RNA_enum_items_add(&item, &totitem, translate_items_full); | |||||
| if (ptr->type == &RNA_SpaceView3D) | |||||
| scene = ((bScreen *)ptr->id.data)->scene; | |||||
| else | |||||
| scene = CTX_data_scene(C); /* can't use scene from ptr->id.data because that enum is also used by operators */ | |||||
| if (scene) { | |||||
| transform_spaces = &scene->transform_spaces; | |||||
| ts = transform_spaces->first; | |||||
| } | |||||
| if (ts) { | |||||
| RNA_enum_item_add_separator(&item, &totitem); | |||||
| for (; ts; ts = ts->next) { | |||||
| tmp.identifier = ts->name; | |||||
| tmp.name = ts->name; | |||||
| tmp.value = i++; | |||||
| RNA_enum_item_add(&item, &totitem, &tmp); | |||||
| } | |||||
| } | |||||
| RNA_enum_item_end(&item, &totitem); | |||||
| *r_free = true; | |||||
| return item; | |||||
| } | |||||
| EnumPropertyItem *rna_TransformRotation_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) | |||||
| { | |||||
| Scene *scene = NULL; | |||||
| ListBase *transform_spaces; | |||||
| TransformOrientation *ts = NULL; | |||||
| EnumPropertyItem tmp = { 0, "", 0, "", "" }; | |||||
| EnumPropertyItem *item = NULL; | |||||
| int i = 0, totitem = 0; | |||||
| RNA_enum_items_add(&item, &totitem, rotate_items_full); | |||||
| if (ptr->type == &RNA_SpaceView3D) | |||||
| scene = ((bScreen *)ptr->id.data)->scene; | |||||
| else | |||||
| scene = CTX_data_scene(C); /* can't use scene from ptr->id.data because that enum is also used by operators */ | |||||
| if (scene) { | |||||
| transform_spaces = &scene->transform_spaces; | |||||
| ts = transform_spaces->first; | |||||
| } | |||||
| if (ts) { | |||||
| RNA_enum_item_add_separator(&item, &totitem); | |||||
| for (; ts; ts = ts->next) { | |||||
| tmp.identifier = ts->name; | |||||
| tmp.name = ts->name; | |||||
| tmp.value = i++; | |||||
| RNA_enum_item_add(&item, &totitem, &tmp); | |||||
| } | |||||
| } | |||||
| RNA_enum_item_end(&item, &totitem); | |||||
| *r_free = true; | |||||
| return item; | |||||
| } | |||||
| EnumPropertyItem *rna_TransformScale_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) | |||||
| { | |||||
| Scene *scene = NULL; | |||||
| ListBase *transform_spaces; | |||||
| TransformOrientation *ts = NULL; | |||||
| EnumPropertyItem tmp = { 0, "", 0, "", "" }; | |||||
| EnumPropertyItem *item = NULL; | |||||
| int i = 0, totitem = 0; | |||||
| RNA_enum_items_add(&item, &totitem, scale_items_full); | |||||
| if (ptr->type == &RNA_SpaceView3D) | |||||
| scene = ((bScreen *)ptr->id.data)->scene; | |||||
| else | |||||
| scene = CTX_data_scene(C); /* can't use scene from ptr->id.data because that enum is also used by operators */ | |||||
| if (scene) { | |||||
| transform_spaces = &scene->transform_spaces; | |||||
| ts = transform_spaces->first; | |||||
| } | |||||
| if (ts) { | |||||
| RNA_enum_item_add_separator(&item, &totitem); | |||||
| for (; ts; ts = ts->next) { | |||||
| tmp.identifier = ts->name; | |||||
| tmp.name = ts->name; | |||||
| tmp.value = i++; | |||||
| RNA_enum_item_add(&item, &totitem, &tmp); | |||||
| } | |||||
| } | |||||
| RNA_enum_item_end(&item, &totitem); | |||||
| *r_free = true; | |||||
| return item; | |||||
| } | |||||
| /* Space 3D View */ | /* Space 3D View */ | ||||
| static void rna_SpaceView3D_camera_update(Main *bmain, Scene *scene, PointerRNA *ptr) | static void rna_SpaceView3D_camera_update(Main *bmain, Scene *scene, PointerRNA *ptr) | ||||
| { | { | ||||
| View3D *v3d = (View3D *)(ptr->data); | View3D *v3d = (View3D *)(ptr->data); | ||||
| if (v3d->scenelock) { | if (v3d->scenelock) { | ||||
| scene->camera = v3d->camera; | scene->camera = v3d->camera; | ||||
| BKE_screen_view3d_main_sync(&bmain->screen, scene); | BKE_screen_view3d_main_sync(&bmain->screen, scene); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 2,171 Lines • ▼ Show 20 Lines | static void rna_def_space_view3d(BlenderRNA *brna) | ||||
| RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); | RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); | ||||
| prop = RNA_def_property(srna, "transform_manipulators", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "transform_manipulators", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_sdna(prop, NULL, "twtype"); | RNA_def_property_enum_sdna(prop, NULL, "twtype"); | ||||
| RNA_def_property_enum_items(prop, manipulators_items); | RNA_def_property_enum_items(prop, manipulators_items); | ||||
| RNA_def_property_flag(prop, PROP_ENUM_FLAG); | RNA_def_property_flag(prop, PROP_ENUM_FLAG); | ||||
| RNA_def_property_ui_text(prop, "Transform Manipulators", "Transformation manipulators"); | RNA_def_property_ui_text(prop, "Transform Manipulators", "Transformation manipulators"); | ||||
| RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); | RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); | ||||
| prop = RNA_def_property(srna, "custom_translate_manipulators", PROP_ENUM, PROP_NONE); | |||||
| RNA_def_property_enum_sdna(prop, NULL, "twtrans"); | |||||
| RNA_def_property_enum_items(prop, translate_items_full); | |||||
| RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_TransformTranslate_itemf"); | |||||
| RNA_def_property_ui_text(prop, "Custom Translate Manipulators", "Custom Translate"); | |||||
| RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); | |||||
| prop = RNA_def_property(srna, "custom_rotate_manipulators", PROP_ENUM, PROP_NONE); | |||||
| RNA_def_property_enum_sdna(prop, NULL, "twrots"); | |||||
| RNA_def_property_enum_items(prop, rotate_items_full); | |||||
| RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_TransformRotation_itemf"); | |||||
| RNA_def_property_ui_text(prop, "Custom Rotation Manipulators", "Custom Rotation"); | |||||
| RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); | |||||
| prop = RNA_def_property(srna, "custom_scale_manipulators", PROP_ENUM, PROP_NONE); | |||||
| RNA_def_property_enum_sdna(prop, NULL, "twscale"); | |||||
| RNA_def_property_enum_items(prop, scale_items_full); | |||||
| RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_TransformScale_itemf"); | |||||
| RNA_def_property_ui_text(prop, "Custom Scale Manipulators", "Custom Scale"); | |||||
| RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); | |||||
| prop = RNA_def_property(srna, "transform_orientation", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "transform_orientation", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_sdna(prop, NULL, "twmode"); | RNA_def_property_enum_sdna(prop, NULL, "twmode"); | ||||
| RNA_def_property_enum_items(prop, transform_orientation_items); | RNA_def_property_enum_items(prop, transform_orientation_items); | ||||
| RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_TransformOrientation_itemf"); | RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_TransformOrientation_itemf"); | ||||
| RNA_def_property_ui_text(prop, "Transform Orientation", "Transformation orientation"); | RNA_def_property_ui_text(prop, "Transform Orientation", "Transformation orientation"); | ||||
| RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); | RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); | ||||
| prop = RNA_def_property(srna, "current_orientation", PROP_POINTER, PROP_NONE); | prop = RNA_def_property(srna, "current_orientation", PROP_POINTER, PROP_NONE); | ||||
| ▲ Show 20 Lines • Show All 2,149 Lines • Show Last 20 Lines | |||||