Revision: 32756
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32756
Author: lukastoenne
Date: 2010-10-28 15:35:33 +0200 (Thu, 28 Oct 2010)
Log Message:
-----------
Removed the static list of "default" particle properties from ParticleSet.
Instead particle properties are now automatically added when a SetData node has
a new socket. Removing particle props still has to be done in the detail panel
though.
Modified Paths:
--------------
branches/particles-2010/release/scripts/ui/properties_data_particleset.py
branches/particles-2010/source/blender/blenkernel/BKE_particleset.h
branches/particles-2010/source/blender/blenkernel/intern/particleset.c
branches/particles-2010/source/blender/editors/particleset/particleset_edit.c
branches/particles-2010/source/blender/editors/particleset/particleset_intern.h
branches/particles-2010/source/blender/editors/particleset/particleset_ops.c
branches/particles-2010/source/blender/editors/space_node/drawnode.c
branches/particles-2010/source/blender/makesdna/DNA_particleset_types.h
branches/particles-2010/source/blender/nodes/intern/simulation/SIM_util.c
branches/particles-2010/source/blender/nodes/intern/simulation/SIM_util.h
branches/particles-2010/source/blender/nodes/intern/simulation/nodes/SIM_random.c
branches/particles-2010/source/blender/nodes/intern/simulation/nodes/SIM_set_data.c
Modified:
branches/particles-2010/release/scripts/ui/properties_data_particleset.py
===================================================================
--- branches/particles-2010/release/scripts/ui/properties_data_particleset.py
2010-10-28 12:43:27 UTC (rev 32755)
+++ branches/particles-2010/release/scripts/ui/properties_data_particleset.py
2010-10-28 13:35:33 UTC (rev 32756)
@@ -66,8 +66,6 @@
row = layout.row()
row.prop(pset, "page_size")
- layout.operator_menu_enum("particleset.property_add", "type")
-
for pp in pset.particle_properties:
box = layout.box()
box.context_pointer_set("parprop", pp)
Modified: branches/particles-2010/source/blender/blenkernel/BKE_particleset.h
===================================================================
--- branches/particles-2010/source/blender/blenkernel/BKE_particleset.h
2010-10-28 12:43:27 UTC (rev 32755)
+++ branches/particles-2010/source/blender/blenkernel/BKE_particleset.h
2010-10-28 13:35:33 UTC (rev 32756)
@@ -36,11 +36,9 @@
void pset_calc_modifiers(struct Scene *scene, struct Object *ob);
/* attribute management */
-extern struct ParticlePropertyInfo pset_common_properties[];
-
struct ParticlePropertyInfo *pset_find_particle_property(struct ParticleSet
*pset, const char *name);
-struct ParticlePropertyInfo *pset_property_add(struct ParticleSet *pset, char
*name);
+struct ParticlePropertyInfo *pset_property_add(struct ParticleSet *pset, const
char *name, ParticlePropertyType type, int flags);
int pset_property_remove(struct ParticleSet *pset, int index);
int pset_property_moveup(struct ParticleSet *pset, int index);
int pset_property_movedown(struct ParticleSet *pset, int index);
Modified: branches/particles-2010/source/blender/blenkernel/intern/particleset.c
===================================================================
--- branches/particles-2010/source/blender/blenkernel/intern/particleset.c
2010-10-28 12:43:27 UTC (rev 32755)
+++ branches/particles-2010/source/blender/blenkernel/intern/particleset.c
2010-10-28 13:35:33 UTC (rev 32756)
@@ -43,17 +43,6 @@
#include "BKE_particleset.h"
#include "BKE_utildefines.h"
-ParticlePropertyInfo pset_common_properties[] = {
-// Name, data type, flags
- { "Position", PARPROP_VECTOR, PARPROP_DEFAULT|PARPROP_PROTECTED
},
- { "Velocity", PARPROP_VECTOR, PARPROP_DEFAULT|PARPROP_PROTECTED
},
- { "Force", PARPROP_VECTOR, PARPROP_PROTECTED,
},
- { "Mass", PARPROP_FLOAT, 0
},
- { "Init", PARPROP_BOOL, 0
},
- /* last line marks the array end */
- { "" }
-};
-
static size_t get_proptype_size(int type)
{
static const size_t parpropsize[NUM_PARPROP_TYPES] = {
@@ -175,7 +164,7 @@
}
}
-ParticlePropertyInfo *pset_property_add(ParticleSet *pset, char *name)
+ParticlePropertyInfo *pset_property_add(ParticleSet *pset, const char *name,
ParticlePropertyType type, int flags)
{
ParticlePropertyInfo *propinfo, *nproperties;
@@ -183,16 +172,14 @@
if (propinfo)
return propinfo;
- for (propinfo=pset_common_properties; strcmp(propinfo->name, name) !=
0; ++propinfo)
- if (propinfo->name[0] == '\0')
- return NULL;
-
/* construct new property array */
nproperties = MEM_callocN((pset->totprop + 1) *
sizeof(ParticlePropertyInfo), "ParticlePropertyInfo");
if (pset->totprop > 0)
memcpy(nproperties, pset->properties, pset->totprop *
sizeof(ParticlePropertyInfo));
- memcpy(nproperties + pset->totprop, propinfo,
sizeof(ParticlePropertyInfo));
- nproperties[pset->totprop].offset = -1;
+ strcpy(nproperties[pset->totprop].name, name);
+ nproperties[pset->totprop].type = type;
+ nproperties[pset->totprop].flag = flags;
+ nproperties[pset->totprop].offset = -1; /* must be intitialised
to -1 to indicate new property! */
if (pset->properties)
MEM_freeN(pset->properties);
@@ -288,16 +275,6 @@
return 1;
}
-static void pset_add_default_properties(ParticleSet *pset)
-{
- ParticlePropertyInfo *propinfo;
- for (propinfo=pset_common_properties; propinfo->name[0] != '\0';
++propinfo) {
- if ((propinfo->flag & PARPROP_DEFAULT) != 0) {
- pset_property_add(pset, propinfo->name);
- }
- }
-}
-
/* buffer management */
static void init_particle(ParticleSet *pset, NParticle *pa, int number)
{
@@ -858,7 +835,7 @@
pset->page_size = 1000;
- pset_add_default_properties(pset);
+ update_particle_size(pset);
/* add a nodetree modifier by default */
/* TODO */
Modified:
branches/particles-2010/source/blender/editors/particleset/particleset_edit.c
===================================================================
---
branches/particles-2010/source/blender/editors/particleset/particleset_edit.c
2010-10-28 12:43:27 UTC (rev 32755)
+++
branches/particles-2010/source/blender/editors/particleset/particleset_edit.c
2010-10-28 13:35:33 UTC (rev 32756)
@@ -147,77 +147,6 @@
ED_object_add_generic_props(ot, TRUE);
}
-/* ================= property_add ================= */
-static EnumPropertyItem pset_common_properties_items[] = {
-{ 0, "PLACEHOLDER", 0, "Placeholder", ""},
-{0, NULL, 0, NULL, NULL}};
-
-static int property_add_exec(bContext *C, wmOperator *op)
-{
- Object *ob = ED_object_active_context(C);
- ParticleSet *pset;
- int type= RNA_enum_get(op->ptr, "type");
-
- if (ob->type != OB_PSET)
- return OPERATOR_CANCELLED;
- pset = (ParticleSet*)ob->data;
-
- if (!pset_property_add(pset, pset_common_properties[type].name));
- return OPERATOR_CANCELLED;
-
- WM_event_add_notifier(C, NC_OBJECT|ND_DATA, ob);
-
- return OPERATOR_FINISHED;
-}
-
-static EnumPropertyItem *property_add_itemf(bContext *C, PointerRNA *ptr, int
*free)
-{
- EnumPropertyItem *item= NULL;
- EnumPropertyItem tmp = {0, "", 0, "", ""};
- ParticlePropertyInfo *propinfo;
- int totitem= 0, a;
-
- /* TODO check for existing properties! */
-// if(!ob)
-// return NULL;
-
- for (a=0, propinfo=pset_common_properties; propinfo->name[0] != '\0';
++a, ++propinfo) {
- tmp.identifier = propinfo->name;
- tmp.name= propinfo->name;
- tmp.value = a;
-
- RNA_enum_item_add(&item, &totitem, &tmp);
- }
-
- RNA_enum_item_end(&item, &totitem);
- *free= 1;
-
- return item;
-}
-
-void PARTICLESET_OT_property_add(wmOperatorType *ot)
-{
- PropertyRNA *prop;
-
- /* identifiers */
- ot->name= "Add Property";
- ot->description = "Add a property to the particles";
- ot->idname= "PARTICLESET_OT_property_add";
-
- /* api callbacks */
- ot->invoke= WM_menu_invoke;
- ot->exec= property_add_exec;
- ot->poll= ED_operator_object_active_editable;
-
- /* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
- /* properties */
- prop= RNA_def_enum(ot->srna, "type", pset_common_properties_items, 0,
"Type", "");
- RNA_def_enum_funcs(prop, property_add_itemf);
- ot->prop= prop;
-}
-
/* ================= property_remove ================= */
static int property_remove_exec(bContext *C, wmOperator *op)
{
Modified:
branches/particles-2010/source/blender/editors/particleset/particleset_intern.h
===================================================================
---
branches/particles-2010/source/blender/editors/particleset/particleset_intern.h
2010-10-28 12:43:27 UTC (rev 32755)
+++
branches/particles-2010/source/blender/editors/particleset/particleset_intern.h
2010-10-28 13:35:33 UTC (rev 32756)
@@ -32,7 +32,6 @@
/* editpointcloud.c */
void PARTICLESET_OT_primitive_particleset_add(struct wmOperatorType *ot);
-void PARTICLESET_OT_property_add(struct wmOperatorType *ot);
void PARTICLESET_OT_property_remove(struct wmOperatorType *ot);
void PARTICLESET_OT_property_moveup(struct wmOperatorType *ot);
void PARTICLESET_OT_property_movedown(struct wmOperatorType *ot);
Modified:
branches/particles-2010/source/blender/editors/particleset/particleset_ops.c
===================================================================
---
branches/particles-2010/source/blender/editors/particleset/particleset_ops.c
2010-10-28 12:43:27 UTC (rev 32755)
+++
branches/particles-2010/source/blender/editors/particleset/particleset_ops.c
2010-10-28 13:35:33 UTC (rev 32756)
@@ -56,7 +56,6 @@
void ED_operatortypes_particleset(void)
{
WM_operatortype_append(PARTICLESET_OT_primitive_particleset_add);
- WM_operatortype_append(PARTICLESET_OT_property_add);
WM_operatortype_append(PARTICLESET_OT_property_remove);
WM_operatortype_append(PARTICLESET_OT_property_moveup);
WM_operatortype_append(PARTICLESET_OT_property_movedown);
Modified: branches/particles-2010/source/blender/editors/space_node/drawnode.c
===================================================================
--- branches/particles-2010/source/blender/editors/space_node/drawnode.c
2010-10-28 12:43:27 UTC (rev 32755)
+++ branches/particles-2010/source/blender/editors/space_node/drawnode.c
2010-10-28 13:35:33 UTC (rev 32756)
@@ -1315,7 +1315,7 @@
if (!BLI_strcasestr(name, str))
return 1;
else
- return uiSearchItemAdd(items, name, (void*)identifier, icon);
+ return uiSearchItemAdd(items, name, (void*)name, icon);
}
static void getdata_add_property_search_cb(const bContext *C, void *arg, char
*str, uiSearchItems *items)
{
@@ -1416,7 +1416,7 @@
if (!BLI_strcasestr(name, str))
return 1;
else
- return uiSearchItemAdd(items, name, (void*)identifier, icon);
+ return uiSearchItemAdd(items, name, (void*)name, icon);
}
static void setdata_add_property_search_cb(const bContext *C, void *arg, char
*str, uiSearchItems *items)
{
Modified:
branches/particles-2010/source/blender/makesdna/DNA_particleset_types.h
===================================================================
--- branches/particles-2010/source/blender/makesdna/DNA_particleset_types.h
2010-10-28 12:43:27 UTC (rev 32755)
+++ branches/particles-2010/source/blender/makesdna/DNA_particleset_types.h
2010-10-28 13:35:33 UTC (rev 32756)
@@ -79,8 +79,6 @@
int mapoffset; /* previous
offset for restoring */
} ParticlePropertyInfo;
-extern ParticlePropertyInfo particle_std_properties[];
-
typedef struct NParticle {
int number;
char alive;
Modified:
branches/particles-2010/source/blender/nodes/intern/simulation/SIM_util.c
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/simulation/SIM_util.c
2010-10-28 12:43:27 UTC (rev 32755)
@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs