* Volume Rendering
authorMatt Ebb <matt@mke3.net>
Tue, 25 Aug 2009 06:30:09 +0000 (06:30 +0000)
committerMatt Ebb <matt@mke3.net>
Tue, 25 Aug 2009 06:30:09 +0000 (06:30 +0000)
Finally in 2.5 branch :)

Still things to do, but will continue working in here. I won't bother
repeating the commit messages from the last year or so, however I've
written up some technical docs to help Ton/Brecht/etc review and find
their way around the code:
http://wiki.blender.org/index.php/User:Broken/VolumeRenderingDev

That above page has some known issues and todos listed, but I'm still
interested in bug reports.

Credits for this code:
* Matt Ebb
(with thanks to Red Cartel/ProMotion Studios)
* Raul Fernandez Hernandez (Farsthary) for patches:
  o Light cache based multiple scattering approximation
  o Initial voxeldata texture code
  o Depth Cutoff threshold
* Andre Susano Pinto for BVH range lookup addition
* Trilinear interpolation adapted from pbrt
* Tricubic interpolation from libtricubic

31 files changed:
release/io/engine_render_pov.py
release/ui/buttons_data_bone.py
release/ui/buttons_data_modifier.py
release/ui/buttons_texture.py
release/ui/space_image.py
release/ui/space_view3d.py
source/blender/blenkernel/BKE_action.h
source/blender/blenkernel/intern/action.c
source/blender/blenkernel/intern/anim_sys.c
source/blender/blenkernel/intern/nla.c
source/blender/editors/animation/anim_channels_defines.c
source/blender/editors/animation/anim_ops.c
source/blender/editors/animation/keyingsets.c
source/blender/editors/include/ED_keyframing.h
source/blender/editors/interface/interface_utils.c
source/blender/editors/space_action/action_draw.c
source/blender/editors/space_action/action_header.c
source/blender/editors/space_nla/nla_channels.c
source/blender/editors/space_nla/nla_edit.c
source/blender/editors/space_view3d/drawvolume.c
source/blender/gpu/intern/gpu_extensions.c
source/blender/makesrna/RNA_enum_types.h
source/blender/makesrna/intern/makesrna.c
source/blender/makesrna/intern/rna_animation.c
source/blender/makesrna/intern/rna_animation_api.c [new file with mode: 0644]
source/blender/makesrna/intern/rna_internal.h
source/blender/makesrna/intern/rna_pose.c
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_scene_api.c [new file with mode: 0644]
source/blender/render/intern/source/shadeinput.c
source/gameengine/Ketsji/KX_MouseFocusSensor.cpp

index b68f5767b135665882da6330708cc75fdc48f3d8..f064add505b607f116f10df154629b526eb2d6ec 100644 (file)
@@ -878,7 +878,7 @@ class RenderButtonsPanel(bpy.types.Panel):
 class SCENE_PT_povray_radiosity(RenderButtonsPanel):
        __label__ = "Radiosity"
        COMPAT_ENGINES = set(['POVRAY_RENDER'])
-       
+
        def draw_header(self, context):
                layout = self.layout
                scene = context.scene
index 1d6a725a105c6c24d051ae9fca39cd194a2130a9..cfdaabadf79452675ec8734d0233acac845dfbdf 100644 (file)
@@ -90,14 +90,14 @@ class BONE_PT_bone(BoneButtonsPanel):
                        col.itemR(bone, "parent", text="")
                else:
                        col.item_pointerR(bone, "parent", arm, "edit_bones", text="")
-
+               
                row = col.row()
                row.active = bone.parent != None
                row.itemR(bone, "connected")
-
+               
                col.itemL(text="Layers:")
                col.template_layers(bone, "layer")
-
+               
                col = split.column()
                col.itemL(text="Inherit:")
                col.itemR(bone, "hinge", text="Rotation")
@@ -105,7 +105,7 @@ class BONE_PT_bone(BoneButtonsPanel):
                col.itemL(text="Display:")
                col.itemR(bone, "draw_wire", text="Wireframe")
                col.itemR(bone, "hidden", text="Hide")
-
+               
                if ob and pchan:
                        split = layout.split()
                        
index 98d354a2fa022e238f525325c2472a3629bf4a0f..bc41b04d32c45b1b081d78a1293379321db5d8a1 100644 (file)
@@ -404,7 +404,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
                sub.itemR(md, "z_normal", text="Z")
                
                split = layout.split()
-               
+
                col = split.column()
                col.itemL(text="Time:")
                sub = col.column(align=True)
index 756f96b4803a0c2d2b2daca9298323a109b45869..4827f677336494cf3a6429c257012d5796e64840 100644 (file)
@@ -1,4 +1,4 @@
-       
+
 import bpy
 
 class TextureButtonsPanel(bpy.types.Panel):
index 82e3319ea5931461bf4af25f35727adaf378f383..8dc016f55b757086ba50191520c98c5f839067c1 100644 (file)
@@ -350,7 +350,7 @@ class IMAGE_PT_view_properties(bpy.types.Panel):
                        col = layout.column()
                        row = col.row()
                        row.itemR(uvedit, "edge_draw_type", expand=True)
-
+                       
                        split = layout.split()
 
                        col = split.column()
index 2062f6e22926ec69bc1060e08065d1e8b02909ec..ae17307080f7049592003e6e9644f256c461ee7f 100644 (file)
@@ -92,7 +92,7 @@ class VIEW3D_MT_view(bpy.types.Menu):
                layout.itemM("VIEW3D_MT_view_cameras", text="Cameras")
                
                layout.itemS()
-
+               
                layout.itemO("view3d.view_persportho")
                
                layout.itemS()
@@ -103,7 +103,7 @@ class VIEW3D_MT_view(bpy.types.Menu):
                layout.itemS()
 
                layout.operator_context = "INVOKE_REGION_WIN"
-
+               
                layout.itemO("view3d.clip_border", text="Clipping Border...")
                layout.itemO("view3d.zoom_border", text="Zoom Border...")
                
@@ -116,7 +116,7 @@ class VIEW3D_MT_view(bpy.types.Menu):
                
                layout.itemO("screen.region_foursplit", text="Toggle Quad View")
                layout.itemO("screen.screen_full_area", text="Toggle Full Screen")
-               
+
 class VIEW3D_MT_view_navigation(bpy.types.Menu):
        __space_type__ = 'VIEW_3D'
        __label__ = "Navigation"
@@ -548,7 +548,7 @@ class VIEW3D_MT_SCULPT(bpy.types.Menu):
                                layout.itemO("sculpt.set_persistent_base")
 
 # ********** Particle menu **********  
-
+       
 class VIEW3D_MT_PARTICLE(bpy.types.Menu):
        __space_type__ = 'VIEW_3D'
        __label__ = "Particle"
@@ -564,7 +564,7 @@ class VIEW3D_MT_PARTICLE(bpy.types.Menu):
                
                layout.itemO("particle.remove_doubles")
                layout.itemO("particle.delete")
-
+               
                if particle_edit.selection_mode == 'POINT':
                        layout.itemO("particle.subdivide")
                
@@ -777,7 +777,7 @@ class VIEW3D_MT_edit_MESH_vertices(bpy.types.Menu):
                
                layout.itemO("mesh.vertices_smooth")
                layout.itemO("mesh.remove_doubles")
-               
+
 class VIEW3D_MT_edit_MESH_edges(bpy.types.Menu):
        __space_type__ = 'VIEW_3D'
        __label__ = "Edges"
@@ -802,7 +802,7 @@ class VIEW3D_MT_edit_MESH_edges(bpy.types.Menu):
                
                layout.item_enumO("mesh.edge_rotate", "direction", 'CW', text="Rotate Edge CW")
                layout.item_enumO("mesh.edge_rotate", "direction", 'CCW', text="Rotate Edge CCW")
-               
+
 class VIEW3D_MT_edit_MESH_faces(bpy.types.Menu):
        __space_type__ = 'VIEW_3D'
        __label__ = "Faces"
@@ -849,7 +849,7 @@ def draw_CURVE(self, context):
        layout = self.layout
        
        settings = context.tool_settings
-
+       
        layout.itemM("VIEW3D_MT_snap")
        
        layout.itemS()
index d35acb5447aae7e82c35fca7a1a2513a70336216..4724ee19aaa0e38926115df87fbf4be4e31a7551 100644 (file)
@@ -66,7 +66,7 @@ void free_action(struct bAction *act);
 void make_local_action(struct bAction *act);
 
 /* Some kind of bounding box operation on the action */
-void calc_action_range(const struct bAction *act, float *start, float *end, int incl_hidden);
+void calc_action_range(const struct bAction *act, float *start, float *end, short incl_modifiers);
 
 /* Does action have any motion data at all? */
 short action_has_motion(const struct bAction *act);
index 6a39139d2505253ed6bc7054f8f809b9e5c7f851..47de044ea25e9cc7bffddca8dfd9537064639e11 100644 (file)
@@ -838,14 +838,15 @@ short action_has_motion(const bAction *act)
 }
 
 /* Calculate the extents of given action */
-void calc_action_range(const bAction *act, float *start, float *end, int incl_hidden)
+void calc_action_range(const bAction *act, float *start, float *end, short incl_modifiers)
 {
        FCurve *fcu;
        float min=999999999.0f, max=-999999999.0f;
-       short foundvert=0;
+       short foundvert=0, foundmod=0;
 
        if (act) {
                for (fcu= act->curves.first; fcu; fcu= fcu->next) {
+                       /* if curve has keyframes, consider them first */
                        if (fcu->totvert) {
                                float nmin, nmax;
                                
@@ -858,10 +859,53 @@ void calc_action_range(const bAction *act, float *start, float *end, int incl_hi
                                
                                foundvert= 1;
                        }
+                       
+                       /* if incl_modifiers is enabled, need to consider modifiers too
+                        *      - only really care about the last modifier
+                        */
+                       if ((incl_modifiers) && (fcu->modifiers.last)) {
+                               FModifier *fcm= fcu->modifiers.last;
+                               
+                               /* only use the maximum sensible limits of the modifiers if they are more extreme */
+                               switch (fcm->type) {
+                                       case FMODIFIER_TYPE_LIMITS: /* Limits F-Modifier */
+                                       {
+                                               FMod_Limits *fmd= (FMod_Limits *)fcm->data;
+                                               
+                                               if (fmd->flag & FCM_LIMIT_XMIN) {
+                                                       min= MIN2(min, fmd->rect.xmin);
+                                               }
+                                               if (fmd->flag & FCM_LIMIT_XMAX) {
+                                                       max= MAX2(max, fmd->rect.xmax);
+                                               }
+                                       }
+                                               break;
+                                               
+                                       case FMODIFIER_TYPE_CYCLES: /* Cycles F-Modifier */
+                                       {
+                                               FMod_Cycles *fmd= (FMod_Cycles *)fcm->data;
+                                               
+                                               if (fmd->before_mode != FCM_EXTRAPOLATE_NONE)
+                                                       min= MINAFRAMEF;
+                                               if (fmd->after_mode != FCM_EXTRAPOLATE_NONE)
+                                                       max= MAXFRAMEF;
+                                       }
+                                               break;
+                                               
+                                       // TODO: function modifier may need some special limits
+                                               
+                                       default: /* all other standard modifiers are on the infinite range... */
+                                               min= MINAFRAMEF;
+                                               max= MAXFRAMEF;
+                                               break;
+                               }
+                               
+                               foundmod= 1;
+                       }
                }
        }       
        
-       if (foundvert) {
+       if (foundvert || foundmod) {
                if(min==max) max+= 1.0f;
                *start= min;
                *end= max;
index 5eaf21335157f4702348de78d16a43e120c1ee56..44d73a7f5b47d48fd1e7b327e91c20f9337574b7 100644 (file)
@@ -207,12 +207,6 @@ AnimData *BKE_copy_animdata (AnimData *adt)
 /* *********************************** */ 
 /* KeyingSet API */
 
-/* NOTES:
- * It is very likely that there will be two copies of the api - one for internal use,
- * and one 'operator' based wrapper of the internal API, which should allow for access
- * from Python/scripts so that riggers can automate the creation of KeyingSets for their rigs.
- */
-
 /* Finding Tools --------------------------- */
 
 /* Find the first path that matches the given criteria */
@@ -299,18 +293,25 @@ void BKE_keyingset_add_destination (KeyingSet *ks, ID *id, const char group_name
        KS_Path *ksp;
        
        /* sanity checks */
-       if ELEM(NULL, ks, rna_path)
+       if ELEM(NULL, ks, rna_path) {
+               printf("ERROR: no Keying Set and/or RNA Path to add destination with \n");
                return;
+       }
        
        /* ID is optional for relative KeyingSets, but is necessary for absolute KeyingSets */
        if (id == NULL) {
-               if (ks->flag & KEYINGSET_ABSOLUTE)
+               if (ks->flag & KEYINGSET_ABSOLUTE) {
+                       printf("ERROR: No ID provided for absolute destination. \n");
                        return;
+               }
        }
        
        /* don't add if there is already a matching KS_Path in the KeyingSet */
-       if (BKE_keyingset_find_destination(ks, id, group_name, rna_path, array_index, groupmode))
+       if (BKE_keyingset_find_destination(ks, id, group_name, rna_path, array_index, groupmode)) {
+               if (G.f & G_DEBUG)
+                       printf("ERROR: destination already exists in Keying Set \n");
                return;
+       }
        
        /* allocate a new KeyingSet Path */
        ksp= MEM_callocN(sizeof(KS_Path), "KeyingSet Path");
@@ -1263,7 +1264,7 @@ static void animsys_evaluate_nla (PointerRNA *ptr, AnimData *adt, float ctime)
                        dummy_strip.act= adt->action;
                        dummy_strip.remap= adt->remap;
                        
-                               // FIXME: what happens when we want to included F-Modifier access?
+                       /* action range is calculated taking F-Modifiers into account (which making new strips doesn't do due to the troublesome nature of that) */
                        calc_action_range(dummy_strip.act, &dummy_strip.actstart, &dummy_strip.actend, 1);
                        dummy_strip.start = dummy_strip.actstart;
                        dummy_strip.end = (IS_EQ(dummy_strip.actstart, dummy_strip.actend)) ?  (dummy_strip.actstart + 1.0f): (dummy_strip.actend);
index c41c4ae78e43c57708b4c991980d6c099820e658..480c79fbc1aa8236cf4d66afdd1614643417fb37 100644 (file)
@@ -291,7 +291,7 @@ NlaStrip *add_nlastrip (bAction *act)
        /* determine initial range 
         *      - strip length cannot be 0... ever...
         */
-       calc_action_range(strip->act, &strip->actstart, &strip->actend, 1);
+       calc_action_range(strip->act, &strip->actstart, &strip->actend, 0);
        
        strip->start = strip->actstart;
        strip->end = (IS_EQ(strip->actstart, strip->actend)) ?  (strip->actstart + 1.0f): (strip->actend);
index 0ef470a698e0d38153b8f5d2e61496ed68083516..b16420a70948cafbdab87ba496e08a9baee1baf6 100644 (file)
@@ -1972,7 +1972,7 @@ void ANIM_channel_draw (bAnimContext *ac, bAnimListElem *ale, float yminc, float
                offset += 3;
                UI_DrawString(offset, ytext, name);
        }
-               }
+}
 
 /* ------------------ */
 
@@ -2206,17 +2206,17 @@ void ANIM_channel_draw_widgets (bAnimContext *ac, bAnimListElem *ale, uiBlock *b
                
                /* check if there's enough space for the toggles if the sliders are drawn too */
                if ( !(draw_sliders) || ((v2d->mask.xmax-v2d->mask.xmin) > ACHANNEL_BUTTON_WIDTH/2) ) {
-               /* protect... */
-               if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PROTECT)) {
-                       offset += ICON_WIDTH; 
-                       draw_setting_widget(ac, ale, acf, block, (int)v2d->cur.xmax-offset, ymid, ACHANNEL_SETTING_PROTECT);
-               }
-               /* mute... */
-               if (acf->has_setting(ac, ale, ACHANNEL_SETTING_MUTE)) {
-                       offset += ICON_WIDTH;
-                       draw_setting_widget(ac, ale, acf, block, (int)v2d->cur.xmax-offset, ymid, ACHANNEL_SETTING_MUTE);
+                       /* protect... */
+                       if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PROTECT)) {
+                               offset += ICON_WIDTH; 
+                               draw_setting_widget(ac, ale, acf, block, (int)v2d->cur.xmax-offset, ymid, ACHANNEL_SETTING_PROTECT);
+                       }
+                       /* mute... */
+                       if (acf->has_setting(ac, ale, ACHANNEL_SETTING_MUTE)) {
+                               offset += ICON_WIDTH;
+                               draw_setting_widget(ac, ale, acf, block, (int)v2d->cur.xmax-offset, ymid, ACHANNEL_SETTING_MUTE);
+                       }
                }
-       }
                
                /* draw slider
                 *      - even if we can draw sliders for this view, we must also check that the channel-type supports them
@@ -2248,7 +2248,7 @@ void ANIM_channel_draw_widgets (bAnimContext *ac, bAnimListElem *ale, uiBlock *b
                                        /* create the slider button, and assign relevant callback to ensure keyframes are inserted... */
                                        but= uiDefAutoButR(block, &ptr, prop, fcu->array_index, "", 0, (int)v2d->cur.xmax-offset, ymid, SLIDER_WIDTH, (int)ymaxc-yminc);
                                        uiButSetFunc(but, achannel_setting_slider_cb, ale->id, fcu);
-}
+                               }
                        }
                        else { /* Special Slider for stuff without RNA Access ---------- */
                                // TODO: only implement this case when we really need it...
index ffa44e60d0031023ba489ff3f21c05e0949d7a36..72fee937e253d785395ab43b452ede905f687324 100644 (file)
@@ -398,9 +398,6 @@ void ED_operatortypes_anim(void)
        
        WM_operatortype_append(ANIM_OT_add_driver_button);
        WM_operatortype_append(ANIM_OT_remove_driver_button);
-       
-       WM_operatortype_append(ANIM_OT_keyingset_add_new);
-       WM_operatortype_append(ANIM_OT_keyingset_add_destination);
 }
 
 void ED_keymap_anim(wmWindowManager *wm)
index 5bd37ba78319eb356cb3636f49068573d5e9f7ff..f19372069c3689bb58c14c2d7717d06490afaf2d 100644 (file)
 /* ************************************************** */
 /* KEYING SETS - EDITING API  */
 
-/* Operators ------------------------------------------- */
-
-/* These operators are only provided for scripting/macro usage, not for direct
- * calling from the UI since they wrap some of the data-access API code for these
- * (defined in blenkernel) which have quite a few properties.
- */
-
-/* ----- */
-
-static int keyingset_add_destination_exec (bContext *C, wmOperator *op)
-{
-       PointerRNA ptr;
-       KeyingSet *ks= NULL;
-       ID *id= NULL;
-       char rna_path[256], group_name[64]; // xxx
-       short groupmode=0, flag=0;
-       int array_index=0;
-       
-       /* get settings from operator properties */
-       ptr = RNA_pointer_get(op->ptr, "keyingset");
-       if (ptr.data) 
-               ks= (KeyingSet *)ptr.data;
-       
-       ptr = RNA_pointer_get(op->ptr, "id");
-       if (ptr.data)
-               id= (ID *)ptr.data;
-       
-       groupmode= RNA_enum_get(op->ptr, "grouping_method");
-       RNA_string_get(op->ptr, "group_name", group_name);              
-       
-       RNA_string_get(op->ptr, "rna_path", rna_path);
-       array_index= RNA_int_get(op->ptr, "array_index");
-       
-       if (RNA_boolean_get(op->ptr, "entire_array"))
-               flag |= KSP_FLAG_WHOLE_ARRAY;
-       
-       /* if enough args are provided, call API method */
-       if (ks) {
-               BKE_keyingset_add_destination(ks, id, group_name, rna_path, array_index, flag, groupmode);
-               return OPERATOR_FINISHED;
-       }
-       else {
-               BKE_report(op->reports, RPT_ERROR, "Keying Set could not be added.");
-               return OPERATOR_CANCELLED;
-       }       
-}
-
-void ANIM_OT_keyingset_add_destination (wmOperatorType *ot)
-{
-       // XXX: this is also defined in rna_animation.c
-       static EnumPropertyItem prop_mode_grouping_items[] = {
-               {KSP_GROUP_NAMED, "NAMED", 0, "Named Group", ""},
-               {KSP_GROUP_NONE, "NONE", 0, "None", ""},
-               {KSP_GROUP_KSNAME, "KEYINGSET", 0, "Keying Set Name", ""},
-               {0, NULL, 0, NULL, NULL}};
-       
-       /* identifiers */
-       ot->name= "Add Keying Set Destination";
-       ot->idname= "ANIM_OT_keyingset_add_destination";
-       
-       /* callbacks */
-       ot->exec= keyingset_add_destination_exec;
-       ot->poll= ED_operator_scene_editable;
-       
-       /* props */
-               /* pointers */ // xxx - do we want to directly expose these?
-       RNA_def_pointer_runtime(ot->srna, "keyingset", &RNA_KeyingSet, "Keying Set", "Keying Set to add destination to.");
-       RNA_def_pointer_runtime(ot->srna, "id", &RNA_ID, "ID", "ID-block for the destination.");
-               /* grouping */
-       RNA_def_enum(ot->srna, "grouping_method", prop_mode_grouping_items, KSP_GROUP_NAMED, "Grouping Method", "Method used to define which Group-name to use.");
-       RNA_def_string(ot->srna, "group_name", "", 64, "Group Name", "Name of Action Group to assign destination to (only if grouping mode is to use this name).");
-               /* rna-path */
-       RNA_def_string(ot->srna, "rna_path", "", 256, "RNA-Path", "RNA-Path to destination property."); // xxx hopefully this is long enough
-       RNA_def_int(ot->srna, "array_index", 0, 0, INT_MAX, "Array Index", "If applicable, the index ", 0, INT_MAX);
-               /* flags */
-       RNA_def_boolean(ot->srna, "entire_array", 1, "Entire Array", "hen an 'array/vector' type is chosen (Location, Rotation, Color, etc.), entire array is to be used.");
-       
-}
-/* ----- */
-
-static int keyingset_add_new_exec (bContext *C, wmOperator *op)
-{
-       Scene *sce= CTX_data_scene(C);
-       KeyingSet *ks= NULL;
-       short flag=0, keyingflag=0;
-       char name[64];
-       
-       /* get settings from operator properties */
-       RNA_string_get(op->ptr, "name", name);
-       
-       if (RNA_boolean_get(op->ptr, "absolute"))
-               flag |= KEYINGSET_ABSOLUTE;
-       if (RNA_boolean_get(op->ptr, "insertkey_needed"))
-               keyingflag |= INSERTKEY_NEEDED;
-       if (RNA_boolean_get(op->ptr, "insertkey_visual"))
-               keyingflag |= INSERTKEY_MATRIX;
-               
-       /* call the API func, and set the active keyingset index */
-       ks= BKE_keyingset_add(&sce->keyingsets, name, flag, keyingflag);
-       
-       if (ks) {
-               sce->active_keyingset= BLI_countlist(&sce->keyingsets);
-               return OPERATOR_FINISHED;
-       }
-       else {
-               BKE_report(op->reports, RPT_ERROR, "Keying Set could not be added.");
-               return OPERATOR_CANCELLED;
-       }
-}
-
-void ANIM_OT_keyingset_add_new (wmOperatorType *ot)
-{
-       /* identifiers */
-       ot->name= "Add Keying Set";
-       ot->idname= "ANIM_OT_keyingset_add_new";
-       
-       /* callbacks */
-       ot->exec= keyingset_add_new_exec;
-       ot->poll= ED_operator_scene_editable;
-       
-       /* props */
-               /* name */
-       RNA_def_string(ot->srna, "name", "KeyingSet", 64, "Name", "Name of Keying Set");
-               /* flags */
-       RNA_def_boolean(ot->srna, "absolute", 1, "Absolute", "Keying Set defines specific paths/settings to be keyframed (i.e. is not reliant on context info)");
-               /* keying flags */
-       RNA_def_boolean(ot->srna, "insertkey_needed", 0, "Insert Keyframes - Only Needed", "Only insert keyframes where they're needed in the relevant F-Curves.");
-       RNA_def_boolean(ot->srna, "insertkey_visual", 0, "Insert Keyframes - Visual", "Insert keyframes based on 'visual transforms'.");
-}
-
 /* UI API --------------------------------------------- */
 
 /* Build menu-string of available keying-sets (allocates memory for string)
index 64672e3502b1ffa5e5e2ed0999a24e292c57da46..4bc24a0adeb5b0a35879df85ab5b49cba912704a 100644 (file)
@@ -154,15 +154,6 @@ struct KeyingSet *ANIM_builtin_keyingset_get_named(struct KeyingSet *prevKS, cha
 /* Initialise builtin KeyingSets on startup */
 void init_builtin_keyingsets(void);
 
-/* -------- */
-
-/* KeyingSet Editing Operators:
- *     These can add a new KeyingSet and/or add 'destinations' to the KeyingSets,
- *     acting as a means by which they can be added outside the Outliner.
- */
-void ANIM_OT_keyingset_add_new(struct wmOperatorType *ot);
-void ANIM_OT_keyingset_add_destination(struct wmOperatorType *ot);
-
 /* ************ Drivers ********************** */
 
 /* Main Driver Management API calls:
index b5cfbe19466e73297761c0e4a3332b206b0d24f0..997ac8b78c64dcc43ccd1d5e95553874ed5d7804 100644 (file)
@@ -444,6 +444,20 @@ int uiDefIDPoinButs(uiBlock *block, Main *bmain, ID *parid, ID *id, int id_code,
                        uiBlockClearButLock(block);
                }
                
+               /* add button */
+               if(events & UI_ID_ADD_NEW) {
+                       uiBlockSetButLock(block, (events & UI_ID_PIN) && *pin_p, "Can't unlink pinned data");
+                       if(parid && parid->lib);
+                       else {
+                               dup_params= MEM_dupallocN(params);
+                               but= uiDefIconBut(block, BUT, 0, ICON_ZOOMIN, x,y,DEF_ICON_BUT_WIDTH,DEF_BUT_HEIGHT, &dup_params->browsenr, params->browsenr, 32767.0, 0, 0, "Add new data block");
+                               uiButSetNFunc(but, idpoin_cb, MEM_dupallocN(params), SET_INT_IN_POINTER(UI_ID_ADD_NEW));
+                               x+= DEF_ICON_BUT_WIDTH;
+                       }
+                       
+                       uiBlockClearButLock(block);
+               }
+               
                /* delete button */
                if(events & UI_ID_DELETE) {
                        uiBlockSetButLock(block, (events & UI_ID_PIN) && *pin_p, "Can't unlink pinned data");
index 1403b6c8ff69654471d2af7dcc32b10b40be0226..4288cc10a26c45992d71eb469f7f662ed2f6b254 100644 (file)
@@ -92,7 +92,7 @@
 #include "ED_screen.h"
 #include "ED_space_api.h"
 
-       
+
 /* ************************************************************************* */
 /* Channel List */
 
index 33a97b5a80ab720695845c979424349d7b650566..e2a725164c985127646459710781248c38abd9aa 100644 (file)
@@ -43,6 +43,7 @@
 #include "BLI_blenlib.h"
 
 #include "BKE_animsys.h"
+#include "BKE_action.h"
 #include "BKE_context.h"
 #include "BKE_screen.h"
 
@@ -272,6 +273,7 @@ static void saction_idpoin_handle(bContext *C, ID *id, int event)
                                /* set action */
                                printf("\tset action \n");
                                adt->action= saction->action;
+                               adt->action->id.us++;
                        }
                        
                        ED_area_tag_redraw(CTX_wm_area(C));
@@ -282,7 +284,14 @@ static void saction_idpoin_handle(bContext *C, ID *id, int event)
                        break;
                case UI_ID_ADD_NEW:
                        printf("actedit addnew \n");
-                       /* XXX not implemented */
+                       if (saction->pin == 0) {
+                               AnimData *adt= BKE_id_add_animdata(&obact->id); /* this only adds if non-existant */
+                               
+                               /* set new action */
+                               // XXX need to restore behaviour to copy old actions...
+                               printf("\tset new action \n");
+                               adt->action= saction->action= add_empty_action("Action");
+                       }
                        break;
                case UI_ID_OPEN:
                        printf("actedit open \n");
index 063b329b7a19db660fdce27fdacc91933be323f1..ccf2326642793f1e352b64bb03220d1e54237587 100644 (file)
@@ -97,6 +97,7 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho
        ListBase anim_data = {NULL, NULL};
        bAnimListElem *ale;
        int filter;
+       View2D *v2d= &ac->ar->v2d;
        int notifierFlags = 0;
        
        /* get the channel that was clicked on */
@@ -186,14 +187,14 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho
                        else
                                offset= 0;
                        
-                       if (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) {
+                       if (x >= (v2d->cur.xmax-NLACHANNEL_BUTTON_WIDTH)) {
                                /* toggle protection (only if there's a toggle there) */
                                nlt->flag ^= NLATRACK_PROTECTED;
                                
                                /* notifier flags - channel was edited */
                                notifierFlags |= ND_ANIMCHAN_EDIT;
                        }
-                       else if (x >= (NLACHANNEL_NAMEWIDTH-2*NLACHANNEL_BUTTON_WIDTH)) {
+                       else if (x >= (v2d->cur.xmax-2*NLACHANNEL_BUTTON_WIDTH)) {
                                /* toggle mute */
                                nlt->flag ^= NLATRACK_MUTED;
                                
@@ -232,7 +233,7 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho
                {
                        AnimData *adt= BKE_animdata_from_id(ale->owner); /* this won't crash, right? */
                        
-                       if (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) {
+                       if (x >= (v2d->cur.xmax-NLACHANNEL_BUTTON_WIDTH)) {
                                if (nlaedit_is_tweakmode_on(ac) == 0) {
                                        /* 'push-down' action - only usable when not in TweakMode */
                                        // TODO: make this use the operator instead of calling the function directly
index 763f41164160e5bd0fe4bd4ddcfa1c94b7c3d4e9..e53ccd004db9d74bf5f69e027c16ac51b3fdd488 100644 (file)
@@ -1249,7 +1249,7 @@ static int nlaedit_apply_scale_exec (bContext *C, wmOperator *op)
                                 * but leave everything else alone 
                                 */
                                strip->scale= 1.0f;
-                               calc_action_range(strip->act, &strip->actstart, &strip->actend, 1);
+                               calc_action_range(strip->act, &strip->actstart, &strip->actend, 0);
                        }
                }
        }
index bc5db5e906ff792d327924e6b381ba7741bc2be8..5e0ffb9ba48b05934336dedf3bae37bb4aebc751 100644 (file)
@@ -238,9 +238,9 @@ void draw_volume(Scene *scene, ARegion *ar, View3D *v3d, Base *base, GPUTexture
 
        if (!GLEW_ARB_texture_non_power_of_two) 
        {
-       cor[0] = (float)res[0]/(float)larger_pow2(res[0]);
-       cor[1] = (float)res[1]/(float)larger_pow2(res[1]);
-       cor[2] = (float)res[2]/(float)larger_pow2(res[2]);
+               cor[0] = (float)res[0]/(float)larger_pow2(res[0]);
+               cor[1] = (float)res[1]/(float)larger_pow2(res[1]);
+               cor[2] = (float)res[2]/(float)larger_pow2(res[2]);
        }
 
        // our slices are defined by the plane equation a*x + b*y +c*z + d = 0
index c61731cef837c863e8cf7869935cd03558ef3ae5..36936a9fcb03edda174e7bbb61ffe23def873428 100644 (file)
@@ -363,9 +363,9 @@ GPUTexture *GPU_texture_create_3D(int w, int h, int depth, float *fpixels)
        glTexParameterfv(GL_TEXTURE_3D, GL_TEXTURE_BORDER_COLOR, vfBorderColor);
        glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
        glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-       glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S,GL_CLAMP_TO_BORDER);
-       glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T,GL_CLAMP_TO_BORDER);
-       glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R,GL_CLAMP_TO_BORDER);
+       glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
+       glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
+       glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_BORDER);
 
        if (pixels)
                MEM_freeN(pixels);
index 46d8c50caa6aa46731894bdbfb64510dd8d9fd25..06be0e69be57ef9b19866056a02bf8e96c6c44f7 100644 (file)
@@ -41,6 +41,8 @@ extern EnumPropertyItem boidrule_type_items[];
 extern EnumPropertyItem beztriple_handle_type_items[];
 extern EnumPropertyItem beztriple_interpolation_mode_items[];
 
+extern EnumPropertyItem keyingset_path_grouping_items[];
+
 extern EnumPropertyItem fmodifier_type_items[];
 
 extern EnumPropertyItem nla_mode_extend_items[];
index 83178f32d5f4dc0a602974fbb0616e823fd05915..fa3a5a406860b1c6e82844f17366e95f765bc43f 100644 (file)
@@ -1942,7 +1942,7 @@ RNAProcessItem PROCESS_ITEMS[]= {
        {"rna_ID.c", NULL, RNA_def_ID},
        {"rna_texture.c", NULL, RNA_def_texture},
        {"rna_action.c", NULL, RNA_def_action},
-       {"rna_animation.c", NULL, RNA_def_animation},
+       {"rna_animation.c", "rna_animation_api.c", RNA_def_animation},
        {"rna_actuator.c", NULL, RNA_def_actuator},
        {"rna_armature.c", NULL, RNA_def_armature},
        {"rna_boid.c", NULL, RNA_def_boid},
@@ -1975,7 +1975,7 @@ RNAProcessItem PROCESS_ITEMS[]= {
        {"rna_pose.c", NULL, RNA_def_pose},
        {"rna_property.c", NULL, RNA_def_gameproperty},
        {"rna_render.c", NULL, RNA_def_render},
-       {"rna_scene.c", NULL, RNA_def_scene},
+       {"rna_scene.c", "rna_scene_api.c", RNA_def_scene},
        {"rna_screen.c", NULL, RNA_def_screen},
        {"rna_sculpt_paint.c", NULL, RNA_def_sculpt_paint},
        {"rna_sensor.c", NULL, RNA_def_sensor},
index e334e2b5e909d03877ea5b3ee791ed8226d3ae5e..7652987ac868bf7027f371b25e5d513a05bea98a 100644 (file)
 
 #include "MEM_guardedalloc.h"
 
+/* exported for use in API */
+EnumPropertyItem keyingset_path_grouping_items[] = {
+       {KSP_GROUP_NAMED, "NAMED", 0, "Named Group", ""},
+       {KSP_GROUP_NONE, "NONE", 0, "None", ""},
+       {KSP_GROUP_KSNAME, "KEYINGSET", 0, "Keying Set Name", ""},
+       {KSP_GROUP_TEMPLATE_ITEM, "TEMPLATE", 0, "Innermost Context-Item Name", ""},
+       {0, NULL, 0, NULL, NULL}};
+
 #ifdef RNA_RUNTIME
 
 static int rna_AnimData_action_editable(PointerRNA *ptr)
@@ -90,13 +98,6 @@ void rna_def_keyingset_path(BlenderRNA *brna)
        StructRNA *srna;
        PropertyRNA *prop;
        
-       static EnumPropertyItem prop_mode_grouping_items[] = {
-               {KSP_GROUP_NAMED, "NAMED", 0, "Named Group", ""},
-               {KSP_GROUP_NONE, "NONE", 0, "None", ""},
-               {KSP_GROUP_KSNAME, "KEYINGSET", 0, "Keying Set Name", ""},
-               {KSP_GROUP_TEMPLATE_ITEM, "TEMPLATE", 0, "Innermost Context-Item Name", ""},
-               {0, NULL, 0, NULL, NULL}};
-       
        srna= RNA_def_struct(brna, "KeyingSetPath", NULL);
        RNA_def_struct_sdna(srna, "KS_Path");
        RNA_def_struct_ui_text(srna, "Keying Set Path", "Path to a setting for use in a Keying Set.");
@@ -112,7 +113,7 @@ void rna_def_keyingset_path(BlenderRNA *brna)
        /* Grouping */
        prop= RNA_def_property(srna, "grouping", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "groupmode");
-       RNA_def_property_enum_items(prop, prop_mode_grouping_items);
+       RNA_def_property_enum_items(prop, keyingset_path_grouping_items);
        RNA_def_property_ui_text(prop, "Grouping Method", "Method used to define which Group-name to use.");
        
        /* Path + Array Index */
@@ -170,7 +171,8 @@ void rna_def_keyingset(BlenderRNA *brna)
        RNA_def_property_boolean_sdna(prop, NULL, "keyingflag", INSERTKEY_MATRIX);
        RNA_def_property_ui_text(prop, "Insert Keyframes - Visual", "Insert keyframes based on 'visual transforms'.");
        
-       
+       /* Keying Set API */
+       RNA_api_keyingset(srna);
 }
 
 /* --- */
diff --git a/source/blender/makesrna/intern/rna_animation_api.c b/source/blender/makesrna/intern/rna_animation_api.c
new file mode 100644 (file)
index 0000000..6af8733
--- /dev/null
@@ -0,0 +1,89 @@
+/**
+ * $Id:
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. 
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2009 Blender Foundation.
+ * All rights reserved.
+ *
+ * 
+ * Contributor(s): Joshua Leung
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "RNA_define.h"
+#include "RNA_enum_types.h"
+#include "RNA_types.h"
+
+#include "DNA_anim_types.h"
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
+
+#ifdef RNA_RUNTIME
+
+#include "BKE_animsys.h"
+
+static void rna_KeyingSet_add_destination(KeyingSet *keyingset, ReportList *reports, 
+               ID *id, char rna_path[], int array_index, int entire_array,
+               int grouping_method, char group_name[])
+{
+       short flag = 0;
+       
+       /* validate flags */
+       if (entire_array)
+               flag |= KSP_FLAG_WHOLE_ARRAY;
+       
+       /* if data is valid, call the API function for this */
+       if (keyingset) {
+               BKE_keyingset_add_destination(keyingset, id, group_name, rna_path, array_index, flag, grouping_method);
+       }
+       else {
+               BKE_report(reports, RPT_ERROR, "Keying Set Destination could not be added.");
+       }
+}
+
+#else
+
+void RNA_api_keyingset(StructRNA *srna)
+{
+       FunctionRNA *func;
+       PropertyRNA *parm;
+       
+       /* Add Destination */
+       func= RNA_def_function(srna, "add_destination", "rna_KeyingSet_add_destination");
+       RNA_def_function_ui_description(func, "Add a new destination for the Keying Set.");
+       RNA_def_function_flag(func, FUNC_USE_REPORTS);
+               /* ID-block for target */
+       parm= RNA_def_pointer(func, "target_id", "ID", "Target ID", "ID-Datablock for the destination."); 
+               RNA_def_property_flag(parm, PROP_REQUIRED);
+               /* rna-path */
+       parm= RNA_def_string(func, "rna_path", "", 256, "RNA-Path", "RNA-Path to destination property."); // xxx hopefully this is long enough
+               RNA_def_property_flag(parm, PROP_REQUIRED);
+       parm=RNA_def_int(func, "array_index", 0, 0, INT_MAX, "Array Index", "If applicable, the index ", 0, INT_MAX);
+               /* flags */
+       parm=RNA_def_boolean(func, "entire_array", 1, "Entire Array", "When an 'array/vector' type is chosen (Location, Rotation, Color, etc.), entire array is to be used.");
+               /* grouping */
+       parm=RNA_def_enum(func, "grouping_method", keyingset_path_grouping_items, KSP_GROUP_KSNAME, "Grouping Method", "Method used to define which Group-name to use.");
+       parm=RNA_def_string(func, "group_name", "", 64, "Group Name", "Name of Action Group to assign destination to (only if grouping mode is to use this name).");
+}
+
+#endif
+
index 579441691ff3f03deb7e78ead71d2a3f8f5911e4..bd28085692f3ae2e7d9ab329c52a7c3d0b43be53 100644 (file)
@@ -197,9 +197,11 @@ void rna_Object_update_data(struct bContext *C, struct PointerRNA *ptr);
 
 /* API functions */
 
+void RNA_api_keyingset(struct StructRNA *srna);
 void RNA_api_main(struct StructRNA *srna);
 void RNA_api_mesh(struct StructRNA *srna);
 void RNA_api_object(struct StructRNA *srna);
+void RNA_api_scene(struct StructRNA *srna);
 void RNA_api_ui_layout(struct StructRNA *srna);
 void RNA_api_wm(struct StructRNA *srna);
 
index b90c3505d7312b050ab770030980920b32665894..bfebc5ee49f1eda70bad3b43f031eceeefa514fd 100644 (file)
@@ -364,7 +364,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
        RNA_def_struct_ui_text(srna, "Pose Channel", "Channel defining pose data for a bone in a Pose.");
        RNA_def_struct_path_func(srna, "rna_PoseChannel_path");
        RNA_def_struct_idproperties_func(srna, "rna_PoseChannel_idproperties");
-
+       
        /* Bone Constraints */
        prop= RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_struct_type(prop, "Constraint");
@@ -375,11 +375,11 @@ static void rna_def_pose_channel(BlenderRNA *brna)
        RNA_def_property_string_funcs(prop, NULL, NULL, "rna_PoseChannel_name_set");
        RNA_def_property_ui_text(prop, "Name", "");
        RNA_def_struct_name_property(srna, prop);
-
+       
        prop= RNA_def_property(srna, "selected", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "selectflag", BONE_SELECTED);
        RNA_def_property_ui_text(prop, "Selected", "");
-       
+
        /* Baked Bone Path cache data s*/
        prop= RNA_def_property(srna, "path_start_frame", PROP_INT, PROP_TIME);
        RNA_def_property_int_sdna(prop, NULL, "pathsf");
@@ -392,7 +392,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "Bone Paths Calculation End Frame", "End frame of range of frames to use for Bone Path calculations.");
        RNA_def_property_update(prop, NC_OBJECT|ND_POSE|ND_TRANSFORM, "rna_Pose_update");
-
+       
        /* Relationships to other bones */
        prop= RNA_def_property(srna, "bone", PROP_POINTER, PROP_NEVER_NULL);
        RNA_def_property_struct_type(prop, "Bone");
@@ -408,7 +408,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
        RNA_def_property_struct_type(prop, "PoseChannel");
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "Child", "Child of this pose channel.");
-
+       
        /* Transformation settings */
        prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
        RNA_def_property_float_sdna(prop, NULL, "loc");
@@ -462,7 +462,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
        prop= RNA_def_property(srna, "pose_tail", PROP_FLOAT, PROP_TRANSLATION);
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "Pose Tail Position", "Location of tail of the channel's bone.");
-
+       
        /* IK Settings */
        prop= RNA_def_property(srna, "has_ik", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_funcs(prop,  "rna_PoseChannel_has_ik_get", NULL);
@@ -559,7 +559,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
        RNA_def_property_range(prop, 0.0f,1.0f);
        RNA_def_property_ui_text(prop, "IK Stretch", "Allow scaling of the bone for IK.");
        RNA_def_property_update(prop, NC_OBJECT|ND_POSE|ND_TRANSFORM, "rna_Pose_update");
-
+       
        /* custom bone shapes */
        prop= RNA_def_property(srna, "custom_shape", PROP_POINTER, PROP_NONE);
        RNA_def_property_pointer_sdna(prop, NULL, "custom");
@@ -567,7 +567,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
        RNA_def_property_flag(prop, PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "Custom Object", "Object that defines custom draw type for this bone.");
        RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
-
+       
        /* bone groups */
        prop= RNA_def_property(srna, "bone_group_index", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "agrp_index");
index 40e3efc9e46eccde35c82edd375eb23234c8cd88..592836c82782b6e3eb35f025edc693a9ea9a6a99 100644 (file)
@@ -1995,6 +1995,9 @@ void RNA_def_scene(BlenderRNA *brna)
        rna_def_scene_render_data(brna);
        rna_def_scene_game_data(brna);
        rna_def_scene_render_layer(brna);
+       
+       /* Scene API */
+       RNA_api_scene(srna);
 }
 
 #endif
diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c
new file mode 100644 (file)
index 0000000..26047ab
--- /dev/null
@@ -0,0 +1,100 @@
+/**
+ * $Id:
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. 
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2009 Blender Foundation.
+ * All rights reserved.
+ *
+ * 
+ * Contributor(s): Joshua Leung
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "RNA_define.h"
+#include "RNA_enum_types.h"
+#include "RNA_types.h"
+
+#include "DNA_anim_types.h"
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
+
+#ifdef RNA_RUNTIME
+
+#include "BKE_animsys.h"
+
+// Scene API stuff from kazanbas branch here...
+
+
+static KeyingSet *rna_Scene_add_keying_set(Scene *sce, ReportList *reports, 
+               char name[], int absolute, int insertkey_needed, int insertkey_visual)
+{
+       KeyingSet *ks= NULL;
+       short flag=0, keyingflag=0;
+       
+       /* validate flags */
+       if (absolute)
+               flag |= KEYINGSET_ABSOLUTE;
+       if (insertkey_needed)
+               keyingflag |= INSERTKEY_NEEDED;
+       if (insertkey_visual)
+               keyingflag |= INSERTKEY_MATRIX;
+               
+       /* call the API func, and set the active keyingset index */
+       ks= BKE_keyingset_add(&sce->keyingsets, name, flag, keyingflag);
+       
+       if (ks) {
+               sce->active_keyingset= BLI_countlist(&sce->keyingsets);
+               return ks;
+       }
+       else {
+               BKE_report(reports, RPT_ERROR, "Keying Set could not be added.");
+               return NULL;
+       }
+}
+
+#else
+
+void RNA_api_scene(StructRNA *srna)
+{
+       FunctionRNA *func;
+       PropertyRNA *parm;
+       
+       // Scene API stuff from kazanbas branch here...
+       
+       /* Add Keying Set */
+       func= RNA_def_function(srna, "add_keying_set", "rna_Scene_add_keying_set");
+       RNA_def_function_ui_description(func, "Add a new Keying Set to Scene.");
+       RNA_def_function_flag(func, FUNC_USE_REPORTS);
+               /* returns the new KeyingSet */
+       parm= RNA_def_pointer(func, "keyingset", "KeyingSet", "", "Newly created Keying Set.");
+               RNA_def_function_return(func, parm);
+               /* name */
+       RNA_def_string(func, "name", "KeyingSet", 64, "Name", "Name of Keying Set");
+               /* flags */
+       RNA_def_boolean(func, "absolute", 1, "Absolute", "Keying Set defines specific paths/settings to be keyframed (i.e. is not reliant on context info)");
+               /* keying flags */
+       RNA_def_boolean(func, "insertkey_needed", 0, "Insert Keyframes - Only Needed", "Only insert keyframes where they're needed in the relevant F-Curves.");
+       RNA_def_boolean(func, "insertkey_visual", 0, "Insert Keyframes - Visual", "Insert keyframes based on 'visual transforms'.");
+}
+
+#endif
+
index ed654eaf526c4450fa77316b3a1e9ae0d9f3d0d0..1a0edfd53ed450da892dfec0c3925db8e6a0a66a 100644 (file)
@@ -217,7 +217,6 @@ void shade_input_do_shade(ShadeInput *shi, ShadeResult *shr)
        }
        else alpha= 1.0f;
        
-       
        /* add mist and premul color */
        if(shr->alpha!=1.0f || alpha!=1.0f) {
                float fac= alpha*(shr->alpha);
index 7d3519247444d3a8e5b7cd95545ef19271b2c618..881747edff2362d5ccc990fa7a99acc95817972d 100644 (file)
@@ -110,10 +110,10 @@ bool KX_MouseFocusSensor::Evaluate()
                        m_positive_event = true;
                        if (!m_mouse_over_in_previous_frame) {
                                result = true;
-                       } 
+                       }
                        else if(m_bTouchPulse && (m_hitObject != m_hitObject_Last)) {
                                result = true;
-               } 
+                       }
                } 
                if (reset) {
                        // force an event 
@@ -130,7 +130,7 @@ bool KX_MouseFocusSensor::Evaluate()
 
        m_mouse_over_in_previous_frame = obHasFocus;
        m_hitObject_Last = (void *)m_hitObject;
-
+                                          
        return result;
 }