[Bf-blender-cvs] [f96f91512cd] soc-2019-npr: LANPR: UI and operator guard for null camera situations.
YimingWu
noreply at git.blender.org
Mon Jul 8 09:28:58 CEST 2019
Commit: f96f91512cd983deed379a5578bc3e977e3c27b6
Author: YimingWu
Date: Mon Jul 8 15:28:28 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rBf96f91512cd983deed379a5578bc3e977e3c27b6
LANPR: UI and operator guard for null camera situations.
===================================================================
M release/scripts/startup/bl_ui/properties_render.py
M source/blender/draw/engines/lanpr/lanpr_ops.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py
index ffbd6234c56..5dc4d5775f0 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -753,18 +753,27 @@ class RENDER_PT_lanpr(RenderButtonsPanel, Panel):
return;
if mode == "SOFTWARE" or mode == "DPIX":
+ if not scene.camera:
+ has_camera=False
+ layout.label(text="No active camera.")
+ else:
+ has_camera=True
if scene.render.engine!="BLENDER_LANPR":
row=layout.row(align=True)
+ row.enabled=has_camera
row.prop(lanpr,"auto_update",toggle=True,text='Auto Update')
row.prop(lanpr,"gpencil_overwrite",toggle=True,text='Overwrite')
if not lanpr.auto_update:
row=layout.row()
+ row.enabled=has_camera
row.operator("scene.lanpr_update_gp_strokes", icon='RENDER_STILL', text='Update GPencil Targets')
row=layout.row()
+ row.enabled=has_camera
row.operator("scene.lanpr_bake_gp_strokes", icon='RENDER_ANIMATION', text='Bake All Frames')
else:
row=layout.row(align=True)
+ row.enabled = has_camera
row.prop(lanpr,'auto_update',toggle=True,text='Auto Update')
txt = "Update" if mode == "SOFTWARE" else "Intersection Cache"
if not lanpr.auto_update:
diff --git a/source/blender/draw/engines/lanpr/lanpr_ops.c b/source/blender/draw/engines/lanpr/lanpr_ops.c
index b06cf28bbf2..740866cf9ec 100644
--- a/source/blender/draw/engines/lanpr/lanpr_ops.c
+++ b/source/blender/draw/engines/lanpr/lanpr_ops.c
@@ -4380,6 +4380,11 @@ int lanpr_compute_feature_lines_internal(Depsgraph *depsgraph, int intersectons_
return OPERATOR_FINISHED;
}
+bool lanpr_camera_exists(struct bContext*c){
+ Scene* s = CTX_data_scene(c);
+ return s->camera?true:false;
+}
+
/* seems we don't quite need this operator... */
static int lanpr_clear_render_buffer_exec(struct bContext *C, struct wmOperator *op)
{
@@ -4433,9 +4438,7 @@ void SCENE_OT_lanpr_calculate_feature_lines(struct wmOperatorType *ot)
ot->description = "LANPR calculates feature line in current scene";
ot->idname = "SCENE_OT_lanpr_calculate";
- /* api callbacks */
- /* ot->invoke = screen_render_invoke; /* why we need both invoke and exec? */
- /* ot->modal = screen_render_modal; */
+ ot->poll = lanpr_camera_exists;
ot->cancel = lanpr_compute_feature_lines_cancel;
ot->exec = lanpr_compute_feature_lines_exec;
}
More information about the Bf-blender-cvs
mailing list