[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23831] trunk/blender: set scene, currently UI is in the render buttons, should be moved to a scene buttons area.
Campbell Barton
ideasman42 at gmail.com
Wed Oct 14 15:20:20 CEST 2009
Revision: 23831
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23831
Author: campbellbarton
Date: 2009-10-14 15:20:20 +0200 (Wed, 14 Oct 2009)
Log Message:
-----------
set scene, currently UI is in the render buttons, should be moved to a scene buttons area.
added a property flag PROP_ID_SELF_CHECK, so properties can be set to point to anything but themselves.
Modified Paths:
--------------
trunk/blender/release/scripts/ui/buttons_scene.py
trunk/blender/source/blender/makesrna/RNA_types.h
trunk/blender/source/blender/makesrna/intern/makesrna.c
trunk/blender/source/blender/makesrna/intern/rna_mesh.c
trunk/blender/source/blender/makesrna/intern/rna_object.c
trunk/blender/source/blender/makesrna/intern/rna_scene.c
Modified: trunk/blender/release/scripts/ui/buttons_scene.py
===================================================================
--- trunk/blender/release/scripts/ui/buttons_scene.py 2009-10-14 11:57:26 UTC (rev 23830)
+++ trunk/blender/release/scripts/ui/buttons_scene.py 2009-10-14 13:20:20 UTC (rev 23831)
@@ -25,14 +25,15 @@
def draw(self, context):
layout = self.layout
-
- rd = context.scene.render_data
+ scene = context.scene
+ rd = scene.render_data
row = layout.row()
row.itemO("screen.render", text="Image", icon='ICON_RENDER_STILL')
row.item_booleanO("screen.render", "animation", True, text="Animation", icon='ICON_RENDER_ANIMATION')
layout.itemR(rd, "display_mode", text="Display")
+ layout.itemR(scene, "set", text="Set Scene") # XXX - this should get its own 'scene buttons'
class SCENE_PT_layers(RenderButtonsPanel):
__label__ = "Layers"
Modified: trunk/blender/source/blender/makesrna/RNA_types.h
===================================================================
--- trunk/blender/source/blender/makesrna/RNA_types.h 2009-10-14 11:57:26 UTC (rev 23830)
+++ trunk/blender/source/blender/makesrna/RNA_types.h 2009-10-14 13:20:20 UTC (rev 23831)
@@ -126,47 +126,51 @@
/* editable means the property is editable in the user
* interface, properties are editable by default except
* for pointers and collections. */
- PROP_EDITABLE = 1,
+ PROP_EDITABLE = 1<<0,
/* this property is editable even if it is lib linked,
* meaning it will get lost on reload, but it's useful
* for editing. */
- PROP_LIB_EXCEPTION = 65536,
+ PROP_LIB_EXCEPTION = 1<<16,
/* animateable means the property can be driven by some
* other input, be it animation curves, expressions, ..
* properties are animateable by default except for pointers
* and collections */
- PROP_ANIMATEABLE = 2,
+ PROP_ANIMATEABLE = 1<<1,
/* icon */
- PROP_ICONS_CONSECUTIVE = 4096,
+ PROP_ICONS_CONSECUTIVE = 1<12,
/* hidden in the user interface */
- PROP_HIDDEN = 524288,
+ PROP_HIDDEN = 1<<19,
/* function paramater flags */
- PROP_REQUIRED = 4,
- PROP_RETURN = 8,
- PROP_RNAPTR = 2048,
-
+ PROP_REQUIRED = 1<<2,
+ PROP_RETURN = 1<<3,
+ PROP_RNAPTR = 1<<11,
/* registering */
- PROP_REGISTER = 16,
- PROP_REGISTER_OPTIONAL = 16|32,
+ PROP_REGISTER = 1<<4,
+ PROP_REGISTER_OPTIONAL = (1<<4)|(1<<5),
/* pointers */
- PROP_ID_REFCOUNT = 64,
- PROP_NEVER_NULL = 262144,
+ PROP_ID_REFCOUNT = 1<<6,
+ /* disallow assigning a variable to its self, eg an object tracking its self
+ * only apply this to types that are derived from an ID ()*/
+ PROP_ID_SELF_CHECK = 1<<20,
+
+ PROP_NEVER_NULL = 1<<18,
+
/* internal flags */
- PROP_BUILTIN = 128,
- PROP_EXPORT = 256,
- PROP_RUNTIME = 512,
- PROP_IDPROPERTY = 1024,
- PROP_RAW_ACCESS = 8192,
- PROP_RAW_ARRAY = 16384,
- PROP_FREE_POINTERS = 32768,
- PROP_DYNAMIC = 131072 /* for dynamic arrays, and retvals of type string */
+ PROP_BUILTIN = 1<<7,
+ PROP_EXPORT = 1<<8,
+ PROP_RUNTIME = 1<<9,
+ PROP_IDPROPERTY = 1<<10,
+ PROP_RAW_ACCESS = 1<<13,
+ PROP_RAW_ARRAY = 1<<14,
+ PROP_FREE_POINTERS = 1<<15,
+ PROP_DYNAMIC = 1<<17 /* for dynamic arrays, and retvals of type string */
} PropertyFlag;
typedef struct CollectionPropertyIterator {
Modified: trunk/blender/source/blender/makesrna/intern/makesrna.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/makesrna.c 2009-10-14 11:57:26 UTC (rev 23830)
+++ trunk/blender/source/blender/makesrna/intern/makesrna.c 2009-10-14 13:20:20 UTC (rev 23831)
@@ -144,6 +144,11 @@
fprintf(f, " %s *data= (%s*)(ptr->data);\n", dp->dnastructname, dp->dnastructname);
}
+static void rna_print_id_get(FILE *f, PropertyDefRNA *dp)
+{
+ fprintf(f, " ID *id= ptr->id.data;\n");
+}
+
static char *rna_alloc_function_name(const char *structname, const char *propname, const char *type)
{
AllocDefRNA *alloc;
@@ -530,6 +535,11 @@
else {
rna_print_data_get(f, dp);
+ if(prop->flag & PROP_ID_SELF_CHECK) {
+ rna_print_id_get(f, dp);
+ fprintf(f, " if(id==value.data) return;\n\n");
+ }
+
if(prop->flag & PROP_ID_REFCOUNT) {
fprintf(f, "\n if(data->%s)\n", dp->dnaname);
fprintf(f, " id_us_min((ID*)data->%s);\n", dp->dnaname);
Modified: trunk/blender/source/blender/makesrna/intern/rna_mesh.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_mesh.c 2009-10-14 11:57:26 UTC (rev 23830)
+++ trunk/blender/source/blender/makesrna/intern/rna_mesh.c 2009-10-14 13:20:20 UTC (rev 23831)
@@ -1452,7 +1452,7 @@
/* TODO, should this be allowed to be its self? */
prop= RNA_def_property(srna, "texture_mesh", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "texcomesh");
- RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
RNA_def_property_ui_text(prop, "Texture Mesh", "Use another mesh for texture indicies (vertex indicies must be aligned).");
/* UV textures */
Modified: trunk/blender/source/blender/makesrna/intern/rna_object.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_object.c 2009-10-14 11:57:26 UTC (rev 23830)
+++ trunk/blender/source/blender/makesrna/intern/rna_object.c 2009-10-14 13:20:20 UTC (rev 23831)
@@ -223,14 +223,6 @@
ED_object_parent(ob, ob->parent, value, ob->parsubstr);
}
-static void rna_Object_track_set(PointerRNA *ptr, PointerRNA value)
-{
- Object *ob= (Object*)ptr->data;
-
- if(ob != value.data)
- ob->track= value.data;
-}
-
static EnumPropertyItem *rna_Object_parent_type_itemf(bContext *C, PointerRNA *ptr, int *free)
{
Object *ob= (Object*)ptr->data;
@@ -1219,8 +1211,7 @@
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update");
prop= RNA_def_property(srna, "track", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_track_set", NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
RNA_def_property_ui_text(prop, "Track", "Object being tracked to define the rotation (Old Track).");
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update");
Modified: trunk/blender/source/blender/makesrna/intern/rna_scene.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_scene.c 2009-10-14 11:57:26 UTC (rev 23830)
+++ trunk/blender/source/blender/makesrna/intern/rna_scene.c 2009-10-14 13:20:20 UTC (rev 23831)
@@ -110,7 +110,20 @@
scene->basact= NULL;
}
+static void rna_Scene_set_set(PointerRNA *ptr, PointerRNA value)
+{
+ Scene *scene= (Scene*)ptr->data;
+ Scene *set= (Scene*)value.data;
+ Scene *nested_set;
+ for(nested_set= set; nested_set; nested_set= nested_set->set) {
+ if(nested_set==scene)
+ return;
+ }
+
+ scene->set= set;
+}
+
static int layer_set(int lay, const int *values)
{
int i, tot= 0;
@@ -2084,6 +2097,14 @@
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Camera", "Active camera used for rendering the scene.");
+ prop= RNA_def_property(srna, "set", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "set");
+ RNA_def_property_struct_type(prop, "Scene");
+ //RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
+ RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_Scene_set_set", NULL);
+ RNA_def_property_ui_text(prop, "Set Scene", "Background set scene.");
+
prop= RNA_def_property(srna, "active_object", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Object");
RNA_def_property_pointer_funcs(prop, "rna_Scene_active_object_get", "rna_Scene_active_object_set", NULL);
More information about the Bf-blender-cvs
mailing list