This repository has been archived on 2023-10-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
blender-archive/source/blender/shader_fx/intern/FX_shader_wave.c
Falk David df0c2693b6 Refactor: Rename grease pencil files to legacy
This renames the `BKE_gpencil_*` as well as the `DNA_gpencil_types.h`
files to indicate that it's the legacy grease pencil.

Pull Request: blender/blender#105597
2023-03-13 10:42:51 +01:00

82 lines
1.8 KiB
C

/* SPDX-License-Identifier: GPL-2.0-or-later
* Copyright 2018 Blender Foundation. */
/** \file
* \ingroup shader_fx
*/
#include <stdio.h>
#include "DNA_gpencil_legacy_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "BKE_context.h"
#include "BKE_screen.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "RNA_access.h"
#include "FX_shader_types.h"
#include "FX_ui_common.h"
static void initData(ShaderFxData *fx)
{
WaveShaderFxData *gpfx = (WaveShaderFxData *)fx;
gpfx->amplitude = 10.0f;
gpfx->period = 20.0f;
gpfx->phase = 0.0f;
gpfx->orientation = 1;
}
static void copyData(const ShaderFxData *md, ShaderFxData *target)
{
BKE_shaderfx_copydata_generic(md, target);
}
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = shaderfx_panel_get_property_pointers(panel, NULL);
uiLayoutSetPropSep(layout, true);
uiItemR(layout, ptr, "orientation", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
uiItemR(layout, ptr, "amplitude", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "period", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "phase", 0, NULL, ICON_NONE);
shaderfx_panel_end(layout, ptr);
}
static void panelRegister(ARegionType *region_type)
{
shaderfx_panel_register(region_type, eShaderFxType_Wave, panel_draw);
}
ShaderFxTypeInfo shaderfx_Type_Wave = {
/*name*/ N_("WaveDistortion"),
/*structName*/ "WaveShaderFxData",
/*structSize*/ sizeof(WaveShaderFxData),
/*type*/ eShaderFxType_GpencilType,
/*flags*/ 0,
/*copyData*/ copyData,
/*initData*/ initData,
/*freeData*/ NULL,
/*isDisabled*/ NULL,
/*updateDepsgraph*/ NULL,
/*dependsOnTime*/ NULL,
/*foreachIDLink*/ NULL,
/*panelRegister*/ panelRegister,
};