Changeset View
Standalone View
source/blender/makesrna/intern/rna_scene.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
| Show First 20 Lines • Show All 184 Lines • ▼ Show 20 Lines | const EnumPropertyItem rna_enum_snap_node_element_items[] = { | ||||
| {SCE_SNAP_MODE_NODE_X | SCE_SNAP_MODE_NODE_Y, | {SCE_SNAP_MODE_NODE_X | SCE_SNAP_MODE_NODE_Y, | ||||
| "NODE_XY", | "NODE_XY", | ||||
| ICON_NODE_CORNER, | ICON_NODE_CORNER, | ||||
| "Node X / Y", | "Node X / Y", | ||||
| "Snap to any node border"}, | "Snap to any node border"}, | ||||
| {0, NULL, 0, NULL, NULL}, | {0, NULL, 0, NULL, NULL}, | ||||
| }; | }; | ||||
| const EnumPropertyItem rna_enum_snap_seq_element_items[] = { | |||||
| {SEQ_SNAP_TO_PLAYHEAD, "PLAYHEAD", ICON_NONE, "Playhead", "Snap to current frame"}, | |||||
| {SEQ_SNAP_TO_STRIP_HOLD, "STRIP_HOLD", ICON_NONE, "Hold Offset", "Snap to strip hold offset"}, | |||||
| {0, NULL, 0, NULL, NULL}, | |||||
| }; | |||||
| #ifndef RNA_RUNTIME | #ifndef RNA_RUNTIME | ||||
| static const EnumPropertyItem snap_uv_element_items[] = { | static const EnumPropertyItem snap_uv_element_items[] = { | ||||
| {SCE_SNAP_MODE_INCREMENT, | {SCE_SNAP_MODE_INCREMENT, | ||||
| "INCREMENT", | "INCREMENT", | ||||
| ICON_SNAP_INCREMENT, | ICON_SNAP_INCREMENT, | ||||
| "Increment", | "Increment", | ||||
| "Snap to increments of grid"}, | "Snap to increments of grid"}, | ||||
| {SCE_SNAP_MODE_VERTEX, "VERTEX", ICON_SNAP_VERTEX, "Vertex", "Snap to vertices"}, | {SCE_SNAP_MODE_VERTEX, "VERTEX", ICON_SNAP_VERTEX, "Vertex", "Snap to vertices"}, | ||||
| ▲ Show 20 Lines • Show All 3,311 Lines • ▼ Show 20 Lines | static void rna_def_sequencer_tool_settings(BlenderRNA *brna) | ||||
| RNA_def_struct_ui_text(srna, "Sequencer Tool Settings", ""); | RNA_def_struct_ui_text(srna, "Sequencer Tool Settings", ""); | ||||
| /* Add strip settings. */ | /* Add strip settings. */ | ||||
| prop = RNA_def_property(srna, "fit_method", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "fit_method", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_items(prop, scale_fit_methods); | RNA_def_property_enum_items(prop, scale_fit_methods); | ||||
| RNA_def_property_ui_text(prop, "Fit Method", "Scale fit method"); | RNA_def_property_ui_text(prop, "Fit Method", "Scale fit method"); | ||||
| /* Transform snapping. */ | /* Transform snapping. */ | ||||
| prop = RNA_def_property(srna, "snap_to_current_frame", PROP_BOOLEAN, PROP_NONE); | |||||
| RNA_def_property_boolean_sdna(prop, NULL, "snap_mode", SEQ_SNAP_TO_PLAYHEAD); | |||||
| RNA_def_property_boolean_default(prop, true); | |||||
| RNA_def_property_ui_text(prop, "Current Frame", "Snap to current frame"); | |||||
| RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */ | |||||
| /* Sequencer editor uses own set of snap modes */ | prop = RNA_def_property(srna, "snap_to_hold_offset", PROP_BOOLEAN, PROP_NONE); | ||||
| prop = RNA_def_property(srna, "snap_seq_element", PROP_ENUM, PROP_NONE); | RNA_def_property_boolean_sdna(prop, NULL, "snap_mode", SEQ_SNAP_TO_STRIP_HOLD); | ||||
| RNA_def_property_enum_bitflag_sdna(prop, NULL, "snap_mode"); | RNA_def_property_boolean_default(prop, true); | ||||
HooglyBoogly: Unfortunately defaults in RNA for DNA properties don't do anything currently AFAIK, what does… | |||||
ISSAuthorUnsubmitted Done Inline ActionsAh I thought this works for "reset to default" I had some trouble setting up DNA defaults here, but will try again. I thought that I am covered when I initialize these in code and set defaults here... ISS: Ah I thought this works for "reset to default"
I had some trouble setting up DNA defaults here… | |||||
HooglyBooglyUnsubmitted Done Inline ActionsYeah, I'm not even sure it's supposed to work or not, seems the system is in sort of a broken state. HooglyBoogly: Yeah, I'm not even sure it's supposed to work or not, seems the system is in sort of a broken… | |||||
ISSAuthorUnsubmitted Done Inline ActionsI have re-checked DNA defaults and issue was quite obvious - SequencerToolSettings is pointer, so it doesn't work. So for now I have removed RNA default values, and I will change SequencerToolSettings to be part of ToolSettings in another patch. ISS: I have re-checked DNA defaults and issue was quite obvious - `SequencerToolSettings` is pointer… | |||||
HooglyBooglyUnsubmitted Not Done Inline ActionsYou don't have to move it into tool settings, you just need to ensure that it's allocated for the first time with the dna defaults system. But yeah, I agree about doing that separately. HooglyBoogly: You don't have to move it into tool settings, you just need to ensure that it's allocated for… | |||||
HooglyBooglyUnsubmitted Not Done Inline ActionsRealize I phrased that in a vague way-- you have to make sure to set up the dna defaults system for the SequencerToolSettings struct and copy the default data over when the struct is created from scratch. HooglyBoogly: Realize I phrased that in a vague way-- you have to make sure to set up the dna defaults system… | |||||
ISSAuthorUnsubmitted Done Inline ActionsAh I see, so basically use DNA_struct_default_alloc or DNA_struct_default_get I would still rather make SequencerToolSettings not a pointer, as that simplifies code a bit. ISS: Ah I see, so basically use `DNA_struct_default_alloc` or `DNA_struct_default_get`
I would… | |||||
| RNA_def_property_enum_items(prop, rna_enum_snap_seq_element_items); | RNA_def_property_ui_text(prop, "Hold Offset", "Snap to strip hold offsets"); | ||||
HooglyBooglyUnsubmitted Done Inline ActionsDid you miss RNA_def_property_update for this second property? HooglyBoogly: Did you miss `RNA_def_property_update` for this second property? | |||||
ISSAuthorUnsubmitted Done Inline ActionsNo, it's in line 3530 ISS: No, it's in line 3530 | |||||
HooglyBooglyUnsubmitted Done Inline ActionsOh, sorry! HooglyBoogly: Oh, sorry! | |||||
| RNA_def_property_ui_text(prop, "Snap To", "Type of element to snap to"); | |||||
| RNA_def_property_flag(prop, PROP_ENUM_FLAG); | |||||
| RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */ | RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */ | ||||
| prop = RNA_def_property(srna, "snap_ignore_muted", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "snap_ignore_muted", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SEQ_SNAP_IGNORE_MUTED); | RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SEQ_SNAP_IGNORE_MUTED); | ||||
| RNA_def_property_boolean_default(prop, true); | RNA_def_property_boolean_default(prop, true); | ||||
| RNA_def_property_ui_text(prop, "Ignore Muted Strips", "Don't snap to hidden strips"); | RNA_def_property_ui_text(prop, "Ignore Muted Strips", "Don't snap to hidden strips"); | ||||
| prop = RNA_def_property(srna, "snap_ignore_sound", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "snap_ignore_sound", PROP_BOOLEAN, PROP_NONE); | ||||
| ▲ Show 20 Lines • Show All 4,483 Lines • Show Last 20 Lines | |||||
Unfortunately defaults in RNA for DNA properties don't do anything currently AFAIK, what does work is using the DNA defaults system.