Page MenuHome

Remove duplicate of map_mode
AbandonedPublic

Authored by Ivan Perevala (ivpe) on Oct 20 2020, 11:15 PM.

Details

Summary

Remove duplicate of map_mode
Also should be replaced tex_paint_map_mode > map_mode
in \release\scripts\addons\space_view3d_brush_menus\texture_menu.py
but there the GIT did not recognize my changes.

It was the only places where tex_paint_map_mode exist.

Diff Detail

Repository
rB Blender
Branch
arcpatch-D9290 (branched from master)
Build Status
Buildable 10925
Build 10925: arc lint + arc unit

Event Timeline

Ivan Perevala (ivpe) requested review of this revision.Oct 20 2020, 11:15 PM
Jeroen Bakker (jbakker) requested changes to this revision.Oct 21 2020, 12:04 PM

Add-ons are located in a different git repository. These changes needs to be send in a separate patch.
My main concern is that AREA_PLANE is now visible in texture paint mode.

source/blender/makesrna/intern/rna_brush.c
1027

This item is only valid for sculpt mode. you could add a itemf function based on the context but that might not be trival to add. Current solution to show it also when texture painting gives a false impression to the user.

This revision now requires changes to proceed.Oct 21 2020, 12:04 PM

@Jeroen Bakker (jbakker) Is it correct not to remove this enum from RNA, but to correct the relationships in the python modules? At the moment map_mode is also used in places where tex_paint_map_mode should be

I expect to that the prop_map_mode_items is moved outside the function and add a similar function like this.

static const EnumPropertyItem *rna_BrushTextureSlot_map_mode_itemf(bContext *C,
                                                                   PointerRNA *UNUSED(ptr),
                                                                   PropertyRNA *UNUSED(prop),
                                                                   bool *r_free)
{
  const bool in_sculpt_mode = ... /* to be completed */

  int totitem = 0;
  EnumPropertyItem *result = NULL;
  for (int i = 0; rna_brush_texture_slot_map_mode_items[i].identifier != NULL; i++) {
    const EnumPropertyItem *item = &rna_brush_texture_slot_map_mode_items[i];
    if (item->value != MTEX_MAP_MODE_AREA || in_sculpt_mode) {
      RNA_enum_item_add(&result, &totitem, item);
    }
  }

  RNA_enum_item_end(&result, &totitem);
  *r_free = true;
  return result;
}

With an itemf function it is possible to set the possible enum values based on the context that the user is working on. Here for example when the user is in sculpt mode all values are displayed, but when in texture mode the area isn't.

This function should be linked to the map_mode rna property with RNA_def_property_enum_funcs.

Ivan Perevala (ivpe) updated this revision to Diff 30223.EditedOct 21 2020, 3:56 PM
  • Update
  • Update rna_brush.c
  • Update rna_brush.c
  • Update rna_brush.c
  • Update rna_brush.c
source/blender/makesrna/intern/rna_brush.c
1071–1079

I am not sure about this

Jeroen Bakker (jbakker) requested changes to this revision.Oct 22 2020, 10:37 AM
Jeroen Bakker (jbakker) added inline comments.
source/blender/makesrna/intern/rna_brush.c
1071–1079

You're right. Only one needs to be available. You can always check how other itemf functions solve this. Eg render pass in the viewport popover.

This revision now requires changes to proceed.Oct 22 2020, 10:37 AM
  • Update rna_brush.c
Ivan Perevala (ivpe) marked 2 inline comments as done.Oct 22 2020, 9:05 PM

Looks like done (but also not by myself ;))

Jeroen Bakker (jbakker) requested changes to this revision.Oct 26 2020, 9:36 AM
Jeroen Bakker (jbakker) added inline comments.
source/blender/makesrna/intern/rna_brush.c
82

Should start with rna_enum_ but the rest of the patch seems fine.

This revision now requires changes to proceed.Oct 26 2020, 9:36 AM
  • Update rna_brush.c
Ivan Perevala (ivpe) marked an inline comment as done.Oct 26 2020, 5:38 PM

Committed rBeebe27431286: RNA: remove duplicate of Brush.tex_paint_map_mode with minor change (support NULL context, no need for allocation).

Also updated the one add-on that used this.