Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-05-09 11:17:40 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-05-09 11:17:40 +0400
commita1fafec360ba20740c1c9d56f05f121423a7edfe (patch)
tree837dbbbb22ac1f125638fac6d50ddfe80d8e04e7
parent9bdec67947f2134b5a04eccec8c545ba1aff7d6b (diff)
blender 2.63a: merge rest of changes from trunk into tag up to r46419
Includes commits from Aligorith (46345, 46338, 46336) Collada commits 46214, 46215 and 46246 and one Aligorith's commit 46342 were already merged in previous merge.
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py63
-rw-r--r--source/blender/editors/animation/anim_filter.c110
-rw-r--r--source/blender/makesrna/intern/rna_object.c7
3 files changed, 126 insertions, 54 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index c258e08fcf1..9dda960ea3b 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -135,7 +135,9 @@ class ShowHideMenu():
layout.operator("%s.hide" % self._operator_name, text="Hide Unselected").unselected = True
-class VIEW3D_MT_transform(Menu):
+# Standard transforms which apply to all cases
+# NOTE: this doesn't seem to be able to be used directly
+class VIEW3D_MT_transform_base(Menu):
bl_label = "Transform"
# TODO: get rid of the custom text strings?
@@ -156,22 +158,38 @@ class VIEW3D_MT_transform(Menu):
layout.operator("transform.warp", text="Warp")
layout.operator("transform.push_pull", text="Push/Pull")
+
+# Generic transform menu - geometry types
+class VIEW3D_MT_transform(VIEW3D_MT_transform_base):
+ def draw(self, context):
+ # base menu
+ VIEW3D_MT_transform_base.draw(self, context)
+
+ # generic...
+ layout = self.layout
layout.separator()
layout.operator("transform.translate", text="Move Texture Space").texture_space = True
layout.operator("transform.resize", text="Scale Texture Space").texture_space = True
- layout.separator()
- obj = context.object
- if obj.type == 'ARMATURE' and obj.mode in {'EDIT', 'POSE'} and obj.data.draw_type in {'BBONE', 'ENVELOPE'}:
- layout.operator("transform.transform", text="Scale Envelope/BBone").mode = 'BONE_SIZE'
+# Object-specific extensions to Transform menu
+class VIEW3D_MT_transform_object(VIEW3D_MT_transform_base):
+ def draw(self, context):
+ # base menu
+ VIEW3D_MT_transform_base.draw(self, context)
+
+ # object-specific option follow...
+ layout = self.layout
+ layout.separator()
- if context.edit_object and context.edit_object.type == 'ARMATURE':
- layout.operator("armature.align")
- else:
- layout.operator_context = 'EXEC_REGION_WIN'
- layout.operator("transform.transform", text="Align to Transform Orientation").mode = 'ALIGN' # XXX see alignmenu() in edit.c of b2.4x to get this working
+ layout.operator("transform.translate", text="Move Texture Space").texture_space = True
+ layout.operator("transform.resize", text="Scale Texture Space").texture_space = True
+
+ layout.separator()
+
+ layout.operator_context = 'EXEC_REGION_WIN'
+ layout.operator("transform.transform", text="Align to Transform Orientation").mode = 'ALIGN' # XXX see alignmenu() in edit.c of b2.4x to get this working
layout.separator()
@@ -191,6 +209,25 @@ class VIEW3D_MT_transform(Menu):
layout.operator("object.anim_transforms_to_deltas")
+# Armature EditMode extensions to Transform menu
+class VIEW3D_MT_transform_armature(VIEW3D_MT_transform_base):
+ def draw(self, context):
+ # base menu
+ VIEW3D_MT_transform_base.draw(self, context)
+
+ # armature specific extensions follow...
+ layout = self.layout
+ layout.separator()
+
+ obj = context.object
+ if (obj.type == 'ARMATURE' and obj.mode in {'EDIT', 'POSE'} and
+ obj.data.draw_type in {'BBONE', 'ENVELOPE'}):
+ layout.operator("transform.transform", text="Scale Envelope/BBone").mode = 'BONE_SIZE'
+
+ if context.edit_object and context.edit_object.type == 'ARMATURE':
+ layout.operator("armature.align")
+
+
class VIEW3D_MT_mirror(Menu):
bl_label = "Mirror"
@@ -699,7 +736,7 @@ class VIEW3D_MT_object(Menu):
layout.separator()
- layout.menu("VIEW3D_MT_transform")
+ layout.menu("VIEW3D_MT_transform_object")
layout.menu("VIEW3D_MT_mirror")
layout.menu("VIEW3D_MT_object_clear")
layout.menu("VIEW3D_MT_object_apply")
@@ -1317,7 +1354,7 @@ class VIEW3D_MT_pose(Menu):
layout.separator()
- layout.menu("VIEW3D_MT_transform")
+ layout.menu("VIEW3D_MT_transform_armature")
layout.menu("VIEW3D_MT_pose_transform")
layout.menu("VIEW3D_MT_pose_apply")
@@ -2071,7 +2108,7 @@ class VIEW3D_MT_edit_armature(Menu):
edit_object = context.edit_object
arm = edit_object.data
- layout.menu("VIEW3D_MT_transform")
+ layout.menu("VIEW3D_MT_transform_armature")
layout.menu("VIEW3D_MT_mirror")
layout.menu("VIEW3D_MT_snap")
layout.menu("VIEW3D_MT_edit_armature_roll")
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 979811235b8..dad261c3f80 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -1476,51 +1476,83 @@ static size_t animdata_filter_ds_textures (bAnimContext *ac, ListBase *anim_data
return items;
}
-static size_t animdata_filter_ds_materials (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Object *ob, int filter_mode)
+
+static size_t animdata_filter_ds_material (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Material *ma, int filter_mode)
{
- size_t items=0;
- int a=0;
+ ListBase tmp_data = {NULL, NULL};
+ size_t tmp_items = 0;
+ size_t items = 0;
- /* firstly check that we actuallly have some materials, by gathering all materials in a temp list */
- for (a=1; a <= ob->totcol; a++) {
- Material *ma= give_current_material(ob, a);
- ListBase tmp_data = {NULL, NULL};
- size_t tmp_items = 0;
+ /* add material's animation data to temp collection */
+ BEGIN_ANIMFILTER_SUBCHANNELS(FILTER_MAT_OBJD(ma))
+ {
+ /* material's animation data */
+ tmp_items += animfilter_block_data(ac, &tmp_data, ads, (ID *)ma, filter_mode);
+
+ /* textures */
+ if (!(ads->filterflag & ADS_FILTER_NOTEX))
+ tmp_items += animdata_filter_ds_textures(ac, &tmp_data, ads, (ID *)ma, filter_mode);
+
+ /* nodes */
+ if ((ma->nodetree) && !(ads->filterflag & ADS_FILTER_NONTREE))
+ tmp_items += animdata_filter_ds_nodetree(ac, &tmp_data, ads, (ID *)ma, ma->nodetree, filter_mode);
+ }
+ END_ANIMFILTER_SUBCHANNELS;
+
+ /* did we find anything? */
+ if (tmp_items) {
+ /* include material-expand widget first */
+ // hmm... do we need to store the index of this material in the array anywhere?
+ if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
+ /* check if filtering by active status */
+ if (ANIMCHANNEL_ACTIVEOK(ma)) {
+ ANIMCHANNEL_NEW_CHANNEL(ma, ANIMTYPE_DSMAT, ma);
+ }
+ }
- /* if no material returned, skip - so that we don't get weird blank entries... */
- if (ma == NULL) continue;
+ /* now add the list of collected channels */
+ BLI_movelisttolist(anim_data, &tmp_data);
+ BLI_assert((tmp_data.first == tmp_data.last) && (tmp_data.first == NULL));
+ items += tmp_items;
+ }
+
+ return items;
+}
+
+static size_t animdata_filter_ds_materials (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Object *ob, int filter_mode)
+{
+ short has_nested = 0;
+ size_t items = 0;
+ int a = 0;
+
+ /* first pass: take the materials referenced via the Material slots of the object */
+ for (a = 1; a <= ob->totcol; a++) {
+ Material *ma = give_current_material(ob, a);
- /* add material's animation data to temp collection */
- BEGIN_ANIMFILTER_SUBCHANNELS(FILTER_MAT_OBJD(ma))
- {
- /* material's animation data */
- tmp_items += animfilter_block_data(ac, &tmp_data, ads, (ID *)ma, filter_mode);
-
- /* textures */
- if (!(ads->filterflag & ADS_FILTER_NOTEX))
- tmp_items += animdata_filter_ds_textures(ac, &tmp_data, ads, (ID *)ma, filter_mode);
-
- /* nodes */
- if ((ma->nodetree) && !(ads->filterflag & ADS_FILTER_NONTREE))
- tmp_items += animdata_filter_ds_nodetree(ac, &tmp_data, ads, (ID *)ma, ma->nodetree, filter_mode);
+ /* if material is valid, try to add relevant contents from here */
+ if (ma) {
+ /* add channels */
+ items += animdata_filter_ds_material(ac, anim_data, ads, ma, filter_mode);
+
+ /* for optimising second pass - check if there's a nested material here to come back for */
+ if (has_nested == 0)
+ has_nested = give_node_material(ma) != NULL;
}
- END_ANIMFILTER_SUBCHANNELS;
-
- /* did we find anything? */
- if (tmp_items) {
- /* include material-expand widget first */
- // hmm... do we need to store the index of this material in the array anywhere?
- if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
- /* check if filtering by active status */
- if (ANIMCHANNEL_ACTIVEOK(ma)) {
- ANIMCHANNEL_NEW_CHANNEL(ma, ANIMTYPE_DSMAT, ma);
- }
- }
+ }
+
+ /* second pass: go through a second time looking for "nested" materials (material.material references)
+ *
+ * NOTE: here we ignore the expanded status of the parent, as it could be too confusing as to why these are
+ * disappearing/not available, since the relationships between these is not that clear
+ */
+ if (has_nested) {
+ for (a = 1; a <= ob->totcol; a++) {
+ Material *base = give_current_material(ob, a);
+ Material *ma = give_node_material(base);
- /* now add the list of collected channels */
- BLI_movelisttolist(anim_data, &tmp_data);
- BLI_assert((tmp_data.first == tmp_data.last) && (tmp_data.first == NULL));
- items += tmp_items;
+ /* add channels from the nested material if it exists */
+ if (ma)
+ items += animdata_filter_ds_material(ac, anim_data, ads, ma, filter_mode);
}
}
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index bd024ba90be..183d0e37c36 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -383,8 +383,11 @@ static void rna_Object_parent_set(PointerRNA *ptr, PointerRNA value)
{
Object *ob = (Object*)ptr->data;
Object *par = (Object*)value.data;
-
- ED_object_parent(ob, par, ob->partype, ob->parsubstr);
+
+ /* NOTE: this dummy check here prevents this method causing weird runtime errors on mingw 4.6.2 */
+ if (ob) {
+ ED_object_parent(ob, par, ob->partype, ob->parsubstr);
+ }
}
static void rna_Object_parent_type_set(PointerRNA *ptr, int value)