svn merge -r 22423:22450 https://svn.blender.org/svnroot/bf-blender/branches/blender2...
authorMatt Ebb <matt@mke3.net>
Sat, 15 Aug 2009 07:40:22 +0000 (07:40 +0000)
committerMatt Ebb <matt@mke3.net>
Sat, 15 Aug 2009 07:40:22 +0000 (07:40 +0000)
45 files changed:
release/ui/buttons_game.py
release/ui/buttons_physics_smoke.py
release/ui/buttons_scene.py
release/ui/buttons_texture.py
release/ui/space_info.py
release/ui/space_time.py [new file with mode: 0644]
release/ui/space_view3d_toolbar.py
source/Makefile
source/blender/blenkernel/BKE_pointcache.h
source/blender/blenkernel/BKE_unit.h
source/blender/blenkernel/intern/brush.c
source/blender/blenkernel/intern/multires.c
source/blender/blenkernel/intern/scene.c
source/blender/blenkernel/intern/unit.c
source/blender/editors/animation/anim_channels_defines.c
source/blender/editors/animation/anim_channels_edit.c
source/blender/editors/include/ED_anim_api.h
source/blender/editors/interface/interface.c
source/blender/editors/object/object_modifier.c
source/blender/editors/sculpt_paint/paint_intern.h
source/blender/editors/sculpt_paint/paint_ops.c
source/blender/editors/sculpt_paint/paint_utils.c
source/blender/editors/sculpt_paint/sculpt.c
source/blender/editors/space_graph/graph_buttons.c
source/blender/editors/space_graph/graph_draw.c
source/blender/editors/space_nla/nla_draw.c
source/blender/editors/space_outliner/outliner.c
source/blender/editors/space_time/space_time.c
source/blender/editors/space_time/time_header.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_header.c
source/blender/editors/transform/transform.c
source/blender/makesdna/DNA_brush_types.h
source/blender/makesdna/DNA_scene_types.h
source/blender/makesdna/DNA_texture_types.h
source/blender/makesdna/DNA_userdef_types.h
source/blender/makesrna/RNA_access.h
source/blender/makesrna/intern/rna_brush.c
source/blender/makesrna/intern/rna_constraint.c
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_space.c
source/blender/makesrna/intern/rna_texture.c
source/blender/makesrna/intern/rna_userdef.c
source/nan_definitions.mk

index 6d53b6a532782217601eec41f13710999af567e0..fbf1ff825348676f62430dbf7795b3302c9d6ca8 100644 (file)
@@ -143,7 +143,8 @@ class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel):
        def poll(self, context):
                ob = context.active_object
                game = ob.game
-               return (game.physics_type in ('DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC'))
+               rd = context.scene.render_data
+               return (game.physics_type in ('DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC')) and (rd.engine == 'BLENDER_GAME')
 
        def draw_header(self, context):
                layout = self.layout
index 5471030883e25054a3ed8a8c6dc9f4785500c63e..a225aedbe236f5c4ac09999ad8b384ac125d1137 100644 (file)
@@ -41,74 +41,119 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel):
                        layout.itemR(md, "smoke_type", expand=True)
                
                        if md.smoke_type == 'TYPE_DOMAIN':
-                               split = layout.split()
                                
-                               col = split.column()
-                               col.itemL(text="Behavior:")
-                               col.itemR(md.domain_settings, "alpha")
-                               col.itemR(md.domain_settings, "beta")
+                               domain = md.domain_settings
                                
-                               col.itemL(text="Resolution:")
-                               col.itemR(md.domain_settings, "maxres", text="Low")
-                               sub = col.column()
-                               sub.active = md.domain_settings.highres
-                               sub.itemR(md.domain_settings, "amplify", text="High")
-                               col.itemR(md.domain_settings, "highres", text="Use High Resolution")
+                               split = layout.split()
                                
                                col = split.column()
+                               col.itemL(text="Resolution:")
+                               col.itemR(domain, "maxres", text="Divisions")
+
                                col.itemL(text="Display:")
-                               col.itemR(md.domain_settings, "visibility")
-                               col.itemR(md.domain_settings, "color", slider=True)
+                               col.itemR(domain, "visibility", text="Resolution")
+                               col.itemR(domain, "color", slider=True)
                                sub = col.column()
-                               sub.active = md.domain_settings.highres
-                               sub.itemR(md.domain_settings, "viewhighres")
-                               
-                               layout.itemL(text="Noise Type:")
-                               layout.itemR(md.domain_settings, "noise_type", expand=True)
-                               
-                               split = layout.split()
-                               col = split.column()
-                               col.itemR(md.domain_settings, "strength")
-                               sub = split.column()
+                               sub.active = domain.highres
+                               sub.itemR(domain, "viewhighres")
                                
-                               split = layout.split()
                                col = split.column()
-                               col.itemR(md.domain_settings, "dissolve_smoke")
+                               col.itemL(text="Behavior:")
+                               col.itemR(domain, "alpha")
+                               col.itemR(domain, "beta")
+                               col.itemR(domain, "dissolve_smoke", text="Dissolve")
                                sub = col.column()
-                               sub.active = md.domain_settings.dissolve_smoke
-                               sub.itemR(md.domain_settings, "dissolve_speed")
-                               sub.itemR(md.domain_settings, "dissolve_smoke_log")
-                               
-                               split = layout.split()
+                               sub.active = domain.dissolve_smoke
+                               sub.itemR(domain, "dissolve_speed", text="Speed")
+                               sub.itemR(domain, "dissolve_smoke_log", text="Slow")
                                
-                               col = split.column()
-                               col.itemL(text="Flow Group:")
-                               col.itemR(md.domain_settings, "fluid_group", text="")
-                               
-                               #col.itemL(text="Effector Group:")
-                               #col.itemR(md.domain_settings, "eff_group", text="")
+                       elif md.smoke_type == 'TYPE_FLOW':
                                
-                               col = split.column()
-                               col.itemL(text="Collision Group:")
-                               col.itemR(md.domain_settings, "coll_group", text="")
+                               flow = md.flow_settings
                                
-                       elif md.smoke_type == 'TYPE_FLOW':
                                split = layout.split()
                                
                                col = split.column()
-                               col.itemR(md.flow_settings, "outflow")
+                               col.itemR(flow, "outflow")
                                col.itemL(text="Particle System:")
-                               col.item_pointerR(md.flow_settings, "psys", ob, "particle_systems", text="")
+                               col.item_pointerR(flow, "psys", ob, "particle_systems", text="")
                                
                                if md.flow_settings.outflow:                            
                                        col = split.column()
                                else:
                                        col = split.column()
                                        col.itemL(text="Behavior:")
-                                       col.itemR(md.flow_settings, "temperature")
-                                       col.itemR(md.flow_settings, "density")
+                                       col.itemR(flow, "temperature")
+                                       col.itemR(flow, "density")
                                        
                        #elif md.smoke_type == 'TYPE_COLL':
                        #       layout.itemS()
+                       
+class PHYSICS_PT_smoke_highres(PhysicButtonsPanel):
+       __label__ = "Smoke High Resolution"
+       __default_closed__ = True
+       
+       def poll(self, context):
+               md = context.smoke
+               if md:
+                               return (md.smoke_type == 'TYPE_DOMAIN')
+               
+               return False
+
+       def draw_header(self, context):
+               layout = self.layout
+               
+               high = context.smoke.domain_settings
+       
+               layout.itemR(high, "highres", text="")
+               
+       def draw(self, context):
+               layout = self.layout
+               
+               high = context.smoke.domain_settings
+               
+               layout.active = high.highres
+               
+               split = layout.split()
+               
+               col = split.column()
+               col.itemL(text="Resolution:")
+               col.itemR(high, "amplify", text="Divisions")
+               
+               sub = split.column()
+               sub.itemL(text="Noise Method:")
+               sub.row().itemR(high, "noise_type", text="")
+               sub.itemR(high, "strength")
+                       
+class PHYSICS_PT_smoke_groups(PhysicButtonsPanel):
+       __label__ = "Smoke Groups"
+       __default_closed__ = True
+       
+       def poll(self, context):
+               md = context.smoke
+               if md:
+                               return (md.smoke_type == 'TYPE_DOMAIN')
+               
+               return False
+
+       def draw(self, context):
+               layout = self.layout
+               
+               group = context.smoke.domain_settings
+               
+               split = layout.split()
+               
+               col = split.column()
+               col.itemL(text="Flow Group:")
+               col.itemR(group, "fluid_group", text="")
+                               
+               #col.itemL(text="Effector Group:")
+               #col.itemR(group, "eff_group", text="")
+                               
+               col = split.column()
+               col.itemL(text="Collision Group:")
+               col.itemR(group, "coll_group", text="")
 
-bpy.types.register(PHYSICS_PT_smoke)
\ No newline at end of file
+bpy.types.register(PHYSICS_PT_smoke)
+bpy.types.register(PHYSICS_PT_smoke_highres)
+bpy.types.register(PHYSICS_PT_smoke_groups)
\ No newline at end of file
index d5ae95a2fb66d37ab9b561161c991fee1168af01..514524ceea5f46551f15dffb57d76d902c502596 100644 (file)
@@ -428,6 +428,25 @@ class SCENE_PT_stamp(RenderButtonsPanel):
                sub.active = rd.stamp_note
                sub.itemR(rd, "stamp_note_text", text="")
 
+class SCENE_PT_unit(RenderButtonsPanel):
+       __label__ = "Units"
+       __default_closed__ = True
+       COMPAT_ENGINES = set(['BLENDER_RENDER'])
+
+       def draw(self, context):
+               layout = self.layout
+               
+               unit = context.scene.unit_settings
+               
+               col = layout.column()
+               col.itemR(unit, "system")
+               
+               col = layout.column()
+               col.active = (unit.system != 'NONE')
+               col.itemR(unit, "scale_length")
+               col.itemR(unit, "use_separate")
+
+
 bpy.types.register(SCENE_PT_render)
 bpy.types.register(SCENE_PT_layers)
 bpy.types.register(SCENE_PT_dimensions)
@@ -438,3 +457,4 @@ bpy.types.register(SCENE_PT_encoding)
 bpy.types.register(SCENE_PT_performance)
 bpy.types.register(SCENE_PT_post_processing)
 bpy.types.register(SCENE_PT_stamp)
+bpy.types.register(SCENE_PT_unit)
index afc4825b15fc72dd2f48914eb86dfc5c9099f0c8..5998eca870af1b02c156eb9b63f46df14e7771f3 100644 (file)
@@ -137,9 +137,20 @@ class TEXTURE_PT_mapping(TextureButtonsPanel):
                        row.itemR(tex, "y_mapping", text="")
                        row.itemR(tex, "z_mapping", text="")
 
-               row = layout.row()
-               row.column().itemR(tex, "offset")
-               row.column().itemR(tex, "size")
+               if br:
+                       layout.itemR(tex, "brush_map_mode", expand=True)
+                       
+                       row = layout.row()
+                       row.active = tex.brush_map_mode in ('FIXED', 'TILED')
+                       row.itemR(tex, "angle")
+
+                       row = layout.row()
+                       row.active = tex.brush_map_mode in ('TILED', '3D')
+                       row.column().itemR(tex, "size")
+               else:
+                       row = layout.row()
+                       row.column().itemR(tex, "offset")
+                       row.column().itemR(tex, "size")
 
 class TEXTURE_PT_influence(TextureButtonsPanel):
        __label__ = "Influence"
index fde443f50f6149a40203fbfa3a768fe5b9379051..f07234a4b0038a0014c03b1efd73d77ad10db8a9 100644 (file)
@@ -320,17 +320,6 @@ class INFO_PT_edit(bpy.types.Panel):
                sub1.itemS()
                sub1.itemL(text="Transform:")
                sub1.itemR(edit, "drag_immediately")
-               sub1.itemS()
-               sub1.itemS()
-               sub1.itemS()
-               
-               sub1.itemL(text="Units:")
-               sub1.itemR(edit, "unit_system")
-               
-               sub2 = sub1.column()
-               sub2.active = (edit.unit_system != 'NONE')
-               sub2.itemR(edit, "unit_scale_length")
-               sub2.itemR(edit, "use_unit_split")
 
                col = split.column()
                sub = col.split(percentage=0.85)
diff --git a/release/ui/space_time.py b/release/ui/space_time.py
new file mode 100644 (file)
index 0000000..7d15a1c
--- /dev/null
@@ -0,0 +1,109 @@
+
+import bpy
+
+class TIME_HT_header(bpy.types.Header):
+       __space_type__ = "TIMELINE"
+
+       def draw(self, context):
+               layout = self.layout
+               
+               st = context.space_data
+               scene = context.scene
+
+               layout.template_header()
+
+               if context.area.show_menus:
+                       row = layout.row()
+                       #row.itemM("TIME_MT_view")
+                       row.itemM("TIME_MT_frame")
+                       row.itemM("TIME_MT_playback")
+
+               layout.itemR(scene, "use_preview_range", text="PR", toggle=True)
+               
+               layout.itemS()
+               
+               row = layout.row(align=True)
+               if not scene.use_preview_range:
+                       row.itemR(scene, "start_frame", text="Start")
+                       row.itemR(scene, "end_frame", text="End")
+               else:
+                       row.itemR(scene, "preview_range_start_frame", text="Start")
+                       row.itemR(scene, "preview_range_end_frame", text="End")
+               
+               layout.itemS()
+               layout.itemR(scene, "current_frame")
+               
+               layout.itemS()
+               
+               # XXX: Pause Button
+               row = layout.row(align=True)
+               row.itemO("screen.frame_jump", text="", icon='ICON_REW')
+               row.itemO("screen.keyframe_jump", text="", icon='ICON_PREV_KEYFRAME')
+               row.item_booleanO("screen.animation_play", "reverse", True, text="", icon='ICON_PLAY_REVERSE')
+               row.itemO("screen.animation_play", text="", icon='ICON_PLAY')
+               row.item_booleanO("screen.keyframe_jump", "next", True, text="", icon='ICON_NEXT_KEYFRAME')
+               row.item_booleanO("screen.frame_jump", "end", True, text="", icon='ICON_FF')
+
+               layout.itemR(scene, "active_keyingset")
+               
+               row = layout.row(align=True)
+               row.itemO("anim.insert_keyframe", text="", icon="ICON_KEY_HLT")
+               row.itemO("anim.delete_keyframe", text="", icon="ICON_KEY_DEHLT")
+
+"""
+class TIME_MT_view(bpy.types.Menu):
+       __space_type__ = "TIMELINE"
+       __label__ = "View"
+
+       def draw(self, context):
+               layout = self.layout
+               
+               st = context.space_data
+
+"""
+
+class TIME_MT_frame(bpy.types.Menu):
+       __space_type__ = "TIMELINE"
+       __label__ = "Frame"
+
+       def draw(self, context):
+               layout = self.layout
+               
+               layout.itemO("marker.add", text="Add Marker")
+               layout.itemO("marker.duplicate", text="Duplicate Marker")
+               layout.itemO("marker.move", text="Grab/Move Marker")
+               layout.itemO("marker.delete", text="Delete Marker")
+               layout.itemL(text="ToDo: Name Marker")
+               
+               layout.itemS()
+               
+               layout.itemO("time.start_frame_set")
+               layout.itemO("time.end_frame_set")
+
+
+class TIME_MT_playback(bpy.types.Menu):
+       __space_type__ = "TIMELINE"
+       __label__ = "Playback"
+
+       def draw(self, context):
+               layout = self.layout
+               
+               st = context.space_data
+               time = st.XXX #ToDo
+               
+               layout.itemR(time, "play_top_left")
+               layout.itemR(time, "play_all_3d")
+               layout.itemR(time, "play_anim")
+               layout.itemR(time, "play_buttons")
+               layout.itemR(time, "play_image")
+               layout.itemR(time, "play_sequencer")
+               
+               layout.itemS()
+               
+               layout.itemR(time, "continue_physics")
+
+
+bpy.types.register(TIME_HT_header)
+#bpy.types.register(TIME_MT_view)
+bpy.types.register(TIME_MT_frame)
+bpy.types.register(TIME_MT_playback)
index 6edf57c7f582181218968ef003f9ca01c8aad506..53534de52abb725ff37618ad6043974873d48446 100644 (file)
@@ -460,6 +460,7 @@ class VIEW3D_PT_tools_brush_curve(PaintPanel):
                layout = self.layout
 
                layout.template_curve_mapping(brush.curve)
+               layout.item_menu_enumO("brush.curve_preset", property="shape")
                
 class VIEW3D_PT_sculpt_options(PaintPanel):
        __label__ = "Options"
index aa226d2766864e1862358b9dcf79bdedf3271a56..588ffe0bbb6b8746800f71f89787f680cdb7ecab 100644 (file)
@@ -109,7 +109,7 @@ COMLIB += $(OCGDIR)/blender/blenfont/$(DEBUG_DIR)libblenfont.a
 COMLIB += $(NAN_AUDASPACE)/lib/$(DEBUG_DIR)libaudaspace.a
 COMLIB += $(NAN_AUDASPACE)/lib/$(DEBUG_DIR)libaud_src.a
 COMLIB += $(NAN_AUDASPACE)/lib/$(DEBUG_DIR)libaud_fx.a
-COMLIB += $(LCGDIR)/samplerate/lib/libsamplerate.a
+COMLIB += $(NAN_SAMPLERATE)/lib/libsamplerate.a
 
 ifneq ($(NAN_NO_KETSJI),true)
     COMLIB += $(OCGDIR)/gameengine/bloutines/$(DEBUG_DIR)libbloutines.a
index 011cde9f297e3e31bf27ded9c14f33dfaee62f4b..b83afb6b28fb7ea651f4b16d5354243709b37348 100644 (file)
@@ -71,6 +71,7 @@ struct Object;
 struct Scene;
 struct SoftBody;
 struct ParticleSystem;
+struct ParticleKey;
 struct ClothModifierData;
 struct PointCache;
 struct ListBase;
index df29971867387e4d1f7afc4d6a1c44c90aa9d754..54d5bba057af80ffe5d720192c405d1bc1386c7c 100644 (file)
@@ -31,10 +31,10 @@ extern "C" {
 /* in all cases the value is assumed to be scaled by the user preference */
 
 /* humanly readable representation of a value in units (used for button drawing) */
-void   bUnit_AsString(char *str, double value, int prec, int system, int type, int split, int pad);
+void   bUnit_AsString(char *str, int len_max, double value, int prec, int system, int type, int split, int pad);
 
 /* replace units with values, used before python button evaluation */
-int            bUnit_ReplaceString(char *str, char *str_orig, char *str_prev, double scale_pref, int system, int type);
+int            bUnit_ReplaceString(char *str, int len_max, char *str_prev, double scale_pref, int system, int type);
 
 /* the size of the unit used for this value (used for calculating the ckickstep) */
 double bUnit_ClosestScalar(double value, int system, int type);
index 30a35cbe91c76608211389e6fcb636bcb1cb8f52..5dbef017f9d819ddee03cce9dc4738366ba3fefb 100644 (file)
@@ -300,6 +300,13 @@ void brush_curve_preset(Brush *b, BrushCurvePreset preset)
        curvemapping_changed(b->curve, 0);
 }
 
+static MTex *brush_active_texture(Brush *brush)
+{
+       if(brush && brush->texact >= 0)
+               return brush->mtex[brush->texact];
+       return NULL;
+}
+
 int brush_texture_set_nr(Brush *brush, int nr)
 {
        ID *idtest, *id=NULL;
@@ -1077,8 +1084,11 @@ void brush_radial_control_invoke(wmOperator *op, Brush *br, float size_weight)
                original_value = br->size * size_weight;
        else if(mode == WM_RADIALCONTROL_STRENGTH)
                original_value = br->alpha;
-       else if(mode == WM_RADIALCONTROL_ANGLE)
-               original_value = br->rot;
+       else if(mode == WM_RADIALCONTROL_ANGLE) {
+               MTex *mtex = brush_active_texture(br);
+               if(mtex)
+                       original_value = mtex->rot;
+       }
 
        RNA_float_set(op->ptr, "initial_value", original_value);
        op->customdata = brush_gen_radial_control_imbuf(br);
@@ -1094,8 +1104,11 @@ int brush_radial_control_exec(wmOperator *op, Brush *br, float size_weight)
                br->size = new_value * size_weight;
        else if(mode == WM_RADIALCONTROL_STRENGTH)
                br->alpha = new_value;
-       else if(mode == WM_RADIALCONTROL_ANGLE)
-               br->rot = new_value * conv;
+       else if(mode == WM_RADIALCONTROL_ANGLE) {
+               MTex *mtex = brush_active_texture(br);
+               if(mtex)
+                       mtex->rot = new_value * conv;
+       }
 
        return OPERATOR_FINISHED;
 }
index 22a471f65219c49481fcd792962b167925966e81..e91f318adadb60afa04b0fc5b8e57d5600695579 100644 (file)
@@ -220,6 +220,7 @@ static void multires_subdisp(DerivedMesh *orig, Mesh *me, DerivedMesh *final, in
        int skip = multires_side_tot[totlvl - lvl] - 1;
        int i, j, k;
 
+       memset(&mmd_sub, 0, sizeof(MultiresModifierData));
        mmd_sub.lvl = mmd_sub.totlvl = totlvl;
        mrdm = multires_dm_create_from_derived(&mmd_sub, orig, me, 0, 0);
                
@@ -465,6 +466,7 @@ void multiresModifier_subdivide(MultiresModifierData *mmd, Object *ob, int dista
                MultiresModifierData mmd_sub;
 
                orig = CDDM_from_mesh(me, NULL);
+               memset(&mmd_sub, 0, sizeof(MultiresModifierData));
                mmd_sub.lvl = mmd_sub.totlvl = mmd->lvl;
                mrdm = multires_dm_create_from_derived(&mmd_sub, orig, me, 0, 0);
                totsubvert = mrdm->getNumVerts(mrdm);
index 0a93874f24ef1571ee6e16f73c71c740c729f8e7..0e987850acda3e23fe902a9c20e0096750874b74 100644 (file)
@@ -280,6 +280,9 @@ Scene *add_scene(char *name)
 
        sce->toolsettings->proportional_size = 1.0f;
 
+
+       sce->unit.scale_length = 1.0f;
+
        pset= &sce->toolsettings->particle;
        pset->flag= PE_KEEP_LENGTHS|PE_LOCK_FIRST|PE_DEFLECT_EMITTER;
        pset->emitterdist= 0.25f;
index 8c63a8756a4d082d4e61e36b9c1159ef684641b2..ba609fc5611a78eb29374e199e6a965e0007c857 100644 (file)
 #include <string.h>
 #include <math.h>
 
+#if defined(WIN32) && (!(defined snprintf))
+#define snprintf _snprintf
+#endif
+
+#define TEMP_STR_SIZE 256
+
 /* define a single unit */
 typedef struct bUnitDef {
        char *name;
@@ -82,13 +88,14 @@ static struct bUnitCollection buMetricLenCollecton = {buMetricLenDef, 3, 0, size
 static struct bUnitDef buImperialLenDef[] = {
        {"mile", "Miles",                               "mi", "m",      1609.344, 0.0,  B_UNIT_DEF_NONE},
        {"furlong", "Furlongs",                 "fur", NULL,201.168, 0.0,       B_UNIT_DEF_SUPPRESS},
+       {"chain", "Chains",                             "ch", NULL,     0.9144*22.0, 0.0,       B_UNIT_DEF_SUPPRESS},
        {"yard", "Yards",                               "yd", NULL,     0.9144, 0.0,    B_UNIT_DEF_NONE},
        {"foot", "Feet",                                "'", "ft",      0.3048, 0.0,    B_UNIT_DEF_NONE},
        {"inch", "Inches",                              "\"", "in",     0.0254, 0.0,    B_UNIT_DEF_NONE}, /* base unit */
        {"thou", "Thous",                               "mil", NULL,0.0000254, 0.0,     B_UNIT_DEF_NONE},
        {NULL, NULL, NULL, NULL, 0.0, 0.0}
 };
-static struct bUnitCollection buImperialLenCollecton = {buImperialLenDef, 3, 0, sizeof(buImperialLenDef)/sizeof(bUnitDef)};
+static struct bUnitCollection buImperialLenCollecton = {buImperialLenDef, 4, 0, sizeof(buImperialLenDef)/sizeof(bUnitDef)};
 
 
 /* Time */
@@ -155,7 +162,7 @@ static void unit_dual_convert(double value, bUnitCollection *usys,
        *unit_b=        unit_best_fit(*value_b, usys, *unit_a, 1);
 }
 
-static int unit_as_string(char *str, double value, int prec, bUnitCollection *usys,
+static int unit_as_string(char *str, int len_max, double value, int prec, bUnitCollection *usys,
                /* non exposed options */
                bUnitDef *unit, char pad)
 {
@@ -177,32 +184,33 @@ static int unit_as_string(char *str, double value, int prec, bUnitCollection *us
 
        /* Convert to a string */
        {
-               char conv_str[5] = {'%', '.', '0'+prec, 'f', '\0'}; /* "%.2f" when prec is 2, must be under 10 */
-               len= sprintf(str, conv_str, (float)value_conv);
+               char conv_str[6] = {'%', '.', '0'+prec, 'l', 'f', '\0'}; /* "%.2lf" when prec is 2, must be under 10 */
+               len= snprintf(str, len_max, conv_str, (float)value_conv);
+
+               if(len >= len_max)
+                       len= len_max;
        }
        
-       
        /* Add unit prefix and strip zeros */
-       {
-               /* replace trailing zero's with spaces 
-                * so the number is less complicated but allignment in a button wont
-                * jump about while dragging */
-               int j;
-               i= len-1;
 
+       /* replace trailing zero's with spaces
+        * so the number is less complicated but allignment in a button wont
+        * jump about while dragging */
+       i= len-1;
+
+       while(i>0 && str[i]=='0') { /* 4.300 -> 4.3 */
+               str[i--]= pad;
+       }
+
+       if(i>0 && str[i]=='.') { /* 10. -> 10 */
+               str[i--]= pad;
+       }
        
-               while(i>0 && str[i]=='0') { /* 4.300 -> 4.3 */
-                       str[i--]= pad;
-               }
-               
-               if(i>0 && str[i]=='.') { /* 10. -> 10 */
-                       str[i--]= pad;
-               }
-               
-               /* Now add the suffix */
+       /* Now add the suffix */
+       if(i<len_max) {
+               int j=0;
                i++;
-               j=0;
-               while(unit->name_short[j]) {
+               while(unit->name_short[j] && (i < len_max)) {
                        str[i++]= unit->name_short[j++];
                }
 
@@ -211,21 +219,23 @@ static int unit_as_string(char *str, double value, int prec, bUnitCollection *us
                         * the unit name only used padded chars,
                         * In that case add padding for the name. */
 
-                       while(i<=len+j) {
+                       while(i<=len+j && (i < len_max)) {
                                str[i++]= pad;
                        }
                }
-               
-               /* terminate no matter whats done with padding above */
-               str[i] = '\0';
        }
 
+       /* terminate no matter whats done with padding above */
+       if(i >= len_max)
+               i= len_max-1;
+
+       str[i] = '\0';
        return i;
 }
 
 
 /* Used for drawing number buttons, try keep fast */
-void bUnit_AsString(char *str, double value, int prec, int system, int type, int split, int pad)
+void bUnit_AsString(char *str, int len_max, double value, int prec, int system, int type, int split, int pad)
 {
        bUnitCollection *usys = unit_get_system(system, type);
 
@@ -241,56 +251,111 @@ void bUnit_AsString(char *str, double value, int prec, int system, int type, int
 
                /* check the 2 is a smaller unit */
                if(unit_b > unit_a) {
-                       i= unit_as_string(str, value_a, prec, usys,  unit_a, '\0');
-                       str[i++]= ',';
-                       str[i++]= ' ';
+                       i= unit_as_string(str, len_max, value_a, prec, usys,  unit_a, '\0');
+
+                       /* is there enough space for at least 1 char of the next unit? */
+                       if(i+3 < len_max) {
+                               str[i++]= ',';
+                               str[i++]= ' ';
 
-                       /* use low precision since this is a smaller unit */
-                       unit_as_string(str+i, value_b, prec?1:0, usys,  unit_b, '\0');
+                               /* use low precision since this is a smaller unit */
+                               unit_as_string(str+i, len_max-i, value_b, prec?1:0, usys,  unit_b, '\0');
+                       }
                        return;
                }
        }
 
-       unit_as_string(str, value, prec, usys,    NULL, pad?' ':'\0');
+       unit_as_string(str, len_max, value, prec, usys,    NULL, pad?' ':'\0');
 }
 
 
-static int unit_scale_str(char *str, char *str_tmp, double scale_pref, bUnitDef *unit, char *replace_str)
+static char *unit_find_str(char *str, char *substr)
 {
        char *str_found;
-       int change= 0;
 
-       if(replace_str==NULL || replace_str[0] == '\0')
-               return 0;
+       if(substr && substr[0] != '\0') {
+               str_found= strstr(str, substr);
+               if(str_found) {
+                       /* previous char cannot be a letter */
+                       if (str_found == str || isalpha(*(str_found-1))==0) {
+                               /* next char cannot be alphanum */
+                               int len_name = strlen(substr);
 
-       if((str_found= strstr(str, replace_str))) {
-               /* previous char cannot be a letter */
-               if (str_found == str || isalpha(*(str_found-1))==0) {
-                       int len_name = strlen(replace_str);
-
-                       /* next char cannot be alphanum */
-                       if (!isalpha(*(str_found+len_name))) {
-                               int len= strlen(str);
-                               int len_num= sprintf(str_tmp, "*%g", unit->scalar/scale_pref);
-                               memmove(str_found+len_num, str_found+len_name, (len+1)-(int)((str_found+len_name)-str)); /* may grow or shrink the string, 1+ to copy the string terminator */
-                               memcpy(str_found, str_tmp, len_num); /* without the string terminator */
-                               change= 1;
+                               if (!isalpha(*(str_found+len_name))) {
+                                       return str_found;
+                               }
                        }
                }
+
        }
-       return change;
+       return NULL;
+
 }
 
-static int unit_replace(char *str, char *str_tmp, double scale_pref, bUnitDef *unit)
+static int unit_scale_str(char *str, int len_max, char *str_tmp, double scale_pref, bUnitDef *unit, char *replace_str)
+{
+       char *str_found= unit_find_str(str, replace_str);
+
+       if(str_found) { /* XXX - investigate, does not respect len_max properly  */
+               int len, len_num, len_name, len_move, found_ofs;
+
+               found_ofs = (int)(str_found-str);
+
+               len= strlen(str);
+
+               len_name = strlen(replace_str);
+               len_move= (len - (found_ofs+len_name)) + 1; /* 1+ to copy the string terminator */
+               len_num= snprintf(str_tmp, TEMP_STR_SIZE, "*%lg", unit->scalar/scale_pref);
+
+               if(len_num > len_max)
+                       len_num= len_max;
+
+               if(found_ofs+len_num+len_move > len_max) {
+                       /* can't move the whole string, move just as much as will fit */
+                       len_move -= (found_ofs+len_num+len_move) - len_max;
+               }
+
+               if(len_move>0) {
+                       /* resize the last part of the string */
+                       memmove(str_found+len_num, str_found+len_name, len_move); /* may grow or shrink the string */
+               }
+
+               if(found_ofs+len_num > len_max) {
+                       /* not even the number will fit into the string, only copy part of it */
+                       len_num -= (found_ofs+len_num) - len_max;
+               }
+
+               if(len_num > 0) {
+                       /* its possible none of the number could be copied in */
+                       memcpy(str_found, str_tmp, len_num); /* without the string terminator */
+               }
+
+               str[len_max-1]= '\0'; /* since the null terminator wont be moved */
+               return 1;
+       }
+       return 0;
+}
+
+static int unit_replace(char *str, int len_max, char *str_tmp, double scale_pref, bUnitDef *unit)
 {      
        int change= 0;
-       change |= unit_scale_str(str, str_tmp, scale_pref, unit, unit->name_short);
-       change |= unit_scale_str(str, str_tmp, scale_pref, unit, unit->name_plural);
-       change |= unit_scale_str(str, str_tmp, scale_pref, unit, unit->name_alt);
-       change |= unit_scale_str(str, str_tmp, scale_pref, unit, unit->name);
+       change |= unit_scale_str(str, len_max, str_tmp, scale_pref, unit, unit->name_short);
+       change |= unit_scale_str(str, len_max, str_tmp, scale_pref, unit, unit->name_plural);
+       change |= unit_scale_str(str, len_max, str_tmp, scale_pref, unit, unit->name_alt);
+       change |= unit_scale_str(str, len_max, str_tmp, scale_pref, unit, unit->name);
        return change;
 }
 
+static int unit_find(char *str, bUnitDef *unit)
+{
+       if (unit_find_str(str, unit->name_short))       return 1;
+       if (unit_find_str(str, unit->name_plural))      return 1;
+       if (unit_find_str(str, unit->name_alt))         return 1;
+       if (unit_find_str(str, unit->name))                     return 1;
+
+       return 0;
+}
+
 /* make a copy of the string that replaces the units with numbers
  * this is used before parsing
  * This is only used when evaluating user input and can afford to be a bit slower
@@ -303,15 +368,13 @@ static int unit_replace(char *str, char *str_tmp, double scale_pref, bUnitDef *u
  *
  * return true of a change was made.
  */
-int bUnit_ReplaceString(char *str, char *str_orig, char *str_prev, double scale_pref, int system, int type)
+int bUnit_ReplaceString(char *str, int len_max, char *str_prev, double scale_pref, int system, int type)
 {
        bUnitCollection *usys = unit_get_system(system, type);
 
        bUnitDef *unit;
-       char str_tmp[256];
+       char str_tmp[TEMP_STR_SIZE];
        int change= 0;
-       
-       strcpy(str, str_orig);
 
        if(usys==NULL || usys->units[0].name==NULL) {
                return 0;
@@ -323,7 +386,7 @@ int bUnit_ReplaceString(char *str, char *str_orig, char *str_prev, double scale_
                        continue;
 
                /* incase there are multiple instances */
-               while(unit_replace(str, str_tmp, scale_pref, unit))
+               while(unit_replace(str, len_max, str_tmp, scale_pref, unit))
                        change= 1;
        }
        unit= NULL;
@@ -342,7 +405,7 @@ int bUnit_ReplaceString(char *str, char *str_orig, char *str_prev, double scale_
                                                continue;
 
                                        /* incase there are multiple instances */
-                                       while(unit_replace(str, str_tmp, scale_pref, unit))
+                                       while(unit_replace(str, len_max, str_tmp, scale_pref, unit))
                                                change= 1;
                                }
                        }
@@ -354,25 +417,24 @@ int bUnit_ReplaceString(char *str, char *str_orig, char *str_prev, double scale_
                /* no units given so infer a unit from the previous string or default */
                if(str_prev) {
                        /* see which units the original value had */
-                       strcpy(str, str_prev); /* temp overwrite */
                        for(unit= usys->units; unit->name; unit++) {
 
                                if(unit->flag & B_UNIT_DEF_SUPPRESS)
                                        continue;
 
-                               if (unit_replace(str, str_tmp, scale_pref, unit))
+                               if (unit_find(str_prev, unit))
                                        break;
                        }
-                       strcpy(str, str_orig); /* temp overwrite */
                }
 
                if(unit==NULL)
                        unit= unit_default(usys);
 
                /* add the unit prefic and re-run */
-               sprintf(str_tmp, "%s %s", str, unit->name);
+               snprintf(str_tmp, sizeof(str_tmp), "%s %s", str, unit->name);
+               strncpy(str, str_tmp, len_max);
 
-               return bUnit_ReplaceString(str, str_tmp, NULL, scale_pref, system, type);
+               return bUnit_ReplaceString(str, len_max, NULL, scale_pref, system, type);
        }
 
        // printf("replace %s\n", str);
index 879296c58b82ef77d51a09cc5e5f388843b0fe2e..32bda94f79696f6eda0ed137365d74511439a02d 100644 (file)
@@ -1874,10 +1874,10 @@ void ANIM_channel_draw (bAnimContext *ac, bAnimListElem *ale, float yminc, float
                                glColor3fv(fcu->color);
                                
                                /* just a solid color rect
-                                *      hardcoded 18 pixels width is slightly wider than icon width, so that 
+                                *      hardcoded 17 pixels width is slightly wider than icon width, so that 
                                 *      there's a slight border around it 
                                 */
-                               glRectf(offset, yminc, offset+18, ymaxc);
+                               glRectf(offset, yminc, offset+17, ymaxc);
                        }
                        
                        /* finally the icon itself */
@@ -1913,34 +1913,35 @@ void ANIM_channel_draw (bAnimContext *ac, bAnimListElem *ale, float yminc, float
                UI_DrawString(offset, ytext, name);
        }
        
-       /* step 6) draw mute+protection toggles ............................. */
+       /* step 6) draw mute+protection toggles + (sliders) ....................... */
        /* reset offset - now goes from RHS of panel */
        offset = 0;
        
        // TODO: we need a mechanism of drawing over (and hiding) stuff from here...
+       // TODO: when drawing sliders, make those draw instead of these toggles if not enough space
        
-       /* set blending again, as text drawing may clear it */
-       glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-       glEnable(GL_BLEND);
-       
-       /* protect... */
-       // XXX v2d might not be valid
-       if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PROTECT)) {
-               enabled= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_PROTECT);
+       if (v2d) {
+               /* set blending again, as text drawing may clear it */
+               glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+               glEnable(GL_BLEND);
                
-               offset += ICON_WIDTH;
-               UI_icon_draw(v2d->cur.xmax-(float)offset, ymid, ((enabled)? ICON_LOCKED : ICON_UNLOCKED));
-       }
-       /* mute... */
-       // XXX v2d might not be valid
-       if (acf->has_setting(ac, ale, ACHANNEL_SETTING_MUTE)) {
-               enabled= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_MUTE);
+               /* protect... */
+               if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PROTECT)) {
+                       enabled= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_PROTECT);
+                       
+                       offset += ICON_WIDTH;
+                       UI_icon_draw(v2d->cur.xmax-(float)offset, ymid, ((enabled)? ICON_LOCKED : ICON_UNLOCKED));
+               }
+               /* mute... */
+               if (acf->has_setting(ac, ale, ACHANNEL_SETTING_MUTE)) {
+                       enabled= ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_MUTE);
+                       
+                       offset += ICON_WIDTH; 
+                       UI_icon_draw(v2d->cur.xmax-(float)offset, ymid, ((enabled)? ICON_MUTE_IPO_ON : ICON_MUTE_IPO_OFF));
+               }
                
-               offset += ICON_WIDTH; 
-               UI_icon_draw(v2d->cur.xmax-(float)offset, ymid, ((enabled)? ICON_MUTE_IPO_ON : ICON_MUTE_IPO_OFF));
+               glDisable(GL_BLEND); /* End of blending with background */
        }
-       
-       glDisable(GL_BLEND); /* End of blending with background */
 }
 
 /* *********************************************** */
index d74c9fbf48becc81925a16e45b87de64e4316cf3..4f463d3daedd191d17acbd018bf3e8ea0b93edc7 100644 (file)
@@ -1193,47 +1193,19 @@ static void borderselect_anim_channels (bAnimContext *ac, rcti *rect, short sele
                
                /* if channel is within border-select region, alter it */
                if (!((ymax < rectf.ymin) || (ymin > rectf.ymax))) {
-                       /* only the following types can be selected */
+                       /* set selection flags only */
+                       ANIM_channel_setting_set(ac, ale, ACHANNEL_SETTING_SELECT, selectmode);
+                       
+                       /* type specific actions */
                        switch (ale->type) {
-                               case ANIMTYPE_OBJECT: /* object */
-                               {
-                                       Base *base= (Base *)ale->data;
-                                       Object *ob= base->object;
-                                       
-                                       ACHANNEL_SET_FLAG(base, selectmode, SELECT);
-                                       ACHANNEL_SET_FLAG(ob, selectmode, SELECT);
-                               }
-                                       break;
-                               case ANIMTYPE_GROUP: /* action group */
+                               case ANIMTYPE_GROUP:
                                {
                                        bActionGroup *agrp= (bActionGroup *)ale->data;
                                        
-                                       ACHANNEL_SET_FLAG(agrp, selectmode, AGRP_SELECTED);
+                                       /* always clear active flag after doing this */
                                        agrp->flag &= ~AGRP_ACTIVE;
                                }
                                        break;
-                               case ANIMTYPE_FCURVE: /* F-Curve channel */
-                               {
-                                       FCurve *fcu = (FCurve *)ale->data;
-                                       
-                                       ACHANNEL_SET_FLAG(fcu, selectmode, FCURVE_SELECTED);
-                               }
-                                       break;
-                               case ANIMTYPE_GPLAYER: /* grease-pencil layer */
-                               {
-                                       bGPDlayer *gpl = (bGPDlayer *)ale->data;
-                                       
-                                       ACHANNEL_SET_FLAG(gpl, selectmode, GP_LAYER_SELECT);
-                               }
-                                       break;
-                                       
-                               case ANIMTYPE_NLATRACK: /* nla-track */
-                               {
-                                       NlaTrack *nlt= (NlaTrack *)ale->data;
-                                       
-                                       ACHANNEL_SET_FLAG(nlt, selectmode, NLATRACK_SELECTED);
-                               }
-                                       break;
                        }
                }
                
index d3d42deba21926bddf8708d49c168b4a020cacf8..21c5e6bbcf9eef8da034b5bc8f370cdf98e3ac38 100644 (file)
@@ -402,14 +402,16 @@ void ANIM_uiTemplate_fmodifier_draw(struct uiLayout *layout, struct ID *id, List
 /* ------------ Animation F-Curves <-> Icons/Names Mapping ------------ */
 /* anim_ipo_utils.c */
 
+/* Get icon for type of setting F-Curve is for */
+// XXX include this in the getname() method via RNA?
 int geticon_anim_blocktype(short blocktype);
 
+/* Get name for channel-list displays for F-Curve */
 void getname_anim_fcurve(char *name, struct ID *id, struct FCurve *fcu);
 
-
+/* Automatically determine a color for the nth F-Curve */
 void ipo_rainbow(int cur, int tot, float *out);
 
-
 /* ------------- NLA-Mapping ----------------------- */
 /* anim_draw.c */
 
index 2fe3ac720b6c5181ce791af8496b6609406d997a..4f6c6db3b16a5a46ae0e8c6d73992b3d4d5ebe50 100644 (file)
@@ -1144,7 +1144,8 @@ int ui_is_but_float(uiBut *but)
 
 int ui_is_but_unit(uiBut *but)
 {
-       if(U.unit_system == USER_UNIT_NONE)
+       Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
+       if(scene->unit.system == USER_UNIT_NONE)
                return 0;
 
        if(but->rnaprop==NULL)
@@ -1324,13 +1325,13 @@ int ui_get_but_string_max_length(uiBut *but)
 
 static double ui_get_but_scale_unit(uiBut *but, double value)
 {
+       Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
        int subtype= RNA_property_subtype(but->rnaprop);
 
        if(subtype & PROP_UNIT_LENGTH) {
-               return value * U.unit_scale_length;
+               return value * scene->unit.scale_length;
        }
        else if(subtype & PROP_UNIT_TIME) { /* WARNING - using evil_C :| */
-               Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
                return FRA2TIME(value);
        }
        else {
@@ -1338,25 +1339,29 @@ static double ui_get_but_scale_unit(uiBut *but, double value)
        }
 }
 
-static void ui_get_but_string_unit(uiBut *but, char *str, double value, int pad)
+static void ui_get_but_string_unit(uiBut *but, char *str, int len_max, double value, int pad)
 {
-       int do_split= U.unit_flag & USER_UNIT_OPT_SPLIT ? 1:0;
+       Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
+       int do_split= scene->unit.flag & USER_UNIT_OPT_SPLIT;
        int unit_type=  RNA_SUBTYPE_UNIT_VALUE(RNA_property_subtype(but->rnaprop));
        int precission= but->a2;
 
+       if(scene->unit.scale_length<0.0001) scene->unit.scale_length= 1.0; // XXX do_versions
+
        /* Sanity checks */
        if(precission>4)                precission= 4;
        else if(precission==0)  precission= 2;
 
-       bUnit_AsString(str, ui_get_but_scale_unit(but, value), precission, U.unit_system, unit_type, do_split, pad);
+       bUnit_AsString(str, len_max, ui_get_but_scale_unit(but, value), precission, scene->unit.system, unit_type, do_split, pad);
 }
 
 static float ui_get_but_step_unit(uiBut *but, double value, float step_default)
 {
+       Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
        int unit_type=  RNA_SUBTYPE_UNIT_VALUE(RNA_property_subtype(but->rnaprop));
        float step;
 
-       step = bUnit_ClosestScalar(ui_get_but_scale_unit(but, value), U.unit_system, unit_type);
+       step = bUnit_ClosestScalar(ui_get_but_scale_unit(but, value), scene->unit.system, unit_type);
 
        if(step > 0.0) { /* -1 is an error value */
                return (step/ui_get_but_scale_unit(but, 1.0))*100;
@@ -1423,7 +1428,7 @@ void ui_get_but_string(uiBut *but, char *str, int maxlen)
 
                if(ui_is_but_float(but)) {
                        if(ui_is_but_unit(but)) {
-                               ui_get_but_string_unit(but, str, value, 0);
+                               ui_get_but_string_unit(but, str, maxlen, value, 0);
                        }
                        else if(but->a2) { /* amount of digits defined */
                                if(but->a2==1) BLI_snprintf(str, maxlen, "%.1f", value);
@@ -1501,14 +1506,19 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str)
 #ifndef DISABLE_PYTHON
                {
                        char str_unit_convert[256];
-                       int unit_type=  RNA_SUBTYPE_UNIT_VALUE(RNA_property_subtype(but->rnaprop));
+                       int unit_type;
+                       Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
+
+                       if(but->rnaprop)
+                               unit_type= RNA_SUBTYPE_UNIT_VALUE(RNA_property_subtype(but->rnaprop));
+                       else
+                               unit_type= 0;
+
+                       BLI_strncpy(str_unit_convert, str, sizeof(str_unit_convert));
 
-                       if(U.unit_system != USER_UNIT_NONE && unit_type) {
+                       if(scene->unit.system != USER_UNIT_NONE && unit_type) {
                                /* ugly, use the draw string to get the value, this could cause problems if it includes some text which resolves to a unit */
-                               bUnit_ReplaceString(str_unit_convert, str, but->drawstr, ui_get_but_scale_unit(but, 1.0), U.unit_system, unit_type);
-                       }
-                       else {
-                               strcpy(str_unit_convert, str);
+                               bUnit_ReplaceString(str_unit_convert, sizeof(str_unit_convert), but->drawstr, ui_get_but_scale_unit(but, 1.0), scene->unit.system, unit_type);
                        }
 
                        if(BPY_button_eval(C, str_unit_convert, &value)) {
@@ -1864,12 +1874,9 @@ void ui_check_but(uiBut *but)
                        else if(value == -FLT_MAX) sprintf(but->drawstr, "%s-inf", but->str);
                        /* support length type buttons */
                        else if(ui_is_but_unit(but)) {
-                               char new_str[256];
-
-                               if(U.unit_scale_length<0.0001) U.unit_scale_length= 1.0; // XXX do_versions
-
-                               ui_get_but_string_unit(but, new_str, value, TRUE);
-                               sprintf(but->drawstr, "%s%s", but->str, new_str);
+                               char new_str[sizeof(but->drawstr)];
+                               ui_get_but_string_unit(but, new_str, sizeof(new_str), value, TRUE);
+                               BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%s", but->str, new_str);
                        }
                        else if(but->a2) { /* amount of digits defined */
                                if(but->a2==1) sprintf(but->drawstr, "%s%.1f", but->str, value);
index 6b9f2db0d961fdde4594f7a4feb281512183d334..1742e1d127981c5ee833f06fe08bc93d90c7f7e6 100644 (file)
@@ -640,14 +640,19 @@ static int multires_subdivide_exec(bContext *C, wmOperator *op)
        return OPERATOR_FINISHED;
 }
 
+static int multires_subdivide_poll(bContext *C)
+{
+       return NULL != CTX_data_active_object(C) && NULL == CTX_data_edit_object(C);
+}
+
 void OBJECT_OT_multires_subdivide(wmOperatorType *ot)
 {
        ot->name= "Multires Subdivide";
        ot->description= "Add a new level of subdivision.";
        ot->idname= "OBJECT_OT_multires_subdivide";
-       ot->poll= ED_operator_object_active;
 
        ot->exec= multires_subdivide_exec;
+       ot->poll= multires_subdivide_poll;
        
        /* flags */
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
index b630975c934f6e625b082d6d3016a3ba08664156..40423e17fe43bb7db681357c2de374e98c1c0a8d 100644 (file)
@@ -59,6 +59,7 @@ int imapaint_pick_face(struct ViewContext *vc, struct Mesh *me, int *mval, unsig
 void imapaint_pick_uv(struct Scene *scene, struct Object *ob, struct Mesh *mesh, unsigned int faceindex, int *xy, float *uv);
 
 void paint_sample_color(struct Scene *scene, struct ARegion *ar, int x, int y);
+void BRUSH_OT_curve_preset(struct wmOperatorType *ot);
 
 #endif /* ED_PAINT_INTERN_H */
 
index e9263ddabf0683d13f991a951fddcfbf5e4040c7..e5500960a6e8e9d217c3f2ceb8fc099f411df6e2 100644 (file)
@@ -10,6 +10,9 @@
 
 void ED_operatortypes_paint(void)
 {
+       /* brush */
+       WM_operatortype_append(BRUSH_OT_curve_preset);
+
        /* image */
        WM_operatortype_append(PAINT_OT_texture_paint_toggle);
        WM_operatortype_append(PAINT_OT_texture_paint_radial_control);
index 85ea55331dcb416f90c45d8e38818b8c34ec29da..8120e23f5f24f5447bd4519e800d4c3fbdb72bf2 100644 (file)
@@ -5,13 +5,18 @@
 #include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_object_types.h"
+
 #include "DNA_scene_types.h"
 #include "DNA_screen_types.h"
 #include "DNA_view3d_types.h"
 
+#include "RNA_access.h"
+#include "RNA_define.h"
+
 #include "BLI_arithb.h"
 
 #include "BKE_brush.h"
+#include "BKE_context.h"
 #include "BKE_DerivedMesh.h"
 #include "BKE_global.h"
 #include "BKE_utildefines.h"
@@ -20,6 +25,9 @@
 
 #include "ED_view3d.h"
 
+#include "WM_api.h"
+#include "WM_types.h"
+
 #include "paint_intern.h"
 
 /* 3D Paint */
@@ -180,3 +188,36 @@ void paint_sample_color(Scene *scene, ARegion *ar, int x, int y)   /* frontbuf */
        }
 }
 
+static int brush_curve_preset_exec(bContext *C, wmOperator *op)
+{
+       Brush *br = *current_brush_source(CTX_data_scene(C));
+       brush_curve_preset(br, RNA_enum_get(op->ptr, "shape"));
+
+       return OPERATOR_FINISHED;
+}
+
+static int brush_curve_preset_poll(bContext *C)
+{
+       Brush **br = current_brush_source(CTX_data_scene(C));
+
+       return br && *br && (*br)->curve;
+}
+
+void BRUSH_OT_curve_preset(wmOperatorType *ot)
+{
+       static EnumPropertyItem prop_shape_items[] = {
+               {BRUSH_PRESET_SHARP, "SHARP", 0, "Sharp", ""},
+               {BRUSH_PRESET_SMOOTH, "SMOOTH", 0, "Smooth", ""},
+               {BRUSH_PRESET_MAX, "MAX", 0, "Max", ""},
+               {0, NULL, 0, NULL, NULL}};
+
+       ot->name= "Preset";
+       ot->idname= "BRUSH_OT_curve_preset";
+
+       ot->exec= brush_curve_preset_exec;
+       ot->poll= brush_curve_preset_poll;
+
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+       RNA_def_enum(ot->srna, "shape", prop_shape_items, BRUSH_PRESET_SHARP, "Mode", "");
+}
index 90d2eb31355e33d14d3901f39a2681504803dfe9..bf05490b631f79838bb6b498c1146f6eead20951 100644 (file)
@@ -655,31 +655,26 @@ static float tex_strength(Sculpt *sd, float *point, const float len)
 {
        SculptSession *ss= sd->session;
        Brush *br = sd->brush;
+       MTex *tex = NULL;
        float avg= 1;
 
-       if(br->texact==-1 || !br->mtex[br->texact])
+       if(br->texact >= 0)
+               tex = br->mtex[br->texact];
+
+       if(!tex) {
                avg= 1;
-       else if(br->tex_mode==BRUSH_TEX_3D) {
-               /* Get strength by feeding the vertex location directly
-                  into a texture */
+       }
+       else if(tex->brush_map_mode == MTEX_MAP_MODE_3D) {
                float jnk;
-               const float factor= 0.01;
-               MTex mtex;
-               memset(&mtex,0,sizeof(MTex));
-               mtex.tex= br->mtex[br->texact]->tex;
-               mtex.projx= 1;
-               mtex.projy= 2;
-               mtex.projz= 3;
-               VecCopyf(mtex.size, br->mtex[br->texact]->size);
-               VecMulf(mtex.size, factor);
-               if(!sd->texsep)
-                       mtex.size[1]= mtex.size[2]= mtex.size[0];
-               
-               externtex(&mtex,point,&avg,&jnk,&jnk,&jnk,&jnk);
+
+               /* Get strength by feeding the vertex 
+                  location directly into a texture */
+               externtex(tex, point, &avg,
+                         &jnk, &jnk, &jnk, &jnk);
        }
        else if(ss->texcache) {
                const float bsize= ss->cache->pixel_radius * 2;
-               const float rot= sd->brush->rot + ss->cache->rotation;
+               const float rot= tex->rot + ss->cache->rotation;
                int px, py;
                float flip[3], point_2d[2];
 
@@ -692,9 +687,9 @@ static float tex_strength(Sculpt *sd, float *point, const float len)
 
                /* For Tile and Drag modes, get the 2D screen coordinates of the
                   and scale them up or down to the texture size. */
-               if(br->tex_mode==BRUSH_TEX_TILE) {
-                       const int sx= (const int)br->mtex[br->texact]->size[0];
-                       const int sy= (const int)sd->texsep ? br->mtex[br->texact]->size[1] : sx;
+               if(tex->brush_map_mode == MTEX_MAP_MODE_TILED) {
+                       const int sx= (const int)tex->size[0];
+                       const int sy= (const int)tex->size[1];
                        
                        float fx= point_2d[0];
                        float fy= point_2d[1];
@@ -714,7 +709,8 @@ static float tex_strength(Sculpt *sd, float *point, const float len)
                        if(sy != 1)
                                py %= sy-1;
                        avg= get_texcache_pixel_bilinear(ss, ss->texcache_side*px/sx, ss->texcache_side*py/sy);
-               } else {
+               }
+               else if(tex->brush_map_mode == MTEX_MAP_MODE_FIXED) {
                        float fx= (point_2d[0] - ss->cache->mouse[0]) / bsize;
                        float fy= (point_2d[1] - ss->cache->mouse[1]) / bsize;
 
@@ -1122,31 +1118,6 @@ static void sculpt_undo_push(bContext *C, Sculpt *sd)
        }
 }
 
-static int sculpt_brush_curve_preset_exec(bContext *C, wmOperator *op)
-{
-       brush_curve_preset(CTX_data_scene(C)->toolsettings->sculpt->brush, RNA_enum_get(op->ptr, "mode"));
-       return OPERATOR_FINISHED;
-}
-
-static void SCULPT_OT_brush_curve_preset(wmOperatorType *ot)
-{
-       static EnumPropertyItem prop_mode_items[] = {
-               {BRUSH_PRESET_SHARP, "SHARP", 0, "Sharp Curve", ""},
-               {BRUSH_PRESET_SMOOTH, "SMOOTH", 0, "Smooth Curve", ""},
-               {BRUSH_PRESET_MAX, "MAX", 0, "Max Curve", ""},
-               {0, NULL, 0, NULL, NULL}};
-
-       ot->name= "Preset";
-       ot->idname= "SCULPT_OT_brush_curve_preset";
-
-       ot->exec= sculpt_brush_curve_preset_exec;
-       ot->poll= sculpt_mode_poll;
-
-       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
-       RNA_def_enum(ot->srna, "mode", prop_mode_items, BRUSH_PRESET_SHARP, "Mode", "");
-}
-
 /**** Radial control ****/
 static int sculpt_radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
@@ -1736,6 +1707,5 @@ void ED_operatortypes_sculpt()
        WM_operatortype_append(SCULPT_OT_radial_control);
        WM_operatortype_append(SCULPT_OT_brush_stroke);
        WM_operatortype_append(SCULPT_OT_sculptmode_toggle);
-       WM_operatortype_append(SCULPT_OT_brush_curve_preset);
        WM_operatortype_append(SCULPT_OT_set_persistent_base);
 }
index 82babb70c5312b3263193d8ab4c6097113cb3809..fb995285ab7a9c37b41a147698cf7deda11b1c03 100644 (file)
@@ -160,7 +160,7 @@ static void graph_panel_properties(const bContext *C, Panel *pa)
        }
        
        getname_anim_fcurve(name, ale->id, fcu);
-       uiDefBut(block, LABEL, 1, name, 30, 180, 300, 19, NULL, 0.0, 0.0, 0, 0, "Name of Active F-Curve");
+       uiDefBut(block, LABEL, 1, name, 40, 180, 300, 19, NULL, 0.0, 0.0, 0, 0, "Name of Active F-Curve");
        
        /* TODO: the following settings could be added here
         *      - F-Curve coloring mode - mode selector + color selector
index 07918646926cade62ea4ee26ecbca89501f6b3fd..46d067d9dd21b1a0bcdad04240424cb3a3fd305d 100644 (file)
@@ -877,10 +877,6 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri
 /* ************************************************************************* */
 /* Channel List */
 
-// XXX quite a few of these need to be kept in sync with their counterparts in Action Editor
-// as they're the same. We have 2 separate copies of this for now to make it easier to develop
-// the diffences between the two editors, but one day these should be merged!
-
 /* left hand part */
 void graph_draw_channel_names(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar) 
 {
@@ -903,17 +899,6 @@ void graph_draw_channel_names(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
         *        start of list offset, and the second is as a correction for the scrollers.
         */
        height= (float)((items*ACHANNEL_STEP) + (ACHANNEL_HEIGHT*2));
-       
-#if 0
-       if (height > (v2d->mask.ymax - v2d->mask.ymin)) {
-               /* don't use totrect set, as the width stays the same 
-                * (NOTE: this is ok here, the configuration is pretty straightforward) 
-                */
-               v2d->tot.ymin= (float)(-height);
-       }
-       
-       /* XXX I would call the below line! (ton) */
-#endif
        UI_view2d_totRect_set(v2d, ar->winx, height);
        
        /* loop through channels, and set up drawing depending on their type  */        
index a7a854a727755814ec1c5166cca33bd5e25462ce..a4265af71d9340d8756aa31a7d2a98ce60d796f7 100644 (file)
@@ -633,308 +633,10 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
                        short indent= 0, offset= 0, sel= 0, group= 0;
                        int expand= -1, protect = -1, special= -1, mute = -1;
                        char name[128];
+                       short doDraw=0;
                        
                        /* determine what needs to be drawn */
                        switch (ale->type) {
-                               case ANIMTYPE_SCENE: /* scene */
-                               {
-                                       Scene *sce= (Scene *)ale->data;
-                                       AnimData *adt= ale->adt;
-                                       
-                                       group= 4;
-                                       indent= 0;
-                                       
-                                       special= ICON_SCENE_DATA;
-                                       
-                                       /* only show expand if there are any channels */
-                                       if (EXPANDED_SCEC(sce))
-                                               expand= ICON_TRIA_DOWN;
-                                       else
-                                               expand= ICON_TRIA_RIGHT;
-                                               
-                                       /* NLA evaluation on/off button */
-                                       if (adt) {
-                                               if (adt->flag & ADT_NLA_EVAL_OFF)
-                                                       mute = ICON_MUTE_IPO_ON;
-                                               else    
-                                                       mute = ICON_MUTE_IPO_OFF;
-                                       }
-                                       
-                                       sel = SEL_SCEC(sce);
-                                       strcpy(name, sce->id.name+2);
-                               }
-                                       break;
-                               case ANIMTYPE_OBJECT: /* object */
-                               {
-                                       Base *base= (Base *)ale->data;
-                                       Object *ob= base->object;
-                                       AnimData *adt= ale->adt;
-                                       
-                                       group= 4;
-                                       indent= 0;
-                                       
-                                       /* icon depends on object-type */
-                                       if (ob->type == OB_ARMATURE)
-                                               special= ICON_ARMATURE_DATA;
-                                       else    
-                                               special= ICON_OBJECT_DATA;
-                                               
-                                       /* only show expand if there are any channels */
-                                       if (EXPANDED_OBJC(ob))
-                                               expand= ICON_TRIA_DOWN;
-                                       else
-                                               expand= ICON_TRIA_RIGHT;
-                                       
-                                       /* NLA evaluation on/off button */
-                                       if (adt) {
-                                               if (adt->flag & ADT_NLA_EVAL_OFF)
-                                                       mute = ICON_MUTE_IPO_ON;
-                                               else    
-                                                       mute = ICON_MUTE_IPO_OFF;
-                                       }
-                                       
-                                       sel = SEL_OBJC(base);
-                                       strcpy(name, ob->id.name+2);
-                               }
-                                       break;
-                               case ANIMTYPE_FILLMATD: /* object materials (dopesheet) expand widget */
-                               {
-                                       Object *ob = (Object *)ale->data;
-                                       
-                                       group = 4;
-                                       indent = 1;
-                                       special = ICON_MATERIAL_DATA;
-                                       
-                                       if (FILTER_MAT_OBJC(ob))
-                                               expand = ICON_TRIA_DOWN;
-                                       else
-                                               expand = ICON_TRIA_RIGHT;
-                                               
-                                       strcpy(name, "Materials");
-                               }
-                                       break;
-                               case ANIMTYPE_FILLPARTD: /* object particles (dopesheet) expand widget */
-                               {
-                                       Object *ob = (Object *)ale->data;
-                                       
-                                       group = 4;
-                                       indent = 1;
-                                       special = ICON_PARTICLE_DATA;
-                                       
-                                       if (FILTER_PART_OBJC(ob))
-                                               expand = ICON_TRIA_DOWN;
-                                       else
-                                               expand = ICON_TRIA_RIGHT;
-                                       
-                                       strcpy(name, "Particles");
-                               }
-                                       break;
-                               
-                               
-                               case ANIMTYPE_DSMAT: /* single material (dopesheet) expand widget */
-                               {
-                                       Material *ma = (Material *)ale->data;
-                                       AnimData *adt= ale->adt;
-                                       
-                                       group = 0;
-                                       indent = 0;
-                                       special = ICON_MATERIAL_DATA;
-                                       offset = 21;
-                                       
-                                       if (FILTER_MAT_OBJD(ma))
-                                               expand = ICON_TRIA_DOWN;
-                                       else
-                                               expand = ICON_TRIA_RIGHT;
-                                               
-                                       /* NLA evaluation on/off button */
-                                       if (adt) {
-                                               if (adt->flag & ADT_NLA_EVAL_OFF)
-                                                       mute = ICON_MUTE_IPO_ON;
-                                               else    
-                                                       mute = ICON_MUTE_IPO_OFF;
-                                       }
-                                       
-                                       strcpy(name, ma->id.name+2);
-                               }
-                                       break;
-                               case ANIMTYPE_DSLAM: /* lamp (dopesheet) expand widget */
-                               {
-                                       Lamp *la = (Lamp *)ale->data;
-                                       AnimData *adt= ale->adt;
-                                       
-                                       group = 4;
-                                       indent = 1;
-                                       special = ICON_LAMP_DATA;
-                                       
-                                       if (FILTER_LAM_OBJD(la))
-                                               expand = ICON_TRIA_DOWN;
-                                       else
-                                               expand = ICON_TRIA_RIGHT;
-                                               
-                                       /* NLA evaluation on/off button */
-                                       if (adt) {
-                                               if (adt->flag & ADT_NLA_EVAL_OFF)
-                                                       mute = ICON_MUTE_IPO_ON;
-                                               else    
-                                                       mute = ICON_MUTE_IPO_OFF;
-                                       }
-                                       
-                                       strcpy(name, la->id.name+2);
-                               }
-                                       break;
-                               case ANIMTYPE_DSCAM: /* camera (dopesheet) expand widget */
-                               {
-                                       Camera *ca = (Camera *)ale->data;
-                                       AnimData *adt= ale->adt;
-                                       
-                                       group = 4;
-                                       indent = 1;
-                                       special = ICON_CAMERA_DATA;
-                                       
-                                       if (FILTER_CAM_OBJD(ca))
-                                               expand = ICON_TRIA_DOWN;
-                                       else
-                                               expand = ICON_TRIA_RIGHT;
-                                               
-                                       /* NLA evaluation on/off button */
-                                       if (adt) {
-                                               if (adt->flag & ADT_NLA_EVAL_OFF)
-                                                       mute = ICON_MUTE_IPO_ON;
-                                               else    
-                                                       mute = ICON_MUTE_IPO_OFF;
-                                       }
-                                       
-                                       strcpy(name, ca->id.name+2);
-                               }
-                                       break;
-                               case ANIMTYPE_DSCUR: /* curve (dopesheet) expand widget */
-                               {
-                                       Curve *cu = (Curve *)ale->data;
-                                       AnimData *adt= ale->adt;
-                                       
-                                       group = 4;
-                                       indent = 1;
-                                       special = ICON_CURVE_DATA;
-                                       
-                                       if (FILTER_CUR_OBJD(cu))
-                                               expand = ICON_TRIA_DOWN;
-                                       else
-                                               expand = ICON_TRIA_RIGHT;
-                                               
-                                       /* NLA evaluation on/off button */
-                                       if (adt) {
-                                               if (adt->flag & ADT_NLA_EVAL_OFF)
-                                                       mute = ICON_MUTE_IPO_ON;
-                                               else    
-                                                       mute = ICON_MUTE_IPO_OFF;
-                                       }
-                                       
-                                       strcpy(name, cu->id.name+2);
-                               }
-                                       break;
-                               case ANIMTYPE_DSSKEY: /* shapekeys (dopesheet) expand widget */
-                               {
-                                       Key *key= (Key *)ale->data;
-                                       AnimData *adt= ale->adt;
-                                       
-                                       group = 4;
-                                       indent = 1;
-                                       special = ICON_SHAPEKEY_DATA; 
-                                       
-                                       if (FILTER_SKE_OBJD(key))       
-                                               expand = ICON_TRIA_DOWN;
-                                       else
-                                               expand = ICON_TRIA_RIGHT;
-                                               
-                                       /* NLA evaluation on/off button */
-                                       if (adt) {
-                                               if (adt->flag & ADT_NLA_EVAL_OFF)
-                                                       mute = ICON_MUTE_IPO_ON;
-                                               else    
-                                                       mute = ICON_MUTE_IPO_OFF;
-                                       }
-                                               
-                                       //sel = SEL_OBJC(base);
-                                       strcpy(name, "Shape Keys");
-                               }
-                                       break;
-                               case ANIMTYPE_DSWOR: /* world (dopesheet) expand widget */
-                               {
-                                       World *wo= (World *)ale->data;
-                                       AnimData *adt= ale->adt;
-                                       
-                                       group = 4;
-                                       indent = 1;
-                                       special = ICON_WORLD_DATA;
-                                       
-                                       if (FILTER_WOR_SCED(wo))        
-                                               expand = ICON_TRIA_DOWN;
-                                       else
-                                               expand = ICON_TRIA_RIGHT;
-                                               
-                                       /* NLA evaluation on/off button */
-                                       if (adt) {
-                                               if (adt->flag & ADT_NLA_EVAL_OFF)
-                                                       mute = ICON_MUTE_IPO_ON;
-                                               else    
-                                                       mute = ICON_MUTE_IPO_OFF;
-                                       }
-                                       
-                                       strcpy(name, wo->id.name+2);
-                               }
-                                       break;
-                               case ANIMTYPE_DSPART: /* particle (dopesheet) expand widget */
-                               {
-                                       ParticleSettings *part= (ParticleSettings*)ale->data;
-                                       AnimData *adt= ale->adt;
-                                       
-                                       group = 0;
-                                       indent = 0;
-                                       special = ICON_PARTICLE_DATA;
-                                       offset = 21;
-                                       
-                                       if (FILTER_PART_OBJD(part))     
-                                               expand = ICON_TRIA_DOWN;
-                                       else
-                                               expand = ICON_TRIA_RIGHT;
-                                               
-                                       /* NLA evaluation on/off button */
-                                       if (adt) {
-                                               if (adt->flag & ADT_NLA_EVAL_OFF)
-                                                       mute = ICON_MUTE_IPO_ON;
-                                               else    
-                                                       mute = ICON_MUTE_IPO_OFF;
-                                       }
-                                       
-                                       strcpy(name, part->id.name+2);
-                               }
-                                       break;
-                               case ANIMTYPE_DSMBALL: /* metaball (dopesheet) expand widget */
-                               {
-                                       MetaBall *mb = (MetaBall *)ale->data;
-                                       AnimData *adt= ale->adt;
-                                       
-                                       group = 4;
-                                       indent = 1;
-                                       special = ICON_META_DATA;
-                                       
-                                       if (FILTER_MBALL_OBJD(mb))
-                                               expand = ICON_TRIA_DOWN;
-                                       else
-                                               expand = ICON_TRIA_RIGHT;
-                                               
-                                       /* NLA evaluation on/off button */
-                                       if (adt) {
-                                               if (adt->flag & ADT_NLA_EVAL_OFF)
-                                                       mute = ICON_MUTE_IPO_ON;
-                                               else    
-                                                       mute = ICON_MUTE_IPO_OFF;
-                                       }
-                                       
-                                       strcpy(name, mb->id.name+2);
-                               }
-                                       break;
-                               
                                case ANIMTYPE_NLATRACK: /* NLA Track */
                                {
                                        NlaTrack *nlt= (NlaTrack *)ale->data;
@@ -978,6 +680,9 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
                                                
                                        sel = SEL_NLT(nlt);
                                        strcpy(name, nlt->name);
+                                       
+                                       // draw manually still
+                                       doDraw= 1;
                                }
                                        break;
                                case ANIMTYPE_NLAACTION: /* NLA Action-Line */
@@ -1004,162 +709,148 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
                                                sprintf(name, "ActAction: <%s>", act->id.name+2);
                                        else
                                                sprintf(name, "<No Action>");
+                                               
+                                       // draw manually still
+                                       doDraw= 1;
                                }
                                        break;
+                                       
+                               default: /* handled by standard channel-drawing API */
+                                       ANIM_channel_draw(ac, ale, yminc, ymaxc);
+                                       break;
                        }       
                        
-                       /* now, start drawing based on this information */
-                       glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-                       glEnable(GL_BLEND);
-                       
-                       /* draw backing strip behind channel name */
-                       if (group == 4) {
-                               /* only used in dopesheet... */
-                               if (ELEM(ale->type, ANIMTYPE_SCENE, ANIMTYPE_OBJECT)) {
-                                       /* object channel - darker */
-                                       UI_ThemeColor(TH_DOPESHEET_CHANNELOB);
-                                       uiSetRoundBox((expand == ICON_TRIA_DOWN)? (8):(1|8));
-                                       gl_round_box(GL_POLYGON, x+offset,  yminc, (float)NLACHANNEL_NAMEWIDTH, ymaxc, 10);
+                       /* if special types, draw manually for now... */
+                       if (doDraw) {
+                               /* now, start drawing based on this information */
+                               glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+                               glEnable(GL_BLEND);
+                               
+                               /* draw backing strip behind channel name */
+                               if (group == 5) {
+                                       /* Action Line */
+                                       AnimData *adt= ale->adt;
+                                       
+                                       // TODO: if tweaking some action, use the same color as for the tweaked track (quick hack done for now)
+                                       if (adt && (adt->flag & ADT_NLA_EDIT_ON)) {
+                                               // greenish color (same as tweaking strip) - hardcoded for now
+                                               glColor3f(0.3f, 0.95f, 0.1f);
+                                       }
+                                       else {
+                                               if (ale->data)
+                                                       glColor3f(0.8f, 0.2f, 0.0f);    // reddish color - hardcoded for now 
+                                               else
+                                                       glColor3f(0.6f, 0.5f, 0.5f);    // greyish-red color - hardcoded for now
+                                       }
+                                       
+                                       offset += 7 * indent;
+                                       
+                                       /* only on top two corners, to show that this channel sits on top of the preceeding ones */
+                                       uiSetRoundBox((1|2)); 
+                                       
+                                       /* draw slightly shifted up vertically to look like it has more separtion from other channels,
+                                        * but we then need to slightly shorten it so that it doesn't look like it overlaps
+                                        */
+                                       gl_round_box(GL_POLYGON, x+offset,  yminc+NLACHANNEL_SKIP, (float)v2d->cur.xmax, ymaxc+NLACHANNEL_SKIP-1, 8);
+                                       
+                                       /* clear group value, otherwise we cause errors... */
+                                       group = 0;
                                }
                                else {
-                                       /* sub-object folders - lighter */
-                                       UI_ThemeColor(TH_DOPESHEET_CHANNELSUBOB);
+                                       /* for normal channels 
+                                        *      - use 3 shades of color group/standard color for 3 indention level
+                                        */
+                                       UI_ThemeColorShade(TH_HEADER, ((indent==0)?20: (indent==1)?-20: -40));
                                        
+                                       indent += group;
                                        offset += 7 * indent;
                                        glBegin(GL_QUADS);
                                                glVertex2f(x+offset, yminc);
                                                glVertex2f(x+offset, ymaxc);
-                                               glVertex2f((float)ACHANNEL_NAMEWIDTH, ymaxc);
-                                               glVertex2f((float)ACHANNEL_NAMEWIDTH, yminc);
+                                               glVertex2f((float)v2d->cur.xmax, ymaxc);
+                                               glVertex2f((float)v2d->cur.xmax, yminc);
                                        glEnd();
-                                       
-                                       /* clear group value, otherwise we cause errors... */
-                                       group = 0;
                                }
-                       }
-                       else if (group == 5) {
-                               /* Action Line */
-                               AnimData *adt= ale->adt;
                                
-                               // TODO: if tweaking some action, use the same color as for the tweaked track (quick hack done for now)
-                               if (adt && (adt->flag & ADT_NLA_EDIT_ON)) {
-                                       // greenish color (same as tweaking strip) - hardcoded for now
-                                       glColor3f(0.3f, 0.95f, 0.1f);
-                               }
-                               else {
-                                       if (ale->data)
-                                               glColor3f(0.8f, 0.2f, 0.0f);    // reddish color - hardcoded for now 
-                                       else
-                                               glColor3f(0.6f, 0.5f, 0.5f);    // greyish-red color - hardcoded for now
+                               /* draw expand/collapse triangle */
+                               if (expand > 0) {
+                                       UI_icon_draw(x+offset, ydatac, expand);
+                                       offset += 17;
                                }
                                
-                               offset += 7 * indent;
+                               /* draw special icon indicating certain data-types */
+                               if (special > -1) {
+                                       /* for normal channels */
+                                       UI_icon_draw(x+offset, ydatac, special);
+                                       offset += 17;
+                               }
+                               glDisable(GL_BLEND);
                                
-                               /* only on top two corners, to show that this channel sits on top of the preceeding ones */
-                               uiSetRoundBox((1|2)); 
+                               /* draw name */
+                               if (sel)
+                                       UI_ThemeColor(TH_TEXT_HI);
+                               else
+                                       UI_ThemeColor(TH_TEXT);
+                               offset += 3;
+                               UI_DrawString(x+offset, y-4, name);
                                
-                               /* draw slightly shifted up vertically to look like it has more separtion from other channels,
-                                * but we then need to slightly shorten it so that it doesn't look like it overlaps
-                                */
-                               gl_round_box(GL_POLYGON, x+offset,  yminc+NLACHANNEL_SKIP, (float)NLACHANNEL_NAMEWIDTH, ymaxc+NLACHANNEL_SKIP-1, 8);
+                               /* reset offset - for RHS of panel */
+                               offset = 0;
                                
-                               /* clear group value, otherwise we cause errors... */
-                               group = 0;
-                       }
-                       else {
-                               /* for normal channels 
-                                *      - use 3 shades of color group/standard color for 3 indention level
-                                */
-                               UI_ThemeColorShade(TH_HEADER, ((indent==0)?20: (indent==1)?-20: -40));
+                               /* set blending again, as text drawing may clear it */
+                               glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+                               glEnable(GL_BLEND);
                                
-                               indent += group;
-                               offset += 7 * indent;
-                               glBegin(GL_QUADS);
-                                       glVertex2f(x+offset, yminc);
-                                       glVertex2f(x+offset, ymaxc);
-                                       glVertex2f((float)NLACHANNEL_NAMEWIDTH, ymaxc);
-                                       glVertex2f((float)NLACHANNEL_NAMEWIDTH, yminc);
-                               glEnd();
-                       }
-                       
-                       /* draw expand/collapse triangle */
-                       if (expand > 0) {
-                               UI_icon_draw(x+offset, ydatac, expand);
-                               offset += 17;
-                       }
-                       
-                       /* draw special icon indicating certain data-types */
-                       if (special > -1) {
-                               /* for normal channels */
-                               UI_icon_draw(x+offset, ydatac, special);
-                               offset += 17;
-                       }
-                       glDisable(GL_BLEND);
-                       
-                       /* draw name */
-                       if (sel)
-                               UI_ThemeColor(TH_TEXT_HI);
-                       else
-                               UI_ThemeColor(TH_TEXT);
-                       offset += 3;
-                       UI_DrawString(x+offset, y-4, name);
-                       
-                       /* reset offset - for RHS of panel */
-                       offset = 0;
-                       
-                       /* set blending again, as text drawing may clear it */
-                       glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-                       glEnable(GL_BLEND);
-                       
-                       /* draw protect 'lock' */
-                       if (protect > -1) {
-                               offset = 16;
-                               UI_icon_draw((float)NLACHANNEL_NAMEWIDTH-offset, ydatac, protect);
-                       }
-                       
-                       /* draw mute 'eye' */
-                       if (mute > -1) {
-                               offset += 16;
-                               UI_icon_draw((float)(NLACHANNEL_NAMEWIDTH-offset), ydatac, mute);
-                       }
-                       
-                       /* draw NLA-action line 'status-icons' - only when there's an action */
-                       if ((ale->type == ANIMTYPE_NLAACTION) && (ale->data)) {
-                               AnimData *adt= ale->adt;
+                               /* draw protect 'lock' */
+                               if (protect > -1) {
+                                       offset = 16;
+                                       UI_icon_draw((float)(v2d->cur.xmax-offset), ydatac, protect);
+                               }
                                
-                               offset += 16;
+                               /* draw mute 'eye' */
+                               if (mute > -1) {
+                                       offset += 16;
+                                       UI_icon_draw((float)(v2d->cur.xmax-offset), ydatac, mute);
+                               }
                                
-                               /* now draw some indicator icons  */
-                               if ((adt) && (adt->flag & ADT_NLA_EDIT_ON)) {
-                                       /* toggle for tweaking with mapping/no-mapping (i.e. 'in place editing' toggle) */
-                                       // for now, use pin icon to symbolise this
-                                       if (adt->flag & ADT_NLA_EDIT_NOMAP)
-                                               UI_icon_draw((float)(NLACHANNEL_NAMEWIDTH-offset), ydatac, ICON_PINNED);
-                                       else
-                                               UI_icon_draw((float)(NLACHANNEL_NAMEWIDTH-offset), ydatac, ICON_UNPINNED);
+                               /* draw NLA-action line 'status-icons' - only when there's an action */
+                               if ((ale->type == ANIMTYPE_NLAACTION) && (ale->data)) {
+                                       AnimData *adt= ale->adt;
                                        
-                                       fdrawline((float)(NLACHANNEL_NAMEWIDTH-offset), yminc, 
-                                                         (float)(NLACHANNEL_NAMEWIDTH-offset), ymaxc);
-                                       offset += 16;;
+                                       offset += 16;
                                        
-                                       /* 'tweaking action' indicator - not a button */
-                                       UI_icon_draw((float)NLACHANNEL_NAMEWIDTH-offset, ydatac, ICON_EDIT); 
-                               }
-                               else {
-                                       /* XXX firstly draw a little rect to help identify that it's different from the toggles */
-                                       glBegin(GL_LINE_LOOP);
-                                               glVertex2f((float)NLACHANNEL_NAMEWIDTH-offset-1, y-7);
-                                               glVertex2f((float)NLACHANNEL_NAMEWIDTH-offset-1, y+9);
-                                               glVertex2f((float)NLACHANNEL_NAMEWIDTH-1, y+9);
-                                               glVertex2f((float)NLACHANNEL_NAMEWIDTH-1, y-7);
-                                       glEnd(); // GL_LINES
-                                       
-                                       /* 'push down' icon for normal active-actions */
-                                       UI_icon_draw((float)NLACHANNEL_NAMEWIDTH-offset, ydatac, ICON_FREEZE);
+                                       /* now draw some indicator icons  */
+                                       if ((adt) && (adt->flag & ADT_NLA_EDIT_ON)) {
+                                               /* toggle for tweaking with mapping/no-mapping (i.e. 'in place editing' toggle) */
+                                               // for now, use pin icon to symbolise this
+                                               if (adt->flag & ADT_NLA_EDIT_NOMAP)
+                                                       UI_icon_draw((float)(v2d->cur.xmax-offset), ydatac, ICON_PINNED);
+                                               else
+                                                       UI_icon_draw((float)(v2d->cur.xmax-offset), ydatac, ICON_UNPINNED);
+                                               
+                                               fdrawline((float)(v2d->cur.xmax-offset), yminc, 
+                                                                 (float)(v2d->cur.xmax-offset), ymaxc);
+                                               offset += 16;;
+                                               
+                                               /* 'tweaking action' indicator - not a button */
+                                               UI_icon_draw((float)(v2d->cur.xmax-offset), ydatac, ICON_EDIT); 
+                                       }
+                                       else {
+                                               /* XXX firstly draw a little rect to help identify that it's different from the toggles */
+                                               glBegin(GL_LINE_LOOP);
+                                                       glVertex2f((float)v2d->cur.xmax-offset-1, y-7);
+                                                       glVertex2f((float)v2d->cur.xmax-offset-1, y+9);
+                                                       glVertex2f((float)v2d->cur.xmax-1, y+9);
+                                                       glVertex2f((float)v2d->cur.xmax-1, y-7);
+                                               glEnd(); // GL_LINES
+                                               
+                                               /* 'push down' icon for normal active-actions */
+                                               UI_icon_draw((float)NLACHANNEL_NAMEWIDTH-offset, ydatac, ICON_FREEZE);
+                                       }
                                }
+                               
+                               glDisable(GL_BLEND);
                        }
-                       
-                       glDisable(GL_BLEND);
                }
                
                /* adjust y-position for next one */
index 4f5d3f8f73695668540518c8e3c67a11aa03ab10..e4fa095e552a4d8a2fd9414fd16a8d516ed56e1b 100644 (file)
@@ -3663,7 +3663,7 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
                                }
                                else if(RNA_property_type(prop) == PROP_COLLECTION) {
                                        char buf[128], *name;
-
+                                       
                                        temnext= (TreeElement*)(ld->next->data);
                                        tsenext= TREESTORE(temnext);
                                        
index 8445f1b47e76702fe412097919b9076aec5be7b5..77ad832e4e97c71e1a8c2b9484588dbd62b391ed 100644 (file)
@@ -270,14 +270,23 @@ static void time_main_area_listener(ARegion *ar, wmNotifier *wmn)
 
 /* ************************ header time area region *********************** */
 
+//#define PY_HEADER
 /* add handlers, stuff you only do once or on area/region changes */
 static void time_header_area_init(wmWindowManager *wm, ARegion *ar)
 {
+#ifdef PY_HEADER
+       ED_region_header_init(ar);
+#else
        UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy);
+#endif
 }
 
 static void time_header_area_draw(const bContext *C, ARegion *ar)
 {
+#ifdef PY_HEADER
+       ED_region_header(C, ar);
+#else
+
        float col[3];
 
        /* clear */
@@ -293,7 +302,8 @@ static void time_header_area_draw(const bContext *C, ARegion *ar)
        UI_view2d_view_ortho(C, &ar->v2d);
        
        time_header_buttons(C, ar);
-       
+#endif
+
        /* restore view matrix? */
        UI_view2d_view_restore(C);
 }
index dd1130849b5ad8ced3ca910bed66586bcb5660eb..ea391e0cca79cf0c2f2d41fb14fcb03d24e298d9 100644 (file)
@@ -437,7 +437,7 @@ void time_header_buttons(const bContext *C, ARegion *ar)
                          &scene->r.psfra,0, 1, 0, 0,
                          "Show settings for frame range of animation preview");
        
-       xco += XIC*2.5;
+       xco += XIC*2;
        
        uiBlockBeginAlign(block);
        
@@ -516,35 +516,37 @@ void time_header_buttons(const bContext *C, ARegion *ar)
        xco+= XIC;
        uiBlockEndAlign(block);
 
-       xco+= 0.5*XIC;
+       xco+= (short)(0.5*XIC);
        
        uiBlockBeginAlign(block);
        uiDefIconButBitS(block, TOG, AUTOKEY_ON, B_REDRAWALL, ICON_REC,
                                         xco, yco, XIC, YIC, &(scene->toolsettings->autokey_mode), 0, 0, 0, 0, "Automatic keyframe insertion for Objects and Bones");
        xco+= 1*XIC;
        if (IS_AUTOKEY_ON(scene)) {
-//             uiDefButS(block, MENU, B_REDRAWALL, 
-//                               "Auto-Keying Mode %t|Add/Replace Keys%x3|Replace Keys %x5", 
-//                               xco, yco, (int)5.5*XIC, YIC, &(scene->toolsettings->autokey_mode), 0, 1, 0, 0, 
-//                               "Mode of automatic keyframe insertion for Objects and Bones");
+               uiDefButS(block, MENU, B_REDRAWALL, 
+                                 "Auto-Keying Mode %t|Add/Replace%x3|Replace%x5", 
+                                 xco, yco, (int)(4.25*XIC), YIC, &(scene->toolsettings->autokey_mode), 0, 1, 0, 0, 
+                                 "Mode of automatic keyframe insertion for Objects and Bones");
+               xco+= (short)(4.25*XIC);
                
                if (animtimer) {
                        uiDefButBitS(block, TOG, ANIMRECORD_FLAG_WITHNLA, B_REDRAWALL, "Layered",       
-                                 xco,yco, 70, YIC,
+                                 xco,yco, (int)(3.5*XIC), YIC,
                                  &(scene->toolsettings->autokey_flag),0, 1, 0, 0,
                                  "Add a new NLA Track + Strip for every loop/pass made over the animation to allow non-destructive tweaking.");
                        uiBlockEndAlign(block);
+                       
+                       xco+= (short)(3.5*XIC);
                }
-       
+               
+               xco += XIC;
+               
+               uiBlockEndAlign(block);
+       }
+       else {
+               xco+= (short)(5.25*XIC);
                uiBlockEndAlign(block);
        }
-       else
-
-       
-       
-       uiBlockEndAlign(block);
-       
-       xco+= (4.5*XIC);
        
        menustr= ANIM_build_keyingsets_menu(&scene->keyingsets, 0);
        uiDefButI(block, MENU, B_DIFF, 
@@ -554,11 +556,14 @@ void time_header_buttons(const bContext *C, ARegion *ar)
        MEM_freeN(menustr);
        xco+= (5.5*XIC);
        
+       /* NOTE: order of these buttons needs to be kept in sync with other occurances 
+        * (see Outliner header for instance, also +/- stuff for filebrowser) 
+        */
        uiBlockBeginAlign(block);
-       uiDefIconButO(block, BUT, "ANIM_OT_insert_keyframe", WM_OP_INVOKE_REGION_WIN, ICON_KEY_HLT, xco,yco,XIC,YIC, "Insert Keyframes for the Active Keying Set (I)");
-       xco += XIC;
        uiDefIconButO(block, BUT, "ANIM_OT_delete_keyframe", WM_OP_INVOKE_REGION_WIN, ICON_KEY_DEHLT, xco,yco,XIC,YIC, "Delete Keyframes for the Active Keying Set (Alt-I)");
        xco += XIC;
+       uiDefIconButO(block, BUT, "ANIM_OT_insert_keyframe", WM_OP_INVOKE_REGION_WIN, ICON_KEY_HLT, xco,yco,XIC,YIC, "Insert Keyframes for the Active Keying Set (I)");
+       xco += XIC;
        uiBlockEndAlign(block);
        
        xco+= XIC;
index 05336d29dc3c78a3bb1d384f839b5d932a05dcfb..0f2b43a260d00607b4334d6378d04a15b9400b9b 100644 (file)
@@ -5351,6 +5351,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
                        float bigfactor = 1.0;
                        int big = (smd->domain->flags & MOD_SMOKE_HIGHRES) && (smd->domain->viewsettings & MOD_SMOKE_VIEW_USEBIG);
                        int new = 0;
+                       int have_lamp = 0;
                        
                        // GUI sent redraw event
                        if(smd->domain->flags & MOD_SMOKE_VIEW_REDRAWNICE)
@@ -5439,7 +5440,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
                        
                        if(new > 1)
                        {
-                               float light[3] = {0.0,0.0,2.0}; // TODO: take real LAMP coordinates - dg
+                               float light[3] = {0.0,0.0,0.0}; // TODO: take real LAMP coordinates - dg
                                Base *base_tmp = NULL;
 
                                for(base_tmp = scene->base.first; base_tmp; base_tmp= base_tmp->next) 
@@ -5451,6 +5452,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
                                                if(la->type == LA_LOCAL)
                                                {
                                                        VECCOPY(light, base_tmp->object->obmat[3]);
+                                                       have_lamp = 1;
                                                        break;
                                                }
                                        }
@@ -5554,6 +5556,9 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
                                                                        tvox =  smoke_get_bigtvox(smd, index);
                                                                        tray = smoke_get_bigtray(smd, index);
                                                                }
+
+                                                               if(!have_lamp)
+                                                                       tray = 1.0;
                                                                
                                                                // fill buffer with luminance and alpha
                                                                // 1 - T_vox
index fcc6692f621cce172cb415eeae411d6b6ecf7255..0e5c16060660f1d2aeb19aabcc9bc85fc32cef23 100644 (file)
@@ -237,7 +237,7 @@ static void drawgrid_draw(ARegion *ar, float wx, float wy, float x, float y, flo
 
 #define GRID_MIN_PX 6.0f
 
-static void drawgrid(ARegion *ar, View3D *v3d, char **grid_unit)
+static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, char **grid_unit)
 {
        /* extern short bgpicmode; */
        RegionView3D *rv3d= ar->regiondata;
@@ -260,7 +260,7 @@ static void drawgrid(ARegion *ar, View3D *v3d, char **grid_unit)
        x= (wx)*fx/fw;
        y= (wy)*fy/fw;
 
-       vec4[0]=vec4[1]= (U.unit_system) ? 1.0 : v3d->grid;
+       vec4[0]=vec4[1]= (unit->system) ? 1.0 : v3d->grid;
 
        vec4[2]= 0.0;
        vec4[3]= 1.0;
@@ -277,7 +277,7 @@ static void drawgrid(ARegion *ar, View3D *v3d, char **grid_unit)
        /* check zoom out */
        UI_ThemeColor(TH_GRID);
        
-       if(U.unit_system) {
+       if(unit->system) {
                /* Use GRID_MIN_PX*2 for units because very very small grid
                 * items are less useful when dealing with units */
                void *usys;
@@ -286,21 +286,21 @@ static void drawgrid(ARegion *ar, View3D *v3d, char **grid_unit)
                float dx_scalar;
                float blend_fac;
 
-               bUnit_GetSystem(&usys, &len, U.unit_system, B_UNIT_LENGTH);
+               bUnit_GetSystem(&usys, &len, unit->system, B_UNIT_LENGTH);
 
                if(usys) {
                        i= len;
                        while(i--) {
                                scalar= bUnit_GetScaler(usys, i);
 
-                               dx_scalar = dx * scalar * U.unit_scale_length;
+                               dx_scalar = dx * scalar * unit->scale_length;
                                if (dx_scalar < (GRID_MIN_PX*2))
                                        continue;
 
                                /* Store the smallest drawn grid size units name so users know how big each grid cell is */
                                if(*grid_unit==NULL) {
                                        *grid_unit= bUnit_GetNamePlural(usys, i);
-                                       v3d->gridview= (scalar * U.unit_scale_length);
+                                       v3d->gridview= (scalar * unit->scale_length);
                                }
                                blend_fac= 1-((GRID_MIN_PX*2)/dx_scalar);
 
@@ -1978,7 +1978,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
        }
        else {
                ED_region_pixelspace(ar);
-               drawgrid(ar, v3d, &grid_unit);
+               drawgrid(&scene->unit, ar, v3d, &grid_unit);
                /* XXX make function? replaces persp(1) */
                glMatrixMode(GL_PROJECTION);
                wmLoadMatrix(rv3d->winmat);
index 26ca5a07973a345fe22213f47b697850c905822a..2e0172f4238c7d261926d7d51f987174dcb2c524 100644 (file)
@@ -3173,9 +3173,9 @@ static void view3d_sculpt_menu(bContext *C, uiLayout *layout, void *arg_unused)
 
        /* Curve */
        uiItemS(layout);
-       uiItemEnumO(layout, NULL, 0, "SCULPT_OT_brush_curve_preset", "mode", BRUSH_PRESET_SHARP);
-       uiItemEnumO(layout, NULL, 0, "SCULPT_OT_brush_curve_preset", "mode", BRUSH_PRESET_SMOOTH);
-       uiItemEnumO(layout, NULL, 0, "SCULPT_OT_brush_curve_preset", "mode", BRUSH_PRESET_MAX);
+       uiItemEnumO(layout, NULL, 0, "BRUSH_OT_curve_preset", "shape", BRUSH_PRESET_SHARP);
+       uiItemEnumO(layout, NULL, 0, "BRUSH_OT_curve_preset", "shape", BRUSH_PRESET_SMOOTH);
+       uiItemEnumO(layout, NULL, 0, "BRUSH_OT_curve_preset", "shape", BRUSH_PRESET_MAX);
 
        uiItemS(layout);
 
index 1d4882c2da251ce94f0366190629dd86c07f7dc5..dd7cebdfe3f40ad379dbc0cf360ab601e87b1483 100644 (file)
@@ -3040,11 +3040,11 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) {
                applyAspectRatio(t, dvec);
 
                dist = VecLength(vec);
-               if(U.unit_system) {
-                       int i, do_split= U.unit_flag & USER_UNIT_OPT_SPLIT ? 1:0;
+               if(t->scene->unit.system) {
+                       int i, do_split= t->scene->unit.flag & USER_UNIT_OPT_SPLIT ? 1:0;
 
                        for(i=0; i<3; i++)
-                               bUnit_AsString(&tvec[i*20], dvec[i]*U.unit_scale_length, 4, U.unit_system, B_UNIT_LENGTH, do_split, 1);
+                               bUnit_AsString(&tvec[i*20], 20, dvec[i]*t->scene->unit.scale_length, 4, t->scene->unit.system, B_UNIT_LENGTH, do_split, 1);
                }
                else {
                        sprintf(&tvec[0], "%.4f", dvec[0]);
@@ -3053,8 +3053,8 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) {
                }
        }
 
-       if(U.unit_system)
-               bUnit_AsString(distvec, dist*U.unit_scale_length, 4, U.unit_system, B_UNIT_LENGTH, U.unit_flag & USER_UNIT_OPT_SPLIT, 0);
+       if(t->scene->unit.system)
+               bUnit_AsString(distvec, sizeof(distvec), dist*t->scene->unit.scale_length, 4, t->scene->unit.system, B_UNIT_LENGTH, t->scene->unit.flag & USER_UNIT_OPT_SPLIT, 0);
        else if( dist > 1e10 || dist < -1e10 )  /* prevent string buffer overflow */
                sprintf(distvec, "%.4e", dist);
        else
index adb7fa2303df3630abd2a901a5d64d3fb9a282fd..e8962d013f48159ac45dd21252cdf52db60193e3 100644 (file)
@@ -63,13 +63,10 @@ typedef struct Brush {
        float rgb[3];                           /* color */
        float alpha;                            /* opacity */
 
-       float rot;                                      /* rotation in radians */
-
        short texact;                           /* active texture */
        char sculpt_tool;                       /* active tool */
-       char tex_mode;
        
-       char pad[4];
+       char pad;
 } Brush;
 
 /* Brush.flag */
@@ -97,11 +94,6 @@ typedef struct Brush {
 #define BRUSH_BLEND_ERASE_ALPHA        6
 #define BRUSH_BLEND_ADD_ALPHA  7
 
-/* Brush.tex_mode */
-#define BRUSH_TEX_DRAG 0
-#define BRUSH_TEX_TILE 1
-#define BRUSH_TEX_3D   2
-
 /* Brush.sculpt_tool */
 #define SCULPT_TOOL_DRAW    1
 #define SCULPT_TOOL_SMOOTH  2
index cf32e4e2980e64f3ed0ba1521846b51f5eb917d8..7404072db47658a3118729e1693606668ca41abe 100644 (file)
@@ -476,11 +476,10 @@ typedef struct Sculpt
        /* For rotating around a pivot point */
        float pivot[3];
        int flags;
-       /* For the Brush Shape */
-       char texsep;
+
        /* Control tablet input */
        char tablet_size, tablet_strength;
-       char pad[5];
+       char pad[6];
 } Sculpt;
 
 typedef struct VPaint {
@@ -622,6 +621,12 @@ typedef struct bStats {
        int totvert, totface;
 } bStats;
 
+typedef struct UnitSettings {
+       /* Display/Editing unit options for each scene */
+       float scale_length; /* maybe have other unit conversions? */
+       short system;
+       short flag; /* imperial, metric etc */
+} UnitSettings;
 
 typedef struct Scene {
        ID id;
@@ -681,6 +686,10 @@ typedef struct Scene {
        /* Game Settings */
        struct GameFraming framing; // XXX  deprecated since 2.5
        struct GameData gm;
+
+       /* Units */
+       struct UnitSettings unit;
+
 } Scene;
 
 
@@ -1072,6 +1081,15 @@ typedef enum SculptFlags {
 #define        SK_RETARGET_ROLL_VIEW                   1
 #define        SK_RETARGET_ROLL_JOINT                  2
 
+/* UnitSettings */
+
+/* UnitSettings->system */
+#define        USER_UNIT_NONE                  0
+#define        USER_UNIT_METRIC                1
+#define        USER_UNIT_IMPERIAL              2
+/* UnitSettings->flag */
+#define        USER_UNIT_OPT_SPLIT             1
+
 
 #ifdef __cplusplus
 }
index 820d3309b136837c3fc9268b47b6f03a2ab56107..6e889fda20a408064c311a62d9d4e975d30fb73a 100644 (file)
@@ -53,17 +53,17 @@ typedef struct MTex {
        char uvname[32];
        
        char projx, projy, projz, mapping;
-       float ofs[3], size[3];
+       float ofs[3], size[3], rot;
        
        short texflag, colormodel, pmapto, pmaptoneg;
-       short normapspace, which_output, pad[2];
+       short normapspace, which_output;
+       char brush_map_mode, pad[7];
        float r, g, b, k;
        float def_var, rt;
        
        float colfac, norfac, varfac;
        float dispfac; 
        float warpfac;
-       
 } MTex;
 
 #ifndef DNA_USHORT_FIX
@@ -450,6 +450,11 @@ typedef struct TexMapping {
 #define MTEX_BLEND_COLOR       13
 #define MTEX_NUM_BLENDTYPES    14
 
+/* brush_map_mode */
+#define MTEX_MAP_MODE_FIXED    0
+#define MTEX_MAP_MODE_TILED    1
+#define MTEX_MAP_MODE_3D       2
+
 /* **************** EnvMap ********************* */
 
 /* type */
index ae0ad6cc0be7950fbdc3a8e508f0fc2d0044f220..019dad4eed501bbed2f760f9bd0aa87be19d7032 100644 (file)
@@ -299,9 +299,7 @@ typedef struct UserDef {
        int audiochannels;
 
        int scrollback; /* console scrollback limit */
-       float unit_scale_length, pad1; /* maybe have other unit conversions? */
-       char unit_system, unit_flag; /* imperial, metric etc */
-       short dpi;              /* range 48-128? */
+       int dpi;                /* range 48-128? */
        short encoding;
        short transopts;
        short menuthreshold1, menuthreshold2;
@@ -418,13 +416,6 @@ extern UserDef U; /* from blenkernel blender.c */
        /* toolsettings->autokey_flag */
 #define        ANIMRECORD_FLAG_WITHNLA         (1<<10)
 
-/* unit_type */
-#define        USER_UNIT_NONE                  0
-#define        USER_UNIT_METRIC                1
-#define        USER_UNIT_IMPERIAL              2
-/* unit_flag */
-#define        USER_UNIT_OPT_SPLIT             1
-
 /* transopts */
 #define        USER_TR_TOOLTIPS                (1 << 0)
 #define        USER_TR_BUTTONS                 (1 << 1)
index 632413e11bfa7719bfd7f0c990d1e29715682cbe..f3a968cc1427b5cf6aa032bf6b27f1306d6c0cf8 100644 (file)
@@ -395,6 +395,7 @@ extern StructRNA RNA_SpaceFileBrowser;
 extern StructRNA RNA_SpaceGraphEditor;
 extern StructRNA RNA_SpaceImageEditor;
 extern StructRNA RNA_SpaceNLA;
+extern StructRNA RNA_SpaceTimeline;
 extern StructRNA RNA_SpaceOutliner;
 extern StructRNA RNA_SpaceSequenceEditor;
 extern StructRNA RNA_SpaceTextEditor;
@@ -472,6 +473,7 @@ extern StructRNA RNA_TransformSequence;
 extern StructRNA RNA_UILayout;
 extern StructRNA RNA_UIListItem;
 extern StructRNA RNA_UVProjectModifier;
+extern StructRNA RNA_UnitSettings;
 extern StructRNA RNA_UnknownType;
 extern StructRNA RNA_UserPreferences;
 extern StructRNA RNA_UserPreferencesAutosave;
index 3b8586e020d3817001e702ad30e1a30739a84365..b58df16dc62b0e30483cbe8654d2fadda73a326d 100644 (file)
@@ -74,20 +74,6 @@ static void rna_Brush_active_texture_set(PointerRNA *ptr, PointerRNA value)
        }
 }
 
-static float rna_Brush_rotation_get(PointerRNA *ptr)
-{
-       Brush *brush= (Brush*)ptr->data;
-       const float conv = 57.295779506;
-       return brush->rot * conv;
-}
-
-static void rna_Brush_rotation_set(PointerRNA *ptr, float v)
-{
-       Brush *brush= (Brush*)ptr->data;
-       const float conv = 0.017453293;
-       brush->rot = v * conv;
-}
-
 #else
 
 void rna_def_brush(BlenderRNA *brna)
@@ -106,12 +92,6 @@ void rna_def_brush(BlenderRNA *brna)
                {BRUSH_BLEND_ADD_ALPHA, "ADD_ALPHA", 0, "Add Alpha", "Add alpha while painting."},
                {0, NULL, 0, NULL, NULL}};
                
-       static EnumPropertyItem prop_texture_mode_items[] = {
-               {BRUSH_TEX_DRAG, "TEX_DRAG", 0, "Drag", ""},
-               {BRUSH_TEX_TILE, "TEX_TILE", 0, "Tile", ""},
-               {BRUSH_TEX_3D, "TEX_3D", 0, "3D", ""},
-               {0, NULL, 0, NULL, NULL}};
-               
        static EnumPropertyItem prop_sculpt_tool_items[] = {
                {SCULPT_TOOL_DRAW, "DRAW", 0, "Draw", ""},
                {SCULPT_TOOL_SMOOTH, "SMOOTH", 0, "Smooth", ""},
@@ -132,11 +112,6 @@ void rna_def_brush(BlenderRNA *brna)
        RNA_def_property_enum_items(prop, prop_blend_items);
        RNA_def_property_ui_text(prop, "Blending mode", "Brush blending mode.");
 
-       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, prop_texture_mode_items);
-       RNA_def_property_ui_text(prop, "Texture Mode", "");
-
        prop= RNA_def_property(srna, "sculpt_tool", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_items(prop, prop_sculpt_tool_items);
        RNA_def_property_ui_text(prop, "Sculpt Tool", "");
@@ -170,12 +145,6 @@ void rna_def_brush(BlenderRNA *brna)
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Strength", "The amount of pressure on the brush.");
 
-       prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_NONE);
-       RNA_def_property_float_sdna(prop, NULL, "rot");
-       RNA_def_property_range(prop, 0, 360);
-       RNA_def_property_float_funcs(prop, "rna_Brush_rotation_get", "rna_Brush_rotation_set", NULL);
-       RNA_def_property_ui_text(prop, "Rotation", "Angle of the brush texture.");
-       
        /* flag */
        prop= RNA_def_property(srna, "airbrush", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_AIRBRUSH);
index 467b8f6e8e13efba05bb74b0368f557e2e6b235c..a8dc0454cef132fcc0d72b6fcdfb22a2a8338949 100644 (file)
@@ -416,7 +416,7 @@ static void rna_def_constraint_kinematic(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Pole Sub-Target", "");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-       prop= RNA_def_property(srna, "pole_angle", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "pole_angle", PROP_FLOAT, PROP_ANGLE); // XXX - todo, convert to rad
        RNA_def_property_float_sdna(prop, NULL, "poleangle");
        RNA_def_property_range(prop, 0.0, 180.f);
        RNA_def_property_ui_text(prop, "Pole Angle", "Pole rotation offset.");
@@ -676,7 +676,7 @@ static void rna_def_constraint_minmax(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Use Rotation", "Use the target's rotation to determine floor.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_DISTANCE);
        RNA_def_property_range(prop, 0.0, 100.f);
        RNA_def_property_ui_text(prop, "Offset", "Offset of floor from object center.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
@@ -871,7 +871,7 @@ static void rna_def_constraint_follow_path(BlenderRNA *brna)
        RNA_def_property_flag(prop, PROP_EDITABLE);
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-       prop= RNA_def_property(srna, "offset", PROP_INT, PROP_NONE);
+       prop= RNA_def_property(srna, "offset", PROP_INT, PROP_TIME);
        RNA_def_property_range(prop, -300000.0, 300000.f);
        RNA_def_property_ui_text(prop, "Offset", "Offset from the position corresponding to the time frame.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
@@ -938,7 +938,7 @@ static void rna_def_constraint_stretch_to(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Keep Axis", "Axis to maintain during stretch.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "original_length", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "original_length", PROP_FLOAT, PROP_DISTANCE);
        RNA_def_property_float_sdna(prop, NULL, "orglength");
        RNA_def_property_range(prop, 0.0, 100.f);
        RNA_def_property_ui_text(prop, "Original Length", "Length at rest position.");
@@ -983,37 +983,37 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Pivot Type", "");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "pivot_x", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "pivot_x", PROP_FLOAT, PROP_DISTANCE);
        RNA_def_property_float_sdna(prop, NULL, "pivX");
        RNA_def_property_range(prop, -1000.0, 1000.f);
        RNA_def_property_ui_text(prop, "Pivot X", "Offset pivot on X.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "pivot_y", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "pivot_y", PROP_FLOAT, PROP_DISTANCE);
        RNA_def_property_float_sdna(prop, NULL, "pivY");
        RNA_def_property_range(prop, -1000.0, 1000.f);
        RNA_def_property_ui_text(prop, "Pivot Y", "Offset pivot on Y.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "pivot_z", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "pivot_z", PROP_FLOAT, PROP_DISTANCE);
        RNA_def_property_float_sdna(prop, NULL, "pivZ");
        RNA_def_property_range(prop, -1000.0, 1000.f);
        RNA_def_property_ui_text(prop, "Pivot Z", "Offset pivot on Z.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "axis_x", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "axis_x", PROP_FLOAT, PROP_ANGLE); // XXX - convert to radians
        RNA_def_property_float_sdna(prop, NULL, "axX");
        RNA_def_property_range(prop, -360.0, 360.f);
        RNA_def_property_ui_text(prop, "Axis X", "Rotate pivot on X axis in degrees.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "axis_y", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "axis_y", PROP_FLOAT, PROP_ANGLE); // XXX - convert to radians
        RNA_def_property_float_sdna(prop, NULL, "axY");
        RNA_def_property_range(prop, -360.0, 360.f);
        RNA_def_property_ui_text(prop, "Axis Y", "Rotate pivot on Y axis in degrees.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "axis_z", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "axis_z", PROP_FLOAT, PROP_ANGLE); // XXX - convert to radians
        RNA_def_property_float_sdna(prop, NULL, "axZ");
        RNA_def_property_range(prop, -360.0, 360.f);
        RNA_def_property_ui_text(prop, "Axis Z", "Rotate pivot on Z axis in degrees.");
@@ -1135,73 +1135,73 @@ static void rna_def_constraint_transform(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Extrapolate Motion", "Extrapolate ranges.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "from_min_x", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "from_min_x", PROP_FLOAT, PROP_DISTANCE);
        RNA_def_property_float_sdna(prop, NULL, "from_min[0]");
        RNA_def_property_range(prop, 0.0, 1000.f);
        RNA_def_property_ui_text(prop, "From Minimum X", "Bottom range of X axis source motion.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "from_min_y", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "from_min_y", PROP_FLOAT, PROP_DISTANCE);
        RNA_def_property_float_sdna(prop, NULL, "from_min[1]");
        RNA_def_property_range(prop, 0.0, 1000.f);
        RNA_def_property_ui_text(prop, "From Minimum Y", "Bottom range of Y axis source motion.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "from_min_z", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "from_min_z", PROP_FLOAT, PROP_DISTANCE);
        RNA_def_property_float_sdna(prop, NULL, "from_min[2]");
        RNA_def_property_range(prop, 0.0, 1000.f);
        RNA_def_property_ui_text(prop, "From Minimum Z", "Bottom range of Z axis source motion.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "from_max_x", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "from_max_x", PROP_FLOAT, PROP_DISTANCE);
        RNA_def_property_float_sdna(prop, NULL, "from_max[0]");
        RNA_def_property_range(prop, 0.0, 1000.f);
        RNA_def_property_ui_text(prop, "From Maximum X", "Top range of X axis source motion.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "from_max_y", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "from_max_y", PROP_FLOAT, PROP_DISTANCE);
        RNA_def_property_float_sdna(prop, NULL, "from_max[1]");
        RNA_def_property_range(prop, 0.0, 1000.f);
        RNA_def_property_ui_text(prop, "From Maximum Y", "Top range of Y axis source motion.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "from_max_z", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "from_max_z", PROP_FLOAT, PROP_DISTANCE);
        RNA_def_property_float_sdna(prop, NULL, "from_max[2]");
        RNA_def_property_range(prop, 0.0, 1000.f);
        RNA_def_property_ui_text(prop, "From Maximum Z", "Top range of Z axis source motion.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "to_min_x", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "to_min_x", PROP_FLOAT, PROP_DISTANCE);
        RNA_def_property_float_sdna(prop, NULL, "to_min[0]");
        RNA_def_property_range(prop, 0.0, 1000.f);
        RNA_def_property_ui_text(prop, "To Minimum X", "Bottom range of X axis destination motion.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "to_min_y", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "to_min_y", PROP_FLOAT, PROP_DISTANCE);
        RNA_def_property_float_sdna(prop, NULL, "to_min[1]");
        RNA_def_property_range(prop, 0.0, 1000.f);
        RNA_def_property_ui_text(prop, "To Minimum Y", "Bottom range of Y axis destination motion.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "to_min_z", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "to_min_z", PROP_FLOAT, PROP_DISTANCE);
        RNA_def_property_float_sdna(prop, NULL, "to_min[2]");
        RNA_def_property_range(prop, 0.0, 1000.f);
        RNA_def_property_ui_text(prop, "To Minimum Z", "Bottom range of Z axis destination motion.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "to_max_x", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "to_max_x", PROP_FLOAT, PROP_DISTANCE);
        RNA_def_property_float_sdna(prop, NULL, "to_max[0]");
        RNA_def_property_range(prop, 0.0, 1000.f);
        RNA_def_property_ui_text(prop, "To Maximum X", "Top range of X axis destination motion.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "to_max_y", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "to_max_y", PROP_FLOAT, PROP_DISTANCE);
        RNA_def_property_float_sdna(prop, NULL, "to_max[1]");
        RNA_def_property_range(prop, 0.0, 1000.f);
        RNA_def_property_ui_text(prop, "To Maximum Y", "Top range of Y axis destination motion.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "to_max_z", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "to_max_z", PROP_FLOAT, PROP_DISTANCE);
        RNA_def_property_float_sdna(prop, NULL, "to_max[2]");
        RNA_def_property_range(prop, 0.0, 1000.f);
        RNA_def_property_ui_text(prop, "To Maximum Z", "Top range of Z axis destination motion.");
@@ -1247,37 +1247,37 @@ static void rna_def_constraint_location_limit(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Maximum Z", "Use the maximum Z value.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "minimum_x", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "minimum_x", PROP_FLOAT, PROP_DISTANCE);
        RNA_def_property_float_sdna(prop, NULL, "xmin");
        RNA_def_property_range(prop, -1000.0, 1000.f);
        RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "minimum_y", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "minimum_y", PROP_FLOAT, PROP_DISTANCE);
        RNA_def_property_float_sdna(prop, NULL, "ymin");
        RNA_def_property_range(prop, -1000.0, 1000.f);
        RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "minimum_z", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "minimum_z", PROP_FLOAT, PROP_DISTANCE);
        RNA_def_property_float_sdna(prop, NULL, "zmin");
        RNA_def_property_range(prop, -1000.0, 1000.f);
        RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "maximum_x", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "maximum_x", PROP_FLOAT, PROP_DISTANCE);
        RNA_def_property_float_sdna(prop, NULL, "xmax");
        RNA_def_property_range(prop, -1000.0, 1000.f);
        RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "maximum_y", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "maximum_y", PROP_FLOAT, PROP_DISTANCE);
        RNA_def_property_float_sdna(prop, NULL, "ymax");
        RNA_def_property_range(prop, -1000.0, 1000.f);
        RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "maximum_z", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "maximum_z", PROP_FLOAT, PROP_DISTANCE);
        RNA_def_property_float_sdna(prop, NULL, "zmax");
        RNA_def_property_range(prop, -1000.0, 1000.f);
        RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow.");
@@ -1313,37 +1313,37 @@ static void rna_def_constraint_rotation_limit(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Limit Z", "Use the minimum Z value.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "minimum_x", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "minimum_x", PROP_FLOAT, PROP_ANGLE);
        RNA_def_property_float_sdna(prop, NULL, "xmin");
        RNA_def_property_range(prop, -1000.0, 1000.f);
        RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "minimum_y", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "minimum_y", PROP_FLOAT, PROP_ANGLE);
        RNA_def_property_float_sdna(prop, NULL, "ymin");
        RNA_def_property_range(prop, -1000.0, 1000.f);
        RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "minimum_z", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "minimum_z", PROP_FLOAT, PROP_ANGLE);
        RNA_def_property_float_sdna(prop, NULL, "zmin");
        RNA_def_property_range(prop, -1000.0, 1000.f);
        RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "maximum_x", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "maximum_x", PROP_FLOAT, PROP_ANGLE);
        RNA_def_property_float_sdna(prop, NULL, "xmax");
        RNA_def_property_range(prop, -1000.0, 1000.f);
        RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "maximum_y", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "maximum_y", PROP_FLOAT, PROP_ANGLE);
        RNA_def_property_float_sdna(prop, NULL, "ymax");
        RNA_def_property_range(prop, -1000.0, 1000.f);
        RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow.");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-       prop= RNA_def_property(srna, "maximum_z", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "maximum_z", PROP_FLOAT, PROP_ANGLE);
        RNA_def_property_float_sdna(prop, NULL, "zmax");
        RNA_def_property_range(prop, -1000.0, 1000.f);
        RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow.");
@@ -1462,7 +1462,7 @@ static void rna_def_constraint_distance_limit(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Sub-Target", "");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-       prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
        RNA_def_property_float_sdna(prop, NULL, "dist");
        RNA_def_property_range(prop, 0.0, 100.f);
        RNA_def_property_ui_text(prop, "Distance", "Radius of limiting sphere.");
@@ -1502,7 +1502,7 @@ static void rna_def_constraint_shrinkwrap(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Shrinkwrap Type", "Selects type of shrinkwrap algorithm for target position");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
        
-       prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
        RNA_def_property_float_sdna(prop, NULL, "dist");
        RNA_def_property_range(prop, 0.0, 100.f);
        RNA_def_property_ui_text(prop, "Distance", "Distance to Target.");
index 97320c0f9d4fe2f408a88305b1de31b526c340d0..fe982ced466da2f359fa9cedda16faa7a15434ec 100644 (file)
@@ -174,6 +174,11 @@ static void rna_Scene_frame_update(bContext *C, PointerRNA *ptr)
        //ED_update_for_newframe(C);
 }
 
+static char *rna_SceneRenderData_path(PointerRNA *ptr)
+{
+       return BLI_sprintfN("render_data");
+}
+
 static int rna_SceneRenderData_threads_get(PointerRNA *ptr)
 {
        RenderData *rd= (RenderData*)ptr->data;
@@ -443,6 +448,40 @@ static void rna_def_tool_settings(BlenderRNA  *brna)
        RNA_def_property_ui_text(prop, "Vertex Group Weight", "Weight to assign in vertex groups.");
 }
 
+
+static void rna_def_unit_settings(BlenderRNA  *brna)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+
+       static EnumPropertyItem unit_systems[] = {
+               {USER_UNIT_NONE, "NONE", 0, "None", ""},
+               {USER_UNIT_METRIC, "METRIC", 0, "Metric", ""},
+               {USER_UNIT_IMPERIAL, "IMPERIAL", 0, "Imperial", ""},
+               {0, NULL, 0, NULL, NULL}};
+
+       srna= RNA_def_struct(brna, "UnitSettings", NULL);
+       RNA_def_struct_ui_text(srna, "Unit Settings", "");
+
+       /* Units */
+       prop= RNA_def_property(srna, "system", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_items(prop, unit_systems);
+       RNA_def_property_ui_text(prop, "Unit System", "The unit system to use for button display.");
+       RNA_def_property_update(prop, NC_WINDOW, NULL);
+
+       prop= RNA_def_property(srna, "scale_length", PROP_FLOAT, PROP_UNSIGNED);
+       RNA_def_property_ui_text(prop, "Unit Scale", "Scale to use when converting between blender units and dimensions.");
+       RNA_def_property_range(prop, 0.00001, 100000.0);
+       RNA_def_property_ui_range(prop, 0.001, 100.0, 0.1, 3);
+       RNA_def_property_update(prop, NC_WINDOW, NULL);
+
+       prop= RNA_def_property(srna, "use_separate", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_UNIT_OPT_SPLIT);
+       RNA_def_property_ui_text(prop, "Separate Units", "Display units in pairs.");
+       RNA_def_property_update(prop, NC_WINDOW, NULL);
+}
+
+
 void rna_def_render_layer_common(StructRNA *srna, int scene)
 {
        PropertyRNA *prop;
@@ -1081,6 +1120,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
        srna= RNA_def_struct(brna, "SceneRenderData", NULL);
        RNA_def_struct_sdna(srna, "RenderData");
        RNA_def_struct_nested(brna, srna, "Scene");
+       RNA_def_struct_path_func(srna, "rna_SceneRenderData_path");
        RNA_def_struct_ui_text(srna, "Render Data", "Rendering settings for a Scene datablock.");
        
        prop= RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);
@@ -1743,6 +1783,12 @@ void RNA_def_scene(BlenderRNA *brna)
        RNA_def_property_pointer_sdna(prop, NULL, "toolsettings");
        RNA_def_property_struct_type(prop, "ToolSettings");
        RNA_def_property_ui_text(prop, "Tool Settings", "");
+
+       /* Unit Settings */
+       prop= RNA_def_property(srna, "unit_settings", PROP_POINTER, PROP_NEVER_NULL);
+       RNA_def_property_pointer_sdna(prop, NULL, "unit");
+       RNA_def_property_struct_type(prop, "UnitSettings");
+       RNA_def_property_ui_text(prop, "Unit Settings", "Unit editing settings");
        
        /* Render Data */
        prop= RNA_def_property(srna, "render_data", PROP_POINTER, PROP_NEVER_NULL);
@@ -1763,6 +1809,7 @@ void RNA_def_scene(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Game Data", "");
        
        rna_def_tool_settings(brna);
+       rna_def_unit_settings(brna);
        rna_def_scene_render_data(brna);
        rna_def_scene_game_data(brna);
        rna_def_scene_render_layer(brna);
index 1d9fac9cbb2b0aa3174e381e917aa723198fa281..620816d3de66a1e6a6f706fecfa5268460c0d4ab 100644 (file)
@@ -118,10 +118,10 @@ static StructRNA* rna_Space_refine(struct PointerRNA *ptr)
                case SPACE_NLA:
                        return &RNA_SpaceNLA;
                /*case SPACE_SCRIPT:
-                       return &RNA_SpaceScriptsWindow;
+                       return &RNA_SpaceScriptsWindow;*/
                case SPACE_TIME:
                        return &RNA_SpaceTimeline;
-               case SPACE_NODE:
+               /*case SPACE_NODE:
                        return &RNA_SpaceNodeEditor;
                case SPACE_LOGIC:
                        return &RNA_SpaceLogicEditor;*/
@@ -1104,6 +1104,48 @@ static void rna_def_space_nla(BlenderRNA *brna)
        // TODO... autosnap, dopesheet?
 }
 
+static void rna_def_space_time(BlenderRNA *brna)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+       
+       srna= RNA_def_struct(brna, "SpaceTimeline", "Space");
+       RNA_def_struct_sdna(srna, "SpaceTime");
+       RNA_def_struct_ui_text(srna, "Space Timeline Editor", "Timeline editor space data.");
+       
+       /* Define Anim Playback Areas */
+       
+       prop= RNA_def_property(srna, "play_top_left", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_REGION);
+       RNA_def_property_ui_text(prop, "Top-Left 3D Window", "");
+       
+       prop= RNA_def_property(srna, "play_all_3d", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_ALL_3D_WIN);
+       RNA_def_property_ui_text(prop, "All 3D Windows", "");
+       
+       prop= RNA_def_property(srna, "play_anim", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_ALL_ANIM_WIN);
+       RNA_def_property_ui_text(prop, "Animation Windows", "");
+       
+       prop= RNA_def_property(srna, "play_buttons", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_ALL_BUTS_WIN);
+       RNA_def_property_ui_text(prop, "Buttons Windows", "");
+       
+       prop= RNA_def_property(srna, "play_image", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_ALL_IMAGE_WIN);
+       RNA_def_property_ui_text(prop, "Image Windows", "");
+       
+       prop= RNA_def_property(srna, "play_sequencer", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_SEQ);
+       RNA_def_property_ui_text(prop, "Sequencer Windows", "");
+       
+       /* Other options */
+       
+       prop= RNA_def_property(srna, "continue_physics", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_CONTINUE_PHYSICS);
+       RNA_def_property_ui_text(prop, "Continue Physics", "During playblack, continue physics simulations regardless of the frame number");    
+}
+
 static void rna_def_console_line(BlenderRNA *brna)
 {
        StructRNA *srna;
@@ -1332,6 +1374,7 @@ void RNA_def_space(BlenderRNA *brna)
        rna_def_space_dopesheet(brna);
        rna_def_space_graph(brna);
        rna_def_space_nla(brna);
+       rna_def_space_time(brna);
        rna_def_space_console(brna);
        rna_def_console_line(brna);
 }
index 577b9de437523c0d82d484d092188b257393abdb..203012dbc80036fa32c27a599f06401ebb357511 100644 (file)
@@ -168,6 +168,20 @@ static EnumPropertyItem *rna_ImageTexture_filter_itemf(bContext *C, PointerRNA *
        return item;
 }
 
+static float rna_TextureSlot_angle_get(PointerRNA *ptr)
+{
+       MTex *tex= (MTex*)ptr->data;
+       const float conv = 57.295779506;
+       return tex->rot * conv;
+}
+
+static void rna_TextureSlot_angle_set(PointerRNA *ptr, float v)
+{
+       MTex *tex= (MTex*)ptr->data;
+       const float conv = 0.017453293;
+       tex->rot = v * conv;
+}
+
 #else
 
 static void rna_def_color_ramp_element(BlenderRNA *brna)
@@ -288,6 +302,12 @@ static void rna_def_mtex(BlenderRNA *brna)
                {MTEX_BLEND_COLOR, "COLOR", 0, "Color", ""},
                {0, NULL, 0, NULL, NULL}};
 
+       static EnumPropertyItem prop_map_mode_items[] = {
+               {MTEX_MAP_MODE_FIXED, "FIXED", 0, "Fixed", ""},
+               {MTEX_MAP_MODE_TILED, "TILED", 0, "Tiled", ""},
+               {MTEX_MAP_MODE_3D, "3D", 0, "3D", ""},
+               {0, NULL, 0, NULL, NULL}};
+
        srna= RNA_def_struct(brna, "TextureSlot", NULL);
        RNA_def_struct_sdna(srna, "MTex");
        RNA_def_struct_ui_text(srna, "Texture Slot", "Texture slot defining the mapping and influence of a texture.");
@@ -346,6 +366,17 @@ static void rna_def_mtex(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "RGB to Intensity", "Converts texture RGB values to intensity (gray) values.");
        RNA_def_property_update(prop, NC_TEXTURE, NULL);
 
+       prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
+       RNA_def_property_float_sdna(prop, NULL, "rot");
+       RNA_def_property_range(prop, 0, 360);
+       RNA_def_property_float_funcs(prop, "rna_TextureSlot_angle_get", "rna_TextureSlot_angle_set", NULL);
+       RNA_def_property_ui_text(prop, "Angle", "Defines brush texture rotation.");
+       RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+       prop= RNA_def_property(srna, "brush_map_mode", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_items(prop, prop_map_mode_items);
+       RNA_def_property_ui_text(prop, "Mode", "");
+
        prop= RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "def_var");
        RNA_def_property_ui_range(prop, 0, 1, 10, 3);
index 165bd0ddd5bcefa43e18e98043690786bb04d0d0..19b2b5376f7f55961ba5e4da6445fb42dc40c021 100644 (file)
@@ -1733,12 +1733,6 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
                {BEZT_IPO_BEZ, "BEZIER", 0, "Bezier", ""},
                {0, NULL, 0, NULL, NULL}};
 
-       static EnumPropertyItem unit_systems[] = {
-               {USER_UNIT_NONE, "NONE", 0, "None", ""},
-               {USER_UNIT_METRIC, "METRIC", 0, "Metric", ""},
-               {USER_UNIT_IMPERIAL, "IMPERIAL", 0, "Imperial", ""},
-               {0, NULL, 0, NULL, NULL}};
-
        srna= RNA_def_struct(brna, "UserPreferencesEdit", NULL);
        RNA_def_struct_sdna(srna, "UserDef");
        RNA_def_struct_nested(brna, srna, "UserPreferences");
@@ -1779,23 +1773,6 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
        RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_GLOBALUNDO);
        RNA_def_property_ui_text(prop, "Global Undo", "Global undo works by keeping a full copy of the file itself in memory, so takes extra memory.");
 
-       /* Units */
-       prop= RNA_def_property(srna, "unit_system", PROP_ENUM, PROP_NONE);
-       RNA_def_property_enum_items(prop, unit_systems);
-       RNA_def_property_ui_text(prop, "Unit System", "The unit system to use for button display.");
-       RNA_def_property_update(prop, NC_WINDOW, NULL);
-
-       prop= RNA_def_property(srna, "unit_scale_length", PROP_FLOAT, PROP_UNSIGNED);
-       RNA_def_property_ui_text(prop, "Unit Scale", "Scale to use when converting between blender units and dimensions.");
-       RNA_def_property_range(prop, 0.00001, 100000.0);
-       RNA_def_property_ui_range(prop, 0.001, 100.0, 0.1, 3);
-       RNA_def_property_update(prop, NC_WINDOW, NULL);
-
-       prop= RNA_def_property(srna, "use_unit_split", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "unit_flag", USER_UNIT_OPT_SPLIT);
-       RNA_def_property_ui_text(prop, "Separate Units", "Display units in pairs.");
-       RNA_def_property_update(prop, NC_WINDOW, NULL);
-
        /* snap to grid */
        prop= RNA_def_property(srna, "snap_translate", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_AUTOGRABGRID);
index 5c6f444ab0c6c0570744830b5436a9fe834d4c74..b3f36dd3b5c256c14f122c313791b3520e426d8a 100644 (file)
@@ -131,7 +131,7 @@ ifndef CONFIG_GUESS
 
     ifeq ($(NAN_PYTHON_VERSION),3.1)
       export PY_FRAMEWORK ?= 0
-         export NAN_PYTHON ?= $(LCGDIR)/python
+      export NAN_PYTHON ?= $(LCGDIR)/python
       export NAN_PYTHON_LIB ?= $(NAN_PYTHON)/lib/python$(NAN_PYTHON_VERSION)/libpython$(NAN_PYTHON_VERSION).a
     else
       export PY_FRAMEWORK ?= 1
@@ -191,6 +191,9 @@ ifndef CONFIG_GUESS
     # enable l10n
     export INTERNATIONAL ?= true
 
+    export NAN_SAMPLERATE ?= $(LCGDIR)/samplerate
+    export NAN_SAMPLERATE_LIBS ?= $(NAN_SAMPLERATE)/lib/libsamplerate.a 
+
   else
   ifeq ($(OS),freebsd)
 
@@ -309,6 +312,7 @@ ifndef CONFIG_GUESS
     export NAN_SDL ?= $(shell sdl-config --prefix)
     export NAN_SDLLIBS ?= $(shell sdl-config --libs)
     export NAN_SDLCFLAGS ?= $(shell sdl-config --cflags)
+    export NAN_SAMPLERATE ?= /usr
 
 ifneq ($(NAN_USE_FFMPEG_CONFIG), true)
     export NAN_FFMPEG ?= /usr
@@ -323,7 +327,7 @@ endif
     endif
 
     # Uncomment the following line to use Mozilla inplace of netscape
-       
+
     # Location of MOZILLA/Netscape header files...
     export NAN_MOZILLA_INC ?= /usr/include/mozilla
     export NAN_MOZILLA_LIB ?= $(LCGDIR)/mozilla/lib/