[Bf-blender-cvs] [1d365374e81] master: Merge branch 'blender2.7'

Sergey Sharybin noreply at git.blender.org
Tue Apr 2 17:52:28 CEST 2019


Commit: 1d365374e81a6ba402858e48acd9adadf54b7b92
Author: Sergey Sharybin
Date:   Tue Apr 2 17:51:44 2019 +0200
Branches: master
https://developer.blender.org/rB1d365374e81a6ba402858e48acd9adadf54b7b92

Merge branch 'blender2.7'

===================================================================



===================================================================

diff --cc source/blender/editors/interface/interface_templates.c
index 213c9df4b29,bd8c202b168..0bb1497a74e
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@@ -50,16 -48,16 +51,18 @@@
  #include "BLF_api.h"
  #include "BLT_translation.h"
  
+ #include "BKE_action.h"
  #include "BKE_colorband.h"
  #include "BKE_colortools.h"
+ #include "BKE_constraint.h"
  #include "BKE_context.h"
 -#include "BKE_depsgraph.h"
  #include "BKE_global.h"
 +#include "BKE_gpencil_modifier.h"
  #include "BKE_idcode.h"
  #include "BKE_idprop.h"
 +#include "BKE_layer.h"
  #include "BKE_library.h"
 +#include "BKE_library_override.h"
  #include "BKE_linestyle.h"
  #include "BKE_main.h"
  #include "BKE_modifier.h"
@@@ -1622,371 -1165,8 +1625,322 @@@ uiLayout *uiTemplateModifier(uiLayout *
  	return NULL;
  }
  
 +/************************ Grease Pencil Modifier Template *************************/
 +
 +static uiLayout *gpencil_draw_modifier(
 +        uiLayout *layout, Object *ob,
 +        GpencilModifierData *md)
 +{
 +	const GpencilModifierTypeInfo *mti = BKE_gpencil_modifierType_getInfo(md->type);
 +	PointerRNA ptr;
 +	uiBlock *block;
 +	uiLayout *box, *column, *row, *sub;
 +	uiLayout *result = NULL;
 +
 +	/* create RNA pointer */
 +	RNA_pointer_create(&ob->id, &RNA_GpencilModifier, md, &ptr);
 +
 +	column = uiLayoutColumn(layout, true);
 +	uiLayoutSetContextPointer(column, "modifier", &ptr);
 +
 +	/* rounded header ------------------------------------------------------------------- */
 +	box = uiLayoutBox(column);
 +
 +	row = uiLayoutRow(box, false);
 +	block = uiLayoutGetBlock(row);
 +
 +	UI_block_emboss_set(block, UI_EMBOSS_NONE);
 +	/* Open/Close .................................  */
 +	uiItemR(row, &ptr, "show_expanded", 0, "", ICON_NONE);
 +
 +	/* modifier-type icon */
 +	uiItemL(row, "", RNA_struct_ui_icon(ptr.type));
 +	UI_block_emboss_set(block, UI_EMBOSS);
 +
 +	/* modifier name */
 +	if (mti->isDisabled && mti->isDisabled(md, 0)) {
 +		uiLayoutSetRedAlert(row, true);
 +	}
 +	uiItemR(row, &ptr, "name", 0, "", ICON_NONE);
 +	uiLayoutSetRedAlert(row, false);
 +
 +	/* mode enabling buttons */
 +	UI_block_align_begin(block);
 +	uiItemR(row, &ptr, "show_render", 0, "", ICON_NONE);
 +	uiItemR(row, &ptr, "show_viewport", 0, "", ICON_NONE);
 +
 +	if (mti->flags & eGpencilModifierTypeFlag_SupportsEditmode) {
 +		sub = uiLayoutRow(row, true);
 +		uiLayoutSetActive(sub, false);
 +		uiItemR(sub, &ptr, "show_in_editmode", 0, "", ICON_NONE);
 +	}
 +
 +	UI_block_align_end(block);
 +
 +	/* Up/Down + Delete ........................... */
 +	UI_block_align_begin(block);
 +	uiItemO(row, "", ICON_TRIA_UP, "OBJECT_OT_gpencil_modifier_move_up");
 +	uiItemO(row, "", ICON_TRIA_DOWN, "OBJECT_OT_gpencil_modifier_move_down");
 +	UI_block_align_end(block);
 +
 +	UI_block_emboss_set(block, UI_EMBOSS_NONE);
 +	uiItemO(row, "", ICON_X, "OBJECT_OT_gpencil_modifier_remove");
 +	UI_block_emboss_set(block, UI_EMBOSS);
 +
 +	/* modifier settings (under the header) --------------------------------------------------- */
 +	if (md->mode & eGpencilModifierMode_Expanded) {
 +		/* apply/convert/copy */
 +		box = uiLayoutBox(column);
 +		row = uiLayoutRow(box, false);
 +
 +		/* only here obdata, the rest of modifiers is ob level */
 +		UI_block_lock_set(block, BKE_object_obdata_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
 +
 +		uiLayoutSetOperatorContext(row, WM_OP_INVOKE_DEFAULT);
 +
 +		sub = uiLayoutRow(row, false);
 +		if (mti->flags & eGpencilModifierTypeFlag_NoApply) {
 +			uiLayoutSetEnabled(sub, false);
 +		}
 +		uiItemEnumO(sub, "OBJECT_OT_gpencil_modifier_apply", CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"),
 +		            0, "apply_as", MODIFIER_APPLY_DATA);
 +		uiItemO(row, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy"), ICON_NONE,
 +		        "OBJECT_OT_gpencil_modifier_copy");
 +
 +		/* result is the layout block inside the box,
 +		 * that we return so that modifier settings can be drawn */
 +		result = uiLayoutColumn(box, false);
 +		block = uiLayoutAbsoluteBlock(box);
 +	}
 +
 +	/* error messages */
 +	if (md->error) {
 +		box = uiLayoutBox(column);
 +		row = uiLayoutRow(box, false);
 +		uiItemL(row, md->error, ICON_ERROR);
 +	}
 +
 +	return result;
 +}
 +
 +uiLayout *uiTemplateGpencilModifier(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
 +{
 +	Object *ob;
 +	GpencilModifierData *md, *vmd;
 +	int i;
 +
 +	/* verify we have valid data */
 +	if (!RNA_struct_is_a(ptr->type, &RNA_GpencilModifier)) {
 +		RNA_warning("Expected modifier on object");
 +		return NULL;
 +	}
 +
 +	ob = ptr->id.data;
 +	md = ptr->data;
 +
 +	if (!ob || !(GS(ob->id.name) == ID_OB)) {
 +		RNA_warning("Expected modifier on object");
 +		return NULL;
 +	}
 +
 +	UI_block_lock_set(uiLayoutGetBlock(layout), (ob && ID_IS_LINKED(ob)), ERROR_LIBDATA_MESSAGE);
 +
 +	/* find modifier and draw it */
 +	vmd = ob->greasepencil_modifiers.first;
 +	for (i = 0; vmd; i++, vmd = vmd->next) {
 +		if (md == vmd) {
 +			return gpencil_draw_modifier(layout, ob, md);
 +		}
 +	}
 +
 +	return NULL;
 +}
 +
 +/************************ Shader FX Template *************************/
 +
 +static uiLayout *gpencil_draw_shaderfx(
 +        uiLayout *layout, Object *ob,
 +        ShaderFxData *md)
 +{
 +	const ShaderFxTypeInfo *mti = BKE_shaderfxType_getInfo(md->type);
 +	PointerRNA ptr;
 +	uiBlock *block;
 +	uiLayout *box, *column, *row, *sub;
 +	uiLayout *result = NULL;
 +
 +	/* create RNA pointer */
 +	RNA_pointer_create(&ob->id, &RNA_ShaderFx, md, &ptr);
 +
 +	column = uiLayoutColumn(layout, true);
 +	uiLayoutSetContextPointer(column, "shaderfx", &ptr);
 +
 +	/* rounded header ------------------------------------------------------------------- */
 +	box = uiLayoutBox(column);
 +
 +	row = uiLayoutRow(box, false);
 +	block = uiLayoutGetBlock(row);
 +
 +	UI_block_emboss_set(block, UI_EMBOSS_NONE);
 +	/* Open/Close .................................  */
 +	uiItemR(row, &ptr, "show_expanded", 0, "", ICON_NONE);
 +
 +	/* shader-type icon */
 +	uiItemL(row, "", RNA_struct_ui_icon(ptr.type));
 +	UI_block_emboss_set(block, UI_EMBOSS);
 +
 +	/* effect name */
 +	if (mti->isDisabled && mti->isDisabled(md, 0)) {
 +		uiLayoutSetRedAlert(row, true);
 +	}
 +	uiItemR(row, &ptr, "name", 0, "", ICON_NONE);
 +	uiLayoutSetRedAlert(row, false);
 +
 +	/* mode enabling buttons */
 +	UI_block_align_begin(block);
 +	uiItemR(row, &ptr, "show_render", 0, "", ICON_NONE);
 +	uiItemR(row, &ptr, "show_viewport", 0, "", ICON_NONE);
 +
 +	if (mti->flags & eShaderFxTypeFlag_SupportsEditmode) {
 +		sub = uiLayoutRow(row, true);
 +		uiLayoutSetActive(sub, false);
 +		uiItemR(sub, &ptr, "show_in_editmode", 0, "", ICON_NONE);
 +	}
 +
 +	UI_block_align_end(block);
 +
 +	/* Up/Down + Delete ........................... */
 +	UI_block_align_begin(block);
 +	uiItemO(row, "", ICON_TRIA_UP, "OBJECT_OT_shaderfx_move_up");
 +	uiItemO(row, "", ICON_TRIA_DOWN, "OBJECT_OT_shaderfx_move_down");
 +	UI_block_align_end(block);
 +
 +	UI_block_emboss_set(block, UI_EMBOSS_NONE);
 +	uiItemO(row, "", ICON_X, "OBJECT_OT_shaderfx_remove");
 +	UI_block_emboss_set(block, UI_EMBOSS);
 +
 +	/* effect settings (under the header) --------------------------------------------------- */
 +	if (md->mode & eShaderFxMode_Expanded) {
 +		/* apply/convert/copy */
 +		box = uiLayoutBox(column);
 +		row = uiLayoutRow(box, false);
 +
 +		/* only here obdata, the rest of effect is ob level */
 +		UI_block_lock_set(block, BKE_object_obdata_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
 +
 +		/* result is the layout block inside the box,
 +		 * that we return so that effect settings can be drawn */
 +		result = uiLayoutColumn(box, false);
 +		block = uiLayoutAbsoluteBlock(box);
 +	}
 +
 +	/* error messages */
 +	if (md->error) {
 +		box = uiLayoutBox(column);
 +		row = uiLayoutRow(box, false);
 +		uiItemL(row, md->error, ICON_ERROR);
 +	}
 +
 +	return result;
 +}
 +
 +uiLayout *uiTemplateShaderFx(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
 +{
 +	Object *ob;
 +	ShaderFxData *fx, *vfx;
 +	int i;
 +
 +	/* verify we have valid data */
 +	if (!RNA_struct_is_a(ptr->type, &RNA_ShaderFx)) {
 +		RNA_warning("Expected shader fx on object");
 +		return NULL;
 +	}
 +
 +	ob = ptr->id.data;
 +	fx = ptr->data;
 +
 +	if (!ob || !(GS(ob->id.name) == ID_OB)) {
 +		RNA_warning("Expected shader fx on object");
 +		return NULL;
 +	}
 +
 +	UI_block_lock_set(uiLayoutGetBlock(layout), (ob && ID_IS_LINKED(ob)), ERROR_LIBDATA_MESSAGE);
 +
 +	/* find modifier and draw it */
 +	vfx = ob->shader_fx.first;
 +	for (i = 0; vfx; i++, vfx = vfx->next) {
 +		if (fx == vfx) {
 +			return gpencil_draw_shaderfx(layout, ob, fx);
 +		}
 +	}
 +
 +	return NULL;
 +}
 +
 +/************************ Redo Buttons Template *************************/
 +
 +static void template_operator_redo_property_buts_draw(
 +        const bContext *C, wmOperator *op,
 +        uiLayout *layout, int layout_flags,
 +        bool *r_has_advanced)
 +{
 +	if (op->type->flag & OPTYPE_MACRO) {
 +		for (wmOperator *macro_op = op->macro.first; macro_op; macro_op = macro_op->next) {
 +			template_operator_redo_property_buts_draw(C, macro_op, layout, layout_flags, r_has_advanced);
 +		}
 +	}
 +	else {
 +		/* Might want to make label_align adjustable somehow. */
 +		eAutoPropButsReturn return_info = uiTemplateOperatorPropertyButs(
 +		        C, layout, op,
 +		        UI_BUT_LABEL_ALIGN_NONE,
 +		        layout_flags);
 +		if (return_info & UI_PROP_BUTS_ANY_FAILED_CHECK) {
 +			if (r_has_advanced) {
 +				*r_has_advanced = true;
 +			}
 +		}
 +	}
 +}
 +
 +void uiTemplateOperatorRedoProperties(uiLayout *layout, const bContext *C)
 +{
 +	wmOperator *op = WM_operator_last_redo(C);
 +	uiBlock *block = uiLayoutGetBlock(layout);
 +
 +	if (op == NULL) {
 +		return;
 +	}
 +
 +	/* Disable for now, doesn't fit well in popover. */
 +#if 0
 +	/* Repeat button with operator name as text. */
 +	uiItemFullO(layout, "SCREEN_OT_repeat_last", RNA_struct_ui_name(op->type->srna),
 +	            ICON_NONE, NULL, WM_OP_INVOKE_DEFAULT, 0, NULL);
 +#endif
 +
 +	if (WM_operator_repeat_check(C, op)) {
 +		int layout_flags = 0;
 +		if (block->panel == NULL) {
 +			layout_flags = UI_TEMPLATE_OP_PROPS_SHOW_TITLE;
 +		}
 +#i

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list