|
@@ -135,6 +135,7 @@ void la_PopulateSelectDataObjects(MSelectData* sd, tnsObject* root, laCanvasExtr
|
|
glClearColor(0,0,0,0); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glEnable(GL_DEPTH_TEST);
|
|
glClearColor(0,0,0,0); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glEnable(GL_DEPTH_TEST);
|
|
tnsInvalidateEvaluation(root); tnsSetObjectTreeEvaluationArgs(root,root->Active,1,1); tnsEvaluateObjectTree(root,0,0);
|
|
tnsInvalidateEvaluation(root); tnsSetObjectTreeEvaluationArgs(root,root->Active,1,1); tnsEvaluateObjectTree(root,0,0);
|
|
tnsDrawObjectTree(root,TNS_EVAL_LAYER_SELECTION,&de,0);
|
|
tnsDrawObjectTree(root,TNS_EVAL_LAYER_SELECTION,&de,0);
|
|
|
|
+ tnsDrawObjectOrigins(root,root->Active,1); tnsFlush();
|
|
glDisable(GL_DEPTH_TEST);
|
|
glDisable(GL_DEPTH_TEST);
|
|
|
|
|
|
nvgEndFrame(vg); tnsRestoreFromNanoVG(); tnsEnableShaderv(T->immShader);
|
|
nvgEndFrame(vg); tnsRestoreFromNanoVG(); tnsEnableShaderv(T->immShader);
|
|
@@ -472,6 +473,23 @@ int OPMOD_Select(laOperator *a, laEvent *e){
|
|
return LA_RUNNING;
|
|
return LA_RUNNING;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+int OPINV_SelectLinked(laOperator *a, laEvent *e){
|
|
|
|
+ if(!a->This || !a->This->EndInstance){ return 0; }
|
|
|
|
+ laCanvasExtra* ex=a->This->EndInstance; tnsCamera*c=ex->ViewingCamera; laUiItem* ui=ex->ParentUi;
|
|
|
|
+ tnsObject*root=ui?ui->PP.EndInstance:0; if(!root) return 0;
|
|
|
|
+ tnsObject* o=root->Active; tnsMeshObject* mo=o; tnsShapeObject* so=o;
|
|
|
|
+
|
|
|
|
+ if(o&&o->Type==TNS_OBJECT_MESH && mo->Mode==TNS_MESH_EDIT_MODE){
|
|
|
|
+ tnsMMeshSelectLinked(mo); tnsInvalidateMeshBatch(mo);
|
|
|
|
+ laNotifyUsers("tns.world"); laRecordAndPush(0,"tns.world","Mesh selection",TNS_HINT_GEOMETRY);
|
|
|
|
+ }elif(o&&o->Type==TNS_OBJECT_SHAPE && so->Mode==TNS_MESH_EDIT_MODE){
|
|
|
|
+ tnsShapeSelectLinked(so);
|
|
|
|
+ laNotifyUsers("tns.world"); laRecordAndPush(0,"tns.world","Shape selection",TNS_HINT_GEOMETRY);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return LA_FINISHED_PASS;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
|
|
#define LA_TRANSFORM_MODE_GRAB 1
|
|
#define LA_TRANSFORM_MODE_GRAB 1
|
|
#define LA_TRANSFORM_MODE_ROTATE 2
|
|
#define LA_TRANSFORM_MODE_ROTATE 2
|
|
@@ -1281,7 +1299,7 @@ int OPINV_Delete(laOperator *a, laEvent *e){
|
|
tnsMMeshRefreshIndex(mo);
|
|
tnsMMeshRefreshIndex(mo);
|
|
tnsInvalidateMeshBatch(mo);
|
|
tnsInvalidateMeshBatch(mo);
|
|
laRecordInstanceDifferences(mo, "tns_mesh_object"); laPushDifferences("Deleted primitives", TNS_HINT_GEOMETRY); laNotifyUsers("tns.world");
|
|
laRecordInstanceDifferences(mo, "tns_mesh_object"); laPushDifferences("Deleted primitives", TNS_HINT_GEOMETRY); laNotifyUsers("tns.world");
|
|
- }if(so->Base.Type==TNS_OBJECT_SHAPE && so->Mode==TNS_MESH_EDIT_MODE){
|
|
|
|
|
|
+ }elif(so->Base.Type==TNS_OBJECT_SHAPE && so->Mode==TNS_MESH_EDIT_MODE){
|
|
if(!tnsShapeAnySelected(so)) return LA_FINISHED;
|
|
if(!tnsShapeAnySelected(so)) return LA_FINISHED;
|
|
char* split=strGetArgumentString(a->ExtraInstructionsP, "split");
|
|
char* split=strGetArgumentString(a->ExtraInstructionsP, "split");
|
|
if(split){
|
|
if(split){
|
|
@@ -1483,11 +1501,12 @@ int OPINV_Add(laOperator *a, laEvent *e){
|
|
if(!a->This || !a->This->EndInstance){ return 0; }
|
|
if(!a->This || !a->This->EndInstance){ return 0; }
|
|
laCanvasExtra* ex=a->This->EndInstance; tnsCamera*c=ex->ViewingCamera; laUiItem* ui=ex->ParentUi;
|
|
laCanvasExtra* ex=a->This->EndInstance; tnsCamera*c=ex->ViewingCamera; laUiItem* ui=ex->ParentUi;
|
|
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; int ran=0; tnsObject* no=0;
|
|
|
|
|
|
+ tnsMeshObject* mo=root->Active; tnsShapeObject* so=mo;int ran=0; tnsObject* no=0;
|
|
laObjectAddData *ad=memAcquire(sizeof(laObjectAddData));a->CustomData=ad;
|
|
laObjectAddData *ad=memAcquire(sizeof(laObjectAddData));a->CustomData=ad;
|
|
char* str=strGetArgumentString(a->ExtraInstructionsP, "mode");
|
|
char* str=strGetArgumentString(a->ExtraInstructionsP, "mode");
|
|
|
|
|
|
- if((!mo) || mo->Base.Type!=TNS_OBJECT_MESH || mo->Mode!=TNS_MESH_EDIT_MODE){ ad->Context=LA_ADD_CTX_OBJECT;
|
|
|
|
|
|
+ if((!mo) || (mo->Base.Type==TNS_OBJECT_MESH && mo->Mode!=TNS_MESH_EDIT_MODE) ||
|
|
|
|
+ (so->Base.Type==TNS_OBJECT_SHAPE && so->Mode!=TNS_MESH_EDIT_MODE)){ ad->Context=LA_ADD_CTX_OBJECT;
|
|
if(strSame(str,"PLANE")){ tnsDeselectAllObjects(root);
|
|
if(strSame(str,"PLANE")){ tnsDeselectAllObjects(root);
|
|
no=tnsCreateMeshPlane(root, "Plane",0,0,0,1); no->Flags|=TNS_OBJECT_FLAGS_SELECTED; memAssignRef(root,&root->Active,no); ran=1; }
|
|
no=tnsCreateMeshPlane(root, "Plane",0,0,0,1); no->Flags|=TNS_OBJECT_FLAGS_SELECTED; memAssignRef(root,&root->Active,no); ran=1; }
|
|
elif(strSame(str,"INSTANCER")){ tnsDeselectAllObjects(root);
|
|
elif(strSame(str,"INSTANCER")){ tnsDeselectAllObjects(root);
|
|
@@ -1496,7 +1515,7 @@ int OPINV_Add(laOperator *a, laEvent *e){
|
|
no=tnsCreateShapeSquare(root, "Square",0,0,0,1); no->Flags|=TNS_OBJECT_FLAGS_SELECTED; memAssignRef(root,&root->Active,no); ran=1; }
|
|
no=tnsCreateShapeSquare(root, "Square",0,0,0,1); no->Flags|=TNS_OBJECT_FLAGS_SELECTED; memAssignRef(root,&root->Active,no); ran=1; }
|
|
else{ laEnableOperatorPanel(a,a->This,e->x,e->y,200,200,0,0,0,0,0,0,0,0,e); return LA_RUNNING; }
|
|
else{ laEnableOperatorPanel(a,a->This,e->x,e->y,200,200,0,0,0,0,0,0,0,0,e); return LA_RUNNING; }
|
|
if(ran){ laRecordAndPush(0,"tns.world","Add object",TNS_HINT_GEOMETRY); laNotifyUsers("tns.world"); }
|
|
if(ran){ laRecordAndPush(0,"tns.world","Add object",TNS_HINT_GEOMETRY); laNotifyUsers("tns.world"); }
|
|
- }elif(mo->Base.Type==TNS_OBJECT_MESH && mo->Mode!=TNS_MESH_EDIT_MODE){ ad->Context=LA_ADD_CTX_MESH;
|
|
|
|
|
|
+ }elif(mo->Base.Type==TNS_OBJECT_MESH && mo->Mode==TNS_MESH_EDIT_MODE){ ad->Context=LA_ADD_CTX_MESH;
|
|
if(strSame(str,"PLANE")){
|
|
if(strSame(str,"PLANE")){
|
|
tnsMMeshDeselectAll(mo); tnsAddMMeshPlane(mo, 1); tnsMMeshEnsureSelection(mo,ex->SelectMode); ran=1;
|
|
tnsMMeshDeselectAll(mo); tnsAddMMeshPlane(mo, 1); tnsMMeshEnsureSelection(mo,ex->SelectMode); ran=1;
|
|
}else{ laEnableOperatorPanel(a,a->This,e->x,e->y,200,200,0,0,0,0,0,0,0,0,e); return LA_RUNNING; }
|
|
}else{ laEnableOperatorPanel(a,a->This,e->x,e->y,200,200,0,0,0,0,0,0,0,0,e); return LA_RUNNING; }
|
|
@@ -1504,14 +1523,12 @@ int OPINV_Add(laOperator *a, laEvent *e){
|
|
tnsMMeshRefreshIndex(mo); tnsInvalidateMeshBatch(mo);
|
|
tnsMMeshRefreshIndex(mo); tnsInvalidateMeshBatch(mo);
|
|
laRecordInstanceDifferences(mo, "tns_mesh_object"); laPushDifferences("Add primitives", TNS_HINT_GEOMETRY); laNotifyUsers("tns.world");
|
|
laRecordInstanceDifferences(mo, "tns_mesh_object"); laPushDifferences("Add primitives", TNS_HINT_GEOMETRY); laNotifyUsers("tns.world");
|
|
}
|
|
}
|
|
- }elif(mo->Base.Type==TNS_OBJECT_SHAPE && mo->Mode!=TNS_MESH_EDIT_MODE){ ad->Context=LA_ADD_CTX_SHAPE;
|
|
|
|
|
|
+ }elif(so->Base.Type==TNS_OBJECT_SHAPE && so->Mode==TNS_MESH_EDIT_MODE){ ad->Context=LA_ADD_CTX_SHAPE;
|
|
if(strSame(str,"SQUARE")){
|
|
if(strSame(str,"SQUARE")){
|
|
- //stuff
|
|
|
|
- ran=1;
|
|
|
|
|
|
+ tnsShapeDeselectAll(so); tnsInitShapeSquare(so,1); ran=1;
|
|
}else{ laEnableOperatorPanel(a,a->This,e->x,e->y,200,200,0,0,0,0,0,0,0,0,e); return LA_RUNNING; }
|
|
}else{ laEnableOperatorPanel(a,a->This,e->x,e->y,200,200,0,0,0,0,0,0,0,0,e); return LA_RUNNING; }
|
|
if(ran){
|
|
if(ran){
|
|
- //stuff
|
|
|
|
- laRecordInstanceDifferences(mo, "tns_shape_object"); laPushDifferences("Add primitives", TNS_HINT_GEOMETRY); laNotifyUsers("tns.world");
|
|
|
|
|
|
+ laRecordInstanceDifferences(so, "tns_shape_object"); laPushDifferences("Add shape", TNS_HINT_GEOMETRY); laNotifyUsers("tns.world");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return LA_FINISHED;
|
|
return LA_FINISHED;
|
|
@@ -2022,6 +2039,7 @@ void la_RegisterModellingOperators(){
|
|
laAddEnumItemAs(p,"OBJECT","Object","Object context",LA_ADD_CTX_OBJECT,0);
|
|
laAddEnumItemAs(p,"OBJECT","Object","Object context",LA_ADD_CTX_OBJECT,0);
|
|
laAddEnumItemAs(p,"MESH","Mesh","Mesh context",LA_ADD_CTX_MESH,0);
|
|
laAddEnumItemAs(p,"MESH","Mesh","Mesh context",LA_ADD_CTX_MESH,0);
|
|
laAddEnumItemAs(p,"SHAPE","Shape","Shape context",LA_ADD_CTX_SHAPE,0);
|
|
laAddEnumItemAs(p,"SHAPE","Shape","Shape context",LA_ADD_CTX_SHAPE,0);
|
|
|
|
+ laCreateOperatorType("M_select_linked", "Select Linked", "Select linked geometry or shapes", OPCHK_ViewportAndSceneExists, 0, 0, OPINV_SelectLinked, 0, 0, LA_EXTRA_TO_PANEL);
|
|
|
|
|
|
laCreateOperatorType("M_separate", "Separate", "Separate mesh parts", 0, 0, 0, OPINV_Separate, 0, 0, 0);
|
|
laCreateOperatorType("M_separate", "Separate", "Separate mesh parts", 0, 0, 0, OPINV_Separate, 0, 0, 0);
|
|
laCreateOperatorType("M_combine", "Combine", "Combine mesh objects", 0, 0, 0, OPINV_Combine, 0, 0, 0);
|
|
laCreateOperatorType("M_combine", "Combine", "Combine mesh objects", 0, 0, 0, OPINV_Combine, 0, 0, 0);
|