Revision: 20168
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20168
Author:   yukishiro
Date:     2009-05-12 04:03:47 +0200 (Tue, 12 May 2009)

Log Message:
-----------
merge from 2.5

Modified Paths:
--------------
    branches/soc-2009-yukishiro/release/ui/buttons_material.py
    branches/soc-2009-yukishiro/release/ui/buttons_scene.py
    branches/soc-2009-yukishiro/source/blender/blenkernel/intern/fcurve.c
    
branches/soc-2009-yukishiro/source/blender/editors/animation/anim_ipo_utils.c
    branches/soc-2009-yukishiro/source/blender/editors/animation/keyframing.c
    branches/soc-2009-yukishiro/source/blender/editors/space_graph/graph_edit.c
    branches/soc-2009-yukishiro/source/blender/makesrna/intern/rna_access.c
    branches/soc-2009-yukishiro/source/blender/makesrna/intern/rna_curve.c
    branches/soc-2009-yukishiro/source/blender/makesrna/intern/rna_object.c
    branches/soc-2009-yukishiro/source/blender/python/epy_doc_gen.py
    branches/soc-2009-yukishiro/source/blender/python/intern/bpy_interface.c

Added Paths:
-----------
    branches/soc-2009-yukishiro/release/ui/buttons_data_empty.py

Copied: branches/soc-2009-yukishiro/release/ui/buttons_data_empty.py (from rev 
20167, branches/blender2.5/blender/release/ui/buttons_data_empty.py)
===================================================================
--- branches/soc-2009-yukishiro/release/ui/buttons_data_empty.py                
                (rev 0)
+++ branches/soc-2009-yukishiro/release/ui/buttons_data_empty.py        
2009-05-12 02:03:47 UTC (rev 20168)
@@ -0,0 +1,28 @@
+
+import bpy
+
+class DataButtonsPanel(bpy.types.Panel):
+       __space_type__ = "BUTTONS_WINDOW"
+       __region_type__ = "WINDOW"
+       __context__ = "data"
+       
+       def poll(self, context):
+               ob = context.active_object
+               return (ob and ob.type == 'EMPTY')
+       
+class DATA_PT_empty(DataButtonsPanel):
+       __idname__ = "DATA_PT_empty"
+       __label__ = "Empty"
+
+       def draw(self, context):
+               ob = context.active_object
+               layout = self.layout
+
+               if not ob:
+                       return
+                       
+               layout.column()
+               layout.itemR(ob, "empty_draw_type")
+               layout.itemR(ob, "empty_draw_size")
+               
+bpy.types.register(DATA_PT_empty)
\ No newline at end of file

Modified: branches/soc-2009-yukishiro/release/ui/buttons_material.py
===================================================================
--- branches/soc-2009-yukishiro/release/ui/buttons_material.py  2009-05-12 
01:56:57 UTC (rev 20167)
+++ branches/soc-2009-yukishiro/release/ui/buttons_material.py  2009-05-12 
02:03:47 UTC (rev 20168)
@@ -11,11 +11,13 @@
        __label__ = "Material"
        
        def draw(self, context):
-               mat = context.main.materials[0]
-               layout = self.layout
+               try:            mat = context.active_object.active_material
+               except: mat = None
                
                if not mat:
-                       return 
+                       return
+                       
+               layout = self.layout
        
                layout.row()
                layout.itemR(mat, "diffuse_color")
@@ -31,12 +33,14 @@
        __label__ = "Subsurface Scattering"
        
        def draw(self, context):
-               sss = context.main.materials[0].subsurface_scattering 
-               layout = self.layout
+               try:            sss = 
context.active_object.active_material.subsurface_scattering
+               except: sss = None
                
                if not sss:
                        return 
                
+               layout = self.layout
+               
                layout.row()
                layout.itemR(sss, "enabled", text="Enable")
                
@@ -60,12 +64,14 @@
        __label__ = "Ray Mirror"
        
        def draw(self, context):
-               raym = context.main.materials[0].raytrace_mirror
-               layout = self.layout
+               try:            raym = 
context.active_object.active_material.raytrace_mirror
+               except: raym = None
                
                if not raym:
                        return 
-
+               
+               layout = self.layout
+               
                layout.row()
                layout.itemR(raym, "enabled", text="Enable")
                
@@ -93,12 +99,14 @@
        __idname__= "MATERIAL_PT_raytransp"
        __label__= "Ray Transparency"
 
-       def draw(self, context):
-               rayt = context.main.materials[0].raytrace_transparency
-               layout = self.layout
+       def draw(self, context):
+               try:            rayt = 
context.active_object.active_material.raytrace_transparency
+               except: rayt = None
 
                if not rayt:
-                       return
+                       return
+               
+               layout = self.layout
 
                layout.row()
                layout.itemR(rayt, "enabled", text="Enable")

Modified: branches/soc-2009-yukishiro/release/ui/buttons_scene.py
===================================================================
--- branches/soc-2009-yukishiro/release/ui/buttons_scene.py     2009-05-12 
01:56:57 UTC (rev 20167)
+++ branches/soc-2009-yukishiro/release/ui/buttons_scene.py     2009-05-12 
02:03:47 UTC (rev 20168)
@@ -93,7 +93,7 @@
 
                layout.row()
                layout.itemO("SCREEN_OT_render", text="RENDER", icon=0) # 
ICON_SCENE
-               #layout.itemO("SCREEN_OT_render", text="ANIM", icon=0) # 
"anim", 1
+               layout.item_booleanO("SCREEN_OT_render", 'anim', True, 
text="ANIM", icon=0)
 
                layout.row()
                layout.itemR(scene, "start_frame", text="Start")

Modified: branches/soc-2009-yukishiro/source/blender/blenkernel/intern/fcurve.c
===================================================================
--- branches/soc-2009-yukishiro/source/blender/blenkernel/intern/fcurve.c       
2009-05-12 01:56:57 UTC (rev 20167)
+++ branches/soc-2009-yukishiro/source/blender/blenkernel/intern/fcurve.c       
2009-05-12 02:03:47 UTC (rev 20168)
@@ -210,8 +210,10 @@
                                BezTriple *bezt;
                                
                                for (bezt=fcu->bezt, i=0; i < fcu->totvert; 
bezt++, i++) {
-                                       yminv= MIN2(yminv, bezt->vec[1][1]);
-                                       ymaxv= MAX2(ymaxv, bezt->vec[1][1]);
+                                       if (bezt->vec[1][1] < yminv)
+                                               yminv= bezt->vec[1][1];
+                                       if (bezt->vec[1][1] > ymaxv)
+                                               ymaxv= bezt->vec[1][1];
                                }
                        }
                }
@@ -227,8 +229,10 @@
                                FPoint *fpt;
                                
                                for (fpt=fcu->fpt, i=0; i < fcu->totvert; 
fpt++, i++) {
-                                       yminv= MIN2(yminv, fpt->vec[1]);
-                                       ymaxv= MAX2(ymaxv, fpt->vec[1]);
+                                       if (fpt->vec[1] < yminv)
+                                               yminv= fpt->vec[1];
+                                       if (fpt->vec[1] > ymaxv)
+                                               ymaxv= fpt->vec[1];
                                }
                        }
                }

Modified: 
branches/soc-2009-yukishiro/source/blender/editors/animation/anim_ipo_utils.c
===================================================================
--- 
branches/soc-2009-yukishiro/source/blender/editors/animation/anim_ipo_utils.c   
    2009-05-12 01:56:57 UTC (rev 20167)
+++ 
branches/soc-2009-yukishiro/source/blender/editors/animation/anim_ipo_utils.c   
    2009-05-12 02:03:47 UTC (rev 20168)
@@ -148,12 +148,6 @@
                        
                        /* Array Index - only if applicable */
                        if (RNA_property_array_length(prop)) {
-                                       // XXX the format of these is not 
final... we don't know how this will go yet
-                                       // format 1 style
-                               //static char *vectoritem[4]= {".X", ".Y", 
".Z", ".W"};
-                               //static char *quatitem[4]= {".W", ".X", ".Y", 
".Z"};
-                               //static char *coloritem[4]= {".R", ".G", ".B", 
".A"};
-                                       // format 2 style
                                static char *vectoritem[4]= {"X ", "Y ", "Z ", 
"W "};
                                static char *quatitem[4]= {"W ", "X ", "Y ", "Z 
"};
                                static char *coloritem[4]= {"R ", "G ", "B ", 
"A "};
@@ -181,8 +175,7 @@
                        
                        /* putting this all together into the buffer */
                        // XXX we need to check for invalid names...
-                       //BLI_snprintf(name, 128, "%s.%s%s", structname, 
propname, arrayname);  // format 1
-                       BLI_snprintf(name, 128, "%s%s (%s)", arrayname, 
propname, structname);  // format 2
+                       BLI_snprintf(name, 128, "%s%s (%s)", arrayname, 
propname, structname); 
                        
                        /* free temp name if nameprop is set */
                        if (nameprop)
@@ -197,6 +190,7 @@
 
 /* ------------------------------- Color Codes for F-Curve Channels 
---------------------------- */
 
+#if 0
 /* used for FCURVE_COLOR_AUTO_RAINBOW */
 // XXX this still doesn't work too great when there are more than 32 curves 
(which happens most of the time)
 void ipo_rainbow (int cur, int tot, float *out)
@@ -206,14 +200,57 @@
        dfac= (float)(1.0/( (float)tot+1.0));
        
        /* this calculation makes 2 or 4 different cycles of rainbow colors */
+               // 2 different cycles - for hue
        if(cur< tot/2) fac= (float)(cur*2.0f*dfac);
        else fac= (float)((cur-tot/2)*2.0f*dfac +dfac);
+       
+               // third cycle with altered hue
        if(tot > 32) fac= fac*1.95f;
+               // clamping for excessive ranges
        if(fac>1.0f) fac-= 1.0f;
        
+               // saturation adjustments for more visible range
        if(fac>0.5f && fac<0.8f) sat= 0.5f;
        else sat= 0.6f;
        
-       //return hsv_to_cpack(fac, sat, 1.0f);
        hsv_to_rgb(fac, sat, 1.0f, out, out+1, out+2);
 }
+#endif
+
+/* step between the major distinguishable color bands of the primary colors */
+#define HSV_BANDWIDTH  0.3f
+
+/* testbed for FCURVE_COLOR_AUTO_RAINBOW determination methods */
+//void fcurve_rainbow (unsigned int cur, unsigned int tot, float *out)
+void ipo_rainbow (int cur, int tot, float *out)
+{
+       float hue, val, sat, fac;
+       int grouping;
+       
+       /* we try to divide the colours into groupings of n colors,
+        * where n is:
+        *      3 - for 'odd' numbers of curves - there should be a majority of 
triplets of curves
+        *      4 - for 'even' numbers of curves - there should be a majority 
of quartets of curves
+        * so the base color is simply one of the three primary colors
+        */
+       grouping= (4 - (tot % 2));
+       hue= HSV_BANDWIDTH * (float)(cur % grouping);
+       
+       /* 'Value' (i.e. darkness) needs to vary so that larger sets of three 
will be 
+        * 'darker' (i.e. smaller value), so that they don't look that similar 
to previous ones.
+        * However, only a range of 0.3 to 1.0 is really usable to avoid 
clashing
+        * with some other stuff 
+        */
+       fac = ((float)cur / (float)tot) * 0.7f;
+       val = 1.0f - fac;
+       
+       /* the base color can get offset a bit so that the colors aren't so 
identical */
+       hue += fac * HSV_BANDWIDTH; 
+       if (hue > 1.0f) hue= fmod(hue, 1.0f);
+       
+       /* saturation fluctuates between 0.5 and 1.0 */
+       sat = ((cur / grouping) % 2) ? 0.61f : 0.96f;
+       
+       /* finally, conver this to RGB colors */
+       hsv_to_rgb(hue, sat, val, out, out+1, out+2); 
+}

Modified: 
branches/soc-2009-yukishiro/source/blender/editors/animation/keyframing.c
===================================================================
--- branches/soc-2009-yukishiro/source/blender/editors/animation/keyframing.c   
2009-05-12 01:56:57 UTC (rev 20167)
+++ branches/soc-2009-yukishiro/source/blender/editors/animation/keyframing.c   
2009-05-12 02:03:47 UTC (rev 20168)
@@ -29,6 +29,7 @@
 #include "BKE_action.h"
 #include "BKE_constraint.h"
 #include "BKE_fcurve.h"
+#include "BKE_global.h"
 #include "BKE_utildefines.h"
 #include "BKE_context.h"
 #include "BKE_report.h"
@@ -68,6 +69,7 @@
                adt= BKE_id_add_animdata(id);
        if (adt == NULL) { 
                /* if still none (as not allowed to add, or ID doesn't have 
animdata for some reason) */
+               printf("ERROR: Couldn't add AnimData (ID = %s) \n", (id) ? 
(id->name) : "<None>");
                return NULL;
        }
                
@@ -793,6 +795,9 @@
                }
        }
        
+       /* no F-Curve to add keyframes to */
+       printf("ERROR: no F-Curve to add keyframes to \n");
+       
        /* return failure */
        return 0;
 }
@@ -1203,11 +1208,11 @@
        memset(&ptr, 0, sizeof(PointerRNA));
        uiAnimContextProperty(C, &ptr, &prop, &index);
        
-       if(ptr.data && prop && RNA_property_animateable(&ptr, prop)) {
+       if ((ptr.data && prop) && RNA_property_animateable(&ptr, prop)) {
                path= RNA_path_from_ID_to_property(&ptr, prop);
                
-               if(path) {
-                       if(all) {
+               if (path) {
+                       if (all) {
                                length= RNA_property_array_length(prop);
                                
                                if(length) index= 0;
@@ -1216,14 +1221,20 @@
                        else
                                length= 1;
                        
-                       for(a=0; a<length; a++)
+                       for (a=0; a<length; a++)
                                success+= insert_keyframe(ptr.id.data, NULL, 
NULL, path, index+a, cfra, 0);
                        
                        MEM_freeN(path);
                }
+               else if (G.f & G_DEBUG)
+                       printf("Button Insert-Key: no path to property \n");
        }
+       else if (G.f & G_DEBUG) {
+               printf("ptr.data = %p, prop = %p,", ptr.data, prop);
+               printf("animateable = %d \n", RNA_property_animateable(&ptr, 
prop));
+       }
        
-       if(success) {
+       if (success) {
                /* send updates */
                ED_anim_dag_flush_update(C);    
                
@@ -1267,11 +1278,11 @@

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to