Пример #1
0
// SCWP_Activate
XCALL_ (int) SCWP_Activate( long version, GlobalFunc *global,
                            void *local, void *serverData ) {
  if ( version != LWMODCOMMAND_VERSION )
    return AFUNC_BADVERSION;

  LWModCommand * command = (LWModCommand *)local;
  if( command == NULL )
    return AFUNC_BADLOCAL;

  // Build a list of parts for the selected polygons
  MeshEditOp *op = (command->editBegin)( 0, 0, OPSEL_DIRECT | OPSEL_MODIFY );
  parts.Flush();

  EDError err = op->polyScan( op->state, SCWP_PolyScan_FindParts, (void *)op, OPLYR_FG );
  if( err != EDERR_NONE ) {
    op->done( op->state, err, 0 );
  } else {
    // Select polygons belonging to the selected parts
    err = op->polyScan( op->state, SCWP_PolyScan_Select, (void *)op, OPLYR_FG );
    op->done( op->state, err, 0 );
  }

  // Clean up
  parts.Flush();

  return CSERR_NONE;
}
Пример #2
0
meZFacing( long version, GlobalFunc *global, MeshEditBegin *local,
           void *serverData )
{
    MeshEditOp *edit;
    EDError err = EDERR_NONE;

    edit = local( 0, 0, OPSEL_DIRECT | OPSEL_MODIFY );
    if ( !edit ) return AFUNC_BADLOCAL;

    err = edit->polyScan( edit->state, polscan, edit, OPLYR_PRIMARY );
    edit->done( edit->state, err, 0 );

    return AFUNC_OK;
}
Пример #3
0
csZFacing( long version, GlobalFunc *global, LWModCommand *local,
           void *serverData )
{
    MeshEditOp *edit;
    EDError err = EDERR_NONE;

    /* ... some commands ... */

    edit = local->editBegin( 0, 0, OPSEL_DIRECT | OPSEL_MODIFY );
    if ( !edit ) return AFUNC_BADLOCAL;

    err = edit->polyScan( edit->state, polscan, edit, OPLYR_PRIMARY );
    edit->done( edit->state, err, 0 );

    /* ... some more commands ... */

    return AFUNC_OK;
}
Пример #4
0
// SCWSS_Activate
XCALL_ (int) SCWSS_Activate( long version, GlobalFunc *global,
                             void *local, void *serverData ) {
  if ( version != LWMODCOMMAND_VERSION )
    return AFUNC_BADVERSION;

  LWModCommand * command = (LWModCommand *)local;
  if( command == NULL )
    return AFUNC_BADLOCAL;

  // Setup
  object_funcs   = (LWObjectFuncs *)global( LWOBJECTFUNCS_GLOBAL, GFUSE_TRANSIENT );
  vmap_count = object_funcs->numVMaps( LWVMAP_PICK );

  // Build a list of selection_set_ids for the selected polygons
  MeshEditOp *op = (command->editBegin)( 0, 0, OPSEL_DIRECT | OPSEL_MODIFY );
  selection_set_ids.Flush();

  EDError err = op->pointScan( op->state, SCWSS_PointScan_FindSets, (void *)op, OPLYR_FG );
  if( err != EDERR_NONE ) {
    op->done( op->state, err, 0 );
  } else {
    // If there are multiple selection sets, ask the user which one(s) they want
    bool do_select = true;
    if( selection_set_ids.NumElements() > 1 ) {
      // Get some globals
      ContextMenuFuncs *context_funcs = (ContextMenuFuncs *)global( LWCONTEXTMENU_GLOBAL, GFUSE_TRANSIENT );
      LWPanelFuncs     *panel_funcs   = (LWPanelFuncs     *)global( LWPANELFUNCS_GLOBAL,  GFUSE_TRANSIENT );

      // Set up te context menu
      LWPanPopupDesc menu_desc;
      menu_desc.type    = LWT_POPUP;
      menu_desc.width   = 200;
      menu_desc.countFn = SelSetCount;
      menu_desc.nameFn  = SelSetName;

      // Set up the panel, open the menu and clean up
      LWPanelID panel = panel_funcs->create( "Selection Sets", panel_funcs );

      LWContextMenuID menu = context_funcs->cmenuCreate( &menu_desc, NULL );
      int index = context_funcs->cmenuDeploy( menu, panel, 0 );
      context_funcs->cmenuDestroy( menu );

      panel_funcs->destroy( panel );

      // Limit to a single selection set or abort, if applicable
      if( index == -1 ) {
        do_select = false;
      } else if( index != (int)selection_set_names.NumElements() ) {
        void *id = selection_set_ids[ index ];
        selection_set_ids.Reset();
        selection_set_ids.Add( id );
      }
    }

    if( do_select ) {
      // Select points belonging to the selected selection sets
      err = op->pointScan( op->state, SCWSS_PointScan_Select, (void *)op, OPLYR_FG );
      op->done( op->state, err, 0 );
    }
  }

  // Clean up
  selection_set_ids.Reset();
  selection_set_names.Flush();

  return CSERR_NONE;
}