Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-06-27 05:15:31 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-06-27 05:15:31 +0400
commit222fe6b1a5d49f67177cbb762f55a0e482145f5d (patch)
tree2ff249d49385233c34cddd473e457a76a17b90c8 /release
parentd839a9ae9ccbf17375e28cc92aa75a0cb4cf6b11 (diff)
UI
* Search popup + autocomplete for bones, vertex groups, etc. This is done with layout.item_pointerR, specifying an RNA collection to take the items from. Used by constraints and modifiers. * Some tests with the List template, ignore those for now..
Diffstat (limited to 'release')
-rw-r--r--release/ui/buttons_data_mesh.py12
-rw-r--r--release/ui/buttons_data_modifier.py169
-rw-r--r--release/ui/buttons_object_constraint.py11
-rw-r--r--release/ui/space_image.py12
-rw-r--r--release/ui/space_text.py2
5 files changed, 106 insertions, 100 deletions
diff --git a/release/ui/buttons_data_mesh.py b/release/ui/buttons_data_mesh.py
index 6f64de312ed..3360f4c47ad 100644
--- a/release/ui/buttons_data_mesh.py
+++ b/release/ui/buttons_data_mesh.py
@@ -74,6 +74,18 @@ class DATA_PT_materials(DataButtonsPanel):
row.itemO("OBJECT_OT_material_slot_select", text="Select");
row.itemO("OBJECT_OT_material_slot_deselect", text="Deselect");
+ layout.itemS()
+
+ box= layout.box()
+
+ row = box.row()
+ row.template_list(ob, "materials", "active_material_index", compact=True)
+
+ subrow = row.row(align=True)
+ subrow.itemO("OBJECT_OT_material_slot_add", icon="ICON_ZOOMIN", text="")
+ subrow.itemO("OBJECT_OT_material_slot_remove", icon="ICON_ZOOMOUT", text="")
+
+
bpy.types.register(DATA_PT_mesh)
bpy.types.register(DATA_PT_materials)
diff --git a/release/ui/buttons_data_modifier.py b/release/ui/buttons_data_modifier.py
index ecb0590f8e5..366f2b8a86b 100644
--- a/release/ui/buttons_data_modifier.py
+++ b/release/ui/buttons_data_modifier.py
@@ -23,68 +23,68 @@ class DATA_PT_modifiers(DataButtonsPanel):
if box:
if md.type == 'ARMATURE':
- self.armature(box, md)
+ self.armature(box, ob, md)
if md.type == 'ARRAY':
- self.array(box, md)
+ self.array(box, ob, md)
if md.type == 'BEVEL':
- self.bevel(box, md)
+ self.bevel(box, ob, md)
if md.type == 'BOOLEAN':
- self.boolean(box, md)
+ self.boolean(box, ob, md)
if md.type == 'BUILD':
- self.build(box, md)
+ self.build(box, ob, md)
if md.type == 'CAST':
- self.cast(box, md)
+ self.cast(box, ob, md)
if md.type == 'CLOTH':
- self.cloth(box, md)
+ self.cloth(box, ob, md)
if md.type == 'COLLISION':
- self.collision(box, md)
+ self.collision(box, ob, md)
if md.type == 'CURVE':
- self.curve(box, md)
+ self.curve(box, ob, md)
if md.type == 'DECIMATE':
- self.decimate(box, md)
+ self.decimate(box, ob, md)
if md.type == 'DISPLACE':
- self.displace(box, md)
+ self.displace(box, ob, md)
if md.type == 'EDGE_SPLIT':
- self.edgesplit(box, md)
+ self.edgesplit(box, ob, md)
if md.type == 'EXPLODE':
- self.explode(box, md)
+ self.explode(box, ob, md)
if md.type == 'FLUID_SIMULATION':
- self.fluid(box, md)
+ self.fluid(box, ob, md)
if md.type == 'HOOK':
- self.hook(box, md)
+ self.hook(box, ob, md)
if md.type == 'LATTICE':
- self.lattice(box, md)
+ self.lattice(box, ob, md)
if md.type == 'MASK':
- self.mask(box, md)
+ self.mask(box, ob, md)
if md.type == 'MESH_DEFORM':
- self.mesh_deform(box, md)
+ self.mesh_deform(box, ob, md)
if md.type == 'MIRROR':
- self.mirror(box, md)
+ self.mirror(box, ob, md)
if md.type == 'MULTIRES':
- self.multires(box, md)
+ self.multires(box, ob, md)
if md.type == 'PARTICLE_INSTANCE':
- self.particleinstance(box, md)
+ self.particleinstance(box, ob, md)
if md.type == 'PARTICLE_SYSTEM':
- self.particlesystem(box, md)
+ self.particlesystem(box, ob, md)
if md.type == 'SHRINKWRAP':
- self.shrinkwrap(box, md)
+ self.shrinkwrap(box, ob, md)
if md.type == 'SIMPLE_DEFORM':
- self.simpledeform(box, md)
+ self.simpledeform(box, ob, md)
if md.type == 'SMOOTH':
- self.smooth(box, md)
+ self.smooth(box, ob, md)
if md.type == 'SOFTBODY':
- self.softbody(box, md)
+ self.softbody(box, ob, md)
if md.type == 'SUBSURF':
- self.subsurf(box, md)
+ self.subsurf(box, ob, md)
if md.type == 'UV_PROJECT':
- self.uvproject(box, md)
+ self.uvproject(box, ob, md)
if md.type == 'WAVE':
- self.wave(box, md)
+ self.wave(box, ob, md)
- def armature(self, layout, md):
+ def armature(self, layout, ob, md):
layout.itemR(md, "object")
row = layout.row()
- row.itemR(md, "vertex_group")
+ row.item_pointerR(md, "vertex_group", ob, "vertex_groups")
row.itemR(md, "invert")
flow = layout.column_flow()
flow.itemR(md, "use_vertex_groups", text="Vertex Groups")
@@ -92,7 +92,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
flow.itemR(md, "quaternion")
flow.itemR(md, "multi_modifier")
- def array(self, layout, md):
+ def array(self, layout, ob, md):
layout.itemR(md, "fit_type")
if md.fit_type == 'FIXED_COUNT':
layout.itemR(md, "count")
@@ -141,7 +141,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.itemR(md, "start_cap")
col.itemR(md, "end_cap")
- def bevel(self, layout, md):
+ def bevel(self, layout, ob, md):
row = layout.row()
row.itemR(md, "width")
row.itemR(md, "only_vertices")
@@ -156,11 +156,11 @@ class DATA_PT_modifiers(DataButtonsPanel):
row = layout.row()
row.itemR(md, "edge_weight_method", expand=True)
- def boolean(self, layout, md):
+ def boolean(self, layout, ob, md):
layout.itemR(md, "operation")
layout.itemR(md, "object")
- def build(self, layout, md):
+ def build(self, layout, ob, md):
split = layout.split()
col = split.column()
@@ -175,7 +175,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
- def cast(self, layout, md):
+ def cast(self, layout, ob, md):
layout.itemR(md, "cast_type")
col = layout.column_flow()
col.itemR(md, "x")
@@ -184,26 +184,26 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.itemR(md, "factor")
col.itemR(md, "radius")
col.itemR(md, "size")
- layout.itemR(md, "vertex_group")
+ layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
#Missing: "OB" and "From Radius"
- def cloth(self, layout, md):
+ def cloth(self, layout, ob, md):
layout.itemL(text="See Cloth panel.")
- def collision(self, layout, md):
+ def collision(self, layout, ob, md):
layout.itemL(text="See Collision panel.")
- def curve(self, layout, md):
+ def curve(self, layout, ob, md):
layout.itemR(md, "object")
- layout.itemR(md, "vertex_group")
+ layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
layout.itemR(md, "deform_axis")
- def decimate(self, layout, md):
+ def decimate(self, layout, ob, md):
layout.itemR(md, "ratio")
layout.itemR(md, "face_count")
- def displace(self, layout, md):
- layout.itemR(md, "vertex_group")
+ def displace(self, layout, ob, md):
+ layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
layout.itemR(md, "texture")
layout.itemR(md, "midlevel")
layout.itemR(md, "strength")
@@ -211,10 +211,10 @@ class DATA_PT_modifiers(DataButtonsPanel):
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")
+ if md.texture_coordinates == 'UV' and ob.type == 'MESH':
+ layout.item_pointerR(md, "uv_layer", ob.data, "uv_layers")
- def edgesplit(self, layout, md):
+ def edgesplit(self, layout, ob, md):
split = layout.split()
col = split.column()
@@ -225,8 +225,8 @@ class DATA_PT_modifiers(DataButtonsPanel):
col = split.column()
col.itemR(md, "use_sharp", text="Sharp Edges")
- def explode(self, layout, md):
- layout.itemR(md, "vertex_group")
+ def explode(self, layout, ob, md):
+ layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
layout.itemR(md, "protect")
layout.itemR(md, "split_edges")
layout.itemR(md, "unborn")
@@ -234,31 +234,31 @@ class DATA_PT_modifiers(DataButtonsPanel):
layout.itemR(md, "dead")
# Missing: "Refresh" and "Clear Vertex Group" ?
- def fluid(self, layout, md):
+ def fluid(self, layout, ob, md):
layout.itemL(text="See Fluidsim panel.")
- def hook(self, layout, md):
+ def hook(self, layout, ob, md):
layout.itemR(md, "falloff")
layout.itemR(md, "force", slider=True)
layout.itemR(md, "object")
- layout.itemR(md, "vertex_group")
+ layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
# Missing: "Reset" and "Recenter"
- def lattice(self, layout, md):
+ def lattice(self, layout, ob, md):
layout.itemR(md, "object")
- layout.itemR(md, "vertex_group")
+ layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
- def mask(self, layout, md):
+ def mask(self, layout, ob, md):
layout.itemR(md, "mode")
if md.mode == 'ARMATURE':
layout.itemR(md, "armature")
if md.mode == 'VERTEX_GROUP':
- layout.itemR(md, "vertex_group")
+ layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
layout.itemR(md, "inverse")
- def mesh_deform(self, layout, md):
+ def mesh_deform(self, layout, ob, md):
layout.itemR(md, "object")
- layout.itemR(md, "vertex_group")
+ layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
layout.itemR(md, "invert")
layout.itemS()
@@ -267,7 +267,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
row.itemR(md, "precision")
row.itemR(md, "dynamic")
- def mirror(self, layout, md):
+ def mirror(self, layout, ob, md):
layout.itemR(md, "merge_limit")
split = layout.split()
@@ -285,12 +285,12 @@ class DATA_PT_modifiers(DataButtonsPanel):
layout.itemR(md, "mirror_object")
- def multires(self, layout, md):
+ def multires(self, layout, ob, md):
layout.itemR(md, "subdivision_type")
layout.itemO("OBJECT_OT_multires_subdivide", text="Subdivide")
layout.itemR(md, "level")
- def particleinstance(self, layout, md):
+ def particleinstance(self, layout, ob, md):
layout.itemR(md, "object")
layout.itemR(md, "particle_system_number")
@@ -302,12 +302,12 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.itemR(md, "alive")
col.itemR(md, "dead")
- def particlesystem(self, layout, md):
+ def particlesystem(self, layout, ob, md):
layout.itemL(text="See Particle panel.")
- def shrinkwrap(self, layout, md):
+ def shrinkwrap(self, layout, ob, md):
layout.itemR(md, "target")
- layout.itemR(md, "vertex_group")
+ layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
layout.itemR(md, "offset")
layout.itemR(md, "subsurf_levels")
layout.itemR(md, "mode")
@@ -329,9 +329,9 @@ class DATA_PT_modifiers(DataButtonsPanel):
layout.itemR(md, "keep_above_surface")
# To-Do: Validate if structs
- def simpledeform(self, layout, md):
+ def simpledeform(self, layout, ob, md):
layout.itemR(md, "mode")
- layout.itemR(md, "vertex_group")
+ layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
layout.itemR(md, "origin")
layout.itemR(md, "relative")
layout.itemR(md, "factor")
@@ -340,7 +340,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
layout.itemR(md, "lock_x_axis")
layout.itemR(md, "lock_y_axis")
- def smooth(self, layout, md):
+ def smooth(self, layout, ob, md):
split = layout.split()
sub = split.column()
sub.itemR(md, "x")
@@ -350,12 +350,12 @@ class DATA_PT_modifiers(DataButtonsPanel):
sub.itemR(md, "factor")
sub.itemR(md, "repeat")
- layout.itemR(md, "vertex_group")
+ layout.template_pointer(md, "vertex_group", ob, "vertex_groups")
- def softbody(self, layout, md):
+ def softbody(self, layout, ob, md):
layout.itemL(text="See Softbody panel.")
- def subsurf(self, layout, md):
+ def subsurf(self, layout, ob, md):
layout.itemR(md, "subdivision_type")
col = layout.column_flow()
col.itemR(md, "levels", text="Preview")
@@ -363,16 +363,17 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.itemR(md, "optimal_draw", text="Optimal Display")
col.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):
+ def uvproject(self, layout, ob, md):
+ if ob.type == 'MESH':
+ layout.item_pointerR(md, "uv_layer", ob.data, "uv_layers")
+ 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, ob, md):
split = layout.split()
sub = split.column()
@@ -398,11 +399,11 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.itemR(md, "start_position_y")
layout.itemR(md, "start_position_object")
- layout.itemR(md, "vertex_group")
+ layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
layout.itemR(md, "texture")
layout.itemR(md, "texture_coordinates")
- if md.texture_coordinates == 'MAP_UV':
- layout.itemR(md, "uv_layer")
+ if md.texture_coordinates == 'MAP_UV' and ob.type == 'MESH':
+ layout.item_pointerR(md, "uv_layer", ob.data, "uv_layers")
if md.texture_coordinates == 'OBJECT':
layout.itemR(md, "texture_coordinates_object")
@@ -412,4 +413,4 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.itemR(md, "width", slider=True)
col.itemR(md, "narrowness", slider=True)
-bpy.types.register(DATA_PT_modifiers) \ No newline at end of file
+bpy.types.register(DATA_PT_modifiers)
diff --git a/release/ui/buttons_object_constraint.py b/release/ui/buttons_object_constraint.py
index 52e43406790..3048bdaa399 100644
--- a/release/ui/buttons_object_constraint.py
+++ b/release/ui/buttons_object_constraint.py
@@ -77,13 +77,14 @@ class ConstraintButtonsPanel(bpy.types.Panel):
if con.target and subtargets:
if con.target.type == "ARMATURE":
- layout.itemR(con, "subtarget", text="Bone") # XXX autocomplete
+ layout.item_pointerR(con, "subtarget", con.target.data, "bones", text="Bone")
- row = layout.row()
- row.itemL(text="Head/Tail:")
- row.itemR(con, "head_tail", text="")
+ if con.type == 'COPY_LOCATION':
+ row = layout.row()
+ row.itemL(text="Head/Tail:")
+ row.itemR(con, "head_tail", text="")
elif con.target.type in ("MESH", "LATTICE"):
- layout.itemR(con, "subtarget", text="Vertex Group") # XXX autocomplete
+ layout.item_pointerR(con, "subtarget", con.target, "vertex_groups", text="Vertex Group")
def child_of(self, layout, con):
self.target_template(layout, con)
diff --git a/release/ui/space_image.py b/release/ui/space_image.py
index e49172fd3f1..63ca316efe7 100644
--- a/release/ui/space_image.py
+++ b/release/ui/space_image.py
@@ -273,16 +273,8 @@ class IMAGE_HT_header(bpy.types.Header):
row.itemR(settings, "snap_mode", text="")
"""
- /* uv layers */
- {
- Object *obedit= CTX_data_edit_object(C);
- char menustr[34*MAX_MTFACE];
- static int act;
-
- image_menu_uvlayers(obedit, menustr, &act);
-
- but = uiDefButI(block, MENU, B_NOP, menustr ,xco,yco,85,YIC, &act, 0, 0, 0, 0, "Active UV Layer for editing.");
- // uiButSetFunc(but, do_image_buttons_set_uvlayer_callback, &act, NULL);
+ mesh = context.edit_object.data
+ row.item_pointerR(mesh, "active_uv_layer", mesh, "uv_layers")
"""
if ima:
diff --git a/release/ui/space_text.py b/release/ui/space_text.py
index 19a495d375e..07e43f32054 100644
--- a/release/ui/space_text.py
+++ b/release/ui/space_text.py
@@ -29,7 +29,7 @@ class TEXT_HT_header(bpy.types.Header):
row.itemR(st, "word_wrap", text="")
row.itemR(st, "syntax_highlight", text="")
- layout.template_ID(st, "text", new="TEXT_OT_new", open="TEXT_OT_open", unlink="TEXT_OT_unlink")
+ layout.template_ID(st, "text", new="TEXT_OT_new", unlink="TEXT_OT_unlink")
if text:
row = layout.row()