forked from blender/blender
WIP: Pan and zoom gizmos for compositor backdrop #1
@ -208,6 +208,13 @@ class NODE_HT_header(Header):
|
||||
sub.active = snode.show_backdrop
|
||||
sub.prop(snode, "backdrop_channels", icon_only=True, text="", expand=True)
|
||||
|
||||
# Navigate
|
||||
row = layout.row(align=True)
|
||||
row.prop(snode, "show_gizmo", icon='GIZMO', text="")
|
||||
sub = row.row(align=True)
|
||||
sub.active = snode.show_gizmo
|
||||
sub.popover(panel="NODE_PT_gizmo_display", text="")
|
||||
|
||||
# Snap
|
||||
row = layout.row(align=True)
|
||||
row.prop(tool_settings, "use_snap_node", text="")
|
||||
@ -223,6 +230,26 @@ class NODE_HT_header(Header):
|
||||
sub.popover(panel="NODE_PT_overlay", text="")
|
||||
|
||||
|
||||
class NODE_PT_gizmo_display(Panel):
|
||||
bl_space_type = 'NODE_EDITOR'
|
||||
bl_region_type = 'HEADER'
|
||||
bl_label = 'Gizmos'
|
||||
bl_ui_units_x = 8
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
snode = context.space_data
|
||||
|
||||
col = layout.column()
|
||||
col.label(text="Viewport Gizmos")
|
||||
col.separator()
|
||||
|
||||
col.active = snode.show_gizmo
|
||||
colsub = col.column()
|
||||
colsub.prop(snode, "show_gizmo_navigate", text="Navigate")
|
||||
|
||||
|
||||
class NODE_MT_editor_menus(Menu):
|
||||
bl_idname = "NODE_MT_editor_menus"
|
||||
bl_label = ""
|
||||
@ -1072,6 +1099,7 @@ classes = (
|
||||
NODE_PT_annotation,
|
||||
NODE_PT_overlay,
|
||||
NODE_PT_active_node_properties,
|
||||
NODE_PT_gizmo_display,
|
||||
|
||||
node_panel(EEVEE_MATERIAL_PT_settings),
|
||||
node_panel(EEVEE_NEXT_MATERIAL_PT_settings),
|
||||
|
@ -99,7 +99,7 @@ static NavigateGizmoInfo *navigate_params_from_space_type(short space_type)
|
||||
case SPACE_CLIP:
|
||||
return g_navigate_params_for_space_clip;
|
||||
default:
|
||||
/* Used for sequencer. */
|
||||
/* Used for sequencer and compositor. */
|
||||
return g_navigate_params_for_view2d;
|
||||
}
|
||||
}
|
||||
@ -143,6 +143,11 @@ static bool WIDGETGROUP_navigate_poll(const bContext *C, wmGizmoGroupType * /*gz
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SPACE_NODE: {
|
||||
const SpaceNode *snode = static_cast<const SpaceNode *>(area->spacedata.first);
|
||||
if (snode->gizmo_flag & (SNODE_GIZMO_HIDE | SNODE_GIZMO_HIDE_NAVIGATE))
|
||||
return false;
|
||||
} break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -626,4 +626,15 @@ void NODE_GGT_backdrop_corner_pin(wmGizmoGroupType *gzgt)
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Navigate
|
||||
* \{ */
|
||||
|
||||
void NODE_GGT_navigate(wmGizmoGroupType *gzgt)
|
||||
{
|
||||
VIEW2D_GGT_navigate_impl(gzgt, "NODE_GGT_navigate");
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
} // namespace blender::ed::space_node
|
||||
|
@ -400,6 +400,7 @@ void NODE_GGT_backdrop_transform(wmGizmoGroupType *gzgt);
|
||||
void NODE_GGT_backdrop_crop(wmGizmoGroupType *gzgt);
|
||||
void NODE_GGT_backdrop_sun_beams(wmGizmoGroupType *gzgt);
|
||||
void NODE_GGT_backdrop_corner_pin(wmGizmoGroupType *gzgt);
|
||||
void NODE_GGT_navigate(wmGizmoGroupType *gzgt);
|
||||
|
||||
/* `node_geometry_attribute_search.cc` */
|
||||
|
||||
|
@ -1137,6 +1137,7 @@ static void node_widgets()
|
||||
WM_gizmogrouptype_append_and_link(gzmap_type, NODE_GGT_backdrop_crop);
|
||||
WM_gizmogrouptype_append_and_link(gzmap_type, NODE_GGT_backdrop_sun_beams);
|
||||
WM_gizmogrouptype_append_and_link(gzmap_type, NODE_GGT_backdrop_corner_pin);
|
||||
WM_gizmogrouptype_append_and_link(gzmap_type, NODE_GGT_navigate);
|
||||
}
|
||||
|
||||
static void node_id_remap(ID *old_id, ID *new_id, SpaceNode *snode)
|
||||
|
@ -1627,6 +1627,9 @@ typedef struct SpaceNode {
|
||||
/** Grease-pencil data. */
|
||||
struct bGPdata *gpd;
|
||||
|
||||
char gizmo_flag;
|
||||
char _pad2[7];
|
||||
|
||||
SpaceNodeOverlay overlay;
|
||||
|
||||
SpaceNode_Runtime *runtime;
|
||||
@ -1649,6 +1652,13 @@ typedef enum eSpaceNode_Flag {
|
||||
SNODE_FLAG_UNUSED_12 = (1 << 13),
|
||||
} eSpaceNode_Flag;
|
||||
|
||||
/** #SpaceNode.gizmo_flag */
|
||||
enum {
|
||||
/** All gizmos. */
|
||||
SNODE_GIZMO_HIDE = (1 << 0),
|
||||
SNODE_GIZMO_HIDE_NAVIGATE = (1 << 1),
|
||||
};
|
||||
|
||||
/** #SpaceNode.texfrom */
|
||||
typedef enum eSpaceNode_TexFrom {
|
||||
/* SNODE_TEX_OBJECT = 0, */
|
||||
|
@ -7810,6 +7810,17 @@ static void rna_def_space_node(BlenderRNA *brna)
|
||||
prop, "Auto-offset Direction", "Direction to offset nodes on insertion");
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, nullptr);
|
||||
|
||||
/* Gizmo Toggles. */
|
||||
prop = RNA_def_property(srna, "show_gizmo", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(prop, nullptr, "gizmo_flag", SNODE_GIZMO_HIDE);
|
||||
RNA_def_property_ui_text(prop, "Show Gizmo", "Show gizmos of all types");
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "show_gizmo_navigate", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(prop, nullptr, "gizmo_flag", SNODE_GIZMO_HIDE_NAVIGATE);
|
||||
RNA_def_property_ui_text(prop, "Navigate Gizmo", "Viewport navigation gizmo");
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, nullptr);
|
||||
|
||||
/* Overlays */
|
||||
prop = RNA_def_property(srna, "overlay", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user