[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40208] branches/soc-2011-onion-uv-tools: manually add some missing files

Antony Riakiotakis kalast at gmail.com
Wed Sep 14 22:47:20 CEST 2011


Revision: 40208
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40208
Author:   psy-fi
Date:     2011-09-14 20:47:20 +0000 (Wed, 14 Sep 2011)
Log Message:
-----------
manually add some missing files

Added Paths:
-----------
    branches/soc-2011-onion-uv-tools/build_files/cmake/Modules/FindOpenCOLLADA.cmake
    branches/soc-2011-onion-uv-tools/doc/python_api/rst/info_gotcha.rst
    branches/soc-2011-onion-uv-tools/doc/python_api/rst/info_overview.rst
    branches/soc-2011-onion-uv-tools/doc/python_api/rst/info_quickstart.rst
    branches/soc-2011-onion-uv-tools/source/blender/imbuf/intern/IMB_indexer.h
    branches/soc-2011-onion-uv-tools/source/blender/imbuf/intern/indexer.c
    branches/soc-2011-onion-uv-tools/source/blender/imbuf/intern/indexer_dv.c

Added: branches/soc-2011-onion-uv-tools/build_files/cmake/Modules/FindOpenCOLLADA.cmake
===================================================================
--- branches/soc-2011-onion-uv-tools/build_files/cmake/Modules/FindOpenCOLLADA.cmake	                        (rev 0)
+++ branches/soc-2011-onion-uv-tools/build_files/cmake/Modules/FindOpenCOLLADA.cmake	2011-09-14 20:47:20 UTC (rev 40208)
@@ -0,0 +1,118 @@
+# - Find OpenCOLLADA library
+# Find the native OpenCOLLADA includes and library
+# This module defines
+#  OPENCOLLADA_INCLUDE_DIRS, where to find COLLADABaseUtils/ and 
+#                 COLLADAFramework/, Set when OPENCOLLADA_INCLUDE_DIR is found.
+#  OPENCOLLADA_LIBRARIES, libraries to link against to use OpenCOLLADA.
+#  OPENCOLLADA_ROOT_DIR, The base directory to search for OpenCOLLADA.
+#                    This can also be an environment variable.
+#  OPENCOLLADA_FOUND, If false, do not try to use OpenCOLLADA.
+#
+# also defined, but not for general use are
+#  OPENCOLLADA_LIBRARY, where to find the OpenCOLLADA library.
+
+#=============================================================================
+# Copyright 2011 Blender Foundation.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+# note about include paths, there are 2 ways includes are set
+#
+# Where '/usr/include/opencollada' is the root dir:
+#   /usr/include/opencollada/COLLADABaseUtils/COLLADABUPlatform.h
+#
+# Where '/opt/opencollada' is the base dir:
+# /opt/opencollada/COLLADABaseUtils/include/COLLADABUPlatform.h
+
+# If OPENCOLLADA_ROOT_DIR was defined in the environment, use it.
+IF(NOT OPENCOLLADA_ROOT_DIR AND NOT $ENV{OPENCOLLADA_ROOT_DIR} STREQUAL "")
+  SET(OPENCOLLADA_ROOT_DIR $ENV{OPENCOLLADA_ROOT_DIR})
+ENDIF()
+
+SET(_opencollada_FIND_INCLUDES
+  COLLADAStreamWriter
+  COLLADABaseUtils
+  COLLADAFramework
+  COLLADASaxFrameworkLoader
+  GeneratedSaxParser
+)
+
+SET(_opencollada_FIND_COMPONENTS
+  OpenCOLLADAStreamWriter
+  OpenCOLLADASaxFrameworkLoader
+  OpenCOLLADAFramework
+  OpenCOLLADABaseUtils
+  GeneratedSaxParser
+  UTF
+  MathMLSolver
+  pcre
+  ftoa
+  buffer
+  xml2
+)
+
+SET(_opencollada_SEARCH_DIRS
+  ${OPENCOLLADA_ROOT_DIR}
+  /usr/local
+  /sw # Fink
+  /opt/local # DarwinPorts
+  /opt/csw # Blastwave
+)
+
+SET(_opencollada_INCLUDES)
+FOREACH(COMPONENT ${_opencollada_FIND_INCLUDES})
+  STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
+
+  # need to use this even thouh we are looking for a dir
+  FIND_FILE(OPENCOLLADA_${UPPERCOMPONENT}_INCLUDE_DIR
+    NAMES
+      ${COMPONENT}/include
+      ${COMPONENT}
+      # Ubuntu ppa needs this.
+      # Alternative would be to suffix all members of search path
+      # but this is less trouble, just looks strange.
+      include/opencollada/${COMPONENT}
+    HINTS
+      ${_opencollada_SEARCH_DIRS}
+    )
+  MARK_AS_ADVANCED(OPENCOLLADA_${UPPERCOMPONENT}_INCLUDE_DIR)
+  LIST(APPEND _opencollada_INCLUDES "${OPENCOLLADA_${UPPERCOMPONENT}_INCLUDE_DIR}")
+ENDFOREACH()
+
+
+SET(_opencollada_LIBRARIES)
+FOREACH(COMPONENT ${_opencollada_FIND_COMPONENTS})
+  STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
+
+  FIND_LIBRARY(OPENCOLLADA_${UPPERCOMPONENT}_LIBRARY
+    NAMES
+      ${COMPONENT}
+    HINTS
+      ${_opencollada_SEARCH_DIRS}
+    PATH_SUFFIXES
+      lib64 lib
+      # Ubuntu ppa needs this.
+      lib64/opencollada lib/opencollada
+    )
+  MARK_AS_ADVANCED(OPENCOLLADA_${UPPERCOMPONENT}_LIBRARY)
+  LIST(APPEND _opencollada_LIBRARIES "${OPENCOLLADA_${UPPERCOMPONENT}_LIBRARY}")
+ENDFOREACH()
+
+
+# handle the QUIETLY and REQUIRED arguments and set OPENCOLLADA_FOUND to TRUE if 
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenCOLLADA  DEFAULT_MSG
+    _opencollada_LIBRARIES _opencollada_INCLUDES)
+
+
+IF(OPENCOLLADA_FOUND)
+  SET(OPENCOLLADA_LIBRARIES ${_opencollada_LIBRARIES})
+  SET(OPENCOLLADA_INCLUDE_DIRS ${_opencollada_INCLUDES})
+ENDIF(OPENCOLLADA_FOUND)

Added: branches/soc-2011-onion-uv-tools/doc/python_api/rst/info_gotcha.rst
===================================================================
--- branches/soc-2011-onion-uv-tools/doc/python_api/rst/info_gotcha.rst	                        (rev 0)
+++ branches/soc-2011-onion-uv-tools/doc/python_api/rst/info_gotcha.rst	2011-09-14 20:47:20 UTC (rev 40208)
@@ -0,0 +1,405 @@
+********
+Gotcha's
+********
+
+This document attempts to help you work with the Blender API in areas that can be troublesome and avoid practices that are known to give instability.
+
+
+Using Operators
+===============
+
+Blender's operators are tools for users to access, that python can access them too is very useful nevertheless operators have limitations that can make them cumbersome to script.
+
+Main limits are...
+
+* Can't pass data such as objects, meshes or materials to operate on (operators use the context instead)
+
+* The return value from calling an operator gives the success (if it finished or was canceled),
+  in some cases it would be more logical from an API perspective to return the result of the operation.
+
+* Operators poll function can fail where an API function would raise an exception giving details on exactly why.
+
+
+Why does an operator's poll fail?
+---------------------------------
+
+When calling an operator gives an error like this:
+
+   >>> bpy.ops.action.clean(threshold=0.001)
+   RuntimeError: Operator bpy.ops.action.clean.poll() failed, context is incorrect
+
+Which raises the question as to what the correct context might be?
+
+Typically operators check for the active area type, a selection or active object they can operate on, but some operators are more picky about when they run.
+
+In most cases you can figure out what context an operator needs simply be seeing how its used in Blender and thinking about what it does.
+
+
+Unfortunately if you're still stuck - the only way to **really** know whats going on is to read the source code for the poll function and see what its checking.
+
+For python operators its not so hard to find the source since its included with with Blender and the source file/line is included in the operator reference docs.
+
+Downloading and searching the C code isn't so simple, especially if you're not familiar with the C language but by searching the operator name or description you should be able to find the poll function with no knowledge of C.
+
+.. note::
+
+   Blender does have the functionality for poll functions to describe why they fail, but its currently not used much, if you're interested to help improve our API feel free to add calls to ``CTX_wm_operator_poll_msg_set`` where its not obvious why poll fails.
+
+      >>> bpy.ops.gpencil.draw()
+      RuntimeError: Operator bpy.ops.gpencil.draw.poll() Failed to find Grease Pencil data to draw into
+
+
+The operator still doesn't work!
+--------------------------------
+
+Certain operators in Blender are only intended for use in a specific context, some operators for example are only called from the properties window where they check the current material, modifier or constraint.
+
+Examples of this are:
+
+* :mod:`bpy.ops.texture.slot_move`
+* :mod:`bpy.ops.constraint.limitdistance_reset`
+* :mod:`bpy.ops.object.modifier_copy`
+* :mod:`bpy.ops.buttons.file_browse`
+
+Another possibility is that you are the first person to attempt to use this operator in a script and some modifications need to be made to the operator to run in a different context, if the operator should logically be able to run but fails when accessed from a script it should be reported to the bug tracker.
+
+
+Stale Data
+==========
+
+No updates after setting values
+-------------------------------
+
+Sometimes you want to modify values from python and immediately access the updated values, eg:
+
+Once changing the objects :class:`bpy.types.Object.location` you may want to access its transformation right after from :class:`bpy.types.Object.matrix_world`, but this doesn't work as you might expect.
+
+Consider the calculations that might go into working out the objects final transformation, this includes:
+
+* animation function curves.
+* drivers and their pythons expressions.
+* constraints
+* parent objects and all of their f-curves, constraints etc.
+
+To avoid expensive recalculations every time a property is modified, Blender defers making the actual calculations until they are needed.
+
+However, while the script runs you may want to access the updated values.
+
+This can be done by calling :class:`bpy.types.Scene.update` after modifying values which recalculates all data that is tagged to be updated.
+
+
+Can I redraw during the script?
+-------------------------------
+
+The official answer to this is no, or... *"You don't want to do that"*.
+
+To give some background on the topic...
+
+While a script executes Blender waits for it to finish and is effectively locked until its done, while in this state Blender won't redraw or respond to user input.
+Normally this is not such a problem because scripts distributed with Blender tend not to run for an extended period of time, nevertheless scripts *can* take ages to execute and its nice to see whats going on in the view port.
+
+Tools that lock Blender in a loop and redraw are highly discouraged since they conflict with Blenders ability to run multiple operators at once and update different parts of the interface as the tool runs.
+
+So the solution here is to write a **modal** operator, that is - an operator which defines a modal() function, See the modal operator template in the text  editor.
+
+Modal operators execute on user input or setup their own timers to run frequently, they can handle the events or pass through to be handled by the keymap or other modal operators.
+
+Transform, Painting, Fly-Mode and File-Select are example of a modal operators.
+
+Writing modal operators takes more effort then a simple ``for`` loop that happens to redraw but is more flexible and integrates better with Blenders design.
+
+
+**Ok, Ok! I still want to draw from python**
+

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list