[Bf-blender-cvs] [89ff5976fbd] sculpt-mode-features: some improvement of the CSG UI
Martin Felke
noreply at git.blender.org
Tue Apr 9 10:45:01 CEST 2019
Commit: 89ff5976fbd6e164cd325673c84ca4978e112a1d
Author: Martin Felke
Date: Tue Apr 9 08:43:30 2019 +0200
Branches: sculpt-mode-features
https://developer.blender.org/rB89ff5976fbd6e164cd325673c84ca4978e112a1d
some improvement of the CSG UI
===================================================================
M release/scripts/startup/bl_ui/properties_data_modifier.py
M source/blender/editors/object/object_modifier.c
M source/blender/makesdna/DNA_modifier_types.h
M source/blender/makesrna/intern/rna_modifier.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 5233744dd3d..52697d1e0d5 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1220,16 +1220,23 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
layout.prop(md, "relax_triangles")
layout.prop(md, "reproject_vertex_paint")
layout.label(text="CSG Operands")
- layout.operator("remesh.csg_add", text="+")
+ layout.operator("remesh.csg_add", text="", icon="ADD")
for i,csg in enumerate(md.csg_operands):
box = layout.box()
row = box.row(align=True)
- row.prop(csg, "enabled", text="")
+ icon = "HIDE_ON"
+ if csg.enabled:
+ icon = "HIDE_OFF"
+ row.prop(csg, "enabled", text="", icon=icon, emboss=True)
row.prop(csg, "object", text="")
row.prop(csg, "operation", text="")
row = box.row(align=True)
+ icon = "RESTRICT_VIEW_ON"
+ if csg.sync_voxel_size:
+ icon = "RESTRICT_VIEW_OFF"
+ row.prop(csg, "sync_voxel_size", text="", icon=icon, emboss=True)
row.prop(csg, "voxel_size")
- row.operator("remesh.csg_remove", text="-").index = i
+ row.operator("remesh.csg_remove", text="", icon="REMOVE").index = i
row.operator("remesh.csg_move_up", text="", icon="TRIA_UP").index = i
row.operator("remesh.csg_move_down", text="", icon="TRIA_DOWN").index = i
else:
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 60080090050..5babeed6b9b 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -2420,8 +2420,9 @@ static int remesh_csg_add_exec(bContext *C, wmOperator *op)
}
CSGVolume_Object *vcob = MEM_callocN(sizeof(CSGVolume_Object), "vcob");
- vcob->voxel_size = 0.1f;
+ vcob->voxel_size = rmd->voxel_size;
vcob->flag |= MOD_REMESH_CSG_OBJECT_ENABLED;
+ vcob->flag |= MOD_REMESH_CSG_SYNC_VOXEL_SIZE;
BLI_addtail(&rmd->csg_operands, vcob);
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE);
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index d43be43ce8e..f07783df8e7 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -1533,10 +1533,12 @@ typedef enum eVoxelFilterBias{
typedef enum eCSGVolumeOperandFlags {
MOD_REMESH_CSG_OBJECT_ENABLED = (1 << 0),
+ MOD_REMESH_CSG_SYNC_VOXEL_SIZE = (1 << 1),
} eCSGVolumeOperandFlags;
typedef struct CSGVolume_Object {
struct CSGVolume_Object *next, *prev;
+ struct RemeshModifierData *md; //modifier we belong to
struct Object *object;
float voxel_size;
char operation;
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 97498ccc1e6..d4192e04fe2 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -645,6 +645,19 @@ static void rna_CSGVolume_object_set(PointerRNA *ptr, PointerRNA value)
vcob->object = ob;
}
+static void rna_RemeshModifier_voxel_size_set(PointerRNA *ptr, float value)
+{
+ RemeshModifierData *rmd = (RemeshModifierData *)ptr->data;
+ CSGVolume_Object *vcob;
+
+ rmd->voxel_size = value;
+ for (vcob = rmd->csg_operands.first; vcob; vcob = vcob->next) {
+ if (vcob->flag & MOD_REMESH_CSG_SYNC_VOXEL_SIZE) {
+ vcob->voxel_size = value;
+ }
+ }
+}
+
#undef RNA_MOD_OBJECT_SET
/* Other rna callbacks */
@@ -4174,6 +4187,7 @@ static void rna_def_modifier_remesh(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "voxel_size", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RemeshModifier_voxel_size_set", NULL);
RNA_def_property_range(prop, 0.001, 1.0);
RNA_def_property_float_default(prop, 0.1f);
RNA_def_property_ui_range(prop, 0.0001, 1, 0.01, 4);
@@ -4266,6 +4280,11 @@ static void rna_def_modifier_remesh(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_REMESH_CSG_OBJECT_ENABLED);
RNA_def_property_ui_text(prop, "Enabled", "Consider this object as part of the csg operations");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "sync_voxel_size", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_REMESH_CSG_SYNC_VOXEL_SIZE);
+ RNA_def_property_ui_text(prop, "Sync Voxel Size", "Consider this object as part of the csg operations");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_ocean(BlenderRNA *brna)
More information about the Bf-blender-cvs
mailing list