Blender V5.0
orientation.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include "RNA_access.hh"
6#include "RNA_types.hh"
7
8#include "IO_orientation.hh"
9
11 {IO_AXIS_X, "X", 0, "X", "Positive X axis"},
12 {IO_AXIS_Y, "Y", 0, "Y", "Positive Y axis"},
13 {IO_AXIS_Z, "Z", 0, "Z", "Positive Z axis"},
14 {IO_AXIS_NEGATIVE_X, "NEGATIVE_X", 0, "-X", "Negative X axis"},
15 {IO_AXIS_NEGATIVE_Y, "NEGATIVE_Y", 0, "-Y", "Negative Y axis"},
16 {IO_AXIS_NEGATIVE_Z, "NEGATIVE_Z", 0, "-Z", "Negative Z axis"},
17 {0, nullptr, 0, nullptr, nullptr}};
18
19void io_ui_forward_axis_update(Main * /*main*/, Scene * /*scene*/, PointerRNA *ptr)
20{
21 /* Both forward and up axes cannot be along the same direction. */
22
23 int forward = RNA_enum_get(ptr, "forward_axis");
24 int up = RNA_enum_get(ptr, "up_axis");
25 if ((forward % 3) == (up % 3)) {
26 RNA_enum_set(ptr, "up_axis", (up + 1) % 6);
27 }
28}
29
30void io_ui_up_axis_update(Main * /*main*/, Scene * /*scene*/, PointerRNA *ptr)
31{
32 int forward = RNA_enum_get(ptr, "forward_axis");
33 int up = RNA_enum_get(ptr, "up_axis");
34 if ((forward % 3) == (up % 3)) {
35 RNA_enum_set(ptr, "forward_axis", (forward + 1) % 6);
36 }
37}
@ IO_AXIS_Y
@ IO_AXIS_NEGATIVE_Z
@ IO_AXIS_NEGATIVE_X
@ IO_AXIS_Z
@ IO_AXIS_NEGATIVE_Y
@ IO_AXIS_X
const EnumPropertyItem io_transform_axis[]
void io_ui_forward_axis_update(Main *, Scene *, PointerRNA *ptr)
void io_ui_up_axis_update(Main *, Scene *, PointerRNA *ptr)
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PointerRNA * ptr
Definition wm_files.cc:4238