diff options
62 files changed, 1827 insertions, 727 deletions
diff --git a/release/ui/buttons_data_modifier.py b/release/ui/buttons_data_modifier.py index af0a8582174..42def1ee764 100644 --- a/release/ui/buttons_data_modifier.py +++ b/release/ui/buttons_data_modifier.py @@ -24,61 +24,63 @@ class DATA_PT_modifiers(DataButtonsPanel): if md.expanded: if md.type == 'ARMATURE': self.armature(box, ob, md) - if md.type == 'ARRAY': + elif md.type == 'ARRAY': self.array(box, ob, md) - if md.type == 'BEVEL': + elif md.type == 'BEVEL': self.bevel(box, ob, md) - if md.type == 'BOOLEAN': + elif md.type == 'BOOLEAN': self.boolean(box, ob, md) - if md.type == 'BUILD': + elif md.type == 'BUILD': self.build(box, ob, md) - if md.type == 'CAST': + elif md.type == 'CAST': self.cast(box, ob, md) - if md.type == 'CLOTH': + elif md.type == 'CLOTH': self.cloth(box, ob, md) - if md.type == 'COLLISION': + elif md.type == 'COLLISION': self.collision(box, ob, md) - if md.type == 'CURVE': + elif md.type == 'CURVE': self.curve(box, ob, md) - if md.type == 'DECIMATE': + elif md.type == 'DECIMATE': self.decimate(box, ob, md) - if md.type == 'DISPLACE': + elif md.type == 'DISPLACE': self.displace(box, ob, md) - if md.type == 'EDGE_SPLIT': + elif md.type == 'EDGE_SPLIT': self.edgesplit(box, ob, md) - if md.type == 'EXPLODE': + elif md.type == 'EXPLODE': self.explode(box, ob, md) - if md.type == 'FLUID_SIMULATION': + elif md.type == 'FLUID_SIMULATION': self.fluid(box, ob, md) - if md.type == 'HOOK': + elif md.type == 'HOOK': self.hook(box, ob, md) - if md.type == 'LATTICE': + elif md.type == 'LATTICE': self.lattice(box, ob, md) - if md.type == 'MASK': + elif md.type == 'MASK': self.mask(box, ob, md) - if md.type == 'MESH_DEFORM': + elif md.type == 'MESH_DEFORM': self.mesh_deform(box, ob, md) - if md.type == 'MIRROR': + elif md.type == 'MIRROR': self.mirror(box, ob, md) - if md.type == 'MULTIRES': + elif md.type == 'MULTIRES': self.multires(box, ob, md) - if md.type == 'PARTICLE_INSTANCE': + elif md.type == 'PARTICLE_INSTANCE': self.particleinstance(box, ob, md) - if md.type == 'PARTICLE_SYSTEM': + elif md.type == 'PARTICLE_SYSTEM': self.particlesystem(box, ob, md) - if md.type == 'SHRINKWRAP': + elif md.type == 'SHRINKWRAP': self.shrinkwrap(box, ob, md) - if md.type == 'SIMPLE_DEFORM': + elif md.type == 'SIMPLE_DEFORM': self.simpledeform(box, ob, md) - if md.type == 'SMOOTH': + elif md.type == 'SMOOTH': self.smooth(box, ob, md) - if md.type == 'SOFTBODY': + elif md.type == 'SOFTBODY': self.softbody(box, ob, md) - if md.type == 'SUBSURF': + elif md.type == 'SUBSURF': self.subsurf(box, ob, md) - if md.type == 'UV_PROJECT': + elif md.type == 'SURFACE': + self.surface(box, ob, md) + elif md.type == 'UV_PROJECT': self.uvproject(box, ob, md) - if md.type == 'WAVE': + elif md.type == 'WAVE': self.wave(box, ob, md) def armature(self, layout, ob, md): @@ -96,9 +98,9 @@ class DATA_PT_modifiers(DataButtonsPanel): layout.itemR(md, "fit_type") if md.fit_type == 'FIXED_COUNT': layout.itemR(md, "count") - if md.fit_type == 'FIT_LENGTH': + elif md.fit_type == 'FIT_LENGTH': layout.itemR(md, "length") - if md.fit_type == 'FIT_CURVE': + elif md.fit_type == 'FIT_CURVE': layout.itemR(md, "curve") layout.itemS() @@ -152,7 +154,7 @@ class DATA_PT_modifiers(DataButtonsPanel): if md.limit_method == 'ANGLE': row = layout.row() row.itemR(md, "angle") - if md.limit_method == 'WEIGHT': + elif md.limit_method == 'WEIGHT': row = layout.row() row.itemR(md, "edge_weight_method", expand=True) @@ -211,7 +213,7 @@ 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' and ob.type == 'MESH': + elif md.texture_coordinates == 'UV' and ob.type == 'MESH': layout.item_pointerR(md, "uv_layer", ob.data, "uv_layers") def edgesplit(self, layout, ob, md): @@ -235,7 +237,7 @@ class DATA_PT_modifiers(DataButtonsPanel): # Missing: "Refresh" and "Clear Vertex Group" ? def fluid(self, layout, ob, md): - layout.itemL(text="See Fluidsim panel.") + layout.itemL(text="See Fluid panel.") def hook(self, layout, ob, md): layout.itemR(md, "falloff") @@ -252,7 +254,7 @@ class DATA_PT_modifiers(DataButtonsPanel): layout.itemR(md, "mode") if md.mode == 'ARMATURE': layout.itemR(md, "armature") - if md.mode == 'VERTEX_GROUP': + elif md.mode == 'VERTEX_GROUP': layout.item_pointerR(md, "vertex_group", ob, "vertex_groups") layout.itemR(md, "inverse") @@ -325,7 +327,7 @@ class DATA_PT_modifiers(DataButtonsPanel): col.itemR(md, "positive") col.itemR(md, "cull_front_faces") col.itemR(md, "cull_back_faces") - if md.mode == 'NEAREST_SURFACEPOINT': + elif md.mode == 'NEAREST_SURFACEPOINT': layout.itemR(md, "keep_above_surface") # To-Do: Validate if structs @@ -353,7 +355,7 @@ class DATA_PT_modifiers(DataButtonsPanel): layout.item_pointerR(md, "vertex_group", ob, "vertex_groups") def softbody(self, layout, ob, md): - layout.itemL(text="See Softbody panel.") + layout.itemL(text="See Soft Body panel.") def subsurf(self, layout, ob, md): layout.itemR(md, "subdivision_type") @@ -362,6 +364,9 @@ class DATA_PT_modifiers(DataButtonsPanel): col.itemR(md, "render_levels", text="Render") col.itemR(md, "optimal_draw", text="Optimal Display") col.itemR(md, "subsurf_uv") + + def surface(self, layout, ob, md): + layout.itemL(text="See Fields panel.") def uvproject(self, layout, ob, md): if ob.type == 'MESH': @@ -404,7 +409,7 @@ class DATA_PT_modifiers(DataButtonsPanel): layout.itemR(md, "texture_coordinates") 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': + elif md.texture_coordinates == 'OBJECT': layout.itemR(md, "texture_coordinates_object") col = layout.column_flow() diff --git a/release/ui/buttons_physic_cloth.py b/release/ui/buttons_physic_cloth.py index a06c644322a..ecb5e48569a 100644 --- a/release/ui/buttons_physic_cloth.py +++ b/release/ui/buttons_physic_cloth.py @@ -7,48 +7,73 @@ class PhysicButtonsPanel(bpy.types.Panel): __context__ = "physics" def poll(self, context): - return (context.cloth != None) + return (context.object != None) -class Physic_PT_cloth(PhysicButtonsPanel): - __idname__ = "Physic_PT_cloth" +class PHYSICS_PT_cloth(PhysicButtonsPanel): + __idname__ = "PHYSICS_PT_cloth" __label__ = "Cloth" def draw(self, context): layout = self.layout - cloth = context.cloth.settings - + md = context.cloth + ob = context.object + split = layout.split() - - col = split.column() - col.itemR(cloth, "quality", slider=True) - col.itemR(cloth, "gravity") - col.itemR(cloth, "mass") - col.itemR(cloth, "mass_vertex_group", text="Vertex Group") - - col = split.column() - col.itemL(text="Stiffness:") - col.itemR(cloth, "structural_stiffness", text="Structural") - col.itemR(cloth, "bending_stiffness", text="Bending") - col.itemL(text="Damping:") - col.itemR(cloth, "spring_damping", text="Spring") - col.itemR(cloth, "air_damping", text="Air") - - # Disabled for now - """ - if cloth.mass_vertex_group: - layout.itemL(text="Goal:") - - col = layout.column_flow() - col.itemR(cloth, "goal_default", text="Default") - col.itemR(cloth, "goal_spring", text="Stiffness") - col.itemR(cloth, "goal_friction", text="Friction") - """ + split.operator_context = "EXEC_DEFAULT" + + if md: + # remove modifier + settings + split.set_context_pointer("modifier", md) + split.itemO("OBJECT_OT_modifier_remove", text="Remove") + + row = split.row(align=True) + row.itemR(md, "render", text="") + row.itemR(md, "realtime", text="") + else: + # add modifier + split.item_enumO("OBJECT_OT_modifier_add", "type", "CLOTH", text="Add") + split.itemL() + + if md: + cloth = md.settings + + split = layout.split() + + col = split.column() + col.itemR(cloth, "quality", slider=True) + col.itemR(cloth, "gravity") + + subcol = col.column(align=True) + subcol.itemR(cloth, "mass") + subcol.item_pointerR(cloth, "mass_vertex_group", ob, "vertex_groups", text="") + + col = split.column() + col.itemL(text="Stiffness:") + col.itemR(cloth, "structural_stiffness", text="Structural") + col.itemR(cloth, "bending_stiffness", text="Bending") + col.itemL(text="Damping:") + col.itemR(cloth, "spring_damping", text="Spring") + col.itemR(cloth, "air_damping", text="Air") + + # Disabled for now + """ + if cloth.mass_vertex_group: + layout.itemL(text="Goal:") + + col = layout.column_flow() + col.itemR(cloth, "goal_default", text="Default") + col.itemR(cloth, "goal_spring", text="Stiffness") + col.itemR(cloth, "goal_friction", text="Friction") + """ class PHYSICS_PT_cloth_cache(PhysicButtonsPanel): __idname__= "PHYSICS_PT_cloth_cache" - __label__ = "Cache" + __label__ = "Cloth Cache" __default_closed__ = True + def poll(self, context): + return (context.cloth != None) + def draw(self, context): layout = self.layout @@ -91,9 +116,12 @@ class PHYSICS_PT_cloth_cache(PhysicButtonsPanel): row.itemO("PTCACHE_OT_free_bake_all", text="Free All Bakes") layout.itemO("PTCACHE_OT_bake_all", text="Update All Dynamics to current frame") -class Physic_PT_cloth_collision(PhysicButtonsPanel): - __idname__ = "Physic_PT_clothcollision" +class PHYSICS_PT_cloth_collision(PhysicButtonsPanel): + __idname__ = "PHYSICS_PT_clothcollision" __label__ = "Cloth Collision" + + def poll(self, context): + return (context.cloth != None) def draw_header(self, context): layout = self.layout @@ -120,9 +148,12 @@ class Physic_PT_cloth_collision(PhysicButtonsPanel): col.itemR(cloth, "self_collision_quality", slider=True) col.itemR(cloth, "self_min_distance", text="MinDistance") -class Physic_PT_cloth_stiffness(PhysicButtonsPanel): - __idname__ = "Physic_PT_stiffness" +class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel): + __idname__ = "PHYSICS_PT_stiffness" __label__ = "Cloth Stiffness Scaling" + + def poll(self, context): + return (context.cloth != None) def draw_header(self, context): layout = self.layout @@ -132,23 +163,25 @@ class Physic_PT_cloth_stiffness(PhysicButtonsPanel): def draw(self, context): layout = self.layout + ob = context.object cloth = context.cloth.settings layout.active = cloth.stiffness_scaling split = layout.split() - sub = split.column() + sub = split.column(align=True) sub.itemL(text="Structural Stiffness:") - sub.column().itemR(cloth, "structural_stiffness_vertex_group", text="VGroup") + sub.item_pointerR(cloth, "structural_stiffness_vertex_group", ob, "vertex_groups", text="") sub.itemR(cloth, "structural_stiffness_max", text="Max") - sub = split.column() + sub = split.column(align=True) sub.itemL(text="Bending Stiffness:") - sub.column().itemR(cloth, "bending_vertex_group", text="VGroup") + sub.item_pointerR(cloth, "bending_vertex_group", ob, "vertex_groups", text="") sub.itemR(cloth, "bending_stiffness_max", text="Max") -bpy.types.register(Physic_PT_cloth) +bpy.types.register(PHYSICS_PT_cloth) bpy.types.register(PHYSICS_PT_cloth_cache) -bpy.types.register(Physic_PT_cloth_collision) -bpy.types.register(Physic_PT_cloth_stiffness) +bpy.types.register(PHYSICS_PT_cloth_collision) +bpy.types.register(PHYSICS_PT_cloth_stiffness) + diff --git a/release/ui/buttons_physics_field.py b/release/ui/buttons_physics_field.py new file mode 100644 index 00000000000..3204ab4709d --- /dev/null +++ b/release/ui/buttons_physics_field.py @@ -0,0 +1,48 @@ + +import bpy + +class PhysicButtonsPanel(bpy.types.Panel): + __space_type__ = "BUTTONS_WINDOW" + __region_type__ = "WINDOW" + __context__ = "physics" + + def poll(self, context): + return (context.object != None) + +class PHYSICS_PT_field(PhysicButtonsPanel): + __idname__ = "PHYSICS_PT_field" + __label__ = "Field" + + def draw(self, context): + layout = self.layout + ob = context.object + field = ob.field + + layout.itemR(field, "type") + + if field.type != "NONE": + layout.itemR(field, "strength") + + if field.type in ("HARMONIC", "SPHERICAL", "CHARGE", "LENNARDj"): + if ob.type in ("MESH", "SURFACE", "FONT", "CURVE"): + layout.itemR(field, "surface") + +class PHYSICS_PT_collision(PhysicButtonsPanel): + __idname__ = "PHYSICS_PT_collision" + __label__ = "Collision" + + def draw_header(self, context): + settings = context.object.collision + self.layout.itemR(settings, "enabled", text="") + + def draw(self, context): + layout = self.layout + md = context.collision + settings = context.object.collision + + if settings.enabled: + pass + +bpy.types.register(PHYSICS_PT_field) +bpy.types.register(PHYSICS_PT_collision) + diff --git a/release/ui/buttons_physics_fluid.py b/release/ui/buttons_physics_fluid.py new file mode 100644 index 00000000000..57e3d910f30 --- /dev/null +++ b/release/ui/buttons_physics_fluid.py @@ -0,0 +1,62 @@ + +import bpy + +class PhysicButtonsPanel(bpy.types.Panel): + __space_type__ = "BUTTONS_WINDOW" + __region_type__ = "WINDOW" + __context__ = "physics" + + def poll(self, context): + ob = context.object + return (ob and ob.type == 'MESH') + +class PHYSICS_PT_fluid(PhysicButtonsPanel): + __idname__ = "PHYSICS_PT_fluid" + __label__ = "Fluid" + + def draw(self, context): + layout = self.layout + md = context.fluid + ob = context.object + + split = layout.split() + split.operator_context = "EXEC_DEFAULT" + + if md: + # remove modifier + settings + split.set_context_pointer("modifier", md) + split.itemO("OBJECT_OT_modifier_remove", text="Remove") + + row = split.row(align=True) + row.itemR(md, "render", text="") + row.itemR(md, "realtime", text="") + else: + # add modifier + split.item_enumO("OBJECT_OT_modifier_add", "type", "FLUID_SIMULATION", text="Add") + split.itemL() + + if md: + fluid = md.settings + + col = layout.column(align=True) + row = col.row() + row.item_enumR(fluid, "type", "DOMAIN") + row.item_enumR(fluid, "type", "FLUID") + row.item_enumR(fluid, "type", "OBSTACLE") + row = col.row() + row.item_enumR(fluid, "type", "INFLOW") + row.item_enumR(fluid, "type", "OUTFLOW") + row.item_enumR(fluid, "type", "PARTICLE") + row.item_enumR(fluid, "type", "CONTROL") + + if fluid.type == "DOMAIN": + layout.itemO("FLUID_OT_bake", text="BAKE") + + col = layout.column(align=True) + + col.itemL(text="Req. Mem.: " + fluid.memory_estimate) + col.itemR(fluid, "resolution") + col.itemR(fluid, "preview_resolution") + +bpy.types.register(PHYSICS_PT_fluid) + diff --git a/release/ui/buttons_physics_softbody.py b/release/ui/buttons_physics_softbody.py new file mode 100644 index 00000000000..389d91bafa7 --- /dev/null +++ b/release/ui/buttons_physics_softbody.py @@ -0,0 +1,43 @@ + +import bpy + +class PhysicButtonsPanel(bpy.types.Panel): + __space_type__ = "BUTTONS_WINDOW" + __region_type__ = "WINDOW" + __context__ = "physics" + + def poll(self, context): + return (context.object != None) + +class PHYSICS_PT_softbody(PhysicButtonsPanel): + __idname__ = "PHYSICS_PT_softbody" + __label__ = "Soft Body" + + def draw(self, context): + layout = self.layout + md = context.soft_body + ob = context.object + + split = layout.split() + split.operator_context = "EXEC_DEFAULT" + + if md: + # remove modifier + settings + split.set_context_pointer("modifier", md) + split.itemO("OBJECT_OT_modifier_remove", text="Remove") + + row = split.row(align=True) + row.itemR(md, "render", text="") + row.itemR(md, "realtime", text="") + else: + # add modifier + split.item_enumO("OBJECT_OT_modifier_add", "type", "SOFTBODY", text="Add") + split.itemL() + + if md: + softbody = md.settings + + split = layout.split() + +bpy.types.register(PHYSICS_PT_softbody) + diff --git a/release/ui/space_view3d_toolbar.py b/release/ui/space_view3d_toolbar.py new file mode 100644 index 00000000000..a866b219b9d --- /dev/null +++ b/release/ui/space_view3d_toolbar.py @@ -0,0 +1,254 @@ + +import bpy + +# ********** default tools for objectmode **************** + +class View3DPanel(bpy.types.Panel): + __space_type__ = "VIEW_3D" + __region_type__ = "TOOLS" + __context__ = "objectmode" + +class VIEW3D_PT_tools_objectmode(View3DPanel): + __idname__ = "VIEW3D_PT_tools_objectmode" + __label__ = "Object Tools" + + def draw(self, context): + layout = self.layout + + layout.row().itemO("OBJECT_OT_duplicate_add") + layout.row().itemO("OBJECT_OT_delete") + layout.row().itemO("OBJECT_OT_mesh_add") + layout.row().itemO("OBJECT_OT_curve_add") + layout.row().itemO("OBJECT_OT_text_add") + layout.row().itemO("OBJECT_OT_surface_add") + +# ********** default tools for editmode_mesh **************** + +class View3DPanel(bpy.types.Panel): + __space_type__ = "VIEW_3D" + __region_type__ = "TOOLS" + __context__ = "editmode_mesh" + +class VIEW3D_PT_tools_editmode_mesh(View3DPanel): + __idname__ = "VIEW3D_PT_tools_editmode_mesh" + __label__ = "Mesh Tools" + + def draw(self, context): + layout = self.layout + + layout.row().itemO("MESH_OT_duplicate_add") + layout.row().itemO("MESH_OT_delete") + layout.row().itemO("MESH_OT_spin") + layout.row().itemO("MESH_OT_screw") + layout.row().itemO("MESH_OT_primitive_plane_add") + layout.row().itemO("MESH_OT_primitive_cube_add") + layout.row().itemO("MESH_OT_primitive_circle_add") + layout.row().itemO("MESH_OT_primitive_cylinder_add") + +# ********** default tools for editmode_curve **************** + +class View3DPanel(bpy.types.Panel): + __space_type__ = "VIEW_3D" + __region_type__ = "TOOLS" + __context__ = "editmode_curve" + +class VIEW3D_PT_tools_editmode_curve(View3DPanel): + __idname__ = "VIEW3D_PT_tools_editmode_curve" + __label__ = "Curve Tools" + + def draw(self, context): + layout = self.layout + + layout.row().itemO("CURVE_OT_duplicate") + layout.row().itemO("CURVE_OT_delete") + layout.row().itemO("OBJECT_OT_curve_add") + layout.row().itemO("CURVE_OT_subdivide") + +# ********** default tools for editmode_surface **************** + +class View3DPanel(bpy.types.Panel): + __space_type__ = "VIEW_3D" + __region_type__ = "TOOLS" + __context__ = "editmode_surface" + +class VIEW3D_PT_tools_editmode_surface(View3DPanel): + __idname__ = "VIEW3D_PT_tools_editmode_surface" + __label__ = "Surface Tools" + + def draw(self, context): + layout = self.layout + + layout.row().itemO("CURVE_OT_duplicate") + layout.row().itemO("CURVE_OT_delete") + layout.row().itemO("OBJECT_OT_surface_add") + layout.row().itemO("CURVE_OT_subdivide") + +# ********** default tools for editmode_text **************** + +class View3DPanel(bpy.types.Panel): + __space_type__ = "VIEW_3D" + __region_type__ = "TOOLS" + __context__ = "editmode_text" + +class VIEW3D_PT_tools_editmode_text(View3DPanel): + __idname__ = "VIEW3D_PT_tools_editmode_text" + __label__ = "Text Tools" + + def draw(self, context): + layout = self.layout + + layout.row().itemO("FONT_OT_text_copy") + layout.row().itemO("FONT_OT_text_paste") + layout.row().itemO("FONT_OT_case_set") + layout.row().itemO("FONT_OT_style_toggle") + +# ********** default tools for editmode_armature **************** + +class View3DPanel(bpy.types.Panel): + __space_type__ = "VIEW_3D" + __region_type__ = "TOOLS" + __context__ = "editmode_armature" + +class VIEW3D_PT_tools_editmode_armature(View3DPanel): + __idname__ = "VIEW3D_PT_tools_editmode_armature" + __label__ = "Armature Tools" + + def draw(self, context): + layout = self.layout + + layout.row().itemO("ARMATURE_OT_duplicate_selected") + layout.row().itemO("ARMATURE_OT_bone_primitive_add") + layout.row().itemO("ARMATURE_OT_delete") + layout.row().itemO("ARMATURE_OT_parent_clear") + +# ********** default tools for editmode_mball **************** + +class View3DPanel(bpy.types.Panel): + __space_type__ = "VIEW_3D" + __region_type__ = "TOOLS" + __context__ = "editmode_mball" + +class VIEW3D_PT_tools_editmode_mball(View3DPanel): + __idname__ = "VIEW3D_PT_tools_editmode_mball" + __label__ = "Meta Tools" + + def draw(self, context): + layout = self.layout + + row = layout.row() + +# ********** default tools for editmode_lattice **************** + +class View3DPanel(bpy.types.Panel): + __space_type__ = "VIEW_3D" + __region_type__ = "TOOLS" + __context__ = "editmode_lattice" + +class VIEW3D_PT_tools_editmode_lattice(View3DPanel): + __idname__ = "VIEW3D_PT_tools_editmode_lattice" + __label__ = "Lattice Tools" + + def draw(self, context): + layout = self.layout + + row = layout.row() + +# ********** default tools for posemode **************** + +class View3DPanel(bpy.types.Panel): + __space_type__ = "VIEW_3D" + __region_type__ = "TOOLS" + __context__ = "posemode" + +class VIEW3D_PT_tools_posemode(View3DPanel): + __idname__ = "VIEW3D_PT_tools_posemode" + __label__ = "Pose Tools" + + def draw(self, context): + layout = self.layout + + layout.row().itemO("POSE_OT_hide") + layout.row().itemO("POSE_OT_reveal") + layout.row().itemO("POSE_OT_rot_clear") + layout.row().itemO("POSE_OT_loc_clear") + +# ********** default tools for sculptmode **************** + +class View3DPanel(bpy.types.Panel): + __space_type__ = "VIEW_3D" + __region_type__ = "TOOLS" + __context__ = "sculptmode" + +class VIEW3D_PT_tools_sculptmode(View3DPanel): + __idname__ = "VIEW3D_PT_tools_sculptmode" + __label__ = "Sculpt Tools" + + def draw(self, context): + layout = self.layout + + layout.row().itemO("SCULPT_OT_radial_control") + +# ********** default tools for weightpaint **************** + +class View3DPanel(bpy.types.Panel): + __space_type__ = "VIEW_3D" + __region_type__ = "TOOLS" + __context__ = "weightpaint" + +class VIEW3D_PT_tools_weightpaint(View3DPanel): + __idname__ = "VIEW3D_PT_tools_weightpaint" + __label__ = "Weight Paint Tools" + + def draw(self, context): + layout = self.layout + + layout.row().itemO("PAINT_OT_weight_paint_radial_control") + +# ********** default tools for vertexpaint **************** + +class View3DPanel(bpy.types.Panel): + __space_type__ = "VIEW_3D" + __region_type__ = "TOOLS" + __context__ = "vertexpaint" + +class VIEW3D_PT_tools_vertexpaint(View3DPanel): + __idname__ = "VIEW3D_PT_tools_vertexpaint" + __label__ = "Vertex Paint Tools" + + def draw(self, context): + layout = self.layout + + layout.row().itemO("PAINT_OT_vertex_paint_radial_control") + +# ********** default tools for texturepaint **************** + +class View3DPanel(bpy.types.Panel): + __space_type__ = "VIEW_3D" + __region_type__ = "TOOLS" + __context__ = "texturepaint" + +class VIEW3D_PT_tools_texturepaint(View3DPanel): + __idname__ = "VIEW3D_PT_tools_texturepaint" + __label__ = "Texture Paint Tools" + + def draw(self, context): + layout = self.layout + + layout.row().itemO("PAINT_OT_texture_paint_radial_control") + + +bpy.types.register(VIEW3D_PT_tools_objectmode) +bpy.types.register(VIEW3D_PT_tools_editmode_mesh) +bpy.types.register(VIEW3D_PT_tools_editmode_curve) +bpy.types.register(VIEW3D_PT_tools_editmode_surface) +bpy.types.register(VIEW3D_PT_tools_editmode_text) +bpy.types.register(VIEW3D_PT_tools_editmode_armature) +bpy.types.register(VIEW3D_PT_tools_editmode_mball) +bpy.types.register(VIEW3D_PT_tools_editmode_lattice) +bpy.types.register(VIEW3D_PT_tools_posemode) +bpy.types.register(VIEW3D_PT_tools_sculptmode) +bpy.types.register(VIEW3D_PT_tools_weightpaint) +bpy.types.register(VIEW3D_PT_tools_vertexpaint) +bpy.types.register(VIEW3D_PT_tools_texturepaint) + + diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h index 2ee31a17fa6..c373fde5693 100644 --- a/source/blender/blenfont/BLF_api.h +++ b/source/blender/blenfont/BLF_api.h @@ -79,6 +79,11 @@ float BLF_width_default(char *str); float BLF_height_default(char *str); /* + * set rotation for default font + */ +void BLF_default_rotation(float angle); + +/* * By default, rotation and clipping are disable and * have to be enable/disable using BLF_enable/disable. */ diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index 9dad5a4bfa0..a7e599fabf9 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -321,6 +321,19 @@ void BLF_draw_default(float x, float y, float z, char *str) } } +void BLF_default_rotation(float angle) +{ + + if (global_font_default>=0) { + global_font[global_font_default]->angle= angle; + if(angle) + global_font[global_font_default]->flags |= BLF_ROTATION; + else + global_font[global_font_default]->flags &= ~BLF_ROTATION; + } +} + + void BLF_draw(char *str) { FontBLF *font; diff --git a/source/blender/blenkernel/BKE_effect.h b/source/blender/blenkernel/BKE_effect.h index fd065978800..e21e83bf5cf 100644 --- a/source/blender/blenkernel/BKE_effect.h +++ b/source/blender/blenkernel/BKE_effect.h @@ -41,6 +41,8 @@ struct Particle; struct Group; struct RNG; +struct PartDeflect *object_add_collision_fields(void); + typedef struct pEffectorCache { struct pEffectorCache *next, *prev; Object *ob; diff --git a/source/blender/blenkernel/BKE_fluidsim.h b/source/blender/blenkernel/BKE_fluidsim.h index 93358fcf7e8..145ae48e732 100644 --- a/source/blender/blenkernel/BKE_fluidsim.h +++ b/source/blender/blenkernel/BKE_fluidsim.h @@ -1,6 +1,5 @@ /** - * BKE_fluidsim.h - * + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -28,29 +27,40 @@ * ***** END GPL LICENSE BLOCK ***** */ -#include "DNA_modifier_types.h" -#include "DNA_object_fluidsim.h" // N_T -#include "DNA_object_types.h" +#ifndef BKE_FLUIDSIM_H +#define BKE_FLUIDSIM_H -#include "BKE_DerivedMesh.h" +struct Object; +struct Scene; +struct FluidsimModifierData; +struct DerivedMesh; +struct MVert; /* old interface */ -FluidsimSettings *fluidsimSettingsNew(Object *srcob); - -void initElbeemMesh(Scene *scene, Object *ob, int *numVertices, float **vertices, int *numTriangles, int **triangles, int useGlobalCoords, int modifierIndex); +struct FluidsimSettings *fluidsimSettingsNew(struct Object *srcob); +void initElbeemMesh(struct Scene *scene, struct Object *ob, + int *numVertices, float **vertices, + int *numTriangles, int **triangles, + int useGlobalCoords, int modifierIndex); /* new fluid-modifier interface */ -void fluidsim_init(FluidsimModifierData *fluidmd); -void fluidsim_free(FluidsimModifierData *fluidmd); +void fluidsim_init(struct FluidsimModifierData *fluidmd); +void fluidsim_free(struct FluidsimModifierData *fluidmd); -DerivedMesh *fluidsim_read_cache(Object *ob, DerivedMesh *orgdm, FluidsimModifierData *fluidmd, int framenr, int useRenderParams); -void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh *dm, char *filename); -DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene, Object *ob, DerivedMesh *dm, int useRenderParams, int isFinalCalc); +struct DerivedMesh *fluidsim_read_cache(struct Object *ob, struct DerivedMesh *orgdm, + struct FluidsimModifierData *fluidmd, int framenr, int useRenderParams); +void fluidsim_read_vel_cache(struct FluidsimModifierData *fluidmd, struct DerivedMesh *dm, + char *filename); +struct DerivedMesh *fluidsimModifier_do(struct FluidsimModifierData *fluidmd, + struct Scene *scene, struct Object *ob, struct DerivedMesh *dm, + int useRenderParams, int isFinalCalc); -// get bounding box of mesh -void fluid_get_bb(MVert *mvert, int totvert, float obmat[][4], - /*RET*/ float start[3], /*RET*/ float size[3] ); +/* bounding box & memory estimate */ +void fluid_get_bb(struct MVert *mvert, int totvert, float obmat[][4], + float start[3], float size[3]); +void fluid_estimate_memory(struct Object *ob, struct FluidsimSettings *fss, char *value); +#endif diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index 4065cbb7007..144ed3bc624 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -62,7 +62,7 @@ typedef enum { * used for particles modifier that doesn't actually modify the object * unless it's a mesh and can be exploded -> curve can also emit particles */ - eModifierTypeType_DeformOrConstruct + eModifierTypeType_DeformOrConstruct, } ModifierTypeType; typedef enum { @@ -87,6 +87,9 @@ typedef enum { /* For modifiers that support pointcache, so we can check to see if it has files we need to deal with */ eModifierTypeFlag_UsesPointCache = (1<<6), + + /* For physics modifiers, max one per type */ + eModifierTypeFlag_Single = (1<<7) } ModifierTypeFlag; typedef void (*ObjectWalkFunc)(void *userData, struct Object *ob, struct Object **obpoin); diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h index 750f4fba7e6..be625fb856a 100644 --- a/source/blender/blenkernel/BKE_screen.h +++ b/source/blender/blenkernel/BKE_screen.h @@ -91,6 +91,9 @@ typedef struct SpaceType { /* region type definitions */ ListBase regiontypes; + /* tool shelf definitions */ + ListBase toolshelf; + /* read and write... */ /* default keymaps to add */ @@ -139,7 +142,7 @@ typedef struct ARegionType { /* menu type definitions */ ListBase menutypes; - + /* hardcoded constraints, smaller than these values region is not visible */ int minsizex, minsizey; /* default keymaps to add */ diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index fbad585d9b7..4a68d90a4ed 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -378,7 +378,7 @@ PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, Stru { PointerRNA ptr = CTX_data_pointer_get(C, member); - if(ptr.data && ptr.type == type) + if(ptr.data && RNA_struct_is_a(ptr.type, type)) return ptr; return PointerRNA_NULL; diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index eaa2d541638..553fdfe530e 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -56,6 +56,8 @@ #include "BLI_jitter.h" #include "BLI_rand.h" +#include "PIL_time.h" + #include "BKE_action.h" #include "BKE_anim.h" /* needed for where_on_path */ #include "BKE_armature.h" @@ -93,6 +95,20 @@ //XXX #include "BIF_screen.h" +PartDeflect *object_add_collision_fields(void) +{ + PartDeflect *pd; + + pd= MEM_callocN(sizeof(PartDeflect), "PartDeflect"); + + pd->pdef_sbdamp = 0.1f; + pd->pdef_sbift = 0.2f; + pd->pdef_sboft = 0.02f; + pd->seed = ((unsigned int)(ceil(PIL_check_seconds_timer()))+1) % 128; + + return pd; +} + /* temporal struct, used for reading return of mesh_get_mapped_verts_nors() */ typedef struct VeNoCo { diff --git a/source/blender/blenkernel/intern/fluidsim.c b/source/blender/blenkernel/intern/fluidsim.c index 54008185f72..6eba64cf33d 100644 --- a/source/blender/blenkernel/intern/fluidsim.c +++ b/source/blender/blenkernel/intern/fluidsim.c @@ -34,7 +34,9 @@ #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" +#include "DNA_object_fluidsim.h" #include "DNA_object_force.h" // for pointcache +#include "DNA_object_types.h" #include "DNA_particle_types.h" #include "DNA_scene_types.h" // N_T @@ -78,7 +80,7 @@ void fluidsim_init(FluidsimModifierData *fluidmd) if(!fss) return; - fss->type = OB_FSBND_NOSLIP; + fss->type = OB_FLUIDSIM_ENABLE; fss->show_advancedoptions = 0; fss->resolutionxyz = 50; @@ -657,5 +659,20 @@ void initElbeemMesh(struct Scene *scene, struct Object *ob, dm->release(dm); } +void fluid_estimate_memory(Object *ob, FluidsimSettings *fss, char *value) +{ + Mesh *mesh; + + value[0]= '\0'; + + if(ob->type == OB_MESH) { + /* use mesh bounding box and object scaling */ + mesh= ob->data; + + fluid_get_bb(mesh->mvert, mesh->totvert, ob->obmat, fss->bbStart, fss->bbSize); + elbeemEstimateMemreq(fss->resolutionxyz, fss->bbSize[0],fss->bbSize[1],fss->bbSize[2], fss->maxRefine, value); + } +} + #endif // DISABLE_ELBEEM diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 80a9f173d6a..9ecf3a32c2b 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -63,6 +63,7 @@ #include "DNA_meshdata_types.h" #include "DNA_modifier_types.h" #include "DNA_object_types.h" +#include "DNA_object_fluidsim.h" #include "DNA_object_force.h" #include "DNA_particle_types.h" #include "DNA_scene_types.h" @@ -8387,7 +8388,8 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type) mti = INIT_TYPE(Softbody); mti->type = eModifierTypeType_OnlyDeform; mti->flags = eModifierTypeFlag_AcceptsCVs - | eModifierTypeFlag_RequiresOriginalData; + | eModifierTypeFlag_RequiresOriginalData + | eModifierTypeFlag_Single; mti->deformVerts = softbodyModifier_deformVerts; mti->dependsOnTime = softbodyModifier_dependsOnTime; @@ -8395,7 +8397,8 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type) mti->type = eModifierTypeType_Nonconstructive; mti->initData = clothModifier_initData; mti->flags = eModifierTypeFlag_AcceptsMesh - | eModifierTypeFlag_UsesPointCache; + | eModifierTypeFlag_UsesPointCache + | eModifierTypeFlag_Single; mti->dependsOnTime = clothModifier_dependsOnTime; mti->freeData = clothModifier_freeData; mti->requiredDataMask = clothModifier_requiredDataMask; @@ -8406,7 +8409,8 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type) mti = INIT_TYPE(Collision); mti->type = eModifierTypeType_OnlyDeform; mti->initData = collisionModifier_initData; - mti->flags = eModifierTypeFlag_AcceptsMesh; + mti->flags = eModifierTypeFlag_AcceptsMesh + | eModifierTypeFlag_Single; mti->dependsOnTime = collisionModifier_dependsOnTime; mti->freeData = collisionModifier_freeData; mti->deformVerts = collisionModifier_deformVerts; @@ -8489,7 +8493,8 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type) mti = INIT_TYPE(Fluidsim); mti->type = eModifierTypeType_Nonconstructive - | eModifierTypeFlag_RequiresOriginalData; + | eModifierTypeFlag_RequiresOriginalData + | eModifierTypeFlag_Single; mti->flags = eModifierTypeFlag_AcceptsMesh; mti->initData = fluidsimModifier_initData; mti->freeData = fluidsimModifier_freeData; diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index e25e4be90c8..4b6eddf60d0 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -78,6 +78,8 @@ static void spacetype_free(SpaceType *st) } BLI_freelistN(&st->regiontypes); + BLI_freelistN(&st->toolshelf); + } void BKE_spacetypes_free(void) diff --git a/source/blender/editors/CMakeLists.txt b/source/blender/editors/CMakeLists.txt index 914fdaa4bc6..b7a868ad537 100644 --- a/source/blender/editors/CMakeLists.txt +++ b/source/blender/editors/CMakeLists.txt @@ -64,6 +64,10 @@ IF(WITH_FFMPEG) ADD_DEFINITIONS(-DWITH_FFMPEG) ENDIF(WITH_FFMPEG) +IF(NOT WITH_ELBEEM) + ADD_DEFINITIONS(-DDISABLE_ELBEEM) +ENDIF(NOT WITH_ELBEEM) + IF(WITH_PYTHON) SET(INC ${INC} ${PYTHON_INC}) ELSE(WITH_PYTHON) diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index f7702379645..6c39e670f5c 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -167,7 +167,7 @@ void ANIM_draw_cfra (const bContext *C, View2D *v2d, short flag) glLineWidth(2.0); glBegin(GL_LINE_STRIP); - vec[1]= v2d->cur.ymin; + vec[1]= v2d->cur.ymin-500.0f; /* XXX arbitrary... want it go to bottom */ glVertex2fv(vec); vec[1]= v2d->cur.ymax; diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 2abec6b831c..d6543b41f47 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -976,7 +976,7 @@ static void MARKER_OT_delete(wmOperatorType *ot) /* ************************** registration **********************************/ /* called in screen_ops.c:ED_operatortypes_screen() */ -void ED_marker_operatortypes(void) +void ED_operatortypes_marker(void) { WM_operatortype_append(MARKER_OT_add); WM_operatortype_append(MARKER_OT_move); diff --git a/source/blender/editors/include/ED_fluidsim.h b/source/blender/editors/include/ED_fluidsim.h index 586f16f42aa..2859ec897bf 100644 --- a/source/blender/editors/include/ED_fluidsim.h +++ b/source/blender/editors/include/ED_fluidsim.h @@ -46,6 +46,8 @@ void fluidsimSettingsFree(struct FluidsimSettings* sb); /* duplicate internal data */ struct FluidsimSettings* fluidsimSettingsCopy(struct FluidsimSettings* sb); +/* memory estimate */ +void fluidsimEstimateMemory(struct Object *ob, struct FluidsimSettings *fs, char *value); #endif /* ED_FLUIDSIM_H */ diff --git a/source/blender/editors/include/ED_markers.h b/source/blender/editors/include/ED_markers.h index 048bbbd7463..4b7a2954206 100644 --- a/source/blender/editors/include/ED_markers.h +++ b/source/blender/editors/include/ED_markers.h @@ -54,7 +54,7 @@ void ED_markers_make_cfra_list(ListBase *markers, ListBase *lb, short sel); /* Operators ------------------------------ */ /* called in screen_ops.c:ED_operatortypes_screen() */ -void ED_marker_operatortypes(void); +void ED_operatortypes_marker(void); /* called in screen_ops.c:ED_keymap_screen() */ void ED_marker_keymap(struct wmWindowManager *wm); diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index e4e4b1d0486..9dcdc30a691 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -103,7 +103,8 @@ void key_to_curve(struct KeyBlock *kb, struct Curve *cu, struct ListBase *nurb) void curve_to_key(struct Curve *cu, struct KeyBlock *kb, struct ListBase *nurb); /* object_modifier.c */ -int ED_object_modifier_delete(struct ReportList *reports, struct Object *ob, struct ModifierData *md); +int ED_object_modifier_add(struct ReportList *reports, struct Scene *scene, struct Object *ob, int type); +int ED_object_modifier_remove(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct ModifierData *md); 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); int ED_object_modifier_convert(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct ModifierData *md); diff --git a/source/blender/editors/include/ED_pointcache.h b/source/blender/editors/include/ED_physics.h index dc50e274fa9..b04bfb992dc 100644 --- a/source/blender/editors/include/ED_pointcache.h +++ b/source/blender/editors/include/ED_physics.h @@ -31,7 +31,9 @@ #define ED_PHYSICS_H /* operators */ + void ED_operatortypes_pointcache(void); +void ED_operatortypes_fluid(void); //void ED_keymap_pointcache(struct wmWindowManager *wm); #endif /* ED_PHYSICS_H */ diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index cc8b936b04f..c0612c3524e 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -635,6 +635,7 @@ void uiItemFullO(uiLayout *layout, char *name, int icon, char *idname, struct ID void uiItemR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, char *propname, int expand, int slider, int toggle); void uiItemFullR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, int value, int expand, int slider, int toggle); void uiItemEnumR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, char *propname, int value); +void uiItemEnumR_string(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, char *propname, char *value); void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, char *propname); void uiItemPointerR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, char *propname, struct PointerRNA *searchptr, char *searchpropname); diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h index 50283113b62..84148047795 100644 --- a/source/blender/editors/include/UI_view2d.h +++ b/source/blender/editors/include/UI_view2d.h @@ -99,9 +99,9 @@ enum { /* ------ Defines for Scrollers ----- */ -/* scroller thickness */ -#define V2D_SCROLL_HEIGHT 16 -#define V2D_SCROLL_WIDTH 16 +/* scroller area */ +#define V2D_SCROLL_HEIGHT 17 +#define V2D_SCROLL_WIDTH 17 /* half the size (in pixels) of scroller 'handles' */ #define V2D_SCROLLER_HANDLE_SIZE 5 diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 1b16155c7e6..b2ba6fb38a8 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -420,6 +420,7 @@ void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y void ui_draw_menu_back(struct uiStyle *style, uiBlock *block, rcti *rect); void ui_draw_search_back(struct uiStyle *style, uiBlock *block, rcti *rect); void ui_draw_link_bezier(rcti *rect); +void widget_scroll_draw(struct uiWidgetColors *wcol, rcti *rect, rcti *slider, int state); extern void ui_draw_but(const struct bContext *C, ARegion *ar, struct uiStyle *style, uiBut *but, rcti *rect); /* theme color init */ diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index f9816235b88..2e30c5f1cb7 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -615,14 +615,13 @@ void uiItemEnumO_string(uiLayout *layout, char *name, int icon, char *opname, ch /* for getting the enum */ PropertyRNA *prop; const EnumPropertyItem *item; - int totitem; int value; WM_operator_properties_create(&ptr, opname); /* enum lookup */ if((prop= RNA_struct_find_property(&ptr, propname))) { - RNA_property_enum_items(&ptr, prop, &item, &totitem); + RNA_property_enum_items(&ptr, prop, &item, NULL); if(RNA_enum_value_from_id(item, value_str, &value)==0) { printf("uiItemEnumO_string: %s.%s, enum %s not found.\n", RNA_struct_identifier(ptr.type), propname, value_str); return; @@ -695,14 +694,17 @@ static void ui_item_rna_size(uiLayout *layout, char *name, int icon, PropertyRNA PropertySubType subtype; int len, w, h; - w= ui_text_icon_width(layout, name, icon); - h= UI_UNIT_Y; - /* arbitrary extended width by type */ type= RNA_property_type(prop); subtype= RNA_property_subtype(prop); len= RNA_property_array_length(prop); + if(type == PROP_STRING && strcmp(name, "") == 0) + name= "non-empty"; + + w= ui_text_icon_width(layout, name, icon); + h= UI_UNIT_Y; + /* increase height for arrays */ if(index == RNA_NO_INDEX && len > 0) { if(strcmp(name, "") == 0 && icon == 0) @@ -827,15 +829,48 @@ void uiItemEnumR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, prop= RNA_struct_find_property(ptr, propname); - if(!prop) { + if(!prop || RNA_property_type(prop) != PROP_ENUM) { ui_item_disabled(layout, propname); - printf("uiItemEnumR: property not found: %s\n", propname); + printf("uiItemEnumR: enum property not found: %s\n", propname); return; } uiItemFullR(layout, name, icon, ptr, prop, RNA_ENUM_VALUE, value, 0, 0, 0); } +void uiItemEnumR_string(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, char *propname, char *value) +{ + PropertyRNA *prop; + const EnumPropertyItem *item; + int ivalue, a; + + if(!ptr->data || !propname) + return; + + prop= RNA_struct_find_property(ptr, propname); + + if(!prop || RNA_property_type(prop) != PROP_ENUM) { + ui_item_disabled(layout, propname); + printf("uiItemEnumR: enum property not found: %s\n", propname); + return; + } + + RNA_property_enum_items(ptr, prop, &item, NULL); + + if(!RNA_enum_value_from_id(item, value, &ivalue)) { + ui_item_disabled(layout, propname); + printf("uiItemEnumR: enum property value not found: %s\n", value); + return; + } + + for(a=0; item[a].identifier; a++) { + if(item[a].value == ivalue) { + uiItemFullR(layout, (char*)item[a].name, item[a].icon, ptr, prop, RNA_ENUM_VALUE, ivalue, 0, 0, 0); + break; + } + } +} + void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, char *propname) { PropertyRNA *prop; diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index a20884a61a3..319e69a40e4 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -106,7 +106,7 @@ static int panel_aligned(ScrArea *sa, ARegion *ar) } else if(sa->spacetype==SPACE_FILE && ar->regiontype == RGN_TYPE_CHANNELS) return BUT_VERTICAL; - else if(ELEM(ar->regiontype, RGN_TYPE_UI, RGN_TYPE_TOOLS)) + else if(ELEM3(ar->regiontype, RGN_TYPE_UI, RGN_TYPE_TOOLS, RGN_TYPE_TOOL_PROPS)) return BUT_VERTICAL; return 0; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 8f1d57b28ed..d9bc2d4d426 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -320,134 +320,6 @@ void uiTemplateID(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname #include "ED_object.h" -static void modifiers_del(bContext *C, void *ob_v, void *md_v) -{ - Scene *scene= CTX_data_scene(C); - Object *ob= ob_v; - ReportList reports; - - BKE_reports_init(&reports, RPT_STORE); - - if(ED_object_modifier_delete(&reports, ob_v, md_v)) { - WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); - DAG_object_flush_update(scene, ob, OB_RECALC_DATA); - - ED_undo_push(C, "Delete modifier"); - } - else - uiPupMenuReports(C, &reports); - - BKE_reports_clear(&reports); -} - -static void modifiers_activate(bContext *C, void *ob_v, void *md_v) -{ - Scene *scene= CTX_data_scene(C); - Object *ob= ob_v; - - WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); - DAG_object_flush_update(scene, ob, OB_RECALC_DATA); -} - -static void modifiers_moveUp(bContext *C, void *ob_v, void *md_v) -{ - Scene *scene= CTX_data_scene(C); - Object *ob= ob_v; - ReportList reports; - - BKE_reports_init(&reports, RPT_STORE); - - if(ED_object_modifier_move_up(&reports, ob_v, md_v)) { - WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); - DAG_object_flush_update(scene, ob, OB_RECALC_DATA); - - ED_undo_push(C, "Move modifier"); - } - else - uiPupMenuReports(C, &reports); - - BKE_reports_clear(&reports); -} - -static void modifiers_moveDown(bContext *C, void *ob_v, void *md_v) -{ - Scene *scene= CTX_data_scene(C); - Object *ob= ob_v; - ReportList reports; - - BKE_reports_init(&reports, RPT_STORE); - - if(ED_object_modifier_move_down(&reports, ob_v, md_v)) { - WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); - DAG_object_flush_update(scene, ob, OB_RECALC_DATA); - - ED_undo_push(C, "Move modifier"); - } - else - uiPupMenuReports(C, &reports); - - BKE_reports_clear(&reports); -} - -static void modifiers_convertParticles(bContext *C, void *obv, void *mdv) -{ - Scene *scene= CTX_data_scene(C); - Object *ob= obv; - ReportList reports; - - BKE_reports_init(&reports, RPT_STORE); - - if(ED_object_modifier_convert(&reports, scene, obv, mdv)) { - WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); - DAG_object_flush_update(scene, ob, OB_RECALC_DATA); - - ED_undo_push(C, "Convert particles to mesh object(s)."); - } - else - uiPupMenuReports(C, &reports); - - BKE_reports_clear(&reports); -} - -static void modifiers_applyModifier(bContext *C, void *obv, void *mdv) -{ - Scene *scene= CTX_data_scene(C); - Object *ob= obv; - ReportList reports; - - BKE_reports_init(&reports, RPT_STORE); - - if(ED_object_modifier_apply(&reports, scene, obv, mdv)) { - WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); - DAG_object_flush_update(scene, ob, OB_RECALC_DATA); - - ED_undo_push(C, "Apply modifier"); - } - else - uiPupMenuReports(C, &reports); - - BKE_reports_clear(&reports); -} - -static void modifiers_copyModifier(bContext *C, void *ob_v, void *md_v) -{ - Scene *scene= CTX_data_scene(C); - Object *ob= ob_v; - ReportList reports; - - BKE_reports_init(&reports, RPT_STORE); - - if(ED_object_modifier_copy(&reports, ob_v, md_v)) { - WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); - DAG_object_flush_update(scene, ob, OB_RECALC_DATA); - ED_undo_push(C, "Copy modifier"); - } - else - uiPupMenuReports(C, &reports); - - BKE_reports_clear(&reports); -} - static void modifiers_setOnCage(bContext *C, void *ob_v, void *md_v) { Scene *scene= CTX_data_scene(C); @@ -490,15 +362,7 @@ static void modifiers_convertToReal(bContext *C, void *ob_v, void *md_v) static int modifier_can_delete(ModifierData *md) { - // deletion over the deflection panel // fluid particle modifier can't be deleted here - - if(md->type==eModifierType_Fluidsim) - return 0; - if(md->type==eModifierType_Collision) - return 0; - if(md->type==eModifierType_Surface) - return 0; if(md->type == eModifierType_ParticleSystem) if(((ParticleSystemModifierData *)md)->psys->part->type == PART_FLUID) return 0; @@ -512,12 +376,12 @@ static uiLayout *draw_modifier(uiLayout *layout, Object *ob, ModifierData *md, i PointerRNA ptr; uiBut *but; uiBlock *block; - uiLayout *column, *row, *subrow, *result= NULL; - int isVirtual = md->mode&eModifierMode_Virtual; + uiLayout *column, *row, *result= NULL; + int isVirtual = md->mode & eModifierMode_Virtual; // XXX short color = md->error?TH_REDALERT:TH_BUT_NEUTRAL; - short width = 295, buttonWidth = width-120-10; char str[128]; + /* create RNA pointer */ RNA_pointer_create(&ob->id, &RNA_Modifier, md, &ptr); column= uiLayoutColumn(layout, 1); @@ -528,57 +392,57 @@ static uiLayout *draw_modifier(uiLayout *layout, Object *ob, ModifierData *md, i /* roundbox 4 free variables: corner-rounding, nop, roundbox type, shade */ row= uiLayoutRow(uiLayoutBox(column), 0); - block= uiLayoutGetBlock(row); + uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_EXPAND); - subrow= uiLayoutRow(row, 0); - uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_LEFT); + block= uiLayoutGetBlock(row); //uiDefBut(block, ROUNDBOX, 0, "", x-10, y-4, width, 25, NULL, 7.0, 0.0, - // (!isVirtual && (md->mode&eModifierMode_Expanded))?3:15, 20, ""); + // (!isVirtual && (md->mode & eModifierMode_Expanded))?3:15, 20, ""); /* XXX uiBlockSetCol(block, TH_AUTO); */ /* open/close icon */ - if (!isVirtual) { + if(!isVirtual) { uiBlockSetEmboss(block, UI_EMBOSSN); uiDefIconButBitI(block, ICONTOG, eModifierMode_Expanded, 0, ICON_TRIA_RIGHT, 0, 0, UI_UNIT_X, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0, "Collapse/Expand Modifier"); } /* modifier-type icon */ - uiDefIconBut(block, BUT, 0, RNA_struct_ui_icon(ptr.type), 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Current Modifier Type"); + uiItemL(row, "", RNA_struct_ui_icon(ptr.type)); uiBlockSetEmboss(block, UI_EMBOSS); - if (isVirtual) { + if(isVirtual) { + /* virtual modifier */ sprintf(str, "%s parent deform", md->name); uiDefBut(block, LABEL, 0, str, 0, 0, 185, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Modifier name"); but = uiDefBut(block, BUT, 0, "Make Real", 0, 0, 80, 16, NULL, 0.0, 0.0, 0.0, 0.0, "Convert virtual modifier to a real modifier"); uiButSetFunc(but, modifiers_convertToReal, ob, md); - } else { + } + else { + /* real modifier */ uiBlockBeginAlign(block); - uiDefBut(block, TEX, 0, "", 0, 0, buttonWidth-40, UI_UNIT_Y, md->name, 0.0, sizeof(md->name)-1, 0.0, 0.0, "Modifier name"); + uiItemR(row, "", 0, &ptr, "name", 0, 0, 0); /* Softbody not allowed in this situation, enforce! */ - if (((md->type!=eModifierType_Softbody && md->type!=eModifierType_Collision) || !(ob->pd && ob->pd->deflect)) && (md->type!=eModifierType_Surface)) { - uiDefIconButBitI(block, TOG, eModifierMode_Render, 0, ICON_SCENE, 0, 0, 19, UI_UNIT_Y,&md->mode, 0, 0, 1, 0, "Enable modifier during rendering"); - but= uiDefIconButBitI(block, TOG, eModifierMode_Realtime, 0, ICON_VIEW3D, 0, 0, 19, UI_UNIT_Y,&md->mode, 0, 0, 1, 0, "Enable modifier during interactive display"); - uiButSetFunc(but, modifiers_activate, ob, md); - if (mti->flags&eModifierTypeFlag_SupportsEditmode) { - but= uiDefIconButBitI(block, TOG, eModifierMode_Editmode, 0, ICON_EDITMODE_HLT, 0, 0, 19, UI_UNIT_Y,&md->mode, 0, 0, 1, 0, "Enable modifier during Editmode (only if enabled for display)"); - uiButSetFunc(but, modifiers_activate, ob, md); - } + if(((md->type!=eModifierType_Softbody && md->type!=eModifierType_Collision) || !(ob->pd && ob->pd->deflect)) && (md->type!=eModifierType_Surface)) { + uiItemR(row, "", ICON_SCENE, &ptr, "render", 0, 0, 0); + uiItemR(row, "", ICON_VIEW3D, &ptr, "realtime", 0, 0, 0); + + if(mti->flags & eModifierTypeFlag_SupportsEditmode) + uiItemR(row, "", ICON_VIEW3D, &ptr, "editmode", 0, 0, 0); } uiBlockEndAlign(block); /* XXX uiBlockSetEmboss(block, UI_EMBOSSR); */ - if (ob->type==OB_MESH && modifier_couldBeCage(md) && index<=lastCageIndex) { + if(ob->type==OB_MESH && modifier_couldBeCage(md) && index<=lastCageIndex) { int icon; //, color; - if (index==cageIndex) { + if(index==cageIndex) { // XXX color = TH_BUT_SETTING; icon = VICON_EDITMODE_HLT; - } else if (index<cageIndex) { + } else if(index<cageIndex) { // XXX color = TH_BUT_NEUTRAL; icon = VICON_EDITMODE_DEHLT; } else { @@ -592,67 +456,55 @@ static uiLayout *draw_modifier(uiLayout *layout, Object *ob, ModifierData *md, i } } - subrow= uiLayoutRow(row, 0); - uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_RIGHT); - + /* up/down/delete */ if(!isVirtual) { /* XXX uiBlockSetCol(block, TH_BUT_ACTION); */ - - but = uiDefIconBut(block, BUT, 0, VICON_MOVE_UP, 0, 0, 16, 16, NULL, 0.0, 0.0, 0.0, 0.0, "Move modifier up in stack"); - uiButSetFunc(but, modifiers_moveUp, ob, md); - - but = uiDefIconBut(block, BUT, 0, VICON_MOVE_DOWN, 0, 0, 16, 16, NULL, 0.0, 0.0, 0.0, 0.0, "Move modifier down in stack"); - uiButSetFunc(but, modifiers_moveDown, ob, md); + uiItemO(row, "", VICON_MOVE_UP, "OBJECT_OT_modifier_move_up"); + uiItemO(row, "", VICON_MOVE_DOWN, "OBJECT_OT_modifier_move_down"); uiBlockSetEmboss(block, UI_EMBOSSN); - - if(modifier_can_delete(md)) { - but = uiDefIconBut(block, BUT, 0, VICON_X, 0, 0, 16, 16, NULL, 0.0, 0.0, 0.0, 0.0, "Delete modifier"); - uiButSetFunc(but, modifiers_del, ob, md); - } + + if(modifier_can_delete(md)) + uiItemO(row, "", VICON_X, "OBJECT_OT_modifier_remove"); + /* XXX uiBlockSetCol(block, TH_AUTO); */ } uiBlockSetEmboss(block, UI_EMBOSS); - if(!isVirtual && (md->mode&eModifierMode_Expanded)) { + if(!isVirtual && (md->mode & eModifierMode_Expanded)) { + /* apply/convert/copy */ uiLayout *box; box= uiLayoutBox(column); row= uiLayoutRow(box, 1); - if (!isVirtual && (md->type!=eModifierType_Collision) && (md->type!=eModifierType_Surface)) { - uiBlockSetButLock(block, object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE); /* only here obdata, the rest of modifiers is ob level */ + if(!isVirtual && (md->type!=eModifierType_Collision) && (md->type!=eModifierType_Surface)) { + /* only here obdata, the rest of modifiers is ob level */ + uiBlockSetButLock(block, object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE); - if (md->type==eModifierType_ParticleSystem) { + if(md->type==eModifierType_ParticleSystem) { ParticleSystem *psys= ((ParticleSystemModifierData *)md)->psys; - if(!(G.f & G_PARTICLEEDIT)) { - if(ELEM3(psys->part->draw_as, PART_DRAW_PATH, PART_DRAW_GR, PART_DRAW_OB) && psys->pathcache) { - but = uiDefBut(block, BUT, 0, "Convert", 0,0,60,19, 0, 0, 0, 0, 0, "Convert the current particles to a mesh object"); - uiButSetFunc(but, modifiers_convertParticles, ob, md); - } - } - } - else{ - but = uiDefBut(block, BUT, 0, "Apply", 0,0,60,19, 0, 0, 0, 0, 0, "Apply the current modifier and remove from the stack"); - uiButSetFunc(but, modifiers_applyModifier, ob, md); + if(!(G.f & G_PARTICLEEDIT)) + if(ELEM3(psys->part->draw_as, PART_DRAW_PATH, PART_DRAW_GR, PART_DRAW_OB) && psys->pathcache) + uiItemO(row, "Convert", 0, "OBJECT_OT_modifier_convert"); } + else + uiItemO(row, "Apply", 0, "OBJECT_OT_modifier_apply"); uiBlockClearButLock(block); uiBlockSetButLock(block, ob && ob->id.lib, ERROR_LIBDATA_MESSAGE); - if (md->type!=eModifierType_Fluidsim && md->type!=eModifierType_Softbody && md->type!=eModifierType_ParticleSystem && (md->type!=eModifierType_Cloth)) { - but = uiDefBut(block, BUT, 0, "Copy", 0,0,60,19, 0, 0, 0, 0, 0, "Duplicate the current modifier at the same position in the stack"); - uiButSetFunc(but, modifiers_copyModifier, ob, md); - } + if(!ELEM4(md->type, eModifierType_Fluidsim, eModifierType_Softbody, eModifierType_ParticleSystem, eModifierType_Cloth)) + uiItemO(row, "Copy", 0, "OBJECT_OT_modifier_copy"); } result= uiLayoutColumn(box, 0); block= uiLayoutFreeBlock(box); } - if (md->error) { + if(md->error) { row = uiLayoutRow(uiLayoutBox(column), 0); /* XXX uiBlockSetCol(block, color); */ @@ -694,7 +546,7 @@ uiLayout *uiTemplateModifier(uiLayout *layout, PointerRNA *ptr) for(i=0; vmd; i++, vmd=vmd->next) { if(md == vmd) return draw_modifier(layout, ob, md, i, cageIndex, lastCageIndex); - else if(vmd->mode&eModifierMode_Virtual) + else if(vmd->mode & eModifierMode_Virtual) i--; } diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index ed2d00cb00d..751a09ede49 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -293,13 +293,15 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl float maxyi= maxy - 1.0f; float facxi= 1.0f/(maxxi-minxi); /* for uv */ float facyi= 1.0f/(maxyi-minyi); - int a, tot= 0; + int a, tot= 0, minsize; - if(2.0f*rad > rect->ymax-rect->ymin) - rad= 0.5f*(rect->ymax-rect->ymin); + minsize= MIN2(rect->xmax-rect->xmin, rect->ymax-rect->ymin); + + if(2.0f*rad > minsize) + rad= 0.5f*minsize; - if(2.0f*(radi+1.0f) > rect->ymax-rect->ymin) - radi= 0.5f*(rect->ymax-rect->ymin) - 1.0f; + if(2.0f*(radi+1.0f) > minsize) + radi= 0.5f*minsize - 1.0f; /* mult */ for(a=0; a<9; a++) { @@ -525,7 +527,7 @@ static void shadecolors4(char *coltop, char *coldown, char *color, short shadeto coldown[0]= CLAMPIS(color[0]+shadedown, 0, 255); coldown[1]= CLAMPIS(color[1]+shadedown, 0, 255); coldown[2]= CLAMPIS(color[2]+shadedown, 0, 255); - coldown[3]= color[3]; + coldown[3]= color[3]; } static void round_box_shade_col4(char *col1, char *col2, float fac) @@ -1104,16 +1106,16 @@ static struct uiWidgetColors wcol_toggle= { }; static struct uiWidgetColors wcol_scroll= { - {25, 25, 25, 255}, + {50, 50, 50, 180}, + {80, 80, 80, 180}, + {100, 100, 100, 180}, {180, 180, 180, 255}, - {153, 153, 153, 255}, - {90, 90, 90, 255}, {0, 0, 0, 255}, {255, 255, 255, 255}, 1, - 0, -20 + 10, -20 }; /* free wcol struct to play with */ @@ -1204,6 +1206,10 @@ static void widget_state_label(uiWidgetType *wt, int state) } +static void widget_state_nothing(uiWidgetType *wt, int state) +{ + wt->wcol= *(wt->wcol_theme); +} /* special case, button that calls pulldown */ static void widget_state_pulldown(uiWidgetType *wt, int state) @@ -1632,44 +1638,64 @@ void ui_draw_link_bezier(rcti *rect) } } -static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +/* function in use for buttons and for view2d sliders */ +void widget_scroll_draw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int state) { uiWidgetBase wtb; - rcti rect1; - double value; - char inner[3]; - float fac, size, rad; + float rad; int horizontal; + widget_init(&wtb); + /* determine horizontal/vertical */ horizontal= (rect->xmax - rect->xmin > rect->ymax - rect->ymin); - + if(horizontal) rad= 0.5f*(rect->ymax - rect->ymin); else rad= 0.5f*(rect->xmax - rect->xmin); - - widget_init(&wtb); + wtb.shadedir= (horizontal)? 1: 0; - + /* draw back part, colors swapped and shading inverted */ - VECCOPY(inner, wcol->inner); - VECCOPY(wcol->inner, wcol->item); if(horizontal) SWAP(short, wcol->shadetop, wcol->shadedown); - if(state & UI_SELECT) - SWAP(short, wcol->shadetop, wcol->shadedown); - round_box_edges(&wtb, roundboxalign, rect, rad); /* XXX vertical gradient is wrong */ + round_box_edges(&wtb, 15, rect, rad); widgetbase_draw(&wtb, wcol); - - VECCOPY(wcol->inner, inner); - if(horizontal) - SWAP(short, wcol->shadetop, wcol->shadedown); - if(state & UI_SELECT) - SWAP(short, wcol->shadetop, wcol->shadedown); - /* front part */ + /* slider */ + if(slider->xmax-slider->xmin<2 || slider->ymax-slider->ymin<2); + else { + + SWAP(short, wcol->shadetop, wcol->shadedown); + + QUATCOPY(wcol->inner, wcol->item); + + if(wcol->shadetop>wcol->shadedown) + wcol->shadetop+= 20; /* XXX violates themes... */ + else wcol->shadedown+= 20; + + if(state & UI_SELECT) + SWAP(short, wcol->shadetop, wcol->shadedown); + + /* draw */ + wtb.emboss= 0; /* only emboss once */ + + round_box_edges(&wtb, 15, slider, rad); + widgetbase_draw(&wtb, wcol); + + } +} + +static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +{ + rcti rect1; + double value; + float fac, size; + int horizontal; + + /* calculate slider part */ value= ui_get_but_val(but); size= (but->softmax + but->a1 - but->softmin); @@ -1678,6 +1704,9 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat /* position */ rect1= *rect; + /* determine horizontal/vertical */ + horizontal= (rect->xmax - rect->xmin > rect->ymax - rect->ymin); + if(horizontal) { fac= (rect->xmax - rect->xmin)/(size); rect1.xmin= rect1.xmin + ceil(fac*(value - but->softmin)); @@ -1689,17 +1718,8 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat rect1.ymin= rect1.ymax - ceil(fac*(but->a1 - but->softmin)); } - /* draw */ - wtb.emboss= 0; /* only emboss once */ - - if(!horizontal) - SWAP(short, wcol->shadetop, wcol->shadedown); + widget_scroll_draw(wcol, rect, &rect1, state); - round_box_edges(&wtb, roundboxalign, &rect1, rad); /* XXX vertical gradient is wrong */ - widgetbase_draw(&wtb, wcol); - - if(!horizontal) - SWAP(short, wcol->shadetop, wcol->shadedown); } static void widget_link(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) @@ -2101,6 +2121,7 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type) case UI_WTYPE_SCROLL: wt.wcol_theme= &btheme->tui.wcol_scroll; + wt.state= widget_state_nothing; wt.custom= widget_scroll; break; } diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index c32c8c817fb..e54f22b5ae6 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -34,6 +34,7 @@ #include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_space_types.h" +#include "DNA_userdef_types.h" #include "DNA_view2d_types.h" #include "BLI_blenlib.h" @@ -918,7 +919,14 @@ void UI_view2d_view_orthoSpecial(const bContext *C, View2D *v2d, short xaxis) /* Restore view matrices after drawing */ void UI_view2d_view_restore(const bContext *C) { - ED_region_pixelspace(CTX_wm_region(C)); + ARegion *ar= CTX_wm_region(C); + int width= ar->winrct.xmax-ar->winrct.xmin+1; + int height= ar->winrct.ymax-ar->winrct.ymin+1; + + wmOrtho2(0.0f, (float)width, 0.0f, (float)height); + wmLoadIdentity(); + + // ED_region_pixelspace(CTX_wm_region(C)); } /* *********************************************************************** */ @@ -1215,7 +1223,10 @@ void UI_view2d_grid_free(View2DGrid *grid) * WARNING: the start of this struct must not change, as view2d_ops.c uses this too. * For now, we don't need to have a separate (internal) header for structs like this... */ -struct View2DScrollers { +struct View2DScrollers { + rcti hor, vert; /* exact size of slider backdrop */ + int horfull, vertfull; /* set if sliders are full, we don't draw them */ + /* focus bubbles */ int vert_min, vert_max; /* vertical scrollbar */ int hor_min, hor_max; /* horizontal scrollbar */ @@ -1231,14 +1242,33 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short { View2DScrollers *scrollers; rcti vert, hor; - float fac, totsize, scrollsize; + float fac1, fac2, totsize, scrollsize; int scroll= view2d_scroll_mapped(v2d->scroll); + /* scrollers is allocated here... */ + scrollers= MEM_callocN(sizeof(View2DScrollers), "View2DScrollers"); + vert= v2d->vert; hor= v2d->hor; - /* scrollers is allocated here... */ - scrollers= MEM_callocN(sizeof(View2DScrollers), "View2DScrollers"); + /* slider rects smaller than region */ + hor.xmin+=4; + hor.xmax-=4; + if (scroll & V2D_SCROLL_BOTTOM) + hor.ymin+=4; + else + hor.ymax-=4; + + if (scroll & V2D_SCROLL_LEFT) + vert.xmin+=4; + else + vert.xmax-=4; + vert.ymin+=4; + vert.ymax-=4; + + /* store in scrollers, used for drawing */ + scrollers->vert= vert; + scrollers->hor= hor; /* scroller 'buttons': * - These should always remain within the visible region of the scrollbar @@ -1251,14 +1281,23 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short totsize= v2d->tot.xmax - v2d->tot.xmin; scrollsize= (float)(hor.xmax - hor.xmin); - fac= (v2d->cur.xmin - v2d->tot.xmin) / totsize; - scrollers->hor_min= (int)(hor.xmin + (fac * scrollsize)); + fac1= (v2d->cur.xmin - v2d->tot.xmin) / totsize; + if(fac1<=0.0f) + scrollers->hor_min= hor.xmin; + else + scrollers->hor_min= (int)(hor.xmin + (fac1 * scrollsize)); - fac= (v2d->cur.xmax - v2d->tot.xmin) / totsize; - scrollers->hor_max= (int)(hor.xmin + (fac * scrollsize)); + fac2= (v2d->cur.xmax - v2d->tot.xmin) / totsize; + if(fac2>=1.0f) + scrollers->hor_max= hor.xmax; + else + scrollers->hor_max= (int)(hor.xmin + (fac2 * scrollsize)); if (scrollers->hor_min > scrollers->hor_max) scrollers->hor_min= scrollers->hor_max; + + if(fac1 <= 0.0f && fac2 >= 1.0f) + scrollers->horfull= 1; } /* vertical scrollers */ @@ -1267,14 +1306,23 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short totsize= v2d->tot.ymax - v2d->tot.ymin; scrollsize= (float)(vert.ymax - vert.ymin); - fac= (v2d->cur.ymin- v2d->tot.ymin) / totsize; - scrollers->vert_min= (int)(vert.ymin + (fac * scrollsize)); + fac1= (v2d->cur.ymin- v2d->tot.ymin) / totsize; + if(fac1<=0.0f) + scrollers->vert_min= vert.ymin; + else + scrollers->vert_min= (int)(vert.ymin + (fac1 * scrollsize)); - fac= (v2d->cur.ymax - v2d->tot.ymin) / totsize; - scrollers->vert_max= (int)(vert.ymin + (fac * scrollsize)); + fac2= (v2d->cur.ymax - v2d->tot.ymin) / totsize; + if(fac2>=1.0f) + scrollers->vert_max= vert.ymax; + else + scrollers->vert_max= (int)(vert.ymin + (fac2 * scrollsize)); if (scrollers->vert_min > scrollers->vert_max) scrollers->vert_min= scrollers->vert_max; + + if(fac1 <= 0.0f && fac2 >= 1.0f) + scrollers->vertfull= 1; } /* grid markings on scrollbars */ @@ -1304,7 +1352,7 @@ static void scroll_printstr(View2DScrollers *scrollers, Scene *scene, float x, f * rotation values (hence 'degrees') are divided by 10 to * be able to show the curves at the same time */ - if ELEM(unit, V2D_UNIT_DEGREES, V2D_UNIT_TIME) { + if (ELEM(unit, V2D_UNIT_DEGREES, V2D_UNIT_TIME)) { power += 1; val *= 10; } @@ -1410,81 +1458,27 @@ static void scroll_printstr(View2DScrollers *scrollers, Scene *scene, float x, f void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *vs) { Scene *scene= CTX_data_scene(C); - const short darker= -50, dark= -10, light= 20, lighter= 50; - rcti vert, hor, corner; + rcti vert, hor; int scroll= view2d_scroll_mapped(v2d->scroll); /* make copies of rects for less typing */ - vert= v2d->vert; - hor= v2d->hor; + vert= vs->vert; + hor= vs->hor; /* horizontal scrollbar */ if (scroll & V2D_SCROLL_HORIZONTAL) { - /* scroller backdrop */ - UI_ThemeColorShade(TH_SHADE1, light); - glRecti(hor.xmin, hor.ymin, hor.xmax, hor.ymax); - - /* scroller 'button' - * - if view is zoomable in x, draw handles too - * - handles are drawn darker - * - no slider when view is > total for non-zoomable views - * (otherwise, zoomable ones tend to flicker) - */ - if ( (v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL) || - ((v2d->tot.xmax - v2d->tot.xmin) > (v2d->cur.xmax - v2d->cur.xmin)) ) - { - if (v2d->keepzoom & V2D_LOCKZOOM_X) { - /* draw base bar as rounded shape */ - UI_ThemeColorShade(TH_SHADE1, dark); - uiSetRoundBox(15); - - /* check that box is large enough for round drawing */ - if ((vs->hor_max - vs->hor_min) < (V2D_SCROLLCAP_RAD * 2)) { - /* Rounded box still gets drawn at the minimum size limit - * This doesn't represent extreme scaling well, but looks nicer... - */ - float mid= 0.5f * (vs->hor_max + vs->hor_min); - - gl_round_box_shade(GL_POLYGON, - mid-V2D_SCROLLCAP_RAD, (float)hor.ymin+2, - mid+V2D_SCROLLCAP_RAD, (float)hor.ymax-2, - V2D_SCROLLCAP_RAD, V2D_SCROLLBAR_SHADE, -V2D_SCROLLBAR_SHADE); - } - else { - /* draw rounded box as per normal */ - gl_round_box_shade(GL_POLYGON, - (float)vs->hor_min, (float)hor.ymin+2, - (float)vs->hor_max, (float)hor.ymax-2, - V2D_SCROLLCAP_RAD, V2D_SCROLLBAR_SHADE, -V2D_SCROLLBAR_SHADE); - } - } - else { - /* base bar drawn as shaded rect */ - UI_ThemeColorShade(TH_SHADE1, dark); - uiSetRoundBox(0); - gl_round_box_shade(GL_POLYGON, - (float)vs->hor_min, (float)hor.ymin+2, - (float)vs->hor_max, (float)hor.ymax-2, - V2D_SCROLLCAP_RAD, V2D_SCROLLBAR_SHADE, -V2D_SCROLLBAR_SHADE); - - /* 'minimum' handle */ - uiSetRoundBox(9); - UI_ThemeColorShade(TH_SHADE1, darker); - - gl_round_box_shade(GL_POLYGON, - (float)vs->hor_min-V2D_SCROLLER_HANDLE_SIZE, (float)hor.ymin+2, - (float)vs->hor_min+V2D_SCROLLER_HANDLE_SIZE, (float)hor.ymax-2, - V2D_SCROLLCAP_RAD, V2D_SCROLLCAP_SHADE, -V2D_SCROLLCAP_SHADE); - - /* maximum handle */ - uiSetRoundBox(6); - UI_ThemeColorShade(TH_SHADE1, darker); - - gl_round_box_shade(GL_POLYGON, - (float)vs->hor_max-V2D_SCROLLER_HANDLE_SIZE, (float)hor.ymin+2, - (float)vs->hor_max+V2D_SCROLLER_HANDLE_SIZE, (float)hor.ymax-2, - V2D_SCROLLCAP_RAD, V2D_SCROLLCAP_SHADE, -V2D_SCROLLCAP_SHADE); - } + + if(vs->horfull==0) { + bTheme *btheme= U.themes.first; + uiWidgetColors wcol= btheme->tui.wcol_scroll; + rcti slider; + + slider.xmin= vs->hor_min; + slider.xmax= vs->hor_max; + slider.ymin= hor.ymin; + slider.ymax= hor.ymax; + + widget_scroll_draw(&wcol, &hor, &slider, (v2d->scroll_ui & V2D_SCROLL_H_ACTIVE)?UI_SELECT:0); } /* scale indicators */ @@ -1519,19 +1513,26 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v /* draw numbers in the appropriate range */ if (dfac > 0.0f) { - for (; fac < hor.xmax; fac+=dfac, val+=grid->dx) { + float h= 2.0f+(float)(hor.ymin); + + for (; fac < hor.xmax-10; fac+=dfac, val+=grid->dx) { + + /* make prints look nicer for scrollers */ + if(fac < hor.xmin+10) + continue; + switch (vs->xunits) { case V2D_UNIT_FRAMES: /* frames (as whole numbers)*/ - scroll_printstr(vs, scene, fac, 3.0f+(float)(hor.ymin), val, grid->powerx, V2D_UNIT_FRAMES, 'h'); + scroll_printstr(vs, scene, fac, h, val, grid->powerx, V2D_UNIT_FRAMES, 'h'); break; case V2D_UNIT_FRAMESCALE: /* frames (not always as whole numbers) */ - scroll_printstr(vs, scene, fac, 3.0f+(float)(hor.ymin), val, grid->powerx, V2D_UNIT_FRAMESCALE, 'h'); + scroll_printstr(vs, scene, fac, h, val, grid->powerx, V2D_UNIT_FRAMESCALE, 'h'); break; case V2D_UNIT_SECONDS: /* seconds */ fac2= val/(float)FPS; - scroll_printstr(vs, scene, fac, 3.0f+(float)(hor.ymin), fac2, grid->powerx, V2D_UNIT_SECONDS, 'h'); + scroll_printstr(vs, scene, fac, h, fac2, grid->powerx, V2D_UNIT_SECONDS, 'h'); break; case V2D_UNIT_SECONDSSEQ: /* seconds with special calculations (only used for sequencer only) */ @@ -1542,96 +1543,37 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v time= (float)floor(fac2); fac2= fac2-time; - scroll_printstr(vs, scene, fac, 3.0f+(float)(hor.ymin), time+(float)FPS*fac2/100.0f, grid->powerx, V2D_UNIT_SECONDSSEQ, 'h'); + scroll_printstr(vs, scene, fac, h, time+(float)FPS*fac2/100.0f, grid->powerx, V2D_UNIT_SECONDSSEQ, 'h'); } break; case V2D_UNIT_DEGREES: /* Graph Editor for rotation Drivers */ /* HACK: although we're drawing horizontal, we make this draw as 'vertical', just to get degree signs */ - scroll_printstr(vs, scene, fac, 3.0f+(float)(hor.ymin), val, grid->powerx, V2D_UNIT_DEGREES, 'v'); + scroll_printstr(vs, scene, fac, h, val, grid->powerx, V2D_UNIT_DEGREES, 'v'); break; } } } } - - /* decoration outer bevel line */ - UI_ThemeColorShade(TH_SHADE1, lighter); - if (scroll & (V2D_SCROLL_BOTTOM|V2D_SCROLL_BOTTOM_O)) - sdrawline(hor.xmin, hor.ymax, hor.xmax, hor.ymax); - else if (scroll & V2D_SCROLL_TOP) - sdrawline(hor.xmin, hor.ymin, hor.xmax, hor.ymin); } /* vertical scrollbar */ if (scroll & V2D_SCROLL_VERTICAL) { - /* scroller backdrop */ - UI_ThemeColorShade(TH_SHADE1, light); - glRecti(vert.xmin, vert.ymin, vert.xmax, vert.ymax); - - /* scroller 'button' - * - if view is zoomable in y, draw handles too - * - handles are drawn darker - * - no slider when view is > total for non-zoomable views - * (otherwise, zoomable ones tend to flicker) - */ - if ( (v2d->scroll & V2D_SCROLL_SCALE_VERTICAL) || - ((v2d->tot.ymax - v2d->tot.ymin) > (v2d->cur.ymax - v2d->cur.ymin)) ) - { - if (v2d->keepzoom & V2D_LOCKZOOM_Y) { - /* draw base bar as rounded shape */ - UI_ThemeColorShade(TH_SHADE1, dark); - uiSetRoundBox(15); - - /* check that box is large enough for round drawing */ - if ((vs->vert_max - vs->vert_min) < (V2D_SCROLLCAP_RAD * 2)) { - /* Rounded box still gets drawn at the minimum size limit - * This doesn't represent extreme scaling well, but looks nicer... - */ - float mid= 0.5f * (vs->vert_max + vs->vert_min); - - gl_round_box_vertical_shade(GL_POLYGON, - (float)vert.xmin+2, mid-V2D_SCROLLCAP_RAD, - (float)vert.xmax-2, mid+V2D_SCROLLCAP_RAD, - V2D_SCROLLCAP_RAD, V2D_SCROLLBAR_SHADE, -V2D_SCROLLBAR_SHADE); - } - else { - /* draw rounded box as per normal */ - gl_round_box_vertical_shade(GL_POLYGON, - (float)vert.xmin+2, (float)vs->vert_min, - (float)vert.xmax-2, (float)vs->vert_max, - V2D_SCROLLCAP_RAD, V2D_SCROLLBAR_SHADE, -V2D_SCROLLBAR_SHADE); - } - } - else { - /* base bar drawn as shaded rect */ - UI_ThemeColorShade(TH_SHADE1, dark); - uiSetRoundBox(0); - gl_round_box_vertical_shade(GL_POLYGON, - (float)vert.xmin+2, (float)vs->vert_min, - (float)vert.xmax-2, (float)vs->vert_max, - V2D_SCROLLCAP_RAD, V2D_SCROLLBAR_SHADE, -V2D_SCROLLBAR_SHADE); - - /* 'minimum' handle */ - UI_ThemeColorShade(TH_SHADE1, darker); - uiSetRoundBox(12); - - gl_round_box_vertical_shade(GL_POLYGON, - (float)vert.xmin+2, (float)vs->vert_min-V2D_SCROLLER_HANDLE_SIZE, - (float)vert.xmax-2, (float)vs->vert_min+V2D_SCROLLER_HANDLE_SIZE, - V2D_SCROLLCAP_RAD, V2D_SCROLLCAP_SHADE, -V2D_SCROLLCAP_SHADE); - - /* maximum handle */ - UI_ThemeColorShade(TH_SHADE1, darker); - uiSetRoundBox(3); - - gl_round_box_vertical_shade(GL_POLYGON, - (float)vert.xmin+2, (float)vs->vert_max-V2D_SCROLLER_HANDLE_SIZE, - (float)vert.xmax-2, (float)vs->vert_max+V2D_SCROLLER_HANDLE_SIZE, - V2D_SCROLLCAP_RAD, V2D_SCROLLCAP_SHADE, -V2D_SCROLLCAP_SHADE); - } + + if(vs->vertfull==0) { + bTheme *btheme= U.themes.first; + uiWidgetColors wcol= btheme->tui.wcol_scroll; + rcti slider; + + slider.xmin= vert.xmin; + slider.xmax= vert.xmax; + slider.ymin= vs->vert_min; + slider.ymax= vs->vert_max; + + widget_scroll_draw(&wcol, &vert, &slider, (v2d->scroll_ui & V2D_SCROLL_V_ACTIVE)?UI_SELECT:0); } + /* scale indiators */ // XXX will need to update the font drawing when the new stuff comes in if ((scroll & V2D_SCROLL_SCALE_VERTICAL) && (vs->grid)) { @@ -1661,42 +1603,23 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v /* draw vertical steps */ if (dfac > 0.0f) { - for (; fac < vert.ymax; fac+= dfac, val += grid->dy) { - scroll_printstr(vs, scene, (float)(vert.xmax)-14.0f, fac, val, grid->powery, vs->yunits, 'v'); + + BLF_default_rotation(90.0f); + + for (; fac < vert.ymax-10; fac+= dfac, val += grid->dy) { + + /* make prints look nicer for scrollers */ + if(fac < vert.ymin+10) + continue; + + scroll_printstr(vs, scene, (float)(vert.xmax)-2.0f, fac, val, grid->powery, vs->yunits, 'v'); } + + BLF_default_rotation(0.0f); } } - - /* decoration outer bevel line */ - UI_ThemeColorShade(TH_SHADE1, lighter); - if (scroll & V2D_SCROLL_RIGHT) - sdrawline(vert.xmin, vert.ymin, vert.xmin, vert.ymax); - else if (scroll & V2D_SCROLL_LEFT) - sdrawline(vert.xmax, vert.ymin, vert.xmax, vert.ymax); } - /* draw a 'sunken square' to cover up any overlapping corners resulting from intersection of overflowing scroller data */ - if ((scroll & V2D_SCROLL_VERTICAL) && (scroll & V2D_SCROLL_HORIZONTAL)) { - /* set bounds (these should be right) */ - corner.xmin= vert.xmin; - corner.xmax= vert.xmax; - corner.ymin= hor.ymin; - corner.ymax= hor.ymax; - - /* firstly, draw using background color to cover up any overlapping junk */ - UI_ThemeColor(TH_SHADE1); - glRecti(corner.xmin, corner.ymin, corner.xmax, corner.ymax); - - /* now, draw suggestive highlighting... */ - /* first, dark lines on top to suggest scrollers overlap box */ - UI_ThemeColorShade(TH_SHADE1, darker); - sdrawline(corner.xmin, corner.ymin, corner.xmin, corner.ymax); - sdrawline(corner.xmin, corner.ymax, corner.xmax, corner.ymax); - /* now, light lines on bottom to show box is sunken in */ - UI_ThemeColorShade(TH_SHADE1, lighter); - sdrawline(corner.xmax, corner.ymin, corner.xmax, corner.ymax); - sdrawline(corner.xmin, corner.ymin, corner.xmax, corner.ymin); - } } /* free temporary memory used for drawing scrollers */ diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index bd1c734b870..ae89e215a03 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -1095,15 +1095,23 @@ static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event, vsm->zone= mouse_in_scroller_handle(y, v2d->vert.ymin, v2d->vert.ymax, scrollers->vert_min, scrollers->vert_max); } } + UI_view2d_scrollers_free(scrollers); + ED_region_tag_redraw(ar); } /* cleanup temp customdata */ static void scroller_activate_exit(bContext *C, wmOperator *op) { if (op->customdata) { + v2dScrollerMove *vsm= op->customdata; + + vsm->v2d->scroll_ui &= ~(V2D_SCROLL_H_ACTIVE|V2D_SCROLL_V_ACTIVE); + MEM_freeN(op->customdata); - op->customdata= NULL; + op->customdata= NULL; + + ED_region_tag_redraw(CTX_wm_region(C)); } } @@ -1240,6 +1248,11 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, wmEvent *event) } } + if(vsm->scroller=='h') + v2d->scroll_ui |= V2D_SCROLL_H_ACTIVE; + else + v2d->scroll_ui |= V2D_SCROLL_V_ACTIVE; + /* still ok, so can add */ WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op); return OPERATOR_RUNNING_MODAL; diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index a52acdd4e1e..6ec5f029148 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -86,6 +86,12 @@ void GROUP_OT_objects_remove_active(struct wmOperatorType *ot); /* object_modifier.c */ 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_apply(struct wmOperatorType *ot); +void OBJECT_OT_modifier_convert(struct wmOperatorType *ot); +void OBJECT_OT_modifier_copy(struct wmOperatorType *ot); void OBJECT_OT_multires_subdivide(struct wmOperatorType *ot); void OBJECT_OT_modifier_mdef_bind(struct wmOperatorType *ot); diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 4bcfcc4d5ab..bda3e4e8f79 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -25,6 +25,7 @@ * ***** END GPL LICENSE BLOCK ***** */ +#include <math.h> #include <stdio.h> #include <stdlib.h> @@ -35,6 +36,7 @@ #include "DNA_meshdata_types.h" #include "DNA_modifier_types.h" #include "DNA_object_types.h" +#include "DNA_object_force.h" #include "DNA_scene_types.h" #include "BLI_listbase.h" @@ -44,6 +46,7 @@ #include "BKE_depsgraph.h" #include "BKE_displist.h" #include "BKE_DerivedMesh.h" +#include "BKE_effect.h" #include "BKE_global.h" #include "BKE_lattice.h" #include "BKE_mesh.h" @@ -52,6 +55,7 @@ #include "BKE_report.h" #include "BKE_object.h" #include "BKE_particle.h" +#include "BKE_softbody.h" #include "BKE_utildefines.h" #include "RNA_access.h" @@ -67,31 +71,97 @@ /******************************** API ****************************/ -int ED_object_modifier_delete(ReportList *reports, Object *ob, ModifierData *md) +int ED_object_modifier_add(ReportList *reports, Scene *scene, Object *ob, int type) +{ + ModifierData *md; + ModifierTypeInfo *mti = modifierType_getInfo(type); + + if(mti->flags&eModifierTypeFlag_Single) { + if(modifiers_findByType(ob, type)) { + BKE_report(reports, RPT_WARNING, "Only one modifier of this type allowed."); + return 0; + } + } + + if(mti->flags&eModifierTypeFlag_RequiresOriginalData) { + md = ob->modifiers.first; + + while(md && modifierType_getInfo(md->type)->type==eModifierTypeType_OnlyDeform) + md = md->next; + + BLI_insertlinkbefore(&ob->modifiers, md, modifier_new(type)); + } + else + BLI_addtail(&ob->modifiers, modifier_new(type)); + + /* special cases */ + if(type == eModifierType_Softbody) { + if(!ob->soft) { + ob->soft= sbNew(scene); + ob->softflag |= OB_SB_GOAL|OB_SB_EDGES; + } + } + else if(type == eModifierType_Collision) { + if(!ob->pd) + ob->pd= object_add_collision_fields(); + + ob->pd->deflect= 1; + DAG_scene_sort(scene); + } + else if(type == eModifierType_Surface) + DAG_scene_sort(scene); + + DAG_object_flush_update(scene, ob, OB_RECALC_DATA); + + return 1; +} + +int ED_object_modifier_remove(ReportList *reports, Scene *scene, Object *ob, ModifierData *md) { ModifierData *obmd; /* It seems on rapid delete it is possible to * get called twice on same modifier, so make * sure it is in list. */ - for (obmd=ob->modifiers.first; obmd; obmd=obmd->next) - if (obmd==md) + for(obmd=ob->modifiers.first; obmd; obmd=obmd->next) + if(obmd==md) break; - if (!obmd) + if(!obmd) return 0; + /* special cases */ if(md->type == eModifierType_ParticleSystem) { ParticleSystemModifierData *psmd=(ParticleSystemModifierData*)md; BLI_remlink(&ob->particlesystem, psmd->psys); psys_free(ob, psmd->psys); } + else if(md->type == eModifierType_Softbody) { + if(ob->soft) { + sbFree(ob->soft); + ob->soft= NULL; + ob->softflag= 0; + } + } + else if(md->type == eModifierType_Collision) { + if(ob->pd) + ob->pd->deflect= 0; - BLI_remlink(&ob->modifiers, md); + DAG_scene_sort(scene); + } + else if(md->type == eModifierType_Surface) { + if(ob->pd) + ob->pd->flag &= ~PFIELD_SURFACE; + DAG_scene_sort(scene); + } + + BLI_remlink(&ob->modifiers, md); modifier_free(md); + DAG_object_flush_update(scene, ob, OB_RECALC_DATA); + return 1; } @@ -103,9 +173,10 @@ int ED_object_modifier_move_up(ReportList *reports, Object *ob, ModifierData *md if(mti->type!=eModifierTypeType_OnlyDeform) { ModifierTypeInfo *nmti = modifierType_getInfo(md->prev->type); - if(nmti->flags&eModifierTypeFlag_RequiresOriginalData) + if(nmti->flags&eModifierTypeFlag_RequiresOriginalData) { BKE_report(reports, RPT_WARNING, "Cannot move above a modifier requiring original data."); return 0; + } } BLI_remlink(&ob->modifiers, md); @@ -329,22 +400,11 @@ static int modifier_add_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); Object *ob = CTX_data_active_object(C); - ModifierData *md; int type= RNA_enum_get(op->ptr, "type"); - ModifierTypeInfo *mti = modifierType_getInfo(type); - if(mti->flags&eModifierTypeFlag_RequiresOriginalData) { - md = ob->modifiers.first; + if(!ED_object_modifier_add(op->reports, scene, ob, type)) + return OPERATOR_CANCELLED; - while(md && modifierType_getInfo(md->type)->type==eModifierTypeType_OnlyDeform) - md = md->next; - - BLI_insertlinkbefore(&ob->modifiers, md, modifier_new(type)); - } - else - BLI_addtail(&ob->modifiers, modifier_new(type)); - - DAG_object_flush_update(scene, ob, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); return OPERATOR_FINISHED; @@ -370,13 +430,198 @@ void OBJECT_OT_modifier_add(wmOperatorType *ot) RNA_def_enum(ot->srna, "type", modifier_type_items, 0, "Type", ""); } +/************************ remove modifier operator *********************/ + +static int modifier_remove_exec(bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_Modifier); + Object *ob= ptr.id.data; + ModifierData *md= ptr.data; + + if(!ob || !md || !ED_object_modifier_remove(op->reports, scene, ob, md)) + return OPERATOR_CANCELLED; + + WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); + + return OPERATOR_FINISHED; +} + +void OBJECT_OT_modifier_remove(wmOperatorType *ot) +{ + ot->name= "Remove Modifier"; + ot->description= "Remove a modifier from the active object."; + ot->idname= "OBJECT_OT_modifier_remove"; + ot->poll= ED_operator_object_active; + + ot->exec= modifier_remove_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +/************************ move up modifier operator *********************/ + +static int modifier_move_up_exec(bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_Modifier); + Object *ob= ptr.id.data; + ModifierData *md= ptr.data; + + if(!ob || !md || !ED_object_modifier_move_up(op->reports, ob, md)) + return OPERATOR_CANCELLED; + + DAG_object_flush_update(scene, ob, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); + + return OPERATOR_FINISHED; +} + +void OBJECT_OT_modifier_move_up(wmOperatorType *ot) +{ + ot->name= "Move Up Modifier"; + ot->description= "Move modifier up in the stack."; + ot->idname= "OBJECT_OT_modifier_move_up"; + ot->poll= ED_operator_object_active; + + ot->exec= modifier_move_up_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +/************************ move down modifier operator *********************/ + +static int modifier_move_down_exec(bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_Modifier); + Object *ob= ptr.id.data; + ModifierData *md= ptr.data; + + if(!ob || !md || !ED_object_modifier_move_down(op->reports, ob, md)) + return OPERATOR_CANCELLED; + + DAG_object_flush_update(scene, ob, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); + + return OPERATOR_FINISHED; +} + +void OBJECT_OT_modifier_move_down(wmOperatorType *ot) +{ + ot->name= "Move Down Modifier"; + ot->description= "Move modifier down in the stack."; + ot->idname= "OBJECT_OT_modifier_move_down"; + ot->poll= ED_operator_object_active; + + ot->exec= modifier_move_down_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +/************************ apply modifier operator *********************/ + +static int modifier_apply_exec(bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_Modifier); + Object *ob= ptr.id.data; + ModifierData *md= ptr.data; + + if(!ob || !md || !ED_object_modifier_apply(op->reports, scene, ob, md)) + return OPERATOR_CANCELLED; + + DAG_object_flush_update(scene, ob, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); + + return OPERATOR_FINISHED; +} + +void OBJECT_OT_modifier_apply(wmOperatorType *ot) +{ + ot->name= "Apply Modifier"; + ot->description= "Apply modifier and remove from the stack."; + ot->idname= "OBJECT_OT_modifier_apply"; + ot->poll= ED_operator_object_active; + + ot->exec= modifier_apply_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +/************************ convert modifier operator *********************/ + +static int modifier_convert_exec(bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_Modifier); + Object *ob= ptr.id.data; + ModifierData *md= ptr.data; + + if(!ob || !md || !ED_object_modifier_convert(op->reports, scene, ob, md)) + return OPERATOR_CANCELLED; + + DAG_object_flush_update(scene, ob, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); + + return OPERATOR_FINISHED; +} + +void OBJECT_OT_modifier_convert(wmOperatorType *ot) +{ + ot->name= "Convert Modifier"; + ot->description= "Convert particles to a mesh object."; + ot->idname= "OBJECT_OT_modifier_convert"; + ot->poll= ED_operator_object_active; + + ot->exec= modifier_convert_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +/************************ copy modifier operator *********************/ + +static int modifier_copy_exec(bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_Modifier); + Object *ob= ptr.id.data; + ModifierData *md= ptr.data; + + if(!ob || !md || !ED_object_modifier_copy(op->reports, ob, md)) + return OPERATOR_CANCELLED; + + DAG_object_flush_update(scene, ob, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); + + return OPERATOR_FINISHED; +} + +void OBJECT_OT_modifier_copy(wmOperatorType *ot) +{ + ot->name= "Copy Modifier"; + ot->description= "Duplicate modifier at the same position in the stack."; + ot->idname= "OBJECT_OT_modifier_copy"; + ot->poll= ED_operator_object_active; + + ot->exec= modifier_copy_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + /****************** multires subdivide operator *********************/ static int multires_subdivide_exec(bContext *C, wmOperator *op) { - Object *ob = CTX_data_active_object(C); - PointerRNA ptr = CTX_data_pointer_get(C, "modifier"); - MultiresModifierData *mmd = (RNA_struct_is_a(ptr.type, &RNA_Modifier))? ptr.data: NULL; + PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_MultiresModifier); + Object *ob= ptr.id.data; + MultiresModifierData *mmd= ptr.data; if(mmd) { multiresModifier_subdivide(mmd, ob, 1, 0, mmd->simple); @@ -403,8 +648,7 @@ void OBJECT_OT_multires_subdivide(wmOperatorType *ot) static int modifier_mdef_bind_poll(bContext *C) { - PointerRNA ptr= CTX_data_pointer_get(C, "modifier"); - return RNA_struct_is_a(ptr.type, &RNA_MeshDeformModifier); + return CTX_data_pointer_get_type(C, "modifier", &RNA_MeshDeformModifier).data != NULL; } static int modifier_mdef_bind_exec(bContext *C, wmOperator *op) diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index 6fa78a53840..6248d826ad4 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -100,6 +100,12 @@ void ED_operatortypes_object(void) WM_operatortype_append(OBJECT_OT_primitive_add); WM_operatortype_append(OBJECT_OT_modifier_add); + 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_apply); + WM_operatortype_append(OBJECT_OT_modifier_convert); + WM_operatortype_append(OBJECT_OT_modifier_copy); WM_operatortype_append(OBJECT_OT_multires_subdivide); WM_operatortype_append(OBJECT_OT_modifier_mdef_bind); diff --git a/source/blender/editors/physics/ed_fluidsim.c b/source/blender/editors/physics/ed_fluidsim.c index 215a72d6927..3990521bd1b 100644 --- a/source/blender/editors/physics/ed_fluidsim.c +++ b/source/blender/editors/physics/ed_fluidsim.c @@ -67,18 +67,19 @@ #include "BKE_blender.h" #include "BKE_context.h" #include "BKE_customdata.h" +#include "BKE_DerivedMesh.h" #include "BKE_displist.h" #include "BKE_effect.h" #include "BKE_fluidsim.h" #include "BKE_global.h" -#include "BKE_modifier.h" -#include "BKE_main.h" +#include "BKE_ipo.h" #include "BKE_key.h" -#include "BKE_scene.h" +#include "BKE_main.h" +#include "BKE_modifier.h" #include "BKE_object.h" +#include "BKE_report.h" +#include "BKE_scene.h" #include "BKE_softbody.h" -#include "BKE_DerivedMesh.h" -#include "BKE_ipo.h" #include "PIL_time.h" @@ -89,6 +90,9 @@ #include "ED_fluidsim.h" #include "ED_screen.h" +#include "WM_api.h" +#include "WM_types.h" + /* XXX */ /* from header info.c */ static int start_progress_bar(void) {return 0;}; @@ -124,7 +128,7 @@ char* fluidsimViscosityPresetString[6] = { /* ********************** fluid sim settings struct functions ********************** */ /* helper function */ -void fluidsimGetGeometryObjFilename(struct Object *ob, char *dst) { //, char *srcname) { +void fluidsimGetGeometryObjFilename(Object *ob, char *dst) { //, char *srcname) { //snprintf(dst,FILE_MAXFILE, "%s_cfgdata_%s.bobj.gz", srcname, ob->id.name); snprintf(dst,FILE_MAXFILE, "fluidcfgdata_%s.bobj.gz", ob->id.name); } @@ -337,14 +341,14 @@ int runSimulationCallback(void *data, int status, int frame) { /* ********************** write fluidsim config to file ************************* */ /* ******************************************************************************** */ -void fluidsimBake(bContext *C, struct Object *ob) +int fluidsimBake(bContext *C, ReportList *reports, Object *ob) { Scene *scene= CTX_data_scene(C); FILE *fileCfg; int i; - struct Object *fsDomain = NULL; + Object *fsDomain = NULL; FluidsimSettings *domainSettings; - struct Object *obit = NULL; /* object iterator */ + Object *obit = NULL; /* object iterator */ Base *base; int origFrame = scene->r.cfra; char debugStrBuffer[256]; @@ -412,8 +416,8 @@ void fluidsimBake(bContext *C, struct Object *ob) // old: noFrames = scene->r.efra - scene->r.sfra +1; noFrames = scene->r.efra - 0; if(noFrames<=0) { - pupmenu("Fluidsim Bake Error%t|No frames to export - check your animation range settings. Aborted%x0"); - return; + BKE_report(reports, RPT_ERROR, "No frames to export - check your animation range settings."); + return 0; } /* no object pointer, find in selected ones.. */ @@ -434,7 +438,7 @@ void fluidsimBake(bContext *C, struct Object *ob) } } // no domains found? - if(!ob) return; + if(!ob) return 0; } channelObjCount = 0; @@ -452,8 +456,8 @@ void fluidsimBake(bContext *C, struct Object *ob) } if (channelObjCount>=255) { - pupmenu("Fluidsim Bake Error%t|Cannot bake with more then 256 objects"); - return; + BKE_report(reports, RPT_ERROR, "Cannot bake with more then 256 objects."); + return 0; } /* check if there's another domain... */ @@ -467,8 +471,8 @@ void fluidsimBake(bContext *C, struct Object *ob) { if(obit != ob) { - pupmenu("Fluidsim Bake Error%t|There should be only one domain object! Aborted%x0"); - return; + BKE_report(reports, RPT_ERROR, "There should be only one domain object."); + return 0; } } } @@ -490,8 +494,8 @@ void fluidsimBake(bContext *C, struct Object *ob) } } if(!haveSomeFluid) { - pupmenu("Fluidsim Bake Error%t|No fluid objects in scene... Aborted%x0"); - return; + BKE_report(reports, RPT_ERROR, "No fluid objects in scene."); + return 0; } /* these both have to be valid, otherwise we wouldnt be here */ @@ -585,7 +589,7 @@ void fluidsimBake(bContext *C, struct Object *ob) // ask user if thats what he/she wants... selection = pupmenu(dispmsg); - if(selection<1) return; // 0 from menu, or -1 aborted + if(selection<1) return 0; // 0 from menu, or -1 aborted strcpy(targetDir, newSurfdataPath); strncpy(domainSettings->surfdataPath, newSurfdataPath, FILE_MAXDIR); BLI_convertstringcode(targetDir, G.sce); // fixed #frame-no @@ -710,6 +714,10 @@ void fluidsimBake(bContext *C, struct Object *ob) // check & init loc,rot,size for(j=0; j<3; j++) { for(k=0; k<3; k++) { + // XXX prevent invalid memory access until this works + icuex[j][k]= NULL; + icudex[j][k]= NULL; + // XXX icuex[j][k] = find_ipocurve(obit->ipo, icuIds[j][k] ); // XXX icudex[j][k] = find_ipocurve(obit->ipo, icudIds[j][k] ); // XXX lines below were already disabled! @@ -812,12 +820,12 @@ void fluidsimBake(bContext *C, struct Object *ob) if(!Mat4Invert(invDomMat, domainMat)) { snprintf(debugStrBuffer,256,"fluidsimBake::error - Invalid obj matrix?\n"); elbeemDebugOut(debugStrBuffer); + BKE_report(reports, RPT_ERROR, "Invalid object matrix."); // FIXME add fatal msg FS_FREE_CHANNELS; - return; + return 0; } - // -------------------------------------------------------------------------------------------- // start writing / exporting strcpy(targetFile, targetDir); @@ -1001,7 +1009,6 @@ void fluidsimBake(bContext *C, struct Object *ob) } // valid mesh } // objects //domainSettings->type = OB_FLUIDSIM_DOMAIN; // enable for bake display again - //fsDomain->fluidsimFlag = OB_FLUIDSIM_ENABLE; // disable during bake // set to neutral, -1 means user abort, -2 means init error globalBakeState = 0; @@ -1080,7 +1087,7 @@ void fluidsimBake(bContext *C, struct Object *ob) // -------------------------------------------------------------------------------------------- else { // write config file to be run with command line simulator - pupmenu("Fluidsim Bake Message%t|Config file export not supported.%x0"); + BKE_report(reports, RPT_WARNING, "Config file export not supported."); } // config file export done! // -------------------------------------------------------------------------------------------- @@ -1099,51 +1106,81 @@ void fluidsimBake(bContext *C, struct Object *ob) ED_update_for_newframe(C, 1); if(!simAborted) { - char fsmessage[512]; char elbeemerr[256]; - strcpy(fsmessage,"Fluidsim Bake Error: "); + // check if some error occurred if(globalBakeState==-2) { - strcat(fsmessage,"Failed to initialize [Msg: "); - elbeemGetErrorString(elbeemerr); - strcat(fsmessage,elbeemerr); - - strcat(fsmessage,"] |OK%x0"); - pupmenu(fsmessage); + BKE_reportf(reports, RPT_ERROR, "Failed to initialize [Msg: %s]", elbeemerr); + return 0; } // init error } // elbeemFree(); + return 1; } -void fluidsimFreeBake(struct Object *ob) +void fluidsimFreeBake(Object *ob) { /* not implemented yet */ } - #else /* DISABLE_ELBEEM */ /* compile dummy functions for disabled fluid sim */ -FluidsimSettings *fluidsimSettingsNew(struct Object *srcob) { +FluidsimSettings *fluidsimSettingsNew(Object *srcob) +{ return NULL; } -void fluidsimSettingsFree(FluidsimSettings *fss) { +void fluidsimSettingsFree(FluidsimSettings *fss) +{ } -FluidsimSettings* fluidsimSettingsCopy(FluidsimSettings *fss) { +FluidsimSettings* fluidsimSettingsCopy(FluidsimSettings *fss) +{ return NULL; } /* only compile dummy functions */ -void fluidsimBake(bContext *C, struct Object *ob) { +int fluidsimBake(bContext *C, ReportList *reports, Object *ob) +{ + return 0; } -void fluidsimFreeBake(struct Object *ob) { +void fluidsimFreeBake(Object *ob) +{ } #endif /* DISABLE_ELBEEM */ +/***************************** Operators ******************************/ + +static int fluid_bake_exec(bContext *C, wmOperator *op) +{ + Object *ob= CTX_data_active_object(C); + + // XXX TODO redraw, escape, non-blocking, .. + if(!fluidsimBake(C, op->reports, ob)) + return OPERATOR_CANCELLED; + + return OPERATOR_FINISHED; +} + +void FLUID_OT_bake(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Fluid Simulation Bake"; + ot->idname= "FLUID_OT_bake"; + + /* api callbacks */ + ot->exec= fluid_bake_exec; + ot->poll= ED_operator_object_active; +} + +void ED_operatortypes_fluid(void) +{ + WM_operatortype_append(FLUID_OT_bake); +} + diff --git a/source/blender/editors/physics/ed_pointcache.c b/source/blender/editors/physics/ed_pointcache.c index 893c59a521d..edd668b46bb 100644 --- a/source/blender/editors/physics/ed_pointcache.c +++ b/source/blender/editors/physics/ed_pointcache.c @@ -45,7 +45,7 @@ #include "BLI_blenlib.h" #include "ED_screen.h" -#include "ED_pointcache.h" +#include "ED_physics.h" #include "UI_interface.h" #include "UI_resources.h" diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 535e99ccfef..dd8efd68604 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -261,6 +261,7 @@ static void region_scissor_winrct(ARegion *ar, rcti *winrct) if(BLI_isect_rcti(winrct, &ar->winrct, NULL)) { if(ar->flag & RGN_FLAG_HIDDEN); + else if(ar->alignment & RGN_SPLIT_PREV); else if(ar->alignment==RGN_OVERLAP_LEFT) { winrct->xmin= ar->winrct.xmax + 1; } diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c index 510103895f4..c8df9bb9741 100644 --- a/source/blender/editors/space_api/spacetypes.c +++ b/source/blender/editors/space_api/spacetypes.c @@ -42,15 +42,15 @@ #include "ED_anim_api.h" #include "ED_armature.h" #include "ED_curve.h" -#include "ED_mesh.h" #include "ED_markers.h" +#include "ED_mesh.h" #include "ED_object.h" #include "ED_particle.h" -#include "ED_sculpt.h" +#include "ED_physics.h" #include "ED_screen.h" +#include "ED_sculpt.h" #include "ED_space_api.h" #include "ED_uvedit.h" -#include "ED_pointcache.h" /* only call once on startup, storage is global in BKE kernel listbase */ void ED_spacetypes_init(void) @@ -89,8 +89,9 @@ void ED_spacetypes_init(void) ED_operatortypes_particle(); ED_operatortypes_curve(); ED_operatortypes_armature(); - ED_marker_operatortypes(); + ED_operatortypes_marker(); ED_operatortypes_pointcache(); + ED_operatortypes_fluid(); ui_view2d_operatortypes(); diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 01794d1bba8..02179f347f5 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -497,7 +497,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r "world", "object", "meshe", "armature", "lattice", "curve", "meta_ball", "lamp", "camera", "material", "material_slot", "texture", "texture_slot", "bone", "edit_bone", "particle_system", - "cloth", "soft_body", "fluid", NULL}; + "cloth", "soft_body", "fluid", "collision", NULL}; CTX_data_dir_set(result, dir); return 1; @@ -615,7 +615,8 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r if(ptr && ptr->data) { Object *ob= ptr->data; - CTX_data_pointer_set(result, &ob->id, &RNA_SoftBodySettings, ob->soft); + ModifierData *md= modifiers_findByType(ob, eModifierType_Softbody); + CTX_data_pointer_set(result, &ob->id, &RNA_SoftBodyModifier, md); return 1; } } @@ -629,6 +630,16 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r return 1; } } + else if(CTX_data_equals(member, "collision")) { + PointerRNA *ptr= get_pointer_type(path, &RNA_Object); + + if(ptr && ptr->data) { + Object *ob= ptr->data; + ModifierData *md= modifiers_findByType(ob, eModifierType_Collision); + CTX_data_pointer_set(result, &ob->id, &RNA_CollisionModifier, md); + return 1; + } + } return 0; } diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index df3e8c62d37..2bc3bdaa613 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -41,6 +41,7 @@ #include "BKE_depsgraph.h" #include "BKE_font.h" #include "BKE_library.h" +#include "BKE_main.h" #include "BKE_material.h" #include "BKE_particle.h" #include "BKE_texture.h" @@ -471,6 +472,7 @@ void OBJECT_OT_particle_system_remove(wmOperatorType *ot) static int new_particle_settings_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); + Main *bmain= CTX_data_main(C); ParticleSettings *part= CTX_data_pointer_get_type(C, "particle_settings", &RNA_ParticleSettings).data; Object *ob; PointerRNA ptr; @@ -479,7 +481,7 @@ static int new_particle_settings_exec(bContext *C, wmOperator *op) if(part) part= psys_copy_settings(part); else - part= psys_new_settings("PSys", NULL); + part= psys_new_settings("PSys", bmain); /* attempt to assign to material slot */ ptr= CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 2cade676817..28b6f0b4ab6 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -96,14 +96,15 @@ /* *************************** Calculate Range ************************** */ /* Get the min/max keyframes*/ -static void get_graph_keyframe_extents (bAnimContext *ac, float *xmin, float *xmax, float *ymin, float *ymax) +/* note: it should return total boundbox, filter for selection only can be argument... */ +void get_graph_keyframe_extents (bAnimContext *ac, float *xmin, float *xmax, float *ymin, float *ymax) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; /* get data to filter, from Dopesheet */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* set large values to try to override */ diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h index 86e5451122d..697c31eaa98 100644 --- a/source/blender/editors/space_graph/graph_intern.h +++ b/source/blender/editors/space_graph/graph_intern.h @@ -84,6 +84,8 @@ enum { /* ***************************************** */ /* graph_edit.c */ +void get_graph_keyframe_extents (struct bAnimContext *ac, float *xmin, float *xmax, float *ymin, float *ymax); + void GRAPH_OT_previewrange_set(struct wmOperatorType *ot); void GRAPH_OT_view_all(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index ef42b009bd4..b17861dc679 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -243,6 +243,10 @@ static void graph_main_area_draw(const bContext *C, ARegion *ar) /* draw curves twice - unselected, then selected, so that the are fewer occlusion problems */ graph_draw_curves(&ac, sipo, ar, grid, 0); graph_draw_curves(&ac, sipo, ar, grid, 1); + + /* XXX the slow way to set tot rect... but for nice sliders needed (ton) */ + get_graph_keyframe_extents(&ac, &v2d->tot.xmin, &v2d->tot.xmax, &v2d->tot.ymin, &v2d->tot.ymax); + } /* only free grid after drawing data, as we need to use it to determine sampling rate */ diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index e9bba7a83c6..c387bb74ad8 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -97,29 +97,45 @@ ARegion *view3d_has_buttons_region(ScrArea *sa) ARegion *view3d_has_tools_region(ScrArea *sa) { - ARegion *ar, *arnew; + ARegion *ar, *artool=NULL, *arprops=NULL, *arhead; - for(ar= sa->regionbase.first; ar; ar= ar->next) + for(ar= sa->regionbase.first; ar; ar= ar->next) { if(ar->regiontype==RGN_TYPE_TOOLS) - return ar; - - /* add subdiv level; after header */ - for(ar= sa->regionbase.first; ar; ar= ar->next) - if(ar->regiontype==RGN_TYPE_HEADER) - break; - - /* is error! */ - if(ar==NULL) return NULL; - - arnew= MEM_callocN(sizeof(ARegion), "tools for view3d"); + artool= ar; + if(ar->regiontype==RGN_TYPE_TOOL_PROPS) + arprops= ar; + } - BLI_insertlinkafter(&sa->regionbase, ar, arnew); - arnew->regiontype= RGN_TYPE_TOOLS; - arnew->alignment= RGN_OVERLAP_LEFT; + /* tool region hide/unhide also hides props */ + if(arprops && artool) return artool; - arnew->flag = RGN_FLAG_HIDDEN; + if(artool==NULL) { + /* add subdiv level; after header */ + for(arhead= sa->regionbase.first; arhead; arhead= arhead->next) + if(arhead->regiontype==RGN_TYPE_HEADER) + break; + + /* is error! */ + if(arhead==NULL) return NULL; + + artool= MEM_callocN(sizeof(ARegion), "tools for view3d"); + + BLI_insertlinkafter(&sa->regionbase, arhead, artool); + artool->regiontype= RGN_TYPE_TOOLS; + artool->alignment= RGN_OVERLAP_LEFT; + artool->flag = RGN_FLAG_HIDDEN; + } + + if(arprops==NULL) { + /* add extra subdivided region for tool properties */ + arprops= MEM_callocN(sizeof(ARegion), "tool props for view3d"); + + BLI_insertlinkafter(&sa->regionbase, artool, arprops); + arprops->regiontype= RGN_TYPE_TOOL_PROPS; + arprops->alignment= RGN_ALIGN_BOTTOM|RGN_SPLIT_PREV; + } - return arnew; + return artool; } /* ****************************************************** */ @@ -558,9 +574,11 @@ static void view3d_tools_area_init(wmWindowManager *wm, ARegion *ar) WM_event_add_keymap_handler(&ar->handlers, keymap); } + + static void view3d_tools_area_draw(const bContext *C, ARegion *ar) { - ED_region_panels(C, ar, 1, NULL); + ED_region_panels(C, ar, 1, view3d_context_string(C)); } /* @@ -859,6 +877,20 @@ void ED_spacetype_view3d(void) BLI_addhead(&st->regiontypes, art); view3d_toolbar_register(art); + + /* regions: tool properties */ + art= MEM_callocN(sizeof(ARegionType), "spacetype view3d region"); + art->regionid = RGN_TYPE_TOOL_PROPS; + art->minsizex= 0; + art->minsizey= 120; + art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_FRAMES; + art->listener= view3d_buttons_area_listener; + art->init= view3d_tools_area_init; + art->draw= view3d_tools_area_draw; + BLI_addhead(&st->regiontypes, art); + + view3d_tool_props_register(art); + /* regions: header */ art= MEM_callocN(sizeof(ARegionType), "spacetype view3d region"); diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 6dbd99c67be..65040b4238f 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -136,9 +136,11 @@ void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d); void VIEW3D_OT_properties(struct wmOperatorType *ot); void view3d_buttons_register(struct ARegionType *art); -/* view3d_buttons.c */ +/* view3d_toolbar.c */ void VIEW3D_OT_toolbar(struct wmOperatorType *ot); void view3d_toolbar_register(struct ARegionType *art); +void view3d_tool_props_register(struct ARegionType *art); +char *view3d_context_string(const struct bContext *C); /* view3d_snap.c */ int minmax_verts(Object *obedit, float *min, float *max); diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index ea365d59ac7..8aba8e11d43 100644 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ b/source/blender/editors/space_view3d/view3d_toolbar.c @@ -150,9 +150,46 @@ static void view3d_panel_operator_redo(const bContext *C, Panel *pa) /* ******************* */ +char *view3d_context_string(const bContext *C) +{ + Object *obedit= CTX_data_edit_object(C); + + if(obedit) { + switch(obedit->type) { + case OB_MESH: + return "editmode_mesh"; + case OB_CURVE: + return "editmode_curve"; + case OB_SURF: + return "editmode_surface"; + case OB_FONT: + return "editmode_text"; + case OB_ARMATURE: + return "editmode_armature"; + case OB_MBALL: + return "editmode_mball"; + case OB_LATTICE: + return "editmode_lattice"; + } + } + else { + Object *ob = CTX_data_active_object(C); + + if(ob && (ob->flag & OB_POSEMODE)) return "posemode"; + else if (G.f & G_SCULPTMODE) return "sculptmode"; + else if (G.f & G_WEIGHTPAINT) return "weightpaint"; + else if (G.f & G_VERTEXPAINT) return "vertexpaint"; + else if (G.f & G_TEXTUREPAINT) return "texturepaint"; + else if(G.f & G_PARTICLEEDIT) return "particlemode"; + } + + return "objectmode"; +} + typedef struct CustomTool { struct CustomTool *next, *prev; char opname[OP_MAX_TYPENAME]; + char context[OP_MAX_TYPENAME]; } CustomTool; static void operator_call_cb(struct bContext *C, void *arg_listbase, void *arg2) @@ -164,6 +201,7 @@ static void operator_call_cb(struct bContext *C, void *arg_listbase, void *arg2) BLI_addtail(arg_listbase, ct); BLI_strncpy(ct->opname, ot->idname, OP_MAX_TYPENAME); + BLI_strncpy(ct->context, view3d_context_string(C), OP_MAX_TYPENAME); } } @@ -221,43 +259,28 @@ static uiBlock *tool_search_menu(bContext *C, ARegion *ar, void *arg_listbase) } -static void view3d_panel_tools(const bContext *C, Panel *pa) +static void view3d_panel_tool_shelf(const bContext *C, Panel *pa) { - static ListBase tools= {NULL, NULL}; - Object *obedit= CTX_data_edit_object(C); -// Object *obact = CTX_data_active_object(C); + SpaceLink *sl= CTX_wm_space_data(C); + SpaceType *st= NULL; uiLayout *col; + const char *context= view3d_context_string(C); - if(obedit) { - if(obedit->type==OB_MESH) { - - col= uiLayoutColumn(pa->layout, 1); - uiItemFullO(col, NULL, 0, "MESH_OT_spin", NULL, WM_OP_INVOKE_REGION_WIN); - uiItemFullO(col, NULL, 0, "MESH_OT_screw", NULL, WM_OP_INVOKE_REGION_WIN); - - if(tools.first) { - CustomTool *ct; - - for(ct= tools.first; ct; ct= ct->next) { - col= uiLayoutColumn(pa->layout, 1); - uiItemFullO(col, NULL, 0, ct->opname, NULL, WM_OP_INVOKE_REGION_WIN); - } + if(sl) + st= BKE_spacetype_from_id(sl->spacetype); + + if(st && st->toolshelf.first) { + CustomTool *ct; + + for(ct= st->toolshelf.first; ct; ct= ct->next) { + if(0==strncmp(context, ct->context, OP_MAX_TYPENAME)) { + col= uiLayoutColumn(pa->layout, 1); + uiItemFullO(col, NULL, 0, ct->opname, NULL, WM_OP_INVOKE_REGION_WIN); } - col= uiLayoutColumn(pa->layout, 1); - uiDefBlockBut(uiLayoutGetBlock(pa->layout), tool_search_menu, &tools, "Add Operator", 0, 0, UI_UNIT_X, UI_UNIT_Y, "Add tool"); } } - else { - - col= uiLayoutColumn(pa->layout, 1); - uiItemFullO(col, NULL, 0, "OBJECT_OT_delete", NULL, WM_OP_INVOKE_REGION_WIN); - uiItemFullO(col, NULL, 0, "OBJECT_OT_primitive_add", NULL, WM_OP_INVOKE_REGION_WIN); - - col= uiLayoutColumn(pa->layout, 1); - uiItemFullO(col, NULL, 0, "OBJECT_OT_parent_set", NULL, WM_OP_INVOKE_REGION_WIN); - uiItemFullO(col, NULL, 0, "OBJECT_OT_parent_clear", NULL, WM_OP_INVOKE_REGION_WIN); - - } + col= uiLayoutColumn(pa->layout, 1); + uiDefBlockBut(uiLayoutGetBlock(pa->layout), tool_search_menu, &st->toolshelf, "Add Tool", 0, 0, UI_UNIT_X, UI_UNIT_Y, "Add Tool in shelf, gets saved in files"); } @@ -266,10 +289,15 @@ void view3d_toolbar_register(ARegionType *art) PanelType *pt; pt= MEM_callocN(sizeof(PanelType), "spacetype view3d panel tools"); - strcpy(pt->idname, "VIEW3D_PT_tools"); - strcpy(pt->label, "Tools"); - pt->draw= view3d_panel_tools; + strcpy(pt->idname, "VIEW3D_PT_tool_shelf"); + strcpy(pt->label, "Tool Shelf"); + pt->draw= view3d_panel_tool_shelf; BLI_addtail(&art->paneltypes, pt); +} + +void view3d_tool_props_register(ARegionType *art) +{ + PanelType *pt; pt= MEM_callocN(sizeof(PanelType), "spacetype view3d panel last operator"); strcpy(pt->idname, "VIEW3D_PT_last_operator"); @@ -278,6 +306,8 @@ void view3d_toolbar_register(ARegionType *art) BLI_addtail(&art->paneltypes, pt); } +/* ********** operator to open/close toolbar region */ + static int view3d_toolbar(bContext *C, wmOperator *op) { ScrArea *sa= CTX_wm_area(C); diff --git a/source/blender/makesdna/DNA_object_fluidsim.h b/source/blender/makesdna/DNA_object_fluidsim.h index 66c5baab84b..09288b24c20 100644 --- a/source/blender/makesdna/DNA_object_fluidsim.h +++ b/source/blender/makesdna/DNA_object_fluidsim.h @@ -135,12 +135,12 @@ typedef struct FluidsimSettings { /* ob->fluidsimSettings defines */ #define OB_FLUIDSIM_ENABLE 1 #define OB_FLUIDSIM_DOMAIN 2 -#define OB_FLUIDSIM_FLUID 4 +#define OB_FLUIDSIM_FLUID 4 #define OB_FLUIDSIM_OBSTACLE 8 -#define OB_FLUIDSIM_INFLOW 16 -#define OB_FLUIDSIM_OUTFLOW 32 -#define OB_FLUIDSIM_PARTICLE 64 -#define OB_FLUIDSIM_CONTROL 128 +#define OB_FLUIDSIM_INFLOW 16 +#define OB_FLUIDSIM_OUTFLOW 32 +#define OB_FLUIDSIM_PARTICLE 64 +#define OB_FLUIDSIM_CONTROL 128 #define OB_TYPEFLAG_START 7 #define OB_FSGEO_THIN (1<<(OB_TYPEFLAG_START+1)) diff --git a/source/blender/makesdna/DNA_object_force.h b/source/blender/makesdna/DNA_object_force.h index 88d9894cf7a..32bfc58f56c 100644 --- a/source/blender/makesdna/DNA_object_force.h +++ b/source/blender/makesdna/DNA_object_force.h @@ -271,7 +271,7 @@ typedef struct SoftBody { #define PTCACHE_REDO_NEEDED 258 /* ob->softflag */ -#define OB_SB_ENABLE 1 +#define OB_SB_ENABLE 1 /* deprecated, use modifier */ #define OB_SB_GOAL 2 #define OB_SB_EDGES 4 #define OB_SB_QUADS 8 diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h index d9d68490425..44133b61e6c 100644 --- a/source/blender/makesdna/DNA_screen_types.h +++ b/source/blender/makesdna/DNA_screen_types.h @@ -226,6 +226,7 @@ typedef struct ARegion { #define RGN_TYPE_TEMPORARY 3 #define RGN_TYPE_UI 4 #define RGN_TYPE_TOOLS 5 +#define RGN_TYPE_TOOL_PROPS 6 /* region alignment */ #define RGN_ALIGN_NONE 0 diff --git a/source/blender/makesdna/DNA_view2d_types.h b/source/blender/makesdna/DNA_view2d_types.h index ac628ca2266..dd73d691b62 100644 --- a/source/blender/makesdna/DNA_view2d_types.h +++ b/source/blender/makesdna/DNA_view2d_types.h @@ -118,6 +118,10 @@ typedef struct View2D { #define V2D_SCROLL_VERTICAL_HIDE (1<<7) #define V2D_SCROLL_HORIZONTAL_HIDE (1<<8) +/* scroll_ui, activate flag for drawing */ +#define V2D_SCROLL_H_ACTIVE (1<<0) +#define V2D_SCROLL_V_ACTIVE (1<<1) + /* alignment flags for totrect, flags use 'shading-out' convention (v2d->align) */ /* all quadrants free */ #define V2D_ALIGN_FREE 0 diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 0673521505f..55084d7537c 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -364,7 +364,7 @@ extern StructRNA RNA_ShrinkwrapModifier; extern StructRNA RNA_SimpleDeformModifier; extern StructRNA RNA_SmoothModifier; extern StructRNA RNA_SoftBodySettings; -extern StructRNA RNA_SoftbodyModifier; +extern StructRNA RNA_SoftBodyModifier; extern StructRNA RNA_Sound; extern StructRNA RNA_SoundSequence; extern StructRNA RNA_Space; @@ -388,6 +388,7 @@ extern StructRNA RNA_StucciTexture; extern StructRNA RNA_SubsurfModifier; extern StructRNA RNA_SunLamp; extern StructRNA RNA_SurfaceCurve; +extern StructRNA RNA_SurfaceModifier; extern StructRNA RNA_TexMapping; extern StructRNA RNA_Text; extern StructRNA RNA_TextBox; diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 963e4f9aeff..3400b69ee38 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -62,6 +62,10 @@ IF(WITH_FFMPEG) ADD_DEFINITIONS(-DWITH_FFMPEG) ENDIF(WITH_FFMPEG) +IF(NOT WITH_ELBEEM) + ADD_DEFINITIONS(-DDISABLE_ELBEEM) +ENDIF(NOT WITH_ELBEEM) + # Build makesrna executable ADD_EXECUTABLE(makesrna ${SRC} ${INC_FILES}) TARGET_LINK_LIBRARIES(makesrna bf_dna) diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c index 4e047ff7772..44a50fbae25 100644 --- a/source/blender/makesrna/intern/rna_fluidsim.c +++ b/source/blender/makesrna/intern/rna_fluidsim.c @@ -31,8 +31,23 @@ #include "DNA_object_fluidsim.h" +#include "WM_api.h" +#include "WM_types.h" + #ifdef RNA_RUNTIME +#include "MEM_guardedalloc.h" + +#include "DNA_scene_types.h" +#include "DNA_particle_types.h" + +#include "BKE_depsgraph.h" +#include "BKE_fluidsim.h" +#include "BKE_main.h" +#include "BKE_modifier.h" +#include "BKE_particle.h" +#include "BKE_pointcache.h" + static StructRNA* rna_FluidSettings_refine(struct PointerRNA *ptr) { FluidsimSettings *fss= (FluidsimSettings*)ptr->data; @@ -57,6 +72,79 @@ static StructRNA* rna_FluidSettings_refine(struct PointerRNA *ptr) } } +static void rna_FluidSettings_update_type(bContext *C, PointerRNA *ptr) +{ + Main *bmain= CTX_data_main(C); + Scene *scene= CTX_data_scene(C); + Object *ob= (Object*)ptr->id.data; + FluidsimModifierData *fluidmd; + ParticleSystemModifierData *psmd; + ParticleSystem *psys; + ParticleSettings *part; + + fluidmd= (FluidsimModifierData*)modifiers_findByType(ob, eModifierType_Fluidsim); + fluidmd->fss->flag &= ~OB_FLUIDSIM_REVERSE; // clear flag + + /* remove fluidsim particle system */ + if(fluidmd->fss->type & OB_FLUIDSIM_PARTICLE) { + for(psys=ob->particlesystem.first; psys; psys=psys->next) + if(psys->part->type == PART_FLUID) + break; + + if(ob->type == OB_MESH && !psys) { + /* add particle system */ + part= psys_new_settings("PSys", bmain); + psys= MEM_callocN(sizeof(ParticleSystem), "particle_system"); + + part->type= PART_FLUID; + psys->part= part; + psys->pointcache= BKE_ptcache_add(); + psys->flag |= PSYS_ENABLED; + BLI_addtail(&ob->particlesystem,psys); + + /* add modifier */ + psmd= (ParticleSystemModifierData*)modifier_new(eModifierType_ParticleSystem); + sprintf(psmd->modifier.name, "FluidParticleSystem" ); + psmd->psys= psys; + BLI_addtail(&ob->modifiers, psmd); + } + } + else { + for(psys=ob->particlesystem.first; psys; psys=psys->next) { + if(psys->part->type == PART_FLUID) { + /* clear modifier */ + psmd= psys_get_modifier(ob, psys); + BLI_remlink(&ob->modifiers, psmd); + modifier_free((ModifierData *)psmd); + + /* clear particle system */ + BLI_remlink(&ob->particlesystem, psys); + psys_free(ob, psys); + } + } + } + + DAG_object_flush_update(scene, ob, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob); +} + +static void rna_DomainFluidSettings_memory_estimate_get(PointerRNA *ptr, char *value) +{ +#ifdef DISABLE_ELBEEM + value[0]= '\0'; +#else + Object *ob= (Object*)ptr->id.data; + FluidsimSettings *fss= (FluidsimSettings*)ptr->data; + + fluid_estimate_memory(ob, fss, value); +#endif +} + +static int rna_DomainFluidSettings_memory_estimate_length(PointerRNA *ptr) +{ + return 32; +} + #else static void rna_def_fluidsim_slip(StructRNA *srna) @@ -128,6 +216,7 @@ static void rna_def_fluidsim_domain(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "guiDisplayMode"); RNA_def_property_enum_items(prop, quality_items); RNA_def_property_ui_text(prop, "Viewport Display Mode", "How to display the mesh in the viewport."); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); prop= RNA_def_property(srna, "render_display_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "renderDisplayMode"); @@ -142,6 +231,12 @@ static void rna_def_fluidsim_domain(BlenderRNA *brna) RNA_def_property_string_maxlength(prop, 240); RNA_def_property_string_sdna(prop, NULL, "surfdataPath"); RNA_def_property_ui_text(prop, "Path", "Directory (and/or filename prefix) to store baked fluid simulation files in."); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); + + prop= RNA_def_property(srna, "memory_estimate", PROP_STRING, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_string_funcs(prop, "rna_DomainFluidSettings_memory_estimate_get", "rna_DomainFluidSettings_memory_estimate_length", NULL); + RNA_def_property_ui_text(prop, "Memory Estimate", "Estimated amount of memory needed for baking the domain."); /* advanced settings */ @@ -336,6 +431,7 @@ static void rna_def_fluidsim_particle(BlenderRNA *brna) RNA_def_property_string_maxlength(prop, 240); RNA_def_property_string_sdna(prop, NULL, "surfdataPath"); RNA_def_property_ui_text(prop, "Path", "Directory (and/or filename prefix) to store and load particles from."); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); } static void rna_def_fluidsim_control(BlenderRNA *brna) @@ -393,7 +489,7 @@ void RNA_def_fluidsim(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem prop_fluid_type_items[] = { - {0, "NONE", 0, "None", ""}, + {OB_FLUIDSIM_ENABLE, "NONE", 0, "None", ""}, {OB_FLUIDSIM_DOMAIN, "DOMAIN", 0, "Domain", "Bounding box of this object represents the computational domain of the fluid simulation."}, {OB_FLUIDSIM_FLUID, "FLUID", 0, "Fluid", "Object represents a volume of fluid in the simulation."}, {OB_FLUIDSIM_OBSTACLE, "OBSTACLE", 0, "Obstacle", "Object is a fixed obstacle."}, @@ -409,18 +505,11 @@ void RNA_def_fluidsim(BlenderRNA *brna) RNA_def_struct_refine_func(srna, "rna_FluidSettings_refine"); RNA_def_struct_ui_text(srna, "Fluid Simulation Settings", "Fluid simulation settings for an object taking part in the simulation."); - /* enable and type */ - - prop= RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "type", OB_FLUIDSIM_ENABLE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); // needs to create modifier - RNA_def_property_ui_text(prop, "Enabled", "Sets object to participate in fluid simulation."); - prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, prop_fluid_type_items); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); // needs to update variables RNA_def_property_ui_text(prop, "Type", "Type of participation in the fluid simulation."); + RNA_def_property_update(prop, 0, "rna_FluidSettings_update_type"); //prop= RNA_def_property(srna, "ipo", PROP_POINTER, PROP_NONE); //RNA_def_property_ui_text(prop, "Ipo Curves", "Ipo curves used by fluid simulation settings."); diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 5b8e7c76636..6a5d5ccfdc3 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -186,6 +186,9 @@ void rna_object_vgroup_name_set(struct PointerRNA *ptr, const char *value, char void rna_object_uvlayer_name_set(struct PointerRNA *ptr, const char *value, char *result, int maxlen); void rna_object_vcollayer_name_set(struct PointerRNA *ptr, const char *value, char *result, int maxlen); +void rna_Object_update(struct bContext *C, struct PointerRNA *ptr); +void rna_Object_update_data(struct bContext *C, struct PointerRNA *ptr); + /* API functions */ void RNA_api_main(struct StructRNA *srna); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 9b3ff6e74a0..48bfdf70171 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -66,8 +66,9 @@ EnumPropertyItem modifier_type_items[] ={ {eModifierType_Shrinkwrap, "SHRINKWRAP", ICON_MOD_SHRINKWRAP, "Shrinkwrap", ""}, {eModifierType_SimpleDeform, "SIMPLE_DEFORM", ICON_MOD_SIMPLEDEFORM, "Simple Deform", ""}, {eModifierType_Smooth, "SMOOTH", ICON_MOD_SMOOTH, "Smooth", ""}, - {eModifierType_Softbody, "SOFTBODY", ICON_MOD_SOFT, "Softbody", ""}, + {eModifierType_Softbody, "SOFTBODY", ICON_MOD_SOFT, "Soft Body", ""}, {eModifierType_Subsurf, "SUBSURF", ICON_MOD_SUBSURF, "Subsurf", ""}, + {eModifierType_Surface, "SURFACE", ICON_MOD_PHYSICS, "Surface", ""}, {eModifierType_UVProject, "UV_PROJECT", ICON_MOD_UVPROJECT, "UV Project", ""}, {eModifierType_Wave, "WAVE", ICON_MOD_WAVE, "Wave", ""}, {0, NULL, 0, NULL, NULL}}; @@ -109,7 +110,7 @@ static StructRNA* rna_Modifier_refine(struct PointerRNA *ptr) case eModifierType_Hook: return &RNA_HookModifier; case eModifierType_Softbody: - return &RNA_SoftbodyModifier; + return &RNA_SoftBodyModifier; case eModifierType_Boolean: return &RNA_BooleanModifier; case eModifierType_Array: @@ -148,6 +149,8 @@ static StructRNA* rna_Modifier_refine(struct PointerRNA *ptr) return &RNA_SimpleDeformModifier; case eModifierType_Multires: return &RNA_MultiresModifier; + case eModifierType_Surface: + return &RNA_SurfaceModifier; default: return &RNA_Modifier; } @@ -348,6 +351,18 @@ static void rna_ArrayModifier_curve_set(PointerRNA *ptr, PointerRNA value) modifier_object_set(&((ArrayModifierData*)ptr->data)->curve_ob, OB_CURVE, value); } +static PointerRNA rna_SoftBodyModifier_settings_get(PointerRNA *ptr) +{ + Object *ob= (Object*)ptr->id.data; + return rna_pointer_inherit_refine(ptr, &RNA_SoftBodySettings, ob->soft); +} + +static PointerRNA rna_CollisionModifier_settings_get(PointerRNA *ptr) +{ + Object *ob= (Object*)ptr->id.data; + return rna_pointer_inherit_refine(ptr, &RNA_CollisionSettings, ob->pd); +} + #else static void rna_def_property_subdivision_common(StructRNA *srna, const char type[]) @@ -831,11 +846,17 @@ static void rna_def_modifier_hook(BlenderRNA *brna) static void rna_def_modifier_softbody(BlenderRNA *brna) { StructRNA *srna; + PropertyRNA *prop; - srna= RNA_def_struct(brna, "SoftbodyModifier", "Modifier"); - RNA_def_struct_ui_text(srna, "Softbody Modifier", "Softbody simulation modifier."); + srna= RNA_def_struct(brna, "SoftBodyModifier", "Modifier"); + RNA_def_struct_ui_text(srna, "Soft Body Modifier", "Soft body simulation modifier."); RNA_def_struct_sdna(srna, "SoftbodyModifierData"); RNA_def_struct_ui_icon(srna, ICON_MOD_SOFT); + + prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NEVER_NULL); + RNA_def_property_struct_type(prop, "SoftBodySettings"); + RNA_def_property_pointer_funcs(prop, "rna_SoftBodyModifier_settings_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Soft Body Settings", ""); } static void rna_def_modifier_boolean(BlenderRNA *brna) @@ -1398,6 +1419,11 @@ static void rna_def_modifier_collision(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Collision Modifier", "Collision modifier defining modifier stack position used for collision."); RNA_def_struct_sdna(srna, "CollisionModifierData"); RNA_def_struct_ui_icon(srna, ICON_MOD_PHYSICS); + + prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NEVER_NULL); + RNA_def_property_struct_type(prop, "CollisionSettings"); + RNA_def_property_pointer_funcs(prop, "rna_CollisionModifier_settings_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Settings", ""); prop= RNA_def_property(srna, "absorption", PROP_INT, PROP_PERCENTAGE); RNA_def_property_int_sdna(prop, NULL, "absorption"); @@ -1672,6 +1698,16 @@ static void rna_def_modifier_simpledeform(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); } +static void rna_def_modifier_surface(BlenderRNA *brna) +{ + StructRNA *srna; + + srna= RNA_def_struct(brna, "SurfaceModifier", "Modifier"); + RNA_def_struct_ui_text(srna, "Surface Modifier", "Surface modifier defining modifier stack position used for surface fields."); + RNA_def_struct_sdna(srna, "SurfaceModifierData"); + RNA_def_struct_ui_icon(srna, ICON_MOD_PHYSICS); +} + void RNA_def_modifier(BlenderRNA *brna) { StructRNA *srna; @@ -1701,15 +1737,18 @@ void RNA_def_modifier(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Realtime); RNA_def_property_ui_text(prop, "Realtime", "Realtime display of a modifier."); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); + RNA_def_property_ui_icon(prop, ICON_VIEW3D, 0); prop= RNA_def_property(srna, "render", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Render); RNA_def_property_ui_text(prop, "Render", "Use modifier during rendering."); + RNA_def_property_ui_icon(prop, ICON_SCENE, 0); prop= RNA_def_property(srna, "editmode", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Editmode); RNA_def_property_ui_text(prop, "Editmode", "Use modifier while in the edit mode."); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); + RNA_def_property_ui_icon(prop, ICON_EDITMODE_HLT, 0); prop= RNA_def_property(srna, "on_cage", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_OnCage); @@ -1751,6 +1790,7 @@ void RNA_def_modifier(BlenderRNA *brna) rna_def_modifier_mask(brna); rna_def_modifier_simpledeform(brna); rna_def_modifier_multires(brna); + rna_def_modifier_surface(brna); } #endif diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 2be0d115dc9..ca2c9d072fb 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -48,17 +48,18 @@ #include "BKE_context.h" #include "BKE_curve.h" #include "BKE_depsgraph.h" +#include "BKE_effect.h" #include "BKE_key.h" #include "BKE_material.h" #include "BKE_mesh.h" #include "BKE_particle.h" -static void rna_Object_update(bContext *C, PointerRNA *ptr) +void rna_Object_update(bContext *C, PointerRNA *ptr) { DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_OB); } -static void rna_Object_update_data(bContext *C, PointerRNA *ptr) +void rna_Object_update_data(bContext *C, PointerRNA *ptr) { DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_DATA); } @@ -456,6 +457,28 @@ static void rna_Object_shape_key_lock_set(PointerRNA *ptr, int value) ob->shapeflag &= ~OB_SHAPE_TEMPLOCK; } +static PointerRNA rna_Object_field_get(PointerRNA *ptr) +{ + Object *ob= (Object*)ptr->id.data; + + /* weak */ + if(!ob->pd) + ob->pd= object_add_collision_fields(); + + return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, ob->pd); +} + +static PointerRNA rna_Object_collision_get(PointerRNA *ptr) +{ + Object *ob= (Object*)ptr->id.data; + + /* weak */ + if(!ob->pd) + ob->pd= object_add_collision_fields(); + + return rna_pointer_inherit_refine(ptr, &RNA_CollisionSettings, ob->pd); +} + #else static void rna_def_vertex_group(BlenderRNA *brna) @@ -1006,11 +1029,13 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "field", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "pd"); RNA_def_property_struct_type(prop, "FieldSettings"); + RNA_def_property_pointer_funcs(prop, "rna_Object_field_get", NULL, NULL); RNA_def_property_ui_text(prop, "Field Settings", "Settings for using the objects as a field in physics simulation."); prop= RNA_def_property(srna, "collision", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "pd"); RNA_def_property_struct_type(prop, "CollisionSettings"); + RNA_def_property_pointer_funcs(prop, "rna_Object_collision_get", NULL, NULL); RNA_def_property_ui_text(prop, "Collision Settings", "Settings for using the objects as a collider in physics simulation."); prop= RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 4d8c728db12..45a9dc44875 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -33,18 +33,25 @@ #include "DNA_object_force.h" #include "DNA_scene_types.h" +#include "WM_api.h" #include "WM_types.h" #ifdef RNA_RUNTIME #include "MEM_guardedalloc.h" +#include "DNA_modifier_types.h" +#include "DNA_texture_types.h" + #include "BKE_context.h" +#include "BKE_modifier.h" #include "BKE_pointcache.h" #include "BKE_depsgraph.h" #include "BLI_blenlib.h" +#include "ED_object.h" + static void rna_Cache_change(bContext *C, PointerRNA *ptr) { Scene *scene = CTX_data_scene(C); @@ -209,21 +216,6 @@ static void rna_SoftBodySettings_new_aero_set(PointerRNA *ptr, int value) else data->softflag &= ~OB_SB_AERO_ANGLE; } -static int rna_SoftBodySettings_enabled_get(PointerRNA *ptr) -{ - Object *data= (Object*)(ptr->data); - return (((data->softflag) & OB_SB_ENABLE) != 0); -} - -#if 0 -static void rna_SoftBodySettings_enabled_set(PointerRNA *ptr, int value) -{ - Object *data= (Object*)(ptr->data); - if(value) data->softflag |= OB_SB_ENABLE; - else data->softflag &= ~OB_SB_ENABLE; -} -#endif - static int rna_SoftBodySettings_face_collision_get(PointerRNA *ptr) { Object *data= (Object*)(ptr->data); @@ -250,6 +242,108 @@ static void rna_SoftBodySettings_edge_collision_set(PointerRNA *ptr, int value) else data->softflag &= ~OB_SB_EDGECOLL; } +static void rna_SoftBodySettings_goal_vgroup_get(PointerRNA *ptr, char *value) +{ + SoftBody *sb= (SoftBody*)ptr->data; + rna_object_vgroup_name_index_get(ptr, value, sb->vertgroup); +} + +static int rna_SoftBodySettings_goal_vgroup_length(PointerRNA *ptr) +{ + SoftBody *sb= (SoftBody*)ptr->data; + return rna_object_vgroup_name_index_length(ptr, sb->vertgroup); +} + +static void rna_SoftBodySettings_goal_vgroup_set(PointerRNA *ptr, const char *value) +{ + SoftBody *sb= (SoftBody*)ptr->data; + rna_object_vgroup_name_index_set(ptr, value, &sb->vertgroup); +} + +static void rna_FieldSettings_update(bContext *C, PointerRNA *ptr) +{ + Scene *scene= CTX_data_scene(C); + Object *ob= (Object*)ptr->id.data; + + if(ob->pd->forcefield != PFIELD_TEXTURE && ob->pd->tex) { + ob->pd->tex->id.us--; + ob->pd->tex= 0; + } + + DAG_object_flush_update(scene, ob, OB_RECALC_OB); + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); +} + +static void rna_FieldSettings_surface_update(bContext *C, PointerRNA *ptr) +{ + Scene *scene= CTX_data_scene(C); + Object *ob= (Object*)ptr->id.data; + PartDeflect *pd= ob->pd; + ModifierData *md= modifiers_findByType(ob, eModifierType_Surface); + + /* add/remove modifier as needed */ + if(!md) { + if(pd && (pd->flag & PFIELD_SURFACE)) + if(ELEM5(pd->forcefield,PFIELD_HARMONIC,PFIELD_FORCE,PFIELD_HARMONIC,PFIELD_CHARGE,PFIELD_LENNARDJ)) + if(ELEM4(ob->type, OB_MESH, OB_SURF, OB_FONT, OB_CURVE)) + ED_object_modifier_add(NULL, scene, ob, eModifierType_Surface); + } + else { + if(!pd || !(pd->flag & PFIELD_SURFACE)) + ED_object_modifier_remove(NULL, scene, ob, md); + } + + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); +} + +static void rna_FieldSettings_dependency_update(bContext *C, PointerRNA *ptr) +{ + Scene *scene= CTX_data_scene(C); + Object *ob= (Object*)ptr->id.data; + + /* do this before scene sort, that one checks for CU_PATH */ + /* XXX if(ob->type==OB_CURVE && ob->pd->forcefield==PFIELD_GUIDE) { + Curve *cu= ob->data; + cu->flag |= (CU_PATH|CU_3D); + do_curvebuts(B_CU3D); // all curves too + }*/ + + rna_FieldSettings_surface_update(C, ptr); + + DAG_scene_sort(scene); + + if(ob->type == OB_CURVE && ob->pd->forcefield == PFIELD_GUIDE) + DAG_object_flush_update(scene, ob, OB_RECALC); + else + DAG_object_flush_update(scene, ob, OB_RECALC_OB); + + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); +} + +static void rna_CollisionSettings_dependency_update(bContext *C, PointerRNA *ptr) +{ + Scene *scene= CTX_data_scene(C); + Object *ob= (Object*)ptr->id.data; + ModifierData *md= modifiers_findByType(ob, eModifierType_Collision); + + /* add/remove modifier as needed */ + if(ob->pd->deflect && !md) + ED_object_modifier_add(NULL, scene, ob, eModifierType_Collision); + else if(!ob->pd->deflect && md) + ED_object_modifier_remove(NULL, scene, ob, md); + + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); +} + +static void rna_CollisionSettings_update(bContext *C, PointerRNA *ptr) +{ + Scene *scene= CTX_data_scene(C); + Object *ob= (Object*)ptr->id.data; + + DAG_object_flush_update(scene, ob, OB_RECALC); + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); +} + #else static void rna_def_pointcache(BlenderRNA *brna) @@ -279,9 +373,11 @@ static void rna_def_pointcache(BlenderRNA *brna) /* flags */ prop= RNA_def_property(srna, "baked", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_BAKED); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "baking", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_BAKING); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "disk_cache", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_DISK_CACHE); @@ -325,6 +421,7 @@ static void rna_def_collision(BlenderRNA *brna) prop= RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "deflect", 1); RNA_def_property_ui_text(prop, "Enabled", "Enable this objects as a collider for physics systems"); + RNA_def_property_update(prop, 0, "rna_CollisionSettings_dependency_update"); /* Particle Interaction */ @@ -332,30 +429,36 @@ static void rna_def_collision(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "pdef_damp"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Damping Factor", "Amount of damping during particle collision"); + RNA_def_property_update(prop, 0, "rna_CollisionSettings_update"); prop= RNA_def_property(srna, "random_damping", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "pdef_rdamp"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Random Damping", "Random variation of damping"); + RNA_def_property_update(prop, 0, "rna_CollisionSettings_update"); prop= RNA_def_property(srna, "friction_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "pdef_frict"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Friction Factor", "Amount of friction during particle collision"); + RNA_def_property_update(prop, 0, "rna_CollisionSettings_update"); prop= RNA_def_property(srna, "random_friction", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "pdef_rfrict"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Random Friction", "Random variation of friction"); + RNA_def_property_update(prop, 0, "rna_CollisionSettings_update"); prop= RNA_def_property(srna, "permeability", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "pdef_perm"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Permeability", "Chance that the particle will pass through the mesh"); + RNA_def_property_update(prop, 0, "rna_CollisionSettings_update"); prop= RNA_def_property(srna, "kill_particles", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PDEFLE_KILL_PART); RNA_def_property_ui_text(prop, "Kill Particles", "Kill collided particles"); + RNA_def_property_update(prop, 0, "rna_CollisionSettings_update"); /* Soft Body and Cloth Interaction */ @@ -363,21 +466,25 @@ static void rna_def_collision(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "pdef_sbift"); RNA_def_property_range(prop, 0.001f, 1.0f); RNA_def_property_ui_text(prop, "Inner Thickness", "Inner face thickness"); + RNA_def_property_update(prop, 0, "rna_CollisionSettings_update"); prop= RNA_def_property(srna, "outer_thickness", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "pdef_sboft"); RNA_def_property_range(prop, 0.001f, 1.0f); RNA_def_property_ui_text(prop, "Outer Thickness", "Outer face thickness"); + RNA_def_property_update(prop, 0, "rna_CollisionSettings_update"); prop= RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "pdef_sbdamp"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Damping", "Amount of damping during collision"); + RNA_def_property_update(prop, 0, "rna_CollisionSettings_update"); /* Does this belong here? prop= RNA_def_property(srna, "collision_stack", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "softflag", OB_SB_COLLFINAL); RNA_def_property_ui_text(prop, "Collision from Stack", "Pick collision object from modifier stack (softbody only)"); + RNA_def_property_update(prop, 0, "rna_CollisionSettings_update"); */ } @@ -418,20 +525,23 @@ static void rna_def_field(BlenderRNA *brna) /* Enums */ - prop= RNA_def_property(srna, "field_type", PROP_ENUM, PROP_NONE); + prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "forcefield"); RNA_def_property_enum_items(prop, field_type_items); - RNA_def_property_ui_text(prop, "Field Type", "Choose Field Type"); + RNA_def_property_ui_text(prop, "Type", "Type of field."); + RNA_def_property_update(prop, 0, "rna_FieldSettings_dependency_update"); prop= RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "falloff"); RNA_def_property_enum_items(prop, falloff_items); - RNA_def_property_ui_text(prop, "Fall-Off", "Fall-Off Shape"); + RNA_def_property_ui_text(prop, "Fall-Off", "Fall-off shape."); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); prop= RNA_def_property(srna, "texture_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "tex_mode"); RNA_def_property_enum_items(prop, texture_items); RNA_def_property_ui_text(prop, "Texture Mode", "How the texture effect is calculated (RGB & Curl need a RGB texture else Gradient will be used instead)"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); /* Float */ @@ -439,103 +549,125 @@ static void rna_def_field(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "f_strength"); RNA_def_property_range(prop, -1000.0f, 1000.0f); RNA_def_property_ui_text(prop, "Strength", "Strength of force field"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); prop= RNA_def_property(srna, "falloff_power", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "f_power"); RNA_def_property_range(prop, 0.0f, 10.0f); RNA_def_property_ui_text(prop, "Falloff Power", "Falloff power (real gravitational falloff = 2)"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); prop= RNA_def_property(srna, "harmonic_damping", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "f_damp"); RNA_def_property_range(prop, 0.0f, 10.0f); RNA_def_property_ui_text(prop, "Harmonic Damping", "Damping of the harmonic force"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); prop= RNA_def_property(srna, "minimum_distance", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "mindist"); RNA_def_property_range(prop, 0.0f, 1000.0f); RNA_def_property_ui_text(prop, "Minimum Distance", "Minimum distance for the field's fall-off"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); prop= RNA_def_property(srna, "maximum_distance", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "maxdist"); RNA_def_property_range(prop, 0.0f, 1000.0f); RNA_def_property_ui_text(prop, "Maximum Distance", "Maximum distance for the field to work"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); prop= RNA_def_property(srna, "radial_minimum", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "minrad"); RNA_def_property_range(prop, 0.0f, 1000.0f); RNA_def_property_ui_text(prop, "Minimum Radial Distance", "Minimum radial distance for the field's fall-off"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); prop= RNA_def_property(srna, "radial_maximum", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "maxrad"); RNA_def_property_range(prop, 0.0f, 1000.0f); RNA_def_property_ui_text(prop, "Maximum Radial Distance", "Maximum radial distance for the field to work"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); prop= RNA_def_property(srna, "radial_falloff", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "f_power_r"); RNA_def_property_range(prop, 0.0f, 10.0f); RNA_def_property_ui_text(prop, "Radial Falloff Power", "Radial falloff power (real gravitational falloff = 2)"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); prop= RNA_def_property(srna, "texture_nabla", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "tex_nabla"); RNA_def_property_range(prop, 0.0001f, 1.0f); RNA_def_property_ui_text(prop, "Nabla", "Defines size of derivative offset used for calculating gradient and curl"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); prop= RNA_def_property(srna, "noise", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "f_noise"); RNA_def_property_range(prop, 0.0f, 10.0f); RNA_def_property_ui_text(prop, "Noise", "Noise of the wind force"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); prop= RNA_def_property(srna, "seed", PROP_INT, PROP_UNSIGNED); RNA_def_property_range(prop, 1, 128); RNA_def_property_ui_text(prop, "Seed", "Seed of the wind noise"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); /* Boolean */ prop= RNA_def_property(srna, "use_min_distance", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMIN); RNA_def_property_ui_text(prop, "Use Min", "Use a minimum distance for the field's fall-off"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); prop= RNA_def_property(srna, "use_max_distance", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMAX); RNA_def_property_ui_text(prop, "Use Max", "Use a maximum distance for the field to work"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); prop= RNA_def_property(srna, "use_radial_min", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMINR); RNA_def_property_ui_text(prop, "Use Min", "Use a minimum radial distance for the field's fall-off"); // "Use a minimum angle for the field's fall-off" + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); prop= RNA_def_property(srna, "use_radial_max", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMAXR); RNA_def_property_ui_text(prop, "Use Max", "Use a maximum radial distance for the field to work"); // "Use a maximum angle for the field to work" + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); prop= RNA_def_property(srna, "guide_path_add", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_GUIDE_PATH_ADD); RNA_def_property_ui_text(prop, "Additive", "Based on distance/falloff it adds a portion of the entire path"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); prop= RNA_def_property(srna, "planar", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_PLANAR); RNA_def_property_ui_text(prop, "Planar", "Create planar field"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); prop= RNA_def_property(srna, "surface", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_SURFACE); RNA_def_property_ui_text(prop, "Surface", "Use closest point on surface"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_surface_update"); prop= RNA_def_property(srna, "positive_z", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_POSZ); RNA_def_property_ui_text(prop, "Positive", "Effect only in direction of positive Z axis"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); prop= RNA_def_property(srna, "use_coordinates", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_TEX_OBJECT); RNA_def_property_ui_text(prop, "Use Coordinates", "Use object/global coordinates for texture"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); prop= RNA_def_property(srna, "force_2d", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_TEX_2D); RNA_def_property_ui_text(prop, "2D", "Apply force only in 2d"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); prop= RNA_def_property(srna, "root_coordinates", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_TEX_ROOTCO); RNA_def_property_ui_text(prop, "Root Texture Coordinates", "Texture coordinates from root particle locations"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); /* Pointer */ @@ -543,6 +675,7 @@ static void rna_def_field(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "tex"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Texture", "Texture to use as force"); + RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); } static void rna_def_game_softbody(BlenderRNA *brna) @@ -561,9 +694,9 @@ static void rna_def_softbody(BlenderRNA *brna) static EnumPropertyItem collision_type_items[] = { {SBC_MODE_MANUAL, "MANUAL", 0, "Manual", "Manual adjust"}, - {SBC_MODE_AVG, "AVERAGE", 0, "Average", "Average Spring lenght * Ball Size"}, - {SBC_MODE_MIN, "MINIMAL", 0, "Minimal", "Minimal Spring lenght * Ball Size"}, - {SBC_MODE_MAX, "MAXIMAL", 0, "Maximal", "Maximal Spring lenght * Ball Size"}, + {SBC_MODE_AVG, "AVERAGE", 0, "Average", "Average Spring length * Ball Size"}, + {SBC_MODE_MIN, "MINIMAL", 0, "Minimal", "Minimal Spring length * Ball Size"}, + {SBC_MODE_MAX, "MAXIMAL", 0, "Maximal", "Maximal Spring length * Ball Size"}, {SBC_MODE_AVGMINMAX, "MINMAX", 0, "AvMinMax", "(Min+Max)/2 * Ball Size"}, {0, NULL, 0, NULL, NULL}}; @@ -577,52 +710,62 @@ static void rna_def_softbody(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "mediafrict"); RNA_def_property_range(prop, 0.0f, 50.0f); RNA_def_property_ui_text(prop, "Friction", "General media friction for point movements"); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); prop= RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "nodemass"); RNA_def_property_range(prop, 0.0f, 50000.0f); RNA_def_property_ui_text(prop, "Mass", ""); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); prop= RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "grav"); RNA_def_property_range(prop, -10.0f, 10.0f); RNA_def_property_ui_text(prop, "Gravitation", "Apply gravitation to point movement"); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); prop= RNA_def_property(srna, "speed", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "physics_speed"); RNA_def_property_range(prop, 0.01f, 100.0f); RNA_def_property_ui_text(prop, "Speed", "Tweak timing for physics to control frequency and speed"); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); /* Goal */ - /*prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE); + prop= RNA_def_property(srna, "goal_vertex_group", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "vertgroup"); - RNA_def_property_ui_text(prop, "Vertex Group", "Use control point weight values");*/ + RNA_def_property_string_funcs(prop, "rna_SoftBodySettings_goal_vgroup_get", "rna_SoftBodySettings_goal_vgroup_length", "rna_SoftBodySettings_goal_vgroup_set"); + RNA_def_property_ui_text(prop, "Goal Vertex Group", "Control point weight values."); prop= RNA_def_property(srna, "goal_min", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "mingoal"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Goal Minimum", "Goal minimum, vertex group weights are scaled to match this range."); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); prop= RNA_def_property(srna, "goal_max", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "maxgoal"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Goal Maximum", "Goal maximum, vertex group weights are scaled to match this range."); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); prop= RNA_def_property(srna, "goal_default", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "defgoal"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Goal Default", "Default Goal (vertex target position) value, when no Vertex Group used."); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); prop= RNA_def_property(srna, "goal_spring", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "goalspring"); RNA_def_property_range(prop, 0.0f, 0.999f); RNA_def_property_ui_text(prop, "Goal Stiffness", "Goal (vertex target position) spring stiffness."); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); prop= RNA_def_property(srna, "goal_friction", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "goalfrict"); RNA_def_property_range(prop, 0.0f, 50.0f); RNA_def_property_ui_text(prop, "Goal Damping", "Goal (vertex target position) friction."); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); /* Edge Spring Settings */ @@ -630,36 +773,43 @@ static void rna_def_softbody(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "inspring"); RNA_def_property_range(prop, 0.0f, 0.999f); RNA_def_property_ui_text(prop, "Pull", "Edge spring stiffness when longer than rest length"); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); prop= RNA_def_property(srna, "push", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "inpush"); RNA_def_property_range(prop, 0.0f, 0.999f); RNA_def_property_ui_text(prop, "Push", "Edge spring stiffness when shorter than rest length"); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); prop= RNA_def_property(srna, "damp", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "infrict"); RNA_def_property_range(prop, 0.0f, 50.0f); RNA_def_property_ui_text(prop, "Damp", "Edge spring friction"); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); - prop= RNA_def_property(srna, "spring_lenght", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "spring_length", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "springpreload"); RNA_def_property_range(prop, 0.0f, 200.0f); - RNA_def_property_ui_text(prop, "SL", "Alter spring lenght to shrink/blow up (unit %) 0 to disable"); + RNA_def_property_ui_text(prop, "SL", "Alter spring length to shrink/blow up (unit %) 0 to disable"); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); prop= RNA_def_property(srna, "aero", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "aeroedge"); RNA_def_property_range(prop, 0.0f, 30000.0f); RNA_def_property_ui_text(prop, "Aero", "Make edges 'sail'"); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); prop= RNA_def_property(srna, "plastic", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "plastic"); RNA_def_property_range(prop, 0.0f, 100.0f); RNA_def_property_ui_text(prop, "Plastic", "Permanent deform"); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); prop= RNA_def_property(srna, "bending", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "secondspring"); RNA_def_property_range(prop, 0.0f, 10.0f); RNA_def_property_ui_text(prop, "Bending", "Bending Stiffness"); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); prop= RNA_def_property(srna, "shear", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "shearstiff"); @@ -672,21 +822,25 @@ static void rna_def_softbody(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "sbc_mode"); RNA_def_property_enum_items(prop, collision_type_items); RNA_def_property_ui_text(prop, "Collision Type", "Choose Collision Type"); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); prop= RNA_def_property(srna, "ball_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "colball"); RNA_def_property_range(prop, -10.0f, 10.0f); RNA_def_property_ui_text(prop, "Ball Size", "Absolute ball size or factor if not manual adjusted"); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); prop= RNA_def_property(srna, "ball_stiff", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "ballstiff"); RNA_def_property_range(prop, 0.001f, 100.0f); RNA_def_property_ui_text(prop, "Ball Size", "Ball inflating presure"); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); prop= RNA_def_property(srna, "ball_damp", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "balldamp"); RNA_def_property_range(prop, 0.001f, 1.0f); RNA_def_property_ui_text(prop, "Ball Size", "Blending to inelastic collision"); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); /* Solver */ @@ -694,30 +848,36 @@ static void rna_def_softbody(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "rklimit"); RNA_def_property_range(prop, 0.001f, 10.0f); RNA_def_property_ui_text(prop, "Error Limit", "The Runge-Kutta ODE solver error limit, low value gives more precision, high values speed"); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); prop= RNA_def_property(srna, "minstep", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "minloops"); RNA_def_property_range(prop, 0, 30000); RNA_def_property_ui_text(prop, "Min Step", "Minimal # solver steps/frame"); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); prop= RNA_def_property(srna, "maxstep", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "maxloops"); RNA_def_property_range(prop, 0, 30000); RNA_def_property_ui_text(prop, "Max Step", "Maximal # solver steps/frame"); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); prop= RNA_def_property(srna, "choke", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "choke"); RNA_def_property_range(prop, 0, 100); RNA_def_property_ui_text(prop, "Choke", "'Viscosity' inside collision target"); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); prop= RNA_def_property(srna, "fuzzy", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "fuzzyness"); RNA_def_property_range(prop, 1, 100); RNA_def_property_ui_text(prop, "Fuzzy", "Fuzzyness while on collision, high values make collsion handling faster but less stable"); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); prop= RNA_def_property(srna, "auto_step", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "solverflags", SBSO_OLDERR); RNA_def_property_ui_text(prop, "V", "Use velocities for automagic step sizes"); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); prop= RNA_def_property(srna, "diagnose", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "solverflags", SBSO_MONITOR); @@ -725,38 +885,40 @@ static void rna_def_softbody(BlenderRNA *brna) /* Flags */ - prop= RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_enabled_get", "rna_SoftBodySettings_enabled_set"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Enable", "Sets object to become soft body."); - prop= RNA_def_property(srna, "use_goal", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_use_goal_get", "rna_SoftBodySettings_use_goal_set"); RNA_def_property_ui_text(prop, "Use Goal", "Define forces for vertices to stick to animated position."); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); prop= RNA_def_property(srna, "use_edges", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_use_edges_get", "rna_SoftBodySettings_use_edges_set"); RNA_def_property_ui_text(prop, "Use Edges", "Use Edges as springs"); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); prop= RNA_def_property(srna, "stiff_quads", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_stiff_quads_get", "rna_SoftBodySettings_stiff_quads_set"); RNA_def_property_ui_text(prop, "Stiff Quads", "Adds diagonal springs on 4-gons."); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); prop= RNA_def_property(srna, "edge_collision", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_edge_collision_get", "rna_SoftBodySettings_edge_collision_set"); RNA_def_property_ui_text(prop, "Edge Collision", "Edges collide too."); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); prop= RNA_def_property(srna, "face_collision", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_face_collision_get", "rna_SoftBodySettings_face_collision_set"); RNA_def_property_ui_text(prop, "Face Collision", "Faces collide too, SLOOOOOW warning."); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); prop= RNA_def_property(srna, "new_aero", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_new_aero_get", "rna_SoftBodySettings_new_aero_set"); RNA_def_property_ui_text(prop, "N", "New aero(uses angle and length)."); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); prop= RNA_def_property(srna, "self_collision", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_self_collision_get", "rna_SoftBodySettings_self_collision_set"); RNA_def_property_ui_text(prop, "Self Collision", "Enable naive vertex ball self collision."); + RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data"); } void RNA_def_object_force(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index a4ba6ec172b..fb836a98a52 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -36,6 +36,7 @@ EnumPropertyItem region_type_items[] = { {RGN_TYPE_WINDOW, "WINDOW", 0, "Window", ""}, {RGN_TYPE_HEADER, "HEADER", 0, "Header", ""}, {RGN_TYPE_CHANNELS, "CHANNELS", 0, "Channels", ""}, + {RGN_TYPE_TOOLS, "TOOLS", 0, "Tools", ""}, {RGN_TYPE_TEMPORARY, "TEMPORARY", 0, "Temporary", ""}, {RGN_TYPE_UI, "UI", 0, "UI", ""}, {0, NULL, 0, NULL, NULL}}; diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 3df3fad3f15..363891e0f24 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -130,11 +130,11 @@ void RNA_api_ui_layout(StructRNA *srna) api_ui_item_common(func); api_ui_item_rna_common(func); - /*func= RNA_def_function(srna, "item_enumR", "uiItemEnumR"); + func= RNA_def_function(srna, "item_enumR", "uiItemEnumR_string"); api_ui_item_common(func); api_ui_item_rna_common(func); parm= RNA_def_string(func, "value", "", 0, "", "Enum property value."); - RNA_def_property_flag(parm, PROP_REQUIRED);*/ + RNA_def_property_flag(parm, PROP_REQUIRED); func= RNA_def_function(srna, "item_pointerR", "uiItemPointerR"); api_ui_item_common(func); diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 8b5ad36f349..1d18fe36ad9 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -37,7 +37,7 @@ #include "BPY_extern.h" #include "../generic/bpy_internal_import.h" // our own imports -/* external util modukes */ +/* external util modules */ #include "../generic/Mathutils.h" #include "../generic/Geometry.h" @@ -132,6 +132,21 @@ static PyObject *CreateGlobalDictionary( bContext *C ) return dict; } +/* Use this so we can include our own python bundle */ +#if 0 +wchar_t* Py_GetPath(void) +{ + int i; + static wchar_t py_path[FILE_MAXDIR] = L""; + char *dirname= BLI_gethome_folder("python"); + if(dirname) { + i= mbstowcs(py_path, dirname, FILE_MAXDIR); + printf("py path %s, %d\n", dirname, i); + } + return py_path; +} +#endif + void BPY_start_python( int argc, char **argv ) { PyThreadState *py_tstate = NULL; |