UI: Drag and Drop Modifiers, Layout Updates
This patch implements the list panel system D7490 for modifiers. It also moves modifier drawing to a callback in ModifierTypeInfo in line with the extensible architecture refactoring goal T75724. This adds a PanelRegister callback and utilities for registering panels and subpanels. It also adds the callbacks for expansion saving and drag and drop reordering described in D7490. These utilities, callbacks, and other common UI elements shared between modifiers live in MOD_ui_common.c. Because modifier buttons are now in panels, we can make use of subpanels for organization. The UI layouts also use the single column layout style consistently used elsewhere in Blender. Additionally, the mode-setting buttons are aligned and ordered consistently with the outliner. However, the large number of UI changes in this patch may mean that additional polishing is required in master. Thanks to William Reynish (@billreynish) who did a fair amount of the layout work and to Julian Eisel (@Severin) for consistent help. Differential Revision: https://developer.blender.org/D7498
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -28,6 +28,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct ARegionType;
|
||||
struct BMEditMesh;
|
||||
struct CustomData_MeshMasks;
|
||||
struct DepsNodeHandle;
|
||||
@@ -351,13 +352,22 @@ typedef struct ModifierTypeInfo {
|
||||
* more like "ensure the data is freed".
|
||||
*/
|
||||
void (*freeRuntimeData)(void *runtime_data);
|
||||
|
||||
/* Register the panel types for the modifier's UI. */
|
||||
void (*panelRegister)(struct ARegionType *region_type);
|
||||
} ModifierTypeInfo;
|
||||
|
||||
/* Used to find a modifier's panel type. */
|
||||
#define MODIFIER_TYPE_PANEL_PREFIX "MOD_PT_"
|
||||
|
||||
/* Initialize modifier's global data (type info and some common global storages). */
|
||||
void BKE_modifier_init(void);
|
||||
|
||||
const ModifierTypeInfo *BKE_modifier_get_info(ModifierType type);
|
||||
|
||||
/* For modifier UI panels. */
|
||||
void BKE_modifier_type_panel_id(ModifierType type, char *r_idname);
|
||||
|
||||
/* Modifier utility calls, do call through type pointer and return
|
||||
* default values if pointer is optional.
|
||||
*/
|
||||
|
||||
@@ -116,6 +116,17 @@ const ModifierTypeInfo *BKE_modifier_get_info(ModifierType type)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the idname of the modifier type's panel, which was defined in the #panelRegister callback.
|
||||
*/
|
||||
void BKE_modifier_type_panel_id(ModifierType type, char *r_idname)
|
||||
{
|
||||
const ModifierTypeInfo *mti = BKE_modifier_get_info(type);
|
||||
|
||||
strcpy(r_idname, MODIFIER_TYPE_PANEL_PREFIX);
|
||||
strcat(r_idname, mti->name);
|
||||
}
|
||||
|
||||
/***/
|
||||
|
||||
ModifierData *BKE_modifier_new(int type)
|
||||
@@ -127,8 +138,9 @@ ModifierData *BKE_modifier_new(int type)
|
||||
BLI_strncpy(md->name, DATA_(mti->name), sizeof(md->name));
|
||||
|
||||
md->type = type;
|
||||
md->mode = eModifierMode_Realtime | eModifierMode_Render | eModifierMode_Expanded;
|
||||
md->mode = eModifierMode_Realtime | eModifierMode_Render;
|
||||
md->flag = eModifierFlag_OverrideLibrary_Local;
|
||||
md->ui_expand_flag = 1; /* Only open the main panel at the beginning, not the subpanels. */
|
||||
|
||||
if (mti->flags & eModifierTypeFlag_EnableInEditmode) {
|
||||
md->mode |= eModifierMode_Editmode;
|
||||
@@ -342,6 +354,7 @@ void BKE_modifier_copydata_ex(ModifierData *md, ModifierData *target, const int
|
||||
|
||||
target->mode = md->mode;
|
||||
target->flag = md->flag;
|
||||
target->ui_expand_flag = md->ui_expand_flag;
|
||||
|
||||
if (mti->copyData) {
|
||||
mti->copyData(md, target, flag);
|
||||
|
||||
@@ -266,5 +266,18 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
*/
|
||||
{
|
||||
/* Keep this block, even when empty. */
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "ModifierData", "short", "ui_expand_flag")) {
|
||||
for (Object *object = bmain->objects.first; object != NULL; object = object->id.next) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
|
||||
if (md->mode & eModifierMode_Expanded_DEPRECATED) {
|
||||
md->ui_expand_flag = 1;
|
||||
}
|
||||
else {
|
||||
md->ui_expand_flag = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -370,12 +370,17 @@ bool ED_object_modifier_remove(struct ReportList *reports,
|
||||
struct Object *ob,
|
||||
struct ModifierData *md);
|
||||
void ED_object_modifier_clear(struct Main *bmain, struct Object *ob);
|
||||
int ED_object_modifier_move_down(struct ReportList *reports,
|
||||
struct Object *ob,
|
||||
struct ModifierData *md);
|
||||
int ED_object_modifier_move_up(struct ReportList *reports,
|
||||
struct Object *ob,
|
||||
struct ModifierData *md);
|
||||
bool ED_object_modifier_move_down(struct ReportList *reports,
|
||||
struct Object *ob,
|
||||
struct ModifierData *md);
|
||||
bool ED_object_modifier_move_up(struct ReportList *reports,
|
||||
struct Object *ob,
|
||||
struct ModifierData *md);
|
||||
bool ED_object_modifier_move_to_index(struct ReportList *reports,
|
||||
struct Object *ob,
|
||||
struct ModifierData *md,
|
||||
const int index);
|
||||
|
||||
int ED_object_modifier_convert(struct ReportList *reports,
|
||||
struct Main *bmain,
|
||||
struct Depsgraph *depsgraph,
|
||||
|
||||
@@ -2002,7 +2002,7 @@ void uiTemplatePathBuilder(uiLayout *layout,
|
||||
const char *propname,
|
||||
struct PointerRNA *root_ptr,
|
||||
const char *text);
|
||||
uiLayout *uiTemplateModifier(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr);
|
||||
void uiTemplateModifiers(uiLayout *layout, struct bContext *C);
|
||||
uiLayout *uiTemplateGpencilModifier(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr);
|
||||
void uiTemplateGpencilColorPreview(uiLayout *layout,
|
||||
struct bContext *C,
|
||||
|
||||
@@ -1816,360 +1816,50 @@ void uiTemplatePathBuilder(uiLayout *layout,
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Modifier Template
|
||||
/** \name Modifiers Template
|
||||
*
|
||||
* Template for building the panel layout for the active object's modifiers.
|
||||
* \{ */
|
||||
|
||||
#define ERROR_LIBDATA_MESSAGE TIP_("Can't edit external library data")
|
||||
|
||||
static void modifiers_convertToReal(bContext *C, void *ob_v, void *md_v)
|
||||
static void modifier_panel_id(void *md_link, char *r_name)
|
||||
{
|
||||
Object *ob = ob_v;
|
||||
ModifierData *md = md_v;
|
||||
ModifierData *nmd = BKE_modifier_new(md->type);
|
||||
|
||||
BKE_modifier_copydata(md, nmd);
|
||||
nmd->mode &= ~eModifierMode_Virtual;
|
||||
|
||||
BLI_addhead(&ob->modifiers, nmd);
|
||||
|
||||
BKE_modifier_unique_name(&ob->modifiers, nmd);
|
||||
|
||||
ob->partype = PAROBJECT;
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
|
||||
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
|
||||
|
||||
ED_undo_push(C, "Modifier convert to real");
|
||||
ModifierData *md = (ModifierData *)md_link;
|
||||
BKE_modifier_type_panel_id(md->type, r_name);
|
||||
}
|
||||
|
||||
static bool modifier_can_delete(ModifierData *md)
|
||||
void uiTemplateModifiers(uiLayout *UNUSED(layout), bContext *C)
|
||||
{
|
||||
/* fluid particle modifier can't be deleted here */
|
||||
if (md->type == eModifierType_ParticleSystem) {
|
||||
short particle_type = ((ParticleSystemModifierData *)md)->psys->part->type;
|
||||
if (ELEM(particle_type,
|
||||
PART_FLUID,
|
||||
PART_FLUID_FLIP,
|
||||
PART_FLUID_FOAM,
|
||||
PART_FLUID_SPRAY,
|
||||
PART_FLUID_BUBBLE,
|
||||
PART_FLUID_TRACER,
|
||||
PART_FLUID_SPRAYFOAM,
|
||||
PART_FLUID_SPRAYBUBBLE,
|
||||
PART_FLUID_FOAMBUBBLE,
|
||||
PART_FLUID_SPRAYFOAMBUBBLE)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
|
||||
/* Check whether Modifier is a simulation or not,
|
||||
* this is used for switching to the physics/particles context tab */
|
||||
static int modifier_is_simulation(ModifierData *md)
|
||||
{
|
||||
/* Physic Tab */
|
||||
if (ELEM(md->type,
|
||||
eModifierType_Cloth,
|
||||
eModifierType_Collision,
|
||||
eModifierType_Fluidsim,
|
||||
eModifierType_Fluid,
|
||||
eModifierType_Softbody,
|
||||
eModifierType_Surface,
|
||||
eModifierType_DynamicPaint)) {
|
||||
return 1;
|
||||
}
|
||||
/* Particle Tab */
|
||||
else if (md->type == eModifierType_ParticleSystem) {
|
||||
return 2;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static uiLayout *draw_modifier(uiLayout *layout,
|
||||
Scene *scene,
|
||||
Object *ob,
|
||||
ModifierData *md,
|
||||
int index,
|
||||
int cageIndex,
|
||||
int lastCageIndex)
|
||||
{
|
||||
const ModifierTypeInfo *mti = BKE_modifier_get_info(md->type);
|
||||
PointerRNA ptr;
|
||||
uiBut *but;
|
||||
uiBlock *block;
|
||||
uiLayout *box, *column, *row, *sub;
|
||||
uiLayout *result = NULL;
|
||||
int isVirtual = (md->mode & eModifierMode_Virtual);
|
||||
char str[128];
|
||||
|
||||
/* create RNA pointer */
|
||||
RNA_pointer_create(&ob->id, &RNA_Modifier, md, &ptr);
|
||||
|
||||
column = uiLayoutColumn(layout, true);
|
||||
uiLayoutSetContextPointer(column, "modifier", &ptr);
|
||||
|
||||
/* rounded header ------------------------------------------------------------------- */
|
||||
box = uiLayoutBox(column);
|
||||
|
||||
if (isVirtual) {
|
||||
row = uiLayoutRow(box, false);
|
||||
uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_EXPAND);
|
||||
block = uiLayoutGetBlock(row);
|
||||
/* VIRTUAL MODIFIER */
|
||||
/* XXX this is not used now, since these cannot be accessed via RNA */
|
||||
BLI_snprintf(str, sizeof(str), IFACE_("%s parent deform"), md->name);
|
||||
uiDefBut(block,
|
||||
UI_BTYPE_LABEL,
|
||||
0,
|
||||
str,
|
||||
0,
|
||||
0,
|
||||
185,
|
||||
UI_UNIT_Y,
|
||||
NULL,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
TIP_("Modifier name"));
|
||||
|
||||
but = uiDefBut(block,
|
||||
UI_BTYPE_BUT,
|
||||
0,
|
||||
IFACE_("Make Real"),
|
||||
0,
|
||||
0,
|
||||
80,
|
||||
16,
|
||||
NULL,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
TIP_("Convert virtual modifier to a real modifier"));
|
||||
UI_but_func_set(but, modifiers_convertToReal, ob, md);
|
||||
}
|
||||
else {
|
||||
/* REAL MODIFIER */
|
||||
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(scene, md, 0)) {
|
||||
uiLayoutSetRedAlert(row, true);
|
||||
}
|
||||
uiItemR(row, &ptr, "name", 0, "", ICON_NONE);
|
||||
uiLayoutSetRedAlert(row, false);
|
||||
|
||||
/* mode enabling buttons */
|
||||
UI_block_align_begin(block);
|
||||
/* Collision and Surface are always enabled, hide buttons! */
|
||||
if (((md->type != eModifierType_Collision) || !(ob->pd && ob->pd->deflect)) &&
|
||||
(md->type != eModifierType_Surface)) {
|
||||
uiItemR(row, &ptr, "show_render", 0, "", ICON_NONE);
|
||||
uiItemR(row, &ptr, "show_viewport", 0, "", ICON_NONE);
|
||||
|
||||
if (mti->flags & eModifierTypeFlag_SupportsEditmode) {
|
||||
sub = uiLayoutRow(row, true);
|
||||
if (!(md->mode & eModifierMode_Realtime)) {
|
||||
uiLayoutSetActive(sub, false);
|
||||
}
|
||||
uiItemR(sub, &ptr, "show_in_editmode", 0, "", ICON_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
if (ob->type == OB_MESH) {
|
||||
if (BKE_modifier_supports_cage(scene, md) && (index <= lastCageIndex)) {
|
||||
sub = uiLayoutRow(row, true);
|
||||
if (index < cageIndex || !BKE_modifier_couldbe_cage(scene, md)) {
|
||||
uiLayoutSetActive(sub, false);
|
||||
}
|
||||
uiItemR(sub, &ptr, "show_on_cage", 0, "", ICON_NONE);
|
||||
}
|
||||
} /* tessellation point for curve-typed objects */
|
||||
else if (ELEM(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
|
||||
/* some modifiers could work with pre-tessellated curves only */
|
||||
if (ELEM(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_MeshDeform)) {
|
||||
/* add disabled pre-tessellated button, so users could have
|
||||
* message for this modifiers */
|
||||
but = uiDefIconButBitI(block,
|
||||
UI_BTYPE_TOGGLE,
|
||||
eModifierMode_ApplyOnSpline,
|
||||
0,
|
||||
ICON_SURFACE_DATA,
|
||||
0,
|
||||
0,
|
||||
UI_UNIT_X - 2,
|
||||
UI_UNIT_Y,
|
||||
&md->mode,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
TIP_("This modifier can only be applied on splines' points"));
|
||||
UI_but_flag_enable(but, UI_BUT_DISABLED);
|
||||
}
|
||||
else if (mti->type != eModifierTypeType_Constructive) {
|
||||
/* constructive modifiers tessellates curve before applying */
|
||||
uiItemR(row, &ptr, "use_apply_on_spline", 0, "", ICON_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
UI_block_align_end(block);
|
||||
|
||||
/* Up/Down + Delete ........................... */
|
||||
UI_block_align_begin(block);
|
||||
uiItemO(row, "", ICON_TRIA_UP, "OBJECT_OT_modifier_move_up");
|
||||
uiItemO(row, "", ICON_TRIA_DOWN, "OBJECT_OT_modifier_move_down");
|
||||
UI_block_align_end(block);
|
||||
|
||||
UI_block_emboss_set(block, UI_EMBOSS_NONE);
|
||||
/* When Modifier is a simulation,
|
||||
* show button to switch to context rather than the delete button. */
|
||||
if (modifier_can_delete(md) && !modifier_is_simulation(md)) {
|
||||
uiItemO(row, "", ICON_X, "OBJECT_OT_modifier_remove");
|
||||
}
|
||||
else if (modifier_is_simulation(md) == 1) {
|
||||
uiItemStringO(
|
||||
row, "", ICON_PROPERTIES, "WM_OT_properties_context_change", "context", "PHYSICS");
|
||||
}
|
||||
else if (modifier_is_simulation(md) == 2) {
|
||||
uiItemStringO(
|
||||
row, "", ICON_PROPERTIES, "WM_OT_properties_context_change", "context", "PARTICLES");
|
||||
}
|
||||
UI_block_emboss_set(block, UI_EMBOSS);
|
||||
}
|
||||
|
||||
/* modifier settings (under the header) --------------------------------------------------- */
|
||||
if (!isVirtual && (md->mode & eModifierMode_Expanded)) {
|
||||
/* apply/convert/copy */
|
||||
box = uiLayoutBox(column);
|
||||
row = uiLayoutRow(box, false);
|
||||
|
||||
if (!ELEM(md->type, eModifierType_Collision, eModifierType_Surface)) {
|
||||
/* only here obdata, the rest of modifiers is ob level */
|
||||
UI_block_lock_set(block, BKE_object_obdata_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
|
||||
|
||||
if (md->type == eModifierType_ParticleSystem) {
|
||||
ParticleSystem *psys = ((ParticleSystemModifierData *)md)->psys;
|
||||
|
||||
if (!(ob->mode & OB_MODE_PARTICLE_EDIT)) {
|
||||
if (ELEM(psys->part->ren_as, PART_DRAW_GR, PART_DRAW_OB)) {
|
||||
uiItemO(row,
|
||||
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Convert"),
|
||||
ICON_NONE,
|
||||
"OBJECT_OT_duplicates_make_real");
|
||||
}
|
||||
else if (psys->part->ren_as == PART_DRAW_PATH) {
|
||||
uiItemO(row,
|
||||
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Convert"),
|
||||
ICON_NONE,
|
||||
"OBJECT_OT_modifier_convert");
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
uiLayoutSetOperatorContext(row, WM_OP_INVOKE_DEFAULT);
|
||||
uiItemEnumO(row,
|
||||
"OBJECT_OT_modifier_apply",
|
||||
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"),
|
||||
0,
|
||||
"apply_as",
|
||||
MODIFIER_APPLY_DATA);
|
||||
|
||||
if (BKE_modifier_is_same_topology(md) && !BKE_modifier_is_non_geometrical(md)) {
|
||||
uiItemEnumO(row,
|
||||
"OBJECT_OT_modifier_apply",
|
||||
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply as Shape Key"),
|
||||
0,
|
||||
"apply_as",
|
||||
MODIFIER_APPLY_SHAPE);
|
||||
}
|
||||
}
|
||||
|
||||
UI_block_lock_clear(block);
|
||||
UI_block_lock_set(block, ob && ID_IS_LINKED(ob), ERROR_LIBDATA_MESSAGE);
|
||||
|
||||
if (!ELEM(md->type,
|
||||
eModifierType_Fluidsim,
|
||||
eModifierType_Softbody,
|
||||
eModifierType_ParticleSystem,
|
||||
eModifierType_Cloth,
|
||||
eModifierType_Fluid)) {
|
||||
uiItemO(row,
|
||||
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy"),
|
||||
ICON_NONE,
|
||||
"OBJECT_OT_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 *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Object *ob;
|
||||
ModifierData *md, *vmd;
|
||||
VirtualModifierData virtualModifierData;
|
||||
int i, lastCageIndex, cageIndex;
|
||||
|
||||
/* verify we have valid data */
|
||||
if (!RNA_struct_is_a(ptr->type, &RNA_Modifier)) {
|
||||
RNA_warning("Expected modifier on object");
|
||||
return NULL;
|
||||
SpaceProperties *sbuts = CTX_wm_space_properties(C);
|
||||
if (sbuts != NULL && (sbuts->pinid != NULL) && GS(sbuts->pinid->name) == ID_OB) {
|
||||
ob = (Object *)sbuts->pinid;
|
||||
}
|
||||
|
||||
ob = (Object *)ptr->owner_id;
|
||||
md = ptr->data;
|
||||
|
||||
if (!ob || !(GS(ob->id.name) == ID_OB)) {
|
||||
RNA_warning("Expected modifier on object");
|
||||
return NULL;
|
||||
else {
|
||||
ob = CTX_data_active_object(C);
|
||||
}
|
||||
ListBase *modifiers = &ob->modifiers;
|
||||
|
||||
UI_block_lock_set(uiLayoutGetBlock(layout), (ob && ID_IS_LINKED(ob)), ERROR_LIBDATA_MESSAGE);
|
||||
bool panels_match = UI_panel_list_matches_data(region, modifiers, modifier_panel_id);
|
||||
|
||||
/* find modifier and draw it */
|
||||
cageIndex = BKE_modifiers_get_cage_index(scene, ob, &lastCageIndex, 0);
|
||||
if (!panels_match) {
|
||||
UI_panels_free_instanced(C, region);
|
||||
ModifierData *md = modifiers->first;
|
||||
for (int i = 0; md; i++, md = md->next) {
|
||||
const ModifierTypeInfo *mti = BKE_modifier_get_info(md->type);
|
||||
if (mti->panelRegister) {
|
||||
char panel_idname[MAX_NAME];
|
||||
modifier_panel_id(md, panel_idname);
|
||||
|
||||
/* XXX virtual modifiers are not accessible for python */
|
||||
vmd = BKE_modifiers_get_virtual_modifierlist(ob, &virtualModifierData);
|
||||
|
||||
for (i = 0; vmd; i++, vmd = vmd->next) {
|
||||
if (md == vmd) {
|
||||
return draw_modifier(layout, scene, ob, md, i, cageIndex, lastCageIndex);
|
||||
}
|
||||
else if (vmd->mode & eModifierMode_Virtual) {
|
||||
i--;
|
||||
Panel *new_panel = UI_panel_add_instanced(sa, region, ®ion->panels, panel_idname, i);
|
||||
if (new_panel != NULL) {
|
||||
UI_panel_set_expand_from_list_data(C, new_panel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
@@ -2178,6 +1868,8 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
||||
/** \name Grease Pencil Modifier Template
|
||||
* \{ */
|
||||
|
||||
#define ERROR_LIBDATA_MESSAGE TIP_("Can't edit external library data")
|
||||
|
||||
static uiLayout *gpencil_draw_modifier(uiLayout *layout, Object *ob, GpencilModifierData *md)
|
||||
{
|
||||
const GpencilModifierTypeInfo *mti = BKE_gpencil_modifier_get_info(md->type);
|
||||
|
||||
@@ -162,6 +162,7 @@ void OBJECT_OT_modifier_add(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_modifier_remove(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_modifier_move_up(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_modifier_move_down(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_modifier_move_to_index(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_modifier_apply(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_modifier_convert(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_modifier_copy(struct wmOperatorType *ot);
|
||||
|
||||
@@ -430,7 +430,7 @@ void ED_object_modifier_clear(Main *bmain, Object *ob)
|
||||
DEG_relations_tag_update(bmain);
|
||||
}
|
||||
|
||||
int ED_object_modifier_move_up(ReportList *reports, Object *ob, ModifierData *md)
|
||||
bool ED_object_modifier_move_up(ReportList *reports, Object *ob, ModifierData *md)
|
||||
{
|
||||
if (md->prev) {
|
||||
const ModifierTypeInfo *mti = BKE_modifier_get_info(md->type);
|
||||
@@ -440,18 +440,22 @@ int ED_object_modifier_move_up(ReportList *reports, Object *ob, ModifierData *md
|
||||
|
||||
if (nmti->flags & eModifierTypeFlag_RequiresOriginalData) {
|
||||
BKE_report(reports, RPT_WARNING, "Cannot move above a modifier requiring original data");
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
BLI_remlink(&ob->modifiers, md);
|
||||
BLI_insertlinkbefore(&ob->modifiers, md->prev, md);
|
||||
}
|
||||
else {
|
||||
BKE_report(reports, RPT_WARNING, "Cannot move modifier beyond the start of the list");
|
||||
return false;
|
||||
}
|
||||
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
int ED_object_modifier_move_down(ReportList *reports, Object *ob, ModifierData *md)
|
||||
bool ED_object_modifier_move_down(ReportList *reports, Object *ob, ModifierData *md)
|
||||
{
|
||||
if (md->next) {
|
||||
const ModifierTypeInfo *mti = BKE_modifier_get_info(md->type);
|
||||
@@ -461,15 +465,53 @@ int ED_object_modifier_move_down(ReportList *reports, Object *ob, ModifierData *
|
||||
|
||||
if (nmti->type != eModifierTypeType_OnlyDeform) {
|
||||
BKE_report(reports, RPT_WARNING, "Cannot move beyond a non-deforming modifier");
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
BLI_remlink(&ob->modifiers, md);
|
||||
BLI_insertlinkafter(&ob->modifiers, md->next, md);
|
||||
}
|
||||
else {
|
||||
BKE_report(reports, RPT_WARNING, "Cannot move modifier beyond the end of the list");
|
||||
return false;
|
||||
}
|
||||
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ED_object_modifier_move_to_index(ReportList *reports,
|
||||
Object *ob,
|
||||
ModifierData *md,
|
||||
const int index)
|
||||
{
|
||||
BLI_assert(md != NULL);
|
||||
BLI_assert(index >= 0);
|
||||
if (index >= BLI_listbase_count(&ob->modifiers)) {
|
||||
BKE_report(reports, RPT_WARNING, "Cannot move modifier beyond the end of the stack");
|
||||
return false;
|
||||
}
|
||||
|
||||
int md_index = BLI_findindex(&ob->modifiers, md);
|
||||
BLI_assert(md_index != -1);
|
||||
if (md_index < index) {
|
||||
/* Move modifier down in list. */
|
||||
for (; md_index < index; md_index++) {
|
||||
if (!ED_object_modifier_move_down(reports, ob, md)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Move modifier up in list. */
|
||||
for (; md_index > index; md_index--) {
|
||||
if (!ED_object_modifier_move_up(reports, ob, md)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int ED_object_modifier_convert(ReportList *UNUSED(reports),
|
||||
@@ -1179,6 +1221,60 @@ void OBJECT_OT_modifier_move_down(wmOperatorType *ot)
|
||||
|
||||
/** \} */
|
||||
|
||||
/* ------------------------------------------------------------------- */
|
||||
/** \name Move to Index Modifier Operator
|
||||
* \{ */
|
||||
|
||||
static bool modifier_move_to_index_poll(bContext *C)
|
||||
{
|
||||
return edit_modifier_poll(C);
|
||||
}
|
||||
|
||||
static int modifier_move_to_index_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = ED_object_active_context(C);
|
||||
ModifierData *md = edit_modifier_property_get(op, ob, 0);
|
||||
int index = RNA_int_get(op->ptr, "index");
|
||||
|
||||
if (!ED_object_modifier_move_to_index(op->reports, ob, md, index)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static int modifier_move_to_index_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
{
|
||||
if (edit_modifier_invoke_properties(C, op)) {
|
||||
return modifier_move_to_index_exec(C, op);
|
||||
}
|
||||
else {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
}
|
||||
|
||||
void OBJECT_OT_modifier_move_to_index(wmOperatorType *ot)
|
||||
{
|
||||
ot->name = "Move Active Modifier to Index";
|
||||
ot->description = "Move the active modifier to an index in the stack";
|
||||
ot->idname = "OBJECT_OT_modifier_move_to_index";
|
||||
|
||||
ot->invoke = modifier_move_to_index_invoke;
|
||||
ot->exec = modifier_move_to_index_exec;
|
||||
ot->poll = modifier_move_to_index_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
|
||||
edit_modifier_properties(ot);
|
||||
RNA_def_int(
|
||||
ot->srna, "index", 0, 0, INT_MAX, "Index", "The index to move the modifier to", 0, INT_MAX);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* ------------------------------------------------------------------- */
|
||||
/** \name Apply Modifier Operator
|
||||
* \{ */
|
||||
|
||||
@@ -130,6 +130,7 @@ void ED_operatortypes_object(void)
|
||||
WM_operatortype_append(OBJECT_OT_modifier_remove);
|
||||
WM_operatortype_append(OBJECT_OT_modifier_move_up);
|
||||
WM_operatortype_append(OBJECT_OT_modifier_move_down);
|
||||
WM_operatortype_append(OBJECT_OT_modifier_move_to_index);
|
||||
WM_operatortype_append(OBJECT_OT_modifier_apply);
|
||||
WM_operatortype_append(OBJECT_OT_modifier_convert);
|
||||
WM_operatortype_append(OBJECT_OT_modifier_copy);
|
||||
|
||||
@@ -30,8 +30,11 @@
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "DNA_modifier_types.h"
|
||||
|
||||
#include "ED_screen.h"
|
||||
#include "ED_space_api.h"
|
||||
#include "ED_view3d.h" /* To draw toolbar UI. */
|
||||
@@ -632,6 +635,15 @@ void ED_spacetype_buttons(void)
|
||||
#endif
|
||||
BLI_addhead(&st->regiontypes, art);
|
||||
|
||||
/* Register the panel types from modifiers. The actual panels are built per modifier rather than
|
||||
* per modifier type. */
|
||||
for (ModifierType i = 0; i < NUM_MODIFIER_TYPES; i++) {
|
||||
const ModifierTypeInfo *mti = BKE_modifier_get_info(i);
|
||||
if (mti != NULL && mti->panelRegister != NULL) {
|
||||
mti->panelRegister(art);
|
||||
}
|
||||
}
|
||||
|
||||
/* regions: header */
|
||||
art = MEM_callocN(sizeof(ARegionType), "spacetype buttons region");
|
||||
art->regionid = RGN_TYPE_HEADER;
|
||||
|
||||
@@ -103,7 +103,8 @@ typedef enum ModifierMode {
|
||||
eModifierMode_Render = (1 << 1),
|
||||
eModifierMode_Editmode = (1 << 2),
|
||||
eModifierMode_OnCage = (1 << 3),
|
||||
eModifierMode_Expanded = (1 << 4),
|
||||
/* Old modifier box expansion, just for versioning. */
|
||||
eModifierMode_Expanded_DEPRECATED = (1 << 4),
|
||||
eModifierMode_Virtual = (1 << 5),
|
||||
eModifierMode_ApplyOnSpline = (1 << 6),
|
||||
eModifierMode_DisableTemporary = (1u << 31),
|
||||
@@ -115,7 +116,8 @@ typedef struct ModifierData {
|
||||
int type, mode;
|
||||
int stackindex;
|
||||
short flag;
|
||||
char _pad[2];
|
||||
/* An "expand" bit for each of the modifier's (sub)panels. */
|
||||
short ui_expand_flag;
|
||||
/** MAX_NAME. */
|
||||
char name[64];
|
||||
|
||||
|
||||
@@ -2808,7 +2808,7 @@ static void rna_def_modifier_array(BlenderRNA *brna)
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
|
||||
/* PROP_TRANSLATION causes units to be used which we don't want */
|
||||
prop = RNA_def_property(srna, "relative_offset_displace", PROP_FLOAT, PROP_NONE);
|
||||
prop = RNA_def_property(srna, "relative_offset_displace", PROP_FLOAT, PROP_XYZ);
|
||||
RNA_def_property_float_sdna(prop, NULL, "scale");
|
||||
RNA_def_property_ui_text(
|
||||
prop,
|
||||
@@ -2824,7 +2824,8 @@ static void rna_def_modifier_array(BlenderRNA *brna)
|
||||
|
||||
prop = RNA_def_property(srna, "use_merge_vertices_cap", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_ARR_MERGEFINAL);
|
||||
RNA_def_property_ui_text(prop, "Merge Vertices", "Merge vertices in first and last duplicates");
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Merge End Vertices", "Merge vertices in first and last duplicates");
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "merge_threshold", PROP_FLOAT, PROP_DISTANCE);
|
||||
@@ -3356,7 +3357,7 @@ static void rna_def_modifier_cast(BlenderRNA *brna)
|
||||
prop = RNA_def_property(srna, "cast_type", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "type");
|
||||
RNA_def_property_enum_items(prop, prop_cast_type_items);
|
||||
RNA_def_property_ui_text(prop, "Cast Type", "Target object shape");
|
||||
RNA_def_property_ui_text(prop, "Shape", "Target object shape");
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
|
||||
@@ -3958,6 +3959,12 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem prop_affect_items[] = {
|
||||
{0, "EDGES", 0, "Edges", "Affect only edges"},
|
||||
{MOD_BEVEL_VERT, "VERTICES", 0, "Vertices", "Affect only vertices"},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
};
|
||||
|
||||
srna = RNA_def_struct(brna, "BevelModifier", "Modifier");
|
||||
RNA_def_struct_ui_text(
|
||||
srna, "Bevel Modifier", "Bevel modifier to make edges and vertices more rounded");
|
||||
@@ -3986,9 +3993,10 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Segments", "Number of segments for round edges/verts");
|
||||
RNA_def_property_update(prop, 0, "rna_BevelModifier_update_segments");
|
||||
|
||||
prop = RNA_def_property(srna, "use_only_vertices", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_BEVEL_VERT);
|
||||
RNA_def_property_ui_text(prop, "Only Vertices", "Bevel verts/corners, not edges");
|
||||
prop = RNA_def_property(srna, "affect", PROP_ENUM, PROP_NONE); /* as an enum */
|
||||
RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
|
||||
RNA_def_property_enum_items(prop, prop_affect_items);
|
||||
RNA_def_property_ui_text(prop, "Affect", "Affect edges or vertices");
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "limit_method", PROP_ENUM, PROP_NONE);
|
||||
@@ -4036,7 +4044,7 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
|
||||
RNA_def_property_int_sdna(prop, NULL, "mat");
|
||||
RNA_def_property_range(prop, -1, SHRT_MAX);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Material", "Material index of generated faces, -1 for automatic");
|
||||
prop, "Material Index", "Material index of generated faces, -1 for automatic");
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "loop_slide", PROP_BOOLEAN, PROP_NONE);
|
||||
@@ -4063,7 +4071,7 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
|
||||
RNA_def_property_enum_sdna(prop, NULL, "face_str_mode");
|
||||
RNA_def_property_enum_items(prop, prop_harden_normals_items);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Set Face Strength", "Whether to set face strength, and which faces to set it on");
|
||||
prop, "Face Strength", "Whether to set face strength, and which faces to set it on");
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "miter_outer", PROP_ENUM, PROP_NONE);
|
||||
@@ -4164,7 +4172,7 @@ static void rna_def_modifier_shrinkwrap(BlenderRNA *brna)
|
||||
prop = RNA_def_property(srna, "wrap_method", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "shrinkType");
|
||||
RNA_def_property_enum_items(prop, shrink_type_items);
|
||||
RNA_def_property_ui_text(prop, "Mode", "");
|
||||
RNA_def_property_ui_text(prop, "Wrap Method", "");
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
|
||||
|
||||
prop = RNA_def_property(srna, "wrap_mode", PROP_ENUM, PROP_NONE);
|
||||
@@ -4923,7 +4931,7 @@ static void rna_def_modifier_weightvg_mask(BlenderRNA *UNUSED(brna),
|
||||
|
||||
prop = RNA_def_property(srna, "mask_vertex_group", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "mask_defgrp_name");
|
||||
RNA_def_property_ui_text(prop, "Mask VGroup", "Masking vertex group name");
|
||||
RNA_def_property_ui_text(prop, "Mask Vertex Group", "Masking vertex group name");
|
||||
RNA_def_property_string_funcs(prop, NULL, NULL, mask_vgroup_setter);
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
|
||||
@@ -5422,7 +5430,7 @@ static void rna_def_modifier_remesh(BlenderRNA *brna)
|
||||
|
||||
prop = RNA_def_property(srna, "use_remove_disconnected", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_REMESH_FLOOD_FILL);
|
||||
RNA_def_property_ui_text(prop, "Remove Disconnected Pieces", "");
|
||||
RNA_def_property_ui_text(prop, "Remove Disconnected", "");
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_smooth_shade", PROP_BOOLEAN, PROP_NONE);
|
||||
@@ -5977,6 +5985,8 @@ static void rna_def_modifier_meshseqcache(BlenderRNA *brna)
|
||||
RNA_def_property_flag(prop, PROP_ENUM_FLAG);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "read_flag");
|
||||
RNA_def_property_enum_items(prop, read_flag_items);
|
||||
RNA_def_property_ui_text(prop, "Read Data", "Data to read from the cache");
|
||||
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
|
||||
RNA_define_lib_overridable(false);
|
||||
@@ -6161,7 +6171,7 @@ static void rna_def_modifier_datatransfer(BlenderRNA *brna)
|
||||
{DT_TYPE_MDEFORMVERT,
|
||||
"VGROUP_WEIGHTS",
|
||||
0,
|
||||
"Vertex Group(s)",
|
||||
"Vertex Groups",
|
||||
"Transfer active or all vertex groups"},
|
||||
# if 0 /* TODO */
|
||||
{DT_TYPE_SHAPEKEY, "SHAPEKEYS", 0, "Shapekey(s)", "Transfer active or all shape keys"},
|
||||
@@ -6178,19 +6188,15 @@ static void rna_def_modifier_datatransfer(BlenderRNA *brna)
|
||||
static const EnumPropertyItem DT_layer_edge_items[] = {
|
||||
{DT_TYPE_SHARP_EDGE, "SHARP_EDGE", 0, "Sharp", "Transfer sharp mark"},
|
||||
{DT_TYPE_SEAM, "SEAM", 0, "UV Seam", "Transfer UV seam mark"},
|
||||
{DT_TYPE_CREASE, "CREASE", 0, "Subsurf Crease", "Transfer crease values"},
|
||||
{DT_TYPE_CREASE, "CREASE", 0, "Crease", "Transfer subdivision crease values"},
|
||||
{DT_TYPE_BWEIGHT_EDGE, "BEVEL_WEIGHT_EDGE", 0, "Bevel Weight", "Transfer bevel weights"},
|
||||
{DT_TYPE_FREESTYLE_EDGE,
|
||||
"FREESTYLE_EDGE",
|
||||
0,
|
||||
"Freestyle Mark",
|
||||
"Transfer Freestyle edge mark"},
|
||||
{DT_TYPE_FREESTYLE_EDGE, "FREESTYLE_EDGE", 0, "Freestyle", "Transfer Freestyle edge mark"},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem DT_layer_loop_items[] = {
|
||||
{DT_TYPE_LNOR, "CUSTOM_NORMAL", 0, "Custom Normals", "Transfer custom normals"},
|
||||
{DT_TYPE_VCOL, "VCOL", 0, "VCol", "Vertex (face corners) colors"},
|
||||
{DT_TYPE_VCOL, "VCOL", 0, "Vertex Colors", "Vertex (face corners) colors"},
|
||||
{DT_TYPE_UV, "UV", 0, "UVs", "Transfer UV layers"},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
};
|
||||
@@ -6374,7 +6380,7 @@ static void rna_def_modifier_datatransfer(BlenderRNA *brna)
|
||||
0.0f,
|
||||
0.0f,
|
||||
1.0f,
|
||||
"Islands Handling Refinement",
|
||||
"Islands Precision",
|
||||
"Factor controlling precision of islands handling "
|
||||
"(typically, 0.1 should be enough, higher values can make things really slow)",
|
||||
0.0f,
|
||||
@@ -6855,7 +6861,7 @@ void RNA_def_modifier(BlenderRNA *brna)
|
||||
|
||||
prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Expanded);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "ui_expand_flag", 0);
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_ui_text(prop, "Expanded", "Set modifier expanded in the user interface");
|
||||
RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
|
||||
|
||||
@@ -1209,13 +1209,9 @@ void RNA_api_ui_layout(StructRNA *srna)
|
||||
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
|
||||
api_ui_item_common_text(func);
|
||||
|
||||
func = RNA_def_function(srna, "template_modifier", "uiTemplateModifier");
|
||||
func = RNA_def_function(srna, "template_modifiers", "uiTemplateModifiers");
|
||||
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
||||
RNA_def_function_ui_description(func, "Generates the UI layout for modifiers");
|
||||
parm = RNA_def_pointer(func, "data", "Modifier", "", "Modifier data");
|
||||
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
||||
parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
|
||||
RNA_def_function_return(func, parm);
|
||||
RNA_def_function_ui_description(func, "Generates the UI layout for the modifier stack");
|
||||
|
||||
func = RNA_def_function(srna, "template_greasepencil_modifier", "uiTemplateGpencilModifier");
|
||||
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
||||
|
||||
@@ -23,12 +23,15 @@ set(INC
|
||||
intern
|
||||
../blenfont
|
||||
../blenkernel
|
||||
../blentranslation
|
||||
../blenlib
|
||||
../bmesh
|
||||
../depsgraph
|
||||
../editors/include
|
||||
../makesdna
|
||||
../makesrna
|
||||
../render/extern/include
|
||||
../windowmanager
|
||||
../../../intern/eigen
|
||||
../../../intern/guardedalloc
|
||||
)
|
||||
@@ -89,6 +92,7 @@ set(SRC
|
||||
intern/MOD_surface.c
|
||||
intern/MOD_surfacedeform.c
|
||||
intern/MOD_triangulate.c
|
||||
intern/MOD_ui_common.c
|
||||
intern/MOD_util.c
|
||||
intern/MOD_uvproject.c
|
||||
intern/MOD_uvwarp.c
|
||||
@@ -105,6 +109,7 @@ set(SRC
|
||||
MOD_modifiertypes.h
|
||||
intern/MOD_meshcache_util.h
|
||||
intern/MOD_solidify_util.h
|
||||
intern/MOD_ui_common.h
|
||||
intern/MOD_util.h
|
||||
intern/MOD_weightvg_util.h
|
||||
)
|
||||
@@ -157,6 +162,11 @@ if(WITH_INTERNATIONAL)
|
||||
add_definitions(-DWITH_INTERNATIONAL)
|
||||
endif()
|
||||
|
||||
# To disable adaptive subdivision test in subsurf UI without cycles
|
||||
if(WITH_CYCLES)
|
||||
add_definitions(-DWITH_CYCLES)
|
||||
endif()
|
||||
|
||||
# So we can have special tricks in modifier system.
|
||||
add_definitions(${GL_DEFINITIONS})
|
||||
|
||||
|
||||
@@ -26,17 +26,27 @@
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_armature_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_action.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_editmesh.h"
|
||||
#include "BKE_lattice.h"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
@@ -45,6 +55,7 @@
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
|
||||
static void initData(ModifierData *md)
|
||||
@@ -244,6 +255,36 @@ static void deformMatrices(ModifierData *md,
|
||||
}
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "object", 0, NULL, ICON_NONE);
|
||||
modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
|
||||
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiItemR(col, &ptr, "use_deform_preserve_volume", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "use_multi_modifier", 0, NULL, ICON_NONE);
|
||||
|
||||
col = uiLayoutColumnWithHeading(layout, true, "Bind to");
|
||||
uiItemR(col, &ptr, "use_vertex_groups", 0, IFACE_("Vertex Groups"), ICON_NONE);
|
||||
uiItemR(col, &ptr, "use_bone_envelopes", 0, IFACE_("Bone Envelopes"), ICON_NONE);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_Armature, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Armature = {
|
||||
/* name */ "Armature",
|
||||
/* structName */ "ArmatureModifierData",
|
||||
@@ -274,4 +315,5 @@ ModifierTypeInfo modifierType_Armature = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -29,12 +29,16 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_curve_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_curve.h"
|
||||
#include "BKE_displist.h"
|
||||
#include "BKE_lib_id.h"
|
||||
@@ -42,7 +46,14 @@
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_object_deform.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
@@ -822,6 +833,179 @@ static bool isDisabled(const struct Scene *UNUSED(scene),
|
||||
return false;
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "fit_type", 0, NULL, ICON_NONE);
|
||||
|
||||
int fit_type = RNA_enum_get(&ptr, "fit_type");
|
||||
if (fit_type == MOD_ARR_FIXEDCOUNT) {
|
||||
uiItemR(layout, &ptr, "count", 0, NULL, ICON_NONE);
|
||||
}
|
||||
else if (fit_type == MOD_ARR_FITLENGTH) {
|
||||
uiItemR(layout, &ptr, "fit_length", 0, NULL, ICON_NONE);
|
||||
}
|
||||
else if (fit_type == MOD_ARR_FITCURVE) {
|
||||
uiItemR(layout, &ptr, "curve", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiItemR(col, &ptr, "start_cap", 0, IFACE_("Cap Start"), ICON_NONE);
|
||||
uiItemR(col, &ptr, "end_cap", 0, IFACE_("End"), ICON_NONE);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void relative_offset_header_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiItemR(layout, &ptr, "use_relative_offset", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void relative_offset_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiLayout *col = uiLayoutColumn(layout, false);
|
||||
|
||||
uiLayoutSetActive(col, RNA_boolean_get(&ptr, "use_relative_offset"));
|
||||
uiItemR(col, &ptr, "relative_offset_displace", 0, IFACE_("Factor"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void constant_offset_header_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiItemR(layout, &ptr, "use_constant_offset", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void constant_offset_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiLayout *col = uiLayoutColumn(layout, false);
|
||||
|
||||
uiLayoutSetActive(col, RNA_boolean_get(&ptr, "use_constant_offset"));
|
||||
uiItemR(col, &ptr, "constant_offset_displace", 0, IFACE_("Distance"), ICON_NONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Object offset in a subpanel for consistency with the other offset types.
|
||||
*/
|
||||
static void object_offset_header_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiItemR(layout, &ptr, "use_object_offset", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void object_offset_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiLayout *col = uiLayoutColumn(layout, false);
|
||||
|
||||
uiLayoutSetActive(col, RNA_boolean_get(&ptr, "use_object_offset"));
|
||||
uiItemR(col, &ptr, "offset_object", 0, IFACE_("Object"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void symmetry_panel_header_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiItemR(layout, &ptr, "use_merge_vertices", 0, IFACE_("Merge"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void symmetry_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiLayout *col = uiLayoutColumn(layout, false);
|
||||
uiLayoutSetActive(col, RNA_boolean_get(&ptr, "use_merge_vertices"));
|
||||
uiItemR(col, &ptr, "merge_threshold", 0, IFACE_("Distance"), ICON_NONE);
|
||||
uiItemR(col, &ptr, "use_merge_vertices_cap", 0, IFACE_("First and Last Copies"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void uv_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiItemR(col, &ptr, "offset_u", UI_ITEM_R_EXPAND, IFACE_("Offset U"), ICON_NONE);
|
||||
uiItemR(col, &ptr, "offset_v", UI_ITEM_R_EXPAND, IFACE_("V"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Array, panel_draw);
|
||||
modifier_subpanel_register(region_type,
|
||||
"relative_offset",
|
||||
"",
|
||||
relative_offset_header_draw,
|
||||
relative_offset_draw,
|
||||
panel_type);
|
||||
modifier_subpanel_register(region_type,
|
||||
"constant_offset",
|
||||
"",
|
||||
constant_offset_header_draw,
|
||||
constant_offset_draw,
|
||||
panel_type);
|
||||
modifier_subpanel_register(
|
||||
region_type, "object_offset", "", object_offset_header_draw, object_offset_draw, panel_type);
|
||||
modifier_subpanel_register(
|
||||
region_type, "merge", "", symmetry_panel_header_draw, symmetry_panel_draw, panel_type);
|
||||
modifier_subpanel_register(region_type, "uv", "UVs", NULL, uv_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Array = {
|
||||
/* name */ "Array",
|
||||
/* structName */ "ArrayModifierData",
|
||||
@@ -853,4 +1037,5 @@ ModifierTypeInfo modifierType_Array = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -27,16 +27,28 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_curveprofile_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_curveprofile.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
|
||||
#include "BKE_curveprofile.h"
|
||||
@@ -263,6 +275,149 @@ static bool isDisabled(const Scene *UNUSED(scene), ModifierData *md, bool UNUSED
|
||||
return (bmd->value == 0.0f);
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
const char *offset_name = "";
|
||||
if (RNA_enum_get(&ptr, "offset_type") == BEVEL_AMT_PERCENT) {
|
||||
uiItemR(col, &ptr, "width_pct", 0, NULL, ICON_NONE);
|
||||
}
|
||||
else {
|
||||
switch (RNA_enum_get(&ptr, "offset_type")) {
|
||||
case BEVEL_AMT_DEPTH:
|
||||
offset_name = "Depth";
|
||||
break;
|
||||
case BEVEL_AMT_WIDTH:
|
||||
offset_name = "Width";
|
||||
break;
|
||||
case BEVEL_AMT_OFFSET:
|
||||
offset_name = "Offset";
|
||||
break;
|
||||
}
|
||||
uiItemR(col, &ptr, "width", 0, IFACE_(offset_name), ICON_NONE);
|
||||
}
|
||||
uiItemR(col, &ptr, "offset_type", 0, NULL, ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "segments", 0, NULL, ICON_NONE);
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
uiItemR(layout, &ptr, "affect", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiItemR(col, &ptr, "limit_method", 0, NULL, ICON_NONE);
|
||||
int limit_method = RNA_enum_get(&ptr, "limit_method");
|
||||
if (limit_method == MOD_BEVEL_ANGLE) {
|
||||
uiItemR(col, &ptr, "angle_limit", 0, NULL, ICON_NONE);
|
||||
}
|
||||
else if (limit_method == MOD_BEVEL_VGROUP) {
|
||||
modifier_vgroup_ui(col, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
|
||||
}
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void geometry_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "miter_inner", 0, IFACE_("Miter Inner"), ICON_NONE);
|
||||
uiItemR(layout, &ptr, "miter_outer", 0, IFACE_("Outer"), ICON_NONE);
|
||||
if (RNA_enum_get(&ptr, "miter_inner") == BEVEL_MITER_ARC) {
|
||||
uiItemR(layout, &ptr, "spread", 0, NULL, ICON_NONE);
|
||||
}
|
||||
uiItemS(layout);
|
||||
|
||||
uiItemR(layout, &ptr, "vmesh_method", 0, IFACE_("Intersections"), ICON_NONE);
|
||||
uiItemR(layout, &ptr, "use_clamp_overlap", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "loop_slide", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void shading_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "harden_normals", 0, NULL, ICON_NONE);
|
||||
|
||||
col = uiLayoutColumnWithHeading(layout, true, IFACE_("Mark"));
|
||||
uiItemR(col, &ptr, "mark_seam", 0, IFACE_("Seam"), ICON_NONE);
|
||||
uiItemR(col, &ptr, "mark_sharp", 0, IFACE_("Sharp"), ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "material", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "face_strength_mode", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void profile_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "profile", UI_ITEM_R_SLIDER, IFACE_("Shape"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void custom_profile_panel_draw_header(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiItemR(layout, &ptr, "use_custom_profile", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void custom_profile_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
uiLayoutSetActive(layout, RNA_boolean_get(&ptr, "use_custom_profile"));
|
||||
|
||||
uiTemplateCurveProfile(layout, &ptr, "custom_profile");
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Bevel, panel_draw);
|
||||
PanelType *bevel_profil_panel = modifier_subpanel_register(
|
||||
region_type, "profile", "Profile", NULL, profile_panel_draw, panel_type);
|
||||
modifier_subpanel_register(region_type,
|
||||
"custom",
|
||||
"",
|
||||
custom_profile_panel_draw_header,
|
||||
custom_profile_panel_draw,
|
||||
bevel_profil_panel);
|
||||
modifier_subpanel_register(
|
||||
region_type, "geometry", "Geometry", NULL, geometry_panel_draw, panel_type);
|
||||
modifier_subpanel_register(
|
||||
region_type, "shading", "Shading", NULL, shading_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Bevel = {
|
||||
/* name */ "Bevel",
|
||||
/* structName */ "BevelModifierData",
|
||||
@@ -290,4 +445,5 @@ ModifierTypeInfo modifierType_Bevel = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* uiPanel */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -31,17 +31,28 @@
|
||||
#include "BLI_math_geom.h"
|
||||
#include "BLI_math_matrix.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_global.h" /* only to check G.debug */
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
@@ -346,6 +357,32 @@ static void requiredDataMask(Object *UNUSED(ob),
|
||||
r_cddata_masks->fmask |= CD_MASK_MTFACE;
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "operation", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "object", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "double_threshold", 0, NULL, ICON_NONE);
|
||||
|
||||
if (G.debug) {
|
||||
uiLayout *col = uiLayoutColumn(layout, true);
|
||||
uiItemR(col, &ptr, "debug_options", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_Boolean, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Boolean = {
|
||||
/* name */ "Boolean",
|
||||
/* structName */ "BooleanModifierData",
|
||||
@@ -375,4 +412,5 @@ ModifierTypeInfo modifierType_Boolean = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -32,15 +32,24 @@
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_particle.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
|
||||
static void initData(ModifierData *md)
|
||||
{
|
||||
@@ -275,6 +284,52 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, struct
|
||||
return result;
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "frame_start", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "frame_duration", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "use_reverse", 0, NULL, ICON_NONE);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void random_panel_header_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiItemR(layout, &ptr, "use_random_order", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void random_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiLayoutSetActive(layout, RNA_boolean_get(&ptr, "use_random_order"));
|
||||
uiItemR(layout, &ptr, "seed", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Build, panel_draw);
|
||||
modifier_subpanel_register(
|
||||
region_type, "randomize", "", random_panel_header_draw, random_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Build = {
|
||||
/* name */ "Build",
|
||||
/* structName */ "BuildModifierData",
|
||||
@@ -304,4 +359,5 @@ ModifierTypeInfo modifierType_Build = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -25,19 +25,30 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_editmesh.h"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
|
||||
static void initData(ModifierData *md)
|
||||
@@ -523,6 +534,47 @@ static void deformVertsEM(ModifierData *md,
|
||||
}
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *row;
|
||||
uiLayout *layout = panel->layout;
|
||||
int toggles_flag = UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
PointerRNA cast_object_ptr = RNA_pointer_get(&ptr, "object");
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "cast_type", 0, NULL, ICON_NONE);
|
||||
|
||||
row = uiLayoutRowWithHeading(layout, true, IFACE_("Axis"));
|
||||
uiItemR(row, &ptr, "use_x", toggles_flag, NULL, ICON_NONE);
|
||||
uiItemR(row, &ptr, "use_y", toggles_flag, NULL, ICON_NONE);
|
||||
uiItemR(row, &ptr, "use_z", toggles_flag, NULL, ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "factor", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "radius", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "size", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "use_radius_as_size", 0, NULL, ICON_NONE);
|
||||
|
||||
modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
|
||||
|
||||
uiItemR(layout, &ptr, "object", 0, NULL, ICON_NONE);
|
||||
if (!RNA_pointer_is_null(&cast_object_ptr)) {
|
||||
uiItemR(layout, &ptr, "use_radius_as_size", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_Cast, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Cast = {
|
||||
/* name */ "Cast",
|
||||
/* structName */ "CastModifierData",
|
||||
@@ -553,4 +605,5 @@ ModifierTypeInfo modifierType_Cast = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -27,15 +27,19 @@
|
||||
|
||||
#include "BLI_listbase.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_cloth_types.h"
|
||||
#include "DNA_key_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BKE_cloth.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_effect.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_key.h"
|
||||
@@ -44,10 +48,17 @@
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_pointcache.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph_physics.h"
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
|
||||
static void initData(ModifierData *md)
|
||||
@@ -253,6 +264,23 @@ static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *u
|
||||
}
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiItemL(layout, IFACE_("Settings are inside the Physics tab"), ICON_NONE);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_Cloth, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Cloth = {
|
||||
/* name */ "Cloth",
|
||||
/* structName */ "ClothModifierData",
|
||||
@@ -283,4 +311,5 @@ ModifierTypeInfo modifierType_Cloth = {
|
||||
/* foreachIDLink */ foreachIDLink,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -25,13 +25,17 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BKE_collision.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_mesh.h"
|
||||
@@ -39,8 +43,15 @@
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_pointcache.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
@@ -241,6 +252,23 @@ static void updateDepsgraph(ModifierData *UNUSED(md), const ModifierUpdateDepsgr
|
||||
DEG_add_modifier_to_transform_relation(ctx->node, "Collision Modifier");
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiItemL(layout, IFACE_("Settings are inside the Physics tab"), ICON_NONE);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_Collision, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Collision = {
|
||||
/* name */ "Collision",
|
||||
/* structName */ "CollisionModifierData",
|
||||
@@ -270,4 +298,5 @@ ModifierTypeInfo modifierType_Collision = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -27,19 +27,30 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_editmesh.h"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
|
||||
#include "BLI_strict_flags.h"
|
||||
@@ -769,6 +780,42 @@ static void deformVertsEM(ModifierData *md,
|
||||
}
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "factor", 0, IFACE_("Factor"), ICON_NONE);
|
||||
uiItemR(layout, &ptr, "iterations", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "scale", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "smooth_type", 0, NULL, ICON_NONE);
|
||||
|
||||
modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
|
||||
|
||||
uiItemR(layout, &ptr, "use_only_smooth", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "use_pin_boundary", 0, NULL, ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "rest_source", 0, NULL, ICON_NONE);
|
||||
if (RNA_enum_get(&ptr, "rest_source") == MOD_CORRECTIVESMOOTH_RESTSOURCE_BIND) {
|
||||
uiItemO(layout,
|
||||
(RNA_boolean_get(&ptr, "is_bind") ? IFACE_("Unbind") : IFACE_("Bind")),
|
||||
ICON_NONE,
|
||||
"OBJECT_OT_correctivesmooth_bind");
|
||||
}
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_CorrectiveSmooth, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_CorrectiveSmooth = {
|
||||
/* name */ "CorrectiveSmooth",
|
||||
/* structName */ "CorrectiveSmoothModifierData",
|
||||
@@ -798,4 +845,5 @@ ModifierTypeInfo modifierType_CorrectiveSmooth = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -25,22 +25,33 @@
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_editmesh.h"
|
||||
#include "BKE_lattice.h"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
#include "DEG_depsgraph_build.h"
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
|
||||
static void initData(ModifierData *md)
|
||||
@@ -154,6 +165,29 @@ static void deformVertsEM(ModifierData *md,
|
||||
}
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "object", 0, IFACE_("Curve Object"), ICON_NONE);
|
||||
uiItemR(layout, &ptr, "deform_axis", 0, NULL, ICON_NONE);
|
||||
|
||||
modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_Curve, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Curve = {
|
||||
/* name */ "Curve",
|
||||
/* structName */ "CurveModifierData",
|
||||
@@ -184,4 +218,5 @@ ModifierTypeInfo modifierType_Curve = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -25,11 +25,15 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_customdata.h"
|
||||
#include "BKE_data_transfer.h"
|
||||
#include "BKE_lib_id.h"
|
||||
@@ -38,10 +42,18 @@
|
||||
#include "BKE_mesh_remap.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_report.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
|
||||
/**************************************
|
||||
@@ -231,6 +243,235 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
||||
return result;
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *sub, *row;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
row = uiLayoutRow(layout, true);
|
||||
uiItemR(row, &ptr, "object", 0, IFACE_("Source"), ICON_NONE);
|
||||
sub = uiLayoutRow(row, true);
|
||||
uiLayoutSetPropDecorate(sub, false);
|
||||
uiItemR(sub, &ptr, "use_object_transform", 0, "", ICON_ORIENTATION_GLOBAL);
|
||||
|
||||
uiItemR(layout, &ptr, "mix_mode", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "mix_factor", 0, NULL, ICON_NONE);
|
||||
|
||||
modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
|
||||
|
||||
uiItemO(layout, "Generate Data Layers", ICON_NONE, "OBJECT_OT_datalayout_transfer");
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void vertex_panel_draw_header(const bContext *C, Panel *panel)
|
||||
{
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
uiItemR(layout, &ptr, "use_vert_data", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void vertex_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
bool use_vert_data = RNA_boolean_get(&ptr, "use_vert_data");
|
||||
uiLayoutSetActive(layout, use_vert_data);
|
||||
|
||||
uiItemR(layout, &ptr, "data_types_verts", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "vert_mapping", 0, IFACE_("Mapping"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void vertex_vgroup_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetActive(layout, RNA_enum_get(&ptr, "data_types_verts") & DT_TYPE_MDEFORMVERT);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "layers_vgroup_select_src", 0, IFACE_("Layer Selection"), ICON_NONE);
|
||||
uiItemR(layout, &ptr, "layers_vgroup_select_dst", 0, IFACE_("Layer Mapping"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void edge_panel_draw_header(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiItemR(layout, &ptr, "use_edge_data", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void edge_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetActive(layout, RNA_boolean_get(&ptr, "use_edge_data"));
|
||||
|
||||
uiItemR(layout, &ptr, "data_types_edges", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "edge_mapping", 0, IFACE_("Mapping"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void face_corner_panel_draw_header(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiItemR(layout, &ptr, "use_loop_data", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void face_corner_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetActive(layout, RNA_boolean_get(&ptr, "use_loop_data"));
|
||||
|
||||
uiItemR(layout, &ptr, "data_types_loops", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "loop_mapping", 0, IFACE_("Mapping"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void face_corner_vcol_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiLayoutSetActive(layout, RNA_enum_get(&ptr, "data_types_loops") & DT_TYPE_VCOL);
|
||||
|
||||
uiItemR(layout, &ptr, "layers_vcol_select_src", 0, IFACE_("Layer Selection"), ICON_NONE);
|
||||
uiItemR(layout, &ptr, "layers_vcol_select_dst", 0, IFACE_("Layer Mapping"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void face_corner_uv_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiLayoutSetActive(layout, RNA_enum_get(&ptr, "data_types_loops") & DT_TYPE_UV);
|
||||
|
||||
uiItemR(layout, &ptr, "layers_uv_select_src", 0, IFACE_("Layer Selection"), ICON_NONE);
|
||||
uiItemR(layout, &ptr, "layers_uv_select_dst", 0, IFACE_("Layer Mapping"), ICON_NONE);
|
||||
uiItemR(layout, &ptr, "islands_precision", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void face_panel_draw_header(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiItemR(layout, &ptr, "use_poly_data", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void face_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetActive(layout, RNA_boolean_get(&ptr, "use_poly_data"));
|
||||
|
||||
uiItemR(layout, &ptr, "data_types_polys", 0, NULL, ICON_NONE);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "poly_mapping", 0, IFACE_("Mapping"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void advanced_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *row, *sub;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
row = uiLayoutRowWithHeading(layout, true, IFACE_("Max Distance"));
|
||||
uiItemR(row, &ptr, "use_max_distance", 0, "", ICON_NONE);
|
||||
sub = uiLayoutRow(row, true);
|
||||
uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_max_distance"));
|
||||
uiItemR(sub, &ptr, "max_distance", 0, "", ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "ray_radius", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = modifier_panel_register(
|
||||
region_type, eModifierType_DataTransfer, panel_draw);
|
||||
PanelType *vertex_panel = modifier_subpanel_register(
|
||||
region_type, "vertex", "", vertex_panel_draw_header, vertex_panel_draw, panel_type);
|
||||
modifier_subpanel_register(
|
||||
region_type, "vertex_vgroup", "Vertex Groups", NULL, vertex_vgroup_panel_draw, vertex_panel);
|
||||
|
||||
modifier_subpanel_register(
|
||||
region_type, "edge", "", edge_panel_draw_header, edge_panel_draw, panel_type);
|
||||
|
||||
PanelType *face_corner_panel = modifier_subpanel_register(region_type,
|
||||
"face_corner",
|
||||
"",
|
||||
face_corner_panel_draw_header,
|
||||
face_corner_panel_draw,
|
||||
panel_type);
|
||||
modifier_subpanel_register(region_type,
|
||||
"face_corner_vcol",
|
||||
"Vertex Colors",
|
||||
NULL,
|
||||
face_corner_vcol_panel_draw,
|
||||
face_corner_panel);
|
||||
modifier_subpanel_register(
|
||||
region_type, "face_corner_uv", "UVs", NULL, face_corner_uv_panel_draw, face_corner_panel);
|
||||
|
||||
modifier_subpanel_register(
|
||||
region_type, "face", "", face_panel_draw_header, face_panel_draw, panel_type);
|
||||
modifier_subpanel_register(
|
||||
region_type, "advanced", "Topology Mapping", NULL, advanced_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
#undef HIGH_POLY_WARNING
|
||||
#undef DT_TYPES_AFFECT_MESH
|
||||
|
||||
@@ -264,4 +505,5 @@ ModifierTypeInfo modifierType_DataTransfer = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -25,14 +25,24 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
@@ -46,6 +56,7 @@
|
||||
# include "PIL_time_utildefines.h"
|
||||
#endif
|
||||
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
|
||||
static void initData(ModifierData *md)
|
||||
@@ -215,6 +226,57 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
||||
return result;
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *sub, *row;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
int decimate_type = RNA_enum_get(&ptr, "decimate_type");
|
||||
char count_info[32];
|
||||
snprintf(count_info, 32, IFACE_("Face Count: %d"), RNA_int_get(&ptr, "face_count"));
|
||||
|
||||
uiItemR(layout, &ptr, "decimate_type", 0, NULL, ICON_NONE);
|
||||
|
||||
if (decimate_type == MOD_DECIM_MODE_COLLAPSE) {
|
||||
uiItemR(layout, &ptr, "ratio", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
|
||||
|
||||
row = uiLayoutRowWithHeading(layout, true, "Symmetry");
|
||||
uiLayoutSetPropDecorate(row, false);
|
||||
sub = uiLayoutRow(row, true);
|
||||
uiItemR(sub, &ptr, "use_symmetry", 0, "", ICON_NONE);
|
||||
sub = uiLayoutRow(sub, true);
|
||||
uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_symmetry"));
|
||||
uiItemR(sub, &ptr, "symmetry_axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
uiItemDecoratorR(row, &ptr, "symmetry_axis", 0);
|
||||
|
||||
uiItemR(layout, &ptr, "use_collapse_triangulate", 0, NULL, ICON_NONE);
|
||||
|
||||
modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
|
||||
}
|
||||
else if (decimate_type == MOD_DECIM_MODE_UNSUBDIV) {
|
||||
uiItemR(layout, &ptr, "iterations", 0, NULL, ICON_NONE);
|
||||
}
|
||||
else { /* decimate_type == MOD_DECIM_MODE_DISSOLVE. */
|
||||
uiItemR(layout, &ptr, "angle_limit", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "delimit", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "use_dissolve_boundaries", 0, NULL, ICON_NONE);
|
||||
}
|
||||
uiItemL(layout, count_info, ICON_NONE);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_Decimate, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Decimate = {
|
||||
/* name */ "Decimate",
|
||||
/* structName */ "DecimateModifierData",
|
||||
@@ -244,4 +306,5 @@ ModifierTypeInfo modifierType_Decimate = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -26,10 +26,14 @@
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_task.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_customdata.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_editmesh.h"
|
||||
@@ -39,13 +43,20 @@
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_texture.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
|
||||
#include "RE_shader_ext.h"
|
||||
@@ -419,6 +430,73 @@ static void deformVertsEM(ModifierData *md,
|
||||
}
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
PointerRNA texture_ptr = RNA_pointer_get(&ptr, "texture");
|
||||
bool has_texture = !RNA_pointer_is_null(&texture_ptr);
|
||||
int texture_coords = RNA_enum_get(&ptr, "texture_coords");
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiTemplateID(layout, C, &ptr, "texture", "texture.new", NULL, NULL, 0, ICON_NONE, NULL);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiLayoutSetActive(col, has_texture);
|
||||
uiItemR(col, &ptr, "texture_coords", 0, IFACE_("Coordinates"), ICON_NONE);
|
||||
if (texture_coords == MOD_DISP_MAP_OBJECT) {
|
||||
uiItemR(col, &ptr, "texture_coords_object", 0, NULL, ICON_NONE);
|
||||
PointerRNA texture_coords_obj_ptr = RNA_pointer_get(&ptr, "texture_coords_object");
|
||||
if (!RNA_pointer_is_null(&texture_coords_obj_ptr) &&
|
||||
(RNA_enum_get(&texture_coords_obj_ptr, "type") == OB_ARMATURE)) {
|
||||
PointerRNA texture_coords_obj_data_ptr = RNA_pointer_get(&texture_coords_obj_ptr, "data");
|
||||
uiItemPointerR(layout,
|
||||
&ptr,
|
||||
"texture_coords_bone",
|
||||
&texture_coords_obj_data_ptr,
|
||||
"bones",
|
||||
IFACE_("Bone"),
|
||||
ICON_NONE);
|
||||
}
|
||||
}
|
||||
else if (texture_coords == MOD_DISP_MAP_UV && RNA_enum_get(&ob_ptr, "type") == OB_MESH) {
|
||||
uiItemR(col, &ptr, "uv_layer", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiItemR(col, &ptr, "direction", 0, 0, ICON_NONE);
|
||||
if (ELEM(RNA_enum_get(&ptr, "direction"),
|
||||
MOD_DISP_DIR_X,
|
||||
MOD_DISP_DIR_Y,
|
||||
MOD_DISP_DIR_Z,
|
||||
MOD_DISP_DIR_RGB_XYZ)) {
|
||||
uiItemR(col, &ptr, "space", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiItemR(col, &ptr, "strength", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "mid_level", 0, NULL, ICON_NONE);
|
||||
|
||||
modifier_vgroup_ui(col, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_Displace, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Displace = {
|
||||
/* name */ "Displace",
|
||||
/* structName */ "DisplaceModifierData",
|
||||
@@ -448,4 +526,5 @@ ModifierTypeInfo modifierType_Displace = {
|
||||
/* foreachIDLink */ foreachIDLink,
|
||||
/* foreachTexLink */ foreachTexLink,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -23,17 +23,27 @@
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_dynamicpaint_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_object_force_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_dynamicpaint.h"
|
||||
#include "BKE_layer.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
#include "DEG_depsgraph_build.h"
|
||||
@@ -41,6 +51,7 @@
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
|
||||
static void initData(ModifierData *md)
|
||||
{
|
||||
@@ -172,6 +183,23 @@ static void foreachTexLink(ModifierData *UNUSED(md),
|
||||
// walk(userData, ob, md, ""); /* re-enable when possible */
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiItemL(layout, IFACE_("Settings are inside the Physics tab"), ICON_NONE);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_DynamicPaint, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_DynamicPaint = {
|
||||
/* name */ "Dynamic Paint",
|
||||
/* structName */ "DynamicPaintModifierData",
|
||||
@@ -203,4 +231,5 @@ ModifierTypeInfo modifierType_DynamicPaint = {
|
||||
/* foreachIDLink */ foreachIDLink,
|
||||
/* foreachTexLink */ foreachTexLink,
|
||||
/* freeRuntimeData */ freeRuntimeData,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -30,16 +30,27 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "bmesh.h"
|
||||
#include "bmesh_tools.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
|
||||
static Mesh *doEdgeSplit(Mesh *mesh, EdgeSplitModifierData *emd)
|
||||
{
|
||||
@@ -127,6 +138,32 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *UNUSED(ctx)
|
||||
return result;
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *row, *sub;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
row = uiLayoutRowWithHeading(layout, true, IFACE_("Edge Angle"));
|
||||
uiItemR(row, &ptr, "use_edge_angle", 0, "", ICON_NONE);
|
||||
sub = uiLayoutRow(row, true);
|
||||
uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_edge_angle"));
|
||||
uiItemR(sub, &ptr, "split_angle", 0, "", ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "use_edge_sharp", 0, IFACE_("Sharp Edges"), ICON_NONE);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_EdgeSplit, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_EdgeSplit = {
|
||||
/* name */ "EdgeSplit",
|
||||
/* structName */ "EdgeSplitModifierData",
|
||||
@@ -158,4 +195,5 @@ ModifierTypeInfo modifierType_EdgeSplit = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -28,11 +28,15 @@
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_rand.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_lattice.h"
|
||||
#include "BKE_lib_id.h"
|
||||
@@ -40,12 +44,19 @@
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_particle.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
|
||||
static void initData(ModifierData *md)
|
||||
{
|
||||
@@ -1174,6 +1185,49 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
||||
return mesh;
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *row;
|
||||
uiLayout *layout = panel->layout;
|
||||
int toggles_flag = UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
PointerRNA obj_data_ptr = RNA_pointer_get(&ob_ptr, "data");
|
||||
bool has_vertex_group = RNA_string_length(&ptr, "vertex_group") != 0;
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemPointerR(layout, &ptr, "particle_uv", &obj_data_ptr, "uv_layers", NULL, ICON_NONE);
|
||||
|
||||
row = uiLayoutRowWithHeading(layout, true, IFACE_("Show"));
|
||||
uiItemR(row, &ptr, "show_alive", toggles_flag, NULL, ICON_NONE);
|
||||
uiItemR(row, &ptr, "show_dead", toggles_flag, NULL, ICON_NONE);
|
||||
uiItemR(row, &ptr, "show_unborn", toggles_flag, NULL, ICON_NONE);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "use_edge_cut", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "use_size", 0, NULL, ICON_NONE);
|
||||
|
||||
modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
|
||||
|
||||
row = uiLayoutRow(layout, false);
|
||||
uiLayoutSetActive(row, has_vertex_group);
|
||||
uiItemR(row, &ptr, "protect", 0, NULL, ICON_NONE);
|
||||
|
||||
uiItemO(layout, IFACE_("Refresh"), ICON_NONE, "OBJECT_OT_explode_refresh");
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_Explode, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Explode = {
|
||||
/* name */ "Explode",
|
||||
/* structName */ "ExplodeModifierData",
|
||||
@@ -1202,4 +1256,5 @@ ModifierTypeInfo modifierType_Explode = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -27,17 +27,27 @@
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_collection_types.h"
|
||||
#include "DNA_fluid_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_object_force_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_fluid.h"
|
||||
#include "BKE_layer.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
#include "DEG_depsgraph_build.h"
|
||||
@@ -45,6 +55,7 @@
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
|
||||
static void initData(ModifierData *md)
|
||||
{
|
||||
@@ -194,6 +205,23 @@ static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *u
|
||||
}
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiItemL(layout, IFACE_("Settings are inside the Physics tab"), ICON_NONE);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_Fluid, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Fluid = {
|
||||
/* name */ "Fluid",
|
||||
/* structName */ "FluidModifierData",
|
||||
@@ -223,4 +251,5 @@ ModifierTypeInfo modifierType_Fluid = {
|
||||
/* foreachIDLink */ foreachIDLink,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -25,23 +25,34 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_action.h"
|
||||
#include "BKE_colortools.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_editmesh.h"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
|
||||
static void initData(ModifierData *md)
|
||||
@@ -388,6 +399,75 @@ static void deformVertsEM(struct ModifierData *md,
|
||||
}
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *row, *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
PointerRNA hook_object_ptr = RNA_pointer_get(&ptr, "object");
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiItemR(col, &ptr, "object", 0, NULL, ICON_NONE);
|
||||
if (!RNA_pointer_is_null(&hook_object_ptr) &&
|
||||
RNA_enum_get(&hook_object_ptr, "type") == OB_ARMATURE) {
|
||||
PointerRNA hook_object_data_ptr = RNA_pointer_get(&hook_object_ptr, "data");
|
||||
uiItemPointerR(
|
||||
col, &ptr, "subtarget", &hook_object_data_ptr, "bones", IFACE_("Bone"), ICON_NONE);
|
||||
}
|
||||
modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
|
||||
|
||||
uiItemR(layout, &ptr, "strength", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
|
||||
|
||||
if (RNA_enum_get(&ob_ptr, "mode") == OB_MODE_EDIT) {
|
||||
row = uiLayoutRow(layout, true);
|
||||
uiItemO(row, "Reset", ICON_NONE, "OBJECT_OT_hook_reset");
|
||||
uiItemO(row, "Recenter", ICON_NONE, "OBJECT_OT_hook_recenter");
|
||||
row = uiLayoutRow(layout, true);
|
||||
uiItemO(row, "Select", ICON_NONE, "OBJECT_OT_hook_select");
|
||||
uiItemO(row, "Assign", ICON_NONE, "OBJECT_OT_hook_assign");
|
||||
}
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void falloff_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *row;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
bool use_falloff = RNA_enum_get(&ptr, "falloff_type") != eWarp_Falloff_None;
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "falloff_type", 0, IFACE_("Type"), ICON_NONE);
|
||||
|
||||
row = uiLayoutRow(layout, false);
|
||||
uiLayoutSetActive(row, use_falloff);
|
||||
uiItemR(row, &ptr, "falloff_radius", 0, NULL, ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "use_falloff_uniform", 0, NULL, ICON_NONE);
|
||||
|
||||
if (RNA_enum_get(&ptr, "falloff_type") == eWarp_Falloff_Curve) {
|
||||
uiTemplateCurveMapping(layout, &ptr, "falloff_curve", 0, false, false, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Hook, panel_draw);
|
||||
modifier_subpanel_register(
|
||||
region_type, "falloff", "Falloff", NULL, falloff_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Hook = {
|
||||
/* name */ "Hook",
|
||||
/* structName */ "HookModifierData",
|
||||
@@ -417,4 +497,5 @@ ModifierTypeInfo modifierType_Hook = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -29,9 +29,13 @@
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_editmesh.h"
|
||||
#include "BKE_lib_id.h"
|
||||
@@ -39,7 +43,14 @@
|
||||
#include "BKE_mesh_mapping.h"
|
||||
#include "BKE_mesh_runtime.h"
|
||||
#include "BKE_particle.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
|
||||
#include "eigen_capi.h"
|
||||
@@ -808,6 +819,41 @@ static void freeData(ModifierData *md)
|
||||
lmd->total_verts = 0;
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *row;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
bool is_bind = RNA_boolean_get(&ptr, "is_bind");
|
||||
bool has_vertex_group = RNA_string_length(&ptr, "vertex_group") != 0;
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "iterations", 0, NULL, ICON_NONE);
|
||||
|
||||
modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
row = uiLayoutRow(layout, true);
|
||||
uiLayoutSetEnabled(row, has_vertex_group);
|
||||
uiItemO(row,
|
||||
is_bind ? IFACE_("Unbind") : IFACE_("Bind"),
|
||||
ICON_NONE,
|
||||
"OBJECT_OT_laplaciandeform_bind");
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_LaplacianDeform, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_LaplacianDeform = {
|
||||
/* name */ "LaplacianDeform",
|
||||
/* structName */ "LaplacianDeformModifierData",
|
||||
@@ -836,4 +882,5 @@ ModifierTypeInfo modifierType_LaplacianDeform = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -25,18 +25,29 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_editmesh.h"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
|
||||
#include "eigen_capi.h"
|
||||
@@ -572,8 +583,43 @@ static void deformVertsEM(ModifierData *md,
|
||||
}
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *row;
|
||||
uiLayout *layout = panel->layout;
|
||||
int toggles_flag = UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "iterations", 0, NULL, ICON_NONE);
|
||||
|
||||
row = uiLayoutRowWithHeading(layout, true, IFACE_("Axis"));
|
||||
uiItemR(row, &ptr, "use_x", toggles_flag, NULL, ICON_NONE);
|
||||
uiItemR(row, &ptr, "use_y", toggles_flag, NULL, ICON_NONE);
|
||||
uiItemR(row, &ptr, "use_z", toggles_flag, NULL, ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "lambda_factor", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "lambda_border", 0, NULL, ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "use_volume_preserve", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "use_normalized", 0, NULL, ICON_NONE);
|
||||
|
||||
modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_LaplacianSmooth, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_LaplacianSmooth = {
|
||||
/* name */ "Laplacian Smooth",
|
||||
/* name */ "LaplacianSmooth",
|
||||
/* structName */ "LaplacianSmoothModifierData",
|
||||
/* structSize */ sizeof(LaplacianSmoothModifierData),
|
||||
/* type */ eModifierTypeType_OnlyDeform,
|
||||
@@ -601,4 +647,5 @@ ModifierTypeInfo modifierType_LaplacianSmooth = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -25,19 +25,30 @@
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "DNA_object_types.h"
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_editmesh.h"
|
||||
#include "BKE_lattice.h"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
|
||||
static void initData(ModifierData *md)
|
||||
@@ -137,6 +148,30 @@ static void deformVertsEM(ModifierData *md,
|
||||
}
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "object", 0, NULL, ICON_NONE);
|
||||
|
||||
modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
|
||||
|
||||
uiItemR(layout, &ptr, "strength", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_Lattice, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Lattice = {
|
||||
/* name */ "Lattice",
|
||||
/* structName */ "LatticeModifierData",
|
||||
@@ -167,4 +202,5 @@ ModifierTypeInfo modifierType_Lattice = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -28,23 +28,39 @@
|
||||
#include "BLI_ghash.h"
|
||||
#include "BLI_listbase.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_armature_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_action.h" /* BKE_pose_channel_find_name */
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_customdata.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_modifier.h"
|
||||
|
||||
/* SpaceType struct has a member called 'new' which obviously conflicts with C++
|
||||
* so temporarily redefining the new keyword to make it compile. */
|
||||
#define new extern_new
|
||||
#include "BKE_screen.h"
|
||||
#undef new
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph_build.h"
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
|
||||
#include "BLI_array.hh"
|
||||
#include "BLI_listbase_wrapper.hh"
|
||||
@@ -387,6 +403,42 @@ static bool isDisabled(const struct Scene *UNUSED(scene),
|
||||
return mmd->ob_arm && mmd->ob_arm->type != OB_ARMATURE;
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *sub, *row;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
int mode = RNA_enum_get(&ptr, "mode");
|
||||
|
||||
uiItemR(layout, &ptr, "mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
if (mode == MOD_MASK_MODE_ARM) {
|
||||
row = uiLayoutRow(layout, true);
|
||||
uiItemR(row, &ptr, "armature", 0, NULL, ICON_NONE);
|
||||
sub = uiLayoutRow(row, true);
|
||||
uiLayoutSetPropDecorate(sub, false);
|
||||
uiItemR(sub, &ptr, "invert_vertex_group", 0, "", ICON_ARROW_LEFTRIGHT);
|
||||
}
|
||||
else if (mode == MOD_MASK_MODE_VGROUP) {
|
||||
modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", nullptr);
|
||||
}
|
||||
|
||||
uiItemR(layout, &ptr, "threshold", 0, NULL, ICON_NONE);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_Mask, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Mask = {
|
||||
/* name */ "Mask",
|
||||
/* structName */ "MaskModifierData",
|
||||
@@ -418,4 +470,5 @@ ModifierTypeInfo modifierType_Mask = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -26,22 +26,32 @@
|
||||
#include "BLI_path_util.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "MOD_meshcache_util.h" /* utility functions */
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
|
||||
static void initData(ModifierData *md)
|
||||
{
|
||||
@@ -287,8 +297,90 @@ static void deformVertsEM(ModifierData *md,
|
||||
meshcache_do(mcmd, scene, ctx->object, vertexCos, numVerts);
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "cache_format", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "filepath", 0, NULL, ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "factor", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "deform_mode", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "interpolation", 0, NULL, ICON_NONE);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void time_remapping_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiItemR(layout, &ptr, "time_mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "play_mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
|
||||
if (RNA_enum_get(&ptr, "play_mode") == MOD_MESHCACHE_PLAY_CFEA) {
|
||||
uiItemR(layout, &ptr, "frame_start", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "frame_scale", 0, NULL, ICON_NONE);
|
||||
}
|
||||
else { /* play_mode == MOD_MESHCACHE_PLAY_EVAL */
|
||||
int time_mode = RNA_enum_get(&ptr, "time_mode");
|
||||
if (time_mode == MOD_MESHCACHE_TIME_FRAME) {
|
||||
uiItemR(layout, &ptr, "eval_frame", 0, NULL, ICON_NONE);
|
||||
}
|
||||
else if (time_mode == MOD_MESHCACHE_TIME_SECONDS) {
|
||||
uiItemR(layout, &ptr, "eval_time", 0, NULL, ICON_NONE);
|
||||
}
|
||||
else { /* time_mode == MOD_MESHCACHE_TIME_FACTOR */
|
||||
uiItemR(layout, &ptr, "eval_factor", 0, NULL, ICON_NONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void axis_mapping_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiLayoutSetRedAlert(col, RNA_enum_get(&ptr, "forward_axis") == RNA_enum_get(&ptr, "up_axis"));
|
||||
uiItemR(col, &ptr, "forward_axis", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "up_axis", 0, NULL, ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "flip_axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = modifier_panel_register(
|
||||
region_type, eModifierType_MeshCache, panel_draw);
|
||||
modifier_subpanel_register(region_type,
|
||||
"time_remapping",
|
||||
"Time Remapping",
|
||||
NULL,
|
||||
time_remapping_panel_draw,
|
||||
panel_type);
|
||||
modifier_subpanel_register(
|
||||
region_type, "axis_mapping", "Axis Mapping", NULL, axis_mapping_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_MeshCache = {
|
||||
/* name */ "Mesh Cache",
|
||||
/* name */ "MeshCache",
|
||||
/* structName */ "MeshCacheModifierData",
|
||||
/* structSize */ sizeof(MeshCacheModifierData),
|
||||
/* type */ eModifierTypeType_OnlyDeform,
|
||||
@@ -317,4 +409,5 @@ ModifierTypeInfo modifierType_MeshCache = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -26,11 +26,15 @@
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_task.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_editmesh.h"
|
||||
#include "BKE_global.h"
|
||||
@@ -39,12 +43,19 @@
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_mesh_runtime.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
|
||||
#ifdef __SSE2__
|
||||
@@ -558,6 +569,43 @@ void BKE_modifier_mdef_compact_influences(ModifierData *md)
|
||||
mmd->bindweights = NULL;
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
bool is_bound = RNA_boolean_get(&ptr, "is_bound");
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiLayoutSetEnabled(col, !is_bound);
|
||||
uiItemR(col, &ptr, "object", 0, NULL, ICON_NONE);
|
||||
|
||||
modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiLayoutSetEnabled(col, !is_bound);
|
||||
uiItemR(col, &ptr, "precision", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "use_dynamic_bind", 0, NULL, ICON_NONE);
|
||||
|
||||
uiItemO(layout,
|
||||
is_bound ? IFACE_("Unbind") : IFACE_("Bind"),
|
||||
ICON_NONE,
|
||||
"OBJECT_OT_meshdeform_bind");
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_MeshDeform, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_MeshDeform = {
|
||||
/* name */ "MeshDeform",
|
||||
/* structName */ "MeshDeformModifierData",
|
||||
@@ -588,4 +636,5 @@ ModifierTypeInfo modifierType_MeshDeform = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -23,21 +23,32 @@
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_cachefile_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_cachefile.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph_build.h"
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
|
||||
#ifdef WITH_ALEMBIC
|
||||
# include "ABC_alembic.h"
|
||||
@@ -185,8 +196,41 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
|
||||
}
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *box;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
PointerRNA cache_file_ptr = RNA_pointer_get(&ptr, "cache_file");
|
||||
bool has_cache_file = !RNA_pointer_is_null(&cache_file_ptr);
|
||||
|
||||
box = uiLayoutBox(layout);
|
||||
uiTemplateCacheFile(box, C, &ptr, "cache_file");
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
if (has_cache_file) {
|
||||
uiItemPointerR(layout, &ptr, "object_path", &cache_file_ptr, "object_paths", NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
if (RNA_enum_get(&ob_ptr, "type") == OB_MESH) {
|
||||
uiItemR(layout, &ptr, "read_data", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_MeshSequenceCache, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_MeshSequenceCache = {
|
||||
/* name */ "Mesh Sequence Cache",
|
||||
/* name */ "MeshSequenceCache",
|
||||
/* structName */ "MeshSeqCacheModifierData",
|
||||
/* structSize */ sizeof(MeshSeqCacheModifierData),
|
||||
/* type */ eModifierTypeType_Constructive,
|
||||
@@ -214,4 +258,5 @@ ModifierTypeInfo modifierType_MeshSequenceCache = {
|
||||
/* foreachIDLink */ foreachIDLink,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -23,16 +23,26 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_mesh_mirror.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "bmesh.h"
|
||||
#include "bmesh_tools.h"
|
||||
@@ -43,6 +53,7 @@
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
|
||||
static void initData(ModifierData *md)
|
||||
{
|
||||
@@ -113,6 +124,93 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
||||
return result;
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *row, *col, *sub;
|
||||
uiLayout *layout = panel->layout;
|
||||
int toggles_flag = UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE;
|
||||
|
||||
PropertyRNA *prop;
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiLayoutSetPropSep(col, true);
|
||||
|
||||
prop = RNA_struct_find_property(&ptr, "use_axis");
|
||||
row = uiLayoutRowWithHeading(col, true, IFACE_("Axis"));
|
||||
uiItemFullR(row, &ptr, prop, 0, 0, toggles_flag, IFACE_("X"), ICON_NONE);
|
||||
uiItemFullR(row, &ptr, prop, 1, 0, toggles_flag, IFACE_("Y"), ICON_NONE);
|
||||
uiItemFullR(row, &ptr, prop, 2, 0, toggles_flag, IFACE_("Z"), ICON_NONE);
|
||||
|
||||
prop = RNA_struct_find_property(&ptr, "use_bisect_axis");
|
||||
row = uiLayoutRowWithHeading(col, true, IFACE_("Bisect"));
|
||||
uiItemFullR(row, &ptr, prop, 0, 0, toggles_flag, IFACE_("X"), ICON_NONE);
|
||||
uiItemFullR(row, &ptr, prop, 1, 0, toggles_flag, IFACE_("Y"), ICON_NONE);
|
||||
uiItemFullR(row, &ptr, prop, 2, 0, toggles_flag, IFACE_("Z"), ICON_NONE);
|
||||
|
||||
prop = RNA_struct_find_property(&ptr, "use_bisect_flip_axis");
|
||||
row = uiLayoutRowWithHeading(col, true, IFACE_("Flip"));
|
||||
uiItemFullR(row, &ptr, prop, 0, 0, toggles_flag, IFACE_("X"), ICON_NONE);
|
||||
uiItemFullR(row, &ptr, prop, 1, 0, toggles_flag, IFACE_("Y"), ICON_NONE);
|
||||
uiItemFullR(row, &ptr, prop, 2, 0, toggles_flag, IFACE_("Z"), ICON_NONE);
|
||||
|
||||
uiItemS(col);
|
||||
|
||||
uiItemR(col, &ptr, "mirror_object", 0, NULL, ICON_NONE);
|
||||
|
||||
uiItemR(col, &ptr, "use_clip", 0, IFACE_("Clipping"), ICON_NONE);
|
||||
|
||||
row = uiLayoutRowWithHeading(col, true, IFACE_("Merge"));
|
||||
uiItemR(row, &ptr, "use_mirror_merge", 0, "", ICON_NONE);
|
||||
sub = uiLayoutRow(row, true);
|
||||
uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_mirror_merge"));
|
||||
uiItemR(sub, &ptr, "merge_threshold", 0, "", ICON_NONE);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void data_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col, *row, *sub;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
col = uiLayoutColumnWithHeading(layout, false, IFACE_("Mirror U"));
|
||||
row = uiLayoutRow(col, true);
|
||||
uiLayoutSetPropDecorate(row, false);
|
||||
sub = uiLayoutRow(row, true);
|
||||
uiItemR(sub, &ptr, "use_mirror_u", 0, "", ICON_NONE);
|
||||
sub = uiLayoutRow(sub, true);
|
||||
uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_mirror_u"));
|
||||
uiItemR(sub, &ptr, "mirror_offset_u", UI_ITEM_R_SLIDER, "", ICON_NONE);
|
||||
uiItemDecoratorR(row, &ptr, "mirror_offset_v", 0);
|
||||
|
||||
col = uiLayoutColumnWithHeading(layout, false, "V");
|
||||
row = uiLayoutRow(col, true);
|
||||
uiLayoutSetPropDecorate(row, false);
|
||||
sub = uiLayoutRow(row, true);
|
||||
uiItemR(sub, &ptr, "use_mirror_v", 0, "", ICON_NONE);
|
||||
sub = uiLayoutRow(sub, true);
|
||||
uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_mirror_v"));
|
||||
uiItemR(sub, &ptr, "mirror_offset_v", UI_ITEM_R_SLIDER, "", ICON_NONE);
|
||||
uiItemDecoratorR(row, &ptr, "mirror_offset_v", 0);
|
||||
|
||||
uiItemR(layout, &ptr, "use_mirror_vertex_groups", 0, IFACE_("Vertex Groups"), ICON_NONE);
|
||||
uiItemR(layout, &ptr, "use_mirror_udim", 0, IFACE_("Flip UDIM"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Mirror, panel_draw);
|
||||
modifier_subpanel_register(region_type, "data", "Data", NULL, data_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Mirror = {
|
||||
/* name */ "Mirror",
|
||||
/* structName */ "MirrorModifierData",
|
||||
@@ -146,4 +244,5 @@ ModifierTypeInfo modifierType_Mirror = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -27,24 +27,37 @@
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_cdderivedmesh.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_multires.h"
|
||||
#include "BKE_paint.h"
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_subdiv.h"
|
||||
#include "BKE_subdiv_ccg.h"
|
||||
#include "BKE_subdiv_deform.h"
|
||||
#include "BKE_subdiv_mesh.h"
|
||||
#include "BKE_subsurf.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "WM_types.h" /* For subdivide operator UI. */
|
||||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
|
||||
typedef struct MultiresRuntimeData {
|
||||
/* Cached subdivision surface descriptor, with topology and settings. */
|
||||
@@ -272,6 +285,112 @@ static void deformMatrices(ModifierData *md,
|
||||
}
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *row, *col, *split, *col2;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
MultiresModifierData *mmd = (MultiresModifierData *)ptr.data;
|
||||
|
||||
PointerRNA op_ptr;
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "subdivision_type", 0, NULL, ICON_NONE);
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiItemR(col, &ptr, "levels", 0, IFACE_("Levels Viewport"), ICON_NONE);
|
||||
uiItemR(col, &ptr, "render_levels", 0, IFACE_("Render"), ICON_NONE);
|
||||
uiItemR(layout, &ptr, "show_only_control_edges", 0, NULL, ICON_NONE);
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
split = uiLayoutSplit(layout, 0.5f, false);
|
||||
uiLayoutSetEnabled(split, ELEM(RNA_enum_get(&ob_ptr, "mode"), OB_MODE_EDIT, OB_MODE_SCULPT));
|
||||
col = uiLayoutColumn(split, false);
|
||||
col2 = uiLayoutColumn(split, false);
|
||||
|
||||
uiItemO(col, IFACE_("Unsubdivide"), ICON_NONE, "OBJECT_OT_multires_unsubdivide");
|
||||
|
||||
row = uiLayoutRow(col2, true);
|
||||
uiItemFullO(row,
|
||||
"OBJECT_OT_multires_subdivide",
|
||||
IFACE_("Subdivide"),
|
||||
ICON_NONE,
|
||||
NULL,
|
||||
WM_OP_EXEC_DEFAULT,
|
||||
0,
|
||||
&op_ptr);
|
||||
RNA_enum_set(&op_ptr, "mode", MULTIRES_SUBDIVIDE_CATMULL_CLARK);
|
||||
uiItemFullO(row,
|
||||
"OBJECT_OT_multires_subdivide",
|
||||
IFACE_("Simple"),
|
||||
ICON_NONE, /* TODO: Needs icon, remove text */
|
||||
NULL,
|
||||
WM_OP_EXEC_DEFAULT,
|
||||
0,
|
||||
&op_ptr);
|
||||
RNA_enum_set(&op_ptr, "mode", MULTIRES_SUBDIVIDE_SIMPLE);
|
||||
uiItemFullO(row,
|
||||
"OBJECT_OT_multires_subdivide",
|
||||
IFACE_("Linear"),
|
||||
ICON_NONE, /* TODO: Needs icon, remove text */
|
||||
NULL,
|
||||
WM_OP_EXEC_DEFAULT,
|
||||
0,
|
||||
&op_ptr);
|
||||
RNA_enum_set(&op_ptr, "mode", MULTIRES_SUBDIVIDE_LINEAR);
|
||||
|
||||
uiItemL(col, "", ICON_NONE);
|
||||
uiItemO(col2, IFACE_("Delete Higher"), ICON_NONE, "OBJECT_OT_multires_higher_levels_delete");
|
||||
|
||||
uiItemO(col, IFACE_("Reshape"), ICON_NONE, "OBJECT_OT_multires_reshape");
|
||||
uiItemO(col2, IFACE_("Apply Base"), ICON_NONE, "OBJECT_OT_multires_base_apply");
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
if (mmd->totlvl == 0) {
|
||||
uiItemO(
|
||||
layout, IFACE_("Rebuild Subdivisions"), ICON_NONE, "OBJECT_OT_multires_rebuild_subdiv");
|
||||
}
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
row = uiLayoutRow(col, false);
|
||||
if (RNA_boolean_get(&ptr, "is_external")) {
|
||||
uiItemO(row, IFACE_("Pack External"), ICON_NONE, "OBJECT_OT_multires_external_pack");
|
||||
row = uiLayoutRow(col, false);
|
||||
uiItemR(row, &ptr, "filepath", 0, "", ICON_NONE);
|
||||
}
|
||||
else {
|
||||
uiItemO(col, IFACE_("Save External..."), ICON_NONE, "OBJECT_OT_multires_external_save");
|
||||
}
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void advanced_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "quality", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "uv_smooth", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "use_creases", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Multires, panel_draw);
|
||||
modifier_subpanel_register(
|
||||
region_type, "advanced", "Advanced", NULL, advanced_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Multires = {
|
||||
/* name */ "Multires",
|
||||
/* structName */ "MultiresModifierData",
|
||||
@@ -302,4 +421,5 @@ ModifierTypeInfo modifierType_Multires = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ freeRuntimeData,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -27,17 +27,28 @@
|
||||
#include "BLI_bitmap.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
|
||||
static void generate_vert_coordinates(Mesh *mesh,
|
||||
@@ -689,8 +700,86 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
||||
return normalEditModifier_do((NormalEditModifierData *)md, ctx, ctx->object, mesh);
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
int mode = RNA_enum_get(&ptr, "mode");
|
||||
|
||||
uiItemR(layout, &ptr, "mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "target", 0, NULL, ICON_NONE);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiLayoutSetActive(col, mode == MOD_NORMALEDIT_MODE_DIRECTIONAL);
|
||||
uiItemR(col, &ptr, "use_direction_parallel", 0, NULL, ICON_NONE);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
/* This panel could be open by default, but it isn't currently. */
|
||||
static void mix_mode_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *row;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "mix_mode", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "mix_factor", 0, NULL, ICON_NONE);
|
||||
|
||||
modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
|
||||
|
||||
row = uiLayoutRow(layout, true);
|
||||
uiItemR(row, &ptr, "mix_limit", 0, NULL, ICON_NONE);
|
||||
uiItemR(row,
|
||||
&ptr,
|
||||
"no_polynors_fix",
|
||||
0,
|
||||
"",
|
||||
(RNA_boolean_get(&ptr, "no_polynors_fix") ? ICON_LOCKED : ICON_UNLOCKED));
|
||||
}
|
||||
|
||||
static void offset_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
int mode = RNA_enum_get(&ptr, "mode");
|
||||
PointerRNA target_ptr = RNA_pointer_get(&ptr, "target");
|
||||
bool needs_object_offset = (mode == MOD_NORMALEDIT_MODE_RADIAL &&
|
||||
RNA_pointer_is_null(&target_ptr)) ||
|
||||
(mode == MOD_NORMALEDIT_MODE_DIRECTIONAL &&
|
||||
RNA_boolean_get(&ptr, "use_direction_parallel"));
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiLayoutSetActive(layout, needs_object_offset);
|
||||
uiItemR(layout, &ptr, "offset", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = modifier_panel_register(
|
||||
region_type, eModifierType_NormalEdit, panel_draw);
|
||||
modifier_subpanel_register(region_type, "mix", "Mix", NULL, mix_mode_panel_draw, panel_type);
|
||||
modifier_subpanel_register(region_type, "offset", "Offset", NULL, offset_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_NormalEdit = {
|
||||
/* name */ "Set Split Normals",
|
||||
/* name */ "NormalEdit",
|
||||
/* structName */ "NormalEditModifierData",
|
||||
/* structSize */ sizeof(NormalEditModifierData),
|
||||
/* type */ eModifierTypeType_Constructive,
|
||||
@@ -719,4 +808,5 @@ ModifierTypeInfo modifierType_NormalEdit = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -27,21 +27,34 @@
|
||||
#include "BLI_math_inline.h"
|
||||
#include "BLI_task.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_customdata_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_ocean.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "WM_types.h" /* For UI free bake operator. */
|
||||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
|
||||
#ifdef WITH_OCEANSIM
|
||||
static void init_cache_data(Object *ob, struct OceanModifierData *omd)
|
||||
@@ -494,6 +507,172 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
||||
|
||||
return result;
|
||||
}
|
||||
// #define WITH_OCEANSIM
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
#ifdef WITH_OCEANSIM
|
||||
uiLayout *col;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "geometry_mode", 0, NULL, ICON_NONE);
|
||||
if (RNA_enum_get(&ptr, "geometry_mode") == MOD_OCEAN_GEOM_GENERATE) {
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiItemR(col, &ptr, "repeat_x", 0, IFACE_("Repeat X"), ICON_NONE);
|
||||
uiItemR(col, &ptr, "repeat_y", 0, IFACE_("Y"), ICON_NONE);
|
||||
}
|
||||
uiItemR(layout, &ptr, "random_seed", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "resolution", 0, NULL, ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "time", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "depth", 0, NULL, ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "size", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "spatial_size", 0, NULL, ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "use_normals", 0, NULL, ICON_NONE);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
|
||||
#else /* WITH_OCEANSIM */
|
||||
uiItemL(layout, IFACE_("Built without Ocean modifier"), ICON_NONE);
|
||||
UNUSED_VARS(C);
|
||||
#endif /* WITH_OCEANSIM */
|
||||
}
|
||||
|
||||
#ifdef WITH_OCEANSIM
|
||||
static void waves_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "wave_scale", 0, IFACE_("Scale"), ICON_NONE);
|
||||
uiItemR(layout, &ptr, "wave_scale_min", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "choppiness", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "wind_velocity", 0, NULL, ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "wave_alignment", 0, IFACE_("Alignment"), ICON_NONE);
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiLayoutSetActive(col, RNA_float_get(&ptr, "wave_alignment") > 0.0f);
|
||||
uiItemR(col, &ptr, "wave_direction", 0, IFACE_("Direction"), ICON_NONE);
|
||||
uiItemR(col, &ptr, "damping", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void foam_panel_draw_header(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiItemR(layout, &ptr, "use_foam", 0, IFACE_("Foam"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void foam_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
bool use_foam = RNA_boolean_get(&ptr, "use_foam");
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiLayoutSetActive(col, use_foam);
|
||||
uiItemR(col, &ptr, "foam_coverage", 0, IFACE_("Coverage"), ICON_NONE);
|
||||
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiLayoutSetActive(col, use_foam);
|
||||
uiItemR(col, &ptr, "foam_layer_name", 0, IFACE_("Data Layer"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void spectrum_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
int spectrum = RNA_enum_get(&ptr, "spectrum");
|
||||
|
||||
uiItemR(layout, &ptr, "spectrum", 0, NULL, ICON_NONE);
|
||||
if (ELEM(spectrum, MOD_OCEAN_SPECTRUM_TEXEL_MARSEN_ARSLOE, MOD_OCEAN_SPECTRUM_JONSWAP)) {
|
||||
uiItemR(layout, &ptr, "sharpen_peak_jonswap", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "fetch_jonswap", 0, NULL, ICON_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
static void bake_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
bool is_cached = RNA_boolean_get(&ptr, "is_cached");
|
||||
bool use_foam = RNA_boolean_get(&ptr, "use_foam");
|
||||
|
||||
if (is_cached) {
|
||||
PointerRNA op_ptr;
|
||||
uiItemFullO(layout,
|
||||
"OBJECT_OT_ocean_bake",
|
||||
IFACE_("Delete Bake"),
|
||||
ICON_NONE,
|
||||
NULL,
|
||||
WM_OP_EXEC_DEFAULT,
|
||||
0,
|
||||
&op_ptr);
|
||||
RNA_boolean_set(&op_ptr, "free", true);
|
||||
}
|
||||
else {
|
||||
uiItemO(layout, NULL, ICON_NONE, "OBJECT_OT_ocean_bake");
|
||||
}
|
||||
|
||||
uiItemR(layout, &ptr, "filepath", 0, NULL, ICON_NONE);
|
||||
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiLayoutSetEnabled(col, !is_cached);
|
||||
uiItemR(col, &ptr, "frame_start", 0, IFACE_("Start"), ICON_NONE);
|
||||
uiItemR(col, &ptr, "frame_end", 0, IFACE_("End"), ICON_NONE);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiLayoutSetActive(col, use_foam);
|
||||
uiItemR(col, &ptr, "bake_foam_fade", 0, NULL, ICON_NONE);
|
||||
}
|
||||
#endif /* WITH_OCEANSIM */
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Ocean, panel_draw);
|
||||
#ifdef WITH_OCEANSIM
|
||||
modifier_subpanel_register(region_type, "waves", "Waves", NULL, waves_panel_draw, panel_type);
|
||||
modifier_subpanel_register(
|
||||
region_type, "foam", "", foam_panel_draw_header, foam_panel_draw, panel_type);
|
||||
modifier_subpanel_register(
|
||||
region_type, "spectrum", "Spectrum", NULL, spectrum_panel_draw, panel_type);
|
||||
modifier_subpanel_register(region_type, "bake", "Bake", NULL, bake_panel_draw, panel_type);
|
||||
#else
|
||||
UNUSED_VARS(panel_type);
|
||||
#endif /* WITH_OCEANSIM */
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Ocean = {
|
||||
/* name */ "Ocean",
|
||||
@@ -525,4 +704,5 @@ ModifierTypeInfo modifierType_Ocean = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -30,9 +30,13 @@
|
||||
#include "BLI_rand.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_effect.h"
|
||||
#include "BKE_lattice.h"
|
||||
#include "BKE_lib_query.h"
|
||||
@@ -40,11 +44,18 @@
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_particle.h"
|
||||
#include "BKE_pointcache.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph_build.h"
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
|
||||
static void initData(ModifierData *md)
|
||||
{
|
||||
@@ -546,6 +557,129 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *row;
|
||||
uiLayout *layout = panel->layout;
|
||||
int toggles_flag = UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
PointerRNA particle_obj_ptr = RNA_pointer_get(&ptr, "object");
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "object", 0, NULL, ICON_NONE);
|
||||
if (!RNA_pointer_is_null(&particle_obj_ptr)) {
|
||||
uiItemPointerR(layout,
|
||||
&ptr,
|
||||
"particle_system",
|
||||
&particle_obj_ptr,
|
||||
"particle_systems",
|
||||
"Particle System",
|
||||
ICON_NONE);
|
||||
}
|
||||
else {
|
||||
uiItemR(layout, &ptr, "particle_system_index", 0, IFACE_("Particle System"), ICON_NONE);
|
||||
}
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
row = uiLayoutRowWithHeading(layout, true, IFACE_("Create Instances"));
|
||||
uiItemR(row, &ptr, "use_normal", toggles_flag, NULL, ICON_NONE);
|
||||
uiItemR(row, &ptr, "use_children", toggles_flag, NULL, ICON_NONE);
|
||||
uiItemR(row, &ptr, "use_size", toggles_flag, NULL, ICON_NONE);
|
||||
|
||||
row = uiLayoutRowWithHeading(layout, true, IFACE_("Show"));
|
||||
uiItemR(row, &ptr, "show_alive", toggles_flag, NULL, ICON_NONE);
|
||||
uiItemR(row, &ptr, "show_dead", toggles_flag, NULL, ICON_NONE);
|
||||
uiItemR(row, &ptr, "show_unborn", toggles_flag, NULL, ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "particle_amount", 0, IFACE_("Amount"), ICON_NONE);
|
||||
uiItemR(layout, &ptr, "particle_offset", 0, IFACE_("Offset"), ICON_NONE);
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
uiItemR(layout, &ptr, "space", 0, IFACE_("Coordinate Space"), ICON_NONE);
|
||||
row = uiLayoutRow(layout, true);
|
||||
uiItemR(row, &ptr, "axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void path_panel_draw_header(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiItemR(layout, &ptr, "use_path", 0, IFACE_("Create Along Paths"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void path_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiLayoutSetActive(layout, RNA_boolean_get(&ptr, "use_path"));
|
||||
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiItemR(col, &ptr, "position", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "random_position", UI_ITEM_R_SLIDER, IFACE_("Random"), ICON_NONE);
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiItemR(col, &ptr, "rotation", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "random_rotation", UI_ITEM_R_SLIDER, IFACE_("Random"), ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "use_preserve_shape", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void layers_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
PointerRNA obj_data_ptr = RNA_pointer_get(&ob_ptr, "data");
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemPointerR(layout,
|
||||
&ptr,
|
||||
"index_layer_name",
|
||||
&obj_data_ptr,
|
||||
"vertex_colors",
|
||||
IFACE_("Index"),
|
||||
ICON_NONE);
|
||||
uiItemPointerR(layout,
|
||||
&ptr,
|
||||
"value_layer_name",
|
||||
&obj_data_ptr,
|
||||
"vertex_colors",
|
||||
IFACE_("Value"),
|
||||
ICON_NONE);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = modifier_panel_register(
|
||||
region_type, eModifierType_ParticleInstance, panel_draw);
|
||||
modifier_subpanel_register(
|
||||
region_type, "paths", "", path_panel_draw_header, path_panel_draw, panel_type);
|
||||
modifier_subpanel_register(region_type, "layers", "Layers", NULL, layers_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_ParticleInstance = {
|
||||
/* name */ "ParticleInstance",
|
||||
/* structName */ "ParticleInstanceModifierData",
|
||||
@@ -576,4 +710,5 @@ ModifierTypeInfo modifierType_ParticleInstance = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -25,17 +25,28 @@
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_editmesh.h"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_particle.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
|
||||
static void initData(ModifierData *md)
|
||||
@@ -247,6 +258,43 @@ static void deformVertsEM(ModifierData *md,
|
||||
}
|
||||
#endif
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
Object *ob = ob_ptr.data;
|
||||
ModifierData *md = (ModifierData *)ptr.data;
|
||||
ParticleSystem *psys = ((ParticleSystemModifierData *)md)->psys;
|
||||
|
||||
uiItemL(layout, IFACE_("Settings are in the particle tab"), ICON_NONE);
|
||||
|
||||
if (!(ob->mode & OB_MODE_PARTICLE_EDIT)) {
|
||||
if (ELEM(psys->part->ren_as, PART_DRAW_GR, PART_DRAW_OB)) {
|
||||
uiItemO(layout,
|
||||
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Convert"),
|
||||
ICON_NONE,
|
||||
"OBJECT_OT_duplicates_make_real");
|
||||
}
|
||||
else if (psys->part->ren_as == PART_DRAW_PATH) {
|
||||
uiItemO(layout,
|
||||
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Convert"),
|
||||
ICON_NONE,
|
||||
"OBJECT_OT_modifier_convert");
|
||||
}
|
||||
}
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_ParticleSystem, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_ParticleSystem = {
|
||||
/* name */ "ParticleSystem",
|
||||
/* structName */ "ParticleSystemModifierData",
|
||||
@@ -280,4 +328,5 @@ ModifierTypeInfo modifierType_ParticleSystem = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -27,16 +27,27 @@
|
||||
#include "BLI_math_base.h"
|
||||
#include "BLI_threads.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_mesh_remesh_voxel.h"
|
||||
#include "BKE_mesh_runtime.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
@@ -226,6 +237,54 @@ static Mesh *modifyMesh(ModifierData *UNUSED(md),
|
||||
|
||||
#endif /* !WITH_MOD_REMESH */
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
#ifdef WITH_MOD_REMESH
|
||||
uiLayout *row;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
int mode = RNA_enum_get(&ptr, "mode");
|
||||
|
||||
uiItemR(layout, &ptr, "mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
if (mode == MOD_REMESH_VOXEL) {
|
||||
uiItemR(layout, &ptr, "voxel_size", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "adaptivity", 0, NULL, ICON_NONE);
|
||||
}
|
||||
else {
|
||||
uiItemR(layout, &ptr, "octree_depth", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "scale", 0, NULL, ICON_NONE);
|
||||
|
||||
if (mode == MOD_REMESH_SHARP_FEATURES) {
|
||||
uiItemR(layout, &ptr, "sharpness", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
uiItemR(layout, &ptr, "use_remove_disconnected", 0, NULL, ICON_NONE);
|
||||
row = uiLayoutRow(layout, false);
|
||||
uiLayoutSetActive(row, RNA_boolean_get(&ptr, "use_remove_disconnected"));
|
||||
uiItemR(layout, &ptr, "threshold", 0, NULL, ICON_NONE);
|
||||
}
|
||||
uiItemR(layout, &ptr, "use_smooth_shade", 0, NULL, ICON_NONE);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
|
||||
#else /* WITH_MOD_REMESH */
|
||||
uiItemL(layout, IFACE_("Built without Remesh modifier"), ICON_NONE);
|
||||
UNUSED_VARS(C);
|
||||
#endif /* WITH_MOD_REMESH */
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_Remesh, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Remesh = {
|
||||
/* name */ "Remesh",
|
||||
/* structName */ "RemeshModifierData",
|
||||
@@ -254,5 +313,7 @@ ModifierTypeInfo modifierType_Remesh = {
|
||||
/* dependsOnNormals */ NULL,
|
||||
/* foreachObjectLink */ NULL,
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -29,18 +29,30 @@
|
||||
#include "BLI_alloca.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph_build.h"
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
|
||||
#include "BLI_strict_flags.h"
|
||||
|
||||
@@ -1156,6 +1168,83 @@ static void foreachObjectLink(ModifierData *md, Object *ob, ObjectWalkFunc walk,
|
||||
walk(userData, ob, <md->ob_axis, IDWALK_CB_NOP);
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *sub, *row, *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
int toggles_flag = UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
PointerRNA screw_obj_ptr = RNA_pointer_get(&ptr, "object");
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiItemR(col, &ptr, "angle", 0, NULL, ICON_NONE);
|
||||
row = uiLayoutRow(col, false);
|
||||
uiLayoutSetActive(row,
|
||||
RNA_pointer_is_null(&screw_obj_ptr) ||
|
||||
!RNA_boolean_get(&ptr, "use_object_screw_offset"));
|
||||
uiItemR(row, &ptr, "screw_offset", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "iterations", 0, NULL, ICON_NONE);
|
||||
|
||||
uiItemS(layout);
|
||||
col = uiLayoutColumn(layout, false);
|
||||
row = uiLayoutRow(col, false);
|
||||
uiItemR(row, &ptr, "axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "object", 0, IFACE_("Axis Object"), ICON_NONE);
|
||||
sub = uiLayoutColumn(col, false);
|
||||
uiLayoutSetActive(sub, !RNA_pointer_is_null(&screw_obj_ptr));
|
||||
uiItemR(sub, &ptr, "use_object_screw_offset", 0, NULL, ICON_NONE);
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiItemR(col, &ptr, "steps", 0, IFACE_("Steps Viewport"), ICON_NONE);
|
||||
uiItemR(col, &ptr, "render_steps", 0, IFACE_("Render"), ICON_NONE);
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
row = uiLayoutRowWithHeading(layout, true, IFACE_("Merge"));
|
||||
uiItemR(row, &ptr, "use_merge_vertices", 0, "", ICON_NONE);
|
||||
sub = uiLayoutRow(row, true);
|
||||
uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_merge_vertices"));
|
||||
uiItemR(sub, &ptr, "merge_threshold", 0, "", ICON_NONE);
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
row = uiLayoutRowWithHeading(layout, true, IFACE_("Stretch UVs"));
|
||||
uiItemR(row, &ptr, "use_stretch_u", toggles_flag, IFACE_("U"), ICON_NONE);
|
||||
uiItemR(row, &ptr, "use_stretch_v", toggles_flag, IFACE_("V"), ICON_NONE);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void normals_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiItemR(col, &ptr, "use_smooth_shade", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "use_normal_calculate", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "use_normal_flip", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Screw, panel_draw);
|
||||
modifier_subpanel_register(
|
||||
region_type, "normals", "Normals", NULL, normals_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Screw = {
|
||||
/* name */ "Screw",
|
||||
/* structName */ "ScrewModifierData",
|
||||
@@ -1187,4 +1276,5 @@ ModifierTypeInfo modifierType_Screw = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -147,4 +147,5 @@ ModifierTypeInfo modifierType_ShapeKey = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ NULL,
|
||||
};
|
||||
|
||||
@@ -25,18 +25,29 @@
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_editmesh.h"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_shrinkwrap.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
|
||||
static bool dependsOnNormals(ModifierData *md);
|
||||
@@ -203,6 +214,65 @@ static bool dependsOnNormals(ModifierData *md)
|
||||
return false;
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *row, *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
int toggles_flag = UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
int wrap_method = RNA_enum_get(&ptr, "wrap_method");
|
||||
|
||||
uiItemR(layout, &ptr, "wrap_method", 0, NULL, ICON_NONE);
|
||||
|
||||
if (ELEM(wrap_method,
|
||||
MOD_SHRINKWRAP_PROJECT,
|
||||
MOD_SHRINKWRAP_NEAREST_SURFACE,
|
||||
MOD_SHRINKWRAP_TARGET_PROJECT)) {
|
||||
uiItemR(layout, &ptr, "wrap_mode", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
if (wrap_method == MOD_SHRINKWRAP_PROJECT) {
|
||||
uiItemR(layout, &ptr, "project_limit", 0, IFACE_("Limit"), ICON_NONE);
|
||||
uiItemR(layout, &ptr, "subsurf_levels", 0, NULL, ICON_NONE);
|
||||
|
||||
row = uiLayoutRowWithHeading(layout, true, IFACE_("Axis"));
|
||||
uiItemR(row, &ptr, "use_project_x", toggles_flag, NULL, ICON_NONE);
|
||||
uiItemR(row, &ptr, "use_project_y", toggles_flag, NULL, ICON_NONE);
|
||||
uiItemR(row, &ptr, "use_project_z", toggles_flag, NULL, ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "use_negative_direction", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "use_positive_direction", 0, NULL, ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "cull_face", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiLayoutSetActive(col,
|
||||
RNA_boolean_get(&ptr, "use_negative_direction") &&
|
||||
RNA_enum_get(&ptr, "cull_face") != 0);
|
||||
uiItemR(col, &ptr, "use_invert_cull", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
uiItemR(layout, &ptr, "target", 0, NULL, ICON_NONE);
|
||||
if (wrap_method == MOD_SHRINKWRAP_PROJECT) {
|
||||
uiItemR(layout, &ptr, "auxiliary_target", 0, NULL, ICON_NONE);
|
||||
}
|
||||
uiItemR(layout, &ptr, "offset", 0, NULL, ICON_NONE);
|
||||
|
||||
modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_Shrinkwrap, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Shrinkwrap = {
|
||||
/* name */ "Shrinkwrap",
|
||||
/* structName */ "ShrinkwrapModifierData",
|
||||
@@ -234,4 +304,5 @@ ModifierTypeInfo modifierType_Shrinkwrap = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -25,19 +25,30 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_editmesh.h"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
|
||||
#include "bmesh.h"
|
||||
@@ -452,6 +463,80 @@ static void deformVertsEM(ModifierData *md,
|
||||
}
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *row;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
int deform_method = RNA_enum_get(&ptr, "deform_method");
|
||||
|
||||
row = uiLayoutRow(layout, false);
|
||||
uiItemR(row, &ptr, "deform_method", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
if (ELEM(deform_method, MOD_SIMPLEDEFORM_MODE_TAPER, MOD_SIMPLEDEFORM_MODE_STRETCH)) {
|
||||
uiItemR(layout, &ptr, "factor", 0, NULL, ICON_NONE);
|
||||
}
|
||||
else {
|
||||
uiItemR(layout, &ptr, "angle", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
uiItemR(layout, &ptr, "origin", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "deform_axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void restrictions_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *row;
|
||||
uiLayout *layout = panel->layout;
|
||||
int toggles_flag = UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
int deform_method = RNA_enum_get(&ptr, "deform_method");
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "limits", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
|
||||
|
||||
if (ELEM(deform_method,
|
||||
MOD_SIMPLEDEFORM_MODE_TAPER,
|
||||
MOD_SIMPLEDEFORM_MODE_STRETCH,
|
||||
MOD_SIMPLEDEFORM_MODE_TWIST)) {
|
||||
int deform_axis = RNA_enum_get(&ptr, "deform_axis");
|
||||
|
||||
row = uiLayoutRowWithHeading(layout, true, IFACE_("Lock"));
|
||||
if (deform_axis != 0) {
|
||||
uiItemR(row, &ptr, "lock_x", toggles_flag, NULL, ICON_NONE);
|
||||
}
|
||||
if (deform_axis != 1) {
|
||||
uiItemR(row, &ptr, "lock_y", toggles_flag, NULL, ICON_NONE);
|
||||
}
|
||||
if (deform_axis != 2) {
|
||||
uiItemR(row, &ptr, "lock_z", toggles_flag, NULL, ICON_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = modifier_panel_register(
|
||||
region_type, eModifierType_SimpleDeform, panel_draw);
|
||||
modifier_subpanel_register(
|
||||
region_type, "restrictions", "Restrictions", NULL, restrictions_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_SimpleDeform = {
|
||||
/* name */ "SimpleDeform",
|
||||
/* structName */ "SimpleDeformModifierData",
|
||||
@@ -484,4 +569,5 @@ ModifierTypeInfo modifierType_SimpleDeform = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_pointcloud_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_simulation_types.h"
|
||||
|
||||
#include "BKE_customdata.h"
|
||||
@@ -41,10 +42,22 @@
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_modifier.h"
|
||||
|
||||
/* SpaceType struct has a member called 'new' which obviously conflicts with C++
|
||||
* so temporarily redefining the new keyword to make it compile. */
|
||||
#define new extern_new
|
||||
#include "BKE_screen.h"
|
||||
#undef new
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph_build.h"
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
|
||||
static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
|
||||
{
|
||||
@@ -77,6 +90,25 @@ static PointCloud *modifyPointCloud(ModifierData *md,
|
||||
return pointcloud;
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
uiItemR(layout, &ptr, "simulation", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "data_path", 0, NULL, ICON_NONE);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_Mask, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Simulation = {
|
||||
/* name */ "Simulation",
|
||||
/* structName */ "SimulationModifierData",
|
||||
@@ -106,4 +138,5 @@ ModifierTypeInfo modifierType_Simulation = {
|
||||
/* foreachIDLink */ foreachIDLink,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -61,18 +61,31 @@
|
||||
#include "BLI_math_geom.h"
|
||||
#include "BLI_stack.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_mesh_mapping.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "WM_types.h" /* For skin mark clear operator UI. */
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
|
||||
#include "bmesh.h"
|
||||
|
||||
@@ -1934,6 +1947,64 @@ static void requiredDataMask(Object *UNUSED(ob),
|
||||
r_cddata_masks->vmask |= CD_MASK_MVERT_SKIN | CD_MASK_MDEFORMVERT;
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *row;
|
||||
uiLayout *layout = panel->layout;
|
||||
int toggles_flag = UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
PointerRNA op_ptr;
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "branch_smoothing", 0, NULL, ICON_NONE);
|
||||
|
||||
row = uiLayoutRowWithHeading(layout, true, IFACE_("Symmetry"));
|
||||
uiItemR(row, &ptr, "use_x_symmetry", toggles_flag, NULL, ICON_NONE);
|
||||
uiItemR(row, &ptr, "use_y_symmetry", toggles_flag, NULL, ICON_NONE);
|
||||
uiItemR(row, &ptr, "use_z_symmetry", toggles_flag, NULL, ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "use_smooth_shade", 0, NULL, ICON_NONE);
|
||||
|
||||
row = uiLayoutRow(layout, false);
|
||||
uiItemO(row, IFACE_("Create Armature"), ICON_NONE, "OBJECT_OT_skin_armature_create");
|
||||
uiItemO(row, NULL, ICON_NONE, "MESH_OT_customdata_skin_add");
|
||||
|
||||
row = uiLayoutRow(layout, true);
|
||||
uiItemFullO(row,
|
||||
"OBJECT_OT_skin_loose_mark_clear",
|
||||
IFACE_("Mark Loose"),
|
||||
ICON_NONE,
|
||||
NULL,
|
||||
WM_OP_EXEC_DEFAULT,
|
||||
0,
|
||||
&op_ptr);
|
||||
RNA_enum_set(&op_ptr, "action", 0); /* SKIN_LOOSE_MARK */
|
||||
uiItemFullO(row,
|
||||
"OBJECT_OT_skin_loose_mark_clear",
|
||||
IFACE_("Clear Loose"),
|
||||
ICON_NONE,
|
||||
NULL,
|
||||
WM_OP_EXEC_DEFAULT,
|
||||
0,
|
||||
&op_ptr);
|
||||
RNA_enum_set(&op_ptr, "action", 1); /* SKIN_LOOSE_CLEAR */
|
||||
|
||||
uiItemO(layout, IFACE_("Mark Root"), ICON_NONE, "OBJECT_OT_skin_root_mark");
|
||||
uiItemO(layout, IFACE_("Equalize Radii"), ICON_NONE, "OBJECT_OT_skin_radii_equalize");
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_Skin, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Skin = {
|
||||
/* name */ "Skin",
|
||||
/* structName */ "SkinModifierData",
|
||||
@@ -1961,5 +2032,7 @@ ModifierTypeInfo modifierType_Skin = {
|
||||
/* dependsOnNormals */ NULL,
|
||||
/* foreachObjectLink */ NULL,
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -27,16 +27,27 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_editmesh.h"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_particle.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
|
||||
static void initData(ModifierData *md)
|
||||
@@ -226,6 +237,37 @@ static void deformVertsEM(ModifierData *md,
|
||||
}
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *row, *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
int toggles_flag = UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
row = uiLayoutRowWithHeading(layout, true, IFACE_("Axis"));
|
||||
uiItemR(row, &ptr, "use_x", toggles_flag, NULL, ICON_NONE);
|
||||
uiItemR(row, &ptr, "use_y", toggles_flag, NULL, ICON_NONE);
|
||||
uiItemR(row, &ptr, "use_z", toggles_flag, NULL, ICON_NONE);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiItemR(col, &ptr, "factor", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "iterations", 0, NULL, ICON_NONE);
|
||||
|
||||
modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_Smooth, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Smooth = {
|
||||
/* name */ "Smooth",
|
||||
/* structName */ "SmoothModifierData",
|
||||
@@ -256,4 +298,5 @@ ModifierTypeInfo modifierType_Smooth = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -25,20 +25,31 @@
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_object_force_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_layer.h"
|
||||
#include "BKE_particle.h"
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_softbody.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
#include "DEG_depsgraph_build.h"
|
||||
#include "DEG_depsgraph_physics.h"
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
|
||||
static void deformVerts(ModifierData *UNUSED(md),
|
||||
const ModifierEvalContext *ctx,
|
||||
@@ -73,6 +84,23 @@ static void updateDepsgraph(ModifierData *UNUSED(md), const ModifierUpdateDepsgr
|
||||
DEG_add_modifier_to_transform_relation(ctx->node, "SoftBody Modifier");
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiItemL(layout, IFACE_("Settings are inside the Physics tab"), ICON_NONE);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_Softbody, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Softbody = {
|
||||
/* name */ "Softbody",
|
||||
/* structName */ "SoftbodyModifierData",
|
||||
@@ -104,4 +132,5 @@ ModifierTypeInfo modifierType_Softbody = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -21,13 +21,26 @@
|
||||
* \ingroup modifiers
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_particle.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
|
||||
#include "MOD_solidify_util.h"
|
||||
|
||||
@@ -84,6 +97,164 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
||||
return mesh;
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *sub, *row, *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
int solidify_mode = RNA_enum_get(&ptr, "solidify_mode");
|
||||
bool has_vertex_group = RNA_string_length(&ptr, "vertex_group") != 0;
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "solidify_mode", 0, NULL, ICON_NONE);
|
||||
|
||||
if (solidify_mode == MOD_SOLIDIFY_MODE_NONMANIFOLD) {
|
||||
uiItemR(layout, &ptr, "nonmanifold_thickness_mode", 0, IFACE_("Thickness"), ICON_NONE);
|
||||
uiItemR(layout, &ptr, "nonmanifold_boundary_mode", 0, IFACE_("Boundary"), ICON_NONE);
|
||||
}
|
||||
|
||||
uiItemR(layout, &ptr, "thickness", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "offset", 0, NULL, ICON_NONE);
|
||||
|
||||
if (solidify_mode == MOD_SOLIDIFY_MODE_NONMANIFOLD) {
|
||||
uiItemR(layout, &ptr, "nonmanifold_merge_threshold", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
col = uiLayoutColumnWithHeading(layout, false, "Rim");
|
||||
uiItemR(col, &ptr, "use_rim", 0, IFACE_("Fill"), ICON_NONE);
|
||||
sub = uiLayoutColumn(col, false);
|
||||
uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_rim"));
|
||||
uiItemR(sub, &ptr, "use_rim_only", 0, NULL, ICON_NONE);
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
|
||||
row = uiLayoutRow(layout, false);
|
||||
uiLayoutSetActive(row, has_vertex_group);
|
||||
uiItemR(row, &ptr, "thickness_vertex_group", 0, IFACE_("Factor"), ICON_NONE);
|
||||
|
||||
if (solidify_mode == MOD_SOLIDIFY_MODE_NONMANIFOLD) {
|
||||
row = uiLayoutRow(layout, false);
|
||||
uiLayoutSetActive(row, has_vertex_group);
|
||||
uiItemR(row, &ptr, "use_flat_faces", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void normals_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
int solidify_mode = RNA_enum_get(&ptr, "solidify_mode");
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "use_flip_normals", 0, NULL, ICON_NONE);
|
||||
if (solidify_mode == MOD_SOLIDIFY_MODE_EXTRUDE) {
|
||||
uiItemR(layout, &ptr, "use_quality_normals", 0, IFACE_("High Quality"), ICON_NONE);
|
||||
uiItemR(layout, &ptr, "use_even_offset", 0, NULL, ICON_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
static void materials_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "material_offset", 0, NULL, ICON_NONE);
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiLayoutSetActive(col, RNA_boolean_get(&ptr, "use_rim"));
|
||||
uiItemR(col, &ptr, "material_offset_rim", 0, IFACE_("Rim"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void edge_data_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
int solidify_mode = RNA_enum_get(&ptr, "solidify_mode");
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
if (solidify_mode == MOD_SOLIDIFY_MODE_EXTRUDE) {
|
||||
uiItemR(layout, &ptr, "edge_crease_inner", 0, IFACE_("Inner"), ICON_NONE);
|
||||
uiItemR(layout, &ptr, "edge_crease_outer", 0, IFACE_("Outer"), ICON_NONE);
|
||||
uiItemR(layout, &ptr, "edge_crease_rim", 0, IFACE_("Rim"), ICON_NONE);
|
||||
}
|
||||
uiItemR(layout, &ptr, "bevel_convex", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void clamp_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *row;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "thickness_clamp", 0, NULL, ICON_NONE);
|
||||
row = uiLayoutRow(layout, false);
|
||||
uiLayoutSetActive(row, RNA_float_get(&ptr, "thickness_clamp") > 0.0f);
|
||||
uiItemR(row, &ptr, "use_thickness_angle_clamp", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void vertex_group_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiItemPointerR(col, &ptr, "shell_vertex_group", &ob_ptr, "vertex_groups", "Shell", ICON_NONE);
|
||||
uiItemPointerR(col, &ptr, "rim_vertex_group", &ob_ptr, "vertex_groups", "Rim", ICON_NONE);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Solidify, panel_draw);
|
||||
modifier_subpanel_register(
|
||||
region_type, "normals", "Normals", NULL, normals_panel_draw, panel_type);
|
||||
modifier_subpanel_register(
|
||||
region_type, "materials", "Materials", NULL, materials_panel_draw, panel_type);
|
||||
modifier_subpanel_register(
|
||||
region_type, "edge_data", "Edge Data", NULL, edge_data_panel_draw, panel_type);
|
||||
modifier_subpanel_register(
|
||||
region_type, "clamp", "Thickness Clamp", NULL, clamp_panel_draw, panel_type);
|
||||
modifier_subpanel_register(region_type,
|
||||
"vertex_groups",
|
||||
"Output Vertex Groups",
|
||||
NULL,
|
||||
vertex_group_panel_draw,
|
||||
panel_type);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Solidify = {
|
||||
/* name */ "Solidify",
|
||||
/* structName */ "SolidifyModifierData",
|
||||
@@ -116,4 +287,5 @@ ModifierTypeInfo modifierType_Solidify = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -22,26 +22,40 @@
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_subdiv.h"
|
||||
#include "BKE_subdiv_ccg.h"
|
||||
#include "BKE_subdiv_deform.h"
|
||||
#include "BKE_subdiv_mesh.h"
|
||||
#include "BKE_subsurf.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RE_engine.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
|
||||
#include "intern/CCGSubSurf.h"
|
||||
|
||||
@@ -275,6 +289,142 @@ static void deformMatrices(ModifierData *md,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WITH_CYCLES
|
||||
static bool get_show_adaptive_options(const bContext *C, Panel *panel)
|
||||
{
|
||||
/* Don't show adaptive options if cycles isn't the active engine. */
|
||||
const struct RenderEngineType *engine_type = CTX_data_engine_type(C);
|
||||
if (!STREQ(engine_type->idname, "CYCLES")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Only show adaptive options if this is the last modifier. */
|
||||
PointerRNA md_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &md_ptr);
|
||||
ModifierData *md = md_ptr.data;
|
||||
if (md->next != NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Don't show adaptive options if the cycles experimental feature set is disabled. */
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
PointerRNA scene_ptr;
|
||||
RNA_id_pointer_create(&scene->id, &scene_ptr);
|
||||
if (BKE_scene_uses_cycles(scene)) {
|
||||
PointerRNA cycles_ptr = RNA_pointer_get(&scene_ptr, "cycles");
|
||||
if (RNA_enum_get(&cycles_ptr, "feature_set") != 1) { /* EXPERIMENTAL */
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
/* Only test for adaptive subdivision if built with cycles. */
|
||||
bool show_adaptive_options = false;
|
||||
bool ob_use_adaptive_subdivision = false;
|
||||
PointerRNA cycles_ptr = {NULL};
|
||||
PointerRNA ob_cycles_ptr = {NULL};
|
||||
#ifdef WITH_CYCLES
|
||||
PointerRNA scene_ptr;
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
RNA_id_pointer_create(&scene->id, &scene_ptr);
|
||||
if (BKE_scene_uses_cycles(scene)) {
|
||||
cycles_ptr = RNA_pointer_get(&scene_ptr, "cycles");
|
||||
ob_cycles_ptr = RNA_pointer_get(&ob_ptr, "cycles");
|
||||
if (!RNA_pointer_is_null(&ob_cycles_ptr)) {
|
||||
ob_use_adaptive_subdivision = RNA_boolean_get(&ob_cycles_ptr, "use_adaptive_subdivision");
|
||||
show_adaptive_options = get_show_adaptive_options(C, panel);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "subdivision_type", 0, IFACE_("Type"), ICON_NONE);
|
||||
|
||||
if (show_adaptive_options) {
|
||||
uiItemR(layout,
|
||||
&ob_cycles_ptr,
|
||||
"use_adaptive_subdivision",
|
||||
0,
|
||||
IFACE_("Adaptive Subdivision"),
|
||||
ICON_NONE);
|
||||
}
|
||||
if (ob_use_adaptive_subdivision && show_adaptive_options) {
|
||||
uiItemR(layout, &ob_cycles_ptr, "dicing_rate", 0, NULL, ICON_NONE);
|
||||
float render = MAX2(RNA_float_get(&cycles_ptr, "dicing_rate") *
|
||||
RNA_float_get(&ob_cycles_ptr, "dicing_rate"),
|
||||
0.1f);
|
||||
float preview = MAX2(RNA_float_get(&cycles_ptr, "preview_dicing_rate") *
|
||||
RNA_float_get(&ob_cycles_ptr, "dicing_rate"),
|
||||
0.1f);
|
||||
char output[64];
|
||||
snprintf(output, 64, "Final Scale: Render %.2f px, Viewport %.2f px", render, preview);
|
||||
uiItemL(layout, output, ICON_NONE);
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
uiItemR(layout, &ptr, "levels", 0, IFACE_("Levels Viewport"), ICON_NONE);
|
||||
}
|
||||
else {
|
||||
uiLayout *col = uiLayoutColumn(layout, true);
|
||||
uiItemR(col, &ptr, "levels", 0, IFACE_("Levels Viewport"), ICON_NONE);
|
||||
uiItemR(col, &ptr, "render_levels", 0, IFACE_("Render"), ICON_NONE);
|
||||
}
|
||||
|
||||
uiItemR(layout, &ptr, "show_only_control_edges", 0, NULL, ICON_NONE);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void advanced_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
bool ob_use_adaptive_subdivision = false;
|
||||
bool show_adaptive_options = false;
|
||||
#ifdef WITH_CYCLES
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
if (BKE_scene_uses_cycles(scene)) {
|
||||
PointerRNA ob_cycles_ptr = RNA_pointer_get(&ob_ptr, "cycles");
|
||||
if (!RNA_pointer_is_null(&ob_cycles_ptr)) {
|
||||
ob_use_adaptive_subdivision = RNA_boolean_get(&ob_cycles_ptr, "use_adaptive_subdivision");
|
||||
show_adaptive_options = get_show_adaptive_options(C, panel);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiLayoutSetActive(layout, !(show_adaptive_options && ob_use_adaptive_subdivision));
|
||||
uiItemR(layout, &ptr, "quality", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "uv_smooth", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "use_creases", 0, NULL, ICON_NONE);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Subsurf, panel_draw);
|
||||
modifier_subpanel_register(
|
||||
region_type, "advanced", "Advanced", NULL, advanced_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Subsurf = {
|
||||
/* name */ "Subdivision",
|
||||
/* structName */ "SubsurfModifierData",
|
||||
@@ -306,4 +456,5 @@ ModifierTypeInfo modifierType_Subsurf = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ freeRuntimeData,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -25,19 +25,30 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_bvhutils.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
@@ -182,6 +193,23 @@ static void deformVerts(ModifierData *md,
|
||||
}
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiItemL(layout, IFACE_("Settings are inside the Physics tab"), ICON_NONE);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_Surface, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Surface = {
|
||||
/* name */ "Surface",
|
||||
/* structName */ "SurfaceModifierData",
|
||||
@@ -212,4 +240,5 @@ ModifierTypeInfo modifierType_Surface = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -24,25 +24,35 @@
|
||||
#include "BLI_math_geom.h"
|
||||
#include "BLI_task.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_bvhutils.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_editmesh.h"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_mesh_runtime.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "BKE_deform.h"
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
|
||||
typedef struct SDefAdjacency {
|
||||
@@ -1385,8 +1395,50 @@ static bool isDisabled(const Scene *UNUSED(scene), ModifierData *md, bool UNUSED
|
||||
!(smd->verts != NULL && !(smd->flags & MOD_SDEF_BIND));
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
PointerRNA target_ptr = RNA_pointer_get(&ptr, "target");
|
||||
|
||||
bool is_bound = RNA_boolean_get(&ptr, "is_bound");
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiLayoutSetActive(col, !is_bound);
|
||||
uiItemR(col, &ptr, "target", 0, NULL, ICON_NONE);
|
||||
|
||||
uiItemR(col, &ptr, "falloff", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "strength", 0, NULL, ICON_NONE);
|
||||
|
||||
modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
if (is_bound) {
|
||||
uiItemO(col, IFACE_("Unbind"), ICON_NONE, "OBJECT_OT_surfacedeform_bind");
|
||||
}
|
||||
else {
|
||||
uiLayoutSetActive(col, !RNA_pointer_is_null(&target_ptr));
|
||||
uiItemO(col, IFACE_("Bind"), ICON_NONE, "OBJECT_OT_surfacedeform_bind");
|
||||
}
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_SurfaceDeform, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_SurfaceDeform = {
|
||||
/* name */ "Surface Deform",
|
||||
/* name */ "SurfaceDeform",
|
||||
/* structName */ "SurfaceDeformModifierData",
|
||||
/* structSize */ sizeof(SurfaceDeformModifierData),
|
||||
/* type */ eModifierTypeType_OnlyDeform,
|
||||
@@ -1414,4 +1466,5 @@ ModifierTypeInfo modifierType_SurfaceDeform = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -22,17 +22,28 @@
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "bmesh.h"
|
||||
#include "bmesh_tools.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
|
||||
static Mesh *triangulate_mesh(Mesh *mesh,
|
||||
const int quad_method,
|
||||
@@ -115,6 +126,29 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *UNUSED(ctx)
|
||||
return result;
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "quad_method", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "ngon_method", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "min_vertices", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "keep_custom_normals", 0, NULL, ICON_NONE);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_Triangulate, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Triangulate = {
|
||||
/* name */ "Triangulate",
|
||||
/* structName */ "TriangulateModifierData",
|
||||
@@ -144,5 +178,7 @@ ModifierTypeInfo modifierType_Triangulate = {
|
||||
/* dependsOnNormals */ NULL,
|
||||
/* foreachObjectLink */ NULL,
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
426
source/blender/modifiers/intern/MOD_ui_common.c
Normal file
426
source/blender/modifiers/intern/MOD_ui_common.c
Normal file
@@ -0,0 +1,426 @@
|
||||
/* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \ingroup modifiers
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "BLI_listbase.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "DNA_object_force_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_particle_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_space_types.h"
|
||||
|
||||
#include "ED_object.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h" /* Self include */
|
||||
|
||||
static Object *get_modifier_object(const bContext *C)
|
||||
{
|
||||
SpaceProperties *sbuts = CTX_wm_space_properties(C);
|
||||
if (sbuts != NULL && (sbuts->pinid != NULL) && GS(sbuts->pinid->name) == ID_OB) {
|
||||
return (Object *)sbuts->pinid;
|
||||
}
|
||||
else {
|
||||
return CTX_data_active_object(C);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Poll function so these modifier panels don't show for other object types with modifiers (only
|
||||
* grease pencil currently).
|
||||
*/
|
||||
static bool modifier_ui_poll(const bContext *C, PanelType *UNUSED(pt))
|
||||
{
|
||||
Object *ob = get_modifier_object(C);
|
||||
|
||||
return (ob != NULL) && (ob->type != OB_GPENCIL);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Panel Drag and Drop, Expansion Saving
|
||||
* \{ */
|
||||
|
||||
/**
|
||||
* Move a modifier to the index it's moved to after a drag and drop.
|
||||
*/
|
||||
static void modifier_reorder(bContext *C, Panel *panel, int new_index)
|
||||
{
|
||||
Object *ob = get_modifier_object(C);
|
||||
|
||||
ModifierData *md = BLI_findlink(&ob->modifiers, panel->runtime.list_index);
|
||||
PointerRNA props_ptr;
|
||||
wmOperatorType *ot = WM_operatortype_find("OBJECT_OT_modifier_move_to_index", false);
|
||||
WM_operator_properties_create_ptr(&props_ptr, ot);
|
||||
RNA_string_set(&props_ptr, "modifier", md->name);
|
||||
RNA_int_set(&props_ptr, "index", new_index);
|
||||
WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr);
|
||||
WM_operator_properties_free(&props_ptr);
|
||||
}
|
||||
|
||||
static short get_modifier_expand_flag(const bContext *C, Panel *panel)
|
||||
{
|
||||
Object *ob = get_modifier_object(C);
|
||||
ModifierData *md = BLI_findlink(&ob->modifiers, panel->runtime.list_index);
|
||||
return md->ui_expand_flag;
|
||||
}
|
||||
|
||||
static void set_modifier_expand_flag(const bContext *C, Panel *panel, short expand_flag)
|
||||
{
|
||||
Object *ob = get_modifier_object(C);
|
||||
ModifierData *md = BLI_findlink(&ob->modifiers, panel->runtime.list_index);
|
||||
md->ui_expand_flag = expand_flag;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Modifier Panel Layouts
|
||||
* \{ */
|
||||
|
||||
/**
|
||||
* Draw modifier error message.
|
||||
*/
|
||||
void modifier_panel_end(uiLayout *layout, PointerRNA *ptr)
|
||||
{
|
||||
ModifierData *md = ptr->data;
|
||||
if (md->error) {
|
||||
uiLayout *row = uiLayoutRow(layout, false);
|
||||
uiItemL(row, IFACE_(md->error), ICON_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets RNA pointers for the active object and the panel's modifier data. Also locks
|
||||
* the layout if the modifer is from a linked object, and sets the context pointer.
|
||||
*/
|
||||
#define ERROR_LIBDATA_MESSAGE TIP_("External library data")
|
||||
void modifier_panel_get_property_pointers(const bContext *C,
|
||||
Panel *panel,
|
||||
PointerRNA *r_ob_ptr,
|
||||
PointerRNA *r_md_ptr)
|
||||
{
|
||||
Object *ob = get_modifier_object(C);
|
||||
|
||||
ModifierData *md = BLI_findlink(&ob->modifiers, panel->runtime.list_index);
|
||||
|
||||
RNA_pointer_create(&ob->id, &RNA_Modifier, md, r_md_ptr);
|
||||
|
||||
if (r_ob_ptr != NULL) {
|
||||
RNA_pointer_create(&ob->id, &RNA_Object, ob, r_ob_ptr);
|
||||
}
|
||||
|
||||
uiBlock *block = uiLayoutGetBlock(panel->layout);
|
||||
UI_block_lock_set(
|
||||
block, BKE_object_obdata_is_libdata(ob) || ID_IS_LINKED(ob), ERROR_LIBDATA_MESSAGE);
|
||||
|
||||
uiLayoutSetContextPointer(panel->layout, "modifier", r_md_ptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function for modifier layouts to draw vertex group settings.
|
||||
*/
|
||||
void modifier_vgroup_ui(uiLayout *layout,
|
||||
PointerRNA *ptr,
|
||||
PointerRNA *ob_ptr,
|
||||
const char *vgroup_prop,
|
||||
const char *invert_vgroup_prop,
|
||||
const char *text)
|
||||
{
|
||||
bool has_vertex_group = RNA_string_length(ptr, vgroup_prop) != 0;
|
||||
|
||||
uiLayout *row = uiLayoutRow(layout, true);
|
||||
uiItemPointerR(row, ptr, vgroup_prop, ob_ptr, "vertex_groups", text, ICON_NONE);
|
||||
if (invert_vgroup_prop != NULL) {
|
||||
uiLayout *sub = uiLayoutRow(row, true);
|
||||
uiLayoutSetActive(sub, has_vertex_group);
|
||||
uiLayoutSetPropDecorate(sub, false);
|
||||
uiItemR(sub, ptr, invert_vgroup_prop, 0, "", ICON_ARROW_LEFTRIGHT);
|
||||
}
|
||||
if (uiLayoutGetPropDecorate(layout)) {
|
||||
uiItemL(row, "", ICON_BLANK1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether Modifier is a simulation or not. Used for switching to the
|
||||
* physics/particles context tab.
|
||||
*/
|
||||
static int modifier_is_simulation(ModifierData *md)
|
||||
{
|
||||
/* Physic Tab */
|
||||
if (ELEM(md->type,
|
||||
eModifierType_Cloth,
|
||||
eModifierType_Collision,
|
||||
eModifierType_Fluidsim,
|
||||
eModifierType_Fluid,
|
||||
eModifierType_Softbody,
|
||||
eModifierType_Surface,
|
||||
eModifierType_DynamicPaint)) {
|
||||
return 1;
|
||||
}
|
||||
/* Particle Tab */
|
||||
else if (md->type == eModifierType_ParticleSystem) {
|
||||
return 2;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static bool modifier_can_delete(ModifierData *md)
|
||||
{
|
||||
/* fluid particle modifier can't be deleted here */
|
||||
if (md->type == eModifierType_ParticleSystem) {
|
||||
short particle_type = ((ParticleSystemModifierData *)md)->psys->part->type;
|
||||
if (ELEM(particle_type,
|
||||
PART_FLUID,
|
||||
PART_FLUID_FLIP,
|
||||
PART_FLUID_FOAM,
|
||||
PART_FLUID_SPRAY,
|
||||
PART_FLUID_BUBBLE,
|
||||
PART_FLUID_TRACER,
|
||||
PART_FLUID_SPRAYFOAM,
|
||||
PART_FLUID_SPRAYBUBBLE,
|
||||
PART_FLUID_FOAMBUBBLE,
|
||||
PART_FLUID_SPRAYFOAMBUBBLE)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static void modifier_ops_extra_draw(bContext *UNUSED(C), uiLayout *layout, void *md_v)
|
||||
{
|
||||
ModifierData *md = (ModifierData *)md_v;
|
||||
|
||||
uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT);
|
||||
|
||||
uiItemEnumO(layout,
|
||||
"OBJECT_OT_modifier_apply",
|
||||
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"),
|
||||
0,
|
||||
"apply_as",
|
||||
MODIFIER_APPLY_DATA);
|
||||
|
||||
if (BKE_modifier_is_same_topology(md) && !BKE_modifier_is_non_geometrical(md)) {
|
||||
uiItemEnumO(layout,
|
||||
"OBJECT_OT_modifier_apply",
|
||||
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply As Shapekey"),
|
||||
ICON_SHAPEKEY_DATA,
|
||||
"apply_as",
|
||||
MODIFIER_APPLY_SHAPE);
|
||||
}
|
||||
|
||||
if (!ELEM(md->type,
|
||||
eModifierType_Fluidsim,
|
||||
eModifierType_Softbody,
|
||||
eModifierType_ParticleSystem,
|
||||
eModifierType_Cloth,
|
||||
eModifierType_Fluid)) {
|
||||
uiItemO(layout,
|
||||
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Duplicate"),
|
||||
ICON_DUPLICATE,
|
||||
"OBJECT_OT_modifier_copy");
|
||||
}
|
||||
|
||||
if (modifier_can_delete(md) && !modifier_is_simulation(md)) {
|
||||
uiItemO(layout,
|
||||
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Delete"),
|
||||
ICON_X,
|
||||
"OBJECT_OT_modifier_remove");
|
||||
}
|
||||
}
|
||||
|
||||
static void modifier_panel_header(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *row, *sub;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
Object *ob = get_modifier_object(C);
|
||||
|
||||
/* Don't use #modifier_panel_get_property_pointers, we don't want to lock the header. */
|
||||
ModifierData *md = BLI_findlink(&ob->modifiers, panel->runtime.list_index);
|
||||
RNA_pointer_create(&ob->id, &RNA_Modifier, md, &ptr);
|
||||
uiLayoutSetContextPointer(panel->layout, "modifier", &ptr);
|
||||
|
||||
const ModifierTypeInfo *mti = BKE_modifier_get_info(md->type);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
int index = panel->runtime.list_index;
|
||||
bool narrow_panel = (panel->sizex < UI_UNIT_X * 8 && panel->sizex != 0);
|
||||
|
||||
/* Modifier Icon. */
|
||||
row = uiLayoutRow(layout, false);
|
||||
if (mti->isDisabled && mti->isDisabled(scene, md, 0)) {
|
||||
uiLayoutSetRedAlert(row, true);
|
||||
}
|
||||
uiItemL(row, "", RNA_struct_ui_icon(ptr.type));
|
||||
|
||||
/* Modifier Name. */
|
||||
if (!narrow_panel) {
|
||||
uiItemR(layout, &ptr, "name", 0, "", ICON_NONE);
|
||||
}
|
||||
|
||||
/* Switch context buttons. */
|
||||
if (modifier_is_simulation(md) == 1) {
|
||||
uiItemStringO(
|
||||
layout, "", ICON_PROPERTIES, "WM_OT_properties_context_change", "context", "PHYSICS");
|
||||
}
|
||||
else if (modifier_is_simulation(md) == 2) {
|
||||
uiItemStringO(
|
||||
layout, "", ICON_PROPERTIES, "WM_OT_properties_context_change", "context", "PARTICLES");
|
||||
}
|
||||
|
||||
/* Mode switching buttons. */
|
||||
row = uiLayoutRow(layout, true);
|
||||
if (ob->type == OB_MESH) {
|
||||
int last_cage_index;
|
||||
int cage_index = BKE_modifiers_get_cage_index(scene, ob, &last_cage_index, 0);
|
||||
if (BKE_modifier_supports_cage(scene, md) && (index <= last_cage_index)) {
|
||||
sub = uiLayoutRow(row, true);
|
||||
if (index < cage_index || !BKE_modifier_couldbe_cage(scene, md)) {
|
||||
uiLayoutSetActive(sub, false);
|
||||
}
|
||||
uiItemR(sub, &ptr, "show_on_cage", 0, "", ICON_NONE);
|
||||
}
|
||||
} /* Tessellation point for curve-typed objects. */
|
||||
else if (ELEM(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
|
||||
if (mti->type != eModifierTypeType_Constructive) {
|
||||
/* Constructive modifiers tessellates curve before applying. */
|
||||
uiItemR(layout, &ptr, "use_apply_on_spline", 0, "", ICON_NONE);
|
||||
}
|
||||
}
|
||||
/* Collision and Surface are always enabled, hide buttons. */
|
||||
if (((md->type != eModifierType_Collision) || !(ob->pd && ob->pd->deflect)) &&
|
||||
(md->type != eModifierType_Surface)) {
|
||||
if (mti->flags & eModifierTypeFlag_SupportsEditmode) {
|
||||
sub = uiLayoutRow(row, true);
|
||||
uiLayoutSetActive(sub, (md->mode & eModifierMode_Realtime));
|
||||
uiItemR(sub, &ptr, "show_in_editmode", 0, "", ICON_NONE);
|
||||
}
|
||||
uiItemR(row, &ptr, "show_viewport", 0, "", ICON_NONE);
|
||||
uiItemR(row, &ptr, "show_render", 0, "", ICON_NONE);
|
||||
}
|
||||
|
||||
row = uiLayoutRow(layout, false);
|
||||
uiItemMenuF(row, "", ICON_DOWNARROW_HLT, modifier_ops_extra_draw, md);
|
||||
|
||||
/* Some padding at the end, so the buttons aren't too close to the drag button. */
|
||||
uiItemS(layout);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Modifier Registration Helpers
|
||||
* \{ */
|
||||
|
||||
/**
|
||||
* Create a panel in the context's region
|
||||
*/
|
||||
PanelType *modifier_panel_register(ARegionType *region_type, ModifierType type, PanelDrawFn draw)
|
||||
{
|
||||
/* Get the name for the modifier's panel. */
|
||||
char panel_idname[BKE_ST_MAXNAME];
|
||||
BKE_modifier_type_panel_id(type, panel_idname);
|
||||
|
||||
PanelType *panel_type = MEM_callocN(sizeof(PanelType), panel_idname);
|
||||
|
||||
strcpy(panel_type->idname, panel_idname);
|
||||
strcpy(panel_type->label, "");
|
||||
strcpy(panel_type->context, "modifier");
|
||||
strcpy(panel_type->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
|
||||
|
||||
panel_type->draw_header = modifier_panel_header;
|
||||
panel_type->draw = draw;
|
||||
panel_type->poll = modifier_ui_poll;
|
||||
|
||||
/* Give the panel the special flag that says it was built here and corresponds to a
|
||||
* modifer rather than a PanelType. */
|
||||
panel_type->flag = PNL_LAYOUT_HEADER_EXPAND | PNL_DRAW_BOX | PNL_INSTANCED;
|
||||
panel_type->reorder = modifier_reorder;
|
||||
panel_type->get_list_data_expand_flag = get_modifier_expand_flag;
|
||||
panel_type->set_list_data_expand_flag = set_modifier_expand_flag;
|
||||
|
||||
BLI_addtail(®ion_type->paneltypes, panel_type);
|
||||
|
||||
return panel_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a shild panel to the parent.
|
||||
*
|
||||
* \note To create the panel type's idname, it appends the \a name argument to the \a parent's
|
||||
* idname.
|
||||
*/
|
||||
PanelType *modifier_subpanel_register(ARegionType *region_type,
|
||||
const char *name,
|
||||
const char *label,
|
||||
PanelDrawFn draw_header,
|
||||
PanelDrawFn draw,
|
||||
PanelType *parent)
|
||||
{
|
||||
/* Create the subpanel's ID name. */
|
||||
char panel_idname[BKE_ST_MAXNAME];
|
||||
strcpy(panel_idname, parent->idname);
|
||||
strcat(panel_idname, "_");
|
||||
strcat(panel_idname, name);
|
||||
|
||||
PanelType *panel_type = MEM_callocN(sizeof(PanelType), panel_idname);
|
||||
|
||||
strcpy(panel_type->idname, panel_idname);
|
||||
strcpy(panel_type->label, label);
|
||||
strcpy(panel_type->context, "modifier");
|
||||
strcpy(panel_type->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
|
||||
|
||||
panel_type->draw_header = draw_header;
|
||||
panel_type->draw = draw;
|
||||
panel_type->poll = modifier_ui_poll;
|
||||
panel_type->flag = (PNL_DEFAULT_CLOSED | PNL_DRAW_BOX);
|
||||
|
||||
BLI_assert(parent != NULL);
|
||||
strcpy(panel_type->parent_id, parent->idname);
|
||||
panel_type->parent = parent;
|
||||
BLI_addtail(&parent->children, BLI_genericNodeN(panel_type));
|
||||
BLI_addtail(®ion_type->paneltypes, panel_type);
|
||||
|
||||
return panel_type;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
70
source/blender/modifiers/intern/MOD_ui_common.h
Normal file
70
source/blender/modifiers/intern/MOD_ui_common.h
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \ingroup modifiers
|
||||
*/
|
||||
|
||||
#ifndef __MOD_UI_COMMON_H__
|
||||
#define __MOD_UI_COMMON_H__
|
||||
|
||||
/* so modifier types match their defines */
|
||||
#include "MOD_modifiertypes.h"
|
||||
|
||||
#include "DEG_depsgraph_build.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct ARegionType;
|
||||
struct bContext;
|
||||
struct PanelType;
|
||||
struct uiLayout;
|
||||
typedef void (*PanelDrawFn)(const bContext *, struct Panel *);
|
||||
|
||||
void modifier_panel_buttons(const struct bContext *C, struct Panel *panel);
|
||||
|
||||
void modifier_vgroup_ui(struct uiLayout *layout,
|
||||
struct PointerRNA *ptr,
|
||||
struct PointerRNA *ob_ptr,
|
||||
const char *vgroup_prop,
|
||||
const char *invert_vgroup_prop,
|
||||
const char *text);
|
||||
|
||||
void modifier_panel_end(struct uiLayout *layout, PointerRNA *ptr);
|
||||
|
||||
void modifier_panel_get_property_pointers(const bContext *C,
|
||||
struct Panel *panel,
|
||||
struct PointerRNA *r_ob_ptr,
|
||||
struct PointerRNA *r_ptr);
|
||||
|
||||
struct PanelType *modifier_panel_register(struct ARegionType *region_type,
|
||||
ModifierType type,
|
||||
PanelDrawFn draw);
|
||||
|
||||
struct PanelType *modifier_subpanel_register(struct ARegionType *region_type,
|
||||
const char *name,
|
||||
const char *label,
|
||||
PanelDrawFn draw_header,
|
||||
PanelDrawFn draw,
|
||||
struct PanelType *parent);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __MOD_UI_COMMON_H__ */
|
||||
@@ -28,17 +28,28 @@
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_uvproject.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_camera_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_camera.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
@@ -313,6 +324,43 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
||||
return result;
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *sub;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
PointerRNA obj_data_ptr = RNA_pointer_get(&ob_ptr, "data");
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemPointerR(layout, &ptr, "uv_layer", &obj_data_ptr, "uv_layers", NULL, ICON_NONE);
|
||||
|
||||
sub = uiLayoutColumn(layout, true);
|
||||
uiItemR(sub, &ptr, "aspect_x", 0, IFACE_("Aspect X"), ICON_NONE);
|
||||
uiItemR(sub, &ptr, "aspect_y", 0, IFACE_("Y"), ICON_NONE);
|
||||
|
||||
sub = uiLayoutColumn(layout, true);
|
||||
uiItemR(sub, &ptr, "scale_x", 0, IFACE_("Scale X"), ICON_NONE);
|
||||
uiItemR(sub, &ptr, "scale_y", 0, IFACE_("Y"), ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "projector_count", 0, IFACE_("Projectors"), ICON_NONE);
|
||||
RNA_BEGIN (&ptr, projector_ptr, "projectors") {
|
||||
uiItemR(layout, &projector_ptr, "object", 0, NULL, ICON_NONE);
|
||||
}
|
||||
RNA_END;
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_UVProject, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_UVProject = {
|
||||
/* name */ "UVProject",
|
||||
/* structName */ "UVProjectModifierData",
|
||||
@@ -343,4 +391,5 @@ ModifierTypeInfo modifierType_UVProject = {
|
||||
/* foreachIDLink */ foreachIDLink,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -25,17 +25,28 @@
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_task.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_action.h" /* BKE_pose_channel_find_name */
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
|
||||
static void uv_warp_from_mat4_pair(float uv_dst[2], const float uv_src[2], float warp_mat[4][4])
|
||||
@@ -245,6 +256,70 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
|
||||
DEG_add_modifier_to_transform_relation(ctx->node, "UVWarp Modifier");
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
PointerRNA warp_obj_ptr;
|
||||
PointerRNA obj_data_ptr = RNA_pointer_get(&ob_ptr, "data");
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemPointerR(layout, &ptr, "uv_layer", &obj_data_ptr, "uv_layers", NULL, ICON_NONE);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiItemR(col, &ptr, "center", 0, NULL, ICON_NONE);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiItemR(col, &ptr, "axis_u", 0, IFACE_("Axis U"), ICON_NONE);
|
||||
uiItemR(col, &ptr, "axis_v", 0, IFACE_("V"), ICON_NONE);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiItemR(col, &ptr, "object_from", 0, NULL, ICON_NONE);
|
||||
warp_obj_ptr = RNA_pointer_get(&ptr, "object_from");
|
||||
if (!RNA_pointer_is_null(&warp_obj_ptr) && RNA_enum_get(&warp_obj_ptr, "type") == OB_ARMATURE) {
|
||||
PointerRNA warp_obj_data_ptr = RNA_pointer_get(&warp_obj_ptr, "data");
|
||||
uiItemPointerR(col, &ptr, "bone_from", &warp_obj_data_ptr, "bones", NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
uiItemR(col, &ptr, "object_to", 0, IFACE_("To"), ICON_NONE);
|
||||
warp_obj_ptr = RNA_pointer_get(&ptr, "object_to");
|
||||
if (!RNA_pointer_is_null(&warp_obj_ptr) && RNA_enum_get(&warp_obj_ptr, "type") == OB_ARMATURE) {
|
||||
PointerRNA warp_obj_data_ptr = RNA_pointer_get(&warp_obj_ptr, "data");
|
||||
uiItemPointerR(col, &ptr, "bone_to", &warp_obj_data_ptr, "bones", NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void transform_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "offset", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "scale", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "rotation", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = modifier_panel_register(region_type, eModifierType_UVWarp, panel_draw);
|
||||
modifier_subpanel_register(
|
||||
region_type, "offset", "Transform", NULL, transform_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_UVWarp = {
|
||||
/* name */ "UVWarp",
|
||||
/* structName */ "UVWarpModifierData",
|
||||
@@ -275,4 +350,5 @@ ModifierTypeInfo modifierType_UVWarp = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -26,25 +26,36 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_action.h" /* BKE_pose_channel_find_name */
|
||||
#include "BKE_colortools.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_editmesh.h"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_texture.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "RE_shader_ext.h"
|
||||
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
|
||||
static void initData(ModifierData *md)
|
||||
@@ -393,6 +404,111 @@ static void deformVertsEM(ModifierData *md,
|
||||
}
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiItemR(col, &ptr, "object_from", 0, NULL, ICON_NONE);
|
||||
PointerRNA from_obj_ptr = RNA_pointer_get(&ptr, "object_from");
|
||||
if (!RNA_pointer_is_null(&from_obj_ptr) && RNA_enum_get(&from_obj_ptr, "type") == OB_ARMATURE) {
|
||||
|
||||
PointerRNA from_obj_data_ptr = RNA_pointer_get(&from_obj_ptr, "data");
|
||||
uiItemPointerR(col, &ptr, "bone_from", &from_obj_data_ptr, "bones", IFACE_("Bone"), ICON_NONE);
|
||||
}
|
||||
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiItemR(col, &ptr, "object_to", 0, NULL, ICON_NONE);
|
||||
PointerRNA to_obj_ptr = RNA_pointer_get(&ptr, "object_to");
|
||||
if (!RNA_pointer_is_null(&to_obj_ptr) && RNA_enum_get(&to_obj_ptr, "type") == OB_ARMATURE) {
|
||||
PointerRNA to_obj_data_ptr = RNA_pointer_get(&to_obj_ptr, "data");
|
||||
uiItemPointerR(col, &ptr, "bone_to", &to_obj_data_ptr, "bones", IFACE_("Bone"), ICON_NONE);
|
||||
}
|
||||
|
||||
uiItemR(layout, &ptr, "use_volume_preserve", 0, NULL, ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "strength", 0, NULL, ICON_NONE);
|
||||
|
||||
modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void falloff_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
bool use_falloff = (RNA_enum_get(&ptr, "falloff_type") != eWarp_Falloff_None);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "falloff_type", 0, NULL, ICON_NONE);
|
||||
|
||||
if (use_falloff) {
|
||||
uiItemR(layout, &ptr, "falloff_radius", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
if (use_falloff && RNA_enum_get(&ptr, "falloff_type") == eWarp_Falloff_Curve) {
|
||||
uiTemplateCurveMapping(layout, &ptr, "falloff_curve", 0, false, false, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
static void texture_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
int texture_coords = RNA_enum_get(&ptr, "texture_coords");
|
||||
|
||||
uiTemplateID(layout, C, &ptr, "texture", "texture.new", NULL, NULL, 0, ICON_NONE, NULL);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "texture_coords", 0, IFACE_("Coordinates"), ICON_NONE);
|
||||
|
||||
if (texture_coords == MOD_DISP_MAP_OBJECT) {
|
||||
uiItemR(layout, &ptr, "texture_coords_object", 0, "Object", ICON_NONE);
|
||||
PointerRNA texture_coords_obj_ptr = RNA_pointer_get(&ptr, "texture_coords_object");
|
||||
if (!RNA_pointer_is_null(&texture_coords_obj_ptr) &&
|
||||
(RNA_enum_get(&texture_coords_obj_ptr, "type") == OB_ARMATURE)) {
|
||||
PointerRNA texture_coords_obj_data_ptr = RNA_pointer_get(&texture_coords_obj_ptr, "data");
|
||||
uiItemPointerR(layout,
|
||||
&ptr,
|
||||
"texture_coords_bone",
|
||||
&texture_coords_obj_data_ptr,
|
||||
"bones",
|
||||
IFACE_("Bone"),
|
||||
ICON_NONE);
|
||||
}
|
||||
}
|
||||
else if (texture_coords == MOD_DISP_MAP_UV && RNA_enum_get(&ob_ptr, "type") == OB_MESH) {
|
||||
PointerRNA obj_data_ptr = RNA_pointer_get(&ob_ptr, "data");
|
||||
uiItemPointerR(layout, &ptr, "uv_layer", &obj_data_ptr, "uv_layers", NULL, ICON_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Warp, panel_draw);
|
||||
modifier_subpanel_register(
|
||||
region_type, "falloff", "Falloff", NULL, falloff_panel_draw, panel_type);
|
||||
modifier_subpanel_register(
|
||||
region_type, "texture", "Texture", NULL, texture_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Warp = {
|
||||
/* name */ "Warp",
|
||||
/* structName */ "WarpModifierData",
|
||||
@@ -422,4 +538,5 @@ ModifierTypeInfo modifierType_Warp = {
|
||||
/* foreachIDLink */ foreachIDLink,
|
||||
/* foreachTexLink */ foreachTexLink,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -25,23 +25,34 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_editmesh.h"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_texture.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
#include "RE_shader_ext.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
@@ -365,6 +376,122 @@ static void deformVertsEM(ModifierData *md,
|
||||
}
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *sub, *row, *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
row = uiLayoutRowWithHeading(layout, true, "Motion");
|
||||
uiItemR(row, &ptr, "use_x", UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE, NULL, ICON_NONE);
|
||||
uiItemR(row, &ptr, "use_y", UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE, NULL, ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "use_cyclic", 0, NULL, ICON_NONE);
|
||||
|
||||
row = uiLayoutRowWithHeading(layout, true, IFACE_("Along Normals"));
|
||||
uiItemR(row, &ptr, "use_normal", 0, "", ICON_NONE);
|
||||
sub = uiLayoutRow(row, true);
|
||||
uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_normal"));
|
||||
uiItemR(sub, &ptr, "use_normal_x", UI_ITEM_R_TOGGLE, "X", ICON_NONE);
|
||||
uiItemR(sub, &ptr, "use_normal_y", UI_ITEM_R_TOGGLE, "Y", ICON_NONE);
|
||||
uiItemR(sub, &ptr, "use_normal_z", UI_ITEM_R_TOGGLE, "Z", ICON_NONE);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiItemR(col, &ptr, "falloff_radius", 0, "Falloff", ICON_NONE);
|
||||
uiItemR(col, &ptr, "height", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "width", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "narrowness", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
|
||||
|
||||
modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void position_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "start_position_object", 0, IFACE_("Object"), ICON_NONE);
|
||||
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiItemR(col, &ptr, "start_position_x", 0, "Start position X", ICON_NONE);
|
||||
uiItemR(col, &ptr, "start_position_y", 0, "Y", ICON_NONE);
|
||||
}
|
||||
|
||||
static void time_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiItemR(col, &ptr, "time_offset", 0, "Offset", ICON_NONE);
|
||||
uiItemR(col, &ptr, "lifetime", 0, "Life", ICON_NONE);
|
||||
uiItemR(col, &ptr, "damping_time", 0, "Damping", ICON_NONE);
|
||||
uiItemR(col, &ptr, "speed", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void texture_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
int texture_coords = RNA_enum_get(&ptr, "texture_coords");
|
||||
|
||||
uiTemplateID(layout, C, &ptr, "texture", "texture.new", NULL, NULL, 0, ICON_NONE, NULL);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "texture_coords", 0, IFACE_("Coordinates"), ICON_NONE);
|
||||
if (texture_coords == MOD_DISP_MAP_OBJECT) {
|
||||
uiItemR(layout, &ptr, "texture_coords_object", 0, NULL, ICON_NONE);
|
||||
PointerRNA texture_coords_obj_ptr = RNA_pointer_get(&ptr, "texture_coords_object");
|
||||
if (!RNA_pointer_is_null(&texture_coords_obj_ptr) &&
|
||||
(RNA_enum_get(&texture_coords_obj_ptr, "type") == OB_ARMATURE)) {
|
||||
PointerRNA texture_coords_obj_data_ptr = RNA_pointer_get(&texture_coords_obj_ptr, "data");
|
||||
uiItemPointerR(layout,
|
||||
&ptr,
|
||||
"texture_coords_bone",
|
||||
&texture_coords_obj_data_ptr,
|
||||
"bones",
|
||||
IFACE_("Bone"),
|
||||
ICON_NONE);
|
||||
}
|
||||
}
|
||||
else if (texture_coords == MOD_DISP_MAP_UV && RNA_enum_get(&ob_ptr, "type") == OB_MESH) {
|
||||
PointerRNA obj_data_ptr = RNA_pointer_get(&ob_ptr, "data");
|
||||
uiItemPointerR(layout, &ptr, "uv_layer", &obj_data_ptr, "uv_layers", NULL, ICON_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Wave, panel_draw);
|
||||
modifier_subpanel_register(
|
||||
region_type, "position", "Start Position", NULL, position_panel_draw, panel_type);
|
||||
modifier_subpanel_register(region_type, "time", "Time", NULL, time_panel_draw, panel_type);
|
||||
modifier_subpanel_register(
|
||||
region_type, "texture", "Texture", NULL, texture_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Wave = {
|
||||
/* name */ "Wave",
|
||||
/* structName */ "WaveModifierData",
|
||||
@@ -395,4 +522,5 @@ ModifierTypeInfo modifierType_Wave = {
|
||||
/* foreachIDLink */ foreachIDLink,
|
||||
/* foreachTexLink */ foreachTexLink,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -24,16 +24,27 @@
|
||||
#include "BLI_linklist.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
|
||||
#include "bmesh.h"
|
||||
@@ -700,8 +711,36 @@ static bool dependsOnNormals(ModifierData *UNUSED(md))
|
||||
return true;
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "mode", 0, NULL, ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "weight", 0, IFACE_("Weight"), ICON_NONE);
|
||||
uiItemR(layout, &ptr, "thresh", 0, IFACE_("Threshold"), ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "keep_sharp", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "face_influence", 0, NULL, ICON_NONE);
|
||||
|
||||
modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_WeightedNormal, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_WeightedNormal = {
|
||||
/* name */ "Weighted Normal",
|
||||
/* name */ "WeightedNormal",
|
||||
/* structName */ "WeightedNormalModifierData",
|
||||
/* structSize */ sizeof(WeightedNormalModifierData),
|
||||
/* type */ eModifierTypeType_Constructive,
|
||||
@@ -730,4 +769,5 @@ ModifierTypeInfo modifierType_WeightedNormal = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
#include "BLI_rand.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_color_types.h" /* CurveMapping. */
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
@@ -35,15 +37,22 @@
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
#include "BKE_colortools.h" /* CurveMapping. */
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_customdata.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_texture.h" /* Texture masking. */
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
#include "MOD_weightvg_util.h"
|
||||
#include "RE_shader_ext.h" /* Texture masking. */
|
||||
@@ -329,3 +338,48 @@ void weightvg_update_vg(MDeformVert *dvert,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Common vertex weight mask interface elements for the modifier panels.
|
||||
*/
|
||||
void weightvg_ui_common(const bContext *C, PointerRNA *ob_ptr, PointerRNA *ptr, uiLayout *layout)
|
||||
{
|
||||
PointerRNA mask_texture_ptr = RNA_pointer_get(ptr, "mask_texture");
|
||||
bool has_mask_texture = !RNA_pointer_is_null(&mask_texture_ptr);
|
||||
bool has_mask_vertex_group = RNA_string_length(ptr, "mask_vertex_group") != 0;
|
||||
int mask_tex_mapping = RNA_enum_get(ptr, "mask_tex_mapping");
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, ptr, "mask_constant", UI_ITEM_R_SLIDER, IFACE_("Global Influence:"), ICON_NONE);
|
||||
|
||||
if (!has_mask_texture) {
|
||||
modifier_vgroup_ui(layout, ptr, ob_ptr, "mask_vertex_group", "invert_mask_vertex_group", NULL);
|
||||
}
|
||||
|
||||
if (!has_mask_vertex_group) {
|
||||
uiTemplateID(layout,
|
||||
C,
|
||||
ptr,
|
||||
"mask_texture",
|
||||
"texture.new",
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
ICON_NONE,
|
||||
IFACE_("Mask Texture"));
|
||||
|
||||
if (has_mask_texture) {
|
||||
uiItemR(layout, ptr, "mask_tex_use_channel", 0, IFACE_("Channel"), ICON_NONE);
|
||||
uiItemR(layout, ptr, "mask_tex_mapping", 0, NULL, ICON_NONE);
|
||||
|
||||
if (mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
|
||||
uiItemR(layout, ptr, "mask_tex_map_object", 0, IFACE_("Object"), ICON_NONE);
|
||||
}
|
||||
else if (mask_tex_mapping == MOD_DISP_MAP_UV && RNA_enum_get(ob_ptr, "type") == OB_MESH) {
|
||||
PointerRNA obj_data_ptr = RNA_pointer_get(ob_ptr, "data");
|
||||
uiItemPointerR(
|
||||
layout, ptr, "mask_tex_uv_layer", &obj_data_ptr, "uv_layers", NULL, ICON_NONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,9 +30,11 @@ struct MDeformWeight;
|
||||
struct Mesh;
|
||||
struct ModifierEvalContext;
|
||||
struct Object;
|
||||
struct PointerRNA;
|
||||
struct RNG;
|
||||
struct Scene;
|
||||
struct Tex;
|
||||
struct uiLayout;
|
||||
|
||||
/*
|
||||
* XXX I'd like to make modified weights visible in WeightPaint mode,
|
||||
@@ -89,4 +91,5 @@ void weightvg_update_vg(struct MDeformVert *dvert,
|
||||
const float rem_thresh,
|
||||
const bool do_normalize);
|
||||
|
||||
void weightvg_ui_common(const bContext *C, PointerRNA *ob_ptr, PointerRNA *ptr, uiLayout *layout);
|
||||
#endif /* __MOD_WEIGHTVG_UTIL_H__ */
|
||||
|
||||
@@ -27,24 +27,35 @@
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_rand.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_color_types.h" /* CurveMapping. */
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_colortools.h" /* CurveMapping. */
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_texture.h" /* Texture masking. */
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph_build.h"
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
#include "MOD_weightvg_util.h"
|
||||
|
||||
@@ -303,6 +314,91 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
||||
return mesh;
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *sub, *col, *row;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiItemPointerR(col, &ptr, "vertex_group", &ob_ptr, "vertex_groups", NULL, ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "default_weight", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
|
||||
|
||||
col = uiLayoutColumnWithHeading(layout, false, IFACE_("Group Add"));
|
||||
row = uiLayoutRow(col, true);
|
||||
uiLayoutSetPropDecorate(row, false);
|
||||
sub = uiLayoutRow(row, true);
|
||||
uiItemR(sub, &ptr, "use_add", 0, "", ICON_NONE);
|
||||
sub = uiLayoutRow(sub, true);
|
||||
uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_add"));
|
||||
uiLayoutSetPropSep(sub, false);
|
||||
uiItemR(sub, &ptr, "add_threshold", UI_ITEM_R_SLIDER, "Threshold", ICON_NONE);
|
||||
uiItemDecoratorR(row, &ptr, "add_threshold", 0);
|
||||
|
||||
col = uiLayoutColumnWithHeading(layout, false, IFACE_("Group Remove"));
|
||||
row = uiLayoutRow(col, true);
|
||||
uiLayoutSetPropDecorate(row, false);
|
||||
sub = uiLayoutRow(row, true);
|
||||
uiItemR(sub, &ptr, "use_remove", 0, "", ICON_NONE);
|
||||
sub = uiLayoutRow(sub, true);
|
||||
uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_remove"));
|
||||
uiLayoutSetPropSep(sub, false);
|
||||
uiItemR(sub, &ptr, "remove_threshold", UI_ITEM_R_SLIDER, "Threshold", ICON_NONE);
|
||||
uiItemDecoratorR(row, &ptr, "remove_threshold", 0);
|
||||
|
||||
uiItemR(layout, &ptr, "normalize", 0, NULL, ICON_NONE);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void falloff_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *row, *sub;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
row = uiLayoutRow(layout, true);
|
||||
uiItemR(row, &ptr, "falloff_type", 0, IFACE_("Type"), ICON_NONE);
|
||||
sub = uiLayoutRow(row, true);
|
||||
uiLayoutSetPropSep(sub, false);
|
||||
uiItemR(row, &ptr, "invert_falloff", 0, "", ICON_ARROW_LEFTRIGHT);
|
||||
if (RNA_enum_get(&ptr, "falloff_type") == MOD_WVG_MAPPING_CURVE) {
|
||||
uiTemplateCurveMapping(layout, &ptr, "map_curve", 0, false, false, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
static void influence_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
weightvg_ui_common(C, &ob_ptr, &ptr, layout);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = modifier_panel_register(
|
||||
region_type, eModifierType_WeightVGEdit, panel_draw);
|
||||
modifier_subpanel_register(
|
||||
region_type, "falloff", "Falloff", NULL, falloff_panel_draw, panel_type);
|
||||
modifier_subpanel_register(
|
||||
region_type, "influence", "Influence", NULL, influence_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_WeightVGEdit = {
|
||||
/* name */ "VertexWeightEdit",
|
||||
/* structName */ "WeightVGEditModifierData",
|
||||
@@ -333,4 +429,5 @@ ModifierTypeInfo modifierType_WeightVGEdit = {
|
||||
/* foreachIDLink */ foreachIDLink,
|
||||
/* foreachTexLink */ foreachTexLink,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -26,23 +26,34 @@
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_customdata.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_texture.h" /* Texture masking. */
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph_build.h"
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
#include "MOD_weightvg_util.h"
|
||||
|
||||
@@ -449,6 +460,54 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
||||
return mesh;
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group_a", "invert_vertex_group_a", NULL);
|
||||
modifier_vgroup_ui(
|
||||
layout, &ptr, &ob_ptr, "vertex_group_b", "invert_vertex_group_b", IFACE_("B"));
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
uiItemR(layout, &ptr, "default_weight_a", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "default_weight_b", 0, IFACE_("B"), ICON_NONE);
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
uiItemR(layout, &ptr, "mix_set", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "mix_mode", 0, NULL, ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "normalize", 0, NULL, ICON_NONE);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void influence_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
weightvg_ui_common(C, &ob_ptr, &ptr, layout);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = modifier_panel_register(
|
||||
region_type, eModifierType_WeightVGMix, panel_draw);
|
||||
modifier_subpanel_register(
|
||||
region_type, "influence", "Influence", NULL, influence_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_WeightVGMix = {
|
||||
/* name */ "VertexWeightMix",
|
||||
/* structName */ "WeightVGMixModifierData",
|
||||
@@ -479,4 +538,5 @@ ModifierTypeInfo modifierType_WeightVGMix = {
|
||||
/* foreachIDLink */ foreachIDLink,
|
||||
/* foreachTexLink */ foreachTexLink,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -29,12 +29,16 @@
|
||||
#include "BLI_rand.h"
|
||||
#include "BLI_task.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_bvhutils.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_curve.h"
|
||||
#include "BKE_customdata.h"
|
||||
#include "BKE_deform.h"
|
||||
@@ -42,14 +46,21 @@
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_texture.h" /* Texture masking. */
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph_build.h"
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
#include "MOD_util.h"
|
||||
#include "MOD_weightvg_util.h"
|
||||
|
||||
@@ -630,6 +641,65 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
||||
return mesh;
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *row, *col, *sub;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemPointerR(layout, &ptr, "vertex_group", &ob_ptr, "vertex_groups", NULL, ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "target", 0, NULL, ICON_NONE);
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
uiItemR(layout, &ptr, "proximity_mode", 0, NULL, ICON_NONE);
|
||||
if (RNA_enum_get(&ptr, "proximity_mode") == MOD_WVG_PROXIMITY_GEOMETRY) {
|
||||
uiItemR(layout, &ptr, "proximity_geometry", UI_ITEM_R_EXPAND, IFACE_("Geometry"), ICON_NONE);
|
||||
}
|
||||
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiItemR(col, &ptr, "min_dist", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "max_dist", 0, NULL, ICON_NONE);
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
row = uiLayoutRow(layout, true);
|
||||
uiItemR(row, &ptr, "falloff_type", 0, NULL, ICON_NONE);
|
||||
sub = uiLayoutRow(row, true);
|
||||
uiLayoutSetPropSep(sub, false);
|
||||
uiItemR(row, &ptr, "invert_falloff", 0, "", ICON_ARROW_LEFTRIGHT);
|
||||
modifier_panel_end(layout, &ptr);
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
uiItemR(layout, &ptr, "normalize", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void influence_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
weightvg_ui_common(C, &ob_ptr, &ptr, layout);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = modifier_panel_register(
|
||||
region_type, eModifierType_WeightVGProximity, panel_draw);
|
||||
modifier_subpanel_register(
|
||||
region_type, "influence", "Influence", NULL, influence_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_WeightVGProximity = {
|
||||
/* name */ "VertexWeightProximity",
|
||||
/* structName */ "WeightVGProximityModifierData",
|
||||
@@ -660,4 +730,5 @@ ModifierTypeInfo modifierType_WeightVGProximity = {
|
||||
/* foreachIDLink */ foreachIDLink,
|
||||
/* foreachTexLink */ foreachTexLink,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
@@ -35,19 +35,30 @@
|
||||
#include "BLI_kdopbvh.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_bvhutils.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
|
||||
//#define USE_WELD_DEBUG
|
||||
//#define USE_WELD_NORMALS
|
||||
@@ -1939,6 +1950,28 @@ static void requiredDataMask(Object *UNUSED(ob),
|
||||
}
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "merge_threshold", 0, IFACE_("Distance"), ICON_NONE);
|
||||
uiItemR(layout, &ptr, "max_interactions", 0, NULL, ICON_NONE);
|
||||
modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
modifier_panel_register(region_type, eModifierType_Weld, panel_draw);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Weld = {
|
||||
/* name */ "Weld",
|
||||
/* structName */ "WeldModifierData",
|
||||
@@ -1970,6 +2003,7 @@ ModifierTypeInfo modifierType_Weld = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -18,15 +18,28 @@
|
||||
* \ingroup modifiers
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
#include "MOD_ui_common.h"
|
||||
|
||||
#include "bmesh.h"
|
||||
#include "tools/bmesh_wireframe.h"
|
||||
@@ -104,6 +117,67 @@ static Mesh *modifyMesh(ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||
return WireframeModifier_do((WireframeModifierData *)md, ctx->object, mesh);
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col, *row, *sub;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "thickness", 0, IFACE_("Thickness"), ICON_NONE);
|
||||
uiItemR(layout, &ptr, "offset", 0, NULL, ICON_NONE);
|
||||
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiItemR(col, &ptr, "use_boundary", 0, IFACE_("Boundary"), ICON_NONE);
|
||||
uiItemR(col, &ptr, "use_replace", 0, IFACE_("Replace Original"), ICON_NONE);
|
||||
|
||||
col = uiLayoutColumnWithHeading(layout, true, IFACE_("Thickness"));
|
||||
uiItemR(col, &ptr, "use_even_offset", 0, IFACE_("Even"), ICON_NONE);
|
||||
uiItemR(col, &ptr, "use_relative_offset", 0, IFACE_("Relative"), ICON_NONE);
|
||||
|
||||
row = uiLayoutRowWithHeading(layout, true, IFACE_("Crease Edges"));
|
||||
uiItemR(row, &ptr, "use_crease", 0, "", ICON_NONE);
|
||||
sub = uiLayoutRow(row, true);
|
||||
uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_crease"));
|
||||
uiItemR(sub, &ptr, "crease_weight", UI_ITEM_R_SLIDER, "", ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "material_offset", 0, IFACE_("Material Offset"), ICON_NONE);
|
||||
|
||||
modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void vertex_group_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *row;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
bool has_vertex_group = RNA_string_length(&ptr, "vertex_group") != 0;
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
|
||||
|
||||
row = uiLayoutRow(layout, true);
|
||||
uiLayoutSetActive(row, has_vertex_group);
|
||||
uiItemR(row, &ptr, "thickness_vertex_group", 0, IFACE_("Factor"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = modifier_panel_register(
|
||||
region_type, eModifierType_Wireframe, panel_draw);
|
||||
modifier_subpanel_register(
|
||||
region_type, "vertex_group", "Vertex Group", NULL, vertex_group_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
ModifierTypeInfo modifierType_Wireframe = {
|
||||
/* name */ "Wireframe",
|
||||
/* structName */ "WireframeModifierData",
|
||||
@@ -133,4 +207,5 @@ ModifierTypeInfo modifierType_Wireframe = {
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* freeRuntimeData */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user