I can not load a character in .py

Hello,

I do not have the module editor, because it is broke, and I can not
load manually an actor, or character, it says it can not find the url. I can not paste the script here, but I believe the problem is obvious.

Question; If you want to load a new Actor, what kind of url do you type in?

Thank you in advance for your help.

Regards,

Bart

it’s not really an url (like used in your browser addres).
it’s just the path to the file. usualy the py-files starts at the place where itself is located.
if you put your py script and your actor model in the same directory you can load it with just the filename.
if you have it somewhere else you need to point to there.
in example you have the actor in a subfolder called “modells”
in this case you need to load “/modells/actor.egg”
i think the whole pathing uses unix style pathnames. so directorys are seperated with / and it’s case-sensitive.

actually you should be able to find everything above in the tutorials and the manual.

import direct.directbase.DirectStart from direct.task import Task from direct.actor import Actor import math #Load the first environment model environ = loader.loadModel(“models/environment”) environ.reparentTo(render) environ.setScale(0.25,0.25,0.25) environ.setPos(-8,42,0) #Task to move the camera def SpinCameraTask(task): angledegrees = task.time * 6.0 angleradians = angledegrees * (math.pi / 180.0) base.camera.setPos(20math.sin(angleradians),-20.0math.cos(angleradians),3) base.camera.setHpr(angledegrees, 0, 0) return Task.cont taskMgr.add(SpinCameraTask, “SpinCameraTask”)

#Load the panda actor, and loop its animation
pandaActor = Actor.Actor(“models/bvw_f2004_babydino/babyd.egg”,{“walk”:“models/babydani.egg”})
pandaActor.setScale(0.005,0.005,0.005)
pandaActor.reparentTo(render)
pandaActor.loop(“walk”) run()

I have reorganized only the last part, the first was messed up a bit.

The path is in all other scripts the same. I only think that there is something wrong with the array name or it says can not find the name or something, after run. I should have copied the syntax error of course.

Thanks in advance,

Regards,

Bart

the error message would greatly help in clearify what’s wrong

are you shure that the animation file is in a different folder than the actual model file? the py file has to be in the same folder as the “models” directory but i think this is not the problem.

and of you post code… just use the code function, makes it easyer to read.
if you checked the above stuff and still get errors please post the error output. =) otherwise it’s just “guessing errors”

I have about the following error;

Warning: DirectNotify: category ‘Interval’ already exists
Known pipe types:
wglGraphicsPipe
(3 aux display modules not yet loaded.)
File “Scene_dani_walk.py”, line 23, in ?
pandaActor.reparentTo(render)
NameError: name ‘pandaActor’ is not defined

I did not have the .py file in the same dirctory of the .egg files, but I assume that it can read the path since it is in the system directory.

Thank you regards,

Bart
[/code]

Sounds like pipeline problem to me.
What modeller do you use ?
Are you sure you exported your animation in the correct way ?
You splitted your model-animation export, right ?

About the location :
say your script is in /myDino, then the location of :

  • your model file must be in : …/myDino/models/bvw_f2004_babydino
  • your animation file must be in : …/myDino/models

One more important thing : it’s CASE SENSITIVE !

Warning: DirectNotify: category ‘Interval’ already exists
Known pipe types:
wglGraphicsPipe
(3 aux display modules not yet loaded.)
File “Scene_dani_walk.py”, line 23, in ?
pandaActor.reparentTo(render)
NameError: name ‘pandaActor’ is not defined

I do not think it is the pipe line problem, but I do not understand syntax errors, so if somebody can explain this, thank you in advance.

Regards,

Bart

I see that there it is a pipe issue, but it says that there are three issues not loaded,

I think I have to think this over, but a working script is still far from now.

Regards,

Bart

You sould ignore this text:

Warning: DirectNotify: category 'Interval' already exists
Known pipe types:
wglGraphicsPipe
(3 aux display modules not yet loaded.) 

This is the normal startup messages of Panda. The first line is a meaningless warning that no one has gotten around to fixing. The remaining three lines are for your information: they are telling you that Panda is using OpenGL, but might still be able to use DX8 or DX9 (and possibly DX7) if OpenGL doesn’t work out.

The actual error message, referring to the variable called pandaActor, has nothing to do with Panda or with your models. This is an error message generated by Python. It’s saying that you are referencing a variable called pandaActor, which you have not yet assigned anything to. The assignment is normally a line that looks like “pandaActor = blahdyblah”, so it follows that something is wrong with that line.

David

Try to check your model & anim with Pview, if it’s OK, then your script is messed up !
Are you sure about the cAsE in your script :

pandaActor = Actor.Actor("models/bvw_f2004_babydino/babyd.egg",{"walk":"models/babydani.egg"})

Remember :
bvw <> Bvw <> BVw <> BVW <> bVw <>bvW

Hello again,

This is the code;


import direct.directbase.DirectStart 
from direct.task import Task 
from direct.actor import Actor 
import math 

#Load the first environment model 
environ = loader.loadModel("models/environment") 
environ.reparentTo(render) 
environ.setScale(0.25,0.25,0.25) 
environ.setPos(-8,42,0) 

#Task to move the camera 
def SpinCameraTask(task): 
  angledegrees = task.time * 6.0 
  angleradians = angledegrees * (math.pi / 180.0) 
  base.camera.setPos(20*math.sin(angleradians),-20.0*math.cos(angleradians),3) 
  base.camera.setHpr(angledegrees, 0, 0) 
  return Task.cont 

taskMgr.add(SpinCameraTask, "SpinCameraTask") 

#Load the panda actor, and loop its animation  
nodePath = Actor.Actor() 
nodePath.loadModel("models/babyd.egg")
babyd.reparentTo(render) 


run() 

If you can check this out, I have downloaded the babyd from this site,
to make sure I could do this with another model than the panda, but
its happens to be that it is not working so far.

Thanks in advance for your help.

Regards,

Bart

Hey, nothing is wrong with babydino model & animation.
It works well, so it’s absolutely your mistake.

  • the filename & location could be mistyped
  • the filename & location could be in incorrect case
    to disable case sensitive (default), you can change the “vfs-case-sensitive” to 0 in your config.prc file (on \etc).

For more interesting view, try this :

import direct.directbase.DirectStart 
from direct.task import Task 
from direct.actor import Actor 
import math 

#Load the first environment model 
environ = loader.loadModel("models/environment") 
environ.reparentTo(render) 
environ.setScale(0.25,0.25,0.25) 
environ.setPos(-8,42,0) 
environ.setTwoSided(1)


#Task to move the camera 
def SpinCameraTask(task): 
	angledegrees = task.time * 50.0 
	angleradians = angledegrees * (math.pi / 180.0) 
	base.camera.setPos(90*math.sin(angleradians),-90.0*math.cos(angleradians),50) 
	base.camera.setHpr(angledegrees, 0, 0) 
	#to keep the camera look at (0,0,0), close to the babydino
         base.cam.lookAt(render)
	return Task.cont 

taskMgr.add(SpinCameraTask, "SpinCameraTask") 

#Load the panda actor, and loop its animation 
babyd = Actor.Actor("babyd.egg",{"walk":"babydani.egg"})
babyd.reparentTo(render)
babyd.setPos(10,-80,3.5)
babyd.loop("walk") 

run()

I put the model & anim files on the same location with the script file.

FYI, to enable the BBcode, goto your profile and set “Always allow BBCode” to yes.

Ah Ha! I think I know what’s wrong. The bvw_f2004_babydino folder is ‘nested’ meaning that there is another bvw_f2004_babydino folder inside the first.

So what I did was open the folder and copy all the model files to the ‘models’ folder in my Panda3D project folder (NOT the main Panda3D directory, just a different folder where I save and run all my scripts from), then I ran this script to test it:

import direct.directbase.DirectStart
from pandac.PandaModules import *
from direct.actor import Actor # To use animated Actors

base.disableMouse() #Disable mouse-based camera-control.
camera.setPosHpr(Vec3(0, -15, 20),Vec3(0, -15, 0)) #Position the camera.

#Load a model
player = Actor.Actor("models/babyd",{"walk":"models/babydani"})
player.reparentTo(render) #Make it display in the scene
player.loop("walk") #Play the animation 

run() 

It works a charm. Hope it helps.

Hello again…

I have seen the problem, the problem was finally that I could not see the dino because it was scaled down so much I could not see it. I had
some variable problems too I think to call the Actor or something, but this was my first attempt to do anything. The baby dino though is a real
mess when you convert it to DXF by example, all faces are free from
one another and I could not scale it myself. So thanks for the script and I hope not to have too much trouble next time.

Regards,

Bart