diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh index 7b41f156ea8..0444f9d288a 100755 --- a/build_files/build_environment/install_deps.sh +++ b/build_files/build_environment/install_deps.sh @@ -1142,6 +1142,9 @@ EOF fi _with_built_openexr=true + + # Just always run it, much simpler this way! + _need_openexr_ldconfig=true } #### Build OIIO #### @@ -3135,6 +3138,9 @@ fi if [ $_need_oiio_ldconfig == true ]; then sudo sh -c "echo \"$INST/oiio/lib\" > /etc/ld.so.conf.d/oiio.conf" fi +if [ $_need_openexr_ldconfig == true ]; then + sudo sh -c "echo \"$INST/openexr/lib\" > /etc/ld.so.conf.d/openexr.conf" +fi sudo /sbin/ldconfig # XXX OpenSuse does not include sbin in command path with sudo!!! INFO "" diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp index fd3f349286b..e1e43b117e7 100644 --- a/intern/cycles/kernel/osl/osl_services.cpp +++ b/intern/cycles/kernel/osl/osl_services.cpp @@ -104,9 +104,10 @@ OSLRenderServices::~OSLRenderServices() { } -void OSLRenderServices::thread_init(KernelGlobals *kernel_globals_) +void OSLRenderServices::thread_init(KernelGlobals *kernel_globals_, OSL::TextureSystem *osl_ts_) { kernel_globals = kernel_globals_; + osl_ts = osl_ts_; } bool OSLRenderServices::get_matrix(OSL::Matrix44 &result, OSL::TransformationPtr xform, float time) @@ -767,7 +768,7 @@ bool OSLRenderServices::texture(ustring filename, TextureOpt &options, float s, float t, float dsdx, float dtdx, float dsdy, float dtdy, float *result) { - OSL::TextureSystem *ts = kernel_globals->osl->ts; + OSL::TextureSystem *ts = osl_ts; bool status = ts->texture(filename, options, s, t, dsdx, dtdx, dsdy, dtdy, result); if(!status) { @@ -789,7 +790,7 @@ bool OSLRenderServices::texture3d(ustring filename, TextureOpt &options, const OSL::Vec3 &dPdx, const OSL::Vec3 &dPdy, const OSL::Vec3 &dPdz, float *result) { - OSL::TextureSystem *ts = kernel_globals->osl->ts; + OSL::TextureSystem *ts = osl_ts; bool status = ts->texture3d(filename, options, P, dPdx, dPdy, dPdz, result); if(!status) { @@ -811,7 +812,7 @@ bool OSLRenderServices::environment(ustring filename, TextureOpt &options, OSL::ShaderGlobals *sg, const OSL::Vec3 &R, const OSL::Vec3 &dRdx, const OSL::Vec3 &dRdy, float *result) { - OSL::TextureSystem *ts = kernel_globals->osl->ts; + OSL::TextureSystem *ts = osl_ts; bool status = ts->environment(filename, options, R, dRdx, dRdy, result); if(!status) { @@ -832,7 +833,7 @@ bool OSLRenderServices::get_texture_info(ustring filename, int subimage, ustring dataname, TypeDesc datatype, void *data) { - OSL::TextureSystem *ts = kernel_globals->osl->ts; + OSL::TextureSystem *ts = osl_ts; return ts->get_texture_info(filename, subimage, dataname, datatype, data); } diff --git a/intern/cycles/kernel/osl/osl_services.h b/intern/cycles/kernel/osl/osl_services.h index 5043852846d..ca18c85a167 100644 --- a/intern/cycles/kernel/osl/osl_services.h +++ b/intern/cycles/kernel/osl/osl_services.h @@ -45,7 +45,7 @@ public: OSLRenderServices(); ~OSLRenderServices(); - void thread_init(KernelGlobals *kernel_globals); + void thread_init(KernelGlobals *kernel_globals, OSL::TextureSystem *ts); bool get_matrix(OSL::Matrix44 &result, OSL::TransformationPtr xform, float time); bool get_inverse_matrix(OSL::Matrix44 &result, OSL::TransformationPtr xform, float time); @@ -148,6 +148,7 @@ public: private: KernelGlobals *kernel_globals; + OSL::TextureSystem *osl_ts; }; CCL_NAMESPACE_END diff --git a/intern/cycles/kernel/osl/osl_shader.cpp b/intern/cycles/kernel/osl/osl_shader.cpp index ddde199663a..0b0c8ab2e3c 100644 --- a/intern/cycles/kernel/osl/osl_shader.cpp +++ b/intern/cycles/kernel/osl/osl_shader.cpp @@ -47,7 +47,7 @@ void OSLShader::thread_init(KernelGlobals *kg, KernelGlobals *kernel_globals, OS /* per thread kernel data init*/ kg->osl = osl_globals; - kg->osl->services->thread_init(kernel_globals); + kg->osl->services->thread_init(kernel_globals, osl_globals->ts); OSL::ShadingSystem *ss = kg->osl->ss; OSLThreadData *tdata = new OSLThreadData(); diff --git a/intern/cycles/render/background.cpp b/intern/cycles/render/background.cpp index 3513665f256..2b2a8609c1a 100644 --- a/intern/cycles/render/background.cpp +++ b/intern/cycles/render/background.cpp @@ -38,6 +38,7 @@ Background::Background() use = true; visibility = ~0; + shader = 0; transparent = false; need_update = true; @@ -54,6 +55,11 @@ void Background::device_update(Device *device, DeviceScene *dscene, Scene *scene device_free(device, dscene); + if(use) + shader = scene->default_background; + else + shader = scene->default_empty; + /* set shader index and transparent option */ KernelBackground *kbackground = &dscene->data.background; @@ -61,10 +67,7 @@ void Background::device_update(Device *device, DeviceScene *dscene, Scene *scene kbackground->ao_distance = ao_distance; kbackground->transparent = transparent; - if(use) - kbackground->shader = scene->shader_manager->get_shader_id(scene->default_background); - else - kbackground->shader = scene->shader_manager->get_shader_id(scene->default_empty); + kbackground->shader = scene->shader_manager->get_shader_id(shader); if(!(visibility & PATH_RAY_DIFFUSE)) kbackground->shader |= SHADER_EXCLUDE_DIFFUSE; diff --git a/intern/cycles/render/background.h b/intern/cycles/render/background.h index e0c0c42de37..ffedfbe3da3 100644 --- a/intern/cycles/render/background.h +++ b/intern/cycles/render/background.h @@ -35,6 +35,7 @@ public: bool use; uint visibility; + uint shader; bool transparent; bool need_update; diff --git a/intern/cycles/render/osl.cpp b/intern/cycles/render/osl.cpp index 56bb9582172..3f269f44abe 100644 --- a/intern/cycles/render/osl.cpp +++ b/intern/cycles/render/osl.cpp @@ -122,6 +122,12 @@ void OSLShaderManager::device_update(Device *device, DeviceScene *dscene, Scene scene->image_manager->set_osl_texture_system((void*)ts); device_update_common(device, dscene, scene, progress); + + /* greedyjit test + { + thread_scoped_lock lock(ss_shared_mutex); + ss->optimize_all_groups(); + }*/ } void OSLShaderManager::device_free(Device *device, DeviceScene *dscene, Scene *scene) @@ -187,6 +193,7 @@ void OSLShaderManager::shading_system_init() ss_shared->attribute("lockgeom", 1); ss_shared->attribute("commonspace", "world"); ss_shared->attribute("searchpath:shader", path_get("shader")); + //ss_shared->attribute("greedyjit", 1); /* our own ray types */ static const char *raytypes[] = { @@ -714,7 +721,7 @@ void OSLCompiler::compile_type(Shader *shader, ShaderGraph *graph, ShaderType ty current_type = type; - ss->ShaderGroupBegin(); + ss->ShaderGroupBegin(shader->name.c_str()); ShaderNode *output = graph->output(); set dependencies; @@ -777,9 +784,11 @@ void OSLCompiler::compile(OSLGlobals *og, Shader *shader) if(shader->graph_bump) { ss->clear_state(); compile_type(shader, shader->graph_bump, SHADER_TYPE_SURFACE); + shader->osl_surface_bump_ref = ss->state(); } + else + shader->osl_surface_bump_ref = shader->osl_surface_ref; - shader->osl_surface_bump_ref = ss->state(); ss->clear_state(); shader->has_surface = true; diff --git a/intern/cycles/render/scene.h b/intern/cycles/render/scene.h index be50279ba74..8f5bc4ead95 100644 --- a/intern/cycles/render/scene.h +++ b/intern/cycles/render/scene.h @@ -180,7 +180,6 @@ public: int default_surface; int default_light; int default_background; - int default_holdout; int default_empty; /* device */ diff --git a/intern/cycles/render/shader.cpp b/intern/cycles/render/shader.cpp index 76b5b2baaa6..72a0645c779 100644 --- a/intern/cycles/render/shader.cpp +++ b/intern/cycles/render/shader.cpp @@ -16,6 +16,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "background.h" #include "bssrdf.h" #include "blackbody.h" #include "device.h" @@ -194,10 +195,10 @@ void ShaderManager::device_update_shaders_used(Scene *scene) foreach(Shader *shader, scene->shaders) shader->used = false; + scene->shaders[scene->background->shader]->used = true; scene->shaders[scene->default_surface]->used = true; scene->shaders[scene->default_light]->used = true; scene->shaders[scene->default_background]->used = true; - scene->shaders[scene->default_holdout]->used = true; scene->shaders[scene->default_empty]->used = true; foreach(Mesh *mesh, scene->meshes) @@ -353,22 +354,6 @@ void ShaderManager::add_default(Scene *scene) scene->default_background = scene->shaders.size() - 1; } - /* default holdout */ - { - graph = new ShaderGraph(); - - closure = graph->add(new HoldoutNode()); - out = graph->output(); - - graph->connect(closure->output("Holdout"), out->input("Surface")); - - shader = new Shader(); - shader->name = "default_holdout"; - shader->graph = graph; - scene->shaders.push_back(shader); - scene->default_holdout = scene->shaders.size() - 1; - } - /* default empty */ { graph = new ShaderGraph(); diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index 6d3b34b0785..b0d0b1a5b5d 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -106,6 +106,11 @@ static int is_crappy_intel_card(void) return is_crappy; } +/* force NVidia Optimus to used dedicated graphics */ +extern "C" { + __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; +} + GHOST_WindowWin32::GHOST_WindowWin32( GHOST_SystemWin32 *system, const STR_String& title, diff --git a/release/scripts/startup/bl_operators/node.py b/release/scripts/startup/bl_operators/node.py index 1e92619c519..cc1fa93ec2c 100644 --- a/release/scripts/startup/bl_operators/node.py +++ b/release/scripts/startup/bl_operators/node.py @@ -66,12 +66,8 @@ class NodeAddOperator(): # convert mouse position to the View2D for later node placement if context.region.type == 'WINDOW': - # XXX, why use DPI for coords? - dpi_fac = context.user_preferences.system.dpi / 72.0 space.cursor_location = v2d.region_to_view(event.mouse_region_x, event.mouse_region_y) - space.cursor_location /= dpi_fac - else: space.cursor_location = tree.view_center diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py index 04aa59c3b11..b6ad14196cd 100644 --- a/release/scripts/startup/bl_ui/properties_data_mesh.py +++ b/release/scripts/startup/bl_ui/properties_data_mesh.py @@ -34,6 +34,7 @@ class MESH_MT_vertex_group_specials(Menu): layout.operator("object.vertex_group_copy_to_linked", icon='LINK_AREA') layout.operator("object.vertex_group_copy_to_selected", icon='LINK_AREA') layout.operator("object.vertex_group_mirror", icon='ARROW_LEFTRIGHT') + layout.operator("object.vertex_group_mirror", text="Mirror Vertex Group (Topology)", icon='ARROW_LEFTRIGHT').use_topology = True layout.operator("object.vertex_group_remove_from", icon='X', text="Remove from All Groups").use_all_groups = True layout.operator("object.vertex_group_remove_from", icon='X', text="Clear Active Group").use_all_verts = True layout.operator("object.vertex_group_remove", icon='X', text="Delete All Groups").all = True @@ -53,6 +54,7 @@ class MESH_MT_shape_key_specials(Menu): layout.operator("object.shape_key_transfer", icon='COPY_ID') # icon is not ideal layout.operator("object.join_shapes", icon='COPY_ID') # icon is not ideal layout.operator("object.shape_key_mirror", icon='ARROW_LEFTRIGHT') + layout.operator("object.shape_key_mirror", text="Mirror Shape Key (Topology)", icon='ARROW_LEFTRIGHT').use_topology = True layout.operator("object.shape_key_add", icon='ZOOMIN', text="New Shape From Mix").from_mix = True layout.operator("object.shape_key_remove", icon='X', text="Delete All Shapes").all = True @@ -213,7 +215,7 @@ class DATA_PT_vertex_groups(MeshButtonsPanel, Panel): row = layout.row() sub = row.row(align=True) - sub.operator("object.vertex_group_assign", text="Assign").new = False + sub.operator("object.vertex_group_assign", text="Assign") sub.operator("object.vertex_group_remove_from", text="Remove") sub = row.row(align=True) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 51995ba5012..0eea75e4e64 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -1312,13 +1312,13 @@ class VIEW3D_MT_vertex_group(Menu): layout = self.layout layout.operator_context = 'EXEC_AREA' - layout.operator("object.vertex_group_assign", text="Assign to New Group").new = True + layout.operator("object.vertex_group_assign_new") ob = context.active_object if ob.mode == 'EDIT' or (ob.mode == 'WEIGHT_PAINT' and ob.type == 'MESH' and ob.data.use_paint_mask_vertex): if ob.vertex_groups.active: layout.separator() - layout.operator("object.vertex_group_assign", text="Assign to Active Group").new = False + layout.operator("object.vertex_group_assign", text="Assign to Active Group") layout.operator("object.vertex_group_remove_from", text="Remove from Active Group").use_all_groups = False layout.operator("object.vertex_group_remove_from", text="Remove from All").use_all_groups = True layout.separator() diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 7bc6d476a4b..444002a0702 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -726,8 +726,6 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel): # Weight Paint Mode # elif context.weight_paint_object and brush: - layout.prop(toolsettings, "use_auto_normalize", text="Auto Normalize") - layout.prop(toolsettings, "use_multipaint", text="Multi-Paint") col = layout.column() @@ -746,6 +744,10 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel): col.prop(brush, "vertex_tool", text="Blend") + col = layout.column() + col.prop(toolsettings, "use_auto_normalize", text="Auto Normalize") + col.prop(toolsettings, "use_multipaint", text="Multi-Paint") + # Vertex Paint Mode # elif context.vertex_paint_object and brush: col = layout.column() @@ -1151,7 +1153,9 @@ class VIEW3D_PT_tools_weightpaint_options(Panel, View3DPaintPanel): if obj.type == 'MESH': mesh = obj.data col.prop(mesh, "use_mirror_x") - col.prop(mesh, "use_mirror_topology") + row = col.row() + row.active = mesh.use_mirror_x + row.prop(mesh, "use_mirror_topology") col.prop(wpaint, "input_samples") diff --git a/source/blender/blenfont/SConscript b/source/blender/blenfont/SConscript index 3973fed677f..1c573fa4a59 100644 --- a/source/blender/blenfont/SConscript +++ b/source/blender/blenfont/SConscript @@ -55,4 +55,7 @@ if sys.platform == 'win32' or env['OURPLATFORM'] == 'linuxcross': if env['WITH_BF_INTERNATIONAL']: defs.append('WITH_INTERNATIONAL') +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): + incs.append(env['BF_PTHREADS_INC']) + env.BlenderLib('bf_blenfont', sources, incs, defines=defs, libtype=['core', 'player'], priority=[210, 210]) diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index 6523aa87473..130eaaecba5 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -44,6 +44,7 @@ #include "DNA_vec_types.h" #include "BLI_math.h" +#include "BLI_threads.h" #include "BIF_gl.h" #include "BLF_api.h" diff --git a/source/blender/blenfont/intern/blf_dir.c b/source/blender/blenfont/intern/blf_dir.c index 116a55c0579..721e86fbf21 100644 --- a/source/blender/blenfont/intern/blf_dir.c +++ b/source/blender/blenfont/intern/blf_dir.c @@ -46,6 +46,7 @@ #include "BLI_listbase.h" #include "BLI_path_util.h" #include "BLI_string.h" +#include "BLI_threads.h" #include "BIF_gl.h" diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index f346478889b..56a77d643d6 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -48,6 +48,7 @@ #include "BLI_rect.h" #include "BLI_string.h" #include "BLI_string_utf8.h" +#include "BLI_threads.h" #include "BLI_linklist.h" /* linknode */ #include "BIF_gl.h" @@ -64,15 +65,18 @@ /* freetype2 handle ONLY for this file!. */ static FT_Library ft_lib; +static SpinLock ft_lib_mutex; int blf_font_init(void) { + BLI_spin_init(&ft_lib_mutex); return FT_Init_FreeType(&ft_lib); } void blf_font_exit(void) { FT_Done_FreeType(ft_lib); + BLI_spin_end(&ft_lib_mutex); } void blf_font_size(FontBLF *font, unsigned int size, unsigned int dpi) @@ -572,6 +576,7 @@ static void blf_font_fill(FontBLF *font) font->buf_info.col[3] = 0; font->ft_lib = ft_lib; + font->ft_lib_mutex = &ft_lib_mutex; } FontBLF *blf_font_new(const char *name, const char *filename) diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c index 4812f8f23f7..55424145b43 100644 --- a/source/blender/blenfont/intern/blf_glyph.c +++ b/source/blender/blenfont/intern/blf_glyph.c @@ -48,6 +48,7 @@ #include "BLI_listbase.h" #include "BLI_rect.h" +#include "BLI_threads.h" #include "BIF_gl.h" #include "BLF_api.h" @@ -224,6 +225,19 @@ GlyphBLF *blf_glyph_add(FontBLF *font, unsigned int index, unsigned int c) if (g) return g; + /* glyphs are dynamically created as needed by font rendering. this means that + * to make font rendering thread safe we have to do locking here. note that this + * must be a lock for the whole library and not just per font, because the font + * renderer uses a shared buffer internally */ + BLI_spin_lock(font->ft_lib_mutex); + + /* search again after locking */ + g = blf_glyph_search(font->glyph_cache, c); + if (g) { + BLI_spin_unlock(font->ft_lib_mutex); + return g; + } + if (font->flags & BLF_HINTING) flags &= ~FT_LOAD_NO_HINTING; @@ -231,8 +245,11 @@ GlyphBLF *blf_glyph_add(FontBLF *font, unsigned int index, unsigned int c) err = FT_Load_Glyph(font->face, (FT_UInt)index, FT_LOAD_TARGET_MONO); else err = FT_Load_Glyph(font->face, (FT_UInt)index, flags); - if (err) + + if (err) { + BLI_spin_unlock(font->ft_lib_mutex); return NULL; + } /* get the glyph. */ slot = font->face->glyph; @@ -251,8 +268,10 @@ GlyphBLF *blf_glyph_add(FontBLF *font, unsigned int index, unsigned int c) err = FT_Render_Glyph(slot, FT_RENDER_MODE_NORMAL); } - if (err || slot->format != FT_GLYPH_FORMAT_BITMAP) + if (err || slot->format != FT_GLYPH_FORMAT_BITMAP) { + BLI_spin_unlock(font->ft_lib_mutex); return NULL; + } g = (GlyphBLF *)MEM_callocN(sizeof(GlyphBLF), "blf_glyph_add"); g->c = c; @@ -289,6 +308,9 @@ GlyphBLF *blf_glyph_add(FontBLF *font, unsigned int index, unsigned int c) key = blf_hash(g->c); BLI_addhead(&(font->glyph_cache->bucket[key]), g); + + BLI_spin_unlock(font->ft_lib_mutex); + return g; } diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h index 36294bfe3b5..096ff50a3ca 100644 --- a/source/blender/blenfont/intern/blf_internal_types.h +++ b/source/blender/blenfont/intern/blf_internal_types.h @@ -217,6 +217,9 @@ typedef struct FontBLF { /* freetype2 lib handle. */ FT_Library ft_lib; + /* Mutex lock for library */ + SpinLock *ft_lib_mutex; + /* freetype2 face. */ FT_Face face; diff --git a/source/blender/blenkernel/BKE_mball.h b/source/blender/blenkernel/BKE_mball.h index 9bbff515983..44459300c56 100644 --- a/source/blender/blenkernel/BKE_mball.h +++ b/source/blender/blenkernel/BKE_mball.h @@ -57,9 +57,11 @@ float *BKE_mball_make_orco(struct Object *ob, struct ListBase *dispbase); void BKE_mball_properties_copy(struct Scene *scene, struct Object *active_object); -int BKE_mball_minmax(struct MetaBall *mb, float min[3], float max[3]); -int BKE_mball_center_median(struct MetaBall *mb, float r_cent[3]); -int BKE_mball_center_bounds(struct MetaBall *mb, float r_cent[3]); +bool BKE_mball_minmax(struct MetaBall *mb, float min[3], float max[3]); +bool BKE_mball_minmax_ex(struct MetaBall *mb, float min[3], float max[3], + float obmat[4][4], const short flag); +bool BKE_mball_center_median(struct MetaBall *mb, float r_cent[3]); +bool BKE_mball_center_bounds(struct MetaBall *mb, float r_cent[3]); void BKE_mball_translate(struct MetaBall *mb, const float offset[3]); struct MetaElem *BKE_mball_element_add(struct MetaBall *mb, const int type); diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 7481a403dc8..de1f3deaf81 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -146,7 +146,7 @@ void BKE_mesh_flush_hidden_from_verts(struct Mesh *me); void BKE_mesh_flush_hidden_from_polys_ex(struct MVert *mvert, const struct MLoop *mloop, - struct MEdge *medge, int totedge, + struct MEdge *medge, const int totedge, const struct MPoly *mpoly, const int totpoly); void BKE_mesh_flush_hidden_from_polys(struct Mesh *me); diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index aeb664b3c2f..6f86b0c3f88 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1946,9 +1946,9 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D DerivedMesh **final_r, CustomDataMask dataMask) { - ModifierData *md; + ModifierData *md, *previewmd = NULL; float (*deformedVerts)[3] = NULL; - CustomDataMask mask; + CustomDataMask mask, previewmask = 0; DerivedMesh *dm, *orcodm = NULL; int i, numVerts = 0, cageIndex = modifiers_getCageIndex(scene, ob, NULL, 1); CDMaskLink *datamasks, *curr; @@ -1962,6 +1962,7 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D const int do_final_wmcol = FALSE; int do_init_wmcol = ((((Mesh *)ob->data)->drawflag & ME_DRAWEIGHT) && !do_final_wmcol); int do_init_statvis = ((((Mesh *)ob->data)->drawflag & ME_DRAW_STATVIS) && !do_init_wmcol); + const int do_mod_wmcol = do_init_wmcol; modifiers_clearErrors(ob); @@ -1972,7 +1973,18 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D dm = NULL; md = modifiers_getVirtualModifierList(ob); - datamasks = modifiers_calcDataMasks(scene, ob, md, dataMask, required_mode, NULL, 0); + /* copied from mesh_calc_modifiers */ + if (do_mod_wmcol) { + previewmd = modifiers_getLastPreview(scene, md, required_mode); + /* even if the modifier doesn't need the data, to make a preview it may */ + if (previewmd) { + if (do_mod_wmcol) { + previewmask = CD_MASK_MDEFORMVERT; + } + } + } + + datamasks = modifiers_calcDataMasks(scene, ob, md, dataMask, required_mode, previewmd, previewmask); curr = datamasks; for (i = 0; md; i++, md = md->next, curr = curr->next) { diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 65e1f433c20..001964087b8 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -1639,8 +1639,46 @@ static NlaEvalChannel *nlaevalchan_find_match(ListBase *channels, PointerRNA *pt return NULL; } +/* initialise default value for NlaEvalChannel, so that it doesn't blend things wrong */ +static void nlaevalchan_value_init(NlaEvalChannel *nec) +{ + PointerRNA *ptr = &nec->ptr; + PropertyRNA *prop = nec->prop; + int index = nec->index; + + /* NOTE: while this doesn't work for all RNA properties as default values aren't in fact + * set properly for most of them, at least the common ones (which also happen to get used + * in NLA strips a lot, e.g. scale) are set correctly. + */ + switch (RNA_property_type(prop)) { + case PROP_BOOLEAN: + if (RNA_property_array_length(ptr, prop)) + nec->value = (float)RNA_property_boolean_get_default_index(ptr, prop, index); + else + nec->value = (float)RNA_property_boolean_get_default(ptr, prop); + break; + case PROP_INT: + if (RNA_property_array_length(ptr, prop)) + nec->value = (float)RNA_property_int_get_default_index(ptr, prop, index); + else + nec->value = (float)RNA_property_int_get_default(ptr, prop); + break; + case PROP_FLOAT: + if (RNA_property_array_length(ptr, prop)) + nec->value = RNA_property_float_get_default_index(ptr, prop, index); + else + nec->value = RNA_property_float_get_default(ptr, prop); + break; + case PROP_ENUM: + nec->value = (float)RNA_property_enum_get_default(ptr, prop); + break; + default: + break; + } +} + /* verify that an appropriate NlaEvalChannel for this F-Curve exists */ -static NlaEvalChannel *nlaevalchan_verify(PointerRNA *ptr, ListBase *channels, NlaEvalStrip *nes, FCurve *fcu, short *newChan) +static NlaEvalChannel *nlaevalchan_verify(PointerRNA *ptr, ListBase *channels, NlaEvalStrip *nes, FCurve *fcu) { NlaEvalChannel *nec; NlaStrip *strip = nes->strip; @@ -1674,22 +1712,23 @@ static NlaEvalChannel *nlaevalchan_verify(PointerRNA *ptr, ListBase *channels, N /* allocate a new struct for this if none found */ if (nec == NULL) { nec = MEM_callocN(sizeof(NlaEvalChannel), "NlaEvalChannel"); - *newChan = 1; BLI_addtail(channels, nec); + /* store property links for writing to the property later */ nec->ptr = new_ptr; nec->prop = prop; nec->index = fcu->array_index; + + /* initialise value using default value of property [#35856] */ + nlaevalchan_value_init(nec); } - else - *newChan = 0; /* we can now return */ return nec; } /* accumulate (i.e. blend) the given value on to the channel it affects */ -static void nlaevalchan_accumulate(NlaEvalChannel *nec, NlaEvalStrip *nes, short UNUSED(newChan), float value) +static void nlaevalchan_accumulate(NlaEvalChannel *nec, NlaEvalStrip *nes, float value) { NlaStrip *strip = nes->strip; short blendmode = strip->blendmode; @@ -1756,7 +1795,7 @@ static void nlaevalchan_buffers_accumulate(ListBase *channels, ListBase *tmp_buf * otherwise, add the current channel to the buffer for efficiency */ if (necd) - nlaevalchan_accumulate(necd, nes, 0, nec->value); + nlaevalchan_accumulate(necd, nes, nec->value); else { BLI_remlink(tmp_buffer, nec); BLI_addtail(channels, nec); @@ -1853,7 +1892,6 @@ static void nlastrip_evaluate_actionclip(PointerRNA *ptr, ListBase *channels, Li for (fcu = strip->act->curves.first; fcu; fcu = fcu->next) { NlaEvalChannel *nec; float value = 0.0f; - short newChan = -1; /* check if this curve should be skipped */ if (fcu->flag & (FCURVE_MUTED | FCURVE_DISABLED)) @@ -1875,9 +1913,9 @@ static void nlastrip_evaluate_actionclip(PointerRNA *ptr, ListBase *channels, Li /* get an NLA evaluation channel to work with, and accumulate the evaluated value with the value(s) * stored in this channel if it has been used already */ - nec = nlaevalchan_verify(ptr, channels, nes, fcu, &newChan); + nec = nlaevalchan_verify(ptr, channels, nes, fcu); if (nec) - nlaevalchan_accumulate(nec, nes, newChan, value); + nlaevalchan_accumulate(nec, nes, value); } /* unlink this strip's modifiers from the parent's modifiers again */ diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 03891f0fed3..2206770dfbd 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -1455,9 +1455,8 @@ static void lib_id_recalc_data_tag(Main *bmain, ID *id) } /* node was checked to have lasttime != curtime and is if type ID_OB */ -static void flush_update_node(DagNode *node, unsigned int layer, int curtime) +static void flush_update_node(Main *bmain, DagNode *node, unsigned int layer, int curtime) { - Main *bmain = G.main; DagAdjList *itA; Object *ob, *obc; int oldflag, changed = 0; @@ -1541,7 +1540,7 @@ static void flush_update_node(DagNode *node, unsigned int layer, int curtime) /* we only go deeper if node not checked or something changed */ for (itA = node->child; itA; itA = itA->next) { if (changed || itA->node->lasttime != curtime) - flush_update_node(itA->node, layer, curtime); + flush_update_node(bmain, itA->node, layer, curtime); } } @@ -1571,9 +1570,8 @@ static unsigned int flush_layer_node(Scene *sce, DagNode *node, int curtime) } /* node was checked to have lasttime != curtime, and is of type ID_OB */ -static void flush_pointcache_reset(Scene *scene, DagNode *node, int curtime, int reset) +static void flush_pointcache_reset(Main *bmain, Scene *scene, DagNode *node, int curtime, int reset) { - Main *bmain = G.main; DagAdjList *itA; Object *ob; @@ -1590,10 +1588,10 @@ static void flush_pointcache_reset(Scene *scene, DagNode *node, int curtime, int lib_id_recalc_data_tag(bmain, &ob->id); } - flush_pointcache_reset(scene, itA->node, curtime, 1); + flush_pointcache_reset(bmain, scene, itA->node, curtime, 1); } else - flush_pointcache_reset(scene, itA->node, curtime, 0); + flush_pointcache_reset(bmain, scene, itA->node, curtime, 0); } } } @@ -1694,7 +1692,7 @@ void DAG_scene_flush_update(Main *bmain, Scene *sce, unsigned int lay, const sho lasttime = sce->theDag->time; for (itA = firstnode->child; itA; itA = itA->next) if (itA->node->lasttime != lasttime && itA->node->type == ID_OB) - flush_update_node(itA->node, lay, lasttime); + flush_update_node(bmain, itA->node, lay, lasttime); /* if update is not due to time change, do pointcache clears */ if (!time) { @@ -1710,10 +1708,10 @@ void DAG_scene_flush_update(Main *bmain, Scene *sce, unsigned int lay, const sho lib_id_recalc_data_tag(bmain, &ob->id); } - flush_pointcache_reset(sce, itA->node, lasttime, 1); + flush_pointcache_reset(bmain, sce, itA->node, lasttime, 1); } else - flush_pointcache_reset(sce, itA->node, lasttime, 0); + flush_pointcache_reset(bmain, sce, itA->node, lasttime, 0); } } } @@ -1797,7 +1795,7 @@ static short animdata_use_time(AnimData *adt) return 0; } -static void dag_object_time_update_flags(Scene *scene, Object *ob) +static void dag_object_time_update_flags(Main *bmain, Scene *scene, Object *ob) { if (ob->constraints.first) { bConstraint *con; @@ -1923,9 +1921,9 @@ static void dag_object_time_update_flags(Scene *scene, Object *ob) } if (ob->recalc & OB_RECALC_OB) - lib_id_recalc_tag(G.main, &ob->id); + lib_id_recalc_tag(bmain, &ob->id); if (ob->recalc & OB_RECALC_DATA) - lib_id_recalc_data_tag(G.main, &ob->id); + lib_id_recalc_data_tag(bmain, &ob->id); } /* flag all objects that need recalc, for changes in time for example */ @@ -1949,7 +1947,7 @@ void DAG_scene_update_flags(Main *bmain, Scene *scene, unsigned int lay, const s /* NOTE: "sce_iter" not "scene" so that rigidbodies in background scenes work * (i.e. muting + rbw availability can be checked and tagged properly) [#33970] */ - dag_object_time_update_flags(sce_iter, ob); + dag_object_time_update_flags(bmain, sce_iter, ob); } /* handled in next loop */ @@ -1962,7 +1960,7 @@ void DAG_scene_update_flags(Main *bmain, Scene *scene, unsigned int lay, const s for (group = bmain->group.first; group; group = group->id.next) { if (group->id.flag & LIB_DOIT) { for (go = group->gobject.first; go; go = go->next) { - dag_object_time_update_flags(scene, go->ob); + dag_object_time_update_flags(bmain, scene, go->ob); } } } @@ -1981,7 +1979,7 @@ void DAG_scene_update_flags(Main *bmain, Scene *scene, unsigned int lay, const s /* hrmf... an exception to look at once, for invisible camera object we do it over */ if (scene->camera) - dag_object_time_update_flags(scene, scene->camera); + dag_object_time_update_flags(bmain, scene, scene->camera); } /* and store the info in groupobject */ @@ -2129,9 +2127,8 @@ static void dag_id_flush_update__isDependentTexture(void *userData, Object *UNUS } } -static void dag_id_flush_update(Scene *sce, ID *id) +static void dag_id_flush_update(Main *bmain, Scene *sce, ID *id) { - Main *bmain = G.main; Object *obt, *ob = NULL; short idtype; @@ -2279,7 +2276,7 @@ static void dag_id_flush_update(Scene *sce, ID *id) MovieClip *clip = BKE_object_movieclip_get(sce, sce->camera, 1); if (clip) - dag_id_flush_update(sce, &clip->id); + dag_id_flush_update(bmain, sce, &clip->id); } /* update editors */ @@ -2314,7 +2311,7 @@ void DAG_ids_flush_tagged(Main *bmain) if (id->flag & (LIB_ID_RECALC | LIB_ID_RECALC_DATA)) { for (dsl = listbase.first; dsl; dsl = dsl->next) - dag_id_flush_update(dsl->scene, id); + dag_id_flush_update(bmain, dsl->scene, id); do_flush = TRUE; } diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c index be072d9cc16..87f7da8a1fb 100644 --- a/source/blender/blenkernel/intern/editderivedmesh.c +++ b/source/blender/blenkernel/intern/editderivedmesh.c @@ -778,7 +778,7 @@ static void emdm_pass_attrib_vertex_glsl(DMVertexAttribs *attribs, BMLoop *loop, } if (attribs->tottang) { const float *tang = attribs->tang.array[i * 4 + index_in_face]; - glVertexAttrib3fvARB(attribs->tang.gl_index, tang); + glVertexAttrib4fvARB(attribs->tang.gl_index, tang); } } diff --git a/source/blender/blenkernel/intern/image_gen.c b/source/blender/blenkernel/intern/image_gen.c index c31ec593e54..eda22a095ef 100644 --- a/source/blender/blenkernel/intern/image_gen.c +++ b/source/blender/blenkernel/intern/image_gen.c @@ -287,7 +287,7 @@ static void checker_board_text(unsigned char *rect, float *rect_float, int width int x, y; int pen_x, pen_y; char text[3] = {'A', '1', '\0'}; - const int mono = blf_mono_font; + const int mono = blf_mono_font_render; BLF_size(mono, 54, 72); /* hard coded size! */ diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index 23368446675..c9b904e76ac 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -65,15 +65,21 @@ int BKE_lattice_index_from_uvw(struct Lattice *lt, const int u, const int v, const int w) { - return (w * (lt->pntsu * lt->pntsv) + (v * lt->pntsu) + u); + const int totu = lt->pntsu; + const int totv = lt->pntsv; + + return (w * (totu * totv) + (v * totu) + u); } void BKE_lattice_index_to_uvw(struct Lattice *lt, const int index, int *r_u, int *r_v, int *r_w) { - *r_u = (index % lt->pntsu); - *r_v = (index / lt->pntsu) % lt->pntsv; - *r_w = (index / (lt->pntsu * lt->pntsv)); + const int totu = lt->pntsu; + const int totv = lt->pntsv; + + *r_u = (index % totu); + *r_v = (index / totu) % totv; + *r_w = (index / (totu * totv)); } void calc_lat_fudu(int flag, int res, float *r_fu, float *r_du) diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index c1715ada7bd..5b5d4f3c318 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1573,7 +1573,7 @@ void BKE_library_make_local(Main *bmain, Library *lib, bool untagged_only) { if (lib == NULL || id->lib == lib) { if (id->lib) { - id_clear_lib_data(bmain, id); /* sets 'id->flag' */ + id_make_local(id, false); /* why sort alphabetically here but not in * id_clear_lib_data() ? - campbell */ diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index 8361f0c4f6c..31212c3a6b7 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -2375,8 +2375,44 @@ void BKE_mball_polygonize(Scene *scene, Object *ob, ListBase *dispbase) freepolygonize(&process); } +bool BKE_mball_minmax_ex(MetaBall *mb, float min[3], float max[3], + float obmat[4][4], const short flag) +{ + const float scale = obmat ? mat4_to_scale(obmat) : 1.0f; + MetaElem *ml; + bool change = false; + float centroid[3], vec[3]; + + INIT_MINMAX(min, max); + + for (ml = mb->elems.first; ml; ml = ml->next) { + if ((ml->flag & flag) == flag) { + const float scale_mb = (ml->rad * 0.5f) * scale; + int i; + + if (obmat) { + mul_v3_m4v3(centroid, obmat, &ml->x); + } + else { + copy_v3_v3(centroid, &ml->x); + } + + /* TODO, non circle shapes cubes etc, probably nobody notices - campbell */ + for (i = -1; i != 3; i += 2) { + copy_v3_v3(vec, centroid); + add_v3_fl(vec, scale_mb * i); + minmax_v3v3_v3(min, max, vec); + } + change = true; + } + } + + return change; +} + + /* basic vertex data functions */ -int BKE_mball_minmax(MetaBall *mb, float min[3], float max[3]) +bool BKE_mball_minmax(MetaBall *mb, float min[3], float max[3]) { MetaElem *ml; @@ -2389,7 +2425,7 @@ int BKE_mball_minmax(MetaBall *mb, float min[3], float max[3]) return (mb->elems.first != NULL); } -int BKE_mball_center_median(MetaBall *mb, float r_cent[3]) +bool BKE_mball_center_median(MetaBall *mb, float r_cent[3]) { MetaElem *ml; int total = 0; @@ -2407,7 +2443,7 @@ int BKE_mball_center_median(MetaBall *mb, float r_cent[3]) return (total != 0); } -int BKE_mball_center_bounds(MetaBall *mb, float r_cent[3]) +bool BKE_mball_center_bounds(MetaBall *mb, float r_cent[3]) { float min[3], max[3]; diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 92ba82a9ce2..4ec86cbac7b 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -517,9 +517,9 @@ Mesh *BKE_mesh_copy_ex(Main *bmain, Mesh *me) } } - men->mselect = NULL; men->edit_btmesh = NULL; + men->mselect = MEM_dupallocN(men->mselect); men->bb = MEM_dupallocN(men->bb); men->key = BKE_key_copy(me->key); diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index e556e6f23c3..bb160cff86a 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -923,7 +923,7 @@ Object *BKE_object_add(Main *bmain, Scene *scene, int type) base = BKE_scene_base_add(scene, ob); BKE_scene_base_deselect_all(scene); BKE_scene_base_select(scene, base); - DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); + DAG_id_tag_update_ex(bmain, &ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); return ob; } @@ -2313,7 +2313,7 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const bool us BoundBox bb; float vec[3]; int a; - short change = FALSE; + bool change = false; switch (ob->type) { case OB_CURVE: @@ -2390,6 +2390,17 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const bool us } } break; + case OB_MBALL: + { + float ob_min[3], ob_max[3]; + + change = BKE_mball_minmax_ex(ob->data, ob_min, ob_max, ob->obmat, 0); + if (change) { + minmax_v3v3_v3(min_r, max_r, ob_min); + minmax_v3v3_v3(min_r, max_r, ob_max); + } + break; + } } if (change == FALSE) { diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index c073c716ec6..8141fc8aaa1 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -2901,7 +2901,7 @@ typedef struct ReconstructProgressData { int message_size; } ReconstructProgressData; -/* Create mew libmv Tracks structure from blender's tracks list. */ +/* Create new libmv Tracks structure from blender's tracks list. */ static struct libmv_Tracks *libmv_tracks_new(ListBase *tracksbase, int width, int height) { int tracknr = 0; diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index fe50c2abcc1..1e76a7f3164 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -530,6 +530,7 @@ void BLI_path_rel(char *file, const char *relfile) * This is replaced by the two slashes at the beginning */ char *p = temp; char *q = file; + char *r = res; #ifdef WIN32 while (tolower(*p) == tolower(*q)) @@ -557,20 +558,23 @@ void BLI_path_rel(char *file, const char *relfile) while ( (p >= temp) && (*p != '/') ) { --p; --q; } } - strcpy(res, "//"); + r += BLI_strcpy_rlen(r, "//"); /* p now points to the slash that is at the beginning of the part * where the path is different from the relative path. * We count the number of directories we need to go up in the * hierarchy to arrive at the common 'prefix' of the path */ + if (p < temp) p = temp; while (p && p < lslash) { - if (*p == '/') - strcat(res, "../"); + if (*p == '/') { + r += BLI_strcpy_rlen(r, "../"); + } p++; } - strcat(res, q + 1); /* don't copy the slash at the beginning */ + /* don't copy the slash at the beginning */ + r += BLI_strcpy_rlen(r, q + 1); #ifdef WIN32 BLI_char_switch(res + 2, '/', '\\'); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 673cd3f7b26..5d30bf6ff73 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -4148,6 +4148,11 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh) mesh->bb = NULL; mesh->edit_btmesh = NULL; + /* happens with old files */ + if (mesh->mselect == NULL) { + mesh->totselect = 0; + } + /* Multires data */ mesh->mr= newdataadr(fd, mesh->mr); if (mesh->mr) { diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c index 1d20f94c51c..3ffdbe167d7 100644 --- a/source/blender/bmesh/intern/bmesh_operators.c +++ b/source/blender/bmesh/intern/bmesh_operators.c @@ -1371,6 +1371,12 @@ void *BMO_iter_new(BMOIter *iter, return NULL; } } + else if (iter->slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF) { + BLI_assert(restrictmask & slot->slot_subtype.elem); + } + else { + BLI_assert(0); + } return BMO_iter_step(iter); } diff --git a/source/blender/bmesh/operators/bmo_bridge.c b/source/blender/bmesh/operators/bmo_bridge.c index a517b7af502..045997fb6be 100644 --- a/source/blender/bmesh/operators/bmo_bridge.c +++ b/source/blender/bmesh/operators/bmo_bridge.c @@ -371,6 +371,14 @@ static void bridge_loop_pair(BMesh *bm, BMO_op_initf(bm, &op_sub, 0, "triangulate faces=%hf", BM_ELEM_TAG, true); + /* calc normals for input faces before executing */ + { + BMOIter siter; + BMFace *f; + BMO_ITER (f, &siter, op_sub.slots_in, "faces", BM_FACE) { + BM_face_normal_update(f); + } + } BMO_op_exec(bm, &op_sub); BMO_slot_buffer_flag_enable(bm, op_sub.slots_out, "faces.out", BM_FACE, FACE_OUT); BMO_slot_buffer_hflag_enable(bm, op_sub.slots_out, "faces.out", BM_FACE, BM_ELEM_TAG, false); diff --git a/source/blender/compositor/nodes/COM_MixNode.cpp b/source/blender/compositor/nodes/COM_MixNode.cpp index 3e8f1fb0f74..ab4e464327d 100644 --- a/source/blender/compositor/nodes/COM_MixNode.cpp +++ b/source/blender/compositor/nodes/COM_MixNode.cpp @@ -124,16 +124,6 @@ void MixNode::convertToOperations(ExecutionSystem *graph, CompositorContext *con convertProg->setUseValueAlphaMultiply(useAlphaPremultiply); convertProg->setUseClamp(useClamp); - if (color1Socket->isConnected()) { - convertProg->setResolutionInputSocketIndex(1); - } - else { - if (color2Socket->isConnected()) - convertProg->setResolutionInputSocketIndex(2); - else - convertProg->setResolutionInputSocketIndex(0); - } - valueSocket->relinkConnections(convertProg->getInputSocket(0), 0, graph); color1Socket->relinkConnections(convertProg->getInputSocket(1), 1, graph); color2Socket->relinkConnections(convertProg->getInputSocket(2), 2, graph); diff --git a/source/blender/compositor/operations/COM_MixBaseOperation.cpp b/source/blender/compositor/operations/COM_MixBaseOperation.cpp index 438fb84ebb7..5b455338bb0 100644 --- a/source/blender/compositor/operations/COM_MixBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_MixBaseOperation.cpp @@ -63,6 +63,30 @@ void MixBaseOperation::executePixel(float output[4], float x, float y, PixelSamp output[3] = inputColor1[3]; } +void MixBaseOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]) +{ + InputSocket *socket; + unsigned int tempPreferredResolution[2] = {0, 0}; + unsigned int tempResolution[2]; + + socket = this->getInputSocket(1); + socket->determineResolution(tempResolution, tempPreferredResolution); + if ((tempResolution[0] != 0) && (tempResolution[1] != 0)) { + this->setResolutionInputSocketIndex(1); + } + else { + socket = this->getInputSocket(2); + socket->determineResolution(tempResolution, tempPreferredResolution); + if ((tempResolution[0] != 0) && (tempResolution[1] != 0)) { + this->setResolutionInputSocketIndex(2); + } + else { + this->setResolutionInputSocketIndex(0); + } + } + NodeOperation::determineResolution(resolution, preferredResolution); +} + void MixBaseOperation::deinitExecution() { this->m_inputValueOperation = NULL; diff --git a/source/blender/compositor/operations/COM_MixBaseOperation.h b/source/blender/compositor/operations/COM_MixBaseOperation.h index 75ca1c3f6c6..3c0c0778190 100644 --- a/source/blender/compositor/operations/COM_MixBaseOperation.h +++ b/source/blender/compositor/operations/COM_MixBaseOperation.h @@ -70,6 +70,9 @@ public: * Deinitialize the execution */ void deinitExecution(); + + void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); + void setUseValueAlphaMultiply(const bool value) { this->m_valueAlphaMultiply = value; } bool useValueAlphaMultiply() { return this->m_valueAlphaMultiply; } diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index b98e4e493ff..adea3bcdc31 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -138,7 +138,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s /* draw polynomial order selector */ row = uiLayoutRow(layout, FALSE); block = uiLayoutGetBlock(row); - but = uiDefButI(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Poly Order:"), 0.5*UI_UNIT_X, 0, bwidth, UI_UNIT_Y, + but = uiDefButI(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Poly Order:"), 0.5f * UI_UNIT_X, 0, bwidth, UI_UNIT_Y, &data->poly_order, 1, 100, 0, 0, TIP_("'Order' of the Polynomial (for a polynomial with n terms, 'order' is n-1)")); uiButSetFunc(but, validate_fmodifier_cb, fcm, NULL); diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index c7c034da45b..1638e4ce629 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -909,6 +909,7 @@ short insert_keyframe(ReportList *reports, ID *id, bAction *act, const char grou { PointerRNA id_ptr, ptr; PropertyRNA *prop = NULL; + AnimData *adt; FCurve *fcu; int array_index_max = array_index + 1; int ret = 0; @@ -929,8 +930,6 @@ short insert_keyframe(ReportList *reports, ID *id, bAction *act, const char grou /* if no action is provided, keyframe to the default one attached to this ID-block */ if (act == NULL) { - AnimData *adt = BKE_animdata_from_id(id); - /* get action to add F-Curve+keyframe to */ act = verify_adt_action(id, 1); @@ -940,11 +939,12 @@ short insert_keyframe(ReportList *reports, ID *id, bAction *act, const char grou id->name, rna_path); return 0; } - - /* apply NLA-mapping to frame to use (if applicable) */ - cfra = BKE_nla_tweakedit_remap(adt, cfra, NLATIME_CONVERT_UNMAP); } + /* apply NLA-mapping to frame to use (if applicable) */ + adt = BKE_animdata_from_id(id); + cfra = BKE_nla_tweakedit_remap(adt, cfra, NLATIME_CONVERT_UNMAP); + /* key entire array convenience method */ if (array_index == -1) { array_index = 0; diff --git a/source/blender/editors/armature/armature_relations.c b/source/blender/editors/armature/armature_relations.c index 7ed7ebbb4b9..d5dbe80538f 100644 --- a/source/blender/editors/armature/armature_relations.c +++ b/source/blender/editors/armature/armature_relations.c @@ -468,8 +468,8 @@ static int separate_armature_exec(bContext *C, wmOperator *UNUSED(op)) /* TODO: use context iterators for this? */ CTX_DATA_BEGIN(C, Base *, base, visible_bases) { - if (base->object == obedit) base->flag |= 1; - else base->flag &= ~1; + if (base->object == obedit) base->flag |= SELECT; + else base->flag &= ~SELECT; } CTX_DATA_END; diff --git a/source/blender/editors/armature/armature_skinning.c b/source/blender/editors/armature/armature_skinning.c index 2e43c388fa8..0a9cff3dc90 100644 --- a/source/blender/editors/armature/armature_skinning.c +++ b/source/blender/editors/armature/armature_skinning.c @@ -199,10 +199,11 @@ static void envelope_bone_weighting(Object *ob, Mesh *mesh, float (*verts)[3], i bDeformGroup *dgroup; float distance; int i, iflip, j; + bool use_topology = (mesh->editflag & ME_EDIT_MIRROR_TOPO) != 0; /* for each vertex in the mesh */ for (i = 0; i < mesh->totvert; i++) { - iflip = (dgroupflip) ? mesh_get_x_mirror_vert(ob, i) : 0; + iflip = (dgroupflip) ? mesh_get_x_mirror_vert(ob, i, use_topology) : 0; /* for each skinnable bone */ for (j = 0; j < numbones; ++j) { diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c index 25a7eedfb8c..01825f2c2f9 100644 --- a/source/blender/editors/armature/meshlaplacian.c +++ b/source/blender/editors/armature/meshlaplacian.c @@ -652,6 +652,7 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource, float solution, weight; int *vertsflipped = NULL, *mask = NULL; int a, tottri, j, bbone, firstsegment, lastsegment; + bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0; MVert *mvert = me->mvert; int use_vert_sel = FALSE; @@ -716,7 +717,7 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource, if (dgroupflip) { vertsflipped = MEM_callocN(sizeof(int) * me->totvert, "vertsflipped"); for (a = 0; a < me->totvert; a++) - vertsflipped[a] = mesh_get_x_mirror_vert(ob, a); + vertsflipped[a] = mesh_get_x_mirror_vert(ob, a, use_topology); } /* compute weights per bone */ diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 3e0269aa138..3929969c5c4 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -77,9 +77,9 @@ struct MeshStatVis; /* editmesh_utils.c */ void EDBM_verts_mirror_cache_begin_ex(struct BMEditMesh *em, const int axis, const bool use_self, const bool use_select, - const bool is_topo, float maxdist, int *r_index); + const bool use_topology, float maxdist, int *r_index); void EDBM_verts_mirror_cache_begin(struct BMEditMesh *em, const int axis, - const bool use_self, const bool use_select); + const bool use_self, const bool use_select, const bool use_toplogy); void EDBM_verts_mirror_apply(struct BMEditMesh *em, const int sel_from, const int sel_to); struct BMVert *EDBM_verts_mirror_get(struct BMEditMesh *em, struct BMVert *v); void EDBM_verts_mirror_cache_clear(struct BMEditMesh *em, struct BMVert *v); @@ -241,7 +241,8 @@ void ED_vgroup_data_clamp_range(struct ID *id, const int total); bool ED_vgroup_give_array(struct ID *id, struct MDeformVert **dvert_arr, int *dvert_tot); bool ED_vgroup_copy_array(struct Object *ob, struct Object *ob_from); void ED_vgroup_mirror(struct Object *ob, - const bool mirror_weights, const bool flip_vgroups, const bool all_vgroups, + const bool mirror_weights, const bool flip_vgroups, + const bool all_vgroups, const bool use_topology, int *r_totmirr, int *r_totfail); bool ED_vgroup_object_is_edit_mode(struct Object *ob); @@ -304,8 +305,10 @@ int mesh_mirrtopo_table(struct Object *ob, char mode); /* retrieves mirrored cache vert, or NULL if there isn't one. * note: calling this without ensuring the mirror cache state * is bad.*/ -int mesh_get_x_mirror_vert(struct Object *ob, int index); -struct BMVert *editbmesh_get_x_mirror_vert(struct Object *ob, struct BMEditMesh *em, struct BMVert *eve, const float co[3], int index); +int mesh_get_x_mirror_vert(struct Object *ob, int index, const bool use_topology); +struct BMVert *editbmesh_get_x_mirror_vert(struct Object *ob, struct BMEditMesh *em, + struct BMVert *eve, const float co[3], + int index, const bool use_topology); int *mesh_get_x_mirror_faces(struct Object *ob, struct BMEditMesh *em); bool ED_mesh_pick_vert(struct bContext *C, struct Object *ob, const int mval[2], unsigned int *index, int size, bool use_zbuf); diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index 468bbb8a5c5..0e71408edcc 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -59,8 +59,9 @@ #include "BIF_gl.h" -#include "DNA_object_types.h" +#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" +#include "DNA_object_types.h" #include "GPU_extensions.h" @@ -76,10 +77,12 @@ void EDBM_select_mirrored(BMEditMesh *em, bool extend, int *r_totmirr, int *r_totfail) { + Mesh *me = (Mesh *)em->ob->data; BMVert *v1, *v2; BMIter iter; int totmirr = 0; int totfail = 0; + bool use_topology = (me && (me->editflag & ME_EDIT_MIRROR_TOPO)); *r_totmirr = *r_totfail = 0; @@ -92,7 +95,7 @@ void EDBM_select_mirrored(BMEditMesh *em, bool extend, } } - EDBM_verts_mirror_cache_begin(em, 0, true, true); + EDBM_verts_mirror_cache_begin(em, 0, true, true, use_topology); if (!extend) EDBM_flag_disable_all(em, BM_ELEM_SELECT); diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 0d0134af4e5..2fa6812d131 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -1099,11 +1099,13 @@ void MESH_OT_normals_make_consistent(wmOperatorType *ot) static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); + Mesh *me = obedit->data; BMEditMesh *em = BKE_editmesh_from_object(obedit); ModifierData *md; int mirrx = false, mirry = false, mirrz = false; int i, repeat; float clip_dist = 0.0f; + bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0; const bool xaxis = RNA_boolean_get(op->ptr, "xaxis"); const bool yaxis = RNA_boolean_get(op->ptr, "yaxis"); @@ -1111,7 +1113,7 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op) /* mirror before smooth */ if (((Mesh *)obedit->data)->editflag & ME_EDIT_MIRROR_X) { - EDBM_verts_mirror_cache_begin(em, 0, false, true); + EDBM_verts_mirror_cache_begin(em, 0, false, true, use_topology); } /* if there is a mirror modifier with clipping, flag the verts that @@ -1183,6 +1185,8 @@ static int edbm_do_smooth_laplacian_vertex_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BKE_editmesh_from_object(obedit); + Mesh *me = obedit->data; + bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0; int usex = true, usey = true, usez = true, preserve_volume = true; int i, repeat; float lambda_factor; @@ -1202,7 +1206,7 @@ static int edbm_do_smooth_laplacian_vertex_exec(bContext *C, wmOperator *op) /* mirror before smooth */ if (((Mesh *)obedit->data)->editflag & ME_EDIT_MIRROR_X) { - EDBM_verts_mirror_cache_begin(em, 0, false, true); + EDBM_verts_mirror_cache_begin(em, 0, false, true, use_topology); } repeat = RNA_int_get(op->ptr, "repeat"); @@ -2735,7 +2739,7 @@ static int edbm_fill_grid_exec(bContext *C, wmOperator *op) void MESH_OT_fill_grid(wmOperatorType *ot) { /* identifiers */ - ot->name = "Fill Grid"; + ot->name = "Grid Fill"; ot->description = "Fill grid from two loops"; ot->idname = "MESH_OT_fill_grid"; @@ -4257,7 +4261,7 @@ static int mesh_symmetry_snap_exec(bContext *C, wmOperator *op) BMEditMesh *em = BKE_editmesh_from_object(obedit); BMesh *bm = em->bm; int *index = MEM_mallocN(bm->totvert * sizeof(*index), __func__); - const bool is_topo = false; + const bool use_topology = false; const float thresh = RNA_float_get(op->ptr, "threshold"); const float fac = RNA_float_get(op->ptr, "factor"); @@ -4276,7 +4280,7 @@ static int mesh_symmetry_snap_exec(bContext *C, wmOperator *op) BMVert *v; int i; - EDBM_verts_mirror_cache_begin_ex(em, axis, true, true, is_topo, thresh, index); + EDBM_verts_mirror_cache_begin_ex(em, axis, true, true, use_topology, thresh, index); EDBM_index_arrays_ensure(em, BM_VERT); diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index 560c314405e..834db3f9ad1 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -1151,13 +1151,13 @@ static BMVert *cache_mirr_intptr_as_bmvert(intptr_t *index_lookup, int index) * \param em Editmesh. * \param use_self Allow a vertex to point to its self (middle verts). * \param use_select Restrict to selected verts. - * \param is_topo Use topology mirror. + * \param use_topology Use topology mirror. * \param maxdist Distance for close point test. * \param r_index Optional array to write into, as an alternative to a customdata layer (length of total verts). */ void EDBM_verts_mirror_cache_begin_ex(BMEditMesh *em, const int axis, const bool use_self, const bool use_select, /* extra args */ - const bool is_topo, float maxdist, int *r_index) + const bool use_topology, float maxdist, int *r_index) { Mesh *me = (Mesh *)em->ob->data; BMesh *bm = em->bm; @@ -1188,7 +1188,7 @@ void EDBM_verts_mirror_cache_begin_ex(BMEditMesh *em, const int axis, const bool BM_mesh_elem_index_ensure(bm, BM_VERT); - if (is_topo) { + if (use_topology) { ED_mesh_mirrtopo_init(me, -1, &mesh_topo_store, true); } else { @@ -1208,7 +1208,7 @@ void EDBM_verts_mirror_cache_begin_ex(BMEditMesh *em, const int axis, const bool BMVert *v_mirr; int *idx = VERT_INTPTR(v, i); - if (is_topo) { + if (use_topology) { v_mirr = cache_mirr_intptr_as_bmvert(mesh_topo_store.index_lookup, i); } else { @@ -1233,7 +1233,7 @@ void EDBM_verts_mirror_cache_begin_ex(BMEditMesh *em, const int axis, const bool #undef VERT_INTPTR - if (is_topo) { + if (use_topology) { ED_mesh_mirrtopo_free(&mesh_topo_store); } else { @@ -1242,17 +1242,13 @@ void EDBM_verts_mirror_cache_begin_ex(BMEditMesh *em, const int axis, const bool } void EDBM_verts_mirror_cache_begin(BMEditMesh *em, const int axis, - const bool use_self, const bool use_select) + const bool use_self, const bool use_select, + const bool use_topology) { - Mesh *me = (Mesh *)em->ob->data; - bool is_topo; - - is_topo = (me && (me->editflag & ME_EDIT_MIRROR_TOPO)); - EDBM_verts_mirror_cache_begin_ex(em, axis, use_self, use_select, /* extra args */ - is_topo, BM_SEARCH_MAXDIST_MIRR, NULL); + use_topology, BM_SEARCH_MAXDIST_MIRR, NULL); } BMVert *EDBM_verts_mirror_get(BMEditMesh *em, BMVert *v) diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c index ba9bd8d3f7b..3d8718ef887 100644 --- a/source/blender/editors/mesh/mesh_navmesh.c +++ b/source/blender/editors/mesh/mesh_navmesh.c @@ -384,7 +384,8 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh, BM_vert_create(em->bm, co, NULL, 0); } - EDBM_index_arrays_ensure(em, BM_VERT); + /* need to rebuild entirely because array size changes */ + EDBM_index_arrays_init(em, BM_VERT); /* create faces */ for (j = 0; j < trinum; j++) { diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index b0d337c365f..51b5e30bc3f 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -939,9 +939,9 @@ static int mesh_get_x_mirror_vert_topo(Object *ob, int index) return mesh_topo_store.index_lookup[index]; } -int mesh_get_x_mirror_vert(Object *ob, int index) +int mesh_get_x_mirror_vert(Object *ob, int index, const bool use_topology) { - if (((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_TOPO) { + if (use_topology) { return mesh_get_x_mirror_vert_topo(ob, index); } else { @@ -1001,9 +1001,9 @@ static BMVert *editbmesh_get_x_mirror_vert_topo(Object *ob, struct BMEditMesh *e return NULL; } -BMVert *editbmesh_get_x_mirror_vert(Object *ob, struct BMEditMesh *em, BMVert *eve, const float co[3], int index) +BMVert *editbmesh_get_x_mirror_vert(Object *ob, struct BMEditMesh *em, BMVert *eve, const float co[3], int index, const bool use_topology) { - if (((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_TOPO) { + if (use_topology) { return editbmesh_get_x_mirror_vert_topo(ob, em, eve, index); } else { @@ -1121,6 +1121,7 @@ int *mesh_get_x_mirror_faces(Object *ob, BMEditMesh *em) MVert *mv, *mvert = me->mvert; MFace mirrormf, *mf, *hashmf, *mface = me->mface; GHash *fhash; + const bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0; int *mirrorverts, *mirrorfaces; int a; @@ -1130,7 +1131,7 @@ int *mesh_get_x_mirror_faces(Object *ob, BMEditMesh *em) mesh_octree_table(ob, em, NULL, 's'); for (a = 0, mv = mvert; a < me->totvert; a++, mv++) - mirrorverts[a] = mesh_get_x_mirror_vert(ob, a); + mirrorverts[a] = mesh_get_x_mirror_vert(ob, a, use_topology); mesh_octree_table(ob, em, NULL, 'e'); diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index c7aec9f93d4..d6f48b4d350 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -2038,7 +2038,7 @@ static int duplicate_exec(bContext *C, wmOperator *op) clear_id_newpoins(); clear_sca_new_poins(); /* sensor/contr/act */ - CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) + CTX_DATA_BEGIN (C, Base *, base, selected_bases) { Base *basen = object_add_duplicate_internal(bmain, scene, base, dupflag); diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index 04c67b8d3fa..1f0163bc391 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -460,6 +460,7 @@ static int add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *ob ModifierData *md = NULL; HookModifierData *hmd = NULL; float cent[3]; + float pose_mat[4][4]; int tot, ok, *indexar; char name[MAX_NAME]; @@ -494,11 +495,20 @@ static int add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *ob hmd->totindex = tot; BLI_strncpy(hmd->name, name, sizeof(hmd->name)); + unit_m4(pose_mat); + if (mode == OBJECT_ADDHOOK_SELOB_BONE) { bArmature *arm = ob->data; BLI_assert(ob->type == OB_ARMATURE); if (arm->act_bone) { + bPoseChannel *pchan_act; + BLI_strncpy(hmd->subtarget, arm->act_bone->name, sizeof(hmd->subtarget)); + + pchan_act = BKE_pose_channel_active(ob); + if (LIKELY(pchan_act)) { + invert_m4_m4(pose_mat, pchan_act->pose_mat); + } } else { BKE_report(reports, RPT_WARNING, "Armature has no active object bone"); @@ -512,7 +522,7 @@ static int add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *ob invert_m4_m4(ob->imat, ob->obmat); /* apparently this call goes from right to left... */ - mul_serie_m4(hmd->parentinv, ob->imat, obedit->obmat, NULL, + mul_serie_m4(hmd->parentinv, pose_mat, ob->imat, obedit->obmat, NULL, NULL, NULL, NULL, NULL); DAG_relations_tag_update(bmain); diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index b3ce9320852..58cca9dca02 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -203,6 +203,7 @@ void CONSTRAINT_OT_followpath_path_animate(struct wmOperatorType *ot); void OBJECT_OT_vertex_group_add(struct wmOperatorType *ot); void OBJECT_OT_vertex_group_remove(struct wmOperatorType *ot); void OBJECT_OT_vertex_group_assign(struct wmOperatorType *ot); +void OBJECT_OT_vertex_group_assign_new(struct wmOperatorType *ot); void OBJECT_OT_vertex_group_remove_from(struct wmOperatorType *ot); void OBJECT_OT_vertex_group_select(struct wmOperatorType *ot); void OBJECT_OT_vertex_group_deselect(struct wmOperatorType *ot); diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c index d3537051861..0e220357d30 100644 --- a/source/blender/editors/object/object_lattice.c +++ b/source/blender/editors/object/object_lattice.c @@ -368,22 +368,6 @@ typedef enum eLattice_FlipAxes { LATTICE_FLIP_W = 2 } eLattice_FlipAxes; -/* Helper macro for accessing item at index (u, v, w) - * < lt: (Lattice) - * < U: (int) u-axis coordinate of point - * < V: (int) v-axis coordinate of point - * < W: (int) w-axis coordinate of point - * < dimU: (int) number of points per row or number of columns (U-Axis) - * < dimV: (int) number of rows (V-Axis) - * > returns: (BPoint *) pointer to BPoint at this index - */ -#define LATTICE_PT(lt, U, V, W, dimU, dimV) \ - ( (lt)->def + \ - ((dimU) * (dimV)) * (W) + \ - (dimU) * (V) + \ - (U) \ - ) - /* Flip midpoint value so that relative distances between midpoint and neighbour-pair is maintained * ! Assumes that uvw <=> xyz (i.e. axis-aligned index-axes with coordinate-axes) * - Helper for lattice_flip_exec() @@ -394,7 +378,7 @@ static void lattice_flip_point_value(Lattice *lt, int u, int v, int w, float mid float diff; /* just the point in the middle (unpaired) */ - bp = LATTICE_PT(lt, u, v, w, lt->pntsu, lt->pntsv); + bp = <->def[BKE_lattice_index_from_uvw(lt, u, v, w)]; /* flip over axis */ diff = mid - bp->vec[axis]; @@ -432,8 +416,8 @@ static void lattice_swap_point_pairs(Lattice *lt, int u, int v, int w, float mid } /* get points to operate on */ - bpA = LATTICE_PT(lt, u0, v0, w0, numU, numV); - bpB = LATTICE_PT(lt, u1, v1, w1, numU, numV); + bpA = <->def[BKE_lattice_index_from_uvw(lt, u0, v0, w0)]; + bpB = <->def[BKE_lattice_index_from_uvw(lt, u1, v1, w1)]; /* Swap all coordinates, so that flipped coordinates belong to * the indices on the correct side of the lattice. diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index 356bda109a4..35bfba8b78a 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -175,6 +175,7 @@ void ED_operatortypes_object(void) WM_operatortype_append(OBJECT_OT_vertex_group_add); WM_operatortype_append(OBJECT_OT_vertex_group_remove); WM_operatortype_append(OBJECT_OT_vertex_group_assign); + WM_operatortype_append(OBJECT_OT_vertex_group_assign_new); WM_operatortype_append(OBJECT_OT_vertex_group_remove_from); WM_operatortype_append(OBJECT_OT_vertex_group_select); WM_operatortype_append(OBJECT_OT_vertex_group_deselect); diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 4c652a82765..45773a2803c 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -1430,12 +1430,13 @@ static int make_links_data_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); const int type = RNA_enum_get(op->ptr, "type"); Object *ob_src; - ID *id; + ID *obdata_id; int a; /* group */ LinkNode *ob_groups = NULL; - int is_cycle = FALSE; + bool is_cycle = false; + bool is_lib = false; ob_src = ED_object_active_context(C); @@ -1450,14 +1451,15 @@ static int make_links_data_exec(bContext *C, wmOperator *op) if (ob_src != ob_dst) { if (allow_make_links_data(type, ob_src, ob_dst)) { + obdata_id = ob_dst->data; + switch (type) { case MAKE_LINKS_OBDATA: /* obdata */ - id = ob_dst->data; - id->us--; + obdata_id->us--; - id = ob_src->data; - id_us_plus(id); - ob_dst->data = id; + obdata_id = ob_src->data; + id_us_plus(obdata_id); + ob_dst->data = obdata_id; /* if amount of material indices changed: */ test_object_materials(bmain, ob_dst->data); @@ -1473,6 +1475,10 @@ static int make_links_data_exec(bContext *C, wmOperator *op) break; case MAKE_LINKS_ANIMDATA: BKE_copy_animdata_id((ID *)ob_dst, (ID *)ob_src, FALSE); + if (obdata_id->lib) { + is_lib = true; + break; + } BKE_copy_animdata_id((ID *)ob_dst->data, (ID *)ob_src->data, FALSE); break; case MAKE_LINKS_GROUP: @@ -1508,6 +1514,11 @@ static int make_links_data_exec(bContext *C, wmOperator *op) Curve *cu_src = ob_src->data; Curve *cu_dst = ob_dst->data; + if (obdata_id->lib) { + is_lib = true; + break; + } + if (cu_dst->vfont) cu_dst->vfont->id.us--; cu_dst->vfont = cu_src->vfont; id_us_plus((ID *)cu_dst->vfont); @@ -1540,6 +1551,10 @@ static int make_links_data_exec(bContext *C, wmOperator *op) } } + if (is_lib) { + BKE_report(op->reports, RPT_WARNING, "Skipped editing library object data"); + } + DAG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C)); WM_event_add_notifier(C, NC_OBJECT, NULL); diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c index 8fead6024fb..ea96db514b2 100644 --- a/source/blender/editors/object/object_shapekey.c +++ b/source/blender/editors/object/object_shapekey.c @@ -168,7 +168,7 @@ static bool ED_object_shape_key_remove(Main *bmain, Object *ob) } static bool object_shape_key_mirror(bContext *C, Object *ob, - int *r_totmirr, int *r_totfail) + int *r_totmirr, int *r_totfail, bool use_topology) { KeyBlock *kb; Key *key; @@ -196,7 +196,7 @@ static bool object_shape_key_mirror(bContext *C, Object *ob, mesh_octree_table(ob, NULL, NULL, 's'); for (i1 = 0, mv = me->mvert; i1 < me->totvert; i1++, mv++) { - i2 = mesh_get_x_mirror_vert(ob, i1); + i2 = mesh_get_x_mirror_vert(ob, i1, use_topology); if (i2 == i1) { fp1 = ((float *)kb->data) + i1 * 3; fp1[0] = -fp1[0]; @@ -440,8 +440,9 @@ static int shape_key_mirror_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_context(C); int totmirr = 0, totfail = 0; + bool use_topology = RNA_boolean_get(op->ptr, "use_topology"); - if (!object_shape_key_mirror(C, ob, &totmirr, &totfail)) + if (!object_shape_key_mirror(C, ob, &totmirr, &totfail, use_topology)) return OPERATOR_CANCELLED; ED_mesh_report_mirror(op, totmirr, totfail); @@ -462,6 +463,10 @@ void OBJECT_OT_shape_key_mirror(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + /* properties */ + RNA_def_boolean(ot->srna, "use_topology", 0, "Topology Mirror", + "Use topology based mirroring (for when both sides of mesh have matching, unique topology)"); } diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index b85c7126fdb..c4fb3188528 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -438,8 +438,9 @@ static void ED_mesh_defvert_mirror_update_em(Object *ob, BMVert *eve, int def_nr Mesh *me = ob->data; BMEditMesh *em = me->edit_btmesh; BMVert *eve_mirr; + bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0; - eve_mirr = editbmesh_get_x_mirror_vert(ob, em, eve, eve->co, vidx); + eve_mirr = editbmesh_get_x_mirror_vert(ob, em, eve, eve->co, vidx, use_topology); if (eve_mirr && eve_mirr != eve) { MDeformVert *dvert_src = BM_ELEM_CD_GET_VOID_P(eve, cd_dvert_offset); @@ -452,10 +453,12 @@ static void ED_mesh_defvert_mirror_update_ob(Object *ob, int def_nr, int vidx) { int vidx_mirr; Mesh *me = ob->data; + bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0; + if (vidx == -1) return; - vidx_mirr = mesh_get_x_mirror_vert(ob, vidx); + vidx_mirr = mesh_get_x_mirror_vert(ob, vidx, use_topology); if ((vidx_mirr) >= 0 && (vidx_mirr != vidx)) { MDeformVert *dvert_src = &me->dvert[vidx]; @@ -557,16 +560,14 @@ static void vgroup_copy_active_to_sel(Object *ob, eVGroupSelect subset_type) const int cd_dvert_offset = CustomData_get_offset(&em->bm->vdata, CD_MDEFORMVERT); dvert_act = ED_mesh_active_dvert_get_em(ob, &eve_act); - if (dvert_act == NULL) { - return; - } - - BM_ITER_MESH_INDEX (eve, &iter, em->bm, BM_VERTS_OF_MESH, i) { - if (BM_elem_flag_test(eve, BM_ELEM_SELECT) && eve != eve_act) { - MDeformVert *dv = BM_ELEM_CD_GET_VOID_P(eve, cd_dvert_offset); - defvert_copy_subset(dv, dvert_act, vgroup_validmap, vgroup_tot); - if (me->editflag & ME_EDIT_MIRROR_X) { - ED_mesh_defvert_mirror_update_em(ob, eve, -1, i, cd_dvert_offset); + if (dvert_act) { + BM_ITER_MESH_INDEX (eve, &iter, em->bm, BM_VERTS_OF_MESH, i) { + if (BM_elem_flag_test(eve, BM_ELEM_SELECT) && eve != eve_act) { + MDeformVert *dv = BM_ELEM_CD_GET_VOID_P(eve, cd_dvert_offset); + defvert_copy_subset(dv, dvert_act, vgroup_validmap, vgroup_tot); + if (me->editflag & ME_EDIT_MIRROR_X) { + ED_mesh_defvert_mirror_update_em(ob, eve, -1, i, cd_dvert_offset); + } } } } @@ -576,16 +577,14 @@ static void vgroup_copy_active_to_sel(Object *ob, eVGroupSelect subset_type) int v_act; dvert_act = ED_mesh_active_dvert_get_ob(ob, &v_act); - if (dvert_act == NULL) { - return; - } - - dv = me->dvert; - for (i = 0; i < me->totvert; i++, dv++) { - if ((me->mvert[i].flag & SELECT) && dv != dvert_act) { - defvert_copy_subset(dv, dvert_act, vgroup_validmap, vgroup_tot); - if (me->editflag & ME_EDIT_MIRROR_X) { - ED_mesh_defvert_mirror_update_ob(ob, -1, i); + if (dvert_act) { + dv = me->dvert; + for (i = 0; i < me->totvert; i++, dv++) { + if ((me->mvert[i].flag & SELECT) && dv != dvert_act) { + defvert_copy_subset(dv, dvert_act, vgroup_validmap, vgroup_tot); + if (me->editflag & ME_EDIT_MIRROR_X) { + ED_mesh_defvert_mirror_update_ob(ob, -1, i); + } } } } @@ -2318,7 +2317,8 @@ static void dvert_mirror_op(MDeformVert *dvert, MDeformVert *dvert_mirr, /* TODO, vgroup locking */ /* TODO, face masking */ void ED_vgroup_mirror(Object *ob, - const bool mirror_weights, const bool flip_vgroups, const bool all_vgroups, + const bool mirror_weights, const bool flip_vgroups, + const bool all_vgroups, const bool use_topology, int *r_totmirr, int *r_totfail) { @@ -2375,7 +2375,7 @@ void ED_vgroup_mirror(Object *ob, goto cleanup; } - EDBM_verts_mirror_cache_begin(em, 0, true, false); + EDBM_verts_mirror_cache_begin(em, 0, true, false, use_topology); /* Go through the list of editverts and assign them */ BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) { @@ -2424,7 +2424,7 @@ void ED_vgroup_mirror(Object *ob, for (vidx = 0, mv = me->mvert; vidx < me->totvert; vidx++, mv++) { if ((mv->flag & ME_VERT_TMP_TAG) == 0) { - if ((vidx_mirr = mesh_get_x_mirror_vert(ob, vidx)) != -1) { + if ((vidx_mirr = mesh_get_x_mirror_vert(ob, vidx, use_topology)) != -1) { if (vidx != vidx_mirr) { mv_mirr = &me->mvert[vidx_mirr]; if ((mv_mirr->flag & ME_VERT_TMP_TAG) == 0) { @@ -2982,7 +2982,8 @@ static int vertex_group_vert_select_unlocked_poll(bContext *C) return 0; if (!(vgroup_object_in_edit_mode(ob) || - vgroup_object_in_wpaint_vert_select(ob))) { + vgroup_object_in_wpaint_vert_select(ob))) + { return 0; } @@ -2992,7 +2993,7 @@ static int vertex_group_vert_select_unlocked_poll(bContext *C) return !(dg->flag & DG_LOCK_WEIGHT); } } - return 0; + return 1; } static int vertex_group_vert_select_mesh_poll(bContext *C) @@ -3079,10 +3080,7 @@ static int vertex_group_assign_exec(bContext *C, wmOperator *op) { ToolSettings *ts = CTX_data_tool_settings(C); Object *ob = ED_object_context(C); - - if (RNA_boolean_get(op->ptr, "new")) - ED_vgroup_add(ob); - + vgroup_assign_verts(ob, ts->vgroup_weight); DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data); @@ -3093,9 +3091,9 @@ static int vertex_group_assign_exec(bContext *C, wmOperator *op) void OBJECT_OT_vertex_group_assign(wmOperatorType *ot) { /* identifiers */ - ot->name = "Assign Vertex Group"; + ot->name = "Assign to Vertex Group"; ot->idname = "OBJECT_OT_vertex_group_assign"; - ot->description = "Assign the selected vertices to the active (or a new) vertex group"; + ot->description = "Assign the selected vertices to the active vertex group"; /* api callbacks */ ot->poll = vertex_group_vert_select_unlocked_poll; @@ -3106,9 +3104,35 @@ void OBJECT_OT_vertex_group_assign(wmOperatorType *ot) * isn't stored in local edit mode stack and toggling "new" property will * lead to creating plenty of new vertex groups (see [#29527], sergey) */ ot->flag = /*OPTYPE_REGISTER|*/ OPTYPE_UNDO; +} - /* properties */ - RNA_def_boolean(ot->srna, "new", 0, "New", "Assign vertex to new vertex group"); +/* NOTE: just a wrapper around vertex_group_assign_exec(), except we add these to a new group */ +static int vertex_group_assign_new_exec(bContext *C, wmOperator *op) +{ + /* create new group... */ + Object *ob = ED_object_context(C); + ED_vgroup_add(ob); + + /* assign selection to new group */ + return vertex_group_assign_exec(C, op); +} + +void OBJECT_OT_vertex_group_assign_new(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Assign to New Group"; + ot->idname = "OBJECT_OT_vertex_group_assign_new"; + ot->description = "Assign the selected vertices to a new vertex group"; + + /* api callbacks */ + ot->poll = vertex_group_vert_select_poll; + ot->exec = vertex_group_assign_new_exec; + + /* flags */ + /* redo operator will fail in this case because vertex group assignment + * isn't stored in local edit mode stack and toggling "new" property will + * lead to creating plenty of new vertex groups (see [#29527], sergey) */ + ot->flag = /*OPTYPE_REGISTER|*/ OPTYPE_UNDO; } static int vertex_group_remove_from_exec(bContext *C, wmOperator *op) @@ -3627,6 +3651,7 @@ static int vertex_group_mirror_exec(bContext *C, wmOperator *op) RNA_boolean_get(op->ptr, "mirror_weights"), RNA_boolean_get(op->ptr, "flip_group_names"), RNA_boolean_get(op->ptr, "all_groups"), + RNA_boolean_get(op->ptr, "use_topology"), &totmirr, &totfail); ED_mesh_report_mirror(op, totmirr, totfail); @@ -3657,7 +3682,8 @@ void OBJECT_OT_vertex_group_mirror(wmOperatorType *ot) RNA_def_boolean(ot->srna, "mirror_weights", true, "Mirror Weights", "Mirror weights"); RNA_def_boolean(ot->srna, "flip_group_names", true, "Flip Group Names", "Flip vertex group names"); RNA_def_boolean(ot->srna, "all_groups", false, "All Groups", "Mirror all vertex groups weights"); - + RNA_def_boolean(ot->srna, "use_topology", 0, "Topology Mirror", + "Use topology based mirroring (for when both sides of mesh have matching, unique topology)"); } static int vertex_group_copy_to_linked_exec(bContext *C, wmOperator *UNUSED(op)) @@ -4153,15 +4179,15 @@ static bool check_vertex_group_accessible(wmOperator *op, Object *ob, int def_nr if (!dg) { BKE_report(op->reports, RPT_ERROR, "Invalid Weight Group Index"); - return true; + return false; } if (dg->flag & DG_LOCK_WEIGHT) { BKE_report(op->reports, RPT_ERROR, "Weight Group is locked"); - return true; + return false; } - return false; + return true; } static int vertex_weight_paste_exec(bContext *C, wmOperator *op) @@ -4206,7 +4232,7 @@ static int vertex_weight_delete_exec(bContext *C, wmOperator *op) Object *ob = ED_object_context(C); const int def_nr = RNA_int_get(op->ptr, "weight_group"); - if (check_vertex_group_accessible(op, ob, def_nr)) { + if (!check_vertex_group_accessible(op, ob, def_nr)) { return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index c274135786f..d9dc5648ae3 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -1639,7 +1639,7 @@ void ED_screen_full_restore(bContext *C, ScrArea *sa) if (sl->spacetype == SPACE_IMAGE) { SpaceImage *sima = sa->spacedata.first; - if(sima->flag & (SI_PREVSPACE|SI_FULLWINDOW)) { + if (sima->flag & (SI_PREVSPACE | SI_FULLWINDOW)) { sima->flag &= ~SI_PREVSPACE; sima->flag &= ~SI_FULLWINDOW; ED_screen_full_prevspace(C, sa); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index f4172d4ec80..c70841ffe82 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -599,13 +599,12 @@ static int actionzone_area_poll(bContext *C) wmWindow *win = CTX_wm_window(C); ScrArea *sa = CTX_wm_area(C); - if (sa && win) { + if (sa && win && win->eventstate) { + const int *xy = &win->eventstate->x; AZone *az; - int x = win->eventstate->x; - int y = win->eventstate->y; for (az = sa->actionzones.first; az; az = az->next) - if (BLI_rcti_isect_pt(&az->rect, x, y)) + if (BLI_rcti_isect_pt_v(&az->rect, xy)) return 1; } return 0; diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index b16721640da..584d4cef133 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -511,7 +511,7 @@ void SCREEN_OT_screencast(wmOperatorType *ot) ot->invoke = WM_operator_confirm; ot->exec = screencast_exec; - ot->poll = WM_operator_winactive; + ot->poll = screenshot_poll; /* shared poll */ ot->flag = 0; diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 158a6a92536..173a76a54e8 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -482,6 +482,7 @@ bool ED_wpaint_fill(VPaint *wp, Object *ob, float paintweight) MDeformWeight *dw, *dw_prev; int vgroup_active, vgroup_mirror = -1; unsigned int index; + const bool topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0; /* mutually exclusive, could be made into a */ const short paint_selmode = ME_EDIT_PAINT_SEL_MODE(me); @@ -521,7 +522,7 @@ bool ED_wpaint_fill(VPaint *wp, Object *ob, float paintweight) dw->weight = paintweight; if (me->editflag & ME_EDIT_MIRROR_X) { /* x mirror painting */ - int j = mesh_get_x_mirror_vert(ob, vidx); + int j = mesh_get_x_mirror_vert(ob, vidx, topology); if (j >= 0) { /* copy, not paint again */ if (vgroup_mirror != -1) { @@ -1790,6 +1791,7 @@ static void do_weight_paint_vertex( { Mesh *me = ob->data; MDeformVert *dv = &me->dvert[index]; + bool topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0; MDeformWeight *dw, *dw_prev; @@ -1818,7 +1820,7 @@ static void do_weight_paint_vertex( /* from now on we can check if mirrors enabled if this var is -1 and not bother with the flag */ if (me->editflag & ME_EDIT_MIRROR_X) { - index_mirr = mesh_get_x_mirror_vert(ob, index); + index_mirr = mesh_get_x_mirror_vert(ob, index, topology); vgroup_mirr = (wpi->vgroup_mirror != -1) ? wpi->vgroup_mirror : wpi->vgroup_active; /* another possible error - mirror group _and_ active group are the same (which is fine), @@ -2340,10 +2342,16 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P /* which faces are involved */ if (use_depth) { if (wp->flag & VP_AREA) { + char editflag_prev = me->editflag; + /* Ugly hack, to avoid drawing vertex index when getting the face index buffer - campbell */ me->editflag &= ~ME_EDIT_PAINT_VERT_SEL; + if (use_vert_sel) { + /* Ugly x2, we need this so hidden faces don't draw */ + me->editflag |= ME_EDIT_PAINT_FACE_SEL; + } totindex = sample_backbuf_area(vc, indexar, me->totpoly, mval[0], mval[1], brush_size_pressure); - me->editflag |= use_vert_sel ? ME_EDIT_PAINT_VERT_SEL : 0; + me->editflag = editflag_prev; } else { indexar[0] = view3d_sample_backbuf(vc, mval[0], mval[1]); diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index bdf93b98f22..7610f7a9192 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -214,7 +214,7 @@ static void draw_fcurve_vertices_handles(FCurve *fcu, SpaceIpo *sipo, View2D *v2 int i; /* get view settings */ - hsize = UI_GetThemeValuef(TH_HANDLE_VERTEX_SIZE); + hsize = UI_GetThemeValuef(TH_HANDLE_VERTEX_SIZE) * U.pixelsize; UI_view2d_getscale(v2d, &xscale, &yscale); /* set handle color */ diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index 6e38f236d01..765c61b5bed 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -189,7 +189,10 @@ static void graph_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) } /* force immediate init of any invalid F-Curve colors */ - sipo->flag |= SIPO_TEMP_NEEDCHANSYNC; + /* XXX: but, don't do SIPO_TEMP_NEEDCHANSYNC (i.e. channel select state sync) + * as this is run on each region resize; setting this here will cause selection + * state to be lost on area/region resizing. [#35744] + */ ED_area_tag_refresh(sa); } diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 0a2bd2aad81..20bbfbbf343 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1342,7 +1342,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI Scene *scene = CTX_data_scene(C); RenderResult *rr = BKE_image_acquire_renderresult(scene, ima); if (rr) { - RE_WriteRenderResult(op->reports, rr, simopts->filepath, simopts->im_format.quality); + RE_WriteRenderResult(op->reports, rr, simopts->filepath, simopts->im_format.exr_codec); ok = TRUE; } else { diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index ca50ff3b545..bf914a05620 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -287,24 +287,34 @@ static int mouse_nla_channels(bAnimContext *ac, float x, int channel_index, shor /* NOTE: rest of NLA-Action name doubles for operating on the AnimData block * - this is useful when there's no clear divider, and makes more sense in * the case of users trying to use this to change actions + * - in tweakmode, clicking here gets us out of tweakmode, as changing selection + * while in tweakmode is really evil! */ - - /* select/deselect */ - if (selectmode == SELECT_INVERT) { - /* inverse selection status of this AnimData block only */ - adt->flag ^= ADT_UI_SELECTED; + if (nlaedit_is_tweakmode_on(ac)) { + /* exit tweakmode immediately */ + nlaedit_disable_tweakmode(ac); + + /* changes to NLA-Action occurred */ + notifierFlags |= ND_NLA_ACTCHANGE; } else { - /* select AnimData block by itself */ - ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); - adt->flag |= ADT_UI_SELECTED; + /* select/deselect */ + if (selectmode == SELECT_INVERT) { + /* inverse selection status of this AnimData block only */ + adt->flag ^= ADT_UI_SELECTED; + } + else { + /* select AnimData block by itself */ + ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); + adt->flag |= ADT_UI_SELECTED; + } + + /* set active? */ + if (adt->flag & ADT_UI_SELECTED) + adt->flag |= ADT_UI_ACTIVE; + + notifierFlags |= (ND_ANIMCHAN | NA_SELECTED); } - - /* set active? */ - if (adt->flag & ADT_UI_SELECTED) - adt->flag |= ADT_UI_ACTIVE; - - notifierFlags |= (ND_ANIMCHAN | NA_SELECTED); } } break; diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index 159cc74af56..7347b446bce 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -173,26 +173,21 @@ void NLA_OT_tweakmode_enter(wmOperatorType *ot) /* ------------- */ -static int nlaedit_disable_tweakmode_exec(bContext *C, wmOperator *op) +/* NLA Editor internal API function for exiting tweakmode */ +bool nlaedit_disable_tweakmode(bAnimContext *ac) { - bAnimContext ac; - ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; - /* get editor data */ - if (ANIM_animdata_get_context(C, &ac) == 0) - return OPERATOR_CANCELLED; - /* get a list of the AnimData blocks being shown in the NLA */ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_ANIMDATA); - ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); + ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* if no blocks, popup error? */ if (anim_data.first == NULL) { - BKE_report(op->reports, RPT_ERROR, "No AnimData blocks to enter tweak mode for"); - return OPERATOR_CANCELLED; + BKE_report(ac->reports, RPT_ERROR, "No AnimData blocks in tweak mode to exit from"); + return false; } /* for each AnimData block with NLA-data, try exitting tweak-mode */ @@ -209,16 +204,36 @@ static int nlaedit_disable_tweakmode_exec(bContext *C, wmOperator *op) /* if we managed to enter tweakmode on at least one AnimData block, * set the flag for this in the active scene and send notifiers */ - if (ac.scene) { + if (ac->scene) { /* clear editing flag */ - ac.scene->flag &= ~SCE_NLA_EDIT_ON; + ac->scene->flag &= ~SCE_NLA_EDIT_ON; /* set notifier that things have changed */ - WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL); + WM_main_add_notifier(NC_ANIMATION | ND_NLA_ACTCHANGE, NULL); } /* done */ - return OPERATOR_FINISHED; + return true; +} + +/* exit tweakmode operator callback */ +static int nlaedit_disable_tweakmode_exec(bContext *C, wmOperator *UNUSED(op)) +{ + bAnimContext ac; + bool ok = false; + + /* get editor data */ + if (ANIM_animdata_get_context(C, &ac) == 0) + return OPERATOR_CANCELLED; + + /* perform operation */ + ok = nlaedit_disable_tweakmode(&ac); + + /* success? */ + if (ok) + return OPERATOR_FINISHED; + else + return OPERATOR_CANCELLED; } void NLA_OT_tweakmode_exit(wmOperatorType *ot) diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h index e78187cef39..2ad2418fc77 100644 --- a/source/blender/editors/space_nla/nla_intern.h +++ b/source/blender/editors/space_nla/nla_intern.h @@ -81,6 +81,8 @@ enum eNlaEdit_Snap_Mode { /* --- */ +bool nlaedit_disable_tweakmode(bAnimContext *ac); + void NLA_OT_tweakmode_enter(wmOperatorType *ot); void NLA_OT_tweakmode_exit(wmOperatorType *ot); diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c index e4d5c6ef284..aa3224507bc 100644 --- a/source/blender/editors/space_nla/nla_ops.c +++ b/source/blender/editors/space_nla/nla_ops.c @@ -172,8 +172,9 @@ static void nla_keymap_channels(wmKeyMap *keymap) { wmKeyMapItem *kmi; - /* NLA-specific (different to standard channels keymap) -------------------------- */ - /* selection */ + /* keymappings here are NLA-specific (different to standard channels keymap) */ + + /* selection --------------------------------------------------------------------- */ /* click-select */ // XXX for now, only leftmouse.... kmi = WM_keymap_add_item(keymap, "NLA_OT_channels_click", LEFTMOUSE, KM_PRESS, 0, 0); @@ -181,7 +182,7 @@ static void nla_keymap_channels(wmKeyMap *keymap) kmi = WM_keymap_add_item(keymap, "NLA_OT_channels_click", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0); RNA_boolean_set(kmi->ptr, "extend", TRUE); - /* channel operations */ + /* channel operations ------------------------------------------------------------ */ /* add tracks */ kmi = WM_keymap_add_item(keymap, "NLA_OT_tracks_add", AKEY, KM_PRESS, KM_SHIFT, 0); RNA_boolean_set(kmi->ptr, "above_selected", FALSE); @@ -197,7 +198,7 @@ static void nla_keymap_main(wmKeyConfig *keyconf, wmKeyMap *keymap) { wmKeyMapItem *kmi; - /* selection */ + /* selection ------------------------------------------------ */ /* click select */ kmi = WM_keymap_add_item(keymap, "NLA_OT_click_select", SELECTMOUSE, KM_PRESS, 0, 0); RNA_boolean_set(kmi->ptr, "extend", FALSE); @@ -233,20 +234,14 @@ static void nla_keymap_main(wmKeyConfig *keyconf, wmKeyMap *keymap) kmi = WM_keymap_add_item(keymap, "NLA_OT_select_border", BKEY, KM_PRESS, KM_ALT, 0); RNA_boolean_set(kmi->ptr, "axis_range", TRUE); - /* view*/ + /* view ---------------------------------------------------- */ /* auto-set range */ //WM_keymap_add_item(keymap, "NLA_OT_previewrange_set", PKEY, KM_PRESS, KM_CTRL|KM_ALT, 0); WM_keymap_add_item(keymap, "NLA_OT_view_all", HOMEKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "NLA_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0); - /* editing */ - /* tweakmode - * - enter and exit are separate operators with the same hotkey... - * This works as they use different poll()'s - */ - WM_keymap_add_item(keymap, "NLA_OT_tweakmode_enter", TABKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "NLA_OT_tweakmode_exit", TABKEY, KM_PRESS, 0, 0); - + /* editing ------------------------------------------------ */ + /* add strips */ WM_keymap_add_item(keymap, "NLA_OT_actionclip_add", AKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "NLA_OT_transition_add", TKEY, KM_PRESS, KM_SHIFT, 0); @@ -301,11 +296,20 @@ void nla_keymap(wmKeyConfig *keyconf) { wmKeyMap *keymap; - /* keymap for all regions */ + /* keymap for all regions ------------------------------------------- */ keymap = WM_keymap_find(keyconf, "NLA Generic", SPACE_NLA, 0); + + /* region management */ WM_keymap_add_item(keymap, "NLA_OT_properties", NKEY, KM_PRESS, 0, 0); - /* channels */ + /* tweakmode + * - enter and exit are separate operators with the same hotkey... + * This works as they use different poll()'s + */ + WM_keymap_add_item(keymap, "NLA_OT_tweakmode_enter", TABKEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "NLA_OT_tweakmode_exit", TABKEY, KM_PRESS, 0, 0); + + /* channels ---------------------------------------------------------- */ /* Channels are not directly handled by the NLA Editor module, but are inherited from the Animation module. * Most of the relevant operations, keymaps, drawing, etc. can therefore all be found in that module instead, as there * are many similarities with the other Animation Editors. @@ -315,7 +319,7 @@ void nla_keymap(wmKeyConfig *keyconf) keymap = WM_keymap_find(keyconf, "NLA Channels", SPACE_NLA, 0); nla_keymap_channels(keymap); - /* data */ + /* data ------------------------------------------------------------- */ keymap = WM_keymap_find(keyconf, "NLA Editor", SPACE_NLA, 0); nla_keymap_main(keyconf, keymap); } diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 46feea6a553..3b769761dfb 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -1059,9 +1059,9 @@ static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, Spa dx = (int)UI_GetStringWidth(te->name); - if (dx < 5*UI_UNIT_X) dx = 5*UI_UNIT_X; + if (dx < 5 * UI_UNIT_X) dx = 5 * UI_UNIT_X; spx = te->xs + 1.8f * UI_UNIT_X; - if (spx + dx + 0.5f*UI_UNIT_X > ar->v2d.cur.xmax) dx = ar->v2d.cur.xmax - spx - 0.5f*UI_UNIT_X; + if (spx + dx + 0.5f * UI_UNIT_X > ar->v2d.cur.xmax) dx = ar->v2d.cur.xmax - spx - 0.5f * UI_UNIT_X; bt = uiDefBut(block, TEX, OL_NAMEBUTTON, "", spx, (int)te->ys, dx + UI_UNIT_X, UI_UNIT_Y - 1, (void *)te->name, 1.0, (float)len, 0, 0, ""); diff --git a/source/blender/editors/space_script/script_edit.c b/source/blender/editors/space_script/script_edit.c index 8074ec57474..9df849410f4 100644 --- a/source/blender/editors/space_script/script_edit.c +++ b/source/blender/editors/space_script/script_edit.c @@ -36,10 +36,12 @@ #include "BLI_utildefines.h" #include "BKE_context.h" +#include "BKE_report.h" #include "BKE_global.h" #include "WM_api.h" #include "WM_types.h" +#include "wm_event_system.h" #include "RNA_access.h" #include "RNA_define.h" @@ -84,10 +86,41 @@ void SCRIPT_OT_python_file_run(wmOperatorType *ot) RNA_def_string_file_path(ot->srna, "filepath", "", FILE_MAX, "Path", ""); } +#ifdef WITH_PYTHON +static bool script_test_modal_operators(bContext *C) +{ + wmWindowManager *wm; + wmWindow *win; -static int script_reload_exec(bContext *C, wmOperator *UNUSED(op)) + wm = CTX_wm_manager(C); + + for (win = wm->windows.first; win; win = win->next) { + wmEventHandler *handler; + + for (handler = win->modalhandlers.first; handler; handler = handler->next) { + if (handler->op) { + wmOperatorType *ot = handler->op->type; + if (ot->ext.srna) { + return true; + } + } + } + } + + return false; +} +#endif + +static int script_reload_exec(bContext *C, wmOperator *op) { #ifdef WITH_PYTHON + + /* clear running operators */ + if (script_test_modal_operators(C)) { + BKE_report(op->reports, RPT_ERROR, "Can't reload with running modal operators"); + return OPERATOR_CANCELLED; + } + /* TODO, this crashes on netrender and keying sets, need to look into why * disable for now unless running in debug mode */ WM_cursor_wait(1); @@ -96,7 +129,7 @@ static int script_reload_exec(bContext *C, wmOperator *UNUSED(op)) WM_event_add_notifier(C, NC_WINDOW, NULL); return OPERATOR_FINISHED; #else - (void)C; /* unused */ + (void)C, (void)op; /* unused */ return OPERATOR_CANCELLED; #endif } diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index 6a836c4af13..7525b799067 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -1004,45 +1004,83 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, } /* Vertex Paint and Weight Paint */ +void draw_mesh_paint_weight_faces(DerivedMesh *dm, const bool use_light, + void *facemask_cb, void *user_data) +{ + if (use_light) { + const float spec[4] = {0.47f, 0.47f, 0.47f, 0.47f}; + + /* but set default spec */ + glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR); + glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, spec); + + /* diffuse */ + glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE); + glEnable(GL_LIGHTING); + glEnable(GL_COLOR_MATERIAL); + } + + dm->drawMappedFaces(dm, (DMSetDrawOptions)facemask_cb, GPU_enable_material, NULL, user_data, + DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH); + + if (use_light) { + glDisable(GL_COLOR_MATERIAL); + glDisable(GL_LIGHTING); + + GPU_disable_material(); + } +} + +void draw_mesh_paint_weight_edges(RegionView3D *rv3d, DerivedMesh *dm, const bool use_depth, + void *edgemask_cb, void *user_data) +{ + /* weight paint in solid mode, special case. focus on making the weights clear + * rather than the shading, this is also forced in wire view */ + + if (use_depth) { + bglPolygonOffset(rv3d->dist, 1.0); + glDepthMask(0); /* disable write in zbuffer, selected edge wires show better */ + } + else { + glDisable(GL_DEPTH_TEST); + } + + glEnable(GL_BLEND); + glColor4ub(255, 255, 255, 96); + glEnable(GL_LINE_STIPPLE); + glLineStipple(1, 0xAAAA); + + dm->drawMappedEdges(dm, (DMSetDrawOptions)edgemask_cb, user_data); + + if (use_depth) { + bglPolygonOffset(rv3d->dist, 0.0); + glDepthMask(1); + } + else { + glEnable(GL_DEPTH_TEST); + } + + glDisable(GL_LINE_STIPPLE); + glDisable(GL_BLEND); +} void draw_mesh_paint(View3D *v3d, RegionView3D *rv3d, Object *ob, DerivedMesh *dm, const int draw_flags) { DMSetDrawOptions facemask = NULL; Mesh *me = ob->data; - const bool do_light = (v3d->drawtype >= OB_SOLID); + const bool use_light = (v3d->drawtype >= OB_SOLID); /* hide faces in face select mode */ if (me->editflag & (ME_EDIT_PAINT_VERT_SEL | ME_EDIT_PAINT_FACE_SEL)) facemask = wpaint__setSolidDrawOptions_facemask; if (ob->mode & OB_MODE_WEIGHT_PAINT) { - - if (do_light) { - const float spec[4] = {0.47f, 0.47f, 0.47f, 0.47f}; - - /* enforce default material settings */ + if (use_light) { GPU_enable_material(0, NULL); - - /* but set default spec */ - glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR); - glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, spec); - - /* diffuse */ - glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE); - glEnable(GL_LIGHTING); - glEnable(GL_COLOR_MATERIAL); } - dm->drawMappedFaces(dm, facemask, GPU_enable_material, NULL, me, - DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH); - - if (do_light) { - glDisable(GL_COLOR_MATERIAL); - glDisable(GL_LIGHTING); - - GPU_disable_material(); - } + draw_mesh_paint_weight_faces(dm, use_light, facemask, me); } else if (ob->mode & OB_MODE_VERTEX_PAINT) { if (me->mloopcol) { @@ -1060,37 +1098,9 @@ void draw_mesh_paint(View3D *v3d, RegionView3D *rv3d, if (draw_flags & DRAW_FACE_SELECT) { draw_mesh_face_select(rv3d, me, dm); } - else if ((do_light == false) || (ob->dtx & OB_DRAWWIRE)) { - const int use_depth = (v3d->flag & V3D_ZBUF_SELECT) || !(ob->mode & OB_MODE_WEIGHT_PAINT); - - /* weight paint in solid mode, special case. focus on making the weights clear - * rather than the shading, this is also forced in wire view */ - - if (use_depth) { - bglPolygonOffset(rv3d->dist, 1.0); - glDepthMask(0); /* disable write in zbuffer, selected edge wires show better */ - } - else { - glDisable(GL_DEPTH_TEST); - } - - glEnable(GL_BLEND); - glColor4ub(255, 255, 255, 96); - glEnable(GL_LINE_STIPPLE); - glLineStipple(1, 0xAAAA); - - dm->drawEdges(dm, 1, 1); - - if (use_depth) { - bglPolygonOffset(rv3d->dist, 0.0); - glDepthMask(1); - } - else { - glEnable(GL_DEPTH_TEST); - } - - glDisable(GL_LINE_STIPPLE); - glDisable(GL_BLEND); + else if ((use_light == false) || (ob->dtx & OB_DRAWWIRE)) { + const bool use_depth = (v3d->flag & V3D_ZBUF_SELECT) || !(ob->mode & OB_MODE_WEIGHT_PAINT); + draw_mesh_paint_weight_edges(rv3d, dm, use_depth, NULL, NULL); } } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 1ce8cf9082e..9ab6336ab0e 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -179,7 +179,7 @@ static void ob_wire_color_blend_theme_id(const unsigned char ob_wire_col[4], con } /* this condition has been made more complex since editmode can draw textures */ -static bool check_object_draw_texture(Scene *scene, View3D *v3d, int drawtype) +static bool check_object_draw_texture(Scene *scene, View3D *v3d, const char drawtype) { /* texture and material draw modes */ if (ELEM(v3d->drawtype, OB_TEXTURE, OB_MATERIAL) && drawtype > OB_SOLID) { @@ -201,6 +201,18 @@ static bool check_object_draw_texture(Scene *scene, View3D *v3d, int drawtype) return false; } +static bool check_object_draw_editweight(Mesh *me, DerivedMesh *finalDM) +{ + if (me->drawflag & ME_DRAWEIGHT) { + /* editmesh handles its own weight drawing */ + if (finalDM->type != DM_TYPE_EDITBMESH) { + return true; + } + } + + return false; +} + static bool check_ob_drawface_dot(Scene *sce, View3D *vd, char dt) { if ((sce->toolsettings->selectmode & SCE_SELECT_FACE) == 0) @@ -3030,7 +3042,21 @@ static void draw_em_fancy(Scene *scene, ARegion *ar, View3D *v3d, EDBM_index_arrays_ensure(em, BM_VERT | BM_EDGE | BM_FACE); - if (dt > OB_WIRE) { + if (check_object_draw_editweight(me, finalDM)) { + if (dt > OB_WIRE) { + draw_mesh_paint_weight_faces(finalDM, true, draw_em_fancy__setFaceOpts, me->edit_btmesh); + + bglPolygonOffset(rv3d->dist, 1.0); + glDepthMask(0); + } + else { + glEnable(GL_DEPTH_TEST); + draw_mesh_paint_weight_faces(finalDM, false, draw_em_fancy__setFaceOpts, me->edit_btmesh); + draw_mesh_paint_weight_edges(rv3d, finalDM, true, draw_dm_edges__setDrawOptions, me->edit_btmesh); + glDisable(GL_DEPTH_TEST); + } + } + else if (dt > OB_WIRE) { if (check_object_draw_texture(scene, v3d, dt)) { if (draw_glsl_material(scene, ob, v3d, dt)) { glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW); diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index a1df2568f73..0a2358aa137 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -592,7 +592,7 @@ static void drawcursor(Scene *scene, ARegion *ar, View3D *v3d) * colors copied from transform_manipulator.c, we should keep these matching. */ static void draw_view_axis(RegionView3D *rv3d, rcti *rect) { - const float k = U.rvisize; /* axis size */ + const float k = U.rvisize * U.pixelsize; /* axis size */ const float toll = 0.5; /* used to see when view is quasi-orthogonal */ float startx = k + 1.0f; /* axis center in screen coordinates, x=y */ float starty = k + 1.0f; diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index f5ffd10c272..44c85799896 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -150,6 +150,10 @@ bool draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob, struct DerivedMesh *dm, const int draw_flags); void draw_mesh_face_select(struct RegionView3D *rv3d, struct Mesh *me, struct DerivedMesh *dm); +void draw_mesh_paint_weight_faces(struct DerivedMesh *dm, const bool do_light, + void *facemask_cb, void *user_data); +void draw_mesh_paint_weight_edges(RegionView3D *rv3d, struct DerivedMesh *dm, const bool use_depth, + void *edgemask_cb, void *user_data); void draw_mesh_paint(View3D *v3d, RegionView3D *rv3d, struct Object *ob, struct DerivedMesh *dm, const int draw_flags); diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index d243f355b5c..1678487d8bf 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -54,6 +54,7 @@ #include "BKE_depsgraph.h" #include "BKE_lattice.h" #include "BKE_main.h" +#include "BKE_mball.h" #include "BKE_object.h" #include "BKE_editmesh.h" #include "BKE_DerivedMesh.h" @@ -1089,6 +1090,19 @@ bool ED_view3d_minmax_verts(Object *obedit, float min[3], float max[3]) float centroid[3], vec[3], bmat[3][3]; int a; + /* metaballs are an exception */ + if (obedit->type == OB_MBALL) { + float ob_min[3], ob_max[3]; + bool change; + + change = BKE_mball_minmax_ex(obedit->data, ob_min, ob_max, obedit->obmat, SELECT); + if (change) { + minmax_v3v3_v3(min, max, ob_min); + minmax_v3v3_v3(min, max, ob_max); + } + return change; + } + tottrans = 0; if (ELEM5(obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE)) make_trans_verts(obedit, bmat[0], bmat[1], TM_ALL_JOINTS); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 44c2158bf74..a089f0d4159 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -2023,6 +2023,7 @@ static void createTransEditVerts(TransInfo *t) TransData *tob = NULL; TransDataExtension *tx = NULL; BMEditMesh *em = BKE_editmesh_from_object(t->obedit); + Mesh *me = t->obedit->data; BMesh *bm = em->bm; BMVert *eve; BMIter iter; @@ -2036,9 +2037,10 @@ static void createTransEditVerts(TransInfo *t) char *selstate = NULL; short selectmode = ts->selectmode; int cd_vert_bweight_offset = -1; + bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0; if (t->flag & T_MIRROR) { - EDBM_verts_mirror_cache_begin(em, 0, false, (t->flag & T_PROP_EDIT) == 0); + EDBM_verts_mirror_cache_begin(em, 0, false, (t->flag & T_PROP_EDIT) == 0, use_topology); mirror = 1; } diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index cfdbf87785e..9dc98e59c42 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -1889,365 +1889,388 @@ void GPU_state_init(void) #ifdef DEBUG /* debugging aid */ -static void gpu_get_print(const char *name, GLenum type) +static void gpu_state_print_fl_ex(const char *name, GLenum type) { + const unsigned char err_mark[4] = {0xff, 0xff, 0xff, 0xff}; + float value[32]; int a; - - memset(value, 0, sizeof(value)); + + memset(value, 0xff, sizeof(value)); glGetFloatv(type, value); printf("%s: ", name); - for (a = 0; a < 32; a++) + for (a = 0; a < 32; a++) { + if (memcmp(&value[a], err_mark, sizeof(value[a])) == 0) { + break; + } printf("%.2f ", value[a]); + } printf("\n"); } +#define gpu_state_print_fl(val) gpu_state_print_fl_ex(#val, val) + void GPU_state_print(void) { - gpu_get_print("GL_ACCUM_ALPHA_BITS", GL_ACCUM_ALPHA_BITS); - gpu_get_print("GL_ACCUM_BLUE_BITS", GL_ACCUM_BLUE_BITS); - gpu_get_print("GL_ACCUM_CLEAR_VALUE", GL_ACCUM_CLEAR_VALUE); - gpu_get_print("GL_ACCUM_GREEN_BITS", GL_ACCUM_GREEN_BITS); - gpu_get_print("GL_ACCUM_RED_BITS", GL_ACCUM_RED_BITS); - gpu_get_print("GL_ACTIVE_TEXTURE", GL_ACTIVE_TEXTURE); - gpu_get_print("GL_ALIASED_POINT_SIZE_RANGE", GL_ALIASED_POINT_SIZE_RANGE); - gpu_get_print("GL_ALIASED_LINE_WIDTH_RANGE", GL_ALIASED_LINE_WIDTH_RANGE); - gpu_get_print("GL_ALPHA_BIAS", GL_ALPHA_BIAS); - gpu_get_print("GL_ALPHA_BITS", GL_ALPHA_BITS); - gpu_get_print("GL_ALPHA_SCALE", GL_ALPHA_SCALE); - gpu_get_print("GL_ALPHA_TEST", GL_ALPHA_TEST); - gpu_get_print("GL_ALPHA_TEST_FUNC", GL_ALPHA_TEST_FUNC); - gpu_get_print("GL_ALPHA_TEST_REF", GL_ALPHA_TEST_REF); - gpu_get_print("GL_ARRAY_BUFFER_BINDING", GL_ARRAY_BUFFER_BINDING); - gpu_get_print("GL_ATTRIB_STACK_DEPTH", GL_ATTRIB_STACK_DEPTH); - gpu_get_print("GL_AUTO_NORMAL", GL_AUTO_NORMAL); - gpu_get_print("GL_AUX_BUFFERS", GL_AUX_BUFFERS); - gpu_get_print("GL_BLEND", GL_BLEND); - gpu_get_print("GL_BLEND_COLOR", GL_BLEND_COLOR); - gpu_get_print("GL_BLEND_DST_ALPHA", GL_BLEND_DST_ALPHA); - gpu_get_print("GL_BLEND_DST_RGB", GL_BLEND_DST_RGB); - gpu_get_print("GL_BLEND_EQUATION_RGB", GL_BLEND_EQUATION_RGB); - gpu_get_print("GL_BLEND_EQUATION_ALPHA", GL_BLEND_EQUATION_ALPHA); - gpu_get_print("GL_BLEND_SRC_ALPHA", GL_BLEND_SRC_ALPHA); - gpu_get_print("GL_BLEND_SRC_RGB", GL_BLEND_SRC_RGB); - gpu_get_print("GL_BLUE_BIAS", GL_BLUE_BIAS); - gpu_get_print("GL_BLUE_BITS", GL_BLUE_BITS); - gpu_get_print("GL_BLUE_SCALE", GL_BLUE_SCALE); - gpu_get_print("GL_CLIENT_ACTIVE_TEXTURE", GL_CLIENT_ACTIVE_TEXTURE); - gpu_get_print("GL_CLIENT_ATTRIB_STACK_DEPTH", GL_CLIENT_ATTRIB_STACK_DEPTH); - gpu_get_print("GL_CLIP_PLANE0", GL_CLIP_PLANE0); - gpu_get_print("GL_COLOR_ARRAY", GL_COLOR_ARRAY); - gpu_get_print("GL_COLOR_ARRAY_BUFFER_BINDING", GL_COLOR_ARRAY_BUFFER_BINDING); - gpu_get_print("GL_COLOR_ARRAY_SIZE", GL_COLOR_ARRAY_SIZE); - gpu_get_print("GL_COLOR_ARRAY_STRIDE", GL_COLOR_ARRAY_STRIDE); - gpu_get_print("GL_COLOR_ARRAY_TYPE", GL_COLOR_ARRAY_TYPE); - gpu_get_print("GL_COLOR_CLEAR_VALUE", GL_COLOR_CLEAR_VALUE); - gpu_get_print("GL_COLOR_LOGIC_OP", GL_COLOR_LOGIC_OP); - gpu_get_print("GL_COLOR_MATERIAL", GL_COLOR_MATERIAL); - gpu_get_print("GL_COLOR_MATERIAL_FACE", GL_COLOR_MATERIAL_FACE); - gpu_get_print("GL_COLOR_MATERIAL_PARAMETER", GL_COLOR_MATERIAL_PARAMETER); - gpu_get_print("GL_COLOR_MATRIX", GL_COLOR_MATRIX); - gpu_get_print("GL_COLOR_MATRIX_STACK_DEPTH", GL_COLOR_MATRIX_STACK_DEPTH); - gpu_get_print("GL_COLOR_SUM", GL_COLOR_SUM); - gpu_get_print("GL_COLOR_TABLE", GL_COLOR_TABLE); - gpu_get_print("GL_COLOR_WRITEMASK", GL_COLOR_WRITEMASK); - gpu_get_print("GL_COMPRESSED_TEXTURE_FORMATS", GL_COMPRESSED_TEXTURE_FORMATS); - gpu_get_print("GL_CONVOLUTION_1D", GL_CONVOLUTION_1D); - gpu_get_print("GL_CONVOLUTION_2D", GL_CONVOLUTION_2D); - gpu_get_print("GL_CULL_FACE", GL_CULL_FACE); - gpu_get_print("GL_CULL_FACE_MODE", GL_CULL_FACE_MODE); - gpu_get_print("GL_CURRENT_COLOR", GL_CURRENT_COLOR); - gpu_get_print("GL_CURRENT_FOG_COORD", GL_CURRENT_FOG_COORD); - gpu_get_print("GL_CURRENT_INDEX", GL_CURRENT_INDEX); - gpu_get_print("GL_CURRENT_NORMAL", GL_CURRENT_NORMAL); - gpu_get_print("GL_CURRENT_PROGRAM", GL_CURRENT_PROGRAM); - gpu_get_print("GL_CURRENT_RASTER_COLOR", GL_CURRENT_RASTER_COLOR); - gpu_get_print("GL_CURRENT_RASTER_DISTANCE", GL_CURRENT_RASTER_DISTANCE); - gpu_get_print("GL_CURRENT_RASTER_INDEX", GL_CURRENT_RASTER_INDEX); - gpu_get_print("GL_CURRENT_RASTER_POSITION", GL_CURRENT_RASTER_POSITION); - gpu_get_print("GL_CURRENT_RASTER_POSITION_VALID", GL_CURRENT_RASTER_POSITION_VALID); - gpu_get_print("GL_CURRENT_RASTER_SECONDARY_COLOR", GL_CURRENT_RASTER_SECONDARY_COLOR); - gpu_get_print("GL_CURRENT_RASTER_TEXTURE_COORDS", GL_CURRENT_RASTER_TEXTURE_COORDS); - gpu_get_print("GL_CURRENT_SECONDARY_COLOR", GL_CURRENT_SECONDARY_COLOR); - gpu_get_print("GL_CURRENT_TEXTURE_COORDS", GL_CURRENT_TEXTURE_COORDS); - gpu_get_print("GL_DEPTH_BIAS", GL_DEPTH_BIAS); - gpu_get_print("GL_DEPTH_BITS", GL_DEPTH_BITS); - gpu_get_print("GL_DEPTH_CLEAR_VALUE", GL_DEPTH_CLEAR_VALUE); - gpu_get_print("GL_DEPTH_FUNC", GL_DEPTH_FUNC); - gpu_get_print("GL_DEPTH_RANGE", GL_DEPTH_RANGE); - gpu_get_print("GL_DEPTH_SCALE", GL_DEPTH_SCALE); - gpu_get_print("GL_DEPTH_TEST", GL_DEPTH_TEST); - gpu_get_print("GL_DEPTH_WRITEMASK", GL_DEPTH_WRITEMASK); - gpu_get_print("GL_DITHER", GL_DITHER); - gpu_get_print("GL_DOUBLEBUFFER", GL_DOUBLEBUFFER); - gpu_get_print("GL_DRAW_BUFFER", GL_DRAW_BUFFER); - gpu_get_print("GL_DRAW_BUFFER0", GL_DRAW_BUFFER0); - gpu_get_print("GL_EDGE_FLAG", GL_EDGE_FLAG); - gpu_get_print("GL_EDGE_FLAG_ARRAY", GL_EDGE_FLAG_ARRAY); - gpu_get_print("GL_EDGE_FLAG_ARRAY_BUFFER_BINDING", GL_EDGE_FLAG_ARRAY_BUFFER_BINDING); - gpu_get_print("GL_EDGE_FLAG_ARRAY_STRIDE", GL_EDGE_FLAG_ARRAY_STRIDE); - gpu_get_print("GL_ELEMENT_ARRAY_BUFFER_BINDING", GL_ELEMENT_ARRAY_BUFFER_BINDING); - gpu_get_print("GL_FEEDBACK_BUFFER_SIZE", GL_FEEDBACK_BUFFER_SIZE); - gpu_get_print("GL_FEEDBACK_BUFFER_TYPE", GL_FEEDBACK_BUFFER_TYPE); - gpu_get_print("GL_FOG", GL_FOG); - gpu_get_print("GL_FOG_COORD_ARRAY", GL_FOG_COORD_ARRAY); - gpu_get_print("GL_FOG_COORD_ARRAY_BUFFER_BINDING", GL_FOG_COORD_ARRAY_BUFFER_BINDING); - gpu_get_print("GL_FOG_COORD_ARRAY_STRIDE", GL_FOG_COORD_ARRAY_STRIDE); - gpu_get_print("GL_FOG_COORD_ARRAY_TYPE", GL_FOG_COORD_ARRAY_TYPE); - gpu_get_print("GL_FOG_COORD_SRC", GL_FOG_COORD_SRC); - gpu_get_print("GL_FOG_COLOR", GL_FOG_COLOR); - gpu_get_print("GL_FOG_DENSITY", GL_FOG_DENSITY); - gpu_get_print("GL_FOG_END", GL_FOG_END); - gpu_get_print("GL_FOG_HINT", GL_FOG_HINT); - gpu_get_print("GL_FOG_INDEX", GL_FOG_INDEX); - gpu_get_print("GL_FOG_MODE", GL_FOG_MODE); - gpu_get_print("GL_FOG_START", GL_FOG_START); - gpu_get_print("GL_FRAGMENT_SHADER_DERIVATIVE_HINT", GL_FRAGMENT_SHADER_DERIVATIVE_HINT); - gpu_get_print("GL_FRONT_FACE", GL_FRONT_FACE); - gpu_get_print("GL_GENERATE_MIPMAP_HINT", GL_GENERATE_MIPMAP_HINT); - gpu_get_print("GL_GREEN_BIAS", GL_GREEN_BIAS); - gpu_get_print("GL_GREEN_BITS", GL_GREEN_BITS); - gpu_get_print("GL_GREEN_SCALE", GL_GREEN_SCALE); - gpu_get_print("GL_HISTOGRAM", GL_HISTOGRAM); - gpu_get_print("GL_INDEX_ARRAY", GL_INDEX_ARRAY); - gpu_get_print("GL_INDEX_ARRAY_BUFFER_BINDING", GL_INDEX_ARRAY_BUFFER_BINDING); - gpu_get_print("GL_INDEX_ARRAY_STRIDE", GL_INDEX_ARRAY_STRIDE); - gpu_get_print("GL_INDEX_ARRAY_TYPE", GL_INDEX_ARRAY_TYPE); - gpu_get_print("GL_INDEX_BITS", GL_INDEX_BITS); - gpu_get_print("GL_INDEX_CLEAR_VALUE", GL_INDEX_CLEAR_VALUE); - gpu_get_print("GL_INDEX_LOGIC_OP", GL_INDEX_LOGIC_OP); - gpu_get_print("GL_INDEX_MODE", GL_INDEX_MODE); - gpu_get_print("GL_INDEX_OFFSET", GL_INDEX_OFFSET); - gpu_get_print("GL_INDEX_SHIFT", GL_INDEX_SHIFT); - gpu_get_print("GL_INDEX_WRITEMASK", GL_INDEX_WRITEMASK); - gpu_get_print("GL_LIGHT0", GL_LIGHT0); - gpu_get_print("GL_LIGHTING", GL_LIGHTING); - gpu_get_print("GL_LIGHT_MODEL_AMBIENT", GL_LIGHT_MODEL_AMBIENT); - gpu_get_print("GL_LIGHT_MODEL_COLOR_CONTROL", GL_LIGHT_MODEL_COLOR_CONTROL); - gpu_get_print("GL_LIGHT_MODEL_LOCAL_VIEWER", GL_LIGHT_MODEL_LOCAL_VIEWER); - gpu_get_print("GL_LIGHT_MODEL_TWO_SIDE", GL_LIGHT_MODEL_TWO_SIDE); - gpu_get_print("GL_LINE_SMOOTH", GL_LINE_SMOOTH); - gpu_get_print("GL_LINE_SMOOTH_HINT", GL_LINE_SMOOTH_HINT); - gpu_get_print("GL_LINE_STIPPLE", GL_LINE_STIPPLE); - gpu_get_print("GL_LINE_STIPPLE_PATTERN", GL_LINE_STIPPLE_PATTERN); - gpu_get_print("GL_LINE_STIPPLE_REPEAT", GL_LINE_STIPPLE_REPEAT); - gpu_get_print("GL_LINE_WIDTH", GL_LINE_WIDTH); - gpu_get_print("GL_LINE_WIDTH_GRANULARITY", GL_LINE_WIDTH_GRANULARITY); - gpu_get_print("GL_LINE_WIDTH_RANGE", GL_LINE_WIDTH_RANGE); - gpu_get_print("GL_LIST_BASE", GL_LIST_BASE); - gpu_get_print("GL_LIST_INDEX", GL_LIST_INDEX); - gpu_get_print("GL_LIST_MODE", GL_LIST_MODE); - gpu_get_print("GL_LOGIC_OP_MODE", GL_LOGIC_OP_MODE); - gpu_get_print("GL_MAP1_COLOR_4", GL_MAP1_COLOR_4); - gpu_get_print("GL_MAP1_GRID_DOMAIN", GL_MAP1_GRID_DOMAIN); - gpu_get_print("GL_MAP1_GRID_SEGMENTS", GL_MAP1_GRID_SEGMENTS); - gpu_get_print("GL_MAP1_INDEX", GL_MAP1_INDEX); - gpu_get_print("GL_MAP1_NORMAL", GL_MAP1_NORMAL); - gpu_get_print("GL_MAP1_TEXTURE_COORD_1", GL_MAP1_TEXTURE_COORD_1); - gpu_get_print("GL_MAP1_TEXTURE_COORD_2", GL_MAP1_TEXTURE_COORD_2); - gpu_get_print("GL_MAP1_TEXTURE_COORD_3", GL_MAP1_TEXTURE_COORD_3); - gpu_get_print("GL_MAP1_TEXTURE_COORD_4", GL_MAP1_TEXTURE_COORD_4); - gpu_get_print("GL_MAP1_VERTEX_3", GL_MAP1_VERTEX_3); - gpu_get_print("GL_MAP1_VERTEX_4", GL_MAP1_VERTEX_4); - gpu_get_print("GL_MAP2_COLOR_4", GL_MAP2_COLOR_4); - gpu_get_print("GL_MAP2_GRID_DOMAIN", GL_MAP2_GRID_DOMAIN); - gpu_get_print("GL_MAP2_GRID_SEGMENTS", GL_MAP2_GRID_SEGMENTS); - gpu_get_print("GL_MAP2_INDEX", GL_MAP2_INDEX); - gpu_get_print("GL_MAP2_NORMAL", GL_MAP2_NORMAL); - gpu_get_print("GL_MAP2_TEXTURE_COORD_1", GL_MAP2_TEXTURE_COORD_1); - gpu_get_print("GL_MAP2_TEXTURE_COORD_2", GL_MAP2_TEXTURE_COORD_2); - gpu_get_print("GL_MAP2_TEXTURE_COORD_3", GL_MAP2_TEXTURE_COORD_3); - gpu_get_print("GL_MAP2_TEXTURE_COORD_4", GL_MAP2_TEXTURE_COORD_4); - gpu_get_print("GL_MAP2_VERTEX_3", GL_MAP2_VERTEX_3); - gpu_get_print("GL_MAP2_VERTEX_4", GL_MAP2_VERTEX_4); - gpu_get_print("GL_MAP_COLOR", GL_MAP_COLOR); - gpu_get_print("GL_MAP_STENCIL", GL_MAP_STENCIL); - gpu_get_print("GL_MATRIX_MODE", GL_MATRIX_MODE); - gpu_get_print("GL_MAX_3D_TEXTURE_SIZE", GL_MAX_3D_TEXTURE_SIZE); - gpu_get_print("GL_MAX_CLIENT_ATTRIB_STACK_DEPTH", GL_MAX_CLIENT_ATTRIB_STACK_DEPTH); - gpu_get_print("GL_MAX_ATTRIB_STACK_DEPTH", GL_MAX_ATTRIB_STACK_DEPTH); - gpu_get_print("GL_MAX_CLIP_PLANES", GL_MAX_CLIP_PLANES); - gpu_get_print("GL_MAX_COLOR_MATRIX_STACK_DEPTH", GL_MAX_COLOR_MATRIX_STACK_DEPTH); - gpu_get_print("GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS", GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS); - gpu_get_print("GL_MAX_CUBE_MAP_TEXTURE_SIZE", GL_MAX_CUBE_MAP_TEXTURE_SIZE); - gpu_get_print("GL_MAX_DRAW_BUFFERS", GL_MAX_DRAW_BUFFERS); - gpu_get_print("GL_MAX_ELEMENTS_INDICES", GL_MAX_ELEMENTS_INDICES); - gpu_get_print("GL_MAX_ELEMENTS_VERTICES", GL_MAX_ELEMENTS_VERTICES); - gpu_get_print("GL_MAX_EVAL_ORDER", GL_MAX_EVAL_ORDER); - gpu_get_print("GL_MAX_FRAGMENT_UNIFORM_COMPONENTS", GL_MAX_FRAGMENT_UNIFORM_COMPONENTS); - gpu_get_print("GL_MAX_LIGHTS", GL_MAX_LIGHTS); - gpu_get_print("GL_MAX_LIST_NESTING", GL_MAX_LIST_NESTING); - gpu_get_print("GL_MAX_MODELVIEW_STACK_DEPTH", GL_MAX_MODELVIEW_STACK_DEPTH); - gpu_get_print("GL_MAX_NAME_STACK_DEPTH", GL_MAX_NAME_STACK_DEPTH); - gpu_get_print("GL_MAX_PIXEL_MAP_TABLE", GL_MAX_PIXEL_MAP_TABLE); - gpu_get_print("GL_MAX_PROJECTION_STACK_DEPTH", GL_MAX_PROJECTION_STACK_DEPTH); - gpu_get_print("GL_MAX_TEXTURE_COORDS", GL_MAX_TEXTURE_COORDS); - gpu_get_print("GL_MAX_TEXTURE_IMAGE_UNITS", GL_MAX_TEXTURE_IMAGE_UNITS); - gpu_get_print("GL_MAX_TEXTURE_LOD_BIAS", GL_MAX_TEXTURE_LOD_BIAS); - gpu_get_print("GL_MAX_TEXTURE_SIZE", GL_MAX_TEXTURE_SIZE); - gpu_get_print("GL_MAX_TEXTURE_STACK_DEPTH", GL_MAX_TEXTURE_STACK_DEPTH); - gpu_get_print("GL_MAX_TEXTURE_UNITS", GL_MAX_TEXTURE_UNITS); - gpu_get_print("GL_MAX_VARYING_FLOATS", GL_MAX_VARYING_FLOATS); - gpu_get_print("GL_MAX_VERTEX_ATTRIBS", GL_MAX_VERTEX_ATTRIBS); - gpu_get_print("GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS", GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS); - gpu_get_print("GL_MAX_VERTEX_UNIFORM_COMPONENTS", GL_MAX_VERTEX_UNIFORM_COMPONENTS); - gpu_get_print("GL_MAX_VIEWPORT_DIMS", GL_MAX_VIEWPORT_DIMS); - gpu_get_print("GL_MINMAX", GL_MINMAX); - gpu_get_print("GL_MODELVIEW_MATRIX", GL_MODELVIEW_MATRIX); - gpu_get_print("GL_MODELVIEW_STACK_DEPTH", GL_MODELVIEW_STACK_DEPTH); - gpu_get_print("GL_NAME_STACK_DEPTH", GL_NAME_STACK_DEPTH); - gpu_get_print("GL_NORMAL_ARRAY", GL_NORMAL_ARRAY); - gpu_get_print("GL_NORMAL_ARRAY_BUFFER_BINDING", GL_NORMAL_ARRAY_BUFFER_BINDING); - gpu_get_print("GL_NORMAL_ARRAY_STRIDE", GL_NORMAL_ARRAY_STRIDE); - gpu_get_print("GL_NORMAL_ARRAY_TYPE", GL_NORMAL_ARRAY_TYPE); - gpu_get_print("GL_NORMALIZE", GL_NORMALIZE); - gpu_get_print("GL_NUM_COMPRESSED_TEXTURE_FORMATS", GL_NUM_COMPRESSED_TEXTURE_FORMATS); - gpu_get_print("GL_PACK_ALIGNMENT", GL_PACK_ALIGNMENT); - gpu_get_print("GL_PACK_IMAGE_HEIGHT", GL_PACK_IMAGE_HEIGHT); - gpu_get_print("GL_PACK_LSB_FIRST", GL_PACK_LSB_FIRST); - gpu_get_print("GL_PACK_ROW_LENGTH", GL_PACK_ROW_LENGTH); - gpu_get_print("GL_PACK_SKIP_IMAGES", GL_PACK_SKIP_IMAGES); - gpu_get_print("GL_PACK_SKIP_PIXELS", GL_PACK_SKIP_PIXELS); - gpu_get_print("GL_PACK_SKIP_ROWS", GL_PACK_SKIP_ROWS); - gpu_get_print("GL_PACK_SWAP_BYTES", GL_PACK_SWAP_BYTES); - gpu_get_print("GL_PERSPECTIVE_CORRECTION_HINT", GL_PERSPECTIVE_CORRECTION_HINT); - gpu_get_print("GL_PIXEL_MAP_A_TO_A_SIZE", GL_PIXEL_MAP_A_TO_A_SIZE); - gpu_get_print("GL_PIXEL_MAP_B_TO_B_SIZE", GL_PIXEL_MAP_B_TO_B_SIZE); - gpu_get_print("GL_PIXEL_MAP_G_TO_G_SIZE", GL_PIXEL_MAP_G_TO_G_SIZE); - gpu_get_print("GL_PIXEL_MAP_I_TO_A_SIZE", GL_PIXEL_MAP_I_TO_A_SIZE); - gpu_get_print("GL_PIXEL_MAP_I_TO_B_SIZE", GL_PIXEL_MAP_I_TO_B_SIZE); - gpu_get_print("GL_PIXEL_MAP_I_TO_G_SIZE", GL_PIXEL_MAP_I_TO_G_SIZE); - gpu_get_print("GL_PIXEL_MAP_I_TO_I_SIZE", GL_PIXEL_MAP_I_TO_I_SIZE); - gpu_get_print("GL_PIXEL_MAP_I_TO_R_SIZE", GL_PIXEL_MAP_I_TO_R_SIZE); - gpu_get_print("GL_PIXEL_MAP_R_TO_R_SIZE", GL_PIXEL_MAP_R_TO_R_SIZE); - gpu_get_print("GL_PIXEL_MAP_S_TO_S_SIZE", GL_PIXEL_MAP_S_TO_S_SIZE); - gpu_get_print("GL_PIXEL_PACK_BUFFER_BINDING", GL_PIXEL_PACK_BUFFER_BINDING); - gpu_get_print("GL_PIXEL_UNPACK_BUFFER_BINDING", GL_PIXEL_UNPACK_BUFFER_BINDING); - gpu_get_print("GL_POINT_DISTANCE_ATTENUATION", GL_POINT_DISTANCE_ATTENUATION); - gpu_get_print("GL_POINT_FADE_THRESHOLD_SIZE", GL_POINT_FADE_THRESHOLD_SIZE); - gpu_get_print("GL_POINT_SIZE", GL_POINT_SIZE); - gpu_get_print("GL_POINT_SIZE_GRANULARITY", GL_POINT_SIZE_GRANULARITY); - gpu_get_print("GL_POINT_SIZE_MAX", GL_POINT_SIZE_MAX); - gpu_get_print("GL_POINT_SIZE_MIN", GL_POINT_SIZE_MIN); - gpu_get_print("GL_POINT_SIZE_RANGE", GL_POINT_SIZE_RANGE); - gpu_get_print("GL_POINT_SMOOTH", GL_POINT_SMOOTH); - gpu_get_print("GL_POINT_SMOOTH_HINT", GL_POINT_SMOOTH_HINT); - gpu_get_print("GL_POINT_SPRITE", GL_POINT_SPRITE); - gpu_get_print("GL_POLYGON_MODE", GL_POLYGON_MODE); - gpu_get_print("GL_POLYGON_OFFSET_FACTOR", GL_POLYGON_OFFSET_FACTOR); - gpu_get_print("GL_POLYGON_OFFSET_UNITS", GL_POLYGON_OFFSET_UNITS); - gpu_get_print("GL_POLYGON_OFFSET_FILL", GL_POLYGON_OFFSET_FILL); - gpu_get_print("GL_POLYGON_OFFSET_LINE", GL_POLYGON_OFFSET_LINE); - gpu_get_print("GL_POLYGON_OFFSET_POINT", GL_POLYGON_OFFSET_POINT); - gpu_get_print("GL_POLYGON_SMOOTH", GL_POLYGON_SMOOTH); - gpu_get_print("GL_POLYGON_SMOOTH_HINT", GL_POLYGON_SMOOTH_HINT); - gpu_get_print("GL_POLYGON_STIPPLE", GL_POLYGON_STIPPLE); - gpu_get_print("GL_POST_COLOR_MATRIX_COLOR_TABLE", GL_POST_COLOR_MATRIX_COLOR_TABLE); - gpu_get_print("GL_POST_COLOR_MATRIX_RED_BIAS", GL_POST_COLOR_MATRIX_RED_BIAS); - gpu_get_print("GL_POST_COLOR_MATRIX_GREEN_BIAS", GL_POST_COLOR_MATRIX_GREEN_BIAS); - gpu_get_print("GL_POST_COLOR_MATRIX_BLUE_BIAS", GL_POST_COLOR_MATRIX_BLUE_BIAS); - gpu_get_print("GL_POST_COLOR_MATRIX_ALPHA_BIAS", GL_POST_COLOR_MATRIX_ALPHA_BIAS); - gpu_get_print("GL_POST_COLOR_MATRIX_RED_SCALE", GL_POST_COLOR_MATRIX_RED_SCALE); - gpu_get_print("GL_POST_COLOR_MATRIX_GREEN_SCALE", GL_POST_COLOR_MATRIX_GREEN_SCALE); - gpu_get_print("GL_POST_COLOR_MATRIX_BLUE_SCALE", GL_POST_COLOR_MATRIX_BLUE_SCALE); - gpu_get_print("GL_POST_COLOR_MATRIX_ALPHA_SCALE", GL_POST_COLOR_MATRIX_ALPHA_SCALE); - gpu_get_print("GL_POST_CONVOLUTION_COLOR_TABLE", GL_POST_CONVOLUTION_COLOR_TABLE); - gpu_get_print("GL_POST_CONVOLUTION_RED_BIAS", GL_POST_CONVOLUTION_RED_BIAS); - gpu_get_print("GL_POST_CONVOLUTION_GREEN_BIAS", GL_POST_CONVOLUTION_GREEN_BIAS); - gpu_get_print("GL_POST_CONVOLUTION_BLUE_BIAS", GL_POST_CONVOLUTION_BLUE_BIAS); - gpu_get_print("GL_POST_CONVOLUTION_ALPHA_BIAS", GL_POST_CONVOLUTION_ALPHA_BIAS); - gpu_get_print("GL_POST_CONVOLUTION_RED_SCALE", GL_POST_CONVOLUTION_RED_SCALE); - gpu_get_print("GL_POST_CONVOLUTION_GREEN_SCALE", GL_POST_CONVOLUTION_GREEN_SCALE); - gpu_get_print("GL_POST_CONVOLUTION_BLUE_SCALE", GL_POST_CONVOLUTION_BLUE_SCALE); - gpu_get_print("GL_POST_CONVOLUTION_ALPHA_SCALE", GL_POST_CONVOLUTION_ALPHA_SCALE); - gpu_get_print("GL_PROJECTION_MATRIX", GL_PROJECTION_MATRIX); - gpu_get_print("GL_PROJECTION_STACK_DEPTH", GL_PROJECTION_STACK_DEPTH); - gpu_get_print("GL_READ_BUFFER", GL_READ_BUFFER); - gpu_get_print("GL_RED_BIAS", GL_RED_BIAS); - gpu_get_print("GL_RED_BITS", GL_RED_BITS); - gpu_get_print("GL_RED_SCALE", GL_RED_SCALE); - gpu_get_print("GL_RENDER_MODE", GL_RENDER_MODE); - gpu_get_print("GL_RESCALE_NORMAL", GL_RESCALE_NORMAL); - gpu_get_print("GL_RGBA_MODE", GL_RGBA_MODE); - gpu_get_print("GL_SAMPLE_BUFFERS", GL_SAMPLE_BUFFERS); - gpu_get_print("GL_SAMPLE_COVERAGE_VALUE", GL_SAMPLE_COVERAGE_VALUE); - gpu_get_print("GL_SAMPLE_COVERAGE_INVERT", GL_SAMPLE_COVERAGE_INVERT); - gpu_get_print("GL_SAMPLES", GL_SAMPLES); - gpu_get_print("GL_SCISSOR_BOX", GL_SCISSOR_BOX); - gpu_get_print("GL_SCISSOR_TEST", GL_SCISSOR_TEST); - gpu_get_print("GL_SECONDARY_COLOR_ARRAY", GL_SECONDARY_COLOR_ARRAY); - gpu_get_print("GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING", GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING); - gpu_get_print("GL_SECONDARY_COLOR_ARRAY_SIZE", GL_SECONDARY_COLOR_ARRAY_SIZE); - gpu_get_print("GL_SECONDARY_COLOR_ARRAY_STRIDE", GL_SECONDARY_COLOR_ARRAY_STRIDE); - gpu_get_print("GL_SECONDARY_COLOR_ARRAY_TYPE", GL_SECONDARY_COLOR_ARRAY_TYPE); - gpu_get_print("GL_SELECTION_BUFFER_SIZE", GL_SELECTION_BUFFER_SIZE); - gpu_get_print("GL_SEPARABLE_2D", GL_SEPARABLE_2D); - gpu_get_print("GL_SHADE_MODEL", GL_SHADE_MODEL); - gpu_get_print("GL_SMOOTH_LINE_WIDTH_RANGE", GL_SMOOTH_LINE_WIDTH_RANGE); - gpu_get_print("GL_SMOOTH_LINE_WIDTH_GRANULARITY", GL_SMOOTH_LINE_WIDTH_GRANULARITY); - gpu_get_print("GL_SMOOTH_POINT_SIZE_RANGE", GL_SMOOTH_POINT_SIZE_RANGE); - gpu_get_print("GL_SMOOTH_POINT_SIZE_GRANULARITY", GL_SMOOTH_POINT_SIZE_GRANULARITY); - gpu_get_print("GL_STENCIL_BACK_FAIL", GL_STENCIL_BACK_FAIL); - gpu_get_print("GL_STENCIL_BACK_FUNC", GL_STENCIL_BACK_FUNC); - gpu_get_print("GL_STENCIL_BACK_PASS_DEPTH_FAIL", GL_STENCIL_BACK_PASS_DEPTH_FAIL); - gpu_get_print("GL_STENCIL_BACK_PASS_DEPTH_PASS", GL_STENCIL_BACK_PASS_DEPTH_PASS); - gpu_get_print("GL_STENCIL_BACK_REF", GL_STENCIL_BACK_REF); - gpu_get_print("GL_STENCIL_BACK_VALUE_MASK", GL_STENCIL_BACK_VALUE_MASK); - gpu_get_print("GL_STENCIL_BACK_WRITEMASK", GL_STENCIL_BACK_WRITEMASK); - gpu_get_print("GL_STENCIL_BITS", GL_STENCIL_BITS); - gpu_get_print("GL_STENCIL_CLEAR_VALUE", GL_STENCIL_CLEAR_VALUE); - gpu_get_print("GL_STENCIL_FAIL", GL_STENCIL_FAIL); - gpu_get_print("GL_STENCIL_FUNC", GL_STENCIL_FUNC); - gpu_get_print("GL_STENCIL_PASS_DEPTH_FAIL", GL_STENCIL_PASS_DEPTH_FAIL); - gpu_get_print("GL_STENCIL_PASS_DEPTH_PASS", GL_STENCIL_PASS_DEPTH_PASS); - gpu_get_print("GL_STENCIL_REF", GL_STENCIL_REF); - gpu_get_print("GL_STENCIL_TEST", GL_STENCIL_TEST); - gpu_get_print("GL_STENCIL_VALUE_MASK", GL_STENCIL_VALUE_MASK); - gpu_get_print("GL_STENCIL_WRITEMASK", GL_STENCIL_WRITEMASK); - gpu_get_print("GL_STEREO", GL_STEREO); - gpu_get_print("GL_SUBPIXEL_BITS", GL_SUBPIXEL_BITS); - gpu_get_print("GL_TEXTURE_1D", GL_TEXTURE_1D); - gpu_get_print("GL_TEXTURE_BINDING_1D", GL_TEXTURE_BINDING_1D); - gpu_get_print("GL_TEXTURE_2D", GL_TEXTURE_2D); - gpu_get_print("GL_TEXTURE_BINDING_2D", GL_TEXTURE_BINDING_2D); - gpu_get_print("GL_TEXTURE_3D", GL_TEXTURE_3D); - gpu_get_print("GL_TEXTURE_BINDING_3D", GL_TEXTURE_BINDING_3D); - gpu_get_print("GL_TEXTURE_BINDING_CUBE_MAP", GL_TEXTURE_BINDING_CUBE_MAP); - gpu_get_print("GL_TEXTURE_COMPRESSION_HINT", GL_TEXTURE_COMPRESSION_HINT); - gpu_get_print("GL_TEXTURE_COORD_ARRAY", GL_TEXTURE_COORD_ARRAY); - gpu_get_print("GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING", GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING); - gpu_get_print("GL_TEXTURE_COORD_ARRAY_SIZE", GL_TEXTURE_COORD_ARRAY_SIZE); - gpu_get_print("GL_TEXTURE_COORD_ARRAY_STRIDE", GL_TEXTURE_COORD_ARRAY_STRIDE); - gpu_get_print("GL_TEXTURE_COORD_ARRAY_TYPE", GL_TEXTURE_COORD_ARRAY_TYPE); - gpu_get_print("GL_TEXTURE_CUBE_MAP", GL_TEXTURE_CUBE_MAP); - gpu_get_print("GL_TEXTURE_GEN_Q", GL_TEXTURE_GEN_Q); - gpu_get_print("GL_TEXTURE_GEN_R", GL_TEXTURE_GEN_R); - gpu_get_print("GL_TEXTURE_GEN_S", GL_TEXTURE_GEN_S); - gpu_get_print("GL_TEXTURE_GEN_T", GL_TEXTURE_GEN_T); - gpu_get_print("GL_TEXTURE_MATRIX", GL_TEXTURE_MATRIX); - gpu_get_print("GL_TEXTURE_STACK_DEPTH", GL_TEXTURE_STACK_DEPTH); - gpu_get_print("GL_TRANSPOSE_COLOR_MATRIX", GL_TRANSPOSE_COLOR_MATRIX); - gpu_get_print("GL_TRANSPOSE_MODELVIEW_MATRIX", GL_TRANSPOSE_MODELVIEW_MATRIX); - gpu_get_print("GL_TRANSPOSE_PROJECTION_MATRIX", GL_TRANSPOSE_PROJECTION_MATRIX); - gpu_get_print("GL_TRANSPOSE_TEXTURE_MATRIX", GL_TRANSPOSE_TEXTURE_MATRIX); - gpu_get_print("GL_UNPACK_ALIGNMENT", GL_UNPACK_ALIGNMENT); - gpu_get_print("GL_UNPACK_IMAGE_HEIGHT", GL_UNPACK_IMAGE_HEIGHT); - gpu_get_print("GL_UNPACK_LSB_FIRST", GL_UNPACK_LSB_FIRST); - gpu_get_print("GL_UNPACK_ROW_LENGTH", GL_UNPACK_ROW_LENGTH); - gpu_get_print("GL_UNPACK_SKIP_IMAGES", GL_UNPACK_SKIP_IMAGES); - gpu_get_print("GL_UNPACK_SKIP_PIXELS", GL_UNPACK_SKIP_PIXELS); - gpu_get_print("GL_UNPACK_SKIP_ROWS", GL_UNPACK_SKIP_ROWS); - gpu_get_print("GL_UNPACK_SWAP_BYTES", GL_UNPACK_SWAP_BYTES); - gpu_get_print("GL_VERTEX_ARRAY", GL_VERTEX_ARRAY); - gpu_get_print("GL_VERTEX_ARRAY_BUFFER_BINDING", GL_VERTEX_ARRAY_BUFFER_BINDING); - gpu_get_print("GL_VERTEX_ARRAY_SIZE", GL_VERTEX_ARRAY_SIZE); - gpu_get_print("GL_VERTEX_ARRAY_STRIDE", GL_VERTEX_ARRAY_STRIDE); - gpu_get_print("GL_VERTEX_ARRAY_TYPE", GL_VERTEX_ARRAY_TYPE); - gpu_get_print("GL_VERTEX_PROGRAM_POINT_SIZE", GL_VERTEX_PROGRAM_POINT_SIZE); - gpu_get_print("GL_VERTEX_PROGRAM_TWO_SIDE", GL_VERTEX_PROGRAM_TWO_SIDE); - gpu_get_print("GL_VIEWPORT", GL_VIEWPORT); - gpu_get_print("GL_ZOOM_X", GL_ZOOM_X); - gpu_get_print("GL_ZOOM_Y", GL_ZOOM_Y); + gpu_state_print_fl(GL_ACCUM_ALPHA_BITS); + gpu_state_print_fl(GL_ACCUM_BLUE_BITS); + gpu_state_print_fl(GL_ACCUM_CLEAR_VALUE); + gpu_state_print_fl(GL_ACCUM_GREEN_BITS); + gpu_state_print_fl(GL_ACCUM_RED_BITS); + gpu_state_print_fl(GL_ACTIVE_TEXTURE); + gpu_state_print_fl(GL_ALIASED_LINE_WIDTH_RANGE); + gpu_state_print_fl(GL_ALIASED_POINT_SIZE_RANGE); + gpu_state_print_fl(GL_ALPHA_BIAS); + gpu_state_print_fl(GL_ALPHA_BITS); + gpu_state_print_fl(GL_ALPHA_SCALE); + gpu_state_print_fl(GL_ALPHA_TEST); + gpu_state_print_fl(GL_ALPHA_TEST_FUNC); + gpu_state_print_fl(GL_ALPHA_TEST_REF); + gpu_state_print_fl(GL_ARRAY_BUFFER_BINDING); + gpu_state_print_fl(GL_ATTRIB_STACK_DEPTH); + gpu_state_print_fl(GL_AUTO_NORMAL); + gpu_state_print_fl(GL_AUX_BUFFERS); + gpu_state_print_fl(GL_BLEND); + gpu_state_print_fl(GL_BLEND_COLOR); + gpu_state_print_fl(GL_BLEND_DST_ALPHA); + gpu_state_print_fl(GL_BLEND_DST_RGB); + gpu_state_print_fl(GL_BLEND_EQUATION_ALPHA); + gpu_state_print_fl(GL_BLEND_EQUATION_RGB); + gpu_state_print_fl(GL_BLEND_SRC_ALPHA); + gpu_state_print_fl(GL_BLEND_SRC_RGB); + gpu_state_print_fl(GL_BLUE_BIAS); + gpu_state_print_fl(GL_BLUE_BITS); + gpu_state_print_fl(GL_BLUE_SCALE); + gpu_state_print_fl(GL_CLIENT_ACTIVE_TEXTURE); + gpu_state_print_fl(GL_CLIENT_ATTRIB_STACK_DEPTH); + gpu_state_print_fl(GL_CLIP_PLANE0); + gpu_state_print_fl(GL_COLOR_ARRAY); + gpu_state_print_fl(GL_COLOR_ARRAY_BUFFER_BINDING); + gpu_state_print_fl(GL_COLOR_ARRAY_SIZE); + gpu_state_print_fl(GL_COLOR_ARRAY_STRIDE); + gpu_state_print_fl(GL_COLOR_ARRAY_TYPE); + gpu_state_print_fl(GL_COLOR_CLEAR_VALUE); + gpu_state_print_fl(GL_COLOR_LOGIC_OP); + gpu_state_print_fl(GL_COLOR_MATERIAL); + gpu_state_print_fl(GL_COLOR_MATERIAL_FACE); + gpu_state_print_fl(GL_COLOR_MATERIAL_PARAMETER); + gpu_state_print_fl(GL_COLOR_MATRIX); + gpu_state_print_fl(GL_COLOR_MATRIX_STACK_DEPTH); + gpu_state_print_fl(GL_COLOR_SUM); + gpu_state_print_fl(GL_COLOR_TABLE); + gpu_state_print_fl(GL_COLOR_WRITEMASK); + gpu_state_print_fl(GL_COMPRESSED_TEXTURE_FORMATS); + gpu_state_print_fl(GL_CONVOLUTION_1D); + gpu_state_print_fl(GL_CONVOLUTION_2D); + gpu_state_print_fl(GL_CULL_FACE); + gpu_state_print_fl(GL_CULL_FACE_MODE); + gpu_state_print_fl(GL_CURRENT_COLOR); + gpu_state_print_fl(GL_CURRENT_FOG_COORD); + gpu_state_print_fl(GL_CURRENT_INDEX); + gpu_state_print_fl(GL_CURRENT_NORMAL); + gpu_state_print_fl(GL_CURRENT_PROGRAM); + gpu_state_print_fl(GL_CURRENT_RASTER_COLOR); + gpu_state_print_fl(GL_CURRENT_RASTER_DISTANCE); + gpu_state_print_fl(GL_CURRENT_RASTER_INDEX); + gpu_state_print_fl(GL_CURRENT_RASTER_POSITION); + gpu_state_print_fl(GL_CURRENT_RASTER_POSITION_VALID); + gpu_state_print_fl(GL_CURRENT_RASTER_SECONDARY_COLOR); + gpu_state_print_fl(GL_CURRENT_RASTER_TEXTURE_COORDS); + gpu_state_print_fl(GL_CURRENT_SECONDARY_COLOR); + gpu_state_print_fl(GL_CURRENT_TEXTURE_COORDS); + gpu_state_print_fl(GL_DEPTH_BIAS); + gpu_state_print_fl(GL_DEPTH_BITS); + gpu_state_print_fl(GL_DEPTH_CLEAR_VALUE); + gpu_state_print_fl(GL_DEPTH_FUNC); + gpu_state_print_fl(GL_DEPTH_RANGE); + gpu_state_print_fl(GL_DEPTH_SCALE); + gpu_state_print_fl(GL_DEPTH_TEST); + gpu_state_print_fl(GL_DEPTH_WRITEMASK); + gpu_state_print_fl(GL_DITHER); + gpu_state_print_fl(GL_DOUBLEBUFFER); + gpu_state_print_fl(GL_DRAW_BUFFER); + gpu_state_print_fl(GL_DRAW_BUFFER0); + gpu_state_print_fl(GL_EDGE_FLAG); + gpu_state_print_fl(GL_EDGE_FLAG_ARRAY); + gpu_state_print_fl(GL_EDGE_FLAG_ARRAY_BUFFER_BINDING); + gpu_state_print_fl(GL_EDGE_FLAG_ARRAY_STRIDE); + gpu_state_print_fl(GL_ELEMENT_ARRAY_BUFFER_BINDING); + gpu_state_print_fl(GL_FEEDBACK_BUFFER_SIZE); + gpu_state_print_fl(GL_FEEDBACK_BUFFER_TYPE); + gpu_state_print_fl(GL_FOG); + gpu_state_print_fl(GL_FOG_COLOR); + gpu_state_print_fl(GL_FOG_COORD_ARRAY); + gpu_state_print_fl(GL_FOG_COORD_ARRAY_BUFFER_BINDING); + gpu_state_print_fl(GL_FOG_COORD_ARRAY_STRIDE); + gpu_state_print_fl(GL_FOG_COORD_ARRAY_TYPE); + gpu_state_print_fl(GL_FOG_COORD_SRC); + gpu_state_print_fl(GL_FOG_DENSITY); + gpu_state_print_fl(GL_FOG_END); + gpu_state_print_fl(GL_FOG_HINT); + gpu_state_print_fl(GL_FOG_INDEX); + gpu_state_print_fl(GL_FOG_MODE); + gpu_state_print_fl(GL_FOG_START); + gpu_state_print_fl(GL_FRAGMENT_PROGRAM_ARB); + gpu_state_print_fl(GL_FRAGMENT_SHADER_DERIVATIVE_HINT); + gpu_state_print_fl(GL_FRONT_FACE); + gpu_state_print_fl(GL_GENERATE_MIPMAP_HINT); + gpu_state_print_fl(GL_GREEN_BIAS); + gpu_state_print_fl(GL_GREEN_BITS); + gpu_state_print_fl(GL_GREEN_SCALE); + gpu_state_print_fl(GL_HISTOGRAM); + gpu_state_print_fl(GL_INDEX_ARRAY); + gpu_state_print_fl(GL_INDEX_ARRAY_BUFFER_BINDING); + gpu_state_print_fl(GL_INDEX_ARRAY_STRIDE); + gpu_state_print_fl(GL_INDEX_ARRAY_TYPE); + gpu_state_print_fl(GL_INDEX_BITS); + gpu_state_print_fl(GL_INDEX_CLEAR_VALUE); + gpu_state_print_fl(GL_INDEX_LOGIC_OP); + gpu_state_print_fl(GL_INDEX_MODE); + gpu_state_print_fl(GL_INDEX_OFFSET); + gpu_state_print_fl(GL_INDEX_SHIFT); + gpu_state_print_fl(GL_INDEX_WRITEMASK); + gpu_state_print_fl(GL_LIGHT0); + gpu_state_print_fl(GL_LIGHT1); + gpu_state_print_fl(GL_LIGHT2); + gpu_state_print_fl(GL_LIGHT3); + gpu_state_print_fl(GL_LIGHT4); + gpu_state_print_fl(GL_LIGHT5); + gpu_state_print_fl(GL_LIGHT6); + gpu_state_print_fl(GL_LIGHT7); + gpu_state_print_fl(GL_LIGHTING); + gpu_state_print_fl(GL_LIGHT_MODEL_AMBIENT); + gpu_state_print_fl(GL_LIGHT_MODEL_COLOR_CONTROL); + gpu_state_print_fl(GL_LIGHT_MODEL_LOCAL_VIEWER); + gpu_state_print_fl(GL_LIGHT_MODEL_TWO_SIDE); + gpu_state_print_fl(GL_LINE_SMOOTH); + gpu_state_print_fl(GL_LINE_SMOOTH_HINT); + gpu_state_print_fl(GL_LINE_STIPPLE); + gpu_state_print_fl(GL_LINE_STIPPLE_PATTERN); + gpu_state_print_fl(GL_LINE_STIPPLE_REPEAT); + gpu_state_print_fl(GL_LINE_WIDTH); + gpu_state_print_fl(GL_LINE_WIDTH_GRANULARITY); + gpu_state_print_fl(GL_LINE_WIDTH_RANGE); + gpu_state_print_fl(GL_LIST_BASE); + gpu_state_print_fl(GL_LIST_INDEX); + gpu_state_print_fl(GL_LIST_MODE); + gpu_state_print_fl(GL_LOGIC_OP); + gpu_state_print_fl(GL_LOGIC_OP_MODE); + gpu_state_print_fl(GL_MAP1_COLOR_4); + gpu_state_print_fl(GL_MAP1_GRID_DOMAIN); + gpu_state_print_fl(GL_MAP1_GRID_SEGMENTS); + gpu_state_print_fl(GL_MAP1_INDEX); + gpu_state_print_fl(GL_MAP1_NORMAL); + gpu_state_print_fl(GL_MAP1_TEXTURE_COORD_1); + gpu_state_print_fl(GL_MAP1_TEXTURE_COORD_2); + gpu_state_print_fl(GL_MAP1_TEXTURE_COORD_3); + gpu_state_print_fl(GL_MAP1_TEXTURE_COORD_4); + gpu_state_print_fl(GL_MAP1_VERTEX_3); + gpu_state_print_fl(GL_MAP1_VERTEX_4); + gpu_state_print_fl(GL_MAP2_COLOR_4); + gpu_state_print_fl(GL_MAP2_GRID_DOMAIN); + gpu_state_print_fl(GL_MAP2_GRID_SEGMENTS); + gpu_state_print_fl(GL_MAP2_INDEX); + gpu_state_print_fl(GL_MAP2_NORMAL); + gpu_state_print_fl(GL_MAP2_TEXTURE_COORD_1); + gpu_state_print_fl(GL_MAP2_TEXTURE_COORD_2); + gpu_state_print_fl(GL_MAP2_TEXTURE_COORD_3); + gpu_state_print_fl(GL_MAP2_TEXTURE_COORD_4); + gpu_state_print_fl(GL_MAP2_VERTEX_3); + gpu_state_print_fl(GL_MAP2_VERTEX_4); + gpu_state_print_fl(GL_MAP_COLOR); + gpu_state_print_fl(GL_MAP_STENCIL); + gpu_state_print_fl(GL_MATRIX_MODE); + gpu_state_print_fl(GL_MAX_3D_TEXTURE_SIZE); + gpu_state_print_fl(GL_MAX_ATTRIB_STACK_DEPTH); + gpu_state_print_fl(GL_MAX_CLIENT_ATTRIB_STACK_DEPTH); + gpu_state_print_fl(GL_MAX_CLIP_PLANES); + gpu_state_print_fl(GL_MAX_COLOR_MATRIX_STACK_DEPTH); + gpu_state_print_fl(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS); + gpu_state_print_fl(GL_MAX_CUBE_MAP_TEXTURE_SIZE); + gpu_state_print_fl(GL_MAX_DRAW_BUFFERS); + gpu_state_print_fl(GL_MAX_ELEMENTS_INDICES); + gpu_state_print_fl(GL_MAX_ELEMENTS_VERTICES); + gpu_state_print_fl(GL_MAX_EVAL_ORDER); + gpu_state_print_fl(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS); + gpu_state_print_fl(GL_MAX_LIGHTS); + gpu_state_print_fl(GL_MAX_LIST_NESTING); + gpu_state_print_fl(GL_MAX_MODELVIEW_STACK_DEPTH); + gpu_state_print_fl(GL_MAX_NAME_STACK_DEPTH); + gpu_state_print_fl(GL_MAX_PIXEL_MAP_TABLE); + gpu_state_print_fl(GL_MAX_PROJECTION_STACK_DEPTH); + gpu_state_print_fl(GL_MAX_TEXTURE_COORDS); + gpu_state_print_fl(GL_MAX_TEXTURE_IMAGE_UNITS); + gpu_state_print_fl(GL_MAX_TEXTURE_LOD_BIAS); + gpu_state_print_fl(GL_MAX_TEXTURE_SIZE); + gpu_state_print_fl(GL_MAX_TEXTURE_STACK_DEPTH); + gpu_state_print_fl(GL_MAX_TEXTURE_UNITS); + gpu_state_print_fl(GL_MAX_VARYING_FLOATS); + gpu_state_print_fl(GL_MAX_VERTEX_ATTRIBS); + gpu_state_print_fl(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS); + gpu_state_print_fl(GL_MAX_VERTEX_UNIFORM_COMPONENTS); + gpu_state_print_fl(GL_MAX_VIEWPORT_DIMS); + gpu_state_print_fl(GL_MINMAX); + gpu_state_print_fl(GL_MODELVIEW_MATRIX); + gpu_state_print_fl(GL_MODELVIEW_STACK_DEPTH); + gpu_state_print_fl(GL_MULTISAMPLE); + gpu_state_print_fl(GL_MULTISAMPLE_ARB); + gpu_state_print_fl(GL_NAME_STACK_DEPTH); + gpu_state_print_fl(GL_NORMALIZE); + gpu_state_print_fl(GL_NORMAL_ARRAY); + gpu_state_print_fl(GL_NORMAL_ARRAY_BUFFER_BINDING); + gpu_state_print_fl(GL_NORMAL_ARRAY_STRIDE); + gpu_state_print_fl(GL_NORMAL_ARRAY_TYPE); + gpu_state_print_fl(GL_NUM_COMPRESSED_TEXTURE_FORMATS); + gpu_state_print_fl(GL_PACK_ALIGNMENT); + gpu_state_print_fl(GL_PACK_IMAGE_HEIGHT); + gpu_state_print_fl(GL_PACK_LSB_FIRST); + gpu_state_print_fl(GL_PACK_ROW_LENGTH); + gpu_state_print_fl(GL_PACK_SKIP_IMAGES); + gpu_state_print_fl(GL_PACK_SKIP_PIXELS); + gpu_state_print_fl(GL_PACK_SKIP_ROWS); + gpu_state_print_fl(GL_PACK_SWAP_BYTES); + gpu_state_print_fl(GL_PERSPECTIVE_CORRECTION_HINT); + gpu_state_print_fl(GL_PIXEL_MAP_A_TO_A_SIZE); + gpu_state_print_fl(GL_PIXEL_MAP_B_TO_B_SIZE); + gpu_state_print_fl(GL_PIXEL_MAP_G_TO_G_SIZE); + gpu_state_print_fl(GL_PIXEL_MAP_I_TO_A_SIZE); + gpu_state_print_fl(GL_PIXEL_MAP_I_TO_B_SIZE); + gpu_state_print_fl(GL_PIXEL_MAP_I_TO_G_SIZE); + gpu_state_print_fl(GL_PIXEL_MAP_I_TO_I_SIZE); + gpu_state_print_fl(GL_PIXEL_MAP_I_TO_R_SIZE); + gpu_state_print_fl(GL_PIXEL_MAP_R_TO_R_SIZE); + gpu_state_print_fl(GL_PIXEL_MAP_S_TO_S_SIZE); + gpu_state_print_fl(GL_PIXEL_PACK_BUFFER_BINDING); + gpu_state_print_fl(GL_PIXEL_UNPACK_BUFFER_BINDING); + gpu_state_print_fl(GL_POINT_DISTANCE_ATTENUATION); + gpu_state_print_fl(GL_POINT_FADE_THRESHOLD_SIZE); + gpu_state_print_fl(GL_POINT_SIZE); + gpu_state_print_fl(GL_POINT_SIZE_GRANULARITY); + gpu_state_print_fl(GL_POINT_SIZE_MAX); + gpu_state_print_fl(GL_POINT_SIZE_MIN); + gpu_state_print_fl(GL_POINT_SIZE_RANGE); + gpu_state_print_fl(GL_POINT_SMOOTH); + gpu_state_print_fl(GL_POINT_SMOOTH_HINT); + gpu_state_print_fl(GL_POINT_SPRITE); + gpu_state_print_fl(GL_POLYGON_MODE); + gpu_state_print_fl(GL_POLYGON_OFFSET_FACTOR); + gpu_state_print_fl(GL_POLYGON_OFFSET_FILL); + gpu_state_print_fl(GL_POLYGON_OFFSET_LINE); + gpu_state_print_fl(GL_POLYGON_OFFSET_POINT); + gpu_state_print_fl(GL_POLYGON_OFFSET_UNITS); + gpu_state_print_fl(GL_POLYGON_SMOOTH); + gpu_state_print_fl(GL_POLYGON_SMOOTH_HINT); + gpu_state_print_fl(GL_POLYGON_STIPPLE); + gpu_state_print_fl(GL_POST_COLOR_MATRIX_ALPHA_BIAS); + gpu_state_print_fl(GL_POST_COLOR_MATRIX_ALPHA_SCALE); + gpu_state_print_fl(GL_POST_COLOR_MATRIX_BLUE_BIAS); + gpu_state_print_fl(GL_POST_COLOR_MATRIX_BLUE_SCALE); + gpu_state_print_fl(GL_POST_COLOR_MATRIX_COLOR_TABLE); + gpu_state_print_fl(GL_POST_COLOR_MATRIX_GREEN_BIAS); + gpu_state_print_fl(GL_POST_COLOR_MATRIX_GREEN_SCALE); + gpu_state_print_fl(GL_POST_COLOR_MATRIX_RED_BIAS); + gpu_state_print_fl(GL_POST_COLOR_MATRIX_RED_SCALE); + gpu_state_print_fl(GL_POST_CONVOLUTION_ALPHA_BIAS); + gpu_state_print_fl(GL_POST_CONVOLUTION_ALPHA_SCALE); + gpu_state_print_fl(GL_POST_CONVOLUTION_BLUE_BIAS); + gpu_state_print_fl(GL_POST_CONVOLUTION_BLUE_SCALE); + gpu_state_print_fl(GL_POST_CONVOLUTION_COLOR_TABLE); + gpu_state_print_fl(GL_POST_CONVOLUTION_GREEN_BIAS); + gpu_state_print_fl(GL_POST_CONVOLUTION_GREEN_SCALE); + gpu_state_print_fl(GL_POST_CONVOLUTION_RED_BIAS); + gpu_state_print_fl(GL_POST_CONVOLUTION_RED_SCALE); + gpu_state_print_fl(GL_PROJECTION_MATRIX); + gpu_state_print_fl(GL_PROJECTION_STACK_DEPTH); + gpu_state_print_fl(GL_READ_BUFFER); + gpu_state_print_fl(GL_RED_BIAS); + gpu_state_print_fl(GL_RED_BITS); + gpu_state_print_fl(GL_RED_SCALE); + gpu_state_print_fl(GL_RENDER_MODE); + gpu_state_print_fl(GL_RESCALE_NORMAL); + gpu_state_print_fl(GL_RGBA_MODE); + gpu_state_print_fl(GL_SAMPLES); + gpu_state_print_fl(GL_SAMPLE_BUFFERS); + gpu_state_print_fl(GL_SAMPLE_COVERAGE_INVERT); + gpu_state_print_fl(GL_SAMPLE_COVERAGE_VALUE); + gpu_state_print_fl(GL_SCISSOR_BOX); + gpu_state_print_fl(GL_SCISSOR_TEST); + gpu_state_print_fl(GL_SECONDARY_COLOR_ARRAY); + gpu_state_print_fl(GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING); + gpu_state_print_fl(GL_SECONDARY_COLOR_ARRAY_SIZE); + gpu_state_print_fl(GL_SECONDARY_COLOR_ARRAY_STRIDE); + gpu_state_print_fl(GL_SECONDARY_COLOR_ARRAY_TYPE); + gpu_state_print_fl(GL_SELECTION_BUFFER_SIZE); + gpu_state_print_fl(GL_SEPARABLE_2D); + gpu_state_print_fl(GL_SHADE_MODEL); + gpu_state_print_fl(GL_SMOOTH_LINE_WIDTH_GRANULARITY); + gpu_state_print_fl(GL_SMOOTH_LINE_WIDTH_RANGE); + gpu_state_print_fl(GL_SMOOTH_POINT_SIZE_GRANULARITY); + gpu_state_print_fl(GL_SMOOTH_POINT_SIZE_RANGE); + gpu_state_print_fl(GL_STENCIL_BACK_FAIL); + gpu_state_print_fl(GL_STENCIL_BACK_FUNC); + gpu_state_print_fl(GL_STENCIL_BACK_PASS_DEPTH_FAIL); + gpu_state_print_fl(GL_STENCIL_BACK_PASS_DEPTH_PASS); + gpu_state_print_fl(GL_STENCIL_BACK_REF); + gpu_state_print_fl(GL_STENCIL_BACK_VALUE_MASK); + gpu_state_print_fl(GL_STENCIL_BACK_WRITEMASK); + gpu_state_print_fl(GL_STENCIL_BITS); + gpu_state_print_fl(GL_STENCIL_CLEAR_VALUE); + gpu_state_print_fl(GL_STENCIL_FAIL); + gpu_state_print_fl(GL_STENCIL_FUNC); + gpu_state_print_fl(GL_STENCIL_PASS_DEPTH_FAIL); + gpu_state_print_fl(GL_STENCIL_PASS_DEPTH_PASS); + gpu_state_print_fl(GL_STENCIL_REF); + gpu_state_print_fl(GL_STENCIL_TEST); + gpu_state_print_fl(GL_STENCIL_VALUE_MASK); + gpu_state_print_fl(GL_STENCIL_WRITEMASK); + gpu_state_print_fl(GL_STEREO); + gpu_state_print_fl(GL_SUBPIXEL_BITS); + gpu_state_print_fl(GL_TEXTURE_1D); + gpu_state_print_fl(GL_TEXTURE_2D); + gpu_state_print_fl(GL_TEXTURE_3D); + gpu_state_print_fl(GL_TEXTURE_BINDING_1D); + gpu_state_print_fl(GL_TEXTURE_BINDING_2D); + gpu_state_print_fl(GL_TEXTURE_BINDING_3D); + gpu_state_print_fl(GL_TEXTURE_BINDING_CUBE_MAP); + gpu_state_print_fl(GL_TEXTURE_COMPRESSION_HINT); + gpu_state_print_fl(GL_TEXTURE_COORD_ARRAY); + gpu_state_print_fl(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING); + gpu_state_print_fl(GL_TEXTURE_COORD_ARRAY_SIZE); + gpu_state_print_fl(GL_TEXTURE_COORD_ARRAY_STRIDE); + gpu_state_print_fl(GL_TEXTURE_COORD_ARRAY_TYPE); + gpu_state_print_fl(GL_TEXTURE_CUBE_MAP); + gpu_state_print_fl(GL_TEXTURE_CUBE_MAP_ARB); + gpu_state_print_fl(GL_TEXTURE_GEN_Q); + gpu_state_print_fl(GL_TEXTURE_GEN_R); + gpu_state_print_fl(GL_TEXTURE_GEN_S); + gpu_state_print_fl(GL_TEXTURE_GEN_T); + gpu_state_print_fl(GL_TEXTURE_MATRIX); + gpu_state_print_fl(GL_TEXTURE_STACK_DEPTH); + gpu_state_print_fl(GL_TRANSPOSE_COLOR_MATRIX); + gpu_state_print_fl(GL_TRANSPOSE_MODELVIEW_MATRIX); + gpu_state_print_fl(GL_TRANSPOSE_PROJECTION_MATRIX); + gpu_state_print_fl(GL_TRANSPOSE_TEXTURE_MATRIX); + gpu_state_print_fl(GL_UNPACK_ALIGNMENT); + gpu_state_print_fl(GL_UNPACK_IMAGE_HEIGHT); + gpu_state_print_fl(GL_UNPACK_LSB_FIRST); + gpu_state_print_fl(GL_UNPACK_ROW_LENGTH); + gpu_state_print_fl(GL_UNPACK_SKIP_IMAGES); + gpu_state_print_fl(GL_UNPACK_SKIP_PIXELS); + gpu_state_print_fl(GL_UNPACK_SKIP_ROWS); + gpu_state_print_fl(GL_UNPACK_SWAP_BYTES); + gpu_state_print_fl(GL_VERTEX_ARRAY); + gpu_state_print_fl(GL_VERTEX_ARRAY_BUFFER_BINDING); + gpu_state_print_fl(GL_VERTEX_ARRAY_SIZE); + gpu_state_print_fl(GL_VERTEX_ARRAY_STRIDE); + gpu_state_print_fl(GL_VERTEX_ARRAY_TYPE); + gpu_state_print_fl(GL_VERTEX_PROGRAM_POINT_SIZE); + gpu_state_print_fl(GL_VERTEX_PROGRAM_TWO_SIDE); + gpu_state_print_fl(GL_VIEWPORT); + gpu_state_print_fl(GL_ZOOM_X); + gpu_state_print_fl(GL_ZOOM_Y); } + +#undef gpu_state_print_fl + #endif diff --git a/source/blender/ikplugin/intern/ikplugin_api.c b/source/blender/ikplugin/intern/ikplugin_api.c index 507d54d7526..2ca50afb0f2 100644 --- a/source/blender/ikplugin/intern/ikplugin_api.c +++ b/source/blender/ikplugin/intern/ikplugin_api.c @@ -86,12 +86,13 @@ static IKPlugin ikplugin_tab[] = { static IKPlugin *get_plugin(bPose *pose) { - if (!pose || pose->iksolver < 0 || pose->iksolver > (sizeof(ikplugin_tab) / sizeof(IKPlugin) - 2)) + if (!pose || pose->iksolver < 0 || pose->iksolver >= ((sizeof(ikplugin_tab) / sizeof(IKPlugin)) - 1)) return NULL; return &ikplugin_tab[pose->iksolver]; } + /*----------------------------------------*/ /* Plugin API */ diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index fbf64138e4c..c1707048612 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -667,7 +667,7 @@ static void rna_def_brush(BlenderRNA *brna) prop = RNA_def_property(srna, "vertex_tool", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "vertexpaint_tool"); RNA_def_property_enum_items(prop, brush_vertex_tool_items); - RNA_def_property_ui_text(prop, "Vertex/Weight Paint Tool", ""); + RNA_def_property_ui_text(prop, "Blending mode", "Brush blending mode"); RNA_def_property_update(prop, 0, "rna_Brush_vertex_tool_update"); prop = RNA_def_property(srna, "image_tool", PROP_ENUM, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index b70ab7c15f2..24eab621f5e 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -1598,32 +1598,32 @@ static void rna_def_event(BlenderRNA *brna) prop = RNA_def_property(srna, "mouse_x", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "x"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Mouse X Position", "The window relative vertical location of the mouse"); + RNA_def_property_ui_text(prop, "Mouse X Position", "The window relative horizontal location of the mouse"); prop = RNA_def_property(srna, "mouse_y", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "y"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Mouse Y Position", "The window relative horizontal location of the mouse"); + RNA_def_property_ui_text(prop, "Mouse Y Position", "The window relative vertical location of the mouse"); prop = RNA_def_property(srna, "mouse_region_x", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "mval[0]"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Mouse X Position", "The region relative vertical location of the mouse"); + RNA_def_property_ui_text(prop, "Mouse X Position", "The region relative horizontal location of the mouse"); prop = RNA_def_property(srna, "mouse_region_y", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "mval[1]"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Mouse Y Position", "The region relative horizontal location of the mouse"); + RNA_def_property_ui_text(prop, "Mouse Y Position", "The region relative vertical location of the mouse"); prop = RNA_def_property(srna, "mouse_prev_x", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "prevx"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Mouse Previous X Position", "The window relative vertical location of the mouse"); + RNA_def_property_ui_text(prop, "Mouse Previous X Position", "The window relative horizontal location of the mouse"); prop = RNA_def_property(srna, "mouse_prev_y", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "prevy"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Mouse Previous Y Position", "The window relative horizontal location of the mouse"); + RNA_def_property_ui_text(prop, "Mouse Previous Y Position", "The window relative vertical location of the mouse"); /* modifiers */ @@ -1721,12 +1721,12 @@ static void rna_def_window(BlenderRNA *brna) prop = RNA_def_property(srna, "x", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "posx"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "X Position", "Vertical location of the window"); + RNA_def_property_ui_text(prop, "X Position", "Horizontal location of the window"); prop = RNA_def_property(srna, "y", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "posy"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Y Position", "Horizontal location of the window"); + RNA_def_property_ui_text(prop, "Y Position", "Vertical location of the window"); prop = RNA_def_property(srna, "width", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "sizex"); diff --git a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c index a6369aeb3a8..ad1e70423a5 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c +++ b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c @@ -30,21 +30,19 @@ * \ingroup cmpnodes */ - - #include "node_composite_util.h" /* ******************* Color Balance ********************************* */ static bNodeSocketTemplate cmp_node_colorcorrection_in[] = { - { SOCK_RGBA,1,N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_FLOAT, 1, N_("Mask"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - { -1,0,""} + { -1, 0, ""} }; static bNodeSocketTemplate cmp_node_colorcorrection_out[] = { - { SOCK_RGBA,0,N_("Image")}, - { -1,0,""} + { SOCK_RGBA, 0, N_("Image")}, + { -1, 0, ""} }; static void node_composit_init_colorcorrection(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index c96206643d9..29555756f9f 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -4563,7 +4563,7 @@ static int render_object_type(short type) return OB_TYPE_SUPPORT_MATERIAL(type); } -static void find_dupli_instances(Render *re, ObjectRen *obr) +static void find_dupli_instances(Render *re, ObjectRen *obr, DupliObject *dob) { ObjectInstanceRen *obi; float imat[4][4], obmat[4][4], obimat[4][4], nmat[3][3]; @@ -4588,6 +4588,12 @@ static void find_dupli_instances(Render *re, ObjectRen *obr) invert_m3_m3(obi->nmat, nmat); transpose_m3(obi->nmat); + if (dob) { + copy_v3_v3(obi->dupliorco, dob->orco); + obi->dupliuv[0]= dob->uv[0]; + obi->dupliuv[1]= dob->uv[1]; + } + if (!first) { re->totvert += obr->totvert; re->totvlak += obr->totvlak; @@ -4600,7 +4606,7 @@ static void find_dupli_instances(Render *re, ObjectRen *obr) } } -static void assign_dupligroup_dupli(Render *re, ObjectInstanceRen *obi, ObjectRen *obr) +static void assign_dupligroup_dupli(Render *re, ObjectInstanceRen *obi, ObjectRen *obr, DupliObject *dob) { float imat[4][4], obmat[4][4], obimat[4][4], nmat[3][3]; @@ -4618,6 +4624,12 @@ static void assign_dupligroup_dupli(Render *re, ObjectInstanceRen *obi, ObjectRe invert_m3_m3(obi->nmat, nmat); transpose_m3(obi->nmat); + if (dob) { + copy_v3_v3(obi->dupliorco, dob->orco); + obi->dupliuv[0]= dob->uv[0]; + obi->dupliuv[1]= dob->uv[1]; + } + re->totvert += obr->totvert; re->totvlak += obr->totvlak; re->tothalo += obr->tothalo; @@ -4682,6 +4694,12 @@ static void set_dupli_tex_mat(Render *re, ObjectInstanceRen *obi, DupliObject *d invert_m4_m4(imat, dob->mat); mul_serie_m4(obi->duplitexmat, re->viewmat, dob->omat, imat, re->viewinv, 0, 0, 0, 0); } + + if (dob) { + copy_v3_v3(obi->dupliorco, dob->orco); + obi->dupliuv[0]= dob->uv[0]; + obi->dupliuv[1]= dob->uv[1]; + } } static void init_render_object_data(Render *re, ObjectRen *obr, int timeoffset) @@ -4765,7 +4783,7 @@ static void add_render_object(Render *re, Object *ob, Object *par, DupliObject * if (dob) set_dupli_tex_mat(re, obi, dob); } else - find_dupli_instances(re, obr); + find_dupli_instances(re, obr, dob); for (i=1; i<=ob->totcol; i++) { Material* ma = give_render_material(re, ob, i); @@ -4796,7 +4814,7 @@ static void add_render_object(Render *re, Object *ob, Object *par, DupliObject * if (dob) set_dupli_tex_mat(re, obi, dob); } else - find_dupli_instances(re, obr); + find_dupli_instances(re, obr, dob); } } } @@ -5154,9 +5172,9 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp * created object, and possibly setup instances if this object * itself was duplicated. for the first case find_dupli_instances * will be called later. */ - assign_dupligroup_dupli(re, obi, obr); + assign_dupligroup_dupli(re, obi, obr, dob); if (obd->transflag & OB_RENDER_DUPLI) - find_dupli_instances(re, obr); + find_dupli_instances(re, obr, dob); } } @@ -5176,9 +5194,9 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp obi->dupliuv[1]= dob->uv[1]; } else { - assign_dupligroup_dupli(re, obi, obr); + assign_dupligroup_dupli(re, obi, obr, dob); if (obd->transflag & OB_RENDER_DUPLI) - find_dupli_instances(re, obr); + find_dupli_instances(re, obr, dob); } } } diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index 3eeaebff92d..178d304eca2 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -924,6 +924,19 @@ void shade_color(ShadeInput *shi, ShadeResult *shr) shr->diff[1]= shi->g; shr->diff[2]= shi->b; shr->alpha= shi->alpha; + + /* modulate by the object color */ + if ((ma->shade_flag & MA_OBCOLOR) && shi->obr->ob) { + float obcol[4]; + + copy_v4_v4(obcol, shi->obr->ob->col); + CLAMP(obcol[3], 0.0f, 1.0f); + + shr->diff[0] *= obcol[0]; + shr->diff[1] *= obcol[1]; + shr->diff[2] *= obcol[2]; + if (shi->mode & MA_TRANSP) shr->alpha *= obcol[3]; + } } /* ramp for at end of shade */ diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c index fa7e4afc68c..515f80b0ade 100644 --- a/source/blender/windowmanager/intern/wm_cursors.c +++ b/source/blender/windowmanager/intern/wm_cursors.c @@ -107,7 +107,9 @@ static BCursor *BlenderCursor[BC_NUMCURSORS]; /*Points to static BCursor Structs void WM_cursor_set(wmWindow *win, int curs) { - if (win == NULL) return; /* Can't set custom cursor before Window init */ + if (win == NULL || G.background) { + return; /* Can't set custom cursor before Window init */ + } if (curs == CURSOR_NONE) { GHOST_SetCursorVisibility(win->ghostwin, 0); diff --git a/source/creator/creator.c b/source/creator/creator.c index 04882f07cc3..84d23530800 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -249,12 +249,12 @@ static int print_help(int UNUSED(argc), const char **UNUSED(argv), void *data) BLI_argsPrintArgDoc(ba, "--frame-jump"); BLI_argsPrintArgDoc(ba, "--render-output"); BLI_argsPrintArgDoc(ba, "--engine"); + BLI_argsPrintArgDoc(ba, "--threads"); printf("\n"); printf("Format Options:\n"); BLI_argsPrintArgDoc(ba, "--render-format"); BLI_argsPrintArgDoc(ba, "--use-extension"); - BLI_argsPrintArgDoc(ba, "--threads"); printf("\n"); printf("Animation Playback Options:\n"); @@ -266,26 +266,52 @@ static int print_help(int UNUSED(argc), const char **UNUSED(argv), void *data) BLI_argsPrintArgDoc(ba, "--window-borderless"); BLI_argsPrintArgDoc(ba, "--window-geometry"); BLI_argsPrintArgDoc(ba, "--start-console"); + BLI_argsPrintArgDoc(ba, "--no-native-pixels"); + printf("\n"); printf("Game Engine Specific Options:\n"); BLI_argsPrintArgDoc(ba, "-g"); printf("\n"); - printf("Misc Options:\n"); - BLI_argsPrintArgDoc(ba, "--debug"); - BLI_argsPrintArgDoc(ba, "--debug-fpe"); - BLI_argsPrintArgDoc(ba, "--disable-crash-handler"); + printf("Python Options:\n"); + BLI_argsPrintArgDoc(ba, "--enable-autoexec"); + BLI_argsPrintArgDoc(ba, "--disable-autoexec"); + printf("\n"); + + BLI_argsPrintArgDoc(ba, "--python"); + BLI_argsPrintArgDoc(ba, "--python-text"); + BLI_argsPrintArgDoc(ba, "--python-console"); + BLI_argsPrintArgDoc(ba, "--addons"); + + + printf("\n"); + printf("Debug Options:\n"); + BLI_argsPrintArgDoc(ba, "--debug"); + BLI_argsPrintArgDoc(ba, "--debug-value"); + + printf("\n"); + BLI_argsPrintArgDoc(ba, "--debug-events"); #ifdef WITH_FFMPEG BLI_argsPrintArgDoc(ba, "--debug-ffmpeg"); #endif - + BLI_argsPrintArgDoc(ba, "--debug-handlers"); #ifdef WITH_LIBMV BLI_argsPrintArgDoc(ba, "--debug-libmv"); #endif + BLI_argsPrintArgDoc(ba, "--debug-jobs"); + BLI_argsPrintArgDoc(ba, "--debug-python"); + + BLI_argsPrintArgDoc(ba, "--debug-wm"); + BLI_argsPrintArgDoc(ba, "--debug-all"); printf("\n"); + BLI_argsPrintArgDoc(ba, "--debug-fpe"); + BLI_argsPrintArgDoc(ba, "--disable-crash-handler"); + + printf("\n"); + printf("Misc Options:\n"); BLI_argsPrintArgDoc(ba, "--factory-startup"); printf("\n"); BLI_argsPrintArgDoc(ba, "--env-system-config"); @@ -302,18 +328,6 @@ static int print_help(int UNUSED(argc), const char **UNUSED(argv), void *data) BLI_argsPrintArgDoc(ba, "--help"); - printf("\n"); - - BLI_argsPrintArgDoc(ba, "--enable-autoexec"); - BLI_argsPrintArgDoc(ba, "--disable-autoexec"); - - printf("\n"); - - BLI_argsPrintArgDoc(ba, "--python"); - BLI_argsPrintArgDoc(ba, "--python-text"); - BLI_argsPrintArgDoc(ba, "--python-console"); - BLI_argsPrintArgDoc(ba, "--addons"); - #ifdef WIN32 BLI_argsPrintArgDoc(ba, "-R"); BLI_argsPrintArgDoc(ba, "-r"); diff --git a/source/tests/bl_run_operators.py b/source/tests/bl_run_operators.py index e6f1cc56eb0..effc06cd15f 100644 --- a/source/tests/bl_run_operators.py +++ b/source/tests/bl_run_operators.py @@ -27,9 +27,13 @@ import bpy import sys USE_ATTRSET = False +USE_FILES = "" # "/mango/" USE_RANDOM = False +USE_RANDOM_SCREEN = False RANDOM_SEED = [1] # so we can redo crashes -RANDOM_RESET = 0.1 # 10% chance of resetting on each mew operator +RANDOM_RESET = 0.1 # 10% chance of resetting on each new operator +RANDOM_MULTIPLY = 10 + op_blacklist = ( "script.reload", @@ -50,8 +54,13 @@ op_blacklist = ( "nla.bake", # OK but slow "*.*_export", "*.*_import", + "ed.undo", "ed.undo_push", + "script.autoexec_warn_clear", + "screen.delete", # already used for random screens "wm.blenderplayer_start", + "wm.recover_auto_save", + "wm.quit_blender", "wm.url_open", "wm.doc_view", "wm.doc_edit", @@ -78,6 +87,33 @@ op_blacklist = ( ) +def blend_list(mainpath): + import os + from os.path import join, splitext + + def file_list(path, filename_check=None): + for dirpath, dirnames, filenames in os.walk(path): + + # skip '.svn' + if dirpath.startswith("."): + continue + + for filename in filenames: + filepath = join(dirpath, filename) + if filename_check is None or filename_check(filepath): + yield filepath + + def is_blend(filename): + ext = splitext(filename)[1] + return (ext in {".blend",}) + + return list(sorted(file_list(mainpath, is_blend))) + +if USE_FILES: + USE_FILES_LS = blend_list(USE_FILES) + # print(USE_FILES_LS) + + def filter_op_list(operators): from fnmatch import fnmatchcase @@ -98,6 +134,18 @@ def reset_blend(): scene.frame_start = 1 scene.frame_end = 5 + if USE_RANDOM_SCREEN: + import random + for i in range(random.randint(0, len(bpy.data.screens))): + bpy.ops.screen.delete() + print("Scree IS", bpy.context.screen) + + +def reset_file(): + import random + f = USE_FILES_LS[random.randint(0, len(USE_FILES_LS) - 1)] + bpy.ops.wm.open_mainfile(filepath=f) + if USE_ATTRSET: def build_property_typemap(skip_classes): @@ -167,12 +215,14 @@ if USE_ATTRSET: # main function _random_values = ( - None, object, - 1, 0.1, -1, + None, object, type, + 1, 0.1, -1, # float("nan"), "", "test", b"", b"test", (), [], {}, (10,), (10, 20), (0, 0, 0), - {}, + {0: "", 1: "hello", 2: "test"}, {"": 0, "hello": 1, "test": 2}, + set(), {"", "test", "."}, {None, ..., type}, + range(10), (" " * i for i in range(10)), ) def attrset_data(): @@ -194,11 +244,6 @@ if USE_ATTRSET: def run_ops(operators, setup_func=None, reset=True): print("\ncontext:", setup_func.__name__) - if USE_RANDOM: - import random - if random.random() < (1.0 - RANDOM_RESET): - reset = False - # first invoke for op_id, op in operators: if op.poll(): @@ -207,7 +252,18 @@ def run_ops(operators, setup_func=None, reset=True): # disable will get blender in a bad state and crash easy! if reset: - reset_blend() + reset_test = True + if USE_RANDOM: + import random + if random.random() < (1.0 - RANDOM_RESET): + reset_test = False + + if reset_test: + if USE_FILES: + reset_file() + else: + reset_blend() + del reset_test if USE_RANDOM: # we can't be sure it will work @@ -386,12 +442,17 @@ def main(): if USE_RANDOM: import random random.seed(RANDOM_SEED[0]) + operators = operators * RANDOM_MULTIPLY random.shuffle(operators) # 2 passes, first just run setup_func to make sure they are ok for operators_test in ((), operators): # Run the operator tests in different contexts run_ops(operators_test, setup_func=lambda: None) + + if USE_FILES: + continue + run_ops(operators_test, setup_func=ctx_clear_scene) # object modes run_ops(operators_test, setup_func=ctx_object_empty)