forked from bartvdbraak/blender
Node UI:
* Added Backdrop Panel inside the "Properties" area. * Hard limit for the "zoom" value. Negative values doesn't make sense. * Added a missing notifier for the Node backdrop move operator.
This commit is contained in:
parent
fefe3daf24
commit
05034fb91f
@ -163,6 +163,36 @@ class NODE_MT_node(bpy.types.Menu):
|
|||||||
layout.operator("node.show_cyclic_dependencies")
|
layout.operator("node.show_cyclic_dependencies")
|
||||||
|
|
||||||
|
|
||||||
|
# Node Backdrop options
|
||||||
|
class NODE_PT_properties(bpy.types.Panel):
|
||||||
|
bl_space_type = 'NODE_EDITOR'
|
||||||
|
bl_region_type = 'UI'
|
||||||
|
bl_label = "Backdrop"
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def poll(cls, context):
|
||||||
|
snode = context.space_data
|
||||||
|
return snode.tree_type == 'COMPOSITING'
|
||||||
|
|
||||||
|
def draw_header(self, context):
|
||||||
|
snode = context.space_data
|
||||||
|
self.layout.prop(snode, "show_backdrop", text="")
|
||||||
|
|
||||||
|
def draw(self, context):
|
||||||
|
layout = self.layout
|
||||||
|
|
||||||
|
snode = context.space_data
|
||||||
|
layout.active = snode.show_backdrop
|
||||||
|
layout.prop(snode, "backdrop_channels", text="")
|
||||||
|
layout.prop(snode, "backdrop_zoom", text="Zoom")
|
||||||
|
|
||||||
|
col = layout.column(align=True)
|
||||||
|
col.label(text="Offset:")
|
||||||
|
col.prop(snode, "backdrop_x", text="X")
|
||||||
|
col.prop(snode, "backdrop_y", text="Y")
|
||||||
|
col.operator("node.backimage_move", text="Move")
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -785,6 +785,8 @@ static int snode_bg_viewmove_modal(bContext *C, wmOperator *op, wmEvent *event)
|
|||||||
MEM_freeN(nvm);
|
MEM_freeN(nvm);
|
||||||
op->customdata= NULL;
|
op->customdata= NULL;
|
||||||
|
|
||||||
|
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_NODE, NULL);
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -831,6 +833,7 @@ void NODE_OT_backimage_move(wmOperatorType *ot)
|
|||||||
{
|
{
|
||||||
/* identifiers */
|
/* identifiers */
|
||||||
ot->name= "Background Image Move";
|
ot->name= "Background Image Move";
|
||||||
|
ot->description = "Move Node backdrop";
|
||||||
ot->idname= "NODE_OT_backimage_move";
|
ot->idname= "NODE_OT_backimage_move";
|
||||||
|
|
||||||
/* api callbacks */
|
/* api callbacks */
|
||||||
|
@ -2311,6 +2311,7 @@ static void rna_def_space_node(BlenderRNA *brna)
|
|||||||
|
|
||||||
prop= RNA_def_property(srna, "backdrop_zoom", PROP_FLOAT, PROP_NONE);
|
prop= RNA_def_property(srna, "backdrop_zoom", PROP_FLOAT, PROP_NONE);
|
||||||
RNA_def_property_float_sdna(prop, NULL, "zoom");
|
RNA_def_property_float_sdna(prop, NULL, "zoom");
|
||||||
|
RNA_def_property_range(prop, 0.01f, FLT_MAX);
|
||||||
RNA_def_property_ui_text(prop, "Backdrop Zoom", "Backdrop zoom factor");
|
RNA_def_property_ui_text(prop, "Backdrop Zoom", "Backdrop zoom factor");
|
||||||
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE_VIEW, NULL);
|
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE_VIEW, NULL);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user