2.5 Buttons Modifier:

* Converted all modifier to python layout engine. Needs a layout cleanup still.
* Removed corresponding C code (brecht: please check)
* 2 RNA Modifier fixes

* Added initial Mesh panel by William Reynish.
This commit is contained in:
Thomas Dinges
2009-05-21 21:23:36 +00:00
parent c056b22a14
commit c671469bbb
4 changed files with 364 additions and 681 deletions

View File

@@ -0,0 +1,35 @@
import bpy
class DataButtonsPanel(bpy.types.Panel):
__space_type__ = "BUTTONS_WINDOW"
__region_type__ = "WINDOW"
__context__ = "data"
def poll(self, context):
ob = context.active_object
return (ob and ob.type == 'MESH')
class DATA_PT_surface(DataButtonsPanel):
__idname__ = "DATA_PT_surface"
__label__ = "Surface"
def draw(self, context):
mesh = context.main.meshes[0]
layout = self.layout
if not mesh:
return
split = layout.split()
sub = split.column()
sub.itemR(mesh, "autosmooth")
sub.itemR(mesh, "autosmooth_angle", text="Angle")
sub = split.column()
sub.itemR(mesh, "vertex_normal_flip")
sub.itemR(mesh, "double_sided")
row = layout.row()
row.itemR(mesh, "texco_mesh")
bpy.types.register(DATA_PT_surface)

View File

@@ -31,7 +31,61 @@ class DATA_PT_modifiers(DataButtonsPanel):
if md.expanded:
if md.type == 'ARMATURE':
self.armature(box, md)
if md.type == 'ARRAY':
self.array(box, md)
if md.type == 'BEVEL':
self.bevel(box, md)
if md.type == 'BOOLEAN':
self.boolean(box, md)
if md.type == 'BUILD':
self.build(box, md)
if md.type == 'CAST':
self.cast(box, md)
if md.type == 'CLOTH':
self.cloth(box, md)
if md.type == 'COLLISION':
self.collision(box, md)
if md.type == 'CURVE':
self.curve(box, md)
if md.type == 'DECIMATE':
self.decimate(box, md)
if md.type == 'DISPLACE':
self.displace(box, md)
if md.type == 'EDGE_SPLIT':
self.edgesplit(box, md)
if md.type == 'EXPLODE':
self.explode(box, md)
if md.type == 'HOOK':
self.hook(box, md)
if md.type == 'LATTICE':
self.lattice(box, md)
if md.type == 'MASK':
self.mask(box, md)
if md.type == 'MESH_DEFORM':
self.meshdeform(box, md)
if md.type == 'MIRROR':
self.mirror(box, md)
if md.type == 'MULTIRES':
self.multires(box, md)
if md.type == 'PARTICLE_INSTANCE':
self.particleinstance(box, md)
if md.type == 'PARTICLE_SYSTEM':
self.particlesystem(box, md)
if md.type == 'SHRINKWRAP':
self.shrinkwrap(box, md)
if md.type == 'SIMPLE_DEFORM':
self.simpledeform(box, md)
if md.type == 'SMOOTH':
self.smooth(box, md)
if md.type == 'SOFTBODY':
self.softbody(box, md)
if md.type == 'SUBSURF':
self.subsurf(box, md)
if md.type == 'UV_PROJECT':
self.uvproject(box, md)
if md.type == 'WAVE':
self.wave(box, md)
def armature(self, layout, md):
layout.itemR(md, "object")
row = layout.row()
@@ -43,5 +97,275 @@ class DATA_PT_modifiers(DataButtonsPanel):
flow.itemR(md, "quaternion")
flow.itemR(md, "multi_modifier")
def array(self, layout, md):
layout.itemR(md, "fit_type")
if md.fit_type == 'FIXED_COUNT':
layout.itemR(md, "count")
if md.fit_type == 'FIT_LENGTH':
layout.itemR(md, "length")
if md.fit_type == 'FIT_CURVE':
layout.itemR(md, "curve")
split = layout.split()
col = split.column()
sub = col.column()
sub.itemR(md, "constant_offset")
sub.itemR(md, "constant_offset_displacement", text="Displacement")
sub = col.column()
sub = col.row().itemR(md, "merge_adjacent_vertices", text="Merge")
sub = col.row().itemR(md, "merge_end_vertices", text="First Last")
sub = col.itemR(md, "merge_distance", text="Distance")
col = split.column()
sub = col.column()
sub.itemR(md, "relative_offset")
sub.itemR(md, "relative_offset_displacement", text="Displacement")
sub = col.column()
sub.itemR(md, "add_offset_object")
sub.itemR(md, "offset_object")
col = layout.column()
col.itemR(md, "start_cap")
col.itemR(md, "end_cap")
def bevel(self, layout, md):
row = layout.row()
row.itemR(md, "width")
row.itemR(md, "only_vertices")
layout.itemL(text="Limit Method:")
row = layout.row()
row.itemR(md, "limit_method", expand=True)
if md.limit_method == 'ANGLE':
row = layout.row()
row.itemR(md, "angle")
if md.limit_method == 'WEIGHT':
row = layout.row()
row.itemR(md, "edge_weight_method", expand=True)
def boolean(self, layout, md):
layout.itemR(md, "operation")
layout.itemR(md, "object")
def build(self, layout, md):
layout.itemR(md, "start")
layout.itemR(md, "length")
layout.itemR(md, "randomize")
if md.randomize:
layout.itemR(md, "seed")
def cast(self, layout, md):
layout.itemR(md, "cast_type")
layout.itemR(md, "x")
layout.itemR(md, "y")
layout.itemR(md, "z")
layout.itemR(md, "factor")
layout.itemR(md, "radius")
layout.itemR(md, "size")
layout.itemR(md, "vertex_group")
#Missing: "OB" and "From Radius"
def cloth(self, layout, md):
layout.itemL(text="See Cloth panel.")
def collision(self, layout, md):
layout.itemL(text="See Collision panel.")
def curve(self, layout, md):
layout.itemR(md, "curve")
layout.itemR(md, "vertex_group")
layout.itemR(md, "deform_axis")
def decimate(self, layout, md):
layout.itemR(md, "ratio")
layout.itemR(md, "face_count")
def displace(self, layout, md):
layout.itemR(md, "vertex_group")
layout.itemR(md, "texture")
layout.itemR(md, "midlevel")
layout.itemR(md, "strength")
layout.itemR(md, "texture_coordinates")
if md.texture_coordinates == 'OBJECT':
layout.itemR(md, "texture_coordinate_object", text="Object")
if md.texture_coordinates == 'UV':
layout.itemR(md, "uv_layer")
def edgesplit(self, layout, md):
layout.itemR(md, "use_edge_angle")
if (md.use_edge_angle):
layout.itemR(md, "split_angle")
layout.itemR(md, "use_sharp")
def explode(self, layout, md):
layout.itemR(md, "vertex_group")
layout.itemR(md, "protect")
layout.itemR(md, "split_edges")
layout.itemR(md, "unborn")
layout.itemR(md, "alive")
layout.itemR(md, "dead")
# Missing: "Refresh" and "Clear Vertex Group" ?
# Couldn't test due to crash.
def fluid(self, layout, md):
layout.itemL(text="See Fluidsim panel.")
def hook(self, layout, md):
layout.itemR(md, "falloff")
layout.itemR(md, "force", slider=True)
layout.itemR(md, "object")
layout.itemR(md, "vertex_group")
# Missing: "Reset" and "Recenter"
def lattice(self, layout, md):
layout.itemR(md, "lattice")
layout.itemR(md, "vertex_group")
def mask(self, layout, md):
layout.itemR(md, "mode")
if md.mode == 'ARMATURE':
layout.itemR(md, "armature")
if md.mode == 'VERTEX_GROUP':
layout.itemR(md, "vertex_group")
layout.itemR(md, "inverse")
def meshdeform(self, layout, md):
layout.itemR(md, "mesh")
layout.itemR(md, "vertex_group")
layout.itemR(md, "invert")
layout.itemR(md, "precision")
layout.itemR(md, "dynamic")
# Missing: "Bind"
def mirror(self, layout, md):
layout.itemR(md, "merge_limit")
row = layout.row()
row.itemR(md, "x")
row.itemR(md, "y")
row.itemR(md, "z")
col = layout.column_flow()
col.itemR(md, "clip", text="Do Clipping")
col.itemR(md, "mirror_vertex_groups")
col.itemR(md, "mirror_u")
col.itemR(md, "mirror_v")
layout.itemR(md, "mirror_object")
def multires(self, layout, md):
layout.itemR(md, "levels")
def particleinstance(self, layout, md):
layout.itemR(md, "object")
layout.itemR(md, "particle_system_number")
col = layout.column_flow()
col.itemR(md, "normal")
col.itemR(md, "children")
col.itemR(md, "path")
col.itemR(md, "unborn")
col.itemR(md, "alive")
col.itemR(md, "dead")
def particlesystem(self, layout, md):
layout.itemL(text="See Particle panel.")
def shrinkwrap(self, layout, md):
layout.itemR(md, "target")
layout.itemR(md, "vertex_group")
layout.itemR(md, "offset")
layout.itemR(md, "subsurf_levels")
layout.itemR(md, "mode")
if md.mode == 'PROJECT':
layout.itemR(md, "subsurf_levels")
layout.itemR(md, "auxiliary_target")
row = layout.row()
row.itemR(md, "x")
row.itemR(md, "y")
row.itemR(md, "z")
col = layout.column_flow()
col.itemR(md, "negative")
col.itemR(md, "positive")
col.itemR(md, "cull_front_faces")
col.itemR(md, "cull_back_faces")
if md.mode == 'NEAREST_SURFACEPOINT':
layout.itemR(md, "keep_above_surface")
# To-Do: Validate if structs
def simpledeform(self, layout, md):
layout.itemR(md, "mode")
layout.itemR(md, "vertex_group")
layout.itemR(md, "origin")
layout.itemR(md, "relative")
layout.itemR(md, "factor")
layout.itemR(md, "limits")
if md.mode in ('TAPER', 'STRETCH'):
layout.itemR(md, "lock_x_axis")
layout.itemR(md, "lock_y_axis")
def smooth(self, layout, md):
row = layout.row()
row.itemR(md, "x")
row.itemR(md, "y")
row.itemR(md, "z")
layout.itemR(md, "factor")
layout.itemR(md, "repeat")
layout.itemR(md, "vertex_group")
def softbody(self, layout, md):
layout.itemL(text="See Softbody panel.")
def subsurf(self, layout, md):
layout.itemR(md, "subdivision_type")
layout.itemR(md, "levels")
layout.itemR(md, "render_levels")
layout.itemR(md, "optimal_draw")
layout.itemR(md, "subsurf_uv")
def uvproject(self, layout, md):
layout.itemR(md, "uv_layer")
layout.itemR(md, "projectors")
layout.itemR(md, "image")
layout.itemR(md, "horizontal_aspect_ratio")
layout.itemR(md, "vertical_aspect_ratio")
layout.itemR(md, "override_image")
#"Projectors" don't work.
def wave(self, layout, md):
row = layout.row()
row.itemR(md, "x")
row.itemR(md, "y")
row.itemR(md, "cyclic")
row = layout.row()
row.itemR(md, "normals")
row.itemR(md, "x_normal")
row.itemR(md, "y_normal")
row.itemR(md, "z_normal")
col = layout.column_flow()
col.itemR(md, "time_offset")
col.itemR(md, "lifetime")
col.itemR(md, "damping_time")
col.itemR(md, "falloff_radius")
col.itemR(md, "start_position_x")
col.itemR(md, "start_position_y")
layout.itemR(md, "start_position_object")
layout.itemR(md, "vertex_group")
layout.itemR(md, "texture")
layout.itemR(md, "texture_coordinates")
layout.itemR(md, "uv_layer")
layout.itemR(md, "texture_coordinates_object")
col = layout.column_flow()
col.itemR(md, "speed", slider=True)
col.itemR(md, "height", slider=True)
col.itemR(md, "width", slider=True)
col.itemR(md, "narrowness", slider=True)
bpy.types.register(DATA_PT_modifiers)

View File

@@ -934,684 +934,8 @@ static uiLayout *draw_modifier(bContext *C, uiLayout *layout, Object *ob, Modifi
lx = x + 10;
cy = y + 10 - 1;
uiBlockBeginAlign(block);
if (md->type==eModifierType_Subsurf) {
SubsurfModifierData *smd = (SubsurfModifierData*) md;
char subsurfmenu[]="Subsurf Type%t|Catmull-Clark%x0|Simple Subdiv.%x1";
uiDefButS(block, MENU, B_MODIFIER_RECALC, subsurfmenu, lx,(cy-=19),buttonWidth,19, &smd->subdivType, 0, 0, 0, 0, "Selects type of subdivision algorithm.");
uiDefButS(block, NUM, B_MODIFIER_RECALC, "Levels:", lx, (cy-=19), buttonWidth,19, &smd->levels, 1, 6, 0, 0, "Number subdivisions to perform");
uiDefButS(block, NUM, B_MODIFIER_REDRAW, "Render Levels:", lx, (cy-=19), buttonWidth,19, &smd->renderLevels, 1, 6, 0, 0, "Number subdivisions to perform when rendering");
/* Disabled until non-EM DerivedMesh implementation is complete */
/*
uiDefButBitS(block, TOG, eSubsurfModifierFlag_Incremental, B_MODIFIER_RECALC, "Incremental", lx, (cy-=19),90,19,&smd->flags, 0, 0, 0, 0, "Use incremental calculation, even outside of mesh mode");
uiDefButBitS(block, TOG, eSubsurfModifierFlag_DebugIncr, B_MODIFIER_RECALC, "Debug", lx+90, cy,buttonWidth-90,19,&smd->flags, 0, 0, 0, 0, "Visualize the subsurf incremental calculation, for debugging effect of other modifiers");
*/
uiDefButBitS(block, TOG, eSubsurfModifierFlag_ControlEdges, B_MODIFIER_RECALC, "Optimal Draw", lx, (cy-=19), buttonWidth,19,&smd->flags, 0, 0, 0, 0, "Skip drawing/rendering of interior subdivided edges");
uiDefButBitS(block, TOG, eSubsurfModifierFlag_SubsurfUv, B_MODIFIER_RECALC, "Subsurf UV", lx, (cy-=19),buttonWidth,19,&smd->flags, 0, 0, 0, 0, "Use subsurf to subdivide UVs");
} else if (md->type==eModifierType_Lattice) {
LatticeModifierData *lmd = (LatticeModifierData*) md;
uiDefIDPoinBut(block, modifier_testLatticeObj, ID_OB, B_CHANGEDEP, "Ob: ", lx, (cy-=19), buttonWidth,19, &lmd->object, "Lattice object to deform with");
but=uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ", lx, (cy-=19), buttonWidth,19, &lmd->name, 0.0, 31.0, 0, 0, "Vertex Group name");
uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)ob);
} else if (md->type==eModifierType_Curve) {
CurveModifierData *cmd = (CurveModifierData*) md;
uiDefIDPoinBut(block, modifier_testCurveObj, ID_OB, B_CHANGEDEP, "Ob: ", lx, (cy-=19), buttonWidth,19, &cmd->object, "Curve object to deform with");
but=uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ", lx, (cy-=19), buttonWidth,19, &cmd->name, 0.0, 31.0, 0, 0, "Vertex Group name");
uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)ob);
uiDefButS(block, ROW,B_MODIFIER_RECALC,"X", lx, (cy-=19), 19,19, &cmd->defaxis, 12.0, MOD_CURVE_POSX, 0, 0, "The axis that the curve deforms along");
uiDefButS(block, ROW,B_MODIFIER_RECALC,"Y", (lx+buttonWidth/6), cy, 19,19, &cmd->defaxis, 12.0, MOD_CURVE_POSY, 0, 0, "The axis that the curve deforms along");
uiDefButS(block, ROW,B_MODIFIER_RECALC,"Z", (lx+2*buttonWidth/6), cy, 19,19, &cmd->defaxis, 12.0, MOD_CURVE_POSZ, 0, 0, "The axis that the curve deforms along");
uiDefButS(block, ROW,B_MODIFIER_RECALC,"-X", (lx+3*buttonWidth/6), cy, 24,19, &cmd->defaxis, 12.0, MOD_CURVE_NEGX, 0, 0, "The axis that the curve deforms along");
uiDefButS(block, ROW,B_MODIFIER_RECALC,"-Y", (lx+4*buttonWidth/6), cy, 24,19, &cmd->defaxis, 12.0, MOD_CURVE_NEGY, 0, 0, "The axis that the curve deforms along");
uiDefButS(block, ROW,B_MODIFIER_RECALC,"-Z", (lx+buttonWidth-buttonWidth/6), cy, 24,19, &cmd->defaxis, 12.0, MOD_CURVE_NEGZ, 0, 0, "The axis that the curve deforms along");
} else if (md->type==eModifierType_Build) {
BuildModifierData *bmd = (BuildModifierData*) md;
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Start:", lx, (cy-=19), buttonWidth,19, &bmd->start, 1.0, MAXFRAMEF, 100, 0, "Specify the start frame of the effect");
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Length:", lx, (cy-=19), buttonWidth,19, &bmd->length, 1.0, MAXFRAMEF, 100, 0, "Specify the total time the build effect requires");
uiDefButI(block, TOG, B_MODIFIER_RECALC, "Randomize", lx, (cy-=19), buttonWidth,19, &bmd->randomize, 0, 0, 1, 0, "Randomize the faces or edges during build.");
uiDefButI(block, NUM, B_MODIFIER_RECALC, "Seed:", lx, (cy-=19), buttonWidth,19, &bmd->seed, 1.0, MAXFRAMEF, 100, 0, "Specify the seed for random if used.");
} else if (md->type==eModifierType_Mirror) {
MirrorModifierData *mmd = (MirrorModifierData*) md;
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Merge Limit:", lx, (cy-=19), buttonWidth,19, &mmd->tolerance, 0.0, 1.0, 10, 10, "Distance from axis within which mirrored vertices are merged");
uiDefButBitS(block, TOG, MOD_MIR_AXIS_X, B_MODIFIER_RECALC, "X", lx,(cy-=19),20,19, &mmd->flag, 0, 0, 0, 0, "Enable X axis mirror");
uiDefButBitS(block, TOG, MOD_MIR_AXIS_Y, B_MODIFIER_RECALC, "Y", lx+20,cy,20,19, &mmd->flag, 0, 0, 0, 0, "Enable Y axis mirror");
uiDefButBitS(block, TOG, MOD_MIR_AXIS_Z, B_MODIFIER_RECALC, "Z", lx+40,cy,20,19, &mmd->flag, 0, 0, 0, 0, "Enable Z axis mirror");
uiDefButBitS(block, TOG, MOD_MIR_CLIPPING, B_MODIFIER_RECALC, "Do Clipping", lx+60, cy, buttonWidth-60,19, &mmd->flag, 1, 2, 0, 0, "Prevents during Transform vertices to go through Mirror");
uiDefButBitS(block, TOG, MOD_MIR_VGROUP, B_MODIFIER_RECALC, "Mirror Vgroups", lx, (cy-=19), buttonWidth,19, &mmd->flag, 1, 2, 0, 0, "Mirror vertex groups (e.g. .R->.L)");
uiDefButBitS(block, TOG, MOD_MIR_MIRROR_U, B_MODIFIER_RECALC,
"Mirror U",
lx, (cy-=19), buttonWidth/2, 19,
&mmd->flag, 0, 0, 0, 0,
"Mirror the U texture coordinate around "
"the 0.5 point");
uiDefButBitS(block, TOG, MOD_MIR_MIRROR_V, B_MODIFIER_RECALC,
"Mirror V",
lx + buttonWidth/2 + 1, cy, buttonWidth/2, 19,
&mmd->flag, 0, 0, 0, 0,
"Mirror the V texture coordinate around "
"the 0.5 point");
uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CHANGEDEP,
"Ob: ", lx, (cy -= 19), buttonWidth, 19,
&mmd->mirror_ob,
"Object to use as mirror");
} else if (md->type==eModifierType_Bevel) {
BevelModifierData *bmd = (BevelModifierData*) md;
/*uiDefButS(block, ROW, B_MODIFIER_RECALC, "Distance",
lx, (cy -= 19), (buttonWidth/2), 19, &bmd->val_flags,
11.0, 0, 0, 0,
"Interpret bevel value as a constant distance from each edge");
uiDefButS(block, ROW, B_MODIFIER_RECALC, "Radius",
(lx+buttonWidth/2), cy, (buttonWidth - buttonWidth/2), 19, &bmd->val_flags,
11.0, BME_BEVEL_RADIUS, 0, 0,
"Interpret bevel value as a radius - smaller angles will be beveled more");*/
uiBlockBeginAlign(block);
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Width: ",
lx, (cy -= 19), buttonWidth, 19, &bmd->value,
0.0, 0.5, 5, 4,
"Bevel value/amount");
/*uiDefButI(block, NUM, B_MODIFIER_RECALC, "Recurs",
lx, (cy -= 19), buttonWidth, 19, &bmd->res,
1, 4, 5, 2,
"Number of times to bevel");*/
uiDefButBitS(block, TOG, BME_BEVEL_VERT,
B_MODIFIER_RECALC, "Only Vertices",
lx, (cy -= 19), buttonWidth, 19,
&bmd->flags, 0, 0, 0, 0,
"Bevel only verts/corners; not edges");
uiBlockEndAlign(block);
uiDefBut(block, LABEL, 1, "Limit using:", lx, (cy-=25), buttonWidth,19, NULL, 0.0, 0.0, 0, 0, "");
uiBlockBeginAlign(block);
uiDefButS(block, ROW, B_MODIFIER_RECALC, "None",
lx, (cy -= 19), (buttonWidth/3), 19, &bmd->lim_flags,
12.0, 0, 0, 0,
"Bevel the entire mesh by a constant amount");
uiDefButS(block, ROW, B_MODIFIER_RECALC, "Angle",
(lx+buttonWidth/3), cy, (buttonWidth/3), 19, &bmd->lim_flags,
12.0, BME_BEVEL_ANGLE, 0, 0,
"Only bevel edges with sharp enough angles between faces");
uiDefButS(block, ROW, B_MODIFIER_RECALC, "BevWeight",
lx+(2*buttonWidth/3), cy, buttonWidth-2*(buttonWidth/3), 19, &bmd->lim_flags,
12.0, BME_BEVEL_WEIGHT, 0, 0,
"Use bevel weights to determine how much bevel is applied; apply them separately in vert/edge select mode");
if ((bmd->lim_flags & BME_BEVEL_WEIGHT) && !(bmd->flags & BME_BEVEL_VERT)) {
uiDefButS(block, ROW, B_MODIFIER_RECALC, "Min",
lx, (cy -= 19), (buttonWidth/3), 19, &bmd->e_flags,
13.0, BME_BEVEL_EMIN, 0, 0,
"The sharpest edge's weight is used when weighting a vert");
uiDefButS(block, ROW, B_MODIFIER_RECALC, "Average",
(lx+buttonWidth/3), cy, (buttonWidth/3), 19, &bmd->e_flags,
13.0, 0, 0, 0,
"The edge weights are averaged when weighting a vert");
uiDefButS(block, ROW, B_MODIFIER_RECALC, "Max",
(lx+2*(buttonWidth/3)), cy, buttonWidth-2*(buttonWidth/3), 19, &bmd->e_flags,
13.0, BME_BEVEL_EMAX, 0, 0,
"The largest edge's wieght is used when weighting a vert");
}
else if (bmd->lim_flags & BME_BEVEL_ANGLE) {
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Angle:",
lx, (cy -= 19), buttonWidth, 19, &bmd->bevel_angle,
0.0, 180.0, 100, 2,
"Angle above which to bevel edges");
}
} else if (md->type==eModifierType_EdgeSplit) {
EdgeSplitModifierData *emd = (EdgeSplitModifierData*) md;
uiDefButBitI(block, TOG, MOD_EDGESPLIT_FROMANGLE,
B_MODIFIER_RECALC, "From Edge Angle",
lx, (cy -= 19), buttonWidth, 19,
&emd->flags, 0, 0, 0, 0,
"Split edges with high angle between faces");
if(emd->flags & MOD_EDGESPLIT_FROMANGLE) {
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Split Angle:",
lx, (cy -= 19), buttonWidth, 19, &emd->split_angle,
0.0, 180.0, 100, 2,
"Angle above which to split edges");
}
uiDefButBitI(block, TOG, MOD_EDGESPLIT_FROMFLAG,
B_MODIFIER_RECALC, "From Marked As Sharp",
lx, (cy -= 19), buttonWidth, 19,
&emd->flags, 0, 0, 0, 0,
"Split edges that are marked as sharp");
} else if (md->type==eModifierType_Displace) {
DisplaceModifierData *dmd = (DisplaceModifierData*) md;
but = uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ",
lx, (cy -= 19), buttonWidth, 19,
&dmd->defgrp_name, 0.0, 31.0, 0, 0,
"Name of vertex group to displace"
" (displace whole mesh if blank)");
uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)ob);
uiDefIDPoinBut(block, modifier_testTexture, ID_TE, B_CHANGEDEP,
"Texture: ", lx, (cy -= 19), buttonWidth, 19,
&dmd->texture,
"Texture to use as displacement input");
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Midlevel:",
lx, (cy -= 19), buttonWidth, 19, &dmd->midlevel,
0, 1, 10, 3,
"Material value that gives no displacement");
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Strength:",
lx, (cy -= 19), buttonWidth, 19, &dmd->strength,
-1000, 1000, 10, 0.1,
"Strength of displacement");
sprintf(str, "Direction%%t|Normal%%x%d|RGB -> XYZ%%x%d|"
"Z%%x%d|Y%%x%d|X%%x%d",
MOD_DISP_DIR_NOR, MOD_DISP_DIR_RGB_XYZ,
MOD_DISP_DIR_Z, MOD_DISP_DIR_Y, MOD_DISP_DIR_X);
uiDefButI(block, MENU, B_MODIFIER_RECALC, str,
lx, (cy -= 19), buttonWidth, 19, &dmd->direction,
0.0, 1.0, 0, 0, "Displace direction");
sprintf(str, "Texture Coordinates%%t"
"|Local%%x%d|Global%%x%d|Object%%x%d|UV%%x%d",
MOD_DISP_MAP_LOCAL, MOD_DISP_MAP_GLOBAL,
MOD_DISP_MAP_OBJECT, MOD_DISP_MAP_UV);
uiDefButI(block, MENU, B_MODIFIER_RECALC, str,
lx, (cy -= 19), buttonWidth, 19, &dmd->texmapping,
0.0, 1.0, 0, 0,
"Texture coordinates used for displacement input");
if (dmd->texmapping == MOD_DISP_MAP_UV) {
char *strtmp;
int i;
Mesh *me= (Mesh*)ob->data;
CustomData *fdata = obedit? &me->edit_mesh->fdata: &me->fdata;
build_uvlayer_menu_vars(fdata, &strtmp, &dmd->uvlayer_tmp,
dmd->uvlayer_name);
but = uiDefButI(block, MENU, B_MODIFIER_RECALC, strtmp,
lx, (cy -= 19), buttonWidth, 19, &dmd->uvlayer_tmp,
0.0, 1.0, 0, 0, "Set the UV layer to use");
MEM_freeN(strtmp);
i = CustomData_get_layer_index(fdata, CD_MTFACE);
uiButSetFunc(but, set_displace_uvlayer, dmd,
&fdata->layers[i]);
}
if(dmd->texmapping == MOD_DISP_MAP_OBJECT) {
uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CHANGEDEP,
"Ob: ", lx, (cy -= 19), buttonWidth, 19,
&dmd->map_object,
"Object to get texture coordinates from");
}
} else if (md->type==eModifierType_UVProject) {
UVProjectModifierData *umd = (UVProjectModifierData *) md;
int i;
char *strtmp;
Mesh *me= (Mesh*)ob->data;
CustomData *fdata = obedit? &me->edit_mesh->fdata: &me->fdata;
build_uvlayer_menu_vars(fdata, &strtmp, &umd->uvlayer_tmp,
umd->uvlayer_name);
but = uiDefButI(block, MENU, B_MODIFIER_RECALC, strtmp,
lx, (cy -= 19), buttonWidth, 19, &umd->uvlayer_tmp,
0.0, 1.0, 0, 0, "Set the UV layer to use");
i = CustomData_get_layer_index(fdata, CD_MTFACE);
uiButSetFunc(but, set_uvproject_uvlayer, umd, &fdata->layers[i]);
MEM_freeN(strtmp);
uiDefButF(block, NUM, B_MODIFIER_RECALC, "AspX:",
lx, (cy -= 19), buttonWidth / 2, 19, &umd->aspectx,
1, 1000, 100, 2,
"Horizontal Aspect Ratio");
uiDefButF(block, NUM, B_MODIFIER_RECALC, "AspY:",
lx + (buttonWidth / 2) + 1, cy, buttonWidth / 2, 19,
&umd->aspecty,
1, 1000, 100, 2,
"Vertical Aspect Ratio");
uiDefButI(block, NUM, B_MODIFIER_RECALC, "Projectors:",
lx, (cy -= 19), buttonWidth, 19, &umd->num_projectors,
1, MOD_UVPROJECT_MAXPROJECTORS, 0, 0,
"Number of objects to use as projectors");
for(i = 0; i < umd->num_projectors; ++i) {
uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CHANGEDEP,
"Ob: ", lx, (cy -= 19), buttonWidth, 19,
&umd->projectors[i],
"Object to use as projector");
}
uiDefIDPoinBut(block, modifier_testImage, ID_IM, B_CHANGEDEP,
"Image: ", lx, (cy -= 19), buttonWidth, 19,
&umd->image,
"Image to project (only faces with this image "
"will be altered");
uiButSetCompleteFunc(but, autocomplete_image, (void *)ob);
uiDefButBitI(block, TOG, MOD_UVPROJECT_OVERRIDEIMAGE,
B_MODIFIER_RECALC, "Override Image",
lx, (cy -= 19), buttonWidth, 19,
&umd->flags, 0, 0, 0, 0,
"Override faces' current images with the "
"given image");
} else if (md->type==eModifierType_Decimate) {
DecimateModifierData *dmd = (DecimateModifierData*) md;
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Ratio:", lx,(cy-=19),buttonWidth,19, &dmd->percent, 0.0, 1.0, 10, 0, "Defines the percentage of triangles to reduce to");
sprintf(str, "Face Count: %d", dmd->faceCount);
uiDefBut(block, LABEL, 1, str, lx, (cy-=19), 160,19, NULL, 0.0, 0.0, 0, 0, "Displays the current number of faces in the decimated mesh");
} else if (md->type==eModifierType_Mask) {
MaskModifierData *mmd = (MaskModifierData *)md;
sprintf(str, "Mask Mode%%t|Vertex Group%%x%d|Selected Bones%%x%d|",
MOD_MASK_MODE_VGROUP,MOD_MASK_MODE_ARM);
uiDefButI(block, MENU, B_MODIFIER_RECALC, str,
lx, (cy -= 19), buttonWidth, 19, &mmd->mode,
0.0, 1.0, 0, 0, "How masking region is defined");
if (mmd->mode == MOD_MASK_MODE_ARM) {
uiDefIDPoinBut(block, modifier_testArmatureObj, ID_OB, B_CHANGEDEP,
"Ob: ", lx, (cy -= 19), buttonWidth, 19, &mmd->ob_arm,
"Armature to use as source of bones to mask");
}
else {
but=uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ",
lx, (cy-=19), buttonWidth, 19, &mmd->vgroup,
0.0, 31.0, 0, 0, "Vertex Group name");
uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)ob);
}
uiDefButBitI(block, TOG, MOD_MASK_INV, B_MODIFIER_RECALC, "Inverse",
lx, (cy-=19), buttonWidth, 19, &mmd->flag,
0, 0, 0, 0, "Use vertices that are not part of region defined");
} else if (md->type==eModifierType_Smooth) {
SmoothModifierData *smd = (SmoothModifierData*) md;
uiDefButBitS(block, TOG, MOD_SMOOTH_X, B_MODIFIER_RECALC, "X", lx,(cy-=19),45,19, &smd->flag, 0, 0, 0, 0, "Enable X axis smoothing");
uiDefButBitS(block, TOG, MOD_SMOOTH_Y, B_MODIFIER_RECALC, "Y", lx+45,cy,45,19, &smd->flag, 0, 0, 0, 0, "Enable Y axis smoothing");
uiDefButBitS(block, TOG, MOD_SMOOTH_Z, B_MODIFIER_RECALC, "Z", lx+90,cy,45,19, &smd->flag, 0, 0, 0, 0, "Enable Z axis smoothing");
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Factor:", lx,(cy-=19),buttonWidth, 19, &smd->fac, -10.0, 10.0, 0.5, 0, "Define the amount of smoothing, from 0.0 to 1.0 (lower / higher values can deform the mesh)");
uiDefButS(block, NUM, B_MODIFIER_RECALC, "Repeat:", lx,(cy-=19),buttonWidth, 19, &smd->repeat, 0.0, 30.0, 1, 0, "Number of smoothing iterations");
but=uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ", lx, (cy-=19), buttonWidth,19, &smd->defgrp_name, 0.0, 31.0, 0, 0, "Vertex Group name to define which vertices are affected");
} else if (md->type==eModifierType_Cast) {
CastModifierData *cmd = (CastModifierData*) md;
char casttypemenu[]="Projection Type%t|Sphere%x0|Cylinder%x1|Cuboid%x2";
uiDefButS(block, MENU, B_MODIFIER_RECALC, casttypemenu, lx,(cy-=19),buttonWidth - 30,19, &cmd->type, 0, 0, 0, 0, "Projection type to apply");
uiDefButBitS(block, TOG, MOD_CAST_X, B_MODIFIER_RECALC, "X", lx,(cy-=19),45,19, &cmd->flag, 0, 0, 0, 0, "Enable (local) X axis deformation");
uiDefButBitS(block, TOG, MOD_CAST_Y, B_MODIFIER_RECALC, "Y", lx+45,cy,45,19, &cmd->flag, 0, 0, 0, 0, "Enable (local) Y axis deformation");
if (cmd->type != MOD_CAST_TYPE_CYLINDER) {
uiDefButBitS(block, TOG, MOD_CAST_Z, B_MODIFIER_RECALC, "Z", lx+90,cy,45,19, &cmd->flag, 0, 0, 0, 0, "Enable (local) Z axis deformation");
}
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Factor:", lx,(cy-=19),buttonWidth, 19, &cmd->fac, -10.0, 10.0, 5, 0, "Define the amount of deformation");
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Radius:", lx,(cy-=19),buttonWidth, 19, &cmd->radius, 0.0, 100.0, 10.0, 0, "Only deform vertices within this distance from the center of the effect (leave as 0 for infinite)");
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Size:", lx,(cy-=19),buttonWidth, 19, &cmd->size, 0.0, 100.0, 10.0, 0, "Size of projection shape (leave as 0 for auto)");
uiDefButBitS(block, TOG, MOD_CAST_SIZE_FROM_RADIUS, B_MODIFIER_RECALC, "From radius", lx+buttonWidth,cy,80,19, &cmd->flag, 0, 0, 0, 0, "Use radius as size of projection shape (0 = auto)");
if (ob->type == OB_MESH) {
but=uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ", lx, (cy-=19), buttonWidth,19, &cmd->defgrp_name, 0.0, 31.0, 0, 0, "Vertex Group name to define which vertices are affected");
}
uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CHANGEDEP, "Ob: ", lx,(cy-=19), buttonWidth,19, &cmd->object, "Control object: if available, its location determines the center of the effect");
if(cmd->object) {
uiDefButBitS(block, TOG, MOD_CAST_USE_OB_TRANSFORM, B_MODIFIER_RECALC, "Use transform", lx+buttonWidth,cy,80,19, &cmd->flag, 0, 0, 0, 0, "Use object transform to control projection shape");
}
} else if (md->type==eModifierType_Wave) {
WaveModifierData *wmd = (WaveModifierData*) md;
uiDefButBitS(block, TOG, MOD_WAVE_X, B_MODIFIER_RECALC, "X", lx,(cy-=19),45,19, &wmd->flag, 0, 0, 0, 0, "Enable X axis motion");
uiDefButBitS(block, TOG, MOD_WAVE_Y, B_MODIFIER_RECALC, "Y", lx+45,cy,45,19, &wmd->flag, 0, 0, 0, 0, "Enable Y axis motion");
uiDefButBitS(block, TOG, MOD_WAVE_CYCL, B_MODIFIER_RECALC, "Cycl", lx+90,cy,buttonWidth-90,19, &wmd->flag, 0, 0, 0, 0, "Enable cyclic wave effect");
uiDefButBitS(block, TOG, MOD_WAVE_NORM, B_MODIFIER_RECALC, "Normals", lx,(cy-=19),buttonWidth,19, &wmd->flag, 0, 0, 0, 0, "Displace along normals");
if (wmd->flag & MOD_WAVE_NORM){
if (ob->type==OB_MESH) {
uiDefButBitS(block, TOG, MOD_WAVE_NORM_X, B_MODIFIER_RECALC, "X", lx,(cy-=19),buttonWidth/3,19, &wmd->flag, 0, 0, 0, 0, "Enable displacement along the X normal");
uiDefButBitS(block, TOG, MOD_WAVE_NORM_Y, B_MODIFIER_RECALC, "Y", lx+(buttonWidth/3),cy,buttonWidth/3,19, &wmd->flag, 0, 0, 0, 0, "Enable displacement along the Y normal");
uiDefButBitS(block, TOG, MOD_WAVE_NORM_Z, B_MODIFIER_RECALC, "Z", lx+(buttonWidth/3)*2,cy,buttonWidth/3,19, &wmd->flag, 0, 0, 0, 0, "Enable displacement along the Z normal");
}
else
uiDefBut(block, LABEL, 1, "Meshes Only", lx, (cy-=19), buttonWidth,19, NULL, 0.0, 0.0, 0, 0, "");
}
uiBlockBeginAlign(block);
if(wmd->speed >= 0)
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Time sta:", lx,(cy-=19),buttonWidth,19, &wmd->timeoffs, -MAXFRAMEF, MAXFRAMEF, 100, 0, "Specify starting frame of the wave");
else
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Time end:", lx,(cy-=19),buttonWidth,19, &wmd->timeoffs, -MAXFRAMEF, MAXFRAMEF, 100, 0, "Specify ending frame of the wave");
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Lifetime:", lx,(cy-=19),buttonWidth,19, &wmd->lifetime, -MAXFRAMEF, MAXFRAMEF, 100, 0, "Specify the lifespan of the wave");
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Damptime:", lx,(cy-=19),buttonWidth,19, &wmd->damp, -MAXFRAMEF, MAXFRAMEF, 100, 0, "Specify the dampingtime of the wave");
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Falloff:", lx,(cy-=19),buttonWidth,19, &wmd->falloff, 0, 100, 100, 0, "Specify the falloff radius of the waves");
cy -= 9;
uiBlockBeginAlign(block);
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Sta x:", lx,(cy-=19),113,19, &wmd->startx, -100.0, 100.0, 100, 0, "Starting position for the X axis");
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Sta y:", lx+115,cy,105,19, &wmd->starty, -100.0, 100.0, 100, 0, "Starting position for the Y axis");
uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_MODIFIER_RECALC, "Ob: ", lx, (cy-=19), 220,19, &wmd->objectcenter, "Object to use as Starting Position (leave blank to disable)");
uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ",lx, (cy -= 19), 220, 19,&wmd->defgrp_name, 0.0, 31.0, 0, 0, "Name of vertex group with which to modulate displacement");
uiDefIDPoinBut(block, modifier_testTexture, ID_TE, B_CHANGEDEP,"Texture: ", lx, (cy -= 19), 220, 19, &wmd->texture,"Texture with which to modulate wave");
sprintf(str, "Texture Coordinates%%t"
"|Local%%x%d|Global%%x%d|Object%%x%d|UV%%x%d",
MOD_WAV_MAP_LOCAL, MOD_WAV_MAP_GLOBAL,
MOD_WAV_MAP_OBJECT, MOD_WAV_MAP_UV);
uiDefButI(block, MENU, B_MODIFIER_RECALC, str,
lx, (cy -= 19), 220, 19, &wmd->texmapping,
0.0, 1.0, 0, 0,
"Texture coordinates used for modulation input");
if (wmd->texmapping == MOD_WAV_MAP_UV) {
char *strtmp;
int i;
Mesh *me = (Mesh*)ob->data;
CustomData *fdata = obedit? &me->edit_mesh->fdata: &me->fdata;
build_uvlayer_menu_vars(fdata, &strtmp, &wmd->uvlayer_tmp,
wmd->uvlayer_name);
but = uiDefButI(block, MENU, B_MODIFIER_RECALC, strtmp,
lx, (cy -= 19), 220, 19, &wmd->uvlayer_tmp,
0.0, 1.0, 0, 0, "Set the UV layer to use");
MEM_freeN(strtmp);
i = CustomData_get_layer_index(fdata, CD_MTFACE);
uiButSetFunc(but, set_wave_uvlayer, wmd,
&fdata->layers[i]);
}
if(wmd->texmapping == MOD_DISP_MAP_OBJECT) {
uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CHANGEDEP,
"Ob: ", lx, (cy -= 19), 220, 19,
&wmd->map_object,
"Object to get texture coordinates from");
}
cy -= 9;
uiBlockBeginAlign(block);
uiDefButF(block, NUMSLI, B_MODIFIER_RECALC, "Speed:", lx,(cy-=19),220,19, &wmd->speed, -2.0, 2.0, 0, 0, "Specify the wave speed");
uiDefButF(block, NUMSLI, B_MODIFIER_RECALC, "Height:", lx,(cy-=19),220,19, &wmd->height, -2.0, 2.0, 0, 0, "Specify the amplitude of the wave");
uiDefButF(block, NUMSLI, B_MODIFIER_RECALC, "Width:", lx,(cy-=19),220,19, &wmd->width, 0.0, 5.0, 0, 0, "Specify the width of the wave");
uiDefButF(block, NUMSLI, B_MODIFIER_RECALC, "Narrow:", lx,(cy-=19),220,19, &wmd->narrow, 0.0, 10.0, 0, 0, "Specify how narrow the wave follows");
} else if (md->type==eModifierType_Hook) {
HookModifierData *hmd = (HookModifierData*) md;
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Falloff: ", lx, (cy-=19), buttonWidth,19, &hmd->falloff, 0.0, 100.0, 100, 0, "If not zero, the distance from hook where influence ends");
uiDefButF(block, NUMSLI, B_MODIFIER_RECALC, "Force: ", lx, (cy-=19), buttonWidth,19, &hmd->force, 0.0, 1.0, 100, 0, "Set relative force of hook");
uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CHANGEDEP, "Ob: ", lx, (cy-=19), buttonWidth,19, &hmd->object, "Parent Object for hook, also recalculates and clears offset");
if(hmd->indexar==NULL) {
but=uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ", lx, (cy-=19), buttonWidth,19, &hmd->name, 0.0, 31.0, 0, 0, "Vertex Group name");
uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)ob);
}
uiBlockBeginAlign(block);
but = uiDefBut(block, BUT, B_MODIFIER_RECALC, "Reset", lx, (cy-=19), 80,19, NULL, 0.0, 0.0, 0, 0, "Recalculate and clear offset (transform) of hook");
uiButSetFunc(but, modifiers_clearHookOffset, ob, md);
but = uiDefBut(block, BUT, B_MODIFIER_RECALC, "Recenter", lx+80, cy, buttonWidth-80,19, NULL, 0.0, 0.0, 0, 0, "Sets hook center to cursor position");
uiButSetFunc(but, modifiers_cursorHookCenter, ob, md);
if (editing) {
but = uiDefBut(block, BUT, B_MODIFIER_RECALC, "Select", lx, (cy-=19), 80,19, NULL, 0.0, 0.0, 0, 0, "Selects effected vertices on mesh");
uiButSetFunc(but, modifiers_selectHook, ob, md);
but = uiDefBut(block, BUT, B_MODIFIER_RECALC, "Reassign", lx+80, cy, buttonWidth-80,19, NULL, 0.0, 0.0, 0, 0, "Reassigns selected vertices to hook");
uiButSetFunc(but, modifiers_reassignHook, ob, md);
}
} else if (md->type==eModifierType_Softbody) {
uiDefBut(block, LABEL, 1, "See Soft Body panel.", lx, (cy-=19), buttonWidth,19, NULL, 0.0, 0.0, 0, 0, "");
} else if (md->type==eModifierType_Cloth) {
uiDefBut(block, LABEL, 1, "See Cloth panel.", lx, (cy-=19), buttonWidth,19, NULL, 0.0, 0.0, 0, 0, "");
} else if (md->type==eModifierType_Collision) {
uiDefBut(block, LABEL, 1, "See Collision panel.", lx, (cy-=19), buttonWidth,19, NULL, 0.0, 0.0, 0, 0, "");
} else if (md->type==eModifierType_Surface) {
uiDefBut(block, LABEL, 1, "See Fields panel.", lx, (cy-=19), buttonWidth,19, NULL, 0.0, 0.0, 0, 0, "");
} else if (md->type==eModifierType_Fluidsim) {
uiDefBut(block, LABEL, 1, "See Fluidsim panel.", lx, (cy-=19), buttonWidth,19, NULL, 0.0, 0.0, 0, 0, "");
} else if (md->type==eModifierType_Boolean) {
BooleanModifierData *bmd = (BooleanModifierData*) md;
uiDefButI(block, MENU, B_MODIFIER_RECALC, "Operation%t|Intersect%x0|Union%x1|Difference%x2", lx,(cy-=19),buttonWidth,19, &bmd->operation, 0.0, 1.0, 0, 0, "Boolean operation to perform");
uiDefIDPoinBut(block, modifier_testMeshObj, ID_OB, B_CHANGEDEP, "Ob: ", lx, (cy-=19), buttonWidth,19, &bmd->object, "Mesh object to use for boolean operation");
} else if (md->type==eModifierType_Array) {
ArrayModifierData *amd = (ArrayModifierData*) md;
float range = 10000;
int cytop, halfwidth = (width - 5)/2 - 15;
int halflx = lx + halfwidth + 10;
// XXX uiBlockSetEmboss(block, UI_EMBOSSX);
uiBlockEndAlign(block);
/* length parameters */
uiBlockBeginAlign(block);
sprintf(str, "Length Fit%%t|Fixed Count%%x%d|Fixed Length%%x%d"
"|Fit To Curve Length%%x%d",
MOD_ARR_FIXEDCOUNT, MOD_ARR_FITLENGTH, MOD_ARR_FITCURVE);
uiDefButI(block, MENU, B_MODIFIER_RECALC, str,
lx, (cy-=19), buttonWidth, 19, &amd->fit_type,
0.0, 1.0, 0, 0, "Array length calculation method");
switch(amd->fit_type)
{
case MOD_ARR_FIXEDCOUNT:
uiDefButI(block, NUM, B_MODIFIER_RECALC, "Count:",
lx, (cy -= 19), buttonWidth, 19, &amd->count,
1, 1000, 0, 0, "Number of duplicates to make");
break;
case MOD_ARR_FITLENGTH:
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Length:",
lx, (cy -= 19), buttonWidth, 19, &amd->length,
0, range, 10, 2,
"Length to fit array within");
break;
case MOD_ARR_FITCURVE:
uiDefIDPoinBut(block, modifier_testCurveObj, ID_OB,
B_CHANGEDEP, "Ob: ",
lx, (cy -= 19), buttonWidth, 19, &amd->curve_ob,
"Curve object to fit array length to");
break;
}
uiBlockEndAlign(block);
/* offset parameters */
cy -= 10;
cytop= cy;
uiBlockBeginAlign(block);
uiDefButBitI(block, TOG, MOD_ARR_OFF_CONST, B_MODIFIER_RECALC,
"Constant Offset", lx, (cy-=19), halfwidth, 19,
&amd->offset_type, 0, 0, 0, 0,
"Constant offset between duplicates "
"(local coordinates)");
uiDefButF(block, NUM, B_MODIFIER_RECALC, "X:",
lx, (cy-=19), halfwidth, 19,
&amd->offset[0],
-range, range, 10, 3,
"Constant component for duplicate offsets "
"(local coordinates)");
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Y:",
lx, (cy-=19), halfwidth, 19,
&amd->offset[1],
-range, range, 10, 3,
"Constant component for duplicate offsets "
"(local coordinates)");
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Z:",
lx, (cy-=19), halfwidth, 19,
&amd->offset[2],
-range, range, 10, 3,
"Constant component for duplicate offsets "
"(local coordinates)");
uiBlockEndAlign(block);
cy= cytop;
uiBlockBeginAlign(block);
uiDefButBitI(block, TOG, MOD_ARR_OFF_RELATIVE, B_MODIFIER_RECALC,
"Relative Offset", halflx, (cy-=19), halfwidth, 19,
&amd->offset_type, 0, 0, 0, 0,
"Offset between duplicates relative to object width "
"(local coordinates)");
uiDefButF(block, NUM, B_MODIFIER_RECALC, "X:",
halflx, (cy-=19), halfwidth, 19,
&amd->scale[0],
-range, range, 10, 3,
"Component for duplicate offsets relative to object "
"width (local coordinates)");
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Y:",
halflx, (cy-=19), halfwidth, 19,
&amd->scale[1],
-range, range, 10, 3,
"Component for duplicate offsets relative to object "
"width (local coordinates)");
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Z:",
halflx, (cy-=19), halfwidth, 19,
&amd->scale[2],
-range, range, 10, 3,
"Component for duplicate offsets relative to object "
"width (local coordinates)");
uiBlockEndAlign(block);
/* vertex merging parameters */
cy -= 10;
cytop= cy;
uiBlockBeginAlign(block);
uiDefButBitI(block, TOG, MOD_ARR_MERGE, B_MODIFIER_RECALC,
"Merge",
lx, (cy-=19), halfwidth/2, 19, &amd->flags,
0, 0, 0, 0,
"Merge vertices in adjacent duplicates");
uiDefButBitI(block, TOG, MOD_ARR_MERGEFINAL, B_MODIFIER_RECALC,
"First Last",
lx + halfwidth/2, cy, (halfwidth+1)/2, 19,
&amd->flags,
0, 0, 0, 0,
"Merge vertices in first duplicate with vertices"
" in last duplicate");
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Limit:",
lx, (cy-=19), halfwidth, 19, &amd->merge_dist,
0, 1.0f, 1, 4,
"Limit below which to merge vertices");
/* offset ob */
cy = cytop;
uiBlockBeginAlign(block);
uiDefButBitI(block, TOG, MOD_ARR_OFF_OBJ, B_MODIFIER_RECALC,
"Object Offset", halflx, (cy -= 19), halfwidth, 19,
&amd->offset_type, 0, 0, 0, 0,
"Add an object transformation to the total offset");
uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CHANGEDEP,
"Ob: ", halflx, (cy -= 19), halfwidth, 19,
&amd->offset_ob,
"Object from which to take offset transformation");
uiBlockEndAlign(block);
cy -= 10;
but = uiDefIDPoinBut(block, test_meshobpoin_but, ID_OB,
B_CHANGEDEP, "Start cap: ",
lx, (cy -= 19), halfwidth, 19,
&amd->start_cap,
"Mesh object to use as start cap");
uiButSetCompleteFunc(but, autocomplete_meshob, (void *)ob);
but = uiDefIDPoinBut(block, test_meshobpoin_but, ID_OB,
B_CHANGEDEP, "End cap: ",
halflx, cy, halfwidth, 19,
&amd->end_cap,
"Mesh object to use as end cap");
uiButSetCompleteFunc(but, autocomplete_meshob, (void *)ob);
} else if (md->type==eModifierType_MeshDeform) {
MeshDeformModifierData *mmd = (MeshDeformModifierData*) md;
uiBlockBeginAlign(block);
uiDefIDPoinBut(block, test_meshobpoin_but, ID_OB, B_CHANGEDEP, "Ob: ", lx, (cy-=19), buttonWidth,19, &mmd->object, "Mesh object to be use as cage");
but=uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ", lx, (cy-19), buttonWidth-40,19, &mmd->defgrp_name, 0.0, 31.0, 0, 0, "Vertex Group name to control overall meshdeform influence");
uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)ob);
uiDefButBitS(block, TOG, MOD_MDEF_INVERT_VGROUP, B_MODIFIER_RECALC, "Inv", lx+buttonWidth-40, (cy-=19), 40,19, &mmd->flag, 0.0, 31.0, 0, 0, "Invert vertex group influence");
uiBlockBeginAlign(block);
if(mmd->bindcos) {
but= uiDefBut(block, BUT, B_MODIFIER_RECALC, "Unbind", lx,(cy-=24), buttonWidth,19, 0, 0, 0, 0, 0, "Unbind mesh from cage");
uiButSetFunc(but,modifiers_bindMeshDeform,ob,md);
}
else {
but= uiDefBut(block, BUT, B_MODIFIER_RECALC, "Bind", lx,(cy-=24), buttonWidth,19, 0, 0, 0, 0, 0, "Bind mesh to cage");
uiButSetFunc(but,modifiers_bindMeshDeform,ob,md);
uiDefButS(block, NUM, B_NOP, "Precision:", lx,(cy-19), buttonWidth/2 + 20,19, &mmd->gridsize, 2, 10, 0.5, 0, "The grid size for binding");
uiDefButBitS(block, TOG, MOD_MDEF_DYNAMIC_BIND, B_MODIFIER_RECALC, "Dynamic", lx+(buttonWidth+1)/2 + 20, (cy-=19), buttonWidth/2 - 20,19, &mmd->flag, 0.0, 31.0, 0, 0, "Recompute binding dynamically on top of other deformers like Shape Keys (slower and more memory consuming!)");
}
uiBlockEndAlign(block);
} else if (md->type==eModifierType_ParticleSystem) {
uiDefBut(block, LABEL, 1, "See Particle buttons.", lx, (cy-=19), buttonWidth,19, NULL, 0.0, 0.0, 0, 0, "");
} else if (md->type==eModifierType_ParticleInstance) {
ParticleInstanceModifierData *pimd = (ParticleInstanceModifierData*) md;
uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CHANGEDEP, "Ob: ", lx, (cy -= 19), buttonWidth, 19, &pimd->ob, "Object that has the particlesystem");
uiDefButS(block, NUM, B_MODIFIER_RECALC, "PSYS:", lx, (cy -= 19), buttonWidth, 19, &pimd->psys, 1, 10, 10, 3, "Particlesystem number in the object");
uiDefButBitS(block, TOG, eParticleInstanceFlag_Parents, B_MODIFIER_RECALC, "Normal", lx, (cy -= 19), buttonWidth/3,19, &pimd->flag, 0, 0, 0, 0, "Create instances from normal particles");
uiDefButBitS(block, TOG, eParticleInstanceFlag_Children, B_MODIFIER_RECALC, "Children", lx+buttonWidth/3, cy, buttonWidth/3,19, &pimd->flag, 0, 0, 0, 0, "Create instances from child particles");
uiDefButBitS(block, TOG, eParticleInstanceFlag_Path, B_MODIFIER_RECALC, "Path", lx+buttonWidth*2/3, cy, buttonWidth/3,19, &pimd->flag, 0, 0, 0, 0, "Create instances along particle paths");
uiDefButBitS(block, TOG, eParticleInstanceFlag_Unborn, B_MODIFIER_RECALC, "Unborn", lx, (cy -= 19), buttonWidth/3,19, &pimd->flag, 0, 0, 0, 0, "Show instances when particles are unborn");
uiDefButBitS(block, TOG, eParticleInstanceFlag_Alive, B_MODIFIER_RECALC, "Alive", lx+buttonWidth/3, cy, buttonWidth/3,19, &pimd->flag, 0, 0, 0, 0, "Show instances when particles are alive");
uiDefButBitS(block, TOG, eParticleInstanceFlag_Dead, B_MODIFIER_RECALC, "Dead", lx+buttonWidth*2/3, cy, buttonWidth/3,19, &pimd->flag, 0, 0, 0, 0, "Show instances when particles are dead");
} else if (md->type==eModifierType_Explode) {
ExplodeModifierData *emd = (ExplodeModifierData*) md;
uiBut *but;
char *menustr= NULL; /* XXX get_vertexgroup_menustr(ob); */
int defCount=BLI_countlist(&ob->defbase);
if(defCount==0) emd->vgroup=0;
uiBlockBeginAlign(block);
but=uiDefButS(block, MENU, B_MODIFIER_RECALC, menustr, lx, (cy-=19), buttonWidth-20,19, &emd->vgroup, 0, defCount, 0, 0, "Protect this vertex group");
uiButSetFunc(but,modifiers_explodeFacepa,emd,0);
MEM_freeN(menustr);
but=uiDefIconBut(block, BUT, B_MODIFIER_RECALC, ICON_X, (lx+buttonWidth)-20, cy, 20,19, 0, 0, 0, 0, 0, "Disable use of vertex group");
uiButSetFunc(but, modifiers_explodeDelVg, (void *)emd, (void *)NULL);
but=uiDefButF(block, NUMSLI, B_MODIFIER_RECALC, "", lx, (cy-=19), buttonWidth,19, &emd->protect, 0.0f, 1.0f, 0, 0, "Clean vertex group edges");
uiButSetFunc(but,modifiers_explodeFacepa,emd,0);
but=uiDefBut(block, BUT, B_MODIFIER_RECALC, "Refresh", lx, (cy-=19), buttonWidth/2,19, 0, 0, 0, 0, 0, "Recalculate faces assigned to particles");
uiButSetFunc(but,modifiers_explodeFacepa,emd,0);
uiDefButBitS(block, TOG, eExplodeFlag_EdgeSplit, B_MODIFIER_RECALC, "Split Edges", lx+buttonWidth/2, cy, buttonWidth/2,19, &emd->flag, 0, 0, 0, 0, "Split face edges for nicer shrapnel");
uiDefButBitS(block, TOG, eExplodeFlag_Unborn, B_MODIFIER_RECALC, "Unborn", lx, (cy-=19), buttonWidth/3,19, &emd->flag, 0, 0, 0, 0, "Show mesh when particles are unborn");
uiDefButBitS(block, TOG, eExplodeFlag_Alive, B_MODIFIER_RECALC, "Alive", lx+buttonWidth/3, cy, buttonWidth/3,19, &emd->flag, 0, 0, 0, 0, "Show mesh when particles are alive");
uiDefButBitS(block, TOG, eExplodeFlag_Dead, B_MODIFIER_RECALC, "Dead", lx+buttonWidth*2/3, cy, buttonWidth/3,19, &emd->flag, 0, 0, 0, 0, "Show mesh when particles are dead");
uiBlockEndAlign(block);
} else if (md->type==eModifierType_Shrinkwrap) {
ShrinkwrapModifierData *smd = (ShrinkwrapModifierData*) md;
char shrinktypemenu[]="Shrinkwrap type%t|nearest surface point %x0|projection %x1|nearest vertex %x2";
uiDefIDPoinBut(block, modifier_testMeshObj, ID_OB, B_CHANGEDEP, "Ob: ", lx, (cy-=19), buttonWidth,19, &smd->target, "Target to shrink to");
but=uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ", lx, (cy-=19), buttonWidth,19, &smd->vgroup_name, 0, 31, 0, 0, "Vertex Group name");
uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)ob);
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Offset:", lx,(cy-=19),buttonWidth,19, &smd->keepDist, 0.0f, 100.0f, 1.0f, 0, "Specify distance to keep from the target");
cy -= 3;
uiDefButS(block, MENU, B_MODIFIER_RECALC, shrinktypemenu, lx,(cy-=19),buttonWidth,19, &smd->shrinkType, 0, 0, 0, 0, "Selects type of shrinkwrap algorithm for target position.");
uiDefButC(block, NUM, B_MODIFIER_RECALC, "SS Levels:", lx, (cy-=19), buttonWidth,19, &smd->subsurfLevels, 0, 6, 0, 0, "This indicates the number of CCSubdivisions that must be performed before extracting vertexs positions and normals");
if (smd->shrinkType == MOD_SHRINKWRAP_PROJECT){
/* UI for projection axis */
uiBlockBeginAlign(block);
uiDefButC(block, ROW, B_MODIFIER_RECALC, "Normal" , lx,(cy-=19),buttonWidth,19, &smd->projAxis, 18.0, MOD_SHRINKWRAP_PROJECT_OVER_NORMAL, 0, 0, "Projection over X axis");
uiDefButBitC(block, TOG, MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS, B_MODIFIER_RECALC, "X", lx+buttonWidth/3*0,(cy-=19),buttonWidth/3,19, &smd->projAxis, 0, 0, 0, 0, "Projection over X axis");
uiDefButBitC(block, TOG, MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS, B_MODIFIER_RECALC, "Y", lx+buttonWidth/3*1,cy,buttonWidth/3,19, &smd->projAxis, 0, 0, 0, 0, "Projection over Y axis");
uiDefButBitC(block, TOG, MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS, B_MODIFIER_RECALC, "Z", lx+buttonWidth/3*2,cy,buttonWidth/3,19, &smd->projAxis, 0, 0, 0, 0, "Projection over Z axis");
/* allowed directions of projection axis */
uiDefButBitS(block, TOG, MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR, B_MODIFIER_RECALC, "Negative", lx,(cy-=19),buttonWidth/2,19, &smd->shrinkOpts, 0, 0, 0, 0, "Allows to move the vertex in the negative direction of axis");
uiDefButBitS(block, TOG, MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR, B_MODIFIER_RECALC, "Positive", lx + buttonWidth/2,cy,buttonWidth/2,19, &smd->shrinkOpts, 0, 0, 0, 0, "Allows to move the vertex in the positive direction of axis");
uiDefButBitS(block, TOG, MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE, B_MODIFIER_RECALC, "Cull frontfaces",lx,(cy-=19),buttonWidth/2,19, &smd->shrinkOpts, 0, 0, 0, 0, "Controls whether a vertex can be projected to a front face on target");
uiDefButBitS(block, TOG, MOD_SHRINKWRAP_CULL_TARGET_BACKFACE, B_MODIFIER_RECALC, "Cull backfaces", lx+buttonWidth/2,cy,buttonWidth/2,19, &smd->shrinkOpts, 0, 0, 0, 0, "Controls whether a vertex can be projected to a back face on target");
uiDefIDPoinBut(block, modifier_testMeshObj, ID_OB, B_CHANGEDEP, "Ob2: ", lx, (cy-=19), buttonWidth,19, &smd->auxTarget, "Aditional mesh to project over");
}
else if (smd->shrinkType == MOD_SHRINKWRAP_NEAREST_SURFACE){
uiDefButBitS(block, TOG, MOD_SHRINKWRAP_KEEP_ABOVE_SURFACE, B_MODIFIER_RECALC, "Above surface", lx,(cy-=19),buttonWidth,19, &smd->shrinkOpts, 0, 0, 0, 0, "Vertices are kept on the front side of faces");
}
uiBlockEndAlign(block);
} else if (md->type==eModifierType_SimpleDeform) {
SimpleDeformModifierData *smd = (SimpleDeformModifierData*) md;
char simpledeform_modemenu[] = "Deform type%t|Twist %x1|Bend %x2|Taper %x3|Strech %x4";
uiDefButC(block, MENU, B_MODIFIER_RECALC, simpledeform_modemenu, lx,(cy-=19),buttonWidth,19, &smd->mode, 0, 0, 0, 0, "Selects type of deform to apply to object.");
but=uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ", lx, (cy-=19), buttonWidth,19, &smd->vgroup_name, 0, 31, 0, 0, "Vertex Group name");
uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)ob);
uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CHANGEDEP, "Ob: ", lx, (cy-=19), buttonWidth,19, &smd->origin, "Origin of modifier space coordinates");
if(smd->origin != NULL)
uiDefButBitC(block, TOG, MOD_SIMPLEDEFORM_ORIGIN_LOCAL, B_MODIFIER_RECALC, "Relative",lx,(cy-=19),buttonWidth,19, &smd->originOpts, 0, 0, 0, 0, "Sets the origin of deform space to be relative to the object");
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Factor:", lx,(cy-=19),buttonWidth,19, &smd->factor, -10.0f, 10.0f, 0.5f, 0, "Deform Factor");
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Upper Limit:", lx,(cy-=19),buttonWidth,19, &smd->limit[1], 0.0f, 1.0f, 5.0f, 0, "Upper Limit for deform");
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Lower Limit:", lx,(cy-=19),buttonWidth,19, &smd->limit[0], 0.0f, 1.0f, 5.0f, 0, "Lower Limit for deform");
if(smd->mode == MOD_SIMPLEDEFORM_MODE_STRETCH
|| smd->mode == MOD_SIMPLEDEFORM_MODE_TAPER )
{
uiDefButBitC(block, TOG, MOD_SIMPLEDEFORM_LOCK_AXIS_X, B_MODIFIER_RECALC, "Loc X", lx, (cy-=19),buttonWidth/2,19, &smd->axis, 0, 0, 0, 0, "Disallow changes on the X coordinate");
uiDefButBitC(block, TOG, MOD_SIMPLEDEFORM_LOCK_AXIS_Y, B_MODIFIER_RECALC, "Loc Y", lx+(buttonWidth/2), (cy),buttonWidth/2,19, &smd->axis, 0, 0, 0, 0, "Disallow changes on the Y coordinate");
}
}
uiBlockEndAlign(block);
// else if (md->type==eModifierType_Surface) {
// uiDefBut(block, LABEL, 1, "See Fields panel.", lx, (cy-=19), buttonWidth,19, NULL, 0.0, 0.0, 0, 0, "");
}
if (md->error) {

View File

@@ -455,7 +455,7 @@ static void rna_def_modifier_mirror(BlenderRNA *brna)
prop= RNA_def_property(srna, "clip", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_CLIPPING);
RNA_def_property_ui_text(prop, "clip", "Prevents vertices from going through the mirror during transform.");
RNA_def_property_ui_text(prop, "Clip", "Prevents vertices from going through the mirror during transform.");
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
prop= RNA_def_property(srna, "mirror_vertex_groups", PROP_BOOLEAN, PROP_NONE);
@@ -1159,7 +1159,7 @@ static void rna_def_modifier_meshdeform(BlenderRNA *brna)
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
prop= RNA_def_property(srna, "dynamic", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MDEF_INVERT_VGROUP);
RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MDEF_DYNAMIC_BIND);
RNA_def_property_ui_text(prop, "Dynamic", "Recompute binding dynamically on top of other deformers (slower and more memory consuming.)");
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");