From 1b1667018e3e960d21ec0c802290a5e49ffe2a90 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 27 May 2009 00:03:49 +0000 Subject: UI: * Added Constraints template and Add Constraint operator. * Added toggle=True/False parameter to uiItemR, to get a toggle button (actual button) rather than an "option" button (checkbox) * Added OPTION/OPTIONN button type, to distinguish with TOG/TOGN. RNA: * Make all modifier pointers editable, including correct updates. * Added notifiers and updates to constraints. * Fix a stack corruption, pointed out by Andrea, and potentially causing crashes. --- source/blender/makesrna/intern/rna_object.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/makesrna/intern/rna_object.c') diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index cbc80e68b4a..47a243b9697 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -48,7 +48,7 @@ static void rna_Object_update(bContext *C, PointerRNA *ptr) DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_OB); } -static void rna_Object_scene_update(bContext *C, PointerRNA *ptr) +static void rna_Object_dependency_update(bContext *C, PointerRNA *ptr) { DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_OB); DAG_scene_sort(CTX_data_scene(C)); @@ -760,7 +760,7 @@ static StructRNA *rna_def_object(BlenderRNA *brna) RNA_def_property_enum_bitflag_sdna(prop, NULL, "transflag"); RNA_def_property_enum_items(prop, dupli_items); RNA_def_property_ui_text(prop, "Dupli Type", "If not None, object duplication method to use."); - RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_scene_update"); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update"); prop= RNA_def_property(srna, "dupli_frames_no_speed", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLINOSPEED); -- cgit v1.2.3 From a591a47c4337b62304a1d69b0e7de009bf3742bd Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 28 May 2009 23:23:47 +0000 Subject: RNA: * Automatically do us++ and us-- reference counting in ID pointer set functions. * Added an enum property callback to dynamically vary the list of available items. * Added some functions to do removes on pointers and collections runtime defined for RNA and using ID properties. * Constraints now have owner/target space wrapped, and most pointers made editable. They can be ported to use python layouts. * Also other pointers made editable that I think are see now with the automatic reference counting. --- source/blender/makesrna/intern/rna_object.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'source/blender/makesrna/intern/rna_object.c') diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 47a243b9697..360b6e1a53b 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -556,6 +556,7 @@ static StructRNA *rna_def_object(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Parent Bone", "Name of parent bone in case of a bone parenting relation."); prop= RNA_def_property(srna, "track", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Track", "Object being tracked to define the rotation (Old Track)."); prop= RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE); @@ -584,7 +585,6 @@ static StructRNA *rna_def_object(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Materials", ""); prop= RNA_def_property(srna, "active_material", PROP_POINTER, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_struct_type(prop, "Material"); RNA_def_property_pointer_funcs(prop, "rna_Object_active_material_get", NULL); RNA_def_property_ui_text(prop, "Active Material", "Active material being displayed."); @@ -596,7 +596,7 @@ static StructRNA *rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "active_material_link", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, material_link_items); - RNA_def_property_enum_funcs(prop, "rna_Object_active_material_link_get", "rna_Object_active_material_link_set"); + RNA_def_property_enum_funcs(prop, "rna_Object_active_material_link_get", "rna_Object_active_material_link_set", NULL); RNA_def_property_ui_text(prop, "Active Material Link", "Use material from object or data for the active material."); /* transform */ @@ -765,6 +765,7 @@ static StructRNA *rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "dupli_frames_no_speed", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLINOSPEED); RNA_def_property_ui_text(prop, "Dupli Frames No Speed", "Set dupliframes to still, regardless of frame."); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update"); prop= RNA_def_property(srna, "dupli_verts_rotation", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIROT); @@ -774,6 +775,7 @@ static StructRNA *rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "dupli_faces_inherit_scale", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIROT); RNA_def_property_ui_text(prop, "Dupli Faces Inherit Scale", "Scale dupli based on face size."); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update"); prop= RNA_def_property(srna, "dupli_faces_scale", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "dupfacesca"); @@ -783,27 +785,33 @@ static StructRNA *rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "dupli_group", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "dup_group"); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Dupli Group", "Instance an existing group."); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update"); prop= RNA_def_property(srna, "dupli_frames_start", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "dupsta"); RNA_def_property_range(prop, 1, 32767); RNA_def_property_ui_text(prop, "Dupli Frames Start", "Start frame for DupliFrames."); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update"); prop= RNA_def_property(srna, "dupli_frames_end", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "dupend"); RNA_def_property_range(prop, 1, 32767); RNA_def_property_ui_text(prop, "Dupli Frames End", "End frame for DupliFrames."); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update"); prop= RNA_def_property(srna, "dupli_frames_on", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "dupon"); RNA_def_property_range(prop, 1, 1500); RNA_def_property_ui_text(prop, "Dupli Frames On", "Number of frames to use between DupOff frames."); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update"); prop= RNA_def_property(srna, "dupli_frames_off", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "dupoff"); RNA_def_property_range(prop, 0, 1500); RNA_def_property_ui_text(prop, "Dupli Frames Off", "Recurring frames to exclude from the Dupliframes."); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update"); /* time offset */ @@ -836,7 +844,6 @@ static StructRNA *rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "script_link", PROP_POINTER, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "scriptlink"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Script Link", "Scripts linked to this object."); /* drawing */ -- cgit v1.2.3 From 688b7c73ad42148bfa946a195549c4fc6b38c266 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 29 May 2009 15:12:31 +0000 Subject: RNA: * Added PROP_ID_REFCOUNT flag to control if refcounting should be done on ID pointer properties. All ID pointers are refcounted, by default, with the exception of Object, Scene and Text. * Also made TextureFace image pointer editable, with the special refcounting behavior. --- source/blender/makesrna/intern/rna_object.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/makesrna/intern/rna_object.c') diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 360b6e1a53b..86df2935f79 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -513,6 +513,7 @@ static StructRNA *rna_def_object(BlenderRNA *brna) srna= RNA_def_struct(brna, "Object", "ID"); RNA_def_struct_ui_text(srna, "Object", "Object datablock defining an object in a scene.."); + RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT); prop= RNA_def_property(srna, "data", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "ID"); -- cgit v1.2.3 From 0e02fef8b498a7a2905dc8b341f6bebfc3a1e167 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 1 Jun 2009 11:39:11 +0000 Subject: 2.5: Added first particle panel, and an RNA property to retrieve the active particle system. --- source/blender/makesrna/intern/rna_object.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'source/blender/makesrna/intern/rna_object.c') diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 86df2935f79..6baf5083d31 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -42,6 +42,7 @@ #include "BKE_context.h" #include "BKE_depsgraph.h" #include "BKE_material.h" +#include "BKE_particle.h" static void rna_Object_update(bContext *C, PointerRNA *ptr) { @@ -202,6 +203,13 @@ static void rna_Object_active_material_link_set(PointerRNA *ptr, int value) ob->colbits &= ~(1<<(ob->actcol)); } +static PointerRNA rna_Object_active_particle_system_get(PointerRNA *ptr) +{ + Object *ob= (Object*)ptr->id.data; + ParticleSystem *psys= psys_get_current(ob); + return rna_pointer_inherit_refine(ptr, &RNA_ParticleSystem, psys); +} + static PointerRNA rna_Object_game_settings_get(PointerRNA *ptr) { return rna_pointer_inherit_refine(ptr, &RNA_GameObjectSettings, ptr->id.data); @@ -720,6 +728,11 @@ static StructRNA *rna_def_object(BlenderRNA *brna) RNA_def_property_struct_type(prop, "ParticleSystem"); RNA_def_property_ui_text(prop, "Particle Systems", "Particle systems emitted from the object."); + prop= RNA_def_property(srna, "active_particle_system", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "ParticleSystem"); + RNA_def_property_pointer_funcs(prop, "rna_Object_active_particle_system_get", NULL); + RNA_def_property_ui_text(prop, "Active Particle System", "Active particle system being displayed"); + /* restrict */ prop= RNA_def_property(srna, "restrict_view", PROP_BOOLEAN, PROP_NONE); -- cgit v1.2.3