[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36682] branches: Recreating my soc-2010-moguri (BGE shaders) branch.
Revision: 36682 http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=36682 Author: moguri Date: 2011-05-14 06:08:35 + (Sat, 14 May 2011) Log Message: --- Recreating my soc-2010-moguri (BGE shaders) branch. I'm also committing all previous changes to this branch. This will make things a lot easier going forward (avoiding a nasty merge and future merges should be easier). Modified Paths: -- branches/soc-2010-moguri/doc/python_api/rst/bge.types.rst branches/soc-2010-moguri/release/scripts/startup/bl_ui/properties_material.py branches/soc-2010-moguri/source/blender/blenkernel/BKE_material.h branches/soc-2010-moguri/source/blender/blenkernel/intern/material.c branches/soc-2010-moguri/source/blender/blenloader/intern/readfile.c branches/soc-2010-moguri/source/blender/editors/render/render_intern.h branches/soc-2010-moguri/source/blender/editors/render/render_ops.c branches/soc-2010-moguri/source/blender/editors/render/render_shading.c branches/soc-2010-moguri/source/blender/gpu/GPU_extensions.h branches/soc-2010-moguri/source/blender/gpu/GPU_material.h branches/soc-2010-moguri/source/blender/gpu/SConscript branches/soc-2010-moguri/source/blender/gpu/intern/gpu_codegen.c branches/soc-2010-moguri/source/blender/gpu/intern/gpu_codegen.h branches/soc-2010-moguri/source/blender/gpu/intern/gpu_draw.c branches/soc-2010-moguri/source/blender/gpu/intern/gpu_extensions.c branches/soc-2010-moguri/source/blender/gpu/intern/gpu_material.c branches/soc-2010-moguri/source/blender/makesdna/DNA_material_types.h branches/soc-2010-moguri/source/blender/makesrna/intern/rna_material.c branches/soc-2010-moguri/source/blenderplayer/bad_level_call_stubs/stubs.c branches/soc-2010-moguri/source/gameengine/Converter/BL_BlenderDataConversion.cpp branches/soc-2010-moguri/source/gameengine/Ketsji/BL_BlenderShader.cpp branches/soc-2010-moguri/source/gameengine/Ketsji/BL_BlenderShader.h branches/soc-2010-moguri/source/gameengine/Ketsji/KX_BlenderMaterial.cpp branches/soc-2010-moguri/source/gameengine/Ketsji/KX_BlenderMaterial.h branches/soc-2010-moguri/source/gameengine/Ketsji/KX_GameObject.cpp branches/soc-2010-moguri/source/gameengine/Ketsji/KX_GameObject.h branches/soc-2010-moguri/source/gameengine/Ketsji/KX_PythonInit.cpp branches/soc-2010-moguri/source/gameengine/Ketsji/KX_PythonInitTypes.cpp branches/soc-2010-moguri/source/gameengine/Ketsji/KX_PythonSeq.cpp branches/soc-2010-moguri/source/gameengine/Ketsji/KX_PythonSeq.h branches/soc-2010-moguri/source/gameengine/Rasterizer/CMakeLists.txt branches/soc-2010-moguri/source/gameengine/Rasterizer/RAS_MaterialBucket.h branches/soc-2010-moguri/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp branches/soc-2010-moguri/source/gameengine/Rasterizer/SConscript Added Paths: --- branches/soc-2010-moguri/ branches/soc-2010-moguri/source/gameengine/Ketsji/KX_PythonShaders.cpp branches/soc-2010-moguri/source/gameengine/Ketsji/KX_PythonShaders.h Property Changed: branches/soc-2010-moguri/source/blender/editors/render/render_intern.h branches/soc-2010-moguri/source/blender/editors/render/render_shading.c Property changes on: branches/soc-2010-moguri ___ Added: svn:ignore + *.pdb .* TAGS build cscope.out install mingw mingw-user-config.py mingw-user-config_debug.py msvc msvc-user-config.py obj sgc.bat sgd.bat smc.bat ssenv.bat tags user-config.py user-def.mk graphicall_32b graphicall_64b graphicall_64b_debug installer_32b installer_64b Added: svn:mergeinfo + /branches/soc-2010-moguri-2:30920,30958,31015,31027,31079,31136-31137,31160,31175,31230,31277,31309,31331,31340,31342,31360-31361,31365-31367,32615,33759 Modified: branches/soc-2010-moguri/doc/python_api/rst/bge.types.rst === --- trunk/blender/doc/python_api/rst/bge.types.rst 2011-05-14 04:39:27 UTC (rev 36678) +++ branches/soc-2010-moguri/doc/python_api/rst/bge.types.rst 2011-05-14 06:08:35 UTC (rev 36682) @@ -658,6 +658,12 @@ KX_BlenderMaterial + .. attribute:: blender_shader + + The current Blender shader that the material is using + + :type: :class:`Shader` + .. method:: getShader() Returns the material's shader. @@ -706,6 +712,63 @@ :return: the material's index :rtype: integer +.. class:: Shader(PyObject_Plus) + Python object for handling Blender shaders + + .. attribute:: vertex + + The vertex shader source. + + :type: string + + .. attribute:: geometry + + The geometry shader source. + + :type: string + + .. attribute:: fragment + + The fragment shader source. +
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36683] trunk/blender/source/blenderplayer /bad_level_call_stubs/stubs.c: stubs.c update: ED_view3d_from_m4()
Revision: 36683 http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=36683 Author: moguri Date: 2011-05-14 06:24:29 + (Sat, 14 May 2011) Log Message: --- stubs.c update: ED_view3d_from_m4() Modified Paths: -- trunk/blender/source/blenderplayer/bad_level_call_stubs/stubs.c Modified: trunk/blender/source/blenderplayer/bad_level_call_stubs/stubs.c === --- trunk/blender/source/blenderplayer/bad_level_call_stubs/stubs.c 2011-05-14 06:08:35 UTC (rev 36682) +++ trunk/blender/source/blenderplayer/bad_level_call_stubs/stubs.c 2011-05-14 06:24:29 UTC (rev 36683) @@ -244,6 +244,7 @@ void ED_view3d_scene_layers_update(struct Main *bmain, struct Scene *scene){} int ED_view3d_scene_layer_set(int lay, const int *values){return 0;} void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar){} +void ED_view3d_from_m4(float mat[][4], float ofs[3], float quat[4], float *dist){} void view3d_apply_mat4(float mat[][4], float *ofs, float *quat, float *dist){} int text_file_modified(struct Text *text){return 0;} void ED_node_shader_default(struct Material *ma){} ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36684] trunk/blender/source/gameengine/ Ketsji: These two files didn' t get added when I created a branch from my working copy.
Revision: 36684 http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=36684 Author: moguri Date: 2011-05-14 06:32:25 + (Sat, 14 May 2011) Log Message: --- These two files didn't get added when I created a branch from my working copy. Added Paths: --- trunk/blender/source/gameengine/Ketsji/KX_PythonShaders.cpp trunk/blender/source/gameengine/Ketsji/KX_PythonShaders.h Copied: trunk/blender/source/gameengine/Ketsji/KX_PythonShaders.cpp (from rev 30958, branches/soc-2010-moguri-2/source/gameengine/Ketsji/KX_PythonShaders.cpp) === --- trunk/blender/source/gameengine/Ketsji/KX_PythonShaders.cpp (rev 0) +++ trunk/blender/source/gameengine/Ketsji/KX_PythonShaders.cpp 2011-05-14 06:32:25 UTC (rev 36684) @@ -0,0 +1,492 @@ +/** + * $Id$ + * + * * BEGIN GPL LICENSE BLOCK * + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * * END GPL LICENSE BLOCK * + * Init bge.shaders + */ + +#ifndef DISABLE_PYTHON +#include KX_PythonInit.h +#include PyObjectPlus.h +#include KX_PythonSeq.h +#include KX_PythonShaders.h +#include KX_BlenderMaterial.h +#include BL_BlenderShader.h +#include DNA_material_types.h +#include BLI_listbase.h + +/** + * The Shader type + */ + +KX_PythonShader::KX_PythonShader() + : PyObjectPlus(), + m_vert(), + m_geom(), + m_frag(), + m_mat(NULL) +{ +} + +KX_PythonShader::KX_PythonShader(KX_BlenderMaterial *material) + : PyObjectPlus(), + m_mat(material) +{ + char vert[64000]=, geom[64000]=, frag[64000]=; + material-GetBlenderShader()-GetSources(vert, geom, frag); + + m_vert = vert; + m_geom = geom; + m_frag = frag; + + CustomUniform *cu = static_castCustomUniform*(material-GetBlenderMaterial()-csi.uniforms.first); + + while (cu) + { + m_uniforms.push_back(new KX_PythonUniform(cu)); + cu = cu-next; + } +} + +KX_PythonShader::~KX_PythonShader() +{ + // XXX This probably needs more attention... + m_uniforms.clear(); +} + +PyObject *KX_PythonShader::py_shader_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + KX_PythonShader* pyshader = new KX_PythonShader(); + return pyshader-GetProxy(); +} + +PyTypeObject KX_PythonShader::Type = { + PyVarObject_HEAD_INIT(NULL, 0) + Shader, + sizeof(PyObjectPlus_Proxy), + 0, + py_base_dealloc, + 0, + 0, + 0, + 0, + py_base_repr, + 0,0,0,0,0,0,0,0,0, + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, + 0,0,0,0,0,0,0, + Methods, + 0, + 0, + PyObjectPlus::Type, + 0,0,0,0,0,0, + py_shader_new +}; + +PyMethodDef KX_PythonShader::Methods[] = { + KX_PYMETHODTABLE_O(KX_PythonShader, addUniform), + {NULL} //Sentinel +}; + +PyAttributeDef KX_PythonShader::Attributes[] = { + KX_PYATTRIBUTE_RW_FUNCTION(vertex, KX_PythonShader, pyattr_get_source, pyattr_set_source), + KX_PYATTRIBUTE_RW_FUNCTION(geometry, KX_PythonShader, pyattr_get_source, pyattr_set_source), + KX_PYATTRIBUTE_RW_FUNCTION(fragment, KX_PythonShader, pyattr_get_source, pyattr_set_source), + KX_PYATTRIBUTE_RO_FUNCTION(uniforms, KX_PythonShader, pyattr_get_uniforms), + {NULL} //Sentinel +}; + +PyObject* KX_PythonShader::pyattr_get_source(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_PythonShader *self = static_castKX_PythonShader*(self_v); + + if (!strcmp(attrdef-m_name, vertex)) + return PyUnicode_FromString(self-m_vert.Ptr()); + else if (!strcmp(attrdef-m_name, geometry)) + return PyUnicode_FromString(self-m_geom.Ptr()); + else if (!strcmp(attrdef-m_name, fragment)) + return PyUnicode_FromString(self-m_frag.Ptr()); + else + /* Should never happen */ + PyErr_SetString(PyExc_SystemError, invalid attribute, internal error); + + Py_RETURN_NONE; +} + +int
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36685] branches/cycles/intern/cycles/ kernel/osl: Cycles: OSL build fixes, based on patch from erwin94.
Revision: 36685 http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=36685 Author: blendix Date: 2011-05-14 09:42:02 + (Sat, 14 May 2011) Log Message: --- Cycles: OSL build fixes, based on patch from erwin94. Modified Paths: -- branches/cycles/intern/cycles/kernel/osl/CMakeLists.txt branches/cycles/intern/cycles/kernel/osl/nodes/node_environment_texture.osl branches/cycles/intern/cycles/kernel/osl/nodes/node_image_texture.osl branches/cycles/intern/cycles/kernel/osl/osl_shader.cpp Added Paths: --- branches/cycles/intern/cycles/kernel/osl/nodes/node_color.h Modified: branches/cycles/intern/cycles/kernel/osl/CMakeLists.txt === --- branches/cycles/intern/cycles/kernel/osl/CMakeLists.txt 2011-05-14 06:32:25 UTC (rev 36684) +++ branches/cycles/intern/cycles/kernel/osl/CMakeLists.txt 2011-05-14 09:42:02 UTC (rev 36685) @@ -27,7 +27,7 @@ SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${RTTI_DISABLE_FLAGS}) -ADD_LIBRARY(kernel_osl ${sources} ${headers}) +ADD_LIBRARY(cycles_kernel_osl ${sources} ${headers}) ADD_SUBDIRECTORY(nodes) Added: branches/cycles/intern/cycles/kernel/osl/nodes/node_color.h === --- branches/cycles/intern/cycles/kernel/osl/nodes/node_color.h (rev 0) +++ branches/cycles/intern/cycles/kernel/osl/nodes/node_color.h 2011-05-14 09:42:02 UTC (rev 36685) @@ -0,0 +1,50 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Color Management */ + +float color_srgb_to_scene_linear(float c) +{ + if(c 0.04045) + return (c 0.0)? 0.0: c * (1.0/12.92); + else + return pow((c + 0.055)*(1.0/1.055), 2.4); +} + +float color_scene_linear_to_srgb(float c) +{ + if(c 0.0031308) + return (c 0.0)? 0.0: c * 12.92; +else + return 1.055 * pow(c, 1.0/2.4) - 0.055; +} + +color color_srgb_to_scene_linear(color c) +{ + return color( + color_srgb_to_scene_linear(c[0]), + color_srgb_to_scene_linear(c[1]), + color_srgb_to_scene_linear(c[2])); +} + +color color_scene_linear_to_srgb(color c) +{ + return color( + color_scene_linear_to_srgb(c[0]), + color_scene_linear_to_srgb(c[1]), + color_scene_linear_to_srgb(c[2])); +} + Modified: branches/cycles/intern/cycles/kernel/osl/nodes/node_environment_texture.osl === --- branches/cycles/intern/cycles/kernel/osl/nodes/node_environment_texture.osl 2011-05-14 06:32:25 UTC (rev 36684) +++ branches/cycles/intern/cycles/kernel/osl/nodes/node_environment_texture.osl 2011-05-14 09:42:02 UTC (rev 36685) @@ -17,6 +17,7 @@ */ #include stdosl.h +#include node_color.h shader node_environment_texture( vector Vector = P, Modified: branches/cycles/intern/cycles/kernel/osl/nodes/node_image_texture.osl === --- branches/cycles/intern/cycles/kernel/osl/nodes/node_image_texture.osl 2011-05-14 06:32:25 UTC (rev 36684) +++ branches/cycles/intern/cycles/kernel/osl/nodes/node_image_texture.osl 2011-05-14 09:42:02 UTC (rev 36685) @@ -17,6 +17,7 @@ */ #include stdosl.h +#include node_color.h shader node_image_texture( point Vector = P, Modified: branches/cycles/intern/cycles/kernel/osl/osl_shader.cpp === --- branches/cycles/intern/cycles/kernel/osl/osl_shader.cpp 2011-05-14 06:32:25 UTC (rev 36684) +++ branches/cycles/intern/cycles/kernel/osl/osl_shader.cpp 2011-05-14 09:42:02 UTC (rev 36685) @@ -31,7 +31,7 @@ CCL_NAMESPACE_BEGIN -tls_ptr(ThreadData, OSLGlobals::thread_data); +tls_ptr(OSLGlobals::ThreadData, OSLGlobals::thread_data); /* Threads */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36686] trunk/blender/source/blender/ editors/space_view3d/view3d_edit.c: fix for view dolly not working with auto-depth zoom to mouse location when
Revision: 36686 http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=36686 Author: campbellbarton Date: 2011-05-14 10:35:11 + (Sat, 14 May 2011) Log Message: --- fix for view dolly not working with auto-depth zoom to mouse location when no depth was found. Modified Paths: -- trunk/blender/source/blender/editors/space_view3d/view3d_edit.c Modified: trunk/blender/source/blender/editors/space_view3d/view3d_edit.c === --- trunk/blender/source/blender/editors/space_view3d/view3d_edit.c 2011-05-14 09:42:02 UTC (rev 36685) +++ trunk/blender/source/blender/editors/space_view3d/view3d_edit.c 2011-05-14 10:35:11 UTC (rev 36686) @@ -391,8 +391,6 @@ } negate_v3(vod-dyn_ofs); copy_v3_v3(vod-ofs, rv3d-ofs); - } else { - vod-ofs[0] = vod-ofs[1] = vod-ofs[2] = 0.0f; } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36687] trunk/blender/source/blender/ editors/sculpt_paint/sculpt.c: Fix #27390: Shift for activating Smooth Brush broken in sculpt
Revision: 36687 http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=36687 Author: nazgul Date: 2011-05-14 12:32:15 + (Sat, 14 May 2011) Log Message: --- Fix #27390: Shift for activating Smooth Brush broken in sculpt Smooth brushes at requires face map which haven't used to be created for simple meshes (without modifiers). Use corrected need_fmap flag at stroke initialization, so face map is created properly for temporary smooth brushes and simple meshes. Modified Paths: -- trunk/blender/source/blender/editors/sculpt_paint/sculpt.c Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt.c === --- trunk/blender/source/blender/editors/sculpt_paint/sculpt.c 2011-05-14 10:35:11 UTC (rev 36686) +++ trunk/blender/source/blender/editors/sculpt_paint/sculpt.c 2011-05-14 12:32:15 UTC (rev 36687) @@ -3287,19 +3287,24 @@ sculpt_update_tex(sd, ss); } -static int sculpt_brush_stroke_init(bContext *C, ReportList *UNUSED(reports)) +static int sculpt_brush_stroke_init(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); Sculpt *sd = CTX_data_tool_settings(C)-sculpt; SculptSession *ss = CTX_data_active_object(C)-sculpt; Brush *brush = paint_brush(sd-paint); + int mode= RNA_enum_get(op-ptr, mode); + int is_smooth= 0; view3d_operator_needs_opengl(C); sculpt_brush_init_tex(sd, ss); - sculpt_update_mesh_elements(scene, sd, ob, brush-sculpt_tool == SCULPT_TOOL_SMOOTH); + is_smooth|= mode == BRUSH_STROKE_SMOOTH; + is_smooth|= brush-sculpt_tool == SCULPT_TOOL_SMOOTH; + sculpt_update_mesh_elements(scene, sd, ob, is_smooth); + return 1; } @@ -3514,7 +3519,7 @@ struct PaintStroke *stroke; int ignore_background_click; - if(!sculpt_brush_stroke_init(C, op-reports)) + if(!sculpt_brush_stroke_init(C, op)) return OPERATOR_CANCELLED; stroke = paint_stroke_new(C, sculpt_stroke_get_location, @@ -3543,7 +3548,7 @@ static int sculpt_brush_stroke_exec(bContext *C, wmOperator *op) { - if(!sculpt_brush_stroke_init(C, op-reports)) + if(!sculpt_brush_stroke_init(C, op)) return OPERATOR_CANCELLED; op-customdata = paint_stroke_new(C, sculpt_stroke_get_location, sculpt_stroke_test_start, ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36688] branches/cycles/intern/cycles/ kernel/svm/svm_closure.h: Cycles: fix chained mix/ add closures nodes not working.
Revision: 36688 http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=36688 Author: blendix Date: 2011-05-14 13:23:15 + (Sat, 14 May 2011) Log Message: --- Cycles: fix chained mix/add closures nodes not working. Modified Paths: -- branches/cycles/intern/cycles/kernel/svm/svm_closure.h Modified: branches/cycles/intern/cycles/kernel/svm/svm_closure.h === --- branches/cycles/intern/cycles/kernel/svm/svm_closure.h 2011-05-14 12:32:15 UTC (rev 36687) +++ branches/cycles/intern/cycles/kernel/svm/svm_closure.h 2011-05-14 13:23:15 UTC (rev 36688) @@ -183,10 +183,10 @@ offset from the current node, so we jump */ if(*randb weight) { *offset += node_jump; - *randb = (*randb - weight)/(1.0f - weight); + *randb = *randb/weight; } else - *randb = *randb/weight; + *randb = (*randb - weight)/(1.0f - weight); } __device void svm_node_add_closure(ShaderData *sd, float *stack, uint unused, @@ -199,10 +199,10 @@ of the two closures being added */ if(*randb weight) { *offset += node_jump; - *randb = (*randb - weight)/(1.0f - weight); + *randb = *randb/weight; } else - *randb = *randb/weight; + *randb = (*randb - weight)/(1.0f - weight); *closure_weight *= 2.0f; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36689] trunk/blender/source/blender/ editors/space_action/action_select.c: action editor was setting wrong rna type on Ctrl+RMB
Revision: 36689 http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=36689 Author: campbellbarton Date: 2011-05-14 15:44:56 + (Sat, 14 May 2011) Log Message: --- action editor was setting wrong rna type on Ctrl+RMB Modified Paths: -- trunk/blender/source/blender/editors/space_action/action_select.c Modified: trunk/blender/source/blender/editors/space_action/action_select.c === --- trunk/blender/source/blender/editors/space_action/action_select.c 2011-05-14 13:23:15 UTC (rev 36688) +++ trunk/blender/source/blender/editors/space_action/action_select.c 2011-05-14 15:44:56 UTC (rev 36689) @@ -858,9 +858,9 @@ /* determine which side of the current frame mouse is on */ UI_view2d_region_to_view(v2d, mval[0], mval[1], x, NULL); if (x CFRA) - RNA_int_set(op-ptr, mode, ACTKEYS_LRSEL_LEFT); + RNA_enum_set(op-ptr, mode, ACTKEYS_LRSEL_LEFT); else - RNA_int_set(op-ptr, mode, ACTKEYS_LRSEL_RIGHT); + RNA_enum_set(op-ptr, mode, ACTKEYS_LRSEL_RIGHT); } /* perform selection */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36690] trunk/blender: option to have the view controls apply to the camera view ( and camera object).
Revision: 36690 http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=36690 Author: campbellbarton Date: 2011-05-14 17:50:33 + (Sat, 14 May 2011) Log Message: --- option to have the view controls apply to the camera view (and camera object). - follow rotate/pan/zoom/dolly operators. - auto-depth preference works. - smooth view navigation supported. - view selected, all numpad operator work too. TODO - deal with camera transform locked axis - find a way to move/zoom the frame while the camera is locked (if it turns out to be a problem). Modified Paths: -- trunk/blender/release/scripts/startup/bl_ui/space_view3d.py trunk/blender/source/blender/editors/include/ED_view3d.h trunk/blender/source/blender/editors/space_view3d/view3d_edit.c trunk/blender/source/blender/editors/space_view3d/view3d_view.c trunk/blender/source/blender/makesdna/DNA_view3d_types.h trunk/blender/source/blender/makesrna/intern/rna_space.c Modified: trunk/blender/release/scripts/startup/bl_ui/space_view3d.py === --- trunk/blender/release/scripts/startup/bl_ui/space_view3d.py 2011-05-14 15:44:56 UTC (rev 36689) +++ trunk/blender/release/scripts/startup/bl_ui/space_view3d.py 2011-05-14 17:50:33 UTC (rev 36690) @@ -2024,6 +2024,9 @@ elif not view.lock_object: col.prop(view, lock_cursor, text=Lock to Cursor) +col = layout.column() +col.prop(view, lock_camera) + col = layout.column(align=True) col.label(text=Clip:) col.prop(view, clip_start, text=Start) Modified: trunk/blender/source/blender/editors/include/ED_view3d.h === --- trunk/blender/source/blender/editors/include/ED_view3d.h2011-05-14 15:44:56 UTC (rev 36689) +++ trunk/blender/source/blender/editors/include/ED_view3d.h2011-05-14 17:50:33 UTC (rev 36690) @@ -193,6 +193,9 @@ void ED_view3d_from_object(struct Object *ob, float ofs[3], float quat[4], float *dist, float *lens); void ED_view3d_to_object(struct Object *ob, const float ofs[3], const float quat[4], const float dist); +void ED_view3d_camera_lock_init(struct View3D *v3d, struct RegionView3D *rv3d); +void ED_view3d_camera_lock_sync(struct View3D *v3d, struct RegionView3D *rv3d); + int view3d_is_ortho(struct View3D *v3d, struct RegionView3D *rv3d); Modified: trunk/blender/source/blender/editors/space_view3d/view3d_edit.c === --- trunk/blender/source/blender/editors/space_view3d/view3d_edit.c 2011-05-14 15:44:56 UTC (rev 36689) +++ trunk/blender/source/blender/editors/space_view3d/view3d_edit.c 2011-05-14 17:50:33 UTC (rev 36690) @@ -56,6 +56,7 @@ #include BKE_paint.h #include BKE_report.h #include BKE_scene.h +#include BKE_depsgraph.h /* for ED_view3d_camera_lock_sync */ #include BIF_gl.h @@ -80,6 +81,22 @@ /* ** view3d_edit: view manipulations * */ +void ED_view3d_camera_lock_init(View3D *v3d, RegionView3D *rv3d) +{ + if(v3d-camera (v3d-flag2 V3D_LOCK_CAMERA) (rv3d-persp==RV3D_CAMOB)) { + ED_view3d_from_object(v3d-camera, rv3d-ofs, rv3d-viewquat, rv3d-dist, NULL); + } +} + +void ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d) +{ + if(v3d-camera (v3d-flag2 V3D_LOCK_CAMERA) (rv3d-persp==RV3D_CAMOB)) { + ED_view3d_to_object(v3d-camera, rv3d-ofs, rv3d-viewquat, rv3d-dist); + DAG_id_tag_update(v3d-camera-id, OB_RECALC_OB); + } +} + + /* * box view support * */ static void view3d_boxview_clip(ScrArea *sa) @@ -360,7 +377,7 @@ view3d_operator_needs_opengl(C); /* needed for zbuf drawing */ if((vod-use_dyn_ofs=view_autodist(CTX_data_scene(C), vod-ar, vod-v3d, event-mval, vod-dyn_ofs))) { - if (rv3d-persp==RV3D_PERSP) { + if (rv3d-persp==RV3D_PERSP || (rv3d-persp==RV3D_CAMOB (vod-v3d-flag2 V3D_LOCK_CAMERA))) { float my_origin[3]; /* original G.vd-ofs */ float my_pivot[3]; /* view */ float dvec[3]; @@ -710,6 +727,8 @@ /* avoid precision loss over time */ normalize_qt(rv3d-viewquat); + ED_view3d_camera_lock_sync(vod-v3d, rv3d); + ED_region_tag_redraw(vod-ar); } @@ -777,6 +796,8 @@ return OPERATOR_PASS_THROUGH; } + ED_view3d_camera_lock_init(vod-v3d, vod-rv3d); + /* switch from camera view when: */ if(rv3d-persp != RV3D_PERSP) { @@ -790,7 +811,7 @@ ED_view3d_from_object(vod-v3d-camera, rv3d-ofs, rv3d-viewquat, rv3d-dist, NULL); } -
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36691] trunk/blender/source/gameengine/ Ketsji: Remove files that were intended for shader branch.
Revision: 36691 http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=36691 Author: jesterking Date: 2011-05-14 18:54:56 + (Sat, 14 May 2011) Log Message: --- Remove files that were intended for shader branch. Removed Paths: - trunk/blender/source/gameengine/Ketsji/KX_PythonShaders.cpp trunk/blender/source/gameengine/Ketsji/KX_PythonShaders.h Deleted: trunk/blender/source/gameengine/Ketsji/KX_PythonShaders.cpp === --- trunk/blender/source/gameengine/Ketsji/KX_PythonShaders.cpp 2011-05-14 17:50:33 UTC (rev 36690) +++ trunk/blender/source/gameengine/Ketsji/KX_PythonShaders.cpp 2011-05-14 18:54:56 UTC (rev 36691) @@ -1,492 +0,0 @@ -/** - * $Id$ - * - * * BEGIN GPL LICENSE BLOCK * - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * * END GPL LICENSE BLOCK * - * Init bge.shaders - */ - -#ifndef DISABLE_PYTHON -#include KX_PythonInit.h -#include PyObjectPlus.h -#include KX_PythonSeq.h -#include KX_PythonShaders.h -#include KX_BlenderMaterial.h -#include BL_BlenderShader.h -#include DNA_material_types.h -#include BLI_listbase.h - -/** - * The Shader type - */ - -KX_PythonShader::KX_PythonShader() - : PyObjectPlus(), - m_vert(), - m_geom(), - m_frag(), - m_mat(NULL) -{ -} - -KX_PythonShader::KX_PythonShader(KX_BlenderMaterial *material) - : PyObjectPlus(), - m_mat(material) -{ - char vert[64000]=, geom[64000]=, frag[64000]=; - material-GetBlenderShader()-GetSources(vert, geom, frag); - - m_vert = vert; - m_geom = geom; - m_frag = frag; - - CustomUniform *cu = static_castCustomUniform*(material-GetBlenderMaterial()-csi.uniforms.first); - - while (cu) - { - m_uniforms.push_back(new KX_PythonUniform(cu)); - cu = cu-next; - } -} - -KX_PythonShader::~KX_PythonShader() -{ - // XXX This probably needs more attention... - m_uniforms.clear(); -} - -PyObject *KX_PythonShader::py_shader_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - KX_PythonShader* pyshader = new KX_PythonShader(); - return pyshader-GetProxy(); -} - -PyTypeObject KX_PythonShader::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - Shader, - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - PyObjectPlus::Type, - 0,0,0,0,0,0, - py_shader_new -}; - -PyMethodDef KX_PythonShader::Methods[] = { - KX_PYMETHODTABLE_O(KX_PythonShader, addUniform), - {NULL} //Sentinel -}; - -PyAttributeDef KX_PythonShader::Attributes[] = { - KX_PYATTRIBUTE_RW_FUNCTION(vertex, KX_PythonShader, pyattr_get_source, pyattr_set_source), - KX_PYATTRIBUTE_RW_FUNCTION(geometry, KX_PythonShader, pyattr_get_source, pyattr_set_source), - KX_PYATTRIBUTE_RW_FUNCTION(fragment, KX_PythonShader, pyattr_get_source, pyattr_set_source), - KX_PYATTRIBUTE_RO_FUNCTION(uniforms, KX_PythonShader, pyattr_get_uniforms), - {NULL} //Sentinel -}; - -PyObject* KX_PythonShader::pyattr_get_source(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_PythonShader *self = static_castKX_PythonShader*(self_v); - - if (!strcmp(attrdef-m_name, vertex)) - return PyUnicode_FromString(self-m_vert.Ptr()); - else if (!strcmp(attrdef-m_name, geometry)) - return PyUnicode_FromString(self-m_geom.Ptr()); - else if (!strcmp(attrdef-m_name, fragment)) - return PyUnicode_FromString(self-m_frag.Ptr()); - else - /* Should never happen */ - PyErr_SetString(PyExc_SystemError, invalid attribute, internal error); - - Py_RETURN_NONE; -} - -int KX_PythonShader::pyattr_set_source(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_PythonShader *self
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36692] trunk/blender/release/scripts/ startup/bl_ui/properties_data_mesh.py: Button for adding shape keys now creates shapes from base mesh instead o
Revision: 36692 http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=36692 Author: cessen Date: 2011-05-14 20:23:05 + (Sat, 14 May 2011) Log Message: --- Button for adding shape keys now creates shapes from base mesh instead of from the current shape mix. The old behavior is still accessable from the menu as New Shape From Mix. Checked with Sergey and Bassam that this is a good change. New users expect the add shape button to simply add a new blank shape, and get confused when that is not the case. It is also really easy to accidentally have other shape information in a new shape when the from mix behavior is default. Modified Paths: -- trunk/blender/release/scripts/startup/bl_ui/properties_data_mesh.py Modified: trunk/blender/release/scripts/startup/bl_ui/properties_data_mesh.py === --- trunk/blender/release/scripts/startup/bl_ui/properties_data_mesh.py 2011-05-14 18:54:56 UTC (rev 36691) +++ trunk/blender/release/scripts/startup/bl_ui/properties_data_mesh.py 2011-05-14 20:23:05 UTC (rev 36692) @@ -46,6 +46,8 @@ 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') +op = layout.operator(object.shape_key_add, icon='ZOOMIN', text=New Shape From Mix) +op.from_mix = True class MeshButtonsPanel(): @@ -193,7 +195,8 @@ col = row.column() sub = col.column(align=True) -sub.operator(object.shape_key_add, icon='ZOOMIN', text=) +op = sub.operator(object.shape_key_add, icon='ZOOMIN', text=) +op.from_mix = False sub.operator(object.shape_key_remove, icon='ZOOMOUT', text=) sub.menu(MESH_MT_shape_key_specials, icon='DOWNARROW_HLT', text=) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36693] trunk/blender/source/blender/ editors: fix for user reported issues
Revision: 36693 http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=36693 Author: campbellbarton Date: 2011-05-15 02:39:36 + (Sun, 15 May 2011) Log Message: --- fix for user reported issues - camera object movement was missing a notifier - auto perspective now works when rotating the view. - shift+b now zooms. Modified Paths: -- trunk/blender/source/blender/editors/include/ED_view3d.h trunk/blender/source/blender/editors/space_view3d/view3d_edit.c trunk/blender/source/blender/editors/space_view3d/view3d_view.c Modified: trunk/blender/source/blender/editors/include/ED_view3d.h === --- trunk/blender/source/blender/editors/include/ED_view3d.h2011-05-14 20:23:05 UTC (rev 36692) +++ trunk/blender/source/blender/editors/include/ED_view3d.h2011-05-15 02:39:36 UTC (rev 36693) @@ -193,7 +193,10 @@ void ED_view3d_from_object(struct Object *ob, float ofs[3], float quat[4], float *dist, float *lens); void ED_view3d_to_object(struct Object *ob, const float ofs[3], const float quat[4], const float dist); +/* camera lock functions */ +/* copy the camera to the view before starting a view transformation */ void ED_view3d_camera_lock_init(struct View3D *v3d, struct RegionView3D *rv3d); +/* copy the view to the camera */ void ED_view3d_camera_lock_sync(struct View3D *v3d, struct RegionView3D *rv3d); int view3d_is_ortho(struct View3D *v3d, struct RegionView3D *rv3d); Modified: trunk/blender/source/blender/editors/space_view3d/view3d_edit.c === --- trunk/blender/source/blender/editors/space_view3d/view3d_edit.c 2011-05-14 20:23:05 UTC (rev 36692) +++ trunk/blender/source/blender/editors/space_view3d/view3d_edit.c 2011-05-15 02:39:36 UTC (rev 36693) @@ -93,6 +93,7 @@ if(v3d-camera (v3d-flag2 V3D_LOCK_CAMERA) (rv3d-persp==RV3D_CAMOB)) { ED_view3d_to_object(v3d-camera, rv3d-ofs, rv3d-viewquat, rv3d-dist); DAG_id_tag_update(v3d-camera-id, OB_RECALC_OB); + WM_main_add_notifier(NC_OBJECT|ND_TRANSFORM, v3d-camera); } } @@ -802,7 +803,9 @@ if(rv3d-persp != RV3D_PERSP) { if (U.uiflag USER_AUTOPERSP) { - rv3d-persp= RV3D_PERSP; + if(!((rv3d-persp==RV3D_CAMOB) (vod-v3d-flag2 V3D_LOCK_CAMERA))) { + rv3d-persp= RV3D_PERSP; + } } else if(rv3d-persp==RV3D_CAMOB) { @@ -2103,10 +2106,11 @@ static int view3d_zoom_border_invoke(bContext *C, wmOperator *op, wmEvent *event) { + View3D *v3d= CTX_wm_view3d(C); RegionView3D *rv3d= CTX_wm_region_view3d(C); /* if in camera view do not exec the operator so we do not conflict with set render border*/ - if (rv3d-persp != RV3D_CAMOB) + if ((rv3d-persp != RV3D_CAMOB) || (v3d-flag2 V3D_LOCK_CAMERA)) return WM_border_select_invoke(C, op, event); else return OPERATOR_PASS_THROUGH; Modified: trunk/blender/source/blender/editors/space_view3d/view3d_view.c === --- trunk/blender/source/blender/editors/space_view3d/view3d_view.c 2011-05-14 20:23:05 UTC (rev 36692) +++ trunk/blender/source/blender/editors/space_view3d/view3d_view.c 2011-05-15 02:39:36 UTC (rev 36693) @@ -308,6 +308,8 @@ copy_qt_qt(rv3d-viewquat, sms-new_quat); rv3d-dist = sms-new_dist; v3d-lens = sms-new_lens; + + ED_view3d_camera_lock_sync(v3d, rv3d); } if((rv3d-viewlock RV3D_LOCKED)==0) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36694] trunk/blender/source/blender/ editors/space_view3d/view3d_edit.c: fix for bug with camera locking, view dolly and rotate with 'about selection
Revision: 36694 http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=36694 Author: campbellbarton Date: 2011-05-15 03:07:07 + (Sun, 15 May 2011) Log Message: --- fix for bug with camera locking, view dolly and rotate with 'about selection' preference enabled would offset the camera. Modified Paths: -- trunk/blender/source/blender/editors/space_view3d/view3d_edit.c Modified: trunk/blender/source/blender/editors/space_view3d/view3d_edit.c === --- trunk/blender/source/blender/editors/space_view3d/view3d_edit.c 2011-05-15 02:39:36 UTC (rev 36693) +++ trunk/blender/source/blender/editors/space_view3d/view3d_edit.c 2011-05-15 03:07:07 UTC (rev 36694) @@ -360,6 +360,11 @@ vod-ar= CTX_wm_region(C); vod-v3d= vod-sa-spacedata.first; vod-rv3d= rv3d= vod-ar-regiondata; + + /* set the view from the camera, if view locking is enabled. +* we may want to make this optional but for now its needed always */ + ED_view3d_camera_lock_init(vod-v3d, vod-rv3d); + vod-dist0= rv3d-dist; copy_qt_qt(vod-oldquat, rv3d-viewquat); vod-origx= vod-oldx= event-x; @@ -797,8 +802,6 @@ return OPERATOR_PASS_THROUGH; } - ED_view3d_camera_lock_init(vod-v3d, vod-rv3d); - /* switch from camera view when: */ if(rv3d-persp != RV3D_PERSP) { @@ -993,11 +996,8 @@ /* makes op-customdata */ viewops_data_create(C, op, event); - vod= op-customdata; - ED_view3d_camera_lock_init(vod-v3d, vod-rv3d); - if (event-type == MOUSEPAN) { viewmove_apply(vod, event-prevx, event-prevy); request_depth_update(vod-rv3d); @@ -1308,8 +1308,6 @@ viewops_data_create(C, op, event); vod= op-customdata; - ED_view3d_camera_lock_init(vod-v3d, vod-rv3d); - /* if one or the other zoom position aren't set, set from event */ if (!RNA_property_is_set(op-ptr, mx) || !RNA_property_is_set(op-ptr, my)) { @@ -1515,11 +1513,8 @@ /* makes op-customdata */ viewops_data_create(C, op, event); - vod= op-customdata; - ED_view3d_camera_lock_init(vod-v3d, vod-rv3d); - /* if one or the other zoom position aren't set, set from event */ if (!RNA_property_is_set(op-ptr, mx) || !RNA_property_is_set(op-ptr, my)) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36695] trunk/blender/source/blender: remove some unused view3d members added RV3D_VIEW_USER define.
Revision: 36695 http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=36695 Author: campbellbarton Date: 2011-05-15 03:42:28 + (Sun, 15 May 2011) Log Message: --- remove some unused view3d members added RV3D_VIEW_USER define. Aligorith: replaced v3d-keyflags with ANIMFILTER_KEYS_LOCAL since v3d-keyflags couldn't be set anywhere and wasn't initialized. Modified Paths: -- trunk/blender/source/blender/editors/space_view3d/view3d_draw.c trunk/blender/source/blender/editors/space_view3d/view3d_edit.c trunk/blender/source/blender/editors/space_view3d/view3d_header.c trunk/blender/source/blender/editors/space_view3d/view3d_view.c trunk/blender/source/blender/makesdna/DNA_view3d_types.h Modified: trunk/blender/source/blender/editors/space_view3d/view3d_draw.c === --- trunk/blender/source/blender/editors/space_view3d/view3d_draw.c 2011-05-15 03:07:07 UTC (rev 36694) +++ trunk/blender/source/blender/editors/space_view3d/view3d_draw.c 2011-05-15 03:42:28 UTC (rev 36695) @@ -763,7 +763,7 @@ /* draw info beside axes in bottom left-corner: * framenum, object name, bone name (if available), marker name (if available) */ -static void draw_selected_name(Scene *scene, Object *ob, View3D *v3d) +static void draw_selected_name(Scene *scene, Object *ob) { char info[256], *markern; short offset=30; @@ -832,7 +832,7 @@ } /* color depends on whether there is a keyframe */ - if (id_frame_has_keyframe((ID *)ob, /*BKE_curframe(scene)*/(float)(CFRA), v3d-keyflags)) + if (id_frame_has_keyframe((ID *)ob, /*BKE_curframe(scene)*/(float)(CFRA), ANIMFILTER_KEYS_LOCAL)) UI_ThemeColor(TH_VERTEX_SELECT); else UI_ThemeColor(TH_TEXT_HI); @@ -2469,7 +2469,7 @@ // needs to be done always, gridview is adjusted in drawgrid() now rv3d-gridview= v3d-grid; - if(rv3d-view==0 || rv3d-persp != RV3D_ORTHO) { + if((rv3d-view == RV3D_VIEW_USER) || (rv3d-persp != RV3D_ORTHO)) { if ((v3d-flag2 V3D_RENDER_OVERRIDE)==0) { drawfloor(scene, v3d, grid_unit); } @@ -2641,7 +2641,7 @@ ob= OBACT; if(U.uiflag USER_DRAWVIEWINFO) - draw_selected_name(scene, ob, v3d); + draw_selected_name(scene, ob); /* XXX here was the blockhandlers for floating panels */ Modified: trunk/blender/source/blender/editors/space_view3d/view3d_edit.c === --- trunk/blender/source/blender/editors/space_view3d/view3d_edit.c 2011-05-15 03:07:07 UTC (rev 36694) +++ trunk/blender/source/blender/editors/space_view3d/view3d_edit.c 2011-05-15 03:42:28 UTC (rev 36695) @@ -568,7 +568,7 @@ { RegionView3D *rv3d= vod-rv3d; - rv3d-view= 0; /* need to reset everytime because of view snapping */ + rv3d-view= RV3D_VIEW_USER; /* need to reset everytime because of view snapping */ if (U.flag USER_TRACKBALL) { float phi, si, q1[4], dvec[3], newvec[3]; @@ -2218,7 +2218,7 @@ invert_qt(obact_quat); mul_qt_qtqt(new_quat, new_quat, obact_quat); - rv3d-view= view= 0; + rv3d-view= view= RV3D_VIEW_USER; } } @@ -2430,7 +2430,7 @@ q1[1]= q1[2]= 0.0; q1[3]= si; mul_qt_qtqt(new_quat, rv3d-viewquat, q1); - rv3d-view= 0; + rv3d-view= RV3D_VIEW_USER; } else if(orbitdir == V3D_VIEW_STEPDOWN || orbitdir == V3D_VIEW_STEPUP) { /* horizontal axis */ @@ -2442,7 +2442,7 @@ q1[0]= (float)cos(phi); mul_v3_fl(q1+1, sin(phi)); mul_qt_qtqt(new_quat, rv3d-viewquat, q1); - rv3d-view= 0; + rv3d-view= RV3D_VIEW_USER; } smooth_view(C, CTX_wm_view3d(C), ar, NULL, NULL, NULL, new_quat, NULL, NULL); Modified: trunk/blender/source/blender/editors/space_view3d/view3d_header.c === --- trunk/blender/source/blender/editors/space_view3d/view3d_header.c 2011-05-15 03:07:07 UTC (rev 36694) +++ trunk/blender/source/blender/editors/space_view3d/view3d_header.c 2011-05-15 03:42:28 UTC (rev 36695) @@ -522,9 +522,9 @@ block= uiLayoutGetBlock(row); if(v3d-twflag V3D_USE_MANIPULATOR) { -
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36696] trunk/blender/source/blender: camera composition guides:
Revision: 36696 http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=36696 Author: campbellbarton Date: 2011-05-15 05:43:59 + (Sun, 15 May 2011) Log Message: --- camera composition guides: removed diagonal golden rule (not very common), added harmonious triangle and golden triangle options. Modified Paths: -- trunk/blender/source/blender/editors/space_view3d/view3d_draw.c trunk/blender/source/blender/makesdna/DNA_camera_types.h trunk/blender/source/blender/makesrna/intern/rna_camera.c Modified: trunk/blender/source/blender/editors/space_view3d/view3d_draw.c === --- trunk/blender/source/blender/editors/space_view3d/view3d_draw.c 2011-05-15 03:42:28 UTC (rev 36695) +++ trunk/blender/source/blender/editors/space_view3d/view3d_draw.c 2011-05-15 05:43:59 UTC (rev 36696) @@ -921,7 +921,7 @@ } } -static void drawviewborder_grid3(float x1, float x2, float y1, float y2, float fac, char diagonal) +static void drawviewborder_grid3(float x1, float x2, float y1, float y2, float fac) { float x3, y3, x4, y4; @@ -931,46 +931,63 @@ y4= y1 + (1.0f - fac) * (y2-y1); glBegin(GL_LINES); - switch(diagonal) { - case '\0': - glVertex2f(x1, y3); - glVertex2f(x2, y3); + glVertex2f(x1, y3); + glVertex2f(x2, y3); - glVertex2f(x1, y4); - glVertex2f(x2, y4); + glVertex2f(x1, y4); + glVertex2f(x2, y4); - glVertex2f(x3, y1); - glVertex2f(x3, y2); + glVertex2f(x3, y1); + glVertex2f(x3, y2); - glVertex2f(x4, y1); - glVertex2f(x4, y2); - break; - case 'H': /* hoz */ + glVertex2f(x4, y1); + glVertex2f(x4, y2); + glEnd(); +} + +/* harmonious triangle */ +static void drawviewborder_triangle(float x1, float x2, float y1, float y2, const char golden, const char dir) +{ + float ofs; + float w= x2 - x1; + float h= y2 - y1; + + glBegin(GL_LINES); + if(w h) { + if(golden) { + ofs = w * (1.0f-(1.0f/1.61803399)); + } + else { + ofs = h * (h / w); + } + if(dir == 'B') SWAP(float, y1, y2); + glVertex2f(x1, y1); - glVertex2f(x2, y4); - - glVertex2f(x1, y3); glVertex2f(x2, y2); glVertex2f(x2, y1); - glVertex2f(x1, y4); + glVertex2f(x1 + (w - ofs), y2); - glVertex2f(x2, y3); glVertex2f(x1, y2); - break; - case 'V': /* vert */ + glVertex2f(x1 + ofs, y1); + } + else { + if(golden) { + ofs = h * (1.0f-(1.0f/1.61803399)); + } + else { + ofs = w * (w / h); + } + if(dir == 'B') SWAP(float, x1, x2); + glVertex2f(x1, y1); - glVertex2f(x4, y2); - - glVertex2f(x3, y1); glVertex2f(x2, y2); + glVertex2f(x2, y1); + glVertex2f(x1, y1 + ofs); + glVertex2f(x1, y2); - glVertex2f(x4, y1); - - glVertex2f(x3, y2); - glVertex2f(x2, y1); - break; + glVertex2f(x2, y1 + (h - ofs)); } glEnd(); } @@ -1083,24 +1100,34 @@ if (ca-dtx CAM_DTX_THIRDS) { UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0); - drawviewborder_grid3(x1, x2, y1, y2, 1.0f/3.0f, '\0'); + drawviewborder_grid3(x1, x2, y1, y2, 1.0f/3.0f); } if (ca-dtx CAM_DTX_GOLDEN) { UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0); - drawviewborder_grid3(x1, x2, y1, y2, 1.0f-(1.0f/1.61803399), '\0'); + drawviewborder_grid3(x1, x2, y1, y2, 1.0f-(1.0f/1.61803399)); } - if (ca-dtx CAM_DTX_GOLDEN_DIAG_H) { + if (ca-dtx CAM_DTX_GOLDEN_TRI_A) { UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0); - drawviewborder_grid3(x1, x2, y1, y2, 1.0f-(1.0f/1.61803399), 'H'); + drawviewborder_triangle(x1, x2, y1, y2, 0, 'A'); } - if (ca-dtx CAM_DTX_GOLDEN_DIAG_V) { + if (ca-dtx CAM_DTX_GOLDEN_TRI_B) { UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0); - drawviewborder_grid3(x1, x2, y1, y2, 1.0f-(1.0f/1.61803399), 'V'); + drawviewborder_triangle(x1, x2, y1, y2, 0, 'B'); } + if