[Bf-blender-cvs] [1fc1fd8] blender2.8: OpenGL: draw area resize handle with new immediate mode
Commit: 1fc1fd837209d31608dbb89ff90ddb31ed89107c Author: Mike Erwin Date: Mon Aug 22 23:39:42 2016 -0400 Branches: blender2.8 https://developer.blender.org/rB1fc1fd837209d31608dbb89ff90ddb31ed89107c OpenGL: draw area resize handle with new immediate mode The little grabby handle in the corner of an area. Now uses 1 draw call instead of 6. Also one version of the (+) icon to show a hidden region. Why do we have multiple versions of this? Fixed a harmless signed/unsigned error. Fixed a GL state error that prematurely disabled blending. Added imm_draw_filled_circle function, which can be used for drawing other widgets. Work toward T49042 and T49043 === M source/blender/editors/include/BIF_glutil.h M source/blender/editors/screen/area.c M source/blender/editors/screen/glutil.c === diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h index 40d4639..a5a1200 100644 --- a/source/blender/editors/include/BIF_glutil.h +++ b/source/blender/editors/include/BIF_glutil.h @@ -81,10 +81,8 @@ void glutil_draw_lined_arc(float start, float angle, float radius, int nsegments void glutil_draw_filled_arc(float start, float angle, float radius, int nsegments); /** - * Draw a circle outline with the given \a radius, - * starting at angle \a start and arcing through - * \a angle. The circle is centered at \a x, \a y - * and drawn in the XY plane. + * Draw a circle outline with the given \a radius. + * The circle is centered at \a x, \a y and drawn in the XY plane. * * \param pos The vertex attribute number for position. * \param x Horizontal center. @@ -95,6 +93,18 @@ void glutil_draw_filled_arc(float start, float angle, float radius, int nsegment void imm_draw_lined_circle(unsigned pos, float x, float y, float radius, int nsegments); /** + * Draw a filled circle with the given \a radius. + * The circle is centered at \a x, \a y and drawn in the XY plane. + * + * \param pos The vertex attribute number for position. + * \param x Horizontal center. + * \param y Vertical center. + * \param radius The circle's radius. + * \param nsegments The number of segments to use in drawing (more = smoother). + */ +void imm_draw_filled_circle(unsigned pos, float x, float y, float radius, int nsegments); + +/** * Returns a float value as obtained by glGetFloatv. * The param must cause only one value to be gotten from GL. */ diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 8d058ed..0924f02 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -57,6 +57,9 @@ #include "ED_screen_types.h" #include "ED_space_api.h" +#include "GPU_shader.h" +#include "GPU_immediate.h" + #include "BIF_gl.h" #include "BIF_glutil.h" #include "BLF_api.h" @@ -206,7 +209,7 @@ static void area_draw_azone_fullscreen(short x1, short y1, short x2, short y2, f if (G.debug_value == 1) { rcti click_rect; float icon_size = UI_DPI_ICON_SIZE + 7 * UI_DPI_FAC; - char alpha_debug = 255 * alpha; + unsigned char alpha_debug = 255 * alpha; BLI_rcti_init(_rect, x, x + icon_size, y, y + icon_size); @@ -229,59 +232,73 @@ static void area_draw_azone(short x1, short y1, short x2, short y2) dx = copysign(ceilf(0.3f * abs(dx)), dx); dy = copysign(ceilf(0.3f * abs(dy)), dy); - glEnable(GL_BLEND); glEnable(GL_LINE_SMOOTH); + + VertexFormat* format = immVertexFormat(); + unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned col = add_attrib(format, "color", GL_UNSIGNED_BYTE, 4, NORMALIZE_INT_TO_FLOAT); + + immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); + immBegin(GL_LINES, 12); + + immAttrib4ub(col, 255, 255, 255, 180); + immVertex2f(pos, x1, y2); + immVertex2f(pos, x2, y1); + + immAttrib4ub(col, 255, 255, 255, 130); + immVertex2f(pos, x1, y2 - dy); + immVertex2f(pos, x2 - dx, y1); + + immAttrib4ub(col, 255, 255, 255, 80); + immVertex2f(pos, x1, y2 - 2 * dy); + immVertex2f(pos, x2 - 2 * dx, y1); - glColor4ub(255, 255, 255, 180); - fdrawline(x1, y2, x2, y1); - glColor4ub(255, 255, 255, 130); - fdrawline(x1, y2 - dy, x2 - dx, y1); - glColor4ub(255, 255, 255, 80); - fdrawline(x1, y2 - 2 * dy, x2 - 2 * dx, y1); - - glColor4ub(0, 0, 0, 210); - fdrawline(x1, y2 + 1, x2 + 1, y1); - glColor4ub(0, 0, 0, 180); - fdrawline(x1, y2 - dy + 1, x2 - dx + 1, y1); - glColor4ub(0, 0, 0, 150); - fdrawline(x1, y2 - 2 * dy + 1, x2 - 2 * dx + 1, y1); + immAttrib4ub(col, 0, 0, 0, 210); + immVertex2f(pos, x1, y2 + 1); + immVertex2f(pos, x2 + 1, y1); + +
[Bf-blender-cvs] [cbf0a28] fluid-mantaflow: adapted value ranges for some fields and removed vorticity guard in smoke script
Commit: cbf0a28f87e7dffc58654dd4e5e30fe366f1a204 Author: Sebastián Barschkis Date: Tue Aug 23 00:31:37 2016 +0200 Branches: fluid-mantaflow https://developer.blender.org/rBcbf0a28f87e7dffc58654dd4e5e30fe366f1a204 adapted value ranges for some fields and removed vorticity guard in smoke script === M intern/mantaflow/intern/strings/smoke_script.h M source/blender/makesrna/intern/rna_smoke.c === diff --git a/intern/mantaflow/intern/strings/smoke_script.h b/intern/mantaflow/intern/strings/smoke_script.h index 59df170..0fb19e6 100644 --- a/intern/mantaflow/intern/strings/smoke_script.h +++ b/intern/mantaflow/intern/strings/smoke_script.h @@ -241,8 +241,7 @@ def step_low():\n\ resetOutflow(flags=flags, real=density)\n\ \n\ mantaMsg('Vorticity')\n\ -if vorticity > 0.01:\n\ -vorticityConfinement(vel=vel, flags=flags, strength=$VORTICITY$)\n\ +vorticityConfinement(vel=vel, flags=flags, strength=$VORTICITY$)\n\ \n\ if using_heat:\n\ mantaMsg('Adding heat buoyancy')\n\ diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index 28c90b2..17edbb5 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -660,8 +660,8 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "time_scale", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "time_scale"); - RNA_def_property_range(prop, 0.2, 1.5); - RNA_def_property_ui_range(prop, 0.2, 1.5, 0.02, 5); + RNA_def_property_range(prop, 0.0001, 10.0); + RNA_def_property_ui_range(prop, 0.0001, 10.0, 0.02, 5); RNA_def_property_ui_text(prop, "Time Scale", "Adjust simulation speed"); RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache"); @@ -802,26 +802,26 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "noise_pos_scale", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "noise_pos_scale"); - RNA_def_property_range(prop, 0.1, 10.0); - RNA_def_property_ui_range(prop, 0.1, 2.0, 1, 2); + RNA_def_property_range(prop, 0.0001, 10.0); + RNA_def_property_ui_range(prop, 0.0001, 10.0, 0.02, 5); RNA_def_property_ui_text(prop, "Scale", "Scale of noise (higher value results in larger vortices)"); RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache"); prop = RNA_def_property(srna, "noise_time_anim", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "noise_time_anim"); - RNA_def_property_range(prop, 0.1, 10.0); - RNA_def_property_ui_range(prop, 0.1, 2.0, 1, 2); + RNA_def_property_range(prop, 0.0001, 10.0); + RNA_def_property_ui_range(prop, 0.0001, 10.0, 0.02, 5); RNA_def_property_ui_text(prop, "Time", "Animation time of noise"); prop = RNA_def_property(srna, "particle_randomness", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.0, 2.0); - RNA_def_property_ui_range(prop, 0.01, 2.0, 1.0, 5); + RNA_def_property_range(prop, 0.0, 10.0); + RNA_def_property_ui_range(prop, 0.0, 10.0, 0.02, 5); RNA_def_property_ui_text(prop, "Randomness", "Randomness factor for particle sampling"); RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache"); prop = RNA_def_property(srna, "particle_number", PROP_INT, PROP_NONE); - RNA_def_property_range(prop, 1, 3); - RNA_def_property_ui_range(prop, 1, 3, 2, -1); + RNA_def_property_range(prop, 1, 5); + RNA_def_property_ui_range(prop, 1, 5, 2, -1); RNA_def_property_ui_text(prop, "Discretization", "Particle number factor (higher value results in more particles)"); RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache"); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [47a1640] fluid-mantaflow: fix ui tab class. tab from elbeem was using this class before.
Commit: 47a16407950cf6937d6a4dc929e8f154e7b261b5 Author: Sebastián Barschkis Date: Mon Aug 22 19:01:17 2016 +0200 Branches: fluid-mantaflow https://developer.blender.org/rB47a16407950cf6937d6a4dc929e8f154e7b261b5 fix ui tab class. tab from elbeem was using this class before. === M release/scripts/startup/bl_ui/properties_physics_smoke.py === diff --git a/release/scripts/startup/bl_ui/properties_physics_smoke.py b/release/scripts/startup/bl_ui/properties_physics_smoke.py index 1d4a700..174c0d1 100644 --- a/release/scripts/startup/bl_ui/properties_physics_smoke.py +++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py @@ -40,7 +40,7 @@ class PhysicButtonsPanel: return (ob and ob.type == 'MESH') and (rd.engine in cls.COMPAT_ENGINES) and (context.smoke) -class PHYSICS_PT_fluid(PhysicButtonsPanel, Panel): +class PHYSICS_PT_smoke(PhysicButtonsPanel, Panel): bl_label = "Fluid" COMPAT_ENGINES = {'BLENDER_RENDER'} ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [0dec3d6] master: Build Packaging : Set proper package name on Windows.
Commit: 0dec3d6e220902bd769bc7acec2bbc5320ff900c Author: lazydodo Date: Mon Aug 22 08:15:03 2016 -0600 Branches: master https://developer.blender.org/rB0dec3d6e220902bd769bc7acec2bbc5320ff900c Build Packaging : Set proper package name on Windows. === M build_files/cmake/packaging.cmake === diff --git a/build_files/cmake/packaging.cmake b/build_files/cmake/packaging.cmake index afdbc64..72f10bb 100644 --- a/build_files/cmake/packaging.cmake +++ b/build_files/cmake/packaging.cmake @@ -38,7 +38,17 @@ unset(MY_WC_HASH) # Force Package Name execute_process(COMMAND date "+%Y%m%d" OUTPUT_VARIABLE CPACK_DATE OUTPUT_STRIP_TRAILING_WHITESPACE) string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER) -set(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME_LOWER}-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}-git${CPACK_DATE}.${BUILD_REV}-${CMAKE_SYSTEM_PROCESSOR}) +if (MSVC) + if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") + set(PACKAGE_ARCH Win64) + else() + set(PACKAGE_ARCH Win32) + endif() +else(MSVC) + set(PACKAGE_ARCH ${CMAKE_SYSTEM_PROCESSOR}) +endif() + +set(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME_LOWER}-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}-git${CPACK_DATE}.${BUILD_REV}-${PACKAGE_ARCH}) if(CMAKE_SYSTEM_NAME MATCHES "Linux") # RPM packages ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [eb2ee72] master: Fix T49136: full constant Curves with zero Fac input crashes in assert.
Commit: eb2ee7212e16547e2a79b967d2ed37d88b0f2565 Author: Alexander Gavrilov Date: Mon Aug 22 11:11:45 2016 +0300 Branches: master https://developer.blender.org/rBeb2ee7212e16547e2a79b967d2ed37d88b0f2565 Fix T49136: full constant Curves with zero Fac input crashes in assert. The if branches were reordered when the original patch was committed, which broke the implicit non-NULL guarantee on link. To prevent re-occurrence, add a couple of unit tests. === M intern/cycles/render/nodes.cpp M intern/cycles/test/render_graph_finalize_test.cpp === diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index 4f54b86..0304d6d 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -4846,12 +4846,8 @@ void CurvesNode::constant_fold(const ConstantFolder& folder, ShaderInput *value_ { ShaderInput *fac_in = input("Fac"); - /* remove no-op node */ - if(!fac_in->link && fac == 0.0f) { - folder.bypass(value_in->link); - } /* evaluate fully constant node */ - else if(folder.all_inputs_constant()) { + if(folder.all_inputs_constant()) { if (curves.size() == 0) return; @@ -4864,6 +4860,11 @@ void CurvesNode::constant_fold(const ConstantFolder& folder, ShaderInput *value_ folder.make_constant(interp(value, result, fac)); } + /* remove no-op node */ + else if(!fac_in->link && fac == 0.0f) { + /* link is not null because otherwise all inputs are constant */ + folder.bypass(value_in->link); + } } void CurvesNode::compile(SVMCompiler& compiler, int type, ShaderInput *value_in, ShaderOutput *value_out) diff --git a/intern/cycles/test/render_graph_finalize_test.cpp b/intern/cycles/test/render_graph_finalize_test.cpp index 633e517..60e41be 100644 --- a/intern/cycles/test/render_graph_finalize_test.cpp +++ b/intern/cycles/test/render_graph_finalize_test.cpp @@ -403,6 +403,26 @@ TEST(render_graph, constant_fold_invert_fac_0) /* * Tests: + * - Folding of Invert with zero Fac and constant input. + */ +TEST(render_graph, constant_fold_invert_fac_0_const) +{ + DEFINE_COMMON_VARIABLES(builder, log); + + EXPECT_ANY_MESSAGE(log); + CORRECT_INFO_MESSAGE(log, "Folding Invert::Color to constant (0.2, 0.5, 0.8)."); + + builder + .add_node(ShaderNodeBuilder("Invert") + .set("Fac", 0.0f) + .set("Color", make_float3(0.2f, 0.5f, 0.8f))) + .output_color("Invert::Color"); + + graph.finalize(); +} + +/* + * Tests: * - Folding of MixRGB Add with all constant inputs (clamp false). */ TEST(render_graph, constant_fold_mix_add) @@ -1344,6 +1364,33 @@ TEST(render_graph, constant_fold_rgb_curves_fac_0) graph.finalize(); } + +/* + * Tests: + * - Folding of RGB Curves with zero Fac and all constant inputs. + */ +TEST(render_graph, constant_fold_rgb_curves_fac_0_const) +{ + DEFINE_COMMON_VARIABLES(builder, log); + + EXPECT_ANY_MESSAGE(log); + CORRECT_INFO_MESSAGE(log, "Folding Curves::Color to constant (0.3, 0.5, 0.7)."); + + array curve; + init_test_curve(curve, make_float3(0.0f, 0.25f, 1.0f), make_float3(1.0f, 0.75f, 0.0f), 257); + + builder + .add_node(ShaderNodeBuilder("Curves") + .set(::curves, curve) + .set(::min_x, 0.1f) + .set(::max_x, 0.9f) + .set("Fac", 0.0f) + .set("Color", make_float3(0.3f, 0.5f, 0.7f))) + .output_color("Curves::Color"); + + graph.finalize(); +} + /* * Tests: * - Folding of Vector Curves with all constant inputs. ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs