[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36483] branches/particles-2010: - Cleanup of node tree execution functions.

Lukas Toenne lukas.toenne at googlemail.com
Wed May 4 14:31:02 CEST 2011


Revision: 36483
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36483
Author:   lukastoenne
Date:     2011-05-04 12:31:01 +0000 (Wed, 04 May 2011)
Log Message:
-----------
- Cleanup of node tree execution functions. There is no generic node tree execution any more now, only specific functions for each tree type API. The tree types don't need execution functions either.
- Fixed svn merge problems with script files.
- Reactivated group nodes for material and texture trees. Texture node groups still have a memory bug with internal texture delegates.

Modified Paths:
--------------
    branches/particles-2010/source/blender/nodes/intern/node_exec.c

Added Paths:
-----------
    branches/particles-2010/release/scripts/modules/
    branches/particles-2010/release/scripts/modules/add_object_utils.py
    branches/particles-2010/release/scripts/modules/addon_utils.py
    branches/particles-2010/release/scripts/modules/animsys_refactor.py
    branches/particles-2010/release/scripts/modules/blend_render_info.py
    branches/particles-2010/release/scripts/modules/bpy/
    branches/particles-2010/release/scripts/modules/bpy/__init__.py
    branches/particles-2010/release/scripts/modules/bpy/ops.py
    branches/particles-2010/release/scripts/modules/bpy/path.py
    branches/particles-2010/release/scripts/modules/bpy/utils.py
    branches/particles-2010/release/scripts/modules/bpy_types.py
    branches/particles-2010/release/scripts/modules/bpyml.py
    branches/particles-2010/release/scripts/modules/bpyml_ui.py
    branches/particles-2010/release/scripts/modules/console/
    branches/particles-2010/release/scripts/modules/console/__init__.py
    branches/particles-2010/release/scripts/modules/console/complete_calltip.py
    branches/particles-2010/release/scripts/modules/console/complete_import.py
    branches/particles-2010/release/scripts/modules/console/complete_namespace.py
    branches/particles-2010/release/scripts/modules/console/intellisense.py
    branches/particles-2010/release/scripts/modules/console_python.py
    branches/particles-2010/release/scripts/modules/console_shell.py
    branches/particles-2010/release/scripts/modules/graphviz_export.py
    branches/particles-2010/release/scripts/modules/image_utils.py
    branches/particles-2010/release/scripts/modules/io_utils.py
    branches/particles-2010/release/scripts/modules/keyingsets_utils.py
    branches/particles-2010/release/scripts/modules/mesh_utils.py
    branches/particles-2010/release/scripts/modules/rna_info.py
    branches/particles-2010/release/scripts/modules/rna_prop_ui.py
    branches/particles-2010/release/scripts/modules/sys_info.py
    branches/particles-2010/release/scripts/presets/
    branches/particles-2010/release/scripts/presets/cloth/
    branches/particles-2010/release/scripts/presets/cloth/cotton.py
    branches/particles-2010/release/scripts/presets/cloth/denim.py
    branches/particles-2010/release/scripts/presets/cloth/leather.py
    branches/particles-2010/release/scripts/presets/cloth/rubber.py
    branches/particles-2010/release/scripts/presets/cloth/silk.py
    branches/particles-2010/release/scripts/presets/ffmpeg/
    branches/particles-2010/release/scripts/presets/ffmpeg/DV.py
    branches/particles-2010/release/scripts/presets/ffmpeg/DVD.py
    branches/particles-2010/release/scripts/presets/ffmpeg/SVCD.py
    branches/particles-2010/release/scripts/presets/ffmpeg/VCD.py
    branches/particles-2010/release/scripts/presets/ffmpeg/h264.py
    branches/particles-2010/release/scripts/presets/ffmpeg/theora.py
    branches/particles-2010/release/scripts/presets/ffmpeg/xvid.py
    branches/particles-2010/release/scripts/presets/framerate/
    branches/particles-2010/release/scripts/presets/framerate/23.98.py
    branches/particles-2010/release/scripts/presets/framerate/24.py
    branches/particles-2010/release/scripts/presets/framerate/25.py
    branches/particles-2010/release/scripts/presets/framerate/29.97.py
    branches/particles-2010/release/scripts/presets/framerate/30.py
    branches/particles-2010/release/scripts/presets/framerate/50.py
    branches/particles-2010/release/scripts/presets/framerate/59.94.py
    branches/particles-2010/release/scripts/presets/framerate/60.py
    branches/particles-2010/release/scripts/presets/framerate/Custom.py
    branches/particles-2010/release/scripts/presets/interaction/
    branches/particles-2010/release/scripts/presets/interaction/blender.py
    branches/particles-2010/release/scripts/presets/interaction/maya.py
    branches/particles-2010/release/scripts/presets/keyconfig/
    branches/particles-2010/release/scripts/presets/keyconfig/maya.py
    branches/particles-2010/release/scripts/presets/render/
    branches/particles-2010/release/scripts/presets/render/DVCPRO_HD_1080p.py
    branches/particles-2010/release/scripts/presets/render/DVCPRO_HD_720p.py
    branches/particles-2010/release/scripts/presets/render/HDTV_1080p.py
    branches/particles-2010/release/scripts/presets/render/HDTV_720p.py
    branches/particles-2010/release/scripts/presets/render/HDV_1080p.py
    branches/particles-2010/release/scripts/presets/render/HDV_NTSC_1080p.py
    branches/particles-2010/release/scripts/presets/render/HDV_PAL_1080p.py
    branches/particles-2010/release/scripts/presets/render/TV_NTSC_16_colon_9.py
    branches/particles-2010/release/scripts/presets/render/TV_NTSC_4_colon_3.py
    branches/particles-2010/release/scripts/presets/render/TV_PAL_16_colon_9.py
    branches/particles-2010/release/scripts/presets/render/TV_PAL_4_colon_3.py
    branches/particles-2010/release/scripts/presets/sss/
    branches/particles-2010/release/scripts/presets/sss/apple.py
    branches/particles-2010/release/scripts/presets/sss/chicken.py
    branches/particles-2010/release/scripts/presets/sss/cream.py
    branches/particles-2010/release/scripts/presets/sss/ketchup.py
    branches/particles-2010/release/scripts/presets/sss/marble.py
    branches/particles-2010/release/scripts/presets/sss/potato.py
    branches/particles-2010/release/scripts/presets/sss/skim_milk.py
    branches/particles-2010/release/scripts/presets/sss/skin1.py
    branches/particles-2010/release/scripts/presets/sss/skin2.py
    branches/particles-2010/release/scripts/presets/sss/whole_milk.py
    branches/particles-2010/release/scripts/presets/sunsky/
    branches/particles-2010/release/scripts/presets/sunsky/classic.py
    branches/particles-2010/release/scripts/presets/sunsky/desert.py
    branches/particles-2010/release/scripts/presets/sunsky/mountain.py
    branches/particles-2010/release/scripts/startup/
    branches/particles-2010/release/scripts/startup/bl_operators/
    branches/particles-2010/release/scripts/startup/bl_operators/__init__.py
    branches/particles-2010/release/scripts/startup/bl_operators/add_mesh_torus.py
    branches/particles-2010/release/scripts/startup/bl_operators/animsys_update.py
    branches/particles-2010/release/scripts/startup/bl_operators/image.py
    branches/particles-2010/release/scripts/startup/bl_operators/mesh.py
    branches/particles-2010/release/scripts/startup/bl_operators/nla.py
    branches/particles-2010/release/scripts/startup/bl_operators/object.py
    branches/particles-2010/release/scripts/startup/bl_operators/object_align.py
    branches/particles-2010/release/scripts/startup/bl_operators/object_quick_effects.py
    branches/particles-2010/release/scripts/startup/bl_operators/object_randomize_transform.py
    branches/particles-2010/release/scripts/startup/bl_operators/presets.py
    branches/particles-2010/release/scripts/startup/bl_operators/screen_play_rendered_anim.py
    branches/particles-2010/release/scripts/startup/bl_operators/sequencer.py
    branches/particles-2010/release/scripts/startup/bl_operators/uvcalc_follow_active.py
    branches/particles-2010/release/scripts/startup/bl_operators/uvcalc_lightmap.py
    branches/particles-2010/release/scripts/startup/bl_operators/uvcalc_smart_project.py
    branches/particles-2010/release/scripts/startup/bl_operators/vertexpaint_dirt.py
    branches/particles-2010/release/scripts/startup/bl_operators/wm.py
    branches/particles-2010/release/scripts/startup/bl_ui/
    branches/particles-2010/release/scripts/startup/bl_ui/__init__.py
    branches/particles-2010/release/scripts/startup/bl_ui/properties_animviz.py
    branches/particles-2010/release/scripts/startup/bl_ui/properties_data_armature.py
    branches/particles-2010/release/scripts/startup/bl_ui/properties_data_bone.py
    branches/particles-2010/release/scripts/startup/bl_ui/properties_data_camera.py
    branches/particles-2010/release/scripts/startup/bl_ui/properties_data_curve.py
    branches/particles-2010/release/scripts/startup/bl_ui/properties_data_empty.py
    branches/particles-2010/release/scripts/startup/bl_ui/properties_data_lamp.py
    branches/particles-2010/release/scripts/startup/bl_ui/properties_data_lattice.py
    branches/particles-2010/release/scripts/startup/bl_ui/properties_data_mesh.py
    branches/particles-2010/release/scripts/startup/bl_ui/properties_data_metaball.py
    branches/particles-2010/release/scripts/startup/bl_ui/properties_data_modifier.py
    branches/particles-2010/release/scripts/startup/bl_ui/properties_game.py
    branches/particles-2010/release/scripts/startup/bl_ui/properties_material.py
    branches/particles-2010/release/scripts/startup/bl_ui/properties_object.py
    branches/particles-2010/release/scripts/startup/bl_ui/properties_object_constraint.py
    branches/particles-2010/release/scripts/startup/bl_ui/properties_particle.py
    branches/particles-2010/release/scripts/startup/bl_ui/properties_physics_cloth.py
    branches/particles-2010/release/scripts/startup/bl_ui/properties_physics_common.py
    branches/particles-2010/release/scripts/startup/bl_ui/properties_physics_field.py
    branches/particles-2010/release/scripts/startup/bl_ui/properties_physics_fluid.py
    branches/particles-2010/release/scripts/startup/bl_ui/properties_physics_smoke.py
    branches/particles-2010/release/scripts/startup/bl_ui/properties_physics_softbody.py
    branches/particles-2010/release/scripts/startup/bl_ui/properties_render.py
    branches/particles-2010/release/scripts/startup/bl_ui/properties_scene.py
    branches/particles-2010/release/scripts/startup/bl_ui/properties_texture.py
    branches/particles-2010/release/scripts/startup/bl_ui/properties_world.py
    branches/particles-2010/release/scripts/startup/bl_ui/space_console.py
    branches/particles-2010/release/scripts/startup/bl_ui/space_dopesheet.py
    branches/particles-2010/release/scripts/startup/bl_ui/space_filebrowser.py
    branches/particles-2010/release/scripts/startup/bl_ui/space_graph.py
    branches/particles-2010/release/scripts/startup/bl_ui/space_image.py
    branches/particles-2010/release/scripts/startup/bl_ui/space_info.py
    branches/particles-2010/release/scripts/startup/bl_ui/space_logic.py
    branches/particles-2010/release/scripts/startup/bl_ui/space_nla.py
    branches/particles-2010/release/scripts/startup/bl_ui/space_node.py
    branches/particles-2010/release/scripts/startup/bl_ui/space_outliner.py
    branches/particles-2010/release/scripts/startup/bl_ui/space_sequencer.py
    branches/particles-2010/release/scripts/startup/bl_ui/space_text.py
    branches/particles-2010/release/scripts/startup/bl_ui/space_time.py
    branches/particles-2010/release/scripts/startup/bl_ui/space_userpref.py
    branches/particles-2010/release/scripts/startup/bl_ui/space_userpref_keymap.py
    branches/particles-2010/release/scripts/startup/bl_ui/space_view3d.py
    branches/particles-2010/release/scripts/startup/bl_ui/space_view3d_toolbar.py
    branches/particles-2010/release/scripts/startup/keyingsets_builtins.py
    branches/particles-2010/release/scripts/templates/
    branches/particles-2010/release/scripts/templates/addon_add_object.py
    branches/particles-2010/release/scripts/templates/background_job.py
    branches/particles-2010/release/scripts/templates/builtin_keyingset.py
    branches/particles-2010/release/scripts/templates/gamelogic.py
    branches/particles-2010/release/scripts/templates/gamelogic_basic.py
    branches/particles-2010/release/scripts/templates/gamelogic_module.py
    branches/particles-2010/release/scripts/templates/operator_export.py
    branches/particles-2010/release/scripts/templates/operator_mesh_add.py
    branches/particles-2010/release/scripts/templates/operator_modal.py
    branches/particles-2010/release/scripts/templates/operator_modal_draw.py
    branches/particles-2010/release/scripts/templates/operator_modal_timer.py
    branches/particles-2010/release/scripts/templates/operator_modal_view3d.py
    branches/particles-2010/release/scripts/templates/operator_simple.py
    branches/particles-2010/release/scripts/templates/operator_uv.py
    branches/particles-2010/release/scripts/templates/panel_simple.py

Added: branches/particles-2010/release/scripts/modules/add_object_utils.py
===================================================================
--- branches/particles-2010/release/scripts/modules/add_object_utils.py	                        (rev 0)
+++ branches/particles-2010/release/scripts/modules/add_object_utils.py	2011-05-04 12:31:01 UTC (rev 36483)
@@ -0,0 +1,116 @@
+# ##### 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.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+import bpy
+import mathutils
+
+
+def add_object_align_init(context, operator):
+    space_data = context.space_data
+    if space_data.type != 'VIEW_3D':
+        space_data = None
+
+    # location
+    if operator and operator.properties.is_property_set("location"):
+        location = mathutils.Matrix.Translation(mathutils.Vector(operator.properties.location))
+    else:
+        if space_data:  # local view cursor is detected below
+            location = mathutils.Matrix.Translation(space_data.cursor_location)
+        else:
+            location = mathutils.Matrix.Translation(context.scene.cursor_location)
+
+        if operator:
+            operator.properties.location = location.to_translation()
+
+    # rotation
+    view_align = (context.user_preferences.edit.object_align == 'VIEW')
+    view_align_force = False
+    if operator:
+        if operator.properties.is_property_set("view_align"):
+            view_align = view_align_force = operator.view_align
+        else:
+            operator.properties.view_align = view_align
+
+    if operator and operator.properties.is_property_set("rotation") and not view_align_force:
+        rotation = mathutils.Euler(operator.properties.rotation).to_matrix().to_4x4()
+    else:
+        if view_align and space_data:
+            rotation = space_data.region_3d.view_matrix.to_3x3().inverted().to_4x4()
+        else:
+            rotation = mathutils.Matrix()
+
+        # set the operator properties
+        if operator:
+            operator.properties.rotation = rotation.to_euler()
+
+    return location * rotation
+
+
+def object_data_add(context, obdata, operator=None):
+
+    scene = context.scene
+
+    # ugh, could be made nicer
+    for ob in scene.objects:
+        ob.select = False
+
+    obj_new = bpy.data.objects.new(obdata.name, obdata)
+
+    base = scene.objects.link(obj_new)
+    base.select = True
+
+    if context.space_data and context.space_data.type == 'VIEW_3D':
+        base.layers_from_view(context.space_data)
+
+    obj_new.matrix_world = add_object_align_init(context, operator)
+
+    obj_act = scene.objects.active
+
+    # XXX
+    # caused because entering editmodedoes not add a empty undo slot!
+    if context.user_preferences.edit.use_enter_edit_mode:
+        if not (obj_act and obj_act.mode == 'EDIT' and obj_act.type == obj_new.type):
+            _obdata = bpy.data.meshes.new(obdata.name)
+            obj_act = bpy.data.objects.new(_obdata.name, _obdata)
+            obj_act.matrix_world = obj_new.matrix_world
+            scene.objects.link(obj_act)
+            scene.objects.active = obj_act
+            bpy.ops.object.mode_set(mode='EDIT')
+            bpy.ops.ed.undo_push(message="Enter Editmode")  # need empty undo step
+    # XXX
+
+    if obj_act and obj_act.mode == 'EDIT' and obj_act.type == obj_new.type:
+        bpy.ops.mesh.select_all(action='DESELECT')
+        bpy.ops.object.mode_set(mode='OBJECT')
+
+        obj_act.select = True
+        scene.update()  # apply location
+        #scene.objects.active = obj_new
+
+        bpy.ops.object.join()  # join into the active.
+        bpy.data.meshes.remove(obdata)
+
+        bpy.ops.object.mode_set(mode='EDIT')
+    else:
+        scene.objects.active = obj_new
+        if context.user_preferences.edit.use_enter_edit_mode:
+            bpy.ops.object.mode_set(mode='EDIT')
+
+    return base

Added: branches/particles-2010/release/scripts/modules/addon_utils.py
===================================================================
--- branches/particles-2010/release/scripts/modules/addon_utils.py	                        (rev 0)
+++ branches/particles-2010/release/scripts/modules/addon_utils.py	2011-05-04 12:31:01 UTC (rev 36483)
@@ -0,0 +1,326 @@
+# ##### 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.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+__all__ = (
+    "paths",
+    "modules",
+    "check",
+    "enable",
+    "disable",
+    "reset_all",
+    "module_bl_info",
+)
+
+import bpy as _bpy
+
+
+def paths():
+    # RELEASE SCRIPTS: official scripts distributed in Blender releases
+    paths = _bpy.utils.script_paths("addons")
+
+    # CONTRIB SCRIPTS: good for testing but not official scripts yet
+    # if folder addons_contrib/ exists, scripts in there will be loaded too
+    paths += _bpy.utils.script_paths("addons_contrib")
+
+    # EXTERN SCRIPTS: external projects scripts
+    # if folder addons_extern/ exists, scripts in there will be loaded too
+    paths += _bpy.utils.script_paths("addons_extern")
+
+    return paths
+
+
+def modules(module_cache):
+    import os
+    import sys
+    import time
+
+    path_list = paths()
+
+    # fake module importing
+    def fake_module(mod_name, mod_path, speedy=True):
+        if _bpy.app.debug:
+            print("fake_module", mod_path, mod_name)
+        import ast
+        ModuleType = type(ast)
+        file_mod = open(mod_path, "r", encoding='UTF-8')
+        if speedy:
+            lines = []
+            line_iter = iter(file_mod)
+            l = ""
+            while not l.startswith("bl_info"):
+                l = line_iter.readline()
+                if len(l) == 0:
+                    break
+            while l.rstrip():
+                lines.append(l)
+                l = line_iter.readline()
+            data = "".join(lines)
+
+        else:
+            data = file_mod.read()
+
+        file_mod.close()
+
+        try:
+            ast_data = ast.parse(data, filename=mod_path)
+        except:
+            print("Syntax error 'ast.parse' can't read %r" % mod_path)
+            import traceback
+            traceback.print_exc()
+            ast_data = None
+
+        body_info = None
+
+        if ast_data:
+            for body in ast_data.body:
+                if body.__class__ == ast.Assign:
+                    if len(body.targets) == 1:
+                        if getattr(body.targets[0], "id", "") == "bl_info":
+                            body_info = body
+                            break
+
+        if body_info:
+            try:
+                mod = ModuleType(mod_name)
+                mod.bl_info = ast.literal_eval(body.value)
+                mod.__file__ = mod_path
+                mod.__time__ = os.path.getmtime(mod_path)
+            except:
+                print("AST error in module %s" % mod_name)
+                import traceback
+                traceback.print_exc()
+                raise
+
+            return mod
+        else:
+            return None
+
+    modules_stale = set(module_cache.keys())
+
+    for path in path_list:
+        for mod_name, mod_path in _bpy.path.module_names(path):
+            modules_stale -= {mod_name}
+            mod = module_cache.get(mod_name)
+            if mod:
+                if mod.__time__ != os.path.getmtime(mod_path):
+                    print("reloading addon:", mod_name, mod.__time__, os.path.getmtime(mod_path), mod_path)
+                    del module_cache[mod_name]
+                    mod = None
+
+            if mod is None:
+                mod = fake_module(mod_name, mod_path)
+                if mod:
+                    module_cache[mod_name] = mod
+
+    # just incase we get stale modules, not likely
+    for mod_stale in modules_stale:
+        del module_cache[mod_stale]
+    del modules_stale
+
+    mod_list = list(module_cache.values())
+    mod_list.sort(key=lambda mod: (mod.bl_info['category'], mod.bl_info['name']))
+    return mod_list
+
+
+def check(module_name):
+    """
+    Returns the loaded state of the addon.
+
+    :arg module_name: The name of the addon and module.
+    :type module_name: string
+    :return: (loaded_default, loaded_state)
+    :rtype: tuple of booleans
+    """
+    import sys
+    loaded_default = module_name in _bpy.context.user_preferences.addons
+
+    mod = sys.modules.get(module_name)
+    loaded_state = mod and getattr(mod, "__addon_enabled__", Ellipsis)
+
+    if loaded_state is Ellipsis:
+        print("Warning: addon-module %r found module but without"
+               " __addon_enabled__ field, possible name collision from file: %r" %
+               (module_name, getattr(mod, "__file__", "<unknown>")))
+
+        loaded_state = False
+
+    return loaded_default, loaded_state
+
+
+def enable(module_name, default_set=True):
+    """
+    Enables an addon by name.
+
+    :arg module_name: The name of the addon and module.
+    :type module_name: string
+    :return: the loaded module or None on failier.
+    :rtype: module
+    """
+    # note, this still gets added to _bpy_types.TypeMap
+
+    import os

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list