|
@@ -286,7 +286,7 @@ int OPINV_Select(laOperator *a, laEvent *e){
|
|
tnsObject*root=ui?ui->PP.EndInstance:0; if(!root) return 0;
|
|
tnsObject*root=ui?ui->PP.EndInstance:0; if(!root) return 0;
|
|
tnsMeshObject* mo=root->Active;
|
|
tnsMeshObject* mo=root->Active;
|
|
|
|
|
|
- int is_geo=0;
|
|
|
|
|
|
+ int is_geo=0, SelectMode=ex->SelectMode, ring_band=0;
|
|
if(strSame(strGetArgumentString(a->ExtraInstructionsP, "mode"), "toggle")){
|
|
if(strSame(strGetArgumentString(a->ExtraInstructionsP, "mode"), "toggle")){
|
|
if(mo && mo->Base.Type==TNS_OBJECT_MESH && mo->Mode==TNS_MESH_EDIT_MODE){
|
|
if(mo && mo->Base.Type==TNS_OBJECT_MESH && mo->Mode==TNS_MESH_EDIT_MODE){
|
|
if(tnsMMeshAnySelected(mo)) tnsMMeshDeselectAll(mo); else tnsMMeshSelectAll(mo);
|
|
if(tnsMMeshAnySelected(mo)) tnsMMeshDeselectAll(mo); else tnsMMeshSelectAll(mo);
|
|
@@ -297,6 +297,9 @@ int OPINV_Select(laOperator *a, laEvent *e){
|
|
laNotifyUsers("tns.world"); laRecordAndPush(0,"tns.world", "Toggle selection",is_geo?TNS_HINT_GEOMETRY:TNS_HINT_TRANSFORM);
|
|
laNotifyUsers("tns.world"); laRecordAndPush(0,"tns.world", "Toggle selection",is_geo?TNS_HINT_GEOMETRY:TNS_HINT_TRANSFORM);
|
|
return LA_FINISHED;
|
|
return LA_FINISHED;
|
|
}
|
|
}
|
|
|
|
+ int spk=e->SpecialKeyBit & (LA_KEY_CTRL|LA_KEY_ALT);
|
|
|
|
+ if(spk==LA_KEY_ALT){ ring_band=1; SelectMode=LA_CANVAS_SELECT_MODE_EDGES; }
|
|
|
|
+ elif(spk==(LA_KEY_CTRL|LA_KEY_ALT)){ ring_band=2; SelectMode=LA_CANVAS_SELECT_MODE_EDGES; }
|
|
|
|
|
|
MSelectData* sd=la_InitSelectData(ex->OffScr->pColor[0]->Width, ex->OffScr->pColor[0]->Height, c);
|
|
MSelectData* sd=la_InitSelectData(ex->OffScr->pColor[0]->Width, ex->OffScr->pColor[0]->Height, c);
|
|
|
|
|
|
@@ -304,15 +307,18 @@ int OPINV_Select(laOperator *a, laEvent *e){
|
|
int Append=e->SpecialKeyBit&LA_KEY_SHIFT; if(Append) DeselectAll=0;
|
|
int Append=e->SpecialKeyBit&LA_KEY_SHIFT; if(Append) DeselectAll=0;
|
|
|
|
|
|
if(mo && mo->Base.Type==TNS_OBJECT_MESH && mo->Mode==TNS_MESH_EDIT_MODE){
|
|
if(mo && mo->Base.Type==TNS_OBJECT_MESH && mo->Mode==TNS_MESH_EDIT_MODE){
|
|
- la_PopulateSelectDataPrimitives(sd, mo, ex->ViewingCamera, ex->SelectMode);
|
|
|
|
|
|
+ la_PopulateSelectDataPrimitives(sd, mo, ex->ViewingCamera, SelectMode);
|
|
if(strSame(strGetArgumentString(a->ExtraInstructionsP, "mode"), "box")){
|
|
if(strSame(strGetArgumentString(a->ExtraInstructionsP, "mode"), "box")){
|
|
MSelectExtra* se=memAcquire(sizeof(MSelectExtra));
|
|
MSelectExtra* se=memAcquire(sizeof(MSelectExtra));
|
|
ex->OnX=e->x; ex->OnX=e->y;
|
|
ex->OnX=e->x; ex->OnX=e->y;
|
|
a->CustomData=se; se->sd=sd; se->Mode=LA_SELECT_MODE_BOX; se->mo=mo; se->cam=c; ex->DrawCursor=1; se->root=root; return LA_RUNNING;
|
|
a->CustomData=se; se->sd=sd; se->Mode=LA_SELECT_MODE_BOX; se->mo=mo; se->cam=c; ex->DrawCursor=1; se->root=root; return LA_RUNNING;
|
|
}
|
|
}
|
|
int elemtype,id=la_SelectGetClosest(sd, e->x-ui->L, e->y-ui->U, LA_RH,&elemtype)-1;
|
|
int elemtype,id=la_SelectGetClosest(sd, e->x-ui->L, e->y-ui->U, LA_RH,&elemtype)-1;
|
|
- void* p=la_SelectGetRef(sd,id,elemtype); printf("%d %d\n",id,elemtype);
|
|
|
|
- la_DoMeshSelect(mo, p, ex->SelectMode, DeselectAll, 1, 1); tnsMMeshEnsureSelection(mo,ex->SelectMode);
|
|
|
|
|
|
+ void* p=la_SelectGetRef(sd,id,elemtype);
|
|
|
|
+ la_DoMeshSelect(mo, p, SelectMode, DeselectAll, 1, 1); tnsMMeshEnsureSelection(mo,ex->SelectMode);
|
|
|
|
+ if(ring_band && p){
|
|
|
|
+ tnsMMeshSelectRingBandFrom(mo,p,ring_band,1,Append); tnsMMeshEnsureSelection(mo,ex->SelectMode);
|
|
|
|
+ }
|
|
tnsInvalidateMeshBatch(mo);
|
|
tnsInvalidateMeshBatch(mo);
|
|
laNotifyUsers("tns.world"); laRecordAndPush(0,"tns.world","Mesh selection",TNS_HINT_GEOMETRY);
|
|
laNotifyUsers("tns.world"); laRecordAndPush(0,"tns.world","Mesh selection",TNS_HINT_GEOMETRY);
|
|
}else{
|
|
}else{
|
|
@@ -322,7 +328,7 @@ int OPINV_Select(laOperator *a, laEvent *e){
|
|
ex->OnX=e->x; ex->OnX=e->y;
|
|
ex->OnX=e->x; ex->OnX=e->y;
|
|
a->CustomData=se; se->sd=sd; se->Mode=LA_SELECT_MODE_BOX; se->cam=c; ex->DrawCursor=1; se->root=root; return LA_RUNNING;
|
|
a->CustomData=se; se->sd=sd; se->Mode=LA_SELECT_MODE_BOX; se->cam=c; ex->DrawCursor=1; se->root=root; return LA_RUNNING;
|
|
}
|
|
}
|
|
- int elemtype,id=la_SelectGetClosest(sd, e->x-ui->L, e->y-ui->U, LA_RH*2,&elemtype); printf("%d\n",elemtype);
|
|
|
|
|
|
+ int elemtype,id=la_SelectGetClosest(sd, e->x-ui->L, e->y-ui->U, LA_RH*2,&elemtype);
|
|
void* p=la_SelectGetRef(sd,id,elemtype); if(p){ la_DoObjectSelect(root, p, ex, DeselectAll, 1, 1); }
|
|
void* p=la_SelectGetRef(sd,id,elemtype); if(p){ la_DoObjectSelect(root, p, ex, DeselectAll, 1, 1); }
|
|
else{ la_DoObjectSelect(root, 0, ex, DeselectAll, 1, 1); }
|
|
else{ la_DoObjectSelect(root, 0, ex, DeselectAll, 1, 1); }
|
|
laNotifyUsers("tns.world"); laRecordAndPush(0,"tns.world","Object selection",TNS_HINT_TRANSFORM);
|
|
laNotifyUsers("tns.world"); laRecordAndPush(0,"tns.world","Object selection",TNS_HINT_TRANSFORM);
|
|
@@ -460,14 +466,14 @@ int la_PopulateTransformVerticies(MTransformData* td, tnsMeshObject* mo){
|
|
tnsInverse44d(td->obmatinv, mo->Base.GlobalTransform);
|
|
tnsInverse44d(td->obmatinv, mo->Base.GlobalTransform);
|
|
for(tnsMVert* mv=mo->mv.pFirst;mv;mv=mv->Item.pNext){
|
|
for(tnsMVert* mv=mo->mv.pFirst;mv;mv=mv->Item.pNext){
|
|
if(!(mv->flags&TNS_MESH_FLAG_SELECTED)) continue;
|
|
if(!(mv->flags&TNS_MESH_FLAG_SELECTED)) continue;
|
|
- printf("v %d ",mv->i);
|
|
|
|
|
|
+ //printf("v %d ",mv->i);
|
|
arrEnsureLength(&td->Originals, td->next, &td->max, sizeof(MTOrigMVert));
|
|
arrEnsureLength(&td->Originals, td->next, &td->max, sizeof(MTOrigMVert));
|
|
MTOrigMVert* to=arrElement(td->Originals, td->next, sizeof(MTOrigMVert)); td->next++; to->mv=mv;
|
|
MTOrigMVert* to=arrElement(td->Originals, td->next, sizeof(MTOrigMVert)); td->next++; to->mv=mv;
|
|
tnsApplyTransform43d(to->p, mo->Base.GlobalTransform, mv->p);
|
|
tnsApplyTransform43d(to->p, mo->Base.GlobalTransform, mv->p);
|
|
memcpy(to->origp, mv->p, sizeof(tnsVector3d)); any++;
|
|
memcpy(to->origp, mv->p, sizeof(tnsVector3d)); any++;
|
|
tnsVectorAccum3d(td->TCenter,to->p);
|
|
tnsVectorAccum3d(td->TCenter,to->p);
|
|
}
|
|
}
|
|
- printf(" [totmv %d]\n",mo->totmv);
|
|
|
|
|
|
+ //printf(" [totmv %d]\n",mo->totmv);
|
|
tnsVectorMultiSelf3d(td->TCenter, 1.0f/any);
|
|
tnsVectorMultiSelf3d(td->TCenter, 1.0f/any);
|
|
la_GetTransformCenter2D(td);
|
|
la_GetTransformCenter2D(td);
|
|
return any;
|
|
return any;
|