Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesrna/intern/rna_scene.c')
-rw-r--r--source/blender/makesrna/intern/rna_scene.c61
1 files changed, 58 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index e91670ea61c..babb26a531d 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -40,6 +40,7 @@
#include "BLT_translation.h"
+#include "BKE_armature.h"
#include "BKE_editmesh.h"
#include "BKE_paint.h"
@@ -1634,7 +1635,36 @@ static void rna_Scene_sync_mode_set(PointerRNA *ptr, int value)
}
}
+static void rna_Scene_cursor_rotation_mode_set(PointerRNA *ptr, int value)
+{
+ Scene *scene = ptr->id.data;
+ View3DCursor *cursor = &scene->cursor;
+
+ /* use API Method for conversions... */
+ BKE_rotMode_change_values(
+ cursor->rotation_quaternion,
+ cursor->rotation_euler,
+ cursor->rotation_axis, &cursor->rotation_angle, cursor->rotation_mode, (short)value);
+ /* finally, set the new rotation type */
+ cursor->rotation_mode = value;
+}
+
+static void rna_Scene_cursor_rotation_axis_angle_get(PointerRNA *ptr, float *value)
+{
+ Scene *scene = ptr->id.data;
+ View3DCursor *cursor = &scene->cursor;
+ value[0] = cursor->rotation_angle;
+ copy_v3_v3(&value[1], cursor->rotation_axis);
+}
+
+static void rna_Scene_cursor_rotation_axis_angle_set(PointerRNA *ptr, const float *value)
+{
+ Scene *scene = ptr->id.data;
+ View3DCursor *cursor = &scene->cursor;
+ cursor->rotation_angle = value[0];
+ copy_v3_v3(cursor->rotation_axis, &value[1]);
+}
static TimeMarker *rna_TimeLine_add(Scene *scene, const char name[], int frame)
{
@@ -6303,6 +6333,10 @@ void RNA_def_scene(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL},
};
+ static float default_quat[4] = {1, 0, 0, 0}; /* default quaternion values */
+ static float default_axisAngle[4] = {0, 0, 1, 0}; /* default axis-angle rotation values */
+
+
/* Struct definition */
srna = RNA_def_struct(brna, "Scene", "ID");
RNA_def_struct_ui_text(srna, "Scene", "Scene data-block, consisting in objects and "
@@ -6336,9 +6370,30 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4);
RNA_def_property_update(prop, NC_WINDOW, NULL);
- prop = RNA_def_property(srna, "cursor_rotation", PROP_FLOAT, PROP_QUATERNION);
- RNA_def_property_float_sdna(prop, NULL, "cursor.rotation");
- RNA_def_property_ui_text(prop, "Cursor Rotation", "3D cursor rotation in quaternions (keep normalized)");
+ prop = RNA_def_property(srna, "cursor_rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
+ RNA_def_property_float_sdna(prop, NULL, "cursor.rotation_quaternion");
+ RNA_def_property_float_array_default(prop, default_quat);
+ RNA_def_property_ui_text(prop, "Cursor Quaternion Rotation", "3D cursor rotation in quaternions (keep normalized)");
+ RNA_def_property_update(prop, NC_WINDOW, NULL);
+
+ prop = RNA_def_property(srna, "cursor_rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_float_funcs(prop, "rna_Scene_cursor_rotation_axis_angle_get",
+ "rna_Scene_cursor_rotation_axis_angle_set", NULL);
+ RNA_def_property_float_array_default(prop, default_axisAngle);
+ RNA_def_property_ui_text(prop, "Cursor Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation");
+ RNA_def_property_update(prop, NC_WINDOW, NULL);
+
+ prop = RNA_def_property(srna, "cursor_rotation_euler", PROP_FLOAT, PROP_EULER);
+ RNA_def_property_float_sdna(prop, NULL, "cursor.rotation_euler");
+ RNA_def_property_ui_text(prop, "Cursor Euler Rotation", "3D cursor rotation");
+ RNA_def_property_update(prop, NC_WINDOW, NULL);
+
+ prop = RNA_def_property(srna, "cursor_rotation_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "cursor.rotation_mode");
+ RNA_def_property_enum_items(prop, rna_enum_object_rotation_mode_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_Scene_cursor_rotation_mode_set", NULL);
+ RNA_def_property_ui_text(prop, "Cursor Rotation Mode", "");
RNA_def_property_update(prop, NC_WINDOW, NULL);
prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);