jwildfire.org

The official JWildfire forum
It is currently Thu Feb 25, 2021 7:36 pm

All times are UTC+01:00




Post new topic This topic is locked, you cannot edit posts or make further replies.  [14 posts ]  Go to pagePrevious12
Author Message
 Post subject: Re: JWildfire 2.60 BETA
PostPosted:Tue Sep 29, 2015 11:53 pm 
Offline
User avatar

Joined:Sun May 31, 2015 2:39 pm
Posts:678
Quote:
Just call the setter for priority and specify on of the values -1, 0 or 1. It is a little flaw in the api that any value is possible, so you could also give a value of 42. But this will not lead to any interesting result, so please only use -1, 0 or 1.

If I wanted to set the julian as post how would I do it? how do I call the setter??
Code:
import org.jwildfire.create.tina.base.Flame;
import org.jwildfire.create.tina.base.XForm;
import org.jwildfire.create.tina.palette.RGBPalette;
import org.jwildfire.create.tina.script.ScriptRunnerEnvironment;
import org.jwildfire.create.tina.transform.XFormTransformService;
import org.jwildfire.create.tina.base.Layer;
import org.jwildfire.create.tina.variation.VariationFunc;
import org.jwildfire.create.tina.variation.VariationFuncList;
import org.jwildfire.create.tina.mutagen.RandomGradientMutation;
import org.jwildfire.create.tina.transform.XFormTransformService;
import org.jwildfire.create.tina.base.EditPlane;

public void run(ScriptRunnerEnvironment pEnv) throws Exception {
  // create a new flame
  Flame flame=new Flame();
  flame.getLayers().clear(); // get rid of the default layer because we create all layers by ourselves
  // set the flame main attributes
  flame.setCamRoll(0);
  flame.setCamPitch(0);
  flame.setCamYaw(0);
  flame.setCamPerspective(0);
  flame.setWidth(401);
  flame.setHeight(301);
  flame.setPixelsPerUnit(25.07294911);
  flame.setCamZoom(1);
  // create layer 1
  {
    Layer layer = new Layer();
    flame.getLayers().add(layer);
    layer.setWeight(1);
    layer.setVisible(true);
    // create a random gradient
    new RandomGradientMutation().execute(layer);
    // create transform 1
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.5);
      xForm.setColor(0);
      xForm.setColorSymmetry(0);

      xForm.setCoeff00(1); // a
      xForm.setCoeff10(0); // b
      xForm.setCoeff20(0); // e
      xForm.setCoeff01(0); // c
      xForm.setCoeff11(1); // d
      xForm.setCoeff21(0); // f

      xForm.setPostCoeff00(2.12118249);
      xForm.setPostCoeff10(-0.63897735);
      xForm.setPostCoeff01(0.63897735);
      xForm.setPostCoeff11(2.12118249);
      xForm.setPostCoeff20(0.83085792);
      xForm.setPostCoeff21(0.1470545);

      // variation 1
      {
        VariationFunc varFunc=VariationFuncList.getVariationFuncInstance("julian", true);
        varFunc.setParameter("power", 2);
        varFunc.setParameter("dist", 1);
        xForm.addVariation(1, varFunc);
      }
      // variation 2
      xForm.addVariation(0.508, VariationFuncList.getVariationFuncInstance("spherical", true));
      // set default edit plane
      flame.setEditPlane(EditPlane.XY);
      // random affine transforms (uncomment to play around)
      //   XFormTransformService.scale(xForm, 1.25-Math.random()*0.5, true, true, false);
      //   XFormTransformService.rotate(xForm, 360.0*Math.random(), false);
      //   XFormTransformService.localTranslate(xForm, 1.0-2.0*Math.random(), 1.0-2.0*Math.random(), false);
      // random affine post transforms (uncomment to play around)
      //   XFormTransformService.scale(xForm, 1.25-Math.random()*0.5, true, true, true);
      //   XFormTransformService.rotate(xForm, 360.0*Math.random(), true);
      //   XFormTransformService.localTranslate(xForm, 1.0-2.0*Math.random(), 1.0-2.0*Math.random(), true);
    }
  }
  // Either update the currently selected flame (to not need to create a new thumbnail
  // in the thumbnail ribbon after each run of the script...
  Flame selFlame = pEnv.getCurrFlame();
  if(selFlame!=null) {
    selFlame.assign(flame);
    pEnv.refreshUI();
  }
  // ...or load the flame in the editor and refresh the UI
  else {
    pEnv.setCurrFlame(flame);
  }
}


Top
   
 
 Post subject: Re: JWildfire 2.60 BETA
PostPosted:Wed Sep 30, 2015 1:19 am 
Offline
Site Admin
User avatar

Joined:Wed May 15, 2013 10:28 pm
Posts:1508
Quote:
Quote:
how do I call the setter??
For each property you may have a pair of methods: the setter (which writes the value) and the getter (which reads the value). Those usually start with "set" or "get".

So, when you have a property called "x", the setter will be "setX", and the getter "getX".

When the property is "priority", the setter will be "setPriority".

The only thing which is needed now is to know to which object the property belongs. This is the object on which you must invoke the setter.

As we have the priority added to variations, it will be the Variation-object, which is created when you add a variation, e.g in
Code:
xForm.addVariation(1, varFunc);
So, you can invoke the setter on this object:
Code:
xForm.addVariation(1, varFunc).setPriority(-1);


Top
   
 
 Post subject: Re: JWildfire 2.60 BETA
PostPosted:Wed Sep 30, 2015 5:24 pm 
Offline

Joined:Wed Sep 30, 2015 7:44 am
Posts:9
I got error message :
https://dl.dropboxusercontent.com/u/13451287/jwc.PNG
Code:
java.lang.NullPointerException
	at org.jwildfire.create.tina.mutagen.MutaGenController$RenderThread.forceAbort(Unknown Source)
	at org.jwildfire.create.tina.mutagen.MutaGenController.executeRenderThread(Unknown Source)
	at org.jwildfire.create.tina.mutagen.MutaGenController.renderFlame(Unknown Source)
	at org.jwildfire.create.tina.mutagen.MutaGenController.mutate(Unknown Source)
	at org.jwildfire.create.tina.mutagen.MutaGenController$5.mouseClicked(Unknown Source)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.awt.EventQueue.access$300(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)


Top
   
 
 Post subject: Re: JWildfire 2.60 BETA
PostPosted:Thu Oct 01, 2015 9:37 pm 
Offline
Site Admin
User avatar

Joined:Wed May 15, 2013 10:28 pm
Posts:1508
Quote:
Fixed in the next release


Top
   
 
Display posts from previous: Sort by 
Post new topic This topic is locked, you cannot edit posts or make further replies.  [14 posts ]  Go to pagePrevious12

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Limited
Theme Created by HOLLYSMOKE
Theme updated to phpBB 3.1.6 by KamijouTouma
Theme Version is 3.1.6-ss2