*/}}
Browse Source

Action UI basics WIP

YimingWu 1 year ago
parent
commit
0c72a8fc97
10 changed files with 199 additions and 31 deletions
  1. 150 10
      la_animation.c
  2. 13 0
      la_data.c
  3. 4 1
      la_data.h
  4. 4 1
      la_interface.h
  5. 14 3
      la_kernel.c
  6. 5 5
      la_resource.c
  7. 3 0
      la_tns.h
  8. 4 2
      la_tns_kernel.c
  9. 0 7
      resources/la_properties.c
  10. 2 2
      resources/la_widgets_viewers.c

+ 150 - 10
la_animation.c

@@ -41,7 +41,9 @@ laActionChannel* laAnimationEnsureChannel(laAction* aa, void* hyper1, laProp* p)
     acf=memAcquire(sizeof(laActionChannel));
     memAssignRef(acf,&acf->For,hyper1); acf->Prop=p;
     acf->DataSize = DataSize;
-    lstAppendItem(&aa->Channels,acf);
+    char _name[128]={0}, *name=_name; laTryGetInstanceIdentifier(hyper1, p->Container,_name,&name);
+    strSafeSet(&acf->CachedName,name); strSafePrint(&acf->CachedName," ⯈ %s",p->Identifier);
+    lstAppendItem(&aa->Channels,acf); laNotifyUsers("la.animation.current_action.channels");
     return acf;
 }
 laActionChannel* laAnimationEnsureFrame(laActionChannel* ac, int frame){
@@ -53,7 +55,7 @@ laActionChannel* laAnimationEnsureFrame(laActionChannel* ac, int frame){
         akf=memAcquireSimple(sizeof(laActionKey)-sizeof(uint64_t)+ac->DataSize);
         akf->At=frame;
         if(beforeakf){ lstInsertItemBefore(&ac->Keys, akf, beforeakf); }
-        lstAppendItem(&ac->Keys, akf);
+        else{ lstAppendItem(&ac->Keys, akf); }
     }
     return akf;
 }
@@ -73,6 +75,7 @@ laActionKey* laAnimationInsertKeyFrame(laAction* aa, void* hyper1, laProp* p){
     int frame=LA_ACTION_FRAME(aa);
     laActionKey* ak=laAnimationEnsureFrame(ac,frame);
     laAnimationStoreKeyValue(ac,ak);
+    laNotifyUsers("la.animation.current_action");
     return ak;
 }
 
@@ -168,6 +171,7 @@ void la_AnimationEvaluateActions(){
 void la_AnimationPreFrame(){
     if(MAIN.Animation->PlayHead<0){
         MAIN.Animation->PlayHead=0; laAnimationSetPlayStatus(0);
+        la_AnimationEvaluateActions();
         laNotifyUsers("la.animation.play_head");
     }
     if(MAIN.Animation->PlayStatus){
@@ -184,41 +188,177 @@ void la_AnimationPostFrame(){
     }
 }
 
+void laget_AnimationChannelName(laActionChannel *p, char *result, char** here){
+    
+}
 
 int LAMOD_AnimationActionsCanvas(laOperator *a, laEvent *e){
     laUiItem *ui = a->Instance; laBoxedTheme *bt = (*ui->Type->Theme);
     laCanvasExtra *ex = a->CustomData; laAction* aa=ui->PP.EndInstance;
     if(!aa) LA_RUNNING_PASS;
+    int W, H; W = ui->R - ui->L; H = ui->B - ui->U;
+    int ShowSide=(ex->ShowLegend&&ex->LW<W-2*LA_RH);
+    int ll=ui->L, lr=ll+(ShowSide?ex->LW:0), tl=lr, tr=ui->R;
+    int FW=LA_RH/2;
+    int Channels=aa?lstCountElements(&aa->Channels):0;
+    int Modal=0; int mid=((W-lr)/2);
+    
+    if(e->Type==LA_M_MOUSE_DOWN){
+        ex->UiMode=1; ex->ClickedX=e->x; ex->ClickedY=e->y; Modal=1; ex->Dragging=10;
+    }elif(e->Type==LA_M_MOUSE_UP || e->Type==LA_L_MOUSE_UP){
+        ex->UiMode=0; Modal=1; ex->Dragging=0; ex->TargetIndexVali=0;
+    }
+    if(ex->UiMode==1){
+        if(e->Type&LA_MOUSE_EVENT){
+            ex->PanY-=e->y-ex->ClickedY; ex->PanX-=e->x-ex->ClickedX;
+            ex->ClickedX=e->x; ex->ClickedY=e->y; Modal=1;
+        }
+    }elif(ex->UiMode==2){
+        if(e->Type&LA_MOUSE_EVENT){
+            ex->LW=e->x-ui->L+LA_SEAM_W; ex->ClickedX=e->x; ex->ClickedY=e->y; Modal=1;
+            if(ex->LW<LA_RH*3 && ex->LW>=LA_RH/2){ ex->LW=LA_RH*3; }
+            if(ex->LW<LA_RH/2 && ex->Dragging!=12){ ex->ShowLegend=0; ex->LW=0; }
+            if(ex->LW<LA_RH*3){ ex->LW=LA_RH*3;}
+        }
+    }
+
+    int MaxDN=LA_RH*(Channels+1)-H+bt->TP+bt->BP; if(MaxDN<0) MaxDN=0;
+    if(!Modal){
+        if(e->x<=lr){
+            if(e->Type==LA_MOUSE_WHEEL_DOWN){ ex->PanY+=LA_RH*MAIN.ScrollingSpeed; Modal=1; }
+            if(e->Type==LA_MOUSE_WHEEL_UP){ ex->PanY-=LA_RH*MAIN.ScrollingSpeed; Modal=1; }
+            if(e->x>=lr-LA_SEAM_W*2){ if(!ex->TargetIndexVali){ ex->TargetIndexVali=1; Modal=1; }
+                if(e->Type==LA_L_MOUSE_DOWN){
+                    ex->UiMode=2; ex->ClickedX=e->x; ex->ClickedY=e->y; Modal=1; ex->Dragging=10; Modal=1;
+                }
+            }else{ if(ex->TargetIndexVali){ ex->TargetIndexVali=0; Modal=1; } }
+        }else{
+            if((!ex->ShowLegend)&&e->x<=ll+LA_SEAM_W*2){
+                if(!ex->TargetIndexVali){ ex->TargetIndexVali=1; Modal=1; }
+                if(e->Type==LA_L_MOUSE_DOWN){ ex->LW=LA_RH*4; ex->Dragging=12; ex->ShowLegend=1; Modal=1; ex->UiMode=2; ex->TargetIndexVali=1; }
+            }else{ if(ex->TargetIndexVali){ ex->TargetIndexVali=0; Modal=1; } }
+            if(e->Type==LA_MOUSE_WHEEL_DOWN){ ex->ZoomX*=0.9; ex->PanX+=mid; ex->PanX*=0.9; ex->PanX-=mid; Modal=1; }
+            if(e->Type==LA_MOUSE_WHEEL_UP){ ex->ZoomX*=1.1; ex->PanX+=mid; ex->PanX*=1.1; ex->PanX-=mid; Modal=1; }
+        }
+    }
+    if(ex->PanY>MaxDN){ ex->PanY=MaxDN; } if(ex->PanY<0){ ex->PanY=0; }
+    if(ex->PanX<0){ ex->PanX=0; }
+
+    if(ex->TargetIndexVali){ laSetWindowCursor(LA_LEFT_AND_RIGHT); }else{ laSetWindowCursor(LA_ARROW); }
+
+    if(Modal){ laRedrawCurrentPanel(); return LA_RUNNING; }
 
     return LA_RUNNING_PASS;
 }
 void la_AnimationActionCanvasInit(laUiItem *ui){
     la_CanvasInit(ui);
-    laCanvasExtra* e=ui->Extra; e->LW=LA_RH*7; e->ShowLegend=1;
+    laCanvasExtra* ex=ui->Extra; ex->LW=LA_RH*7; ex->ShowLegend=1;
 }
 void la_AnimationActionDrawCanvas(laBoxedTheme *bt, laAction *aa, laUiItem* ui){
-    laCanvasExtra* e=ui->Extra; //laAction* aa=ui->PP.EndInstance;
+    laCanvasExtra* ex=ui->Extra; //laAction* aa=ui->PP.EndInstance;
     int W, H; W = ui->R - ui->L; H = ui->B - ui->U; if (W<=0 || H<=0) return;
-    int ShowSide=(e->ShowLegend&&e->LW<W-2*LA_RH);
-    int ll=ui->L, lr=ll+(ShowSide?e->LW:0), tl=lr, tr=ui->R;
+    int ShowSide=(ex->ShowLegend&&ex->LW<W-2*LA_RH);
+    int ll=ui->L, lr=ll+(ShowSide?ex->LW-1:0), tl=lr, tr=ui->R;
+    int FW=LA_RH/2;
 
     //if (!e->OffScr || e->OffScr->pColor[0]->Height != ui->B - ui->U || e->Be.OffScr->pColor[0]->Width != ui->R - ui->L){
     //    if (e->OffScr) tnsDelete2DOffscreen(e->OffScr);
     //    e->OffScr = tnsCreate2DOffscreen(GL_RGBA, W, H, MAIN.PanelMultisample, 1, 0);
     //}
+
+    real *bkg=laThemeColor(bt,LA_BT_NORMAL);
+    real *txt=laThemeColor(bt,LA_BT_TEXT);
+    real *act=laThemeColor(bt,LA_BT_ACTIVE);
     tnsUseNoTexture();
+    tnsColor4d(LA_COLOR3(bkg),bkg[3]*0.3);
+    tnsVertex2d(tl, ui->U); tnsVertex2d(tr, ui->U);
+    tnsVertex2d(tr, ui->B); tnsVertex2d(tl, ui->B);
+    tnsPackAs(GL_TRIANGLE_FAN);
 
-    tnsColor4dv(laThemeColor(bt,LA_BT_BORDER));
-    tnsVertex2d(ui->L, ui->U); tnsVertex2d(ui->R, ui->U);
-    tnsVertex2d(ui->R, ui->B); tnsVertex2d(ui->L, ui->B);
-    tnsPackAs(GL_LINE_LOOP);
+    int row=1,curframe,cx; real fl,fr;
+
+    tnsColor4dv(laThemeColor(bt,LA_BT_NORMAL));
+    tnsVertex2d(ui->L, ui->U+bt->TP+LA_RH); tnsVertex2d(ui->R, ui->U+bt->TP+LA_RH);
+    tnsVertex2d(ui->R, ui->U); tnsVertex2d(ui->L, ui->U);
+    tnsPackAs(GL_TRIANGLE_FAN);
+
+    tnsColor4dv(laThemeColor(bt,LA_BT_TEXT));
+    tnsVertex2d(tl, LA_RH+ui->U); tnsVertex2d(tr, LA_RH+ui->U);
+    tnsPackAs(GL_LINES);
+
+    tnsFlush();
+    int sx,sy,sw,sh,vl,vr,vu,vb;
+    la_DoUiScissor(ui,&sx,&sy,&sw,&sh,&vl,&vr,&vu,&vb);
+
+    if(aa){
+        curframe=LA_ACTION_FRAME(aa); fl=tl+curframe*FW*ex->ZoomX-ex->PanX, fr=tl+(curframe+1)*FW*ex->ZoomX-ex->PanX;
+        tnsUseNoTexture();
+        tnsColor4dv(laAccentColor(LA_BT_NORMAL));
+        tnsVertex2d(fl, ui->U); tnsVertex2d(fr, ui->U);
+        tnsVertex2d(fr, ui->B); tnsVertex2d(fl, ui->B);
+        tnsPackAs(GL_TRIANGLE_FAN);
+        tnsFlush(); glLineWidth(2);
+        for(laActionChannel* ac=aa->Channels.pFirst;ac;ac=ac->Item.pNext){
+            real ku=ui->U+bt->TP+row*LA_RH-ex->PanY,kb=ku+LA_RH;
+            for(laActionKey* ak=ac->Keys.pFirst;ak;ak=ak->Item.pNext){
+                real kl=tl+ak->At*FW*ex->ZoomX-ex->PanX, kr=tl+(ak->At+1)*FW*ex->ZoomX-ex->PanX;
+                if(curframe==ak->At) tnsColor4d(LA_COLOR3(txt),txt[3]*0.6);
+                else tnsColor4dv(laThemeColor(bt,LA_BT_ACTIVE));
+                tnsVertex2d(kl, ku); tnsVertex2d(kr, ku);
+                tnsVertex2d(kr, kb); tnsVertex2d(kl, kb);
+                tnsPackAs(GL_TRIANGLE_FAN);
+                tnsColor4dv(laThemeColor(bt,LA_BT_TEXT_ACTIVE));
+                tnsVertex2d(kl, ku); tnsVertex2d(kr, ku);
+                tnsVertex2d(kr, kb); tnsVertex2d(kl, kb);
+                tnsPackAs(GL_LINE_LOOP);
+            }
+            row++;
+        }
+        tnsFlush(); glLineWidth(1);
+
+        tnsColor4dv(laAccentColor(LA_BT_TEXT_ACTIVE));
+        cx=tl+aa->PlayHead*aa->FrameCount*FW*ex->ZoomX-ex->PanX; tnsVertex2d(cx, ui->U); tnsVertex2d(cx, ui->B);
+        tnsPackAs(GL_LINES); glLineWidth(3); tnsFlush(); glLineWidth(1);
+        tnsColor4dv(laAccentColor(LA_BT_TEXT_ACTIVE));
+        tnsVertex2d(cx, ui->U+LA_RH); tnsVertex2d(cx+LA_RH, ui->U+LA_RH);
+        tnsVertex2d(cx+LA_RH, ui->U); tnsVertex2d(cx, ui->U);
+        tnsPackAs(GL_TRIANGLE_FAN);
+        char buf[32]; sprintf(buf,"%d",curframe);
+        tnsDrawStringAuto(buf,laThemeColor(bt,LA_BT_TEXT_ACTIVE),cx+bt->LP,cx+LA_RH*2,ui->U+bt->TP,0);
+        tnsPackAs(GL_TRIANGLE_FAN); tnsUseNoTexture();
+    }
 
     if(ShowSide){
         tnsColor4dv(laThemeColor(bt,LA_BT_NORMAL));
         tnsVertex2d(ll, ui->U); tnsVertex2d(lr, ui->U);
         tnsVertex2d(lr, ui->B); tnsVertex2d(ll, ui->B);
         tnsPackAs(GL_TRIANGLE_FAN);
+        if(!aa){
+            tnsDrawStringAuto("No action selected",laThemeColor(bt,LA_BT_TEXT),ll+bt->LP,lr-bt->RP,ui->U+bt->BP,0);
+        }else{ int row=1;
+            for(laActionChannel* ac=aa->Channels.pFirst;ac;ac=ac->Item.pNext){
+                tnsDrawStringAuto(ac->CachedName->Ptr,laThemeColor(bt,LA_BT_TEXT),ll+bt->LP,lr-bt->RP,ui->U+bt->TP+row*LA_RH-ex->PanY,0);
+                row++;
+            }
+        }
+    }
+    if(ex->TargetIndexVali==1){
+        int LR=TNS_MAX2(lr,ui->L+LA_SEAM_W*2);
+        tnsColor4dv(act);tnsUseNoTexture();
+        tnsVertex2d(LR, ui->B); tnsVertex2d(LR-LA_SEAM_W*2, ui->B);
+        tnsVertex2d(LR-LA_SEAM_W*2, ui->U); tnsVertex2d(LR, ui->U);
+        tnsPackAs(GL_TRIANGLE_FAN);
     }
+
+    tnsFlush();
+    tnsViewportWithScissor(sx,sy,sw,sh);
+    tnsOrtho(vl,vr,vb,vu,-100,100);
+
+    tnsUseNoTexture();
+    tnsColor4dv(laThemeColor(bt,LA_BT_BORDER));
+    tnsVertex2d(ui->L, ui->U); tnsVertex2d(ui->R, ui->U);
+    tnsVertex2d(ui->R, ui->B); tnsVertex2d(ui->L, ui->B);
+    tnsPackAs(GL_LINE_LOOP);
 }
 void la_AnimationActionDrawOverlay(laUiItem *ui, int h){
     laCanvasExtra *e = ui->Extra; laBoxedTheme *bt = (*ui->Type->Theme);

+ 13 - 0
la_data.c

@@ -1981,6 +1981,19 @@ int laSetRaw(laPropPack *pp, void* data, int _size){
     } return 0;
 }
 
+int laTryGetInstanceIdentifier(void* Instance, laPropContainer* pc, char* identifier, char** here){
+    laProp* p=la_PropLookupIdentifierItem(&pc->Props);
+    if(p){
+        laPropPack PP={0}; laPropStep PS={0};
+        PS.p=p; PS.Type='.'; PS.UseInstance=Instance; PP.LastPs=&PS; PP.EndInstance=Instance;
+        if(p->PropertyType==LA_PROP_STRING){ laGetString(&PP,identifier,here); }
+        elif(p->PropertyType&LA_PROP_INT){ int r[16]={0}; laGetIntArray(&PP,r); sprintf("(%s=%d)",p->Identifier,r[0]); }
+        elif(p->PropertyType&LA_PROP_FLOAT){ real r[16]={0}; laGetFloatArray(&PP,r); sprintf("(%s=%lf)",p->Identifier,r[0]); }
+        elif(p->PropertyType&LA_PROP_ENUM){  laEnumItem *r[16]={0}; laGetEnumArray(&PP,r); sprintf("(%s=%lf)",p->Identifier,r[0]?r[0]->Identifier:"?"); }
+        else{ sprintf("(%.6x)",identifier); }
+    }
+}
+
 int laGetIntRange(laPropPack *pp, int *min, int *max){
     laIntProp *p = pp->LastPs->p;
     if (p->Max != p->Min){

+ 4 - 1
la_data.h

@@ -680,6 +680,7 @@ STRUCTURE(laActionChannel){
     laListItem Item;
     void* For;
     laProp* Prop;
+    laSafeString* CachedName;
     int DataSize; // sizeof
     laListHandle Keys;
 };
@@ -690,7 +691,7 @@ STRUCTURE(laActionKey){
 };
 
 #define LA_ACTION_FRAME(aa)\
-    (aa->PlayHead*(real)aa->FrameCount+0.5)
+    (aa->PlayHead*(real)aa->FrameCount)
 
     //STRUCTURE(laUDFFailNode) {
     //	laListItemPointer Item;
@@ -825,6 +826,8 @@ int laGetFloatRange(laPropPack *pp, real *min, real *max);
 void* laGetRaw(laPropPack *pp, int* r_size, int* return_is_a_copy);
 int laSetRaw(laPropPack *pp, void* data, int _size);
 
+int laTryGetInstanceIdentifier(void* Instance, laPropContainer* pc, char* identifier, char** here);
+
 void laMarkPropChanged(laPropPack* pp);
 void laMarkMemChanged(void* memuser);
 void laMarkMemClean(void* memuser);

+ 4 - 1
la_interface.h

@@ -905,7 +905,7 @@ STRUCTURE(laCanvasExtra){
     real ClickedX;
     real ClickedY;
 
-    int LW,ShowLegend;
+    int LW,ShowLegend,UiMode;
 
     int HeightCoeff;
     //int        SnapBottom;
@@ -1900,6 +1900,9 @@ int laIsInBlockBotton2(laBlock *b, int X, int Y);
 laBlock *laClearBlockButtonRecursive(laBlock *b, laBlock *except);
 laBlock *laDetectBlockRecursive(laBlock *b, int X, int Y);
 
+void la_DoUiScissor(laUiItem* ui, int* savex, int* savey, int* savew, int* saveh,
+    int* savel, int* saver, int* saveu, int* saveb);
+
 laUiList *laPrepareUi(laPanel *p);
 laColumn *laFirstColumn(laUiList *uil);
 laColumn *laSplitColumn(laUiList *uil, laColumn *c, real Percent);

+ 14 - 3
la_kernel.c

@@ -1436,9 +1436,9 @@ int la_SetUpUiListMatrix(laUiListDraw *uild, laUiList *Target, int _L, int _R, i
         return 0;
     }
 
-    tnsViewportWithScissor(uildi->L, PanelH - uildi->B, uildi->R - uildi->L, uildi->B - uildi->U-1);
-    tnsOrtho(Target->L + Target->PanX + uildi->DifX,
-             Target->L + Target->PanX + uildi->DifX+ (uildi->R - uildi->L),
+    tnsViewportWithScissor(uildi->L-1, PanelH - uildi->B, uildi->R - uildi->L+1, uildi->B - uildi->U-1);
+    tnsOrtho(Target->L + Target->PanX + uildi->DifX-1,
+             Target->L + Target->PanX + uildi->DifX+1+ (uildi->R - uildi->L),
              Target->U + Target->PanY + uildi->DifY+ (uildi->B - uildi->U),
              Target->U + Target->PanY + uildi->DifY+1,
              -100, 100);
@@ -1485,6 +1485,17 @@ void la_SetUpUiListMatrixInLine(laUiListDraw *uild, int L, int R, int U, int B,
     lstPushItem(&uild->Items, uildi);
 }
 
+void la_DoUiScissor(laUiItem* ui, int* savex, int* savey, int* savew, int* saveh,
+    int* savel, int* saver, int* saveu, int* saveb){
+    laPanel* panel=MAIN.PropMatcherContextP; int PW=panel->W, PH=panel->H;
+    *savex=T->vsx;*savey=T->vsy;*savew=T->vsw;*saveh=T->vsh;
+    *savel=T->vol;*saver=T->vor;*saveu=T->vou;*saveb=T->vob;
+    real p[3]={0}, tp[3]={0}; tnsMatrix44d m; tnsGetMVPMatrix(m);
+    real x,y,w,h;
+    x=TNS_MAX2(ui->L,T->vsx); y=TNS_MAX2(PH-ui->B,T->vsy);
+    w=TNS_MIN2(ui->R-ui->L,T->vsw); h=TNS_MIN2(ui->B-ui->U,T->vsh);
+    tnsViewportWithScissor(x,y,w,h); tnsOrtho(ui->L,ui->R,ui->B,ui->U,-100,100);
+}
 void la_RebuildCurrentUiListMatrix(laUiListDraw *uild, laUiList *Target, int LimH, int PanelH){
     laUiListDrawItem *uildi = uild->Items.pFirst;
 

+ 5 - 5
la_resource.c

@@ -140,7 +140,7 @@ void la_RegisterMainThemes(){
 
     t = laDesignTheme("Classic Light", "YimingWu");{
         LA_SET3(t->Color, 0.58,0.58,0.55);
-        LA_SET3(t->AccentColor, 0.1,0.1,0.4);
+        LA_SET3(t->AccentColor, 0.27,0.47,0.79);
         t->InactiveMix=0.7; t->InactiveSaturation=0.2;
         t->CursorAlpha=0.9; t->SelectionAlpha=0.3;
         t->WireBrightness=0.5; t->WireSaturation=0.6; t->WireTransparency=0.65;
@@ -171,9 +171,9 @@ void la_RegisterMainThemes(){
         laDesignBoxedTheme(t, "Collection Item",&_LA_THEME_COLLECTION_ITEM,
             0.75, 0.65, 0.2, 0.1, 0.7, 0.3, 1, 1, 0, 0, 1, 1, 1, 1);
         laDesignBoxedTheme(t, "3D Viewer",&_LA_THEME_3D_VIEW,
-            0.75, 0.65, 0.2, 0.1, 0.7, 0.3, 1, 1, 1, 1, 1, 1, 1, 1);
+            0.75, 0.6, 0.50, 0.1, 0.92, 0.6, 1, 1, 1, 1, 1, 1, 1, 1);
         laDesignBoxedTheme(t, "2D Viewer",&_LA_THEME_2D_VIEW,
-            0.75, 0.65, 0.2, 0.1, 0.7, 0.3, 1, 1, 1, 1, 1, 1, 1, 1);
+            0.75, 0.6, 0.50, 0.1, 0.92, 0.6, 1, 1, 1, 1, 1, 1, 1, 1);
 
         la_RefreshThemeColor(t);
     }
@@ -216,9 +216,9 @@ void la_RegisterMainThemes(){
         bt = laDesignBoxedTheme(t, "Collection Item",&_LA_THEME_COLLECTION_ITEM,
             0.25, 0.35, 0.8, 0.7, 0.1, 0.3, 1, 1, 0, 0, 1, 1, 1, 1);
         bt = laDesignBoxedTheme(t, "3D Viewer",&_LA_THEME_3D_VIEW,
-            0.25, 0.35, 0.8, 0.7, 0.1, 0.3, 1, 1, 1, 1, 1, 1, 1, 1);
+            0.25, 0.5, 0.5, 0.7, 0.1, 0.6, 1, 1, 1, 1, 1, 1, 1, 1);
         bt = laDesignBoxedTheme(t, "2D Viewer",&_LA_THEME_2D_VIEW,
-            0.25, 0.35, 0.8, 0.7, 0.1, 0.3, 1, 1, 1, 1, 1, 1, 1, 1);
+            0.25, 0.5, 0.55, 0.7, 0.1, 0.6, 1, 1, 1, 1, 1, 1, 1, 1);
 
         la_RefreshThemeColor(t);
     }

+ 3 - 0
la_tns.h

@@ -194,6 +194,9 @@ struct _tnsMain {
 
     tnsMatrixStack stack;
 
+    int vsx,vsy,vsw,vsh;//for saving scissor etc.
+    int vol,vor,vou,vob;//for saving ortho etc.
+
     laListHandle Shaders;
     int NextShaderIndex;
     tnsShader *CurrentShader;

+ 4 - 2
la_tns_kernel.c

@@ -136,8 +136,8 @@ void tnsSwitchToCurrentWindowContext(void *wnd){
 void tnsViewportWithScissor(int x, int y, int w, int h){
     tnsShader *current_shader = 0;
     glEnable(GL_SCISSOR_TEST);
-    glViewport(x, y, w, h);
-    glScissor(x, y, w, h);
+    glViewport(x, y, w, h); glScissor(x, y, w, h);
+    T->vsx=x;T->vsy=y;T->vsw=w;T->vsh=h;
     if ((current_shader = tKnlGetActiveShader())){
         tnsResetViewMatrix();
         tnsShaderApplyView(current_shader, tnsGetViewMatrix());
@@ -1153,6 +1153,8 @@ void tnsOrtho(real xMin, real xMax, real yMin, real yMax, real zMin, real zMax){
     tnsShader *current_shader = 0;
     real *mat = tnsGetProjectionMatrix();
 
+    T->vol=xMin; T->vor=xMax; T->vou=yMax; T->vob=yMin;
+
     tnsMakeOrthoMatrix44d(mat, xMin, xMax, yMin, yMax, zMin, zMax);
 
     if (current_shader = tKnlGetActiveShader()){

+ 0 - 7
resources/la_properties.c

@@ -548,13 +548,6 @@ void *tnsget_PreviewTexture(void *UNUSED){
 void *tnsset_PreviewTexture(void *UNUSED_PARENT, void *tex, int UNUSEDSTATE){
     T->PreviewTexture = tex;
 }
-void tnsget_ObjectName(tnsObject *s, char *result){
-    if (!s->Name) return;
-    strCopyFull(result, s->Name->Ptr);
-}
-void tnsset_ObjectName(tnsObject *s, char *content){
-    strSafeSet(&s->Name, content);
-}
 void *tnsget_NextLinkedObject(tnsObject *o, laPropIterator *pi){
     pi->Linker = ((laListItemPointer *)pi->Linker->pNext);
     return pi->Linker->p;

+ 2 - 2
resources/la_widgets_viewers.c

@@ -724,9 +724,9 @@ int OPMOD_Canvas(laOperator *a, laEvent *e){
             ex->Dragging=1; ex->ClickedX=e->x; ex->ClickedY=e->y; ex->TargetIndexVali=ui->Expand;
             return LA_RUNNING;
         }
-        if(ex->Dragging){
+        if(ex->Dragging==1){
             if(e->Type==LA_MOUSEMOVE){ ui->Expand=ex->TargetIndexVali+((real)e->y-ex->ClickedY+0.5)/LA_RH;
-                if(ex->HeightCoeff<1) ex->HeightCoeff=1; printf("%d\n",ex->HeightCoeff);laRecalcCurrentPanel(); }
+                if(ex->HeightCoeff<1) ex->HeightCoeff=1; laRecalcCurrentPanel(); }
             elif(e->Type==LA_L_MOUSE_UP){ ex->Dragging=0; }
             elif(e->Type==LA_R_MOUSE_DOWN){ ex->Dragging=0; ui->Expand=ex->TargetIndexVali; laRecalcCurrentPanel(); }
             return LA_RUNNING;