Commit: 591cee2707f834af574a0b41db10b9ba7034bca3
Author: Julian Eisel
Date:   Fri Dec 16 00:58:06 2016 +0100
Branches: custom-manipulators
https://developer.blender.org/rB591cee2707f834af574a0b41db10b9ba7034bca3

Merge branch 'blender2.8' into custom-manipulators

Conflicts:
        source/blender/editors/interface/resources.c
        source/blender/editors/space_node/drawnode.c
        source/blender/makesrna/intern/rna_wm.c

===================================================================



===================================================================

diff --cc source/blender/blenloader/intern/versioning_270.c
index f10c59f,c9335f6..eba1746
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@@ -1360,59 -1414,5 +1414,44 @@@ void blo_do_versions_270(FileData *fd, 
                                }
                        }
                }
- 
-               if (!DNA_struct_elem_find(fd->filesdna, "RigidBodyCon", 
"float", "spring_stiffness_ang_x")) {
-                       Object *ob;
-                       for (ob = main->object.first; ob; ob = ob->id.next) {
-                               RigidBodyCon *rbc = ob->rigidbody_constraint;
-                               if (rbc) {
-                                       rbc->spring_stiffness_ang_x = 10.0;
-                                       rbc->spring_stiffness_ang_y = 10.0;
-                                       rbc->spring_stiffness_ang_z = 10.0;
-                                       rbc->spring_damping_ang_x = 0.5;
-                                       rbc->spring_damping_ang_y = 0.5;
-                                       rbc->spring_damping_ang_z = 0.5;
-                               }
-                       }
-               }
        }
 +
 +      {
 +              if (!DNA_struct_elem_find(fd->filesdna, "SpaceNode", "float", 
"backdrop_zoom")) {
 +                      bScreen *sc;
 +                      for (sc = main->screen.first; sc; sc = sc->id.next) {
 +                              ScrArea *sa;
 +                              for (sa = sc->areabase.first; sa; sa = 
sa->next) {
 +                                      SpaceLink *sl;
 +                                      for (sl = sa->spacedata.first; sl; sl = 
sl->next) {
 +                                              if (sl->spacetype == 
SPACE_NODE) {
 +                                                      SpaceNode *snode = 
(SpaceNode *)sl;
 +                                                      snode->backdrop_zoom = 
1.0;
 +                                              }
 +                                              if (sl->spacetype == SPACE_SEQ) 
{
 +                                                      SpaceSeq *sseq = 
(SpaceSeq *)sl;
 +                                                      sseq->overdrop_zoom = 
1.0;
 +                                              }
 +                                      }
 +                              }
 +                      }
 +              }
 +
 +              if (!DNA_struct_elem_find(fd->filesdna, "SpaceIpo", "float", 
"backdrop_zoom")) {
 +                      bScreen *sc;
 +                      for (sc = main->screen.first; sc; sc = sc->id.next) {
 +                              ScrArea *sa;
 +                              for (sa = sc->areabase.first; sa; sa = 
sa->next) {
 +                                      SpaceLink *sl;
 +                                      for (sl = sa->spacedata.first; sl; sl = 
sl->next) {
 +                                              if (sl->spacetype == SPACE_IPO) 
{
 +                                                      SpaceIpo *sipo = 
(SpaceIpo *)sl;
 +                                                      sipo->backdrop_zoom = 
1.0f;
 +                                                      sipo->backdrop_opacity 
= 0.7f;
 +                                              }
 +                                      }
 +                              }
 +                      }
 +              }
 +      }
  }
diff --cc source/blender/editors/interface/resources.c
index 2920e5a,73a9ea9..b4b8610
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@@ -2782,26 -2799,21 +2782,35 @@@ void init_userdef_do_versions(void
                }
        }
  
-       if (!USER_VERSION_ATLEAST(278, 2)) {
+       if (!USER_VERSION_ATLEAST(278, 3)) {
+               for (bTheme *btheme = U.themes.first; btheme; btheme = 
btheme->next) {
+                       /* Keyframe Indicators (were using wrong alpha) */
+                       btheme->tv3d.time_keyframe[3] = 
btheme->tv3d.time_gp_keyframe[3] = 255;
+                       btheme->ttime.time_keyframe[3] = 
btheme->ttime.time_gp_keyframe[3] = 255;
+               }
+       }
+ 
++      if (!USER_VERSION_ATLEAST(278, 3)) {
 +              bTheme *btheme;
 +              for (btheme = U.themes.first; btheme; btheme = btheme->next) {
 +                      rgba_char_args_set_fl(btheme->tui.xaxis, 1.0f, 0.27f, 
0.27f, 1.0f); /* red */
 +                      rgba_char_args_set_fl(btheme->tui.yaxis, 0.27f, 1.0f, 
0.27f, 1.0f); /* green */
 +                      rgba_char_args_set_fl(btheme->tui.zaxis, 0.27f, 0.27f, 
1.0f, 1.0f); /* blue */
 +              }
 +      }
 +
        /**
         * Include next version bump.
         *
         * (keep this block even if it becomes empty).
         */
        {
-               for (bTheme *btheme = U.themes.first; btheme; btheme = 
btheme->next) {
-                       /* Keyframe Indicators (were using wrong alpha) */
-                       btheme->tv3d.time_keyframe[3] = 
btheme->tv3d.time_gp_keyframe[3] = 255;
-                       btheme->ttime.time_keyframe[3] = 
btheme->ttime.time_gp_keyframe[3] = 255;
 -              
++              bTheme *btheme;
++              for (btheme = U.themes.first; btheme; btheme = btheme->next) {
++                      rgba_char_args_set_fl(btheme->tui.xaxis, 1.0f, 0.27f, 
0.27f, 1.0f); /* red */
++                      rgba_char_args_set_fl(btheme->tui.yaxis, 0.27f, 1.0f, 
0.27f, 1.0f); /* green */
++                      rgba_char_args_set_fl(btheme->tui.zaxis, 0.27f, 0.27f, 
1.0f, 1.0f); /* blue */
 +              }
        }
  
        if (U.pixelsize == 0.0f)
diff --cc source/blender/editors/screen/area.c
index c60c134,19224ed..aae0284
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@@ -59,9 -56,9 +59,10 @@@
  #include "ED_screen.h"
  #include "ED_screen_types.h"
  #include "ED_space_api.h"
 +#include "ED_view3d.h"
  
  #include "GPU_immediate.h"
+ #include "GPU_draw.h"
  
  #include "BIF_gl.h"
  #include "BIF_glutil.h"
@@@ -2402,77 -2439,54 +2446,96 @@@ void ED_region_grid_draw(ARegion *ar, f
                }
        }
  
-       /* the fine resolution level */
        blendfac = 0.25f * gridsize - floorf(0.25f * gridsize);
        CLAMP(blendfac, 0.0f, 1.0f);
-       UI_ThemeColorShade(TH_BACK, (int)(20.0f * (1.0f - blendfac)));
  
-       fac = 0.0f;
-       glBegin(GL_LINES);
-       while (fac < 1.0f) {
-               glVertex2f(x1, y1 * (1.0f - fac) + y2 * fac);
-               glVertex2f(x2, y1 * (1.0f - fac) + y2 * fac);
-               glVertex2f(x1 * (1.0f - fac) + x2 * fac, y1);
-               glVertex2f(x1 * (1.0f - fac) + x2 * fac, y2);
-               fac += gridstep;
-       }
+       int count_fine = 1.0f / gridstep;
+       int count_large = 1.0f / (4.0f * gridstep);
  
-       /* the large resolution level */
-       UI_ThemeColor(TH_BACK);
+       if (count_fine > 0) {
+               VertexFormat_clear(format);
+               pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT);
+               unsigned color = add_attrib(format, "color", GL_FLOAT, 3, 
KEEP_FLOAT);
+               
+               immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
+               immBegin(GL_LINES, 4 * count_fine + 4 * count_large);
+               
+               float theme_color[3];
+               UI_GetThemeColorShade3fv(TH_BACK, (int)(20.0f * (1.0f - 
blendfac)), theme_color);
+               immAttrib3fv(color, theme_color);
+               fac = 0.0f;
+               
+               /* the fine resolution level */
+               for (int i = 0; i < count_fine; i++) {
+                       immVertex2f(pos, x1, y1 * (1.0f - fac) + y2 * fac);
+                       immVertex2f(pos, x2, y1 * (1.0f - fac) + y2 * fac);
+                       immVertex2f(pos, x1 * (1.0f - fac) + x2 * fac, y1);
+                       immVertex2f(pos, x1 * (1.0f - fac) + x2 * fac, y2);
+                       fac += gridstep;
+               }
+ 
+               if (count_large > 0) {
+                       UI_GetThemeColor3fv(TH_BACK, theme_color);
+                       immAttrib3fv(color, theme_color);
+                       fac = 0.0f;
+                       
+                       /* the large resolution level */
+                       for (int i = 0; i < count_large; i++) {
+                               immVertex2f(pos, x1, y1 * (1.0f - fac) + y2 * 
fac);
+                               immVertex2f(pos, x2, y1 * (1.0f - fac) + y2 * 
fac);
+                               immVertex2f(pos, x1 * (1.0f - fac) + x2 * fac, 
y1);
+                               immVertex2f(pos, x1 * (1.0f - fac) + x2 * fac, 
y2);
+                               fac += 4.0f * gridstep;
+                       }
+               }
  
-       fac = 0.0f;
-       while (fac < 1.0f) {
-               glVertex2f(x1, y1 * (1.0f - fac) + y2 * fac);
-               glVertex2f(x2, y1 * (1.0f - fac) + y2 * fac);
-               glVertex2f(x1 * (1.0f - fac) + x2 * fac, y1);
-               glVertex2f(x1 * (1.0f - fac) + x2 * fac, y2);
-               fac += 4.0f * gridstep;
+               immEnd();
+               immUnbindProgram();
        }
-       glEnd();
  }
  
 +/* uses the viewplane from the given camera and draws it as a backdrop */
 +void ED_region_draw_backdrop_view3d(const bContext *C, struct Object *camera, 
const float alpha,
 +                                    const float width, const float height, 
const float x, const float y,
 +                                    const float zoomx, const float zoomy, 
const bool draw_background)
 +{
 +      Main *bmain = CTX_data_main(C);
 +      Scene *scene = CTX_data_scene(C);
 +      char err_out[256] = "unknown";
 +      struct ImBuf *ibuf;
 +
 +      BKE_scene_update_for_newframe(bmain->eval_ctx, bmain, scene, 
scene->lay);
 +      ibuf = ED_view3d_draw_offscreen_imbuf_simple(scene, camera, width, 
height, IB_rect,
 +                                                   OB_SOLID, false, false, 
false,
 +                                                   R_ADDSKY, 0, 
(scene->r.scemode & R_FULL_SAMPLE),
 +                                                   NULL, NULL, NULL, err_out);
 +
 +      if (ibuf == NULL)
 +              return;
 +
 +      glEnable(GL_BLEND);
 +      glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 +      glPushMatrix();
 +      glScalef(zoomx, zoomy, 0.0f);
 +      glTranslatef(x, y, 0.0f);
 +
 +      /* draw background */
 +      if (draw_background) {
 +              char col[4];
 +
 +              UI_GetThemeColorType4ubv(TH_HIGH_GRAD, SPACE_VIEW3D, col);
 +              glColor4ub(UNPACK3(col), alpha * 255);
 +              glRectf(0, 0, width, height);
 +      }
 +      /* draw the imbuf itself */
 +      glaDrawImBuf_glsl_ctx(C, ibuf, 0.0f, 0.0f, GL_NEAREST, alpha);
 +
 +      glPopMatrix();
 +      glDisable(GL_BLEND);
 +
 +      IMB_freeImBuf(ibuf);
 +}
 +
  /* If the area has overlapping regions, it returns visible rect for Region 
*ar */
  /* rect gets returned in local region coordinates */
  void ED_region_visible_rect(ARegion *ar, rcti *rect)
diff --cc source/blender/editors/space_node/drawnode.c
index 67e37cb,c3f2d05..2f7586c
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@@ -2183,17 -2184,24 +2184,24 @@@ static void node_composit_backdrop_view
        if (node->custom1 == 0) {
                const float backdropWidth = backdrop->x;
                const float backdropHeight = backdrop->y;
 -              const float cx  = x + snode->zoom * backdropWidth * 
node->custom3;
 -              const float cy = y + snode->zoom * backdropHeight * 
node->custom4;
 +              const float cx  = x + snode->backdrop_zoom * backdropWidth * 
node->custom3;
 +              const float cy = y + snode->backdrop_zoom * backdropHeight * 
node->custom4;
  
-               glColor3f(1.0, 1.0, 1.0);
+               VertexFormat* format = immVertexFormat();
+               unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, 
KEEP_FLOAT);
+ 
+               immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
+ 
+               immUniformColor3f(1.0f, 1.0f, 1.0f);
+ 
+               immBegin(GL_LINES, 4);
+               immVertex2f(pos, cx - 25, cy - 25);
+               immVertex2f(pos, cx + 25, cy + 25);
+               immVertex2f(pos, cx + 25, cy - 25);
+               immVertex2f(pos, cx - 25, cy + 25);
+               immEnd();
  
-               glBegin(GL_LINES);
-               glVertex2f(cx - 25, cy - 25);
-               glVertex2f(cx + 25, cy + 25);
-               glVertex2f(cx + 25, cy - 25);
-               glVertex2f(cx - 25, cy + 25);
-               glEnd();
+               immUnbindProgram();
        }
  }
  
@@@ -2212,27 -2220,33 +2220,33 @@@ static void node_composit_backdrop_boxm
        float cx, cy, x1, x2, x3, x4;
        float y1, y2, y3, y4;
  
- 
-       glColor3f(1.0, 1.0, 1.0);
- 
 -      cx  = x + snode->zoom * backdropWidth * boxmask->x;
 -      cy = y + snode->zoom * backdropHeight * boxmask->y;
 +      cx  = x + snode->backdrop_zoom * backdropWidth * boxmask->x;
 +      cy = y + snode->backdrop_zoom * backdropHeight * boxmask->y;
  
 -      x1 = cx - (cosine * halveBoxWidth + sine * halveBoxHeight) * 
snode->zoom;
 -      x2 = cx - (cosine * -halveBoxWidth + sine * halveBoxHeight) * 
snode->zoom;
 -      x3 = cx - (co

@@ Diff output truncated at 10240 characters. @@

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

Reply via email to