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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-06-01 15:39:11 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-06-01 15:39:11 +0400
commit0e02fef8b498a7a2905dc8b341f6bebfc3a1e167 (patch)
tree899dd2bb6cb06ed6ecdf24b14d0b7823ffbc0e75
parent41963d9e4e04e481aad99a9b24ddebd9a198b30d (diff)
2.5: Added first particle panel, and an RNA property to retrieve
the active particle system.
-rw-r--r--release/ui/buttons_particle.py26
-rw-r--r--source/blender/makesrna/intern/rna_object.c13
-rw-r--r--source/blender/makesrna/intern/rna_particle.c4
3 files changed, 41 insertions, 2 deletions
diff --git a/release/ui/buttons_particle.py b/release/ui/buttons_particle.py
new file mode 100644
index 00000000000..52e20b03538
--- /dev/null
+++ b/release/ui/buttons_particle.py
@@ -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)
+
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);
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index 95c5c90b304..36a1992670a 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -838,10 +838,10 @@ static void rna_def_particle_settings(BlenderRNA *brna)
//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");