[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20552] branches/blender2.5/blender: 2.5: Added first particle panel, and an RNA property to retrieve
Brecht Van Lommel
brecht at blender.org
Mon Jun 1 13:39:12 CEST 2009
Revision: 20552
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20552
Author: blendix
Date: 2009-06-01 13:39:11 +0200 (Mon, 01 Jun 2009)
Log Message:
-----------
2.5: Added first particle panel, and an RNA property to retrieve
the active particle system.
Modified Paths:
--------------
branches/blender2.5/blender/source/blender/makesrna/intern/rna_object.c
branches/blender2.5/blender/source/blender/makesrna/intern/rna_particle.c
Added Paths:
-----------
branches/blender2.5/blender/release/ui/buttons_particle.py
Added: branches/blender2.5/blender/release/ui/buttons_particle.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_particle.py (rev 0)
+++ branches/blender2.5/blender/release/ui/buttons_particle.py 2009-06-01 11:39:11 UTC (rev 20552)
@@ -0,0 +1,26 @@
+
+import bpy
+
+class ParticleButtonsPanel(bpy.types.Panel):
+ __space_type__ = "BUTTONS_WINDOW"
+ __region_type__ = "WINDOW"
+ __context__ = "particle"
+
+ def poll(self, context):
+ ob = context.active_object
+ return (ob and ob.active_particle_system)
+
+class PARTICLE_PT_particles(ParticleButtonsPanel):
+ __idname__= "PARTICLE_PT_particles"
+ __label__ = "Particles"
+
+ def draw(self, context):
+ layout = self.layout
+
+ psys = context.active_object.active_particle_system
+ part = psys.settings
+
+ layout.itemR(part, "amount")
+
+bpy.types.register(PARTICLE_PT_particles)
+
Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_object.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_object.c 2009-06-01 11:31:06 UTC (rev 20551)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_object.c 2009-06-01 11:39:11 UTC (rev 20552)
@@ -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 @@
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 @@
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);
Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_particle.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_particle.c 2009-06-01 11:31:06 UTC (rev 20551)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_particle.c 2009-06-01 11:39:11 UTC (rev 20552)
@@ -838,10 +838,10 @@
//float rt; TODO:find where rt is used - can't find it in UI
- prop= RNA_def_property(srna, "total_particles", PROP_INT, PROP_UNSIGNED);
+ prop= RNA_def_property(srna, "amount", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "totpart");
RNA_def_property_range(prop, 0, 100000);
- RNA_def_property_ui_text(prop, "Particle Amount", "The total number of particles.");
+ RNA_def_property_ui_text(prop, "Amount", "Total number of particles.");
prop= RNA_def_property(srna, "userjit", PROP_INT, PROP_UNSIGNED);//TODO: can we get a better name for userjit?
RNA_def_property_int_sdna(prop, NULL, "userjit");
More information about the Bf-blender-cvs
mailing list